Package org.apache.tools.ant.util
Class DeweyDecimal
- java.lang.Object
- 
- org.apache.tools.ant.util.DeweyDecimal
 
- 
- All Implemented Interfaces:
- java.lang.Comparable<DeweyDecimal>
 - Direct Known Subclasses:
- DeweyDecimal
 
 public class DeweyDecimal extends java.lang.Object implements java.lang.Comparable<DeweyDecimal> Utility class to contain version numbers in "Dewey Decimal" syntax. Numbers in the "Dewey Decimal" syntax consist of positive decimal integers separated by periods ".". For example, "2.0" or "1.2.3.4.5.6.7". This allows an extensible number to be used to represent major, minor, micro, etc versions. The version number must begin with a number.
- 
- 
Constructor SummaryConstructors Constructor Description DeweyDecimal(int[] components)Construct a DeweyDecimal from an array of integer components.DeweyDecimal(java.lang.String string)Construct a DeweyDecimal from string in DeweyDecimal format.
 - 
Method SummaryModifier and Type Method Description intcompareTo(DeweyDecimal other)Compares this DeweyDecimal with another one.booleanequals(java.lang.Object o)intget(int index)Return the component at specified index.intgetSize()Return number of components inDeweyDecimal.inthashCode()booleanisEqual(DeweyDecimal other)Returntrueif thisDeweyDecimalis equal to the otherDeweyDecimal.booleanisGreaterThan(DeweyDecimal other)Returntrueif thisDeweyDecimalis greater than the otherDeweyDecimal.booleanisGreaterThanOrEqual(DeweyDecimal other)Returntrueif thisDeweyDecimalis greater than or equal to the otherDeweyDecimal.booleanisLessThan(DeweyDecimal other)Returntrueif thisDeweyDecimalis less than the otherDeweyDecimal.booleanisLessThanOrEqual(DeweyDecimal other)Returntrueif thisDeweyDecimalis less than or equal to the otherDeweyDecimal.java.lang.StringtoString()Return string representation ofDeweyDecimal.
 
- 
- 
- 
Constructor Detail- 
DeweyDecimalpublic DeweyDecimal(int[] components) Construct a DeweyDecimal from an array of integer components.- Parameters:
- components- an array of integer components.
 
 - 
DeweyDecimalpublic DeweyDecimal(java.lang.String string) throws java.lang.NumberFormatExceptionConstruct a DeweyDecimal from string in DeweyDecimal format.- Parameters:
- string- the string in dewey decimal format
- Throws:
- java.lang.NumberFormatException- if string is malformed
 
 
- 
 - 
Method Detail- 
getSizepublic int getSize() Return number of components inDeweyDecimal.- Returns:
- the number of components in dewey decimal
 
 - 
getpublic int get(int index) Return the component at specified index.- Parameters:
- index- the index of components
- Returns:
- the value of component at index
 
 - 
isEqualpublic boolean isEqual(DeweyDecimal other) Returntrueif thisDeweyDecimalis equal to the otherDeweyDecimal.- Parameters:
- other- the other DeweyDecimal
- Returns:
- true if equal to other DeweyDecimal, false otherwise
 
 - 
isLessThanpublic boolean isLessThan(DeweyDecimal other) Returntrueif thisDeweyDecimalis less than the otherDeweyDecimal.- Parameters:
- other- the other DeweyDecimal
- Returns:
- true if less than other DeweyDecimal, false otherwise
 
 - 
isLessThanOrEqualpublic boolean isLessThanOrEqual(DeweyDecimal other) Returntrueif thisDeweyDecimalis less than or equal to the otherDeweyDecimal.- Parameters:
- other- the other DeweyDecimal
- Returns:
- true if less than or equal to other DeweyDecimal, false otherwise
 
 - 
isGreaterThanpublic boolean isGreaterThan(DeweyDecimal other) Returntrueif thisDeweyDecimalis greater than the otherDeweyDecimal.- Parameters:
- other- the other DeweyDecimal
- Returns:
- true if greater than other DeweyDecimal, false otherwise
 
 - 
isGreaterThanOrEqualpublic boolean isGreaterThanOrEqual(DeweyDecimal other) Returntrueif thisDeweyDecimalis greater than or equal to the otherDeweyDecimal.- Parameters:
- other- the other DeweyDecimal
- Returns:
- true if greater than or equal to other DeweyDecimal, false otherwise
 
 - 
toStringpublic java.lang.String toString() Return string representation ofDeweyDecimal.- Overrides:
- toStringin class- java.lang.Object
- Returns:
- the string representation of DeweyDecimal.
 
 - 
compareTopublic int compareTo(DeweyDecimal other) Compares this DeweyDecimal with another one.- Specified by:
- compareToin interface- java.lang.Comparable<DeweyDecimal>
- Parameters:
- other- another DeweyDecimal to compare with
- Returns:
- result
- See Also:
- Comparable.compareTo(Object)
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
equalspublic boolean equals(java.lang.Object o) - Overrides:
- equalsin class- java.lang.Object
 
 
- 
 
-