public interface Path extends Cloneable, Iterable<Object>
Graph
as defined by a Traversal
.
In abstraction, any Path implementation maintains two lists: a list of sets of labels and a list of objects.
The list of labels are the labels of the steps traversed. The list of objects are the objects traversed.Modifier and Type | Interface and Description |
---|---|
static class |
Path.Exceptions |
Modifier and Type | Method and Description |
---|---|
Path |
clone() |
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.
|
default void |
forEach(BiConsumer<Object,Set<String>> consumer) |
default <A> A |
get(int index)
Get the object associated with the specified index into the path.
|
default <A> A |
get(Pop pop,
String label)
Pop the object(s) associated with the label of the path.
|
default <A> A |
get(String label)
Get the object associated with the particular label of the path.
|
default boolean |
hasLabel(String label)
Return true if the path has the specified label, else return false.
|
default boolean |
isSimple()
Determines whether the path is a simple or not.
|
default 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
extend(Object, Set) was called. |
List<Object> |
objects()
An ordered list of the objects in the path.
|
default boolean |
popEquals(Pop pop,
Object other) |
Path |
retract(Set<String> labels)
Remove labels from path.
|
default int |
size()
Get the number of step in the path.
|
default Stream<<any>> |
stream() |
forEach, spliterator
default int size()
Path extend(Object object, Set<String> labels)
object
- the new head of the pathlabels
- the labels at the head of the pathPath extend(Set<String> labels)
labels
- the labels at the head of the pathPath retract(Set<String> labels)
labels
- the labels to removedefault <A> A get(String label) throws IllegalArgumentException
List
of those objects.A
- the type of the object associated with the labellabel
- the label of the pathIllegalArgumentException
- if the path does not contain the labeldefault <A> A get(Pop pop, String label) throws IllegalArgumentException
A
- the type of the object associated with the labelpop
- first for least recent, last for most recent, and all for all in a listlabel
- the label of the pathIllegalArgumentException
- if the path does not contain the labeldefault <A> A get(int index)
A
- the type of the object associated with the indexindex
- the index of the pathdefault boolean hasLabel(String label)
label
- the label to search forList<Object> objects()
List<Set<String>> labels()
extend(Object, Set)
was called.Path clone()
default boolean isSimple()
default void forEach(BiConsumer<Object,Set<String>> consumer)
default Stream<<any>> stream()
Copyright © 2013–2016 Apache Software Foundation. All rights reserved.