Interface Path
- 
- All Known Implementing Classes:
- DetachedPath,- EmptyPath,- ImmutablePath,- MutablePath,- ReferencePath
 
 public interface Path extends Cloneable, Iterable<Object> A Path denotes a particular walk through aGraphas defined by aTraversal. 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.- Author:
- Marko A. Rodriguez (http://markorodriguez.com)
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static classPath.Exceptions
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Pathclone()Pathextend(Object object, Set<String> labels)Add a new step to the path with an object and any number of associated labels.Pathextend(Set<String> labels)Add labels to the head of the path.default voidforEach(BiConsumer<Object,Set<String>> consumer)default <A> Aget(int index)Get the object associated with the specified index into the path.default <A> Aget(String label)Get the object associated with the particular label of the path.default <A> Aget(Pop pop, String label)Pop the object(s) associated with the label of the path.default booleanhasLabel(String label)Return true if the path has the specified label, else return false.default <A> Ahead()Get the head of the path.default booleanisEmpty()Determine if the path is empty or not.default booleanisSimple()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 whichextend(Object, Set)was called.List<Object>objects()An ordered list of the objects in the path.default booleanpopEquals(Pop pop, Object other)Pathretract(Set<String> labels)Remove labels from path.default intsize()Get the number of step in the path.default Stream<org.javatuples.Pair<Object,Set<String>>>stream()default PathsubPath(String fromLabel, String toLabel)Isolate a sub-path from the path object.- 
Methods inherited from interface java.lang.IterableforEach, spliterator
 
- 
 
- 
- 
- 
Method Detail- 
sizedefault int size() Get the number of step in the path.- Returns:
- the size of the path
 
 - 
isEmptydefault boolean isEmpty() Determine if the path is empty or not.- Returns:
- whether the path is empty or not.
 
 - 
headdefault <A> A head() Get the head of the path.- Type Parameters:
- A- the type of the head of the path
- Returns:
- the head of the path
 
 - 
extendPath extend(Object object, Set<String> labels) Add a new step to the path with an object and any number of associated labels.- Parameters:
- object- the new head of the path
- labels- the labels at the head of the path
- Returns:
- the extended path
 
 - 
extendPath extend(Set<String> labels) Add labels to the head of the path.- Parameters:
- labels- the labels at the head of the path
- Returns:
- the path with added labels
 
 - 
retractPath retract(Set<String> labels) Remove labels from path.- Parameters:
- labels- the labels to remove
- Returns:
- the path with removed labels
 
 - 
getdefault <A> A get(String label) throws IllegalArgumentException Get the object associated with the particular label of the path. If the path as multiple labels of the type, then return aListof those objects.- Type Parameters:
- A- the type of the object associated with the label
- Parameters:
- label- the label of the path
- Returns:
- the object associated with the label of the path
- Throws:
- IllegalArgumentException- if the path does not contain the label
 
 - 
getdefault <A> A get(Pop pop, String label) throws IllegalArgumentException Pop the object(s) associated with the label of the 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
- Throws:
- IllegalArgumentException- if the path does not contain the label
 
 - 
getdefault <A> A get(int index) Get the object associated with the specified index into the 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
 
 - 
hasLabeldefault boolean hasLabel(String label) Return true if the path has the specified label, else return false.- Parameters:
- label- the label to search for
- Returns:
- true if the label exists in the path
 
 - 
objectsList<Object> objects() An ordered list of the objects in the path.- Returns:
- the objects of the path
 
 - 
labelsList<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 whichextend(Object, Set)was called.- Returns:
- the labels of the path
 
 - 
clonePath clone() 
 - 
isSimpledefault boolean isSimple() Determines whether the path is a simple or not. A simple path has no cycles and thus, no repeated objects.- Returns:
- Whether the path is simple or not
 
 - 
forEachdefault void forEach(BiConsumer<Object,Set<String>> consumer) 
 - 
subPathdefault Path subPath(String fromLabel, String toLabel) Isolate a sub-path from the path object. The isolation is based solely on the path labels. The to-label is inclusive. Thus, from "b" to "c" would isolate the example path as followsa,[b,c],d. Note that if there are multiple path segments with the same label, then its the last occurrence that is isolated. For instance, from "b" to "c" would bea,b,[b,c,d,c].- Parameters:
- fromLabel- The label to start recording the sub-path from.
- toLabel- The label to end recording the sub-path to.
- Returns:
- the isolated sub-path.
 
 
- 
 
-