public enum FunctionProperty extends Enum<FunctionProperty>
ObjectConverter
.
Any given function can have zero, one or more properties from this enumeration. Some properties not included in this enumeration can be expressed by a combination of other properties:
Property | How to build |
---|---|
Bijective | EnumSet.of(INJECTIVE, SURJECTIVE) |
Monotonic | EnumSet.of(INJECTIVE)
or EnumSet.of(SURJECTIVE) |
Strictly increasing | EnumSet.of(ORDER_PRESERVING, INJECTIVE) |
Strictly decreasing | EnumSet.of(ORDER_REVERSING, INJECTIVE) |
Integer.toString()
function is included in a larger set, which is
the set of all possible String
values. In this Javadoc, T stands for
the later set.ObjectConverter.properties()
Defined in the sis-utility
module
Enum Constant and Description |
---|
INJECTIVE
A function is injective if each value of T is either unrelated
to S, or is the output of exactly one value of S.
|
INVERTIBLE
A function is invertible if it can provide an other function mapping
T values to S values.
|
ORDER_PRESERVING
A function preserves order if any sequence of increasing S values is mapped
to a sequence of increasing T values.
|
ORDER_REVERSING
A function reverses order if any sequence of increasing S values is mapped
to a sequence of decreasing T values.
|
SURJECTIVE
A function is surjective if any value of T can be created
from one or many values of S.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
isBijective(Set<FunctionProperty> properties)
Returns
true if a function having the given set of properties is bijective. |
static boolean |
isMonotonic(Set<FunctionProperty> properties)
Returns
true if a function having the given set of properties is monotonic. |
static FunctionProperty |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static FunctionProperty[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final FunctionProperty INVERTIBLE
While other values defined in this enumeration are more about the mathematical aspects
of functions, this particular value is more about the programmatical aspect. A function
may be conceptually invertible (all bijective functions
should be), but the inverse operation may not be implemented. In such case, the function
properties shall not include this INVERTIBLE
value.
ObjectConverter.inverse()
public static final FunctionProperty INJECTIVE
ObjectConverter
doing conversions from Integer
to String
is an injective function, because no pair of integers can produce the same string.SURJECTIVE
,
isBijective(Set)
public static final FunctionProperty SURJECTIVE
ObjectConverter
doing conversions from String
to Integer
is a surjective function, since there is always at least one string for each integer value. Note that such
function can not be injective since many different strings can represent the same integer value.INJECTIVE
,
isBijective(Set)
public static final FunctionProperty ORDER_PRESERVING
Comparable
types or primitive types having a comparable wrapper.
Strictly ordered input values are not necessarily mapped to strictly ordered output values. Strictness is preserved only if the function is also injective.
A function may be both order preserving and order reversing if all input values are mapped to a constant output value.
ORDER_REVERSING
,
isMonotonic(Set)
public static final FunctionProperty ORDER_REVERSING
Comparable
types or primitive types having a comparable wrapper.
Strictly ordered input values are not necessarily mapped to strictly ordered output values. Strictness is preserved only if the function is also injective.
A function may be both order preserving and order reversing if all input values are mapped to a constant output value.
ORDER_PRESERVING
,
isMonotonic(Set)
public static FunctionProperty[] values()
for (FunctionProperty c : FunctionProperty.values()) System.out.println(c);
public static FunctionProperty valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static boolean isBijective(Set<FunctionProperty> properties)
true
if a function having the given set of properties is bijective.
Bijective functions have a one-to-one relationship between all input and output values.
This convenience method tests if the given set contains all following properties:
properties
- The properties of the function to test for bijectivity.true
if a function having the given set of properties is bijective.public static boolean isMonotonic(Set<FunctionProperty> properties)
true
if a function having the given set of properties is monotonic.
This convenience method tests if the given set contains at least one of the following
properties:
properties
- The properties of the function to test for monotonicity.true
if a function having the given set of properties is monotonic.Copyright © 2010–2015 The Apache Software Foundation. All rights reserved.