|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IClassificationProvider
The CPC API for clone classification providers.
A classification provider takes a clone objects,
analyses it and attaches a number of classifications to it.
Classifications are Strings which usually correspond to the CLASSIFICATION_* constants of this class.
3rd parties may add their own classification strings. Such strings need to have a globally
unique prefix to prevent collisions with other classifications.
The prefix "cpc." is reserved for the default CPC classifiers.
Classification strings may only contain letters, numbers and dots. Classification strings are case sensitive.
IClone.hasClassification(String)
,
IClone.getClassifications()
,
IClone.addClassification(String)
,
IClone.removeClassification(String)
Nested Class Summary | |
---|---|
static class |
IClassificationProvider.Result
Possible results of the classify(Type, ICloneFile, IClone, String, IClone) method. |
static class |
IClassificationProvider.Type
Specifies the type of classification to be performed. |
Field Summary | |
---|---|
static java.lang.String |
CLASSIFICATION_CLASS
The clone contains at least one complete java class. |
static java.lang.String |
CLASSIFICATION_COMMENT
The clone contains only comments and whitespaces or a part of a comment. |
static java.lang.String |
CLASSIFICATION_COMPLEX
The clone contains potentially complex code. |
static java.lang.String |
CLASSIFICATION_CONDITION
The clone contains at least one complete java condition block. |
static java.lang.String |
CLASSIFICATION_IDENTIFIER
The clone contains a complete identifier and nothing else. |
static java.lang.String |
CLASSIFICATION_LOOP
The clone contains at least one complete loop construct. |
static java.lang.String |
CLASSIFICATION_METHOD
The clone contains at least one complete java method. |
static java.lang.String |
CLASSIFICATION_TEMPLATE
The clone contains is probably a template code fragment. |
Method Summary | |
---|---|
IClassificationProvider.Result |
classify(IClassificationProvider.Type type,
ICloneFile cloneFile,
IClone clone,
java.lang.String fileContent,
IClone originClone)
Takes a clone object and passes it to all registered classification strategies to decide on the correct classifications. |
Methods inherited from interface org.electrocodeogram.cpc.core.api.provider.IProvider |
---|
getProviderName, toString |
Field Detail |
---|
static final java.lang.String CLASSIFICATION_CLASS
static final java.lang.String CLASSIFICATION_METHOD
static final java.lang.String CLASSIFICATION_LOOP
static final java.lang.String CLASSIFICATION_CONDITION
static final java.lang.String CLASSIFICATION_IDENTIFIER
static final java.lang.String CLASSIFICATION_COMMENT
static final java.lang.String CLASSIFICATION_COMPLEX
static final java.lang.String CLASSIFICATION_TEMPLATE
IClassificationProvider.Result.REJECTED
result.
Method Detail |
---|
IClassificationProvider.Result classify(IClassificationProvider.Type type, ICloneFile cloneFile, IClone clone, java.lang.String fileContent, IClone originClone)
The new classifications are directly added to the clones classifications data structure
(the clone object is updated in place).
It is up to the specified type and the implementation how existing classification
are handled.
Providing the file content is optional, however, if it is already present for some reason, it should be provided to reduce load.
A classification provider may try to obtain additional information for the corresponding file
from the Eclipse environment, if it is running. I.e. a classification provider may try to obtain
the AST for a Java class.
It is up to the classification provider implementation whether to make use of any such additional
information or not.
type
- the type of classification to be performed, never null.cloneFile
- the clone file which contains the given clone, never null.clone
- the clone to classify, never null.fileContent
- current content of the file this clone is located in, may be NULL in which case
the content will be retrieved from an open editor or the filesystem, when needed.originClone
- optional reference to the IClone
which the given clone was copied
from. This will usually only be available for IClassificationProvider.Type.INITIAL
calls and even then it is
optional. May be NULL.
IClassificationProvider.Result
, never null.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |