net.sf.mmm.util.lang.api
Enum Conjunction

java.lang.Object
  extended by java.lang.Enum<Conjunction>
      extended by net.sf.mmm.util.lang.api.Conjunction
All Implemented Interfaces:
Serializable, Comparable<Conjunction>, Datatype<String>

public enum Conjunction
extends Enum<Conjunction>
implements Datatype<String>

A conjunction represents a function that maps a list of boolean arguments to one boolean result.

Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Enum Constant Summary
AND
          This conjunction is true if and only if all arguments are true.
NAND
          This is the negation of AND.
NOR
          This is the negation of OR.
OR
          This conjunction is true if and only if at least one argument is true.
 
Field Summary
private  String title
           
private  String value
           
 
Method Summary
abstract  boolean eval(boolean... arguments)
          This method evaluates this conjunction for the given boolean arguments.
static Conjunction fromValue(String value)
          This method gets the Conjunction with the given value.
 String getTitle()
          This method gets the title of this datatype.
 String getValue()
          This method returns the raw value of this datatype.
 String toString()
          This method needs to return the same result a Datatype.getTitle().
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.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

AND

public static final Conjunction AND
This conjunction is true if and only if all arguments are true.


OR

public static final Conjunction OR
This conjunction is true if and only if at least one argument is true.


NAND

public static final Conjunction NAND
This is the negation of AND. It is only true if at least one argument is false.


NOR

public static final Conjunction NOR
This is the negation of OR. It is only true if all arguments are false.

Field Detail

value

private final String value
See Also:
getValue()

title

private final String title
See Also:
getTitle()
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 name
NullPointerException - if the argument is null

eval

public abstract boolean eval(boolean... arguments)
This method evaluates this conjunction for the given boolean arguments.

Parameters:
arguments - are the boolean values to evaluate.
Returns:
the result of this conjunction applied to the given arguments.
Since:
2.0.0

getValue

public String getValue()
This method returns the raw value of this datatype. This will typically be a common java.lang datatype. In case of a composed datatype it is also legal that this method returns the datatype instance itself.

Specified by:
getValue in interface Datatype<String>
Returns:
the value of this datatype.

getTitle

public String getTitle()
This method gets the title of this datatype. The title is a string representation intended to be displayed to end-users (i18n will be done externally - see NlsMessage).
Since the general contract of Datatype.toString() is quite weak, this method is added to explicitly express the presence of the title and to ensure implementors of this interface can NOT miss to implement this.

Specified by:
getTitle in interface Datatype<String>
Returns:
the display title of this datatype.
See Also:
Datatype.toString()

toString

public String toString()
This method needs to return the same result a Datatype.getTitle().

Specified by:
toString in interface Datatype<String>
Overrides:
toString in class Enum<Conjunction>
Returns:
the display title of this datatype.

fromValue

public static Conjunction fromValue(String value)
This method gets the Conjunction with the given value.

Parameters:
value - is the value of the requested Conjunction.
Returns:
the requested Conjunction.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.