public class ClassFeatureSet extends java.lang.Object implements XMLWriteable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_NAME_KEY |
static java.lang.String |
CODE_LENGTH_KEY |
static java.lang.String |
ELEMENT_NAME |
static double |
EXACT_CLASS_NAME_MATCH
Similarity of classes which don't have enough features to match exactly,
but whose class names match exactly.
|
static java.lang.String |
FEATURE_ELEMENT_NAME |
static java.lang.String |
FIELD_NAME_KEY |
static java.lang.String |
METHOD_NAME_KEY |
static int |
MIN_CODE_LENGTH
Minimum code length required to add a CodeLength feature.
|
static int |
MIN_FEATURES
Minimum number of features which must be present in order to declare two
classes similar.
|
static double |
MIN_MATCH
Minimum similarity required to declare two classes similar.
|
Constructor and Description |
---|
ClassFeatureSet()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addFeature(java.lang.String feature) |
java.util.Iterator<java.lang.String> |
featureIterator() |
java.lang.String |
getClassName() |
int |
getNumFeatures() |
boolean |
hasFeature(java.lang.String feature) |
ClassFeatureSet |
initialize(org.apache.bcel.classfile.JavaClass javaClass)
Initialize from given JavaClass.
|
boolean |
isInterface() |
static boolean |
isUnlikelyToBeRenamed(java.lang.String pkg)
Return true if classes in the given package is unlikely to be renamed:
e.g., because they are part of a public API.
|
static void |
main(java.lang.String[] args) |
void |
setClassName(java.lang.String className) |
void |
setInterface(boolean isInterface) |
static double |
similarity(ClassFeatureSet a,
ClassFeatureSet b) |
boolean |
similarTo(ClassFeatureSet other) |
static java.lang.String |
transformClassName(java.lang.String className)
Transform a class name by stripping its package name.
|
static java.lang.String |
transformMethodSignature(java.lang.String signature)
Transform a method signature to allow it to be compared even if any of
its parameter types are moved to another package.
|
static java.lang.String |
transformSignature(java.lang.String signature)
Transform a field or method parameter signature to allow it to be
compared even if it is moved to another package.
|
void |
writeXML(XMLOutput xmlOutput)
Write this object to given XMLOutput.
|
public static final java.lang.String CLASS_NAME_KEY
public static final java.lang.String METHOD_NAME_KEY
public static final java.lang.String CODE_LENGTH_KEY
public static final java.lang.String FIELD_NAME_KEY
public static final int MIN_CODE_LENGTH
public static final int MIN_FEATURES
public static final double MIN_MATCH
public static final double EXACT_CLASS_NAME_MATCH
public static final java.lang.String ELEMENT_NAME
public static final java.lang.String FEATURE_ELEMENT_NAME
public ClassFeatureSet()
public ClassFeatureSet initialize(org.apache.bcel.classfile.JavaClass javaClass)
javaClass
- the JavaClasspublic java.lang.String getClassName()
public void setClassName(java.lang.String className)
className
- The className to set.public boolean isInterface()
public void setInterface(boolean isInterface)
isInterface
- The isInterface to set.public int getNumFeatures()
public void addFeature(java.lang.String feature)
public java.util.Iterator<java.lang.String> featureIterator()
public boolean hasFeature(java.lang.String feature)
public static java.lang.String transformClassName(java.lang.String className)
className
- a class namepublic static boolean isUnlikelyToBeRenamed(java.lang.String pkg)
pkg
- the package namepublic static java.lang.String transformMethodSignature(java.lang.String signature)
signature
- a method signaturepublic static java.lang.String transformSignature(java.lang.String signature)
signature
- the signaturepublic static double similarity(ClassFeatureSet a, ClassFeatureSet b)
public boolean similarTo(ClassFeatureSet other)
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
public void writeXML(XMLOutput xmlOutput) throws java.io.IOException
XMLWriteable
writeXML
in interface XMLWriteable
xmlOutput
- the XMLOutput for the documentjava.io.IOException
FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.