|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ascape.model.AscapeObject
org.ascape.model.Agent
org.ascape.model.LocatedAgent
org.ascape.model.Cell
org.ascape.model.CellOccupant
public class CellOccupant
An occupant of a cell within a lattice.
| Field Summary | |
|---|---|
static Rule |
PLAY_HOST_RULE
An rule causing the target agent to interact with each of its neighbors as specified by the Agent.play() method. |
static Rule |
RANDOM_WALK_AVAILABLE_RULE
A rule causing the taget agent to take a random walk. |
| Fields inherited from class org.ascape.model.Cell |
|---|
CALCULATE_NEIGHBORS_RULE, neighbors, PLAY_NEIGHBORS_RULE, PLAY_RANDOM_NEIGHBOR_RULE |
| Fields inherited from class org.ascape.model.LocatedAgent |
|---|
agentSize, coordinate, MOVE_RANDOM_LOCATION_RULE, RANDOM_WALK_RULE, thisUpdate |
| Fields inherited from class org.ascape.model.Agent |
|---|
DEATH_RULE, FISSIONING_RULE, FORCE_DIE_RULE, FORCE_FISSION_RULE, FORCE_MOVE_RULE, INITIALIZE_RULE, ITERATE_AND_UPDATE_RULE, ITERATE_RULE, METABOLISM_RULE, MOVEMENT_RULE, PLAY_OTHER, UPDATE_RULE |
| Fields inherited from class org.ascape.model.AscapeObject |
|---|
ARBITRARY_SEED, name, PLATFORM_DEFAULT_COLOR, scape |
| Constructor Summary | |
|---|---|
CellOccupant()
|
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Clone this occupant, making host cell and coordinate null, since for a base cell occupant it is illegal for more than one cell to occupy the same location. |
void |
die()
Removes the agent from play, causing it to vacate its host cell. |
java.util.List |
findAvailableNeighbors()
Returns unoccupied cells neighboring this cell's location on the host cell's lattice. |
LocatedAgent |
findNearest()
Returns the closest agent. |
LocatedAgent |
findNearest(Conditional condition)
Returns the closest agent within the specified distance from this agent that meet some condition. |
LocatedAgent |
findNearest(Conditional condition,
boolean includeSelf,
double distance)
Returns the closest agent within the specified distance from this agent that meet some condition. |
LocatedAgent |
findNearest(Conditional condition,
double distance)
Returns the closest agent within the specified distance from this agent that meet some condition. |
LocatedAgent |
findNearest(double distance)
Returns the closest agent within the specified distance from this agent that meet some condition. |
java.util.List |
findNeighbors()
Returns this cells neighbors, that is, the set of cells adjoining this cell as defined by the scape's geometry. |
java.util.List |
findNeighborsOnHost()
Overides the getNeighbors method to return the cell's occupants neighboring this cell's location on its host cell's lattice. |
Node |
findRandomAvailableNeighbor()
Find random neighbor. |
Node |
findRandomNeighbor()
Returns a cell randomly selected from among this cell's neighbors. |
Cell |
findRandomNeighborOnHost()
Returns a random neighbor on host, if any exist neighboring this cell's location on its host cell's lattice. |
java.util.List |
findWithin(Conditional condition,
boolean includeSelf,
double distance)
Returns all agents within the specified distance of the agent on the host scape. |
java.util.List |
findWithin(Conditional condition,
double distance)
Returns all agents within the specified distance of the agent on the host scape. |
java.util.List |
findWithin(double distance)
Returns all agents within the specified distance of the agent on the host scape. |
Coordinate |
getCoordinate()
Gets a coordinate the location of this cell within the relevant Host Scape. |
HostCell |
getHostCell()
Returns the cell that this cell occupies in the host cell's lattice. |
Scape |
getHostScape()
Returns the lattice that hosts this cell. |
void |
leave()
Removes this cell from the current host cell. |
void |
moveAway(LocatedAgent targetCell)
Move one step away from the occupant of the supplied host cell. |
void |
moveTo(HostCell hostCell)
Assigns this cell as the occupant of the supplied host cell. |
void |
moveToRandomLocation()
Moves this cell to a random unoccupied location on the host scape. |
void |
moveToward(LocatedAgent targetCell)
Move one step toward the occupant of the supplied host cell. |
void |
playNeighbors()
Interact with each neighbor as specified by the Agent.play() method. |
void |
playRandomNeighbor()
Interact with each neighbor as specified by the Agent.play() method. |
void |
randomWalk()
Picks a random neighboring location on the host cell's lattice. |
void |
randomWalkAvailable()
Picks a random available neighboring location on the host cell's lattice. |
void |
setHostCell(HostCell hostCell)
Sets the cell that this cell occupies in the host cell's lattice. |
void |
setHostScape(Scape hostScape)
Sets the lattice that hosts this cell. |
| Methods inherited from class org.ascape.model.Cell |
|---|
calculateNeighbors, countNeighbors, findOccupants, findRelative, getDistance, getNeighbors, getNeighbors, getNetwork, getOccupant, hostedCondition, initialize, isAvailable, removeOccupant, setNeighbors, setNeighborsList, setNetwork, setOccupant, toString |
| Methods inherited from class org.ascape.model.LocatedAgent |
|---|
calculateDistance, calculateDistance, countWithin, countWithin, countWithin, findMaximumWithin, findWithin, getAgentSize, hasWithin, hasWithin, hasWithin, isUpdateNeeded, moveAway, moveAway, moveTo, moveToward, moveToward, requestUpdate, requestUpdateNext, setAgentSize, setCoordinate |
| Methods inherited from class org.ascape.model.Agent |
|---|
clearDeleteMarker, death, deathCondition, execute, execute, fission, fissionCondition, fissioning, getColor, getColor, getImage, getImage, getIteration, getPlatformColor, getRoot, isDelete, isInitialized, iterate, markForDeletion, metabolism, move, movement, movementCondition, play, scapeCreated, setInitialized, setScape, update |
| Methods inherited from class org.ascape.model.AscapeObject |
|---|
diffDeep, diffDeep, diffDeepBFS, diffDeepDFS, diffDeepValidate, diffDeepVisit, equalsDeep, equalsDeep, equalsDeep, getComparisonStream, getName, getRandom, getRandomSeed, getScape, randomInRange, randomInRange, randomIs, randomToLimit, reseed, setComparisonStream, setName, setRandom, setRandomSeed |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.ascape.model.space.Location |
|---|
clearDeleteMarker, isDelete, markForDeletion, setCoordinate |
| Field Detail |
|---|
public static final Rule PLAY_HOST_RULE
public static final Rule RANDOM_WALK_AVAILABLE_RULE
| Constructor Detail |
|---|
public CellOccupant()
| Method Detail |
|---|
public void leave()
public void moveTo(HostCell hostCell)
hostCell - the host to assign this cell topublic void moveToward(LocatedAgent targetCell)
moveToward in class LocatedAgenttargetCell - the host to move towardspublic void moveAway(LocatedAgent targetCell)
moveAway in class LocatedAgenttargetCell - the host to move towardspublic Coordinate getCoordinate()
getCoordinate in interface LocationgetCoordinate in class LocatedAgentpublic void moveToRandomLocation()
moveToRandomLocation in class LocatedAgentpublic void die()
die in class Agentpublic HostCell getHostCell()
public void setHostCell(HostCell hostCell)
public Scape getHostScape()
public void setHostScape(Scape hostScape)
public Cell findRandomNeighborOnHost()
public Node findRandomAvailableNeighbor()
Node
findRandomAvailableNeighbor in interface NodefindRandomAvailableNeighbor in class Cellpublic Node findRandomNeighbor()
Cell
findRandomNeighbor in interface NodefindRandomNeighbor in class Cellpublic java.util.List findNeighbors()
Cell
findNeighbors in interface NodefindNeighbors in class Cellpublic java.util.List findNeighborsOnHost()
public java.util.List findWithin(Conditional condition,
double distance)
findWithin in class LocatedAgentcondition - the condition that found agent must meetdistance - the distance agents must be within to be includedpublic java.util.List findWithin(double distance)
findWithin in class LocatedAgentdistance - the distance agents must be within to be included
public java.util.List findWithin(Conditional condition,
boolean includeSelf,
double distance)
findWithin in class LocatedAgentcondition - the condition that found agent must meetincludeSelf - whether or not the starting agent should be included in the searchdistance - the distance agents must be within to be includedpublic LocatedAgent findNearest()
findNearest in class LocatedAgentpublic LocatedAgent findNearest(double distance)
findNearest in class LocatedAgentdistance - the distance agents must be within to be includedpublic LocatedAgent findNearest(Conditional condition)
findNearest in class LocatedAgentcondition - the condition the agent must meet to be included
public LocatedAgent findNearest(Conditional condition,
double distance)
findNearest in class LocatedAgentcondition - the condition the agent must meet to be includeddistance - the distance agents must be within to be included
public LocatedAgent findNearest(Conditional condition,
boolean includeSelf,
double distance)
findNearest in class LocatedAgentcondition - the condition the agent must meet to be includedincludeSelf - if the calling agent should be included in the searchdistance - the distance agents must be within to be includedpublic java.util.List findAvailableNeighbors()
public void playRandomNeighbor()
playRandomNeighbor in class Cellpublic void playNeighbors()
playNeighbors in class Cellpublic void randomWalk()
randomWalkAvailable.
In this case, a random neighboring cell is slected. If, and only if, that cell is
unoccupied, does the agent move to it.
This means, for instance, that a neighboring cell might be available but
the cell occupant migh select an occupied cell and thus not move.
randomWalk in class LocatedAgentthis.randomWalkAvailable()public void randomWalkAvailable()
randomWalk.
In this case, all available neigbors are first found, and then one of those cells
is randomly selected and moved to.
This means that if there is even one unoccpied cell available, the cell occupant
will move to it.
this.randomWalkpublic java.lang.Object clone()
clone in interface Locationclone in class Cell
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||