String head = w[startIndex];
if (head.equals("TW") || head.equals("IW") || head.equals("SW") || head.equals("SM") || head.equals("TM")) {
Pair<FuzzyExpression, Integer> exp1 = parseExpression(w, startIndex + 1);
Pair<FuzzyExpression, Integer> exp2 = parseExpression(w, exp1.b);
if (head.equals("TW"))
return new Pair(new FuzzyBinaryExpression(exp1.a, exp2.a, new TW()), exp2.b);
else if (head.equals("IW"))
return new Pair(new FuzzyBinaryExpression(exp1.a, exp2.a, new IW()), exp2.b);
else if (head.equals("SW"))
return new Pair(new FuzzyBinaryExpression(exp1.a, exp2.a, new SW()), exp2.b);
else if (head.equals("TM"))
return new Pair(new FuzzyBinaryExpression(exp1.a, exp2.a, new TM()), exp2.b);
else if (head.equals("SM"))
return new Pair(new FuzzyBinaryExpression(exp1.a, exp2.a, new SM()), exp2.b);
else {
System.err.println("WARNING: ILLEGAL FUZZY EXPRESSION 2 (parseExpression/RandomProblemGenerator");
return null;
}
}