net.sourceforge.jeuclid.biparser
Class TextNode

java.lang.Object
  extended by net.sourceforge.jeuclid.biparser.AbstractBiNode
      extended by net.sourceforge.jeuclid.biparser.TextNode
All Implemented Interfaces:
IBiNode

public final class TextNode
extends AbstractBiNode

this class is used to store specific information about a text node. the node cannot have a child nor a sibling

Version:
$Revision: cbff5bfffc35 $

Constructor Summary
TextNode(int length, String t)
          creates a new TextNode, constructor does not create a DOM-node.
 
Method Summary
 Node createDOMSubtree(Document doc)
          create a DOM-textnode.
 void forwardToSibling(boolean insert, BiTree biTree, int offset, int length, int totalOffset)
          forward insert/remove to sibling not allowed at a TextNode.
 String getText()
          get the text of TextNode.
 BiType getType()
          get the type of node.
 void insert(BiTree biTree, int offset, int length, int totalOffset)
          insert characters in TextNode, always reparse parent node.
 void remove(BiTree biTree, int offset, int length, int totalOffset)
          remove characters in TextNode, always reparse parent node.
 TextPosition searchNode(Node node, int totalOffset)
          search a DOM node in this node. if nodes are equal return offset to begin of inputtext, else null
 String toString()
           
 String toString(int level)
          print biNode.
 
Methods inherited from class net.sourceforge.jeuclid.biparser.AbstractBiNode
addSibling, changeLengthRec, formatLength, getLength, getNode, getParent, getPrevious, getSibling, setLength, setNode, setPrevious, setSibling
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextNode

public TextNode(int length,
                String t)
creates a new TextNode, constructor does not create a DOM-node.

Parameters:
length - length of child
t - DOM-info
Method Detail

getType

public BiType getType()
get the type of node.

Returns:
TEXT

insert

public void insert(BiTree biTree,
                   int offset,
                   int length,
                   int totalOffset)
            throws ReparseException
insert characters in TextNode, always reparse parent node. insert characters to node.

Parameters:
biTree - reference to BiTree to which this node contains
offset - position to insert characters
length - number of characters to insert
totalOffset - offset of node to begin of text
Throws:
ReparseException - if a reparse at upper level is needed

remove

public void remove(BiTree biTree,
                   int offset,
                   int length,
                   int totalOffset)
            throws ReparseException
remove characters in TextNode, always reparse parent node. remove characters from node.

Parameters:
biTree - reference to BiTree to which this node contains
offset - position to remove characters
length - number of characters to remove
totalOffset - offset of node to begin of text
Throws:
ReparseException - if a reparse at upper level is needed

forwardToSibling

public void forwardToSibling(boolean insert,
                             BiTree biTree,
                             int offset,
                             int length,
                             int totalOffset)
                      throws ReparseException
forward insert/remove to sibling not allowed at a TextNode. helper method to insert or remove characters.

Specified by:
forwardToSibling in interface IBiNode
Overrides:
forwardToSibling in class AbstractBiNode
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
length - number of characters to insert/remove
totalOffset - offset of node to begin of text
Throws:
ReparseException - if a reparse at upper level is needed

getText

public String getText()
get the text of TextNode.

Returns:
text of TextNode

createDOMSubtree

public Node createDOMSubtree(Document doc)
create a DOM-textnode.

Parameters:
doc - Document to create DOM-tree
Returns:
DOM-textnode

searchNode

public TextPosition searchNode(Node node,
                               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
Overrides:
searchNode in class AbstractBiNode
Parameters:
node - DOM node to search for
totalOffset - offset of node to begin of inputtext
Returns:
position of node in inputtext

toString

public String toString()
Overrides:
toString in class Object

toString

public String toString(int level)
print biNode.

Parameters:
level - level of recursion tree
Returns:
biNode


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