Package util
Record Class GameMap
java.lang.Object
java.lang.Record
util.GameMap
Represents a map to be used by a game of PacMann. A map is a rectangular 2D array of tiles
(whose types are specified by `types`), each with an elevation (given by `elevations`).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final double[][]The field for theelevationsrecord component.private final MazeGenerator.TileType[][]The field for thetypesrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionGameMap(MazeGenerator.TileType[][] types, double[][] elevations) Creates an instance of aGameMaprecord class. -
Method Summary
Modifier and TypeMethodDescriptiondouble[][]Returns the value of theelevationsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.types()Returns the value of thetypesrecord component.
-
Field Details
-
types
The field for thetypesrecord component. -
elevations
private final double[][] elevationsThe field for theelevationsrecord component.
-
-
Constructor Details
-
GameMap
Creates an instance of aGameMaprecord class.- Parameters:
types- the value for thetypesrecord componentelevations- the value for theelevationsrecord component
-
-
Method Details
-
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 withObjects::equals(Object,Object). -
types
Returns the value of thetypesrecord component.- Returns:
- the value of the
typesrecord component
-
elevations
public double[][] elevations()Returns the value of theelevationsrecord component.- Returns:
- the value of the
elevationsrecord component
-