|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--openjava.mop.OJClass | +--PremChaRM.PremChaRM
This class represents the OpenJava Preprocessor for a class containing the mChaRM mechanism.
Its role is to translate the OpenJava class who instantiates it (which is a class written
in an extended syntax of java) into three pure-java classes. The whole class contains methods
and objects representing the mChaRM objects
Field Summary | |
private static int |
CLASSNAME
This constant represent name class. it is an index of memory structure that contains information about index classes |
private static int |
CORE
This constant represent the core. |
private OJMethod[] |
coreMethods
This array contains all methods of create Core class. |
private static int |
ENRICHNAME
This constant represent the enriches clause. |
private ObjectList |
ExtendedSyntax
This variable contains the parse tree reapresentanting the extedend syntax. |
private boolean |
firstTime
During a process that translate class that contains main, is possible that in several situation the programm need information contained in OJMI, this flag used in combination of function HandleFirstTime( String ) permitt to access to information only one time. |
private boolean[] |
isDefined
Every cell of array meaning that relative output Class is defined. |
private static int |
KIND
This constant represent the kind. |
private static java.lang.String[] |
NAME_BASE_CLASSES
This array of constant contains the names of base classes. |
private static java.lang.String[] |
NAME_START_METHODS
This array of constant contains the names of the base methods. |
private OJField[] |
ojFields
This variable contains all fields of starting class. |
private PreGraph |
ojGraph
Instance of Graph, is used to check the consistence of an access to fields. |
private java.util.Vector |
ojMethods
This Vector contains all the method declared in base class |
private java.util.Vector |
ojMethodsCore
This Vector contains the method of hierarchy of the Core. |
private java.util.Vector |
ojMethodsReceiver
This Vector contains the method of hierarchy of the Receiver. |
private java.util.Vector |
ojMethodsSender
This Vector contains the method of hierarchy of the Sender. |
private java.lang.String[] |
OJMIclassNames
This array contains name of output class create during a translating process. |
private OJSubClass |
ojsCore
This OJSubClass contains, if present, the new class CORE |
private OJSubClass |
ojsReceiver
This OJSubClass contains, if present, the new class RECEIVER |
private OJSubClass |
ojsSender
This OJSubClass contains, if present, the new class SENDER |
private static int |
PROVIDESNAME
This constant represent the provides clause. |
private static int |
RECEIVER
This constant represent the receiver. |
private static int |
SENDER
This constant represent the sender. |
Fields inherited from class openjava.mop.OJClass |
substance |
Constructor Summary | |
PremChaRM(java.lang.Class oj_param0,
MetaInfo oj_param1)
|
|
PremChaRM(Environment oj_param0,
OJClass oj_param1,
ClassDeclaration oj_param2)
|
Method Summary | |
private java.util.Vector |
cascadeMethods(OJClass ojClass)
This method return all method declared in a class hierarchy. |
private void |
changeReferenceExpr(Expression call,
Environment env)
This method do a recursive parsing to find typeName to change. |
Expression |
expandAllocation(Environment env,
AllocationExpression expr)
This method is invoked on every AllocationExpression instance of start class. |
Expression |
expandMethodCall(Environment env,
MethodCall call)
This method is invoked on every MethodCall instance of start class not tested yet. |
TypeName |
expandTypeName(Environment env,
TypeName type)
This method is invoked on every TypeName instance of start class. |
Statement |
expandVariableDeclaration(Environment env,
VariableDeclaration var)
This method is invoked on every VariableDeclaration instance of start class. |
static SyntaxRule |
getDeclSuffixRule(java.lang.String keyword)
Function predefined in OJClass, is used to get a parse tree of added syntax. |
void |
HandleFirstTime(java.lang.String expr)
This method takes the info in OJMI file of sterting class. |
private void |
insertConstructorMethods(int className)
This method finds particulary methods representing constructors. |
private void |
insertLateBindingMethods(int className)
This method find methods, in start class, that override someone else in hierarchy class specified by className. |
private void |
insertMethodsFrom(OJMethod ojMethod,
int className)
This method insert in graph the starting method and all method called in. |
static boolean |
isRegisteredKeyword(java.lang.String keyword)
Function predefined in OJClass, is used to check if the keyword present in added syntax regard current OJClass |
OJMethod |
methodCall2OJMethod(MethodCall mcMethod,
Environment environment)
This method perform the translation of MethodCall into OJMethod. |
void |
openClasses()
This method create the output class. |
java.lang.String[] |
parseConstr(java.lang.String constr)
|
java.lang.String |
parseConstr(java.util.StringTokenizer strToken,
char stop)
|
private void |
prepareClasses()
This method makes two different works: first, it initializes the three output classes inserting import clauses and the relative constructor; then it creates graphs for methods and fields, finally inserts right fields and methods in relative class. |
private void |
prepareMainClass()
This method delete main class and add three instance of the generated classes. |
private void |
printClasses()
This method write on file the code of the three classes if they are defining. |
void |
translateDefinition()
This is the starting point of pre-compiling. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static final int KIND
private static final int CORE
private static final int SENDER
private static final int RECEIVER
private static final int CLASSNAME
private static final int ENRICHNAME
private static final int PROVIDESNAME
private static final java.lang.String[] NAME_START_METHODS
private static final java.lang.String[] NAME_BASE_CLASSES
private OJSubClass ojsCore
private OJSubClass ojsSender
private OJSubClass ojsReceiver
private java.util.Vector ojMethods
private java.util.Vector ojMethodsCore
private java.util.Vector ojMethodsSender
private java.util.Vector ojMethodsReceiver
private OJMethod[] coreMethods
private java.lang.String[] OJMIclassNames
private PreGraph ojGraph
private ObjectList ExtendedSyntax
private OJField[] ojFields
private boolean[] isDefined
private boolean firstTime
Constructor Detail |
public PremChaRM(Environment oj_param0, OJClass oj_param1, ClassDeclaration oj_param2)
public PremChaRM(java.lang.Class oj_param0, MetaInfo oj_param1)
Method Detail |
public static boolean isRegisteredKeyword(java.lang.String keyword)
keyword
- String that must be checkpublic static SyntaxRule getDeclSuffixRule(java.lang.String keyword)
keyword
- start String of added syntaxpublic void openClasses()
private void prepareClasses()
private java.util.Vector cascadeMethods(OJClass ojClass)
ojClass
- Class whom find methodsprivate void insertConstructorMethods(int className)
className
- name of class where it search the overridden methodspublic java.lang.String[] parseConstr(java.lang.String constr)
public java.lang.String parseConstr(java.util.StringTokenizer strToken, char stop)
private void insertLateBindingMethods(int className)
className
- name of class where it search the overridden methodsprivate void insertMethodsFrom(OJMethod ojMethod, int className)
ojMethod
- starting method to find all methods invoked in.className
- name of class that contains starting methodpublic OJMethod methodCall2OJMethod(MethodCall mcMethod, Environment environment)
mcMethod
- MethodCall to translate in OJMethodenvironment
- current Environmentprivate void prepareMainClass()
private void printClasses()
public void translateDefinition()
public Statement expandVariableDeclaration(Environment env, VariableDeclaration var)
env
- current Environmentvar
- current VariableDeclarationpublic TypeName expandTypeName(Environment env, TypeName type)
env
- current Environmenttype
- current TypeNamepublic Expression expandAllocation(Environment env, AllocationExpression expr)
env
- current Environmentexpr
- current AllocationExpressionpublic Expression expandMethodCall(Environment env, MethodCall call)
env
- current Environmentcall
- current MethodCallpublic void HandleFirstTime(java.lang.String expr)
expr
- string representig the Core nameprivate void changeReferenceExpr(Expression call, Environment env)
call
- Expressionenv
- current Environment
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |