jdepend.framework

Class JavaPackage

public class JavaPackage extends Object

The JavaPackage class represents a Java package.

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

Constructor Summary
JavaPackage(String name)
Constructs a JavaPackage instance with the specified package name.
JavaPackage(String name, int volatility)
Method Summary
floatabstractness()
Returns the abstractness (A) of this package.
voidaddAfferent(JavaPackage jPackage)
Adds the specified Java package as an afferent of this package.
voidaddClass(JavaClass clazz)
Adds the specified Java class to the package.
voidaddEfferent(JavaPackage jPackage)
Adds the specified Java package as an efferent of this package.
intafferentCoupling()
Returns the afferent coupling (Ca) of this package.
booleancollectAllCycles(List list)
Collects all the packages participating in a package dependency cycle which originates from this package.
booleancollectCycle(List list)
Collects the packages participating in the first package dependency cycle detected which originates from this package.
booleancontainsCycle()
Indicates whether the package contains a package dependency cycle.
voiddependsUpon(JavaPackage imported)
Adds the specified Java package as an efferent of this package and adds this package as an afferent of it.
floatdistance()
Returns this package's distance from the main sequence (D).
intefferentCoupling()
Returns the efferent coupling (Ce) of this package.
booleanequals(Object other)
Indicates whether the specified package is equal to this package.
intgetAbstractClassCount()
Returns the number of abstract classes (and interfaces) in this package.
CollectiongetAfferents()
Returns the collection of afferent packages.
intgetClassCount()
Returns the total number of classes in this package.
CollectiongetClasses()
Returns the collection of Java classes in this package.
intgetConcreteClassCount()
Returns the number of concrete classes in this package.
CollectiongetEfferents()
Returns the collection of efferent packages.
StringgetName()
Returns the package name.
intgetVolatility()
Returns the volatility of this package.
floatinstability()
Returns the instability (I) of this package.
voidsetAfferents(Collection afferents)
Sets the collection of afferent packages.
voidsetEfferents(Collection efferents)
Sets the collection of efferent packages.
voidsetVolatility(int v)
Sets the volatility of this package.

Constructor Detail

JavaPackage

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

Parameters: name Package name.

JavaPackage

public JavaPackage(String name, int volatility)

Method Detail

abstractness

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

Returns: Abstractness (0-1).

addAfferent

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

Parameters: jPackage Java package.

addClass

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

Parameters: clazz Java class to add.

addEfferent

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

Parameters: jPackage Java package.

afferentCoupling

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

Returns: Ca

collectAllCycles

public boolean collectAllCycles(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.

collectCycle

public boolean collectCycle(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.

containsCycle

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

Returns: true if a cycle exist; false otherwise.

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.

distance

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

Returns: Distance.

efferentCoupling

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

Returns: Ce

equals

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

Parameters: other Other package.

Returns: true if the packages are equal; false otherwise.

getAbstractClassCount

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

Returns: Number of abstract classes.

getAfferents

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

Returns: Collection of afferent packages.

getClassCount

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

Returns: Number of classes.

getClasses

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

Returns: Collection of Java classes.

getConcreteClassCount

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

Returns: Number of concrete classes.

getEfferents

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

Returns: Collection of efferent packages.

getName

public String getName()
Returns the package name.

Returns: Name.

getVolatility

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

Returns: Volatility (0-1).

instability

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

Returns: Instability (0-1).

setAfferents

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

Parameters: afferents Collection of afferent packages.

setEfferents

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

Parameters: efferents Collection of efferent packages.

setVolatility

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

Parameters: v Volatility (0-1).

Copyright B) 1999-2003 Clarkware Consulting, Inc.