fi.utu.cs.hockey
Class Player

java.lang.Object
  |
  +--fi.utu.cs.physics.Particle
        |
        +--fi.utu.cs.physics.Body
              |
              +--fi.utu.cs.physics.OrientedBody
                    |
                    +--fi.utu.cs.hockey.Player
All Implemented Interfaces:
MultiShapable, Shapable

public class Player
extends OrientedBody
implements MultiShapable

A player.


Field Summary
static double RADIUS
          Radius of a player in meters.
static double REACHABILITY
          Reachability of a player in meters.
 
Constructor Summary
Player(Point2 p)
          Creates a player at location p.
 
Method Summary
 void advance(double dt)
          Advances the time dt seconds and updates the position, velocity, and rotation of the player accordingly.
 void brake(double p)
          Brakes or dashes the player backward with the proportional power of p.
 boolean canReach(Puck p)
          Returns true, if player can reach the puck p.
 java.awt.Color color()
          Returns a Color object that is used for drawing the outline.
 void dash(double p)
          Dashes the player forward with the proportional power of p.
 java.awt.Color getHelmetColor()
          Returns the player's helmet color.
 java.awt.Color getJerseyColor()
          Returns the player's jersey color.
 java.lang.String getName()
          Returns the player's name.
 int getNumber()
          Returns the player's number.
 int getPlayPosition()
          Returns the player's position in the team.
 void head(double a)
          Turns the player's orientation a radians clockwise.
 boolean isDrawn()
          Returns a boolean value indicating whether the outline of the shape is drawn or not.
 boolean isFilled()
          Returns a boolean value indicating whether the shape is filled or not.
 boolean isHome()
          Returns true if the player belongs to the home team.
 ShapeIterator iterator()
           
 java.awt.Paint paint()
          Returns a Paint object that is used for filling the shape.
 void setColors(java.awt.Color h, java.awt.Color j)
          Sets the player's helmet color to h and jersey color to j.
 void setName(java.lang.String s)
          Sets the player's name to s.
 void setNumber(int n)
          Sets the player's number to n.
 java.awt.Shape shape()
          Returns a Shape object that defines the appearance of the object.
 java.awt.Stroke stroke()
          Returns a Stroke object that is used for drawing the outline.
 java.lang.String toString()
          Returns a string that contains the values of the attributes.
 
Methods inherited from class fi.utu.cs.physics.OrientedBody
futureVelocity, getNormalFriction, getOrientation, getTangentFriction, setNormalFriction, setOrientation, setTangentFriction
 
Methods inherited from class fi.utu.cs.physics.Body
elasticCollision, futurePosition, getAcceleration, getMass, getPosition, getRadius, getVelocity, inelasticCollision, isColliding, isOverlapping, setAcceleration, setAcceleration, setMass, setPosition, setPosition, setRadius, setVelocity, setVelocity
 
Methods inherited from class fi.utu.cs.physics.Particle
addCollisionNotification, clearCollisionNotifications, getOwner, isCollisionNotified, isCollisionNotified, isCorporeal, removeCollisionNotification, setCorporeal, setEthereal, setOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RADIUS

public static final double RADIUS
Radius of a player in meters.

See Also:
Constant Field Values

REACHABILITY

public static final double REACHABILITY
Reachability of a player in meters.

See Also:
Constant Field Values
Constructor Detail

Player

public Player(Point2 p)
Creates a player at location p.

Method Detail

getName

public java.lang.String getName()
Returns the player's name.


setName

public void setName(java.lang.String s)
Sets the player's name to s.


getNumber

public int getNumber()
Returns the player's number.


setNumber

public void setNumber(int n)
Sets the player's number to n.


getPlayPosition

public int getPlayPosition()
Returns the player's position in the team.


isHome

public boolean isHome()
Returns true if the player belongs to the home team.


getHelmetColor

public java.awt.Color getHelmetColor()
Returns the player's helmet color.


getJerseyColor

public java.awt.Color getJerseyColor()
Returns the player's jersey color.


setColors

public void setColors(java.awt.Color h,
                      java.awt.Color j)
Sets the player's helmet color to h and jersey color to j.


dash

public void dash(double p)
Dashes the player forward with the proportional power of p.


brake

public void brake(double p)
Brakes or dashes the player backward with the proportional power of p.


head

public void head(double a)
Turns the player's orientation a radians clockwise.


canReach

public boolean canReach(Puck p)
Returns true, if player can reach the puck p.


advance

public void advance(double dt)
Advances the time dt seconds and updates the position, velocity, and rotation of the player accordingly.

Overrides:
advance in class Body
See Also:
Body.futurePosition(double), Body.futureVelocity(double)

shape

public java.awt.Shape shape()
Description copied from interface: Shapable
Returns a Shape object that defines the appearance of the object.

Specified by:
shape in interface Shapable
See Also:
Shape

isDrawn

public boolean isDrawn()
Description copied from interface: Shapable
Returns a boolean value indicating whether the outline of the shape is drawn or not.

Specified by:
isDrawn in interface Shapable
See Also:
Shapable.stroke(), Shapable.color()

stroke

public java.awt.Stroke stroke()
Description copied from interface: Shapable
Returns a Stroke object that is used for drawing the outline.

Specified by:
stroke in interface Shapable
See Also:
Shapable.isDrawn(), Stroke

color

public java.awt.Color color()
Description copied from interface: Shapable
Returns a Color object that is used for drawing the outline.

Specified by:
color in interface Shapable
See Also:
Shapable.isDrawn(), Color

isFilled

public boolean isFilled()
Description copied from interface: Shapable
Returns a boolean value indicating whether the shape is filled or not.

Specified by:
isFilled in interface Shapable
See Also:
Shapable.paint()

paint

public java.awt.Paint paint()
Description copied from interface: Shapable
Returns a Paint object that is used for filling the shape.

Specified by:
paint in interface Shapable
See Also:
Shapable.isFilled(), Paint

iterator

public ShapeIterator iterator()
Specified by:
iterator in interface MultiShapable

toString

public java.lang.String toString()
Description copied from class: OrientedBody
Returns a string that contains the values of the attributes.

Overrides:
toString in class OrientedBody