public final class ObjectPath<T> extends Object implements Iterable<T>, Comparable<ObjectPath>
| Modifier and Type | Method and Description |
|---|---|
ObjectPath |
appending(T obj)
Create a new path appending the passed object.
|
ObjectPath<T> |
childPath()
Get a copy of this path, lopping off the first element.
|
int |
compareTo(ObjectPath o) |
boolean |
contains(T obj)
Determine if this path contains the passed item.
|
boolean |
containsPath(ObjectPath<T> other)
Determine if this path contains the sequence of elements in another path.
|
Set<? extends T> |
contents()
Get all of the contained objects as a set.
|
T |
end() |
boolean |
equals(Object o) |
T |
first()
Returns the first element.
|
T |
get(int i)
Get the path element at index i.
|
int |
hashCode() |
int |
indexOf(T obj)
Get the (first) index of an item in this path.
|
boolean |
isEmpty()
Determine if this path is empty.
|
boolean |
isNotAPath()
Determine if this path does not represent an actual path - if it has one
element or less.
|
Iterator<T> |
iterator() |
T |
last()
Returns the last element.
|
int |
lastIndexOf(T obj)
Get the (first) index of an item in this path.
|
ObjectPath<T> |
parentPath()
Get a copy of this path, lopping off the last element.
|
ObjectPath |
prepending(T obj)
Create a new path prepending the passed object.
|
ObjectPath<T> |
reversed()
Create a new path whose elements are this one's in reverse order.
|
int |
size()
Get the number of elements in this path.
|
T |
start() |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic ObjectPath prepending(T obj)
obj - Another object, which must actually be contained in the
original graph this path came from, or null will be returnedpublic ObjectPath appending(T obj)
obj - Another object, which must actually be contained in the
original graph this path came from, or null will be returnedpublic Set<? extends T> contents()
public int size()
public T first()
NoSuchElementException - if the path is emptypublic T last()
NoSuchElementException - if the path is emptypublic T get(int i)
i - An index >=0 and < size()public boolean containsPath(ObjectPath<T> other)
other - Another pathpublic boolean contains(T obj)
obj - public int indexOf(T obj)
obj - An objectpublic int lastIndexOf(T obj)
obj - An objectpublic ObjectPath<T> childPath()
public ObjectPath<T> parentPath()
public boolean isEmpty()
public boolean isNotAPath()
public ObjectPath<T> reversed()
public T start()
public T end()
public int compareTo(ObjectPath o)
compareTo in interface Comparable<ObjectPath>Copyright © 2010–2020 Mastfrog Technologies. All rights reserved.