de.uni_paderborn.fujaba.codegen
Class CodeGenStrategy

java.lang.Object
  extended byde.uni_paderborn.fujaba.codegen.CodeGenStrategy
Direct Known Subclasses:
OOGenStrategyClient

public abstract class CodeGenStrategy
extends java.lang.Object

Class CodeGenStrategy

Associations

                -------- 0..1       hasStrategies       0..1
 CodeGenFactory | name |------------------------------------- CodeGenStrategy
                -------- codeGenFactory      codeGenStrategy

                 -------- 0..1        hasVisitors        0..1
 CodeGenStrategy | name |------------------------------------- CodeGenVisitor
                 -------- codeGenStrategy      codeGenVisitor

                  0..1                        0..1
 CodeGenStrategy ---------------------------------- CodeGenFactory
                  currentStrategy   currentFactory

                  0..1                          0..1
 CodeGenStrategy ------------------------------------ CodeGenVisitor
                  currentStrategy     currentVisitor
 

Version:
$Revision: 1.45.2.1 $
Author:
$Author: mksoft $

Constructor Summary
CodeGenStrategy()
          Default Constructor
 
Method Summary
 boolean addToBeforeHandlerChain(CodeGenStrategyHandler value, CodeGenStrategyHandler successorHandler)
          Access method for an one to n association.
 boolean addToCodeGenVisitor(CodeGenVisitor value)
           
 boolean addToHandlerChain(CodeGenStrategyHandler value)
          Access method for an one to n association.
 CodeGenStrategy append(java.lang.String code)
          No comment provided by developer, please add a comment to improve documentation.
 CodeGenStrategy append(java.lang.StringBuffer code)
          No comment provided by developer, please add a comment to improve documentation.
 void appendFunction(CodeGenFunction newFunction)
          Append new function to the end of the responsibility chain.
 void appendHandler(CodeGenStrategyHandler newHandler)
          Appends new handler as the next to last handler of the responsibility chain.
static OOGenToken checkTokenList(FElement increment, OOGenToken prevToken, OOGenToken firstToken, OOGenToken lastToken)
          Checks if a token list is present and if not creates a new one.
 java.lang.String createCommentary(java.lang.String text)
          No comment provided by developer, please add a comment to improve documentation.
 void createFiles(java.lang.String path, java.lang.String name)
          No comment provided by developer, please add a comment to improve documentation.
 java.lang.String createIndentString()
          No comment provided by developer, please add a comment to improve documentation.
 java.lang.String createLineCommentary(java.lang.String text)
          No comment provided by developer, please add a comment to improve documentation.
 java.util.Iterator entriesOfCodeGenVisitor()
           
 java.lang.Object generateCode(FElement incr, java.lang.String methodName, java.lang.Object[] param)
          No comment provided by developer, please add a comment to improve documentation.
 java.lang.StringBuffer generateFElement(FElement element)
          Generates sourcecode for a given FElement without storing it in a file.
 java.lang.StringBuffer generateFElement(FElement element, boolean save)
          Generates sourcecode for a given FElement with the possibility of saving it to a file.
