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

## Class MutablePath

- java.lang.Object
- - org.apache.tinkerpop.gremlin.process.traversal.step.util.MutablePath

- All Implemented Interfaces:
    Serializable, Cloneable, Iterable<Object>, Path
  Direct Known Subclasses:
    DetachedPath, ReferencePath

      public class MutablePath
      extends Object
      implements Path, Serializable

  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.Path

      `Path.Exceptions`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected List<Set<String>>` | `labels`
    `protected List<Object>` | `objects`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `MutablePath()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `MutablePath` | `clone()`
    `boolean` | `equals(Object other)`
    `Path` | `extend(Object object, Set<String> labels)` Add a new step to the path with an object and any number of associated labels.
    `Path` | `extend(Set<String> labels)` Add labels to the head of the path.
    `<A> A` | `get(int index)` Get the object associated with the specified index into the path.
    `<A> A` | `get(Pop pop, String label)` Pop the object(s) associated with the label of the path.
    `int` | `hashCode()`
    `boolean` | `hasLabel(String label)` Return true if the path has the specified label, else return false.
    `<A> A` | `head()` Get the head of the path.
    `boolean` | `isEmpty()` Determine if the path is empty or not.
    `Iterator<Object>` | `iterator()`
    `List<Set<String>>` | `labels()` An ordered list of the labels associated with the path The set of labels for a particular step are ordered by the order in which `Path.extend(Object, Set)` was called.
    `static Path` | `make()`
    `List<Object>` | `objects()` An ordered list of the objects in the path.
    `Path` | `retract(Set<String> removeLabels)` Remove labels from path.
    `int` | `size()` Get the number of step in the path.
    `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.Path

      `forEach, get, isSimple, popEquals, stream, subPath`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Field Detail

    - #### objects

          protected final List<Object> objects

    - #### labels

          protected final List<Set<String>> labels

  - ### Constructor Detail

    - #### MutablePath

          protected MutablePath()

  - ### Method Detail

    - #### make

          public static Path make()

    - #### clone

          public MutablePath clone()

      Specified by:
        `clone` in interface `Path`
      Overrides:
        `clone` in class `Object`

    - #### isEmpty

          public boolean isEmpty()

      Description copied from interface: `Path`
      Determine if the path is empty or not.
      Specified by:
        `isEmpty` in interface `Path`
      Returns:
        whether the path is empty or not.

    - #### head

          public <A> A head()

      Description copied from interface: `Path`
      Get the head of the path.
      Specified by:
        `head` in interface `Path`
      Type Parameters:
        `A` - the type of the head of the path
      Returns:
        the head of the path

    - #### size

          public int size()

      Description copied from interface: `Path`
      Get the number of step in the path.
      Specified by:
        `size` in interface `Path`
      Returns:
        the size of the path

    - #### extend

          public Path extend(Object object,
                             Set<String> labels)

      Description copied from interface: `Path`
      Add a new step to the path with an object and any number of associated labels.
      Specified by:
        `extend` in interface `Path`
      Parameters:
        `object` - the new head of the path
        `labels` - the labels at the head of the path
      Returns:
        the extended path

    - #### extend

          public Path extend(Set<String> labels)

      Description copied from interface: `Path`
      Add labels to the head of the path.
      Specified by:
        `extend` in interface `Path`
      Parameters:
        `labels` - the labels at the head of the path
      Returns:
        the path with added labels

    - #### retract

          public Path retract(Set<String> removeLabels)

      Description copied from interface: `Path`
      Remove labels from path.
      Specified by:
        `retract` in interface `Path`
      Parameters:
        `removeLabels` - the labels to remove
      Returns:
        the path with removed labels

    - #### get

          public <A> A get(int index)

      Description copied from interface: `Path`
      Get the object associated with the specified index into the path.
      Specified by:
        `get` in interface `Path`
      Type Parameters:
        `A` - the type of the object associated with the index
      Parameters:
        `index` - the index of the path
      Returns:
        the object associated with the index of the path

    - #### get

          public <A> A get(Pop pop,
                           String label)

      Description copied from interface: `Path`
      Pop the object(s) associated with the label of the path.
      Specified by:
        `get` in interface `Path`
      Type Parameters:
        `A` - the type of the object associated with the label
      Parameters:
        `pop` - first for least recent, last for most recent, and all for all in a list
        `label` - the label of the path
      Returns:
        the object associated with the label of the path

    - #### hasLabel

          public boolean hasLabel(String label)

      Description copied from interface: `Path`
      Return true if the path has the specified label, else return false.
      Specified by:
        `hasLabel` in interface `Path`
      Parameters:
        `label` - the label to search for
      Returns:
        true if the label exists in the path

    - #### objects

          public List<Object> objects()

      Description copied from interface: `Path`
      An ordered list of the objects in the path.
      Specified by:
        `objects` in interface `Path`
      Returns:
        the objects of the path

    - #### labels

          public List<Set<String>> labels()

      Description copied from interface: `Path`
      An ordered list of the labels associated with the path The set of labels for a particular step are ordered by the order in which `Path.extend(Object, Set)` was called.
      Specified by:
        `labels` in interface `Path`
      Returns:
        the labels of the path

    - #### iterator

          public Iterator<Object> iterator()

      Specified by:
        `iterator` in interface `Iterable<Object>`
      Specified by:
        `iterator` in interface `Path`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object other)

      Overrides:
        `equals` in class `Object`

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