net.sourceforge.jeuclid.biparser
Class AbstractBiNode

java.lang.Object
  extended by net.sourceforge.jeuclid.biparser.AbstractBiNode
All Implemented Interfaces:
IBiNode
Direct Known Subclasses:
BiNode, EmptyNode, TextNode

public abstract class AbstractBiNode
extends Object
implements IBiNode

this class is used to store typical information about a xml-node.

Version:
$Revision: 0b66106c7ff7 $

Constructor Summary
AbstractBiNode()
           
 
Method Summary
 void addSibling(IBiNode sibl)
          add sibling to a node, not possible at a textnode. if node already has a sibling, forward to sibling.
 void changeLengthRec(int change)
          change length of node and recursive of all parents.
 String formatLength()
          helper method for outputting the length of node.
 void forwardToSibling(boolean insert, BiTree biTree, int offset, int len, int totalOffset)
          helper method to insert or remove characters.
 int getLength()
          get length of node (number of characters).
 Node getNode()
          get reference to node in DOM-tree.
 BiNode getParent()
          get parent node for this node.
 IBiNode getPrevious()
          get previous node, null if node is root.
 IBiNode getSibling()
          get sibling node, can be null.
 TextPosition searchNode(Node n, int totalOffset)
          search a DOM node in this node. if nodes are equal return offset to begin of inputtext, else null
 void setLength(int len)
          set length of node.
 void setNode(Node n)
          set reference to node in DOM-tree.
 void setPrevious(IBiNode prev)
          set previous for this node.
 void setSibling(IBiNode sibl)
          set sibling for this node and set previous of sibling to this.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.jeuclid.biparser.IBiNode
createDOMSubtree, getType, insert, remove, toString
 

Constructor Detail

AbstractBiNode

public AbstractBiNode()
Method Detail

getPrevious

public final IBiNode getPrevious()
get previous node, null if node is root.

Specified by:
getPrevious in interface IBiNode
Returns:
previous

setPrevious

public final void setPrevious(IBiNode prev)
set previous for this node.

Specified by:
setPrevious in interface IBiNode
Parameters:
prev - previous node for this node

getParent

public final BiNode getParent()
get parent node for this node.

Specified by:
getParent in interface IBiNode
Returns:
parent

getSibling

public final IBiNode getSibling()
get sibling node, can be null.

Specified by:
getSibling in interface IBiNode
Returns:
sibling

setSibling

public final void setSibling(IBiNode sibl)
set sibling for this node and set previous of sibling to this.

Specified by:
setSibling in interface IBiNode
Parameters:
sibl - new sibling for this node

addSibling

public final void addSibling(IBiNode sibl)
add sibling to a node, not possible at a textnode. if node already has a sibling, forward to sibling.

Specified by:
addSibling in interface IBiNode
Parameters:
sibl - new sibling for this node

getNode

public final Node getNode()
get reference to node in DOM-tree.

Specified by:
getNode in interface IBiNode
Returns:
node in DOM-tree

setNode

public final void setNode(Node n)
set reference to node in DOM-tree.

Specified by:
setNode in interface IBiNode
Parameters:
n - reference in DOM-tree

getLength

public final int getLength()
get length of node (number of characters).

Specified by:
getLength in interface IBiNode
Returns:
length of node

setLength

public final void setLength(int len)
set length of node.

Specified by:
setLength in interface IBiNode
Parameters:
len - to set

changeLengthRec

public final void changeLengthRec(int change)
change length of node and recursive of all parents.

Specified by:
changeLengthRec in interface IBiNode
Parameters:
change - changevalue (can be positive or negative)

forwardToSibling

public void forwardToSibling(boolean insert,
                             BiTree biTree,
                             int offset,
                             int len,
                             int totalOffset)
                      throws ReparseException,
                             NonIncrementalElementException
helper method to insert or remove characters.

Specified by:
forwardToSibling in interface IBiNode
Parameters:
insert - if true call insert-method else remove-method
biTree - reference to BiTree to which this node contains
offset - position to insert/remove characters
len - number of characters to insert/remove
totalOffset - offset of node to begin of text
Throws:
ReparseException - if a reparse at upper level is needed
NonIncrementalElementException - if the subtree contains an element which cannot be incrementally updated.

searchNode

public TextPosition searchNode(Node n,
                               int totalOffset)
search a DOM node in this node. if nodes are equal return offset to begin of inputtext, else null

Specified by:
searchNode in interface IBiNode
Parameters:
n - DOM node to search for
totalOffset - offset of node to begin of inputtext
Returns:
position of node in inputtext

formatLength

public String formatLength()
helper method for outputting the length of node.

Specified by:
formatLength in interface IBiNode
Returns:
formatted output of length


Copyright © 2002-2010 The JEuclid project. All Rights Reserved.