Class CompareOperation

java.lang.Object
de.uka.ipd.sdq.stoex.analyser.operations.CompareOperation
Direct Known Subclasses:
EqualsOperation, GreaterEqualOperation, GreaterOperation, LessEqualOperation, LessOperation, NotEqualOperation

public abstract class CompareOperation extends Object
Abstract class with interface for compare operations (e.g., equals, less, etc.). Includes some helper methods for probability functions.
  • Constructor Details

    • CompareOperation

      public CompareOperation()
  • Method Details

    • compare

      public IProbabilityMassFunction compare(Object left, Object right)
      Compares to objects that represent the left-hand side and the right-hand side of a comparison expression.
      Parameters:
      left -
      right -
      Returns:
    • comparePointWise

      public double comparePointWise(IProbabilityMassFunction left, IProbabilityMassFunction right, CompareOperation op)
      Compares two probability mass functions pointwise.
      Parameters:
      left -
      right -
      Returns:
    • getBoolPMF

      public IProbabilityMassFunction getBoolPMF(double trueProb)
      Converts a probability into a boolean PMF. The probability is taken as value for true and 1-probability as value for false.
      Parameters:
      left -
      right -
      Returns:
    • getProbabilityForValue

      public double getProbabilityForValue(IProbabilityMassFunction iPMF, double valueToSeek)
      Retrieves the probability for a given value from a PMF.
      Parameters:
      iPMF -
      valueToSeek -
      Returns:
    • getThresholdProbability

      public double getThresholdProbability(IProbabilityMassFunction iPMF, double threshold, boolean includeThreshold)
      Returns the sum of probabilities before a given value of a PMF.
      Parameters:
      iPMF -
      threshold -
      includeThreshold -
      Returns:
    • getComparePMF

      protected abstract IProbabilityMassFunction getComparePMF(boolean left, boolean right)
      Compares two boolean values.
      Parameters:
      left -
      right -
      Returns:
    • getComparePMF

      protected abstract IProbabilityMassFunction getComparePMF(double left, double right)
      Compares two doubles.
      Parameters:
      left -
      right -
      Returns:
    • getComparePMF

      protected abstract IProbabilityMassFunction getComparePMF(double left, IProbabilityMassFunction right)
      Compares a PMF with a double.
      Parameters:
      left -
      right -
      Returns:
    • getComparePMF

      protected abstract IProbabilityMassFunction getComparePMF(IProbabilityMassFunction left, double right)
      Compares a PMF with a double.
      Parameters:
      left -
      right -
      Returns:
    • getComparePMF

      protected abstract IProbabilityMassFunction getComparePMF(IProbabilityMassFunction left, IProbabilityMassFunction right)
      Compares two PMFs.
      Parameters:
      left -
      right -
      Returns:
    • getComparePMF

      protected abstract IProbabilityMassFunction getComparePMF(String left, IProbabilityMassFunction right)
      Compares a String and an EnumPMF
      Parameters:
      left -
      right -
      Returns:
    • getComparePMF

      protected abstract IProbabilityMassFunction getComparePMF(String left, String right)
      Compares two Strings.
      Parameters:
      left -
      right -
      Returns:
    • invertBoolPMF

      public static IProbabilityMassFunction invertBoolPMF(IProbabilityMassFunction function)
      This method inverts a BoolPMF as required by a NOT statement. This method would be better placed elsewhere, but it accesses internal knowledge how a BoolPMF is represented as a IProbabilityMassFunction which is only available in this class.
      Parameters:
      function -
      Returns:
      The inverted function, assuming this is a BoolPMF.
      Throws:
      UnsupportedOperationException - if the passed PMF is not a BoolPMF, i.e. if it does not contain the String literals "TRUE" and "FALSE".