Package org.apache.calcite.util.mapping
Class AbstractSourceMapping
java.lang.Object
org.apache.calcite.util.mapping.Mappings.AbstractMapping
org.apache.calcite.util.mapping.AbstractSourceMapping
- All Implemented Interfaces:
Iterable<IntPair>,Mapping,Mappings.CoreMapping,Mappings.FunctionMapping,Mappings.SourceMapping,Mappings.TargetMapping
Simple implementation of
Mappings.TargetMapping where the
number of sources and targets are specified as constructor parameters, and you
just need to implement one method.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all elements in the mapping.Returns the mapping type.intReturns the number of sources.abstract intgetSourceOpt(int source) Returns the source that a target maps to, or -1 if it is not mapped.intReturns the number of targets.inverse()iterator()Returns an iterator over the elements in this mapping.intsize()Returns the number of elements in the mapping.Methods inherited from class org.apache.calcite.util.mapping.Mappings.AbstractMapping
getSource, getTarget, getTargetOpt, isIdentity, set, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.apache.calcite.util.mapping.Mapping
isIdentityMethods inherited from interface org.apache.calcite.util.mapping.Mappings.SourceMapping
getSource, getTargetOptMethods inherited from interface org.apache.calcite.util.mapping.Mappings.TargetMapping
getTarget, getTargetOpt, set
-
Constructor Details
-
AbstractSourceMapping
protected AbstractSourceMapping(int sourceCount, int targetCount)
-
-
Method Details
-
getSourceCount
public int getSourceCount()Description copied from interface:MappingReturns the number of sources. Valid sources will be in the range 0 .. sourceCount.- Specified by:
getSourceCountin interfaceMapping- Specified by:
getSourceCountin interfaceMappings.FunctionMapping- Specified by:
getSourceCountin interfaceMappings.SourceMapping- Specified by:
getSourceCountin interfaceMappings.TargetMapping- Overrides:
getSourceCountin classMappings.AbstractMapping
-
getTargetCount
public int getTargetCount()Description copied from interface:MappingReturns the number of targets. Valid targets will be in the range 0 .. targetCount.- Specified by:
getTargetCountin interfaceMapping- Specified by:
getTargetCountin interfaceMappings.SourceMapping- Specified by:
getTargetCountin interfaceMappings.TargetMapping- Overrides:
getTargetCountin classMappings.AbstractMapping
-
inverse
- Specified by:
inversein interfaceMappings.SourceMapping- Specified by:
inversein interfaceMappings.TargetMapping
-
size
public int size()Description copied from interface:MappingReturns the number of elements in the mapping.- Specified by:
sizein interfaceMapping- Specified by:
sizein interfaceMappings.CoreMapping
-
clear
public void clear()Description copied from interface:MappingRemoves all elements in the mapping. -
getMappingType
Description copied from interface:Mappings.CoreMappingReturns the mapping type.- Specified by:
getMappingTypein interfaceMapping- Specified by:
getMappingTypein interfaceMappings.CoreMapping- Specified by:
getMappingTypein interfaceMappings.FunctionMapping- Specified by:
getMappingTypein interfaceMappings.SourceMapping- Returns:
- Mapping type
-
iterator
Description copied from interface:MappingReturns an iterator over the elements in this mapping.This method is optional; implementations may throw
UnsupportedOperationException. -
getSourceOpt
public abstract int getSourceOpt(int source) Description copied from interface:Mappings.SourceMappingReturns the source that a target maps to, or -1 if it is not mapped.- Specified by:
getSourceOptin interfaceMappings.SourceMapping- Specified by:
getSourceOptin interfaceMappings.TargetMapping- Overrides:
getSourceOptin classMappings.AbstractMapping
-