FileDocCategorySizeDatePackage
FunctionPattern.javaAPI DocJava SE 6 API6900Tue Jun 10 00:23:16 BST 2008com.sun.org.apache.xpath.internal.patterns

FunctionPattern

public class FunctionPattern extends StepPattern
Match pattern step that contains a function.
xsl.usage
advanced

Fields Summary
static final long
serialVersionUID
Expression
m_functionExpr
Should be a {@link com.sun.org.apache.xpath.internal.functions.Function expression}.
Constructors Summary
public FunctionPattern(Expression expr, int axis, int predaxis)
Construct a FunctionPattern from a {@link com.sun.org.apache.xpath.internal.functions.Function expression}. NEEDSDOC @param expr


                
        
  

    super(0, null, null, axis, predaxis);

    m_functionExpr = expr;
  
Methods Summary
public final voidcalcScore()
Static calc of match score.


    m_score = SCORE_OTHER;

    if (null == m_targetString)
      calcTargetString();
  
protected voidcallSubtreeVisitors(com.sun.org.apache.xpath.internal.XPathVisitor visitor)
Call the visitor for the function.

    m_functionExpr.callVisitors(new FunctionOwner(), visitor);
    super.callSubtreeVisitors(visitor);
  
public com.sun.org.apache.xpath.internal.objects.XObjectexecute(com.sun.org.apache.xpath.internal.XPathContext xctxt, int context)
Test a node to see if it matches the given node test.

param
xctxt XPath runtime context.
return
{@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NODETEST}, {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NONE}, {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NSWILD}, {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_QNAME}, or {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_OTHER}.
throws
javax.xml.transform.TransformerException


    DTMIterator nl = m_functionExpr.asIterator(xctxt, context);
    XNumber score = SCORE_NONE;

    if (null != nl)
    {
      int n;

      while (DTM.NULL != (n = nl.nextNode()))
      {
        score = (n == context) ? SCORE_OTHER : SCORE_NONE;

        if (score == SCORE_OTHER)
        {
          context = n;

          break;
        }
      }

      // nl.detach();
    }
    nl.detach();

    return score;
  
public com.sun.org.apache.xpath.internal.objects.XObjectexecute(com.sun.org.apache.xpath.internal.XPathContext xctxt, int context, com.sun.org.apache.xml.internal.dtm.DTM dtm, int expType)
Test a node to see if it matches the given node test.

param
xctxt XPath runtime context.
return
{@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NODETEST}, {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NONE}, {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NSWILD}, {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_QNAME}, or {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_OTHER}.
throws
javax.xml.transform.TransformerException


    DTMIterator nl = m_functionExpr.asIterator(xctxt, context);
    XNumber score = SCORE_NONE;

    if (null != nl)
    {
      int n;

      while (DTM.NULL != (n = nl.nextNode()))
      {
        score = (n == context) ? SCORE_OTHER : SCORE_NONE;

        if (score == SCORE_OTHER)
        {
          context = n;

          break;
        }
      }

      nl.detach();
    }

    return score;
  
public com.sun.org.apache.xpath.internal.objects.XObjectexecute(com.sun.org.apache.xpath.internal.XPathContext xctxt)
Test a node to see if it matches the given node test.

param
xctxt XPath runtime context.
return
{@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NODETEST}, {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NONE}, {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NSWILD}, {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_QNAME}, or {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_OTHER}.
throws
javax.xml.transform.TransformerException


    int context = xctxt.getCurrentNode();
    DTMIterator nl = m_functionExpr.asIterator(xctxt, context);
    XNumber score = SCORE_NONE;

    if (null != nl)
    {
      int n;

      while (DTM.NULL != (n = nl.nextNode()))
      {
        score = (n == context) ? SCORE_OTHER : SCORE_NONE;

        if (score == SCORE_OTHER)
        {
          context = n;

          break;
        }
      }

      nl.detach();
    }

    return score;
  
public voidfixupVariables(java.util.Vector vars, int globalsSize)
This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time.

param
vars List of QNames that correspond to variables. This list should be searched backwards for the first qualified name that corresponds to the variable reference qname. The position of the QName in the vector from the start of the vector will be its position in the stack frame (but variables above the globalsTop value will need to be offset to the current stack frame).

    super.fixupVariables(vars, globalsSize);
    m_functionExpr.fixupVariables(vars, globalsSize);