fi.utu.cs.hockey
Class Game

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--fi.utu.cs.hockey.Game
All Implemented Interfaces:
java.lang.Runnable

public class Game
extends java.lang.Thread

A hockey game.


Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
 int getFaceoffSpot()
          Returns the faceoff spot.
 Team getHome()
          Returns the home team.
 Puck getPuck()
          Returns the puck.
 int getScore(boolean home)
          Returns the score for the home team if home == true, otherwise the score for the visiting team.
 long getTime()
          Returns the time left in the game in milliseconds.
 Team getVisitor()
          Returns the visiting team.
 boolean isFoul(boolean h)
          Returns true, if h == true and the home team commits a foul, or if h == false and the visiting team commits a foul.
 boolean isGameOver()
          Returns true, if the game is over.
 boolean isGameStopped()
          Returns true, if the game is stopped.
 boolean isGoal(boolean h)
          Returns true, if h == true and the home team has scored, or if h == false and the visiting team has scored.
 boolean isGoalieKeepingPuck(boolean h)
          Returns true, if h == true and the home team goalie keeps the puck, or if h == false and the visiting team goalie keeps the puck.
 boolean isIcing(boolean h)
          Returns true, if h == true and the home team causes an icing, or if h == false and the visiting team causes an icing.
 boolean isInterferingGoalie(boolean h)
          Returns true, if h == true and the home team is interfering the goalie, or if h == false and the visiting team is interfering the goalie.
 boolean isOffside(boolean h)
          Returns true, if h == true and the home team causes an offside, or if h == false and the visiting team causes an offside.
 boolean isPuckUnplayable()
          Returns true, if the puck has become unplayable.
 void keepPuck(Player p)
          Lets the goalkeeper p keep the puck, if possible.
 void run()
          Runs the game.
 void shoot(Player p, double s)
          Lets the player p shoot the puck with the proportional power s, if possible.
 void teamUpdated()
          Signal that teams have been updated.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

run

public void run()
Runs the game.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

getHome

public Team getHome()
Returns the home team.


getVisitor

public Team getVisitor()
Returns the visiting team.


getPuck

public Puck getPuck()
Returns the puck.


getTime

public long getTime()
Returns the time left in the game in milliseconds.


getScore

public int getScore(boolean home)
Returns the score for the home team if home == true, otherwise the score for the visiting team.


teamUpdated

public void teamUpdated()
Signal that teams have been updated.


isGameStopped

public boolean isGameStopped()
Returns true, if the game is stopped.


isGameOver

public boolean isGameOver()
Returns true, if the game is over.


getFaceoffSpot

public int getFaceoffSpot()
Returns the faceoff spot.

See Also:
FaceOff

isGoal

public boolean isGoal(boolean h)
Returns true, if h == true and the home team has scored, or if h == false and the visiting team has scored.


isOffside

public boolean isOffside(boolean h)
Returns true, if h == true and the home team causes an offside, or if h == false and the visiting team causes an offside.


isIcing

public boolean isIcing(boolean h)
Returns true, if h == true and the home team causes an icing, or if h == false and the visiting team causes an icing.


isInterferingGoalie

public boolean isInterferingGoalie(boolean h)
Returns true, if h == true and the home team is interfering the goalie, or if h == false and the visiting team is interfering the goalie.


isGoalieKeepingPuck

public boolean isGoalieKeepingPuck(boolean h)
Returns true, if h == true and the home team goalie keeps the puck, or if h == false and the visiting team goalie keeps the puck.


isFoul

public boolean isFoul(boolean h)
Returns true, if h == true and the home team commits a foul, or if h == false and the visiting team commits a foul.


isPuckUnplayable

public boolean isPuckUnplayable()
Returns true, if the puck has become unplayable.


shoot

public void shoot(Player p,
                  double s)
Lets the player p shoot the puck with the proportional power s, if possible.


keepPuck

public void keepPuck(Player p)
Lets the goalkeeper p keep the puck, if possible.