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 theelevations
record component.private final MazeGenerator.TileType[][]
The field for thetypes
record component. -
Constructor Summary
ConstructorsConstructorDescriptionGameMap
(MazeGenerator.TileType[][] types, double[][] elevations) Creates an instance of aGameMap
record class. -
Method Summary
Modifier and TypeMethodDescriptiondouble[][]
Returns the value of theelevations
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.final String
toString()
Returns a string representation of this record class.types()
Returns the value of thetypes
record component.
-
Field Details
-
types
The field for thetypes
record component. -
elevations
private final double[][] elevationsThe field for theelevations
record component.
-
-
Constructor Details
-
GameMap
Creates an instance of aGameMap
record class.- Parameters:
types
- the value for thetypes
record componentelevations
- the value for theelevations
record 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 thetypes
record component.- Returns:
- the value of the
types
record component
-
elevations
public double[][] elevations()Returns the value of theelevations
record component.- Returns:
- the value of the
elevations
record component
-