org.eigenbase.util.mapping
Interface Mapping

All Superinterfaces:
Iterable<IntPair>, Mappings.FunctionMapping, Mappings.SourceMapping, Mappings.TargetMapping
All Known Implementing Classes:
Mappings.AbstractMapping, Mappings.FiniteAbstractMapping, Mappings.IdentityMapping, Mappings.InverseMapping, Mappings.OverridingSourceMapping, Mappings.OverridingTargetMapping, Mappings.PartialFunctionImpl, Mappings.PartialMapping, Mappings.SurjectionWithInverse, Permutation

public interface Mapping
extends Mappings.FunctionMapping, Mappings.SourceMapping, Mappings.TargetMapping, Iterable<IntPair>

A Mapping is a relationship between a source domain to target domain of integers.

This interface represents the most general possible mapping. Depending on the MappingType of a particular mapping, some of the operations may not be applicable. If you call the method, you will receive a runtime error. For instance:

  • If a target has more than one source, then the method Mappings.SourceMapping.getSource(int) will throw Mappings.TooManyElementsException.
  • If a source has no targets, then the method Mappings.FunctionMapping.getTarget(int) will throw Mappings.NoElementException.


    Method Summary
     MappingType getMappingType()
               
     int getSourceCount()
              Returns the number of sources.
     int getTargetCount()
              Returns the number of targets.
     boolean isIdentity()
              Returns whether this mapping is the identity.
     Iterator<IntPair> iterator()
              Returns an iterator over the elements in this mapping.
     
    Methods inherited from interface org.eigenbase.util.mapping.Mappings.FunctionMapping
    getTarget, getTargetOpt
     
    Methods inherited from interface org.eigenbase.util.mapping.Mappings.SourceMapping
    getSource, getSourceOpt, getTargetOpt, inverse
     
    Methods inherited from interface org.eigenbase.util.mapping.Mappings.TargetMapping
    getSourceOpt, getTarget, getTargetOpt, inverse, set
     

    Method Detail

    iterator

    Iterator<IntPair> iterator()
    Returns an iterator over the elements in this mapping.

    This method is optional; implementations may throw UnsupportedOperationException.

    Specified by:
    iterator in interface Iterable<IntPair>

    getSourceCount

    int getSourceCount()
    Returns the number of sources. Valid sources will be in the range 0 .. sourceCount.

    Specified by:
    getSourceCount in interface Mappings.FunctionMapping
    Specified by:
    getSourceCount in interface Mappings.SourceMapping
    Specified by:
    getSourceCount in interface Mappings.TargetMapping

    getTargetCount

    int getTargetCount()
    Returns the number of targets. Valid targets will be in the range 0 .. targetCount.

    Specified by:
    getTargetCount in interface Mappings.SourceMapping
    Specified by:
    getTargetCount in interface Mappings.TargetMapping

    getMappingType

    MappingType getMappingType()
    Specified by:
    getMappingType in interface Mappings.FunctionMapping
    Specified by:
    getMappingType in interface Mappings.SourceMapping
    Specified by:
    getMappingType in interface Mappings.TargetMapping

    isIdentity

    boolean isIdentity()
    Returns whether this mapping is the identity.

    Specified by:
    isIdentity in interface Mappings.SourceMapping