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

public abstract class AbstractVersionComparator extends Object implements VersionComparator
Base class for version comparators.
Since:
1.0-beta-1
  • 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:
      compare in interface Comparator<org.apache.maven.artifact.versioning.ArtifactVersion>
    • getSegmentCount

      public final int getSegmentCount(org.apache.maven.artifact.versioning.ArtifactVersion v)
      Description copied from interface: VersionComparator
      Returns the number of segments specified or specifiable in the supplied artifact version.
      Specified by:
      getSegmentCount in interface VersionComparator
      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.
      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<org.apache.maven.artifact.versioning.ArtifactVersion>
      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: