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.rule
Class CollectStats

    java.lang.Object
      org.ascape.model.AscapeObject
          org.ascape.model.rule.Rule
              org.ascape.model.rule.CollectStats

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

    public class CollectStats

extends Rule

A rule for gathering values (typically aggegate statistics) from the entire population of agents.

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

Field Summary

Fields inherited from class org.ascape.model.AscapeObject
`ARBITRARY_SEED, name, PLATFORM_DEFAULT_COLOR, scape`

Constructor Summary
`CollectStats()` Constructs a new stat collecting rule.
`CollectStats(StatCollector[] statCollectors)` Constructs a new stat collecting rule.

Method Summary
`void` | `addStatCollector(StatCollector addDataPoint)` Adds value stats to the collection rule.
`void` | `addStatCollectors(StatCollector[] addDataPoints)` Adds value stats to the collection rule.
`void` | `calculateValues()` Clears the values so that they can be collected for the next iteration.
`void` | `clear()` Clears the values so that they can be collected for the next iteration.
`void` | `execute(Agent agent)` Collects all values for the agent.
`StatCollector[]` | `getStatCollectors()` Returns the stats used to collect values from the scape.
`boolean` | `isCauseRemoval()` Could this rule cause the removal of any agents from within an this rule's scape or any agent's scape? Used to determine safe optimization of iterations.
`boolean` | `isIterateAll()` Returns true.
`boolean` | `isRandomExecution()` Returns false; it doesn't matter what order we collect statistics in.
`void` | `removeAllStatCollectors()` Removes any and all existing stat collectors from the rule.
`boolean` | `removeStatCollector(StatCollector toBeRemoved)` Removes the stat collector.
`void` | `setPhase(int phase)` Sets the phase.

Methods inherited from class org.ascape.model.rule.Rule
`getScape, setScape`

Methods inherited from class org.ascape.model.AscapeObject
`clone, diffDeep, diffDeep, diffDeepBFS, diffDeepDFS, diffDeepValidate, diffDeepVisit, equalsDeep, equalsDeep, equalsDeep, getComparisonStream, getName, getRandom, getRandomSeed, randomInRange, randomInRange, randomIs, randomToLimit, reseed, setComparisonStream, setName, setRandom, setRandomSeed, toString`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### CollectStats

    public CollectStats()

  Constructs a new stat collecting rule.

### CollectStats

    public CollectStats(StatCollector[] statCollectors)

  Constructs a new stat collecting rule. This constructor is prvided to make it easier to build static stat collectors.

  Parameters:
    `statCollectors` - the stats to use

Method Detail

### getStatCollectors

    public StatCollector[] getStatCollectors()

  Returns the stats used to collect values from the scape.

  Returns:
    the stat collectors

### addStatCollectors

    public void addStatCollectors(StatCollector[] addDataPoints)

  Adds value stats to the collection rule. Typically not called directly, but through Scape. Only adds stats that have autoCollect true.

  Parameters:
    `addDataPoints` - the stats to add
  See Also:
    `Scape.addStatCollectors(org.ascape.util.data.StatCollector[])`, `StatCollector.isAutoCollect()`

### addStatCollector

    public void addStatCollector(StatCollector addDataPoint)

  Adds value stats to the collection rule. Typically not called directly.

  Parameters:
    `addDataPoint` - the add data point

### removeAllStatCollectors

    public void removeAllStatCollectors()

  Removes any and all existing stat collectors from the rule. Note that this should be called when used for example with a static rule to ensure that a stat isn't added to that rule twice. This code will be reworked, probably to prevent the insertion of non-unique stat collectors.

### removeStatCollector

    public boolean removeStatCollector(StatCollector toBeRemoved)

  Removes the stat collector.

  Parameters:
    `toBeRemoved` - the to be removed
  Returns:
    true, if successful

### clear

    public void clear()

  Clears the values so that they can be collected for the next iteration.

### calculateValues

    public void calculateValues()

  Clears the values so that they can be collected for the next iteration.

### execute

    public void execute(Agent agent)

  Collects all values for the agent.

  Specified by:
    `execute` in class `Rule`
  Parameters:
    `agent` - the target agent.

### setPhase

    public void setPhase(int phase)

  Sets the phase.

  Parameters:
    `phase` - the new phase

### isRandomExecution

    public boolean isRandomExecution()

  Returns false; it doesn't matter what order we collect statistics in.

  Overrides:
    `isRandomExecution` in class `Rule`
  Returns:
    true, if is random execution

### isIterateAll

    public boolean isIterateAll()

  Returns true.

  Overrides:
    `isIterateAll` in class `Rule`
  Returns:
    true, if is iterate all

### isCauseRemoval

    public boolean isCauseRemoval()

  Description copied from class: `Rule`
  Could this rule cause the removal of any agents from within an this rule's scape or any agent's scape? Used to determine safe optimization of iterations.

  Overrides:
    `isCauseRemoval` in class `Rule`
  Returns:
    true, if is cause removal

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