cz.cuni.versatile.core
Class IdentityMapping

java.lang.Object
  extended bycz.cuni.versatile.core.IdentityMapping
All Implemented Interfaces:
One2OneMapping, PropertyMapping

public final class IdentityMapping
extends java.lang.Object
implements One2OneMapping

A generic implementation of an identity mapping.

This is essentially used for property renaming to ensure compatibility between multiple property namespaces. For example when using multiple revisions of UAProf or other vocabulary, where each revision uses a different XML namespace as a prefix for their attributes, even though some of the attributes definitions remain unchanged.

Author:
Jaroslav Gergic

Constructor Summary
IdentityMapping(Property domain, Property range)
          Constructs a mapping instance for a given pair of properties.
 
Method Summary
 Property getDomain()
          Returns a domain of this mapping.
 java.util.Set getDomainSet()
          Domain: a set of all source properties required to calculate a value of this mapping.
 Property getRange()
          Returns a range 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.
 java.lang.Object mapValue(java.lang.Object dom)
          Implements an identity function, i.e., returns its input as the output.
 boolean providesReverse()
          Check whether this property mapping is aware of its corresponding reverse transformation map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdentityMapping

public IdentityMapping(Property domain,
                       Property range)
Constructs a mapping instance for a given pair of properties.

Method Detail

getDomain

public Property getDomain()
Description copied from interface: One2OneMapping
Returns a domain of this mapping.

Specified by:
getDomain in interface One2OneMapping
Returns:
a domain property
See Also:
One2OneMapping.getDomain()

getRange

public Property getRange()
Description copied from interface: One2OneMapping
Returns a range of this mapping.

Specified by:
getRange in interface One2OneMapping
Returns:
a range property
See Also:
One2OneMapping.getRange()

mapValue

public java.lang.Object mapValue(java.lang.Object dom)
Implements an identity function, i.e., returns its input as the output.

Specified by:
mapValue in interface One2OneMapping
Parameters:
dom - a domain property value
Returns:
a range property value
See Also:
One2OneMapping.mapValue(java.lang.Object)

providesReverse

public boolean providesReverse()
Description copied from interface: PropertyMapping
Check whether this property mapping is aware of its corresponding reverse transformation map.

Specified by:
providesReverse in interface PropertyMapping
Returns:
true if an invocation to getReverse() will return a reverse mapping.
See Also:
PropertyMapping.providesReverse()

getDomainSet

public java.util.Set getDomainSet()
Description copied from interface: PropertyMapping
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.

Specified by:
getDomainSet in interface PropertyMapping
Returns:
a set of all source properties, must contain at least one item
See Also:
PropertyMapping.getDomainSet()

getRangeSet

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

Specified by:
getRangeSet in interface PropertyMapping
Returns:
a set of all target properties, must contain at least one item
See Also:
PropertyMapping.getRangeSet()

getReverse

public PropertyMapping getReverse()
Description copied from interface: PropertyMapping
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.

Specified by:
getReverse in interface PropertyMapping
Returns:
reverse mapping if exists and known to this mapping implementation
See Also:
PropertyMapping.getReverse()