org.knuth.chkupdate
Class Version

java.lang.Object
  extended by org.knuth.chkupdate.Version

public class Version
extends java.lang.Object

Used to compare two version and see which one is the newer one.

Author:
Lukas Knuth

Field Summary
private  java.lang.String CHAR_REGEX
          RegEx used to parse the Version-String
private  int[] numbers
          Splited version-numbers
private  java.lang.String SPLIT_REGEX
          The RegEx used to split the Version-String up
 
Constructor Summary
Version(java.lang.String version_str)
          Creates a new Version-Object by parsing the given Version String.
 
Method Summary
 boolean isNewerThen(Version version)
          Checks if this version is higher (newer) then the given one.
private  void parseVersion(java.lang.String version_str)
          Splits up the version-string by the "."
 java.lang.String toString()
          Returns the version-String for this "Version"- Object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CHAR_REGEX

private final java.lang.String CHAR_REGEX
RegEx used to parse the Version-String

See Also:
Constant Field Values

SPLIT_REGEX

private final java.lang.String SPLIT_REGEX
The RegEx used to split the Version-String up

See Also:
Constant Field Values

numbers

private int[] numbers
Splited version-numbers

Constructor Detail

Version

public Version(java.lang.String version_str)
Creates a new Version-Object by parsing the given Version String.

Parameters:
version_str - The Version-String to parse.
Method Detail

parseVersion

private void parseVersion(java.lang.String version_str)
Splits up the version-string by the "."-characters and creates a version-level-array.

Parameters:
version_str - The version-String to parse.

isNewerThen

public boolean isNewerThen(Version version)
Checks if this version is higher (newer) then the given one.

Parameters:
version - The Version to check against this Version.
Returns:
"true" if this Version is higher (newer) otherwise "false".

toString

public java.lang.String toString()
Returns the version-String for this "Version"- Object.

Overrides:
toString in class java.lang.Object