|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--VASSAL.counters.Stack
A collection of GamePieces which can be moved as a single unit
| Field Summary | |
protected GamePiece[] |
contents
|
protected Map |
map
|
protected int |
pieceCount
|
protected java.awt.Point |
pos
|
static java.lang.String |
TYPE
|
| Constructor Summary | |
Stack()
|
|
Stack(GamePiece p)
|
|
| Method Summary | |
void |
add(GamePiece c)
|
GamePiece |
bottomPiece()
|
java.awt.Rectangle |
boundingBox()
The area which this GamePiece occupies when drawn at the point given by getPosition(). |
void |
draw(java.awt.Graphics g,
int x,
int y,
java.awt.Component obs,
double zoom)
If the obs parameter is a Map, delegate
drawing of this Stack to the StackMetrics of that Map. |
StackMetrics |
getDefaultMetrics()
|
java.lang.String |
getId()
Each GamePiece must have a unique String identifier |
Map |
getMap()
|
java.lang.String |
getName()
Return a comma-separated list of the names of the pieces in this Stack |
Stack |
getParent()
|
GamePiece |
getPieceAt(int index)
|
int |
getPieceCount()
|
java.util.Enumeration |
getPieces()
|
java.util.Enumeration |
getPiecesInReverseOrder()
|
java.util.Enumeration |
getPiecesInVisibleOrder()
Returns pieces in the order in which they are visible to the player -- topmost first In other words, selected pieces first, then unselected pieces from the top to the bottom |
java.awt.Point |
getPosition()
|
java.lang.Object |
getProperty(java.lang.Object key)
|
java.lang.String |
getState()
The state information is information that can change during the course of a game. |
java.lang.String |
getType()
The type information is information that does not change during the course of a game. |
int |
indexOf(GamePiece p)
|
void |
insert(GamePiece p,
int pos)
|
boolean |
isExpanded()
|
Command |
keyEvent(javax.swing.KeyStroke stroke)
Keyboard events are forward to this method when a piece is selected The GamePiece can respond in any way it likes |
void |
mergeState(java.lang.String newState,
java.lang.String oldState)
Compute the difference between newState and oldState
and appy that difference to the current state |
protected int |
nVisible()
|
void |
remove(GamePiece p)
|
void |
removeAll()
|
java.awt.Rectangle |
selectionBounds()
The area which is considered part of this GamePiece for purposes of selecting it with the mouse |
void |
selectNext(GamePiece c)
|
static void |
setDefaultMetrics(StackMetrics s)
|
void |
setExpanded(boolean b)
|
void |
setId(java.lang.String id)
|
void |
setMap(Map map)
|
void |
setParent(Stack s)
|
void |
setPosition(java.awt.Point p)
|
void |
setProperty(java.lang.Object key,
java.lang.Object val)
The GamePiece should store properties for retrieval (e.g in a Hashtable) It is not necessary that properties stored with this method be retained in the piece's getState() method. |
void |
setState(java.lang.String s)
|
GamePiece |
topPiece()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String TYPE
protected GamePiece[] contents
protected int pieceCount
protected java.awt.Point pos
protected Map map
| Constructor Detail |
public Stack()
public Stack(GamePiece p)
| Method Detail |
public java.util.Enumeration getPieces()
public java.util.Enumeration getPiecesInReverseOrder()
public java.util.Enumeration getPiecesInVisibleOrder()
public void remove(GamePiece p)
public void removeAll()
public int indexOf(GamePiece p)
public GamePiece getPieceAt(int index)
public void add(GamePiece c)
public int getPieceCount()
public void insert(GamePiece p,
int pos)
public void draw(java.awt.Graphics g,
int x,
int y,
java.awt.Component obs,
double zoom)
obs parameter is a Map, delegate
drawing of this Stack to the StackMetrics of that Map.
If obs is not a Map, use the default StackMetrics
draw in interface GamePieceStackMetrics.draw(VASSAL.counters.Stack, java.awt.Graphics, int, int, java.awt.Component, double),
getDefaultMetrics()public java.lang.String getName()
getName in interface GamePiecepublic java.awt.Rectangle boundingBox()
GamePiece
boundingBox in interface GamePiecepublic java.awt.Rectangle selectionBounds()
GamePiece
selectionBounds in interface GamePiecepublic void selectNext(GamePiece c)
public GamePiece topPiece()
public GamePiece bottomPiece()
protected int nVisible()
public Command keyEvent(javax.swing.KeyStroke stroke)
GamePiece
keyEvent in interface GamePieceCommand that, when executed, will invoke
the same response. Usually a ChangePiece command.ForwardToKeyBufferpublic boolean isExpanded()
public void setExpanded(boolean b)
public java.lang.String getState()
GamePiece
getState in interface GamePiecepublic void setState(java.lang.String s)
setState in interface GamePiece
public void mergeState(java.lang.String newState,
java.lang.String oldState)
newState and oldState
and appy that difference to the current state
newState - oldState - public java.lang.String getType()
GamePiece
getType in interface GamePieceBasicCommandEncoder
public void setProperty(java.lang.Object key,
java.lang.Object val)
GamePieceGamePiece.getState() method.
setProperty in interface GamePiecepublic java.lang.Object getProperty(java.lang.Object key)
getProperty in interface GamePiecepublic void setMap(Map map)
setMap in interface GamePiecepublic Map getMap()
getMap in interface GamePiecepublic java.awt.Point getPosition()
getPosition in interface GamePiecepublic void setPosition(java.awt.Point p)
setPosition in interface GamePiecepublic Stack getParent()
getParent in interface GamePiecepublic void setParent(Stack s)
setParent in interface GamePiecepublic java.lang.String getId()
GamePiece
getId in interface GamePieceGameState.getNewPieceId()public void setId(java.lang.String id)
setId in interface GamePiecepublic static void setDefaultMetrics(StackMetrics s)
public StackMetrics getDefaultMetrics()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||