- java.lang.Object
-
- java.lang.Enum<Conjunction>
-
- io.github.mmm.base.lang.Conjunction
-
- All Implemented Interfaces:
Serializable
,Comparable<Conjunction>
public enum Conjunction extends Enum<Conjunction>
- Since:
- 1.0.0
-
-
Enum Constant Summary
Enum Constants Enum Constant Description AND
This conjunction istrue
if and only if all arguments aretrue
.NAND
This is the negation ofAND
.NOR
This is the negation ofOR
.OR
This conjunction istrue
if and only if at least one argument istrue
.XOR
This conjunction istrue
if and only if two arguments differ (exactly one of two arguments iftrue
).
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
eval(boolean... arguments)
This method evaluates this conjunction for the given booleanarguments
.abstract boolean
evalEmpty()
abstract Boolean
evalSingle(boolean argument)
String
getName()
String
getSyntax()
abstract Conjunction
negate()
static Conjunction
ofName(String name)
static Conjunction
ofSymbol(String symbol)
String
toString()
static Conjunction
valueOf(String name)
Returns the enum constant of this type with the specified name.static Conjunction[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
AND
public static final Conjunction AND
This conjunction istrue
if and only if all arguments aretrue
.
-
OR
public static final Conjunction OR
This conjunction istrue
if and only if at least one argument istrue
.
-
NAND
public static final Conjunction NAND
-
NOR
public static final Conjunction NOR
-
XOR
public static final Conjunction XOR
This conjunction istrue
if and only if two arguments differ (exactly one of two arguments iftrue
).
-
-
Method Detail
-
values
public static Conjunction[] 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 (Conjunction c : Conjunction.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Conjunction 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
-
eval
public boolean eval(boolean... arguments)
This method evaluates this conjunction for the given booleanarguments
.- Parameters:
arguments
- are the boolean values to evaluate.- Returns:
- the result of this conjunction applied to the given
arguments
.
-
evalSingle
public abstract Boolean evalSingle(boolean argument)
- Parameters:
argument
- is a literal boolean argument.- Returns:
Boolean.TRUE
ifeval(boolean...)
will returntrue
if any of the given arguments has the value of the givenargument
,Boolean.FALSE
ifeval(boolean...)
will returnfalse
if any of the given arguments has the value of the givenargument
,null
otherwise.
-
evalEmpty
public abstract boolean evalEmpty()
- Returns:
- the result of
eval(boolean...)
for no argument (an empty argument array).
-
getSyntax
public String getSyntax()
- Returns:
- the syntax used for technical representation (e.g. '&&' for
AND
).
-
getName
public String getName()
- Returns:
- the name and
string representation
(e.g. "and" forAND
).
-
negate
public abstract Conjunction negate()
- Returns:
- the negation of this
Conjunction
thatevaluates
to the negated result.
-
toString
public String toString()
- Overrides:
toString
in classEnum<Conjunction>
-
ofSymbol
public static Conjunction ofSymbol(String symbol)
- Parameters:
symbol
- is thesymbol
of the requestedConjunction
.- Returns:
- the requested
Conjunction
ornull
if no suchConjunction
exists.
-
ofName
public static Conjunction ofName(String name)
- Parameters:
name
- is thename
of the requestedConjunction
.- Returns:
- the requested
Conjunction
ornull
if no suchConjunction
exists.
-
-