X
- the class of the elements in the left input sequence.Y
- the class of the elements in the right input sequence.R
- The result class.public abstract class AbstractStrictAlignmentAlgorithm<X,Y,R> extends Object implements AlignmentAlgorithm<X,Y,R>
Constructor and Description |
---|
AbstractStrictAlignmentAlgorithm(Comparator<X,Y> comparator,
Class<R> resultClass) |
Modifier and Type | Method and Description |
---|---|
R |
calculateAlignment(List<X> a,
List<Y> b)
This calculates the alignment dissimilarity D between the Sequences x ∈ X* and y ∈
Y* and returns it as an instance of the result class for this algorithm.
|
Comparator<X,Y> |
getComparator()
This should return the Comparator used to compute local distances for this algorithm.
|
double[][] |
getLastAlignmentMatrix()
The last matrix that was calculated using this algorithm.
|
Class<R> |
getResultClass()
This method shall return the class of the alignment result.
|
static <X,Y> double |
normalizeDissimilarity(double d,
List<X> a,
List<Y> b)
Normalizes the given raw distance by the worst case that could occur in an alignment of the
two sequences: In the worst case, we replace all elements in a with elements in b and
delete/insert the remaining elements in the longer sequence.
|
boolean |
requires(OperationType type)
This method should return true if and only if this AlignmentAlgorithm uses the given
operation.
|
void |
setComparator(Comparator<X,Y> comparator)
This should set the Comparator used to compute local distances for this algorithm.
|
abstract R |
transformToResult(double[][] alignmentMatrix,
double[][] repCosts,
double[] delCosts,
double[] insCosts,
List<X> a,
List<Y> b)
This method has to be implemented by sub classes to transform a calculated dynamic
programming matrix to a valid result of that implementation.
|
public AbstractStrictAlignmentAlgorithm(@NonNull Comparator<X,Y> comparator, @NonNull Class<R> resultClass)
public Class<R> getResultClass()
AlignmentAlgorithm
getResultClass
in interface AlignmentAlgorithm<X,Y,R>
public Comparator<X,Y> getComparator()
AlignmentAlgorithm
getComparator
in interface AlignmentAlgorithm<X,Y,R>
public void setComparator(@NonNull Comparator<X,Y> comparator)
AlignmentAlgorithm
setComparator
in interface AlignmentAlgorithm<X,Y,R>
comparator
- the comparator that is used to compute local distances for this Algorithm.public double[][] getLastAlignmentMatrix()
public boolean requires(@NonNull OperationType type)
AlignmentAlgorithm
requires
in interface AlignmentAlgorithm<X,Y,R>
type
- an OperationType.public R calculateAlignment(@NonNull List<X> a, @NonNull List<Y> b)
AlignmentAlgorithm
calculateAlignment
in interface AlignmentAlgorithm<X,Y,R>
a
- The left input sequence.b
- The right input sequence.public abstract R transformToResult(@NonNull double[][] alignmentMatrix, @NonNull double[][] repCosts, @NonNull double[] delCosts, @NonNull double[] insCosts, @NonNull List<X> a, @NonNull List<Y> b)
alignmentMatrix
- a dynamic programming matrix calculated with respect to both input
sequences.repCosts
- the matrix of pairwise REPLACEMENT costs for each pairwise combination of
elements in the input sequences.delCosts
- the vector of DELETION costs for each element of the left input sequence.insCosts
- the vector of INSERTION costs for each element of the right input sequence.a
- the first input sequence.b
- the second input sequence.public static <X,Y> double normalizeDissimilarity(double d, @NonNull List<X> a, @NonNull List<Y> b)
X
- the class of elements in the first input sequence.Y
- the class of elements in the second input sequence.d
- the raw alignment distance between sequences a and b in the range [0,infinity)a
- the left-hand input sequence.b
- the right-hand input sequence.Copyright (C) 2016-2018 Benjamin Paaßen, AG Theoretical Computer Science, Centre of Excellence Cognitive Interaction Technology (CITEC), University of Bielefeld, licensed under the AGPL v. 3: http://openresearch.cit-ec.de/projects/tcs . This documentation is licensed under the conditions of CC-BY-SA 4.0: https://creativecommons.org/licenses/by-sa/4.0/