consistent toString functions for expressions, parentasis are added if neccessary
This commit is contained in:
@@ -20,10 +20,15 @@ public class AndExpression implements Expression {
|
||||
return Type.AND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Priority getPriority() {
|
||||
return Priority.LOGIC_AND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return exprs.stream().map(e -> {
|
||||
if (e instanceof OrExpression) {
|
||||
if (e.getPriority().getValue() < getPriority().getValue()) {
|
||||
return "(" + e + ")";
|
||||
} else {
|
||||
return e.toString();
|
||||
|
||||
Reference in New Issue
Block a user