OpenOffice.org
XMerge API

org.openoffice.xmerge.merger
Class Difference

java.lang.Object
  |
  +--org.openoffice.xmerge.merger.Difference

public final class Difference
extends java.lang.Object

This is the Difference basic unit. Used by the DiffAlgorithm as a set of difference between two Iterators (the original and modified Iterators).


Field Summary
static int ADD
          Add operation.
static int CHANGE
          Change operation.
static int DELETE
          Delete operation.
static int UNCHANGE
          Unchange operation (i.e.
 
Constructor Summary
Difference(int operation, int orgPosition, int modPosition)
          Constructor.
 
Method Summary
 java.lang.String debug()
          Display debug information.
 boolean equals(java.lang.Object obj)
          Two Difference objects will equal if and only if all operation, orgPosition, modPosition and content are equal.
 int getModPosition()
          Get the modified Iterator position.
 int getOperation()
          Get the operation of the Difference.
 int getOrgPosition()
          Get the original Iterator position.
 java.lang.String toString()
          Returns position and operation values as a single string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ADD

public static final int ADD
Add operation.

CHANGE

public static final int CHANGE
Change operation.

DELETE

public static final int DELETE
Delete operation.

UNCHANGE

public static final int UNCHANGE
Unchange operation (i.e. no change).
Constructor Detail

Difference

public Difference(int operation,
                  int orgPosition,
                  int modPosition)
Constructor. This is the standard way to create a Difference object.
Parameters:
operation - Either ADD or DELETE.
orgPosition - The position in the original (first) Iterator.
modPosition - The position in the modified (second) Iterator.
Method Detail

debug

public java.lang.String debug()
Display debug information.
Returns:
Debug string.

equals

public boolean equals(java.lang.Object obj)
Two Difference objects will equal if and only if all operation, orgPosition, modPosition and content are equal.
Overrides:
equals in class java.lang.Object
Parameters:
obj - Object to compare.
Returns:
true if equal, false otherwise.

getModPosition

public int getModPosition()
Get the modified Iterator position.
Returns:
The position in the modified (second) Iterator

getOperation

public int getOperation()
Get the operation of the Difference.
Returns:
the operation of the Difference, either ADD or DELETE

getOrgPosition

public int getOrgPosition()
Get the original Iterator position.
Returns:
The position in the original (first) Iterator

toString

public java.lang.String toString()
Returns position and operation values as a single string.
Overrides:
toString in class java.lang.Object
Returns:
orgPosition, modPosition and operation as a single string.

OpenOffice.org
XMerge API

Copyright © 2002 OpenOffice.org