Interface Mappings
- All Known Subinterfaces:
BiMappings
,FullMappings
- All Known Implementing Classes:
BiMappingsBase
,FullMappingsBase
,IdentityMappings
,Int2IntMapBiMappings
,Int2IntMapMappings
,IntArrayMappings
,ParticleMappings
public interface Mappings
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
contains
(int id) Returns whether the id has a mapping.int
getNewId
(int id) Returns the mapped id from the given id, or -1 if invalid/out of bounds.default int
getNewIdOrDefault
(int id, int def) Returns the mapped id from the given id, or the given default if unmapped/invalid.inverse()
Mappings with keys and values swapped.int
Returns the amount of new ids total, even if it does not have a direct mapping.void
setNewId
(int id, int mappedId) Manually maps a specific id.int
size()
Returns amount of unmapped entries, being the size of the mapping.
-
Method Details
-
getNewId
int getNewId(int id) Returns the mapped id from the given id, or -1 if invalid/out of bounds.- Parameters:
id
- unmapped id- Returns:
- mapped id, or -1 if invalid/out of bounds
-
getNewIdOrDefault
default int getNewIdOrDefault(int id, int def) Returns the mapped id from the given id, or the given default if unmapped/invalid.- Parameters:
id
- unmapped iddef
- fallback return value- Returns:
- mapped id, or def if invalid/out of bounds
-
contains
default boolean contains(int id) Returns whether the id has a mapping.- Parameters:
id
- unmapped id- Returns:
- whether the id has a mapped id
-
setNewId
void setNewId(int id, int mappedId) Manually maps a specific id.- Parameters:
id
- unmapped idmappedId
- mapped id- Throws:
IndexOutOfBoundsException
- if the unmapped id is invalid
-
size
int size()Returns amount of unmapped entries, being the size of the mapping.- Returns:
- amount of unmapped entries
-
mappedSize
int mappedSize()Returns the amount of new ids total, even if it does not have a direct mapping. Returns -1 if unknown.- Returns:
- amount of new ids, or -1 if unknown
-
inverse
Mappings inverse()Mappings with keys and values swapped.- Returns:
- mappings with keys and values swapped
-