abstract  void generateFProject(FProject theProject)
          No comment provided by developer, please add a comment to improve documentation.
 OOGenToken generateSourceCodeFor(java.util.Enumeration enumeration, OOGenToken current, java.lang.Object[] param)
          Describe generateSourceCodeFor method here.
 OOGenToken generateSourceCodeFor(FElement incr, OOGenToken prevToken, java.lang.Object[] param)
          This method calls the generateSourceCode () method on incr with parameter prevToken.
 OOGenToken generateSourceCodeFor(java.util.Iterator iter, OOGenToken current, java.lang.Object[] param)
          Describe generateSourceCodeFor method here.
 CodeGenFactory getCodeGenFactory()
          Get the codeGenFactory attribute of the CodeGenStrategy object
 java.lang.StringBuffer getCurrentBuffer()
          Get the currentBuffer attribute of the OOGenStrategyClient object
 CodeGenFactory getCurrentFactory()
           
 CodeGenVisitor getCurrentVisitor()
           
 java.lang.String getFileName(FFile theFile)
          Returns the name of the source file corresponding to theFile.
 java.lang.String getFilePath(FFile theFile)
          Returns the directory of the source file corresponding to theFile.
 CodeGenStrategyHandler getFirstOfHandlerChain()
          Get the firstOfHandlerChain attribute of the CodeGenStrategy object
 CodeGenVisitor getFromCodeGenVisitor(java.lang.String key)
           
 CodeGenFunction getFunction()
          Get the function attribute of the OOGenStrategyClient object
 CodeGenStrategyHandler getHandlerChainAt(int index)
          Get the handlerChainAt attribute of the CodeGenStrategy object
 CodeGenStrategyHandler getLastOfHandlerChain()
          Get the lastOfHandlerChain attribute of the CodeGenStrategy object
 java.lang.String getName()
          Get the value of name.
 CodeGenStrategyHandler getNextIndexOfHandlerChain(CodeGenStrategyHandler object, int index)
          Get the nextIndexOfHandlerChain attribute of the CodeGenStrategy object
 CodeGenStrategyHandler getNextOfHandlerChain(CodeGenStrategyHandler object)
          Get the nextOfHandlerChain attribute of the CodeGenStrategy object
 CodeGenStrategyHandler getPreviousIndexOfHandlerChain(CodeGenStrategyHandler object, int index)
          Get the previousIndexOfHandlerChain attribute of the CodeGenStrategy object
 CodeGenStrategyHandler getPreviousOfHandlerChain(CodeGenStrategyHandler object)
          Get the previousOfHandlerChain attribute of the CodeGenStrategy object
 OOGenToken handlerGenerate(ASGElement asgElement, OOGenToken prevToken, java.lang.Object[] param)
          Deprecated. use handlerGenerate(de.uni_paderborn.fujaba.metamodel.FElement, OOGenToken, Object[])
 OOGenToken handlerGenerate(FElement asgElement, OOGenToken prevToken, java.lang.Object[] param)
          Generate token for an element.
 boolean handlerIncrNeedsToken(FElement element)
          No comment provided by developer, please add a comment to improve documentation.
 boolean hasInCodeGenVisitor(CodeGenVisitor value)
           
 boolean hasInHandlerChain(CodeGenStrategyHandler value)
          No comment provided by developer, please add a comment to improve documentation.
 boolean hasKeyInCodeGenVisitor(java.lang.String key)
           
 java.lang.String indentText(java.lang.String text)
          No comment provided by developer, please add a comment to improve documentation.
 java.lang.String indentText(java.lang.StringBuffer text)
          No comment provided by developer, please add a comment to improve documentation.
 int indexOfHandlerChain(CodeGenStrategyHandler elem)
          No comment provided by developer, please add a comment to improve documentation.
 void initBuffer()
          No comment provided by developer, please add a comment to improve documentation.
 void initVisitor(java.lang.String path, java.lang.String name, boolean writeFiles)
          No comment provided by developer, please add a comment to improve documentation.
 void insertFunction(java.lang.Class beforeFunction, CodeGenFunction newFunction)
          No comment provided by developer, please add a comment to improve documentation.
 void insertHandler(java.lang.Class successorHandlerType, CodeGenStrategyHandler newHandler)
          Inserts new handler before a given successor handler of the responsibility chain.
 boolean isAfterOfHandlerChain(CodeGenStrategyHandler leftObject, CodeGenStrategyHandler rightObject)
          Get the afterOfHandlerChain attribute of the CodeGenStrategy object
 boolean isBeforeOfHandlerChain(CodeGenStrategyHandler leftObject, CodeGenStrategyHandler rightObject)
          Get the beforeOfHandlerChain attribute of the CodeGenStrategy object
 java.util.Iterator iteratorOfCodeGenVisitor()
           
 java.util.Iterator iteratorOfHandlerChain()
          No comment provided by developer, please add a comment to improve documentation.
 java.util.Iterator iteratorOfHandlerChain(CodeGenStrategyHandler lowerBound)
          No comment provided by developer, please add a comment to improve documentation.
 java.util.Iterator keysOfCodeGenVisitor()
           
 int lastIndexOfHandlerChain(CodeGenStrategyHandler elem)
          No comment provided by developer, please add a comment to improve documentation.
 void removeAllFromCodeGenVisitor()
           
 void removeAllFromHandlerChain()
          No comment provided by developer, please add a comment to improve documentation.
 boolean removeFromCodeGenVisitor(CodeGenVisitor value)
           
 boolean removeFromHandlerChain(CodeGenStrategyHandler value)
          No comment provided by developer, please add a comment to improve documentation.
 boolean removeKeyFromCodeGenVisitor(java.lang.String key)
           
 void removeYou()
          No comment provided by developer, please add a comment to improve documentation.
 boolean setCodeGenFactory(CodeGenFactory value)
          Sets the codeGenFactory attribute of the CodeGenStrategy object
 boolean setCurrentFactory(CodeGenFactory value)
           
 boolean setCurrentVisitor(CodeGenVisitor value)
           
 boolean setFunction(CodeGenFunction value)
          Sets the function attribute of the OOGenStrategyClient object
 void setName(java.lang.String name)
          Set the value of name.
 int sizeOfCodeGenVisitor()
           
 int sizeOfHandlerChain()
          No comment provided by developer, please add a comment to improve documentation.
 java.lang.String toString()
           
 void writeFiles()
          No comment provided by developer, please add a comment to improve documentation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CodeGenStrategy

