- All Implemented Interfaces:
Serializable
,Comparable<FunctionProperty>
,Constable
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) |
Constant | EnumSet.of(ORDER_PRESERVING, ORDER_REVERSING) |
- S (as in source) is the set of all possible input values (the domain).
- T (as in target) is a set containing all possible output values,
and potentially more elements (the codomain). For example, the set of output
values of the
Integer.toString()
function is included in a larger set, which is the set of all possibleString
values. In this Javadoc, T stands for the latter set.
- Since:
- 0.3
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionA function is injective if each value of T is either unrelated to S, or is the output of exactly one value of S.A function is invertible if it can provide another function mapping T values to S values.A function preserves order if any sequence of increasing S values is mapped to a sequence of increasing T values.A function reverses order if any sequence of increasing S values is mapped to a sequence of decreasing T values.A function is surjective if any value of T can be created from one or many values of S.A function is volatile if the computed value changes each time that the function is evaluated. -
Method Summary
Modifier and TypeMethodDescriptionstatic EnumSet
<FunctionProperty> concatenate
(Set<FunctionProperty> step1, Set<FunctionProperty> step2) Returns the properties of a function defined as the concatenation of two other functions.static boolean
isBijective
(Set<FunctionProperty> properties) Returnstrue
if a function having the given set of properties is bijective.static boolean
isConstant
(Set<FunctionProperty> properties) Returnstrue
if a function can only return a constant value.static boolean
isMonotonic
(Set<FunctionProperty> properties) Returnstrue
if a function having the given set of properties is monotonic.static FunctionProperty
Returns the enum constant of this class with the specified name.static FunctionProperty[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
INVERTIBLE
A function is invertible if it can provide another function mapping T values to S values.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.- See Also:
-
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. For example anObjectConverter
doing conversions fromInteger
toString
is an injective function, because no pair of integers can produce the same string.A function which is both injective and surjective is a bijective function. In such functions, there is a one-to-one relationship between all input and output values.
- See Also:
-
SURJECTIVE
A function is surjective if any value of T can be created from one or many values of S. For example anObjectConverter
doing conversions fromString
toInteger
is a surjective function, because there is always at least one string for each integer value. Note that such function cannot be injective since many different strings can represent the same integer value.A function which is both injective and surjective is a bijective function. In such functions, there is a one-to-one relationship between all input and output values.
- See Also:
-
ORDER_PRESERVING
A function preserves order if any sequence of increasing S values is mapped to a sequence of increasing T values. This enumeration constant can be used only withComparable
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.
- See Also:
-
ORDER_REVERSING
A function reverses order if any sequence of increasing S values is mapped to a sequence of decreasing T values. This enumeration constant can be used only withComparable
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.
- See Also:
-
VOLATILE
A function is volatile if the computed value changes each time that the function is evaluated. It may be for example a random number generator, or a function returning the current date and time.- Since:
- 1.4
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
isBijective
Returnstrue
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:- Parameters:
properties
- the properties of the function to test for bijectivity.- Returns:
true
if a function having the given set of properties is bijective.
-
isMonotonic
Returnstrue
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:- Parameters:
properties
- the properties of the function to test for monotonicity.- Returns:
true
if a function having the given set of properties is monotonic.
-
isConstant
Returnstrue
if a function can only return a constant value. This convenience method tests if the given set contains all of the following properties:- Parameters:
properties
- the properties of the function to test.- Returns:
true
if the function can only return a constant value.- Since:
- 1.4
-
concatenate
public static EnumSet<FunctionProperty> concatenate(Set<FunctionProperty> step1, Set<FunctionProperty> step2) Returns the properties of a function defined as the concatenation of two other functions. The presence of a property in the returned set is determined by combining the presence of the same property in the two steps using the following logical operations:INVERTIBLE
,INJECTIVE
,SURJECTIVE
,ORDER_PRESERVING
: logicalAND
operation.ORDER_REVERSING
: LogicalXOR
operation if the other step is also ordered.VOLATILE
: logicalOR
operation.
- Parameters:
step1
- properties of the first function.step2
- properties of the second function.- Returns:
- properties of the concatenated function as a new and modifiable set.
- Since:
- 1.4
-