com.unitesk.atp.treedl
Class JavaNodeGenerator

java.lang.Object
  extended by com.unitesk.atp.tree.generation.TextGeneratorClient
      extended by com.unitesk.atp.tree.generation.TextGeneratorVisitor
          extended by com.unitesk.atp.treedl.TextGenerator
              extended by com.unitesk.atp.treedl.JavaTextGenerator
                  extended by com.unitesk.atp.treedl.JavaNodeGenerator
All Implemented Interfaces:
Function, Generator, Plugin, TextGenerator, Visitor, TDL.TDL_Visitor
Direct Known Subclasses:
Java5TextGenerator

public class JavaNodeGenerator
extends JavaTextGenerator
implements TDL.TDL_Visitor

Version:
$Id: JavaNodeGenerator.java,v 1.68 2006/02/16 11:19:49 all-x Exp $
Author:
Alexey Demakov

Nested Class Summary
 
Nested classes/interfaces inherited from class com.unitesk.atp.treedl.JavaTextGenerator
JavaTextGenerator.ElementObjectTypeFunction, JavaTextGenerator.ElementTypeFunction, JavaTextGenerator.NameFunction, JavaTextGenerator.PredefinedTypeNameFunction
 
Field Summary
static String DEFAULT_ATTRIBUTE_BOOL_IS
           
static String DEFAULT_ATTRIBUTE_CHECK_NULL
           
static String DEFAULT_ATTRIBUTE_CHECK_SETONCE
           
static String DEFAULT_ATTRIBUTE_CHECK_SIZE
           
static String DEFAULT_ATTRIBUTE_ENUM_CHECK
           
static String DEFAULT_ATTRIBUTE_LIST_ADD
           
static String DEFAULT_ATTRIBUTE_LIST_GET
           
static String DEFAULT_ATTRIBUTE_LIST_MAX
           
static String DEFAULT_ATTRIBUTE_LIST_MIN
           
static String DEFAULT_ATTRIBUTE_LIST_REMOVE
           
static String DEFAULT_ATTRIBUTE_LIST_SIZE
           
static String DEFAULT_NODE_CLASS
           
static String DEFAULT_NODE_DEFAULT_CONSTRUCTOR
           
static String DEFAULT_OPERATION_PUBLIC
           
static String DEFAULT_OPERATION_STATIC
           
static String DEFAULT_SMAP_GENERATE
           
static String PROPERTY_ATTRIBUTE_BOOL_IS
           
static String PROPERTY_ATTRIBUTE_CHECK_NULL
           
static String PROPERTY_ATTRIBUTE_CHECK_SETONCE
           
static String PROPERTY_ATTRIBUTE_CHECK_SIZE
           
static String PROPERTY_ATTRIBUTE_ENUM_CHECK
           
static String PROPERTY_ATTRIBUTE_LIST_ADD
           
static String PROPERTY_ATTRIBUTE_LIST_GET
           
static String PROPERTY_ATTRIBUTE_LIST_MAX
           
static String PROPERTY_ATTRIBUTE_LIST_MIN
           
static String PROPERTY_ATTRIBUTE_LIST_REMOVE
           
static String PROPERTY_ATTRIBUTE_LIST_SIZE
           
static String PROPERTY_NODE_CLASS
           
static String PROPERTY_NODE_DEFAULT_CONSTRUCTOR
           
static String PROPERTY_OPERATION_PUBLIC
           
static String PROPERTY_OPERATION_STATIC
           
static String PROPERTY_SMAP_GENERATE
           
protected  PrintWriter smap
           
 
Fields inherited from class com.unitesk.atp.treedl.TextGenerator
mbox, module, name, pm, positionFilter
 
Fields inherited from class com.unitesk.atp.tree.generation.TextGeneratorClient
server
 
Fields inherited from interface com.unitesk.atp.tree.generation.TextGenerator
endl
 
Fields inherited from interface com.unitesk.atp.text.generation.Generator
DEFAULT_NAME
 
Constructor Summary
JavaNodeGenerator()
           
 
Method Summary
protected  void closeSmap()
           
protected  void generateCall(TDL.OperationDecl operationDecl, ParameterVariantMatrix paramMatrix, Index paramIndex)
          Generate variant call.
