Package net.sf.saxon.expr.accum
Class AccumulatorRule
- java.lang.Object
-
- net.sf.saxon.expr.accum.AccumulatorRule
-
- All Implemented Interfaces:
Locatable
,Traceable
,TraceableComponent
,RuleTarget
public class AccumulatorRule extends Object implements RuleTarget, TraceableComponent
This class represents one of the rules making up the definition of an accumulator
-
-
Constructor Summary
Constructors Constructor Description AccumulatorRule(Expression newValueExpression, SlotManager stackFrameMap, boolean postDescent)
Create a rule
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
export(ExpressionPresenter out)
Output diagnostic explanation to an ExpressionPresentervoid
gatherProperties(BiConsumer<String,Object> consumer)
Get the properties of this object to be included in trace messages, by supplying the property values to a supplied consumer functionExpression
getBody()
Get the expression at the root of the expression tree used to evaluate this constructLocation
getLocation()
Get the location of the constructExpression
getNewValueExpression()
StructuredQName
getObjectName()
Get a name identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc.SlotManager
getStackFrameMap()
String
getTracingTag()
Get a string to identify the type of componentboolean
isCapturing()
boolean
isPostDescent()
void
registerRule(Rule rule)
Register a rule for which this is the targetvoid
setAccumulatorName(StructuredQName name)
void
setBody(Expression expression)
Set the expression to be used to evaluate this constructvoid
setCapturing(boolean capturing)
void
setLocation(Location loc)
-
-
-
Constructor Detail
-
AccumulatorRule
public AccumulatorRule(Expression newValueExpression, SlotManager stackFrameMap, boolean postDescent)
Create a rule- Parameters:
newValueExpression
- the expression that computes a new value of the accumulator functionstackFrameMap
- the stack frame used to evaluate this expressionpostDescent
- true if this is a post-descent rule, false for a pre-descent rule
-
-
Method Detail
-
getNewValueExpression
public Expression getNewValueExpression()
-
export
public void export(ExpressionPresenter out) throws XPathException
Description copied from interface:RuleTarget
Output diagnostic explanation to an ExpressionPresenter- Specified by:
export
in interfaceRuleTarget
- Parameters:
out
- the destination for the explanation- Throws:
XPathException
- if output fails
-
getStackFrameMap
public SlotManager getStackFrameMap()
-
registerRule
public void registerRule(Rule rule)
Register a rule for which this is the target- Specified by:
registerRule
in interfaceRuleTarget
- Parameters:
rule
- a rule in which this is the target
-
setCapturing
public void setCapturing(boolean capturing)
-
isCapturing
public boolean isCapturing()
-
isPostDescent
public boolean isPostDescent()
-
getBody
public Expression getBody()
Description copied from interface:TraceableComponent
Get the expression at the root of the expression tree used to evaluate this construct- Specified by:
getBody
in interfaceTraceableComponent
- Returns:
- the root expression
-
setLocation
public void setLocation(Location loc)
-
getLocation
public Location getLocation()
Description copied from interface:Locatable
Get the location of the construct- Specified by:
getLocation
in interfaceLocatable
- Returns:
- the location. If no location information is available, the method should return
Loc.NONE
rather than returning null. However, callers would be well advised to check for the result being null.
-
getObjectName
public StructuredQName getObjectName()
Description copied from interface:Traceable
Get a name identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc. This is used only where the name is known statically.- Specified by:
getObjectName
in interfaceTraceable
- Returns:
- the QName of the object declared or manipulated by this instruction or expression
-
setBody
public void setBody(Expression expression)
Description copied from interface:TraceableComponent
Set the expression to be used to evaluate this construct- Specified by:
setBody
in interfaceTraceableComponent
- Parameters:
expression
- the evaluation expression
-
getTracingTag
public String getTracingTag()
Description copied from interface:TraceableComponent
Get a string to identify the type of component- Specified by:
getTracingTag
in interfaceTraceableComponent
- Returns:
- an identifying string
-
setAccumulatorName
public void setAccumulatorName(StructuredQName name)
-
gatherProperties
public void gatherProperties(BiConsumer<String,Object> consumer)
Description copied from interface:Traceable
Get the properties of this object to be included in trace messages, by supplying the property values to a supplied consumer function- Specified by:
gatherProperties
in interfaceTraceable
- Parameters:
consumer
- the function to which the properties should be supplied, as (property name, value) pairs.
-
-