public enum MappingType extends java.lang.Enum<MappingType>
MULTI_FUNCTION
(every element in the source and target domain can
participate in many mappings) to the most retricted BIJECTION
(every
element in the source and target domain must be paired with precisely one
element in the other domain).
Some common types:
Once you know what type of mapping you want, call
Mappings.create(MappingType, int, int)
to create an efficient
implementation of that mapping.
Enum Constant and Description |
---|
BIJECTION |
ELEVEN |
FOURTEEN |
FUNCTION |
INJECTION |
INVERSE_FUNCTION
An inverse function has a source for every target, but a source might
have 0, 1 or more targets.
|
INVERSE_INJECTION |
INVERSE_PARTIAL_FUNCTION |
INVERSE_PARTIAL_INJECTION |
INVERSE_SURJECTION
An inverse surjection has a source for every target, and no source has
more than one target.
|
MULTI_FUNCTION |
PARTIAL_FUNCTION |
PARTIAL_INJECTION |
PARTIAL_SURJECTION
A partial surjection has no more than one source for any target, and no
more than one target for any source.
|
SURJECTION |
TEN |
Modifier and Type | Field and Description |
---|---|
private int |
inverseOrdinal |
private static int |
MULTIPLE_SOURCE
Allow more than one source for a given target.
|
private static int |
MULTIPLE_TARGET
Allow more than one target for a given source.
|
private static int |
OPTIONAL_SOURCE
Allow less than one source for a given target.
|
private static int |
OPTIONAL_TARGET
Allow less than one target for a given source.
|
Modifier and Type | Method and Description |
---|---|
MappingType |
inverse() |
boolean |
isA(MappingType mappingType)
Returns whether this mapping type is (possibly a weaker form of) a given
mapping type.
|
boolean |
isBijection()
A mapping is a bijection if it is a surjection and it is an injection.
|
boolean |
isFunction()
A mapping is a total function if every source has precisely one target.
|
boolean |
isInjection()
A mapping is an injection if it is a function and no target has more than
one source.
|
boolean |
isMandatorySource()
Constraint that every target has at least one source.
|
boolean |
isMandatoryTarget()
Constraint that every source has at least one target.
|
boolean |
isPartialFunction()
A mapping is a partial function if every source has at most one target.
|
boolean |
isSingleSource()
Constraint that every target has at most one source.
|
boolean |
isSingleTarget()
Constraint that every source has at most one target.
|
boolean |
isSurjection()
A mapping is a surjection if it is a function and every target has at
least one source.
|
static MappingType |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static MappingType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final MappingType BIJECTION
public static final MappingType SURJECTION
public static final MappingType INJECTION
public static final MappingType FUNCTION
public static final MappingType INVERSE_SURJECTION
public static final MappingType PARTIAL_SURJECTION
public static final MappingType PARTIAL_INJECTION
public static final MappingType PARTIAL_FUNCTION
public static final MappingType INVERSE_INJECTION
public static final MappingType INVERSE_PARTIAL_INJECTION
public static final MappingType TEN
public static final MappingType ELEVEN
public static final MappingType INVERSE_FUNCTION
Obeys the constaints isMandatorySource()
,
isSingleSource()
.
Similar types:
INVERSE_SURJECTION
is stronger (a source may not have
multiple targets);
INVERSE_PARTIAL_FUNCTION
is weaker (a target may have 0 or 1
sources).
public static final MappingType INVERSE_PARTIAL_FUNCTION
public static final MappingType FOURTEEN
public static final MappingType MULTI_FUNCTION
private final int inverseOrdinal
private static final int OPTIONAL_SOURCE
private static final int MULTIPLE_SOURCE
private static final int OPTIONAL_TARGET
private static final int MULTIPLE_TARGET
public static MappingType[] values()
for (MappingType c : MappingType.values()) System.out.println(c);
public static MappingType valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic MappingType inverse()
public boolean isA(MappingType mappingType)
public boolean isFunction()
public boolean isPartialFunction()
public boolean isSurjection()
public boolean isInjection()
public boolean isBijection()
public boolean isMandatoryTarget()
public boolean isSingleTarget()
public boolean isMandatorySource()
public boolean isSingleSource()
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.