Package net.sourceforge.pmd.util
Enum Class OptionalBool
- All Implemented Interfaces:
Serializable,Comparable<OptionalBool>,Constable
Represents a boolean that may not be present. Use as a non-null type.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionReturns the logical complement.static OptionalBooldefinitely(boolean a) Returns either YES or NO depending on the given boolean.booleanisKnown()Returns true this is notUNKNOWN.booleanisTrue()Returns true if this isYES.static OptionalBooljoin(OptionalBool a, OptionalBool b) If both values are the same, return it.static OptionalBoolmax(OptionalBool a, OptionalBool b) static OptionalBoolmin(OptionalBool a, OptionalBool b) static OptionalBoolunless(boolean a) static OptionalBoolReturns the enum constant of this class with the specified name.static OptionalBool[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NO
-
UNKNOWN
-
YES
-
-
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
-
complement
Returns the logical complement.yes -> no unk -> unk no -> yes -
max
-
min
-
join
If both values are the same, return it. Otherwise return UNKNOWN.yes, yes -> yes no, no -> no everything else -> unk -
isKnown
public boolean isKnown()Returns true this is notUNKNOWN. -
isTrue
public boolean isTrue()Returns true if this isYES. -
definitely
Returns either YES or NO depending on the given boolean. -
unless
-