Class AbstractCollector<U,​D,​R>

  • Type Parameters:
    U - the type of the additional result the collector may provide
    D - the type of the objects we want to collect
    R - the result of the transformation
    All Implemented Interfaces:
    Collector<U,​D>, Transformer<R>
    Direct Known Subclasses:
    TseitinTransformer

    public abstract class AbstractCollector<U,​D,​R>
    extends Object
    implements Transformer<R>, Collector<U,​D>
    Similar to AbstractTransformer but is designed for collections and therefore provides Collector functionality for free.
    Author:
    Mathias Hofer
    • Constructor Detail

      • AbstractCollector

        public AbstractCollector()
    • Method Detail

      • transform

        public R transform​(AcceptanceCondition acc)
        Description copied from interface: Transformer
        Transforms the given acceptance condition into another structure.
        Specified by:
        transform in interface Transformer<U>
        Parameters:
        acc - the acceptance condition
        Returns:
        the transformed result
      • topLevelPolarity

        protected int topLevelPolarity()
      • collect

        public U collect​(AcceptanceCondition acc,
                         Consumer<D> consumer)
        Description copied from interface: Collector
        Traverses through the given AcceptanceCondition and calls the provided consumer on all the collected data.
        Specified by:
        collect in interface Collector<U,​D>
        Parameters:
        acc - the acceptance condition
        consumer - the consumer which is used as a callback for the collected data.
        Returns:
        the result we may compute while collecting data
      • initialize

        protected abstract Collection<D> initialize()
        Provides the initial top-down data.
        Returns:
        the initial top-down data
      • finish

        protected abstract R finish​(U bottomUpData,
                                    Collection<D> collection)
      • transformDisjunction

        protected abstract U transformDisjunction​(Collection<U> children,
                                                  Consumer<D> collection,
                                                  int polarity)
      • transformConjunction

        protected abstract U transformConjunction​(Collection<U> children,
                                                  Consumer<D> collection,
                                                  int polarity)
      • transformImplication

        protected abstract U transformImplication​(U left,
                                                  U right,
                                                  Consumer<D> collection,
                                                  int polarity)
      • transformEquivalence

        protected abstract U transformEquivalence​(Collection<U> children,
                                                  Consumer<D> collection,
                                                  int polarity)
      • transformExclusiveDisjunction

        protected abstract U transformExclusiveDisjunction​(U left,
                                                           U right,
                                                           Consumer<D> collection,
                                                           int polarity)
      • transformNegation

        protected abstract U transformNegation​(U child,
                                               Consumer<D> collection,
                                               int polarity)
      • transformArgument

        protected abstract U transformArgument​(Argument argument,
                                               Consumer<D> collection,
                                               int polarity)
      • transformContradiction

        protected abstract U transformContradiction​(Consumer<D> collection,
                                                    int polarity)
      • transformTautology

        protected abstract U transformTautology​(Consumer<D> collection,
                                                int polarity)