Class ExpressionHelper
java.lang.Object
org.palladiosimulator.solver.visitors.ExpressionHelper
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static boolean
allSamplesHaveBooleanStringLiterals
(Collection<de.uka.ipd.sdq.probfunction.Sample<Object>> samples) protected static boolean
allSamplesHaveSameValueType
(Collection<de.uka.ipd.sdq.probfunction.Sample<Object>> samples) static double
getMeanValue
(org.palladiosimulator.pcm.core.PCMRandomVariable variable) static de.uka.ipd.sdq.stoex.Expression
getSolvedExpression
(de.uka.ipd.sdq.stoex.Expression expr, ContextWrapper ctxWrp) static de.uka.ipd.sdq.stoex.Expression
getSolvedExpression
(String specification, ContextWrapper ctxWrp) static String
getSolvedExpressionAsString
(String specification, ContextWrapper ctxWrp) static HashMap<de.uka.ipd.sdq.stoex.Expression,
de.uka.ipd.sdq.stoex.analyser.visitors.TypeEnum> getTypeAnnotation
(de.uka.ipd.sdq.stoex.Expression expr) static double
meanValue
(de.uka.ipd.sdq.stoex.Expression expression) calculated the mean value for a solved expressionstatic de.uka.ipd.sdq.stoex.Expression
parseToExpression
(String specification) protected static de.uka.ipd.sdq.stoex.Expression
transformExpressionToTypedExpression
(de.uka.ipd.sdq.stoex.Expression expression) This method transforms an expression containing generic samples into an expression containing concrete samples if possible.protected static void
transformPMFToTypedPMF
(de.uka.ipd.sdq.probfunction.ProbabilityMassFunction<Object> pmf) protected static de.uka.ipd.sdq.probfunction.Sample<Object>
transformToNonGenericModelSample
(de.uka.ipd.sdq.probfunction.Sample<? extends Object> sample)
-
Constructor Details
-
ExpressionHelper
public ExpressionHelper()
-
-
Method Details
-
parseToExpression
- Parameters:
specification
-
-
getSolvedExpressionAsString
-
transformExpressionToTypedExpression
protected static de.uka.ipd.sdq.stoex.Expression transformExpressionToTypedExpression(de.uka.ipd.sdq.stoex.Expression expression) This method transforms an expression containing generic samples into an expression containing concrete samples if possible. This is necessary in order to serialize the expression. For some reason, the probability function logic decided to solely work with generic samples (SampleImpl<?>) instead of the concrete subtypes. Unfortunately, the serialize does not know how to serialize these generic types. Therefore, this method tries to avoid this error by providing a copy of the given expression that only contains concrete sample types. This is only possible if all values of a PMF are of the same type. Mixed value types are not supported by this method as well as the serializer.- Parameters:
expression
- The expression to transform.- Returns:
- An adjusted copy of the expression.
-
transformPMFToTypedPMF
protected static void transformPMFToTypedPMF(de.uka.ipd.sdq.probfunction.ProbabilityMassFunction<Object> pmf) -
allSamplesHaveBooleanStringLiterals
protected static boolean allSamplesHaveBooleanStringLiterals(Collection<de.uka.ipd.sdq.probfunction.Sample<Object>> samples) -
allSamplesHaveSameValueType
protected static boolean allSamplesHaveSameValueType(Collection<de.uka.ipd.sdq.probfunction.Sample<Object>> samples) -
transformToNonGenericModelSample
-
getSolvedExpression
public static de.uka.ipd.sdq.stoex.Expression getSolvedExpression(String specification, ContextWrapper ctxWrp) -
getSolvedExpression
public static de.uka.ipd.sdq.stoex.Expression getSolvedExpression(de.uka.ipd.sdq.stoex.Expression expr, ContextWrapper ctxWrp) -
getTypeAnnotation
public static HashMap<de.uka.ipd.sdq.stoex.Expression,de.uka.ipd.sdq.stoex.analyser.visitors.TypeEnum> getTypeAnnotation(de.uka.ipd.sdq.stoex.Expression expr) -
meanValue
public static double meanValue(de.uka.ipd.sdq.stoex.Expression expression) throws IllegalArgumentException calculated the mean value for a solved expression- Parameters:
expression
-- Returns:
- Throws:
IllegalArgumentException
- if the passed expression has not been solved before.
-
getMeanValue
public static double getMeanValue(org.palladiosimulator.pcm.core.PCMRandomVariable variable)
-