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

## uchicago.src.sim.network
Class AbstractProbabilityRule

    java.lang.Object
      uchicago.src.sim.network.AbstractProbabilityRule

All Implemented Interfaces:
  ProbabilityRule

Direct Known Subclasses:
  UniformReinforcement

    public abstract class AbstractProbabilityRule

extends java.lang.Object
implements ProbabilityRule

Implements some generic functionality for ProbabilityRule-s. The idea here is that this AbstractProbabilityRule contains a vector of weights associated with a list of Objects. Sub-classes can use this vector of weights in their update and getProbability methods. For example, update may add or substract some amount from an objects associated weight and recalculate the probability accordingly.

Version:
  $Revision: 1.11 $ $Date: 2004/11/03 19:51:01 $

Field Summary
`protected double` | `sum`
`protected java.util.Hashtable` | `weightMap`
`protected cern.colt.list.FloatArrayList` | `weights`

Constructor Summary
`AbstractProbabilityRule(java.util.List objs, float startWeight)` Creates this AbstractProbabilityRule to operate on the specified list of Objects, and assinging the Objects the specified starting weight.
`AbstractProbabilityRule(java.util.List objs, float startWeight, java.lang.Object exclude)` Creates this AbstractProbabilityRule to operate on the specified list of Objects, excluding the specified node, and assinging the Objects the specified starting weight.

Method Summary
`void` | `addNode(java.lang.Object node, float startWeight)` Adds a node with the specified weight.
`float` | `addToNodeWeight(java.lang.Object node, float val)` Adds the specified value to the current weight for the specified node.
`protected void` | `calcSum()` Calculates the sum of the vector of weights.
`abstract double` | `getProbability(java.lang.Object o)` Returns the probability for the specified object.
`protected float` | `getWeight(java.lang.Object o)` Gets the weight of the specified node.
`int` | `getWeightListIndex(java.lang.Object o)` Returns the index position in the list of weights for the specified object.
`RangeMap` | `makeProbabilityMap(RangeMap map)` Recreate the probability map for the list of Objects contained by this AbstractProbabilityRule using the specified RangeMap.
`abstract void` | `update(java.lang.Object o)` Performs an update using the specified object.
`abstract void` | `update(java.lang.Object o, float amt)` Performs an update using the specified object and specified amount.

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

Field Detail

### weights

    protected cern.colt.list.FloatArrayList weights

### weightMap

    protected java.util.Hashtable weightMap

### sum

    protected double sum

Constructor Detail

### AbstractProbabilityRule

    public AbstractProbabilityRule(java.util.List objs,
                                   float startWeight,
                                   java.lang.Object exclude)

  Creates this AbstractProbabilityRule to operate on the specified list of Objects, excluding the specified node, and assinging the Objects the specified starting weight.

  Parameters:
    `objs` - the list Objects to calculate probabilities for.
    `startWeight` - the initial weight in the vector of weights for each node
    `exclude` - the object to exclude when working with the Objects list

### AbstractProbabilityRule

    public AbstractProbabilityRule(java.util.List objs,
                                   float startWeight)

  Creates this AbstractProbabilityRule to operate on the specified list of Objects, and assinging the Objects the specified starting weight.

  Parameters:
    `objs` - the list Objects to calculate probabilities for.
    `startWeight` - the initial weight in the vector of weights for each node

Method Detail

### addToNodeWeight

    public float addToNodeWeight(java.lang.Object node,
                                 float val)

  Adds the specified value to the current weight for the specified node.

  Parameters:
    `node` - the node whose weight is increased (or decreased).
    `val` - the value to increase or decrease the node weight.

### addNode

    public void addNode(java.lang.Object node,
                        float startWeight)

  Adds a node with the specified weight.

### getWeight

    protected float getWeight(java.lang.Object o)

  Gets the weight of the specified node.

### getWeightListIndex

    public int getWeightListIndex(java.lang.Object o)

  Returns the index position in the list of weights for the specified object. The returned value is the index for the weight value of the specified object.

### makeProbabilityMap

    public RangeMap makeProbabilityMap(RangeMap map)

  Recreate the probability map for the list of Objects contained by this AbstractProbabilityRule using the specified RangeMap.

  Specified by:
    `makeProbabilityMap` in interface `ProbabilityRule`

### calcSum

    protected void calcSum()

  Calculates the sum of the vector of weights.

### getProbability

    public abstract double getProbability(java.lang.Object o)

  Description copied from interface: `ProbabilityRule`
  Returns the probability for the specified object.

  Specified by:
    `getProbability` in interface `ProbabilityRule`

### update

    public abstract void update(java.lang.Object o)

  Description copied from interface: `ProbabilityRule`
  Performs an update using the specified object. The semantics of update are defined by implementing classes.

  Specified by:
    `update` in interface `ProbabilityRule`

### update

    public abstract void update(java.lang.Object o,
                                float amt)

  Description copied from interface: `ProbabilityRule`
  Performs an update using the specified object and specified amount. The semantics of update are defined by implementing classes.

  Specified by:
    `update` in interface `ProbabilityRule`

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