]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/build/VersionDistributionId.java
Improve JCR integration
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / build / VersionDistributionId.java
1 /*
2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
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
17 package org.argeo.slc.core.build;
18
19 import java.util.StringTokenizer;
20
21 /**
22 * <p>
23 * An implementation of the distribution id using the standard
24 * Major.Minor.Release notation. And additional arbitrary string can also be
25 * added.
26 * </p>
27 *
28 * <p>
29 * <b>Examples:</b><br>
30 * 0.2.6<br>
31 * 2.4.12.RC1
32 * </p>
33 */
34 public class VersionDistributionId {
35
36 private Integer major;
37 private Integer minor;
38 private Integer release;
39 private String additional;
40
41 /** Parse the provided string in order to set the various components. */
42 public void setVersionString(String str) {
43 StringTokenizer st = new StringTokenizer(str, ".");
44 if (st.hasMoreTokens())
45 major = Integer.parseInt(st.nextToken());
46 if (st.hasMoreTokens())
47 minor = Integer.parseInt(st.nextToken());
48 if (st.hasMoreTokens())
49 release = Integer.parseInt(st.nextToken());
50 if (st.hasMoreTokens())
51 additional = st.nextToken();
52 }
53
54 public Integer getMajor() {
55 return major;
56 }
57
58 public void setMajor(Integer major) {
59 this.major = major;
60 }
61
62 public Integer getMinor() {
63 return minor;
64 }
65
66 public void setMinor(Integer minor) {
67 this.minor = minor;
68 }
69
70 public Integer getRelease() {
71 return release;
72 }
73
74 public void setRelease(Integer release) {
75 this.release = release;
76 }
77
78 public String getAdditional() {
79 return additional;
80 }
81
82 public void setAdditional(String additional) {
83 this.additional = additional;
84 }
85
86 @Override
87 public boolean equals(Object obj) {
88 // TODO Auto-generated method stub
89 return super.equals(obj);
90 }
91
92 @Override
93 public String toString() {
94 return major + "." + minor + "." + release
95 + (additional != null ? "." + additional : "");
96 }
97
98 }