Class NamedTree<TreeType extends NamedTree>

  • Direct Known Subclasses:
    AbstractPtalonEvaluator.IfTree

    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$
    Author:
    Adam Cataldo, Elaine Cheong
    Pt.AcceptedRating:
    Red (celaine)
    Pt.ProposedRating:
    Red (celaine)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      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

      Constructors 
      Constructor Description
      NamedTree​(TreeType parent, java.lang.String name)
      Create a new tree with the specified parent.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      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

      • _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.