org.codehaus.mojo.versions.ordering
Class NumericVersionComparator
java.lang.Object
org.codehaus.mojo.versions.ordering.NumericVersionComparator
- All Implemented Interfaces:
- Comparator
public class NumericVersionComparator
- extends Object
- implements Comparator
A comparator which will compare all segments of a dot separated version string as numbers if possible,
i.e. 1.3.34 > 1.3.9 and 1.3.4.3.2.34 > 1.3.4.3.2.9 and 1.3.4.3.2.34 > 1.3.4.3.2.34-SNAPSHOT
- Since:
- 1.0-alpha-3
- Author:
- Stephen Connolly
|
Method Summary |
int |
compare(Object o1,
Object o2)
|
boolean |
equals(Object obj)
Returns true if this object is the same type of comparator as the parameter. |
int |
hashCode()
Returns a hash code value for the comparator class. |
NumericVersionComparator
public NumericVersionComparator()
compare
public int compare(Object o1,
Object o2)
-
- Specified by:
compare in interface Comparator
hashCode
public int hashCode()
- Returns a hash code value for the comparator class.
- Overrides:
hashCode in class Object
- Returns:
- the hash code.
equals
public boolean equals(Object obj)
- Returns true if this object is the same type of comparator as the parameter.
- Specified by:
equals in interface Comparator- Overrides:
equals in class Object
- Parameters:
obj - the reference object with which to compare.
- Returns:
true if this object is the same as the obj
argument; false otherwise.- See Also:
hashCode(),
Hashtable
Copyright © 2008-2009 Codehaus. All Rights Reserved.