tRightContext));
} else {
EObject uppermostForLoop = findUpperMostForLoop(tParent, tLeft, tLeftContext);
if(uppermostForLoop==null||!TForLoop.isTForLoop(uppermostForLoop)){
throw new SimTLException("Didn't find uppermost for-loop ancistor?");
}
GrayPath grayPathToTLeft = findGrayPath(new TForLoop(uppermostForLoop, tLeftContext, template), tLeft, tLeftContext);
elementsInRange.add(new NewIterationAddAllocation(grayPathToTLeft,true,tLeftContext));
}
return elementsInRange;
}
EObject commonAncistor = tParent;
if(tLeft!=null&&tRight!=null){
commonAncistor = findCommonAncistor(tParent, tLeft, tLeftContext, tRight, tRightContext);
}
// log.info("found common ancistor of " +
// Util.getFullName(tLeft) + " and " + Util.getFullName(tRight) +
// " :: " + Util.getFullName(commonAncistor));
//left to right first
EObject tLeftRep = null;
if(tLeft!=null){
tLeftRep = addAllocationsTillCap(true, tLeft, tLeftContext, commonAncistor, tiChild,elementsInRange);
}
//then right to left
EObject tRightRep = null;
if(tRight!=null){
tRightRep = addAllocationsTillCap(false, tRight, tRightContext, commonAncistor, tiChild,elementsInRange);
}
//then in between tLeftRep and tRightRep below commonAncistor
// log.info("Found tLeftRep: " + Util.getFullName(tLeftRep) + " and tRightRep: " + Util.getFullName(tRightRep));
EReference commonAncistor2ChildRef = (EReference)commonAncistor.eClass().getEStructuralFeature(tParent2ChildRef.getName());
if(commonAncistor2ChildRef==null){
throw new SimTLException("tElementReference doesn't have the name than tParent to tChildReference.");
}
//Up here both contexts could be used
addAllocationsBetweenTLeftRepAndTRightRepUnderCommonAncistor(commonAncistor, commonAncistor2ChildRef, tLeftRep, tRightRep, tiChild, tLeftContext, elementsInRange);
return elementsInRange;