jd.xml.xpath.expr.function
Class FunctionType

java.lang.Object
  extended byjd.xml.xpath.expr.function.FunctionType
Direct Known Subclasses:
NodeFunctionType, XsltFunctionType

public class FunctionType
extends Object

FunctionType provides meta-information about a Function.


Field Summary
 int maxArgumentCount
           
 int minArgumentCount
           
 String name
           
 
Constructor Summary
FunctionType(String name)
          Create a FunctionType with no arguments.
FunctionType(String name, int argumentCount)
          Create a FunctionType with a fixed number of arguments.
FunctionType(String name, int minArgumentCount, int maxArgumentCount)
          Create a FunctionType with a variable number of arguments.
 
Method Summary
 boolean checkArgumentCount(int count)
          Check if the given array of arguments fullfills the requirements for the number of arguments.
 Function copyFunction(Function function)
          Create a copy of the function.
 int getContextDependencies(Expression[] arguments)
          Return a bitfield indicating the dependencies of the function arguments.
 boolean isFunctionInstance(Expression expr)
          Return if the given Expression is an instance of the function represented by this type.
 Expression[] normArguments(Expression[] arguments)
          Check and norm the arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public final String name

minArgumentCount

public final int minArgumentCount

maxArgumentCount

public final int maxArgumentCount
Constructor Detail

FunctionType

public FunctionType(String name)
Create a FunctionType with no arguments.


FunctionType

public FunctionType(String name,
                    int argumentCount)
Create a FunctionType with a fixed number of arguments.


FunctionType

public FunctionType(String name,
                    int minArgumentCount,
                    int maxArgumentCount)
Create a FunctionType with a variable number of arguments.

Method Detail

checkArgumentCount

public boolean checkArgumentCount(int count)
Check if the given array of arguments fullfills the requirements for the number of arguments.

Returns:
true if the argument number is ok
Throws:
XPathException - if the argument count does not match the requirements

normArguments

public Expression[] normArguments(Expression[] arguments)
Check and norm the arguments.

Returns:
a non null array

getContextDependencies

public int getContextDependencies(Expression[] arguments)
Return a bitfield indicating the dependencies of the function arguments.


isFunctionInstance

public boolean isFunctionInstance(Expression expr)
Return if the given Expression is an instance of the function represented by this type.


copyFunction

public Function copyFunction(Function function)
                      throws InstantiationException,
                             ClassNotFoundException,
                             IllegalAccessException
Create a copy of the function.

Throws:
InstantiationException
ClassNotFoundException
IllegalAccessException