public abstract class Expression extends Object implements ExpressionNode, XPathVisitable
XObject, normally has a location within a document
or DOM, can send error and warning events, and normally do not hold state and are meant to be
immutable once construction has completed. An exception to the immutibility rule is iterators and
walkers, which must be cloned in order to be used -- the original must still be immutable.| Constructor and Description |
|---|
Expression() |
| Modifier and Type | Method and Description |
|---|---|
DTMIterator |
asIterator(XPathContext xctxt,
int contextNode)
Given an select expression and a context, evaluate the XPath and return the resulting iterator.
|
int |
asNode(XPathContext xctxt)
Return the first node out of the nodeset, if this expression is a nodeset expression.
|
void |
assertion(boolean b,
String msg)
Tell the user of an assertion error, and probably throw an exception.
|
boolean |
bool(XPathContext xctxt)
Evaluate expression to a boolean.
|
boolean |
canTraverseOutsideSubtree()
Tell if this expression or it's subexpressions can traverse outside the current subtree.
|
abstract boolean |
deepEquals(Expression expr)
Compare this object with another object and see if they are equal, include the sub heararchy.
|
void |
error(XPathContext xctxt,
String msg,
Object[] args)
Tell the user of an error, and probably throw an exception.
|
abstract XObject |
execute(XPathContext xctxt)
Execute an expression in the XPath runtime context, and return the result of the expression.
|
XObject |
execute(XPathContext xctxt,
boolean destructiveOK)
Execute an expression in the XPath runtime context, and return the result of the expression,
but tell that a "safe" object doesn't have to be returned.
|
XObject |
execute(XPathContext xctxt,
int currentNode)
Execute an expression in the XPath runtime context, and return the result of the expression.
|
XObject |
execute(XPathContext xctxt,
int currentNode,
DTM dtm,
int expType)
Execute an expression in the XPath runtime context, and return the result of the expression.
|
ExpressionNode |
exprGetParent() |
void |
exprSetParent(ExpressionNode n)
This pair of methods are used to inform the node of its parent.
|
int |
getColumnNumber() |
ExpressionNode |
getExpressionOwner()
Get the first non-Expression parent of this node.
|
int |
getLineNumber() |
String |
getPublicId() |
String |
getSystemId() |
protected boolean |
isSameClass(Expression expr)
This is a utility method to tell if the passed in class is the same class as this.
|
boolean |
isStableNumber()
Tell if this expression returns a stable number that will not change during iterations within
the expression.
|
double |
num(XPathContext xctxt)
Evaluate expression to a number.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcallVisitorspublic boolean canTraverseOutsideSubtree()
public XObject execute(XPathContext xctxt, int currentNode) throws TransformerException
xctxt - The XPath runtime context.currentNode - The currentNode.XObject.TransformerException - if a runtime exception occurs.public XObject execute(XPathContext xctxt, int currentNode, DTM dtm, int expType) throws TransformerException
xctxt - The XPath runtime context.currentNode - The currentNode.dtm - The DTM of the current node.expType - The expanded type ID of the current node.XObject.TransformerException - if a runtime exception occurs.public abstract XObject execute(XPathContext xctxt) throws TransformerException
xctxt - The XPath runtime context.XObject.TransformerException - if a runtime exception occurs.public XObject execute(XPathContext xctxt, boolean destructiveOK) throws TransformerException
xctxt - The XPath runtime context.destructiveOK - true if a "safe" object doesn't need to be returned.XObject.TransformerException - if a runtime exception occurs.public double num(XPathContext xctxt) throws TransformerException
xctxt - The XPath runtime context.TransformerException - if anypublic boolean bool(XPathContext xctxt) throws TransformerException
xctxt - The XPath runtime context.TransformerException - if anypublic int asNode(XPathContext xctxt) throws TransformerException
xctxt - The XPath runtime context.TransformerException - if anypublic DTMIterator asIterator(XPathContext xctxt, int contextNode) throws TransformerException
xctxt - The execution context.contextNode - The node that "." expresses.TransformerException - thrown if the active ProblemListener decides the error condition
is severe enough to halt processing.TransformerException - if anypublic boolean isStableNumber()
public abstract boolean deepEquals(Expression expr)
expr - Another expression object.protected final boolean isSameClass(Expression expr)
public void assertion(boolean b,
String msg)
b - If false, a runtime exception will be thrown.msg - The assertion message, which should be informative.RuntimeException - if the b argument is false.public void error(XPathContext xctxt, String msg, Object[] args) throws TransformerException
xctxt - The XPath runtime context.msg - An error msgkey that corresponds to one of the constants found in XPATHErrorResources, which is a key for a format string.args - An array of arguments represented in the format string, which may be null.TransformerException - if the current ErrorListoner determines to throw an exception.TransformerException - if anypublic ExpressionNode getExpressionOwner()
public void exprSetParent(ExpressionNode n)
exprSetParent in interface ExpressionNodepublic ExpressionNode exprGetParent()
exprGetParent in interface ExpressionNodepublic String getPublicId()
getPublicId in interface SourceLocatorpublic String getSystemId()
getSystemId in interface SourceLocatorpublic int getLineNumber()
getLineNumber in interface SourceLocatorpublic int getColumnNumber()
getColumnNumber in interface SourceLocatorCopyright © 2022–2024 HtmlUnit. All rights reserved.