net.sourceforge.jeuclid.biparser
Interface IBiNode

All Known Implementing Classes:
AbstractBiNode, BiNode, EmptyNode, TextNode

public interface IBiNode

this interface is used to store typcial information about a xml-node.

Version:
$Revision: 0b66106c7ff7 $

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.
 Node createDOMSubtree(Document doc)
          create a DOM-tree from node.
 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.
 BiType getType()
          get the type of node, can be BiNode, EmptyNode or TextNode.
 void insert(BiTree biTree, int offset, int len, int totalOffset)
          insert characters to node.
 void remove(BiTree biTree, int offset, int len, int totalOffset)
          remove characters from node.
 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.
 String toString(int level)
          print biNode.
 

Method Detail

getPrevious

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

Returns:
previous

setPrevious

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

Parameters:
prev - previous node for this node

getParent

BiNode getParent()
get parent node for this node.

Returns:
parent

getSibling

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

Returns:
sibling

setSibling

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

Parameters:
sibl - new sibling for this node

addSibling

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

Parameters:
sibl - new sibling for this node

getNode

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

Returns:
node in DOM-tree

setNode

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

Parameters:
n - reference in DOM-tree

getLength

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

Returns:
length of node

setLength

void setLength(int len)
set length of node.

Parameters:
len - to set

changeLengthRec

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

Parameters:
change - changevalue (can be positive or negative)

getType

BiType getType()
get the type of node, can be BiNode, EmptyNode or TextNode.

Returns:
type of node

insert

void insert(BiTree biTree,
            int offset,
            int len,
            int totalOffset)
            throws ReparseException,
                   NonIncrementalElementException
insert characters to node.

Parameters:
biTree - reference to BiTree to which this node contains
offset - position to insert characters
len - number of characters to insert
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.

remove

void remove(BiTree biTree,
            int offset,
            int len,
            int totalOffset)
            throws ReparseException,
                   NonIncrementalElementException
remove characters from node.

Parameters:
biTree - reference to BiTree to which this node contains
offset - position to remove characters
len - number of characters to 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.

forwardToSibling

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

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.

createDOMSubtree

Node createDOMSubtree(Document doc)
create a DOM-tree from node.

Parameters:
doc - Document to create DOM-tree
Returns:
root of DOM-tree

searchNode

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

Parameters:
n - DOM node to search for
totalOffset - offset of node to begin of inputtext
Returns:
position of node in inputtext

toString

String toString(int level)
print biNode.

Parameters:
level - level of recursion tree
Returns:
biNode

formatLength

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

Returns:
formatted output of length


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