Class CoreFunction
java.lang.Object
org.apache.commons.jxpath.ri.compiler.Expression
org.apache.commons.jxpath.ri.compiler.Operation
org.apache.commons.jxpath.ri.compiler.CoreFunction
An element of the compile tree representing one of built-in functions
like "position()" or "number()".
- Version:
- $Revision: 668329 $ $Date: 2008-06-16 16:59:48 -0500 (Mon, 16 Jun 2008) $
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.commons.jxpath.ri.compiler.Expression
Expression.PointerIterator, Expression.ValueIterator
-
Field Summary
FieldsFields inherited from class org.apache.commons.jxpath.ri.compiler.Expression
NOT_A_NUMBER, ONE
-
Constructor Summary
ConstructorsConstructorDescriptionCoreFunction
(int functionCode, Expression[] args) Create a new CoreFunction. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
assertArgCount
(int count) Assertcount
args.private void
assertArgRange
(int min, int max) Assert at leastmin
/at mostmax
args.compute
(EvalContext context) Evaluates the expression.boolean
Returns true if any argument is context dependent or if the function is last(), position(), boolean(), local-name(), name(), string(), lang(), number().computeValue
(EvalContext context) Evaluates the expression.protected Object
functionBoolean
(EvalContext context) boolean() implementation.protected Object
functionCeiling
(EvalContext context) ceiling() implementation.protected Object
functionConcat
(EvalContext context) concat() implementation.protected Object
functionContains
(EvalContext context) contains() implementation.protected Object
functionCount
(EvalContext context) count() implementation.protected Object
functionFalse
(EvalContext context) false() implementation.protected Object
functionFloor
(EvalContext context) floor() implementation.private Object
functionFormatNumber
(EvalContext context) format-number() implementation.protected Object
functionID
(EvalContext context) id() implementation.protected Object
functionKey
(EvalContext context) key() implementation.protected Object
functionLang
(EvalContext context) lang() implementation.protected Object
functionLast
(EvalContext context) last() implementation.protected Object
functionLocalName
(EvalContext context) local-name() implementation.protected Object
functionName
(EvalContext context) name() implementation.protected Object
functionNamespaceURI
(EvalContext context) namespace-uri() implementation.protected Object
functionNormalizeSpace
(EvalContext context) normalize-space() implementation.protected Object
functionNot
(EvalContext context) not() implementation.protected Object
functionNull
(EvalContext context) null() implementation.protected Object
functionNumber
(EvalContext context) number() implementation.protected Object
functionPosition
(EvalContext context) position() implementation.protected Object
functionRound
(EvalContext context) round() implementation.protected Object
functionStartsWith
(EvalContext context) starts-with() implementation.protected Object
functionString
(EvalContext context) string() implementation.protected Object
functionStringLength
(EvalContext context) string-length() implementation.protected Object
functionSubstring
(EvalContext context) substring() implementation.protected Object
functionSubstringAfter
(EvalContext context) substring-after() implementation.protected Object
functionSubstringBefore
(EvalContext context) substring-before() implementation.protected Object
functionSum
(EvalContext context) sum() implementation.protected Object
functionTranslate
(EvalContext context) translate() implementation.protected Object
functionTrue
(EvalContext context) true() implementation.getArg1()
Convenience method to return the first argument.getArg2()
Convenience method to return the second argument.getArg3()
Convenience method to return the third argument.int
Return the number of argument Expressions.int
Get the function code.protected String
Get the name of this function.toString()
Methods inherited from class org.apache.commons.jxpath.ri.compiler.Operation
getArguments
Methods inherited from class org.apache.commons.jxpath.ri.compiler.Expression
isContextDependent, iterate, iteratePointers
-
Field Details
-
ZERO
-
functionCode
private int functionCode
-
-
Constructor Details
-
CoreFunction
Create a new CoreFunction.- Parameters:
functionCode
- int function codeargs
- argument Expressions
-
-
Method Details
-
getFunctionCode
public int getFunctionCode()Get the function code.- Returns:
- int function code
-
getFunctionName
Get the name of this function.- Returns:
- String function name
-
getArg1
Convenience method to return the first argument.- Returns:
- Expression
-
getArg2
Convenience method to return the second argument.- Returns:
- Expression
-
getArg3
Convenience method to return the third argument.- Returns:
- Expression
-
getArgumentCount
public int getArgumentCount()Return the number of argument Expressions.- Returns:
- int count
-
computeContextDependent
public boolean computeContextDependent()Returns true if any argument is context dependent or if the function is last(), position(), boolean(), local-name(), name(), string(), lang(), number().- Overrides:
computeContextDependent
in classOperation
- Returns:
- boolean
-
toString
-
compute
Description copied from class:Expression
Evaluates the expression. If the result is a node set, returns the first element of the node set.- Specified by:
compute
in classExpression
- Parameters:
context
- evaluation context- Returns:
- Object
-
computeValue
Description copied from class:Expression
Evaluates the expression. If the result is a node set, returns the first element of the node set.- Specified by:
computeValue
in classExpression
- Parameters:
context
- evaluation context- Returns:
- Object
-
functionLast
last() implementation.- Parameters:
context
- evaluation context- Returns:
- Number
-
functionPosition
position() implementation.- Parameters:
context
- evaluation context- Returns:
- Number
-
functionCount
count() implementation.- Parameters:
context
- evaluation context- Returns:
- Number
-
functionLang
lang() implementation.- Parameters:
context
- evaluation context- Returns:
- Boolean
-
functionID
id() implementation.- Parameters:
context
- evaluation context- Returns:
- Pointer
-
functionKey
key() implementation.- Parameters:
context
- evaluation context- Returns:
- various Object
-
functionNamespaceURI
namespace-uri() implementation.- Parameters:
context
- evaluation context- Returns:
- String
-
functionLocalName
local-name() implementation.- Parameters:
context
- evaluation context- Returns:
- String
-
functionName
name() implementation.- Parameters:
context
- evaluation context- Returns:
- String
-
functionString
string() implementation.- Parameters:
context
- evaluation context- Returns:
- String
-
functionConcat
concat() implementation.- Parameters:
context
- evaluation context- Returns:
- String
-
functionStartsWith
starts-with() implementation.- Parameters:
context
- evaluation context- Returns:
- Boolean
-
functionContains
contains() implementation.- Parameters:
context
- evaluation context- Returns:
- Boolean
-
functionSubstringBefore
substring-before() implementation.- Parameters:
context
- evaluation context- Returns:
- String
-
functionSubstringAfter
substring-after() implementation.- Parameters:
context
- evaluation context- Returns:
- String
-
functionSubstring
substring() implementation.- Parameters:
context
- evaluation context- Returns:
- String
-
functionStringLength
string-length() implementation.- Parameters:
context
- evaluation context- Returns:
- Number
-
functionNormalizeSpace
normalize-space() implementation.- Parameters:
context
- evaluation context- Returns:
- String
-
functionTranslate
translate() implementation.- Parameters:
context
- evaluation context- Returns:
- String
-
functionBoolean
boolean() implementation.- Parameters:
context
- evaluation context- Returns:
- Boolean
-
functionNot
not() implementation.- Parameters:
context
- evaluation context- Returns:
- Boolean
-
functionTrue
true() implementation.- Parameters:
context
- evaluation context- Returns:
- Boolean.TRUE
-
functionFalse
false() implementation.- Parameters:
context
- evaluation context- Returns:
- Boolean.FALSE
-
functionNull
null() implementation.- Parameters:
context
- evaluation context- Returns:
- null
-
functionNumber
number() implementation.- Parameters:
context
- evaluation context- Returns:
- Number
-
functionSum
sum() implementation.- Parameters:
context
- evaluation context- Returns:
- Number
-
functionFloor
floor() implementation.- Parameters:
context
- evaluation context- Returns:
- Number
-
functionCeiling
ceiling() implementation.- Parameters:
context
- evaluation context- Returns:
- Number
-
functionRound
round() implementation.- Parameters:
context
- evaluation context- Returns:
- Number
-
functionFormatNumber
format-number() implementation.- Parameters:
context
- evaluation context- Returns:
- String
-
assertArgCount
private void assertArgCount(int count) Assertcount
args.- Parameters:
count
- int
-
assertArgRange
private void assertArgRange(int min, int max) Assert at leastmin
/at mostmax
args.- Parameters:
min
- intmax
- int
-