public interface SequenceDistanceMeasurer
Implement this interface, SequenceDistanceMeasurer, to define a distance metric for sequences. A sequence may have duplicate elements, unlike a Permutation which must have unique elements. Some SequenceDistanceMeasurers may require the pair of sequences to be the same length, while others do not have that requirement. Some SequenceDistanceMeasurers may require the pair of sequences to contain the same set of elements, while others do not have that requirement. Implementations of this interface compute distances that are integer valued.
If your sequences are guaranteed not to contain duplicates, and the pair is guaranteed to contain the same set of elements, and are of the same length,
then consider instead using the classes that implement the PermutationDistanceMeasurer
interface. Those classes are specifically for distance between permutations of the integers from 0 to N-1.
| Modifier and Type | Method and Description |
|---|---|
int |
distance(boolean[] s1,
boolean[] s2)
Measures the distance between two arrays.
|
int |
distance(byte[] s1,
byte[] s2)
Measures the distance between two arrays.
|
int |
distance(char[] s1,
char[] s2)
Measures the distance between two arrays.
|
int |
distance(double[] s1,
double[] s2)
Measures the distance between two arrays.
|
int |
distance(float[] s1,
float[] s2)
Measures the distance between two arrays.
|
int |
distance(int[] s1,
int[] s2)
Measures the distance between two arrays.
|
<T> int |
distance(List<T> s1,
List<T> s2)
Measures the distance between two lists of objects.
|
int |
distance(long[] s1,
long[] s2)
Measures the distance between two arrays.
|
int |
distance(Object[] s1,
Object[] s2)
Measures the distance between two arrays of objects.
|
int |
distance(short[] s1,
short[] s2)
Measures the distance between two arrays.
|
int |
distance(String s1,
String s2)
Measures the distance between two Strings.
|
int distance(long[] s1,
long[] s2)
s1 - First array.s2 - Second array.int distance(int[] s1,
int[] s2)
s1 - First array.s2 - Second array.int distance(short[] s1,
short[] s2)
s1 - First array.s2 - Second array.int distance(byte[] s1,
byte[] s2)
s1 - First array.s2 - Second array.int distance(char[] s1,
char[] s2)
s1 - First array.s2 - Second array.int distance(double[] s1,
double[] s2)
s1 - First array.s2 - Second array.int distance(float[] s1,
float[] s2)
s1 - First array.s2 - Second array.int distance(boolean[] s1,
boolean[] s2)
s1 - First array.s2 - Second array.int distance(String s1, String s2)
s1 - First String.s2 - Second String.int distance(Object[] s1, Object[] s2)
s1 - First array.s2 - Second array.<T> int distance(List<T> s1, List<T> s2)
T - Type of List elements.s1 - First list.s2 - Second list.Copyright © 2005-2020 Vincent A. Cicirello. All rights reserved.