Class FWSimComponentGroupCodeGen

java.lang.Object
net.simplace.sim.model.FWSimComponentGroupCodeGen

public class FWSimComponentGroupCodeGen extends Object
Code generator for component groups: creates the Java class of a FWSimComponentGroup and its group configuration file (.grp.xml) from an AMEI-style model composition (description plus input, internal and output links). The files are written into the source folder of simplace_modules, using the templates codegen/FWSimComponentGroup.javatemplate and .xmltemplate from the class path.
Author:
Andreas Enders
  • Constructor Details

    • FWSimComponentGroupCodeGen

      public FWSimComponentGroupCodeGen() throws Exception
      Creates the generator: determines the source folder of simplace_modules relative to the template location and loads the templates.
      Throws:
      Exception - if the templates cannot be found or the source folder does not exist
  • Method Details

    • generateCodeAmeiXML

      public String generateCodeAmeiXML(org.jdom2.Element aConfigElement, org.jdom2.Element aComposition, String aSourcePath, HashMap<String,String> aClassNameMap)
      Generates and writes the Java class and the group configuration file of a component group.
      Parameters:
      aConfigElement - model unit element with attributes name (class name), id (package) and a Description child (Authors, Institution, Reference, Abstract)
      aComposition - element with the InputLink, InternalLink and OutputLink children
      aSourcePath - not used
      aClassNameMap - map from member id to member class name
      Returns:
      the content of the generated Java class
    • writeCodeToFile

      public String writeCodeToFile(String aContentOfFile)
      Writes the generated Java code to the Java file. Errors are logged.
      Parameters:
      aContentOfFile - the Java code
      Returns:
      the full class name