edu.rice.cs.hpc.data.experiment.scope.TreeNode Class Reference

This class is a modified version of org.eclipse.jface.viewers.TreeNode org.eclipse.jface.viewers.TreeNode without using Eclipse classes and with additional features, plus a flexible children update. More...

Inheritance diagram for edu.rice.cs.hpc.data.experiment.scope.TreeNode:
Inheritance graph
[legend]
Collaboration diagram for edu.rice.cs.hpc.data.experiment.scope.TreeNode:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TreeNode (final Object value)
 Constructs a new instance of TreeNode.
boolean equals (final Object object)
Object[] getChildren ()
 Returns the child nodes.
TreeNode getParent ()
 Returns the parent node.
Object getValue ()
 Returns the value held by this node.
boolean hasChildren ()
 Returns whether the tree has any children.
int hashCode ()
void add (TreeNode child)
void remove (TreeNode child)
 Remove a child.
void remove (int index)
 Remove a child for a given index.
void setParent (final TreeNode parent)
 Sets the parent for this node.
TreeNode getChildAt (int index)
int getChildCount ()
Iterator< TreeNodegetIterator ()
 Return the iterator of the children.
void dispose ()

Static Public Member Functions

static final int hashCode (final Object object)
 Provides a hash code for the object -- defending against null.
static final boolean equals (final Object left, final Object right)
 Checks whether the two objects are null -- allowing for null.

Protected Attributes

Object value
 The value contained in this node.

Private Attributes

List< TreeNodechildren
 The array of child tree nodes for this tree node.
TreeNode parent
 The parent tree node for this tree node.

Detailed Description

This class is a modified version of org.eclipse.jface.viewers.TreeNode org.eclipse.jface.viewers.TreeNode without using Eclipse classes and with additional features, plus a flexible children update.

A simple data structure that is useful for implemented tree models. This can be returned by org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object). It allows simple delegation of methods from org.eclipse.jface.viewers.ITreeContentProvider such as org.eclipse.jface.viewers.ITreeContentProvider#getChildren(Object), org.eclipse.jface.viewers.ITreeContentProvider#getParent(Object) and org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(Object)

Since:
3.2

Definition at line 35 of file TreeNode.java.


Constructor & Destructor Documentation

edu.rice.cs.hpc.data.experiment.scope.TreeNode.TreeNode ( final Object  value  ) 

Constructs a new instance of TreeNode.

Parameters:
value The value held by this node; may be anything.

Definition at line 62 of file TreeNode.java.


Member Function Documentation

void edu.rice.cs.hpc.data.experiment.scope.TreeNode.add ( TreeNode  child  ) 
void edu.rice.cs.hpc.data.experiment.scope.TreeNode.dispose (  ) 
static final boolean edu.rice.cs.hpc.data.experiment.scope.TreeNode.equals ( final Object  left,
final Object  right 
) [static]

Checks whether the two objects are null -- allowing for null.

Parameters:
left The left object to compare; may be null.
right The right object to compare; may be null.
Returns:
true if the two objects are equivalent; false otherwise.

Definition at line 234 of file TreeNode.java.

References edu.rice.cs.hpc.data.experiment.scope.TreeNode.equals().

boolean edu.rice.cs.hpc.data.experiment.scope.TreeNode.equals ( final Object  object  ) 
TreeNode edu.rice.cs.hpc.data.experiment.scope.TreeNode.getChildAt ( int  index  ) 
int edu.rice.cs.hpc.data.experiment.scope.TreeNode.getChildCount (  ) 
Object [] edu.rice.cs.hpc.data.experiment.scope.TreeNode.getChildren (  ) 
Iterator<TreeNode> edu.rice.cs.hpc.data.experiment.scope.TreeNode.getIterator (  ) 

Return the iterator of the children.


The advantage of an iterator is that it allows the caller to remove elements from the collection of children during the iteration. See java.util.Iterator

Returns:
java.util.Iterator

Definition at line 202 of file TreeNode.java.

References edu.rice.cs.hpc.data.experiment.scope.TreeNode.children.

Referenced by edu.rice.cs.hpc.data.experiment.scope.Scope.dfsVisitFilterScopeTree().

TreeNode edu.rice.cs.hpc.data.experiment.scope.TreeNode.getParent (  ) 

Returns the parent node.

Returns:
The parent node; may be null if there are no parent nodes.

Definition at line 94 of file TreeNode.java.

References edu.rice.cs.hpc.data.experiment.scope.TreeNode.parent.

Referenced by edu.rice.cs.hpc.viewer.scope.ScopeViewActions.getInputNode(), and edu.rice.cs.hpc.data.experiment.scope.Scope.getParentScope().

Object edu.rice.cs.hpc.data.experiment.scope.TreeNode.getValue (  ) 

Returns the value held by this node.

Returns:
The value; may be anything.

Definition at line 103 of file TreeNode.java.

References edu.rice.cs.hpc.data.experiment.scope.TreeNode.value.

Referenced by edu.rice.cs.hpc.data.experiment.scope.Scope.getCCTIndex().

boolean edu.rice.cs.hpc.data.experiment.scope.TreeNode.hasChildren (  ) 

Returns whether the tree has any children.

Returns:
true if its array of children is not null and is non-empty; false otherwise.

Definition at line 114 of file TreeNode.java.

References edu.rice.cs.hpc.data.experiment.scope.TreeNode.children.

Referenced by edu.rice.cs.hpc.viewer.scope.flat.FlatScopeViewActions.flatten(), and edu.rice.cs.hpc.viewer.scope.bottomup.CallerViewContentProvider.hasChildren().

static final int edu.rice.cs.hpc.data.experiment.scope.TreeNode.hashCode ( final Object  object  )  [static]

Provides a hash code for the object -- defending against null.

Parameters:
object The object for which a hash code is required.
Returns:
object.hashCode or 0 if object if null.

Definition at line 219 of file TreeNode.java.

int edu.rice.cs.hpc.data.experiment.scope.TreeNode.hashCode (  ) 
void edu.rice.cs.hpc.data.experiment.scope.TreeNode.remove ( int  index  ) 

Remove a child for a given index.

Parameters:
index : index of the scope to be removed

Definition at line 151 of file TreeNode.java.

References edu.rice.cs.hpc.data.experiment.scope.TreeNode.children.

void edu.rice.cs.hpc.data.experiment.scope.TreeNode.remove ( TreeNode  child  ) 

Remove a child.

The child hash code (which is the cct) has to be unique.
Otherwise, it will remove incorrect child.

Parameters:
child : the child to be removed

Definition at line 141 of file TreeNode.java.

References edu.rice.cs.hpc.data.experiment.scope.TreeNode.children.

Referenced by edu.rice.cs.hpc.data.experiment.Experiment.filter_finalize(), and edu.rice.cs.hpc.data.experiment.scope.visitors.FilterScopeVisitor.removeChild().

void edu.rice.cs.hpc.data.experiment.scope.TreeNode.setParent ( final TreeNode  parent  ) 

Sets the parent for this node.

Parameters:
parent The parent node; may be null.

Definition at line 162 of file TreeNode.java.

Referenced by edu.rice.cs.hpc.data.experiment.scope.Scope.setParentScope().


Member Data Documentation

The parent tree node for this tree node.

This value may be null if there is no parent.

Definition at line 49 of file TreeNode.java.

Referenced by edu.rice.cs.hpc.data.experiment.scope.TreeNode.dispose(), and edu.rice.cs.hpc.data.experiment.scope.TreeNode.getParent().


The documentation for this class was generated from the following file:

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1