summaryrefslogtreecommitdiff
path: root/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff
diff options
context:
space:
mode:
Diffstat (limited to 'xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff')
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CellNodeIterator.java40
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharArrayLCSAlgorithm.java74
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharacterParser.java46
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorLCSAlgorithm.java62
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorRowCompare.java62
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/NodeIterator.java101
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ObjectArrayIterator.java40
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ParaNodeIterator.java40
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/RowIterator.java26
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeEntry.java34
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeIterator.java40
11 files changed, 260 insertions, 305 deletions
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CellNodeIterator.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CellNodeIterator.java
index 9e7eb332d6a5..3d2dfc144d77 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CellNodeIterator.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CellNodeIterator.java
@@ -24,18 +24,17 @@ import org.w3c.dom.Element;
import org.openoffice.xmerge.ConverterCapabilities;
import org.openoffice.xmerge.converter.xml.OfficeConstants;
-
/**
- * <p>This is an implementations of the <code>Iterator</code> interface.
- * It will traverse the tree and find cell <code>Node</code> sequences.</p>
+ * This is an implementations of the {@code Iterator} interface.
+ *
+ * <p>It will traverse the tree and find cell {@code Node} sequences.</p>
*
- * <p>Note: Once the XML Tree is parsed, then the <code>Iterator</code>
- * will be a snap shot of that tree. That means even the tree is
- * modified later, than the cached paragraph <code>Node</code> list will
- * not be updated accordingly. For this reason and for performance reasons
- * this <code>Iterator</code> does not support any operation methods such
- * as insert, remove or replace. The main purpose of this
- * <code>Iterator</code> is to be used with difference, not with merge.</p>
+ * <p>Note: Once the XML Tree is parsed, then the {@code Iterator} will be a
+ * snap shot of that tree. That means even the tree is modified later, than the
+ * cached paragraph {@code Node} list will not be updated accordingly. For this
+ * reason and for performance reasons this {@code Iterator} does not support any
+ * operation methods such as insert, remove or replace. The main purpose of this
+ * {@code Iterator} is to be used with difference, not with merge.</p>
*/
public final class CellNodeIterator extends NodeIterator {
@@ -43,23 +42,24 @@ public final class CellNodeIterator extends NodeIterator {
private static final String SUPPORTED_TAG1 = OfficeConstants.TAG_TABLE_CELL;
/**
- * The standard constructor.
+ * The standard constructor.
*
- * @param cc The <code>ConverterCapabilities</code>.
- * @param node The initial root <code>Node</code>.
+ * @param cc The {@code ConverterCapabilities}.
+ * @param node The initial root {@code Node}.
*/
public CellNodeIterator(ConverterCapabilities cc, Node node) {
super(cc, node);
}
-
/**
- * Overwrite the parent <code>nodeSupported</code> method. Only cell
- * <code>Node</code> objects are supported.
+ * Overwrite the parent {@code nodeSupported} method.
*
- * @param node The <code>Node</code> to check.
+ * <p>Only cell {@code Node} objects are supported.</p>
*
- * @return true if the <code>Node</code> is supported, false otherwise.
+ * @param node The {@code Node} to check.
+ *
+ * @return {@code true} if the {@code Node} is supported, {@code false}
+ * otherwise.
*/
@Override
protected boolean nodeSupported(Node node) {
@@ -70,7 +70,6 @@ public final class CellNodeIterator extends NodeIterator {
node.getNodeName().equals(SUPPORTED_TAG1);
}
-
@Override
protected boolean childrenEqual(Node node1, Node node2) {
@@ -94,5 +93,4 @@ public final class CellNodeIterator extends NodeIterator {
return equal;
}
-}
-
+} \ No newline at end of file
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharArrayLCSAlgorithm.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharArrayLCSAlgorithm.java
index 6f558e00bf84..1501bd3f3556 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharArrayLCSAlgorithm.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharArrayLCSAlgorithm.java
@@ -22,24 +22,25 @@ import java.util.ArrayList;
import org.openoffice.xmerge.merger.Difference;
/**
- * <p>This is an implementations of <code>DiffAlgorithm</code> interface
- * which will difference char arrays.</p>
+ * This is an implementations of {@code DiffAlgorithm} interface which will
+ * difference char arrays.
*
- * <p>It also use Longest Common Subsequence (LCS). The algorithm is based
- * on the book "Introduction to Algorithms" by Thomas H.Cormen,
- * Charles E.Leiserson, and Ronald L.Riverst (MIT Press 1990) page 314.</p>
+ * <p>It also use Longest Common Subsequence (LCS). The algorithm is based on
+ * the book "Introduction to Algorithms" by Thomas H.Cormen, Charles E.Leiserson,
+ * and Ronald L.Riverst (MIT Press 1990) page 314.</p>
*/
public class CharArrayLCSAlgorithm {
/**
- * Return an <code>Difference</code> array. This method finds out
- * the difference between two sequences.
+ * Return an {@code Difference} array.
*
- * @param orgSeq The original sequence.
- * @param modSeq The modified (or changed) sequence to
- * compare against the origial.
+ * <p>This method finds out the difference between two sequences.</p>
*
- * @return A <code>Difference</code> array.
+ * @param orgSeq The original sequence.
+ * @param modSeq The modified (or changed) sequence to compare against
+ * the original.
+ *
+ * @return A {@code Difference} array.
*/
public Difference[] computeDiffs(char[] orgSeq, char[] modSeq) {
@@ -72,15 +73,15 @@ public class CharArrayLCSAlgorithm {
}
/**
- * Create the difference table.
- * The difference table is used internal to keep track what
- * elements are common or different in the two sequences.
+ * Create the difference table.
+ *
+ * <p>The difference table is used internal to keep track what elements are
+ * common or different in the two sequences.</p>
*
- * @param orgSeq The original sequence to be used as a base.
- * @param modSeq The modified sequence to compare.
+ * @param orgSeq The original sequence to be used as a base.
+ * @param modSeq The modified sequence to compare.
*
- * @return A difference table as a two-dimensional array of
- * integers.
+ * @return A difference table as a two-dimensional array of integers.
*/
private int[][] createDiffTable(char[] orgSeq, char[] modSeq) {
int orgSeqlen = orgSeq.length + 1;
@@ -114,27 +115,25 @@ public class CharArrayLCSAlgorithm {
return diffTable;
}
-
/**
- * Generate the <code>Difference</code> result vector.
- * This method will be called recursively to backtrack the difference
- * table to get the difference result (and also the LCS).
+ * Generate the {@code Difference} result vector.
*
- * @param diffTable The difference table containing the
- * <code>Difference</code> result.
- * @param i The nth element in original sequence to
- * compare. This method is called recursively
- * with i and j decreased until 0.
- * @param j The nth element in modified sequence to
- * compare.
- * @param diffVector A vector to output the <code>Difference</code>
- * result. Can not use a return variable as it
- * is a recursive method. The vector will contain
- * <code>Difference</code> objects with operation
- * and positions filled in.
+ * <p>This method will be called recursively to backtrack the difference
+ * table to get the difference result (and also the LCS).</p>
+ *
+ * @param diffTable The difference table containing the {@code Difference}
+ * result.
+ * @param i The nth element in original sequence to compare. This
+ * method is called recursively with {@code i} and
+ * {@code j} decreased until {@code 0}.
+ * @param j The nth element in modified sequence to compare.
+ * @param diffVector A vector to output the {@code Difference} result.
+ * Can not use a return variable as it is a recursive
+ * method. The vector will contain {@code Difference}
+ * objects with operation and positions filled in.
*/
- private void generateResult(int[][] diffTable,
- int i, int j, ArrayList<Difference> diffVector) {
+ private void generateResult(int[][] diffTable, int i, int j,
+ ArrayList<Difference> diffVector) {
// handle the first element
if (i == 0 || j == 0) {
@@ -195,5 +194,4 @@ public class CharArrayLCSAlgorithm {
}
}
}
-}
-
+} \ No newline at end of file
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharacterParser.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharacterParser.java
index 258401e4135b..8b634ae821c1 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharacterParser.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharacterParser.java
@@ -25,20 +25,20 @@ import org.openoffice.xmerge.converter.xml.OfficeConstants;
import java.util.ArrayList;
import java.util.List;
-
/**
- * <p>This is a parser to return a character array for difference purpose.
- * It will use depth first search to traverse all the characters inside the
- * text <code>Node</code> under a given <code>Node</code> (most likely to be
- * a paragraph <code>Node</code>).</p>
+ * This is a parser to return a character array for difference purpose.
+ *
+ * <p>It will use depth first search to traverse all the characters inside the
+ * text {@code Node} under a given {@code Node} (most likely to be a paragraph
+ * {@code Node}).</p>
*
- * <p>Note: Once the XML Tree is parsed, then the <code>Iterator</code> will be
- * a snap shot of that tree. That means even the tree is modified later, than
- * the cached paragraph <code>Node</code> list will not be updated accordingly.
- * For this reason and for performance reasons this <code>Iterator</code> does
- * not support any operation methods such as insert, remove or replace. The
- * main purpose of this <code>Iterator</code> is to be used with difference,
- * not with merge.</p>
+ * <p>Note: Once the XML Tree is parsed, then the {@code Iterator} will be a
+ * snap shot of that tree. That means even the tree is modified later, than
+ * the cached paragraph {@code Node} list will not be updated accordingly. For
+ * this reason and for performance reasons this {@code Iterator} does not
+ * support any operation methods such as insert, remove or replace. The main
+ * purpose of this {@code Iterator} is to be used with difference, not with
+ * merge.</p>
*/
public class CharacterParser {
@@ -47,11 +47,10 @@ public class CharacterParser {
private List<TextNodeEntry> nodeList_ = null;
private char[] charArray;
-
/**
- * Standard constructor.
+ * Standard constructor.
*
- * @param node The initial root <code>Node</code>.
+ * @param node The initial root {@code Node}.
*/
public CharacterParser(Node node) {
textNodes = new TextNodeIterator(node);
@@ -60,11 +59,10 @@ public class CharacterParser {
parseNodes();
}
-
/**
- * Returns the <code>Node</code> pointer with the given character position.
+ * Returns the {@code Node} pointer with the given character position.
*
- * @return The <code>Node</code> pointer with the given character position.
+ * @return The {@code Node} pointer with the given character position.
*/
public List<TextNodeEntry> getNodeList() {
// will go through the nodeList to find the corresponding node
@@ -112,20 +110,18 @@ public class CharacterParser {
charArray = strBuf.toString().toCharArray();
}
-
/**
- * Adds a new <code>Node</code> entry.
+ * Adds a new {@code Node} entry.
*
- * @param textLen The text length.
- * @param node The <code>Node</code>.
+ * @param textLen The text length.
+ * @param node The {@code Node}.
*/
private void addNewNodeEntry(int textLen, Node node) {
TextNodeEntry nodeEntry = new TextNodeEntry(currentPosition,
currentPosition + textLen - 1, node);
- currentPosition = currentPosition + textLen;
+ currentPosition = currentPosition + textLen;
nodeList_.add(nodeEntry);
}
-}
-
+} \ No newline at end of file
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorLCSAlgorithm.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorLCSAlgorithm.java
index c7959be59225..909b6f50d4b2 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorLCSAlgorithm.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorLCSAlgorithm.java
@@ -25,10 +25,11 @@ import org.openoffice.xmerge.merger.Iterator;
import org.openoffice.xmerge.util.Debug;
/**
- * This is one of the implementations of <code>DiffAlgorithm</code> interface.
- * Using Longest Common Subsequence (LCS). The algorithm here is based
- * on the book "Introduction to Algorithms" by Thomas H.Cormen,
- * Charles E.Leiserson and Ronald L.Riverst (MIT Press 1990) page 314.
+ * This is one of the implementations of {@code DiffAlgorithm} interface.
+ *
+ * <p>Using Longest Common Subsequence (LCS). The algorithm here is based on the
+ * book "Introduction to Algorithms" by Thomas H.Cormen, Charles E.Leiserson and
+ * Ronald L.Riverst (MIT Press 1990) page 314.</p>
*/
public class IteratorLCSAlgorithm implements DiffAlgorithm {
@@ -67,12 +68,10 @@ public class IteratorLCSAlgorithm implements DiffAlgorithm {
return diffArray;
}
-
/**
- * Debug function used to print out the nicely formatted
- * difference table.
+ * Debug function used to print out the nicely formatted difference table.
*
- * @param diffTable The difference table to display.
+ * @param diffTable The difference table to display.
*/
private void printDiffTable(int[][] diffTable) {
@@ -88,15 +87,15 @@ public class IteratorLCSAlgorithm implements DiffAlgorithm {
}
/**
- * Create the difference table.
- * The difference table is used internal to keep track what
- * elements are common or different in the two sequences.
+ * Create the difference table.
+ *
+ * <p>The difference table is used internal to keep track what elements are
+ * common or different in the two sequences.</p>
*
- * @param orgSeq The original sequence to be used as a base.
- * @param modSeq The modified sequence to compare.
+ * @param orgSeq The original sequence to be used as a base.
+ * @param modSeq The modified sequence to compare.
*
- * @return A difference table as a two-dimensional array of
- * integers.
+ * @return A difference table as a two-dimensional array of integers.
*/
private int[][] createDiffTable(Iterator orgSeq, Iterator modSeq) {
int orgSeqlen = orgSeq.elementCount() + 1;
@@ -139,24 +138,22 @@ public class IteratorLCSAlgorithm implements DiffAlgorithm {
return diffTable;
}
-
/**
- * Generate the <code>Difference</code> object result vector.
- * This method will be called recursively to backtrack the difference
- * table to get the difference result (and also the LCS).
+ * Generate the {@code Difference} object result vector.
+ *
+ * <p>This method will be called recursively to backtrack the difference
+ * table to get the difference result (and also the LCS).</p>
*
- * @param diffTable The difference table containing the
- * <code>Difference</code> result.
- * @param i The nth element in original sequence to
- * compare. This method is called recursively
- * with i and j decreased until 0.
- * @param j The nth element in modified sequence to
- * compare.
- * @param diffVector A vector to output the <code>Difference</code>
- * result. Can not use a return variable as it
- * is a recursive method. The vector will contain
- * <code>Difference</code> objects with operation
- * and positions fill in.
+ * @param diffTable The difference table containing the {@code Difference}
+ * result.
+ * @param i The nth element in original sequence to compare. This
+ * method is called recursively with {@code i} and
+ * {@code j} decreased until {@code 0}.
+ * @param j The nth element in modified sequence to compare.
+ * @param diffVector A vector to output the {@code Difference} result.
+ * Can not use a return variable as it is a recursive
+ * method. The vector will contain {@code Difference}
+ * objects with operation and positions fill in.
*/
private void generateResult(int[][] diffTable,
int i, int j, ArrayList<Difference> diffVector) {
@@ -221,5 +218,4 @@ public class IteratorLCSAlgorithm implements DiffAlgorithm {
}
}
}
-}
-
+} \ No newline at end of file
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorRowCompare.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorRowCompare.java
index 746709840e28..f2689d1d83a4 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorRowCompare.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorRowCompare.java
@@ -28,30 +28,30 @@ import org.openoffice.xmerge.merger.Iterator;
import org.openoffice.xmerge.converter.xml.OfficeConstants;
/**
- * A very simple and direct difference algorithm for row
- * <code>Node</code> objects in a spreadsheet.
+ * A very simple and direct difference algorithm for row {@code Node} objects in
+ * a spreadsheet.
*
- * <p>Basically, it will compare objects in sequence and does not look ahead
- * (unlike LCS).</p>
+ * <p>Basically, it will compare objects in sequence and does not look ahead
+ * (unlike LCS).</p>
*
- * <ol>
- * <li>
- * If two objects are the same, skip to next one.
- * </li><li>
- * Otherwise check whether the row repeated attribute is the same.
- * </li><li>
- * If the row repeated attribute is the same, then compare two rows
- * and mark it as <i>change</i> if those rows are different.
- * </li><li>
- * If the row repeated attribute is different, then split the rows and
- * continue to compare.
- * </li><li>
- * If there are more objects in the modseq than the original sequence,
- * then all of the extra ones in the modified sequence are marked as add.
+ * <ol>
+ * <li>
+ * If two objects are the same, skip to next one.
+ * </li><li>
+ * Otherwise check whether the row repeated attribute is the same.
+ * </li><li>
+ * If the row repeated attribute is the same, then compare two rows and mark
+ * it as <i>change</i> if those rows are different.
+ * </li><li>
+ * If the row repeated attribute is different, then split the rows and
+ * continue to compare.
+ * </li><li>
+ * If there are more objects in the modseq than the original sequence, then
+ * all of the extra ones in the modified sequence are marked as add.
* </li><li>
* If there are more objects in the original sequence than the modified
- * sequence, then all the extra one in the modified sequence are marked
- * as delete.
+ * sequence, then all the extra one in the modified sequence are marked as
+ * delete.
* </li>
* </ol>
*
@@ -61,17 +61,18 @@ import org.openoffice.xmerge.converter.xml.OfficeConstants;
public class IteratorRowCompare implements DiffAlgorithm {
/**
- * Compute the differences of the given two sequences.
- * Refer to the class description.
+ * Compute the differences of the given two sequences.
*
- * Return an array of <code>Difference</code> objects. This method finds
- * out the difference between two sequences.
+ * <p>Refer to the class description.</p>
*
- * @param orgSeq The original sequence.
- * @param modSeq The modified (or changed) sequence to
- * compare against with the origial.
+ * <p>Return an array of {@code Difference} objects. This method finds out
+ * the difference between two sequences.</p>
*
- * @return An array of Difference objects.
+ * @param orgSeq The original sequence.
+ * @param modSeq The modified (or changed) sequence to compare against
+ * with the original.
+ *
+ * @return An array of Difference objects.
*/
public Difference[] computeDiffs(Iterator orgSeq, Iterator modSeq) {
@@ -190,7 +191,6 @@ public class IteratorRowCompare implements DiffAlgorithm {
modSeq.refresh();
}
-
// convert the vector to array
Difference[] diffArray = new Difference[diffVector.size()];
diffVector.toArray(diffArray);
@@ -198,7 +198,6 @@ public class IteratorRowCompare implements DiffAlgorithm {
return diffArray;
}
-
private Element splitRepeatedRow(Element orgRow, int splitNum, int orgNum) {
// NOTE: should we really want to do deep clone?
// in most the case, it is an empty Row, but the
@@ -229,5 +228,4 @@ public class IteratorRowCompare implements DiffAlgorithm {
return splitRow;
}
-}
-
+} \ No newline at end of file
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/NodeIterator.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/NodeIterator.java
index 5a27ff05fa71..ed34c337f1ac 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/NodeIterator.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/NodeIterator.java
@@ -29,18 +29,17 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-
/**
- * <p>This is an implementation of the <code>Iterator</code> interface.
- * It will traverse the tree and find <code>Node</code> sequences.</p>
+ * This is an implementation of the {@code Iterator} interface.
+ *
+ * <p>It will traverse the tree and find {@code Node} sequences.</p>
*
- * <p>Note: Once the XML Tree is parsed, then the <code>Iterator</code> will
- * be a snap shot of that tree. That means even the tree is modified later,
- * than the cached paragraph <code>Node</code> list will not be updated
- * accordingly. For this reason and for performance reasons this
- * <code>Iterator</code> does not support any operation methods such as
- * insert, remove or replace. The main purpose of this
- * <code>Iterator</code> is to be used with difference, not with merge.</p>
+ * <p>Note: Once the XML Tree is parsed, then the {@code Iterator} will be a
+ * snap shot of that tree. That means even the tree is modified later, than the
+ * cached paragraph {@code Node} list will not be updated accordingly. For this
+ * reason and for performance reasons this {@code Iterator} does not support any
+ * operation methods such as insert, remove or replace. The main purpose of this
+ * {@code Iterator} is to be used with difference, not with merge.</p>
*/
public abstract class NodeIterator implements Iterator {
@@ -49,12 +48,11 @@ public abstract class NodeIterator implements Iterator {
private Node root;
private ConverterCapabilities cc_ = null;
-
/**
- * Standard constructor.
+ * Standard constructor.
*
- * @param cc The <code>ConverterCapabilities</code>.
- * @param node The initial root <code>Node</code>.
+ * @param cc The {@code ConverterCapabilities}.
+ * @param node The initial root {@code Node}.
*/
public NodeIterator(ConverterCapabilities cc, Node node) {
cc_ = cc;
@@ -63,7 +61,6 @@ public abstract class NodeIterator implements Iterator {
markTree(node);
}
-
public Object next() {
if (currentPosition < nodeList.size() - 1) {
currentPosition++;
@@ -73,7 +70,6 @@ public abstract class NodeIterator implements Iterator {
}
}
-
public Object previous() {
if (currentPosition > 0) {
currentPosition--;
@@ -83,13 +79,11 @@ public abstract class NodeIterator implements Iterator {
}
}
-
public Object start() {
currentPosition = 0;
return currentElement();
}
-
public Object end() {
int size = nodeList.size();
@@ -101,22 +95,17 @@ public abstract class NodeIterator implements Iterator {
}
}
-
public Object currentElement() {
-
if (currentPosition < 0 || currentPosition >= nodeList.size()) {
return null;
}
-
return nodeList.get(currentPosition);
}
-
public int elementCount() {
return nodeList.size();
}
-
public boolean equivalent(Object obj1, Object obj2) {
boolean equal = false;
if (!(obj1 instanceof Node && obj2 instanceof Node)) {
@@ -131,22 +120,20 @@ public abstract class NodeIterator implements Iterator {
return equal;
}
-
public void refresh() {
nodeList = new ArrayList<Node>();
markTree(root);
currentPosition = 0;
}
-
/**
- * Used to compare two <code>Node</code> objects (type/name/value)
- * and all their children <code>Node</code> objects.
+ * Used to compare two {@code Node} objects (type/name/value) and all their
+ * children {@code Node} objects.
*
- * @param node1 The first <code>Node</code> to compare.
- * @param node2 The second <code>Node</code> to compare.
+ * @param node1 The first {@code Node} to compare.
+ * @param node2 The second {@code Node} to compare.
*
- * @return true if <code>Node</code> is equal, false otherwise.
+ * @return {@code true} if {@code Node} is equal, {@code false} otherwise.
*/
protected boolean compareNode(Node node1, Node node2) {
boolean equal = false;
@@ -201,17 +188,17 @@ public abstract class NodeIterator implements Iterator {
return equal;
}
-
/**
- * Compare the children of two <code>Node</code> objects. This
- * method can be intentionally overridden by any class that
- * extend from <code>NodeIterator</code> so that it can have
- * its own children comparison if necessary.
+ * Compare the children of two {@code Node} objects.
+ *
+ * <p>This method can be intentionally overridden by any class that extend
+ * from {@code NodeIterator} so that it can have its own children comparison
+ * if necessary.</p>
*
- * @param node1 The first <code>Node</code> to compare.
- * @param node2 The second <code>Node</code> to compare.
+ * @param node1 The first {@code Node} to compare.
+ * @param node2 The second {@code Node} to compare.
*
- * @return true if children are equal, false otherwise.
+ * @return {@code true} if children are equal, {@code false} otherwise.
*/
protected boolean childrenEqual(Node node1, Node node2) {
@@ -244,17 +231,17 @@ public abstract class NodeIterator implements Iterator {
return equal;
}
-
/**
- * Compare attributes of two <code>Node</code> objects. This
- * method can be intentionally overridden by any class that
- * extends from <code>NodeIterator</code> so that it can have
- * its own attribute comparison.
+ * Compare attributes of two {@code Node} objects.
+ *
+ * <p>This method can be intentionally overridden by any class that extends
+ * from {@code NodeIterator} so that it can have its own attribute comparison.
+ * </p>
*
- * @param node1 The first <code>Node</code> to compare.
- * @param node2 The second <code>Node</code> to compare.
+ * @param node1 The first {@code Node} to compare.
+ * @param node2 The second {@code Node} to compare.
*
- * @return true if attributes are equal, false otherwise.
+ * @return {@code true} if attributes are equal, {@code false} otherwise.
*/
private boolean attributesEqual(Node node1, Node node2) {
@@ -264,7 +251,7 @@ public abstract class NodeIterator implements Iterator {
attrNode[0] = node1.getAttributes();
attrNode[1] = node2.getAttributes();
- // attribute node will be null if node is not an element node
+ // Attribute node will be null if node is not an element node
// and attribute nodes are equal if both are not element node
if (attrNode[0] == null || attrNode[1] == null) {
if (attrNode[0] == null && attrNode[1] == null) {
@@ -273,7 +260,7 @@ public abstract class NodeIterator implements Iterator {
return equal;
}
- // compare the attributes from node1 vs node2 and node2 vs node1
+ // Compare the attributes from node1 vs node2 and node2 vs node1
// though it's a little inefficient for the duplication of comparison
// as the number of attributes is not so many, it should not be
// a big problem.
@@ -331,16 +318,17 @@ public abstract class NodeIterator implements Iterator {
return equal;
}
-
/**
- * Check whether a <code>Node</code> is supported. This method
- * can be intentionally overridden by any class that extends from
- * <code>NodeIterator</code> so that it can specify which
- * <code>Node</code> to support.
+ * Check whether a {@code Node} is supported.
*
- * @param node <code>Node</code> to check.
+ * <p>This method can be intentionally overridden by any class that extends
+ * from {@code NodeIterator} so that it can specify which {@code Node} to
+ * support.</p>
*
- * @return true if <code>Node</code> is supported, false otherwise.
+ * @param node {@code Node} to check.
+ *
+ * @return {@code true} if <code>Node</code> is supported, {@code false}
+ * otherwise.
*/
protected abstract boolean nodeSupported(Node node);
@@ -367,5 +355,4 @@ public abstract class NodeIterator implements Iterator {
}
}
}
-}
-
+} \ No newline at end of file
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ObjectArrayIterator.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ObjectArrayIterator.java
index 9854d16a0b8a..ecfe89786c0d 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ObjectArrayIterator.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ObjectArrayIterator.java
@@ -21,25 +21,22 @@ package org.openoffice.xmerge.merger.diff;
import org.openoffice.xmerge.merger.Iterator;
/**
- * <p>This is an implementation of the <code>Iterator</code> interface.
- * It is based upon a simple <code>Object</code> array.</p>
+ * This is an implementation of the {@code Iterator} interface.
+ *
+ * <p>It is based upon a simple {@code Object} array.</p>
*
* <p>Note: this class is not thread safe for performance reasons.</p>
*/
public final class ObjectArrayIterator implements Iterator {
-
- /**
- * The <code>Object</code> array.
- */
+ /** The {@code Object} array. */
private Object [] objArray;
private int currentPosition;
-
/**
- * Standard constructor.
+ * Standard constructor.
*
- * @param objArray The <code>Object</code> array.
+ * @param objArray The {@code Object} array.
*/
public ObjectArrayIterator(Object [] objArray) {
if (objArray != null) {
@@ -51,7 +48,6 @@ public final class ObjectArrayIterator implements Iterator {
}
}
-
public Object next() {
if (currentPosition < objArray.length - 1) {
currentPosition++;
@@ -59,10 +55,8 @@ public final class ObjectArrayIterator implements Iterator {
} else {
return null;
}
-
}
-
public Object previous() {
if (currentPosition > 0) {
currentPosition--;
@@ -72,13 +66,11 @@ public final class ObjectArrayIterator implements Iterator {
}
}
-
public Object start() {
currentPosition = 0;
return currentElement();
}
-
public Object end() {
if (objArray.length > 0) {
currentPosition = objArray.length - 1;
@@ -86,7 +78,6 @@ public final class ObjectArrayIterator implements Iterator {
return currentElement();
}
-
public Object currentElement() {
if (objArray.length > 0) {
return objArray[currentPosition];
@@ -95,21 +86,19 @@ public final class ObjectArrayIterator implements Iterator {
}
}
-
/**
- * Replace current <code>Object</code>.
+ * Replace current {@code Object}.
*
- * @param object <code>Object</code> to replace.
+ * @param object {@code Object} to replace.
*/
public void replace(Object object) {
objArray[currentPosition] = object;
}
-
/**
- * Insert <code>Object</code> after current <code>Object</code>.
+ * Insert {@code Object} after current {@code Object}.
*
- * @param object <code>Object</code> to insert.
+ * @param object {@code Object} to insert.
*/
public void insert(Object object) {
Object [] objArray2 = new Object[objArray.length+1];
@@ -130,9 +119,9 @@ public final class ObjectArrayIterator implements Iterator {
}
/**
- * Append <code>Object</code> after current <code>Object</code>.
+ * Append {@code Object} after current {@code Object}.
*
- * @param object <code>Object</code> to append.
+ * @param object {@code Object} to append.
*/
public void append(Object object) {
Object [] objArray2 = new Object[objArray.length + 1];
@@ -154,7 +143,7 @@ public final class ObjectArrayIterator implements Iterator {
}
/**
- * Remove current <code>Object</code>.
+ * Remove current {@code Object}.
*/
public void remove() {
Object [] objArray2 = new Object[objArray.length - 1];
@@ -187,5 +176,4 @@ public final class ObjectArrayIterator implements Iterator {
public void refresh() {
// do nothing
}
-}
-
+} \ No newline at end of file
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ParaNodeIterator.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ParaNodeIterator.java
index a5e8b9e6ff7e..2a1b4d22cb32 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ParaNodeIterator.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ParaNodeIterator.java
@@ -23,19 +23,18 @@ import org.w3c.dom.Node;
import org.openoffice.xmerge.ConverterCapabilities;
import org.openoffice.xmerge.converter.xml.OfficeConstants;
-
/**
- * <p>This is an implementation of the <code>Iterator</code> interface.
- * It will traverse the tree and find the Paragraph/Heading <code>Node</code>
- * sequences.</p>
+ * This is an implementation of the {@code Iterator} interface.
+ *
+ * <p>It will traverse the tree and find the Paragraph/Heading {@code Node}
+ * sequences.</p>
*
- * <p>Note: Once the XML Tree is parsed, then the <code>Iterator</code> will
- * be a snap shot of that tree. That means even the tree is modified later,
- * than the cached paragraph <code>Node</code> list will not be updated
- * accordingly. For this reason and for performance reasons this
- * <code>Iterator</code> does not support any operation methods such as
- * insert, remove or replace. The main purpose of this
- * <code>Iterator</code> is to be used with difference, not with merge.</p>
+ * <p>Note: Once the XML Tree is parsed, then the {@code Iterator} will be a
+ * snap shot of that tree. That means even the tree is modified later, than the
+ * cached paragraph {@code Node} list will not be updated accordingly. For this
+ * reason and for performance reasons this {@code Iterator} does not support any
+ * operation methods such as insert, remove or replace. The main purpose of this
+ * {@code Iterator} is to be used with difference, not with merge.</p>
*/
public final class ParaNodeIterator extends NodeIterator {
@@ -44,33 +43,30 @@ public final class ParaNodeIterator extends NodeIterator {
private static final String SUPPORTED_TAG2 = OfficeConstants.TAG_HEADING;
/**
- * Standard constructor.
+ * Standard constructor.
*
- * @param cc The <code>ConverterCapabilities</code>.
- * @param node The initial root <code>Node</code>.
+ * @param cc The {@code ConverterCapabilities}.
+ * @param node The initial root {@code Node}.
*/
public ParaNodeIterator(ConverterCapabilities cc, Node node) {
// not using convertercapabilities unless it's needed in future.
super(cc, node);
}
-
/**
- * Overwrite the parent <code>nodeSupported</code> method.
+ * Overwrite the parent <code>nodeSupported</code> method.
*
- * @param node <code>Node</code> to check.
+ * @param node {@code Node} to check.
*
- * @return true if the <code>Node</code> is supported, false
- * otherwise.
+ * @return {@code true} if the {@code Node} is supported, {@code false}
+ * otherwise.
*/
@Override
protected boolean nodeSupported(Node node) {
-
// can use an array later to check all possible tags for
// future expansion
return node.getNodeType() == Node.ELEMENT_NODE &&
(node.getNodeName().equals(SUPPORTED_TAG1) ||
node.getNodeName().equals(SUPPORTED_TAG2));
}
-}
-
+} \ No newline at end of file
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/RowIterator.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/RowIterator.java
index 9425d4c1bb70..7d84f7a7812b 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/RowIterator.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/RowIterator.java
@@ -23,10 +23,11 @@ import org.w3c.dom.Node;
import org.openoffice.xmerge.ConverterCapabilities;
import org.openoffice.xmerge.converter.xml.OfficeConstants;
-
/**
- * This is an implementation of the <code>Iterator</code> interface and extends
- * <code>NodeIterator</code>. It will traverse the tree and find row sequences.
+ * This is an implementation of the {@code Iterator} interface and extends
+ * {@code NodeIterator}.
+ *
+ * <p>It will traverse the tree and find row sequences.</p>
*/
public final class RowIterator extends NodeIterator {
@@ -35,22 +36,24 @@ public final class RowIterator extends NodeIterator {
// considered to be not equivalent.
/**
- * Standard constructor.
+ * Standard constructor.
*
- * @param cc The <code>ConverterCapabilities</code>.
- * @param node The initial root <code>Node</code>.
+ * @param cc The {@code ConverterCapabilities}.
+ * @param node The initial root {@code Node}.
*/
public RowIterator(ConverterCapabilities cc, Node node) {
super(cc, node);
}
/**
- * Overwrite the parent <code>nodeSupported</code> method. Only
- * row <code>Node</code> objects are supported.
+ * Overwrite the parent {@code nodeSupported} method.
*
- * @param node <code>Node</code> to check.
+ * <p>Only row {@code Node} objects are supported.</p>
*
- * @return true if the <code>Node</code> is supported, false otherwise.
+ * @param node {@code Node} to check.
+ *
+ * @return {@code true} if the {@code Node} is supported, {@code false}
+ * otherwise.
*/
@Override
protected boolean nodeSupported(Node node) {
@@ -60,5 +63,4 @@ public final class RowIterator extends NodeIterator {
return node.getNodeType() == Node.ELEMENT_NODE &&
node.getNodeName().equals(OfficeConstants.TAG_TABLE_ROW);
}
-}
-
+} \ No newline at end of file
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeEntry.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeEntry.java
index d20a0055e9c3..ebe234fdadf7 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeEntry.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeEntry.java
@@ -21,10 +21,11 @@ package org.openoffice.xmerge.merger.diff;
import org.w3c.dom.Node;
/**
- * A small class to hold the start/end character position and the
- * <code>Node</code> pointer in a text <code>Node</code>. It is
- * mainly used for character parser to make a list of text
- * <code>Node</code> cache entries.
+ * A small class to hold the start/end character position and the {@code Node}
+ * pointer in a text {@code Node}.
+ *
+ * <p>It is mainly used for character parser to make a list of text {@code Node}
+ * cache entries.</p>
*/
public class TextNodeEntry {
@@ -33,11 +34,11 @@ public class TextNodeEntry {
private Node node_;
/**
- * Constructor
+ * Constructor
*
- * @param startChar The start character position.
- * @param endChar The end character position.
- * @param node The text <code>Node</code>.
+ * @param startChar The start character position.
+ * @param endChar The end character position.
+ * @param node The text {@code Node}.
*/
public TextNodeEntry(int startChar, int endChar, Node node) {
startChar_ = startChar;
@@ -46,32 +47,29 @@ public class TextNodeEntry {
}
/**
- * Returns the start character.
+ * Returns the start character.
*
- * @return The start character.
+ * @return The start character.
*/
public int startChar() {
return startChar_;
}
-
/**
- * Returns the end character.
+ * Returns the end character.
*
- * @return The end character.
+ * @return The end character.
*/
public int endChar() {
return endChar_;
}
-
/**
- * Returns the <code>Node</code>.
+ * Returns the {@code Node}.
*
- * @return The <code>Node</code>.
+ * @return The {@code Node}.
*/
public Node node() {
return node_;
}
-}
-
+} \ No newline at end of file
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeIterator.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeIterator.java
index 791122c398dc..fa7c6086c36b 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeIterator.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeIterator.java
@@ -22,43 +22,42 @@ import org.w3c.dom.Node;
import org.openoffice.xmerge.converter.xml.OfficeConstants;
-
/**
- * <p>This is an implementation of the <code>Iterator</code> interface.
- * It will traverse the tree and find text/space/tab <code>Node</code>
- * sequences.</p>
+ * This is an implementation of the {@code Iterator} interface.
+ *
+ * <p>It will traverse the tree and find text/space/tab {@code Node} sequences.
+ * </p>
*
- * <p>Note: Once the XML Tree is parsed, then the <code>Iterator</code>
- * will be a snap shot of that tree. That means even the tree is modified
- * later, than the cached paragraph <code>Node</code> list will not be
- * updated accordingly. For this reason and for performance reasons
- * this <code>Iterator</code> does not support any operation methods
- * such as insert, remove or replace. The main purpose of this
- * <code>Iterator</code> is to be used with difference, not with merge.</p>
+ * <p>Note: Once the XML Tree is parsed, then the {@code Iterator} will be a
+ * snap shot of that tree. That means even the tree is modified later, than the
+ * cached paragraph {@code Node} list will not be updated accordingly. For this
+ * reason and for performance reasons this {@code Iterator} does not support
+ * any operation methods such as insert, remove or replace. The main purpose of
+ * this {@code Iterator} is to be used with difference, not with merge.</p>
*/
public final class TextNodeIterator extends NodeIterator {
/**
- * Standard constructor.
+ * Standard constructor.
*
- * @param node The initial root <code>Node</code>.
+ * @param node The initial root {@code Node}.
*/
public TextNodeIterator(Node node) {
super(null, node);
}
/**
- * Overwrite the parent <code>nodeSupported</code> method. Only text
- * <code>Node</code> objects are supported.
+ * Overwrite the parent {@code nodeSupported} method.
+ *
+ * <p>Only text {@code Node} objects are supported.</p>
*
- * @param node <code>Node</code> to check.
+ * @param node {@code Node} to check.
*
- * @return true if the <code>Node</code> is supported, false
- * otherwise.
+ * @return {@code true} if the {@code Node} is supported, {@code false}
+ * otherwise.
*/
@Override
protected boolean nodeSupported(Node node) {
-
// can use an array later to check all possible tags for
// future expansion
return node.getNodeType() == Node.TEXT_NODE ||
@@ -66,5 +65,4 @@ public final class TextNodeIterator extends NodeIterator {
node.getNodeName().equals(OfficeConstants.TAG_TAB_STOP) ||
node.getNodeName().equals(OfficeConstants.TAG_LINE_BREAK);
}
-}
-
+} \ No newline at end of file