KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgroups > Version


1
2
3
4 package org.jgroups;
5
6
7 public class Version {
8     public static final String JavaDoc version="2.2.8";
9     public static byte[] version_id={'0', '2', '2', '8'};
10     public static final String JavaDoc cvs="$Id: Version.java,v 1.18.2.1 2005/05/30 09:47:56 belaban Exp $";
11
12     public static void main(String JavaDoc[] args) {
13         System.out.println("\nVersion: \t" + version);
14         System.out.println("CVS: \t\t" + cvs);
15         System.out.println("History: \t(see doc/history.txt for details)\n");
16     }
17
18
19     public static String JavaDoc printVersion() {
20         return "JGroups " + version + "[ " + cvs + "]";
21     }
22
23     public static String JavaDoc printVersionId(byte[] v, int len) {
24         StringBuffer JavaDoc sb=new StringBuffer JavaDoc();
25         if(v != null) {
26             if(len <= 0)
27                 len=v.length;
28             for(int i=0; i < len; i++)
29                 sb.append((char)v[i]);
30         }
31         return sb.toString();
32     }
33
34        public static String JavaDoc printVersionId(byte[] v) {
35         StringBuffer JavaDoc sb=new StringBuffer JavaDoc();
36         if(v != null) {
37             for(int i=0; i < v.length; i++)
38                 sb.append((char)v[i]);
39         }
40         return sb.toString();
41     }
42
43     /**
44      * Don't use this method; used by unit testing only.
45      * @param v
46      */

47     public static void setVersion(byte[] v) {
48         version_id=v;
49     }
50
51     public static boolean compareTo(byte[] v) {
52         if(v == null)
53             return false;
54         if(v.length < version_id.length)
55             return false;
56         for(int i=0; i < version_id.length; i++) {
57             if(version_id[i] != v[i])
58                 return false;
59         }
60         return true;
61     }
62
63     public static int getLength() {
64         return version_id.length;
65     }
66
67 }
Popular Tags