org.eigenbase.util.mapping
Class Mappings.SurjectionWithInverse
java.lang.Object
org.eigenbase.util.mapping.Mappings.AbstractMapping
org.eigenbase.util.mapping.Mappings.FiniteAbstractMapping
org.eigenbase.util.mapping.Mappings.PartialMapping
org.eigenbase.util.mapping.Mappings.SurjectionWithInverse
- All Implemented Interfaces:
- Iterable<IntPair>, Mapping, 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.
Method Summary |
int |
getSource(int target)
|
void |
set(int source,
int target)
Creates a mapping between a source and a target. |
Mappings.SurjectionWithInverse
Mappings.SurjectionWithInverse(int sourceCount,
int targetCount)
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 interface Mappings.TargetMapping
- Overrides:
set
in class Mappings.PartialMapping
- Parameters:
source
- sourcetarget
- target
getSource
public int getSource(int target)
- Specified by:
getSource
in interface Mappings.SourceMapping
- Overrides:
getSource
in class Mappings.AbstractMapping