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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a piecebooleanReturn true if the two pieces can be merged into a single stackvoidclear()Remove all piecesReturn all pieces in the collection, regardless of visibilityReturn all currently-visible pieces in the collection as a read-only arrayintReturns the index of a piece.voidReposition a piece to the back of all others in the same visual layervoidReposition a piece to the front of all others in the same visual layervoidRemoves the piecevoidreposition(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:
indexOfin interfacePieceCollection
-
canMerge
Description copied from interface:PieceCollectionReturn true if the two pieces can be merged into a single stack- Specified by:
canMergein interfacePieceCollection
-
add
Description copied from interface:PieceCollectionAdds a piece- Specified by:
addin interfacePieceCollection
-
clear
public void clear()Description copied from interface:PieceCollectionRemove all pieces- Specified by:
clearin interfacePieceCollection
-
remove
Description copied from interface:PieceCollectionRemoves the piece- Specified by:
removein interfacePieceCollection
-
getPieces
Description copied from interface:PieceCollectionReturn all currently-visible pieces in the collection as a read-only array- Specified by:
getPiecesin interfacePieceCollection
-
getAllPieces
Description copied from interface:PieceCollectionReturn all pieces in the collection, regardless of visibility- Specified by:
getAllPiecesin interfacePieceCollection
-
reposition
-
moveToBack
Description copied from interface:PieceCollectionReposition a piece to the back of all others in the same visual layer- Specified by:
moveToBackin interfacePieceCollection
-
moveToFront
Description copied from interface:PieceCollectionReposition a piece to the front of all others in the same visual layer- Specified by:
moveToFrontin interfacePieceCollection
-