## org.ascape.model
Class MomentumAgent

    java.lang.Object
      org.ascape.model.AscapeObject
          org.ascape.model.Agent
              org.ascape.model.LocatedAgent
                  org.ascape.model.MomentumAgent

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

    public class MomentumAgent

extends LocatedAgent

An agent that has momentum and heading in space. We will soon replace velocity and heading with a single velocity vector coordinate.

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

Field Summary
`protected double` `heading` The heading is an angle, b/w 0 and 360 degrees (or 2 pi)
`protected double` `velocity`

Fields inherited from class org.ascape.model.LocatedAgent
`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
`MomentumAgent()`

Method Summary
`double` `findHeadingAway(Coordinate target)` Finds the heading to point away from a particular direction.
`double` `findHeadingAway(LocatedAgent target)` Finds the heading to point away from a particular direction.
`double` `findHeadingToward(Coordinate target)` Finds the heading between current location and the one being passed in.
`double` `findHeadingToward(LocatedAgent target)` Finds the heading between current location and the one being passed in.
`int` `getAgentSize()` Returns the size of the agent.
`double` `getHeading()`
`double` `getVelocity()`
`void` `headAway(Coordinate target)` Sets the heading to point away from a particular direction.
`void` `headAway(LocatedAgent a)` Sets the heading to point away from a particular agent.
`void` `headToward(Coordinate target)` Sets the heading to point toward a particular direction.
`void` `headToward(LocatedAgent a)` Sets the heading to point toward a particular agent.
`void` `movement()` move to new location.
`void` `moveTo(Coordinate coordinate)` Moves to the coordiante specified.
`void` `moveTo(Coordinate coordinate, boolean adjustHeading)` Moves to the coordiante specified.
`void` `moveToRandomLocation()` Moves this agent to a random unoccupied location on the host scape.
`void` `randomWalk()` Moves a set distance in a random direction.
`void` `setAgentSize(int agentSize)` Sets the size of the agent.
`void` `setHeading(double heading)`
`void` `setVelocity(double velocity)`
`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, getCoordinate, hasWithin, hasWithin, hasWithin, initialize, isUpdateNeeded, moveAway, moveAway, moveAway, moveToward, moveToward, moveToward, requestUpdate, requestUpdateNext, setCoordinate`

Methods inherited from class org.ascape.model.Agent
`clearDeleteMarker, clone, death, deathCondition, die, execute, execute, fission, fissionCondition, fissioning, getColor, getColor, getImage, getImage, getIteration, getPlatformColor, getRoot, isDelete, isInitialized, iterate, markForDeletion, metabolism, move, 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, clone, isDelete, markForDeletion`

Field Detail

### velocity

    protected double velocity

### heading

    protected double heading

  The heading is an angle, b/w 0 and 360 degrees (or 2 pi)

Constructor Detail

### MomentumAgent

    public MomentumAgent()

Method Detail

### moveToRandomLocation

    public void moveToRandomLocation()

  Moves this agent to a random unoccupied location on the host scape. It is an error to call this method on a cell in a non-continous scape unless the cell is a cell occupant.

  Overrides:
    `moveToRandomLocation` in class `LocatedAgent`

### randomWalk

    public void randomWalk()

  Moves a set distance in a random direction. In the continuous space version, moves agent distance 1 in that direction. (distance 1 may be replaced with a veolcity.

  Overrides:
    `randomWalk` in class `LocatedAgent`

### moveTo

    public void moveTo(Coordinate coordinate)

  Moves to the coordiante specified. It is an error to call this method on a cell in a non-continuous space unless the cell is a cell occupant. In other words, the default behavior of this method is to throw an exception.

  Overrides:
    `moveTo` in class `LocatedAgent`
  Parameters:
    `coordinate` -

### headToward

    public void headToward(LocatedAgent a)

  Sets the heading to point toward a particular agent.

  Parameters:
    `a` - the coordinate to point toward

### findHeadingToward

    public double findHeadingToward(LocatedAgent target)

  Finds the heading between current location and the one being passed in.

  Parameters:
    `target` - the coordinate to point towards

### headAway

    public void headAway(LocatedAgent a)

  Sets the heading to point away from a particular agent.

  Parameters:
    `a` - the coordinate to point toward

### headToward

    public void headToward(Coordinate target)

  Sets the heading to point toward a particular direction.

  Parameters:
    `target` - the coordinate to point toward

### findHeadingToward

    public double findHeadingToward(Coordinate target)

  Finds the heading between current location and the one being passed in.

  Parameters:
    `target` - the coordinate to point towards

### headAway

    public void headAway(Coordinate target)

  Sets the heading to point away from a particular direction.

  Parameters:
    `target` - the coordinate to point toward

### findHeadingAway

    public double findHeadingAway(LocatedAgent target)

  Finds the heading to point away from a particular direction.

  Parameters:
    `target` - the coordinate to point toward

### findHeadingAway

    public double findHeadingAway(Coordinate target)

  Finds the heading to point away from a particular direction.

  Parameters:
    `target` - the coordinate to point toward

### moveTo

    public void moveTo(Coordinate coordinate,
                       boolean adjustHeading)

  Moves to the coordiante specified. It is an error to call this method on a cell in a non-continuous space unless the cell is a cell occupant. In other words, the default behavior of this method is to throw an exception.

  Parameters:
    `coordinate` -

### getAgentSize

    public int getAgentSize()

  Returns the size of the agent.

  Overrides:
    `getAgentSize` in class `LocatedAgent`
  Returns:
    the agent size

### setAgentSize

    public void setAgentSize(int agentSize)

  Sets the size of the agent.

  Overrides:
    `setAgentSize` in class `LocatedAgent`
  Parameters:
    `agentSize` - the desired size for this agent.

### movement

    public void movement()

  move to new location. Note: it's probably possible to mess up the visuals by setting velocity too high, and emphasizing the fact that they're jumping around, and not moving through all points between current location and new location.

  Overrides:
    `movement` in class `Agent`
  See Also:
    `Agent.movementCondition()`, `Agent.MOVEMENT_RULE`

### toString

    public java.lang.String toString()

  A string representation of this cell.

  Overrides:
    `toString` in class `LocatedAgent`

### getVelocity

    public double getVelocity()

### setVelocity

    public void setVelocity(double velocity)

### getHeading

    public double getHeading()

### setHeading

    public void setHeading(double heading)