pub struct PentaConstraintStream<S, A, K, E, KE, F, Sc>where
Sc: Score,{ /* private fields */ }Expand description
Same-collection constraint stream over tuples of A entities whose keys are
equal.
Each unordered combination of distinct entities from extractor E with equal
keys KE appears once, in increasing index order, and is kept when filter F
accepts it.
Implementations§
Source§impl<S, A, K, E, KE, Sc> PentaConstraintStream<S, A, K, E, KE, TrueFilter, Sc>
impl<S, A, K, E, KE, Sc> PentaConstraintStream<S, A, K, E, KE, TrueFilter, Sc>
Sourcepub fn new_self_join(extractor: E, key_extractor: KE) -> Self
pub fn new_self_join(extractor: E, key_extractor: KE) -> Self
Creates a stream over every equal-key tuple, with no filter.
Source§impl<S, A, K, E, KE, F, Sc> PentaConstraintStream<S, A, K, E, KE, F, Sc>where
S: Send + Sync + 'static,
A: Hash + PartialEq + Send + Sync + 'static,
K: Eq + Hash + Clone + Send + Sync,
E: CollectionExtract<S, Item = A>,
KE: KeyExtract<S, A, K>,
F: PentaFilter<S, A, A, A, A, A>,
Sc: Score + 'static,
impl<S, A, K, E, KE, F, Sc> PentaConstraintStream<S, A, K, E, KE, F, Sc>where
S: Send + Sync + 'static,
A: Hash + PartialEq + Send + Sync + 'static,
K: Eq + Hash + Clone + Send + Sync,
E: CollectionExtract<S, Item = A>,
KE: KeyExtract<S, A, K>,
F: PentaFilter<S, A, A, A, A, A>,
Sc: Score + 'static,
Sourcepub fn new_self_join_with_filter(
extractor: E,
key_extractor: KE,
filter: F,
) -> Self
pub fn new_self_join_with_filter( extractor: E, key_extractor: KE, filter: F, ) -> Self
Creates a stream over every equal-key tuple accepted by filter.
Sourcepub fn filter<P>(
self,
predicate: P,
) -> PentaConstraintStream<S, A, K, E, KE, AndPentaFilter<F, FnPentaFilter<impl Fn(&S, &A, &A, &A, &A, &A, usize, usize, usize, usize, usize) -> bool + Send + Sync>>, Sc>
pub fn filter<P>( self, predicate: P, ) -> PentaConstraintStream<S, A, K, E, KE, AndPentaFilter<F, FnPentaFilter<impl Fn(&S, &A, &A, &A, &A, &A, usize, usize, usize, usize, usize) -> bool + Send + Sync>>, Sc>
Keeps only tuples for which predicate returns true, after the existing filter.
Sourcepub fn group_by<GK, GF, Co, V, R, Acc>(
self,
key: GF,
collector: Co,
) -> JoinedGroupedStream<S, FilterNode<SelfJoinNode<S, A, CollectionNode<S, E>, K, KE, 5>, impl Fn(&S, &[Leaf<'_, A>; 5]) -> bool + Send + Sync>, impl Fn(&[Leaf<'_, A>; 5]) -> GK + Send + Sync, TupleCollector<Co, V, R, Acc>, GK, V, R, Acc, Sc>where
E: 'static,
KE: 'static,
F: 'static,
K: 'static,
GK: Eq + Hash + Clone + Send + Sync + 'static,
GF: Fn(&A, &A, &A, &A, &A) -> GK + Send + Sync + 'static,
Co: for<'i> Collector<(&'i A, &'i A, &'i A, &'i A, &'i A), Value = V, Result = R, Accumulator = Acc> + 'static,
V: Send + Sync + 'static,
R: Send + Sync + 'static,
Acc: Accumulator<V, R> + 'static,
for<'i> TupleCollector<Co, V, R, Acc>: Collector<[Leaf<'i, A>; 5], Value = V, Result = R, Accumulator = Acc>,
pub fn group_by<GK, GF, Co, V, R, Acc>(
self,
key: GF,
collector: Co,
) -> JoinedGroupedStream<S, FilterNode<SelfJoinNode<S, A, CollectionNode<S, E>, K, KE, 5>, impl Fn(&S, &[Leaf<'_, A>; 5]) -> bool + Send + Sync>, impl Fn(&[Leaf<'_, A>; 5]) -> GK + Send + Sync, TupleCollector<Co, V, R, Acc>, GK, V, R, Acc, Sc>where
E: 'static,
KE: 'static,
F: 'static,
K: 'static,
GK: Eq + Hash + Clone + Send + Sync + 'static,
GF: Fn(&A, &A, &A, &A, &A) -> GK + Send + Sync + 'static,
Co: for<'i> Collector<(&'i A, &'i A, &'i A, &'i A, &'i A), Value = V, Result = R, Accumulator = Acc> + 'static,
V: Send + Sync + 'static,
R: Send + Sync + 'static,
Acc: Accumulator<V, R> + 'static,
for<'i> TupleCollector<Co, V, R, Acc>: Collector<[Leaf<'i, A>; 5], Value = V, Result = R, Accumulator = Acc>,
Groups each matching tuple, preserving upstream filters.
Sourcepub fn penalize<W>(
self,
weight: W,
) -> PentaConstraintBuilder<S, A, K, E, KE, F, impl Fn(&A, &A, &A, &A, &A) -> Sc + Send + Sync, Sc>
pub fn penalize<W>( self, weight: W, ) -> PentaConstraintBuilder<S, A, K, E, KE, F, impl Fn(&A, &A, &A, &A, &A) -> Sc + Send + Sync, Sc>
Penalizes each match by weight.
weight is a fixed score, or a closure over the matched entities returning one.
A fixed weight with a non-zero hard level marks the constraint hard; closures
are soft unless wrapped in hard_weight.
Sourcepub fn reward<W>(
self,
weight: W,
) -> PentaConstraintBuilder<S, A, K, E, KE, F, impl Fn(&A, &A, &A, &A, &A) -> Sc + Send + Sync, Sc>
pub fn reward<W>( self, weight: W, ) -> PentaConstraintBuilder<S, A, K, E, KE, F, impl Fn(&A, &A, &A, &A, &A) -> Sc + Send + Sync, Sc>
Rewards each match by weight.
weight is a fixed score, or a closure over the matched entities returning one.
A fixed weight with a non-zero hard level marks the constraint hard; closures
are soft unless wrapped in hard_weight.