Enum TwoDimensional.Bias

  • All Implemented Interfaces:
    Serializable, Comparable<TwoDimensional.Bias>
    Enclosing interface:
    TwoDimensional

    public static enum TwoDimensional.Bias
    extends Enum<TwoDimensional.Bias>
    Determines whether to add 1 when the end of an inner list is reached

    For example, given the following two dimensional object (a list of lists of objects) where the inner lists values show the absolute index of that specific item within the outer list...

    
     [                 // outer list
          [0, 1, 2, 3],   // inner list 1
          [4, 5, 6]       // inner list 2
     ]                 // outer list
     
    ...navigating to listOfListsObject.offsetTo(3, BACKWARD) will return 3 whereas listOfListsObject.offsetTo(3, FORWARD) will return 4, the "next item" in the two dimensional object. The Bias does not apply if the index is any non-last-index in the inner list. Thus, listOfListsObject.offsetTo(1, BACKWARD) and listOfListsObject.offsetTo(1, FORWARD) will return the same value, 1, since the position is not at the end of the list.
    • Enum Constant Detail

      • Forward

        public static final TwoDimensional.Bias Forward
        When the returned value would be equal to the last index in an "inner list" or the length of some object with length, returns the value + 1. See TwoDimensional.Bias for more clarification.
      • Backward

        public static final TwoDimensional.Bias Backward
        When the returned value would be equal to the last index in an "inner list" or the length of some object with length, returns the value unmodified. See TwoDimensional.Bias for more clarification.
    • Method Detail

      • values

        public static TwoDimensional.Bias[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (TwoDimensional.Bias c : TwoDimensional.Bias.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static TwoDimensional.Bias valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null