|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.sim.network.AbstractProbabilityRule
public abstract class AbstractProbabilityRule
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.
| 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 |
|---|
protected cern.colt.list.FloatArrayList weights
protected java.util.Hashtable weightMap
protected double sum
| Constructor Detail |
|---|
public AbstractProbabilityRule(java.util.List objs,
float startWeight,
java.lang.Object exclude)
objs - the list Objects to calculate probabilities for.startWeight - the initial weight in the vector of weights for
each nodeexclude - the object to exclude when working with the Objects list
public AbstractProbabilityRule(java.util.List objs,
float startWeight)
objs - the list Objects to calculate probabilities for.startWeight - the initial weight in the vector of weights for
each node| Method Detail |
|---|
public float addToNodeWeight(java.lang.Object node,
float val)
node - the node whose weight is increased (or decreased).val - the value to increase or decrease the node weight.
public void addNode(java.lang.Object node,
float startWeight)
protected float getWeight(java.lang.Object o)
public int getWeightListIndex(java.lang.Object o)
public RangeMap makeProbabilityMap(RangeMap map)
makeProbabilityMap in interface ProbabilityRuleprotected void calcSum()
public abstract double getProbability(java.lang.Object o)
ProbabilityRule
getProbability in interface ProbabilityRulepublic abstract void update(java.lang.Object o)
ProbabilityRule
update in interface ProbabilityRule
public abstract void update(java.lang.Object o,
float amt)
ProbabilityRule
update in interface ProbabilityRule
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||