org.apache.tinkerpop.gremlin.process.traversal

## Interface Step<S,E>

- Type Parameters:
    `S` - The incoming object type of the step
    `E` - The outgoing object type of the step
  All Superinterfaces:
    Cloneable, Iterator<Traverser.Admin<E>>, Serializable
  All Known Implementing Classes:
    AbstractStep, AddEdgeStartStep, AddEdgeStep, AddPropertyStep, AddVertexStartStep, AddVertexStep, AggregateStep, AndStep, BranchStep, ChooseStep, ClassFilterStep, CoalesceStep, CoinStep, CollectingBarrierStep, ComputerAwareStep, ComputerAwareStep.EndStep, ComputerResultStep, ConnectiveStep, ConstantStep, CountGlobalStep, CountLocalStep, CypherStartStep, DedupGlobalStep, DedupLocalStep, DropStep, EdgeOtherVertexStep, EdgeVertexStep, EmptyStep, FilterStep, FlatMapStep, FoldStep, GraphStep, GroupCountSideEffectStep, GroupCountStep, GroupSideEffectStep, GroupStep, HasNextStep, HasStep, IdentityStep, IdStep, InjectStep, IsStep, LabelStep, LambdaCollectingBarrierStep, LambdaFilterStep, LambdaFlatMapStep, LambdaMapStep, LambdaSideEffectStep, LocalStep, LoopsStep, MapStep, MatchStep, MatchStep.MatchEndStep, MatchStep.MatchStartStep, MathStep, MaxGlobalStep, MaxLocalStep, MeanGlobalStep, MeanLocalStep, MinGlobalStep, MinLocalStep, Neo4jGraphStep, NoneStep, NoOpBarrierStep, NotStep, OptionalStep, OrderGlobalStep, OrderLocalStep, OrStep, PageRankVertexProgramStep, PathFilterStep, PathStep, PeerPressureVertexProgramStep, ProfileSideEffectStep, ProfileStep, ProfileTest.MockStep, ProgramVertexProgramStep, ProjectStep, PropertiesStep, PropertyKeyStep, PropertyMapStep, PropertyValueStep, RangeGlobalStep, RangeLocalStep, ReducingBarrierStep, RemoteStep, RepeatStep, RepeatStep.RepeatEndStep, RequirementsStep, SackStep, SackValueStep, SampleGlobalStep, SampleLocalStep, SelectOneStep, SelectStep, SideEffectCapStep, SideEffectStep, StartStep, StoreStep, SubgraphStep, SumGlobalStep, SumLocalStep, SupplyingBarrierStep, TailGlobalStep, TailLocalStep, TimeLimitStep, TinkerCountGlobalStep, TinkerGraphStep, TraversalFilterStep, TraversalFlatMapStep, TraversalMapStep, TraversalSelectStep, TraversalSideEffectStep, TraversalVertexProgramStep, TreeSideEffectStep, TreeStep, UnfoldStep, UnionStep, VertexProgramStep, VertexStep, WherePredicateStep, WhereTraversalStep, WhereTraversalStep.WhereEndStep, WhereTraversalStep.WhereStartStep

      public interface Step<S,E>
      extends Iterator<Traverser.Admin<E>>, Serializable, Cloneable

  A `Step` denotes a unit of computation within a `Traversal`. A step takes an incoming object and yields an outgoing object. Steps are chained together in a `Traversal` to yield a lazy function chain of computation.

  In the constructor of a Step, never store explicit sideEffect objects in `TraversalSideEffects`. If a sideEffect needs to be registered with the `Traversal`, use SideEffects.registerSupplier().

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addLabel(String label)` Add a label to this step.
    `void` | `addStart(Traverser.Admin<S> start)` Add a single `Traverser.Admin` to the step.
    `void` | `addStarts(Iterator<Traverser.Admin<S>> starts)` Add a iterator of `Traverser.Admin` objects of type S to the step.
    `Step<S,E>` | `clone()` Cloning is used to duplicate steps for the purpose of traversal optimization and OLTP replication.
    `default boolean` | `equals(Step other, boolean compareIds)` Compare the current step with another step.
    `String` | `getId()` Get the unique id of this step.
    `Set<String>` | `getLabels()` Get the labels of this step.
    `Step<E,?>` | `getNextStep()` Get the next step to the current step.
    `Step<?,S>` | `getPreviousStep()` Get the step prior to the current step.
    `default Set<TraverserRequirement>` | `getRequirements()` Provide the necessary `TraverserRequirement` that must be met by the traverser in order for the step to function properly.
    `<A,B> Traversal.Admin<A,B>` | `getTraversal()` Get the `Traversal.Admin` that this step is contained within.
    `void` | `removeLabel(String label)` Remove a label from this step.
    `void` | `reset()` Reset the state of the step such that it has no incoming starts.
    `void` | `setId(String id)` Get the unique id of the step.
    `void` | `setNextStep(Step<E,?> step)` Set the step that is next to the current step.
    `void` | `setPreviousStep(Step<?,S> step)` Set the step that is previous to the current step.
    `void` | `setTraversal(Traversal.Admin<?,?> traversal)` Set the `Traversal` that this step is contained within.

    - ### Methods inherited from interface java.util.Iterator

      `forEachRemaining, hasNext, next, remove`

- - ### Method Detail

    - #### addStarts

          void addStarts(Iterator<Traverser.Admin<S>> starts)

      Add a iterator of `Traverser.Admin` objects of type S to the step.
      Parameters:
        `starts` - The iterator of objects to add

    - #### addStart

          void addStart(Traverser.Admin<S> start)

      Add a single `Traverser.Admin` to the step.
      Parameters:
        `start` - The traverser to add

    - #### setPreviousStep

          void setPreviousStep(Step<?,S> step)

      Set the step that is previous to the current step. Used for linking steps together to form a function chain.
      Parameters:
        `step` - the previous step of this step

    - #### getPreviousStep

          Step<?,S> getPreviousStep()

      Get the step prior to the current step.
      Returns:
        The previous step

    - #### setNextStep

          void setNextStep(Step<E,?> step)

      Set the step that is next to the current step. Used for linking steps together to form a function chain.
      Parameters:
        `step` - the next step of this step

    - #### getNextStep

          Step<E,?> getNextStep()

      Get the next step to the current step.
      Returns:
        The next step

    - #### getTraversal

          <A,B> Traversal.Admin<A,B> getTraversal()

      Get the `Traversal.Admin` that this step is contained within.
      Type Parameters:
        `A` - The incoming object type of the traversal
        `B` - The outgoing object type of the traversal
      Returns:
        The traversal of this step

    - #### setTraversal

          void setTraversal(Traversal.Admin<?,?> traversal)

      Set the `Traversal` that this step is contained within.
      Parameters:
        `traversal` - the new traversal for this step

    - #### reset

          void reset()

      Reset the state of the step such that it has no incoming starts. Internal states are to be reset, but any sideEffect data structures are not to be recreated.

    - #### clone

          Step<S,E> clone()

      Cloning is used to duplicate steps for the purpose of traversal optimization and OLTP replication. When cloning a step, it is important that the steps, the cloned step is equivalent to the state of the step when `reset()` is called. Moreover, the previous and next steps should be set to `EmptyStep`.
      Returns:
        The cloned step

    - #### getLabels

          Set<String> getLabels()

      Get the labels of this step. The labels are ordered by the order of the calls to `addLabel(java.lang.String)`.
      Returns:
        the set of labels for this step

    - #### addLabel

          void addLabel(String label)

      Add a label to this step.
      Parameters:
        `label` - the label to add to this step

    - #### removeLabel

          void removeLabel(String label)

      Remove a label from this step.
      Parameters:
        `label` - the label to remove from this step

    - #### setId

          void setId(String id)

      Get the unique id of the step. These ids can change when strategies are applied and anonymous traversals are embedded in the parent traversal. A developer should typically not need to call this method.
      Parameters:
        `id` - the unique id of the step

    - #### getId

          String getId()

      Get the unique id of this step.
      Returns:
        the unique id of the step

    - #### getRequirements

          default Set<TraverserRequirement> getRequirements()

      Provide the necessary `TraverserRequirement` that must be met by the traverser in order for the step to function properly. The provided default implements returns an empty set.
      Returns:
        the set of requirements

    - #### equals

          default boolean equals(Step other,
                                 boolean compareIds)

      Compare the current step with another step.
      Parameters:
        `other` - the other step
        `compareIds` - whether to compare step IDs or not
      Returns:
        true if the steps are equal, otherwise false

Copyright © 2013–2020 Apache Software Foundation. All rights reserved.