com.meyling.principia.module
Class Version

java.lang.Object
  |
  +--com.meyling.principia.argument.AbstractArgument
        |
        +--com.meyling.principia.argument.AbstractArgumentList
              |
              +--com.meyling.principia.module.Version
All Implemented Interfaces:
Argument, Textable

public class Version
extends AbstractArgumentList
implements Argument, Textable

A version description.

Version:
$Revision 0.00.50$
Author:
Michael Meyling

Field Summary
private  int[] numbers
          all version numbers
 
Fields inherited from class com.meyling.principia.argument.AbstractArgumentList
arguments
 
Constructor Summary
Version(Argument[] arguments)
          Constructs a version description.
Version(String version)
          Constructs a version description.
 
Method Summary
 Argument create(Argument[] arguments)
          Create a new Argument with given arguments.
 boolean equalWith(Version v)
          Check if this version is equal to another one.
private  int getSubVersion(int i)
          Get the i-th sub version.
 String getText()
          Get label of object.
 boolean greaterThan(Version v)
          Check if this version is greater than another one
 String toString()
          Get the argument in String form.
 
Methods inherited from class com.meyling.principia.argument.AbstractArgumentList
copy, getArgument, getArgumentSize
 
Methods inherited from class com.meyling.principia.argument.AbstractArgument
containsPatternVariables, equals, getHighestNumber, getPatternVariables, getReplacementParents, getSearchParents, hashCode, matches, matches, replace, replace, replace, replaceMatches
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 
Methods inherited from interface com.meyling.principia.argument.Argument
containsPatternVariables, copy, equals, getArgument, getArgumentSize, getPatternVariables, getReplacementParents, getSearchParents, hashCode, matches, matches, replace, replace, replace, replaceMatches
 

Field Detail

numbers

private final int[] numbers
all version numbers
Constructor Detail

Version

public Version(Argument[] arguments)
        throws ArgumentException
Constructs a version description.
Parameters:
arguments - Text to be a version description
Throws:
ArgumentException - if there is not exactly one argument or the first argument is not an instance of Text or it isn't build of digits and periods in the following form: n.nn.nn(.nn)*

Version

public Version(String version)
        throws ArgumentException
Constructs a version description.
Parameters:
version - version
Throws:
ArgumentException - if version it isn't build of digits and periods in the following form: n.nn.nn(.nn)*
Method Detail

greaterThan

public final boolean greaterThan(Version v)
Check if this version is greater than another one
Parameters:
v - version to compare with
Returns:
is this version greater than v?

equalWith

public final boolean equalWith(Version v)
Check if this version is equal to another one. This method would return true for the versions "1.001.00" and "1.1".
Parameters:
v - version to compare with
Returns:
is this version the same as v?

getSubVersion

private final int getSubVersion(int i)
Get the i-th sub version.
Parameters:
i - get this sub version
Returns:
value of i-th sub version

getText

public final String getText()
Description copied from interface: Textable
Get label of object.
Specified by:
getText in interface Textable
Following copied from interface: com.meyling.principia.module.Textable
Returns:
label of object

create

public final Argument create(Argument[] arguments)
                      throws ArgumentException
Description copied from interface: Argument
Create a new Argument with given arguments.
Specified by:
create in interface Argument
Overrides:
create in class AbstractArgumentList
Following copied from interface: com.meyling.principia.argument.Argument
Parameters:
arguments - with these arguments the operator should be created
Returns:
new constructed Argument
Throws:
ArgumentException - if creation failed

toString

public final String toString()
Description copied from interface: Argument
Get the argument in String form.
Specified by:
toString in interface Argument
Overrides:
toString in class AbstractArgumentList
Following copied from interface: com.meyling.principia.argument.Argument
Returns:
readable formula