jaulib v1.3.0
Jau Support Library (C++, Java, ..)
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
org.jau.util.VersionNumber Class Reference

Simple version number class containing a version number either being defined explicit or derived from a string. More...

Inheritance diagram for org.jau.util.VersionNumber:
Collaboration diagram for org.jau.util.VersionNumber:

Public Member Functions

 VersionNumber (final int majorRev, final int minorRev, final int subMinorRev)
 Explicit version number instantiation, with all components defined explicitly. More...
 
 VersionNumber (final String versionString)
 String derived version number instantiation. More...
 
 VersionNumber (final String versionString, final String delim)
 String derived version number instantiation. More...
 
 VersionNumber (final String versionString, final java.util.regex.Pattern versionPattern)
 String derived version number instantiation. More...
 
final boolean isZero ()
 Returns true, if all version components are zero, otherwise false. More...
 
final boolean hasMajor ()
 Returns true, if the major component is defined explicitly, otherwise false. More...
 
final boolean hasMinor ()
 Returns true, if the optional minor component is defined explicitly, otherwise false. More...
 
final boolean hasSub ()
 Returns true, if the optional sub component is defined explicitly, otherwise false. More...
 
final int endOfStringMatch ()
 If constructed with version-string, returns the string offset after the last matching character, or 0 if none matched, or -1 if not constructed with a string. More...
 
final int hashCode ()
 
final boolean equals (final Object o)
 
final int compareTo (final Object o)
 
final int compareTo (final VersionNumber vo)
 
final int getMajor ()
 
final int getMinor ()
 
final int getSub ()
 
String toString ()
 

Static Public Member Functions

static java.util.regex.Pattern getVersionNumberPattern (final String delim)
 Returns the pattern with Perl regular expression: More...
 
static java.util.regex.Pattern getDefaultVersionNumberPattern ()
 Returns the default pattern using getVersionNumberPattern(String) with delimiter "<b>.</b>". More...
 

Static Public Attributes

static final VersionNumber zeroVersion = new VersionNumber(0, 0, 0, -1, (short)0)
 A zero version instance, w/o any component defined explicitly. More...
 

Protected Member Functions

 VersionNumber (final int majorRev, final int minorRev, final int subMinorRev, final int _strEnd, final short _state)
 

Protected Attributes

final int major
 
final int minor
 
final int sub
 
final int strEnd
 
final short state
 

Static Protected Attributes

static final short HAS_MAJOR = 1 << 0
 
static final short HAS_MINOR = 1 << 1
 
static final short HAS_SUB = 1 << 2
 

Detailed Description

Simple version number class containing a version number either being defined explicit or derived from a string.

For the latter case, you can query whether a component has been defined explicitly by the given versionString, via hasMajor(), hasMinor() and hasSub().

The state whether a component is defined explicitly is not considered in the hashCode(), equals(Object) or compareTo(Object) methods, since the version number itself is treated regardless.

Definition at line 45 of file VersionNumber.java.

Constructor & Destructor Documentation

◆ VersionNumber() [1/5]

org.jau.util.VersionNumber.VersionNumber ( final int  majorRev,
final int  minorRev,
final int  subMinorRev,
final int  _strEnd,
final short  _state 
)
protected

Definition at line 103 of file VersionNumber.java.

◆ VersionNumber() [2/5]

org.jau.util.VersionNumber.VersionNumber ( final int  majorRev,
final int  minorRev,
final int  subMinorRev 
)

Explicit version number instantiation, with all components defined explicitly.

See also
hasMajor()
hasMinor()
hasSub()

Definition at line 117 of file VersionNumber.java.

◆ VersionNumber() [3/5]

org.jau.util.VersionNumber.VersionNumber ( final String  versionString)

String derived version number instantiation.

Utilizing the default pattern parser with delimiter "<b>.</b>", see getDefaultVersionNumberPattern().

You can query whether a component has been defined explicitly by the given versionString, via hasMajor(), hasMinor() and hasSub().

Parameters
versionStringshould be given as [MAJOR[.MINOR[.SUB]]]
See also
hasMajor()
hasMinor()
hasSub()

Definition at line 136 of file VersionNumber.java.

Here is the call graph for this function:

◆ VersionNumber() [4/5]

org.jau.util.VersionNumber.VersionNumber ( final String  versionString,
final String  delim 
)

String derived version number instantiation.

Utilizing pattern parser created via getVersionNumberPattern(String).

You can query whether a component has been defined explicitly by the given versionString, via hasMajor(), hasMinor() and hasSub().

Parameters
versionStringshould be given as [MAJOR[.MINOR[.SUB]]]
delimthe delimiter, e.g. "."
See also
hasMajor()
hasMinor()
hasSub()

Definition at line 156 of file VersionNumber.java.

Here is the call graph for this function:

◆ VersionNumber() [5/5]

org.jau.util.VersionNumber.VersionNumber ( final String  versionString,
final java.util.regex.Pattern  versionPattern 
)

String derived version number instantiation.

You can query whether a component has been defined explicitly by the given versionString, via hasMajor(), hasMinor() and hasSub().

Parameters
versionStringshould be given as [MAJOR[.MINOR[.SUB]]]
versionPatternthe pattern parser, must be compatible w/ getVersionNumberPattern(String)
See also
hasMajor()
hasMinor()
hasSub()

