public Object evaluate(MessageEvaluationContext message) throws JMSException { Object rvalue = right.evaluate(message); if (rvalue == null) { return null; } if (rvalue instanceof Number) { return negate((Number)rvalue); } return null; }
/** * @see org.apache.activemq.filter.Expression#evaluate(MessageEvaluationContext) */ public Object evaluate(MessageEvaluationContext message) throws JMSException { if (view == cview) { return cachedValue; } cachedValue = right.evaluate(message); cview = view; return cachedValue; }
public Object evaluate(MessageEvaluationContext message) throws JMSException { Boolean lvalue = (Boolean)right.evaluate(message); if (lvalue == null) { return null; } return lvalue.booleanValue() ? Boolean.FALSE : Boolean.TRUE; }
public Object evaluate(MessageEvaluationContext message) throws JMSException { Boolean lv = (Boolean)left.evaluate(message); if (lv != null && lv.booleanValue()) { return Boolean.TRUE; } Boolean rv = (Boolean)right.evaluate(message); if (rv != null && rv.booleanValue()) { return Boolean.TRUE; } if (lv == null || rv == null) { return null; } return Boolean.FALSE; }
public Object evaluate(MessageEvaluationContext message) throws JMSException { Boolean lv = (Boolean)left.evaluate(message); if (lv != null && !lv.booleanValue()) { return Boolean.FALSE; } Boolean rv = (Boolean)right.evaluate(message); if (rv != null && !rv.booleanValue()) { return Boolean.FALSE; } if (lv == null || rv == null) { return null; } return Boolean.TRUE; }
@SuppressWarnings({ "rawtypes", "unchecked" }) public Object evaluate(MessageEvaluationContext message) throws JMSException { Comparable<Comparable> lv = (Comparable)left.evaluate(message); if (lv == null) { return null; } Comparable rv = (Comparable)right.evaluate(message); if (rv == null) { return null; } return compare(lv, rv); }
public Object evaluate(MessageEvaluationContext message) throws JMSException { Object rvalue = right.evaluate(message); if (rvalue == null) { return null; } if (rvalue.getClass() != String.class) { return null; } if ((inList != null && inList.contains(rvalue)) ^ not) { return Boolean.TRUE; } else { return Boolean.FALSE; } }
public Object evaluate(MessageEvaluationContext message) throws JMSException { Object rvalue = right.evaluate(message); if (rvalue == null) { return null; } if (!rvalue.getClass().equals(Boolean.class)) { return Boolean.FALSE; } return ((Boolean)rvalue).booleanValue() ? Boolean.TRUE : Boolean.FALSE; }
public Object evaluate(MessageEvaluationContext message) throws JMSException { Object lv = left.evaluate(message); Object rv = right.evaluate(message); // If one of the values is null if (lv == null ^ rv == null) { if (lv == null) { return null; } return Boolean.FALSE; } if (lv == rv || lv.equals(rv)) { return Boolean.TRUE; } if (lv instanceof Comparable && rv instanceof Comparable) { return compare((Comparable)lv, (Comparable)rv); } return Boolean.FALSE; }
/** * @see org.apache.activemq.filter.Expression#evaluate(MessageEvaluationContext) */ public Object evaluate(MessageEvaluationContext message) throws JMSException { Object rv = this.getRight().evaluate(message); if (rv == null) { return null; } if (!(rv instanceof String)) { return Boolean.FALSE; // throw new RuntimeException("LIKE can only operate on String // identifiers. LIKE attemped on: '" + rv.getClass()); } return likePattern.matcher((String)rv).matches() ? Boolean.TRUE : Boolean.FALSE; }
/** * Evalutate the given expression, which consists of a call to this function, in the context given. Checks * whether the second argument is a member of the list in the first argument. * * @param expr - the expression consisting of a call to this function. * @param message_ctx - the context in which the call is being evaluated. * @return Boolean - the result of the evaluation. */ public Object evaluate(FunctionCallExpression expr, MessageEvaluationContext message_ctx) throws javax.jms.JMSException { java.util.List arr; int cur; Object cand; boolean found_f; arr = (java.util.List) expr.getArgument(0).evaluate(message_ctx); cand = expr.getArgument(1).evaluate(message_ctx); cur = 0; found_f = false; while ((cur < arr.size()) && (!found_f)) { found_f = arr.get(cur).equals(cand); cur++; } return Boolean.valueOf(found_f); } }
/** * Evaluates the message against all the Expressions added to this object. * The added ExpressionListeners are notified of the result of the * evaluation. * * @param message */ public void evaluate(MessageEvaluationContext message) { Collection<ExpressionListenerSet> expressionListeners = rootExpressions.values(); for (Iterator<ExpressionListenerSet> iter = expressionListeners.iterator(); iter.hasNext();) { ExpressionListenerSet els = iter.next(); try { Object result = els.expression.evaluate(message); for (Iterator<ExpressionListener> iterator = els.listeners.iterator(); iterator.hasNext();) { ExpressionListener l = iterator.next(); l.evaluateResultEvent(els.expression, message, result); } } catch (Throwable e) { e.printStackTrace(); } } } }
/** * Evaluate the given expression for this function in the given context. The result of the evaluation is a * string with all matches of the regular expression, from the evaluation of the second argument, replaced by * the string result from the evaluation of the third argument. Replacement is performed by * String#replaceAll(). * <p/> * Note that all three arguments must be Strings. * * @param expr - the expression consisting of a call to this function. * @return String - the result of the replacement. */ public Object evaluate(FunctionCallExpression expr, MessageEvaluationContext message_ctx) throws javax.jms.JMSException { String src; String match_regex; String repl_lit; String result; src = (String) expr.getArgument(0).evaluate(message_ctx); match_regex = (String) expr.getArgument(1).evaluate(message_ctx); repl_lit = (String) expr.getArgument(2).evaluate(message_ctx); result = src.replaceAll(match_regex, repl_lit); return result; } }
/** * Evalutate the given expression, which consists of a call to this function, in the context given. Creates * a list containing the evaluated results of its argument expressions. * * @param expr - the expression consisting of a call to this function. * @param message_ctx - the context in which the call is being evaluated. * @return java.util.List - the result of the evaluation. */ public Object evaluate(FunctionCallExpression expr, MessageEvaluationContext message) throws javax.jms.JMSException { java.util.ArrayList ele_arr; int num_arg; int cur; num_arg = expr.getNumArguments(); ele_arr = new java.util.ArrayList(num_arg); cur = 0; while (cur < num_arg) { ele_arr.add(expr.getArgument(cur).evaluate(message)); cur++; } return (java.util.List) ele_arr; } }
public Object evaluate(MessageEvaluationContext message) throws JMSException { Boolean lvalue = (Boolean)right.evaluate(message); if (lvalue == null) { return null; } return lvalue.booleanValue() ? Boolean.FALSE : Boolean.TRUE; }
public Object evaluate(MessageEvaluationContext message) throws JMSException { Object rvalue = right.evaluate(message); if (rvalue == null) { return null; } if (!rvalue.getClass().equals(Boolean.class)) { return Boolean.FALSE; } return ((Boolean)rvalue).booleanValue() ? Boolean.TRUE : Boolean.FALSE; }