]>
git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.core/src/org/argeo/slc/core/build/VersionDistributionId.java
c11dc00ea41645c11dcc5bea8fbf01c700434449
2 * Copyright (C) 2007-2012 Argeo GmbH
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.
16 package org
.argeo
.slc
.core
.build
;
18 import java
.util
.StringTokenizer
;
22 * An implementation of the distribution id using the standard
23 * Major.Minor.Release notation. And additional arbitrary string can also be
28 * <b>Examples:</b><br>
33 public class VersionDistributionId
{
35 private Integer major
;
36 private Integer minor
;
37 private Integer release
;
38 private String additional
;
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();
53 public Integer
getMajor() {
57 public void setMajor(Integer major
) {
61 public Integer
getMinor() {
65 public void setMinor(Integer minor
) {
69 public Integer
getRelease() {
73 public void setRelease(Integer release
) {
74 this.release
= release
;
77 public String
getAdditional() {
81 public void setAdditional(String additional
) {
82 this.additional
= additional
;
86 public boolean equals(Object obj
) {
87 // TODO Auto-generated method stub
88 return super.equals(obj
);
92 public String
toString() {
93 return major
+ "." + minor
+ "." + release
94 + (additional
!= null ?
"." + additional
: "");