VASSAL.build.module.map
Class SimplePieceCollection

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

public class SimplePieceCollection
extends java.lang.Object
implements PieceCollection

Stores GamePieces in a simple array


Constructor Summary
SimplePieceCollection()
           
 
Method Summary
 void add(GamePiece p)
          Adds a piece
 void clear()
          Remove all pieces
 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
 void reposition(GamePiece s, int pos)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimplePieceCollection

public SimplePieceCollection()
Method Detail

indexOf

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

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

remove

public void remove(GamePiece p)
Description copied from interface: PieceCollection
Removes the piece
Specified by:
remove 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

reposition

public void reposition(GamePiece s,
                       int pos)

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