The version number of a Component is made up of three
dot-separated fields:
"major.minor.micro"
The major, minor and micro fields are integer numbers represented in decimal notation and have the following meaning:
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private int | |
| private int |
| Access | Constructor and Description |
|---|---|
| public | Version(final int
This major, final int Version major number.This minor, final int Version minor number.This micro)Version micro number.Create a new instance of a |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: number indicating relative value (-1, 0, 1)the object to be compared. o)Implements java. Comparable interface.
|
| public boolean | |
| public boolean | |
| public boolean | Returns: true if the other object is equal to thisVersionan other)Object valueOverrides java. Version.
|
| public int | |
| public int | |
| public int | |
| public static Version | Returns: the new Version objectThe input version string version)Parse a version out of a string. |
| public int | Returns: the hashCodeOverrides java. |
| public String | Returns: the dot seperated version stringOverrides java. |
| m_major | back to summary |
|---|---|
| private int m_major | |
| m_micro | back to summary |
|---|---|
| private int m_micro | |
| m_minor | back to summary |
|---|---|
| private int m_minor | |
| Version | back to summary |
|---|---|
| public Version(final int major, final int minor, final int micro) Create a new instance of a
| |
| compareTo | back to summary |
|---|---|
| public int compareTo(Object o) Implements java. Compare two versions together according to the
| |
| complies | back to summary |
|---|---|
| public boolean complies(final Version other) Check this
If this The following example displays the expected behaviour and results of version. final Version v1 = new Version( 1, 3 , 6 ); final Version v2 = new Version( 1, 3 , 7 ); final Version v3 = new Version( 1, 4 , 0 ); final Version v4 = new Version( 2, 0 , 1 ); assert( v1.complies( v1 ) ); assert( ! v1.complies( v2 ) ); assert( v2.complies( v1 ) ); assert( ! v1.complies( v3 ) ); assert( v3.complies( v1 ) ); assert( ! v1.complies( v4 ) ); assert( ! v4.complies( v1 ) );
| |
| equals | back to summary |
|---|---|
| public boolean equals(final Version other) Check this
If this
| |
| equals | back to summary |
|---|---|
| public boolean equals(final Object other) Overrides java. Indicates whether some other object is "equal to" this
| |
| getMajor | back to summary |
|---|---|
| public int getMajor() Retrieve major component of version.
| |
| getMicro | back to summary |
|---|---|
| public int getMicro() Retrieve micro component of version.
| |
| getMinor | back to summary |
|---|---|
| public int getMinor() Retrieve minor component of version.
| |
| getVersion | back to summary |
|---|---|
| public static Version getVersion(final String version) throws NumberFormatException, IllegalArgumentException Parse a version out of a string.
The version string format is The input version string
the new Version object
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Add a hashing function to ensure the Version object is treated as expected in hashmaps and sets. Note any time the equals() is overridden, hashCode() should also be overridden.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Overload toString to report version correctly.
| |