--- /dev/null
+/*\r
+ * Copyright (C) 2007-2012 Argeo GmbH\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package org.argeo.slc.core.build;\r
+\r
+import java.util.StringTokenizer;\r
+\r
+/**\r
+ * <p>\r
+ * An implementation of the distribution id using the standard\r
+ * Major.Minor.Release notation. And additional arbitrary string can also be\r
+ * added.\r
+ * </p>\r
+ * \r
+ * <p>\r
+ * <b>Examples:</b><br>\r
+ * 0.2.6<br>\r
+ * 2.4.12.RC1\r
+ * </p>\r
+ */\r
+public class VersionDistributionId {\r
+\r
+ private Integer major;\r
+ private Integer minor;\r
+ private Integer release;\r
+ private String additional;\r
+\r
+ /** Parse the provided string in order to set the various components. */\r
+ public void setVersionString(String str) {\r
+ StringTokenizer st = new StringTokenizer(str, ".");\r
+ if (st.hasMoreTokens())\r
+ major = Integer.parseInt(st.nextToken());\r
+ if (st.hasMoreTokens())\r
+ minor = Integer.parseInt(st.nextToken());\r
+ if (st.hasMoreTokens())\r
+ release = Integer.parseInt(st.nextToken());\r
+ if (st.hasMoreTokens())\r
+ additional = st.nextToken();\r
+ }\r
+\r
+ public Integer getMajor() {\r
+ return major;\r
+ }\r
+\r
+ public void setMajor(Integer major) {\r
+ this.major = major;\r
+ }\r
+\r
+ public Integer getMinor() {\r
+ return minor;\r
+ }\r
+\r
+ public void setMinor(Integer minor) {\r
+ this.minor = minor;\r
+ }\r
+\r
+ public Integer getRelease() {\r
+ return release;\r
+ }\r
+\r
+ public void setRelease(Integer release) {\r
+ this.release = release;\r
+ }\r
+\r
+ public String getAdditional() {\r
+ return additional;\r
+ }\r
+\r
+ public void setAdditional(String additional) {\r
+ this.additional = additional;\r
+ }\r
+\r
+ @Override\r
+ public boolean equals(Object obj) {\r
+ // TODO Auto-generated method stub\r
+ return super.equals(obj);\r
+ }\r
+\r
+ @Override\r
+ public String toString() {\r
+ return major + "." + minor + "." + release\r
+ + (additional != null ? "." + additional : "");\r
+ }\r
+\r
+}\r