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
-
Method Summary
Modifier and TypeMethodDescriptionint
getSource
(int target) Returns the source that a target maps to.int
Returns the number of sources.int
getSourceOpt
(int target) Returns the source that a target maps to, or -1 if it is not mapped.int
getTarget
(int source) Returns the target that a source maps to.int
Returns the number of targets.int
getTargetOpt
(int source) Returns the target that a source maps to, or -1 if it is not mapped.boolean
Returns whether this mapping is the identity.void
set
(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, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.apache.calcite.util.mapping.Mapping
clear, getMappingType, iterator, size
Methods inherited from interface org.apache.calcite.util.mapping.Mappings.SourceMapping
inverse
Methods 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:
set
in interfaceMappings.TargetMapping
-
getTargetOpt
public int getTargetOpt(int source) Description copied from interface:Mappings.FunctionMapping
Returns the target that a source maps to, or -1 if it is not mapped.- Specified by:
getTargetOpt
in interfaceMappings.FunctionMapping
- Specified by:
getTargetOpt
in interfaceMappings.SourceMapping
- Specified by:
getTargetOpt
in interfaceMappings.TargetMapping
-
getTarget
public int getTarget(int source) Description copied from interface:Mappings.FunctionMapping
Returns the target that a source maps to.- Specified by:
getTarget
in interfaceMappings.FunctionMapping
- Specified by:
getTarget
in interfaceMappings.TargetMapping
- Parameters:
source
- source- Returns:
- target
-
getSourceOpt
public int getSourceOpt(int target) Description copied from interface:Mappings.SourceMapping
Returns the source that a target maps to, or -1 if it is not mapped.- Specified by:
getSourceOpt
in interfaceMappings.SourceMapping
- Specified by:
getSourceOpt
in interfaceMappings.TargetMapping
-
getSource
public int getSource(int target) Description copied from interface:Mappings.SourceMapping
Returns the source that a target maps to.- Specified by:
getSource
in interfaceMappings.SourceMapping
- Parameters:
target
- target- Returns:
- source
-
getSourceCount
public int getSourceCount()Description copied from interface:Mapping
Returns the number of sources. Valid sources will be in the range 0 .. sourceCount.- Specified by:
getSourceCount
in interfaceMapping
- Specified by:
getSourceCount
in interfaceMappings.FunctionMapping
- Specified by:
getSourceCount
in interfaceMappings.SourceMapping
- Specified by:
getSourceCount
in interfaceMappings.TargetMapping
-
getTargetCount
public int getTargetCount()Description copied from interface:Mapping
Returns the number of targets. Valid targets will be in the range 0 .. targetCount.- Specified by:
getTargetCount
in interfaceMapping
- Specified by:
getTargetCount
in interfaceMappings.SourceMapping
- Specified by:
getTargetCount
in interfaceMappings.TargetMapping
-
isIdentity
public boolean isIdentity()Description copied from interface:Mapping
Returns whether this mapping is the identity.- Specified by:
isIdentity
in interfaceMapping
- Specified by:
isIdentity
in 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()
.
-