Package net.ontopia.topicmaps.viz
Class ProbabilityManager
- java.lang.Object
-
- net.ontopia.topicmaps.viz.ProbabilityManager
-
public class ProbabilityManager extends Object
Manages probability values for given keys, so that all probability values always add up to 1. If a new probability value is added, the other values are added. This can be used to build up a probability distribution incrementally while ensuring that the probabilities never add up to more than 1, i.e. 100%. Currently not used anywhere. Should add a method that guesses a 0.0 ... 1.0 number and returns a corresponding key.
-
-
Constructor Summary
Constructors Constructor Description ProbabilityManager(Object key)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProbability(Object key, Object compKey, double compFactor)
Set key to be compKey * compFactor and adjust all values so that they still add up to 1 and at the same time, the value of compKey remains the same relative to other values.Double
getProbability(Object key)
double
getProbabilityValue(Object key)
Object
guessKey()
Object
guessKey(double valueGuess)
static void
test()
-
-
-
Constructor Detail
-
ProbabilityManager
public ProbabilityManager(Object key)
-
-
Method Detail
-
addProbability
public void addProbability(Object key, Object compKey, double compFactor)
Set key to be compKey * compFactor and adjust all values so that they still add up to 1 and at the same time, the value of compKey remains the same relative to other values.- Parameters:
key
- The key to add (may be there already, in which case it's changedcompKey
- Use the value of 'compKey' to create the value for 'key'compFactor
- Let 'key' = 'compFactor' * 'compKey'.
-
guessKey
public Object guessKey()
-
guessKey
public Object guessKey(double valueGuess)
-
getProbabilityValue
public double getProbabilityValue(Object key)
-
test
public static void test()
-
-