public class LCS<ObjectType>
extends java.lang.Object
| Constructor and Description |
|---|
LCS(java.util.List<ObjectType> from,
java.util.List<ObjectType> to)
Constructs an LCS for the two collections, using the default comparison
mechanism between the objects, such as
equals and
compareTo. |
LCS(java.util.List<ObjectType> from,
java.util.List<ObjectType> to,
java.util.Comparator<ObjectType> comp)
Constructs an LCS for the two collections, using the given comparator.
|
LCS(ObjectType[] from,
ObjectType[] to)
Constructs an LCS for the two arrays, using the default comparison
mechanism between the objects, such as
equals and
compareTo. |
LCS(ObjectType[] from,
ObjectType[] to,
java.util.Comparator<ObjectType> comp)
Constructs an LCS for the two arrays, using the given comparator.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMatches(java.util.TreeMap<java.lang.Integer,java.lang.Integer> matches,
int fromStart,
int fromEnd,
int toStart,
int toEnd) |
java.util.Map<ObjectType,java.util.List<java.lang.Integer>> |
createMatchesMap() |
protected boolean |
equals(java.util.Comparator<ObjectType> comparator,
ObjectType x,
ObjectType y)
Compares the two objects, using the comparator provided with the
constructor, if any.
|
java.util.List<java.lang.Integer> |
getMatches()
Returns an array of the longest common subsequences.
|
java.util.Map<ObjectType,java.util.List<java.lang.Integer>> |
getToMatches(int toStart,
int toEnd) |
protected static java.util.List<java.lang.Integer> |
toList(java.util.TreeMap<java.lang.Integer,java.lang.Integer> map)
Converts the map into a list.
|
public LCS(ObjectType[] from, ObjectType[] to, java.util.Comparator<ObjectType> comp)
public LCS(ObjectType[] from, ObjectType[] to)
equals and
compareTo.public LCS(java.util.List<ObjectType> from, java.util.List<ObjectType> to)
equals and
compareTo.public LCS(java.util.List<ObjectType> from, java.util.List<ObjectType> to, java.util.Comparator<ObjectType> comp)
public java.util.List<java.lang.Integer> getMatches()
public void addMatches(java.util.TreeMap<java.lang.Integer,java.lang.Integer> matches,
int fromStart,
int fromEnd,
int toStart,
int toEnd)
public java.util.Map<ObjectType,java.util.List<java.lang.Integer>> createMatchesMap()
public java.util.Map<ObjectType,java.util.List<java.lang.Integer>> getToMatches(int toStart, int toEnd)
protected boolean equals(java.util.Comparator<ObjectType> comparator, ObjectType x, ObjectType y)
protected static java.util.List<java.lang.Integer> toList(java.util.TreeMap<java.lang.Integer,java.lang.Integer> map)