dk.brics.xact
Class Node

java.lang.Object
  extended by dk.brics.xact.Node
Direct Known Subclasses:
AttrNode, NamespaceDecl, XML

public abstract class Node
extends Object

Base class for all nodes.


Constructor Summary
Node(Origin origin)
          Constructs a new node.
 
Method Summary
 Attribute asAttribute()
          Returns this node as an attribute node.
 Comment asComment()
          Returns this node as a comment node.
 Element asElement()
          Returns this node as an element node.
 NamespaceDecl asNamespaceDecl()
          Returns this node as a namespace declaration node.
 ProcessingInstruction asProcessingInstruction()
          Returns this node as a processing instruction node.
(package private)  TempNode asTemplate()
          Returns this node as an XML template content node.
 Text asText()
          Returns this node as a text node.
(package private) static String expanded(String namespace, String localname)
          Builds an expanded name from an optional namespace URI and a local name.
(package private) static AttrNode follow(AttrNode a)
          Returns the replacement node if forwarded, otherwise returns the node itself.
(package private) static NamespaceDecl follow(NamespaceDecl a)
          Returns the replacement node if forwarded, otherwise returns the node itself.
(package private) static Node follow(Node n)
          Returns the replacement node if forwarded, otherwise returns the node itself.
(package private) static XML follow(XML x)
          Returns the replacement node if forwarded, otherwise returns the node itself.
(package private)  void forward(Node replacement)
          Forwards this node.
 Origin getOrigin()
          Returns the origin of this node, or null if absent.
 boolean isAttribute()
          Checks whether this is an attribute node.
 boolean isComment()
          Checks whether this is an comment node.
 boolean isElement()
          Checks whether this is an element node.
 boolean isNamespaceDecl()
          Checks whether this is a namespace declaration node.
 boolean isProcessingInstruction()
          Checks whether this is an processing instruction node.
(package private)  boolean isTemplate()
          Checks whether this is an XML template content node.
 boolean isText()
          Checks whether this is a text node.
abstract  String toString()
          Returns a description of this node.
(package private) abstract  void visitAnyBy(AnyNodeVisitor v)
          Visits this node by the given any-node visitor.
 void visitBy(NodeVisitor v)
          Visits this node by the given visitor.
<R,A> R
visitBy(NodeVisitorParameterized<R,A> v, A arg)
          Visits this node by the given visitor.
(package private) abstract  void visitNormalizedBy(NodeVisitor v)
          Visits this normalized node it by the given visitor.
(package private) abstract
<R,A> R
visitNormalizedBy(NodeVisitorParameterized<R,A> v, A arg)
          Visits this normalized node it by the given visitor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Node

public Node(Origin origin)
Constructs a new node.

Method Detail

asAttribute

public Attribute asAttribute()
Returns this node as an attribute node.

Throws:
ClassCastException - if this is not an attribute node

asComment

public Comment asComment()
Returns this node as a comment node.

Throws:
ClassCastException - if this is not a comment node

asElement

public Element asElement()
Returns this node as an element node.

Throws:
ClassCastException - if this is not an element node

asNamespaceDecl

public NamespaceDecl asNamespaceDecl()
Returns this node as a namespace declaration node.

Throws:
ClassCastException - if this is not a namespace declaration node

asProcessingInstruction

public ProcessingInstruction asProcessingInstruction()
Returns this node as a processing instruction node.

Throws:
ClassCastException - if this is not a processing instruction node

asTemplate

TempNode asTemplate()
Returns this node as an XML template content node.

Throws:
ClassCastException - if this is not an XML node

asText

public Text asText()
Returns this node as a text node.

Throws:
ClassCastException - if this is not a text node

expanded

static String expanded(String namespace,
                       String localname)
Builds an expanded name from an optional namespace URI and a local name.


follow

static AttrNode follow(AttrNode a)
Returns the replacement node if forwarded, otherwise returns the node itself. See follow(Node).


follow

static NamespaceDecl follow(NamespaceDecl a)
Returns the replacement node if forwarded, otherwise returns the node itself. See follow(Node).


follow

static Node follow(Node n)
Returns the replacement node if forwarded, otherwise returns the node itself. All methods in this package should invoke follow before inspecting the type of a node. Public methods in this package should never return a forwarded node.


follow

static XML follow(XML x)
Returns the replacement node if forwarded, otherwise returns the node itself. See follow(Node).


forward

void forward(Node replacement)
Forwards this node. This is the only way to modify a node! Should only be invoked on a freshly generated (which implies non-shared) node.


getOrigin

public Origin getOrigin()
Returns the origin of this node, or null if absent.


isAttribute

public boolean isAttribute()
Checks whether this is an attribute node.


isComment

public boolean isComment()
Checks whether this is an comment node.


isElement

public boolean isElement()
Checks whether this is an element node.


isNamespaceDecl

public boolean isNamespaceDecl()
Checks whether this is a namespace declaration node.


isProcessingInstruction

public boolean isProcessingInstruction()
Checks whether this is an processing instruction node.


isTemplate

boolean isTemplate()
Checks whether this is an XML template content node.


isText

public boolean isText()
Checks whether this is a text node.


toString

public abstract String toString()
Returns a description of this node.

Overrides:
toString in class Object

visitAnyBy

abstract void visitAnyBy(AnyNodeVisitor v)
Visits this node by the given any-node visitor.


visitBy

public void visitBy(NodeVisitor v)
Visits this node by the given visitor.


visitBy

public <R,A> R visitBy(NodeVisitorParameterized<R,A> v,
                       A arg)
Visits this node by the given visitor.


visitNormalizedBy

abstract void visitNormalizedBy(NodeVisitor v)
Visits this normalized node it by the given visitor.


visitNormalizedBy

abstract <R,A> R visitNormalizedBy(NodeVisitorParameterized<R,A> v,
                                   A arg)
Visits this normalized node it by the given visitor.



Copyright © 2005-2011 Aarhus University.