*/
public static boolean expressionIsContradicting(TCGOCLOperation in_oExpression)
{
// TODO: implement a checker operation to return the type of an expression (boolean, int, double)
try { // double?
TCGOCLOperation oOperation = (TCGOCLOperation)in_oExpression;
double nLeftValue = TCGOCLExpressionHelperClass.getDoubleValue(oOperation.getLeft());
double nRightValue = TCGOCLExpressionHelperClass.getDoubleValue(oOperation.getRight());
if((oOperation.getOperationName().compareTo("<") == 0) && (nLeftValue >= nRightValue))
return true;
if((oOperation.getOperationName().compareTo("<=") == 0) && (nLeftValue > nRightValue))
return true;
if((oOperation.getOperationName().compareTo("=") == 0) && (nLeftValue != nRightValue))
return true;
if((oOperation.getOperationName().compareTo(">=") == 0) && (nLeftValue < nRightValue))
return true;
if((oOperation.getOperationName().compareTo(">") == 0) && (nLeftValue <= nRightValue))
return true;
if((oOperation.getOperationName().compareTo("<>") == 0) && (nLeftValue == nRightValue))
return true;
}
catch(Exception e)
{
// nothing ...
try { // int?
TCGOCLOperation oOperation = (TCGOCLOperation)in_oExpression;
int nLeftValue = TCGOCLExpressionHelperClass.getIntegerValue(oOperation.getLeft());
int nRightValue = TCGOCLExpressionHelperClass.getIntegerValue(oOperation.getRight());
if((oOperation.getOperationName().compareTo("<") == 0) && (nLeftValue >= nRightValue))
return true;
if((oOperation.getOperationName().compareTo("<=") == 0) && (nLeftValue > nRightValue))
return true;
if((oOperation.getOperationName().compareTo("=") == 0) && (nLeftValue != nRightValue))
return true;
if((oOperation.getOperationName().compareTo(">=") == 0) && (nLeftValue < nRightValue))
return true;
if((oOperation.getOperationName().compareTo(">") == 0) && (nLeftValue <= nRightValue))
return true;
if((oOperation.getOperationName().compareTo("<>") == 0) && (nLeftValue == nRightValue))
return true;
}
catch(Exception e1) {
// nothing ...
try { // boolean?
TCGOCLOperation oOperation = (TCGOCLOperation)in_oExpression;
boolean nLeftValue = TCGOCLExpressionHelperClass.getBooleanValueIfNegative(oOperation.getLeft());
boolean nRightValue = TCGOCLExpressionHelperClass.getBooleanValueIfNegative(oOperation.getRight());
if((oOperation.getOperationName().compareTo("=") == 0) && (nLeftValue != nRightValue))
return true;
if((oOperation.getOperationName().compareTo("<>") == 0) && (nLeftValue == nRightValue))
return true;
}
catch(Exception e2) {
// nothing ... but an error message