org.sourceflow
Class CodeFile

java.lang.Object
  extended byorg.sourceflow.CodeElement
      extended byorg.sourceflow.CodeContainer
          extended byorg.sourceflow.CodeFile
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
CFile, CSharpFile, JavaFile, VisualBasicFile

public abstract class CodeFile
extends CodeContainer

The abstract base class for all source code files. The source code files are also code element containers.


Constructor Summary
CodeFile(java.io.File dir)
          Creates a new source code file.
 
Method Summary
 java.io.File getFile()
          Returns the file object to be generated.
abstract  java.lang.String getName()
          Returns the file name without the directory path.
 java.lang.String toString()
          Returns the complete file path, including the directory.
 void write(CodeStyle style)
          Writes the source code for this file.
 
Methods inherited from class org.sourceflow.CodeContainer
addElement, printContents, size
 
Methods inherited from class org.sourceflow.CodeElement
category, compareTo, print, printSeparator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CodeFile

public CodeFile(java.io.File dir)
Creates a new source code file.

Parameters:
dir - the base directory
Method Detail

toString

public java.lang.String toString()
Returns the complete file path, including the directory.

Returns:
the complete file path

getFile

public java.io.File getFile()
Returns the file object to be generated.

Returns:
the file object to be generated

getName

public abstract java.lang.String getName()
Returns the file name without the directory path.

Returns:
the file name

write

public void write(CodeStyle style)
           throws java.io.IOException
Writes the source code for this file. Any previous file with this name will be overwritten.

Parameters:
style - the code style to use
Throws:
java.io.IOException - if the file could not be written properly