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:
java.lang.Iterable<IntPair>
,Mapping
,Mappings.CoreMapping
,Mappings.FunctionMapping
,Mappings.SourceMapping
,Mappings.TargetMapping
public abstract class AbstractSourceMapping extends Mappings.AbstractMapping implements Mapping
Simple implementation ofMappings.TargetMapping
where the number of sources and targets are specified as constructor parameters and you just need to implement one method,
-
-
Field Summary
Fields Modifier and Type Field Description private int
sourceCount
private int
targetCount
-
Constructor Summary
Constructors Constructor Description AbstractSourceMapping(int sourceCount, int targetCount)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
clear()
Removes all elements in the mapping.MappingType
getMappingType()
Returns the mapping type.int
getSourceCount()
Returns the number of sources.abstract int
getSourceOpt(int source)
int
getTargetCount()
Returns the number of targets.Mapping
inverse()
java.util.Iterator<IntPair>
iterator()
Returns an iterator over the elements in this mapping.int
size()
Returns the number of elements in the mapping.-
Methods inherited from class org.apache.calcite.util.mapping.Mappings.AbstractMapping
getSource, getTarget, getTargetOpt, isIdentity, set, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.calcite.util.mapping.Mapping
isIdentity
-
Methods inherited from interface org.apache.calcite.util.mapping.Mappings.SourceMapping
getSource, getTargetOpt
-
Methods inherited from interface org.apache.calcite.util.mapping.Mappings.TargetMapping
getTarget, getTargetOpt, set
-
-
-
-
Method Detail
-
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
- Overrides:
getSourceCount
in classMappings.AbstractMapping
-
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
- Overrides:
getTargetCount
in classMappings.AbstractMapping
-
inverse
public Mapping inverse()
- Specified by:
inverse
in interfaceMappings.SourceMapping
- Specified by:
inverse
in interfaceMappings.TargetMapping
-
size
public int size()
Description copied from interface:Mapping
Returns the number of elements in the mapping.- Specified by:
size
in interfaceMapping
- Specified by:
size
in interfaceMappings.CoreMapping
-
clear
public void clear()
Description copied from interface:Mapping
Removes all elements in the mapping.
-
getMappingType
public MappingType getMappingType()
Description copied from interface:Mappings.CoreMapping
Returns the mapping type.- Specified by:
getMappingType
in interfaceMapping
- Specified by:
getMappingType
in interfaceMappings.CoreMapping
- Specified by:
getMappingType
in interfaceMappings.FunctionMapping
- Specified by:
getMappingType
in interfaceMappings.SourceMapping
- Returns:
- Mapping type
-
iterator
public java.util.Iterator<IntPair> iterator()
Description copied from interface:Mapping
Returns an iterator over the elements in this mapping.This method is optional; implementations may throw
UnsupportedOperationException
.
-
getSourceOpt
public abstract int getSourceOpt(int source)
- Specified by:
getSourceOpt
in interfaceMappings.SourceMapping
- Specified by:
getSourceOpt
in interfaceMappings.TargetMapping
- Overrides:
getSourceOpt
in classMappings.AbstractMapping
-
-