Package org.apache.calcite.util.mapping
Class Mappings.SurjectionWithInverse
- java.lang.Object
-
- org.apache.calcite.util.mapping.Mappings.AbstractMapping
-
- org.apache.calcite.util.mapping.Mappings.FiniteAbstractMapping
-
- org.apache.calcite.util.mapping.Mappings.PartialMapping
-
- org.apache.calcite.util.mapping.Mappings.SurjectionWithInverse
-
- All Implemented Interfaces:
java.lang.Iterable<IntPair>
,Mapping
,Mappings.CoreMapping
,Mappings.FunctionMapping
,Mappings.SourceMapping
,Mappings.TargetMapping
- Enclosing class:
- Mappings
static class Mappings.SurjectionWithInverse extends Mappings.PartialMapping
A surjection with inverse has precisely one source for each target. (Whereas a general surjection has at least one source for each target.) Every source has at most one target.If you call
set(int, int)
on a target, the target's previous source will be lost.
-
-
Field Summary
-
Fields inherited from class org.apache.calcite.util.mapping.Mappings.PartialMapping
sources, targets
-
-
Constructor Summary
Constructors Constructor Description SurjectionWithInverse(int sourceCount, int targetCount)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getSource(int target)
void
set(int source, int target)
Creates a mapping between a source and a target.-
Methods inherited from class org.apache.calcite.util.mapping.Mappings.PartialMapping
clear, getMappingType, getSourceCount, getSourceOpt, getTargetCount, getTargetOpt, inverse, isIdentity, isValid, iterator, size
-
Methods inherited from class org.apache.calcite.util.mapping.Mappings.FiniteAbstractMapping
equals, hashCode
-
Methods inherited from class org.apache.calcite.util.mapping.Mappings.AbstractMapping
getTarget, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.calcite.util.mapping.Mappings.TargetMapping
getTarget
-
-
-
-
Method Detail
-
set
public void set(int source, int target)
Creates a mapping between a source and a target.It is an error to map a target to a source which already has a target.
If you map a source to a target which already has a source, the old source becomes an orphan.
- Specified by:
set
in interfaceMappings.TargetMapping
- Overrides:
set
in classMappings.PartialMapping
- Parameters:
source
- sourcetarget
- target
-
getSource
public int getSource(int target)
- Specified by:
getSource
in interfaceMappings.SourceMapping
- Overrides:
getSource
in classMappings.AbstractMapping
-
-