Package hoverball
Class Puck
java.lang.Object
hoverball.Puck
public class Puck
extends java.lang.Object
The class Puck memorizes all information about a puck that can be perceived or
deduced by a unit.
This can be:
- object identity composed of the identification
(what t n), - object message, if the object is a unit,
- position and looking direction in the form of a orthonormal matrix,
- radius,
- mass.
With the class Puck you have at your disposal various methods that allow to organize and compare objects.
-
Field Summary
Fields Modifier and Type Field Description static intBALLtype constant: balljava.lang.Stringidobject identity (as string)doublemobject massjava.lang.Stringmessageobject message (if unit)intnobject puck number (= player number if unit)static intNODEtype constant: nodedoublerobject radiusinttobject team numberstatic intUNITtype constant: unitintwhatobject typeMatrixXobject position (as orthonormal matrix) -
Constructor Summary
Constructors Constructor Description Puck(int what, int t, int n)Creates a puck with the specified identity, all other values are null.Puck(int what, int t, int n, Matrix X, double r, double m, java.lang.String message)Creates a puck with the specified values.Puck(Puck puck)Creates a puck equal to another. -
Method Summary
Modifier and Type Method Description booleanequals(int what)Compares the type.booleanequals(int what, int t)Compares type and team.booleanequals(int what, int t, int n)Compares the identity.booleanequals(java.lang.Object puck)Compares with a puck.booleanequals(java.lang.String id)Compares the identity (as string).inthashCode()Returns the hash code.static java.lang.Stringid(int what, int t, int n)Creates the identity (as string).java.lang.StringtoString()string representation.
-
Field Details
-
NODE
public static final int NODEtype constant: node- See Also:
- Constant Field Values
-
BALL
public static final int BALLtype constant: ball- See Also:
- Constant Field Values
-
UNIT
public static final int UNITtype constant: unit- See Also:
- Constant Field Values
-
id
public final java.lang.String idobject identity (as string) -
what
public final int whatobject type -
t
public final int tobject team number -
n
public final int nobject puck number (= player number if unit) -
r
public final double robject radius -
m
public final double mobject mass -
X
object position (as orthonormal matrix) -
message
public java.lang.String messageobject message (if unit)
-
-
Constructor Details
-
Puck
Creates a puck equal to another.- Parameters:
puck- copied puck
-
Puck
public Puck(int what, int t, int n)Creates a puck with the specified identity, all other values are null.- Parameters:
what- object typet- team numbern- puck number
-
Puck
Creates a puck with the specified values.- Parameters:
what- object typet- team numbern- puck numberX- orientierted positionr- radiusm- massmessage- message
-
-
Method Details
-
id
public static java.lang.String id(int what, int t, int n)Creates the identity (as string).- Parameters:
what- object typet- team numbern- puck number- Returns:
- the identity
-
equals
public boolean equals(java.lang.Object puck)Compares with a puck.Two puck objects are equal iff their identities are equal.
- Overrides:
equalsin classjava.lang.Object- Parameters:
puck- puck- Returns:
- the equality
-
equals
public boolean equals(int what)Compares the type.- Parameters:
what- object type- Returns:
- the equality
-
equals
public boolean equals(int what, int t)Compares type and team.- Parameters:
what- object typet- team number- Returns:
- the equality
-
equals
public boolean equals(int what, int t, int n)Compares the identity.- Parameters:
what- object typet- team numbern- puck number- Returns:
- the equality
-
equals
public boolean equals(java.lang.String id)Compares the identity (as string).- Parameters:
id- identity string- Returns:
- the equality
-
hashCode
public int hashCode()Returns the hash code.- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hash code
-
toString
public java.lang.String toString()string representation.- Overrides:
toStringin classjava.lang.Object- Returns:
- the string
-