Class PackageNode

  • Direct Known Subclasses:
    AfferentNode, EfferentNode

    public abstract class PackageNode
    extends java.lang.Object
    The PackageNode class defines the default behavior for tree nodes representing Java packages.
    Author:
    Mike Clark, Clarkware Consulting, Inc.
    • Constructor Summary

      Constructors 
      Constructor Description
      PackageNode​(PackageNode parent, JavaPackage jPackage)
      Constructs a PackageNode with the specified package and its collection of dependent packages.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.ArrayList getChildren()
      Returns the child package nodes of this node.
      protected abstract java.util.Collection getCoupledPackages()
      Returns the collection of Java packages coupled to the package represented in this node.
      JavaPackage getPackage()
      Returns the Java package represented in this node.
      PackageNode getParent()
      Returns the parent of this package node.
      boolean isChild​(JavaPackage jPackage)
      Indicates whether the specified package should be displayed as a child of this node.
      boolean isLeaf()
      Indicates whether this node is a leaf node.
      protected abstract PackageNode makeNode​(PackageNode parent, JavaPackage jPackage)
      Creates and returns a PackageNode with the specified parent node and Java package.
      java.lang.String toMetricsString()
      Returns the string representation of this node's metrics.
      java.lang.String toString()
      Returns the string representation of this node in it's current tree context.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • PackageNode

        public PackageNode​(PackageNode parent,
                           JavaPackage jPackage)
        Constructs a PackageNode with the specified package and its collection of dependent packages.
        Parameters:
        parent - Parent package node.
        jPackage - Java package.
    • Method Detail

      • getPackage

        public JavaPackage getPackage()
        Returns the Java package represented in this node.
        Returns:
        Java package.
      • getParent

        public PackageNode getParent()
        Returns the parent of this package node.
        Returns:
        Parent package node.
      • isLeaf

        public boolean isLeaf()
        Indicates whether this node is a leaf node.
        Returns:
        true if this node is a leaf; false otherwise.
      • makeNode

        protected abstract PackageNode makeNode​(PackageNode parent,
                                                JavaPackage jPackage)
        Creates and returns a PackageNode with the specified parent node and Java package.
        Parameters:
        parent - Parent package node.
        jPackage - Java package.
        Returns:
        A non-null PackageNode
      • getCoupledPackages

        protected abstract java.util.Collection getCoupledPackages()
        Returns the collection of Java packages coupled to the package represented in this node.
        Returns:
        Collection of coupled packages.
      • isChild

        public boolean isChild​(JavaPackage jPackage)
        Indicates whether the specified package should be displayed as a child of this node.
        Parameters:
        jPackage - Package to test.
        Returns:
        true to display the package; false otherwise.
      • getChildren

        public java.util.ArrayList getChildren()
        Returns the child package nodes of this node.
        Returns:
        Collection of child package nodes.
      • toMetricsString

        public java.lang.String toMetricsString()
        Returns the string representation of this node's metrics.
        Returns:
        Metrics string.
      • toString

        public java.lang.String toString()
        Returns the string representation of this node in it's current tree context.
        Overrides:
        toString in class java.lang.Object
        Returns:
        Node label.