SandMark version 2.1


sandmark.statistics
Class StatisticsRecord

java.lang.Object
  |
  +--sandmark.statistics.StatisticsRecord

public class StatisticsRecord
extends java.lang.Object

This class contains statistical information about one class including data about its fields, methods and the package in which it is located.


Constructor Summary
StatisticsRecord()
          Constructs a new StatisticsRecord
 
Method Summary
 void addNonStaticField(java.lang.String type)
          Adds a non-static field object of specified type to the collection.
 boolean callsDynamicMethods(java.lang.String methodName)
          Returns true if the specified method calls other dynamic methods, otherwise false
 boolean callsStaticMethods(java.lang.String methodName)
          Returns true if the specified method calls other static methods, otherwise false
 boolean equals(java.lang.Object o)
          Returns true if this object is the same as the one to which it is being compared.
 java.util.Hashtable getByteCodeUsage(java.lang.String methodName)
           
 int getClassHierarchyLevel()
           
 java.lang.String getClassName()
          Returns the name of this class.
 java.util.List getMethodByteCodes(java.lang.String methodName)
          Returns a List of the bytecodes in the specied method.
 java.lang.String getMethodByteCodeUsage(java.lang.String methodName)
           
 EDU.purdue.cs.bloat.editor.MethodEditor getMethodEditor(java.lang.String methodName)
          new StatisticRecord implementation starts here ....
 java.lang.String[] getMethodNames()
          Retruns the names of all of the methods in the class specified
 int getMethodSize(java.lang.String methodName)
          Returns the size of the given method in bytes
 java.lang.String[] getNamesOfMethodsInvoked(java.lang.String methodName)
           
 java.util.List getNonStaticFields()
          Returns a List of all the Non-Static fields in the specified class.
 int getNumberMethods()
          Returns the number of methods which this method contains
 int getNumberOfApiCalls()
          public int getNumberOfApiCalls(String methodName) { EDU.purdue.cs.bloat.editor.MethodEditor methodEditor = getMethod(methodName); java.util.List codelist = methodEditor.code(); int apiCallCount = 0; for(int m=0; m
 int getNumberOfClassMethods()
           
 int getNumberOfConditionalStatements()
           
 int getNumberOfInstanceMethods()
           
 int getNumberOfInstanceVariables()
           
 int getNumberOfMessageSends(java.lang.String methodName)
           
 int getNumberOfMethodParams(java.lang.String methodName)
           
 int getNumberOfMethodsInherited()
           
 int getNumberOfMethodsInScope()
           
 int getNumberOfMethodsInvoked()
           
 int getNumberOfMethodsOverridden()
           
 int getNumberOfPublicMethods()
           
 int getNumberOfScalars()
           
 int getNumberOfStatementsInMethod(java.lang.String methodName)
           
 int getNumberOfSubClasses()
           
 int getNumberOfVectors()
           
 int getNumNonBasicFields()
          Returns the number of non-basic fields that this class contains.
 int getNumNonStatFieldsByType(java.lang.String type)
          Returns the number of non-static fields in this class that are of the specified type.
 int getNumNonStaticFields()
          Returns the number of non-static fields in this class.
 int getNumStaticFields()
          Returns the number of static fields in this class.
 java.lang.String getPackageName()
          Returns the name of the package to which this class belongs.
 java.util.Vector getVectorDimensions()
           
 java.util.Vector halsteadMeasures(java.lang.String methodName)
          'method size' implementation starts here ....
 boolean hasBackwardBranch(java.lang.String methodName)
          Returns true if there is a backward branch instruction in the method specified.
 boolean hasForwardBranch(java.lang.String methodName)
          Returns true if there is a forward branch instruction in the method specified.
 double nestingLevelComplexity(java.lang.String methodName, de.fub.bytecode.generic.MethodGen mg)
           
 void setClassHierarchyLevel(int hierarchyLevel)
          'class hierarchy' implementation starts here ....
 void setClassName(java.lang.String name)
          Sets the class name associated with this record to the one provided.
 void setMethods(EDU.purdue.cs.bloat.editor.MethodEditor[] methods)
          Sets the methods in this class to the specified array of MethodEditor objects.
 void setNumberOfApiCalls(int numberOfApiCalls)
          'method internals' implementation starts here ....
 void setNumberOfConditionalStatements(int numOfCondStats)
          'class internal' implementation starts here ....
 void setNumberOfInstanceMethods(int numMethods)
           
 void setNumberOfMethodsInherited(int numberOfMethodsInherited)
          'method hierarchy' implementation starts here ....
 void setNumberOfMethodsInScope(int numberOfmethodsInScope)
           
 void setNumberOfMethodsInvoked(int numberOfmethodsInvoked)
          'class external' implementation starts here ....
 void setNumberOfMethodsOverridden(int numberOfMethodsOverridden)
           
 void setNumberOfPublicMethods(int numMethods)
          'class size' implementation starts here ....
 void setNumberOfScalars(int numScalars)
           
 void setNumberOfSubClasses(int numberOfSubClasses)
           
 void setNumberOfVectors(int numVectors)
           
 void setNumNonBasicFields(int numNonBasic)
          Sets the number fields with non-basic types to the specified number
 void setNumStaticFields(int number)
          Sets the number of static fields to the specified number.
 void setPackageName(java.lang.String toSet)
          Sets the package name of this class to the specified argument.
 void setVectorDimensions(java.util.Vector numArrayDimensions)
           
 boolean throwsCatchesExc(java.lang.String methodName)
          Returns true if this method throws or catches exceptions, otherwise it returns false.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatisticsRecord

public StatisticsRecord()
Constructs a new StatisticsRecord

Method Detail

setClassName

public void setClassName(java.lang.String name)
Sets the class name associated with this record to the one provided.

Parameters:
name - the name of the class

getClassName

public java.lang.String getClassName()
Returns the name of this class.

Returns:
the name of this class.

equals

public boolean equals(java.lang.Object o)
Returns true if this object is the same as the one to which it is being compared.

Overrides:
equals in class java.lang.Object
Returns:
true if this object has the same class name and package name as the one to which it is being compared. False if either of these two tests if false.

getPackageName

public java.lang.String getPackageName()
Returns the name of the package to which this class belongs.

Returns:
the name of the package to which this class belongs.

setPackageName

public void setPackageName(java.lang.String toSet)
Sets the package name of this class to the specified argument.

Parameters:
toSet - the name of the package this class to which this class it to be set.

getMethodSize

public int getMethodSize(java.lang.String methodName)
Returns the size of the given method in bytes

Parameters:
methodName - the name of the method
Returns:
the number of bytes that make up this method

throwsCatchesExc

public boolean throwsCatchesExc(java.lang.String methodName)
Returns true if this method throws or catches exceptions, otherwise it returns false.

Parameters:
methodName - the name of the method
Returns:
true if this method throws or catches exceptions, false otherwise.

getNumNonStaticFields

public int getNumNonStaticFields()
Returns the number of non-static fields in this class.

Returns:
the number of non-static fields in this class.

getNonStaticFields

public java.util.List getNonStaticFields()
Returns a List of all the Non-Static fields in the specified class.

Returns:
a List representation of all non-static field types in the specified class

addNonStaticField

public void addNonStaticField(java.lang.String type)
Adds a non-static field object of specified type to the collection.

Parameters:
type - the type of non-static field to add.

setNumStaticFields

public void setNumStaticFields(int number)
Sets the number of static fields to the specified number.

Parameters:
number - the number of static fields to acknowledge.

getNumStaticFields

public int getNumStaticFields()
Returns the number of static fields in this class.

Returns:
the number of static fields in this class

setNumNonBasicFields

public void setNumNonBasicFields(int numNonBasic)
Sets the number fields with non-basic types to the specified number

Parameters:
numNonBasic - the number of fields of non-basic type

getNumNonBasicFields

public int getNumNonBasicFields()
Returns the number of non-basic fields that this class contains.

Returns:
the number of non-basic fields that this class contains.

getNumberMethods

public int getNumberMethods()
Returns the number of methods which this method contains

Returns:
the number of methods which this method contains

setMethods

public void setMethods(EDU.purdue.cs.bloat.editor.MethodEditor[] methods)
Sets the methods in this class to the specified array of MethodEditor objects.

Parameters:
methods - the array of MethodEditor objects to add.

getMethodNames

public java.lang.String[] getMethodNames()
Retruns the names of all of the methods in the class specified

Returns:
String array representing all of the method names in the class specified

getMethodByteCodes

public java.util.List getMethodByteCodes(java.lang.String methodName)
Returns a List of the bytecodes in the specied method.

Parameters:
methodName - the name of the method from which to draw the bytecodes.
Returns:
a List of the bytecodes in the specied method.

getMethodByteCodeUsage

public java.lang.String getMethodByteCodeUsage(java.lang.String methodName)

getByteCodeUsage

public java.util.Hashtable getByteCodeUsage(java.lang.String methodName)

getNumNonStatFieldsByType

public int getNumNonStatFieldsByType(java.lang.String type)
Returns the number of non-static fields in this class that are of the specified type.

Parameters:
type - type to count.
Returns:
the number of non-static fields in this class that are of the specified type.

hasForwardBranch

public boolean hasForwardBranch(java.lang.String methodName)
Returns true if there is a forward branch instruction in the method specified.

Parameters:
methodName - the name of the method to inspect.
Returns:
true if there is a forward branch, otherwise false.

hasBackwardBranch

public boolean hasBackwardBranch(java.lang.String methodName)
Returns true if there is a backward branch instruction in the method specified.

Parameters:
methodName - the name of the method to inspect.
Returns:
true if there is a backward branch, otherwise false.

callsStaticMethods

public boolean callsStaticMethods(java.lang.String methodName)
Returns true if the specified method calls other static methods, otherwise false

Parameters:
methodName - the name of the method to investigate
Returns:
true if the specified method calls other static methods, otherwise false

callsDynamicMethods

public boolean callsDynamicMethods(java.lang.String methodName)
Returns true if the specified method calls other dynamic methods, otherwise false

Parameters:
methodName - the name of the method to investigate
Returns:
true if the specified method calls other static methods, otherwise false

getMethodEditor

public EDU.purdue.cs.bloat.editor.MethodEditor getMethodEditor(java.lang.String methodName)
new StatisticRecord implementation starts here ....


halsteadMeasures

public java.util.Vector halsteadMeasures(java.lang.String methodName)
'method size' implementation starts here ....


nestingLevelComplexity

public double nestingLevelComplexity(java.lang.String methodName,
                                     de.fub.bytecode.generic.MethodGen mg)

getNumberOfStatementsInMethod

public int getNumberOfStatementsInMethod(java.lang.String methodName)

getNumberOfMessageSends

public int getNumberOfMessageSends(java.lang.String methodName)

setNumberOfPublicMethods

public void setNumberOfPublicMethods(int numMethods)
'class size' implementation starts here ....


getNumberOfPublicMethods

public int getNumberOfPublicMethods()

setNumberOfInstanceMethods

public void setNumberOfInstanceMethods(int numMethods)

getNumberOfInstanceMethods

public int getNumberOfInstanceMethods()

getNumberOfInstanceVariables

public int getNumberOfInstanceVariables()

getNumberOfClassMethods

public int getNumberOfClassMethods()

setNumberOfApiCalls

public void setNumberOfApiCalls(int numberOfApiCalls)
'method internals' implementation starts here ....


getNumberOfApiCalls

public int getNumberOfApiCalls()
public int getNumberOfApiCalls(String methodName) { EDU.purdue.cs.bloat.editor.MethodEditor methodEditor = getMethod(methodName); java.util.List codelist = methodEditor.code(); int apiCallCount = 0; for(int m=0; m

getNamesOfMethodsInvoked

public java.lang.String[] getNamesOfMethodsInvoked(java.lang.String methodName)

getNumberOfMethodParams

public int getNumberOfMethodParams(java.lang.String methodName)

setNumberOfConditionalStatements

public void setNumberOfConditionalStatements(int numOfCondStats)
'class internal' implementation starts here ....


getNumberOfConditionalStatements

public int getNumberOfConditionalStatements()

setNumberOfScalars

public void setNumberOfScalars(int numScalars)

getNumberOfScalars

public int getNumberOfScalars()

setNumberOfVectors

public void setNumberOfVectors(int numVectors)

getNumberOfVectors

public int getNumberOfVectors()

setVectorDimensions

public void setVectorDimensions(java.util.Vector numArrayDimensions)

getVectorDimensions

public java.util.Vector getVectorDimensions()

setNumberOfMethodsInvoked

public void setNumberOfMethodsInvoked(int numberOfmethodsInvoked)
'class external' implementation starts here ....


getNumberOfMethodsInvoked

public int getNumberOfMethodsInvoked()

setNumberOfMethodsInScope

public void setNumberOfMethodsInScope(int numberOfmethodsInScope)

getNumberOfMethodsInScope

public int getNumberOfMethodsInScope()

setClassHierarchyLevel

public void setClassHierarchyLevel(int hierarchyLevel)
'class hierarchy' implementation starts here ....


getClassHierarchyLevel

public int getClassHierarchyLevel()

setNumberOfSubClasses

public void setNumberOfSubClasses(int numberOfSubClasses)

getNumberOfSubClasses

public int getNumberOfSubClasses()

setNumberOfMethodsInherited

public void setNumberOfMethodsInherited(int numberOfMethodsInherited)
'method hierarchy' implementation starts here ....


getNumberOfMethodsInherited

public int getNumberOfMethodsInherited()

setNumberOfMethodsOverridden

public void setNumberOfMethodsOverridden(int numberOfMethodsOverridden)

getNumberOfMethodsOverridden

public int getNumberOfMethodsOverridden()

SandMark version 2.1

Wed Jul 3 17:27:43 MST 2002