jdepend.framework
Class JavaPackage

java.lang.Object
  extended by jdepend.framework.JavaPackage

public class JavaPackage
extends java.lang.Object

The JavaPackage class represents a Java package.

Author:
Mike Clark (mike@clarkware.com), Clarkware Consulting, Inc.

Constructor Summary
JavaPackage(java.lang.String name)
          Constructs a JavaPackage instance with the specified package name.
JavaPackage(java.lang.String name, int volatility)
           
 
Method Summary
 float abstractness()
          Returns the abstractness (A) of this package.
 void addAfferent(JavaPackage jPackage)
          Adds the specified Java package as an afferent of this package.
 void addClass(JavaClass clazz)
          Adds the specified Java class to the package.
 void addEfferent(JavaPackage jPackage)
          Adds the specified Java package as an efferent of this package.
 int afferentCoupling()
          Returns the afferent coupling (Ca) of this package.
 boolean collectAllCycles(java.util.List list)
          Collects all the packages participating in a package dependency cycle which originates from this package.
 boolean collectCycle(java.util.List list)
          Collects the packages participating in the first package dependency cycle detected which originates from this package.
 boolean containsCycle()
          Indicates whether the package contains a package dependency cycle.
 void dependsUpon(JavaPackage imported)
          Adds the specified Java package as an efferent of this package and adds this package as an afferent of it.
 float distance()
          Returns this package's distance from the main sequence (D).
 int efferentCoupling()
          Returns the efferent coupling (Ce) of this package.
 boolean equals(java.lang.Object other)
          Indicates whether the specified package is equal to this package.
 int getAbstractClassCount()
          Returns the number of abstract classes (and interfaces) in this package.
 java.util.Collection getAfferents()
          Returns the collection of afferent packages.
 int getClassCount()
          Returns the total number of classes in this package.
 java.util.Collection getClasses()
          Returns the collection of Java classes in this package.
 int getConcreteClassCount()
          Returns the number of concrete classes in this package.
 java.util.Collection getEfferents()
          Returns the collection of efferent packages.
 java.lang.String getName()
          Returns the package name.
 int getVolatility()
          Returns the volatility of this package.
 float instability()
          Returns the instability (I) of this package.
 void setAfferents(java.util.Collection afferents)
          Sets the collection of afferent packages.
 void setEfferents(java.util.Collection efferents)
          Sets the collection of efferent packages.
 void setVolatility(int v)
          Sets the volatility of this package.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaPackage

public JavaPackage(java.lang.String name)
Constructs a JavaPackage instance with the specified package name.

Parameters:
name - Package name.

JavaPackage

public JavaPackage(java.lang.String name,
                   int volatility)
Method Detail

getName

public java.lang.String getName()
Returns the package name.

Returns:
Name.

getVolatility

public int getVolatility()
Returns the volatility of this package.

Returns:
Volatility (0-1).

setVolatility

public void setVolatility(int v)
Sets the volatility of this package.

Parameters:
v - Volatility (0-1).

containsCycle

public boolean containsCycle()
Indicates whether the package contains a package dependency cycle.

Returns:
true if a cycle exist; false otherwise.

collectCycle

public boolean collectCycle(java.util.List list)
Collects the packages participating in the first package dependency cycle detected which originates from this package.

Parameters:
list - Collecting object to be populated with the list of JavaPackage instances in a cycle.
Returns:
true if a cycle exist; false otherwise.

collectAllCycles

public boolean collectAllCycles(java.util.List list)
Collects all the packages participating in a package dependency cycle which originates from this package.

This is a more exhaustive search than that employed by collectCycle.

Parameters:
list - Collecting object to be populated with the list of JavaPackage instances in a cycle.
Returns:
true if a cycle exist; false otherwise.

addClass

public void addClass(JavaClass clazz)
Adds the specified Java class to the package.

Parameters:
clazz - Java class to add.

getClasses

public java.util.Collection getClasses()
Returns the collection of Java classes in this package.

Returns:
Collection of Java classes.

getClassCount

public int getClassCount()
Returns the total number of classes in this package.

Returns:
Number of classes.

getAbstractClassCount

public int getAbstractClassCount()
Returns the number of abstract classes (and interfaces) in this package.

Returns:
Number of abstract classes.

getConcreteClassCount

public int getConcreteClassCount()
Returns the number of concrete classes in this package.

Returns:
Number of concrete classes.

dependsUpon

public void dependsUpon(JavaPackage imported)
Adds the specified Java package as an efferent of this package and adds this package as an afferent of it.

Parameters:
imported - Java package.

addAfferent

public void addAfferent(JavaPackage jPackage)
Adds the specified Java package as an afferent of this package.

Parameters:
jPackage - Java package.

getAfferents

public java.util.Collection getAfferents()
Returns the collection of afferent packages.

Returns:
Collection of afferent packages.

setAfferents

public void setAfferents(java.util.Collection afferents)
Sets the collection of afferent packages.

Parameters:
afferents - Collection of afferent packages.

addEfferent

public void addEfferent(JavaPackage jPackage)
Adds the specified Java package as an efferent of this package.

Parameters:
jPackage - Java package.

getEfferents

public java.util.Collection getEfferents()
Returns the collection of efferent packages.

Returns:
Collection of efferent packages.

setEfferents

public void setEfferents(java.util.Collection efferents)
Sets the collection of efferent packages.

Parameters:
efferents - Collection of efferent packages.

afferentCoupling

public int afferentCoupling()
Returns the afferent coupling (Ca) of this package.

Returns:
Ca

efferentCoupling

public int efferentCoupling()
Returns the efferent coupling (Ce) of this package.

Returns:
Ce

instability

public float instability()
Returns the instability (I) of this package.

Returns:
Instability (0-1).

abstractness

public float abstractness()
Returns the abstractness (A) of this package.

Returns:
Abstractness (0-1).

distance

public float distance()
Returns this package's distance from the main sequence (D).

Returns:
Distance.

equals

public boolean equals(java.lang.Object other)
Indicates whether the specified package is equal to this package.

Overrides:
equals in class java.lang.Object
Parameters:
other - Other package.
Returns:
true if the packages are equal; false otherwise.


Copyright ? 1999-2003 Clarkware Consulting, Inc.