]>
git.argeo.org Git - gpl/argeo-slc.git/blob - core/build/VersionDistributionId.java
2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org
.argeo
.slc
.core
.build
;
19 import java
.util
.StringTokenizer
;
23 * An implementation of the distribution id using the standard
24 * Major.Minor.Release notation. And additional arbitrary string can also be
29 * <b>Examples:</b><br>
34 public class VersionDistributionId
{
36 private Integer major
;
37 private Integer minor
;
38 private Integer release
;
39 private String additional
;
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();
54 public Integer
getMajor() {
58 public void setMajor(Integer major
) {
62 public Integer
getMinor() {
66 public void setMinor(Integer minor
) {
70 public Integer
getRelease() {
74 public void setRelease(Integer release
) {
75 this.release
= release
;
78 public String
getAdditional() {
82 public void setAdditional(String additional
) {
83 this.additional
= additional
;
87 public boolean equals(Object obj
) {
88 // TODO Auto-generated method stub
89 return super.equals(obj
);
93 public String
toString() {
94 return major
+ "." + minor
+ "." + release
95 + (additional
!= null ?
"." + additional
: "");