private void resolvePointer(IContext context, ITemplate template) throws SimTLException{
//For printing purposes
StringBuffer callSoFar = new StringBuffer();
EObject firstCall = methodCalls.get(0);
if(firstCall == null){
throw new ValidationException("FirstCall in statement ("+caller+") is null!");
}
callSoFar.append(caller);
callSoFar.append("."+loadAttribute(firstCall, REF_METHODNAME));
//Check whether caller is a model
IModel inputModel = template.getInputModel(caller);
PlaceHolderReturnContainer firstCallPhrc = null;
if(inputModel!=null){
//load model
if(!inputModel.getModelResource().isLoaded()){
try {
inputModel.getModelResource().load(Collections.EMPTY_MAP);
} catch (IOException e) {
throw new ValidationException("Cannot load InputModel",e);
}
}
//first call needs to interpret model-resource
firstCallPhrc = evaluatePlaceHolderModelCall(inputModel,firstCall);
} else {
//caller is variable
Object variable = context.getVariableValue(caller);
if(variable == null){
throw new ValidationException("No such variable nor model with name: " + caller + " imported!");
}
//first call needs to interpret model-resource
firstCallPhrc = evaluatePlaceHolderVariableCall(variable, firstCall,callSoFar.toString());
}