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...
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< TreeNode > | getIterator () |
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< TreeNode > | children |
The array of child tree nodes for this tree node. | |
TreeNode | parent |
The parent tree node for this tree node. |
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)
Definition at line 35 of file TreeNode.java.
edu.rice.cs.hpc.data.experiment.scope.TreeNode.TreeNode | ( | final Object | value | ) |
Constructs a new instance of TreeNode
.
value | The value held by this node; may be anything. |
Definition at line 62 of file TreeNode.java.
void edu.rice.cs.hpc.data.experiment.scope.TreeNode.add | ( | TreeNode | child | ) |
Definition at line 127 of file TreeNode.java.
References edu.rice.cs.hpc.data.experiment.scope.TreeNode.children.
Referenced by edu.rice.cs.hpc.viewer.scope.flat.FlatScopeViewActions.addChildren(), edu.rice.cs.hpc.data.experiment.scope.Scope.addSubscope(), edu.rice.cs.hpc.viewer.scope.flat.FlatScopeViewActions.flatten(), and edu.rice.cs.hpc.data.experiment.scope.visitors.FilterScopeVisitor.removeChild().
void edu.rice.cs.hpc.data.experiment.scope.TreeNode.dispose | ( | ) |
Reimplemented in edu.rice.cs.hpc.data.experiment.scope.Scope.
Definition at line 242 of file TreeNode.java.
References edu.rice.cs.hpc.data.experiment.scope.TreeNode.children, edu.rice.cs.hpc.data.experiment.scope.TreeNode.parent, and edu.rice.cs.hpc.data.experiment.scope.TreeNode.value.
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
.
left | The left object to compare; may be null . | |
right | The right object to compare; may be null . |
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 | ) |
Definition at line 66 of file TreeNode.java.
References edu.rice.cs.hpc.data.experiment.scope.TreeNode.value.
Referenced by edu.rice.cs.hpc.data.experiment.scope.TreeNode.equals().
TreeNode edu.rice.cs.hpc.data.experiment.scope.TreeNode.getChildAt | ( | int | index | ) |
Definition at line 173 of file TreeNode.java.
References edu.rice.cs.hpc.data.experiment.scope.TreeNode.children.
Referenced by edu.rice.cs.hpc.viewer.scope.flat.FlatScopeViewActions.addChildren(), edu.rice.cs.hpc.data.experiment.scope.Scope.dfsVisitFilterScopeTree(), edu.rice.cs.hpc.viewer.scope.BaseScopeView.enableFilter(), edu.rice.cs.hpc.data.experiment.BaseExperiment.filter(), edu.rice.cs.hpc.viewer.scope.flat.FlatScopeViewActions.flatten(), edu.rice.cs.hpc.data.experiment.scope.Scope.getSubscope(), edu.rice.cs.hpc.data.experiment.merge.ExperimentMerger.merge(), and edu.rice.cs.hpc.viewer.scope.flat.FlatScopeViewActionsGUI.shouldFlattenBeEnabled().
int edu.rice.cs.hpc.data.experiment.scope.TreeNode.getChildCount | ( | ) |
Definition at line 187 of file TreeNode.java.
References edu.rice.cs.hpc.data.experiment.scope.TreeNode.children.
Referenced by edu.rice.cs.hpc.viewer.scope.flat.FlatScopeViewActions.addChildren(), edu.rice.cs.hpc.data.experiment.merge.TreeSimilarity.areSameChildren(), edu.rice.cs.hpc.viewer.scope.ScopeZoom.canZoomIn(), edu.rice.cs.hpc.data.experiment.scope.Scope.dfsVisitFilterScopeTree(), edu.rice.cs.hpc.viewer.scope.flat.FlatScopeViewActions.flatten(), edu.rice.cs.hpc.data.experiment.scope.Scope.getSubscopeCount(), edu.rice.cs.hpc.data.experiment.merge.TreeSimilarity.isOnlyChild(), edu.rice.cs.hpc.viewer.scope.flat.FlatScopeViewActionsGUI.shouldFlattenBeEnabled(), and edu.rice.cs.hpc.viewer.scope.BaseScopeView.updateDisplay().
Object [] edu.rice.cs.hpc.data.experiment.scope.TreeNode.getChildren | ( | ) |
Returns the child nodes.
Empty arrays are converted to null
before being returned.
null
, but never empty. There should be no null
children in the array. Definition at line 81 of file TreeNode.java.
References edu.rice.cs.hpc.data.experiment.scope.TreeNode.children.
Referenced by edu.rice.cs.hpc.data.experiment.scope.ProcedureScope.getAllChildren(), edu.rice.cs.hpc.data.experiment.scope.CallSiteScopeCallerView.getAllChildren(), edu.rice.cs.hpc.viewer.scope.bottomup.CallerViewContentProvider.getChildren(), edu.rice.cs.hpc.viewer.scope.AbstractContentProvider.getChildren(), edu.rice.cs.hpc.data.experiment.BaseExperiment.getRootScopeChildren(), edu.rice.cs.hpc.data.experiment.merge.TreeSimilarity.getSortedChildren(), and edu.rice.cs.hpc.data.experiment.scope.visitors.FilterScopeVisitor.removeChild().
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
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.
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.
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.
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
.
object | The object for which a hash code is required. |
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 | ( | ) |
Reimplemented in edu.rice.cs.hpc.data.experiment.scope.Scope.
Definition at line 118 of file TreeNode.java.
References edu.rice.cs.hpc.data.experiment.scope.TreeNode.value.
void edu.rice.cs.hpc.data.experiment.scope.TreeNode.remove | ( | int | index | ) |
Remove a child for a given index.
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.
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.
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().
List<TreeNode> edu.rice.cs.hpc.data.experiment.scope.TreeNode.children [private] |
The array of child tree nodes for this tree node.
If there are no children, then this value may either by an empty array or null
. There should be no null
children in the array.
Definition at line 43 of file TreeNode.java.
Referenced by edu.rice.cs.hpc.data.experiment.scope.TreeNode.add(), edu.rice.cs.hpc.data.experiment.scope.TreeNode.dispose(), edu.rice.cs.hpc.data.experiment.scope.CallSiteScopeCallerView.getAllChildren(), edu.rice.cs.hpc.data.experiment.scope.TreeNode.getChildAt(), edu.rice.cs.hpc.data.experiment.scope.TreeNode.getChildCount(), edu.rice.cs.hpc.data.experiment.scope.TreeNode.getChildren(), edu.rice.cs.hpc.data.experiment.scope.TreeNode.getIterator(), edu.rice.cs.hpc.data.experiment.scope.TreeNode.hasChildren(), and edu.rice.cs.hpc.data.experiment.scope.TreeNode.remove().
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().
Object edu.rice.cs.hpc.data.experiment.scope.TreeNode.value [protected] |
The value contained in this node.
This value may be anything.
Definition at line 54 of file TreeNode.java.
Referenced by edu.rice.cs.hpc.data.experiment.scope.Scope.backupMetricValues(), edu.rice.cs.hpc.data.experiment.scope.TreeNode.dispose(), edu.rice.cs.hpc.data.experiment.scope.TreeNode.equals(), edu.rice.cs.hpc.data.experiment.scope.Scope.getMetricValue(), edu.rice.cs.hpc.data.experiment.scope.TreeNode.getValue(), and edu.rice.cs.hpc.data.experiment.scope.TreeNode.hashCode().