javancss
Class Javancss

java.lang.Object
  extended by javancss.Javancss
All Implemented Interfaces:
ccl.util.Exitable, JavancssConstants

public class Javancss
extends java.lang.Object
implements ccl.util.Exitable, JavancssConstants

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,v 1.22 2006/04/16 11:42:19 clemens Exp clemens $
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  boolean _bXML
           
private  java.util.Hashtable _htPackages
           
private  java.util.Hashtable _htProcessedAtFiles
           
private  int _loc
           
private  int _ncss
           
private  ccl.util.Init _pInit
           
private  JavaParser _pJavaParser
           
private  java.lang.String _sErrorMessage
           
private  java.lang.String _sJavaSourceFileName
          Just used for parseImports.
private  java.lang.Throwable _thrwError
           
private  java.util.Vector _vFunctionMetrics
           
private  java.util.Vector _vImports
           
private  java.util.Vector _vJavaSourceFiles
           
private  java.util.Vector _vObjectMetrics
           
private  java.util.Vector _vPackageMetrics
           
(package private) static int LEN_NR
           
(package private) static java.lang.String S_INIT__FILE_CONTENT
           
 
Fields inherited from interface javancss.JavancssConstants
FCT_CCN, FCT_JVDC, FCT_JVDC_LINES, FCT_MULTI_LINES, FCT_NAME, FCT_NCSS, FCT_SINGLE_LINES, OBJ_CLSSS, OBJ_FCTS, OBJ_JVDC_LINES, OBJ_JVDCS, OBJ_MULTI_LINES, OBJ_NAME, OBJ_NCSS, OBJ_SINGLE_LINES
 
Constructor Summary
Javancss()
          Only way to create object that does not immediately start to parse.
Javancss(java.lang.String sJavaSourceFile_)
           
Javancss(java.lang.String[] asArgs_, java.lang.String sRcsHeader_)
          This is the constructor used in the main routine in javancss.Main.
Javancss(java.io.StringBufferInputStream pStringBufferInputStream_)
           
Javancss(java.util.Vector vJavaSourceFiles_)
           
 
Method Summary
private  void _addJavaFiles(java.io.File file, java.util.Vector v)
           
private  void _measureFiles(java.util.Vector vJavaSourceFiles_)
           
private  void _measureRoot(java.io.InputStream pInputStream_)
          If arguments were provided, they are used, otherwise the input stream is used.
private  void _measureSource(java.io.DataInputStream disSource_)
           
private  void _measureSource(java.lang.String sSourceFileName_)
           
private  void _removeDirs(java.util.Vector vDirs)
           
private  java.io.DataInputStream createInputStream(java.lang.String sSourceFileName_)
           
 Formatter getFormatter()
           
 java.util.Vector getFunctionMetrics()
           
 java.util.Vector getFunctions()
          The same as getFunctionMetrics?!
 java.util.Vector getImports()
           
 int getJdcl()
          JDCL stands for javadoc coment 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.Vector getObjectMetrics()
           
 java.lang.Object[] getPackage()
          Return info about package statement.
 java.util.Vector getPackageMetrics()
          Returns list of packages in the form PackageMetric objects.
 int getSl()
           
 boolean parseImports()
           
 java.lang.String printFunctionNcss()
           
 java.lang.String printJavaNcss()
           
 java.lang.String printObjectNcss()
           
 java.lang.String printPackageNcss()
           
 void setExit()
           
 void setSourceFile(java.lang.String sJavaSourceFile_)
           
 void setXML(boolean bXML)
           
 boolean useXML()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEN_NR

static final int LEN_NR
See Also:
Constant Field Values

S_INIT__FILE_CONTENT

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

_bExit

private boolean _bExit

_ncss

private int _ncss

_loc

private int _loc

_pJavaParser

private JavaParser _pJavaParser

_vJavaSourceFiles

private java.util.Vector _vJavaSourceFiles

_sErrorMessage

private java.lang.String _sErrorMessage

_thrwError

private java.lang.Throwable _thrwError

_vFunctionMetrics

private java.util.Vector _vFunctionMetrics

_vObjectMetrics

private java.util.Vector _vObjectMetrics

_vPackageMetrics

private java.util.Vector _vPackageMetrics

_vImports

private java.util.Vector _vImports

_htPackages

private java.util.Hashtable _htPackages

_htProcessedAtFiles

private java.util.Hashtable _htProcessedAtFiles

_aoPackage

private java.lang.Object[] _aoPackage

_sJavaSourceFileName

private java.lang.String _sJavaSourceFileName
Just used for parseImports.


_pInit

private ccl.util.Init _pInit

_bXML

private boolean _bXML
Constructor Detail

Javancss

public Javancss(java.util.Vector vJavaSourceFiles_)

Javancss

public Javancss(java.lang.String sJavaSourceFile_)

Javancss

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


Javancss

public Javancss(java.io.StringBufferInputStream pStringBufferInputStream_)

Javancss

public Javancss(java.lang.String[] asArgs_,
                java.lang.String sRcsHeader_)
This is the constructor used in the main routine in javancss.Main. Other constructors might be helpful to use Javancss out of other programs.

Method Detail

createInputStream

private java.io.DataInputStream createInputStream(java.lang.String sSourceFileName_)

_measureSource

private void _measureSource(java.lang.String sSourceFileName_)
                     throws java.io.IOException,
                            ParseException,
                            TokenMgrError
Throws:
java.io.IOException
ParseException
TokenMgrError

_measureSource

private void _measureSource(java.io.DataInputStream disSource_)
                     throws java.io.IOException,
                            ParseException,
                            TokenMgrError
Throws:
java.io.IOException
ParseException
TokenMgrError

_measureFiles

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

_measureRoot

private void _measureRoot(java.io.InputStream pInputStream_)
                   throws java.io.IOException,
                          ParseException,
                          TokenMgrError
If arguments were provided, they are used, otherwise the input stream is used.

Throws:
java.io.IOException
ParseException
TokenMgrError

getImports

public java.util.Vector 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.Vector getFunctions()
The same as getFunctionMetrics?!


printObjectNcss

public java.lang.String printObjectNcss()

printFunctionNcss

public java.lang.String printFunctionNcss()

printPackageNcss

public java.lang.String printPackageNcss()

printJavaNcss

public java.lang.String printJavaNcss()

parseImports

public boolean parseImports()

setSourceFile

public void setSourceFile(java.lang.String sJavaSourceFile_)

_addJavaFiles

private void _addJavaFiles(java.io.File file,
                           java.util.Vector v)

_removeDirs

private void _removeDirs(java.util.Vector vDirs)

getNcss

public int getNcss()

getLOC

public int getLOC()

getJvdc

public int getJvdc()

getJdcl

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


getSl

public int getSl()

getMl

public int getMl()

getFunctionMetrics

public java.util.Vector getFunctionMetrics()

getObjectMetrics

public java.util.Vector getObjectMetrics()

getPackageMetrics

public java.util.Vector 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 ccl.util.Exitable

setXML

public void setXML(boolean bXML)

useXML

public boolean useXML()

getFormatter

public Formatter getFormatter()