if (c.getListExpression() != null) {
list = verbalizer.verbalize(c.getListExpression());
} else {
list = verbalizer.verbalize(c.getStringList());
}
IStringExpression a = c.getArg();
String arg = "";
if (a != null) {
arg = ", " + verbalizer.verbalize(a);
}
return name + list +arg + ")";
} else if (condition instanceof LastCondition) {
LastCondition c = (LastCondition) condition;
return name + verbalizer.verbalize(c.getType()) + ")";
} else if (condition instanceof MOfNCondition) {
MOfNCondition c = (MOfNCondition) condition;
StringBuilder sb = new StringBuilder();
sb.append(name);
INumberExpression minE = c.getMin();
String min = verbalizeMin(minE, Integer.MIN_VALUE);
INumberExpression maxE = c.getMax();
String max = verbalizeMax(maxE, Integer.MAX_VALUE);
sb.append(min.substring(2, min.length()));
sb.append(max);
List<AbstractRutaCondition> conditions = c.getConditions();
if (!conditions.isEmpty()) {
sb.append(", ");
}
Iterator<AbstractRutaCondition> it = conditions.iterator();
while (it.hasNext()) {
AbstractRutaCondition each = (AbstractRutaCondition) it.next();
sb.append(verbalize(each));
if (it.hasNext()) {
sb.append(", ");
}
}
sb.append(")");
return sb.toString();
} else if (condition instanceof NearCondition) {
NearCondition c = (NearCondition) condition;
String type = verbalizer.verbalize(c.getType());
String var = verbalizer.verbalize(c.getForward());
INumberExpression minE = c.getMin();
String min = verbalizeMin(minE, Integer.MIN_VALUE);
INumberExpression maxE = c.getMax();
String max = verbalizeMax(maxE, Integer.MAX_VALUE);
String filtered = verbalizer.verbalize(c.getFiltered());
if (!"".equals(filtered)) {
filtered = ", " + filtered;
}
return name + type + min + max + ", " + var + filtered + ")";
} else if (condition instanceof NotCondition) {
NotCondition c = (NotCondition) condition;
List<AbstractRutaCondition> conditions = c.getConditions();
if (conditions.size() != 1) {
StringBuilder sb = new StringBuilder();
sb.append(name);
Iterator<AbstractRutaCondition> it = conditions.iterator();
while (it.hasNext()) {
AbstractRutaCondition each = (AbstractRutaCondition) it.next();
sb.append(verbalize(each));
if (it.hasNext()) {
sb.append(", ");
}
}
sb.append(")");
return sb.toString();
} else {
return "-" + verbalize(conditions.get(0));
}
} else if (condition instanceof OrCondition) {
OrCondition c = (OrCondition) condition;
List<AbstractRutaCondition> conditions = c.getConditions();
StringBuilder sb = new StringBuilder();
sb.append(name);
Iterator<AbstractRutaCondition> it = conditions.iterator();
while (it.hasNext()) {
AbstractRutaCondition each = (AbstractRutaCondition) it.next();
sb.append(verbalize(each));
if (it.hasNext()) {
sb.append(", ");
}
}
sb.append(")");
return sb.toString();
} else if (condition instanceof PartOfCondition) {
PartOfCondition c = (PartOfCondition) condition;
if (c.getType() == null) {
return name + verbalizer.verbalize(c.getList()) + ")";
} else {
return name + verbalizer.verbalize(c.getType()) + ")";
}
} else if (condition instanceof PartOfNeqCondition) {
PartOfNeqCondition c = (PartOfNeqCondition) condition;
if (c.getType() == null) {
return name + verbalizer.verbalize(c.getList()) + ")";
} else {
return name + verbalizer.verbalize(c.getType()) + ")";
}
} else if (condition instanceof PositionCondition) {
PositionCondition c = (PositionCondition) condition;
String relative = "";
if (c.getRelative() != null) {
relative = ", " + verbalizer.verbalize(c.getRelative());
}
return name + verbalizer.verbalize(c.getType()) + ", "
+ verbalizer.verbalize(c.getPosition()) + relative + ")";
} else if (condition instanceof RegExpCondition) {
RegExpCondition c = (RegExpCondition) condition;
IStringExpression variable = c.getVariable();
String ic = verbalizer.verbalize(c.getIgnoreCase());
if (variable == null) {
return name + verbalizer.verbalize(c.getPattern()) + ", " + ic + ")";
} else {
return name + verbalizer.verbalize(variable) + ", " + verbalizer.verbalize(c.getPattern()) + ", " + ic + ")";