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.
The nodes are also represented by the class Puck, although actually they are no real Hoverball pucks.

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 int BALL
    type constant: ball
    java.lang.String id
    object identity (as string)
    double m
    object mass
    java.lang.String message
    object message (if unit)
    int n
    object puck number (= player number if unit)
    static int NODE
    type constant: node
    double r
    object radius
    int t
    object team number
    static int UNIT
    type constant: unit
    int what
    object type
    Matrix X
    object 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
    boolean equals​(int what)
    Compares the type.
    boolean equals​(int what, int t)
    Compares type and team.
    boolean equals​(int what, int t, int n)
    Compares the identity.
    boolean equals​(java.lang.Object puck)
    Compares with a puck.
    boolean equals​(java.lang.String id)
    Compares the identity (as string).
    int hashCode()
    Returns the hash code.
    static java.lang.String id​(int what, int t, int n)
    Creates the identity (as string).
    java.lang.String toString()
    string representation.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • NODE

      public static final int NODE
      type constant: node
      See Also:
      Constant Field Values
    • BALL

      public static final int BALL
      type constant: ball
      See Also:
      Constant Field Values
    • UNIT

      public static final int UNIT
      type constant: unit
      See Also:
      Constant Field Values
    • id

      public final java.lang.String id
      object identity (as string)
    • what

      public final int what
      object type
    • t

      public final int t
      object team number
    • n

      public final int n
      object puck number (= player number if unit)
    • r

      public final double r
      object radius
    • m

      public final double m
      object mass
    • X

      public Matrix X
      object position (as orthonormal matrix)
    • message

      public java.lang.String message
      object message (if unit)
  • Constructor Details

    • Puck

      public Puck​(Puck 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 type
      t - team number
      n - puck number
    • Puck

      public Puck​(int what, int t, int n, Matrix X, double r, double m, java.lang.String message)
      Creates a puck with the specified values.
      Parameters:
      what - object type
      t - team number
      n - puck number
      X - orientierted position
      r - radius
      m - mass
      message - message
  • Method Details

    • id

      public static java.lang.String id​(int what, int t, int n)
      Creates the identity (as string).
      Parameters:
      what - object type
      t - team number
      n - 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:
      equals in class java.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 type
      t - team number
      Returns:
      the equality
    • equals

      public boolean equals​(int what, int t, int n)
      Compares the identity.
      Parameters:
      what - object type
      t - team number
      n - 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:
      hashCode in class java.lang.Object
      Returns:
      the hash code
    • toString

      public java.lang.String toString()
      string representation.
      Overrides:
      toString in class java.lang.Object
      Returns:
      the string