Module org.cicirello.jpt
Package org.cicirello.sequences.distance
Interface SequenceDistanceMeasurer
- All Superinterfaces:
SequenceDistanceMeasurerDouble
- All Known Implementing Classes:
EditDistance,ExactMatchDistance,KendallTauSequenceDistance,LongestCommonSubsequenceDistance
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.
This interface extends the SequenceDistanceMeasurerDouble interface, providing default
implementations of all of that superinterface's distancef methods by delegating the behavior to
the various distance methods. In this way, implementers of SequenceDistanceMeasurer should not
have a reason to implement the distancef methods of SequenceDistanceMeasurerDouble.
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.
-
Method Summary
Modifier and TypeMethodDescriptionintdistance(boolean[] s1, boolean[] s2) Measures the distance between two arrays.intdistance(byte[] s1, byte[] s2) Measures the distance between two arrays.intdistance(char[] s1, char[] s2) Measures the distance between two arrays.intdistance(double[] s1, double[] s2) Measures the distance between two arrays.intdistance(float[] s1, float[] s2) Measures the distance between two arrays.intdistance(int[] s1, int[] s2) Measures the distance between two arrays.intdistance(long[] s1, long[] s2) Measures the distance between two arrays.intdistance(short[] s1, short[] s2) Measures the distance between two arrays.intMeasures the distance between two arrays of objects.intMeasures the distance between two Strings.<T> intMeasures the distance between two lists of objects.default doubledistancef(boolean[] s1, boolean[] s2) Measures the distance between two arrays.default doubledistancef(byte[] s1, byte[] s2) Measures the distance between two arrays.default doubledistancef(char[] s1, char[] s2) Measures the distance between two arrays.default doubledistancef(double[] s1, double[] s2) Measures the distance between two arrays.default doubledistancef(float[] s1, float[] s2) Measures the distance between two arrays.default doubledistancef(int[] s1, int[] s2) Measures the distance between two arrays.default doubledistancef(long[] s1, long[] s2) Measures the distance between two arrays.default doubledistancef(short[] s1, short[] s2) Measures the distance between two arrays.default doubleMeasures the distance between two arrays of objects.default doubleMeasures the distance between two Strings.default <T> doubleMeasures the distance between two lists of objects.
-
Method Details
-
distance
int distance(long[] s1, long[] s2) Measures the distance between two arrays.- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distance
int distance(int[] s1, int[] s2) Measures the distance between two arrays.- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distance
int distance(short[] s1, short[] s2) Measures the distance between two arrays.- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distance
int distance(byte[] s1, byte[] s2) Measures the distance between two arrays.- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distance
int distance(char[] s1, char[] s2) Measures the distance between two arrays.- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distance
int distance(double[] s1, double[] s2) Measures the distance between two arrays.- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distance
int distance(float[] s1, float[] s2) Measures the distance between two arrays.- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distance
int distance(boolean[] s1, boolean[] s2) Measures the distance between two arrays.- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distance
Measures the distance between two Strings.- Parameters:
s1- First String.s2- Second String.- Returns:
- distance between s1 and s2
-
distance
Measures the distance between two arrays of objects. The objects in the arrays must be of a class that has overridden the Object.equals method.- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distance
Measures the distance between two lists of objects. The objects in the lists must be of a class that has overridden the Object.equals method.- Type Parameters:
T- Type of List elements.- Parameters:
s1- First list.s2- Second list.- Returns:
- distance between s1 and s2
-
distancef
default double distancef(long[] s1, long[] s2) Description copied from interface:SequenceDistanceMeasurerDoubleMeasures the distance between two arrays.- Specified by:
distancefin interfaceSequenceDistanceMeasurerDouble- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distancef
default double distancef(int[] s1, int[] s2) Description copied from interface:SequenceDistanceMeasurerDoubleMeasures the distance between two arrays.- Specified by:
distancefin interfaceSequenceDistanceMeasurerDouble- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distancef
default double distancef(short[] s1, short[] s2) Description copied from interface:SequenceDistanceMeasurerDoubleMeasures the distance between two arrays.- Specified by:
distancefin interfaceSequenceDistanceMeasurerDouble- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distancef
default double distancef(byte[] s1, byte[] s2) Description copied from interface:SequenceDistanceMeasurerDoubleMeasures the distance between two arrays.- Specified by:
distancefin interfaceSequenceDistanceMeasurerDouble- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distancef
default double distancef(char[] s1, char[] s2) Description copied from interface:SequenceDistanceMeasurerDoubleMeasures the distance between two arrays.- Specified by:
distancefin interfaceSequenceDistanceMeasurerDouble- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distancef
default double distancef(double[] s1, double[] s2) Description copied from interface:SequenceDistanceMeasurerDoubleMeasures the distance between two arrays.- Specified by:
distancefin interfaceSequenceDistanceMeasurerDouble- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distancef
default double distancef(float[] s1, float[] s2) Description copied from interface:SequenceDistanceMeasurerDoubleMeasures the distance between two arrays.- Specified by:
distancefin interfaceSequenceDistanceMeasurerDouble- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distancef
default double distancef(boolean[] s1, boolean[] s2) Description copied from interface:SequenceDistanceMeasurerDoubleMeasures the distance between two arrays.- Specified by:
distancefin interfaceSequenceDistanceMeasurerDouble- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distancef
Description copied from interface:SequenceDistanceMeasurerDoubleMeasures the distance between two Strings.- Specified by:
distancefin interfaceSequenceDistanceMeasurerDouble- Parameters:
s1- First String.s2- Second String.- Returns:
- distance between s1 and s2
-
distancef
Description copied from interface:SequenceDistanceMeasurerDoubleMeasures the distance between two arrays of objects. The objects in the arrays must be of a class that has overridden the Object.equals method.- Specified by:
distancefin interfaceSequenceDistanceMeasurerDouble- Parameters:
s1- First array.s2- Second array.- Returns:
- distance between s1 and s2
-
distancef
Description copied from interface:SequenceDistanceMeasurerDoubleMeasures the distance between two lists of objects. The objects in the lists must be of a class that has overridden the Object.equals method.- Specified by:
distancefin interfaceSequenceDistanceMeasurerDouble- Type Parameters:
T- Type of List elements.- Parameters:
s1- First list.s2- Second list.- Returns:
- distance between s1 and s2
-