mvc143
Interface IBoggleModel


public interface IBoggleModel

This interface provides the methods needed for the Boggle Model, that is, methods to manipulate the board data, score data and dictionary model.
The constructor of BoggleModel must take exactly these four parameters: a String specifying the board file to be loaded initially (may be null). a String specifying the dictionary file to be loaded (may be null). an int which specifies how many rows the board should be (>=4). an int which specifies how many cols the board be (>=4). *
IMPORTANT NOTE #2 : You must define these two public static fields to specify the author and a brief description. as follows:
public static final String author = " ... ";
public static final String description = " ... ";
"authors" should identify the authors in some fashion, but pseudonyms or nicknames are acceptable. "description" should give a brief description of the module, especially if there are any unexpected or unique features about it. The information in both fields may be visible to the general public, indefinitely into the future, so do not place any information here which you do not wish to be publicly available.


Method Summary
 int addScore(int scoreAugment)
          Add to the score.
 boolean createBoard(String fileID)
          create a new board by loading from a resource (file) if fileID is null, the board is created internally (for example, it randomly assigns the characters for each cell).
 int getCols()
          Tells the number of columns of the board.
 int getLetter(int row, int col)
          Retrive the character on the cell specified by col and row.
 int getRows()
          Tells the number of rows of the board
 int getScore()
          Tell the current score.
 IBoggleWordsModel getWordsModel()
          make the words model object visible to controller
 void resetScore()
          Reset the score to zero; for example, at the start of another game.
 void terminate()
          Perform cleanup when the application is about to end.
 

Method Detail

createBoard

public boolean createBoard(String fileID)
create a new board by loading from a resource (file) if fileID is null, the board is created internally (for example, it randomly assigns the characters for each cell).

Parameters:
fileID - a String specifies the resource (file) of a designed board; or null if an internally generated board should be produced.
Returns:
true, if the board successfully has been created; false, otherwise

getLetter

public int getLetter(int row,
                     int col)
Retrive the character on the cell specified by col and row. If the position is invalid, return -1.

Parameters:
col - the column in the board
row - the row in the board
Returns:
the character at that position, or -1, if the position is invalid.

getCols

public int getCols()
Tells the number of columns of the board.

Returns:
the columns of the board.

getRows

public int getRows()
Tells the number of rows of the board

Returns:
the rows of the board.

addScore

public int addScore(int scoreAugment)
Add to the score.

Parameters:
scoreAugment - >=0, the value to be added to the total score.
Returns:
the total score after modification.

getScore

public int getScore()
Tell the current score.

Returns:
the current score.

resetScore

public void resetScore()
Reset the score to zero; for example, at the start of another game.


getWordsModel

public IBoggleWordsModel getWordsModel()
make the words model object visible to controller

Returns:
the words model object used by this model.

terminate

public void terminate()
Perform cleanup when the application is about to end. Should only be called by the Controller. (You don't neccessarily need to do anything, but it's an opportunity.)