refactoring

This commit is contained in:
rusefillc 2023-01-06 10:42:44 -05:00
parent 95e06434fd
commit c29bdac23a
25 changed files with 125 additions and 85 deletions

View File

@ -1,7 +1,6 @@
package com.rusefi;
import com.rusefi.newparse.ParseState;
import com.rusefi.newparse.parsing.Definition;
import com.rusefi.output.*;
import com.rusefi.trigger.TriggerWheelTSLogic;
import com.rusefi.util.SystemOut;
@ -111,7 +110,7 @@ public class ConfigDefinition {
String cppFile = args[i + 1];
String mdFile = args[i + 2];
i++;
state.destinations.add(new GetConfigValueConsumer(cppFile, mdFile));
state.addDestination(new GetConfigValueConsumer(cppFile, mdFile));
}
break;
case "-readfile":
@ -119,7 +118,7 @@ public class ConfigDefinition {
// yes, we take three parameters here thus pre-increment!
String fileName = args[++i + 1];
try {
state.variableRegistry.register(keyName, IoUtil2.readFile(fileName));
state.getVariableRegistry().register(keyName, IoUtil2.readFile(fileName));
} catch (RuntimeException e) {
throw new IllegalStateException("While processing " + fileName, e);
}
@ -136,7 +135,7 @@ public class ConfigDefinition {
break;
case KEY_SIGNATURE:
signaturePrependFile = args[i + 1];
state.prependFiles.add(args[i + 1]);
state.getPrependFiles().add(args[i + 1]);
// don't add this file to the 'inputFiles'
break;
case KEY_SIGNATURE_DESTINATION:
@ -146,7 +145,7 @@ public class ConfigDefinition {
enumInputFiles.add(args[i + 1]);
break;
case "-ts_output_name":
state.tsFileOutputName = args[i + 1];
state.setTsFileOutputName(args[i + 1]);
break;
case KEY_BOARD_NAME:
String boardName = args[i + 1];
@ -177,12 +176,12 @@ public class ConfigDefinition {
FirmwareVersion uniqueId = new FirmwareVersion(IoUtil2.getCrc32(state.getInputFiles()));
SignatureConsumer.storeUniqueBuildId(state, parseState, tsInputFileFolder, uniqueId);
ExtraUtil.handleFiringOrder(firingEnumFileName, state.variableRegistry, parseState);
ExtraUtil.handleFiringOrder(firingEnumFileName, state.getVariableRegistry(), parseState);
new TriggerWheelTSLogic().execute(triggersInputFolder, state.variableRegistry);
new TriggerWheelTSLogic().execute(triggersInputFolder, state.getVariableRegistry());
if (pinoutLogic != null) {
pinoutLogic.registerBoardSpecificPinNames(state.variableRegistry, state, parseState);
pinoutLogic.registerBoardSpecificPinNames(state.getVariableRegistry(), state, parseState);
}
// Parse the input files
@ -192,7 +191,7 @@ public class ConfigDefinition {
// Ignore duplicates of definitions made during prepend phase
// parseState.setDefinitionPolicy(Definition.OverwritePolicy.IgnoreNew);
for (String prependFile : state.prependFiles) {
for (String prependFile : state.getPrependFiles()) {
// RusefiParseErrorStrategy.parseDefinitionFile(parseState.getListener(), prependFile);
}
}
@ -219,25 +218,25 @@ public class ConfigDefinition {
* we have '-readfile OUTPUTS_SECTION' in one of .sh files in order to template rusefi.input
* Same with '-readfile DATALOG_SECTION'
*/
state.destinations.add(new GaugeConsumer(tsOutputsDestination + File.separator + "generated/gauges.ini"));
state.addDestination(new GaugeConsumer(tsOutputsDestination + File.separator + "generated/gauges.ini"));
}
if (tsInputFileFolder != null) {
state.destinations.add(new TSProjectConsumer(tsInputFileFolder, state));
state.addDestination(new TSProjectConsumer(tsInputFileFolder, state));
VariableRegistry tmpRegistry = new VariableRegistry();
// store the CRC32 as a built-in variable
tmpRegistry.register(SIGNATURE_HASH, uniqueId.encode());
tmpRegistry.readPrependValues(signaturePrependFile);
state.destinations.add(new SignatureConsumer(signatureDestination, tmpRegistry));
state.addDestination(new SignatureConsumer(signatureDestination, tmpRegistry));
}
if (state.destinations.isEmpty())
if (state.isDestinationsEmpty())
throw new IllegalArgumentException("No destinations specified");
state.doJob();
if (destCDefinesFileName != null) {
ExtraUtil.writeDefinesToFile(state.variableRegistry, destCDefinesFileName, state.definitionInputFile);
ExtraUtil.writeDefinesToFile(state.getVariableRegistry(), destCDefinesFileName, state.getDefinitionInputFile());
}
}
}

View File

@ -89,7 +89,7 @@ public class ConfigField {
this.type = type;
this.arraySizeVariableName = arraySizeAsText;
this.arraySizes = arraySizes;
this.tsInfo = tsInfo == null ? null : state.variableRegistry.applyVariables(tsInfo);
this.tsInfo = tsInfo == null ? null : state.getVariableRegistry().applyVariables(tsInfo);
this.isIterate = isIterate;
if (tsInfo != null) {
String[] tokens = getTokens();
@ -116,7 +116,7 @@ public class ConfigField {
}
public ConfigStructure getStructureType() {
return getState().structures.get(getType());
return getState().getStructures().get(getType());
}
public boolean isArray() {
@ -178,12 +178,12 @@ public class ConfigField {
if (matcher.group(5) != null) {
arraySizeAsText = matcher.group(3) + "][" + matcher.group(5);
arraySizes = new int[2];
arraySizes[0] = getSize(state.variableRegistry, matcher.group(3));
arraySizes[1] = getSize(state.variableRegistry, matcher.group(5));
arraySizes[0] = getSize(state.getVariableRegistry(), matcher.group(3));
arraySizes[1] = getSize(state.getVariableRegistry(), matcher.group(5));
} else if (matcher.group(3) != null) {
arraySizeAsText = matcher.group(3);
arraySizes = new int[1];
arraySizes[0] = getSize(state.variableRegistry, arraySizeAsText);
arraySizes[0] = getSize(state.getVariableRegistry(), arraySizeAsText);
} else {
arraySizes = new int[0];
arraySizeAsText = null;
@ -419,7 +419,7 @@ public class ConfigField {
}
public String getCommentTemplated() {
return state.variableRegistry.applyVariables(getComment());
return state.getVariableRegistry().applyVariables(getComment());
}
}

View File

@ -34,20 +34,20 @@ public class ReaderState {
private static final String END_STRUCT = "end_struct";
private static final String STRUCT_NO_PREFIX = "struct_no_prefix ";
private static final String STRUCT = "struct ";
public final Stack<ConfigStructure> stack = new Stack<>();
public final Map<String, Integer> tsCustomSize = new HashMap<>();
public final Map<String, String> tsCustomLine = new HashMap<>();
public final Map<String, ConfigStructure> structures = new HashMap<>();
public String headerMessage;
private final Stack<ConfigStructure> stack = new Stack<>();
private final Map<String, Integer> tsCustomSize = new HashMap<>();
private final Map<String, String> tsCustomLine = new HashMap<>();
private final Map<String, ConfigStructure> structures = new HashMap<>();
private String headerMessage;
// well, technically those should be a builder for state, not this state class itself
public String tsFileOutputName = "rusefi.ini";
String definitionInputFile = null;
private String tsFileOutputName = "rusefi.ini";
private String definitionInputFile = null;
private boolean withC_Defines = true;
List<String> prependFiles = new ArrayList<>();
List<ConfigurationConsumer> destinations = new ArrayList<>();
private final List<String> prependFiles = new ArrayList<>();
private final List<ConfigurationConsumer> destinations = new ArrayList<>();
private final EnumsReader enumsReader = new EnumsReader();
public final VariableRegistry variableRegistry = new VariableRegistry();
private final VariableRegistry variableRegistry = new VariableRegistry();
public void setWithC_Defines(boolean withC_Defines) {
this.withC_Defines = withC_Defines;
@ -374,4 +374,48 @@ public class ReaderState {
public void addInputFile(String fileName) {
inputFiles.add(fileName);
}
public VariableRegistry getVariableRegistry() {
return variableRegistry;
}
public Stack<ConfigStructure> getStack() {
return stack;
}
public Map<String, Integer> getTsCustomSize() {
return tsCustomSize;
}
public Map<String, ConfigStructure> getStructures() {
return structures;
}
public Map<String, String> getTsCustomLine() {
return tsCustomLine;
}
public void setHeaderMessage(String headerMessage) {
this.headerMessage = headerMessage;
}
public String getTsFileOutputName() {
return tsFileOutputName;
}
public void setTsFileOutputName(String tsFileOutputName) {
this.tsFileOutputName = tsFileOutputName;
}
public String getDefinitionInputFile() {
return definitionInputFile;
}
public List<String> getPrependFiles() {
return prependFiles;
}
public boolean isDestinationsEmpty() {
return destinations.isEmpty();
}
}

View File

@ -21,10 +21,10 @@ public class TypesHelper {
Objects.requireNonNull(state);
if (type == null)
return 0;
if (state != null && state.structures.containsKey(type))
return state.structures.get(type).getTotalSize();
if (state != null && state.tsCustomSize.containsKey(type))
return state.tsCustomSize.get(type);
if (state != null && state.getStructures().containsKey(type))
return state.getStructures().get(type).getTotalSize();
if (state != null && state.getTsCustomSize().containsKey(type))
return state.getTsCustomSize().get(type);
Integer primitiveSize = getPrimitiveSize(type);
if (primitiveSize != null)
return primitiveSize;

View File

@ -25,7 +25,7 @@ public class CHeaderConsumer extends BaseCHeaderConsumer {
private final VariableRegistry variableRegistry;
public CHeaderConsumer(ReaderState state, String destCHeader, boolean withC_Defines) {
this.variableRegistry = state.variableRegistry;
this.variableRegistry = state.getVariableRegistry();
this.state = state;
this.withC_Defines = withC_Defines;
SystemOut.println("Writing C header to " + destCHeader);

View File

@ -33,7 +33,7 @@ public class DataLogConsumer implements ConfigurationConsumer {
@Override
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
if (readerState.stack.isEmpty()) {
if (readerState.getStack().isEmpty()) {
PerFieldWithStructuresIterator iterator = new PerFieldWithStructuresIterator(readerState, structure.tsFields, "",
(configField, prefix, prefix2) -> handle(prefix, prefix2));
iterator.loop();

View File

@ -7,7 +7,7 @@ import java.util.List;
public abstract class FieldsStrategy {
public int run(ReaderState state, ConfigStructure structure, int sensorTsPosition) {
if (state.stack.isEmpty()) {
if (state.getStack().isEmpty()) {
return writeFields(structure.tsFields, "", sensorTsPosition);
}
return sensorTsPosition;

View File

@ -36,7 +36,7 @@ public class FileJavaFieldsConsumer extends JavaFieldsConsumer {
@Override
public void endFile() throws IOException {
javaFields.write(state.variableRegistry.getJavaConstants());
javaFields.write(state.getVariableRegistry().getJavaConstants());
javaFields.write(getContent());
allFields.append("\t};" + EOL);

View File

@ -19,7 +19,7 @@ public class GaugeConsumer implements ConfigurationConsumer {
@Override
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
if (readerState.stack.isEmpty()) {
if (readerState.getStack().isEmpty()) {
PerFieldWithStructuresIterator iterator = new PerFieldWithStructuresIterator(readerState, structure.tsFields, "",
(state, configField, prefix) -> handle(configField, prefix));
iterator.loop();

View File

@ -61,7 +61,7 @@ public class GetConfigValueConsumer implements ConfigurationConsumer {
@Override
public void handleEndStruct(ReaderState state, ConfigStructure structure) throws IOException {
if (state.stack.isEmpty()) {
if (state.getStack().isEmpty()) {
PerFieldWithStructuresIterator iterator = new PerFieldWithStructuresIterator(state, structure.tsFields, "",
this::processConfig, ".");
iterator.loop();

View File

@ -34,7 +34,7 @@ public class GetOutputValueConsumer implements ConfigurationConsumer {
@Override
public void handleEndStruct(ReaderState state, ConfigStructure structure) throws IOException {
if (state.stack.isEmpty()) {
if (state.getStack().isEmpty()) {
PerFieldWithStructuresIterator iterator = new PerFieldWithStructuresIterator(state, structure.tsFields, "",
this::processOutput, ".");
iterator.loop();

View File

@ -46,7 +46,7 @@ public abstract class JavaFieldsConsumer implements ConfigurationConsumer {
}
private boolean isStringField(ConfigField configField) {
String custom = state.tsCustomLine.get(configField.getType());
String custom = state.getTsCustomLine().get(configField.getType());
return custom != null && custom.toLowerCase().startsWith(IniFileModel.FIELD_TYPE_STRING);
}
@ -85,9 +85,9 @@ public abstract class JavaFieldsConsumer implements ConfigurationConsumer {
writeJavaFieldName(nameWithPrefix, tsPosition);
content.append("FieldType.FLOAT)" + terminateField());
} else {
String enumOptions = state.variableRegistry.get(configField.getType() + VariableRegistry.FULL_JAVA_ENUM);
String enumOptions = state.getVariableRegistry().get(configField.getType() + VariableRegistry.FULL_JAVA_ENUM);
if (enumOptions == null)
enumOptions = state.variableRegistry.get(configField.getType() + VariableRegistry.ENUM_SUFFIX);
enumOptions = state.getVariableRegistry().get(configField.getType() + VariableRegistry.ENUM_SUFFIX);
if (enumOptions != null && !existingJavaEnums.contains(configField.getType())) {
existingJavaEnums.add(configField.getType());
@ -97,7 +97,7 @@ public abstract class JavaFieldsConsumer implements ConfigurationConsumer {
writeJavaFieldName(nameWithPrefix, tsPosition);
if (isStringField(configField)) {
String custom = state.tsCustomLine.get(configField.getType());
String custom = state.getTsCustomLine().get(configField.getType());
String[] tokens = custom.split(",");
String stringSize = tokens[3].trim();
content.append(stringSize + ", FieldType.STRING");

View File

@ -32,7 +32,7 @@ public class OutputsSectionConsumer implements ConfigurationConsumer {
sensorTsPosition = tsOutput.run(readerState, structure, sensorTsPosition);
if (readerState.stack.isEmpty()) {
if (readerState.getStack().isEmpty()) {
if (tsOutputsSectionFileName != null) {
FileWriter fos = new FileWriter(tsOutputsSectionFileName);
fos.write(tsOutput.getContent());

View File

@ -30,7 +30,7 @@ class PerFieldWithStructuresIterator extends FieldIterator {
@Override
public void end() {
ConfigStructure cs = cf.getState().structures.get(cf.getType());
ConfigStructure cs = cf.getState().getStructures().get(cf.getType());
String content;
if (cs != null) {
if (cf.isFromIterate()) {

View File

@ -13,7 +13,7 @@ public class SdCardFieldsContent {
public String home = "engine->outputChannels";
public void handleEndStruct(ReaderState state, ConfigStructure structure) throws IOException {
if (state.stack.isEmpty()) {
if (state.getStack().isEmpty()) {
PerFieldWithStructuresIterator iterator = new PerFieldWithStructuresIterator(state, structure.tsFields, "",
(configField, prefix, prefix2) -> processOutput(prefix, prefix2), ".");
iterator.loop();

View File

@ -2,7 +2,6 @@ package com.rusefi.output;
import com.rusefi.*;
import com.rusefi.newparse.DefinitionsState;
import com.rusefi.newparse.ParseState;
import com.rusefi.newparse.parsing.Definition;
import com.rusefi.util.SystemOut;
@ -26,7 +25,7 @@ public class SignatureConsumer implements ConfigurationConsumer {
// nasty trick - do not insert signature into live data files
if (tsPath != null) {
parseState.addDefinition(state.variableRegistry,
parseState.addDefinition(state.getVariableRegistry(),
ConfigDefinition.SIGNATURE_HASH, uniqueId.encode(), Definition.OverwritePolicy.NotAllowed);
}
}

View File

@ -90,20 +90,20 @@ public class TSProjectConsumer implements ConfigurationConsumer {
if (line.contains(TS_CONDITION)) {
String token = getToken(line);
String strValue = state.variableRegistry.get(token);
String strValue = state.getVariableRegistry().get(token);
boolean value = Boolean.parseBoolean(strValue);
if (!value)
continue; // skipping this line
line = removeToken(line);
}
line = state.variableRegistry.applyVariables(line);
line = state.getVariableRegistry().applyVariables(line);
if (isBeforeStartTag)
prefix.append(line + ToolUtil.EOL);
if (isAfterEndTag)
postfix.append(state.variableRegistry.applyVariables(line) + ToolUtil.EOL);
postfix.append(state.getVariableRegistry().applyVariables(line) + ToolUtil.EOL);
}
r.close();
return new TsFileContent(prefix.toString(), postfix.toString());
@ -130,7 +130,7 @@ public class TSProjectConsumer implements ConfigurationConsumer {
}
private String getTsFileOutputName(String tsPath) {
return tsPath + File.separator + state.tsFileOutputName;
return tsPath + File.separator + state.getTsFileOutputName();
}
public static String getTsFileInputName(String tsPath) {
@ -144,11 +144,11 @@ public class TSProjectConsumer implements ConfigurationConsumer {
@Override
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
state.variableRegistry.register(structure.name + "_size", structure.getTotalSize());
state.getVariableRegistry().register(structure.name + "_size", structure.getTotalSize());
totalTsSize = tsOutput.run(readerState, structure, 0);
if (state.stack.isEmpty()) {
state.variableRegistry.register("TOTAL_CONFIG_SIZE", totalTsSize);
if (state.getStack().isEmpty()) {
state.getVariableRegistry().register("TOTAL_CONFIG_SIZE", totalTsSize);
}
}

View File

@ -92,8 +92,8 @@ public class TsOutput {
return tsPosition;
}
if (configField.getState().tsCustomLine.containsKey(configField.getType())) {
String bits = configField.getState().tsCustomLine.get(configField.getType());
if (configField.getState().getTsCustomLine().containsKey(configField.getType())) {
String bits = configField.getState().getTsCustomLine().get(configField.getType());
if (!bits.startsWith("bits")) {
bits = handleTsInfo(configField, bits, 5);
}
@ -102,7 +102,7 @@ public class TsOutput {
tsHeader.append(nameWithPrefix + " = " + bits);
if (!configField.getName().equals(next.getName()))
tsPosition += configField.getState().tsCustomSize.get(configField.getType());
tsPosition += configField.getState().getTsCustomSize().get(configField.getType());
} else if (configField.getArraySizes().length == 0) {
tsHeader.append(nameWithPrefix + " = scalar, ");
tsHeader.append(TypesHelper.convertToTs(configField.getType()) + ",");
@ -138,7 +138,7 @@ public class TsOutput {
};
sensorTsPosition = strategy.run(state, structure, sensorTsPosition);
if (state.stack.isEmpty()) {
if (state.getStack().isEmpty()) {
tsHeader.append("; total TS size = " + sensorTsPosition + EOL);
}
return sensorTsPosition;

View File

@ -30,7 +30,7 @@ public class BitParsingTest {
writeContent(fieldsSection, new TsFileContent("", ""), createOutput(sw));
}
};
state.headerMessage = "test";
state.setHeaderMessage("test");
state.readBufferedReader(inputString, javaFieldsConsumer);
System.out.printf("start[" + sw + "]end");

View File

@ -163,7 +163,7 @@ public class ConfigFieldParserTest {
assertEquals(16, TypesHelper.getElementSize(state, "pid_s"));
ConfigStructure structure = state.structures.get("pid_s");
ConfigStructure structure = state.getStructures().get("pid_s");
ConfigField firstField = structure.cFields.get(0);
assertEquals("ms", firstField.getUnits());
}
@ -221,7 +221,7 @@ public class ConfigFieldParserTest {
assertEquals("#define ERROR_BUFFER_COUNT 120\n" +
"#define ERROR_BUFFER_SIZE 120\n" +
"#define RESULT 14400\n", state.variableRegistry.getDefinesSection());
"#define RESULT 14400\n", state.getVariableRegistry().getDefinesSection());
}
@Test
public void expressionInMultiplier() {
@ -276,7 +276,7 @@ public class ConfigFieldParserTest {
assertEquals("\tpublic static final char SD_r = 'r';\n" +
"",
state.variableRegistry.getJavaConstants());
state.getVariableRegistry().getJavaConstants());
}
@Test
@ -293,7 +293,7 @@ public class ConfigFieldParserTest {
assertEquals("\tpublic static final int ERROR_BUFFER_SIZE = 120;\n" +
"\tpublic static final int ERROR_BUFFER_SIZE_H = 0x120;\n" +
"",
state.variableRegistry.getJavaConstants());
state.getVariableRegistry().getJavaConstants());
}
@Test
@ -659,7 +659,7 @@ public class ConfigFieldParserTest {
assertEquals(12, state.parseSize("4*3", ""));
state.variableRegistry.register("var", 256);
state.getVariableRegistry().register("var", 256);
assertEquals(512, state.parseSize("2*@@var@@", ""));
assertEquals(512, state.parseSize("2x@@var@@", ""));

View File

@ -28,10 +28,10 @@ public class EnumAsTsVariable {
EnumsReader.EnumState state = readerState.getEnumsReader().getEnums().get("firing_order_e");
assertNotNull(state);
String data = readerState.variableRegistry.get("firing_order_e_FO_1");
String data = readerState.getVariableRegistry().get("firing_order_e_FO_1");
assertEquals("0", data);
assertEquals("0", readerState.variableRegistry.applyVariables("@@firing_order_e_FO_1@@"));
assertEquals("\\x00\\x00", readerState.variableRegistry.applyVariables("@@firing_order_e_FO_1_16_hex@@"));
assertEquals("0", readerState.getVariableRegistry().applyVariables("@@firing_order_e_FO_1@@"));
assertEquals("\\x00\\x00", readerState.getVariableRegistry().applyVariables("@@firing_order_e_FO_1_16_hex@@"));
}
}

View File

@ -148,8 +148,8 @@ public class GetConfigValueConsumerTest {
"bit enableFan1WithAc;Turn on this fan when AC is on.\n" +
"end_struct\n";
ReaderState state = new ReaderState();
state.variableRegistry.register("PACK_MULT_PERCENT", 100);
state.variableRegistry.register("GAUGE_NAME_FUEL_BASE", "hello");
state.getVariableRegistry().register("PACK_MULT_PERCENT", 100);
state.getVariableRegistry().register("GAUGE_NAME_FUEL_BASE", "hello");
GetConfigValueConsumer getConfigValueConsumer = new GetConfigValueConsumer();

View File

@ -4,17 +4,15 @@ import com.rusefi.ReaderState;
import com.rusefi.output.JavaSensorsConsumer;
import org.junit.Test;
import java.io.IOException;
import static org.junit.Assert.assertEquals;
public class JavaSensorsConsumerTest {
@Test
public void generateJavaSensors() {
ReaderState state = new ReaderState();
state.variableRegistry.register("PACK_MULT_PERCENT", 100);
state.variableRegistry.register("GAUGE_NAME_RPM", "\"hello\"");
state.variableRegistry.register("GAUGE_NAME_GEAR_RATIO", "ra");
state.getVariableRegistry().register("PACK_MULT_PERCENT", 100);
state.getVariableRegistry().register("GAUGE_NAME_RPM", "\"hello\"");
state.getVariableRegistry().register("GAUGE_NAME_GEAR_RATIO", "ra");
String outputChannels = "" +
"\n" +

View File

@ -19,7 +19,7 @@ public class OutputsTest {
@Test
public void generateSomething() throws IOException {
ReaderState state = new ReaderState();
state.variableRegistry.register("GAUGE_NAME_FUEL_WALL_CORRECTION", "wall");
state.getVariableRegistry().register("GAUGE_NAME_FUEL_WALL_CORRECTION", "wall");
String test = "struct total\n" +
"float afr_type;PID dTime;\"ms\", 1, 0, 0, 3000, 0\n" +
"uint8_t afr_typet;@@GAUGE_NAME_FUEL_WALL_CORRECTION@@;\"ms\", 1, 0, 0, 3000, 0\n" +
@ -91,8 +91,8 @@ public class OutputsTest {
"bit enableFan1WithAc;+Turn on this fan when AC is on.\n" +
"end_struct\n";
ReaderState state = new ReaderState();
state.variableRegistry.register("PACK_MULT_PERCENT", 100);
state.variableRegistry.register("GAUGE_NAME_FUEL_BASE", "hello");
state.getVariableRegistry().register("PACK_MULT_PERCENT", 100);
state.getVariableRegistry().register("GAUGE_NAME_FUEL_BASE", "hello");
DataLogConsumer dataLogConsumer = new DataLogConsumer(null);
state.readBufferedReader(test, dataLogConsumer);
@ -124,7 +124,7 @@ public class OutputsTest {
DataLogConsumer dataLogConsumer = new DataLogConsumer(null);
state.readBufferedReader(test, dataLogConsumer);
assertEquals("\"fuel: base mass\"", state.variableRegistry.get("GAUGE_NAME_FUEL_BASE"));
assertEquals("\"fuel: base mass\"", state.getVariableRegistry().get("GAUGE_NAME_FUEL_BASE"));
assertEquals(
"entry = baseFuel, \"fuel: base mass\", int, \"%d\"\n" +
"entry = baseFuel2, \"line1\", int, \"%d\"\n"

View File

@ -14,10 +14,10 @@ public class SdCardFieldsGeneratorTest {
Actor actor = new Actor() {
@Override
public void act(ReaderState state) {
state.variableRegistry.register("PACK_MULT_PERCENT", 100);
state.variableRegistry.register("GAUGE_NAME_RPM", "\"hello\"");
state.variableRegistry.register("GAUGE_NAME_GEAR_RATIO", "ra");
state.variableRegistry.register("GAUGE_NAME_CPU_TEMP", "te");
state.getVariableRegistry().register("PACK_MULT_PERCENT", 100);
state.getVariableRegistry().register("GAUGE_NAME_RPM", "\"hello\"");
state.getVariableRegistry().register("GAUGE_NAME_GEAR_RATIO", "ra");
state.getVariableRegistry().register("GAUGE_NAME_CPU_TEMP", "te");
}
};