|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xalan.xsltc.compiler.Mode
final class Mode
Mode gathers all the templates belonging to a given mode; it is responsible for generating an appropriate applyTemplates + (mode name) method in the translet.
Field Summary | |
---|---|
private java.util.Vector |
_attribNodeGroup
Group for patterns with node()-type kernel and attribute axis. |
private TestSeq |
_attribNodeTestSeq
Test sequence for patterns with node()-type kernel and attribute axis. |
private java.util.Vector |
_childNodeGroup
Group for patterns with node()-type kernel and child axis. |
private TestSeq |
_childNodeTestSeq
Test sequence for patterns with node()-type kernel and child axis. |
private int |
_currentIndex
Variable index for the current node used in code generation. |
private java.util.Vector |
_idxGroup
Group for patterns with id() or key()-type kernel. |
private TestSeq |
_idxTestSeq
Test sequence for patterns with id() or key()-type kernel. |
private java.util.Hashtable |
_importLevels
Stores ranges of template precendences for the compilation of apply-imports (a Hashtable for historical reasons). |
private java.util.Hashtable |
_keys
A mapping between key names and keys. |
private java.lang.String |
_methodName
The name of the method in which this mode is compiled. |
private QName |
_name
The name of this mode as defined in the stylesheet. |
private java.util.Hashtable |
_namedTemplates
A mapping between named templates and Mode objects. |
private java.util.Hashtable |
_neededTemplates
A mapping between templates and test sequences. |
private java.util.Vector[] |
_patternGroups
Group for patterns with any other kernel type. |
private LocationPathPattern |
_rootPattern
A reference to the pattern matching the root node. |
private Stylesheet |
_stylesheet
A reference to the stylesheet object that owns this mode. |
private java.util.Hashtable |
_templateIHs
A mapping between templates and instruction handles. |
private java.util.Hashtable |
_templateILs
A mapping between templates and instruction lists. |
private java.util.Vector |
_templates
A vector of all the templates in this mode. |
private TestSeq[] |
_testSeq
Test sequence for patterns with any other kernel type. |
Constructor Summary | |
---|---|
Mode(QName name,
Stylesheet stylesheet,
java.lang.String suffix)
Creates a new Mode. |
Method Summary | |
---|---|
private void |
addPattern(int kernelType,
LocationPathPattern pattern)
Adds a pattern to a pattern group |
private void |
addPatternToGroup(LocationPathPattern lpp)
Group patterns by NodeTests of their last Step Keep them sorted by priority within group |
void |
addTemplate(Template template)
|
private void |
appendTemplateCode(InstructionList body)
|
private void |
appendTestSequences(InstructionList body)
|
void |
compileApplyImports(ClassGenerator classGen,
int min,
int max)
|
void |
compileApplyTemplates(ClassGenerator classGen)
Compiles the applyTemplates() method and adds it to the translet. |
private InstructionList |
compileDefaultRecursion(ClassGenerator classGen,
MethodGenerator methodGen,
InstructionHandle next)
Compiles the default handling for DOM elements: traverse all children |
private InstructionList |
compileDefaultText(ClassGenerator classGen,
MethodGenerator methodGen,
InstructionHandle next)
Compiles the default action for DOM text nodes and attribute nodes: output the node's text value |
static void |
compileGetChildren(ClassGenerator classGen,
MethodGenerator methodGen,
int node)
|
private void |
compileNamedTemplate(Template template,
ClassGenerator classGen)
|
private InstructionList |
compileNamespaces(ClassGenerator classGen,
MethodGenerator methodGen,
boolean[] isNamespace,
boolean[] isAttribute,
boolean attrFlag,
InstructionHandle defaultTarget)
|
private void |
compileTemplateCalls(ClassGenerator classGen,
MethodGenerator methodGen,
InstructionHandle next,
int min,
int max)
|
private void |
compileTemplates(ClassGenerator classGen,
MethodGenerator methodGen,
InstructionHandle next)
|
private void |
completeTestSequences(int nodeType,
java.util.Vector patterns)
Complete test sequences of a given type by adding all patterns from a given group. |
private void |
flattenAlternative(Pattern pattern,
Template template,
java.util.Hashtable keys)
This method will break up alternative patterns (ie. |
java.lang.String |
functionName()
Returns the name of the method (_not_ function) that will be compiled for this mode. |
java.lang.String |
functionName(int min,
int max)
|
private java.lang.String |
getClassName()
Shortcut to get the class compiled for this mode (will be inlined). |
Stylesheet |
getStylesheet()
|
InstructionHandle |
getTemplateInstructionHandle(Template template)
|
private static boolean |
isAttributeName(java.lang.String qname)
Auxiliary method to determine if a qname is an attribute. |
private static boolean |
isNamespaceName(java.lang.String qname)
Auxiliary method to determine if a qname is a namespace qualified "*". |
private int |
partition(java.util.Vector templates,
int p,
int r)
|
private void |
peepHoleOptimization(MethodGenerator methodGen)
Peephole optimization. |
private void |
prepareTestSequences()
Build test sequences. |
void |
processPatterns(java.util.Hashtable keys)
Process all the test patterns in this mode |
private java.util.Vector |
quicksort(java.util.Vector templates,
int p,
int r)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final QName _name
private final Stylesheet _stylesheet
private final java.lang.String _methodName
private java.util.Vector _templates
private java.util.Vector _childNodeGroup
private TestSeq _childNodeTestSeq
private java.util.Vector _attribNodeGroup
private TestSeq _attribNodeTestSeq
private java.util.Vector _idxGroup
private TestSeq _idxTestSeq
private java.util.Vector[] _patternGroups
private TestSeq[] _testSeq
private java.util.Hashtable _neededTemplates
private java.util.Hashtable _namedTemplates
private java.util.Hashtable _templateIHs
private java.util.Hashtable _templateILs
private LocationPathPattern _rootPattern
private java.util.Hashtable _importLevels
private java.util.Hashtable _keys
private int _currentIndex
Constructor Detail |
---|
public Mode(QName name, Stylesheet stylesheet, java.lang.String suffix)
name
- A textual representation of the mode's QNamestylesheet
- The Stylesheet in which the mode occuredsuffix
- A suffix to append to the method name for this mode
(normally a sequence number - still in a String).Method Detail |
---|
public java.lang.String functionName()
public java.lang.String functionName(int min, int max)
private java.lang.String getClassName()
public Stylesheet getStylesheet()
public void addTemplate(Template template)
private java.util.Vector quicksort(java.util.Vector templates, int p, int r)
private int partition(java.util.Vector templates, int p, int r)
public void processPatterns(java.util.Hashtable keys)
private void flattenAlternative(Pattern pattern, Template template, java.util.Hashtable keys)
private void addPatternToGroup(LocationPathPattern lpp)
private void addPattern(int kernelType, LocationPathPattern pattern)
private void completeTestSequences(int nodeType, java.util.Vector patterns)
private void prepareTestSequences()
private void compileNamedTemplate(Template template, ClassGenerator classGen)
private void compileTemplates(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle next)
private void appendTemplateCode(InstructionList body)
private void appendTestSequences(InstructionList body)
public static void compileGetChildren(ClassGenerator classGen, MethodGenerator methodGen, int node)
private InstructionList compileDefaultRecursion(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle next)
private InstructionList compileDefaultText(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle next)
private InstructionList compileNamespaces(ClassGenerator classGen, MethodGenerator methodGen, boolean[] isNamespace, boolean[] isAttribute, boolean attrFlag, InstructionHandle defaultTarget)
public void compileApplyTemplates(ClassGenerator classGen)
private void compileTemplateCalls(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle next, int min, int max)
public void compileApplyImports(ClassGenerator classGen, int min, int max)
private void peepHoleOptimization(MethodGenerator methodGen)
public InstructionHandle getTemplateInstructionHandle(Template template)
private static boolean isAttributeName(java.lang.String qname)
private static boolean isNamespaceName(java.lang.String qname)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |