jd.xml.xpath.expr
Class ExpressionImpl

java.lang.Object
  extended byjd.xml.xpath.expr.ExpressionImpl
All Implemented Interfaces:
Expression
Direct Known Subclasses:
BooleanExpression, NodeSetExpression, NumericExpression, ProxyExpression, StringExpression, VariableExpression

public abstract class ExpressionImpl
extends Object
implements Expression

ExpressionImpl provides a reasonable default implementation of many expression methods.


Field Summary
 
Fields inherited from interface jd.xml.xpath.expr.Expression
DEP_CONTEXT_NODE, DEP_CONTEXT_POSITION, DEP_CONTEXT_SIZE, DEP_CONTEXT_STATIC, DEP_NONE, DEP_UNKNOWN
 
Constructor Summary
ExpressionImpl()
           
 
Method Summary
 boolean hasContextDependencies(int dependencies)
          Test if the expression has special dependecies.
 boolean isUniqueFilter()
          Test if this expression only matches one node when used as a predicate filter for a node-set.
 boolean matchesFilter(XPathContext context)
          Evaluate the expression and return if the context node matches the expression when used as predicate filter.
 XPathNode toNode(XPathContext context)
          Evaluate the Expression to a XPathNode.
 XNodeSet toNodeSet(XPathContext context, int ordering)
          Evaluate the Expression to a XObject and convert to a XNodeSet.
 String toString()
          Return a string representation of the expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jd.xml.xpath.expr.Expression
accept, getContextDependencies, getResultType, toBooleanValue, toNumberValue, toStringValue, toXObject
 

Constructor Detail

ExpressionImpl

public ExpressionImpl()
Method Detail

toNodeSet

public XNodeSet toNodeSet(XPathContext context,
                          int ordering)
Evaluate the Expression to a XObject and convert to a XNodeSet.

Specified by:
toNodeSet in interface Expression
Parameters:
context - the evaluation context
ordering - the ordering which the returned node-set must have

toNode

public XPathNode toNode(XPathContext context)
Evaluate the Expression to a XPathNode.

Specified by:
toNode in interface Expression
Parameters:
context - the evaluation context

matchesFilter

public boolean matchesFilter(XPathContext context)
Evaluate the expression and return if the context node matches the expression when used as predicate filter.

Specified by:
matchesFilter in interface Expression

isUniqueFilter

public boolean isUniqueFilter()
Test if this expression only matches one node when used as a predicate filter for a node-set. The default implementation returns true if the result type is NUMBER.

Specified by:
isUniqueFilter in interface Expression

hasContextDependencies

public boolean hasContextDependencies(int dependencies)
Test if the expression has special dependecies.

Specified by:
hasContextDependencies in interface Expression
Parameters:
dependencies - the dependency constants merge together with bitwise or

toString

public String toString()
Return a string representation of the expression.

Specified by:
toString in interface Expression