Definition at line 173 of file VersionNumber.java.

Member Function Documentation

◆ compareTo() [1/2]

final int org.jau.util.VersionNumber.compareTo ( final Object  o)

Definition at line 242 of file VersionNumber.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compareTo() [2/2]

final int org.jau.util.VersionNumber.compareTo ( final VersionNumber  vo)

Definition at line 250 of file VersionNumber.java.

◆ endOfStringMatch()

final int org.jau.util.VersionNumber.endOfStringMatch ( )

If constructed with version-string, returns the string offset after the last matching character, or 0 if none matched, or -1 if not constructed with a string.

Definition at line 223 of file VersionNumber.java.

◆ equals()

final boolean org.jau.util.VersionNumber.equals ( final Object  o)

Definition at line 234 of file VersionNumber.java.

Here is the call graph for this function:

◆ getDefaultVersionNumberPattern()

static java.util.regex.Pattern org.jau.util.VersionNumber.getDefaultVersionNumberPattern ( )
static

Returns the default pattern using getVersionNumberPattern(String) with delimiter "<b>.</b>".

Instance is cached.

Definition at line 84 of file VersionNumber.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMajor()

final int org.jau.util.VersionNumber.getMajor ( )

Definition at line 267 of file VersionNumber.java.

◆ getMinor()

final int org.jau.util.VersionNumber.getMinor ( )

Definition at line 271 of file VersionNumber.java.

◆ getSub()

final int org.jau.util.VersionNumber.getSub ( )

Definition at line 275 of file VersionNumber.java.

◆ getVersionNumberPattern()

static java.util.regex.Pattern org.jau.util.VersionNumber.getVersionNumberPattern ( final String  delim)
static

Returns the pattern with Perl regular expression:

  "\\D*(\\d+)[^\\"+delim+"\s]*(?:\"+delim+"\D*(\d+)[^\"+delim+"\s]*(?:\"+delim+"\D*(\d+))?)?"
</pre>
</p>
<p>
A whitespace within the version number will end the parser.
</p>
<p>
Capture groups represent the major (1), optional minor (2) and optional sub version number (3) component in this order.
</p>
<p>
Each capture group ignores any leading non-digit and uses only contiguous digits, i.e. ignores pending non-digits.
</p>
@param delim the delimiter, e.g. "."

Definition at line 73 of file VersionNumber.java.

Here is the caller graph for this function:

◆ hashCode()

final int org.jau.util.VersionNumber.hashCode ( )

Definition at line 226 of file VersionNumber.java.

◆ hasMajor()

final boolean org.jau.util.VersionNumber.hasMajor ( )

Returns true, if the major component is defined explicitly, otherwise false.

Undefined components has the value 0.

Definition at line 213 of file VersionNumber.java.

Here is the caller graph for this function:

◆ hasMinor()

final boolean org.jau.util.VersionNumber.hasMinor ( )

Returns true, if the optional minor component is defined explicitly, otherwise false.

Undefined components has the value 0.

Definition at line 215 of file VersionNumber.java.

Here is the caller graph for this function:

◆ hasSub()

final boolean org.jau.util.VersionNumber.hasSub ( )

Returns true, if the optional sub component is defined explicitly, otherwise false.

Undefined components has the value 0.

Definition at line 217 of file VersionNumber.java.

Here is the caller graph for this function:

◆ isZero()

final boolean org.jau.util.VersionNumber.isZero ( )

Returns true, if all version components are zero, otherwise false.

Definition at line 208 of file VersionNumber.java.

◆ toString()

String org.jau.util.VersionNumber.toString ( )

Reimplemented in org.jau.util.VersionNumberString.

Definition at line 280 of file VersionNumber.java.

Member Data Documentation

◆ HAS_MAJOR

final short org.jau.util.VersionNumber.HAS_MAJOR = 1 << 0
staticprotected

Definition at line 99 of file VersionNumber.java.

◆ HAS_MINOR

final short org.jau.util.VersionNumber.HAS_MINOR = 1 << 1
staticprotected

Definition at line 100 of file VersionNumber.java.

◆ HAS_SUB

final short org.jau.util.VersionNumber.HAS_SUB = 1 << 2
staticprotected

Definition at line 101 of file VersionNumber.java.

◆ major

final int org.jau.util.VersionNumber.major
protected

Definition at line 96 of file VersionNumber.java.

◆ minor

final int org.jau.util.VersionNumber.minor
protected

Definition at line 96 of file VersionNumber.java.

◆ state

final short org.jau.util.VersionNumber.state
protected

Definition at line 98 of file VersionNumber.java.

◆ strEnd

final int org.jau.util.VersionNumber.strEnd
protected

Definition at line 96 of file VersionNumber.java.

◆ sub

final int org.jau.util.VersionNumber.sub
protected

Definition at line 96 of file VersionNumber.java.

◆ zeroVersion

final VersionNumber org.jau.util.VersionNumber.zeroVersion = new VersionNumber(0, 0, 0, -1, (short)0)
static

A zero version instance, w/o any component defined explicitly.

See also
hasMajor()
hasMinor()
hasSub()

Definition at line 53 of file VersionNumber.java.


The documentation for this class was generated from the following file: