java.lang.Object
org.variantsync.diffdetective.variation.diff.serialize.Format<L>

public class Format<L extends Label> extends Object
Format used for exporting a VariationDiff. For easy reusability this class is composed of separate node and edge formats. The exported VariationDiff can be influenced in the following ways:
  • Providing both a node and an edge label format.
  • Changing the order, filtering or adding the nodes and edges by creating a subclass of Format.
  • Field Details

  • Constructor Details

  • Method Details

    • getNodeFormat

      public DiffNodeLabelFormat<? super L> getNodeFormat()
    • getEdgeFormat

      public EdgeLabelFormat<? super L> getEdgeFormat()
    • forEachNode

      public <La extends L> void forEachNode(VariationDiff<La> variationDiff, Consumer<DiffNode<La>> callback)
      Iterates over all DiffNodes in variationDiff and calls callback. Exporters should use this method to enable subclasses of Format to filter nodes, add new nodes and change the order of the exported nodes. This implementation is equivalent to VariationDiff.forAll(java.util.function.Consumer<org.variantsync.diffdetective.variation.diff.DiffNode<L>>).
      Parameters:
      variationDiff - to be exported
      callback - is called for each node
    • forEachEdge

      public <La extends L> void forEachEdge(VariationDiff<La> variationDiff, Consumer<StyledEdge<La>> callback)
      Iterates over all edges in variationDiff and calls callback, visiting parallel edges only once. If an edge is unchanged (there are equal before and after edges) callback is only called once. Exporters should use this method to enable subclasses of Format to filter edges, add new edges and change the order of the exported edges.
      Parameters:
      variationDiff - to be exported
      callback - is called for each unique edge
    • sortedEdgeWithLabel

      protected <La extends L> void sortedEdgeWithLabel(DiffNode<La> originalFrom, DiffNode<La> originalTo, StyledEdge.Style style, Consumer<StyledEdge<La>> callback)
      Constructs a StyledEdge from originalFrom to originalTo. The order of these nodes is permuted according to EdgeLabelFormat.getEdgeDirection() of getEdgeFormat().
      Parameters:
      originalFrom - the origin of the constructed edge
      originalTo - the destination of the constructed edge
      style - the export style of the constructed edge
      callback - the consumer which is called with the resulting StyledEdge