Algernon Software

org.algernon.app.j2p
Class J2PClass

java.lang.Object
  extended byjavax.swing.tree.DefaultMutableTreeNode
      extended byorg.algernon.app.j2p.J2PFrame
          extended byorg.algernon.app.j2p.J2PClass
All Implemented Interfaces:
Cloneable, MutableTreeNode, Serializable, TreeNode

public class J2PClass
extends J2PFrame

J2PClass does...

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.tree.DefaultMutableTreeNode
 
Field Summary
private  List f_subClasses
           
private  List f_superClasses
           
 
Fields inherited from class org.algernon.app.j2p.J2PFrame
CHILD_ERROR_COLOR, ERROR_COLOR, MAX_NAME_LENGTH
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
J2PClass(String name, String originalName)
           
 
Method Summary
 void addSubClass(J2PClass subclass)
          Adds a subclass
 void addSuperClass(J2PClass superclass)
          Adds a superclass.
 Enumeration children()
          Returns an enumeration of the children of this class.
 boolean getAllowsChildren()
          Returns true if this node is allowed to have children.
 TreeNode getChildAt(int index)
          Returns the child at the specified index in this node's child array.
 int getChildCount()
          Returns the number of children of this node.
 int getIndex(TreeNode aChild)
          Returns the index of the specified child in this node's child array.
 TreeNode getParent()
          Returns this node's parent or null if this node has no parent.
 Collection getSubClasses()
          Returns the subclasses of this class.
 Collection getSuperClasses()
          Returns the superclass(es) of this class.
 boolean isLeaf()
          Returns true if this node has no children.
 boolean isLeafClass()
          Returns true if this is a leaf class.
 void removeSubClass(J2PClass subclass)
          Removes a subclass
 void removeSuperClass(J2PClass superclass)
          Removes a superclass
 
Methods inherited from class org.algernon.app.j2p.J2PFrame
childHasError, getError, getName, getOriginalName, hasError, isIgnored, setError, setIsIgnored, setName, setOriginalName, toString
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, clone, depthFirstEnumeration, getChildAfter, getChildBefore, getDepth, getFirstChild, getFirstLeaf, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

f_subClasses

private List f_subClasses

f_superClasses

private List f_superClasses
Constructor Detail

J2PClass

public J2PClass(String name,
                String originalName)
Method Detail

addSuperClass

public void addSuperClass(J2PClass superclass)
Adds a superclass.


addSubClass

public void addSubClass(J2PClass subclass)
Adds a subclass


getSubClasses

public Collection getSubClasses()
Returns the subclasses of this class.


children

public Enumeration children()
Returns an enumeration of the children of this class. There are no instances, so all children are subclasses. Forwards to getSubClasses.

Specified by:
children in interface TreeNode
Specified by:
children in class J2PFrame
Returns:
an Enumeration of this node's children

getSuperClasses

public Collection getSuperClasses()
Returns the superclass(es) of this class.


isLeafClass

public boolean isLeafClass()
Returns true if this is a leaf class.


removeSuperClass

public void removeSuperClass(J2PClass superclass)
Removes a superclass


removeSubClass

public void removeSubClass(J2PClass subclass)
Removes a subclass


getAllowsChildren

public boolean getAllowsChildren()
Returns true if this node is allowed to have children.

Specified by:
getAllowsChildren in interface TreeNode
Overrides:
getAllowsChildren in class J2PFrame
Returns:
true if this node allows children, else false

getChildAt

public TreeNode getChildAt(int index)
Returns the child at the specified index in this node's child array.

Specified by:
getChildAt in interface TreeNode
Overrides:
getChildAt in class J2PFrame
Parameters:
index - an index into this node's child array
Returns:
the TreeNode in this node's child array at the specified index
Throws:
ArrayIndexOutOfBoundsException - if index is out of bounds

getChildCount

public int getChildCount()
Returns the number of children of this node.

Specified by:
getChildCount in interface TreeNode
Overrides:
getChildCount in class J2PFrame
Returns:
an int giving the number of children of this node

getIndex

public int getIndex(TreeNode aChild)
Returns the index of the specified child in this node's child array. If the specified node is not a child of this node, returns -1. This method performs a linear search and is O(n) where n is the number of children.

Specified by:
getIndex in interface TreeNode
Overrides:
getIndex in class J2PFrame
Parameters:
aChild - the TreeNode to search for among this node's children
Returns:
an int giving the index of the node in this node's child array, or -1 if the specified node is a not a child of this node
Throws:
IllegalArgumentException - if aChild is null

isLeaf

public boolean isLeaf()
Returns true if this node has no children. To distinguish between nodes that have no children and nodes that cannot have children (e.g. to distinguish files from empty directories), use this method in conjunction with getAllowsChildren

Specified by:
isLeaf in interface TreeNode
Overrides:
isLeaf in class J2PFrame
Returns:
true if this node has no children
See Also:
getAllowsChildren()

getParent

public TreeNode getParent()
Returns this node's parent or null if this node has no parent.

Specified by:
getParent in interface TreeNode
Overrides:
getParent in class J2PFrame
Returns:
this node's parent TreeNode, or null if this node has no parent

Algernon Software