Class 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
    • 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 for enOperation: The operation represented by this step.
        Returns:
        The operation represented by this step.
      • setOperation

        public EditStep<T> setOperation​(EditStep.StepOperation enNewOperation)
        Setter for enOperation: The operation represented by this step.
        Parameters:
        enNewOperation - The operation represented by this step.
        Returns:
        this.
      • getFrom

        public T getFrom()
        Getter for oFrom: The element in the start sequence.
        Returns:
        The element in the start sequence.
      • setFrom

        public EditStep<T> setFrom​(T oNewFrom)
        Setter for oFrom: The element in the start sequence.
        Parameters:
        oNewFrom - The element in the start sequence.
        Returns:
        this.
      • getFromIndex

        public int getFromIndex()
        Getter for fromIndex: The index of "from".
        Returns:
        The index of "from".
      • setFromIndex

        public void setFromIndex​(int newFromIndex)
        Setter for fromIndex: The index of "from".
        Parameters:
        newFromIndex - The index of "from".
      • getTo

        public T getTo()
        Getter for oTo: The element in the end sequence.
        Returns:
        The element in the end sequence.
      • setTo

        public EditStep<T> setTo​(T oNewTo)
        Setter for oTo: The element in the end sequence.
        Parameters:
        oNewTo - The element in the end sequence.
        Returns:
        this.
      • getToIndex

        public int getToIndex()
        Getter for toIndex: The index of "to".
        Returns:
        The index of "to".
      • setToIndex

        public void setToIndex​(int newToIndex)
        Setter for toIndex: The index of "to".
        Parameters:
        newToIndex - The index of "to".
      • getBackTrace

        public EditStep<T> getBackTrace()
        Getter for eBackTrace: 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 for eBackTrace: 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 for stepDistance: The distance represented by this single step.
        Returns:
        The distance represented by this single step.
      • setStepDistance

        public EditStep<T> setStepDistance​(double newStepDistance)
        Setter for stepDistance: 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 for fromIndex
        toIndex - Value for toIndex
      • toString

        public String toString()
        Representation of the step as a string.
        Overrides:
        toString in class Object
        Returns:
        Representation of the step as a string.