public abstract class InstructionWithContent
extends Instruction
Modifier and Type | Field and Description |
---|---|
protected Map<String,Expression> |
attribs |
protected Expression |
content |
protected String |
name |
private int |
nameCode |
Constructor and Description |
---|
InstructionWithContent(String name,
Map<String,Expression> attribs,
Expression content)
Construct the content instruction.
|
Modifier and Type | Method and Description |
---|---|
boolean |
createsNewNodes()
Determine whether this instruction creates new nodes.
|
void |
display(int level,
PrintStream out,
Configuration config)
Diagnostic print of expression structure.
|
protected void |
dynamicError(Throwable cause,
String message,
String code,
XPathContext context)
Special version of dynamicError that includes a cause with the exception.
|
boolean |
getAttribBool(String attrName,
XPathContext context,
boolean defaultVal) |
String |
getAttribStr(String attrName,
XPathContext context) |
String |
getAttribStr(String attrName,
XPathContext context,
String defaultVal) |
int |
getCardinality() |
int |
getInstructionNameCode()
Get the name of this instruction for diagnostic and tracing purposes
|
ItemType |
getItemType(TypeHierarchy th) |
Iterator |
iterateSubExpressions()
Get all the XPath expressions associated with this instruction
(in XSLT terms, the expression present on attributes of the instruction,
as distinct from the child instructions in a sequence construction)
|
Expression |
optimize(Optimizer opt,
StaticContext env,
ItemType contextItemType) |
abstract TailCall |
processLeavingTail(XPathContext context)
This is where the main work should be performed.
|
protected void |
promoteInst(PromotionOffer offer)
Handle promotion offers, that is, non-local tree rewrites.
|
boolean |
replaceSubExpression(Expression original,
Expression replacement)
Replace one subexpression by a replacement subexpression
|
protected static String |
sequenceToString(Expression exp,
XPathContext context)
Utility function to convert an expression (which might be a sequence) to a string
value.
|
Expression |
simplify(StaticContext env)
Simplify an expression.
|
Expression |
typeCheck(StaticContext env,
ItemType contextItemType) |
appendItem, assembleParams, assembleTunnelParams, computeCardinality, computeSpecialProperties, dynamicError, evaluateAsString, evaluateItem, getImplementationMethod, getInstructionInfo, getSourceLocator, isXSLT, iterate, process, promote
adoptChildExpression, checkPermittedContents, computeDependencies, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, getColumnNumber, getConstructType, getContainingProcedure, getDependencies, getExecutable, getHostLanguage, getIntrinsicDependencies, getLineNumber, getLocationId, getLocationProvider, getParentExpression, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasBadParentPointer, markTailFunctionCalls, resetStaticProperties, setLocationId, setParentExpression, setParentExpression, suppressValidation, typeError
protected final String name
private int nameCode
protected Map<String,Expression> attribs
protected Expression content
public InstructionWithContent(String name, Map<String,Expression> attribs, Expression content)
public String getAttribStr(String attrName, XPathContext context) throws XPathException
XPathException
public String getAttribStr(String attrName, XPathContext context, String defaultVal) throws XPathException
XPathException
public boolean getAttribBool(String attrName, XPathContext context, boolean defaultVal) throws XPathException
XPathException
public Expression simplify(StaticContext env) throws XPathException
simplify
in class Instruction
XPathException
- if an error is discovered during expression rewritingpublic Expression typeCheck(StaticContext env, ItemType contextItemType) throws XPathException
typeCheck
in class Expression
XPathException
public Expression optimize(Optimizer opt, StaticContext env, ItemType contextItemType) throws XPathException
optimize
in class Expression
XPathException
public int getInstructionNameCode()
getInstructionNameCode
in class Instruction
public ItemType getItemType(TypeHierarchy th)
getItemType
in class Instruction
public int getCardinality()
getCardinality
in class Expression
public final boolean createsNewNodes()
createsNewNodes
in class Instruction
protected void promoteInst(PromotionOffer offer) throws XPathException
promoteInst
in class Instruction
offer
- The type of rewrite being offeredXPathException
public Iterator iterateSubExpressions()
iterateSubExpressions
in class Expression
public boolean replaceSubExpression(Expression original, Expression replacement)
replaceSubExpression
in interface Container
replaceSubExpression
in class Expression
original
- the original subexpressionreplacement
- the replacement subexpressionpublic abstract TailCall processLeavingTail(XPathContext context) throws XPathException
processLeavingTail
in interface TailCallReturner
processLeavingTail
in class Instruction
XPathException
protected static String sequenceToString(Expression exp, XPathContext context) throws XPathException
XPathException
public void display(int level, PrintStream out, Configuration config)
display
in class Expression
level
- indentation level for this expressionout
- config
- protected void dynamicError(Throwable cause, String message, String code, XPathContext context) throws DynamicError
DynamicError