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:

?
???
?

?
?
???

¬
??
  • Field Details

    • AND_FUNCTION

      public static final transient ca.uqac.lif.cep.ltl.Troolean.TrooleanAnd AND_FUNCTION
      Static reference to the And function
    • AND_ARRAY_FUNCTION

      public static final transient ca.uqac.lif.cep.ltl.Troolean.TrooleanArrayAnd AND_ARRAY_FUNCTION
      Static reference to the And function on arrays
    • OR_FUNCTION

      public static final transient ca.uqac.lif.cep.ltl.Troolean.TrooleanOr OR_FUNCTION
      Static reference to the Or function
    • IMPLIES_FUNCTION

      public static final transient ca.uqac.lif.cep.ltl.Troolean.TrooleanImplies IMPLIES_FUNCTION
      Static reference to the Implies function
    • NOT_FUNCTION

      public static final transient ca.uqac.lif.cep.ltl.Troolean.TrooleanNot NOT_FUNCTION
      Static reference to the negation function
    • TRUE

      public static final transient Troolean TRUE
      Static reference to a constant object containing the value TRUE
    • FALSE

      public static final transient Troolean FALSE
      Static reference to a constant object containing the value FALSE
    • INCONCLUSIVE

      public static final transient Troolean INCONCLUSIVE
      Static reference to a constant object containing the value INCONCLUSIVE
  • Method Details

    • and

      public static Troolean.Value and(Troolean.Value... values)
      Computes the logical conjunction of the values
      Parameters:
      values - The values
      Returns:
      The result
    • and

      public static Troolean.Value and(Collection<Troolean.Value> values)
      Computes the logical conjunction of the values
      Parameters:
      values - The values
      Returns:
      The result
    • or

      public static Troolean.Value or(Troolean.Value... values)
      Computes the logical disjunction of the values
      Parameters:
      values - The values
      Returns:
      The result
    • or

      public static Troolean.Value or(Collection<Troolean.Value> values)
      Computes the logical disjunction of the values
      Parameters:
      values - The values
      Returns:
      The result
    • implies

      public static Troolean.Value implies(Troolean.Value x, Troolean.Value y)
      Computes the logical implication of two values
      Parameters:
      x - The first value
      y - The second value
      Returns:
      The result
    • implies

      public static Troolean.Value implies(Troolean.Value[] values)
    • implies

      public static Troolean.Value implies(Collection<Troolean.Value> values)
    • not

      public static Troolean.Value not(Troolean.Value x)
      Computes the logical negation of a value
      Parameters:
      x - The value
      Returns:
      The result
    • trooleanValue

      public static Troolean.Value trooleanValue(Object o)
      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

      public static Troolean.Value[] trooleanValues(Object[] values)
      Converts an array of objects into an array of Trooleans. Each element is converted by calling trooleanValue(Object) on it.
      Parameters:
      values - The original array or collection of objects
      Returns:
      The array of Troolean values