- 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 ANDThis conjunction istrueif and only if all arguments aretrue.NANDThis is the negation ofAND.NORThis is the negation ofOR.ORThis conjunction istrueif and only if at least one argument istrue.XORThis conjunction istrueif 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 booleaneval(boolean... arguments)This method evaluates this conjunction for the given booleanarguments.abstract booleanevalEmpty()abstract BooleanevalSingle(boolean argument)StringgetName()StringgetSyntax()abstract Conjunctionnegate()static ConjunctionofName(String name)static ConjunctionofSymbol(String symbol)StringtoString()static ConjunctionvalueOf(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 istrueif and only if all arguments aretrue.
-
OR
public static final Conjunction OR
This conjunction istrueif 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 istrueif 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.TRUEifeval(boolean...)will returntrueif any of the given arguments has the value of the givenargument,Boolean.FALSEifeval(boolean...)will returnfalseif any of the given arguments has the value of the givenargument,nullotherwise.
-
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
Conjunctionthatevaluatesto the negated result.
-
toString
public String toString()
- Overrides:
toStringin classEnum<Conjunction>
-
ofSymbol
public static Conjunction ofSymbol(String symbol)
- Parameters:
symbol- is thesymbolof the requestedConjunction.- Returns:
- the requested
Conjunctionornullif no suchConjunctionexists.
-
ofName
public static Conjunction ofName(String name)
- Parameters:
name- is thenameof the requestedConjunction.- Returns:
- the requested
Conjunctionornullif no suchConjunctionexists.
-
-