org.moyoman.debug
Class GroupRating

java.lang.Object
  |
  +--org.moyoman.debug.Debug
        |
        +--org.moyoman.debug.GroupRating

public class GroupRating
extends Debug

This class allows stones to be put into groups, and each group given a rating of between 0 and 1. Examples of the ratings would include the life and death status of the group, and how important the group is, where 1.0 would indicate an important group, and 0.0 would indicate that the group should be sacrificed.


Field Summary
private  float[] ratings
          Each rating corresponds to the corresponding element in stones.
private  ArrayList stones
          Each element is an ArrayList containing Stone objects.
 
Fields inherited from class org.moyoman.debug.Debug
 
Constructor Summary
GroupRating(String h)
          Create the GroupRating object.
 
Method Summary
 int addGroup(Stone[] st, float rating)
          Add a groupt of stones with a rating.
 float getRating(int group)
          Get the rating for the group.
 Stone[] getStones(int group)
          Get the stones associated with a particular group.
 int getTotalGroups()
          Get the total number of groups.
 DebugType getType()
          Get the debug type.
static void main(String[] args)
          This method is used for unit testing.
 String toString()
          Get a String representation of the object.
 
Methods inherited from class org.moyoman.debug.Debug
getHeaderType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

stones

private ArrayList stones
Each element is an ArrayList containing Stone objects.


ratings

private float[] ratings
Each rating corresponds to the corresponding element in stones.

Constructor Detail

GroupRating

public GroupRating(String h)
Create the GroupRating object.

Parameters:
h - The header.
Method Detail

main

public static void main(String[] args)
This method is used for unit testing.


addGroup

public int addGroup(Stone[] st,
                    float rating)
Add a groupt of stones with a rating.

Parameters:
st - The stones in the group.
rating - The rating of that group.
Returns:
The number of the new group.

getStones

public Stone[] getStones(int group)
                  throws IndexOutOfBoundsException
Get the stones associated with a particular group.

Parameters:
group - The number of the group.
Returns:
An array of stones.
Throws:
IndexOutOfBoundsException - Thrown if the group parameter is invalid.

getRating

public float getRating(int group)
                throws IndexOutOfBoundsException
Get the rating for the group.

Parameters:
group - - The number of the group.
Returns:
A float between 0.0 and 1.0.
Throws:
IndexOutOfBoundsException - Thrown if the group parameter is invalid.

getTotalGroups

public int getTotalGroups()
Get the total number of groups.

Returns:
The number of groups as an int.

toString

public String toString()
Get a String representation of the object.

Overrides:
toString in class Object
Returns:
A String which represents the object.

getType

public DebugType getType()
Get the debug type.

Specified by:
getType in class Debug
Returns:
DebugType.GROUPRATING.