ikrs.util
Interface Path<T>

All Known Implementing Classes:
ListPathAdapter

public interface Path<T>

A path is an abstract sequence of tokens that is usually used to address an item inside a tree. Example: inside the tree A / \ B C / \ \ D E F the element 'E' would be located at the path [ A, B, E ]. A path must not necesarily address a leaf; inner nodes have paths too.


Method Summary
 T getFirstElement()
          Get the first element of this path.
 int getLength()
          Get the length of this path.
 Path<T> getTrailingPath()
          Get the trailing path from this path.
 

Method Detail

getLength

int getLength()
Get the length of this path. The length of a path is the exact number of items. An empty path has the size 0.

Returns:
The length of this path which is the number of path elements.

getFirstElement

T getFirstElement()
Get the first element of this path. If the path is empty the method must return null.

Returns:
The first path element or null if the path is empty.

getTrailingPath

Path<T> getTrailingPath()
Get the trailing path from this path. The trailing path is this path without the first element. Retrieving the trailing path is equivalent to going down one level inside the tree structure. If this path is empty the returned trailing path is null.

Returns:
The trailing path or null if this path is empty.