Package ball.game.crossword
Class Puzzle
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- ball.util.MapView<Coordinate,V>
-
- ball.util.CoordinateMap<Cell>
-
- ball.game.crossword.Puzzle
-
- All Implemented Interfaces:
Serializable,Cloneable,Map<Coordinate,Cell>,SortedMap<Coordinate,Cell>,TableModel
public class Puzzle extends CoordinateMap<Cell> implements Cloneable
CrosswordPuzzle.- Author:
- Allen D. Ball
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPuzzle.Solution-
Nested classes/interfaces inherited from class ball.util.MapView
MapView.EntrySet
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Puzzleclone()Map<Label,String>clues()Map<String,String>headers()booleanisSolved()static Puzzleload(String path)List<String>notes()Puzzleparent()Method to get the parent of thisPuzzle.Puzzleseed()Method to get the "seed" of thisPuzzle.voidsetSolution(Coordinate coordinate, Character character)Method to set the solution in aPuzzle.Map<Label,Puzzle.Solution>solutions()Stream<Puzzle>solve(Set<CharSequence> dictionary)Method to solve aPuzzle.voidwriteTo(OutputStream out)voidwriteTo(PrintWriter out)voidwriteTo(Writer out)-
Methods inherited from class ball.util.CoordinateMap
addTableModelListener, asList, clear, column, columns, comparator, containsKey, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, firstKey, get, getColumnClass, getColumnCount, getColumnName, getMax, getMaxX, getMaxY, getMin, getMinX, getMinY, getRowCount, getTableModelListeners, getType, getValueAt, headMap, includes, isCellEditable, lastKey, map, put, put, remove, removeTableModelListener, resize, resize, row, rows, setValueAt, subMap, subMap, tailMap
-
Methods inherited from class java.util.AbstractMap
containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, toString, values
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, size
-
-
-
-
Method Detail
-
solutions
public Map<Label,Puzzle.Solution> solutions()
-
setSolution
public void setSolution(Coordinate coordinate, Character character)
Method to set the solution in aPuzzle.- Parameters:
coordinate- TheCoordinateof theCell..character- The solutionCharacter.- Throws:
IllegalArgumentException- If any of theCells are already with a differentCharacterthan specified in theString.
-
writeTo
public void writeTo(OutputStream out) throws IOException
- Parameters:
out- TheOutputStream.- Throws:
IOException- If thePuzzlecannot be written.
-
writeTo
public void writeTo(Writer out) throws IOException
- Parameters:
out- TheOutputStream.- Throws:
IOException- If thePuzzlecannot be written.
-
writeTo
public void writeTo(PrintWriter out) throws IOException
- Parameters:
out- TheOutputStream.- Throws:
IOException- If thePuzzlecannot be written.
-
clone
public Puzzle clone() throws CloneNotSupportedException
- Overrides:
clonein classAbstractMap<Coordinate,Cell>- Throws:
CloneNotSupportedException
-
load
public static Puzzle load(String path) throws IOException
- Parameters:
path- The resource path.- Returns:
- The
Puzzle. - Throws:
IOException- If the path cannot be parsed.
-
-