org.planx.xmlstore
Class NodeFactory

java.lang.Object
  extended by org.planx.xmlstore.NodeFactory
Direct Known Subclasses:
DVMNodeFactory

public abstract class NodeFactory
extends Object

Author:
Kasper Bøgebjerg, Henning Niss, Thomas Ambus

Constructor Summary
protected NodeFactory()
           
 
Method Summary
abstract  Attribute createAttribute(String name, String value)
           
abstract  Node createCharDataNode(String data)
           
abstract  Node createElementNode(String tagName)
           
abstract  Node createElementNode(String tagName, List<? extends Node> children)
           
abstract  Node createElementNode(String tagName, List<? extends Node> children, List<Attribute> attrs)
           
abstract  Node createElementNode(String tagName, Node child)
           
abstract  Node createElementNode(String tagName, Node[] children)
           
abstract  Node createElementNode(String tagName, Node[] children, Attribute[] attrs)
           
abstract  Node insertChild(Node n, int index, Node child)
          The method is used for adding a child to an element node.
static NodeFactory instance()
           
abstract  Node removeChild(Node n, int index)
          The method is used for removing a child from an element node.
abstract  Node replaceChild(Node node, int index, Node child)
          The method is used for replacing a child of an element node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeFactory

protected NodeFactory()
Method Detail

instance

public static NodeFactory instance()

createAttribute

public abstract Attribute createAttribute(String name,
                                          String value)

createElementNode

public abstract Node createElementNode(String tagName)

createElementNode

public abstract Node createElementNode(String tagName,
                                       List<? extends Node> children)

createElementNode

public abstract Node createElementNode(String tagName,
                                       List<? extends Node> children,
                                       List<Attribute> attrs)

createElementNode

public abstract Node createElementNode(String tagName,
                                       Node[] children)

createElementNode

public abstract Node createElementNode(String tagName,
                                       Node[] children,
                                       Attribute[] attrs)

createElementNode

public abstract Node createElementNode(String tagName,
                                       Node child)

createCharDataNode

public abstract Node createCharDataNode(String data)

replaceChild

public abstract Node replaceChild(Node node,
                                  int index,
                                  Node child)
The method is used for replacing a child of an element node. The replacement is done by constructing and returning a new element node, which only differs from the original element node in the replaced child.

Parameters:
node - element node.
index - index of the child to replace.
child - new child node.
Returns:
new element node.

insertChild

public abstract Node insertChild(Node n,
                                 int index,
                                 Node child)
The method is used for adding a child to an element node. This is done by constructing and returning a new element node, which only differs from the original element node in the added child.

Parameters:
n - element node.
index - index at which new child is inserted.
child - new child node.
Returns:
new element node.

removeChild

public abstract Node removeChild(Node n,
                                 int index)
The method is used for removing a child from an element node. This is done by constructing and returning a new element node, which only differs from the original element node in the removed child.

Parameters:
n - element node.
index - index specifying the child to remove
Returns:
new element node.


Copyright © 2010. All Rights Reserved.