diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-31 14:12:11 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-31 14:12:11 +0100 |
commit | bbc7251d80e370adeec447f3e04460ec0146eabe (patch) | |
tree | 0668975e54c33e3b5b8cae4ef7a95326bf2057f7 | |
parent | 0c56e7f556277cf9518d0fb191539125e2e6adbf (diff) | |
download | RustAndDust-bbc7251d80e370adeec447f3e04460ec0146eabe.zip RustAndDust-bbc7251d80e370adeec447f3e04460ec0146eabe.tar.gz |
cleanup XxxCollection interfaces -> PawnSet and TileSet
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Board.java | 5 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/PawnSet.java | 22 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/TileSet.java | 23 |
3 files changed, 0 insertions, 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<SearchBoard.Node> nodes); } public interface PawnCollection extends Collection<Pawn> { public Pawn first(); public void enable(int i, boolean enable); - public void collectTiles(TileCollection tiles); - public int fromNodes(Collection<SearchBoard.Node> 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<Pawn> implements Board.PawnCollection @@ -25,24 +23,4 @@ public class PawnSet extends LinkedHashSet<Pawn> 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<SearchBoard.Node> nodes) - { - clear(); - for (SearchBoard.Node node : nodes) { - Tile tile = board.getTile(node.col, node.row); - Iterator<Pawn> 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<Tile> implements Board.TileCollection @@ -25,25 +23,4 @@ public class TileSet extends LinkedHashSet<Tile> 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<Pawn> itr = tile.iterator(); - while(itr.hasNext()) - pawns.add(itr.next()); - } - } - - public int fromNodes(Collection<SearchBoard.Node> nodes) - { - clear(); - for (SearchBoard.Node node : nodes) { - Tile tile = board.getTile(node.col, node.row); - add(tile); - } - - return size(); - } } |