Class TruthValues

  • Direct Known Subclasses:
    ExactTruthMapping, InsensitiveTruthMapping

    public abstract class TruthValues
    extends Object
    A mapping between boolean values and strings. Any number of strings may be mapped to a boolean value, but each boolean value must have a single canonical string representation.
    • Field Detail

      • truth

        protected final String truth
        Text representing a value of true.
      • falsity

        protected final String falsity
        Text representing a value of false.
    • Constructor Detail

      • TruthValues

        protected TruthValues​(String truth,
                              String falsity)
        Defines a new mapping, specifying the canonical representations of true and false.
        Parameters:
        truth - the canonical string representation of true.
        falsity - the canonical string representation of false.
    • Method Detail

      • falseValue

        public String falseValue()
        Gets the string value for false.
        Returns:
        the canonical string representation of false.
      • trueValue

        public String trueValue()
        Gets the string value for true.
        Returns:
        the canonical string representation of true.
      • isTrue

        public abstract boolean isTrue​(String text)
        Indicates whether the given string is a representation for true.
        Parameters:
        text - the string to check
        Returns:
        true if the string represents truth
      • isFalse

        public abstract boolean isFalse​(String text)
        Indicates whether the given string is a representation for false.
        Parameters:
        text - the string to check
        Returns:
        true if the string represents falsity