|
Dresden OCL Toolkit | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttudresden.ocl.injection.reverseeng.AnalysisConsumer
InjectionConsumer used to check for presence of element-type tags in a JavaFile.
After processing of a Java source file, m_lcdCollections
will contain a list of all collections
in the source file, together with their respective element-type tag. In addition, each element of the
list stores information that can be used to identifiy the exact comment where to place the element-type
tag when saving the modified file. m_lmdMaps
will contain a list of similar entries for each map
in the analysed file.
Note that this scheme only work if the Java Source code is not modified externally between analysis and externalisation.
CollectionDescriptor
,
MapDescriptor
Field Summary | |
private int |
m_cComments
The number of doc comments in the current file so far. |
private List |
m_ladFeatures
All features found in the current file whether collections or maps. |
private List |
m_lcdCollections
Collection attributes found in the current file. |
private List |
m_lmdMaps
Map attributes found in the current file. |
private int |
m_nStatus
|
private String |
m_sCurrentComment
The last doc comment parsed so far. |
private String |
m_sFileName
Name of source file being analysed without trailing extension. |
static int |
STATUS_COLLECTIONSANDMAPS
File contains collections and maps which are complete. |
static int |
STATUS_COLLECTIONSANDMAPS_INCOMPL
File contains collections and maps, some of which are incomplete. |
static int |
STATUS_COLLECTIONSONLY
File contains only collections which are complete. |
static int |
STATUS_COLLECTIONSONLY_INCOMPL
File contains only collections, some of which are incomplete. |
static int |
STATUS_MAPSONLY
File contains only maps which are complete. |
static int |
STATUS_MAPSONLY_INCOMPL
File contains only maps, some of which are incomplete. |
private static int |
STATUS_MASK_COLLECTIONS
|
private static int |
STATUS_MASK_INCOMPL
|
private static int |
STATUS_MASK_MAPS
|
private static int |
STATUS_MASK_NONE
|
static int |
STATUS_NORMALFILE
Normal Java file: no collections, no maps. |
Constructor Summary | |
AnalysisConsumer(String sFileName)
Creates new AnalysisConsumer |
Method Summary | |
static AnalysisConsumer |
analyse(File fToAnalyse)
|
List |
getAllFeatures()
|
List |
getCollections()
|
String |
getFileName()
|
List |
getMaps()
|
int |
getStatus()
|
boolean |
hasIncompleteElements()
|
static void |
main(String[] args)
|
void |
onAttributeHeader(JavaAttribute ja)
Encountered the header of a java attribute. |
void |
onBehaviourHeader(JavaBehaviour jb)
Encountered the header of a java method. |
void |
onClass(JavaClass cc)
Encountered a class header. |
void |
onClassEnd(JavaClass cc)
Encountered the end of a class. |
void |
onClassFeature(JavaFeature cf,
String doccomment)
Called for attributes and methods. |
boolean |
onDocComment(String doccomment)
Encountered a java comment. |
void |
onFileDocComment(String doccomment)
Encountered a java documentation comment. |
void |
onFileEnd()
Encountered the end of the input stream. |
void |
onImport(String importname)
Encountered an import statement. |
void |
onPackage(JavaFile javafile)
Encountered a package statement. |
void |
updateStatus()
Update the status of the file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final int STATUS_MASK_NONE
private static final int STATUS_MASK_COLLECTIONS
private static final int STATUS_MASK_MAPS
private static final int STATUS_MASK_INCOMPL
public static final int STATUS_NORMALFILE
public static final int STATUS_COLLECTIONSONLY
public static final int STATUS_COLLECTIONSONLY_INCOMPL
public static final int STATUS_MAPSONLY
public static final int STATUS_MAPSONLY_INCOMPL
public static final int STATUS_COLLECTIONSANDMAPS
public static final int STATUS_COLLECTIONSANDMAPS_INCOMPL
private int m_cComments
private String m_sCurrentComment
private List m_lcdCollections
private List m_lmdMaps
private List m_ladFeatures
private int m_nStatus
private String m_sFileName
Constructor Detail |
public AnalysisConsumer(String sFileName)
sFileName
- name of source file being analysed.Method Detail |
public void onPackage(JavaFile javafile)
onPackage
in interface InjectionConsumer
JavaFile.getPackageName()
public void onImport(String importname)
onImport
in interface InjectionConsumer
JavaFile.findType(String)
public void onClass(JavaClass cc)
onClass
in interface InjectionConsumer
public void onClassEnd(JavaClass cc) throws IOException
onClassEnd
in interface InjectionConsumer
IOException
InjectionConsumer.onClass(JavaClass)
public void onBehaviourHeader(JavaBehaviour jb) throws IOException
onBehaviourHeader
in interface InjectionConsumer
IOException
public void onAttributeHeader(JavaAttribute ja) throws IOException
InjectionConsumer
InjectionConsumer.onClassFeature(JavaFeature, String)
.
onAttributeHeader
in interface InjectionConsumer
IOException
public void onClassFeature(JavaFeature cf, String doccomment) throws InjectorParseException, IOException
If an attribute, checks whether a collection. If so, creates a new entry in m_lCollections.
This method relies on the compiled versions of all classes of the system to be analysed to be available in the classpath.
onClassFeature
in interface InjectionConsumer
InjectorParseException
IOException
public boolean onDocComment(String doccomment) throws IOException
If this is a doc comment, it is saved temporarily in m_sCurrentComment, so that onClassFeature can use it. Also, m_cComments is increased.
onDocComment
in interface InjectionConsumer
IOException
public void onFileDocComment(String doccomment) throws IOException
InjectionConsumer
onFileDocComment
in interface InjectionConsumer
IOException
public void onFileEnd()
onFileEnd
in interface InjectionConsumer
public boolean hasIncompleteElements()
public int getStatus()
public void updateStatus()
public List getCollections()
public List getMaps()
public List getAllFeatures()
public String getFileName()
public static void main(String[] args)
public static AnalysisConsumer analyse(File fToAnalyse) throws IOException, InjectorParseException
IOException
InjectorParseException
|
Dresden OCL Toolkit | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |