refactoring
This commit is contained in:
parent
8c3780e78d
commit
01669b7327
|
@ -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();
|
||||
}
|
||||
|
||||
protected void writeJavaFieldName(String nameWithPrefix, int tsPosition) throws IOException {
|
||||
private void writeJavaFieldName(String nameWithPrefix, int tsPosition) throws IOException {
|
||||
javaFieldsWriter.write("\tpublic static final Field ");
|
||||
allFields.append("\t" + nameWithPrefix.toUpperCase() + "," + EOL);
|
||||
javaFieldsWriter.write(nameWithPrefix.toUpperCase());
|
||||
|
@ -34,14 +34,14 @@ public abstract class JavaFieldsConsumer implements ConfigurationConsumer {
|
|||
+ tsPosition + ", ");
|
||||
}
|
||||
|
||||
protected int writeJavaFields(List<ConfigField> tsFields, String prefix, int tsPosition) throws IOException {
|
||||
FieldIterator fieldIterator = new FieldIterator();
|
||||
private int writeJavaFields(List<ConfigField> tsFields, String prefix, int tsPosition) throws IOException {
|
||||
BitState bitState = new BitState();
|
||||
for (int i = 0; i < tsFields.size(); i++) {
|
||||
ConfigField next = i == tsFields.size() - 1 ? ConfigField.VOID : tsFields.get(i + 1);
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -88,13 +88,13 @@ public class TSProjectConsumer implements ConfigurationConsumer {
|
|||
}
|
||||
|
||||
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++) {
|
||||
ConfigField next = i == configStructure.tsFields.size() - 1 ? ConfigField.VOID : configStructure.tsFields.get(i + 1);
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue