Class ScoreBoard

java.lang.Object
  |
  +--ScoreBoard

public class ScoreBoard
extends java.lang.Object


Field Summary
static int SECSINPERIOD
           
 
Constructor Summary
ScoreBoard()
          Creates new ScoreBoard
 
Method Summary
 void adjustClock(int secs)
          Change the value for seconds left in a period - pass negative number if want to decrease (take time off the clock) pass a positive number to add time
 void beginGame(java.lang.String home, java.lang.String away)
          Establish a bunch of things appropriate to the beginning of a game
 void copyMe(ScoreBoard toChange)
          Make a passed score board a copy of the current (calling) score board Not necessary because we have the above - but done to illustrate that object parameters are called by reference - so they can be changed inside the method (unlike primitive parameters such as ints) copy all instance variables
 void copyOf(ScoreBoard toCopy)
          Make a score board a copy of a passed scoreboard copy all instance variables
 boolean endPeriod()
          reports whether the period is over (clock is zero)
 boolean equals(ScoreBoard toCompare)
          Determine if two scoreboards should be considered equal I think probably we want all instance variables to be equal in order to consider the objects equal
 java.lang.String getAwayName()
          Report away teams name
 int getAwayScore()
          Report away teams score
 int getCurrMargin()
          return how much the leading team is leading by
 java.lang.String getHomeName()
          Report home teams name
 int getHomeScore()
          Report home teams score
 java.lang.String getLeadingTeam()
          Report who is leading
 int getPeriod()
          Report which period it is
 int getTimeLeft()
          Report number of seconds left in period
 java.lang.String getTimeLeftString()
          Report time left in period in a friendly string format
 int makeFoulShot(java.lang.String team)
          score a foul shot (1 point) for a given team
 int makeThreePoint(java.lang.String team)
          score a three point shot (long field goal) for a given team
 int makeTwoPoint(java.lang.String team)
          score a two point shot (regular field goal) for a given team
 void nextPeriod()
          advance the period number to the next period
 void setAwayName(java.lang.String name)
          Establish a new value for away teams name - should probably only be used at very beginning
 void setAwayScore(int score)
          Establish a new value for away teams score - should probably only be used at very beginning
 void setHomeName(java.lang.String name)
          Establish a new value for home teams name - should probably only be used at very beginningwhich period it is
 void setHomeScore(int score)
          Establish a new value for home teams score - should probably only be used at very beginning
 void setPeriod(int per)
          Establish a new value for period in game - should probably only be used at very beginning
 void setTimeLeft(int secs)
          Establish a new value for seconds left in a period - should probably only be used at very beginning
 java.lang.String toString()
          Prepare for nice output of score board
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SECSINPERIOD

public static final int SECSINPERIOD
Constructor Detail

ScoreBoard

public ScoreBoard()
Creates new ScoreBoard
Method Detail

getHomeName

public java.lang.String getHomeName()
Report home teams name

getAwayName

public java.lang.String getAwayName()
Report away teams name

getHomeScore

public int getHomeScore()
Report home teams score

getAwayScore

public int getAwayScore()
Report away teams score

getTimeLeft

public int getTimeLeft()
Report number of seconds left in period

getTimeLeftString

public java.lang.String getTimeLeftString()
Report time left in period in a friendly string format

getLeadingTeam

public java.lang.String getLeadingTeam()
Report who is leading

getCurrMargin

public int getCurrMargin()
return how much the leading team is leading by

getPeriod

public int getPeriod()
Report which period it is

endPeriod

public boolean endPeriod()
reports whether the period is over (clock is zero)

toString

public java.lang.String toString()
Prepare for nice output of score board
Overrides:
toString in class java.lang.Object

equals

public boolean equals(ScoreBoard toCompare)
Determine if two scoreboards should be considered equal I think probably we want all instance variables to be equal in order to consider the objects equal

beginGame

public void beginGame(java.lang.String home,
                      java.lang.String away)
Establish a bunch of things appropriate to the beginning of a game

setHomeName

public void setHomeName(java.lang.String name)
Establish a new value for home teams name - should probably only be used at very beginningwhich period it is

setAwayName

public void setAwayName(java.lang.String name)
Establish a new value for away teams name - should probably only be used at very beginning

setHomeScore

public void setHomeScore(int score)
Establish a new value for home teams score - should probably only be used at very beginning

setAwayScore

public void setAwayScore(int score)
Establish a new value for away teams score - should probably only be used at very beginning

setPeriod

public void setPeriod(int per)
Establish a new value for period in game - should probably only be used at very beginning

setTimeLeft

public void setTimeLeft(int secs)
Establish a new value for seconds left in a period - should probably only be used at very beginning

adjustClock

public void adjustClock(int secs)
Change the value for seconds left in a period - pass negative number if want to decrease (take time off the clock) pass a positive number to add time

makeFoulShot

public int makeFoulShot(java.lang.String team)
score a foul shot (1 point) for a given team

makeTwoPoint

public int makeTwoPoint(java.lang.String team)
score a two point shot (regular field goal) for a given team

makeThreePoint

public int makeThreePoint(java.lang.String team)
score a three point shot (long field goal) for a given team

nextPeriod

public void nextPeriod()
advance the period number to the next period

copyOf

public void copyOf(ScoreBoard toCopy)
Make a score board a copy of a passed scoreboard copy all instance variables

copyMe

public void copyMe(ScoreBoard toChange)
Make a passed score board a copy of the current (calling) score board Not necessary because we have the above - but done to illustrate that object parameters are called by reference - so they can be changed inside the method (unlike primitive parameters such as ints) copy all instance variables