protected  void generateCaseCode(TDL.OperationDecl operationDecl, ParameterVariantMatrix paramMatrix, Index paramIndex)
          Generate case code for the given variant.
protected  void generateEnumCheck(TDL.Field node)
          check( int ) for the first attribute of constant type
protected  void generateEnumSwitch(TDL.OperationDecl operationDecl, int index, ParameterVariantMatrix paramMatrix, Index paramIndex)
          Generate switch by enum type of virtual parameter
protected  void generateKeyClassSwitch(TDL.OperationDecl operationDecl, int index, Index moduleIndex)
          Generate switch (if-else-if) by key class of virtual parameter
protected  void generateKeySwitch(TDL.OperationDecl operationDecl, int index, ParameterVariantMatrix paramMatrix, Index paramIndex)
          Generate switch by key of virtual parameter
protected  void generateListCheck(String min, String max)
           
protected  void generateVariants(TDL.OperationDecl operationDecl, ParameterVariantMatrix paramMatrix)
          Generate variant methods for all combinations of virtual node types parameters
 String getVersion()
          
protected  void openSmap()
           
protected  void putMapping(int inputLine, int outputLine, int repeatCount)
           
 void visitBaseModule(TDL.BaseModule node)
           
 void visitBodyCodeMember(TDL.BodyCodeMember node)
           
 void visitCase(TDL.Case node)
           
 void visitCaseSignature(TDL.CaseSignature node)
           
 void visitConstructorCodeMember(TDL.ConstructorCodeMember node)
           
 void visitConstTypeDecl(TDL.ConstTypeDecl node)
           
 void visitField(TDL.Field node)
           
 void visitModule(TDL.Module node)
           
 void visitNodeTypeDecl(TDL.NodeTypeDecl node)
           
 void visitNonVirtualParameterDecl(TDL.NonVirtualParameterDecl node)
           
 void visitOperationDecl(TDL.OperationDecl node)
           
 void visitParameter(TDL.Parameter node)
           
 void visitVirtualParameterDecl(TDL.VirtualParameterDecl node)
           
 
Methods inherited from class com.unitesk.atp.treedl.JavaTextGenerator
block_nl, block, generateHeader, getOutFileName, setOutDir, unblock_nl, unblock, visitCode, visitID, visitNameType, visitNodeType, visitOperationRef, visitPredefinedType, visitQID, visitTypeRef
 
Methods inherited from class com.unitesk.atp.treedl.TextGenerator
addImplementedInterface, getActionName, getBaseClassName, getBooleanProperty, getColumn, getImplementedInterfaceList, getKind, getLine, getModule, getName, getOutClassName, getOutFile, getPlugin, getPluginManager, getProperty, getProperty, getProperty, getPropertyName, init, process, setActionName, setBaseClassName, setOutClassName, setOutFile, setPositionFilter
 
Methods inherited from class com.unitesk.atp.tree.generation.TextGeneratorVisitor
visit
 
Methods inherited from class com.unitesk.atp.tree.generation.TextGeneratorClient
decIndent, getFunction, getIndent, getNode, getVariable, incIndent, list, nl, popIndent, popNode, process, pushIndent, pushNode, setFunction, setGenerator, setVariable, txt, txtAsIs, txtif, txtif, txtif, txtif
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.unitesk.atp.treedl.TDL.TDL_Visitor
visitCode, visitID, visitNameType, visitNodeType, visitOperationRef, visitPredefinedType, visitQID, visitTypeRef
 

Field Detail

smap

protected PrintWriter smap

PROPERTY_NODE_CLASS

public static final String PROPERTY_NODE_CLASS
See Also:
Constant Field Values

DEFAULT_NODE_CLASS

public static final String DEFAULT_NODE_CLASS
See Also:
Constant Field Values

PROPERTY_SMAP_GENERATE

public static final String PROPERTY_SMAP_GENERATE
See Also:
Constant Field Values

DEFAULT_SMAP_GENERATE

public static final String DEFAULT_SMAP_GENERATE
See Also:
Constant Field Values

PROPERTY_NODE_DEFAULT_CONSTRUCTOR

public static final String PROPERTY_NODE_DEFAULT_CONSTRUCTOR
See Also:
Constant Field Values

DEFAULT_NODE_DEFAULT_CONSTRUCTOR

public static final String DEFAULT_NODE_DEFAULT_CONSTRUCTOR
See Also:
Constant Field Values

