net.ontopia.topicmaps.viz
Class ProbabilityManager

java.lang.Object
  extended by net.ontopia.topicmaps.viz.ProbabilityManager

public class ProbabilityManager
extends java.lang.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
ProbabilityManager(java.lang.Object key)
           
 
Method Summary
 void addProbability(java.lang.Object key, java.lang.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.
 java.lang.Double getProbability(java.lang.Object key)
           
 double getProbabilityValue(java.lang.Object key)
           
 java.lang.Object guessKey()
           
 java.lang.Object guessKey(double valueGuess)
           
static void test()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProbabilityManager

public ProbabilityManager(java.lang.Object key)
Method Detail

addProbability

public void addProbability(java.lang.Object key,
                           java.lang.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 changed
compKey - Use the value of 'compKey' to create the value for 'key'
compFactor - Let 'key' = 'compFactor' * 'compKey'.

guessKey

public java.lang.Object guessKey()

guessKey

public java.lang.Object guessKey(double valueGuess)

getProbability

public java.lang.Double getProbability(java.lang.Object key)

getProbabilityValue

public double getProbabilityValue(java.lang.Object key)

test

public static void test()


Copyright © 2000-2012 Ontopia.