java.lang.Object
org.variantsync.diffdetective.variation.diff.serialize.LineGraphExport

public final class LineGraphExport extends Object
Class that contains functions for writing CommitDiffs and (sets of) VariationDiffs to a linegraph file.
Author:
Paul Bittner, Kevin Jedelhauser
  • Field Details

  • Constructor Details

    • LineGraphExport

      private LineGraphExport()
  • Method Details

    • toLineGraphFormat

      public static <L extends Label> VariationDiffSerializeDebugData toLineGraphFormat(VariationDiff<? extends L> variationDiff, LineGraphExportOptions<? super L> options, OutputStream destination) throws IOException
      Exports the given VariationDiff to a linegraph String. No file will be written.
      Parameters:
      variationDiff - The variation diff to export to linegraph format.
      options - Configuration options for the export, such as the format used for node and edge labels.
      Returns:
      A pair holding some debug information and the produced linegraph as a string.
      Throws:
      IOException
    • toLineGraphFormat

      public static <L extends Label> LineGraphExport.Statistic toLineGraphFormat(Iterable<VariationDiff<L>> trees, LineGraphExportOptions<? super L> options, OutputStream destination) throws IOException
      Exports the given VariationDiffs that originated from a repository with the given name.
      Parameters:
      trees - The set of trees to export.
      options - Configuration options for the export, such as the format used for node and edge labels.
      Returns:
      A pair of (1) metadata about the exported VariationDiffs, and (2) the produced linegraph as String.
      Throws:
      IOException
    • toLineGraphFormat

      public static LineGraphExport.Statistic toLineGraphFormat(CommitDiff commitDiff, LineGraphExportOptions<? super DiffLinesLabel> options, OutputStream destination) throws IOException
      Writes the given commitDiff in linegraph format to the given StringBuilder.
      Parameters:
      commitDiff - The diff to convert to line graph format.
      options - Configuration options for the export, such as the format used for node and edge labels.
      destination - where the resulting line graph is written
      Returns:
      The number of the next diff tree to export (updated value of treeCounter).
      Throws:
      IOException
    • toLineGraphFormat

      public static LineGraphExport.Statistic toLineGraphFormat(PatchDiff patch, LineGraphExportOptions<? super DiffLinesLabel> options, OutputStream destination) throws IOException
      Writes the given patch in linegraph format to the given StringBuilder.
      Parameters:
      patch - The diff to convert to line graph format.
      options - Configuration options for the export, such as the format used for node and edge labels.
      destination - where the resulting line graph is written
      Returns:
      The number of the next diff tree to export (updated value of treeCounter).
      Throws:
      IOException
    • lineGraphHeader

      private static String lineGraphHeader(VariationDiffSource source, LineGraphExportOptions<?> options)
      Produces the final linegraph file content. Creates a linegraph header from the given VariationDiffSource using the LineGraphExportOptions.treeFormat() in the given options. Then appends the already created file content for nodes and edges.
      Parameters:
      source - The VariationDiffSource that describes where the VariationDiff whose content is written to the file originated from.
      options - LineGraphExportOptions used to determine the treeFormat for the header.
    • lineGraphFooter

      private static String lineGraphFooter()