org.vishia.java2C
Class JavaSrcTreeFile

java.lang.Object
  extended by org.vishia.java2C.JavaSrcTreeFile
All Implemented Interfaces:
JavaSources.ClassDataOrJavaSrcFile

public class JavaSrcTreeFile
extends java.lang.Object
implements JavaSources.ClassDataOrJavaSrcFile

Representation of an existing Java file.


Field Summary
private  boolean bToTranslateToC
          True if this file is to be translate.
(package private)  ClassData classData
          If set, the file is translated, the classData presents its content for foreign use.
private  java.io.File fileJava
           
private  JavaSrcTreePkg itsPkg
           
private  ConfigSrcPathPkg_ifc.Set replaceCinfo
          informations to find out where the C-file is found and which pre/suffix are valid.
private  java.lang.String sFileName
           
private  java.lang.String sFilePathC
           
private  java.lang.String sJavaSrcPath
           
private  java.lang.String sPrefixClassNameC
          Pre- and Suffixes to build the class name in C additional to the java-name of classes.
private  java.lang.String sPublicClassName
          The name of the public class of this file.
private  java.lang.String sStcPath
           
private  java.lang.String sSuffixClassNameC
          Pre- and Suffixes to build the class name in C additional to the java-name of classes.
 
Constructor Summary
JavaSrcTreeFile(JavaSrcTreePkg itsPkg, java.lang.String javaSrcPath, java.io.File fileJava, java.lang.String sFileNameJava, ConfigSrcPathPkg_ifc.Set info, java.lang.String stcPath, boolean translateToC)
          Initializes the instance.
 
Method Summary
 java.lang.String getClassCNamePrefix()
           
 java.lang.String getClassCNameSuffix()
           
 ClassData getClassData()
          returns nullif the file is not translated, returns the ClassData if it is translated.
 java.io.File getFileJava()
           
 java.lang.String getFileNameC()
           
 JavaSrcTreePkg getJavaPkg()
          Implements JavaSources.ClassDataOrJavaSrcFile.getJavaPkg()
 JavaSrcTreeFile getJavaSrc()
          returns the instance because it is.
private  java.lang.String getJavaSrcPathInfo()
          Returns the source path where the file is found.
 LocalIdents getLocalIdents(java.lang.String sClassName)
          Gets the local idents of the givenclass of the file.
 LocalIdents getPkgLevelTypes()
           
 java.lang.String getPkgPath()
           
 java.lang.String getPublicClassName()
           
 ConfigSrcPathPkg_ifc.Set getReplaceCinfo()
          Returns the informations to find out where the C-file is found and which pre/suffix are valid.
 java.lang.String getStcPath()
           
 java.lang.String getTypeName()
          Implements JavaSources.ClassDataOrJavaSrcFile.getTypeName()
(package private)  void infoSecondFile(java.io.File fileJava, boolean shouldTranslated)
           
 boolean isToTranslate()
          Returns true if the translation from Java is set.
 boolean isTranslated()
           
 void setClassData(ClassData data)
           
 void setToTranslate(java.io.File fileJava)
           
 java.lang.String toString()
           
 LocalIdents xxxgetLocalIdents()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sFileName

private final java.lang.String sFileName

sPublicClassName

private final java.lang.String sPublicClassName
The name of the public class of this file. In Java only one class can be public in a file.


sJavaSrcPath

private final java.lang.String sJavaSrcPath

sPrefixClassNameC

private final java.lang.String sPrefixClassNameC
Pre- and Suffixes to build the class name in C additional to the java-name of classes.


sSuffixClassNameC

private final java.lang.String sSuffixClassNameC
Pre- and Suffixes to build the class name in C additional to the java-name of classes.


sStcPath

private final java.lang.String sStcPath

sFilePathC

private final java.lang.String sFilePathC

itsPkg

private final JavaSrcTreePkg itsPkg

fileJava

private java.io.File fileJava

bToTranslateToC

private boolean bToTranslateToC
True if this file is to be translate.


replaceCinfo

private final ConfigSrcPathPkg_ifc.Set replaceCinfo
informations to find out where the C-file is found and which pre/suffix are valid.


classData

ClassData classData
If set, the file is translated, the classData presents its content for foreign use.

Constructor Detail

JavaSrcTreeFile

public JavaSrcTreeFile(JavaSrcTreePkg itsPkg,
                       java.lang.String javaSrcPath,
                       java.io.File fileJava,
                       java.lang.String sFileNameJava,
                       ConfigSrcPathPkg_ifc.Set info,
                       java.lang.String stcPath,
                       boolean translateToC)
