1 /*
2  * The Spread Toolkit.
3  *
4  * The contents of this file are subject to the Spread Open-Source
5  * License, Version 1.0 (the ``License''); you may not use
6  * this file except in compliance with the License.  You may obtain a
7  * copy of the License at:
8  *
9  * http://www.spread.org/license/
10  *
11  * or in the file ``license.txt'' found in this distribution.
12  *
13  * Software distributed under the License is distributed on an AS IS basis,
14  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
15  * for the specific language governing rights and limitations under the
16  * License.
17  *
18  * The Creators of Spread are:
19  *  Yair Amir, Michal Miskin-Amir, Jonathan Stanton.
20  *
21  *  Copyright (C) 1993-2004 Spread Concepts LLC <spread@spreadconcepts.com>
22  *
23  *  All Rights Reserved.
24  *
25  * Major Contributor(s):
26  * ---------------
27  *    Cristina Nita-Rotaru crisn@cs.purdue.edu - group communication security.
28  *    Theo Schlossnagle    jesus@omniti.com - Perl, skiplists, autoconf.
29  *    Dan Schoenblum       dansch@cnds.jhu.edu - Java interface.
30  *    John Schultz         jschultz@cnds.jhu.edu - contribution to process group membership.
31  *
32  */
33 
34 
35 
36 package spread;
37 
38 /**
39  * A SpreadVersion object is used to get the version of spread that is being used.
40  */
41 public class SpreadVersion
42 {
43 	// The major version.
44 	/////////////////////
45 	private int majorVersion = 3;
46 
47 	// The minor version.
48 	/////////////////////
49 	private int minorVersion = 16;
50 
51 	// The patch version.
52 	/////////////////////
53 	private int patchVersion = 1;
54 
55 	// Get the spread version.
56 	//////////////////////////
57 	/**
58 	 * Returns the spread version as a float.  The float is of
59 	 * the form A.B where A is the major version and B is the minor version.
60 	 * The patch version is not returned.
61 	 *
62 	 * @return  the spread version
63 	*/
getVersion()64 	public float getVersion()
65 	{
66 		return (float)((float)majorVersion + ((float)minorVersion / 100.0));
67 	}
68 
69 	// Get the major version.
70 	/////////////////////////
71 	/**
72 	 * Returns the spread major version as an int.
73 	 *
74 	 * @return  the spread major version
75 	 */
getMajorVersion()76 	public int getMajorVersion()
77 	{
78 		return majorVersion;
79 	}
80 
81 	// Get the minor version.
82 	/////////////////////////
83 	/** Returns the spread minor version as an int.
84 	 *
85 	 * @return  the spread minor version
86 	 */
getMinorVersion()87 	public int getMinorVersion()
88 	{
89 		return minorVersion;
90 	}
91 
92 	// Get the patch version.
93 	/////////////////////////
94 	/** Returns the spread patch version as an int.
95 	 *
96 	 * @return  the spread patch version
97 	 */
getPatchVersion()98 	public int getPatchVersion()
99 	{
100 		return patchVersion;
101 	}
102 
103 	// Convert to a string.
104 	///////////////////////
105 	/**
106 	 * Returns the spread version in string form.  The string is of
107 	 * the form A.BB.CC where A is the major version and BB is the minor version
108 	 * and CC is the patch version.
109 	 */
toString()110 	public String toString()
111 	{
112 		return new String(majorVersion + "." + (minorVersion / 10) + "" + (minorVersion % 10) + "." +
113 				  (patchVersion / 10) + (patchVersion % 10));
114 	}
115 }
116