use of com.yahoo.elide.core.security.permissions.expressions.NotExpression in project elide by yahoo.
the class PermissionExpressionNormalizationVisitor method visitNotExpression.
@Override
public Expression visitNotExpression(NotExpression notExpression) {
Expression inner = notExpression.getLogical();
if (inner instanceof AndExpression) {
AndExpression and = (AndExpression) inner;
Expression left = new NotExpression(and.getLeft()).accept(this);
Expression right = new NotExpression(and.getRight()).accept(this);
return new OrExpression(left, right);
}
if (inner instanceof OrExpression) {
OrExpression or = (OrExpression) inner;
Expression left = new NotExpression(or.getLeft()).accept(this);
Expression right = new NotExpression(or.getRight()).accept(this);
return new AndExpression(left, right);
}
if (inner instanceof NotExpression) {
NotExpression not = (NotExpression) inner;
return (not.getLogical()).accept(this);
}
return notExpression;
}
Aggregations