|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvitro.Actor
vitro.grid.GridActor
public class GridActor
GridActor provides a number of convenience methods for Actors that are meant to be part of a Grid model.
Field Summary | |
---|---|
protected static int[][] |
ADJACENT
A set of x/y deltas for vertically, horizontally and diagonally adjacent cells. |
protected static int[][] |
DIAGONAL
A set of x/y deltas for diagonally adjacent cells. |
protected Grid |
model
A reference to this Actor's Model. |
protected static int[][] |
ORTHOGONAL
A set of x/y deltas for vertically or horizontally adjacent cells. |
Constructor Summary | |
---|---|
GridActor(Grid model)
Build a new GridActor associated with a specific Model. |
Method Summary | |
---|---|
Location |
location()
Get the Location of this Actor in the current Model. |
MoveAction |
move(Location location,
Set<Action> options)
Find an Action corresponding to moving this Actor to a specific Location. |
Set<Action> |
moves(Set<Location> locations)
Produce a Set of MoveActions corresponding to moving this Actor to each of a Set of Locations. |
Set<Location> |
neighbors(int[][] deltas)
Obtain references to Location objects representing neighboring cells. |
Set<Location> |
neighbors(Location location,
int[][] deltas)
Obtain references to Location objects representing cells neighboring a specific Location. |
Set<Location> |
passableNeighbors(int[][] deltas)
Performs the same function as neighbors(), but only returns Locations which would be passable to a this Actor. |
Set<Location> |
passableNeighbors(Location location,
int[][] deltas)
Performs the same function as neighbors(), but only returns Locations which would be passable to a this Actor. |
Set<Location> |
pumpingNeighbors(int[][] deltas)
Performs the same function as neighbors(), but will "pump on" a delta for as long as the resulting Location is passable to this Actor. |
Methods inherited from class vitro.Actor |
---|
actions |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int[][] ORTHOGONAL
protected static final int[][] DIAGONAL
protected static final int[][] ADJACENT
protected final Grid model
Constructor Detail |
---|
public GridActor(Grid model)
Method Detail |
---|
public Location location()
public Set<Location> neighbors(int[][] deltas)
deltas
- a collection of x and y offsets to neighboring cells.
public Set<Location> neighbors(Location location, int[][] deltas)
location
- the origin Location.deltas
- a collection of x and y offsets to neighboring cells.
public Set<Location> passableNeighbors(Location location, int[][] deltas)
location
- the origin Location.deltas
- a collection of x and y offsets to neighboring cells.
public Set<Location> passableNeighbors(int[][] deltas)
deltas
- a collection of x and y offsets to neighboring cells.
public Set<Location> pumpingNeighbors(int[][] deltas)
deltas
- a collection of x and y offsets to neighboring cells.
public Set<Action> moves(Set<Location> locations)
locations
- the Locations to which this Actor might move.
public MoveAction move(Location location, Set<Action> options)
location
- the Actor's desired destination.options
- a Set of Actions to consider.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |