Package forgottentowns.mod.api
Record Class ColonyContext.Bed
java.lang.Object
java.lang.Record
forgottentowns.mod.api.ColonyContext.Bed
- Record Components:
id- stable placeable identitytiles- immutable occupied surface positions
- Enclosing interface:
ColonyContext
One complete bed footprint; adjacency means two footprints share an edge.
-
Constructor Summary
ConstructorsConstructorDescriptionBed(long id, List<ColonyContext.Position> tiles) Copies the complete occupied bed footprint. -
Method Summary
Modifier and TypeMethodDescriptionbooleanadjacentTo(ColonyContext.Bed other) Checks cardinal adjacency of two distinct bed footprints.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longid()Returns the value of theidrecord component.tiles()Returns the value of thetilesrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Bed
Copies the complete occupied bed footprint.- Parameters:
id- stable bed identitytiles- occupied positions- Throws:
NullPointerException- if tiles is null or contains null
-
-
Method Details
-
adjacentTo
Checks cardinal adjacency of two distinct bed footprints.- Parameters:
other- another bed, or null- Returns:
- whether distinct bed identities share a cardinal edge on one level; false for null
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
id
public long id()Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
tiles
Returns the value of thetilesrecord component.- Returns:
- the value of the
tilesrecord component
-