NASA World Wind

gov.nasa.worldwind.util.tree
Class TreePath

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<String>
              extended by gov.nasa.worldwind.util.tree.TreePath
All Implemented Interfaces:
Serializable, Cloneable, Iterable<String>, Collection<String>, List<String>, RandomAccess

public class TreePath
extends ArrayList<String>

A path to a node in a Tree. The path is expressed as a list of strings.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
TreePath()
          Create an empty tree path.
TreePath(List<String> initialPathEntries)
          Create a tree path from a list.
TreePath(String initialPathEntry, String... args)
          Create a tre path.
TreePath(TreePath initialPath, String... args)
          Create a tre path.
 
Method Summary
static boolean isEmptyPath(TreePath path)
          Determines if a path is empty.
 TreePath lastButOne()
          Retrieves the a sub-section of this path from the first element to the second to last element.
 TreePath subPath(int start, int end)
          Retrieves a subsection of the path.
 String toString()
           
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

TreePath

public TreePath()
Create an empty tree path.


TreePath

public TreePath(List<String> initialPathEntries)
Create a tree path from a list.

Parameters:
initialPathEntries - Entries in the path.

TreePath

public TreePath(String initialPathEntry,
                String... args)
Create a tre path.

Parameters:
initialPathEntry - The first entry in the path.
args - Additional path entries.

TreePath

public TreePath(TreePath initialPath,
                String... args)
Create a tre path.

Parameters:
initialPath - Base tree path.
args - Additional path elements to append to initialPath.
Method Detail

isEmptyPath

public static boolean isEmptyPath(TreePath path)
Determines if a path is empty.

Parameters:
path - Path to test.
Returns:
true if path contains no entries, path is null, or if the first entry of path is null or an empty string.

lastButOne

public TreePath lastButOne()
Retrieves the a sub-section of this path from the first element to the second to last element.

Returns:
a new TreePath that contains the entries in this path, excluding the final entry.

subPath

public TreePath subPath(int start,
                        int end)
Retrieves a subsection of the path.

Parameters:
start - first index (inclusive) of the sub-path
end - last index (exclusive) of the sub-path
Returns:
A new path made up of path elements between start and end.

toString

public String toString()
Overrides:
toString in class AbstractCollection<String>

NASA World Wind