Skip to content

Commit

Permalink
made NQueens factory method public static
Browse files Browse the repository at this point in the history
  • Loading branch information
Zomis committed Jan 3, 2015
1 parent 93b945c commit 78a39b2
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void eightQueens() throws Exception {
assertEquals(92, solutions.getTotal(), 0.001);
}

private AnalyzeFactory<Integer> createQueens(int size) {
public static AnalyzeFactory<Integer> createQueens(int size) {
AnalyzeFactory<Integer> analyze = new AnalyzeFactory<Integer>();

for (int x = 0; x < size; x++) {
Expand Down Expand Up @@ -79,7 +79,7 @@ private AnalyzeFactory<Integer> createQueens(int size) {
return analyze;
}

private Collection<Integer> createDiagonal(int x, int y, int size, int offsetX, int offsetY) {
private static Collection<Integer> createDiagonal(int x, int y, int size, int offsetX, int offsetY) {
List<Integer> fields = new ArrayList<Integer>();
while (x < size && y < size && x >= 0 && y >= 0) {
fields.add(pos(x, y, size));
Expand All @@ -89,7 +89,7 @@ private Collection<Integer> createDiagonal(int x, int y, int size, int offsetX,
return fields;
}

private Integer pos(int x, int y, int size) {
private static Integer pos(int x, int y, int size) {
return y * size + x;
}

Expand Down

0 comments on commit 78a39b2

Please sign in to comment.