ptolemy.actor.ptalon
Class NamedTree<TreeType extends NamedTree>

java.lang.Object
  extended by ptolemy.actor.ptalon.NamedTree<TreeType>
Direct Known Subclasses:
AbstractPtalonEvaluator.IfTree, PtalonEvaluator.ActorTree

public abstract class NamedTree<TreeType extends NamedTree>
extends java.lang.Object

This class is used for generic trees, where each node has a name. Subclasses will typically should set TreeType to be the subclass itself. For instance, IfTree extends NamedTree < IfTree >

Since:
Ptolemy II 6.1
Version:
$Id: NamedTree.java 53095 2009-04-12 19:12:45Z cxh $
Author:
Adam Cataldo, Elaine Cheong
Accepted Rating:
Red (celaine)
Proposed Rating:
Red (celaine)

Field Summary
protected  java.util.List<TreeType> _children
          The children of this tree.
protected  java.lang.String _name
          The name of this tree.
protected  TreeType _parent
          The parent of this tree.
 
Constructor Summary
NamedTree(TreeType parent, java.lang.String name)
          Create a new tree with the specified parent.
 
Method Summary
abstract  TreeType addChild(java.lang.String name)
          Create a new child tree to this tree with the specified name and return it.
 TreeType getChild(java.lang.String name)
          Returns the child with the specified name.
 java.util.List<TreeType> getChildren()
          Returns the children of this tree.
 java.lang.String getName()
          Returns the name associated with this tree.
 TreeType getParent()
          Returns the parent of this tree.
 java.util.List<TreeType> getProperAncestors()
          Return the ancestors of this tree, not including this tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_parent

protected TreeType extends NamedTree _parent
The parent of this tree.


_children

protected java.util.List<TreeType extends NamedTree> _children
The children of this tree.


_name

protected java.lang.String _name
The name of this tree.

Constructor Detail

NamedTree

public NamedTree(TreeType parent,
                 java.lang.String name)
Create a new tree with the specified parent. This is null if the tree to create is a root.

Parameters:
parent - The parent for this tree.
name - The name for this tree.
Method Detail

addChild

public abstract TreeType addChild(java.lang.String name)
Create a new child tree to this tree with the specified name and return it.

Parameters:
name - The name of the child.
Returns:
The child TreeType.

getChild

public TreeType getChild(java.lang.String name)
Returns the child with the specified name.

Parameters:
name - The name for the desired child.
Returns:
A child with the specified name, if there is any, or null otherwise.

getChildren

public java.util.List<TreeType> getChildren()
Returns the children of this tree.

Returns:
The children of this tree.

getName

public java.lang.String getName()
Returns the name associated with this tree.

Returns:
The name associated with this tree.

getParent

public TreeType getParent()
Returns the parent of this tree.

Returns:
The parent of this tree.

getProperAncestors

public java.util.List<TreeType> getProperAncestors()
Return the ancestors of this tree, not including this tree.

Returns:
The ancestors of this tree, not including this tree.