1 46 package org.mr.api.jms.selector.syntax; 47 48 49 53 class MantaBoolean extends MantaObject { 54 55 58 public static final MantaBoolean TRUE = new MantaBoolean(Boolean.TRUE); 59 60 63 public static final MantaBoolean FALSE = new MantaBoolean(Boolean.FALSE); 64 65 68 private Boolean value; 69 70 71 76 public MantaBoolean(final Boolean value) { 77 this.value = value; 78 } 80 81 86 public final Object getObject() { 87 return value; 88 } 90 91 96 public final boolean value() { 97 return value.booleanValue(); 98 } 100 101 108 public final MantaBoolean and(final MantaBoolean rightHand) { 109 MantaBoolean result = null; 110 if (rightHand != null) { 111 112 if (value() && rightHand.value()) { 113 result = MantaBoolean.TRUE; 114 } else { 116 result = MantaBoolean.FALSE; 117 } } else if (!value()) { 120 result = MantaBoolean.FALSE; 121 } return result; 123 } 125 126 133 public final MantaBoolean or(final MantaBoolean rightHand) { 134 MantaBoolean result = null; 135 if (value()) { 136 result = MantaBoolean.TRUE; 137 } else { 139 result = rightHand; 140 } return result; 142 } 144 145 150 public final MantaBoolean not() { 151 MantaBoolean result = MantaBoolean.TRUE; 152 if (value()) { 153 result = MantaBoolean.FALSE; 154 } return result; 156 } 158 163 public final Type type() { 164 return Type.BOOLEAN; 165 }} | Popular Tags |