VASSAL.build.module.map
Class DefaultPieceCollection

java.lang.Object
  |
  +--VASSAL.build.module.map.DefaultPieceCollection
All Implemented Interfaces:
PieceCollection

public class DefaultPieceCollection
extends java.lang.Object
implements PieceCollection

Default implementation of PieceCollection separates pieces into two layers: stacking pieces always above non-stacking pieces


Constructor Summary
DefaultPieceCollection()
           
 
Method Summary
 void add(GamePiece p)
          Adds a piece
 void clear()
          Remove all pieces
protected  PieceCollection getCollectionForPiece(GamePiece p)
           
 GamePiece[] getPieces()
          Return all pieces in the collection as a read-only array
 int 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 layer
 void moveToFront(GamePiece p)
          Reposition a piece to the front of all others in the same layer
 void remove(GamePiece p)
          Removes the piece
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPieceCollection

public DefaultPieceCollection()
Method Detail

getCollectionForPiece

protected PieceCollection getCollectionForPiece(GamePiece p)

add

public void add(GamePiece p)
Description copied from interface: PieceCollection
Adds a piece
Specified by:
add in interface PieceCollection

clear

public void clear()
Description copied from interface: PieceCollection
Remove all pieces
Specified by:
clear in interface PieceCollection

getPieces

public GamePiece[] getPieces()
Description copied from interface: PieceCollection
Return all pieces in the collection as a read-only array
Specified by:
getPieces in interface PieceCollection

indexOf

public int indexOf(GamePiece p)
Description copied from interface: PieceCollection
Returns the index of a piece. When painting the map, pieces are drawn in order of index
Specified by:
indexOf in interface PieceCollection

remove

public void remove(GamePiece p)
Description copied from interface: PieceCollection
Removes the piece
Specified by:
remove in interface PieceCollection

moveToBack

public void moveToBack(GamePiece p)
Description copied from interface: PieceCollection
Reposition a piece to the back of all others in the same layer
Specified by:
moveToBack in interface PieceCollection

moveToFront

public void moveToFront(GamePiece p)
Description copied from interface: PieceCollection
Reposition a piece to the front of all others in the same layer
Specified by:
moveToFront in interface PieceCollection