This commit is contained in:
rusefillc 2021-12-08 23:18:31 -05:00
parent 49c348d118
commit 905760e84e
2 changed files with 11 additions and 4 deletions

View File

@ -5,6 +5,9 @@ import com.rusefi.ConfigField;
import java.util.List;
/**
* custom iterator with references to previous and next elements
*/
public class FieldIterator {
private final List<ConfigField> tsFields;
BitState bitState = new BitState();

View File

@ -10,14 +10,18 @@ import java.io.Writer;
import static com.rusefi.ToolUtil.EOL;
/**
* Same code is used to generate [Constants] and [OutputChannels] bodies, with just one flag controlling the minor
* difference in behaviours
*/
public class TsOutput {
private final StringBuilder settingContextHelp = new StringBuilder();
private final ReaderState state;
private final boolean longForm;
private final boolean isConstantsSection;
public TsOutput(ReaderState state, boolean longForm) {
this.state = state;
this.longForm = longForm;
this.isConstantsSection = longForm;
}
public StringBuilder getSettingContextHelp() {
@ -49,7 +53,7 @@ public class TsOutput {
tsHeader.write(" " + tsPosition + ", [");
tsHeader.write(bitIndex + ":" + bitIndex);
tsHeader.write("]");
if (longForm)
if (isConstantsSection)
tsHeader.write(", \"" + configField.getFalseName() + "\", \"" + configField.getTrueName() + "\"");
tsHeader.write(EOL);
@ -144,7 +148,7 @@ public class TsOutput {
}
}
StringBuilder sb = new StringBuilder();
if (!longForm) {
if (!isConstantsSection) {
String[] subarray = new String[3];
System.arraycopy(fields, 0, subarray, 0, subarray.length);
fields = subarray;