public interface Path extends Cloneable
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 |
---|---|
void |
addLabel(String label)
Add label to the current head of the path.
|
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.
|
default Path |
extend(Object object,
String... labels) |
default void |
forEach(BiConsumer<Object,Set<String>> consumer) |
default void |
forEach(Consumer<Object> 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.
|
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
addLabel(java.lang.String) was called. |
List<Object> |
objects()
An ordered list of the objects in the path.
|
default int |
size()
Get the number of step in the path.
|
default Stream<<any>> |
stream() |
default int size()
Path extend(Object object, Set<String> labels)
object
- the new head of the pathlabels
- the labels at the head of the pathdefault <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 forvoid addLabel(String label)
label
- the label to add to the head of the pathList<Object> objects()
List<Set<String>> labels()
addLabel(java.lang.String)
was called.Path clone()
default boolean isSimple()
default void forEach(BiConsumer<Object,Set<String>> consumer)
default Stream<<any>> stream()
Copyright © 2013–2015 Apache Software Foundation. All rights reserved.