| 1 21 package com.presumo.jms.selector; 22 23 28 class JmsBooleanLiteral extends JmsDataType 29 { 30 private static final short JMS_TRUE = 1; 31 private static final short JMS_FALSE = 2; 32 private static final short JMS_UNKNOWN = 3; 33 34 static final JmsBooleanLiteral TRUE = new JmsBooleanLiteral(JMS_TRUE); 35 static final JmsBooleanLiteral FALSE = new JmsBooleanLiteral(JMS_FALSE); 36 static final JmsBooleanLiteral UNKNOWN = new JmsBooleanLiteral(JMS_UNKNOWN); 37 38 private final short type; 39 40 44 48 protected JmsBooleanLiteral(short type) { 49 super(false); this.type = type; 51 52 switch (type) { 55 case (JMS_TRUE): 56 stringRepresentation = "TRUE"; 57 break; 58 case (JMS_FALSE): 59 stringRepresentation = "FALSE"; 60 break; 61 default: 62 stringRepresentation = "UNKNOWN"; 63 } 64 } 65 66 70 JmsBooleanLiteral eq(JmsDataType value) throws SelectorFalseException 71 { 72 if (! (value instanceof JmsBooleanLiteral)) 73 throw SelectorFalseException.getInstance(); 74 75 if (this == UNKNOWN || value == UNKNOWN) 78 return UNKNOWN; 79 if(this == value) 80 return JmsBooleanLiteral.TRUE; 81 else 82 return JmsBooleanLiteral.FALSE; 83 } 84 85 89 short getType() { return JmsOperand.JMS_BOOLEAN_LITERAL; } 90 91 } 92 | Popular Tags |