if(in_oExpression != null)
{
VariableExp oVarExp = TestCaseGraphHelper.getVariableExp(in_oExpression);
if(oVarExp != null)
{
TCGOCLAtom oAtom = GeneratedFactory.eINSTANCE.createTCGOCLAtom();
oAtom.setElement(oVarExp.getReferredVariable());
// oAtom.setElement(oVarExp.getReferredVariable().getRepresentedParameter());
// oAtom.setElement(in_oExpression);
oTCGOCLExpression = oAtom;
oTCGOCLExpression.setClassification(classifyOCLExpression(oVarExp, in_sOCLTypeId));
}
else if(in_oExpression instanceof PropertyCallExp)
{
PropertyCallExp oPropExp = (PropertyCallExp)in_oExpression;
TCGOCLAtom oAtom = GeneratedFactory.eINSTANCE.createTCGOCLAtom();
// do not use the directly referenced property but the property closest to the given context
oAtom.setElement((EObject)TestCaseGraphHelper.findMatchingPropertyInContext(
oPropExp.getReferredProperty(), oContextClass));
oTCGOCLExpression = oAtom;
oTCGOCLExpression.setClassification(classifyOCLExpression(oPropExp, in_sOCLTypeId));
}
else if(in_oExpression instanceof OperationCallExp)
{
// TODO un�re Operationen einf�hren?
OperationCallExp oOpExp = (OperationCallExp)in_oExpression;
TCGOCLOperation oOperation = GeneratedFactory.eINSTANCE.createTCGOCLOperation();
// operation call on the context class
if(oOpExp.getSource() != null &&
oOpExp.getSource().getName() != null &&
oOpExp.getSource().getName().equals("self")) {
// TODO ...
}
else {
OCLExpression oOCLLeftExpression = (OCLExpression)oOpExp.getSource();
if(oOCLLeftExpression != null)
oOperation.setLeft(
transformExpression(oOCLLeftExpression, in_sOCLTypeId,
oContextClass, oContextClass));
if(oOpExp.getArgument().size() > 0)
oOperation.setRight(
transformExpression((OCLExpression)oOpExp.getArgument().get(0),
in_sOCLTypeId, oContextClass, oContextClass));
}
oOperation.setOperation((EObject)oOpExp.getReferredOperation());
oOperation.setOperationName(oOpExp.getReferredOperation().getName());
oTCGOCLExpression = oOperation;
}
else if(in_oExpression instanceof IfExp)
{
TCGOCLIfThenElse oTCGIfExp = GeneratedFactory.eINSTANCE.createTCGOCLIfThenElse();
IfExp oIfExp = (IfExp)in_oExpression;
oTCGIfExp.setCondition(transformExpression((OCLExpression)oIfExp.getCondition(),
in_sOCLTypeId, oContextClass, oContextClass));
oTCGIfExp.setThenExpression(transformExpression((OCLExpression)oIfExp.getThenExpression(),
in_sOCLTypeId, oContextClass, oContextClass));
oTCGIfExp.setElseExpression(transformExpression((OCLExpression)oIfExp.getElseExpression(),
in_sOCLTypeId, oContextClass, oContextClass));
oTCGOCLExpression = oTCGIfExp;
}
else if(in_oExpression instanceof EnumLiteralExp)
{
EnumLiteralExp oEnumExp = (EnumLiteralExp)in_oExpression;
TCGOCLAtom oAtom = GeneratedFactory.eINSTANCE.createTCGOCLAtom();
// do not use the directly referenced property but the property closest to the given context
// oAtom.setElement((EObject)TestCaseGraphHelper.findMatchingPropertyInContext(
// oEnumExp.getReferredEnumLiteral(), oContextClass));
oAtom.setElement(oEnumExp.getReferredEnumLiteral());
oTCGOCLExpression = oAtom;
oTCGOCLExpression.setClassification(VariableClassification.INDEPENDENT);
}
else if(in_oExpression instanceof BooleanLiteralExp) {
BooleanLiteralExp oBooleanExp = (BooleanLiteralExp)in_oExpression;
TCGOCLAtom oAtom = GeneratedFactory.eINSTANCE.createTCGOCLAtom();
// for(Boolean oBoolean : PrimitiveTypeEObjectReferenceHelper.sm_colEObjectToBoolean.keySet())
// {
// if(oBoolean.equals(oBooleanExp.getBooleanSymbol())) {
// oAtom.setElement(PrimitiveTypeEObjectReferenceHelper.sm_colEObjectToBoolean.get(oBoolean));
// }
// }
// if(oAtom.getElement() == null) {
// EObject oObject = GeneratedFactory.eINSTANCE.createDummy();
// PrimitiveTypeEObjectReferenceHelper.sm_colEObjectToBoolean.put(
// oBooleanExp.getBooleanSymbol(), oObject);
// oAtom.setElement(oObject);
// }
oAtom.setElement(oBooleanExp);
oTCGOCLExpression = oAtom;
oTCGOCLExpression.setClassification(VariableClassification.INDEPENDENT);
}
else if(in_oExpression instanceof IntegerLiteralExp) {
IntegerLiteralExp oIntegerExp = (IntegerLiteralExp)in_oExpression;
TCGOCLAtom oAtom = GeneratedFactory.eINSTANCE.createTCGOCLAtom();
oAtom.setElement(oIntegerExp);
oTCGOCLExpression = oAtom;
oTCGOCLExpression.setClassification(VariableClassification.INDEPENDENT);
}
//@author Amin Rezaee
else if(in_oExpression instanceof RealLiteralExp){
RealLiteralExp oRealExp = (RealLiteralExp)in_oExpression;
TCGOCLAtom oAtom = GeneratedFactory.eINSTANCE.createTCGOCLAtom();
oAtom.setElement(oRealExp);
oTCGOCLExpression = oAtom;
oTCGOCLExpression.setClassification(VariableClassification.INDEPENDENT);
}
//Amin
if(oTCGOCLExpression == null) {