]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/build/VersionDistributionId.java
Remove legacy code
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / build / VersionDistributionId.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.argeo.slc.core.build;
17
18 import java.util.StringTokenizer;
19
20 /**
21 * <p>
22 * An implementation of the distribution id using the standard
23 * Major.Minor.Release notation. And additional arbitrary string can also be
24 * added.
25 * </p>
26 *
27 * <p>
28 * <b>Examples:</b><br>
29 * 0.2.6<br>
30 * 2.4.12.RC1
31 * </p>
32 */
33 public class VersionDistributionId {
34
35 private Integer major;
36 private Integer minor;
37 private Integer release;
38 private String additional;
39
40 /** Parse the provided string in order to set the various components. */
41 public void setVersionString(String str) {
42 StringTokenizer st = new StringTokenizer(str, ".");
43 if (st.hasMoreTokens())
44 major = Integer.parseInt(st.nextToken());
45 if (st.hasMoreTokens())
46 minor = Integer.parseInt(st.nextToken());
47 if (st.hasMoreTokens())
48 release = Integer.parseInt(st.nextToken());
49 if (st.hasMoreTokens())
50 additional = st.nextToken();
51 }
52
53 public Integer getMajor() {
54 return major;
55 }
56
57 public void setMajor(Integer major) {
58 this.major = major;
59 }
60
61 public Integer getMinor() {
62 return minor;
63 }
64
65 public void setMinor(Integer minor) {
66 this.minor = minor;
67 }
68
69 public Integer getRelease() {
70 return release;
71 }
72
73 public void setRelease(Integer release) {
74 this.release = release;
75 }
76
77 public String getAdditional() {
78 return additional;
79 }
80
81 public void setAdditional(String additional) {
82 this.additional = additional;
83 }
84
85 @Override
86 public boolean equals(Object obj) {
87 // TODO Auto-generated method stub
88 return super.equals(obj);
89 }
90
91 @Override
92 public String toString() {
93 return major + "." + minor + "." + release
94 + (additional != null ? "." + additional : "");
95 }
96
97 }