// iterate over all expressions of all postcondition conjunctions
for(TCGConjunction oPostConjunction : in_colPostcondition.getConjunctions()) {
EXPRESSIONLOOP: for(TCGOCLExpression oPostCondition : oPostConjunction.getExpressions()) {
TCGOCLVariableClassificator oClassificator =
new TCGOCLVariableClassificator(oPostCondition);
for(TCGOCLAtom oActivePostExpression :
oClassificator.getClassifiedElementsInExpression(
VariableClassification.ACTIVE_DEPENDENT)) {
oClassificator.shiftSubexpressionToTheLeft(oActivePostExpression);
TCGOCLAtom oAtomPostExp = (TCGOCLAtom)oActivePostExpression;
// 1) precondition references the same active object as postcondition
// 2) expression is an operation (else a transformation is not possible)
if((TCGOCLExpressionHelperClass.conditionContainsReferenceToObject(
in_oPrecondition, oAtomPostExp.getElement()))) // &&
//oClassificator.getExpression() instanceof TCGOCLOperation)
{
TCGOCLVariableClassificator oRightSubClassificator =
new TCGOCLVariableClassificator(oClassificator.getExpression());
// does the right side contain a passive dependent element?
List<TCGOCLAtom> colPassiveDependentSubExpression =
oRightSubClassificator.getClassifiedElementsInExpression(
VariableClassification.PASSIVE_DEPENDENT);
List<TCGOCLAtom> colInputParameterSubExpression =
oRightSubClassificator.getClassifiedElementsInExpression(
VariableClassification.INPUT_PARAMETER);
if((!colPassiveDependentSubExpression.isEmpty()) ||
(!colInputParameterSubExpression.isEmpty()))
{
TCGOCLExpression oNewExpression = TCGOCLExpressionHelperClass.connectPreconditionAndPostcondition(
in_oPrecondition, oPostCondition);
if(oNewExpression != null) {
in_colNewExpressions.add(oNewExpression);
}
io_oPostConjunction.getExpressions().addAll(
oPostConjunction.getExpressions());
eRetValue = PrePostComparisonResult.RESOLVED_CONDITION;
}
else { // does the right side contain just independent elements?
// Hier ansetzen - Postcondition kann auch LateEvaluationGroups erzeugen
// TODO : AA hier Abh�ngigkeiten bei postconditions einbauen
// List<TCGOCLAtom> colChangeableParameters =
// TCGOCLExpressionHelperClass.getPassiveDependentVariablesAndInputParameters(oPostCondition);
ValueTypeRange oPostValueRange =
OCLExpressionValueTypeRangeFactory.
getValueTypeRangeForRightSideOfExpression(
oPostCondition);
// compare the expressions of both elements!
if(oPreValueRange != null && oPostValueRange != null)
{
// postcondition
if(ValueTypeRangeHelper.outerVTRangeContainsInnerVTRange(
oPreValueRange, oPostValueRange, false))
{
// alle Elemente der Konjunktion durchsuchen
for(TCGOCLExpression oIndependentPostCondition : oPostConjunction.getExpressions())
{
// au�er der gerade behandelten Nachbedingung
if(oIndependentPostCondition != oPostCondition)
{
TCGOCLVariableClassificator oIndependentClassificator = new TCGOCLVariableClassificator(oIndependentPostCondition);
if(oIndependentClassificator.getClassifiedElementsInExpression(VariableClassification.ACTIVE_DEPENDENT).isEmpty())
{
// die Elemente ohne aktive Variablen weiter in fr�heren Postconditions checken
if(oIndependentPostCondition == null) {
System.out.println("new expression is zero!");
}