org.dolben.MarkN
Class Score

java.lang.Object
  extended by org.dolben.MarkN.Score
All Implemented Interfaces:
java.lang.Cloneable

public class Score
extends java.lang.Object
implements java.lang.Cloneable

This is the score for some guess compared to a target.


Constructor Summary
Score()
          constructs a new score
 
Method Summary
 java.lang.Object clone()
          makes a new copy of this score
 boolean correct()
          tests whether or not this score indicates a correct guess
 void count(boolean inplace)
          increments one of the score's counters
 boolean equal(Score s)
          tests whether or not this score is equal to the given one
 int getMisplaced()
          gets the number of digits which are in the wrong place
 int getPlaced()
          gets the number of digits which are in the right place
 void setMisplaced(int misplaced)
          sets the number of digits which are in the wrong place
 void setPlaced(int placed)
          sets the number of digits which are in the right place
 java.lang.String toString()
          makes a string of the score
 boolean valid()
          tests whether or not this score is valid
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Score

Score()
constructs a new score

Method Detail

clone

public java.lang.Object clone()
makes a new copy of this score

Overrides:
clone in class java.lang.Object
Returns:
the copy

setPlaced

public void setPlaced(int placed)
sets the number of digits which are in the right place

Parameters:
placed - the number of digits in the right place

getPlaced

public int getPlaced()
gets the number of digits which are in the right place

Returns:
the number of digits in the right place

setMisplaced

public void setMisplaced(int misplaced)
sets the number of digits which are in the wrong place

Parameters:
misplaced - the number of digits in the wrong place

getMisplaced

public int getMisplaced()
gets the number of digits which are in the wrong place

Returns:
the number of digits in the wrong place

correct

public boolean correct()
tests whether or not this score indicates a correct guess

Returns:
true iff this score is a correct guess

valid

public boolean valid()
tests whether or not this score is valid

Returns:
true iff this score is valid

equal

public boolean equal(Score s)
tests whether or not this score is equal to the given one

Parameters:
s - the score to check for equality
Returns:
true iff this score is equal to the given one

count

public void count(boolean inplace)
increments one of the score's counters

Parameters:
inplace - true iff the counter for digits in the right place is to be incremented

toString

public java.lang.String toString()
makes a string of the score

Overrides:
toString in class java.lang.Object
Returns:
the string of the score