public class Analyser
extends java.lang.Object
Constructor and Description |
---|
Analyser(java.lang.String[] classFiles)
Creates an instance for the specified files or folders.
|
Analyser(java.lang.String[] classFiles,
StringPattern pattern,
StringPattern reflectionPattern,
boolean mergeInnerClasses)
Creates an instance for the specified files or folders which are
filtered by the specified
StringPattern object. |
Modifier and Type | Method and Description |
---|---|
long |
calculateClassLayerMap()
Calculates the for each class its layer index.
|
long |
calculatePackageLayerMap()
Calculates the for each package its layer index.
|
long |
condenseClassGraph()
Condenses the class graph to an acyclic graph of its strong components.
|
long |
condensePackageGraph()
Condenses the package graph to an acyclic graph of its strong components.
|
long |
createClassGraph()
Parses the class files and creates the class graph.
|
long |
createPackageGraph()
Creates the package graph from the class graph.
|
AtomicVertex[] |
getClassGraph()
Returns the class graph.
|
java.util.Map<AtomicVertex,java.lang.Integer> |
getClassLayerMap()
Calculates the for each class its layer index and returns
a Map where the classes are the keys (type
AtomicVertex )
and the layer indices are the values (type Integer). |
StrongComponent[] |
getCondensedClassGraph()
Returns the condensed the class graph, i.e.
|
StrongComponent[] |
getCondensedPackageGraph()
Returns the condensed package graph, i.e.
|
int |
getNumberOfExternalClasses()
Counts the number of external classes.
|
AtomicVertex[] |
getPackageGraph()
Returns the package graph created the class graph.
|
java.util.Map<AtomicVertex,java.lang.Integer> |
getPackageLayerMap()
Calculates the for each package its layer index and returns
a Map where the packages are the keys (type
AtomicVertex )
and the layer indices are the values (type Integer). |
static void |
main(java.lang.String[] args)
Main method of the Analyser.
|
void |
printComponents(java.io.PrintWriter writer,
int minSize)
Prints for each strong component of the class graph a raw output into
the specified writer.
|
void |
printCSV(java.io.PrintWriter writer)
Prints a CSV report into the specified writer.
|
void |
printRaw(java.io.PrintWriter writer)
Prints for each class a raw output into the specified writer.
|
void |
printXML(java.lang.String title,
boolean packagesOnly,
java.io.PrintWriter writer)
Prints an XML report into the specified writer.
|
void |
readAndAnalyse(boolean packagesOnly)
Reads and analyses class files.
|
public Analyser(java.lang.String[] classFiles)
classFiles
- Absolute or relative file names.public Analyser(java.lang.String[] classFiles, StringPattern pattern, StringPattern reflectionPattern, boolean mergeInnerClasses)
StringPattern
object.classFiles
- Absolute or relative file names.pattern
- Pattern fully-qualified class name have to match in order
to be a part of the class graph.reflectionPattern
- Pattern ordinary string constants of a class
file have to fullfill in order to be handled as a class references.
In addition such strings have to be syntactically valid
fully qualified class names. If null ordinary string
constants will not be checked.mergeInnerClasses
- If true
merge inner classes with its outer classpublic long createClassGraph() throws java.io.IOException
java.io.IOException
- if a problem occured during readingpublic AtomicVertex[] getClassGraph()
createClassGraph()
if not
already invoked.public int getNumberOfExternalClasses()
public long condenseClassGraph()
java.lang.IllegalStateException
- if this method is called before
createClassGraph()
.public StrongComponent[] getCondensedClassGraph()
java.lang.IllegalStateException
- if this method is called before
createClassGraph()
.public long calculateClassLayerMap()
java.lang.IllegalStateException
- if this method is called before
createClassGraph()
.public java.util.Map<AtomicVertex,java.lang.Integer> getClassLayerMap()
AtomicVertex
)
and the layer indices are the values (type Integer).java.lang.IllegalStateException
- if this method is called before
createClassGraph()
.public long createPackageGraph()
java.lang.IllegalStateException
- if this method is called before
createClassGraph()
.public void printCSV(java.io.PrintWriter writer)
writer
- Output stream.public void printRaw(java.io.PrintWriter writer)
writer
- Output stream.public void printComponents(java.io.PrintWriter writer, int minSize)
writer
- Output stream.minSize
- Minimum size of the strong component.java.lang.IllegalStateException
- if this method is called before
createClassGraph()
.public AtomicVertex[] getPackageGraph()
java.lang.IllegalStateException
- if this method is called before
createClassGraph()
.public long condensePackageGraph()
java.lang.IllegalStateException
- if this method is called before
createPackageGraph()
.public StrongComponent[] getCondensedPackageGraph()
java.lang.IllegalStateException
- if this method is called before
createPackageGraph()
.public long calculatePackageLayerMap()
java.lang.IllegalStateException
- if this method is called before
createPackageGraph()
.public java.util.Map<AtomicVertex,java.lang.Integer> getPackageLayerMap()
AtomicVertex
)
and the layer indices are the values (type Integer).java.lang.IllegalStateException
- if this method is called before
createPackageGraph()
.public void readAndAnalyse(boolean packagesOnly) throws java.io.IOException
java.io.IOException
- in case of reading problems.public void printXML(java.lang.String title, boolean packagesOnly, java.io.PrintWriter writer)
title
- Title of the report.packagesOnly
- if true classes are omitted.writer
- Output stream.java.lang.IllegalStateException
- if this method is called before
createPackageGraph()
.public static void main(java.lang.String[] args) throws java.lang.Exception
args
- command line arguments.java.lang.Exception