1 43 44 package org.exolab.jms.selector; 45 46 47 54 class SBool extends SObject { 55 56 59 public static final SBool TRUE = new SBool(Boolean.TRUE); 60 61 64 public static final SBool FALSE = new SBool(Boolean.FALSE); 65 66 69 private Boolean _value; 70 71 72 77 public SBool(final Boolean value) { 78 _value = value; 79 } 80 81 86 public final Object getObject() { 87 return _value; 88 } 89 90 95 public final boolean value() { 96 return _value.booleanValue(); 97 } 98 99 108 public final SBool and(final SBool rhs) { 109 SBool result = null; 110 if (rhs != null) { 111 if (value() && rhs.value()) { 112 result = SBool.TRUE; 113 } else { 114 result = SBool.FALSE; 115 } 116 } else if (!value()) { 117 result = SBool.FALSE; 118 } 119 120 return result; 121 } 122 123 130 public final SBool or(final SBool rhs) { 131 SBool result = null; 132 if (value()) { 133 result = SBool.TRUE; 134 } else { 135 result = rhs; 136 } 137 return result; 138 } 139 140 146 public final SBool not() { 147 SBool result = SBool.TRUE; 148 if (value()) { 149 result = SBool.FALSE; 150 } 151 return result; 152 } 153 154 159 public final Type type() { 160 return Type.BOOLEAN; 161 } 162 163 } | Popular Tags |