dk.brics.xsugar.stylesheet
Class TraversalVisitor

java.lang.Object
  extended by dk.brics.xsugar.stylesheet.TraversalVisitor
All Implemented Interfaces:
Visitor

public class TraversalVisitor
extends Object
implements Visitor

In-order, left-to-right traversal visitor.


Field Summary
 boolean in_attribute
          True if currently processing an attribute.
 boolean in_name
          True if currently processing an element/attribute name.
 boolean in_toplevel_singleton_content
          True if currently processing an item at top-level of element content of size 1.
 boolean in_xml
          True if currently processing XML side of a production.
 
Constructor Summary
TraversalVisitor()
          Constructs a new traversal visitor.
 
Method Summary
 void mid1Element(Element x)
          Invoked after processing the name of an Element.
 void mid2Element(Element x)
          Invoked after processing the attributes of an Element.
 void midAttribute(Attribute x)
          Invoked after processing the name of an Attribute.
 boolean midUnifyingProduction(UnifyingProduction x)
          Invoked between processing of left and right side of a UnifyingProduction.
 void postAttribute(Attribute x)
          Invoked after processing an Attribute.
 void postElement(Element x)
          Invoked after processing an Element.
 void postStylesheet(Stylesheet x)
          Invoked after processing a Stylesheet.
 void postUnifyingProduction(UnifyingProduction x)
          Invoked after processing a UnifyingProduction.
 void preAttribute(Attribute x)
          Invoked before processing an Attribute.
 void preElement(Element x)
          Invoked before processing an Element.
 void preStylesheet(Stylesheet x)
          Invoked before processing a Stylesheet.
 boolean preUnifyingProduction(UnifyingProduction x)
          Invoked before processing a UnifyingProduction.
protected  void processAttributes(Element x)
          Processes the attributes of the given element.
protected  void processContents(Element x)
          Processes the contents of the given element.
protected  void processName(Name n)
          Processes the given element/attribute name.
 void visitAttribute(Attribute x)
          Invokes preAttribute, then processes the attribute name, invokes midAttribute, then processes the attribute value, and finally invokes postAttribute.
 void visitElement(Element x)
          Invokes preElement, then processes the element name, invokes mid1Element, processes all attributes, invokes mid2Element, processes the contents, and finally invokes postElement/code>.
 void visitNonterminal(Nonterminal x)
          Processes a nonterminal.
 void visitQName(QName x)
          Processes a QName.
 void visitRegexpTerminal(RegexpTerminal x)
          Processes a regexp terminal.
 void visitStringTerminal(StringTerminal x)
          Processes a string terminal.
 void visitStylesheet(Stylesheet x)
          Invokes preStylesheet, then processes all productions, and finally invokes postStylesheet.
 void visitUnifyingProduction(UnifyingProduction x)
          Invokes preUnifyingProduction, then processes all left items, invokes midUnifyingProduction, then processes all right items, and finally invokes postUnifyingProduction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in_attribute

public boolean in_attribute
True if currently processing an attribute.


in_name

public boolean in_name
True if currently processing an element/attribute name.


in_toplevel_singleton_content

public boolean in_toplevel_singleton_content
True if currently processing an item at top-level of element content of size 1.


in_xml

public boolean in_xml
True if currently processing XML side of a production.

Constructor Detail

TraversalVisitor

public TraversalVisitor()
Constructs a new traversal visitor.

Method Detail

mid1Element

public void mid1Element(Element x)
Invoked after processing the name of an Element. Does nothing by default.


mid2Element

public void mid2Element(Element x)
Invoked after processing the attributes of an Element. Does nothing by default.


midAttribute

public void midAttribute(Attribute x)
Invoked after processing the name of an Attribute. Does nothing by default.


midUnifyingProduction

public boolean midUnifyingProduction(UnifyingProduction x)
Invoked between processing of left and right side of a UnifyingProduction. Returns true by default.

Returns:
true if XML-side should be processed

postAttribute

public void postAttribute(Attribute x)
Invoked after processing an Attribute. Does nothing by default.


postElement

public void postElement(Element x)
Invoked after processing an Element. Does nothing by default.


postStylesheet

public void postStylesheet(Stylesheet x)
Invoked after processing a Stylesheet. Does nothing by default.


postUnifyingProduction

public void postUnifyingProduction(UnifyingProduction x)
Invoked after processing a UnifyingProduction. Does nothing by default.


preAttribute

public void preAttribute(Attribute x)
Invoked before processing an Attribute. Does nothing by default.


preElement

public void preElement(Element x)
Invoked before processing an Element. Does nothing by default.


preStylesheet

public void preStylesheet(Stylesheet x)
Invoked before processing a Stylesheet. Does nothing by default.


preUnifyingProduction

public boolean preUnifyingProduction(UnifyingProduction x)
Invoked before processing a UnifyingProduction. Returns true by default.

Returns:
true if non-XML-side should be processed

processAttributes

protected void processAttributes(Element x)
Processes the attributes of the given element.

Parameters:
x - element

processContents

protected void processContents(Element x)
Processes the contents of the given element.

Parameters:
x - element

processName

protected void processName(Name n)
Processes the given element/attribute name.

Parameters:
n - element/attribute name

visitAttribute

public void visitAttribute(Attribute x)
Invokes preAttribute, then processes the attribute name, invokes midAttribute, then processes the attribute value, and finally invokes postAttribute.

Specified by:
visitAttribute in interface Visitor

visitElement

public void visitElement(Element x)
Invokes preElement, then processes the element name, invokes mid1Element, processes all attributes, invokes mid2Element, processes the contents, and finally invokes postElement/code>.

Specified by:
visitElement in interface Visitor

visitNonterminal

public void visitNonterminal(Nonterminal x)
Processes a nonterminal. Does nothing by default.

Specified by:
visitNonterminal in interface Visitor

visitQName

public void visitQName(QName x)
Processes a QName. Does nothing by default.

Specified by:
visitQName in interface Visitor

visitRegexpTerminal

public void visitRegexpTerminal(RegexpTerminal x)
Processes a regexp terminal. Does nothing by default.

Specified by:
visitRegexpTerminal in interface Visitor

visitStringTerminal

public void visitStringTerminal(StringTerminal x)
Processes a string terminal. Does nothing by default.

Specified by:
visitStringTerminal in interface Visitor

visitStylesheet

public void visitStylesheet(Stylesheet x)
Invokes preStylesheet, then processes all productions, and finally invokes postStylesheet.

Specified by:
visitStylesheet in interface Visitor

visitUnifyingProduction

public void visitUnifyingProduction(UnifyingProduction x)
Invokes preUnifyingProduction, then processes all left items, invokes midUnifyingProduction, then processes all right items, and finally invokes postUnifyingProduction.

Specified by:
visitUnifyingProduction in interface Visitor


Copyright © 2004-2007 Anders Møller & Claus Brabrand.