|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.util.mapping.Mappings.AbstractMapping org.eigenbase.util.mapping.Mappings.PartialFunctionImpl
private static class Mappings.PartialFunctionImpl
Implementation of Mapping
where a source can have at most one
target, and a target can have any number of sources. The source count
must be finite, but the target count may be infinite.
The implementation uses an array for the forward-mapping, but does not store the backward mapping.
Field Summary | |
---|---|
private MappingType |
mappingType
|
private int |
sourceCount
|
private int |
targetCount
|
private int[] |
targets
|
Constructor Summary | |
---|---|
Mappings.PartialFunctionImpl(int sourceCount,
int targetCount,
MappingType mappingType)
|
Method Summary | |
---|---|
MappingType |
getMappingType()
|
int |
getSourceCount()
Returns the number of sources. |
int |
getTargetCount()
Returns the number of targets. |
int |
getTargetOpt(int source)
Returns the target that a source maps to, or -1 if it is not mapped. |
Mapping |
inverse()
|
Iterator<IntPair> |
iterator()
Returns an iterator over the elements in this mapping. |
void |
set(int source,
int target)
|
void |
setAll(Mapping mapping)
|
Methods inherited from class org.eigenbase.util.mapping.Mappings.AbstractMapping |
---|
getSource, getSourceOpt, getTarget, isIdentity |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eigenbase.util.mapping.Mappings.TargetMapping |
---|
getSourceOpt, getTarget |
Field Detail |
---|
private final int sourceCount
private final int targetCount
private final MappingType mappingType
private final int[] targets
Constructor Detail |
---|
public Mappings.PartialFunctionImpl(int sourceCount, int targetCount, MappingType mappingType)
Method Detail |
---|
public int getSourceCount()
Mapping
getSourceCount
in interface Mapping
getSourceCount
in interface Mappings.FunctionMapping
getSourceCount
in interface Mappings.SourceMapping
getSourceCount
in interface Mappings.TargetMapping
getSourceCount
in class Mappings.AbstractMapping
public int getTargetCount()
Mapping
getTargetCount
in interface Mapping
getTargetCount
in interface Mappings.SourceMapping
getTargetCount
in interface Mappings.TargetMapping
getTargetCount
in class Mappings.AbstractMapping
public Iterator<IntPair> iterator()
Mapping
This method is optional; implementations may throw UnsupportedOperationException
.
iterator
in interface Iterable<IntPair>
iterator
in interface Mapping
public MappingType getMappingType()
getMappingType
in interface Mapping
getMappingType
in interface Mappings.FunctionMapping
getMappingType
in interface Mappings.SourceMapping
getMappingType
in interface Mappings.TargetMapping
public Mapping inverse()
inverse
in interface Mappings.SourceMapping
inverse
in interface Mappings.TargetMapping
public void set(int source, int target)
set
in interface Mappings.TargetMapping
set
in class Mappings.AbstractMapping
public void setAll(Mapping mapping)
public int getTargetOpt(int source)
Mappings.FunctionMapping
getTargetOpt
in interface Mappings.FunctionMapping
getTargetOpt
in interface Mappings.SourceMapping
getTargetOpt
in interface Mappings.TargetMapping
getTargetOpt
in class Mappings.AbstractMapping
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |