Enum TwoSidedList.Direction

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<TwoSidedList.Direction>
    Enclosing class:
    TwoSidedList<E>

    public static enum TwoSidedList.Direction
    extends java.lang.Enum<TwoSidedList.Direction>
    Used as an argument for methods adding or removing elements from this list to determine in which direction this list has to shrink or grow.
    • Constructor Detail

      • Direction

        private Direction()
    • Method Detail

      • values

        public static TwoSidedList.Direction[] 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 (TwoSidedList.Direction c : TwoSidedList.Direction.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static TwoSidedList.Direction valueOf​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • checkRange

        abstract void checkRange​(int ind,
                                 TwoSidedList<?> list)
        Checks whether index ind is in the range of list and throws an appropriate exception if not.
        Parameters:
        ind - the index to be checked.
        list - the twosided list under consideration.
        Throws:
        java.lang.IndexOutOfBoundsException -
        • for this == Left2Rightif not list.firstIndex() <= ind<list.minFreeIndex()+1.
        • for this == Right2Leftif not list.firstIndex()-1 <= ind<list.minFreeIndex() .
        The message is always the same: "Index: <ind> Range: <firstIndex> - <minFreeIndex()> exclusively. " .
        See Also:
        (int, Object, Direction), TwoSidedList.addAll(int, Collection, Direction)