PROPERTY_ATTRIBUTE_CHECK_SETONCE

public static final String PROPERTY_ATTRIBUTE_CHECK_SETONCE
See Also:
Constant Field Values

DEFAULT_ATTRIBUTE_CHECK_SETONCE

public static final String DEFAULT_ATTRIBUTE_CHECK_SETONCE
See Also:
Constant Field Values

PROPERTY_ATTRIBUTE_CHECK_NULL

public static final String PROPERTY_ATTRIBUTE_CHECK_NULL
See Also:
Constant Field Values

DEFAULT_ATTRIBUTE_CHECK_NULL

public static final String DEFAULT_ATTRIBUTE_CHECK_NULL
See Also:
Constant Field Values

PROPERTY_ATTRIBUTE_CHECK_SIZE

public static final String PROPERTY_ATTRIBUTE_CHECK_SIZE
See Also:
Constant Field Values

DEFAULT_ATTRIBUTE_CHECK_SIZE

public static final String DEFAULT_ATTRIBUTE_CHECK_SIZE
See Also:
Constant Field Values

PROPERTY_ATTRIBUTE_BOOL_IS

public static final String PROPERTY_ATTRIBUTE_BOOL_IS
See Also:
Constant Field Values

DEFAULT_ATTRIBUTE_BOOL_IS

public static final String DEFAULT_ATTRIBUTE_BOOL_IS
See Also:
Constant Field Values

PROPERTY_ATTRIBUTE_LIST_ADD

public static final String PROPERTY_ATTRIBUTE_LIST_ADD
See Also:
Constant Field Values

DEFAULT_ATTRIBUTE_LIST_ADD

public static final String DEFAULT_ATTRIBUTE_LIST_ADD
See Also:
Constant Field Values

PROPERTY_ATTRIBUTE_LIST_REMOVE

public static final String PROPERTY_ATTRIBUTE_LIST_REMOVE
See Also:
Constant Field Values

DEFAULT_ATTRIBUTE_LIST_REMOVE

public static final String DEFAULT_ATTRIBUTE_LIST_REMOVE
See Also:
Constant Field Values

PROPERTY_ATTRIBUTE_LIST_SIZE

public static final String PROPERTY_ATTRIBUTE_LIST_SIZE
See Also:
Constant Field Values

DEFAULT_ATTRIBUTE_LIST_SIZE

public static final String DEFAULT_ATTRIBUTE_LIST_SIZE
See Also:
Constant Field Values

PROPERTY_ATTRIBUTE_LIST_GET

public static final String PROPERTY_ATTRIBUTE_LIST_GET
See Also:
Constant Field Values

DEFAULT_ATTRIBUTE_LIST_GET

public static final String DEFAULT_ATTRIBUTE_LIST_GET
See Also:
Constant Field Values

PROPERTY_ATTRIBUTE_LIST_MIN

public static final String PROPERTY_ATTRIBUTE_LIST_MIN
See Also:
Constant Field Values

DEFAULT_ATTRIBUTE_LIST_MIN

public static final String DEFAULT_ATTRIBUTE_LIST_MIN
See Also:
Constant Field Values

PROPERTY_ATTRIBUTE_LIST_MAX

public static final String PROPERTY_ATTRIBUTE_LIST_MAX
See Also:
Constant Field Values

DEFAULT_ATTRIBUTE_LIST_MAX

public static final String DEFAULT_ATTRIBUTE_LIST_MAX
See Also:
Constant Field Values

PROPERTY_ATTRIBUTE_ENUM_CHECK

public static final String PROPERTY_ATTRIBUTE_ENUM_CHECK
See Also:
Constant Field Values

DEFAULT_ATTRIBUTE_ENUM_CHECK

public static final String DEFAULT_ATTRIBUTE_ENUM_CHECK
See Also:
Constant Field Values

PROPERTY_OPERATION_PUBLIC

public static final String PROPERTY_OPERATION_PUBLIC
See Also:
Constant Field Values

DEFAULT_OPERATION_PUBLIC

public static final String DEFAULT_OPERATION_PUBLIC
See Also:
Constant Field Values

PROPERTY_OPERATION_STATIC

public static final String PROPERTY_OPERATION_STATIC
See Also:
Constant Field Values

DEFAULT_OPERATION_STATIC

