APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xalan.internal.xsltc.compiler

pack-priv final Class TestSeq

extends Object
Class Inheritance
Imports
com.sun.org.apache.bcel.internal.generic.GOTO_W, .InstructionHandle, .InstructionList, com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator, .MethodGenerator, java.util.ArrayList, .List, .Map

A test sequence is a sequence of patterns that (1) occured in templates in the same mode (2) share the same kernel node type (e.g. A/B and C/C/B) (3) may also contain patterns matching "*" and "node()" (element sequence only) or matching "@*" (attribute sequence only). A test sequence may have a default template, which will be instantiated if none of the other patterns match.
Authors
Jacek Ambroziak, Santiago Pericas-Geertsen, Erwin Bolwidt , Morten Jorgensen

Field Summary

Modifier and TypeField and Description
private Template
_default

Default template for this test sequence

private InstructionList
_instructionList

Instruction list representing this test sequence.

private int
_kernelType

Integer code for the kernel type of this test sequence

private Mode
_mode

A reference to the Mode object.

private List<LocationPathPattern>
_patterns

ArrayList of all patterns in the test sequence.

private InstructionHandle
_start

Cached handle to avoid compiling more than once.

Constructor Summary

AccessConstructor and Description
public
TestSeq(List<LocationPathPattern> patterns, Mode mode)

Creates a new test sequence given a set of patterns and a mode.

public
TestSeq(List<LocationPathPattern> patterns, int kernelType, Mode mode)

Method Summary

Modifier and TypeMethod and Description
public InstructionHandle
compile(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle continuation)

Compile the code for this test sequence.

public void
findTemplates(Map<Template, Object> templates)

Returns, by reference, the templates that are included in this test sequence.

public InstructionList
getInstructionList()

Returns the instruction list for this test sequence

private LocationPathPattern
getPattern(int n)

Returns pattern n in this test sequence

public int
getPosition()

Returns the position of the highest priority pattern in this test sequence.

public double
getPriority()

Return the highest priority for a pattern in this test sequence.

private InstructionHandle
getTemplateHandle(Template template)

Get the instruction handle to a template's code.

public void
reduce()

Reduce the patterns in this test sequence.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of this test sequence.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_defaultback to summary
private Template _default

Default template for this test sequence

_instructionListback to summary
private InstructionList _instructionList

Instruction list representing this test sequence.

_kernelTypeback to summary
private int _kernelType

Integer code for the kernel type of this test sequence

_modeback to summary
private Mode _mode

A reference to the Mode object.

_patternsback to summary
private List<LocationPathPattern> _patterns

ArrayList of all patterns in the test sequence. May include patterns with "*", "@*" or "node()" kernel.

_startback to summary
private InstructionHandle _start

Cached handle to avoid compiling more than once.

Constructor Detail

TestSeqback to summary
public TestSeq(List<LocationPathPattern> patterns, Mode mode)

Creates a new test sequence given a set of patterns and a mode.

TestSeqback to summary
public TestSeq(List<LocationPathPattern> patterns, int kernelType, Mode mode)

Method Detail

compileback to summary
public InstructionHandle compile(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle continuation)

Compile the code for this test sequence. Compile patterns from highest to lowest priority. Note that since patterns can be share by multiple test sequences, instruction lists must be copied before backpatching.

findTemplatesback to summary
public void findTemplates(Map<Template, Object> templates)

Returns, by reference, the templates that are included in this test sequence. Note that a single template can occur in several test sequences if its pattern is a union.

getInstructionListback to summary
public InstructionList getInstructionList()

Returns the instruction list for this test sequence

getPatternback to summary
private LocationPathPattern getPattern(int n)

Returns pattern n in this test sequence

getPositionback to summary
public int getPosition()

Returns the position of the highest priority pattern in this test sequence.

getPriorityback to summary
public double getPriority()

Return the highest priority for a pattern in this test sequence. This is either the priority of the first or of the default pattern.

getTemplateHandleback to summary
private InstructionHandle getTemplateHandle(Template template)

Get the instruction handle to a template's code. This is used when a single template occurs in several test sequences; that is, if its pattern is a union of patterns (e.g. match="A/B | A/C").

reduceback to summary
public void reduce()

Reduce the patterns in this test sequence. Creates a new vector of patterns and sets the default pattern if it finds a patterns that is fully reduced.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of this test sequence. Notice that test sequences are mutable, so the value returned by this method is different before and after calling reduce().