Enum Class TileContents
- All Implemented Interfaces:
Serializable,Comparable<TileContents>,Constable
Enum representing different types of tile contents.
Used for mapping indices to tile content classes.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Method Summary
Modifier and TypeMethodDescriptionintgetIndex()Gets the unique identifier of this TileContentstatic intgetIndexByClass(Class<? extends TileContent> tileClass) Gets aTileContentby searching for its identifierstatic TileContentgetNewTileClassByIndex(int index) Retrieves a new TileContent instance based on the given index.Creates a new instance of the tile content.static TileContentsReturns the enum constant of this class with the specified name.static TileContents[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
WALL
-
TEST
-
PLAYER
-
MOVABLE_BLOCK
-
TEST_ITEM
-
TEST_ITEM02
-
INVISIBLE_WALL
-
GLOVE_ITEM
-
GOAL_OBJECT
-
MOVABLE_BLOCK_TRANSCENDENT
-
TRANSCENDENT_TEST
-
DOOR
-
DOOR_TRIGGER
-
HOLE
-
PORTAL
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException- if the argument is null
-
getIndex
public int getIndex()Gets the unique identifier of this TileContent- Returns:
- unique identifier of this TileContent
-
getIndexByClass
Gets aTileContentby searching for its identifier- Parameters:
tileClass- AClassextendingTileContentthat will be the search target- Returns:
- Index of the Class if found; -1 otherwise
-
getNewTileContent
Creates a new instance of the tile content.- Returns:
- A new TileContent instance.
-
getNewTileClassByIndex
Retrieves a new TileContent instance based on the given index.- Parameters:
index- The index of the TileContent.- Returns:
- A new TileContent instance.
- Throws:
IllegalArgumentException- If no TileContent corresponds to the given index.
-