FileDocCategorySizeDatePackage
XBoolean.javaAPI DocJava SE 6 API3589Tue Jun 10 00:23:16 BST 2008com.sun.org.apache.xpath.internal.objects

XBoolean

public class XBoolean extends XObject
This class represents an XPath boolean object, and is capable of converting the boolean to other types, such as a string.
xsl.usage
advanced

Fields Summary
static final long
serialVersionUID
public static final XBoolean
S_TRUE
A true boolean object so we don't have to keep creating them.
public static final XBoolean
S_FALSE
A true boolean object so we don't have to keep creating them.
private final boolean
m_val
Value of the object.
Constructors Summary
public XBoolean(boolean b)
Construct a XBoolean object.

param
b Value of the boolean object


                
    
  

    super();

    m_val = b;
  
public XBoolean(Boolean b)
Construct a XBoolean object.

param
b Value of the boolean object


    super();

    m_val = b.booleanValue();
    m_obj = b;
  
Methods Summary
public booleanbool()
Cast result object to a boolean.

return
The object value as a boolean

    return m_val;
  
public booleanequals(com.sun.org.apache.xpath.internal.objects.XObject obj2)
Tell if two objects are functionally equal.

param
obj2 Object to compare to this
return
True if the two objects are equal
throws
javax.xml.transform.TransformerException


    // In order to handle the 'all' semantics of 
    // nodeset comparisons, we always call the 
    // nodeset function.
    if (obj2.getType() == XObject.CLASS_NODESET)
      return obj2.equals(this);

    try
    {
      return m_val == obj2.bool();
    }
    catch(javax.xml.transform.TransformerException te)
    {
      throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(te);
    }
  
public intgetType()
Tell that this is a CLASS_BOOLEAN.

return
type of CLASS_BOOLEAN

    return CLASS_BOOLEAN;
  
public java.lang.StringgetTypeString()
Given a request type, return the equivalent string. For diagnostic purposes.

return
type string "#BOOLEAN"

    return "#BOOLEAN";
  
public doublenum()
Cast result object to a number.

return
numeric value of the object value

    return m_val ? 1.0 : 0.0;
  
public java.lang.Objectobject()
Return a java object that's closest to the representation that should be handed to an extension.

return
The object's value as a java object

    if(null == m_obj)
      m_obj = new Boolean(m_val);
    return m_obj;
  
public java.lang.Stringstr()
Cast result object to a string.

return
The object's value as a string

    return m_val ? "true" : "false";