Package com.inet.html
Class InetHtmlDocument.ElementEditBuffer
java.lang.Object
com.inet.html.InetHtmlDocument.ElementEditBuffer
- Enclosing class:
- InetHtmlDocument
Extension of the java.text way to store the adds and removes in two arrays.
This class has the ability to gather all element changes on one parent. It supports
to sort the elements stored in the remove or add lists and to calculate the effective
start and end offset of the modification.
-
Constructor Summary
ConstructorsConstructorDescriptionElementEditBuffer(Element parent, int index, Element[] removes, Element[] adds) Creates an element edit buffer based on the data of the first modification on an element -
Method Summary
Modifier and TypeMethodDescriptionvoidRegister a further added elementbooleanRegister a further removeElement[]Returns the added elements as an arrayElement[]Returns the removed elements as an arrayReturns the parent elementConstructs anAbstractDocument.ElementEditfrom the registered adds and removesintCalculates the end offset based on the added and removed elementsintgetIndex()Returns the modification indexintCalculates the start offset based on the added and removed elementsvoidsetIndex(int index) Sets the modification indextoString()
-
Constructor Details
-
ElementEditBuffer
Creates an element edit buffer based on the data of the first modification on an element- Parameters:
parent- the element whose children will be exchangedindex- the index within the children where the modification startsremoves- the removed elementsadds- the inserted elements
-
-
Method Details
-
getChildrenAdded
Returns the added elements as an array- Returns:
- the added elements as an array
-
getChildrenRemoved
Returns the removed elements as an array- Returns:
- the removed elements as an array
-
getElement
Returns the parent element- Returns:
- the parent element
-
getIndex
public int getIndex()Returns the modification index- Returns:
- the modification index
-
setIndex
public void setIndex(int index) Sets the modification index- Parameters:
index- the index where the first removed or inserted element is located within the children of the parent element
-
addRemove
Register a further remove- Parameters:
e- a child of the parent element, which was removed- Returns:
- true, if the element was present in the added list. Which means an element which was created by the current parser run was removed. If false the element was not present as added element
-
addAdd
Register a further added element- Parameters:
e- a child which was added to the parents children-list
-
getElementEdit
Constructs anAbstractDocument.ElementEditfrom the registered adds and removes- Returns:
- the created edit info
-
toString
-
getStartOffset
public int getStartOffset()Calculates the start offset based on the added and removed elements- Returns:
- the start offset based on the added and removed elements
-
getEndOffset
public int getEndOffset()Calculates the end offset based on the added and removed elements- Returns:
- the end offset based on the added and removed elements
-