org.infai.emo.matcher
Class StructureComparator

java.lang.Object
  extended by org.infai.emo.matcher.Comparator
      extended by org.infai.emo.matcher.StructureComparator
Direct Known Subclasses:
ContainerComparator, ContentsComparator

public abstract class StructureComparator
extends Comparator

Abstract class for comparing two elements in context of the model structure.
Shows that the Comparator is used for structured comparison of elements.
Note: Before using this comparator at least one other comparator of type ElementComparator has to be used before so that you can take the previous matching-values into account.

Version:
1.0.0
Author:
Stanley Hillner
See Also:
Comparator

Field Summary
private  double comparisonCount
          The number of previous comparisons for the previous matching.
private  Matching matching
          The previous matching of the two models to compare.
 
Constructor Summary
StructureComparator(Matching matching, double comparisonCount)
          Constructor that initializes the comparator by setting the previous matching and the comparisonCount.
 
Method Summary
 double getComparisonCount()
           
 Matching getMatching()
           
 
Methods inherited from class org.infai.emo.matcher.Comparator
compareTo, getName, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

matching

private Matching matching
The previous matching of the two models to compare. This matching can e.g. be used to take previous comparisons between referenced model-elements into account.

See Also:
Matching

comparisonCount

private double comparisonCount
The number of previous comparisons for the previous matching.

Note: the comparisonCount is calculated as the sum of the weightings of the previously used comparators.
If you e.g. used 3 comparators before this one and the weightings were 0.5, 1.0, 0.75 then the comparisonCount for this comparator is 2.25.

Constructor Detail

StructureComparator

public StructureComparator(Matching matching,
                           double comparisonCount)
                    throws java.lang.IllegalArgumentException
Constructor that initializes the comparator by setting the previous matching and the comparisonCount.

Parameters:
matching - the previous completed matching between two models.
ComparisonCount - the number of previous comparison-operations for this matching.
Throws:
An - IllegalArgumentException will be thrown if the matching is null
java.lang.IllegalArgumentException
See Also:
matching, comparisonCount
Method Detail

getMatching

public Matching getMatching()
Returns:
the matching that was part of the input of the comparator.

getComparisonCount

public double getComparisonCount()
Returns:
the number of comparisons up to this comparator.