public class MissingVowelsPuzzle extends AbstractWordPuzzle
MissingVowelsPuzzle p = new MissingVowelsPuzzle("facetious");
System.out.println(p);
outputs:
f_c_t___s : facetious
A second example where the puzzle has multiple solutions:
MissingVowelsPuzzle p = new MissingVowelsPuzzle("cat", "cot", "cut");
System.out.println(p);
outputs:
c_t : cat, cot, cut
Constructor and Description |
---|
MissingVowelsPuzzle(String solution)
Constructs a missing vowels word puzzle for the solution word
solution . |
MissingVowelsPuzzle(String solution,
String... otherSolutions)
Constructs a missing vowels word puzzle for the solution word
solution . |
Modifier and Type | Method and Description |
---|---|
String |
getSolution()
Get the solution word.
|
SortedSet<String> |
getSolutions()
Get a sorted set of all of the solution words.
|
getPuzzleWord, setPuzzleWord, toString
public MissingVowelsPuzzle(String solution)
solution
. The puzzle word is the solution word with the
letters 'a', 'e', 'i', 'o', and 'u' replaced with an underscore '_'.solution
- a solution wordpublic MissingVowelsPuzzle(String solution, String... otherSolutions)
solution
. All other possible solutions should also be
provided.IllegalArgumentException
- if a solution in otherSolutions
is incompatible with
solution
.solution
- a solution wordotherSolutions
- all other solutions to the puzzlepublic String getSolution()
getSolution
in class AbstractWordPuzzle
public SortedSet<String> getSolutions()
The set returned by this method cannot be used to modify the solutions for this puzzle.
getSolutions
in class AbstractWordPuzzle