if(in_oExpression == null)
return oDNF;
if(in_oExpression instanceof TCGOCLOperation)
{
TCGOCLOperation oOpExp = (TCGOCLOperation)in_oExpression;
// TODO f�r alle andere booleschen Operatoren erweitern
if(oOpExp.getOperationName().compareTo("and") == 0)
{
TCGDisjunctiveNormalForm oLeftDNF = createDisjunctiveNormalForm(oOpExp.getLeft());
TCGDisjunctiveNormalForm oRightDNF = createDisjunctiveNormalForm(oOpExp.getRight());
return connectTwoDNFWithAnd(oLeftDNF, oRightDNF);
}
if(oOpExp.getOperationName().compareTo("or") == 0)
{
TCGDisjunctiveNormalForm oLeftDNF = createDisjunctiveNormalForm(oOpExp.getLeft());
TCGDisjunctiveNormalForm oRightDNF = createDisjunctiveNormalForm(oOpExp.getRight());
return connectTwoDNFWithOr(oLeftDNF, oRightDNF);
// DisjunctiveNormalForm oFirstDNF = new DisjunctiveNormalForm();
// {
// TCGOCLExpression oFirstExp = TestCaseGraphHelper.copyExpression(oOpExp.getLeft());
// TCGOCLExpression oSecondExp = TestCaseGraphHelper.copyExpression(oOpExp.getRight());
// Conjunction oFirstConjunction = new Conjunction();
// oFirstConjunction.getExpressions().add(oFirstExp);
// oFirstConjunction.getExpressions().add(oSecondExp);
// oFirstDNF.getConjunctions().add(oFirstConjunction);
// }
//
// DisjunctiveNormalForm oSecondDNF = new DisjunctiveNormalForm();
// {
// TCGOCLExpression oFirstExp = TestCaseGraphHelper.copyExpression(oOpExp.getLeft());
// negateTCGOCLExpression(oFirstExp);
// TCGOCLExpression oSecondExp = TestCaseGraphHelper.copyExpression(oOpExp.getRight());
// Conjunction oFirstConjunction = new Conjunction();
// oFirstConjunction.getExpressions().add(oFirstExp);
// oFirstConjunction.getExpressions().add(oSecondExp);
// oSecondDNF.getConjunctions().add(oFirstConjunction);
// }
//
// DisjunctiveNormalForm oThirdDNF = new DisjunctiveNormalForm();
// {
// TCGOCLExpression oFirstExp = TestCaseGraphHelper.copyExpression(oOpExp.getLeft());
// TCGOCLExpression oSecondExp = TestCaseGraphHelper.copyExpression(oOpExp.getRight());
// negateTCGOCLExpression(oSecondExp);
// Conjunction oFirstConjunction = new Conjunction();
// oFirstConjunction.getExpressions().add(oFirstExp);
// oFirstConjunction.getExpressions().add(oSecondExp);
// oThirdDNF.getConjunctions().add(oFirstConjunction);
// }
//
// return connectTwoDNFWithOr(oFirstDNF, connectTwoDNFWithOr(oSecondDNF, oThirdDNF));
}
if(oOpExp.getOperationName().compareTo("not") == 0)
{
// negation has to be applicated to all sub-expressions
// TODO: introduce unary operation - which side holds the information?
if(oOpExp.getLeft() != null)
{
oOpExp.setLeft(negateTCGOCLExpression(oOpExp.getLeft()));
return createDisjunctiveNormalForm(oOpExp.getLeft());
}
else if(oOpExp.getRight() != null)
{
oOpExp.setRight(negateTCGOCLExpression(oOpExp.getRight()));
return createDisjunctiveNormalForm(oOpExp.getRight());
}
}
if(oOpExp.getOperationName().compareTo("<>") == 0)
{
// split up "<>" in two alternatives: "<" or ">"
TCGOCLOperation oFirstExp = (TCGOCLOperation)TestCaseGraphHelper.copyExpression(oOpExp);
oFirstExp.setOperationName("<");
TCGConjunction oFirstConjunction = GeneratedFactory.eINSTANCE.createTCGConjunction();
oFirstConjunction.getExpressions().add(oFirstExp);
TCGOCLOperation oSecondExp = (TCGOCLOperation)TestCaseGraphHelper.copyExpression(oOpExp);
oSecondExp.setOperationName(">");
TCGConjunction oSecondConjunction = GeneratedFactory.eINSTANCE.createTCGConjunction();
oSecondConjunction.getExpressions().add(oSecondExp);
TCGDisjunctiveNormalForm oNewDNF = GeneratedFactory.eINSTANCE.createTCGDisjunctiveNormalForm();
oNewDNF.getConjunctions().add(oFirstConjunction);