Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.jface.viewers
Class TreePath


java.lang.Object
  extended by 
org.eclipse.jface.viewers.TreePath

public final class TreePath
extends Object

A tree path denotes a model element in a tree viewer. Tree path objects have value semantics. A model element is represented by a path of elements in the tree from the root element to the leaf element.

Clients may instantiate this class. Not intended to be subclassed.

Since:
3.2

Field Summary
static  TreePath EMPTY
          Constant for representing an empty tree path.
 
Constructor Summary
TreePath ( Object[] segments)
          Constructs a path identifying a leaf node in a tree.
 
Method Summary
  TreePath createChildPath ( Object newSegment)
          Returns a copy of this tree path with the given segment added at the end.
 boolean equals ( Object other)
           
 boolean equals ( TreePath otherPath, IElementComparer comparer)
          Returns whether this path is equivalent to the given path using the specified comparer to compare individual elements.
  Object getFirstSegment ()
          Returns the first element in this path, or null if this path has no segments.
  Object getLastSegment ()
          Returns the last element in this path, or null if this path has no segments.
  TreePath getParentPath ()
          Returns a copy of this tree path with one segment removed from the end, or null if this tree path has no segments.
  Object getSegment (int index)
          Returns the element at the specified index in this path.
 int getSegmentCount ()
          Returns the number of elements in this path.
 int hashCode ()
          (non-Javadoc)
 int hashCode ( IElementComparer comparer)
          Returns a hash code computed from the hash codes of the segments, using the given comparer to compute the hash codes of the segments.
 boolean startsWith ( TreePath treePath, IElementComparer comparer)
          Returns whether this path starts with the same segments as the given path, using the given comparer to compare segments.
 
Methods inherited from class java.lang. Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final 
TreePath EMPTY
Constant for representing an empty tree path.

Constructor Detail

TreePath

public TreePath(
Object[] segments)
Constructs a path identifying a leaf node in a tree.

Parameters:
segments - path of elements to a leaf node in a tree, starting with the root element
Method Detail

getSegment

public 
Object getSegment(int index)
Returns the element at the specified index in this path.

Parameters:
index - index of element to return
Returns:
element at the specified index

getSegmentCount

public int getSegmentCount()
Returns the number of elements in this path.

Returns:
the number of elements in this path

getFirstSegment

public 
Object getFirstSegment()
Returns the first element in this path, or null if this path has no segments.

Returns:
the first element in this path

getLastSegment

public 
Object getLastSegment()
Returns the last element in this path, or null if this path has no segments.

Returns:
the last element in this path

equals

public boolean equals(
Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
(non-Javadoc)

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

hashCode

public int hashCode(
IElementComparer comparer)
Returns a hash code computed from the hash codes of the segments, using the given comparer to compute the hash codes of the segments.

Parameters:
comparer - comparer to use or null if the segments' hash codes should be computed by calling their hashCode() methods.
Returns:
the computed hash code

equals

public boolean equals(
TreePath otherPath,
                      
IElementComparer comparer)
Returns whether this path is equivalent to the given path using the specified comparer to compare individual elements.

Parameters:
otherPath - tree path to compare to
comparer - comparator to use or null if segments should be compared using equals()
Returns:
whether the paths are equal

startsWith

public boolean startsWith(
TreePath treePath,
                          
IElementComparer comparer)
Returns whether this path starts with the same segments as the given path, using the given comparer to compare segments.

Parameters:
treePath - path to compare to
comparer - the comparer to use, or null if equals() should be used to compare segments
Returns:
whether the given path is a prefix of this path, or the same as this path

getParentPath

public 
TreePath getParentPath()
Returns a copy of this tree path with one segment removed from the end, or null if this tree path has no segments.

Returns:
a tree path

createChildPath

public 
TreePath createChildPath(
Object newSegment)
Returns a copy of this tree path with the given segment added at the end.

Parameters:
newSegment -
Returns:
a tree path

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire