Class AbstractVersionScheme<I extends AbstractVersionIterator>

    • Constructor Detail

      • AbstractVersionScheme

        public AbstractVersionScheme()
    • Method Detail

      • compare

        public int compare​(String v1,
                           String v2)
        Description copied from interface: VersionScheme
        Compare two versions according to this version scheme.
        Specified by:
        compare in interface Comparator<I extends AbstractVersionIterator>
        Specified by:
        compare in interface VersionScheme
        Parameters:
        v1 - the first version (must not be null)
        v2 - the second version (must not be null)
        Returns:
        -1, 0, or 1 if the first version is less than, equal to, or greater than the second version according to this version scheme
      • iterate

        public abstract I iterate​(String version)
        Description copied from interface: VersionScheme
        Iterate the canonicalized components of the given version according to the rules of this versioning scheme.
        Specified by:
        iterate in interface VersionScheme
        Parameters:
        version - the version to iterate (must not be null)
        Returns:
        the version iterator (not null)
      • appendCanonicalized

        public StringBuilder appendCanonicalized​(StringBuilder target,
                                                 String original)
        Description copied from interface: VersionScheme
        Append the canonical representation of this version to the given builder, according to the current version scheme.
        Specified by:
        appendCanonicalized in interface VersionScheme
        Parameters:
        target - the string builder to append to (must not be null)
        original - the possibly non-canonical version (must not be null)
        Returns:
        the string builder that was passed in
      • compareNext

        protected int compareNext​(I i1,
                                  I i2)
        Compare the next elements of the given iterators. If one iterator is at the end of iteration (its iterator reports no next element), the corresponding version is considered to come before the other version. If both iterators are at the end of iteration, the versions are considered equal. Otherwise, compare(I, I) is called to compare the iterators' current tokens.
        Parameters:
        i1 - the iterator for the first version (must not be null)
        i2 - the iterator for the second version (must not be null)
        Returns:
        -1, 0, or 1 if the first version is less than, equal to, or greater than the second version
      • compare

        protected abstract int compare​(I i1,
                                       I i2)
        Compare the current tokens of the two given iterators. If the tokens are equal, then this method should recurse to compareNext(I, I) (or equivalent) to compare the next tokens.
        Parameters:
        i1 - the iterator for the first version (must not be null)
        i2 - the iterator for the second version (must not be null)
        Returns:
        -1, 0, or 1 if the first version is less than, equal to, or greater than the second version