/** * Creates a new key/value state for the given hash map of key/value pairs. * * @param stateTable The state table for which this state is associated to. * @param keySerializer The serializer for the keys. * @param valueSerializer The serializer for the state. * @param namespaceSerializer The serializer for the namespace. * @param defaultValue The default value for the state. * @param reduceFunction The reduce function used for reducing state. */ private HeapReducingState( StateTable<K, N, V> stateTable, TypeSerializer<K> keySerializer, TypeSerializer<V> valueSerializer, TypeSerializer<N> namespaceSerializer, V defaultValue, ReduceFunction<V> reduceFunction) { super(stateTable, keySerializer, valueSerializer, namespaceSerializer, defaultValue); this.reduceTransformation = new ReduceTransformation<>(reduceFunction); }
@Override protected V mergeState(V a, V b) throws Exception { return reduceTransformation.apply(a, b); }
/** * Creates a new key/value state for the given hash map of key/value pairs. * * @param stateTable The state table for which this state is associated to. * @param keySerializer The serializer for the keys. * @param valueSerializer The serializer for the state. * @param namespaceSerializer The serializer for the namespace. * @param defaultValue The default value for the state. * @param reduceFunction The reduce function used for reducing state. */ private HeapReducingState( StateTable<K, N, V> stateTable, TypeSerializer<K> keySerializer, TypeSerializer<V> valueSerializer, TypeSerializer<N> namespaceSerializer, V defaultValue, ReduceFunction<V> reduceFunction) { super(stateTable, keySerializer, valueSerializer, namespaceSerializer, defaultValue); this.reduceTransformation = new ReduceTransformation<>(reduceFunction); }
/** * Creates a new key/value state for the given hash map of key/value pairs. * * @param stateTable The state table for which this state is associated to. * @param keySerializer The serializer for the keys. * @param valueSerializer The serializer for the state. * @param namespaceSerializer The serializer for the namespace. * @param defaultValue The default value for the state. * @param reduceFunction The reduce function used for reducing state. */ public HeapReducingState( StateTable<K, N, V> stateTable, TypeSerializer<K> keySerializer, TypeSerializer<V> valueSerializer, TypeSerializer<N> namespaceSerializer, V defaultValue, ReduceFunction<V> reduceFunction) { super(stateTable, keySerializer, valueSerializer, namespaceSerializer, defaultValue); this.reduceTransformation = new ReduceTransformation<>(reduceFunction); }
/** * Creates a new key/value state for the given hash map of key/value pairs. * * @param stateDesc The state identifier for the state. This contains name * and can create a default state value. * @param stateTable The state table to use in this kev/value state. May contain initial state. */ public HeapReducingState( ReducingStateDescriptor<V> stateDesc, StateTable<K, N, V> stateTable, TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer) { super(stateDesc, stateTable, keySerializer, namespaceSerializer); this.reduceTransformation = new ReduceTransformation<>(stateDesc.getReduceFunction()); }
@Override protected V mergeState(V a, V b) throws Exception { return reduceTransformation.apply(a, b); }
@Override protected V mergeState(V a, V b) throws Exception { return reduceTransformation.apply(a, b); }
@Override protected V mergeState(V a, V b) throws Exception { return reduceTransformation.apply(a, b); }