Package org.apache.calcite.util.mapping
Interface Mapping
-
- All Superinterfaces:
java.lang.Iterable<IntPair>
,Mappings.CoreMapping
,Mappings.FunctionMapping
,Mappings.SourceMapping
,Mappings.TargetMapping
- All Known Implementing Classes:
AbstractSourceMapping
,AbstractTargetMapping
,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, java.lang.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 throwMappings.TooManyElementsException
. - If a source has no targets, then the method
Mappings.FunctionMapping.getTarget(int)
will throwMappings.NoElementException
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clear()
Removes all elements in the mapping.MappingType
getMappingType()
Returns the mapping type.int
getSourceCount()
Returns the number of sources.int
getTargetCount()
Returns the number of targets.boolean
isIdentity()
Returns whether this mapping is the identity.java.util.Iterator<IntPair>
iterator()
Returns an iterator over the elements in this mapping.int
size()
Returns the number of elements in the mapping.-
Methods inherited from interface org.apache.calcite.util.mapping.Mappings.SourceMapping
getSource, getSourceOpt, getTargetOpt, inverse
-
Methods inherited from interface org.apache.calcite.util.mapping.Mappings.TargetMapping
getSourceOpt, getTarget, getTargetOpt, inverse, set
-
-
-
-
Method Detail
-
iterator
java.util.Iterator<IntPair> iterator()
Returns an iterator over the elements in this mapping.This method is optional; implementations may throw
UnsupportedOperationException
.- Specified by:
iterator
in interfacejava.lang.Iterable<IntPair>
-
getSourceCount
int getSourceCount()
Returns the number of sources. Valid sources will be in the range 0 .. sourceCount.- Specified by:
getSourceCount
in interfaceMappings.FunctionMapping
- Specified by:
getSourceCount
in interfaceMappings.SourceMapping
- Specified by:
getSourceCount
in interfaceMappings.TargetMapping
-
getTargetCount
int getTargetCount()
Returns the number of targets. Valid targets will be in the range 0 .. targetCount.- Specified by:
getTargetCount
in interfaceMappings.SourceMapping
- Specified by:
getTargetCount
in interfaceMappings.TargetMapping
-
getMappingType
MappingType getMappingType()
Description copied from interface:Mappings.CoreMapping
Returns the mapping type.- Specified by:
getMappingType
in interfaceMappings.CoreMapping
- Specified by:
getMappingType
in interfaceMappings.FunctionMapping
- Specified by:
getMappingType
in interfaceMappings.SourceMapping
- Returns:
- Mapping type
-
isIdentity
boolean isIdentity()
Returns whether this mapping is the identity.- Specified by:
isIdentity
in interfaceMappings.SourceMapping
-
clear
void clear()
Removes all elements in the mapping.
-
size
int size()
Returns the number of elements in the mapping.- Specified by:
size
in interfaceMappings.CoreMapping
-
-