net.sourceforge.cobertura.javancss
Class Javancss

java.lang.Object
  extended by net.sourceforge.cobertura.javancss.Javancss
All Implemented Interfaces:
Exitable

public class Javancss
extends java.lang.Object
implements Exitable

While the Java parser class might be the heart of JavaNCSS, this class is the brain. This class controls input and output and invokes the Java parser.

Version:
$Id: Javancss.java 676 2009-09-04 13:42:13Z lewijw $
Author:
Chr. Clemens Lee , recursive feature by P��k� Hannu , additional javadoc metrics by Emilio Gongora , and Guillermo Rodriguez .

Field Summary
private  java.lang.Object[] _aoPackage
           
private  boolean _bExit
           
private  java.util.Map _htPackages
           
private  int _loc
           
private  int _ncss
           
private  Init _pInit
           
private  JavaParserInterface _pJavaParser
           
private  java.lang.String _sErrorMessage
           
private  java.io.File _sJavaSourceFile
          Just used for parseImports.
private  java.lang.Throwable _thrwError
           
private  java.util.List _vFunctionMetrics
           
private  java.util.List _vImports
           
private  java.util.List _vJavaSourceFiles
           
private  java.util.List _vObjectMetrics
           
private  java.util.List _vPackageMetrics
           
private  java.lang.String encoding
           
private static java.lang.String S_INIT__FILE_CONTENT
           
 
Constructor Summary
Javancss()
          Only way to create object that does not immediately start to parse.
Javancss(java.io.File sJavaSourceFile_)
           
Javancss(java.io.InputStream isJavaSource_)
           
Javancss(java.util.List vJavaSourceFiles_)
           
 
Method Summary
private  void _measureFiles(java.util.List vJavaSourceFiles_)
           
private  void _measureRoot(java.io.Reader reader)
          If arguments were provided, they are used, otherwise the input stream is used.
private  void _measureSource(java.io.File sSourceFile_)
           
private  void _measureSource(java.io.Reader reader)
           
private  java.io.Reader createSourceReader(java.io.File sSourceFile_)
           
 java.lang.String getEncoding()
           
 java.util.List getFunctionMetrics()
           
 java.util.List getFunctions()
          The same as getFunctionMetrics?!
 java.util.List getImports()
           
 int getJdcl()
          JDCL stands for javadoc comment lines (while jvdc stands for number of javadoc comments).
 int getJvdc()
           
 java.lang.Throwable getLastError()
           
 java.lang.String getLastErrorMessage()
           
 int getLOC()
           
 int getMl()
           
 int getNcss()
           
 java.util.List getObjectMetrics()
           
 java.lang.Object[] getPackage()
          Return info about package statement.
 java.util.List getPackageMetrics()
          Returns list of packages in the form PackageMetric objects.
 int getSl()
           
private  java.io.Reader newReader(java.io.File file)
           
private  java.io.Reader newReader(java.io.InputStream stream)
           
 boolean parseImports()
           
 void setEncoding(java.lang.String encoding)
           
 void setExit()
           
 void setSourceFile(java.io.File javaSourceFile_)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

S_INIT__FILE_CONTENT

private static final java.lang.String S_INIT__FILE_CONTENT
See Also:
Constant Field Values

_bExit

private boolean _bExit

_vJavaSourceFiles

private java.util.List _vJavaSourceFiles

encoding

private java.lang.String encoding

_sErrorMessage

private java.lang.String _sErrorMessage

_thrwError

private java.lang.Throwable _thrwError

_pJavaParser

private JavaParserInterface _pJavaParser

_ncss

private int _ncss

_loc

private int _loc

_vFunctionMetrics

private java.util.List _vFunctionMetrics

_vObjectMetrics

private java.util.List _vObjectMetrics

_vPackageMetrics

private java.util.List _vPackageMetrics

_vImports

private java.util.List _vImports

_htPackages

private java.util.Map _htPackages

_aoPackage

private java.lang.Object[] _aoPackage

_sJavaSourceFile

private java.io.File _sJavaSourceFile
Just used for parseImports.


_pInit

private Init _pInit
Constructor Detail

Javancss

public Javancss(java.util.List vJavaSourceFiles_)

Javancss

public Javancss(java.io.File sJavaSourceFile_)

Javancss

public Javancss(java.io.InputStream isJavaSource_)

Javancss

public Javancss()
Only way to create object that does not immediately start to parse.

Method Detail

createSourceReader

private java.io.Reader createSourceReader(java.io.File sSourceFile_)

_measureSource

private void _measureSource(java.io.File sSourceFile_)
                     throws java.io.IOException,
                            java.lang.Exception,
                            java.lang.Error
Throws:
java.io.IOException
java.lang.Exception
java.lang.Error

_measureSource

private void _measureSource(java.io.Reader reader)
                     throws java.io.IOException,
                            java.lang.Exception,
                            java.lang.Error
Throws:
java.io.IOException
java.lang.Exception
java.lang.Error

_measureFiles

private void _measureFiles(java.util.List vJavaSourceFiles_)
                    throws java.io.IOException,
                           ParseException,
                           TokenMgrError
Throws:
java.io.IOException
ParseException
TokenMgrError

_measureRoot

private void _measureRoot(java.io.Reader reader)
                   throws java.io.IOException,
                          java.lang.Exception,
                          java.lang.Error
If arguments were provided, they are used, otherwise the input stream is used.

Throws:
java.io.IOException
java.lang.Exception
java.lang.Error

getImports

public java.util.List getImports()

getPackage

public java.lang.Object[] getPackage()
Return info about package statement. First element has name of package, then begin of line, etc.


getFunctions

public java.util.List getFunctions()
The same as getFunctionMetrics?!


parseImports

public boolean parseImports()

setSourceFile

public void setSourceFile(java.io.File javaSourceFile_)

getNcss

public int getNcss()

getLOC

public int getLOC()

getJvdc

public int getJvdc()

getJdcl

public int getJdcl()
JDCL stands for javadoc comment lines (while jvdc stands for number of javadoc comments).


getSl

public int getSl()

getMl

public int getMl()

getFunctionMetrics

public java.util.List getFunctionMetrics()

getObjectMetrics

public java.util.List getObjectMetrics()

getPackageMetrics

public java.util.List getPackageMetrics()
Returns list of packages in the form PackageMetric objects.


getLastErrorMessage

public java.lang.String getLastErrorMessage()

getLastError

public java.lang.Throwable getLastError()

setExit

public void setExit()
Specified by:
setExit in interface Exitable

getEncoding

public java.lang.String getEncoding()

setEncoding

public void setEncoding(java.lang.String encoding)

newReader

private java.io.Reader newReader(java.io.InputStream stream)
                          throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException

newReader

private java.io.Reader newReader(java.io.File file)
                          throws java.io.FileNotFoundException,
                                 java.io.UnsupportedEncodingException
Throws:
java.io.FileNotFoundException
java.io.UnsupportedEncodingException