public abstract class ReducingBarrierStep<S,E> extends AbstractStep<S,E> implements Barrier<E>, Generating<E,E>
Modifier and Type | Class and Description |
---|---|
static class |
ReducingBarrierStep.NonEmittingSeed
A class that represents a value that is not be to be emitted which helps with flow control internal to the class
and is serializable in Gryo for use in OLAP.
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
hasProcessedOnce |
static Object |
NON_EMITTING_SEED
A seed value not to be emitted from the
ReducingBarrierStep helping with flow control within this step. |
protected BinaryOperator<E> |
reducingBiOperator |
protected Supplier<E> |
seedSupplier
If the
seedSupplier is null then the default behavior is to generate the seed from the starts. |
id, labels, nextEnd, nextStep, previousStep, starts, traversal, traverserStepIdAndLabelsSetByChild
Constructor and Description |
---|
ReducingBarrierStep(Traversal.Admin traversal) |
Modifier and Type | Method and Description |
---|---|
void |
addBarrier(E barrier)
Add a barrier to the step.
|
ReducingBarrierStep<S,E> |
clone()
Cloning is used to duplicate steps for the purpose of traversal optimization and OLTP replication.
|
void |
done()
A way to hard set that the barrier is complete.
|
protected E |
generateSeedFromStarts()
If the
seedSupplier is null then this method is called. |
BinaryOperator<E> |
getBiOperator() |
MemoryComputeKey<E> |
getMemoryComputeKey()
The
MemoryComputeKey that will be used by this step. |
Supplier<E> |
getSeedSupplier()
Gets the provided seed supplier or provides
generateSeedFromStarts() . |
boolean |
hasNextBarrier()
Whether or not the step has an accessible barrier.
|
E |
nextBarrier()
Get the next barrier within this step.
|
void |
processAllStarts()
Process all left traversers by do not yield the resultant output.
|
Traverser.Admin<E> |
processNextStart() |
abstract E |
projectTraverser(Traverser.Admin<S> traverser) |
void |
reset()
Reset the state of the step such that it has no incoming starts.
|
void |
setReducingBiOperator(BinaryOperator<E> reducingBiOperator) |
void |
setSeedSupplier(Supplier<E> seedSupplier) |
addLabel, addStart, addStarts, equals, getId, getLabels, getNextStep, getPreviousStep, getStarts, getTraversal, hashCode, hasNext, hasStarts, isTraverserStepIdAndLabelsSetByChild, next, prepareTraversalForNextStep, removeLabel, setId, setNextStep, setPreviousStep, setTraversal, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
generateFinalResult
equals, getRequirements
forEachRemaining, remove
public static final Object NON_EMITTING_SEED
ReducingBarrierStep
helping with flow control within this step.protected Supplier<E> seedSupplier
seedSupplier
is null
then the default behavior is to generate the seed from the starts.
This supplier must be callable as a constant and not rely on state from the class. Prefer overriding
generateSeedFromStarts()
otherwise.protected BinaryOperator<E> reducingBiOperator
protected boolean hasProcessedOnce
public ReducingBarrierStep(Traversal.Admin traversal)
public Supplier<E> getSeedSupplier()
generateSeedFromStarts()
.protected E generateSeedFromStarts()
seedSupplier
is null
then this method is called.public abstract E projectTraverser(Traverser.Admin<S> traverser)
public void setReducingBiOperator(BinaryOperator<E> reducingBiOperator)
public BinaryOperator<E> getBiOperator()
public void reset()
Step
public void done()
Barrier
public void processAllStarts()
Barrier
ReducingBarrierStep
, where traversers can be processed "on the fly" and thus, reduce memory consumption.processAllStarts
in interface Barrier<E>
public boolean hasNextBarrier()
Barrier
hasNextBarrier
in interface Barrier<E>
public E nextBarrier()
Barrier
nextBarrier
in interface Barrier<E>
public void addBarrier(E barrier)
Barrier
addBarrier
in interface Barrier<E>
barrier
- the barrier to merge inpublic Traverser.Admin<E> processNextStart()
processNextStart
in class AbstractStep<S,E>
public ReducingBarrierStep<S,E> clone()
Step
Step.reset()
is called. Moreover, the previous and next steps should be set to EmptyStep
.public MemoryComputeKey<E> getMemoryComputeKey()
MemoryComputing
MemoryComputeKey
that will be used by this step.getMemoryComputeKey
in interface MemoryComputing<E>
Copyright © 2013–2022 Apache Software Foundation. All rights reserved.