Class PathNode

java.lang.Object
com.github.difflib.algorithm.myers.PathNode

public final class PathNode extends Object
A node in a diffpath.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final boolean
     
    final int
    Position in the original sequence.
    final int
    Position in the revised sequence.
    final PathNode
    The previous node in the path.
    final boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    PathNode(int i, int j, boolean snake, boolean bootstrap, PathNode prev)
    Concatenates a new path node with an existing diffpath.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Is this a bootstrap node?
    boolean
     
    final PathNode
    Skips sequences of PathNodes until a snake or bootstrap node is found, or the end of the path is reached.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • i

      public final int i
      Position in the original sequence.
    • j

      public final int j
      Position in the revised sequence.
    • prev

      public final PathNode prev
      The previous node in the path.
    • snake

      public final boolean snake
    • bootstrap

      public final boolean bootstrap
  • Constructor Details

    • PathNode

      public PathNode(int i, int j, boolean snake, boolean bootstrap, PathNode prev)
      Concatenates a new path node with an existing diffpath.
      Parameters:
      i - The position in the original sequence for the new node.
      j - The position in the revised sequence for the new node.
      prev - The previous node in the path.
  • Method Details

    • isSnake

      public boolean isSnake()
    • isBootstrap

      public boolean isBootstrap()
      Is this a bootstrap node?

      In bottstrap nodes one of the two corrdinates is less than zero.

      Returns:
      tru if this is a bootstrap node.
    • previousSnake

      public final PathNode previousSnake()
      Skips sequences of PathNodes until a snake or bootstrap node is found, or the end of the path is reached.
      Returns:
      The next first PathNode or bootstrap node in the path, or null if none found.
    • toString

      public String toString()
      Overrides:
      toString in class Object