|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sibvisions.util.Version
public class Version
The Version class is a simple representation for version numbers. It supports major, minor,
build and revision sequences, e.g. 2.0.0.1. The class supports parsing version strings.
| Nested Class Summary | |
|---|---|
static class |
Version.Level
the supported version levels. |
| Constructor Summary | |
|---|---|
Version(int pMajor)
Creates a new instance of Version with given major number. |
|
Version(int pMajor,
int pMinor)
Creates a new instance of Version with given major and minor
numbers.A negative number means ignore. |
|
Version(int pMajor,
int pMinor,
int pBuild)
Creates a new instance of Version with given numbers. |
|
Version(int pMajor,
int pMinor,
int pBuild,
int pRevision)
Creates a new instance of Version with given numbers. |
|
| Method Summary | |
|---|---|
int |
compareTo(Version pVersion)
|
int |
compareTo(Version pVersion,
Version.Level pLevel)
Compares this version with another version. |
boolean |
equals(java.lang.Object pObject)
|
int |
getBuild()
Gets the build number (x.x.3.x). |
Version.Level |
getLevel()
Gets the level of the last significant sequence, e.g. 2.0.1 will return Version.Level.Build. |
int |
getMajor()
Gets the major number (1.x.x.x). |
int |
getMinor()
Gets the minor number (x.2.x.x). |
int |
getRevision()
Gets the revision number (x.x.x.4). |
int |
hashCode()
|
boolean |
isGreater(Version pVersion)
Gets whether the current (this) version is greater than the given version. |
boolean |
isGreaterOrEqual(Version pVersion)
Gets whether the current (this) version is greater or equal than the given version. |
boolean |
isSmaller(Version pVersion)
Gets whether the current (this) version is smaller than the given version. |
boolean |
isSmallerOrEqual(Version pVersion)
Gets whether the current (this) version is smaller or equal than the given version. |
boolean |
isUndefined()
Gets whether the version is undefined. |
boolean |
isValid()
Gets whether this version number is a valid version number. |
static Version |
parse(long pVersion)
Parses a version number. |
static Version |
parse(java.lang.String pVersion)
Parses a version number. |
long |
toNumber()
Gets the full version number. |
long |
toNumber(Version.Level pLevel)
Gets the number representation of the version. |
java.lang.String |
toString()
Gets the version number as full string wih all sequences (major, minor, build, revision). |
java.lang.String |
toString(boolean pShort)
Gets a version for given level. |
java.lang.String |
toString(Version.Level pLevel)
Gets a version for given level. |
java.lang.String |
toString(Version.Level pLevel,
boolean pShort)
Gets a version string with all sequences up-to the given level. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Version(int pMajor)
Version with given major number. A negative number
means ignore.
pMajor - the major number
public Version(int pMajor,
int pMinor)
Version with given major and minor
numbers.A negative number means ignore.
pMajor - the major numberpMinor - the minor number
public Version(int pMajor,
int pMinor,
int pBuild)
Version with given numbers. A negative number
means ignore.
pMajor - the major numberpMinor - the minor numberpBuild - the build number
public Version(int pMajor,
int pMinor,
int pBuild,
int pRevision)
Version with given numbers. A negative number
means ignore.
pMajor - the major numberpMinor - the minor numberpBuild - the build numberpRevision - the revision number| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object pObject)
equals in class java.lang.Objectpublic int compareTo(Version pVersion)
compareTo in interface java.lang.Comparable<Version>public static Version parse(java.lang.String pVersion)
pVersion - the version string
public static Version parse(long pVersion)
pVersion - the version representation
public java.lang.String toString(Version.Level pLevel,
boolean pShort)
pLevel - the version levelpShort - true to stop after the last sequence that contains a valid number (> 0).
public java.lang.String toString(Version.Level pLevel)
pLevel - the level
public java.lang.String toString(boolean pShort)
pShort - true to stop after the last sequence that contains a valid number (> 0).
public Version.Level getLevel()
Version.Level.Build.
public boolean isUndefined()
true if version is undefined, false otherwisepublic long toNumber()
public long toNumber(Version.Level pLevel)
pLevel - the expected depth/level
public int compareTo(Version pVersion,
Version.Level pLevel)
pVersion - the to comparepLevel - the check depth/level
public int getMajor()
public int getMinor()
public int getBuild()
public int getRevision()
public boolean isSmaller(Version pVersion)
pVersion - the "greater" version
true if this version is smaller than the given, false otherwisepublic boolean isSmallerOrEqual(Version pVersion)
pVersion - the smaller or equal version
true if this version is smaller than the given, false otherwisepublic boolean isGreater(Version pVersion)
pVersion - the "smaller" version
true if this version is greater than the given, false otherwisepublic boolean isGreaterOrEqual(Version pVersion)
pVersion - the greater or equal version
true if this version is greater than the given, false otherwisepublic boolean isValid()
true if version number is valid, false otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||