public abstract class AbstractSourceMapping extends Mappings.AbstractMapping implements Mapping
Mappings.TargetMapping
where the
number of sources and targets are specified as constructor parameters and you
just need to implement one method,Modifier and Type | Field and Description |
---|---|
private int |
sourceCount |
private int |
targetCount |
Constructor and Description |
---|
AbstractSourceMapping(int sourceCount,
int targetCount) |
Modifier and Type | Method and 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.
|
getSource, getTarget, getTargetOpt, isIdentity, set, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isIdentity
getSource, getTargetOpt
getTarget, getTargetOpt, set
public AbstractSourceMapping(int sourceCount, int targetCount)
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 Mapping inverse()
inverse
in interface Mappings.SourceMapping
inverse
in interface Mappings.TargetMapping
public int size()
Mapping
size
in interface Mapping
size
in interface Mappings.CoreMapping
public void clear()
Mapping
public MappingType getMappingType()
Mappings.CoreMapping
getMappingType
in interface Mapping
getMappingType
in interface Mappings.CoreMapping
getMappingType
in interface Mappings.FunctionMapping
getMappingType
in interface Mappings.SourceMapping
public java.util.Iterator<IntPair> iterator()
Mapping
This method is optional; implementations may throw
UnsupportedOperationException
.
public abstract int getSourceOpt(int source)
getSourceOpt
in interface Mappings.SourceMapping
getSourceOpt
in interface Mappings.TargetMapping
getSourceOpt
in class Mappings.AbstractMapping
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.