KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > release > BasicReleaseInfo


1 /*====================================================================
2
3  ObjectWeb GoTM project - http://gotm.objectweb.org
4  Contact: gotm@objectweb.org
5
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or any later version.
10
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  USA
20
21  Initial developer(s): Romain Rouvoy.
22  Contributor(s): ______________________________________.
23
24  ---------------------------------------------------------------------
25  $Id: BasicReleaseInfo.java,v 1.1 2004/02/27 19:07:20 rouvoy Exp $
26  ====================================================================*/

27
28 package org.objectweb.util.release;
29
30 /**
31  * Basic Implementation of the Release Info.
32  * @author <a HREF="mailto:Romain.Rouvoy@lifl.fr">Romain Rouvoy</a>
33  * @version 0.1
34  */

35 public class BasicReleaseInfo implements ReleaseInfo {
36
37     protected String JavaDoc nameLong;
38     protected String JavaDoc nameShort;
39     
40     protected short[] versionNumber = {1,0};
41     protected short[] specVersionNumber = {1,0};
42     
43     
44     /**
45      * Defines the long version of the name.
46      * @param nameLong The nameLong to set.
47      */

48     protected void setNameLong(String JavaDoc nameLong) {
49         this.nameLong = nameLong;
50     }
51
52     /**
53      * Defines the short version of the name.
54      * @param nameShort The nameShort to set.
55      */

56     protected void setNameShort(String JavaDoc nameShort) {
57         this.nameShort = nameShort;
58     }
59
60     /**
61      * Defines the Specification Version Number.
62      * @param specVersionNumber The specVersionNumber to set.
63      */

64     protected void setSpecVersionNumber(short[] specVersionNumber) {
65         this.specVersionNumber = specVersionNumber;
66     }
67
68     /**
69      * Defines the Implementation Version Number.
70      * @param versionNumber The versionNumber to set.
71      */

72     protected void setVersionNumber(short[] versionNumber) {
73         this.versionNumber = versionNumber;
74     }
75
76     /* (non-Javadoc)
77      * @see org.objectweb.util.release.Release#getNameLong()
78      */

79     public String JavaDoc getNameLong() {
80         return this.nameLong;
81     }
82
83     /* (non-Javadoc)
84      * @see org.objectweb.util.release.Release#getNameShort()
85      */

86     public String JavaDoc getNameShort() {
87         return this.nameShort;
88     }
89
90     /* (non-Javadoc)
91      * @see org.objectweb.util.release.Release#getVersionNumber()
92      */

93     public short[] getVersionNumber() {
94         return this.versionNumber;
95     }
96
97     /**
98      * Convert a short array into a string using the tag separator.
99      * @param number the short array to convert.
100      * @param tag the tag to use in the string for separating numbers.
101      * @return the resulting string (number[0]+tag+number[1]+tag+ ... +tag+number[length-1]).
102      */

103     protected static String JavaDoc toString(short[] number, String JavaDoc tag){
104         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
105         buffer.append(number[0]);
106         for (int i=1;i<number.length;i++) {
107             buffer.append(tag+number[i]);
108         }
109         return buffer.toString();
110     }
111     
112     /* (non-Javadoc)
113      * @see org.objectweb.util.release.Release#getVersion()
114      */

115     public String JavaDoc getVersion() {
116         return toString(getVersionNumber(),".");
117     }
118
119     /* (non-Javadoc)
120      * @see org.objectweb.util.release.Release#getSpecVersionNumber()
121      */

122     public short[] getSpecVersionNumber() {
123         return this.specVersionNumber;
124     }
125
126     /* (non-Javadoc)
127      * @see org.objectweb.util.release.Release#getSpecVersion()
128      */

129     public String JavaDoc getSpecVersion() {
130         return toString(getSpecVersionNumber(),".");
131     }
132
133     /* (non-Javadoc)
134      * @see org.objectweb.util.release.Release#getRelease()
135      */

136     public String JavaDoc getRelease() {
137         return getNameLong()+" Release "+getVersion();
138     }
139
140     /* (non-Javadoc)
141      * @see org.objectweb.util.release.Release#getReleaseTag()
142      */

143     public String JavaDoc getReleaseTag() {
144         return getNameLong()+"_"+toString(getVersionNumber(),"_");
145     }
146 }
147
Popular Tags