Salt  3.4.2
A powerful, tagset-independent and theory-neutral meta model and API for storing, manipulating, and representing nearly all types of linguistic data .
org.corpus_tools.salt.util.internal.AbstractDiff< S extends Object > Class Template Referenceabstract

Public Member Functions

 AbstractDiff (final S template, final S other)
 Initializes Diff object with the two graphs template and other. More...
 
 AbstractDiff (final S template, final S other, DiffOptions optionMap)
 
boolean isIsomorph ()
 Compares the set graphs and returns if they are isomorphic or not. More...
 
Set< DifferencefindDiffs ()
 Compares the set graphs and returns if they are isomorphic or not. More...
 

Protected Member Functions

BiMap< SNode, SNodegetIsoNodes ()
 Return BiMap with isomorphic SNodes key= template, value= other. More...
 
Set< DifferencegetDifferences ()
 Returns a list containing all computed differences. More...
 
void addDifference (final Object templateObject, final Object otherObject, final Object container, final DIFF_TYPES diffType, final Set< Difference > subDiffs)
 Adds a difference to the differences set. More...
 
boolean compareIdentifiableElements (final IdentifiableElement template, final IdentifiableElement other, final Set< Difference > subDiffs)
 Checks whether two IdentifiableElement objects are isomorph. More...
 
boolean compareAnnotationContainers (final SAnnotationContainer template, final SAnnotationContainer other, final Set< Difference > subDiffs)
 Checks whether two SAnnotationContainer objects are isomorph and returns true if this is the case, false otherwise. More...
 
abstract boolean findDiffs (boolean diffsRequested)
 

Protected Attributes

final S templateObject
 
final S otherObject
 
final DiffOptions options
 
Set< Differencedifferences = null
 
boolean diffsRequested = false
 if false, only isomorphie is computed, which makes the process faster but does not collect all differences
 

Constructor & Destructor Documentation

◆ AbstractDiff()

org.corpus_tools.salt.util.internal.AbstractDiff< S extends Object >.AbstractDiff ( final S  template,
final S  other 
)

Initializes Diff object with the two graphs template and other.

Parameters
template
other

Member Function Documentation

◆ addDifference()

void org.corpus_tools.salt.util.internal.AbstractDiff< S extends Object >.addDifference ( final Object  templateObject,
final Object  otherObject,
final Object  container,
final DIFF_TYPES  diffType,
final Set< Difference subDiffs 
)
protected

Adds a difference to the differences set.

Parameters
templateObjectfirst Salt object
otherObjectsecond Salt object
containerObject containing the given object, e.g. used for layers
diffTypetype of the difference
Returns
returns whether sizes are the same

◆ compareAnnotationContainers()

boolean org.corpus_tools.salt.util.internal.AbstractDiff< S extends Object >.compareAnnotationContainers ( final SAnnotationContainer  template,
final SAnnotationContainer  other,
final Set< Difference subDiffs 
)
protected

Checks whether two SAnnotationContainer objects are isomorph and returns true if this is the case, false otherwise.

If subdiffs is not null, the differences will be added to that list, if that list is empty the method returns false when the first difference was found.
The behavior of this method depends on options: OPTION_IGNORE_META_ANNOTATIONS, OPTION_IGNORE_PROCESSING_ANNOTATIONS, OPTION_IGNORE_ANNOTATIONS and OPTION_IGNORE_FEATURES

Parameters
templateNode
otherNode
subDiffsif differences shall be computed, this list must not have to be empty
Returns

◆ compareIdentifiableElements()

boolean org.corpus_tools.salt.util.internal.AbstractDiff< S extends Object >.compareIdentifiableElements ( final IdentifiableElement  template,
final IdentifiableElement  other,
final Set< Difference subDiffs 
)
protected

Checks whether two IdentifiableElement objects are isomorph.

If option OPTION_IGNORE_ID is false, this method returns true, if the id values of both are equal, false otherwise.If subdiffs is not null, the differences will be added to that list, if that list is empty the method returns false when the first difference was found.

Parameters
templateNode
otherNode
subDiffs
Returns
true if elements have the same id, false otherwise

◆ findDiffs()

Set<Difference> org.corpus_tools.salt.util.internal.AbstractDiff< S extends Object >.findDiffs ( )

Compares the set graphs and returns if they are isomorphic or not.

If graphs are not isomporphic, this method finds and records all differences and lists them. This means the entire graphs have to be compared and could slow down the computation. If you are only interested in the result and not in the particular differences, use method isIsomorph().

Returns
true, if graphs are isomorphic, false otherwise.

◆ getDifferences()

Set<Difference> org.corpus_tools.salt.util.internal.AbstractDiff< S extends Object >.getDifferences ( )
protected

Returns a list containing all computed differences.

Returns
returns differences Set

◆ getIsoNodes()

BiMap<SNode, SNode> org.corpus_tools.salt.util.internal.AbstractDiff< S extends Object >.getIsoNodes ( )
protected

Return BiMap with isomorphic SNodes key= template, value= other.

Returns
BiMap with isomorphic SNodes

◆ isIsomorph()

boolean org.corpus_tools.salt.util.internal.AbstractDiff< S extends Object >.isIsomorph ( )

Compares the set graphs and returns if they are isomorphic or not.

In case of the graphs are not isomorphic, this method does not record all differences. TO speed up the computation. it just detects the first difference and returns false. To get a full list of all differences, use method findDiffs().

Returns
true, if graphs are isomorphic, false otherwise.