refactoring
This commit is contained in:
parent
cc6806adae
commit
f1f09832be
|
@ -1,10 +0,0 @@
|
||||||
package com.rusefi;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (c) Andrey Belomutskiy
|
|
||||||
* 6/4/2015.
|
|
||||||
*/
|
|
||||||
public class FieldIterator {
|
|
||||||
public BitState bitState = new BitState();
|
|
||||||
|
|
||||||
}
|
|
|
@ -26,7 +26,7 @@ public abstract class JavaFieldsConsumer implements ConfigurationConsumer {
|
||||||
return javaFieldsWriter.toString();
|
return javaFieldsWriter.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void writeJavaFieldName(String nameWithPrefix, int tsPosition) throws IOException {
|
private void writeJavaFieldName(String nameWithPrefix, int tsPosition) throws IOException {
|
||||||
javaFieldsWriter.write("\tpublic static final Field ");
|
javaFieldsWriter.write("\tpublic static final Field ");
|
||||||
allFields.append("\t" + nameWithPrefix.toUpperCase() + "," + EOL);
|
allFields.append("\t" + nameWithPrefix.toUpperCase() + "," + EOL);
|
||||||
javaFieldsWriter.write(nameWithPrefix.toUpperCase());
|
javaFieldsWriter.write(nameWithPrefix.toUpperCase());
|
||||||
|
@ -34,14 +34,14 @@ public abstract class JavaFieldsConsumer implements ConfigurationConsumer {
|
||||||
+ tsPosition + ", ");
|
+ tsPosition + ", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int writeJavaFields(List<ConfigField> tsFields, String prefix, int tsPosition) throws IOException {
|
private int writeJavaFields(List<ConfigField> tsFields, String prefix, int tsPosition) throws IOException {
|
||||||
FieldIterator fieldIterator = new FieldIterator();
|
BitState bitState = new BitState();
|
||||||
for (int i = 0; i < tsFields.size(); i++) {
|
for (int i = 0; i < tsFields.size(); i++) {
|
||||||
ConfigField next = i == tsFields.size() - 1 ? ConfigField.VOID : tsFields.get(i + 1);
|
ConfigField next = i == tsFields.size() - 1 ? ConfigField.VOID : tsFields.get(i + 1);
|
||||||
ConfigField cf = tsFields.get(i);
|
ConfigField cf = tsFields.get(i);
|
||||||
tsPosition = writeJavaFields(cf, prefix, tsPosition, next, fieldIterator.bitState.get());
|
tsPosition = writeJavaFields(cf, prefix, tsPosition, next, bitState.get());
|
||||||
|
|
||||||
fieldIterator.bitState.incrementBitIndex(cf, next);
|
bitState.incrementBitIndex(cf, next);
|
||||||
}
|
}
|
||||||
return tsPosition;
|
return tsPosition;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,13 +88,13 @@ public class TSProjectConsumer implements ConfigurationConsumer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int writeTunerStudio(ConfigStructure configStructure, String prefix, Writer tsHeader, int tsPosition) throws IOException {
|
private int writeTunerStudio(ConfigStructure configStructure, String prefix, Writer tsHeader, int tsPosition) throws IOException {
|
||||||
FieldIterator fieldIterator = new FieldIterator();
|
BitState bitState = new BitState();
|
||||||
for (int i = 0; i < configStructure.tsFields.size(); i++) {
|
for (int i = 0; i < configStructure.tsFields.size(); i++) {
|
||||||
ConfigField next = i == configStructure.tsFields.size() - 1 ? ConfigField.VOID : configStructure.tsFields.get(i + 1);
|
ConfigField next = i == configStructure.tsFields.size() - 1 ? ConfigField.VOID : configStructure.tsFields.get(i + 1);
|
||||||
ConfigField cf = configStructure.tsFields.get(i);
|
ConfigField cf = configStructure.tsFields.get(i);
|
||||||
tsPosition = writeTunerStudio(cf, prefix, tsHeader, tsPosition, next, fieldIterator.bitState.get());
|
tsPosition = writeTunerStudio(cf, prefix, tsHeader, tsPosition, next, bitState.get());
|
||||||
|
|
||||||
fieldIterator.bitState.incrementBitIndex(cf, next);
|
bitState.incrementBitIndex(cf, next);
|
||||||
}
|
}
|
||||||
return tsPosition;
|
return tsPosition;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue