@Override public void meet(And node) throws RuntimeException { builder.append("("); node.getLeftArg().visit(this); builder.append(" AND "); node.getRightArg().visit(this); builder.append(")"); }
@Override public void visit(And andExp) { System.out.print("("); if (andExp.getLHS() != null) andExp.getLHS().accept(this); System.out.print(" && "); if (andExp.getRHS() != null) andExp.getRHS().accept(this); System.out.print(")"); }
private void andWithFalse(boolean withSideEffect, boolean falseOnLeft) { And and = new And(); and.type = BooleanType.instance; False falseExp = new False(); falseExp.type = BooleanType.instance; java.lang.Class expectedClass; if (withSideEffect) expectedClass = And.class; else expectedClass = False.class; operationWithConstantValue(and, expectedClass, falseExp, falseOnLeft, withSideEffect); }
public void trivialAndTester(boolean firstIsTrue, boolean secondIsTrue) { And and = new And(); and.left = firstIsTrue ? new True() : new False(); and.left.type = BooleanType.instance; and.right = secondIsTrue ? new True() : new False(); and.right.type = BooleanType.instance; expressionSimplificationTester( and, firstIsTrue && secondIsTrue ? True.class : False.class, BooleanType.instance, 0, false); }
public static void init() { Add.init(); Address.init(); Align.init(); Alloc.init(); Anchor.init(); And.init(); Bad.init(); Bitcast.init(); Block.init(); Builtin.init(); Call.init(); Cmp.init(); Cond.init(); Confirm.init(); Const.init(); Conv.init(); CopyB.init(); Deleted.init(); Div.init(); Dummy.init(); End.init(); Eor.init(); Free.init(); IJmp.init(); Id.init(); Jmp.init(); Load.init(); Member.init(); Minus.init(); Mod.init(); Mul.init(); Mulh.init(); Mux.init(); NoMem.init(); Not.init(); Offset.init(); Or.init(); Phi.init(); Pin.init(); Proj.init(); Raise.init(); Return.init(); Sel.init(); Shl.init(); Shr.init(); Shrs.init(); Size.init(); Start.init(); Store.init(); Sub.init(); Switch.init(); Sync.init(); Tuple.init(); Unknown.init(); }
@Override public Boolean visit(And ast) { boolean checkLhs = ast.getLhs().accept(this); boolean checkRhs = ast.getRhs().accept(this); if (!(checkLhs && checkRhs)) return false; Type lhsType = ast.getLhs().typeOf(env); Type rhsType = ast.getRhs().typeOf(env); if (!(lhsType.isCompatibleToBool() && rhsType.isCompatibleToBool())) { addToErrorList( ast, "the operator && can not be applied to instances of type " + lhsType.getClass() + " and type " + rhsType.getClass()); return false; } return true; }
@Override public ConfigurationRuleBuilderWhen when(Condition condition, Condition... conditions) { List<Condition> list = new LinkedList<Condition>(); list.add(condition); list.addAll(Arrays.asList(conditions)); for (ConfigurationRuleBuilderInterceptor interceptor : interceptors) { list = interceptor.when(list); } rule.when(And.all(list.toArray(new Condition[list.size()]))); return this; }
private Query buildESQuery(String startDate, String endDate) { // build query Query query = new Query(); Filtered filtered = null; FilteredWithQuery filteredWithQuery = null; CreatedDate createdDate = new CreatedDate(); createdDate.setGte(startDate); createdDate.setLte(endDate); Range range = new Range(); range.setCreatedDate(createdDate); And and = new And(); and.setRange(range); List<And> andList = new ArrayList<And>(); andList.add(and); FilterWithAnd fwa = new FilterWithAnd(); fwa.setAnd(andList); if (groupsNames != null) { QueryWithTerms qwt = new QueryWithTerms(); Terms terms = new Terms(); terms.setGroupName(PerisaiUtil.userGroupListToArr(groupsNames)); qwt.setTerms(terms); filteredWithQuery = new FilteredWithQuery(); filteredWithQuery.setQuery(qwt); filteredWithQuery.setFilter(fwa); query.setFiltered(filteredWithQuery); } else { filtered = new Filtered(); filtered.setFilter(fwa); query.setFiltered(filtered); } return query; }
private Expression<K> copyWithoutTrue(And<K> input) { List<Expression<K>> copy = Lists.newArrayList(); for (Expression<K> expr : input.expressions) { if (expr instanceof Literal) { Literal l = (Literal) expr; if (l.getValue()) { continue; } } copy.add(expr); } if (copy.isEmpty()) { return Literal.getTrue(); } return And.of(copy); }
@Override public ConditionBuilder andNot(final Condition condition) { if (condition == null) return this; return And.all(this, Not.any(condition)); }
/** * Wrap a given {@link Condition} as a new {@link DefaultConditionBuilder} that evaluates the the * original {@link Condition} when {@link #evaluate(Rewrite, EvaluationContext)} is invoked. */ public static ConditionBuilder wrap(Condition condition) { if (condition == null) return create(); return And.all(condition); }
/** * Wrap a given {@link Condition} as a new {@link DefaultConditionBuilder} that evaluates the the * original {@link Condition} when {@link #evaluate(Rewrite, EvaluationContext)} is invoked. */ public static ConditionBuilder wrap(Condition condition) { if (condition == null) return create(); if (condition instanceof ConditionBuilder) return (ConditionBuilder) condition; return And.all(condition); }