org.moyoman.util
Class RatedMove

java.lang.Object
  |
  +--org.moyoman.util.Move
        |
        +--org.moyoman.util.RatedMove
All Implemented Interfaces:
Cloneable, Comparable, Serializable

public class RatedMove
extends Move
implements Comparable

This class represents a move which has been rated. The rating consists of two factors, the quality of the move, and the confidence in the rating. The rating varies between -1.0 and 1.0, where 1.0 is a highly rated move, and -1.0 a very bad move. The confidence varies between 0.0 and 1.0, where 1.0 indicates a high degree of confidence in the rating, and 0.0 indicates a very low degree of confidence in the rating.

See Also:
Serialized Form

Field Summary
private  float confidence
          The confidence in the rating, 1.0 is very confident, 0.0 is no confidence.
private  String message
          An optional message explaining the move, which is not null.
private  float rating
          The rating of the move, 1.0 is very good, - 1,0 is very bad.
 
Fields inherited from class org.moyoman.util.Move
PASS, RESIGNATION, STONE_PLAYED
 
Constructor Summary
RatedMove(NumberedStone stone, float r, float conf)
          Create a new RatedMove object.
RatedMove(short type, short num, Color color, float r, float conf)
          Create a new RatedMove object.
 
Method Summary
 Object clone()
          Clone this object.
 int compareTo(Object o)
          Compare a RatedMove object with this one for sorting purposes.
 float getConfidence()
          Return the confidence in the rating.
 String getMessage()
          Return the message for this move.
 float getRating()
          Return the rating of the move.
 void setMessage(String m)
          Set the message.
 String toString()
          Return a String representation of this object.
 
Methods inherited from class org.moyoman.util.Move
getColor, getMoveNumber, getNumberedStone, isNumberedStone, isPass, isResignation
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rating

private float rating
The rating of the move, 1.0 is very good, - 1,0 is very bad.


confidence

private float confidence
The confidence in the rating, 1.0 is very confident, 0.0 is no confidence.


message

private String message
An optional message explaining the move, which is not null.

Constructor Detail

RatedMove

public RatedMove(NumberedStone stone,
                 float r,
                 float conf)
          throws IllegalArgumentException
Create a new RatedMove object.

Parameters:
stone - The stone which is the rated move.
r - The rating of the move, which varies between -1,0 and 1.0.
conf - The confidence in the rating, which varies between 0.0 and 1.0.
Throws:
IllegalArgumentException - - Thrown if either the rating or confidence are outside of their allowed ranges.

RatedMove

public RatedMove(short type,
                 short num,
                 Color color,
                 float r,
                 float conf)
          throws IllegalArgumentException
Create a new RatedMove object.

Parameters:
type - - either Move.PASS, or Move.RESIGNATION.
num - - The move number.
color - - The color of the move.
r - The rating of the move, which varies between -1.0 and 1.0.
conf - The confidence in the rating, which varies between 0.0 and 1.0.
Throws:
IllegalArgumentException - - Thrown if either the rating or confidence are outside of their allowed ranges.
Method Detail

setMessage

public void setMessage(String m)
Set the message. The String parameter is meant to be read by the user, and so should be appropriate for the users language.

Parameters:
m - The message.

getRating

public float getRating()
Return the rating of the move.

Returns:
A value between -1.0 and 1.0.

getConfidence

public float getConfidence()
Return the confidence in the rating.

Returns:
A value between 0.0 and 1.0.

getMessage

public String getMessage()
Return the message for this move.

Returns:
A String object, which is not null, but may be of length 0.

compareTo

public int compareTo(Object o)
Compare a RatedMove object with this one for sorting purposes. RatedMove objects are sorted by their rating.

Specified by:
compareTo in interface Comparable
Parameters:
o - An Object which should be a RatedMove.
Returns:
An int, which is -1 if this object has a lower rating than the parameter, 1 if it has a higher rating, and 0 if they are the same, or if o is not a RatedMove object.

toString

public String toString()
Return a String representation of this object.

Overrides:
toString in class Move
Returns:
A String object.

clone

public Object clone()
Clone this object.

Overrides:
clone in class Move
Returns:
A RatedMove object which is a clone of this one.