Package nzilbb.editpath
Class EditStep<T>
- java.lang.Object
-
- nzilbb.editpath.EditStep<T>
-
public class EditStep<T> extends Object
Represents a single step in editing one sequency into another.- Author:
- Robert Fromont robert@fromont.net.nz
- See Also:
MinimumEditPath
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EditStep.StepOperation
Enumeration for representing the operation represented by a step
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EditStep<T>
getBackTrace()
Getter foreBackTrace
: Backtrace to the previous (minimum) edit in the sequence.T
getFrom()
Getter foroFrom
: The element in the start sequence.int
getFromIndex()
Getter forfromIndex
: The index of "from".EditStep.StepOperation
getOperation()
Getter forenOperation
: The operation represented by this step.double
getStepDistance()
Getter forstepDistance
: The distance represented by this single step.T
getTo()
Getter foroTo
: The element in the end sequence.int
getToIndex()
Getter fortoIndex
: The index of "to".EditStep<T>
setBackTrace(EditStep<T> eNewBackTrace)
Setter foreBackTrace
: Backtrace to the previous (minimum) edit in the sequence.EditStep<T>
setFrom(T oNewFrom)
Setter foroFrom
: The element in the start sequence.void
setFromIndex(int newFromIndex)
Setter forfromIndex
: The index of "from".void
setFromToIndices(int fromIndex, int toIndex)
Sets both fromIndex and toIndex.EditStep<T>
setOperation(EditStep.StepOperation enNewOperation)
Setter forenOperation
: The operation represented by this step.EditStep<T>
setStepDistance(double newStepDistance)
Setter forstepDistance
: The distance represented by this single step.EditStep<T>
setTo(T oNewTo)
Setter foroTo
: The element in the end sequence.void
setToIndex(int newToIndex)
Setter fortoIndex
: The index of "to".String
toString()
Representation of the step as a string.double
totalDistance()
The total distance up to and including this edit.
-
-
-
Constructor Detail
-
EditStep
public EditStep()
Default constructor
-
EditStep
public EditStep(T from, T to, double stepDistance, EditStep.StepOperation operation)
Constructor- Parameters:
from
- Object in the source (original) list, or null.to
- Object in the destination (final) list, or null.stepDistance
- The distance represented by this single step.operation
- The operation represented by this step.
-
EditStep
public EditStep(T from, T to, double stepDistance, EditStep.StepOperation operation, EditStep<T> backtrace)
Constructor- Parameters:
from
- Object in the source (original) list, or null.to
- Object in the destination (final) list, or null.stepDistance
- The distance represented by this single step.operation
- The operation represented by this step.backtrace
- The previous (minimum) edit in the sequence.
-
-
Method Detail
-
getOperation
public EditStep.StepOperation getOperation()
Getter forenOperation
: The operation represented by this step.- Returns:
- The operation represented by this step.
-
setOperation
public EditStep<T> setOperation(EditStep.StepOperation enNewOperation)
Setter forenOperation
: The operation represented by this step.- Parameters:
enNewOperation
- The operation represented by this step.- Returns:
- this.
-
getFrom
public T getFrom()
Getter foroFrom
: The element in the start sequence.- Returns:
- The element in the start sequence.
-
setFrom
public EditStep<T> setFrom(T oNewFrom)
Setter foroFrom
: The element in the start sequence.- Parameters:
oNewFrom
- The element in the start sequence.- Returns:
- this.
-
getFromIndex
public int getFromIndex()
Getter forfromIndex
: The index of "from".- Returns:
- The index of "from".
-
setFromIndex
public void setFromIndex(int newFromIndex)
Setter forfromIndex
: The index of "from".- Parameters:
newFromIndex
- The index of "from".
-
getTo
public T getTo()
Getter foroTo
: The element in the end sequence.- Returns:
- The element in the end sequence.
-
setTo
public EditStep<T> setTo(T oNewTo)
Setter foroTo
: The element in the end sequence.- Parameters:
oNewTo
- The element in the end sequence.- Returns:
- this.
-
getToIndex
public int getToIndex()
Getter fortoIndex
: The index of "to".- Returns:
- The index of "to".
-
setToIndex
public void setToIndex(int newToIndex)
Setter fortoIndex
: The index of "to".- Parameters:
newToIndex
- The index of "to".
-
getBackTrace
public EditStep<T> getBackTrace()
Getter foreBackTrace
: Backtrace to the previous (minimum) edit in the sequence.- Returns:
- Backtrace to the previous (minimum) edit in the sequence.
-
setBackTrace
public EditStep<T> setBackTrace(EditStep<T> eNewBackTrace)
Setter foreBackTrace
: Backtrace to the previous (minimum) edit in the sequence.- Parameters:
eNewBackTrace
- Backtrace to the previous (minimum) edit in the sequence.- Returns:
- this.
-
getStepDistance
public double getStepDistance()
Getter forstepDistance
: The distance represented by this single step.- Returns:
- The distance represented by this single step.
-
setStepDistance
public EditStep<T> setStepDistance(double newStepDistance)
Setter forstepDistance
: The distance represented by this single step.- Parameters:
newStepDistance
- The distance represented by this single step.- Returns:
- this.
-
totalDistance
public double totalDistance()
The total distance up to and including this edit.- Returns:
- The total distance up to and including this edit.
-
setFromToIndices
public void setFromToIndices(int fromIndex, int toIndex)
Sets both fromIndex and toIndex.- Parameters:
fromIndex
- Value forfromIndex
toIndex
- Value fortoIndex
-
-