public CodeGenStrategy()
Default Constructor

Method Detail

generateFProject

public abstract void generateFProject(FProject theProject)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
theProject - No description provided

generateFElement

public final java.lang.StringBuffer generateFElement(FElement element)
Generates sourcecode for a given FElement without storing it in a file.

Parameters:
element - The model element for which source code will be generated.
Returns:
the generated sourcecode

handlerIncrNeedsToken

public boolean handlerIncrNeedsToken(FElement element)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
element - No description provided
Returns:
No description provided

generateFElement

public final java.lang.StringBuffer generateFElement(FElement element,
                                                     boolean save)
Generates sourcecode for a given FElement with the possibility of saving it to a file.

Parameters:
element - The model element for which source code will be generated.
save - Defines whether the generated sourcecode has to be saved or not.
Returns:
the generated sourcecode

handlerGenerate

public OOGenToken handlerGenerate(FElement asgElement,
                                  OOGenToken prevToken,
                                  java.lang.Object[] param)
Generate token for an element. Subclasses must override this method. For backward compatibility this method is not abstract but invokes the old version.

Parameters:
asgElement - No description provided
prevToken - No description provided
param - No description provided
Returns:
No description provided

handlerGenerate

public OOGenToken handlerGenerate(ASGElement asgElement,
                                  OOGenToken prevToken,
                                  java.lang.Object[] param)
Deprecated. use handlerGenerate(de.uni_paderborn.fujaba.metamodel.FElement, OOGenToken, Object[])

Parameters:
asgElement -
prevToken -
param -
Returns:
No description provided

generateSourceCodeFor

public OOGenToken generateSourceCodeFor(FElement incr,
                                        OOGenToken prevToken,
                                        java.lang.Object[] param)
This method calls the generateSourceCode () method on incr with parameter prevToken. The return value is the last token to go on with. It also deletes superfluous tokens.

Parameters:
incr - the increment on which to call generateJava
prevToken - the previous token where to insert the new one
param - No description provided
Returns:
the last token of the list generated by the increment

generateSourceCodeFor

public OOGenToken generateSourceCodeFor(java.util.Iterator iter,
                                        OOGenToken current,
                                        java.lang.Object[] param)
Describe generateSourceCodeFor method here.

Parameters:
iter - an Iterator value
current - an OOGenToken value
param - No description provided
Returns:
an OOGenToken value

