Class ScoringMatrixImpl
- java.lang.Object
-
- de.uni_trier.wi2.procake.similarity.nest.sequence.utils.impl.ScoringMatrixImpl
-
- All Implemented Interfaces:
ScoringMatrix
public class ScoringMatrixImpl extends Object implements ScoringMatrix
-
-
Field Summary
-
Fields inherited from interface de.uni_trier.wi2.procake.similarity.nest.sequence.utils.ScoringMatrix
DIAGONAL, HORIZONTAL, NO_STEP, VERTICAL
-
-
Constructor Summary
Constructors Constructor Description ScoringMatrixImpl(DataObject[] queryObjects, DataObject[] caseObjects)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MatrixPathbacktrackFrom(int queryIdx, int caseIdx)Create the alignment path of this scoring matrix.MatrixPathbacktrackFrom(MatrixPath.MatrixCellPair cell)Create the alignment path of this scoring matrix.doubleget(int queryIdx, int caseIdx)Get the value of a cell.doubleget(MatrixPath.MatrixCellPair pair)Get the value of a cell.doublegetHighestScore()Get the highest score in the last row of the matrix.MatrixPath.MatrixCellPairgetPair(int queryIdx, int caseIdx)Get the NESTTaskPair object at the specified position.MatrixPath.MatrixCellPairgetSourceOf(int queryIdx, int caseIdx)Get the source of a cell.intgetSourceStepOf(int queryIdx, int caseIdx)Get the source step of a cell.MatrixPath.MatrixCellPairgetStartCell(boolean onlyLastRow)Get the start cell of the alignment path.voidinitialize()Initialize the first row and first column to value zero.booleanisInBounds(int queryIdx, int caseIdx)Whether or not the indices are in bounds.voidset(int queryIdx, int caseIdx, int stepToSource, double value)Set a cell of the matrix to a given value and also provide the direction to the source cell.voidset(int queryIdx, int caseIdx, MatrixPath.MatrixCellPair sourceCell, double value)Set a cell of the matrix to a given value and also provide a reference to the source cell.voidset(MatrixPath.MatrixCellPair pair)Set a cell of the matrix to the given pair.
-
-
-
Constructor Detail
-
ScoringMatrixImpl
public ScoringMatrixImpl(DataObject[] queryObjects, DataObject[] caseObjects)
-
-
Method Detail
-
initialize
public void initialize()
Description copied from interface:ScoringMatrixInitialize the first row and first column to value zero.- Specified by:
initializein interfaceScoringMatrix
-
set
public void set(int queryIdx, int caseIdx, int stepToSource, double value)Description copied from interface:ScoringMatrixSet a cell of the matrix to a given value and also provide the direction to the source cell.- Specified by:
setin interfaceScoringMatrix- Parameters:
queryIdx- Index of the query task to set.caseIdx- Index of the case task to set.stepToSource- Either DIAGONAL, VERTICAL or HORIZONTAL.value- The value to set this cell to.
-
set
public void set(int queryIdx, int caseIdx, MatrixPath.MatrixCellPair sourceCell, double value)Description copied from interface:ScoringMatrixSet a cell of the matrix to a given value and also provide a reference to the source cell.- Specified by:
setin interfaceScoringMatrix- Parameters:
queryIdx- Index of the query task to set.caseIdx- Index of the case task to set.sourceCell- The source cell.value- The value to set this cell to.
-
set
public void set(MatrixPath.MatrixCellPair pair)
Description copied from interface:ScoringMatrixSet a cell of the matrix to the given pair.- Specified by:
setin interfaceScoringMatrix- Parameters:
pair- The new cell entry containing also the indices.
-
get
public double get(int queryIdx, int caseIdx)Description copied from interface:ScoringMatrixGet the value of a cell.- Specified by:
getin interfaceScoringMatrix- Parameters:
queryIdx- The query task index.caseIdx- The case task index.- Returns:
- The value at the given position.
-
get
public double get(MatrixPath.MatrixCellPair pair)
Description copied from interface:ScoringMatrixGet the value of a cell.- Specified by:
getin interfaceScoringMatrix- Parameters:
pair- Specifies the cell's position in the matrix.- Returns:
- The value at the given position.
-
getPair
public MatrixPath.MatrixCellPair getPair(int queryIdx, int caseIdx)
Description copied from interface:ScoringMatrixGet the NESTTaskPair object at the specified position.- Specified by:
getPairin interfaceScoringMatrix- Returns:
-
getSourceOf
public MatrixPath.MatrixCellPair getSourceOf(int queryIdx, int caseIdx)
Description copied from interface:ScoringMatrixGet the source of a cell.- Specified by:
getSourceOfin interfaceScoringMatrix- Parameters:
queryIdx- The query task index of the cell.caseIdx- The case task index of the dell.- Returns:
- A pair representing the source cell.
-
getSourceStepOf
public int getSourceStepOf(int queryIdx, int caseIdx)Description copied from interface:ScoringMatrixGet the source step of a cell.- Specified by:
getSourceStepOfin interfaceScoringMatrix- Parameters:
queryIdx- The query task index of the cell.caseIdx- The case task index of the dell.- Returns:
- Either DIAGONAL, VERTICAL or HORIZONTAL.
-
getHighestScore
public double getHighestScore()
Description copied from interface:ScoringMatrixGet the highest score in the last row of the matrix.- Specified by:
getHighestScorein interfaceScoringMatrix- Returns:
- The score.
-
getStartCell
public MatrixPath.MatrixCellPair getStartCell(boolean onlyLastRow)
Description copied from interface:ScoringMatrixGet the start cell of the alignment path. Always returns the cell with the highest value in the last row of the matrix.- Specified by:
getStartCellin interfaceScoringMatrix- Parameters:
onlyLastRow- Depicts whether only to search in last row of matrix.- Returns:
- A pair representing the start cell.
-
backtrackFrom
public MatrixPath backtrackFrom(MatrixPath.MatrixCellPair cell)
Description copied from interface:ScoringMatrixCreate the alignment path of this scoring matrix. Backtracks to a cell of value 0 (not included).- Specified by:
backtrackFromin interfaceScoringMatrix- Parameters:
cell- The cell to start the backtrack from.- Returns:
- The found path.
-
backtrackFrom
public MatrixPath backtrackFrom(int queryIdx, int caseIdx)
Description copied from interface:ScoringMatrixCreate the alignment path of this scoring matrix. Backtracks to a cell of value 0 (not included).- Specified by:
backtrackFromin interfaceScoringMatrix- Parameters:
queryIdx- The query task index of the starting cell.caseIdx- The case task index of the starting cell.- Returns:
- The found path.
-
isInBounds
public boolean isInBounds(int queryIdx, int caseIdx)Description copied from interface:ScoringMatrixWhether or not the indices are in bounds.- Specified by:
isInBoundsin interfaceScoringMatrix- Returns:
- True, if the indices are in bounds.
-
-