org.moyoman.debug
Class SOI

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

public class SOI
extends Debug

This class represents groups of stones and empty points that are associated with them.


Field Summary
private  ArrayList groups
          Each element is an ArrayList containing Stone objects.
private  HashMap points
          Each key is an Integer, and each value is a Point array.
 
Fields inherited from class org.moyoman.debug.Debug
 
Constructor Summary
SOI(String h)
          Create a new SOI object.
 
Method Summary
 int addGroup(Stone[] stones)
          Add a group of stones.
 void addPoints(int group, Point[] pts)
          Add points to be associated with the specific group.
 Stone[] getGroupStones(int group)
          Return the stones in a particular group.
 Point[] getPoints(int group)
          Get the points associated with this group.
 int getTotalGroups()
          Return the total number of groups.
 DebugType getType()
          Get the debug type of this object.
static void main(String[] args)
          This method is used for unit testing.
 String toString()
          Return a String representation of this 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

groups

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


points

private HashMap points
Each key is an Integer, and each value is a Point array.

Constructor Detail

SOI

public SOI(String h)
Create a new SOI 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[] stones)
Add a group of stones.

Parameters:
stones - An array of stones that are one group.
Returns:
The number representing that group.

getGroupStones

public Stone[] getGroupStones(int group)
                       throws IndexOutOfBoundsException
Return the stones in a particular group.

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

getTotalGroups

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

Returns:
the total number of groups.

addPoints

public void addPoints(int group,
                      Point[] pts)
               throws IndexOutOfBoundsException
Add points to be associated with the specific group.

Parameters:
group - - The group number.
pts - - The array of points to be added.
Throws:
IndexOutOfBoundsException - - Thrown if the group number is invalid.

getPoints

public Point[] getPoints(int group)
                  throws IndexOutOfBoundsException
Get the points associated with this group.

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

toString

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

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

getType

public DebugType getType()
Get the debug type of this object.

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