Enum Class OptionalBool

java.lang.Object
java.lang.Enum<OptionalBool>
net.sourceforge.pmd.util.OptionalBool
All Implemented Interfaces:
Serializable, Comparable<OptionalBool>, Constable

public enum OptionalBool extends Enum<OptionalBool>
Represents a boolean that may not be present. Use as a non-null type.
  • Enum Constant Details

  • Method Details

    • values

      public static OptionalBool[] 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

      public static OptionalBool valueOf(String name)
      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 name
      NullPointerException - 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 not UNKNOWN.
    • isTrue

      public boolean isTrue()
      Returns true if this is YES.
    • definitely

      public static OptionalBool definitely(boolean a)
      Returns either YES or NO depending on the given boolean.
    • unless

      public static OptionalBool unless(boolean a)