Package org.apache.calcite.util.mapping
Enum MappingType
 java.lang.Object

 java.lang.Enum<MappingType>

 org.apache.calcite.util.mapping.MappingType

 All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<MappingType>
public enum MappingType extends java.lang.Enum<MappingType>
Describes the type of a mapping, from the most generalMULTI_FUNCTION
(every element in the source and target domain can participate in many mappings) to the most retrictedBIJECTION
(every element in the source and target domain must be paired with precisely one element in the other domain).Some common types:
 A surjection is a mapping if every target has at least one source; also known as an 'onto' mapping.
 A mapping is a partial function if every source has at most one target.
 A mapping is a function if every source has precisely one target.
 An injection is a mapping where a target has at most one source; also somewhat confusingly known as a 'onetoone' mapping.
 A bijection is a mapping which is both an injection and a surjection. Every source has precisely one target, and vice versa.
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 Summary
Enum Constants Enum Constant 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

Field Summary
Fields Modifier and Type Field 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.

Constructor Summary
Constructors Modifier Constructor Description private
MappingType()

Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.



Enum Constant Detail

BIJECTION
public static final MappingType BIJECTION

SURJECTION
public static final MappingType SURJECTION

INJECTION
public static final MappingType INJECTION

FUNCTION
public static final MappingType FUNCTION

INVERSE_SURJECTION
public static final MappingType INVERSE_SURJECTION
An inverse surjection has a source for every target, and no source has more than one target.

PARTIAL_SURJECTION
public static final MappingType PARTIAL_SURJECTION
A partial surjection has no more than one source for any target, and no more than one target for any source.

PARTIAL_INJECTION
public static final MappingType PARTIAL_INJECTION

PARTIAL_FUNCTION
public static final MappingType PARTIAL_FUNCTION

INVERSE_INJECTION
public static final MappingType INVERSE_INJECTION

INVERSE_PARTIAL_INJECTION
public static final MappingType INVERSE_PARTIAL_INJECTION

TEN
public static final MappingType TEN

ELEVEN
public static final MappingType ELEVEN

INVERSE_FUNCTION
public static final MappingType INVERSE_FUNCTION
An inverse function has a source for every target, but a source might have 0, 1 or more targets.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).


INVERSE_PARTIAL_FUNCTION
public static final MappingType INVERSE_PARTIAL_FUNCTION

FOURTEEN
public static final MappingType FOURTEEN

MULTI_FUNCTION
public static final MappingType MULTI_FUNCTION


Field Detail

inverseOrdinal
private final int inverseOrdinal

OPTIONAL_SOURCE
private static final int OPTIONAL_SOURCE
Allow less than one source for a given target. See Also:
 Constant Field Values

MULTIPLE_SOURCE
private static final int MULTIPLE_SOURCE
Allow more than one source for a given target. See Also:
 Constant Field Values

OPTIONAL_TARGET
private static final int OPTIONAL_TARGET
Allow less than one target for a given source. See Also:
 Constant Field Values

MULTIPLE_TARGET
private static final int MULTIPLE_TARGET
Allow more than one target for a given source. See Also:
 Constant Field Values


Method Detail

values
public static MappingType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (MappingType c : MappingType.values()) System.out.println(c);
 Returns:
 an array containing the constants of this enum type, in the order they are declared

valueOf
public static MappingType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) Parameters:
name
 the name of the enum constant to be returned. Returns:
 the enum constant with the specified name
 Throws:
java.lang.IllegalArgumentException
 if this enum type has no constant with the specified namejava.lang.NullPointerException
 if the argument is null

inverse
public MappingType inverse()

isA
public boolean isA(MappingType mappingType)

isFunction
public boolean isFunction()
A mapping is a total function if every source has precisely one target.

isPartialFunction
public boolean isPartialFunction()
A mapping is a partial function if every source has at most one target.

isSurjection
public boolean isSurjection()
A mapping is a surjection if it is a function and every target has at least one source.

isInjection
public boolean isInjection()
A mapping is an injection if it is a function and no target has more than one source. (In other words, every source has precisely one target.)

isBijection
public boolean isBijection()
A mapping is a bijection if it is a surjection and it is an injection. (In other words,

isMandatoryTarget
public boolean isMandatoryTarget()
Constraint that every source has at least one target.

isSingleTarget
public boolean isSingleTarget()
Constraint that every source has at most one target.

isMandatorySource
public boolean isMandatorySource()
Constraint that every target has at least one source.

isSingleSource
public boolean isSingleSource()
Constraint that every target has at most one source.

