Map<String, Integer> m = new HashMap();
m.put(((FuzzyVariableExpression) fexp).getName(), 1);
return new NodeExp(m, 0);
}
else if (fexp instanceof FuzzyUnaryExpression) {
FuzzyUnaryExpression fu = (FuzzyUnaryExpression) fexp;
if (fu.getOperator() instanceof N) {
MaxMinExp arg = clauseToMaxMin(fu.getArgument());
return arg.getComplement();
}
else
throw new UnsupportedOperationException();
}
else if (fexp instanceof FuzzyBinaryExpression) {
FuzzyBinaryExpression fu = (FuzzyBinaryExpression) fexp;
if (fu.getOperator() instanceof TW) {
MaxMinExp arg1 = clauseToMaxMin(fu.getArgument1());
MaxMinExp arg2 = clauseToMaxMin(fu.getArgument2());
MaxMinExp res = arg1.add(arg2);
NodeExp c = new NodeExp(new HashMap(), -1);
MaxMinExp a = res.add(c);
MaxMinExp b = new NodeExp(new HashMap(), 0);
return new MaxExp(a, b);
}
else if (fu.getOperator() instanceof SM) {
MaxMinExp arg1 = clauseToMaxMin(fu.getArgument1());
MaxMinExp arg2 = clauseToMaxMin(fu.getArgument2());
return new MaxExp(arg1, arg2);
}
else
throw new UnsupportedOperationException();
}