|
![]() |
|||||||||
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
public class Cell
The base class for all members of lattices. Currently considered a node, although nodes might be become a superclass of this class as the notion of a coordinate may not be useful in all graphs.
Field Summary | |
---|---|
static Rule |
CALCULATE_NEIGHBORS_RULE
A rule causing the taget agent to move to a random location. |
protected java.util.List |
neighbors
For better performance we store neighbors so we only have to calculate them once. |
static Rule |
PLAY_NEIGHBORS_RULE
A rule causing the target agent to interact with each of its neighbors as specified by the Agent.play() method. |
static Rule |
PLAY_RANDOM_NEIGHBOR_RULE
A rule causing the target agent to interact with one of its neighbors as specified by the Agent.play() method. |
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, scape |
Constructor Summary | |
---|---|
Cell()
|
Method Summary | |
---|---|
void |
calculateNeighbors()
Computes the cells neighbors in the context of the primary scape and assigns them as this cell's neighbors. |
java.lang.Object |
clone()
Clones the host cell, making coordinate null. |
int |
countNeighbors(Conditional condition)
Returns the number of cells that are neighbors and that meet the supplied 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. |
static java.util.List |
findOccupants(java.util.List candidates)
Returns all cell occupants of the provided cells. |
Node |
findRandomAvailableNeighbor()
Find random neighbor. |
Node |
findRandomNeighbor()
Returns a cell randomly selected from among this cell's neighbors. |
Cell |
findRelative(Coordinate c)
|
int |
getDistance(Cell target)
|
Cell[] |
getNeighbors()
Deprecated. use findNeighbors instead. |
java.util.List |
getNeighbors(Conditional condition)
Returns the neighbors of the cell that meet the supplied condition. |
java.util.List |
getNetwork()
Returns some network of related cells. |
Node |
getOccupant()
Returns any occupants of this cell. |
protected static Conditional |
hostedCondition(Conditional condition)
|
void |
initialize()
Initialize any values. |
boolean |
isAvailable()
Is this cell available for occupation? Again, this will always return false because base cells can not host agents. |
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 |
removeOccupant()
Removes this cell's occupant. |
void |
setNeighbors(Cell[] neighbors)
Sets this cell's neighbors. |
void |
setNeighborsList(java.util.List neighbors)
Sets this cell's neighbors. |
void |
setNetwork(java.util.List network)
Sets a network of related cells. |
void |
setOccupant(Node occupant)
Sets this cell's occupant. |
java.lang.String |
toString()
A string representation of this cell. |
Methods inherited from class org.ascape.model.LocatedAgent |
---|
calculateDistance, calculateDistance, countWithin, countWithin, countWithin, findMaximumWithin, findNearest, findNearest, findNearest, findNearest, findNearest, findWithin, findWithin, findWithin, findWithin, getAgentSize, getCoordinate, hasWithin, hasWithin, hasWithin, isUpdateNeeded, moveAway, moveAway, moveAway, moveTo, moveToRandomLocation, moveToward, moveToward, moveToward, randomWalk, requestUpdate, requestUpdateNext, setAgentSize, setCoordinate |
Methods inherited from class org.ascape.model.Agent |
---|
clearDeleteMarker, death, deathCondition, die, execute, execute, fission, fissionCondition, fissioning, getColor, getColor, getImage, getImage, getIteration, 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, getCoordinate, isDelete, markForDeletion, setCoordinate |
Field Detail |
---|
public static final Rule PLAY_NEIGHBORS_RULE
public static final Rule PLAY_RANDOM_NEIGHBOR_RULE
public static final Rule CALCULATE_NEIGHBORS_RULE
protected java.util.List neighbors
Constructor Detail |
---|
public Cell()
Method Detail |
---|
public void initialize()
Agent
initialize
in interface Location
initialize
in class LocatedAgent
public void calculateNeighbors()
public Cell[] getNeighbors()
public java.util.List findNeighbors()
findNeighbors
in interface Node
public Cell findRelative(Coordinate c) throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException
public java.util.List getNeighbors(Conditional condition)
condition
- the condition that found cell must meetpublic int countNeighbors(Conditional condition)
condition
- the condition that found cell must meetpublic void playRandomNeighbor()
public void playNeighbors()
public int getDistance(Cell target)
public void setNeighborsList(java.util.List neighbors)
neighbors
- the array of neighbors to setpublic void setNeighbors(Cell[] neighbors)
neighbors
- the array of neighbors to setpublic Node findRandomNeighbor()
findRandomNeighbor
in interface Node
public Node findRandomAvailableNeighbor()
Node
findRandomAvailableNeighbor
in interface Node
public Node getOccupant()
getOccupant
in interface Node
public java.util.List getNetwork()
public void setNetwork(java.util.List network)
public boolean isAvailable()
isAvailable
in interface Node
public void setOccupant(Node occupant)
setOccupant
in interface Node
occupant
- the occupantpublic void removeOccupant()
public java.lang.Object clone()
clone
in interface Location
clone
in class Agent
public java.lang.String toString()
toString
in class LocatedAgent
protected static Conditional hostedCondition(Conditional condition)
public static java.util.List findOccupants(java.util.List candidates)
candidates
- the cells to return occupants of
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |