Package org.apache.calcite.util.mapping
Interface Mapping
- All Superinterfaces:
Iterable<IntPair>
,Mappings.CoreMapping
,Mappings.FunctionMapping
,Mappings.SourceMapping
,Mappings.TargetMapping
- All Known Implementing Classes:
AbstractSourceMapping
,AbstractTargetMapping
,Mappings.AbstractMapping
,Mappings.FiniteAbstractMapping
,Mappings.IdentityMapping
,Mappings.OverridingSourceMapping
,Mappings.OverridingTargetMapping
,Mappings.PartialMapping
,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 throwMappings.TooManyElementsException
. - If a source has no targets, then the method
Mappings.FunctionMapping.getTarget(int)
will throwMappings.NoElementException
.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Removes all elements in the mapping.Returns the mapping type.int
Returns the number of sources.int
Returns the number of targets.boolean
Returns whether this mapping is the identity.iterator()
Returns an iterator over the elements in this mapping.int
size()
Returns the number of elements in the mapping.Methods inherited from interface java.lang.Iterable
forEach, spliterator
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 Details
-
iterator
Returns an iterator over the elements in this mapping.This method is optional; implementations may throw
UnsupportedOperationException
. -
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
-