|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectBoggleModel
public class BoggleModel
Constructor Summary | |
---|---|
BoggleModel(BoggleBoard b,
ILexicon lex)
Construct the model from a board and a lexicon. |
Method Summary | |
---|---|
int |
boardSize()
Returns the size of the model's board, currently all boards are square. |
java.util.List<BoardCell> |
cellsForWord(java.lang.String word)
Return a list of BoardCell objects corresponding to a word on the model's board. |
java.lang.String |
getFace(int row,
int col)
Return a string representing the face of a Boggle cube at the specified position on the model's current board. |
java.util.Iterator<java.lang.String> |
getLexiconIterator()
Return an iterator over the model's lexicon. |
int |
getScore(java.lang.String s)
Return the score for specific string according to standard rules of Boggle. |
void |
load(java.util.Scanner s)
Load the lexicon with words, thus the model will have a potentially new source of words other than the source with which it was constructed. |
void |
makeBoard(int size)
Generate a new board of the specified size (boards are square). |
void |
setFinder(IWordOnBoardFinder finder)
Supply the model with an object that finds words on the model's board, and thus allows games/players to access the cells of a word on a board via the method cellsForWord |
LexStatus |
wordStatus(java.lang.String s)
Return the status of a string, i.e., one of LexStatus.WORD , LexStatus.PREFIX
or LexStatus.NOT_WORD . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BoggleModel(BoggleBoard b, ILexicon lex)
b
- is the initial board for this modellex
- is the lexicon used by the modelMethod Detail |
---|
public void setFinder(IWordOnBoardFinder finder)
cellsForWord
finder
- is the new word finder used by the modelpublic java.lang.String getFace(int row, int col)
row
- specifies location on current boardcol
- specifies column of location on current board
java.lang.ArrayIndexOutOfBoundsException
- if row and col
aren't valid for the model's current boardpublic void load(java.util.Scanner s)
s
- is the source of the words for the model's lexiconpublic java.util.List<BoardCell> cellsForWord(java.lang.String word)
IWordOnBoardFinder
for complete documentation of the order of the cells
returned in the list. This method doesn't check the lexicon, just
the board as a source for the word.
word
- is the string being checked on the board to
see if it can be formed from adjacent board cells
public int boardSize()
public LexStatus wordStatus(java.lang.String s)
LexStatus.WORD
, LexStatus.PREFIX
or LexStatus.NOT_WORD
. See LexStatus
for documentation on these values.
s
- is string/word whose status is returned
public java.util.Iterator<java.lang.String> getLexiconIterator()
public void makeBoard(int size)
size
- is number of rows, e.g., the size of one
dimension of the board being generatedpublic int getScore(java.lang.String s)
s
- is word whose score is returned
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |