Fix warnings
This commit is contained in:
parent
48a9fa11e4
commit
0745a04b8e
3 changed files with 12 additions and 16 deletions
|
@ -9,10 +9,10 @@ import java.util.Set;
|
|||
* TODO bad javadoc
|
||||
*/
|
||||
public class CrosswordBuilder {
|
||||
private int width, height;
|
||||
private String solution;
|
||||
private Set<Word> words = new HashSet<>();
|
||||
private Set<PlacedWord> placedWords = new HashSet<>();
|
||||
private final int width, height;
|
||||
private final String solution;
|
||||
private final Set<Word> words = new HashSet<>();
|
||||
private final Set<PlacedWord> placedWords = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Creates a new {@link CrosswordBuilder}
|
||||
|
@ -65,7 +65,8 @@ public class CrosswordBuilder {
|
|||
|
||||
public CrosswordBuilder generate() {
|
||||
System.out.println("Generator invoked");
|
||||
placedWords = Generator.generate(width, height, solution, words.toArray(Word[]::new));
|
||||
// TODO perhaps making this an assignment and making placedWords not final is better
|
||||
placedWords.addAll(Generator.generate(width, height, solution, words.toArray(Word[]::new)));
|
||||
System.out.println("Generator done");
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
package eu.m724;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalTime;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class Generator {
|
||||
private int width, height;
|
||||
private String solution;
|
||||
private Word[] words;
|
||||
private final int width, height;
|
||||
private final String solution;
|
||||
private final Word[] words;
|
||||
|
||||
private char[][] charArray;
|
||||
private Set<PlacedWord> placedWords;
|
||||
private final char[][] charArray;
|
||||
private final Set<PlacedWord> placedWords;
|
||||
|
||||
private ThreadLocalRandom random = ThreadLocalRandom.current();
|
||||
private final ThreadLocalRandom random = ThreadLocalRandom.current();
|
||||
|
||||
private Generator(int width, int height, String solution, Word[] words) {
|
||||
this.width = width;
|
||||
|
|
|
@ -13,9 +13,6 @@ public class Renderer {
|
|||
SVGGraphics2D g2 = new SVGGraphics2D(crossword.width() * TILE_SIZE, crossword.height() * TILE_SIZE);
|
||||
g2.setPaint(Color.BLACK);
|
||||
|
||||
FontRenderContext frc = g2.getFontRenderContext();
|
||||
Font font = g2.getFont();
|
||||
|
||||
for (PlacedWord word : crossword.words()) {
|
||||
int x = word.x();
|
||||
int y = word.y();
|
||||
|
|
Loading…
Reference in a new issue