From bbc7251d80e370adeec447f3e04460ec0146eabe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 31 Oct 2014 14:12:11 +0100 Subject: cleanup XxxCollection interfaces -> PawnSet and TileSet --- core/src/ch/asynk/tankontank/engine/Board.java | 5 ----- core/src/ch/asynk/tankontank/engine/PawnSet.java | 22 ---------------------- core/src/ch/asynk/tankontank/engine/TileSet.java | 23 ----------------------- 3 files changed, 50 deletions(-) diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java index 60a3611..5f54564 100644 --- a/core/src/ch/asynk/tankontank/engine/Board.java +++ b/core/src/ch/asynk/tankontank/engine/Board.java @@ -1,6 +1,5 @@ package ch.asynk.tankontank.engine; -import java.util.List; import java.util.Iterator; import java.util.Collection; import java.util.ArrayList; @@ -37,16 +36,12 @@ public abstract class Board implements Disposable { public Tile first(); public void enable(int i, boolean enable); - public void collectPawns(PawnCollection pawns); - public int fromNodes(Collection nodes); } public interface PawnCollection extends Collection { public Pawn first(); public void enable(int i, boolean enable); - public void collectTiles(TileCollection tiles); - public int fromNodes(Collection nodes); } public static class Config diff --git a/core/src/ch/asynk/tankontank/engine/PawnSet.java b/core/src/ch/asynk/tankontank/engine/PawnSet.java index d06fdd2..0df2332 100644 --- a/core/src/ch/asynk/tankontank/engine/PawnSet.java +++ b/core/src/ch/asynk/tankontank/engine/PawnSet.java @@ -1,7 +1,5 @@ package ch.asynk.tankontank.engine; -import java.util.Iterator; -import java.util.Collection; import java.util.LinkedHashSet; public class PawnSet extends LinkedHashSet implements Board.PawnCollection @@ -25,24 +23,4 @@ public class PawnSet extends LinkedHashSet implements Board.PawnCollection for (Pawn pawn : this) pawn.enableOverlay(i, enable); } - - public void collectTiles(Board.TileCollection tiles) - { - tiles.clear(); - for (Pawn pawn : this) - tiles.add(pawn.getTile()); - } - - public int fromNodes(Collection nodes) - { - clear(); - for (SearchBoard.Node node : nodes) { - Tile tile = board.getTile(node.col, node.row); - Iterator pawns = tile.iterator(); - while(pawns.hasNext()) - add(pawns.next()); - } - - return size(); - } } diff --git a/core/src/ch/asynk/tankontank/engine/TileSet.java b/core/src/ch/asynk/tankontank/engine/TileSet.java index 6f71b42..c8897f3 100644 --- a/core/src/ch/asynk/tankontank/engine/TileSet.java +++ b/core/src/ch/asynk/tankontank/engine/TileSet.java @@ -1,7 +1,5 @@ package ch.asynk.tankontank.engine; -import java.util.Iterator; -import java.util.Collection; import java.util.LinkedHashSet; public class TileSet extends LinkedHashSet implements Board.TileCollection @@ -25,25 +23,4 @@ public class TileSet extends LinkedHashSet implements Board.TileCollection for (Tile tile : this) board.enableOverlayOn(tile, i, enable); } - - public void collectPawns(Board.PawnCollection pawns) - { - pawns.clear(); - for (Tile tile : this) { - Iterator itr = tile.iterator(); - while(itr.hasNext()) - pawns.add(itr.next()); - } - } - - public int fromNodes(Collection nodes) - { - clear(); - for (SearchBoard.Node node : nodes) { - Tile tile = board.getTile(node.col, node.row); - add(tile); - } - - return size(); - } } -- cgit v1.1-2-g2b99