generateSourceCodeFor

public OOGenToken generateSourceCodeFor(java.util.Enumeration enumeration,
                                        OOGenToken current,
                                        java.lang.Object[] param)
Describe generateSourceCodeFor method here.

Parameters:
enumeration - an Enumeration value
current - an OOGenToken value
param - No description provided
Returns:
an OOGenToken value

generateCode

public final java.lang.Object generateCode(FElement incr,
                                           java.lang.String methodName,
                                           java.lang.Object[] param)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
incr - No description provided
methodName - No description provided
param - No description provided
Returns:
No description provided

checkTokenList

public static OOGenToken checkTokenList(FElement increment,
                                        OOGenToken prevToken,
                                        OOGenToken firstToken,
                                        OOGenToken lastToken)
Checks if a token list is present and if not creates a new one. It throws an runtime exception if the list only contains one token or the first or last token is null. If the prevToken is not the previous token of firstToken then it cuts out the list and inserts it behind prevToken.

Parameters:
increment - an FElement value
prevToken - marks the new position for the list
firstToken - marks the first token in the list
lastToken - marks the last token in the list
Returns:
the 'new' first token

createFiles

public void createFiles(java.lang.String path,
                        java.lang.String name)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
path - No description provided
name - No description provided

initVisitor

public void initVisitor(java.lang.String path,
                        java.lang.String name,
                        boolean writeFiles)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
path - No description provided
name - No description provided
writeFiles - No description provided

initBuffer

public void initBuffer()
No comment provided by developer, please add a comment to improve documentation.


writeFiles

public void writeFiles()
No comment provided by developer, please add a comment to improve documentation.


append

public CodeGenStrategy append(java.lang.StringBuffer code)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
code - No description provided
Returns:
No description provided

append

public CodeGenStrategy append(java.lang.String code)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
code - No description provided
Returns:
No description provided

createIndentString

public java.lang.String createIndentString()
No comment provided by developer, please add a comment to improve documentation.

Returns:
No description provided

indentText

public java.lang.String indentText(java.lang.String text)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
text - No description provided
Returns:
No description provided

indentText

public java.lang.String indentText(java.lang.StringBuffer text)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
text - No description provided
Returns:
No description provided

getCurrentBuffer

public java.lang.StringBuffer getCurrentBuffer()
Get the currentBuffer attribute of the OOGenStrategyClient object

Returns:
The currentBuffer value

createLineCommentary

public java.lang.String createLineCommentary(java.lang.String text)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
text - No description provided
Returns:
No description provided

createCommentary

public java.lang.String createCommentary(java.lang.String text)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
text - No description provided
Returns:
No description provided

getFilePath

public java.lang.String getFilePath(FFile theFile)
Returns the directory of the source file corresponding to theFile.

Parameters:
theFile - the file whose directory is to be returned.
Returns:
the name of the directory.

getFileName

public java.lang.String getFileName(FFile theFile)
Returns the name of the source file corresponding to theFile.

Parameters:
theFile - the file whose source file is to be returned
Returns:
the name of the source file without extension

setCurrentFactory

public boolean setCurrentFactory(CodeGenFactory value)
Parameters:
value - The new currentFactory value
Returns:
No description provided
See Also:
#currentFactory

getCurrentFactory

public CodeGenFactory getCurrentFactory()
Returns:
The currentFactory value
See Also:
#currentFactory

setCurrentVisitor

public boolean setCurrentVisitor(CodeGenVisitor value)
Parameters:
value - The new currentVisitor value
Returns:
No description provided
See Also:
#currentVisitor

getCurrentVisitor

public CodeGenVisitor getCurrentVisitor()
Returns:
The currentVisitor value
See Also:
#currentVisitor

getCodeGenFactory

public CodeGenFactory getCodeGenFactory()
Get the codeGenFactory attribute of the CodeGenStrategy object

Returns:
The codeGenFactory value

setCodeGenFactory

public boolean setCodeGenFactory(CodeGenFactory value)
Sets the codeGenFactory attribute of the CodeGenStrategy object

