|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectwordFinderPuzzle.WFPuzzleReader
Read a text file which contains a representation of a word finder puzzle.
The format of the file is as follows:
Line 1 contains two integers, separated by a space. These
are number of rows (r) and number of columns (c) of the puzzle.
The next r lines each contain a string of exactly c characters.
These lines represent the rows of characters of the puzzle.
The next line contains a single number, which is the number (w) of
words
which are to be looked for in the puzzle.
The next w lines each contain one word to be searched for.
Any lines beyond this are ignored.
For example, the following represents a 3x3 puzzle with
two words to be searched for:
3 3
cat
ack
rtx
2
cat
act
There is a minimum number of rows and columns that a puzzle must be.
The number of rows and columns does not have to be the same.
Field Summary | |
static int |
MIN_COLS
Minimum number of columns a puzzle may have. |
static int |
MIN_ROWS
Minimum number of rows a puzzle may have. |
Constructor Summary | |
WFPuzzleReader(java.lang.String fileID)
Read in a file from a file. |
Method Summary | |
char[][] |
getMatrix()
Get the character matrix of the puzzle that was read in. |
java.lang.String[] |
getWords()
Get the list of words which are to be looked for in the puzzle. |
java.lang.String |
toString()
Give a short summary of the puzzle that was read in. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int MIN_ROWS
public static final int MIN_COLS
Constructor Detail |
public WFPuzzleReader(java.lang.String fileID) throws java.io.IOException
fileID
- Identifies a file, which may be local, or may
be a URL of a remote file. If local, the file should be on
the classpath, in the user directory, or someplace else likely.
java.io.IOException
- if there is any error reading the file.
java.lang.IllegalArgumentException
- if the file format is illegal.Method Detail |
public char[][] getMatrix()
public java.lang.String[] getWords()
public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |