Package org.webcat.diff
Class DiffList<T>
java.lang.Object
- Type Parameters:
T- the type of the item in the list
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<Diff<T>>,Collection<Diff<T>>,Deque<Diff<T>>,List<Diff<T>>,Queue<Diff<T>>
A linked list of
Diff objects that provides additional methods for
operating on the list or reconstituting the original lists.- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCompute and return the source text (all equalities and deletions).Compute and return the destination text (all equalities and insertions).intCompute the Levenshtein distance; the number of inserted, deleted or substituted characters.inttranslateIndex(int loc) loc is a location in text1, compute and return the equivalent location in text2. e.g.Methods inherited from class java.util.LinkedList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, spliterator, toArray, toArrayMethods inherited from class java.util.AbstractSequentialList
iteratorMethods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subListMethods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, replaceAll, retainAll, sort, subList
-
Constructor Details
-
DiffList
public DiffList()
-
-
Method Details
-
computeFirstList
Compute and return the source text (all equalities and deletions).- Returns:
- Source text.
-
computeSecondList
Compute and return the destination text (all equalities and insertions).- Returns:
- Destination text.
-
getLevenshteinDistance
public int getLevenshteinDistance()Compute the Levenshtein distance; the number of inserted, deleted or substituted characters.- Returns:
- Number of changes.
-
translateIndex
public int translateIndex(int loc) loc is a location in text1, compute and return the equivalent location in text2. e.g. "The cat" vs "The big cat", 1->1, 5->8- Parameters:
loc- Location within text1.- Returns:
- Location within text2.
-