LibreOffice Module xmerge (master) 1
Public Member Functions | Private Attributes | List of all members
org.openoffice.xmerge.merger.diff.ObjectArrayIterator Class Reference

This is an implementation of the Iterator interface. More...

Inheritance diagram for org.openoffice.xmerge.merger.diff.ObjectArrayIterator:
[legend]
Collaboration diagram for org.openoffice.xmerge.merger.diff.ObjectArrayIterator:
[legend]

Public Member Functions

 ObjectArrayIterator (Object[] objArray)
 Standard constructor. More...
 
Object next ()
 Move to next element in the sequence. More...
 
Object previous ()
 
Object start ()
 Move to the beginning of the sequence. More...
 
Object end ()
 
Object currentElement ()
 Return the current element Object content. More...
 
void replace (Object object)
 Replace current Object. More...
 
void insert (Object object)
 Insert Object after current Object. More...
 
void append (Object object)
 Append Object after current Object. More...
 
void remove ()
 Remove current Object. More...
 
int elementCount ()
 Return the total element count in the sequence. More...
 
boolean equivalent (Object obj1, Object obj2)
 A method to allow the difference algorithm to test whether the obj1 and obj2 in the Iterator are considered equal. More...
 
void refresh ()
 A method to force the Iterator to traverse the tree again to refresh the content. More...
 
Object next ()
 Move to next element in the sequence. More...
 
Object start ()
 Move to the beginning of the sequence. More...
 
Object currentElement ()
 Return the current element Object content. More...
 
int elementCount ()
 Return the total element count in the sequence. More...
 
boolean equivalent (Object obj1, Object obj2)
 A method to allow the difference algorithm to test whether the obj1 and obj2 in the Iterator are considered equal. More...
 
void refresh ()
 A method to force the Iterator to traverse the tree again to refresh the content. More...
 

Private Attributes

Object[] objArray
 The Object array. More...
 
int currentPosition
 

Detailed Description

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.

Definition at line 30 of file ObjectArrayIterator.java.

Constructor & Destructor Documentation

◆ ObjectArrayIterator()

org.openoffice.xmerge.merger.diff.ObjectArrayIterator.ObjectArrayIterator ( Object[]  objArray)
inline

Standard constructor.

Parameters
objArrayThe Object array.

Definition at line 41 of file ObjectArrayIterator.java.

References org.openoffice.xmerge.merger.diff.ObjectArrayIterator.currentPosition, org.openoffice.xmerge.merger.diff.ObjectArrayIterator.objArray, Object, and System.

Member Function Documentation

◆ append()

void org.openoffice.xmerge.merger.diff.ObjectArrayIterator.append ( Object  object)
inline

Append Object after current Object.

Parameters
objectObject to append.

Definition at line 126 of file ObjectArrayIterator.java.

References org.openoffice.xmerge.merger.diff.ObjectArrayIterator.currentPosition, org.openoffice.xmerge.merger.diff.ObjectArrayIterator.objArray, Object, and System.

◆ currentElement()

Object org.openoffice.xmerge.merger.diff.ObjectArrayIterator.currentElement ( )
inline

◆ elementCount()

int org.openoffice.xmerge.merger.diff.ObjectArrayIterator.elementCount ( )
inline

Return the total element count in the sequence.

Returns
The total element count.

Implements org.openoffice.xmerge.merger.Iterator.

Definition at line 168 of file ObjectArrayIterator.java.

References org.openoffice.xmerge.merger.diff.ObjectArrayIterator.objArray.

◆ end()

Object org.openoffice.xmerge.merger.diff.ObjectArrayIterator.end ( )
inline

◆ equivalent()

boolean org.openoffice.xmerge.merger.diff.ObjectArrayIterator.equivalent ( Object  obj1,
Object  obj2 
)
inline

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
obj1The first Object
obj2The second Object.
Returns
true if equal, false otherwise.

Implements org.openoffice.xmerge.merger.Iterator.

Definition at line 172 of file ObjectArrayIterator.java.

◆ insert()

void org.openoffice.xmerge.merger.diff.ObjectArrayIterator.insert ( Object  object)
inline

Insert Object after current Object.

Parameters
objectObject to insert.

Definition at line 103 of file ObjectArrayIterator.java.

References org.openoffice.xmerge.merger.diff.ObjectArrayIterator.currentPosition, org.openoffice.xmerge.merger.diff.ObjectArrayIterator.objArray, Object, and System.

◆ next()

Object org.openoffice.xmerge.merger.diff.ObjectArrayIterator.next ( )
inline

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.

Implements org.openoffice.xmerge.merger.Iterator.

Definition at line 51 of file ObjectArrayIterator.java.

References org.openoffice.xmerge.merger.diff.ObjectArrayIterator.currentElement(), org.openoffice.xmerge.merger.diff.ObjectArrayIterator.currentPosition, org.openoffice.xmerge.merger.diff.ObjectArrayIterator.objArray, and Object.

◆ previous()

Object org.openoffice.xmerge.merger.diff.ObjectArrayIterator.previous ( )
inline

◆ refresh()

void org.openoffice.xmerge.merger.diff.ObjectArrayIterator.refresh ( )
inline

A method to force the Iterator to traverse the tree again to refresh the content.

It is used mainly for Iterator objects which take a snapshot instead of dynamically traversing the tree. The current position will be set to the beginning.

Implements org.openoffice.xmerge.merger.Iterator.

Definition at line 176 of file ObjectArrayIterator.java.

◆ remove()

void org.openoffice.xmerge.merger.diff.ObjectArrayIterator.remove ( )
inline

◆ replace()

void org.openoffice.xmerge.merger.diff.ObjectArrayIterator.replace ( Object  object)
inline

Replace current Object.

Parameters
objectObject to replace.

Definition at line 94 of file ObjectArrayIterator.java.

References org.openoffice.xmerge.merger.diff.ObjectArrayIterator.currentPosition, and org.openoffice.xmerge.merger.diff.ObjectArrayIterator.objArray.

◆ start()

Object org.openoffice.xmerge.merger.diff.ObjectArrayIterator.start ( )
inline

Move to the beginning of the sequence.

Returns
The Object of the first element in the sequence. If it is empty, then return null.

Implements org.openoffice.xmerge.merger.Iterator.

Definition at line 69 of file ObjectArrayIterator.java.

References org.openoffice.xmerge.merger.diff.ObjectArrayIterator.currentElement(), org.openoffice.xmerge.merger.diff.ObjectArrayIterator.currentPosition, and Object.

Member Data Documentation

◆ currentPosition

int org.openoffice.xmerge.merger.diff.ObjectArrayIterator.currentPosition
private

◆ objArray

Object [] org.openoffice.xmerge.merger.diff.ObjectArrayIterator.objArray
private

The documentation for this class was generated from the following file: