1 21 package com.presumo.jms.selector; 22 23 import javax.jms.Message ; 24 25 30 final class JmsBinaryOr extends JmsBinaryOperand 31 { 32 static { 33 STRING_REP = " OR "; } 35 36 37 static JmsBinaryOr getInstance(JmsOperand lvalue, JmsOperand rvalue) 41 { 42 JmsBinaryOr retval; 43 44 retval = (JmsBinaryOr) getInstanceReflective(JmsOperand.JMS_BINARY_OR, lvalue, rvalue); 45 if (retval == null) 46 retval = new JmsBinaryOr(lvalue, rvalue); 47 48 return retval; 49 } 50 51 protected JmsBinaryOr(JmsOperand lvalue, JmsOperand rvalue) 55 { 56 super(lvalue, rvalue); 57 } 58 59 63 JmsOperand evaluate(Message msg) throws SelectorFalseException 64 { 65 66 JmsBooleanLiteral leftSide = (JmsBooleanLiteral) lvalue.evaluateOnce(msg); 67 if (leftSide == JmsBooleanLiteral.TRUE) 68 return leftSide; 69 70 JmsBooleanLiteral rightSide = (JmsBooleanLiteral) rvalue.evaluateOnce(msg); 71 72 if (rightSide == JmsBooleanLiteral.TRUE) { 73 JmsOperand temp = lvalue; 76 lvalue = rvalue; 77 rvalue = temp; 78 return rightSide; 79 } 80 return leftSide; 81 } 82 83 short getType() { return JmsOperand.JMS_BINARY_OR; } 84 85 } 86 87 88 89 90 91 | Popular Tags |