org.vishia.java2C
Class CCodeData

java.lang.Object
  extended by org.vishia.java2C.CCodeData

public class CCodeData
extends java.lang.Object

This is a helper class to return a peace of c-code with associated type information.


Field Summary
(package private)  java.lang.String cCode
          The generated code snippet for this expression.
(package private)  int dimensionArrayOrFixSize
          0 if the value in the code snipped is scalar, 1.. if it is an array.
(package private)  FieldData identInfo
          This is the identInfo of the basicly used variable or value type ClassData.classTypeInfo.
(package private)  char modeAccess
          The access mode may be changed in comparison with identInfos, if a array element is accessed in this code snippet.
private  char returnMode
          If true, than the cCode represents a method call, which returned the same reference as used for call, it means the method returns this.
(package private)  java.lang.String sTempRef
          If true, than the cCode represents a setting of a temporary reference.
 
Constructor Summary
CCodeData(java.lang.String cCode, FieldData identInfo)
          Initializes the detail information modeAccess and dimensionArrayOrFixSize with the same values as identInfo.
CCodeData(java.lang.String cCode, FieldData identInfo, char modeAccess)
          Initializes the detail information modeAccess and dimensionArrayOrFixSize with the same values as identInfo.
CCodeData(java.lang.String cCode, FieldData identInfo, char modeAccess, char returnMode)
          Initializes the detail information modeAccess and dimensionArrayOrFixSize with the same values as identInfo.
CCodeData(java.lang.String cCode, FieldData identInfo, char modeAccess, int dimensionArray)
          Initializes the detail information modeAccess and dimensionArrayOrFixSize in a special kind.
CCodeData(java.lang.String cCode, FieldData identInfo, char modeAccess, int dimensionArray, char returnMode)
          Initializes the detail information modeAccess and dimensionArrayOrFixSize in a special kind.
 
Method Summary
 LocalIdents getClassLevelIdents()
          Returns all class level idents, if the code snipped is a reference of a class type.
(package private)  char getReturnMode()
           
 java.lang.String getTypeHeaderfilename()
          Returns the name of the Headerfile, which defines the class, if the code snipped is a reference of a class type.
 java.lang.String getTypeName()
          Returns the String representation of the type of the code snipped, detected from the identInfo and its FieldData.typeClazz.
(package private)  boolean isReturnNew()
           
(package private)  boolean isReturnThis()
           
 java.lang.String toString()
           
private  java.lang.String xxxtestAndCast(FieldData dstIdentInfo, char intension)
          Tests and generates a cast if a cast to the destination form is necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cCode

java.lang.String cCode
The generated code snippet for this expression. This information is not important for further using, only as return string in gen_-routines. Therefore it may be deleted using removeCode();


sTempRef

java.lang.String sTempRef
If true, than the cCode represents a setting of a temporary reference. The reference may be used as reference. It is the last used temporary reference. The result code should be consist of the setting of the temporary reference, with following comma separator of expressions. This strategy is used to disentangle the nesting of method calls in paramter for concatenated calls in Java.


returnMode

private final char returnMode
If true, than the cCode represents a method call, which returned the same reference as used for call, it means the method returns this. This information can be used for concatenation, the reference needn't be taken from the return value.


modeAccess

char modeAccess
The access mode may be changed in comparison with identInfos, if a array element is accessed in this code snippet. This information should be used for evaluating the kind of code snippet.


identInfo

final FieldData identInfo
This is the identInfo of the basicly used variable or value type ClassData.classTypeInfo. Therefore the information about the type of the code snipped maybe alternating,

dimensionArrayOrFixSize

final int dimensionArrayOrFixSize
0 if the value in the code snipped is scalar, 1.. if it is an array. The dimensionArrayOrFixSize may be changed in comparison with identInfos, if a array element is accessed in this code snippet. This information should be used for evaluating the kind of code snippet.

Constructor Detail

CCodeData

CCodeData(java.lang.String cCode,
          FieldData identInfo)
Initializes the detail information modeAccess and dimensionArrayOrFixSize with the same values as identInfo.

Parameters:
cCode - code snipped
identInfo - the type and access infos to the code snipped.

CCodeData

CCodeData(java.lang.String cCode,
          FieldData identInfo,
          char modeAccess)
Initializes the detail information modeAccess and dimensionArrayOrFixSize with the same values as identInfo.

Parameters:
cCode - code snipped
identInfo - the type and access infos to the code snipped.

CCodeData

CCodeData(java.lang.String cCode,
          FieldData identInfo,
          char modeAccess,
          char returnMode)
Initializes the detail information modeAccess and dimensionArrayOrFixSize with the same values as identInfo.

Parameters:
cCode - code snipped
identInfo - the type and access infos to the code snipped.

CCodeData

CCodeData(java.lang.String cCode,
          FieldData identInfo,
          char modeAccess,
          int dimensionArray)
Initializes the detail information modeAccess and dimensionArrayOrFixSize in a special kind.

Parameters:
cCode - code snipped
identInfo - the type and access infos to the code snipped.
modeAccess -
dimensionArrayOrFixSize -

CCodeData

CCodeData(java.lang.String cCode,
          FieldData identInfo,
          char modeAccess,
          int dimensionArray,
          char returnMode)
Initializes the detail information modeAccess and dimensionArrayOrFixSize in a special kind.

Parameters:
cCode - code snipped
identInfo - the type and access infos to the code snipped.
modeAccess -
dimensionArrayOrFixSize -
Method Detail

isReturnThis

boolean isReturnThis()

isReturnNew

boolean isReturnNew()

getReturnMode

char getReturnMode()

xxxtestAndCast

private java.lang.String xxxtestAndCast(FieldData dstIdentInfo,
                                        char intension)
Tests and generates a cast if a cast to the destination form is necessary.
If it is a static array, a { CONST_ObjectJc(...), fixArraySize, 0, cCode } is generated to initialize a static array.
Otherwise ClassData#testAndcast(ClassData, String, char) is called for the given FieldData.typeClazz from parameter dstIdentInfo

Parameters:
dstIdentInfo - The type of necessity appearance of the code snipped, enclosing the representation of the type.
intension - see ClassData#testAndcast(ClassData, String, char).
Returns:
The original cCode or the casted form.

getTypeName

public java.lang.String getTypeName()
Returns the String representation of the type of the code snipped, detected from the identInfo and its FieldData.typeClazz.


getClassLevelIdents

public LocalIdents getClassLevelIdents()
Returns all class level idents, if the code snipped is a reference of a class type. Especially it able to use, if the code snipped is a reference to a method or field of another class.


getTypeHeaderfilename

public java.lang.String getTypeHeaderfilename()
Returns the name of the Headerfile, which defines the class, if the code snipped is a reference of a class type. Especially it able to use, if the code snipped is a reference to a method or field of another class.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object