Dresden OCL Toolkit

tudresden.ocl.injection.reverseeng
Class FileSaveConsumer

java.lang.Object
  extended bytudresden.ocl.injection.reverseeng.FileSaveConsumer
All Implemented Interfaces:
InjectionConsumer

public class FileSaveConsumer
extends Object
implements InjectionConsumer

InjectionConsumer used to save changes made via RevengGUI.

Version:
0.1
Author:
sz9 (Steffen Zschaler)

Field Summary
private  AnalysisConsumer m_acAnalysisResults
          The AnalysisConsumer that contains the information about the analysed file.
private  AbstractDescriptor m_adCurrentFeature
          The next feature that needs a corrected doccomment.
private  int m_cComments
          The number of doc comments in the current file so far.
private  boolean m_fWroteDocComment
          True if a doccomment has been written after the last feature.
private  IndentAwareWriter m_iawOutput
          The writer used to produce the output file.
private  Iterator m_iFeatures
          The Iterator of features that need a corrected doccomment.
 
Constructor Summary
FileSaveConsumer(IndentAwareWriter iawOutput, AnalysisConsumer acAnalysisResults)
          Creates new FileSaveConsumer
 
Method Summary
private  AbstractDescriptor getCurrentFeature()
           
 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 documentation 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.
static void save(File fSource, File fDest, AnalysisConsumer acAnalysisResults)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_iawOutput

private IndentAwareWriter m_iawOutput
The writer used to produce the output file.


m_acAnalysisResults

private AnalysisConsumer m_acAnalysisResults
The AnalysisConsumer that contains the information about the analysed file.


m_cComments

private int m_cComments
The number of doc comments in the current file so far.


m_iFeatures

private Iterator m_iFeatures
The Iterator of features that need a corrected doccomment.


m_adCurrentFeature

private AbstractDescriptor m_adCurrentFeature
The next feature that needs a corrected doccomment.


m_fWroteDocComment

private boolean m_fWroteDocComment
True if a doccomment has been written after the last feature.

Constructor Detail

FileSaveConsumer

public FileSaveConsumer(IndentAwareWriter iawOutput,
                        AnalysisConsumer acAnalysisResults)
Creates new FileSaveConsumer

Method Detail

getCurrentFeature

private AbstractDescriptor getCurrentFeature()

onPackage

public void onPackage(JavaFile javafile)
               throws InjectorParseException
Encountered a package statement. This method is guaranteed to be called at most once.

Specified by:
onPackage in interface InjectionConsumer
Throws:
InjectorParseException
See Also:
JavaFile.getPackageName()

onImport

public void onImport(String importname)
Encountered an import statement. Imports are also saved in JavaFile.imports. This information may be used for mapping type names to types.

Specified by:
onImport in interface InjectionConsumer
See Also:
JavaFile.findType(String)

onClass

public void onClass(JavaClass cc)
Encountered a class header. Is also called for inner classes.

Specified by:
onClass in interface InjectionConsumer

onClassEnd

public void onClassEnd(JavaClass cc)
                throws IOException,
                       InjectorParseException
Encountered the end of a class.

Specified by:
onClassEnd in interface InjectionConsumer
Throws:
IOException
InjectorParseException
See Also:
onClass(JavaClass)

onBehaviourHeader

public void onBehaviourHeader(JavaBehaviour jb)
                       throws IOException
Encountered the header of a java method. Is called additionally to onClassFeature(JavaFeature, String).

Specified by:
onBehaviourHeader in interface InjectionConsumer
Throws:
IOException

onAttributeHeader

public void onAttributeHeader(JavaAttribute ja)
                       throws IOException
Description copied from interface: InjectionConsumer
Encountered the header of a java attribute. Is called additionally to InjectionConsumer.onClassFeature(JavaFeature, String).

Specified by:
onAttributeHeader in interface InjectionConsumer
Throws:
IOException

onClassFeature

public void onClassFeature(JavaFeature cf,
                           String doccomment)
Called for attributes and methods. Is called additionally to onBehaviourHeader(JavaBehaviour).

Specified by:
onClassFeature in interface InjectionConsumer

onDocComment

public boolean onDocComment(String doccomment)
                     throws IOException
Encountered a java documentation comment. Is called for comments on class level only, i.e. inside a class, but outside of methods and attributes.

Specified by:
onDocComment in interface InjectionConsumer
Returns:
if false is returned, the next class feature is ignored.
Throws:
IOException

onFileDocComment

public void onFileDocComment(String doccomment)
                      throws IOException
Description copied from interface: InjectionConsumer
Encountered a java documentation comment. Is called for comments on file level only, i.e. outside of any classes.

Specified by:
onFileDocComment in interface InjectionConsumer
Throws:
IOException

onFileEnd

public void onFileEnd()
Encountered the end of the input stream.

Specified by:
onFileEnd in interface InjectionConsumer

save

public static void save(File fSource,
                        File fDest,
                        AnalysisConsumer acAnalysisResults)
                 throws IOException
Throws:
IOException

Dresden OCL Toolkit

Submit a bug
Developed at the Dresden University of Technology.
This software is published under the GNU Lesser General Public License.