@Override public boolean containsKey(Object key) { boolean result = super.containsKey(key); if (result == false && parent != null) result = parent.containsKey(key); return result; }
/** * Return <code>true</code> if this instance is equal to {@link RewriteState#EVALUATING}. */ public boolean isEvaluating() { return EVALUATING.equals(this); }
/** * Returns the number of "Not"s that have been evaluated in the current evaluation process. * * For example, when(Not.any(MyCondition)) would have a "NotCount" of "1" during the evaluation of "MyCondition". * * when(Not.any(Not.any(MyCondition))) would have a "NotCount" of "2" during the evaluation of "MyCondition". * * This is useful for conditions that may have side effects, as they will know whether or not their condition is being * negated. */ public static int getNegationCount(final EvaluationContext context) { if (context == null) return 0; Integer count = (Integer)context.get(NEGATION_COUNT_KEY); return count == null ? 0 : count; }
@Override public void put(Object key, Object value) { if (wrapped instanceof Context) { ((Context) wrapped).put(key, value); } contextMap.put(key, value); }
@Override public Object get(Object key) { if (wrapped instanceof Context) { return ((Context) wrapped).get(key); } return contextMap.get(key); }
private void storeValue(final Rewrite event, final EvaluationContext context, final String key, final Object value) { context.put(key, value); }
/** * Clears the state of this context so that it may be reused, saving instantiation cost during rule iteration. */ @Override public void clear() { this.postOperations.clear(); this.postOperations.clear(); state = null; super.clear(); }
@Override public void clear() { if (wrapped instanceof Context) { ((Context) wrapped).clear();; } contextMap.clear();; }
/** * Returns the number of "Not"s that have been evaluated in the current evaluation process. * * For example, when(Not.any(MyCondition)) would have a "NotCount" of "1" during the evaluation of "MyCondition". * * when(Not.any(Not.any(MyCondition))) would have a "NotCount" of "2" during the evaluation of "MyCondition". * * This is useful for conditions that may have side effects, as they will know whether or not their condition is being * negated. */ public static int getNegationCount(final EvaluationContext context) { if (context == null) return 0; Integer count = (Integer)context.get(NEGATION_COUNT_KEY); return count == null ? 0 : count; }
@Override public void put(Object key, Object value) { if (wrapped instanceof Context) { ((Context) wrapped).put(key, value); } contextMap.put(key, value); }
/** * Gets the current instance of {@link RuleProviderRegistry}. */ public static RuleProviderRegistry instance(GraphRewrite event) { RuleProviderRegistry instance = (RuleProviderRegistry) event.getRewriteContext().get(RuleProviderRegistry.class); return instance; }
@Override public boolean containsKey(Object key) { boolean result = super.containsKey(key); if (result == false && parent != null) result = parent.containsKey(key); return result; }
private void storeValue(final Rewrite event, final EvaluationContext context, final String key, final Object value) { context.put(key, value); }
/** * Clears the state of this context so that it may be reused, saving instantiation cost during rule iteration. */ @Override public void clear() { this.postOperations.clear(); this.postOperations.clear(); super.clear(); }
/** * Return <code>true</code> if this instance is equal to {@link RewriteState#PERFORMING}. */ public boolean isPerforming() { return PERFORMING.equals(this); } }
public ClassificationModel attachClassification(GraphRewrite event, EvaluationContext context, FileModel fileModel, String categoryId, String classificationText, String description) { Rule rule = (Rule) context.get(Rule.class); return attachClassification(event, rule, fileModel, categoryId, classificationText, description); }
/** * Return <code>true</code> if this instance is equal to {@link RewriteState#EVALUATING}. */ public boolean isEvaluating() { return EVALUATING.equals(this); }
/** * Return <code>true</code> if this instance is equal to {@link RewriteState#PERFORMING}. */ public boolean isPerforming() { return PERFORMING.equals(this); } }