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 TypeMethodDescriptionvoidclear()Removes all elements in the mapping.Returns the mapping type.intReturns the number of sources.intReturns the number of targets.booleanReturns whether this mapping is the identity.iterator()Returns an iterator over the elements in this mapping.intsize()Returns the number of elements in the mapping.Methods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.apache.calcite.util.mapping.Mappings.SourceMapping
getSource, getSourceOpt, getTargetOpt, inverseMethods 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:
getSourceCountin interfaceMappings.FunctionMapping- Specified by:
getSourceCountin interfaceMappings.SourceMapping- Specified by:
getSourceCountin interfaceMappings.TargetMapping
-
getTargetCount
int getTargetCount()Returns the number of targets. Valid targets will be in the range 0 .. targetCount.- Specified by:
getTargetCountin interfaceMappings.SourceMapping- Specified by:
getTargetCountin interfaceMappings.TargetMapping
-
getMappingType
MappingType getMappingType()Description copied from interface:Mappings.CoreMappingReturns the mapping type.- Specified by:
getMappingTypein interfaceMappings.CoreMapping- Specified by:
getMappingTypein interfaceMappings.FunctionMapping- Specified by:
getMappingTypein interfaceMappings.SourceMapping- Returns:
- Mapping type
-
isIdentity
boolean isIdentity()Returns whether this mapping is the identity.- Specified by:
isIdentityin interfaceMappings.SourceMapping
-
clear
void clear()Removes all elements in the mapping. -
size
int size()Returns the number of elements in the mapping.- Specified by:
sizein interfaceMappings.CoreMapping
-