public interface Mappings
Modifier and Type | Interface and Description |
---|---|
static class |
Mappings.Builder<T extends Mappings>
Deprecated.
|
static interface |
Mappings.MappingsSupplier<T extends Mappings> |
Modifier and Type | Method and Description |
---|---|
static <T extends Mappings> |
builder(Mappings.MappingsSupplier<T> supplier) |
default 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.
|
Mappings |
inverse()
Mappings with keys and values swapped.
|
int |
mappedSize()
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.
|
int getNewId(int id)
id
- unmapped iddefault int getNewIdOrDefault(int id, int def)
id
- unmapped iddef
- fallback return valuedefault boolean contains(int id)
id
- unmapped idvoid setNewId(int id, int mappedId)
id
- unmapped idmappedId
- mapped idjava.lang.IndexOutOfBoundsException
- if the unmapped id is invalidint size()
int mappedSize()
Mappings inverse()
static <T extends Mappings> Mappings.Builder<T> builder(Mappings.MappingsSupplier<T> supplier)