|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.simplegamenet.specs.to.Version
A version to check if a client and server are using compatible SimpleGameNet framework and game
module packages. A version consists out of one or several levels of int
values, each
considered more important then the next.
GameFactory
,
Serialized FormConstructor Summary | |
Version(int level0Value)
Initializes a newly created Version object with 1 level. |
|
Version(int[] levelValues)
Initializes a newly created Version object with a variable amount of levels. |
|
Version(int level0Value,
int level1Value)
Initializes a newly created Version object with 2 levels. |
|
Version(int level0Value,
int level1Value,
int level2Value)
Initializes a newly created Version object with 3 levels. |
Method Summary | |
int |
compareTo(Object object)
Compares two versions by comparing their level values, beginning from the highest level. |
boolean |
equals(Object object)
Compares this version to the specified object. |
String |
toString()
Returns the string representation of this Version. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Version(int level0Value)
Version
object with 1 level. It is recommended not
to use this constructor, but to use at least 2 levels to define a version instead.
level0Value
- the value of the only levelpublic Version(int level0Value, int level1Value)
Version
object with 2 levels.
level0Value
- the value of the first and most important levellevel1Value
- the value of the second and least important levelpublic Version(int level0Value, int level1Value, int level2Value)
Version
object with 3 levels.
level0Value
- the value of the first and most important levellevel1Value
- the value of the second levellevel2Value
- the value of the third levelpublic Version(int[] levelValues)
Version
object with a variable amount of levels.
levelValues
- the values of each level, starting with the most important level firstMethod Detail |
public boolean equals(Object object)
true
if and only if
the argument is not null
and is a version that represents the same sequence of
values as this version.
Versions with a different amount of levels are compared to the same amount of levels by
padding 0
values to the version with less levels. For example: 1.3, 1.3.0 and
1.3.0.0 are considered to be equal, while 1.4 and 1.4.1 are considered to be unequal.
object
- the object to compare this version against
true
if the versions are equalpublic int compareTo(Object object)
0
values to the version with less levels. For example: 1.3 compared to
1.3.0 will be considered equal, while 1.4 compared to 1.4.1 will be considered older.
compareTo
in interface Comparable
object
- the object to compare this version against
0
if the argument version is equal to this version, a value
less than 0
if this version is older than the argument and a value
greater than 0
if this version is newer than the argument.public String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |