bResult = bResult &&
oVTR.adaptRange(in_colCurrentValueAssignment.get(oAtomWithAssignedValue).getValue());
bResult = bResult &&
oGlobalVTR.adaptRange(oVTR);
if(!bResult)
return new IndefinableValueTypeRange();
// break ATOM;
// continue ATOM;
}
}
// keep track of all the expressions still to evaluate ...
List<TCGOCLExpression> colTmpExpressionsCopy = new ArrayList<TCGOCLExpression>();
colTmpExpressionsCopy.addAll(in_colExpressions);
for(TCGOCLExpression oExpression : in_colExpressions) {
OCLTreeExpressionFindAtomReferenceVisitor oVisitor =
//new OCLTreeExpressionFindAtomReferenceVisitor(in_oAtom);
new OCLTreeExpressionFindAtomReferenceVisitor(oAtom);
OCLTreeExpressionIterator.run(oExpression, oVisitor);
// oExpression contains oAtom
if(oVisitor.isFound()) {
for(TCGOCLAtom oInterestingAtom : oVisitor.getFoundAtoms()) {
if(oExpression instanceof TCGOCLAtom) {
ValueTypeRange oTmpVTR = OCLExpressionValueTypeRangeFactory.
getValueTypeRangeForRightSideOfExpression(
oInterestingAtom, oExpression);
if(oVTR == null)
oVTR = oTmpVTR;
else {
if(!oVTR.adaptRange(oTmpVTR)) {
// bResult = false;
return new IndefinableValueTypeRange();
// break ATOM;
}
}
}
else if(oExpression instanceof TCGOCLOperation) {
TCGOCLOperation oOperation = (TCGOCLOperation)oExpression;
// shift atom to the left
shiftSubexpressionToTheLeft(oInterestingAtom, oOperation);
// now investigate the right side of the expression
// combine with other expressions of the list
colTmpExpressionsCopy.remove(oOperation);
Map<TCGOCLAtom, ValueTypeRange> colTemporaryAtomToVTR
= new LinkedHashMap<TCGOCLAtom, ValueTypeRange>();
colTemporaryAtomToVTR.putAll(in_colAtomToVTR);
colTemporaryAtomToVTR.remove(oAtom);
//colTemporaryAtomToVTR.remove(in_oAtom);
// colTemporaryEPIToAtoms contains all remaining epi to atoms
Map<TCGOCLAtom, ValueTypeRange> colAtomToVTR =
new LinkedHashMap<TCGOCLAtom, ValueTypeRange>();
// restart the evaluation for each ATOM of the right side
OCLTreeTCGOCLAtomCollectorVisitor oAtomCollector =
new OCLTreeTCGOCLAtomCollectorVisitor();
OCLTreeExpressionIterator.run(oOperation.getRight(), oAtomCollector);
for(TCGOCLAtom oExpAtom : oAtomCollector.getExpressions()) {
// check only atoms that reference variables or properties
if(oExpAtom.getElement() instanceof Variable ||
oExpAtom.getElement() instanceof Property) {
List<TCGOCLAtom> colExpAtoms = new ArrayList<TCGOCLAtom>();
colExpAtoms.add(oExpAtom);
ValueTypeRange oTmpVTR =
getValueTypeRangeForEventParameterInstance(
colExpAtoms, colTmpExpressionsCopy, colTemporaryAtomToVTR,
in_colCurrentValueAssignment, in_colAlreadyEvaluatedExpressions);
if(oTmpVTR instanceof IndefinableValueTypeRange) {
return new IndefinableValueTypeRange();
// bResult = false;
// break ATOM;
}
colAtomToVTR.put(oExpAtom, oTmpVTR);
}
}
// evaluate expressions with the help of value type ranges
ValueTypeRange oTmpVTR = ValueTypeRangeFactory.createValueTypeRangeForObject(oInterestingAtom);
oTmpVTR = OCLExpressionValueTypeRangeFactory.
getValueTypeRangeForRightSideOfExpression(
oTmpVTR, oOperation,
in_colCurrentValueAssignment, colAtomToVTR);
if(oVTR == null)
oVTR = oTmpVTR;
else {
if(!oVTR.adaptRange(oTmpVTR)) {
return new IndefinableValueTypeRange();
// bResult = false;
// break ATOM;
}
}
oVTR.adaptRangeToStaticConstraints();
// combine other expressions with this expression?
// no -> because of the differences between elements
// instead: find value type ranges for other elements
// - evaluate the expression using value type ranges
// derive value type ranges
// adapt the returned value type ranges depending
// on the relational symbol
colTmpExpressionsCopy.add(oOperation);
}
}
}
}
// for each expression:
//if(expression contains atom in_colEPIToAtom.get(in_oEPI)
// expression: atom auf linke Seite holen
// f�r alle dependent elemente auf der rechten Seite:
// Wertebestimmung ohne die bereits genutzten Ausdr�cke
// in Abh�ngigkeit von dem Relationszeichen die
//return oVTR;
if(!oGlobalVTR.adaptRange(oVTR)) {
return new IndefinableValueTypeRange();
// bResult = false;
// break ATOM;
}
}
if(!bResult) {
oGlobalVTR = new IndefinableValueTypeRange();
}
return oGlobalVTR;
}