From 01669b73275955a2bc644effd95a96214bc71df2 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sun, 8 Sep 2019 23:11:11 -0400 Subject: [PATCH] refactoring --- .../src/com/rusefi/FieldIterator.java | 10 ---------- .../src/com/rusefi/output/JavaFieldsConsumer.java | 10 +++++----- .../src/com/rusefi/output/TSProjectConsumer.java | 6 +++--- 3 files changed, 8 insertions(+), 18 deletions(-) delete mode 100644 java_tools/configuration_definition/src/com/rusefi/FieldIterator.java diff --git a/java_tools/configuration_definition/src/com/rusefi/FieldIterator.java b/java_tools/configuration_definition/src/com/rusefi/FieldIterator.java deleted file mode 100644 index cb109e5cd0..0000000000 --- a/java_tools/configuration_definition/src/com/rusefi/FieldIterator.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.rusefi; - -/** - * (c) Andrey Belomutskiy - * 6/4/2015. - */ -public class FieldIterator { - public BitState bitState = new BitState(); - -} diff --git a/java_tools/configuration_definition/src/com/rusefi/output/JavaFieldsConsumer.java b/java_tools/configuration_definition/src/com/rusefi/output/JavaFieldsConsumer.java index c8b48ccf94..b7b6a6b637 100644 --- a/java_tools/configuration_definition/src/com/rusefi/output/JavaFieldsConsumer.java +++ b/java_tools/configuration_definition/src/com/rusefi/output/JavaFieldsConsumer.java @@ -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 tsFields, String prefix, int tsPosition) throws IOException { - FieldIterator fieldIterator = new FieldIterator(); + private int writeJavaFields(List 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; } diff --git a/java_tools/configuration_definition/src/com/rusefi/output/TSProjectConsumer.java b/java_tools/configuration_definition/src/com/rusefi/output/TSProjectConsumer.java index 53cc1101b0..ada71f1d87 100644 --- a/java_tools/configuration_definition/src/com/rusefi/output/TSProjectConsumer.java +++ b/java_tools/configuration_definition/src/com/rusefi/output/TSProjectConsumer.java @@ -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; }