Initializes the instance.

Parameters:
itsPkg - The package where the file is member of.
javaSrcPath - The source path where the file is found first time.
fileJava - The File instance ready to open source file.
sFileNameJava - The file name without path but with extension .java without directories.
prefixCFile - The prefix to build the C class name and the C file name. The part after the last slash / is the prefix for class names. The prefix should ended with slash if the file name has no prefix, but a path to store the to create *.c and *.h files are given. The prefix may contain "".
If the prefix is null, the param suffixCFile contains the complete C-File-name. This is only possible for Files, which are not translated from Java2C, but it is parsed their stc-File. In this case the stc-File contains the valid struct names for C. No or suffix is necessary than.
suffixCFile - The suffix to build the C class name and the C file name.
prefixNames -
suffixNames -
stcPath - null or a special path where the stc-file is located.
translateToC - false than the file should not be translate to C, instead the stc-file should be used any time. This is if it is a standard class or a users class, which is located in a library.
Method Detail

getClassData

public ClassData getClassData()
returns nullif the file is not translated, returns the ClassData if it is translated.

Specified by:
getClassData in interface JavaSources.ClassDataOrJavaSrcFile
See Also:
JavaSources.ClassDataOrJavaSrcFile.getClassData()

getJavaSrc

public JavaSrcTreeFile getJavaSrc()
returns the instance because it is.

Specified by:
getJavaSrc in interface JavaSources.ClassDataOrJavaSrcFile
See Also:
JavaSources.ClassDataOrJavaSrcFile.getJavaSrc()

infoSecondFile

void infoSecondFile(java.io.File fileJava,
                    boolean shouldTranslated)
Parameters:
fileJava -

getStcPath

public java.lang.String getStcPath()

getPublicClassName

public java.lang.String getPublicClassName()

getPkgLevelTypes

public LocalIdents getPkgLevelTypes()

getFileNameC

public java.lang.String getFileNameC()

getJavaSrcPathInfo

private java.lang.String getJavaSrcPathInfo()
Returns the source path where the file is found. It is only a info, where the file comes from, not to process.


toString

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

getPkgPath

public java.lang.String getPkgPath()

getClassCNamePrefix

public java.lang.String getClassCNamePrefix()

getClassCNameSuffix

public java.lang.String getClassCNameSuffix()

setClassData

public void setClassData(ClassData data)
Specified by:
setClassData in interface JavaSources.ClassDataOrJavaSrcFile

isToTranslate

public boolean isToTranslate()
Description copied from interface: JavaSources.ClassDataOrJavaSrcFile
Returns true if the translation from Java is set. It doesn't mean that it should be translated any time, the necessity of translation depends on the time stamps of Java- and C-files. But the Java-File have to be existing.

Specified by:
isToTranslate in interface JavaSources.ClassDataOrJavaSrcFile
Returns:
false if always the stc-File is to be read, or it is a ClassData.

setToTranslate

public void setToTranslate(java.io.File fileJava)

isTranslated

public boolean isTranslated()

getFileJava

public final java.io.File getFileJava()

xxxgetLocalIdents

public LocalIdents xxxgetLocalIdents()

getLocalIdents

public LocalIdents getLocalIdents(java.lang.String sClassName)
Gets the local idents of the givenclass of the file. The file may be translated or not. If it isn't translated, it will be translated now respectively the structure-file (stc) is translated.

Specified by:
getLocalIdents in interface JavaSources.ClassDataOrJavaSrcFile
Parameters:
sClassName - name of the class in file, it may the public class or another one. implements JavaSources.ClassDataOrJavaSrcFile.getLocalIdents(java.lang.String)
Returns:
Especially list of all types in the element. If it is a package, the types may be the files in the package or sub-packages.

getJavaPkg

public JavaSrcTreePkg getJavaPkg()
Implements JavaSources.ClassDataOrJavaSrcFile.getJavaPkg()

Specified by:
getJavaPkg in interface JavaSources.ClassDataOrJavaSrcFile

getTypeName

public java.lang.String getTypeName()
Implements JavaSources.ClassDataOrJavaSrcFile.getTypeName()

Specified by:
getTypeName in interface JavaSources.ClassDataOrJavaSrcFile

getReplaceCinfo

public ConfigSrcPathPkg_ifc.Set getReplaceCinfo()
Description copied from interface: JavaSources.ClassDataOrJavaSrcFile
Returns the informations to find out where the C-file is found and which pre/suffix are valid.

Specified by:
getReplaceCinfo in interface JavaSources.ClassDataOrJavaSrcFile
Returns:
null if there are not such informations. That is especially for super-paths.