Package eu.simuline.util
Enum TwoSidedList.Direction
- java.lang.Object
-
- java.lang.Enum<TwoSidedList.Direction>
-
- eu.simuline.util.TwoSidedList.Direction
-
- All Implemented Interfaces:
Serializable,Comparable<TwoSidedList.Direction>
- Enclosing class:
- TwoSidedList<E>
public static enum TwoSidedList.Direction extends 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.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description Left2RightRight2Left
-
Constructor Summary
Constructors Modifier Constructor Description privateDirection()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract voidcheckAdd1(TwoSidedList<?> list)Checks inTwoSidedList.add(int, Object, Direction)whether by adding elements causes underrun inTwoSidedList.firstIndex()or overrun inTwoSidedList.minFreeIndex().(package private) abstract voidcheckAddAll(int size, TwoSidedList<?> list)Checks inTwoSidedList.addAll(int, Collection, Direction)whether by adding elements causes underrun inTwoSidedList.firstIndex()or overrun inTwoSidedList.minFreeIndex().(package private) abstract voidcheckRange(int ind, TwoSidedList<?> list)Checks whether indexindis in the range oflistand throws an appropriate exception if not.static TwoSidedList.DirectionvalueOf(String name)Returns the enum constant of this type with the specified name.static TwoSidedList.Direction[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
Left2Right
public static final TwoSidedList.Direction Left2Right
-
Right2Left
public static final TwoSidedList.Direction Right2Left
-
-
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(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 nameNullPointerException- if the argument is null
-
checkRange
abstract void checkRange(int ind, TwoSidedList<?> list)Checks whether indexindis in the range oflistand throws an appropriate exception if not.- Parameters:
ind- the index to be checked.list- the twosided list under consideration.- Throws:
IndexOutOfBoundsException-- for
this == Left2Rightif notlist.firstIndex() <= ind<list.minFreeIndex()+1. - for
this == Right2Leftif notlist.firstIndex()-1 <= ind<list.minFreeIndex().
"Index: <ind> Range: <firstIndex> - <minFreeIndex()> exclusively. ".- for
- See Also:
(int, Object, Direction),TwoSidedList.addAll(int, Collection, Direction)
-
checkAdd1
abstract void checkAdd1(TwoSidedList<?> list)
Checks inTwoSidedList.add(int, Object, Direction)whether by adding elements causes underrun inTwoSidedList.firstIndex()or overrun inTwoSidedList.minFreeIndex().- Parameters:
list- the twosided list under consideration.- Throws:
IllegalStateException- if adding an object to this list would cause underrun inTwoSidedList.firstIndex()or overrun inTwoSidedList.minFreeIndex()depending on this direction.- See Also:
TwoSidedList.decFirstIndex(),TwoSidedList.checkIncMinFreeIndex()
-
checkAddAll
abstract void checkAddAll(int size, TwoSidedList<?> list)Checks inTwoSidedList.addAll(int, Collection, Direction)whether by adding elements causes underrun inTwoSidedList.firstIndex()or overrun inTwoSidedList.minFreeIndex().- Parameters:
size- the number of elements to be added.list- the twosided list under consideration.- Throws:
IllegalStateException- if addingsizeobjects to this list would cause underrun inTwoSidedList.firstIndex()or overrun inTwoSidedList.minFreeIndex()depending on this direction.
-
-