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

pack-priv final Class Whitespace

extends TopLevelElement
Class Inheritance
Imports
com.sun.org.apache.bcel.internal.generic.ALOAD, .BranchHandle, .ConstantPoolGen, .IF_ICMPEQ, .ILOAD, .INVOKEINTERFACE, .INVOKEVIRTUAL, .InstructionHandle, .InstructionList, .PUSH, com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator, .ErrorMsg, .MethodGenerator, .Type, .TypeCheckError, .Util, java.util.ArrayList, .List, .StringTokenizer

Author
Morten Jorgensen

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
Whitespace.WhitespaceRule

Auxillary class for encapsulating a single strip/preserve rule

Field Summary

Modifier and TypeField and Description
private int
private String
private int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
Inherited from com.sun.org.apache.xalan.internal.xsltc.compiler.TopLevelElement:
_dependencies

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static void
compileDefault(int defaultAction, ClassGenerator classGen)

Compiles the predicate method

private static void
compilePredicate(List<Whitespace.WhitespaceRule> rules, int defaultAction, ClassGenerator classGen)

Compiles the predicate method

public static void
public static void
private static Whitespace.WhitespaceRule
findContradictingRule(List<Whitespace.WhitespaceRule> rules, Whitespace.WhitespaceRule rule)

Scans through the rules vector and looks for a rule of higher priority that contradicts the current rule.

public List<Whitespace.WhitespaceRule>
getRules()

De-tokenize the elements listed in the 'elements' attribute and instanciate a set of strip/preserve rules.

public void
parseContents(Parser parser)

Overrides com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.parseContents.

Parse the attributes of the xsl:strip/preserve-space element.

private static int
partition(List<Whitespace.WhitespaceRule> rules, int p, int r)

Used with quicksort method above

private static int
prioritizeRules(List<Whitespace.WhitespaceRule> rules)

Orders a set or rules by priority, removes redundant rules and rules that are shadowed by stronger, contradicting rules.

private static void
quicksort(List<Whitespace.WhitespaceRule> rules, int p, int r)

Sorts a range of rules with regard to PRIORITY only

public void
translate(ClassGenerator classGen, MethodGenerator methodGen)

Overrides com.sun.org.apache.xalan.internal.xsltc.compiler.TopLevelElement.translate.

This method should not produce any code

public static int
translateRules(List<Whitespace.WhitespaceRule> rules, ClassGenerator classGen)

Takes a vector of WhitespaceRule objects and generates a predicate method.

public Type
typeCheck(SymbolTable stable)

Overrides com.sun.org.apache.xalan.internal.xsltc.compiler.TopLevelElement.typeCheck.

Type-check contents/attributes - nothing to do...

Inherited from com.sun.org.apache.xalan.internal.xsltc.compiler.TopLevelElement:
addDependencycompiledisplaygetDependencies

Field Detail

_actionback to summary
private int _action
_elementListback to summary
private String _elementList
_importPrecedenceback to summary
private int _importPrecedence
PRESERVE_SPACEback to summary
public static final int PRESERVE_SPACE
RULE_ALLback to summary
public static final int RULE_ALL
RULE_ELEMENTback to summary
public static final int RULE_ELEMENT
RULE_NAMESPACEback to summary
public static final int RULE_NAMESPACE
RULE_NONEback to summary
public static final int RULE_NONE
STRIP_SPACEback to summary
public static final int STRIP_SPACE

Hides com.sun.org.apache.xalan.internal.xsltc.compiler.Constants.STRIP_SPACE.

USE_PREDICATEback to summary
public static final int USE_PREDICATE

Constructor Detail

Whitespaceback to summary
pack-priv Whitespace()

Method Detail

compileDefaultback to summary
private static void compileDefault(int defaultAction, ClassGenerator classGen)

Compiles the predicate method

compilePredicateback to summary
private static void compilePredicate(List<Whitespace.WhitespaceRule> rules, int defaultAction, ClassGenerator classGen)

Compiles the predicate method

compilePreserveSpaceback to summary
public static void compilePreserveSpace(BranchHandle[] preserve, int pCount, InstructionList il)
compileStripSpaceback to summary
public static void compileStripSpace(BranchHandle[] strip, int sCount, InstructionList il)
findContradictingRuleback to summary
private static Whitespace.WhitespaceRule findContradictingRule(List<Whitespace.WhitespaceRule> rules, Whitespace.WhitespaceRule rule)

Scans through the rules vector and looks for a rule of higher priority that contradicts the current rule.

Annotations
@SuppressWarnings:fallthrough
getRulesback to summary
public List<Whitespace.WhitespaceRule> getRules()

De-tokenize the elements listed in the 'elements' attribute and instanciate a set of strip/preserve rules.

parseContentsback to summary
public void parseContents(Parser parser)

Overrides com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.parseContents.

Parse the attributes of the xsl:strip/preserve-space element. The element should have not contents (ignored if any).

partitionback to summary
private static int partition(List<Whitespace.WhitespaceRule> rules, int p, int r)

Used with quicksort method above

prioritizeRulesback to summary
private static int prioritizeRules(List<Whitespace.WhitespaceRule> rules)

Orders a set or rules by priority, removes redundant rules and rules that are shadowed by stronger, contradicting rules.

quicksortback to summary
private static void quicksort(List<Whitespace.WhitespaceRule> rules, int p, int r)

Sorts a range of rules with regard to PRIORITY only

translateback to summary
public void translate(ClassGenerator classGen, MethodGenerator methodGen)

Overrides com.sun.org.apache.xalan.internal.xsltc.compiler.TopLevelElement.translate.

This method should not produce any code

translateRulesback to summary
public static int translateRules(List<Whitespace.WhitespaceRule> rules, ClassGenerator classGen)

Takes a vector of WhitespaceRule objects and generates a predicate method. This method returns the translets default action for handling whitespace text-nodes: - USE_PREDICATE (run the method generated by this method) - STRIP_SPACE (always strip whitespace text-nodes) - PRESERVE_SPACE (always preserve whitespace text-nodes)

typeCheckback to summary
public Type typeCheck(SymbolTable stable) throws TypeCheckError

Overrides com.sun.org.apache.xalan.internal.xsltc.compiler.TopLevelElement.typeCheck.

Type-check contents/attributes - nothing to do...

com.sun.org.apache.xalan.internal.xsltc.compiler back to summary

pack-priv final Class Whitespace.WhitespaceRule

extends Object
Class Inheritance
  • java.lang.Object
  • com.sun.org.apache.xalan.internal.xsltc.compiler.Whitespace.WhitespaceRule

Auxillary class for encapsulating a single strip/preserve rule

Field Summary

Modifier and TypeField and Description
private final int
private String
private String
private int
private int

Constructor Summary

AccessConstructor and Description
public
WhitespaceRule(int action, String element, int precedence)

Strip/preserve rule constructor

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(Whitespace.WhitespaceRule other)

For sorting rules depending on priority

public int
public String
public String
public int
public int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_actionback to summary
private final int _action
_elementback to summary
private String _element
_namespaceback to summary
private String _namespace
_priorityback to summary
private int _priority
_typeback to summary
private int _type

Constructor Detail

WhitespaceRuleback to summary
public WhitespaceRule(int action, String element, int precedence)

Strip/preserve rule constructor

Method Detail

compareToback to summary
public int compareTo(Whitespace.WhitespaceRule other)

For sorting rules depending on priority

getActionback to summary
public int getAction()
getElementback to summary
public String getElement()
getNamespaceback to summary
public String getNamespace()
getPriorityback to summary
public int getPriority()
getStrengthback to summary
public int getStrength()