Class SimplePieceCollection
java.lang.Object
VASSAL.build.module.map.SimplePieceCollection
- All Implemented Interfaces:
PieceCollection
A SimplePieceCollection is used within a
CompoundPieceCollection
to maintain an array of the
pieces/stacks/decks (GamePiece
) within a single visual layer. Even within a
single "layer", the individual pieces can be rearranged, which will change their relative draw order
within that layer.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a pieceboolean
Return true if the two pieces can be merged into a single stackvoid
clear()
Remove all piecesReturn all pieces in the collection, regardless of visibilityReturn all currently-visible pieces in the collection as a read-only arrayint
Returns the index of a piece.void
Reposition a piece to the back of all others in the same visual layervoid
Reposition a piece to the front of all others in the same visual layervoid
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, so lowest index is drawn first and therefore appears at the "bottom", as later pieces are then drawn "on top of" it.- 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 visual layer- Specified by:
moveToBack
in interfacePieceCollection
-
moveToFront
Description copied from interface:PieceCollection
Reposition a piece to the front of all others in the same visual layer- Specified by:
moveToFront
in interfacePieceCollection
-