Interface Source

All Known Subinterfaces:
GitPatch, Relevance
All Known Implementing Classes:
BadVDiff, CommitDiffVariationDiffSource, CompositeSource, Configure, ConfigureSpec, FileSource, GitPatch.SimpleGitPatch, GitSource, LineGraphFileSource, PatchDiff, PatchString, ProjectionSource, Search, Trace, TraceSup, VariationDiff, VariationTree, ViewSource

public interface Source
An interface for source traceability. For testing and debugging, it can be really useful to know where some value originated from. For example, imagine an error during you analysis of a VariationDiff. Now you want to know where the variation diff came from. The solution: DiffDetectice tracks the source and transformations of important data structures like VariationDiff.getSource() and allows you to inspect them using this interface.

Source represents a hierarchy of inputs, processing steps, and results (the distinction between these types is not directly reflected in the API and only serve as explanation of the interface).

In summary, each Source in the hierarchy has a short explanation and a number of arguments. A source may contain additional data (e.g., the diff a variation diff originated from) that is too big to be printed by the standard formatting functions (shallowExplanation(), shortExplanation(org.variantsync.diffdetective.util.Source), fullExplanation(int,java.lang.StringBuilder)) of this interface. To access such data, or the arguments of specific subclasses, you can use <T>findFirst(org.variantsync.diffdetective.util.Source,java.lang.Class<T>) and <T>findAll(org.variantsync.diffdetective.util.Source,java.lang.Class<T>).

For dealing with generic sources, it is recommended to use the static methods of this interface. They provide a more readable interface (e.g., variationDiff.shallowExplanation() vs. Source.shallowExplanation(variationDiff)) and correctly deal with null sources (treated as Unknown).

See Also: