Package org.apache.calcite.util.mapping
Class Mappings.AbstractMapping
java.lang.Object
org.apache.calcite.util.mapping.Mappings.AbstractMapping
- All Implemented Interfaces:
Iterable<IntPair>,Mapping,Mappings.CoreMapping,Mappings.FunctionMapping,Mappings.SourceMapping,Mappings.TargetMapping
- Direct Known Subclasses:
AbstractSourceMapping,AbstractTargetMapping,Mappings.FiniteAbstractMapping,Mappings.IdentityMapping,Mappings.OverridingSourceMapping,Mappings.OverridingTargetMapping
- Enclosing class:
Mappings
Abstract implementation of
Mapping.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetSource(int target) Returns the source that a target maps to.intReturns the number of sources.intgetSourceOpt(int target) Returns the source that a target maps to, or -1 if it is not mapped.intgetTarget(int source) Returns the target that a source maps to.intReturns the number of targets.intgetTargetOpt(int source) Returns the target that a source maps to, or -1 if it is not mapped.booleanReturns whether this mapping is the identity.voidset(int source, int target) toString()Returns a string representation of this mapping.Methods 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
clear, getMappingType, iterator, sizeMethods inherited from interface org.apache.calcite.util.mapping.Mappings.SourceMapping
inverseMethods inherited from interface org.apache.calcite.util.mapping.Mappings.TargetMapping
inverse
-
Constructor Details
-
AbstractMapping
public AbstractMapping()
-
-
Method Details
-
set
public void set(int source, int target) - Specified by:
setin interfaceMappings.TargetMapping
-
getTargetOpt
public int getTargetOpt(int source) Description copied from interface:Mappings.FunctionMappingReturns the target that a source maps to, or -1 if it is not mapped.- Specified by:
getTargetOptin interfaceMappings.FunctionMapping- Specified by:
getTargetOptin interfaceMappings.SourceMapping- Specified by:
getTargetOptin interfaceMappings.TargetMapping
-
getTarget
public int getTarget(int source) Description copied from interface:Mappings.FunctionMappingReturns the target that a source maps to.- Specified by:
getTargetin interfaceMappings.FunctionMapping- Specified by:
getTargetin interfaceMappings.TargetMapping- Parameters:
source- source- Returns:
- target
-
getSourceOpt
public int getSourceOpt(int target) 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
-
getSource
public int getSource(int target) Description copied from interface:Mappings.SourceMappingReturns the source that a target maps to.- Specified by:
getSourcein interfaceMappings.SourceMapping- Parameters:
target- target- Returns:
- source
-
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
-
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
-
isIdentity
public boolean isIdentity()Description copied from interface:MappingReturns whether this mapping is the identity.- Specified by:
isIdentityin interfaceMapping- Specified by:
isIdentityin interfaceMappings.SourceMapping
-
toString
Returns a string representation of this mapping.For example, the mapping
Example source 0 1 2 target -1 3 2 Example target 0 1 2 3 source -1 -1 2 1 is represented by the string "[1:3, 2:2]".
This method relies upon the optional method
Mapping.iterator().
-