/** * Returns true if the document referenced by this document operation is accepted by this selector * * @param op A document operation * @return True if the document is accepted. * @throws RuntimeException if the evaluation enters an illegal state */ public Result accepts(DocumentOperation op) { return accepts(new Context(op)); }
@Override public Object evaluate(Context context) { return evaluate(context.getDocumentOperation()); }
@Override public Object evaluate(Context context) { Object o = context.getVariables().get(value); if (o == null) { throw new IllegalArgumentException("Variable " + value + " was not set in the variable list"); } return o; }
public Number evaluate(Document doc, Map<String, Object> variables) { Context context = new Context(new DocumentPut(doc)); context.setVariables(variables); try { Object o = comparison.getLHS().evaluate(context); if (Double.isInfinite(((Number)o).doubleValue())) { throw new IllegalArgumentException("Expression evaluated to an infinite number"); } return ((Number)o).doubleValue(); } catch (ArithmeticException e) { throw new IllegalArgumentException("Arithmetic exception " + e.getMessage(), e); } } }
public Object evaluate(Context context) { return distribution.getColumn(factory.getBucketId(context.getDocumentOperation().getId())); }
/** * Returns the list of different variables resulting in a true state for this * expression. * * @param op The document to evaluate. * @return True if the document is accepted. * @throws RuntimeException if the evaluation enters an illegal state */ public ResultList getMatchingResultList(DocumentOperation op) { return getMatchingResultList(new Context(op)); }
public Object evaluate(Context context) { DocumentId id = context.getDocumentOperation().getId(); if (id == null) { throw new IllegalStateException("Document has no identifier.");