//negate if condition
parameterModelHandler.negateCondition(new TIfStatement(tObject,context,template), true);
//introduce trace link
modelCorrespondence.add(
new TraceLink(
(StaticContext)context, //context is been adapted
new TraceLinkNode(
template,
tChild
),
new TraceLinkNode(
instance,
tiChild
)
));
} else if(TForLoop.isTForLoop(tObject)){
TForLoop forLoop = new TForLoop(tObject, context, template);
EObject neighborInputElement = context.getVariableValue(forLoop.getName());
Reference2Element pPointerToList = (Reference2Element)forLoop.getSetToBeIterated().getReferenceFromParent();
List<EObject> parameterList = (List<EObject>)pPointerToList.getReferencedValue();
if(parameterList.size()>0
&& (neighborInputElement==null
||!parameterList.contains(neighborInputElement))){
throw new SimTLException("InputModel collection doesn't contain neighbor input element. It does contain other elements though");
}
Reference2Element pPointerToListElement = (Reference2Element)pPointerToList;
EClass pClass = pPointerToListElement.getReferenceToChildren().getEReferenceType();
//create new inputElement
EObject pElement = pClass.getEPackage().getEFactoryInstance().create(pClass);
if(pElement==null) throw new SimTLException("Couldn't instantiate parameter element type " + pClass.getName());
//Add element to parameter model
if(parameterList.size()>1){
//It must be a new iteration => Existing is covered in position above
boolean insertToRightOfParam = ((NewIterationAddAllocation)grayElementAddAllocation).isInsertToRightOfParam();
int neighborIndex = parameterList.indexOf(neighborInputElement);
int pIndex =
insertToRightOfParam
?neighborIndex+1
:neighborIndex;
parameterModelHandler.addElement(pElement, pIndex, pPointerToList);
} else {
parameterModelHandler.addElement(pElement, Util.NO_POSITION, pPointerToList);
}
//Update context
context = addVariableToContext(context, forLoop.getName(), pElement);
//introduce trace link
modelCorrespondence.add(
new TraceLink(
(StaticContext)context, //context is been adapted
new TraceLinkNode(
template,
tChild
),