com.kuka.common.versioning
Class AbstractVersion

java.lang.Object
  extended by com.kuka.common.versioning.AbstractVersion
All Implemented Interfaces:
Comparable<AbstractVersion>
Direct Known Subclasses:
InterfaceVersion

public abstract class AbstractVersion
extends Object
implements Comparable<AbstractVersion>

Abstract base class for immutable versions.


Field Summary
protected static String versionSeperator
          Version part separator.
 
Constructor Summary
protected AbstractVersion(int[] initialFields, int minRequired)
          Creates an instance of the class from the specified version fields array.
protected AbstractVersion(int maxNumFields, int minRequired)
          Create a version with all fields set to zero.
protected AbstractVersion(int numFields, int minRequired, String version)
          Called by the superclass to specify the version format and parse the value from an input string.
 
Method Summary
 int compareTo(AbstractVersion other)
           
 boolean equals(Object obj)
           
 int getField(int idx)
          Access the value of the field with the given index.
 int getVersionLength()
           
 int hashCode()
           
protected  int parseVersionString(int[] fields, int numFields, int minRequired, String version)
          Parses the specified string into the specified array of integer version fields.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

versionSeperator

protected static final String versionSeperator
Version part separator.

See Also:
Constant Field Values
Constructor Detail

AbstractVersion

protected AbstractVersion(int numFields,
                          int minRequired,
                          String version)
Called by the superclass to specify the version format and parse the value from an input string.

Parameters:
numFields - The maximum number of fields of this version
minRequired - The minimal required fields
version - The input string to be parsed
Throws:
IllegalArgumentException - The input string could not be parsed

AbstractVersion

protected AbstractVersion(int maxNumFields,
                          int minRequired)
Create a version with all fields set to zero.

Parameters:
maxNumFields - The maximum number of fields of this version
minRequired - The minimal required fields

AbstractVersion

protected AbstractVersion(int[] initialFields,
                          int minRequired)
Creates an instance of the class from the specified version fields array.

Parameters:
initialFields - initial version fields.
minRequired - minimum required number of fields.
Method Detail

parseVersionString

protected int parseVersionString(int[] fields,
                                 int numFields,
                                 int minRequired,
                                 String version)
Parses the specified string into the specified array of integer version fields.

Parameters:
fields - target array
numFields - number of fields to parse.
minRequired - minimal required number of fields.
version - version string to parse
Returns:
number of field that was parsed.

getField

public int getField(int idx)
Access the value of the field with the given index.

Parameters:
idx - The 0-based field index
Returns:
The value of the specified field

getVersionLength

public int getVersionLength()
Returns:
the number of fields.

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(AbstractVersion other)
Specified by:
compareTo in interface Comparable<AbstractVersion>

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2019. All rights reserved.