FileDocCategorySizeDatePackage
Function2Args.javaAPI DocJava SE 6 API5053Tue Jun 10 00:23:16 BST 2008com.sun.org.apache.xpath.internal.functions

Function2Args

public class Function2Args extends FunctionOneArg
Base class for functions that accept two arguments.
xsl.usage
advanced

Fields Summary
static final long
serialVersionUID
Expression
m_arg1
The second argument passed to the function (at index 1).
Constructors Summary
Methods Summary
public voidcallArgVisitors(com.sun.org.apache.xpath.internal.XPathVisitor visitor)

see
com.sun.org.apache.xpath.internal.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor)

  	super.callArgVisitors(visitor);
  	if(null != m_arg1)
  		m_arg1.callVisitors(new Arg1Owner(), visitor);
  
public booleancanTraverseOutsideSubtree()
Tell if this expression or it's subexpressions can traverse outside the current subtree.

return
true if traversal outside the context node's subtree can occur.

    return super.canTraverseOutsideSubtree() 
    ? true : m_arg1.canTraverseOutsideSubtree();
   
public voidcheckNumberArgs(int argNum)
Check that the number of arguments passed to this function is correct.

param
argNum The number of arguments that is being passed to the function.
throws
WrongNumberArgsException

    if (argNum != 2)
      reportWrongNumberArgs();
  
public booleandeepEquals(com.sun.org.apache.xpath.internal.Expression expr)

see
Expression#deepEquals(Expression)

  	if(!super.deepEquals(expr))
  		return false;
  		
  	if(null != m_arg1)
  	{
  		if(null == ((Function2Args)expr).m_arg1)
  			return false;
  			
  		if(!m_arg1.deepEquals(((Function2Args)expr).m_arg1))
  			return false;
  	}
  	else if(null != ((Function2Args)expr).m_arg1)
  		return false;
  		
  	return true;
  
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);
    if(null != m_arg1)
      m_arg1.fixupVariables(vars, globalsSize);
  
public com.sun.org.apache.xpath.internal.ExpressiongetArg1()
Return the second argument passed to the function (at index 1).

return
An expression that represents the second argument passed to the function.


                                     
    
  
    return m_arg1;
  
protected voidreportWrongNumberArgs()
Constructs and throws a WrongNumberArgException with the appropriate message for this function object.

throws
WrongNumberArgsException

      throw new WrongNumberArgsException(XSLMessages.createXPATHMessage("two", null));
  
public voidsetArg(com.sun.org.apache.xpath.internal.Expression arg, int argNum)
Set an argument expression for a function. This method is called by the XPath compiler.

param
arg non-null expression that represents the argument.
param
argNum The argument number index.
throws
WrongNumberArgsException If the argNum parameter is greater than 1.


    // System.out.println("argNum: "+argNum);
    if (argNum == 0)
      super.setArg(arg, argNum);
    else if (1 == argNum)
    {
      m_arg1 = arg;
      arg.exprSetParent(this);
    }
    else
		  reportWrongNumberArgs();