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

This is an implementation of the. More...

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

Public Member Functions

 NodeIterator (ConverterCapabilities cc, Node node)
 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. 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. More...
 
void refresh ()
 A method to force the. More...
 

Protected Member Functions

boolean compareNode (Node node1, Node node2)
 Used to compare two. More...
 
boolean childrenEqual (Node node1, Node node2)
 Compare the children of two. More...
 
abstract boolean nodeSupported (Node node)
 Check whether a. More...
 

Private Member Functions

boolean attributesEqual (Node node1, Node node2)
 Compare attributes of two. More...
 
void markTree (Node node)
 

Private Attributes

List< NodenodeList = null
 
int currentPosition = 0
 
final Node root
 
final ConverterCapabilities cc_
 

Detailed Description

This is an implementation of the.

Iterator

interface.

It will traverse the tree and find

sequences.

Note: Once the XML Tree is parsed, then the

Iterator

will be a snapshot of that tree. That means even the tree is modified later, then the cached paragraph

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.

Definition at line 44 of file NodeIterator.java.

Constructor & Destructor Documentation

org.openoffice.xmerge.merger.diff.NodeIterator.NodeIterator ( ConverterCapabilities  cc,
Node  node 
)
inline

Standard constructor.

Parameters
ccThe
ConverterCapabilities
.
nodeThe initial root .

Definition at line 57 of file NodeIterator.java.

References org.openoffice.xmerge.merger.diff.NodeIterator.markTree().

Member Function Documentation

boolean org.openoffice.xmerge.merger.diff.NodeIterator.attributesEqual ( Node  node1,
Node  node2 
)
inlineprivate

Compare attributes of two.

objects.

This method can be intentionally overridden by any class that extends from

so that it can have its own attribute comparison.

Parameters
node1The first to compare.
node2The second to compare.
Returns
true
if attributes are equal,
false
otherwise.

Definition at line 246 of file NodeIterator.java.

References org.openoffice.xmerge.ConverterCapabilities.canConvertAttribute(), equal(), i, org.openoffice.xmerge.util.Debug.INFO, org.openoffice.xmerge.util.Debug.log(), and String.

Referenced by org.openoffice.xmerge.merger.diff.NodeIterator.compareNode().

boolean org.openoffice.xmerge.merger.diff.NodeIterator.childrenEqual ( Node  node1,
Node  node2 
)
inlineprotected

Compare the children of two.

objects.

This method can be intentionally overridden by any class that extend from

so that it can have its own children comparison if necessary.

Parameters
node1The first to compare.
node2The second to compare.
Returns
true
if children are equal,
false
otherwise.

Definition at line 203 of file NodeIterator.java.

References org.openoffice.xmerge.merger.diff.NodeIterator.compareNode(), equal(), and i.

Referenced by org.openoffice.xmerge.merger.diff.NodeIterator.compareNode().

boolean org.openoffice.xmerge.merger.diff.NodeIterator.compareNode ( Node  node1,
Node  node2 
)
inlineprotected

Used to compare two.

objects (type/name/value) and all their children

objects.

Parameters
node1The first to compare.
node2The second to compare.
Returns
true
if is equal,
false
otherwise.

Definition at line 138 of file NodeIterator.java.

References org.openoffice.xmerge.merger.diff.NodeIterator.attributesEqual(), org.openoffice.xmerge.merger.diff.NodeIterator.childrenEqual(), and equal().

Referenced by org.openoffice.xmerge.merger.diff.NodeIterator.childrenEqual(), and org.openoffice.xmerge.merger.diff.NodeIterator.equivalent().

Object org.openoffice.xmerge.merger.diff.NodeIterator.currentElement ( )
inline
int org.openoffice.xmerge.merger.diff.NodeIterator.elementCount ( )
inline

Return the total element count in the sequence.

Returns
The total element count.

Implements org.openoffice.xmerge.merger.Iterator.

Definition at line 105 of file NodeIterator.java.

Object org.openoffice.xmerge.merger.diff.NodeIterator.end ( )
inline
boolean org.openoffice.xmerge.merger.diff.NodeIterator.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

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

Implements org.openoffice.xmerge.merger.Iterator.

Definition at line 109 of file NodeIterator.java.

References org.openoffice.xmerge.merger.diff.NodeIterator.compareNode(), equal(), org.openoffice.xmerge.util.Debug.ERROR, org.openoffice.xmerge.util.Resources.getInstance(), org.openoffice.xmerge.util.Resources.getString(), org.openoffice.xmerge.util.Debug.log(), and String.

void org.openoffice.xmerge.merger.diff.NodeIterator.markTree ( Node  node)
inlineprivate
Object org.openoffice.xmerge.merger.diff.NodeIterator.next ( )
inline

Move to next element in the sequence.

Returns
The 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 64 of file NodeIterator.java.

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

Referenced by org.openoffice.xmerge.merger.diff.CharacterParser.parseNodes().

abstract boolean org.openoffice.xmerge.merger.diff.NodeIterator.nodeSupported ( Node  node)
abstractprotected

Check whether a.

is supported.

This method can be intentionally overridden by any class that extends from

so that it can specify which

to support.

Parameters
node

Referenced by org.openoffice.xmerge.merger.diff.NodeIterator.markTree().

Object org.openoffice.xmerge.merger.diff.NodeIterator.previous ( )
inline
void org.openoffice.xmerge.merger.diff.NodeIterator.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 123 of file NodeIterator.java.

References org.openoffice.xmerge.merger.diff.NodeIterator.markTree().

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

Move to the beginning of the sequence.

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

Implements org.openoffice.xmerge.merger.Iterator.

Definition at line 82 of file NodeIterator.java.

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

Referenced by org.openoffice.xmerge.merger.diff.CharacterParser.parseNodes().

Member Data Documentation

final ConverterCapabilities org.openoffice.xmerge.merger.diff.NodeIterator.cc_
private

Definition at line 49 of file NodeIterator.java.

int org.openoffice.xmerge.merger.diff.NodeIterator.currentPosition = 0
private

Definition at line 47 of file NodeIterator.java.

List<Node> org.openoffice.xmerge.merger.diff.NodeIterator.nodeList = null
private

Definition at line 46 of file NodeIterator.java.

final Node org.openoffice.xmerge.merger.diff.NodeIterator.root
private

Definition at line 48 of file NodeIterator.java.


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