public class ScoreTracker
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
ScoreTracker.ScoreCalculator
This will be the interface to a score calculator object.
|
Modifier and Type | Field and Description |
---|---|
private int |
askedQuestions |
private int |
cluesFound |
private int |
incorrectAccusations |
private long |
startTime |
Constructor and Description |
---|
ScoreTracker()
Construct a score tracker with all values set to an initial state.
|
ScoreTracker(long startTime)
Construct a score tracker where the start time is given.
|
Modifier and Type | Method and Description |
---|---|
void |
addClue()
Indicate to the score tracker that a clue has been found.
|
void |
addIncorrectAccusation()
Indicate to the score tracker that an incorrect accusation has happened.
|
void |
addQuestion()
Indicate to the score tracker that a question has been asked.
|
int |
collectScore(long currentTime,
ScoreTracker.ScoreCalculator scoreCalculator)
Combine all of the parameters into a single score.
|
int |
collectScore(ScoreTracker.ScoreCalculator scoreCalculator)
Combine all of the parameters into a single score.
|
private long startTime
private int incorrectAccusations
private int askedQuestions
private int cluesFound
public ScoreTracker(long startTime)
startTime
- The time stamp of the time the game started at.public ScoreTracker()
public void addIncorrectAccusation()
public void addQuestion()
public void addClue()
public int collectScore(long currentTime, ScoreTracker.ScoreCalculator scoreCalculator)
currentTime
- The end time to use to calculate the total time.scoreCalculator
- The score calculator to use.public int collectScore(ScoreTracker.ScoreCalculator scoreCalculator)
This method assumes that the game has ended the instant the method was called.
scoreCalculator
- The score calculator to use.