org.infai.emo.matcher.util
Class Mapping

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.HashSet<Tuple>
              extended by org.infai.emo.matcher.util.Mapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Tuple>, java.util.Collection<Tuple>, java.util.Set<Tuple>

public class Mapping
extends java.util.HashSet<Tuple>

This class contains a mapping between two models.
The mapping contains tuples, each containing one element of the first model an one element of the second model.
In this context the mapping is a complete cross product that maps each element of the first model to each element of the second model. Note: Donīt swap this mapping with the second phase of the difference detection-algorithm.

Version:
1.0.0
Author:
Stanley Hillner
See Also:
Tuple, Serialized Form

Field Summary
private  boolean crossProduct
          This flag indicates if the models where mapped using a full cross product.
private  Model leftModel
          The left model of the mapping.
private  Model rightModel
          The right model or the mapping.
 
Constructor Summary
Mapping()
          An empty mapping without models.
Mapping(Model model1, Model model2, boolean crossProduct)
          Method that builds the mapping between the two models by creating tuples for every possible pair of elements of the models.
 
Method Summary
 Mapping getInvertedMapping()
          Inverts the tuples of the Mapping, thus the element-order of the tuples will be switched.
 Model getLeftModel()
           
 Model getRightModel()
           
 boolean isCrossProduct()
          Whether a full cross-product was used for the mapping.
 java.lang.String toString()
          
 
Methods inherited from class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, remove, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Field Detail

leftModel

private Model leftModel
The left model of the mapping.

See Also:
Model

rightModel

private Model rightModel
The right model or the mapping.

See Also:
Model

crossProduct

private boolean crossProduct
This flag indicates if the models where mapped using a full cross product.

Constructor Detail

Mapping

public Mapping(Model model1,
               Model model2,
               boolean crossProduct)
Method that builds the mapping between the two models by creating tuples for every possible pair of elements of the models.

Parameters:
leftModel - the model that provides the first elements of the tuples.
rightModel - the model that provides the second elements of the tuples.
crossProduct - indicates if the mapping shall be built using a cross product or not.
If this flag is set to false the mapping will only contain tuples of elements of the same meta-type.
See Also:
leftModel, rightModel, crossProduct

Mapping

Mapping()
An empty mapping without models.

Method Detail

getInvertedMapping

public Mapping getInvertedMapping()
Inverts the tuples of the Mapping, thus the element-order of the tuples will be switched.

Returns:
an inverted mapping of the mapping on which this method was called.
See Also:
Tuple

toString

public java.lang.String toString()

Overrides:
toString in class java.util.AbstractCollection<Tuple>

getLeftModel

public Model getLeftModel()
Returns:
the left model of the mapping.
See Also:
leftModel

getRightModel

public Model getRightModel()
Returns:
the right model of the mapping.
See Also:
rightModel

isCrossProduct

public boolean isCrossProduct()
Whether a full cross-product was used for the mapping.