Commit 46ea91be authored by Malte Heithoff's avatar Malte Heithoff
Browse files

Use FileContent instead of Map.Entry<String,String>

parent 65f91e24
Pipeline #335927 passed with stage
in 1 minute and 33 seconds
...@@ -4,6 +4,8 @@ package de.monticore.lang.monticar.cnnarch.generator; ...@@ -4,6 +4,8 @@ package de.monticore.lang.monticar.cnnarch.generator;
import de.monticore.lang.monticar.cnnarch._symboltable.*; import de.monticore.lang.monticar.cnnarch._symboltable.*;
import de.monticore.lang.monticar.cnnarch.predefined.Sigmoid; import de.monticore.lang.monticar.cnnarch.predefined.Sigmoid;
import de.monticore.lang.monticar.cnnarch.predefined.Softmax; import de.monticore.lang.monticar.cnnarch.predefined.Softmax;
import de.monticore.lang.monticar.generator.FileContent;
import org.apache.commons.io.monitor.FileEntry;
import java.io.StringWriter; import java.io.StringWriter;
import java.io.Writer; import java.io.Writer;
...@@ -198,7 +200,7 @@ public abstract class CNNArchTemplateController { ...@@ -198,7 +200,7 @@ public abstract class CNNArchTemplateController {
templateConfiguration.processTemplate(ftlContext, templatePath, writer); templateConfiguration.processTemplate(ftlContext, templatePath, writer);
} }
public Map.Entry<String,String> process(String templateNameWithoutEnding, Target targetLanguage){ public FileContent process(String templateNameWithoutEnding, Target targetLanguage){
StringWriter newWriter = new StringWriter(); StringWriter newWriter = new StringWriter();
this.mainTemplateNameWithoutEnding = templateNameWithoutEnding; this.mainTemplateNameWithoutEnding = templateNameWithoutEnding;
this.targetLanguage = targetLanguage; this.targetLanguage = targetLanguage;
...@@ -207,7 +209,7 @@ public abstract class CNNArchTemplateController { ...@@ -207,7 +209,7 @@ public abstract class CNNArchTemplateController {
include("", templateNameWithoutEnding, newWriter); include("", templateNameWithoutEnding, newWriter);
String fileEnding = targetLanguage.toString(); String fileEnding = targetLanguage.toString();
String fileName = getFileNameWithoutEnding() + fileEnding; String fileName = getFileNameWithoutEnding() + fileEnding;
Map.Entry<String,String> fileContent = new AbstractMap.SimpleEntry<>(fileName, newWriter.toString()); FileContent fileContent = new FileContent(fileName, newWriter.toString());
this.mainTemplateNameWithoutEnding = null; this.mainTemplateNameWithoutEnding = null;
this.targetLanguage = null; this.targetLanguage = null;
......
...@@ -113,5 +113,5 @@ public abstract class CNNTrainGenerator { ...@@ -113,5 +113,5 @@ public abstract class CNNTrainGenerator {
public abstract void generate(Path modelsDirPath, String rootModelNames); public abstract void generate(Path modelsDirPath, String rootModelNames);
//check cocos with CNNTrainCocos.checkAll(configuration) before calling this method. //check cocos with CNNTrainCocos.checkAll(configuration) before calling this method.
public abstract Map<String, String> generateStrings(ConfigurationSymbol configuration); public abstract List<FileContent> generateStrings(ConfigurationSymbol configuration);
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment