Class DeweyNumber

  • All Implemented Interfaces:
    Serializable

    public class DeweyNumber
    extends Object
    implements Serializable
    Versioning scheme which allows to retrieve dependencies between different versions.

    A dewey number consists of a sequence of digits d1.d2.d3. ... .dn. A dewey number v is compatible to v' iff v contains v' as a prefix or if both dewey number differ only in the last digit and the last digit of v is greater than v'.

    See Also:
    Serialized Form
    • Constructor Detail

      • DeweyNumber

        public DeweyNumber​(int start)
      • DeweyNumber

        public DeweyNumber​(DeweyNumber number)
    • Method Detail

      • isCompatibleWith

        public boolean isCompatibleWith​(DeweyNumber other)
        Checks whether this dewey number is compatible to the other dewey number.

        True iff this contains other as a prefix or iff they differ only in the last digit whereas the last digit of this is greater than the last digit of other.

        Parameters:
        other - The other dewey number to check compatibility against
        Returns:
        Whether this dewey number is compatible to the other dewey number
      • getRun

        public int getRun()
      • length

        public int length()
      • increase

        public DeweyNumber increase()
        Creates a new dewey number from this such that its last digit is increased by one.
        Returns:
        A new dewey number derived from this whose last digit is increased by one
      • increase

        public DeweyNumber increase​(int times)
        Creates a new dewey number from this such that its last digit is increased by the supplied number.
        Parameters:
        times - how many times to increase the Dewey number
        Returns:
        A new dewey number derived from this whose last digit is increased by given number
      • addStage

        public DeweyNumber addStage()
        Creates a new dewey number from this such that a 0 is appended as new last digit.
        Returns:
        A new dewey number which contains this as a prefix and has 0 as last digit
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • fromString

        public static DeweyNumber fromString​(String deweyNumberString)
        Creates a dewey number from a string representation. The input string must be a dot separated string of integers.
        Parameters:
        deweyNumberString - Dot separated string of integers
        Returns:
        Dewey number generated from the given input string