Package megamek.ai.dataset
Class EntityDataMap<F extends Enum<F>>
java.lang.Object
megamek.ai.dataset.EntityDataMap<F>
- Type Parameters:
F
- The enum type representing field names
- Direct Known Subclasses:
BoardData
,GameData
,MapSettingsData
,PlanetaryConditionsData
,UnitAction
,UnitAttack
,UnitState
Abstract base class for data maps that use enum fields.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
EntityDataMap
(Class<F> fieldEnumClass) Creates an empty EntityDataMap. -
Method Summary
Modifier and TypeMethodDescriptionGets a field value from the data map.<T> T
Gets a field value with type casting.Gets all fields and values in the map.Gets the class of the field enum.Gets the ordered list of field enums.Adds a field to the data map.
-
Constructor Details
-
EntityDataMap
Creates an empty EntityDataMap.- Parameters:
fieldEnumClass
- The class of the enum type F
-
-
Method Details
-
put
Adds a field to the data map.- Parameters:
field
- The field enumvalue
- The field value- Returns:
- This EntityDataMap for method chaining
-
get
Gets a field value from the data map.- Parameters:
field
- The field enum- Returns:
- The field value, or null if not present
-
get
Gets a field value with type casting.- Type Parameters:
T
- The expected type- Parameters:
field
- The field enumtype
- The class of the expected type- Returns:
- The field value cast to the expected type, or null if not present
-
getAllFields
Gets all fields and values in the map.- Returns:
- The underlying map of data
-
getFieldOrder
Gets the ordered list of field enums.- Returns:
- List of fields in insertion order
-
getFieldEnumClass
Gets the class of the field enum.- Returns:
- The enum class
-