OpenOffice.org
XMerge API

org.openoffice.xmerge.merger.diff
Class ObjectArrayIterator

java.lang.Object
  |
  +--org.openoffice.xmerge.merger.diff.ObjectArrayIterator
All Implemented Interfaces:
Iterator

public final class ObjectArrayIterator
extends java.lang.Object
implements Iterator

This is an implementation of the Iterator interface. It is based upon a simple Object array.

Note: this class is not thread safe for performance reasons.


Constructor Summary
ObjectArrayIterator(java.lang.Object[] objArray)
          Standard constructor.
 
Method Summary
 void append(java.lang.Object object)
          Append Object after current Object.
 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.
 void insert(java.lang.Object object)
          Insert Object after current Object.
 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.
 void remove()
          Remove current Object.
 void replace(java.lang.Object object)
          Replace current Object.
 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

ObjectArrayIterator

public ObjectArrayIterator(java.lang.Object[] objArray)
Standard constructor.
Parameters:
objArray - The Object array.
Method Detail

append

public void append(java.lang.Object object)
Append Object after current Object.
Parameters:
object - Object to append.

currentElement

public java.lang.Object currentElement()
Description copied from interface: Iterator
Return the current element Object content.
Specified by:
currentElement in interface Iterator
Following copied from interface: org.openoffice.xmerge.merger.Iterator
Returns:
The Object at current position.

elementCount

public int elementCount()
Description copied from interface: Iterator
Return the total element count in the sequence.
Specified by:
elementCount in interface Iterator
Following copied from interface: org.openoffice.xmerge.merger.Iterator
Returns:
The total element count.

end

public java.lang.Object end()
Description copied from interface: Iterator
Move to the end of the sequence.
Specified by:
end in interface Iterator
Following copied from interface: org.openoffice.xmerge.merger.Iterator
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)
Description copied from interface: Iterator
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.
Specified by:
equivalent in interface Iterator
Following copied from interface: org.openoffice.xmerge.merger.Iterator
Parameters:
obj1 - The first Object.
obj2 - The second Object.
Returns:
true if equal, false otherwise.

insert

public void insert(java.lang.Object object)
Insert Object after current Object.
Parameters:
object - Object to insert.

next

public java.lang.Object next()
Description copied from interface: Iterator
Move to next element in the sequence.
Specified by:
next in interface Iterator
Following copied from interface: org.openoffice.xmerge.merger.Iterator
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()
Description copied from interface: Iterator
Move to previous element in the sequence.
Specified by:
previous in interface Iterator
Following copied from interface: org.openoffice.xmerge.merger.Iterator
Returns:
The Object of the previous element in the sequence. If there is no previous element, then return null.

refresh

public void refresh()
Description copied from interface: 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.

Specified by:
refresh in interface Iterator

remove

public void remove()
Remove current Object.

replace

public void replace(java.lang.Object object)
Replace current Object.
Parameters:
object - Object to replace.

start

public java.lang.Object start()
Description copied from interface: Iterator
Move to the beginning of the sequence.
Specified by:
start in interface Iterator
Following copied from interface: org.openoffice.xmerge.merger.Iterator
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