|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.moyoman.debug.Debug | +--org.moyoman.debug.Legend
This class allows stones or points to be associated with a legend. There is a set of N symbols, and a set of stones or points are associated with the numbers 0 through N - 1. For example, the legend could consist of the three symbols "Forcing Move", "Ko Threat", "Ladder Breaker", and there would be a set of points associated with each. Or there could be the symbols, "Alive", "Dead", "Undetermined", and a set of stones associated with each. Each symbol in the legend may be associated with points or stones, but not both. It is also OK to have a symbol with no points or stones associated with it.
Field Summary | |
static short |
NONE
Value returned by getSymbolType if no points or stones are associated with it. |
private ArrayList |
points
Each element is an ArrayList containing Point objects. |
static short |
POINTS
Value returned by getSymbolType if points are associated with it. |
private ArrayList |
stones
Each element is an ArrayList containing Stone objects. |
static short |
STONES
Value returned by getSymbolType if stones are associated with it. |
private ArrayList |
symbols
Each element is a String object. |
Fields inherited from class org.moyoman.debug.Debug |
|
Constructor Summary | |
Legend(String h)
Create the Legend object. |
Method Summary | |
void |
addPoint(Point point,
int symbol)
Associate a point with one of the strings. |
void |
addPoints(Point[] pt,
int symbol)
Associate points with one of the strings. |
void |
addStone(Stone stone,
int symbol)
Associate a stone with one of the strings. |
void |
addStones(Stone[] st,
int symbol)
Associate stones with one of the strings. |
int |
addSymbol(String symbol)
Create a new symbol. |
Point[] |
getPoints(int symbol)
Get the points associated with a particular symbol. |
Stone[] |
getStones(int symbol)
Get the stones associated with a particular symbol. |
String |
getSymbol(int number)
Return the string associated with the particular number. |
short |
getSymbolType(int symbol)
Determine the type of symbol, either NONE, POINTS, or STONES. |
int |
getTotalSymbols()
The total number of symbols in the legend. |
DebugType |
getType()
Get the debug type. |
String |
toString()
Get 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 |
public static final short NONE
public static final short POINTS
public static final short STONES
private ArrayList symbols
private ArrayList stones
private ArrayList points
Constructor Detail |
public Legend(String h)
h
- The header.Method Detail |
public int addSymbol(String symbol)
symbol
- The string which is part of the legend.
public short getSymbolType(int symbol) throws IndexOutOfBoundsException
symbol
- - The number of the symbol.
IndexOutOfBoundsException
- Thrown if the symbol parameter
is invalid.public void addStone(Stone stone, int symbol) throws IndexOutOfBoundsException, InconsistentStateException
stone
- The stone to be added.symbol
- The number of the symbol.
IndexOutOfBoundsException
- Thrown if symbol
is invalid.
InconsistentStateException
- - Thrown if
points have already beena associated with this symbol.public void addStones(Stone[] st, int symbol) throws IndexOutOfBoundsException, InconsistentStateException
st
- The stones to be added.symbol
- The number of the symbol.
IndexOutOfBoundsException
- Thrown if symbol
is invalid.
InconsistentStateException
- - Thrown if
points have already beena associated with this symbol.public void addPoint(Point point, int symbol) throws IndexOutOfBoundsException, InconsistentStateException
point
- The point to be added.symbol
- The number of the symbol.
IndexOutOfBoundsException
- Thrown if symbol
is invalid.
InconsistentStateException
- - Thrown if
stones have already beena associated with this symbol.public void addPoints(Point[] pt, int symbol) throws IndexOutOfBoundsException, InconsistentStateException
pt
- The points to be added.symbol
- The number of the symbol.
IndexOutOfBoundsException
- Thrown if symbol
is invalid.
InconsistentStateException
- - Thrown if
stones have already beena associated with this symbol.public String getSymbol(int number) throws IndexOutOfBoundsException
number
- The number of the symbol.
IndexOutOfBoundsException
- Thrown if symbol
is invalid.public int getTotalSymbols()
public Stone[] getStones(int symbol) throws IndexOutOfBoundsException
symbol
- The number of the symbol.
IndexOutOfBoundsException
- Thrown if symbol
is invalid.public Point[] getPoints(int symbol) throws IndexOutOfBoundsException
symbol
- The number of the symbol.
IndexOutOfBoundsException
- Thrown if symbol
is invalid.public String toString()
toString
in class Object
public DebugType getType()
getType
in class Debug
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |