|
OpenOffice.org XMerge API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openoffice.xmerge.merger.diff.NodeIterator
This is an implementation of the Iterator
interface.
It will traverse the tree and find Node
sequences.
Note: Once the XML Tree is parsed, then the Iterator
will
be a snap shot of that tree. That means even the tree is modified later,
than the cached paragraph Node
list will not be updated
accordingly. For this reason and for performance reasons this
Iterator
does not support any operation methods such as
insert, remove or replace. The main purpose of this
Iterator
is to be used with difference, not with merge.
Constructor Summary | |
NodeIterator(ConverterCapabilities cc,
org.w3c.dom.Node node)
Standard constructor. |
Method Summary | |
protected boolean |
attributesEqual(org.w3c.dom.Node node1,
org.w3c.dom.Node node2)
Compare attributes of two Node objects. |
protected boolean |
childrenEqual(org.w3c.dom.Node node1,
org.w3c.dom.Node node2)
Compare the children of two Node objects. |
protected boolean |
compareNode(org.w3c.dom.Node node1,
org.w3c.dom.Node node2)
Used to compare two Node objects (type/name/value)
and all their children Node objects. |
java.lang.Object |
currentElement()
Return the current element Object content. |
int |
elementCount()
Return the total element count in the sequence. |
java.lang.Object |
end()
Move to the end of the sequence. |
boolean |
equivalent(java.lang.Object obj1,
java.lang.Object obj2)
A method to allow the difference algorithm to test whether the obj1 and obj2 in the
Iterator are considered equal. |
java.lang.Object |
next()
Move to next element in the sequence. |
protected abstract boolean |
nodeSupported(org.w3c.dom.Node node)
Check whether a Node is supported. |
java.lang.Object |
previous()
Move to previous element in the sequence. |
void |
refresh()
A method to force the Iterator to transverse the tree
again to refresh the content. |
java.lang.Object |
start()
Move to the beginning of the sequence. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public NodeIterator(ConverterCapabilities cc, org.w3c.dom.Node node)
cc
- The ConverterCapabilities
.node
- The initial root Node
.Method Detail |
protected boolean attributesEqual(org.w3c.dom.Node node1, org.w3c.dom.Node node2)
Node
objects. This
method can be intentionally overridden by any class that
extends from NodeIterator
so that it can have
its own attribute comparison.node1
- The first Node
to compare.node2
- The second Node
to compare.protected boolean childrenEqual(org.w3c.dom.Node node1, org.w3c.dom.Node node2)
Node
objects. This
method can be intentionally overridden by any class that
extend from NodeIterator
so that it can have
its own children comparison if necessary.node1
- The first Node
to compare.node2
- The second Node
to compare.protected boolean compareNode(org.w3c.dom.Node node1, org.w3c.dom.Node node2)
Node
objects (type/name/value)
and all their children Node
objects.node1
- The first Node
to compare.node2
- The second Node
to compare.Node
is equal, false otherwise.public java.lang.Object currentElement()
Iterator
Object
content.currentElement
in interface Iterator
org.openoffice.xmerge.merger.Iterator
Object
at current position.public int elementCount()
Iterator
elementCount
in interface Iterator
org.openoffice.xmerge.merger.Iterator
public java.lang.Object end()
Iterator
end
in interface Iterator
org.openoffice.xmerge.merger.Iterator
Object
of the last element in the sequence.
If it is empty, then return null.public boolean equivalent(java.lang.Object obj1, java.lang.Object obj2)
Iterator
obj1
and obj2
in the
Iterator
are considered equal. As not every
Object
in the Iterator
can implement its
own equal method, with this equivalent method, we can allow
flexibility for the Iterator
to choose a custom way
to compare two objects. Two objects can even be compared based on
the position in the Iterator
rather than by
the content via this option.equivalent
in interface Iterator
org.openoffice.xmerge.merger.Iterator
obj1
- The first Object
.obj2
- The second Object
.public java.lang.Object next()
Iterator
next
in interface Iterator
org.openoffice.xmerge.merger.Iterator
Object
of the next element in the sequence.
If there is no next element, then return null.protected abstract boolean nodeSupported(org.w3c.dom.Node node)
Node
is supported. This method
can be intentionally overridden by any class that extends from
NodeIterator
so that it can specify which
Node
to support.node
- Node
to check.Node
is supported, false otherwise.public java.lang.Object previous()
Iterator
previous
in interface Iterator
org.openoffice.xmerge.merger.Iterator
Object
of the previous element in the sequence.
If there is no previous element, then return null.public void refresh()
Iterator
A method to force the Iterator
to transverse the tree
again to refresh the content.
It is used mainly for Iterator
objects which take a snap
shot instead of dynamically transversing the tree. The current
position will be set to the beginning.
refresh
in interface Iterator
public java.lang.Object start()
Iterator
start
in interface Iterator
org.openoffice.xmerge.merger.Iterator
Object
of the first element in the sequence.
If it is empty, then return null.
|
OpenOffice.org XMerge API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |