Interface TraceObjectValPath
- All Superinterfaces:
Comparable<TraceObjectValPath>
- All Known Implementing Classes:
DBTraceObjectValPath
Often, the source object is the root. These are often returned in streams where the search involves a desired "span." The path satisfies that requirement, i.e., "the path intersects the span" if the cumulative intersection of all values' lifespans along the path and the given span is non-empty. Paths may also be empty, implying the source is the destination. Empty paths "intersect" any given span.
-
Method Summary
Modifier and TypeMethodDescriptionappend(TraceObjectValue entry) Append the entry to this path, generating a new pathbooleancontains(TraceObjectValue entry) Check if a given value appears on this pathgetDestination(TraceObject ifEmpty) Get the destination objectgetDestinationValue(Object ifEmpty) Get the destination valueList<? extends TraceObjectValue> Get the values in the path, ordered from source to destinationGet the first entry, i.e., the one adjacent to the source objectGet the last entry, i.e., the one adjacent to the destination objectgetPath()Get the keys in the path, ordered from source to destinationgetSource(TraceObject ifEmpty) Get the source objectstatic TraceObjectValPathof()Get the zero-length pathprepend(TraceObjectValue entry) Prepend the entry to this path, generating a new pathMethods inherited from interface java.lang.Comparable
compareTo
-
Method Details
-
of
Get the zero-length path- Returns:
- the empty path
-
getEntryList
List<? extends TraceObjectValue> getEntryList()Get the values in the path, ordered from source to destination- Returns:
- the list of value entries
-
getPath
KeyPath getPath()Get the keys in the path, ordered from source to destinationThe returned list is suited for testing with
PathFilteror other path-manipulation methods.- Returns:
- the list of keys
-
contains
Check if a given value appears on this path- Parameters:
entry- the value entry to check- Returns:
- true if it appears on the path, false otherwise
-
getFirstEntry
TraceObjectValue getFirstEntry()Get the first entry, i.e., the one adjacent to the source object- Returns:
- the entry, or null if the path is empty
-
getSource
Get the source objectThis returns the parent object of the first entry of the path, unless the path is empty. If the path is empty, then this returns the value passed in
ifEmpty, which is presumably the destination object.- Parameters:
ifEmpty- the object to return when this path is empty- Returns:
- the source object
-
getLastEntry
TraceObjectValue getLastEntry()Get the last entry, i.e., the one adjacent to the destination object- Returns:
- the entry, or null if the path is empty
-
getDestinationValue
Get the destination valueThis returns the value of the last entry of the path, unless the path is empty. If the path is empty, then this returns the object passed in
ifEmpty, which is presumably the source object. Note that values may be a primitive, so the destination is not always an object, i.e.,TraceObject. UsegetDestination(TraceObject)to assume the destination is an object.- Parameters:
ifEmpty- the value to return when the path is empty- Returns:
- the destination value
-
getDestination
Get the destination objectThis returns the child object of the last entry of the path, unless the path is empty. If the path is empty, then this returns the object passed in
ifEmpty, which is presumably the source object. Note that values may be primitive, so the destination is not always an object, i.e.,TraceObject. UsegetDestinationValue(Object)when it is not safe to assume the destination is an object.- Parameters:
ifEmpty- the object to return when the path is empty- Returns:
- the destination object
- Throws:
ClassCastException- if the destination value is not an object
-
append
Append the entry to this path, generating a new pathThis performs no validation. The parent of the given entry should be the child of the last entry in this path.
- Parameters:
entry- the entry to append- Returns:
- the new path
-
prepend
Prepend the entry to this path, generating a new pathThis performs no validation. The child of the given entry should be the parent of the first entry in this path.
- Parameters:
entry- the entry to prepend- Returns:
- the new path
-