Interface TraceObjectValPath

All Superinterfaces:
Comparable<TraceObjectValPath>
All Known Implementing Classes:
DBTraceObjectValPath

public interface TraceObjectValPath extends Comparable<TraceObjectValPath>
A path of values leading from one object to another

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 Details

    • of

      static TraceObjectValPath 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 destination

      The returned list is suited for testing with PathFilter or other path-manipulation methods.

      Returns:
      the list of keys
    • contains

      boolean contains(TraceObjectValue entry)
      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

      TraceObject getSource(TraceObject ifEmpty)
      Get the source object

      This 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

      Object getDestinationValue(Object ifEmpty)
      Get the destination value

      This 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. Use getDestination(TraceObject) to assume the destination is an object.

      Parameters:
      ifEmpty - the value to return when the path is empty
      Returns:
      the destination value
    • getDestination

      TraceObject getDestination(TraceObject ifEmpty)
      Get the destination object

      This 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. Use getDestinationValue(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 path

      This 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 path

      This 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