Skip to content

Commit 54e8ff1

Browse files
committed
Nicer expression ordering.
1 parent f70b038 commit 54e8ff1

File tree

1 file changed

+5
-1
lines changed
  • base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers

1 file changed

+5
-1
lines changed

base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/Expr.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,8 @@ public Expr and(Expr expr) {
462462
if (type.isLogical() && !expr.type.isLogical()) {
463463
if (type == AND)
464464
right.and(expr);
465+
else if (type != NOT)
466+
setLogical(Type.AND, expr, new Expr(this));
465467
else
466468
setLogical(Type.AND, expr, new Expr(this));
467469
} else {
@@ -488,8 +490,10 @@ public Expr or(Expr expr) {
488490
if (type.isLogical() && !expr.type.isLogical()) {
489491
if (type == OR)
490492
right.or(expr);
491-
else
493+
else if (type != NOT)
492494
setLogical(Type.OR, expr, new Expr(this));
495+
else
496+
setLogical(Type.OR, new Expr(this), expr);
493497
}
494498
else
495499
setLogical(Type.OR, new Expr(this), expr);

0 commit comments

Comments
 (0)