Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 16 19 package org.apache.xpath.objects; 20 21 26 public class XBoolean extends XObject 27 { 28 29 33 public static XBoolean S_TRUE = new XBooleanStatic(true); 34 35 39 public static XBoolean S_FALSE = new XBooleanStatic(false); 40 41 43 boolean m_val; 44 45 50 public XBoolean(boolean b) 51 { 52 53 super(); 54 55 m_val = b; 56 } 57 58 63 public XBoolean(Boolean b) 64 { 65 66 super(); 67 68 m_val = b.booleanValue(); 69 m_obj = b; 70 } 71 72 73 78 public int getType() 79 { 80 return CLASS_BOOLEAN; 81 } 82 83 89 public String getTypeString() 90 { 91 return "#BOOLEAN"; 92 } 93 94 99 public double num() 100 { 101 return m_val ? 1.0 : 0.0; 102 } 103 104 109 public boolean bool() 110 { 111 return m_val; 112 } 113 114 119 public String str() 120 { 121 return m_val ? "true" : "false"; 122 } 123 124 130 public Object object() 131 { 132 if(null == m_obj) 133 m_obj = new Boolean (m_val); 134 return m_obj; 135 } 136 137 146 public boolean equals(XObject obj2) 147 { 148 149 if (obj2.getType() == XObject.CLASS_NODESET) 153 return obj2.equals(this); 154 155 try 156 { 157 return m_val == obj2.bool(); 158 } 159 catch(javax.xml.transform.TransformerException te) 160 { 161 throw new org.apache.xml.utils.WrappedRuntimeException(te); 162 } 163 } 164 165 } 166
| Popular Tags
|