Lizzy v1.1.1

christophedelory.xml
Class Version

java.lang.Object
  extended by christophedelory.xml.Version
All Implemented Interfaces:
Serializable, Cloneable

public class Version
extends Object
implements Cloneable, Serializable

A generic version information, composed of a version number, a revision number and a step number.

Version:
$Revision: 92 $
Author:
Christophe Delory
See Also:
Serialized Form

Field Summary
static Version CURRENT
          The current version of this project.
 
Constructor Summary
Version(int version, int revision, int step)
          Builds a new Version instance which should keep a specific version, revision and step numbers.
 
Method Summary
 Object clone()
          Creates and returns a "shallow" copy of this object.
 int compareTo(Object o)
           
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 int getRevision()
          Returns the revision number kept by this instance.
 int getStep()
          Returns the step number kept by this instance.
 int getVersion()
          Returns the version number kept by this instance.
 int hashCode()
           
 String toString()
          Returns a string representation of this version information.
static Version valueOf(String name)
          Builds a version information from the specified string.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CURRENT

public static Version CURRENT
The current version of this project. Defaults to "0.0.0".

Constructor Detail

Version

public Version(int version,
               int revision,
               int step)
Builds a new Version instance which should keep a specific version, revision and step numbers.

Parameters:
version - the version number.
revision - the revision number.
step - the step number.
Throws:
IndexOutOfBoundsException - if one of the numbers is strictly negative.
Method Detail

valueOf

public static Version valueOf(String name)
Builds a version information from the specified string.

Parameters:
name - the version string.
Throws:
NullPointerException - if the version string is null.
IllegalArgumentException - if the version string is malformed.
IndexOutOfBoundsException - if one of the numbers is strictly negative.
NumberFormatException - if the version string contains a non-parsable integer.
See Also:
toString()

getVersion

public int getVersion()
Returns the version number kept by this instance.

Returns:
a version number.

getRevision

public int getRevision()
Returns the revision number kept by this instance.

Returns:
a revision number.

getStep

public int getStep()
Returns the step number kept by this instance.

Returns:
a step number.

compareTo

public int compareTo(Object o)

equals

public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one. Two version information are the same if their version and revision and step numbers are the same.

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare. A Version instance is expected.
Returns:
true if this object is the same as the obj argument; false otherwise.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

clone

public Object clone()
             throws CloneNotSupportedException
Creates and returns a "shallow" copy of this object.

Overrides:
clone in class Object
Returns:
a clone of this instance.
Throws:
CloneNotSupportedException - shall not be thrown, because this class is cloneable.
See Also:
Object.clone()

toString

public String toString()
Returns a string representation of this version information. It takes the following form: "<version>.<revision>.<step>".

Overrides:
toString in class Object
Returns:
a string representing this version information.

© 2008-2009 Christophe Delory

Copyright © 2008-2009 Christophe Delory. All Rights Reserved.