Parameters:
value - The new codeGenFactory value
Returns:
No description provided

getName

public java.lang.String getName()
Get the value of name.

Returns:
Value of name.

setName

public void setName(java.lang.String name)
Set the value of name.

Parameters:
name - Value to assign to name.

hasInCodeGenVisitor

public boolean hasInCodeGenVisitor(CodeGenVisitor value)
Parameters:
value - No description provided
Returns:
No description provided
See Also:
#codeGenVisitor

hasKeyInCodeGenVisitor

public boolean hasKeyInCodeGenVisitor(java.lang.String key)
Parameters:
key - No description provided
Returns:
No description provided
See Also:
#codeGenVisitor

iteratorOfCodeGenVisitor

public java.util.Iterator iteratorOfCodeGenVisitor()
Returns:
No description provided
See Also:
#codeGenVisitor

keysOfCodeGenVisitor

public java.util.Iterator keysOfCodeGenVisitor()
Returns:
No description provided
See Also:
#codeGenVisitor

entriesOfCodeGenVisitor

public java.util.Iterator entriesOfCodeGenVisitor()
Returns:
No description provided
See Also:
#codeGenVisitor

sizeOfCodeGenVisitor

public int sizeOfCodeGenVisitor()
Returns:
No description provided
See Also:
#codeGenVisitor

getFromCodeGenVisitor

public CodeGenVisitor getFromCodeGenVisitor(java.lang.String key)
Parameters:
key - No description provided
Returns:
The fromCodeGenVisitor value
See Also:
#codeGenVisitor

addToCodeGenVisitor

public boolean addToCodeGenVisitor(CodeGenVisitor value)
Parameters:
value - The object added.
Returns:
No description provided
See Also:
#codeGenVisitor

removeFromCodeGenVisitor

public boolean removeFromCodeGenVisitor(CodeGenVisitor value)
Parameters:
value - No description provided
Returns:
No description provided
See Also:
#codeGenVisitor

removeKeyFromCodeGenVisitor

public boolean removeKeyFromCodeGenVisitor(java.lang.String key)
Parameters:
key - No description provided
Returns:
No description provided
See Also:
#codeGenVisitor

removeAllFromCodeGenVisitor

public void removeAllFromCodeGenVisitor()
See Also:
#codeGenVisitor

addToBeforeHandlerChain

public boolean addToBeforeHandlerChain(CodeGenStrategyHandler value,
                                       CodeGenStrategyHandler successorHandler)
Access method for an one to n association.

Parameters:
value - The object added.
successorHandler - The object added.
Returns:
No description provided

addToHandlerChain

public boolean addToHandlerChain(CodeGenStrategyHandler value)
Access method for an one to n association.

Parameters:
value - The object added.
Returns:
No description provided

getFirstOfHandlerChain

public CodeGenStrategyHandler getFirstOfHandlerChain()
Get the firstOfHandlerChain attribute of the CodeGenStrategy object

Returns:
The firstOfHandlerChain value

getHandlerChainAt

public CodeGenStrategyHandler getHandlerChainAt(int index)
Get the handlerChainAt attribute of the CodeGenStrategy object

Parameters:
index - No description provided
Returns:
The handlerChainAt value

getLastOfHandlerChain

public CodeGenStrategyHandler getLastOfHandlerChain()
Get the lastOfHandlerChain attribute of the CodeGenStrategy object

Returns:
The lastOfHandlerChain value

getNextIndexOfHandlerChain

public CodeGenStrategyHandler getNextIndexOfHandlerChain(CodeGenStrategyHandler object,
                                                         int index)
Get the nextIndexOfHandlerChain attribute of the CodeGenStrategy object

Parameters:
object - No description provided
index - No description provided
Returns:
The nextIndexOfHandlerChain value

getNextOfHandlerChain

public CodeGenStrategyHandler getNextOfHandlerChain(CodeGenStrategyHandler object)
Get the nextOfHandlerChain attribute of the CodeGenStrategy object

