Class LineDiff

java.lang.Object
network.ike.plugin.scaffold.LineDiff

public final class LineDiff extends Object
Minimal LCS-based line differ used by tracked and tracked-block tier handlers to build human-readable diff output for scaffold-draft.

This is not a full unified-diff implementation — we only emit the prefixed lines (' ', '-', '+') without hunk headers, which is plenty for draft output where the file path is already printed separately.

Both inputs are treated as UTF-8 text and split on LF. A trailing newline is normalised away so "a\n" and "a" produce identical line lists — callers that care about trailing-newline differences should compare raw bytes.

  • Method Details

    • counts

      public static LineDiff.Counts counts(String from, String to)
      Count of '+' and '-' lines between two texts.
      Parameters:
      from - the baseline text
      to - the new text
      Returns:
      a LineDiff.Counts record
    • unified

      public static String unified(String from, String to)
      A line-prefixed diff: every line in the union starts with one of ' ', '-', or '+'. Empty output means the texts are identical.
      Parameters:
      from - the baseline text
      to - the new text
      Returns:
      a newline-terminated, prefixed diff