Class AbstractVersionComparator
java.lang.Object
org.codehaus.mojo.versions.ordering.AbstractVersionComparator
- All Implemented Interfaces:
Comparator<org.apache.maven.artifact.versioning.ArtifactVersion>,VersionComparator
- Direct Known Subclasses:
MavenVersionComparator,MercuryVersionComparator,NumericVersionComparator
Base class for version comparators.
- Since:
- 1.0-beta-1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract intcompare(org.apache.maven.artifact.versioning.ArtifactVersion o1, org.apache.maven.artifact.versioning.ArtifactVersion o2) booleanReturns true if this object is the same type of comparator as the parameter.final intgetSegmentCount(org.apache.maven.artifact.versioning.ArtifactVersion v) Returns the number of segments specified or specifiable in the supplied artifact version.inthashCode()Returns a hash code value for the comparator class.protected abstract intinnerGetSegmentCount(org.apache.maven.artifact.versioning.ArtifactVersion v) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
AbstractVersionComparator
public AbstractVersionComparator()
-
-
Method Details
-
compare
public abstract int compare(org.apache.maven.artifact.versioning.ArtifactVersion o1, org.apache.maven.artifact.versioning.ArtifactVersion o2) - Specified by:
comparein interfaceComparator<org.apache.maven.artifact.versioning.ArtifactVersion>
-
getSegmentCount
public final int getSegmentCount(org.apache.maven.artifact.versioning.ArtifactVersion v) Description copied from interface:VersionComparatorReturns the number of segments specified or specifiable in the supplied artifact version.- Specified by:
getSegmentCountin interfaceVersionComparator- Parameters:
v- The artifact version to count the segments of.- Returns:
- The number of segments.
-
innerGetSegmentCount
protected abstract int innerGetSegmentCount(org.apache.maven.artifact.versioning.ArtifactVersion v) -
hashCode
public int hashCode()Returns a hash code value for the comparator class. -
equals
Returns true if this object is the same type of comparator as the parameter.- Specified by:
equalsin interfaceComparator<org.apache.maven.artifact.versioning.ArtifactVersion>- Overrides:
equalsin classObject- Parameters:
obj- the reference object with which to compare.- Returns:
trueif this object is the same as the obj argument;falseotherwise.- See Also:
-