cz.cuni.versatile.api.relops
Interface PropertyMapping

All Known Subinterfaces:
Many2ManyMapping, Many2OneMapping, One2ManyMapping, One2OneMapping
All Known Implementing Classes:
IdentityMapping

public interface PropertyMapping

PropertyMapping interface represents a generic a transformational map from a set of properties to another set of another properties. Mathematically speaking, it is an n-ary function (P1, P2, P3, ..., Pn) -> (P1', P2', P3', ...Pm), n and m being positive integers, so that given input values (x1:P1, ..., xn:Pn) it calculates a tuple of output values (y1:P1', ..., ym:Pm).

This generic interface is a super-type for a set of specialized mapping interfaces with different arities. The purpose of this interface to serve as a marker interface and for meta-modeling capabilities like property dependency tracking. One of its sub-types Many2ManyMapping corresponds to the most generic n:m mapping, other are simpler 1:n, n:1 and 1:1 arity maps.

The reason behind the chosen type hierarchy organization is to make implementation of the most common mappings easier, by most common we assume 1:1 - unary function.

Author:
Jaroslav Gergic

Method Summary
 java.util.Set getDomainSet()
          Domain: a set of all source properties required to calculate a value of this mapping.
 java.util.Set getRangeSet()
          Range: Returns a set of all target properties calculated by this mapping.
 PropertyMapping getReverse()
          Returns an implementation of the corresponding reverse mapping, if implemented.
 boolean providesReverse()
          Check whether this property mapping is aware of its corresponding reverse transformation map.
 

Method Detail

providesReverse

public boolean providesReverse()
Check whether this property mapping is aware of its corresponding reverse transformation map.

Returns:
true if an invocation to getReverse() will return a reverse mapping.

getDomainSet

public java.util.Set getDomainSet()
Domain: a set of all source properties required to calculate a value of this mapping. The size of the set is the arity of the mapping.

Returns:
a set of all source properties, must contain at least one item

getRangeSet

public java.util.Set getRangeSet()
Range: Returns a set of all target properties calculated by this mapping.

Returns:
a set of all target properties, must contain at least one item

getReverse

public PropertyMapping getReverse()
Returns an implementation of the corresponding reverse mapping, if implemented. A reverse mapping has their domain and range sets swapped and in addition to that it should semantically complement its counterpart. If this methods does return null, it does not mean a reverse mapping does not exist: there can still be one or more independent implementations.

Returns:
reverse mapping if exists and known to this mapping implementation