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, Clarkware Consulting, Inc.

Constructor Summary
JavaPackage(java.lang.String name)
          Constructs a JavaPackage instance with the specified package name.
 
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 jClass)
          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 collectCycle(java.util.List list)
          Collects the packages participating in a package dependency cycle.
 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.
 boolean equalsAfferents(java.lang.Object other)
          Indicates whether the specified package is equal to this package in terms of its afferent couplings.
 boolean equalsDependencies(java.lang.Object other)
          Indicates whether the specified package is equal to this package in terms of its afferent and efferent couplings.
 boolean equalsEfferents(java.lang.Object other)
          Indicates whether the specified package is equal to this package in terms of its efferent couplings.
 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 name.
 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.
 
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.
Method Detail

getName

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

Returns:
Name.

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 a package dependency cycle.

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 jClass)
Adds the specified Java class to the package.

Parameters:
jClass - 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.

equalsDependencies

public boolean equalsDependencies(java.lang.Object other)
Indicates whether the specified package is equal to this package in terms of its afferent and efferent couplings.

Parameters:
other - Other package.
Returns:
true if the packages are equal; false otherwise.

equalsAfferents

public boolean equalsAfferents(java.lang.Object other)
Indicates whether the specified package is equal to this package in terms of its afferent couplings.

Parameters:
other - Other package.
Returns:
true if the packages are equal; false otherwise.

equalsEfferents

public boolean equalsEfferents(java.lang.Object other)
Indicates whether the specified package is equal to this package in terms of its efferent couplings.

Parameters:
other - Other package.
Returns:
true if the packages are equal; false otherwise.


Copyright ? 1999-2002 Clarkware Consulting, Inc. All Rights Reserved.