Class RichLocation.Strand

  • All Implemented Interfaces:
    java.lang.Comparable
    Enclosing interface:
    RichLocation

    public static class RichLocation.Strand
    extends java.lang.Object
    implements java.lang.Comparable
    This class represents a strand on which a location may lie. Three strands are defined by default - UNKNOWN, NEGATIVE, and POSITIVE.
    • Method Detail

      • forValue

        public static RichLocation.Strand forValue​(int value)
        Returns the strand object that matches the number given. Throws an exception if it could not recognise the number. Number is usually 1,-1,0.
        Parameters:
        value - the number of the strand.
        Returns:
        the strand matching that number.
      • forName

        public static RichLocation.Strand forName​(java.lang.String name)
        Returns the strand object that matches the symbol given. Throws an exception if it could not recognise the symbol. Symbol is usually +,-,?.
        Parameters:
        name - the symbol of the strand.
        Returns:
        the strand matching that symbol.
      • intValue

        public int intValue()
        Returns the numeric value of this strand.
        Returns:
        the numeric value.
      • getName

        public java.lang.String getName()
        Returns the string symbol of this strand.
        Returns:
        the string symbol.
      • toString

        public java.lang.String toString()
        Form: "symbol" (eg. +,-,?)
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Strands are equal if their numbers and symbols match.
        Overrides:
        equals in class java.lang.Object
      • compareTo

        public int compareTo​(java.lang.Object o)
        Strands are compared first by symbol, then by number.
        Specified by:
        compareTo in interface java.lang.Comparable