Package org.webcat.diff
Class DiffList<T>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.AbstractSequentialList<E>
-
- java.util.LinkedList<Diff<T>>
-
- org.webcat.diff.DiffList<T>
-
- 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>>
public class DiffList<T> extends LinkedList<Diff<T>>
A linked list ofDiff
objects that provides additional methods for operating on the list or reconstituting the original lists.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description DiffList()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<T>
computeFirstList()
Compute and return the source text (all equalities and deletions).List<T>
computeSecondList()
Compute and return the destination text (all equalities and insertions).int
getLevenshteinDistance()
Compute the Levenshtein distance; the number of inserted, deleted or substituted characters.int
translateIndex(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, toArray
-
Methods inherited from class java.util.AbstractSequentialList
iterator
-
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, replaceAll, retainAll, sort, subList
-
-
-
-
Method Detail
-
computeFirstList
public List<T> computeFirstList()
Compute and return the source text (all equalities and deletions).- Returns:
- Source text.
-
computeSecondList
public List<T> 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.
-
-