org.dom4j.tree

Class AbstractBranch

public abstract class AbstractBranch extends AbstractNode implements Branch

AbstractBranch is an abstract base class for tree implementors to use for implementation inheritence.

Version: $Revision: 1.44 $

Author: James Strachan

Field Summary
protected static intDEFAULT_CONTENT_LIST_SIZE
Constructor Summary
AbstractBranch()
Method Summary
voidadd(Node node)
voidadd(Comment comment)
voidadd(Element element)
voidadd(ProcessingInstruction pi)
ElementaddElement(String name)
ElementaddElement(String qualifiedName, String namespaceURI)
ElementaddElement(QName qname)
ElementaddElement(String name, String prefix, String uri)
protected abstract voidaddNode(Node node)
protected abstract voidaddNode(int index, Node node)
voidappendContent(Branch branch)
protected abstract voidchildAdded(Node node)
Called when a new child node has been added to me to allow any parent relationships to be created or events to be fired.
protected abstract voidchildRemoved(Node node)
Called when a child node has been removed to allow any parent relationships to be deleted or events to be fired.
Listcontent()
protected abstract ListcontentList()
DOCUMENT ME!
protected voidcontentRemoved()
Called when the given List content has been removed so each node should have its parent and document relationships cleared
protected ListcreateContentList()
A Factory Method pattern which creates a List implementation used to store content
protected ListcreateContentList(int size)
A Factory Method pattern which creates a List implementation used to store content
protected ListcreateEmptyList()
A Factory Method pattern which creates an empty a BackedList implementation
protected BackedListcreateResultList()
A Factory Method pattern which creates a BackedList implementation used to store results of a filtered content query.
protected ListcreateSingleResultList(Object result)
A Factory Method pattern which creates a BackedList implementation which contains a single result
ElementelementByID(String elementID)
protected StringelementID(Element element)
DOCUMENT ME!
protected StringgetContentAsStringValue(Object content)
DOCUMENT ME!
protected StringgetContentAsText(Object content)
DOCUMENT ME!
StringgetText()
StringgetTextTrim()
booleanhasContent()
intindexOf(Node node)
protected voidinvalidNodeTypeAddException(Node node)
Called when an invalid node has been added.
booleanisReadOnly()
Nodenode(int index)
intnodeCount()
IteratornodeIterator()
booleanremove(Node node)
booleanremove(Comment comment)
booleanremove(Element element)
booleanremove(ProcessingInstruction pi)
protected abstract booleanremoveNode(Node node)
voidsetProcessingInstructions(List listOfPIs)

Field Detail

DEFAULT_CONTENT_LIST_SIZE

protected static final int DEFAULT_CONTENT_LIST_SIZE

Constructor Detail

AbstractBranch

public AbstractBranch()

Method Detail

add

public void add(Node node)

add

public void add(Comment comment)

add

public void add(Element element)

add

public void add(ProcessingInstruction pi)

addElement

public Element addElement(String name)

addElement

public Element addElement(String qualifiedName, String namespaceURI)

addElement

public Element addElement(QName qname)

addElement

public Element addElement(String name, String prefix, String uri)

addNode

protected abstract void addNode(Node node)

addNode

protected abstract void addNode(int index, Node node)

appendContent

public void appendContent(Branch branch)

childAdded

protected abstract void childAdded(Node node)
Called when a new child node has been added to me to allow any parent relationships to be created or events to be fired.

Parameters: node DOCUMENT ME!

childRemoved

protected abstract void childRemoved(Node node)
Called when a child node has been removed to allow any parent relationships to be deleted or events to be fired.

Parameters: node DOCUMENT ME!

content

public List content()

contentList

protected abstract List contentList()
DOCUMENT ME!

Returns: the internal List used to manage the content

contentRemoved

protected void contentRemoved()
Called when the given List content has been removed so each node should have its parent and document relationships cleared

createContentList

protected List createContentList()
A Factory Method pattern which creates a List implementation used to store content

Returns: DOCUMENT ME!

createContentList

protected List createContentList(int size)
A Factory Method pattern which creates a List implementation used to store content

Parameters: size DOCUMENT ME!

Returns: DOCUMENT ME!

createEmptyList

protected List createEmptyList()
A Factory Method pattern which creates an empty a BackedList implementation

Returns: DOCUMENT ME!

createResultList

protected BackedList createResultList()
A Factory Method pattern which creates a BackedList implementation used to store results of a filtered content query.

Returns: DOCUMENT ME!

createSingleResultList

protected List createSingleResultList(Object result)
A Factory Method pattern which creates a BackedList implementation which contains a single result

Parameters: result DOCUMENT ME!

Returns: DOCUMENT ME!

elementByID

public Element elementByID(String elementID)

elementID

protected String elementID(Element element)
DOCUMENT ME!

Parameters: element DOCUMENT ME!

Returns: the ID of the given Element

getContentAsStringValue

protected String getContentAsStringValue(Object content)
DOCUMENT ME!

Parameters: content DOCUMENT ME!

Returns: the XPath defined string-value of the given content object

getContentAsText

protected String getContentAsText(Object content)
DOCUMENT ME!

Parameters: content DOCUMENT ME!

Returns: the text value of the given content object as text which returns the text value of CDATA, Entity or Text nodes

getText

public String getText()

getTextTrim

public String getTextTrim()

hasContent

public boolean hasContent()

indexOf

public int indexOf(Node node)

invalidNodeTypeAddException

protected void invalidNodeTypeAddException(Node node)
Called when an invalid node has been added. Throws an {@link IllegalAddException}.

Parameters: node DOCUMENT ME!

Throws: IllegalAddException DOCUMENT ME!

isReadOnly

public boolean isReadOnly()

node

public Node node(int index)

nodeCount

public int nodeCount()

nodeIterator

public Iterator nodeIterator()

remove

public boolean remove(Node node)

remove

public boolean remove(Comment comment)

remove

public boolean remove(Element element)

remove

public boolean remove(ProcessingInstruction pi)

removeNode

protected abstract boolean removeNode(Node node)

setProcessingInstructions

public void setProcessingInstructions(List listOfPIs)
Copyright B) 2005 MetaStuff Ltd. All Rights Reserved. Hosted by

SourceForge