FuzzyConstantExpression cstexp = (FuzzyConstantExpression) exp;
int val = (int) (Math.round(cstexp.getValue() * totalNumberOfDegrees));
return new IntegerConstantVariable(val);
}
else if (exp instanceof FuzzyUnaryExpression) {
FuzzyUnaryExpression unexp = (FuzzyUnaryExpression) exp;
if (unexp.getOperator() instanceof N) {
IntegerExpressionVariable arg = getExpression(unexp.getArgument());
return plus(totalNumberOfDegrees, mult(arg, -1));
}
else if(unexp.getOperator() instanceof NM){
Constraint cnstr = lt(0,getExpression(unexp.getArgument()));
return ifThenElse(cnstr,new IntegerConstantVariable(0),new IntegerConstantVariable(totalNumberOfDegrees));
}
else
throw new UnsupportedOperationException();
}