Class AcceptanceCondition

    • Method Summary

      Modifier and Type Method Description
      abstract java.util.stream.Stream<Argument> arguments()  
      AcceptanceCondition.Builder builder()  
      static AcceptanceCondition.Builder builder​(AcceptanceCondition acc)  
      <C,​R,​O>
      R
      collect​(Transform<C,​R> transform, java.util.function.BiConsumer<O,​C> accumulator, O container)
      Similar to collect(Transform, Collector) but with the main difference that it allows us access to all returned values of the given transform.
      <C,​R,​A,​O>
      O
      collect​(Transform<C,​R> transform, java.util.stream.Collector<C,​A,​O> collector)
      A powerful method which allows us to collect arbitrary information provided by the given transform into arbitrary data-structures provided by the collector.
      protected abstract java.lang.String getName()  
      boolean isContradiction()
      Note that this method does not perform any computations to determine if this acceptance condition is a tautology, it only checks if this is of type ContradictionAcceptanceCondition.
      boolean isTautology()
      Note that this method does not perform any computations to determine if this acceptance condition is a tautology, it only checks if this is of type TautologyAcceptanceCondition.
      java.lang.String toString()  
      <R> R transform​(Transform<?,​R> transform)
      A simple transform operation which is expected to be used in cases where we just want to transform this recursive structure into another recursive structure.
      protected abstract <C,​R>
      R
      transform​(Transform<C,​R> transform, java.util.function.Consumer<C> consumer, int polarity)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AcceptanceCondition

        public AcceptanceCondition()
    • Method Detail

      • arguments

        public abstract java.util.stream.Stream<Argument> arguments()
        Returns:
        a stream of all arguments of this acceptance condition and its subconditions.
      • collect

        public <C,​R,​A,​O> O collect​(Transform<C,​R> transform,
                                                     java.util.stream.Collector<C,​A,​O> collector)
        A powerful method which allows us to collect arbitrary information provided by the given transform into arbitrary data-structures provided by the collector.

        The information we collect is defined by the generic type C of the transform and is retrieved via a Consumer the transform implementation can use in order to write out further return values besides the one of its second generic type R. Which means that we can only collect values if the given Transform returns values via its consumer. This is not necessarily the case, since for simple transform operations, like the transform from AcceptanceCondition to PlFormula, there is no need for additional return values, since its just a 1:1 mapping of its structure. In cases like DefinitionalCNFTransform such a 1:1 mapping is not the case however, in this case the consumer is used to return the generated clauses which we can then collect.

        Type Parameters:
        C - the type we want to collect during the transform process, e.g. the type of the generated clauses in the case of a CNF-transform
        R - the return type of each transform step, or in other words the type of the information we pass from the bottom to the top of the structure
        A - the mutable accumulation type of the reduction operation (see Collector)
        O - the result type of the accumulation operation (see Collector)
        Parameters:
        transform - the transform operation
        collector - the collector which is used for collecting the information we get during the transform operation
        Returns:
        the collected transformed structure
      • collect

        public <C,​R,​O> R collect​(Transform<C,​R> transform,
                                             java.util.function.BiConsumer<O,​C> accumulator,
                                             O container)
        Similar to collect(Transform, Collector) but with the main difference that it allows us access to all returned values of the given transform. Hence, the C values given to us via the Consumer parameter of the transform methods in Transform and the directly returned bottom-up information.

        Instead of an encapsulating Collector this method expects an already initialized container of type O and a BiConsumer which works as an abstraction to the add method of the container. This abstraction is needed since the container can be completely arbitrary.

        Type Parameters:
        C - the type we want to collect during the transform process, e.g. the type of the generated clauses in the case of a CNF-transform
        R - the return type of each transform step, or in other words the type of the information we pass from the bottom to the top of the structure
        O - the result type of the accumulation operation (see Collector)
        Parameters:
        transform - the transform operation
        accumulator -
        container -
        Returns:
        the result of the transformed root acceptance condition
      • isTautology

        public boolean isTautology()
        Note that this method does not perform any computations to determine if this acceptance condition is a tautology, it only checks if this is of type TautologyAcceptanceCondition.

        This is useful for some syntax level rewriting to avoid instanceof checks and keep the code typesafe.

        Returns:
        true iff this acceptance condition represents the tautology constant
      • isContradiction

        public boolean isContradiction()
        Note that this method does not perform any computations to determine if this acceptance condition is a tautology, it only checks if this is of type ContradictionAcceptanceCondition.

        This is useful for some syntax level rewriting to avoid instanceof checks and keep the code typesafe.

        Returns:
        true iff this acceptance condition represents the contradiction constant
      • getName

        protected abstract java.lang.String getName()
      • transform

        protected abstract <C,​R> R transform​(Transform<C,​R> transform,
                                                   java.util.function.Consumer<C> consumer,
                                                   int polarity)
      • transform

        public <R> R transform​(Transform<?,​R> transform)
        A simple transform operation which is expected to be used in cases where we just want to transform this recursive structure into another recursive structure. No additional return values provided by the given transform is used.

        More generally speaking, it can be used whenever we are only interested in the result of the transformation of the root acceptance condition. Which is usually the case for recursive structures, since they have a reference to their sub-structures.

        Type Parameters:
        R - the return type of each transform step, or in other words the type of the information we pass from the bottom to the top of the structure
        Parameters:
        transform - the transform operation
        Returns:
        the result of the (simple) recursive transform operation
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object