Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ascape.model
Class HostCell

    java.lang.Object
      org.ascape.model.AscapeObject
          org.ascape.model.Agent
              org.ascape.model.LocatedAgent
                  org.ascape.model.Cell
                      org.ascape.model.HostCell

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, Location, Node, HasName, RandomFunctions

Direct Known Subclasses:
  BasicCell, Block, ComplexLocation, Habitat, Habitat, Habitat, Habitat, HeatCell, Place, Place, PlayCell, RegionalLocation, SugarCell

    public class HostCell

extends Cell

An cell capable fo serving as a 'home' for agents. At the moment, only one agent per cell can be hosted, but note that that cell can obviosuly be an instance of Scape such as a list.

Since:
  1.0
Version:
  3.0
Author:
  Miles Parker
See Also:
  Serialized Form

Field Summary
`static Conditional` | `IS_AVAILABLE`
`static Conditional` | `IS_OCCUPIED`
`protected CellOccupant` | `occupant` The occupant, if any, of this cell.

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
`HostCell()`

Method Summary
`java.lang.Object` | `clone()` Clones the host cell, making occupant and neighbors null.
`java.util.List` | `findAvailableNeighbors()` Returns all neighboring cells which are available for occupation.
`LocatedAgent` | `findNearestOccupants()` Returns the closest agent.
`LocatedAgent` | `findNearestOccupants(Conditional condition)` Returns the closest agent within the specified distance from this agent that meet some condition.
`LocatedAgent` | `findNearestOccupants(Conditional condition, boolean includeSelf, double distance)` Returns the closest agent within the specified distance from this agent that meet some condition.
`LocatedAgent` | `findNearestOccupants(Conditional condition, double distance)` Returns the closest agent within the specified distance from this agent that meet some condition.
`LocatedAgent` | `findNearestOccupants(double distance)` Returns the closest agent within the specified distance from this agent that meet some condition.
`java.util.List` | `findNeighboringOccupants()` Returns all occupants of neighboring cells.
`java.util.List` | `findOccupantsWithin(Conditional condition, boolean includeSelf, double distance)`
`java.util.List` | `findOccupantsWithin(Conditional condition, double distance)`
`java.util.List` | `findOccupantsWithin(double distance)`
`HostCell` | `findRandomAvailableNeighbor()` Gets a random neighboring host cell.
`java.awt.Color` | `getColor()` Returns the default color for this cell (green.) Override to provide another color, or provide a different color feature for your views.
`Node` | `getOccupant()` Return the occupant of this cell, null if no occupant.
`boolean` | `isAvailable()` Is this cell available (currently unoccupied?)
`boolean` | `isNeighborAvailable()` Are their any neighboring cells that are available.
`void` | `removeOccupant()` Evict the supplied occupant.
`void` | `setNeighborsList(java.util.List neighbors)` Sets this cell's neighbors.
`void` | `setOccupant(Node occupant)` Host the supplied occupant.

Methods inherited from class org.ascape.model.Cell
`calculateNeighbors, countNeighbors, findNeighbors, findOccupants, findRandomNeighbor, findRelative, getDistance, getNeighbors, getNeighbors, getNetwork, hostedCondition, initialize, playNeighbors, playRandomNeighbor, setNeighbors, setNetwork, toString`

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, 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, getCoordinate, isDelete, markForDeletion, setCoordinate`

Field Detail

### IS_AVAILABLE

    public static final Conditional IS_AVAILABLE

### IS_OCCUPIED

    public static final Conditional IS_OCCUPIED

### occupant

    protected CellOccupant occupant

  The occupant, if any, of this cell.

Constructor Detail

### HostCell

    public HostCell()

Method Detail

### isAvailable

    public boolean isAvailable()

  Is this cell available (currently unoccupied?)

  Specified by:
    `isAvailable` in interface `Node`
  Overrides:
    `isAvailable` in class `Cell`
  Returns:
    true if available, false if not

### getOccupant

    public Node getOccupant()

  Return the occupant of this cell, null if no occupant.

  Specified by:
    `getOccupant` in interface `Node`
  Overrides:
    `getOccupant` in class `Cell`
  Returns:
    the occupant

### setNeighborsList

    public void setNeighborsList(java.util.List neighbors)

  Sets this cell's neighbors. Used by agent scape intialize methods to inform the cell of it's neighbors. When creating new lattice classes, be sure to set all cell's neighbors using this method. Note that this method could also be used for creating dynamic spaces!

  Overrides:
    `setNeighborsList` in class `Cell`
  Parameters:
    `neighbors` - the array of neighbors to set

### isNeighborAvailable

    public boolean isNeighborAvailable()

  Are their any neighboring cells that are available. return true if adjoing cell is available, false otherwise

### findRandomAvailableNeighbor

    public HostCell findRandomAvailableNeighbor()

  Gets a random neighboring host cell. If none available, returns null.

  Specified by:
    `findRandomAvailableNeighbor` in interface `Node`
  Overrides:
    `findRandomAvailableNeighbor` in class `Cell`
  Returns:
    the node

### setOccupant

    public void setOccupant(Node occupant)

  Host the supplied occupant. Request a view update.

  Specified by:
    `setOccupant` in interface `Node`
  Overrides:
    `setOccupant` in class `Cell`
  Parameters:
    `occupant` - the occupant

### removeOccupant

    public void removeOccupant()

  Evict the supplied occupant. Request a view update.

  Overrides:
    `removeOccupant` in class `Cell`

### findNeighboringOccupants

    public java.util.List findNeighboringOccupants()

  Returns all occupants of neighboring cells.

### findOccupantsWithin

    public java.util.List findOccupantsWithin(Conditional condition,
                                              double distance)

### findOccupantsWithin

    public java.util.List findOccupantsWithin(double distance)

### findOccupantsWithin

    public java.util.List findOccupantsWithin(Conditional condition,
                                              boolean includeSelf,
                                              double distance)

### findNearestOccupants

    public LocatedAgent findNearestOccupants()

  Returns the closest agent.

### findNearestOccupants

    public LocatedAgent findNearestOccupants(double distance)

  Returns the closest agent within the specified distance from this agent that meet some condition.

  Parameters:
    `distance` - the distance agents must be within to be included

### findNearestOccupants

    public LocatedAgent findNearestOccupants(Conditional condition)

  Returns the closest agent within the specified distance from this agent that meet some condition.

  Parameters:
    `condition` - the condition the agent must meet to be included

### findNearestOccupants

    public LocatedAgent findNearestOccupants(Conditional condition,
                                             double distance)

  Returns the closest agent within the specified distance from this agent that meet some condition.

  Parameters:
    `condition` - the condition the agent must meet to be included
    `distance` - the distance agents must be within to be included

### findNearestOccupants

    public LocatedAgent findNearestOccupants(Conditional condition,
                                             boolean includeSelf,
                                             double distance)

  Returns the closest agent within the specified distance from this agent that meet some condition.

  Parameters:
    `condition` - the condition the agent must meet to be included
    `includeSelf` - if the calling agent should be included in the search
    `distance` - the distance agents must be within to be included

### findAvailableNeighbors

    public java.util.List findAvailableNeighbors()

  Returns all neighboring cells which are available for occupation.

### clone

    public java.lang.Object clone()

  Clones the host cell, making occupant and neighbors null.

  Specified by:
    `clone` in interface `Location`
  Overrides:
    `clone` in class `Cell`
  Returns:
    the object

### getColor

    public java.awt.Color getColor()

  Returns the default color for this cell (green.) Override to provide another color, or provide a different color feature for your views.

  Overrides:
    `getColor` in class `Agent`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD