();
- for (String line : list) {
- result.add(wrapText(line, columnWidth));
- }
- return result;
- }
-
- /**
- * Wrap the text with the given column width
- * @param line the text
- * @param columnWidth the given column
- * @return the wrapped text
- */
- public static String wrapText(String line, int columnWidth) {
- int lenght = line.length();
- int delimiter = "
".length();
- int widthIndex = columnWidth;
-
- for (int count = 0; lenght > widthIndex; count++) {
- line = line.subSequence(0, widthIndex + delimiter * count) + "
"
- + line.substring(widthIndex + delimiter * count);
- widthIndex += columnWidth;
- }
-
- return line;
- }
-}
diff --git a/src/main/java/difflib/myers/DiffException.java b/src/main/java/difflib/myers/DiffException.java
deleted file mode 100644
index d3802ff..0000000
--- a/src/main/java/difflib/myers/DiffException.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * ====================================================================
- *
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999-2003 The Apache Software Foundation.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowledgement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgement may appear in the software itself,
- * if and wherever such third-party acknowledgements normally appear.
- *
- * 4. The names "The Jakarta Project", "Commons", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- *
- */
-
-package difflib.myers;
-
-/**
- * Base class for all exceptions emanating from this package.
- *
- * @version $Revision: 69 $ $Date: 2003-10-13 11:00:44 +0300 (Пнд, 13 Окт 2003) $
- *
- * @author Juanco Anez
- */
-public class DiffException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- public DiffException() {
- }
-
- public DiffException(String msg) {
- super(msg);
- }
-}
diff --git a/src/main/java/difflib/myers/DiffNode.java b/src/main/java/difflib/myers/DiffNode.java
deleted file mode 100644
index a2fb071..0000000
--- a/src/main/java/difflib/myers/DiffNode.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package difflib.myers;
-
-/**
- * Title:
- * Description:
- * Copyright: Copyright (c) 2002
- * Company:
- * @author not attributable
- * @version 1.0
- */
-
-/**
- * A diffnode in a diffpath.
- *
- * A DiffNode and its previous node mark a delta between
- * two input sequences, that is, two differing subsequences
- * between (possibly zero length) matching sequences.
- *
- * {@link DiffNode DiffNodes} and {@link Snake Snakes} allow for compression
- * of diffpaths, as each snake is represented by a single {@link Snake Snake}
- * node and each contiguous series of insertions and deletions is represented
- * by a single {@link DiffNode DiffNodes}.
- *
- * @version $Revision: 60 $ $Date: 2003-05-10 21:56:10 +0300 (Суб, 10 Май 2003) $
- * @author Juanco Anez
- *
- */
-public final class DiffNode extends PathNode {
- /**
- * Constructs a DiffNode.
- *
- * DiffNodes are compressed. That means that
- * the path pointed to by the prev parameter
- * will be followed using {@link PathNode#previousSnake}
- * until a non-diff node is found.
- *
- * @param the position in the original sequence
- * @param the position in the revised sequence
- * @param prev the previous node in the path.
- */
- public DiffNode(int i, int j, PathNode prev) {
- super(i, j, (prev == null ? null : prev.previousSnake()));
- }
-
- /**
- * {@inheritDoc}
- * @return false, always
- */
- public boolean isSnake() {
- return false;
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/difflib/myers/DifferentiationFailedException.java b/src/main/java/difflib/myers/DifferentiationFailedException.java
deleted file mode 100644
index c25c081..0000000
--- a/src/main/java/difflib/myers/DifferentiationFailedException.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * ====================================================================
- *
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999-2003 The Apache Software Foundation.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowledgement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgement may appear in the software itself,
- * if and wherever such third-party acknowledgements normally appear.
- *
- * 4. The names "The Jakarta Project", "Commons", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- *
- */
-
-package difflib.myers;
-
-/**
- * Thrown whenever the differencing engine cannot produce the differences
- * between two revisions of ta text.
- *
- * @version $Revision: 69 $ $Date: 2003-10-13 11:00:44 +0300 (Пнд, 13 Окт 2003) $
- *
- * @author Juanco Anez
- * @see MyersDiff
- * @see difflib.DiffAlgorithm
- */
-public class DifferentiationFailedException extends DiffException {
- private static final long serialVersionUID = 1L;
-
- public DifferentiationFailedException() {
- }
-
- public DifferentiationFailedException(String msg) {
- super(msg);
- }
-}
diff --git a/src/main/java/difflib/myers/Equalizer.java b/src/main/java/difflib/myers/Equalizer.java
deleted file mode 100644
index f644019..0000000
--- a/src/main/java/difflib/myers/Equalizer.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package difflib.myers;
-
-/**
- * Specifies when two compared elements in the Myers algorithm are equal.
- *
- * @param T The type of the compared elements in the 'lines'.
- */
-public interface Equalizer {
-
- /**
- * Indicates if two elements are equal according to the diff mechanism.
- * @param original The original element. Must not be {@code null}.
- * @param revised The revised element. Must not be {@code null}.
- * @return Returns true if the elements are equal.
- */
- public boolean equals(T original, T revised);
-}
diff --git a/src/main/java/difflib/myers/MyersDiff.java b/src/main/java/difflib/myers/MyersDiff.java
deleted file mode 100644
index 40be478..0000000
--- a/src/main/java/difflib/myers/MyersDiff.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * ====================================================================
- *
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowledgement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgement may appear in the software itself,
- * if and wherever such third-party acknowledgements normally appear.
- *
- * 4. The names "The Jakarta Project", "Commons", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- *
- */
-
-package difflib.myers;
-
-import difflib.*;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * A clean-room implementation of
- * Eugene Myers differencing algorithm.
- *
- * See the paper at
- * http://www.cs.arizona.edu/people/gene/PAPERS/diff.ps
- *
- * @author Juanco Anez
- * @param T The type of the compared elements in the 'lines'.
- */
-public class MyersDiff implements DiffAlgorithm {
-
- /** Default equalizer. */
- private final Equalizer DEFAULT_EQUALIZER = new Equalizer() {
- public boolean equals(final T original, final T revised) {
- return original.equals(revised);
- }
- };
-
- /** The equalizer. */
- private final Equalizer equalizer;
-
-
- /**
- * Constructs an instance of the Myers differencing algorithm.
- */
- public MyersDiff() {
- equalizer = DEFAULT_EQUALIZER;
- }
-
- /**
- * Constructs an instance of the Myers differencing algorithm.
- * @param equalizer Must not be {@code null}.
- */
- public MyersDiff(final Equalizer equalizer) {
- if (equalizer == null) {
- throw new IllegalArgumentException("equalizer must not be null");
- }
- this.equalizer = equalizer;
- }
-
- /**
- * {@inheritDoc}
- *
- * @return Returns an empty diff if get the error while procession the difference.
- */
- public Patch diff(final T[] original, final T[] revised) {
- return diff(Arrays.asList(original), Arrays.asList(revised));
- }
-
- /**
- * {@inheritDoc}
- *
- * Return empty diff if get the error while procession the difference.
- */
- public Patch diff(final List original, final List revised) {
- if (original == null) {
- throw new IllegalArgumentException("original list must not be null");
- }
- if (revised == null) {
- throw new IllegalArgumentException("revised list must not be null");
- }
- PathNode path;
- try {
- path = buildPath(original, revised);
- return buildRevision(path, original, revised);
- } catch (DifferentiationFailedException e) {
- e.printStackTrace();
- }
- return new Patch();
- }
-
- /**
- * Computes the minimum diffpath that expresses de differences
- * between the original and revised sequences, according
- * to Gene Myers differencing algorithm.
- *
- * @param orig The original sequence.
- * @param rev The revised sequence.
- * @return A minimum {@link PathNode Path} accross the differences graph.
- * @throws DifferentiationFailedException if a diff path could not be found.
- */
- public PathNode buildPath(final List orig, final List rev)
- throws DifferentiationFailedException {
- if (orig == null)
- throw new IllegalArgumentException("original sequence is null");
- if (rev == null)
- throw new IllegalArgumentException("revised sequence is null");
-
- // these are local constants
- final int N = orig.size();
- final int M = rev.size();
-
- final int MAX = N + M + 1;
- final int size = 1 + 2 * MAX;
- final int middle = size / 2;
- final PathNode diagonal[] = new PathNode[size];
-
- diagonal[middle + 1] = new Snake(0, -1, null);
- for (int d = 0; d < MAX; d++) {
- for (int k = -d; k <= d; k += 2) {
- final int kmiddle = middle + k;
- final int kplus = kmiddle + 1;
- final int kminus = kmiddle - 1;
- PathNode prev = null;
-
- int i;
- if ((k == -d) || (k != d && diagonal[kminus].i < diagonal[kplus].i)) {
- i = diagonal[kplus].i;
- prev = diagonal[kplus];
- } else {
- i = diagonal[kminus].i + 1;
- prev = diagonal[kminus];
- }
-
- diagonal[kminus] = null; // no longer used
-
- int j = i - k;
-
- PathNode node = new DiffNode(i, j, prev);
-
- // orig and rev are zero-based
- // but the algorithm is one-based
- // that's why there's no +1 when indexing the sequences
- while (i < N && j < M && equals(orig.get(i), rev.get(j))) {
- i++;
- j++;
- }
- if (i > node.i)
- node = new Snake(i, j, node);
-
- diagonal[kmiddle] = node;
-
- if (i >= N && j >= M) {
- return diagonal[kmiddle];
- }
- }
- diagonal[middle + d - 1] = null;
-
- }
- // According to Myers, this cannot happen
- throw new DifferentiationFailedException("could not find a diff path");
- }
-
- private boolean equals(T orig, T rev) {
- return equalizer.equals(orig, rev);
- }
-
- /**
- * Constructs a {@link Patch} from a difference path.
- *
- * @param path The path.
- * @param orig The original sequence.
- * @param rev The revised sequence.
- * @return A {@link Patch} script corresponding to the path.
- * @throws DifferentiationFailedException if a {@link Patch} could
- * not be built from the given path.
- */
- public Patch buildRevision(PathNode path, List orig, List rev) {
- if (path == null)
- throw new IllegalArgumentException("path is null");
- if (orig == null)
- throw new IllegalArgumentException("original sequence is null");
- if (rev == null)
- throw new IllegalArgumentException("revised sequence is null");
-
- Patch patch = new Patch();
- if (path.isSnake())
- path = path.prev;
- while (path != null && path.prev != null && path.prev.j >= 0) {
- if (path.isSnake())
- throw new IllegalStateException("bad diffpath: found snake when looking for diff");
- int i = path.i;
- int j = path.j;
-
- path = path.prev;
- int ianchor = path.i;
- int janchor = path.j;
-
- Chunk original = new Chunk(ianchor, copyOfRange(orig, ianchor, i));
- Chunk revised = new Chunk(janchor, copyOfRange(rev, janchor, j));
- Delta delta = null;
- if (original.size() == 0 && revised.size() != 0) {
- delta = new InsertDelta(original, revised);
- } else if (original.size() > 0 && revised.size() == 0) {
- delta = new DeleteDelta(original, revised);
- } else {
- delta = new ChangeDelta(original, revised);
- }
-
- patch.addDelta(delta);
- if (path.isSnake())
- path = path.prev;
- }
- return patch;
- }
-
- /**
- * Creates a new list containing the elements returned by {@link List#subList(int, int)}.
- * @param original The original sequence. Must not be {@code null}.
- * @param fromIndex low endpoint (inclusive) of the subList.
- * @param to high endpoint (exclusive) of the subList.
- * @return A new list of the specified range within the original list.
-
- */
- private List copyOfRange( final List original, final int fromIndex, final int to ) {
- return new ArrayList( original.subList( fromIndex, to ) );
- }
-
- /**
- * Copied here from JDK 1.6
- */
- @SuppressWarnings("unchecked")
- public static T[] copyOfRange2(T[] original, int from, int to) {
- return copyOfRange2(original, from, to, (Class) original.getClass());
- }
-
- /**
- * Copied here from JDK 1.6
- */
- @SuppressWarnings("unchecked")
- public static T[] copyOfRange2(U[] original, int from, int to,
- Class extends T[]> newType) {
- int newLength = to - from;
- if (newLength < 0)
- throw new IllegalArgumentException(from + " > " + to);
- T[] copy = ((Object) newType == (Object) Object[].class) ? (T[]) new Object[newLength]
- : (T[]) Array.newInstance(newType.getComponentType(), newLength);
- System.arraycopy(original, from, copy, 0, Math.min(original.length - from, newLength));
- return copy;
- }
-
-}
diff --git a/src/main/java/difflib/myers/PathNode.java b/src/main/java/difflib/myers/PathNode.java
deleted file mode 100644
index 4ead5f2..0000000
--- a/src/main/java/difflib/myers/PathNode.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * ====================================================================
- *
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999-2003 The Apache Software Foundation.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowledgement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgement may appear in the software itself,
- * if and wherever such third-party acknowledgements normally appear.
- *
- * 4. The names "The Jakarta Project", "Commons", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- *
- */
-
-package difflib.myers;
-
-/**
- * A node in a diffpath.
- *
- * @version $Revision: 69 $ $Date: 2003-10-13 11:00:44 +0300 (Пнд, 13 Окт 2003) $
- * @author Juanco Anez
- *
- * @see DiffNode
- * @see Snake
- *
- */
-public abstract class PathNode {
- /** Position in the original sequence. */
- public final int i;
- /** Position in the revised sequence. */
- public final int j;
- /** The previous node in the path. */
- public final PathNode prev;
-
- /**
- * Concatenates a new path node with an existing diffpath.
- * @param i The position in the original sequence for the new node.
- * @param j The position in the revised sequence for the new node.
- * @param prev The previous node in the path.
- */
- public PathNode(int i, int j, PathNode prev) {
- this.i = i;
- this.j = j;
- this.prev = prev;
- }
-
- /**
- * Is this node a {@link Snake Snake node}?
- * @return true if this is a {@link Snake Snake node}
- */
- public abstract boolean isSnake();
-
- /**
- * Is this a bootstrap node?
- *
- * In bottstrap nodes one of the two corrdinates is
- * less than zero.
- * @return tru if this is a bootstrap node.
- */
- public boolean isBootstrap() {
- return i < 0 || j < 0;
- }
-
- /**
- * Skips sequences of {@link DiffNode DiffNodes} until a
- * {@link Snake} or bootstrap node is found, or the end
- * of the path is reached.
- * @return The next first {@link Snake} or bootstrap node in the path, or
- * null
- * if none found.
- */
- public final PathNode previousSnake() {
- if (isBootstrap())
- return null;
- if (!isSnake() && prev != null)
- return prev.previousSnake();
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- public String toString() {
- StringBuffer buf = new StringBuffer("[");
- PathNode node = this;
- while (node != null) {
- buf.append("(");
- buf.append(Integer.toString(node.i));
- buf.append(",");
- buf.append(Integer.toString(node.j));
- buf.append(")");
- node = node.prev;
- }
- buf.append("]");
- return buf.toString();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/difflib/myers/Snake.java b/src/main/java/difflib/myers/Snake.java
deleted file mode 100644
index 452829b..0000000
--- a/src/main/java/difflib/myers/Snake.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * ====================================================================
- *
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999-2003 The Apache Software Foundation.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowledgement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgement may appear in the software itself,
- * if and wherever such third-party acknowledgements normally appear.
- *
- * 4. The names "The Jakarta Project", "Commons", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- *
- */
-
-package difflib.myers;
-
-/**
- * Represents a snake in a diffpath.
- *
- *
- * {@link DiffNode DiffNodes} and {@link Snake Snakes} allow for compression
- * of diffpaths, as each snake is represented by a single {@link Snake Snake}
- * node and each contiguous series of insertions and deletions is represented
- * by a single {@link DiffNode DiffNodes}.
- *
- * @version $Revision: 69 $ $Date: 2003-10-13 11:00:44 +0300 (Пнд, 13 Окт 2003) $
- * @author Juanco Anez
- *
- */
-public final class Snake extends PathNode {
- /**
- * Constructs a snake node.
- *
- * @param the position in the original sequence
- * @param the position in the revised sequence
- * @param prev the previous node in the path.
- */
- public Snake(int i, int j, PathNode prev) {
- super(i, j, prev);
- }
-
- /**
- * {@inheritDoc}
- * @return true always
- */
- public boolean isSnake() {
- return true;
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/difflib/myers/package.html b/src/main/java/difflib/myers/package.html
deleted file mode 100644
index 3ccec66..0000000
--- a/src/main/java/difflib/myers/package.html
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
-
-
-
-
- The {@link difflib.myers diff.myers} package
- implements Gene Myers'
- differencing algorithm.
-
-
- Myer's algorithm produces optimum results (minimum diffs), but
- consumes considerably more memory than SimpleDiff, so its not
- suitable for very large files.
-
-@author Juanco Anez
-
-
diff --git a/src/main/java/difflib/package.html b/src/main/java/difflib/package.html
deleted file mode 100644
index 0f82244..0000000
--- a/src/main/java/difflib/package.html
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
-
-
- The {@link difflib difflib} package
- implements general operation with diff files.
-
-@author Dmitry Naumenko
-
-
diff --git a/src/test/java/diffutils/DiffRowGeneratorTest.java b/src/test/java/diffutils/DiffRowGeneratorTest.java
deleted file mode 100644
index de209d4..0000000
--- a/src/test/java/diffutils/DiffRowGeneratorTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package diffutils;
-
-import java.util.Arrays;
-import java.util.List;
-
-import difflib.DiffRow;
-import difflib.DiffRowGenerator;
-
-import junit.framework.TestCase;
-
-public class DiffRowGeneratorTest extends TestCase {
-
- public void testGenerator_Default() {
- String first = "anything \n \nother";
- String second ="anything\n\nother";
-
- DiffRowGenerator generator = new DiffRowGenerator.Builder()
- .columnWidth(Integer.MAX_VALUE) // do not wrap
- .build();
- List rows = generator.generateDiffRows(split(first), split(second));
- print(rows);
-
- assertEquals(3, rows.size());
- }
-
- public void testGenerator_InlineDiff() {
- String first = "anything \n \nother";
- String second ="anything\n\nother";
-
- DiffRowGenerator generator = new DiffRowGenerator.Builder()
- .showInlineDiffs(true)
- .columnWidth(Integer.MAX_VALUE) // do not wrap
- .build();
- List rows = generator.generateDiffRows(split(first), split(second));
- print(rows);
-
- assertEquals(3, rows.size());
- assertTrue(rows.get(0).getOldLine().indexOf(" 0);
- }
-
- public void testGenerator_IgnoreWhitespaces() {
- String first = "anything \n \nother\nmore lines";
- String second ="anything\n\nother\nsome more lines";
-
- DiffRowGenerator generator = new DiffRowGenerator.Builder()
- .ignoreWhiteSpaces(true)
- .columnWidth(Integer.MAX_VALUE) // do not wrap
- .build();
- List rows = generator.generateDiffRows(split(first), split(second));
- print(rows);
-
- assertEquals(4, rows.size());
- assertEquals(rows.get(0).getTag(), DiffRow.Tag.EQUAL);
- assertEquals(rows.get(1).getTag(), DiffRow.Tag.EQUAL);
- assertEquals(rows.get(2).getTag(), DiffRow.Tag.EQUAL);
- assertEquals(rows.get(3).getTag(), DiffRow.Tag.CHANGE);
- }
-
- private List split(String content) {
- return Arrays.asList(content.split("\n"));
- }
-
- private void print(List diffRows) {
- for (DiffRow row: diffRows) {
- System.out.println(row);
- }
- }
-}
diff --git a/src/test/java/diffutils/DiffTest.java b/src/test/java/diffutils/DiffTest.java
deleted file mode 100644
index 6d1ef31..0000000
--- a/src/test/java/diffutils/DiffTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package diffutils;
-
-import difflib.*;
-import junit.framework.TestCase;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-public class DiffTest extends TestCase {
-
- public void testDiff_Insert() {
- final Patch patch = DiffUtils.diff(Arrays.asList("hhh"), Arrays.asList("hhh", "jjj", "kkk"));
- assertNotNull(patch);
- assertEquals(1, patch.getDeltas().size());
- final Delta delta = patch.getDeltas().get(0);
- assertEquals(InsertDelta.class, delta.getClass());
- assertEquals(new Chunk(1, Collections. emptyList()), delta.getOriginal());
- assertEquals(new Chunk(1, Arrays.asList("jjj", "kkk")), delta.getRevised());
- }
-
- public void testDiff_Delete() {
- final Patch patch = DiffUtils.diff(Arrays.asList("ddd", "fff", "ggg"), Arrays.asList("ggg"));
- assertNotNull(patch);
- assertEquals(1, patch.getDeltas().size());
- final Delta delta = patch.getDeltas().get(0);
- assertEquals(DeleteDelta.class, delta.getClass());
- assertEquals(new Chunk(0, Arrays.asList("ddd", "fff")), delta.getOriginal());
- assertEquals(new Chunk