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.
 Text asText()
          Returns this node as a text 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.
 boolean isText()
          Checks whether this is a text node.
abstract  String toString()
          Returns a description of this node.
 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.
 
Methods inherited from class java.lang.Object
equals, 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

asText

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

Throws:
ClassCastException - if this is not a text 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.


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

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.



Copyright © 2005-2011 Aarhus University.