Record Class Action
java.lang.Object
java.lang.Record
nz.ac.vuw.ecs.swen225.gp22.recorder.Action
- Record Components:
entityID
- The id of the entity.actionType
- The type of action.x
- The x coordinate of the action.y
- The y coordinate of the action.prevDir
- The previous direction.currDir
- The current direction.color
- The color of the tile. Can be None.
public record Action(int entityID, String actionType, int x, int y, String prevDir, String currDir, String color)
extends Record
The action class to update the game.
- Author:
- Chris
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theactionType
record component.color()
Returns the value of thecolor
record component.currDir()
Returns the value of thecurrDir
record component.int
entityID()
Returns the value of theentityID
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.prevDir()
Returns the value of theprevDir
record component.final String
toString()
Returns a string representation of this record class.org.dom4j.Element
toxml()
Creates an XML element from the action.int
x()
Returns the value of thex
record component.int
y()
Returns the value of they
record component.
-
Constructor Details
-
Action
public Action(int entityID, String actionType, int x, int y, String prevDir, String currDir, String color) Creates an instance of aAction
record class.- Parameters:
entityID
- the value for theentityID
record componentactionType
- the value for theactionType
record componentx
- the value for thex
record componenty
- the value for they
record componentprevDir
- the value for theprevDir
record componentcurrDir
- the value for thecurrDir
record componentcolor
- the value for thecolor
record component
-
-
Method Details
-
toxml
public org.dom4j.Element toxml()Creates an XML element from the action.- Returns:
- the XML element
-
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 '=='. -
entityID
public int entityID()Returns the value of theentityID
record component.- Returns:
- the value of the
entityID
record component
-
actionType
Returns the value of theactionType
record component.- Returns:
- the value of the
actionType
record component
-
x
public int x()Returns the value of thex
record component.- Returns:
- the value of the
x
record component
-
y
public int y()Returns the value of they
record component.- Returns:
- the value of the
y
record component
-
prevDir
Returns the value of theprevDir
record component.- Returns:
- the value of the
prevDir
record component
-
currDir
Returns the value of thecurrDir
record component.- Returns:
- the value of the
currDir
record component
-
color
Returns the value of thecolor
record component.- Returns:
- the value of the
color
record component
-