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
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 Constructor Description SimplePieceCollection() -
Method Summary
Modifier and Type Method Description voidadd(GamePiece p)Adds a piecebooleancanMerge(GamePiece p1, GamePiece p2)Return true if the two pieces can be merged into a single stackvoidclear()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 arrayintindexOf(GamePiece p)Returns the index of a piece.voidmoveToBack(GamePiece p)Reposition a piece to the back of all others in the same visual layervoidmoveToFront(GamePiece p)Reposition a piece to the front of all others in the same visual layervoidremove(GamePiece p)Removes 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
-