Package net.sourceforge.pmd.util
Enum OptionalBool
- java.lang.Object
-
- java.lang.Enum<OptionalBool>
-
- net.sourceforge.pmd.util.OptionalBool
-
- All Implemented Interfaces:
Serializable
,Comparable<OptionalBool>
public enum OptionalBool extends Enum<OptionalBool>
Represents a boolean that may not be present. Use as a non-null type.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OptionalBool
complement()
Returns the logical complement.static OptionalBool
definitely(boolean a)
Returns either YES or NO depending on the given boolean.boolean
isKnown()
Returns true this is notUNKNOWN
.boolean
isTrue()
Returns true if this isYES
.static OptionalBool
join(OptionalBool a, OptionalBool b)
If both values are the same, return it.static OptionalBool
max(OptionalBool a, OptionalBool b)
static OptionalBool
min(OptionalBool a, OptionalBool b)
static OptionalBool
unless(boolean a)
static OptionalBool
valueOf(String name)
Returns the enum constant of this type with the specified name.static OptionalBool[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NO
public static final OptionalBool NO
-
UNKNOWN
public static final OptionalBool UNKNOWN
-
YES
public static final OptionalBool YES
-
-
Method Detail
-
values
public static OptionalBool[] 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 (OptionalBool c : OptionalBool.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static OptionalBool 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
-
complement
public OptionalBool complement()
Returns the logical complement.yes -> no unk -> unk no -> yes
-
max
public static OptionalBool max(OptionalBool a, OptionalBool b)
-
min
public static OptionalBool min(OptionalBool a, OptionalBool b)
-
join
public static OptionalBool join(OptionalBool a, OptionalBool b)
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
public static OptionalBool definitely(boolean a)
Returns either YES or NO depending on the given boolean.
-
unless
public static OptionalBool unless(boolean a)
-
-