OpenOffice.org
XMerge API

org.openoffice.xmerge.merger
Interface Iterator

All Known Implementing Classes:
NodeIterator, ObjectArrayIterator

public interface Iterator

This is an interface used by the DiffAlgorithm and MergeAlgorithm to access a Document.


Method Summary
 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.
 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.
 

Method Detail

currentElement

public java.lang.Object currentElement()
Return the current element Object content.
Returns:
The Object at current position.

elementCount

public int elementCount()
Return the total element count in the sequence.
Returns:
The total element count.

end

public java.lang.Object end()
Move to the end of the sequence.
Returns:
The Object of the last element in the sequence. If it is empty, then return null.

equivalent

public 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. 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.
Parameters:
obj1 - The first Object.
obj2 - The second Object.
Returns:
true if equal, false otherwise.

next

public java.lang.Object next()
Move to next element in the sequence.
Returns:
The Object of the next element in the sequence. If there is no next element, then return null.

previous

public java.lang.Object previous()
Move to previous element in the sequence.
Returns:
The Object of the previous element in the sequence. If there is no previous element, then return null.

refresh

public void refresh()

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.


start

public java.lang.Object start()
Move to the beginning of the sequence.
Returns:
The Object of the first element in the sequence. If it is empty, then return null.

OpenOffice.org
XMerge API

Copyright © 2002 OpenOffice.org