View Javadoc

1   /*
2   @See License.txt@
3    */
4   
5   package spellcast.net;
6   
7   import java.io.*;
8   
9   /***
10   * This class contains the version details.
11   *
12   * @author Barrie Treloar
13   */
14  public class VersionDetails implements Serializable
15  {
16      private String programName;
17      private int majorVersionNumber;
18      private int minorVersionNumber;
19      private int revisionVersionNumber;
20  
21      /***
22       * Provide the actual values for the version numbers.
23       *
24       * @param programName the name of the program creating the packet
25       * @param majorVersionNumber the major version number
26       * @param minorVersionNumber the minor version number
27       * @param revisionVersionNumber the revision version number
28       */
29      public VersionDetails( String programName,
30                             int majorVersionNumber,
31                             int minorVersionNumber,
32                             int revisionVersionNumber )
33                             
34      {
35          this.programName = programName;
36          this.majorVersionNumber = majorVersionNumber;
37          this.minorVersionNumber = minorVersionNumber;
38          this.revisionVersionNumber = revisionVersionNumber;
39      }
40  
41      /***
42       * Copy constructor.  This constructor copies the values out of the object
43       * provided and uses them to construct a new object.
44       */
45      public VersionDetails( VersionDetails copy )
46      {
47          this( copy.getProgramName(),
48                copy.getMajorVersionNumber(),
49                copy.getMinorVersionNumber(),
50                copy.getRevisionVersionNumber() );
51      }
52  
53      /***
54       * Returns the name of the program that created this packet.
55       * The program is free to present any String as the representation of the program name.
56       */
57      public String getProgramName()
58      {
59          return programName;
60      }
61  
62      /***
63       * Returns the major version number for the program.
64       * As backwards incompatible changes are made the major version number is incremented.
65       * Two versions are only compatible if the major versions numbers are identical.
66       */
67      public int getMajorVersionNumber()
68      {
69          return majorVersionNumber;
70      }
71      
72      /***
73       * Returns the minor version number for the program.
74       * When a group of changes that do not affect the backwards compatibility are 
75       * bundled together to form a new release then the minor version number is incremented.
76       * The minor version number does not affect the compatibility.
77       */
78      public int getMinorVersionNumber()
79      {
80          return minorVersionNumber;
81      }
82      
83      /***
84       * Returns the revision version number for the program.
85       * The revision version number is used to indicate the build of the system.  
86       * Every time the system is modified and rebuilt this number is incremented.
87       * This number should be reset to zero when a minor release is made.
88       * The revision version number does not affect the compatibility.
89       */
90      public int getRevisionVersionNumber()
91      {
92          return revisionVersionNumber;
93      }
94  
95      public String toString() 
96      {
97          return programName + " (" + majorVersionNumber + "." + minorVersionNumber + "." +
98          revisionVersionNumber + ")";
99      }
100 
101 }