public static final String DEFAULT_OPERATION_STATIC
See Also:
Constant Field Values
Constructor Detail

JavaNodeGenerator

public JavaNodeGenerator()
Method Detail

getVersion

public String getVersion()

Specified by:
getVersion in interface Plugin

openSmap

protected void openSmap()

closeSmap

protected void closeSmap()

putMapping

protected void putMapping(int inputLine,
                          int outputLine,
                          int repeatCount)

visitModule

public void visitModule(TDL.Module node)
Specified by:
visitModule in interface TDL.TDL_Visitor

visitBaseModule

public void visitBaseModule(TDL.BaseModule node)
Specified by:
visitBaseModule in interface TDL.TDL_Visitor

visitConstTypeDecl

public void visitConstTypeDecl(TDL.ConstTypeDecl node)
Specified by:
visitConstTypeDecl in interface TDL.TDL_Visitor

visitNodeTypeDecl

public void visitNodeTypeDecl(TDL.NodeTypeDecl node)
Specified by:
visitNodeTypeDecl in interface TDL.TDL_Visitor

visitConstructorCodeMember

public void visitConstructorCodeMember(TDL.ConstructorCodeMember node)
Specified by:
visitConstructorCodeMember in interface TDL.TDL_Visitor

visitBodyCodeMember

public void visitBodyCodeMember(TDL.BodyCodeMember node)
Specified by:
visitBodyCodeMember in interface TDL.TDL_Visitor

visitField

public void visitField(TDL.Field node)
Specified by:
visitField in interface TDL.TDL_Visitor

generateListCheck

protected void generateListCheck(String min,
                                 String max)

generateEnumCheck

protected void generateEnumCheck(TDL.Field node)
check( int ) for the first attribute of constant type


generateVariants

protected void generateVariants(TDL.OperationDecl operationDecl,
                                ParameterVariantMatrix paramMatrix)
Generate variant methods for all combinations of virtual node types parameters

Parameters:
operationDecl - operation declaration to generate variants for
paramMatrix - matrix to generate variants for

generateCaseCode

protected void generateCaseCode(TDL.OperationDecl operationDecl,
                                ParameterVariantMatrix paramMatrix,
                                Index paramIndex)
Generate case code for the given variant.


generateCall

protected void generateCall(TDL.OperationDecl operationDecl,
                            ParameterVariantMatrix paramMatrix,
                            Index paramIndex)
Generate variant call.


generateEnumSwitch

protected void generateEnumSwitch(TDL.OperationDecl operationDecl,
                                  int index,
                                  ParameterVariantMatrix paramMatrix,
                                  Index paramIndex)
Generate switch by enum type of virtual parameter

Parameters:
index - index of virtual parameter

generateKeySwitch

protected void generateKeySwitch(TDL.OperationDecl operationDecl,
                                 int index,
                                 ParameterVariantMatrix paramMatrix,
                                 Index paramIndex)
Generate switch by key of virtual parameter

Parameters:
index - index of virtual parameter

generateKeyClassSwitch

protected void generateKeyClassSwitch(TDL.OperationDecl operationDecl,
                                      int index,
                                      Index moduleIndex)
Generate switch (if-else-if) by key class of virtual parameter

Parameters:
index - index of virtual parameter

visitOperationDecl

public void visitOperationDecl(TDL.OperationDecl node)
Specified by:
visitOperationDecl in interface TDL.TDL_Visitor

visitNonVirtualParameterDecl

public void visitNonVirtualParameterDecl(TDL.NonVirtualParameterDecl node)
Specified by:
visitNonVirtualParameterDecl in interface TDL.TDL_Visitor

visitVirtualParameterDecl

public void visitVirtualParameterDecl(TDL.VirtualParameterDecl node)
Specified by:
visitVirtualParameterDecl in interface TDL.TDL_Visitor

visitCase

public void visitCase(TDL.Case node)
Specified by:
visitCase in interface TDL.TDL_Visitor

visitCaseSignature

public void visitCaseSignature(TDL.CaseSignature node)
Specified by:
visitCaseSignature in interface TDL.TDL_Visitor

visitParameter

public void visitParameter(TDL.Parameter node)
Specified by:
visitParameter in interface TDL.TDL_Visitor


Copyright © 2001-2006 ISP RAS, RedVerst Group. All Rights Reserved.