Class AggBuilder<I,E,O,ACC extends Accumulator<I,E,O>,AGG extends ParallelAggregator<I,E,O,ACC>>

java.lang.Object
org.aksw.commons.collector.core.AggBuilder<I,E,O,ACC,AGG>
Type Parameters:
I - The current aggregator's input type
O - The current aggregator's output type
ACC - The current aggregator's accumulator type
AGG - The current aggregator's own type

public class AggBuilder<I,E,O,ACC extends Accumulator<I,E,O>,AGG extends ParallelAggregator<I,E,O,ACC>> extends Object
Builder for parallel aggregators. Static 'from' methods start the builder chain. All methods that perform modifications return a new independent builder object. Because type expressions can become complex there are three getters that return the wrapped aggregator either fully typed, as a parallel aggregator or as a simple aggregator:
invalid reference
#getFullyTyped()
,
invalid reference
#getAsParallelAggregator()
,
invalid reference
#getAsAggregator()
.
Author:
raven
  • Constructor Details

    • AggBuilder

      public AggBuilder()
  • Method Details

    • inputFilter

      public static <I, E, O, ACC extends Accumulator<I, E, O>, AGG extends ParallelAggregator<I, E, O, ACC>> AggInputFilter<I,E,O,ACC,AGG> inputFilter(org.aksw.commons.lambda.serializable.SerializablePredicate<? super I> inputFilter, AGG state)
      Pass on input to sub-acc if the predicate evaluates to true
    • inputSplit

      public static <I, E, K, J, O, ACC extends Accumulator<J, E, O>, AGG extends ParallelAggregator<J, E, O, ACC>> AggInputSplit<I,E,K,J,O,ACC,AGG> inputSplit(org.aksw.commons.lambda.serializable.SerializableFunction<? super I,? extends Set<? extends K>> keyMapper, org.aksw.commons.lambda.serializable.SerializableBiFunction<? super I,? super K,? extends J> valueMapper, AGG state)
      InputSplit: Create the same accumulator type for each split of the input
    • inputSplit

      public static <I, E, K, J, O, ACC extends Accumulator<J, E, O>, AGG extends ParallelAggregator<J, E, O, ACC>> AggInputSplit<I,E,K,J,O,ACC,AGG> inputSplit(Set<K> fixedKeys, boolean considerNewKeys, org.aksw.commons.lambda.serializable.SerializableFunction<? super I,? extends Set<? extends K>> keyMapper, org.aksw.commons.lambda.serializable.SerializableBiFunction<? super I,? super K,? extends J> valueMapper, AGG state)
    • inputSplit

      public static <I, E, K, O, ACC extends Accumulator<I, E, O>, AGG extends ParallelAggregator<I, E, O, ACC>> AggInputSplit<I,E,K,I,O,ACC,AGG> inputSplit(org.aksw.commons.lambda.serializable.SerializableFunction<? super I,? extends K> keyMapper, AGG state)
      Simple input split: Partition input by a key derived from it
    • inputTransform

      public static <I, E, J, O, ACC extends Accumulator<J, E, O>, AGG extends ParallelAggregator<J, E, O, ACC>> AggInputTransform<I,E,J,O,ACC,AGG> inputTransform(org.aksw.commons.lambda.serializable.SerializableFunction<? super I,? extends J> inputTransform, AGG state)
    • inputTransform2

      public static <I, E, J, O, ACC extends Accumulator<J, E, O>, AGG extends ParallelAggregator<J, E, O, ACC>> AggInputTransform<I,E,J,O,ACC,AGG> inputTransform2(org.aksw.commons.lambda.serializable.SerializableBiFunction<? super I,E,? extends J> inputTransform, AGG state)
      input transform with support for the environment argument.
    • errorHandler

      public static <I, E, O, ACC extends Accumulator<I, E, O>, AGG extends ParallelAggregator<I, E, O, ACC>> AggErrorHandler<I,E,O,ACC,AGG> errorHandler(AGG state)
      Wraps another aggregator such that if accumulation fails with an exception an error counter is increased. If the error counter is non zero then the accumulated value will always be null
    • errorHandler

      public static <I, E, O, ACC extends Accumulator<I, E, O>, AGG extends ParallelAggregator<I, E, O, ACC>> AggErrorHandler<I,E,O,ACC,AGG> errorHandler(AGG state, boolean accDespiteError, org.aksw.commons.lambda.serializable.SerializableConsumer<? super Throwable> errorCallback, org.aksw.commons.lambda.serializable.SerializableFunction<AggErrorHandler.AccError<I,E,O,ACC>,O> errorValueExtractor)
      Wraps another aggregator such that if accumulation fails with an exception an error counter is increased. If the error counter is non zero then a custom policy for extracting a final value from the accumulator state can be specified
    • inputFlatMap

      public static <I, E, J, O, ACC extends Accumulator<J, E, O>, AGG extends ParallelAggregator<J, E, O, ACC>> AggInputFlatMap<I,E,J,O,ACC,AGG> inputFlatMap(org.aksw.commons.lambda.serializable.SerializableFunction<I,? extends Iterator<? extends J>> inputTransform, AGG state)
    • inputFlatMap2

      public static <I, E, J, O, ACC extends Accumulator<J, E, O>, AGG extends ParallelAggregator<J, E, O, ACC>> AggInputFlatMap<I,E,J,O,ACC,AGG> inputFlatMap2(org.aksw.commons.lambda.serializable.SerializableBiFunction<? super I,E,? extends Iterator<? extends J>> inputTransform, AGG state)
    • outputTransform

      public static <I, E, O, P, ACC extends Accumulator<I, E, O>, AGG extends ParallelAggregator<I, E, O, ACC>> AggOutputTransform<I,E,O,P,ACC,AGG> outputTransform(AGG state, org.aksw.commons.lambda.serializable.SerializableFunction<? super O,? extends P> outputTransform)
    • hashSetSupplier

      public static <T, E> ParallelAggregator<T,E,Set<T>,Accumulator<T,E,Set<T>>> hashSetSupplier()
    • arrayListSupplier

      public static <T, E> ParallelAggregator<T,E,List<T>,Accumulator<T,E,List<T>>> arrayListSupplier()
    • setSupplier

      public static <T, E> ParallelAggregator<T,E,Set<T>,Accumulator<T,E,Set<T>>> setSupplier(org.aksw.commons.lambda.serializable.SerializableSupplier<? extends Set<T>> setSupplier)
    • mapSupplier

      public static <K, V, E> ParallelAggregator<Map.Entry<K,V>,E,SetOverMap<K,V>,Accumulator<Map.Entry<K,V>,E,SetOverMap<K,V>>> mapSupplier(org.aksw.commons.lambda.serializable.SerializableSupplier<? extends Map<K,V>> mapSupplier)
      We provide the SetOverMap collection type which transparently gives access to the underlying map This way we can reuse the collection machinery for accumulation and still type-safely extract the map eventually
    • collectionSupplier

      public static <T, E, C extends Collection<T>> ParallelAggregator<T,E,C,Accumulator<T,E,C>> collectionSupplier(org.aksw.commons.lambda.serializable.SerializableSupplier<? extends C> colSupplier)
    • naturalAccumulator

      public static <T, E, C extends Collection<T>> ParallelAggregator<T,E,C,Accumulator<T,E,C>> naturalAccumulator(org.aksw.commons.lambda.serializable.SerializableSupplier<? extends Accumulator<T,E,C>> accSupplier)
    • counting

      public static <I, E> ParallelAggregator<I,E,Long,Accumulator<I,E,Long>> counting()
    • inputBroadcast

      public static <I, E, O1, O2> ParallelAggregator<I,E,Map.Entry<O1,O2>,?> inputBroadcast(ParallelAggregator<I,E,O1,?> agg1, ParallelAggregator<I,E,O2,?> agg2)
      An aggregator that broadcasts its input to two sub-aggregators that accept the same input.
    • inputBroadcastMap

      public static <I, E, K, O> AggInputBroadcastMap<I,E,K,O> inputBroadcastMap(Map<K,ParallelAggregator<I,E,O,?>> subAggMap)
      An aggregator that broadcasts its input to multiple sub-aggregators that accept the same input
    • fold

      public static <I, E> ParallelAggregator<I,E,I,Accumulator<I,E,I>> fold(org.aksw.commons.lambda.serializable.SerializableSupplier<I> zeroElementSupplier, org.aksw.commons.lambda.serializable.SerializableBinaryOperator<I> plusOperator)
    • fromCollector

      public static <T, E, R, A> AggFromCollector<T,E,R,A> fromCollector(org.aksw.commons.lambda.serializable.SerializableSupplier<A> supplier, org.aksw.commons.lambda.serializable.SerializableBiConsumer<A,T> accumulator, org.aksw.commons.lambda.serializable.SerializableBinaryOperator<A> combiner, org.aksw.commons.lambda.serializable.SerializableFunction<A,R> finisher)
    • fromCollector

      public static <T, E, R, A> AggFromCollector<T,E,R,A> fromCollector(org.aksw.commons.lambda.serializable.SerializableSupplier<A> supplier, org.aksw.commons.lambda.serializable.SerializableBiConsumer<A,T> accumulator, org.aksw.commons.lambda.serializable.SerializableBinaryOperator<A> combiner, org.aksw.commons.lambda.serializable.SerializableFunction<A,R> finisher, Set<Collector.Characteristics> characteristics)
    • fromCollector

      public static <T, E, A, R> AggFromCollector<T,E,R,A> fromCollector(org.aksw.commons.lambda.serializable.SerializableCollector<T,A,R> collector)
    • maxLong

      public static <E> ParallelAggregator<Long,E,Long,Accumulator<Long,E,Long>> maxLong()
    • maxInteger

      public static <E> ParallelAggregator<Integer,E,Integer,Accumulator<Integer,E,Integer>> maxInteger()
    • summarizingInt

      public static <T, E> AggFromCollector<T,E,org.aksw.commons.util.serializable.SerializableIntSummaryStatistics,org.aksw.commons.util.serializable.SerializableIntSummaryStatistics> summarizingInt(org.aksw.commons.lambda.serializable.SerializableToIntFunction<T> mapper)
    • summarizingLong

      public static <T, E> AggFromCollector<T,E,org.aksw.commons.util.serializable.SerializableLongSummaryStatistics,org.aksw.commons.util.serializable.SerializableLongSummaryStatistics> summarizingLong(org.aksw.commons.lambda.serializable.SerializableToLongFunction<T> mapper)
    • summarizingDouble

      public static <T, E> AggFromCollector<T,E,org.aksw.commons.util.serializable.SerializableDoubleSummaryStatistics,org.aksw.commons.util.serializable.SerializableDoubleSummaryStatistics> summarizingDouble(org.aksw.commons.lambda.serializable.SerializableToDoubleFunction<T> mapper)