org.apache.tinkerpop.gremlin.process.traversal.step.util

## Class AbstractStep<S,E>

- java.lang.Object
- - org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep<S,E>

- All Implemented Interfaces:
    Serializable, Cloneable, Iterator<Traverser.Admin<E>>, Step<S,E>
  Direct Known Subclasses:
    AddEdgeStartStep, AddVertexStartStep, AggregateGlobalStep, CollectingBarrierStep, ComputerAwareStep, ComputerAwareStep.EndStep, ComputerResultStep, FilterStep, FlatMapStep, GraphStep, HasNextStep, IdentityStep, IoStep, LocalStep, MapStep, MatchStep.MatchStartStep, NoOpBarrierStep, OptionalStep, ProfileStep, ReducingBarrierStep, RemoteStep, RequirementsStep, SideEffectStep, StartStep, SupplyingBarrierStep, TailGlobalStep, TinkerCountGlobalStep, VertexProgramStep

      public abstract class AbstractStep<S,E>
      extends Object
      implements Step<S,E>

  Author:
    Marko A. Rodriguez (http://markorodriguez.com)
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String` | `id`
    `protected Set<String>` | `labels`
    `protected Traverser.Admin<E>` | `nextEnd`
    `protected Step<E,?>` | `nextStep`
    `protected Step<?,S>` | `previousStep`
    `protected ExpandableStepIterator<S>` | `starts`
    `protected Traversal.Admin` | `traversal`
    `protected boolean` | `traverserStepIdAndLabelsSetByChild`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractStep(Traversal.Admin traversal)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete 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.
    `AbstractStep<S,E>` | `clone()` Cloning is used to duplicate steps for the purpose of traversal optimization and OLTP replication.
    `boolean` | `equals(Object other)`
    `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.
    `ExpandableStepIterator<S>` | `getStarts()`
    `<A,B> Traversal.Admin<A,B>` | `getTraversal()` Get the `Traversal.Admin` that this step is contained within.
    `int` | `hashCode()`
    `boolean` | `hasNext()`
    `boolean` | `hasStarts()` Determines if starts objects are present without iterating forward.
    `boolean` | `isTraverserStepIdAndLabelsSetByChild()`
    `Traverser.Admin<E>` | `next()`
    `protected Traverser.Admin<E>` | `prepareTraversalForNextStep(Traverser.Admin<E> traverser)`
    `protected abstract Traverser.Admin<E>` | `processNextStart()`
    `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.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Step

      `equals, getRequirements`

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

      `forEachRemaining, remove`

- - ### Field Detail

    - #### labels

          protected Set<String> labels

    - #### id

          protected String id

    - #### traversal

          protected Traversal.Admin traversal

    - #### starts

          protected ExpandableStepIterator<S> starts

    - #### nextEnd

          protected Traverser.Admin<E> nextEnd

    - #### traverserStepIdAndLabelsSetByChild

          protected boolean traverserStepIdAndLabelsSetByChild

    - #### previousStep

          protected Step<?,S> previousStep

    - #### nextStep

          protected Step<E,?> nextStep

  - ### Constructor Detail

    - #### AbstractStep

          public AbstractStep(Traversal.Admin traversal)

  - ### Method Detail

    - #### setId

          public void setId(String id)

      Description copied from interface: `Step`
      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.
      Specified by:
        `setId` in interface `Step<S,E>`
      Parameters:
        `id` - the unique id of the step

    - #### getId

          public String getId()

      Description copied from interface: `Step`
      Get the unique id of this step.
      Specified by:
        `getId` in interface `Step<S,E>`
      Returns:
        the unique id of the step

    - #### addLabel

          public void addLabel(String label)

      Description copied from interface: `Step`
      Add a label to this step.
      Specified by:
        `addLabel` in interface `Step<S,E>`
      Parameters:
        `label` - the label to add to this step

    - #### removeLabel

          public void removeLabel(String label)

      Description copied from interface: `Step`
      Remove a label from this step.
      Specified by:
        `removeLabel` in interface `Step<S,E>`
      Parameters:
        `label` - the label to remove from this step

    - #### getLabels

          public Set<String> getLabels()

      Description copied from interface: `Step`
      Get the labels of this step. The labels are ordered by the order of the calls to `Step.addLabel(java.lang.String)`.
      Specified by:
        `getLabels` in interface `Step<S,E>`
      Returns:
        the set of labels for this step

    - #### reset

          public void reset()

      Description copied from interface: `Step`
      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.
      Specified by:
        `reset` in interface `Step<S,E>`

    - #### addStarts

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

      Description copied from interface: `Step`
      Add a iterator of `Traverser.Admin` objects of type S to the step.
      Specified by:
        `addStarts` in interface `Step<S,E>`
      Parameters:
        `starts` - The iterator of objects to add

    - #### addStart

          public void addStart(Traverser.Admin<S> start)

      Description copied from interface: `Step`
      Add a single `Traverser.Admin` to the step.
      Specified by:
        `addStart` in interface `Step<S,E>`
      Parameters:
        `start` - The traverser to add

    - #### hasStarts

          public boolean hasStarts()

      Description copied from interface: `Step`
      Determines if starts objects are present without iterating forward. This function has special applicability around `ReducingBarrierStep` implementations where they always return `true` for calls to `Iterator.hasNext()`. Using this function gives insight to what the step itself is holding in its iterator without performing any sort of processing on the step itself.
      Specified by:
        `hasStarts` in interface `Step<S,E>`

    - #### setPreviousStep

          public void setPreviousStep(Step<?,S> step)

      Description copied from interface: `Step`
      Set the step that is previous to the current step. Used for linking steps together to form a function chain.
      Specified by:
        `setPreviousStep` in interface `Step<S,E>`
      Parameters:
        `step` - the previous step of this step

    - #### getPreviousStep

          public Step<?,S> getPreviousStep()

      Description copied from interface: `Step`
      Get the step prior to the current step.
      Specified by:
        `getPreviousStep` in interface `Step<S,E>`
      Returns:
        The previous step

    - #### setNextStep

          public void setNextStep(Step<E,?> step)

      Description copied from interface: `Step`
      Set the step that is next to the current step. Used for linking steps together to form a function chain.
      Specified by:
        `setNextStep` in interface `Step<S,E>`
      Parameters:
        `step` - the next step of this step

    - #### getNextStep

          public Step<E,?> getNextStep()

      Description copied from interface: `Step`
      Get the next step to the current step.
      Specified by:
        `getNextStep` in interface `Step<S,E>`
      Returns:
        The next step

    - #### next

          public Traverser.Admin<E> next()

      Specified by:
        `next` in interface `Iterator<Traverser.Admin<E>>`

    - #### hasNext

          public boolean hasNext()

      Specified by:
        `hasNext` in interface `Iterator<Traverser.Admin<E>>`

    - #### getTraversal

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

      Description copied from interface: `Step`
      Get the `Traversal.Admin` that this step is contained within.
      Specified by:
        `getTraversal` in interface `Step<S,E>`
      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

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

      Description copied from interface: `Step`
      Set the `Traversal` that this step is contained within.
      Specified by:
        `setTraversal` in interface `Step<S,E>`
      Parameters:
        `traversal` - the new traversal for this step

    - #### processNextStart

          protected abstract Traverser.Admin<E> processNextStart()
                                                          throws NoSuchElementException

      Throws:
        `NoSuchElementException`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### clone

          public AbstractStep<S,E> clone()

      Description copied from interface: `Step`
      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 `Step.reset()` is called. Moreover, the previous and next steps should be set to `EmptyStep`.
      Specified by:
        `clone` in interface `Step<S,E>`
      Overrides:
        `clone` in class `Object`
      Returns:
        The cloned step

    - #### equals

          public boolean equals(Object other)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getStarts

          public ExpandableStepIterator<S> getStarts()

    - #### isTraverserStepIdAndLabelsSetByChild

          public boolean isTraverserStepIdAndLabelsSetByChild()

    - #### prepareTraversalForNextStep

          protected Traverser.Admin<E> prepareTraversalForNextStep(Traverser.Admin<E> traverser)

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