Package ca.uqac.lif.cep.ltl
Class Troolean
java.lang.Object
ca.uqac.lif.cep.functions.Function
ca.uqac.lif.cep.functions.Constant
ca.uqac.lif.cep.ltl.Troolean
- All Implemented Interfaces:
ca.uqac.lif.cep.Duplicable,ca.uqac.lif.cep.functions.DuplicableFunction
public class Troolean
extends ca.uqac.lif.cep.functions.Constant
Implementation of a three-valued logic. The "Troolean" type
has three values: TRUE ("⊤"), FALSE ("⊥") and INCONCLUSIVE ("?",
which can also stand for UNKNOWN). The truth table for Troolean connectives
is defined as follows:
| ∧ | ⊥ | ? | ⊤ |
|---|---|---|---|
| ⊥ | ⊥ | ⊥ | ⊥ |
| ? | ⊥ | ? | ? |
| ⊤ | ⊥ | ? | ⊤ |
| ∨ | ⊥ | ? | ⊤ |
|---|---|---|---|
| ⊥ | ⊥ | ? | ⊤ |
| ? | ? | ? | ⊤ |
| ⊤ | ⊤ | ⊤ | ⊤ |
| ¬ | |
|---|---|
| ⊥ | ⊤ |
| ? | ? |
| ⊤ | ⊥ |
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe three possible values of a Troolean -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ca.uqac.lif.cep.ltl.Troolean.TrooleanArrayAndStatic reference to the And function on arraysstatic final ca.uqac.lif.cep.ltl.Troolean.TrooleanAndStatic reference to the And functionstatic final TrooleanStatic reference to a constant object containing the value FALSEstatic final ca.uqac.lif.cep.ltl.Troolean.TrooleanImpliesStatic reference to the Implies functionstatic final TrooleanStatic reference to a constant object containing the value INCONCLUSIVEstatic final ca.uqac.lif.cep.ltl.Troolean.TrooleanNotStatic reference to the negation functionstatic final ca.uqac.lif.cep.ltl.Troolean.TrooleanOrStatic reference to the Or functionstatic final TrooleanStatic reference to a constant object containing the value TRUEFields inherited from class ca.uqac.lif.cep.functions.Constant
ONE, ZEROFields inherited from class ca.uqac.lif.cep.functions.Function
s_maxInputArity -
Method Summary
Modifier and TypeMethodDescriptionstatic Troolean.Valueand(Troolean.Value... values) Computes the logical conjunction of the valuesstatic Troolean.Valueand(Collection<Troolean.Value> values) Computes the logical conjunction of the valuesstatic Troolean.Valueimplies(Troolean.Value[] values) static Troolean.ValueComputes the logical implication of two valuesstatic Troolean.Valueimplies(Collection<Troolean.Value> values) static Troolean.ValueComputes the logical negation of a valuestatic Troolean.Valueor(Troolean.Value... values) Computes the logical disjunction of the valuesstatic Troolean.Valueor(Collection<Troolean.Value> values) Computes the logical disjunction of the valuesstatic Troolean.ValueConverts an object into a Troolean.static Troolean.Value[]trooleanValues(Object[] values) Converts an array of objects into an array of Trooleans.Methods inherited from class ca.uqac.lif.cep.functions.Constant
duplicate, evaluate, evaluate, evaluatePartial, getInputArity, getInputTypesFor, getOutputArity, getOutputTypeFor, getValue, printState, readState, reset, toStringMethods inherited from class ca.uqac.lif.cep.functions.Function
duplicate, evaluate, evaluateLazy
-
Field Details
-
AND_FUNCTION
public static final transient ca.uqac.lif.cep.ltl.Troolean.TrooleanAnd AND_FUNCTIONStatic reference to the And function -
AND_ARRAY_FUNCTION
public static final transient ca.uqac.lif.cep.ltl.Troolean.TrooleanArrayAnd AND_ARRAY_FUNCTIONStatic reference to the And function on arrays -
OR_FUNCTION
public static final transient ca.uqac.lif.cep.ltl.Troolean.TrooleanOr OR_FUNCTIONStatic reference to the Or function -
IMPLIES_FUNCTION
public static final transient ca.uqac.lif.cep.ltl.Troolean.TrooleanImplies IMPLIES_FUNCTIONStatic reference to the Implies function -
NOT_FUNCTION
public static final transient ca.uqac.lif.cep.ltl.Troolean.TrooleanNot NOT_FUNCTIONStatic reference to the negation function -
TRUE
Static reference to a constant object containing the value TRUE -
FALSE
Static reference to a constant object containing the value FALSE -
INCONCLUSIVE
Static reference to a constant object containing the value INCONCLUSIVE
-
-
Method Details
-
and
Computes the logical conjunction of the values- Parameters:
values- The values- Returns:
- The result
-
and
Computes the logical conjunction of the values- Parameters:
values- The values- Returns:
- The result
-
or
Computes the logical disjunction of the values- Parameters:
values- The values- Returns:
- The result
-
or
Computes the logical disjunction of the values- Parameters:
values- The values- Returns:
- The result
-
implies
Computes the logical implication of two values- Parameters:
x- The first valuey- The second value- Returns:
- The result
-
implies
-
implies
-
not
Computes the logical negation of a value- Parameters:
x- The value- Returns:
- The result
-
trooleanValue
Converts an object into a Troolean. The method uses the following rules:- null evaluates to INCONCLUSIVE
- Ordinary Booleans evaluate to their corresponding value
- Ordinary Trooleans evaluate to their corresponding value
- The strings "1", "true" and "T" evaluate to TRUE (case insensitive)
- The strings "0", "false" and "F" evaluate to FALSE (case insensitive)
- All other strings evaluate to INCONCLUSIVE
- The number 0 evaluates to FALSE
- Other numbers evaluate to TRUE
- All other objects evaluate to INCONCLUSIVE
- Parameters:
o- The object- Returns:
- The Troolean value
-
trooleanValues
Converts an array of objects into an array of Trooleans. Each element is converted by callingtrooleanValue(Object)on it.- Parameters:
values- The original array or collection of objects- Returns:
- The array of Troolean values
-