/** * Tell if two objects are functionally equal. * * @param obj2 Object to compare this to * * @return True if the given object is of type CLASS_NULL */ public boolean equals(XObject obj2) { return obj2.getType() == CLASS_NULL; } }
/** * Tell if two objects are functionally equal. * * @param obj2 Object to compare this to * * @return True if the given object is of type CLASS_NULL */ public boolean equals(XObject obj2) { return obj2.getType() == CLASS_NULL; } }
/** * Apply the operation to two operands, and return the result. * * * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject right) throws javax.xml.transform.TransformerException { if (XObject.CLASS_BOOLEAN == right.getType()) return right; else return right.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE; }
/** * Apply the operation to two operands, and return the result. * * * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject right) throws javax.xml.transform.TransformerException { if (XObject.CLASS_BOOLEAN == right.getType()) return right; else return right.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE; }
/** * Get a global variable or parameter from the global stack frame. * * * @param xctxt The XPath context, which must be passed in order to * lazy evaluate variables. * * @param index Global variable index relative to the global stack * frame bottom. * * @return The value of the variable. * * @throws TransformerException */ public XObject getGlobalVariable(XPathContext xctxt, final int index) throws TransformerException { XObject val = _stackFrames[index]; // Lazy execution of variables. if (val.getType() == XObject.CLASS_UNRESOLVEDVARIABLE) return (_stackFrames[index] = val.execute(xctxt)); return val; }
/** * Apply the operation to two operands, and return the result. * * * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject right) throws javax.xml.transform.TransformerException { if (XObject.CLASS_NUMBER == right.getType()) return right; else return new XNumber(right.num()); }
/** * Apply the operation to two operands, and return the result. * * * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject right) throws javax.xml.transform.TransformerException { if (XObject.CLASS_NUMBER == right.getType()) return right; else return new XNumber(right.num()); }
/** * Tell if two objects are functionally not equal. * * @param obj2 Object to compare this to * * @return True if this object is not equal to the given object * * @throws javax.xml.transform.TransformerException */ public boolean notEquals(XObject obj2) 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.notEquals(this); return !equals(obj2); }
/** * Tell if two objects are functionally not equal. * * @param obj2 Object to compare this to * * @return True if this object is not equal to the given object * * @throws javax.xml.transform.TransformerException */ public boolean notEquals(XObject obj2) 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.notEquals(this); return !equals(obj2); }
/** * Get a global variable or parameter from the global stack frame. * * * @param xctxt The XPath context, which must be passed in order to * lazy evaluate variables. * * @param index Global variable index relative to the global stack * frame bottom. * * @return The value of the variable. * * @throws TransformerException */ public XObject getGlobalVariable(XPathContext xctxt, final int index, boolean destructiveOK) throws TransformerException { XObject val = _stackFrames[index]; // Lazy execution of variables. if (val.getType() == XObject.CLASS_UNRESOLVEDVARIABLE) return (_stackFrames[index] = val.execute(xctxt)); return destructiveOK ? val : val.getFresh(); }
/** * Tell if one object is less than the other. * * @param obj2 Object to compare this to * * @return True if this object is less than the given object * * @throws javax.xml.transform.TransformerException */ public boolean lessThan(XObject obj2) throws javax.xml.transform.TransformerException { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. Because the arguments // are backwards, we call the opposite comparison // function. if (obj2.getType() == XObject.CLASS_NODESET) return obj2.greaterThan(this); return this.num() < obj2.num(); }
/** * Tell if one object is less than or equal to the other. * * @param obj2 Object to compare this to * * @return True if this object is less than or equal to the given object * * @throws javax.xml.transform.TransformerException */ public boolean lessThanOrEqual(XObject obj2) throws javax.xml.transform.TransformerException { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. Because the arguments // are backwards, we call the opposite comparison // function. if (obj2.getType() == XObject.CLASS_NODESET) return obj2.greaterThanOrEqual(this); return this.num() <= obj2.num(); }
/** * Tell if one object is greater than the other. * * @param obj2 Object to compare this to * * @return True if this object is greater than the given object * * @throws javax.xml.transform.TransformerException */ public boolean greaterThan(XObject obj2) throws javax.xml.transform.TransformerException { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. Because the arguments // are backwards, we call the opposite comparison // function. if (obj2.getType() == XObject.CLASS_NODESET) return obj2.lessThan(this); return this.num() > obj2.num(); }
/** * Tell if one object is greater than or equal to the other. * * @param obj2 Object to compare this to * * @return True if this object is greater than or equal to the given object * * @throws javax.xml.transform.TransformerException */ public boolean greaterThanOrEqual(XObject obj2) throws javax.xml.transform.TransformerException { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. Because the arguments // are backwards, we call the opposite comparison // function. if (obj2.getType() == XObject.CLASS_NODESET) return obj2.lessThanOrEqual(this); return this.num() >= obj2.num(); }
/** * Tell if one object is greater than the other. * * @param obj2 Object to compare this to * * @return True if this object is greater than the given object * * @throws javax.xml.transform.TransformerException */ public boolean greaterThan(XObject obj2) throws javax.xml.transform.TransformerException { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. Because the arguments // are backwards, we call the opposite comparison // function. if (obj2.getType() == XObject.CLASS_NODESET) return obj2.lessThan(this); return this.num() > obj2.num(); }
/** * Tell if one object is less than or equal to the other. * * @param obj2 Object to compare this to * * @return True if this object is less than or equal to the given object * * @throws javax.xml.transform.TransformerException */ public boolean lessThanOrEqual(XObject obj2) throws javax.xml.transform.TransformerException { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. Because the arguments // are backwards, we call the opposite comparison // function. if (obj2.getType() == XObject.CLASS_NODESET) return obj2.greaterThanOrEqual(this); return this.num() <= obj2.num(); }
/** * Tell if one object is less than the other. * * @param obj2 Object to compare this to * * @return True if this object is less than the given object * * @throws javax.xml.transform.TransformerException */ public boolean lessThan(XObject obj2) throws javax.xml.transform.TransformerException { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. Because the arguments // are backwards, we call the opposite comparison // function. if (obj2.getType() == XObject.CLASS_NODESET) return obj2.greaterThan(this); return this.num() < obj2.num(); }
/** * Tell if one object is greater than or equal to the other. * * @param obj2 Object to compare this to * * @return True if this object is greater than or equal to the given object * * @throws javax.xml.transform.TransformerException */ public boolean greaterThanOrEqual(XObject obj2) throws javax.xml.transform.TransformerException { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. Because the arguments // are backwards, we call the opposite comparison // function. if (obj2.getType() == XObject.CLASS_NODESET) return obj2.lessThanOrEqual(this); return this.num() >= obj2.num(); }
/** * For support of literal objects in xpaths. * * @param xctxt The XPath execution context. * * @return the result of executing the select expression * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject m_selected; m_selected = ((Expression)m_obj).execute(xctxt); m_selected.allowDetachToRelease(m_allowRelease); if (m_selected.getType() == CLASS_STRING) return m_selected; else return new XString(m_selected.str()); }
/** * For support of literal objects in xpaths. * * @param xctxt The XPath execution context. * * @return the result of executing the select expression * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject m_selected; m_selected = ((Expression)m_obj).execute(xctxt); m_selected.allowDetachToRelease(m_allowRelease); if (m_selected.getType() == CLASS_STRING) return m_selected; else return new XString(m_selected.str()); }