Package org.revapi
Enum Ternary
- java.lang.Object
-
- java.lang.Enum<Ternary>
-
- org.revapi.Ternary
-
- All Implemented Interfaces:
Serializable
,Comparable<Ternary>
public enum Ternary extends Enum<Ternary>
Ternary logic using the Kleene algebra. TheUNDECIDED
value means just that - it doesn't mean "both true and false".
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Ternary
and(Supplier<Ternary> other)
Short-circuiting version ofand(Ternary)
.Ternary
and(Ternary other)
static Ternary
fromBoolean(boolean value)
Ternary
implies(Supplier<Ternary> other)
Ternary
implies(Ternary other)
Ternary
negate()
Ternary
or(Supplier<Ternary> other)
Short-circuiting version ofor(Ternary)
.Ternary
or(Ternary other)
boolean
toBoolean(boolean undecidedValue)
static Ternary
valueOf(String name)
Returns the enum constant of this type with the specified name.static Ternary[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Method Detail
-
values
public static Ternary[] 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 (Ternary c : Ternary.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Ternary valueOf(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:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
fromBoolean
public static Ternary fromBoolean(boolean value)
-
toBoolean
public boolean toBoolean(boolean undecidedValue)
- Parameters:
undecidedValue
- the boolean value to convert theUNDECIDED
value to.- Returns:
- the value as a boolean
-
negate
public Ternary negate()
-
and
public Ternary and(Supplier<Ternary> other)
Short-circuiting version ofand(Ternary)
. Will only evaluate the argument if necessary.
-
or
public Ternary or(Supplier<Ternary> other)
Short-circuiting version ofor(Ternary)
. Will only evaluate the argument if necessary.
-
-