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

## Class EmptyTraverser<T>

- java.lang.Object
- - org.apache.tinkerpop.gremlin.process.traversal.traverser.util.EmptyTraverser<T>

- All Implemented Interfaces:
    Serializable, Cloneable, Comparable<Traverser<T>>, Traverser<T>, Traverser.Admin<T>, Attachable<T>

      public final class EmptyTraverser<T>
      extends Object
      implements Traverser<T>, Traverser.Admin<T>

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

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traverser

      `Traverser.Admin<T>`

    - ### Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.structure.util.Attachable

      `Attachable.Exceptions, Attachable.Method`

  - ### Field Summary

    - ### Fields inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traverser.Admin

      `HALT`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addLabels(Set<String> labels)`
    `T` | `attach(Function<Attachable<T>,T> method)` Regenerate the detached traverser given its location at a particular vertex.
    `long` | `bulk()` A traverser may represent a grouping of traversers to allow for more efficient data propagation.
    `EmptyTraverser<T>` | `clone()` Traverser cloning is important when splitting a traverser at a bifurcation point in a traversal.
    `Traverser.Admin<T>` | `detach()` Prepare the traverser for migration across a JVM boundary.
    `void` | `dropLabels(Set<String> labels)` Drop all path information associated with specified labels.
    `void` | `dropPath()` Drop the path of the traverser.
    `boolean` | `equals(Object object)`
    `T` | `get()` Get the object that the traverser is current at.
    `TraversalSideEffects` | `getSideEffects()` Get the sideEffects associated with the traversal of the traverser.
    `String` | `getStepId()` Get the step id of where the traverser is located.
    `Set<String>` | `getTags()` Get the tags associated with the traverser.
    `int` | `hashCode()`
    `void` | `incrLoops(String stepLabel)` Increment the number of times the traverser has gone through a looping section of traversal.
    `static <R> EmptyTraverser<R>` | `instance()`
    `void` | `keepLabels(Set<String> labels)` Drop all path information not associated with specified labels.
    `int` | `loops()` Return the number of times the traverser has gone through a looping section of a traversal.
    `void` | `merge(Traverser.Admin<?> other)` When two traversers are have equality with each other, then they can be merged.
    `Path` | `path()` Get the current path of the traverser.
    `void` | `resetLoops()` Set the number of times the traverser has gone through a loop back to 0.
    `<S> S` | `sack()` Get the sack local sack object of this traverser.
    `<S> void` | `sack(S object)` Set the traversers sack object to the provided value ("sack the value").
    `void` | `set(T t)` Set the current object location of the traverser.
    `void` | `setBulk(long count)` Set the number of traversers represented by this traverser.
    `void` | `setSideEffects(TraversalSideEffects sideEffects)` Set the sideEffects of the `Traversal`.
    `void` | `setStepId(String stepId)` Set the step id of where the traverser is located.
    `Traverser.Admin<T>` | `split()` Generate a sibling traverser of the current traverser with a full copy of all state within the sibling.
    `<R> Traverser.Admin<R>` | `split(R r, Step<T,R> step)` Generate a child traverser of the current traverser for current as step and new object location.

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

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

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

      `isHalted`

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

      `asAdmin, compareTo, path, path, sideEffects, sideEffects`

- - ### Method Detail

    - #### instance

          public static <R> EmptyTraverser<R> instance()

    - #### addLabels

          public void addLabels(Set<String> labels)

      Specified by:
        `addLabels` in interface `Traverser.Admin<T>`

    - #### keepLabels

          public void keepLabels(Set<String> labels)

      Description copied from interface: `Traverser.Admin`
      Drop all path information not associated with specified labels. This is an optimization method that allows a traverser to save memory and increase the likelihood of bulking.
      Specified by:
        `keepLabels` in interface `Traverser.Admin<T>`
      Parameters:
        `labels` - the labels to keep path information for.

    - #### dropLabels

          public void dropLabels(Set<String> labels)

      Description copied from interface: `Traverser.Admin`
      Drop all path information associated with specified labels. This is an optimization method that allows a traverser to save memory and increase the likelihood of bulking.
      Specified by:
        `dropLabels` in interface `Traverser.Admin<T>`
      Parameters:
        `labels` - the labels to drop path information for.

    - #### dropPath

          public void dropPath()

      Description copied from interface: `Traverser.Admin`
      Drop the path of the traverser. This is an optimization method that allows a traverser to save memory and increase the likelihood of bulking.
      Specified by:
        `dropPath` in interface `Traverser.Admin<T>`

    - #### set

          public void set(T t)

      Description copied from interface: `Traverser.Admin`
      Set the current object location of the traverser.
      Specified by:
        `set` in interface `Traverser.Admin<T>`
      Parameters:
        `t` - The current object of the traverser

    - #### incrLoops

          public void incrLoops(String stepLabel)

      Description copied from interface: `Traverser.Admin`
      Increment the number of times the traverser has gone through a looping section of traversal. The step label is important to create a stack of loop counters when within a nested context. If the provided label is not the same as the current label on the stack, add a new loop counter. If the provided label is the same as the current label on the stack, increment the loop counter.
      Specified by:
        `incrLoops` in interface `Traverser.Admin<T>`
      Parameters:
        `stepLabel` - the label of the step that is doing the incrementing

    - #### resetLoops

          public void resetLoops()

      Description copied from interface: `Traverser.Admin`
      Set the number of times the traverser has gone through a loop back to 0. When a traverser exits a looping construct, this method should be called. In a nested loop context, the highest stack loop counter should be removed.
      Specified by:
        `resetLoops` in interface `Traverser.Admin<T>`

    - #### getStepId

          public String getStepId()

      Description copied from interface: `Traverser.Admin`
      Get the step id of where the traverser is located. This is typically used in multi-machine systems that require the movement of traversers between different traversal instances.
      Specified by:
        `getStepId` in interface `Traverser.Admin<T>`
      Returns:
        The future step for the traverser

    - #### setStepId

          public void setStepId(String stepId)

      Description copied from interface: `Traverser.Admin`
      Set the step id of where the traverser is located. If the future is `Traverser.Admin.HALT`, then `Traverser.Admin.isHalted()` is true.
      Specified by:
        `setStepId` in interface `Traverser.Admin<T>`
      Parameters:
        `stepId` - The future step of the traverser

    - #### setBulk

          public void setBulk(long count)

      Description copied from interface: `Traverser.Admin`
      Set the number of traversers represented by this traverser.
      Specified by:
        `setBulk` in interface `Traverser.Admin<T>`
      Parameters:
        `count` - the number of traversers

    - #### split

          public <R> Traverser.Admin<R> split(R r,
                                              Step<T,R> step)

      Description copied from interface: `Traverser.Admin`
      Generate a child traverser of the current traverser for current as step and new object location. The child has the path history, future, and loop information of the parent. The child extends that path history with the current as and provided R-object.
      Specified by:
        `split` in interface `Traverser.Admin<T>`
      Type Parameters:
        `R` - The current object type of the child
      Parameters:
        `r` - The current object of the child
        `step` - The step yielding the split
      Returns:
        The split traverser

    - #### split

          public Traverser.Admin<T> split()

      Description copied from interface: `Traverser.Admin`
      Generate a sibling traverser of the current traverser with a full copy of all state within the sibling.
      Specified by:
        `split` in interface `Traverser.Admin<T>`
      Returns:
        The split traverser

    - #### detach

          public Traverser.Admin<T> detach()

      Description copied from interface: `Traverser.Admin`
      Prepare the traverser for migration across a JVM boundary.
      Specified by:
        `detach` in interface `Traverser.Admin<T>`
      Returns:
        The deflated traverser

    - #### attach

          public T attach(Function<Attachable<T>,T> method)

      Description copied from interface: `Traverser.Admin`
      Regenerate the detached traverser given its location at a particular vertex.
      Specified by:
        `attach` in interface `Traverser.Admin<T>`
      Specified by:
        `attach` in interface `Attachable<T>`
      Parameters:
        `method` - The method by which to attach a `Traverser` to an vertex.
      Returns:
        The inflated traverser

    - #### setSideEffects

          public void setSideEffects(TraversalSideEffects sideEffects)

      Description copied from interface: `Traverser.Admin`
      Set the sideEffects of the `Traversal`. Given that traversers can move between machines, it may be important to re-set this when the traverser crosses machine boundaries.
      Specified by:
        `setSideEffects` in interface `Traverser.Admin<T>`
      Parameters:
        `sideEffects` - the sideEffects of the traversal.

    - #### get

          public T get()

      Description copied from interface: `Traverser`
      Get the object that the traverser is current at.
      Specified by:
        `get` in interface `Traverser<T>`
      Specified by:
        `get` in interface `Attachable<T>`
      Returns:
        The current object of the traverser

    - #### sack

          public <S> S sack()

      Description copied from interface: `Traverser`
      Get the sack local sack object of this traverser.
      Specified by:
        `sack` in interface `Traverser<T>`
      Type Parameters:
        `S` - the type of the sack object
      Returns:
        the sack object

    - #### sack

          public <S> void sack(S object)

      Description copied from interface: `Traverser`
      Set the traversers sack object to the provided value ("sack the value").
      Specified by:
        `sack` in interface `Traverser<T>`
      Type Parameters:
        `S` - the type of the object
      Parameters:
        `object` - the new value of the traverser's sack

    - #### merge

          public void merge(Traverser.Admin<?> other)

      Description copied from interface: `Traverser.Admin`
      When two traversers are have equality with each other, then they can be merged. This method is used to merge the traversers into a single traverser. This is used for optimization where instead of enumerating all traversers, they can be counted.
      Specified by:
        `merge` in interface `Traverser.Admin<T>`
      Parameters:
        `other` - the other traverser to merge into this traverser. Once merged, the other can be garbage collected.

    - #### path

          public Path path()

      Description copied from interface: `Traverser`
      Get the current path of the traverser.
      Specified by:
        `path` in interface `Traverser<T>`
      Returns:
        The path of the traverser

    - #### loops

          public int loops()

      Description copied from interface: `Traverser`
      Return the number of times the traverser has gone through a looping section of a traversal.
      Specified by:
        `loops` in interface `Traverser<T>`
      Returns:
        The number of times the traverser has gone through a loop

    - #### bulk

          public long bulk()

      Description copied from interface: `Traverser`
      A traverser may represent a grouping of traversers to allow for more efficient data propagation.
      Specified by:
        `bulk` in interface `Traverser<T>`
      Returns:
        the number of traversers represented in this traverser.

    - #### getSideEffects

          public TraversalSideEffects getSideEffects()

      Description copied from interface: `Traverser.Admin`
      Get the sideEffects associated with the traversal of the traverser.
      Specified by:
        `getSideEffects` in interface `Traverser.Admin<T>`
      Returns:
        the traversal sideEffects of the traverser

    - #### getTags

          public Set<String> getTags()

      Description copied from interface: `Traverser.Admin`
      Get the tags associated with the traverser. Tags are used to categorize historic behavior of a traverser. The returned set is mutable.
      Specified by:
        `getTags` in interface `Traverser.Admin<T>`
      Returns:
        the set of tags associated with the traverser.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object object)

      Overrides:
        `equals` in class `Object`

    - #### clone

          public EmptyTraverser<T> clone()

      Description copied from interface: `Traverser`
      Traverser cloning is important when splitting a traverser at a bifurcation point in a traversal.
      Specified by:
        `clone` in interface `Traverser<T>`
      Overrides:
        `clone` in class `Object`

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