Record Class IdentityMappings
java.lang.Object
java.lang.Record
com.viaversion.viaversion.api.data.IdentityMappings
- All Implemented Interfaces:
Mappings
-
Constructor Summary
ConstructorDescriptionIdentityMappings
(int size, int mappedSize) Creates an instance of aIdentityMappings
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.int
getNewId
(int id) Returns the mapped id from the given id, or -1 if invalid/out of bounds.final int
hashCode()
Returns a hash code value for this object.inverse()
Mappings with keys and values swapped.int
Returns the value of themappedSize
record component.void
setNewId
(int id, int mappedId) Manually maps a specific id.int
size()
Returns the value of thesize
record component.final String
toString()
Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.viaversion.viaversion.api.data.Mappings
contains, getNewIdOrDefault
-
Constructor Details
-
IdentityMappings
public IdentityMappings(int size, int mappedSize) Creates an instance of aIdentityMappings
record class.- Parameters:
size
- the value for thesize
record componentmappedSize
- the value for themappedSize
record component
-
-
Method Details
-
getNewId
public int getNewId(int id) Description copied from interface:Mappings
Returns the mapped id from the given id, or -1 if invalid/out of bounds. -
setNewId
public void setNewId(int id, int mappedId) Description copied from interface:Mappings
Manually maps a specific id. -
inverse
Description copied from interface:Mappings
Mappings with keys and values swapped. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
size
public int size()Returns the value of thesize
record component. -
mappedSize
public int mappedSize()Returns the value of themappedSize
record component.- Specified by:
mappedSize
in interfaceMappings
- Returns:
- the value of the
mappedSize
record component
-