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 Details

    • ProbabilityManager

      public ProbabilityManager(Object key)
  • Method Details

    • 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 changed
      compKey - 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)
    • getProbability

      public Double getProbability(Object key)
    • getProbabilityValue

      public double getProbabilityValue(Object key)
    • test

      public static void test()