if(in_oNamespace instanceof org.eclipse.uml2.uml.Class)
oContextClass = (org.eclipse.uml2.uml.Class)in_oNamespace;
else if(in_oNamespace instanceof org.eclipse.uml2.uml.Operation)
oContextClass = ((org.eclipse.uml2.uml.Operation)in_oNamespace).getClass_();
TCGOCLExpression oTCGOCLExpression = null;
if(in_oExpression != null)
{
VariableExp oVarExp = TestCaseGraphHelper.getVariableExp(in_oExpression);
if(oVarExp != null)
{
TCGOCLAtom oAtom = GeneratedFactory.eINSTANCE.createTCGOCLAtom();
//oAtom.setElement(oVarExp.getReferredVariable());
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();
OCLExpression oOCLLeftExpression = (OCLExpression)oOpExp.getSource();
if(oOCLLeftExpression != null)
oOperation.setLeft(
transformExpression(oOCLLeftExpression, in_sOCLTypeId, oContextClass));
if(oOpExp.getArgument().size() > 0)
oOperation.setRight(
transformExpression((OCLExpression)oOpExp.getArgument().get(0), in_sOCLTypeId, 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));
oTCGIfExp.setThenExpression(transformExpression((OCLExpression)oIfExp.getThenExpression(), in_sOCLTypeId, oContextClass));
oTCGIfExp.setElseExpression(transformExpression((OCLExpression)oIfExp.getElseExpression(), in_sOCLTypeId, oContextClass));
oTCGOCLExpression = oTCGIfExp;
}
// Reference to original OCL expression
oTCGOCLExpression.setOclReference(in_oExpression);
}
return oTCGOCLExpression;
}