Parameters:
object - No description provided
Returns:
The nextOfHandlerChain value

getPreviousIndexOfHandlerChain

public CodeGenStrategyHandler getPreviousIndexOfHandlerChain(CodeGenStrategyHandler object,
                                                             int index)
Get the previousIndexOfHandlerChain attribute of the CodeGenStrategy object

Parameters:
object - No description provided
index - No description provided
Returns:
The previousIndexOfHandlerChain value

getPreviousOfHandlerChain

public CodeGenStrategyHandler getPreviousOfHandlerChain(CodeGenStrategyHandler object)
Get the previousOfHandlerChain attribute of the CodeGenStrategy object

Parameters:
object - No description provided
Returns:
The previousOfHandlerChain value

hasInHandlerChain

public boolean hasInHandlerChain(CodeGenStrategyHandler value)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
value - No description provided
Returns:
No description provided

indexOfHandlerChain

public int indexOfHandlerChain(CodeGenStrategyHandler elem)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
elem - No description provided
Returns:
No description provided

isAfterOfHandlerChain

public boolean isAfterOfHandlerChain(CodeGenStrategyHandler leftObject,
                                     CodeGenStrategyHandler rightObject)
Get the afterOfHandlerChain attribute of the CodeGenStrategy object

Parameters:
leftObject - No description provided
rightObject - No description provided
Returns:
The afterOfHandlerChain value

isBeforeOfHandlerChain

public boolean isBeforeOfHandlerChain(CodeGenStrategyHandler leftObject,
                                      CodeGenStrategyHandler rightObject)
Get the beforeOfHandlerChain attribute of the CodeGenStrategy object

Parameters:
leftObject - No description provided
rightObject - No description provided
Returns:
The beforeOfHandlerChain value

iteratorOfHandlerChain

public java.util.Iterator iteratorOfHandlerChain()
No comment provided by developer, please add a comment to improve documentation.

Returns:
No description provided

iteratorOfHandlerChain

public java.util.Iterator iteratorOfHandlerChain(CodeGenStrategyHandler lowerBound)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
lowerBound - No description provided
Returns:
No description provided

lastIndexOfHandlerChain

public int lastIndexOfHandlerChain(CodeGenStrategyHandler elem)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
elem - No description provided
Returns:
No description provided

removeAllFromHandlerChain

public void removeAllFromHandlerChain()
No comment provided by developer, please add a comment to improve documentation.


removeFromHandlerChain

public boolean removeFromHandlerChain(CodeGenStrategyHandler value)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
value - No description provided
Returns:
No description provided

sizeOfHandlerChain

public int sizeOfHandlerChain()
No comment provided by developer, please add a comment to improve documentation.

Returns:
No description provided

appendHandler

public void appendHandler(CodeGenStrategyHandler newHandler)
Appends new handler as the next to last handler of the responsibility chain. A dummy handler is always the last element of the chain.

Parameters:
newHandler - No description provided

insertHandler

public void insertHandler(java.lang.Class successorHandlerType,
                          CodeGenStrategyHandler newHandler)
Inserts new handler before a given successor handler of the responsibility chain.

Parameters:
successorHandlerType - The type of the successor handler
newHandler - The handler to be added

setFunction

public boolean setFunction(CodeGenFunction value)
Sets the function attribute of the OOGenStrategyClient object

Parameters:
value - The new function value
Returns:
No description provided

getFunction

public CodeGenFunction getFunction()
Get the function attribute of the OOGenStrategyClient object

Returns:
The function value

appendFunction

public void appendFunction(CodeGenFunction newFunction)
Append new function to the end of the responsibility chain.

Parameters:
newFunction - No description provided

insertFunction

public void insertFunction(java.lang.Class beforeFunction,
                           CodeGenFunction newFunction)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
beforeFunction - No description provided
newFunction - No description provided

removeYou

public void removeYou()
No comment provided by developer, please add a comment to improve documentation.


toString

public java.lang.String toString()
Returns:
short string representation of current object