Class CompareOperation
java.lang.Object
de.uka.ipd.sdq.stoex.analyser.operations.CompareOperation
- Direct Known Subclasses:
EqualsOperation
,GreaterEqualOperation
,GreaterOperation
,LessEqualOperation
,LessOperation
,NotEqualOperation
Abstract class with interface for compare operations (e.g., equals, less,
etc.). Includes some helper methods for probability functions.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCompares to objects that represent the left-hand side and the right-hand side of a comparison expression.double
comparePointWise
(IProbabilityMassFunction left, IProbabilityMassFunction right, CompareOperation op) Compares two probability mass functions pointwise.getBoolPMF
(double trueProb) Converts a probability into a boolean PMF.protected abstract IProbabilityMassFunction
getComparePMF
(boolean left, boolean right) Compares two boolean values.protected abstract IProbabilityMassFunction
getComparePMF
(double left, double right) Compares two doubles.protected abstract IProbabilityMassFunction
getComparePMF
(double left, IProbabilityMassFunction right) Compares a PMF with a double.protected abstract IProbabilityMassFunction
getComparePMF
(IProbabilityMassFunction left, double right) Compares a PMF with a double.protected abstract IProbabilityMassFunction
Compares two PMFs.protected abstract IProbabilityMassFunction
getComparePMF
(String left, IProbabilityMassFunction right) Compares a String and an EnumPMFprotected abstract IProbabilityMassFunction
getComparePMF
(String left, String right) Compares two Strings.double
getProbabilityForValue
(IProbabilityMassFunction iPMF, double valueToSeek) Retrieves the probability for a given value from a PMF.double
getThresholdProbability
(IProbabilityMassFunction iPMF, double threshold, boolean includeThreshold) Returns the sum of probabilities before a given value of a PMF.static IProbabilityMassFunction
invertBoolPMF
(IProbabilityMassFunction function) This method inverts a BoolPMF as required by a NOT statement.
-
Constructor Details
-
CompareOperation
public CompareOperation()
-
-
Method Details
-
compare
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
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
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
Compares two boolean values.- Parameters:
left
-right
-- Returns:
-
getComparePMF
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
Compares two Strings.- Parameters:
left
-right
-- Returns:
-
invertBoolPMF
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".
-