Package VASSAL.build.module.map
Class SimplePieceCollection
java.lang.Object
VASSAL.build.module.map.SimplePieceCollection
- All Implemented Interfaces:
PieceCollection
public class SimplePieceCollection extends Object implements PieceCollection
Stores
GamePiece
s in a simple array-
Constructor Summary
Constructors Constructor Description SimplePieceCollection()
-
Method Summary
Modifier and Type Method Description void
add(GamePiece p)
Adds a pieceboolean
canMerge(GamePiece p1, GamePiece p2)
Return true if the two pieces can be merged into a single stackvoid
clear()
Remove all piecesGamePiece[]
getAllPieces()
Return all pieces in the collection, regardless of visibilityGamePiece[]
getPieces()
Return all currently-visible pieces in the collection as a read-only arrayint
indexOf(GamePiece p)
Returns the index of a piece.void
moveToBack(GamePiece p)
Reposition a piece to the back of all others in the same layervoid
moveToFront(GamePiece p)
Reposition a piece to the front of all others in the same layervoid
remove(GamePiece p)
Removes the piecevoid
reposition(GamePiece p, int pos)
-
Constructor Details
-
SimplePieceCollection
public SimplePieceCollection()
-
-
Method Details
-
indexOf
Returns the index of a piece. When painting the map, pieces are drawn in order of index- Specified by:
indexOf
in interfacePieceCollection
-
canMerge
Description copied from interface:PieceCollection
Return true if the two pieces can be merged into a single stack- Specified by:
canMerge
in interfacePieceCollection
-
add
Description copied from interface:PieceCollection
Adds a piece- Specified by:
add
in interfacePieceCollection
-
clear
public void clear()Description copied from interface:PieceCollection
Remove all pieces- Specified by:
clear
in interfacePieceCollection
-
remove
Description copied from interface:PieceCollection
Removes the piece- Specified by:
remove
in interfacePieceCollection
-
getPieces
Description copied from interface:PieceCollection
Return all currently-visible pieces in the collection as a read-only array- Specified by:
getPieces
in interfacePieceCollection
-
getAllPieces
Description copied from interface:PieceCollection
Return all pieces in the collection, regardless of visibility- Specified by:
getAllPieces
in interfacePieceCollection
-
reposition
-
moveToBack
Description copied from interface:PieceCollection
Reposition a piece to the back of all others in the same layer- Specified by:
moveToBack
in interfacePieceCollection
-
moveToFront
Description copied from interface:PieceCollection
Reposition a piece to the front of all others in the same layer- Specified by:
moveToFront
in interfacePieceCollection
-