public abstract static class Mappings.AbstractMapping extends java.lang.Object implements Mapping
Mapping
.Constructor and Description |
---|
AbstractMapping() |
Modifier and Type | Method and Description |
---|---|
int |
getSource(int target) |
int |
getSourceCount()
Returns the number of sources.
|
int |
getSourceOpt(int target) |
int |
getTarget(int source)
Returns the target that a source maps to.
|
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.
|
boolean |
isIdentity()
Returns whether this mapping is the identity.
|
void |
set(int source,
int target) |
java.lang.String |
toString()
Returns a string representation of this mapping.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
clear, getMappingType, iterator, size
inverse
inverse
public void set(int source, int target)
set
in interface Mappings.TargetMapping
public int getTargetOpt(int source)
Mappings.FunctionMapping
getTargetOpt
in interface Mappings.FunctionMapping
getTargetOpt
in interface Mappings.SourceMapping
getTargetOpt
in interface Mappings.TargetMapping
public int getTarget(int source)
Mappings.FunctionMapping
getTarget
in interface Mappings.FunctionMapping
getTarget
in interface Mappings.TargetMapping
source
- sourcepublic int getSourceOpt(int target)
getSourceOpt
in interface Mappings.SourceMapping
getSourceOpt
in interface Mappings.TargetMapping
public int getSource(int target)
getSource
in interface Mappings.SourceMapping
public int getSourceCount()
Mapping
getSourceCount
in interface Mapping
getSourceCount
in interface Mappings.FunctionMapping
getSourceCount
in interface Mappings.SourceMapping
getSourceCount
in interface Mappings.TargetMapping
public int getTargetCount()
Mapping
getTargetCount
in interface Mapping
getTargetCount
in interface Mappings.SourceMapping
getTargetCount
in interface Mappings.TargetMapping
public boolean isIdentity()
Mapping
isIdentity
in interface Mapping
isIdentity
in interface Mappings.SourceMapping
public java.lang.String toString()
For example, the mapping
source | 0 | 1 | 2 |
---|---|---|---|
target | -1 | 3 | 2 |
target | 0 | 1 | 2 | 3 |
---|---|---|---|---|
source | -1 | -1 | 2 | 1 |
is represented by the string "[1:3, 2:2]".
This method relies upon the optional method Mapping.iterator()
.
toString
in class java.lang.Object
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.