Provides support for finding and displaying the differences
between hierarchically structured data.
Package Specification
The class Differencer is a differencing engine for hierarchically
structured data. It takes two or three inputs and performs a two-way or
three-way compare on them.
If the input elements to the differencing engine implement the IStructureComparator
interface the engine recursively applies itself to the children of
the input element. Leaf elements must implement the IStreamContentAccessor
interface (see package org.eclipse.compare) so that the
differencer can perform a bytewise comparison on them.
By default the differencing engine returns the result of the compare
as a tree of DiffNode objects. Every DiffNode describes
the changes among the two or three inputs.
A tree of DiffNodes can be displayed in a DiffTreeViewer.
The DiffTreeViewer requires that inner nodes of the tree implement
the IDiffContainer interface and leafs the IDiffElement
interface.
The typical steps to compare hierarchically structured data and to display
the differences would be to:
-
map the input data into a tree of IStructureComparator and IStreamContentAccessors,
-
perform the compare operation by means of the Differencer, and
-
feed the differencing result into the DiffTreeViewer.
The StructureDiffViewer is a specialized DiffTreeViewer
that automates the three steps from above. It takes a single input object
of type ICompareInput from which it retrieves the two or three
input elements to compare. Then it uses a IStructureCreator to
extract a tree of IStructureComparator and IStreamContentAccessor
from them. These trees are then compared with the differencing engine and
the result is displayed in the tree viewer.