From cc38847333da8a4de681abf0e8a1a254ff4968df Mon Sep 17 00:00:00 2001 From: rusefillc Date: Mon, 24 Jan 2022 21:15:35 -0500 Subject: [PATCH] Live Data: dead code --- .../livedata/LiveDataParserPanelSandbox.java | 46 ------------------ .../livedata/LiveDataParserSandbox.java | 2 +- .../com/rusefi/livedata/LiveDataView.java | 47 ------------------- .../ui/livedata/LiveDataParserTest.java | 7 ++- 4 files changed, 6 insertions(+), 96 deletions(-) delete mode 100644 java_console/ui/src/test/java/com/rusefi/livedata/LiveDataParserPanelSandbox.java delete mode 100644 java_console/ui/src/test/java/com/rusefi/livedata/LiveDataView.java diff --git a/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataParserPanelSandbox.java b/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataParserPanelSandbox.java deleted file mode 100644 index cabdbac19c..0000000000 --- a/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataParserPanelSandbox.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.rusefi.livedata; - -import com.rusefi.config.Field; -import com.rusefi.config.generated.BoostControl; -import com.rusefi.ldmp.StateDictionary; -import com.rusefi.ui.UIContext; -import com.rusefi.ui.livedocs.LiveDocsRegistry; -import com.rusefi.ui.util.FrameHelper; -import org.jetbrains.annotations.NotNull; - -import javax.swing.*; - -/** - * TODO: no point in this class kill it? - * @see LiveDataParserSandbox - */ -public class LiveDataParserPanelSandbox { - private final static LiveDataView liveDataView = LiveDataView.BOOST_CONTROL; - - public static void main(String[] args) { - - UIContext context = new UIContext(); - - JPanel panel = createLiveDataParserContent(context, - liveDataView); - - Field[] values = StateDictionary.INSTANCE.getFields(liveDataView.getLiveDataE()); - int size = Field.getStructureSize(values); - byte[] state = new byte[size]; - - - Field.findFieldOrNull(values, "", BoostControl.ISTPSINVALID.getName()).setValue(state, true); - Field.findFieldOrNull(values, "", BoostControl.ISNOTCLOSEDLOOP.getName()).setValue(state, true); - - LiveDocsRegistry.INSTANCE.refresh(context1 -> state - ); - - new FrameHelper().showFrame(panel); - } - - @NotNull - private static JPanel createLiveDataParserContent(UIContext uiContext, LiveDataView view) { - LiveDataParserPanel panel = LiveDataParserPanel.createLiveDataParserPanel(uiContext, view.getLiveDataE(), view.getValues(), view.getFileName()); - return panel.getContent(); - } -} diff --git a/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataParserSandbox.java b/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataParserSandbox.java index 1c1a529c05..3d1ca034be 100644 --- a/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataParserSandbox.java +++ b/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataParserSandbox.java @@ -12,7 +12,7 @@ import java.util.Map; import java.util.TreeMap; /** - * @see LiveDataParserPanelSandbox + * */ public class LiveDataParserSandbox { public static void main(String[] args) { diff --git a/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataView.java b/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataView.java deleted file mode 100644 index 67019f48eb..0000000000 --- a/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataView.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.rusefi.livedata; - -import com.rusefi.config.Field; -import com.rusefi.config.generated.*; -import com.rusefi.enums.live_data_e; -import com.rusefi.ldmp.StateDictionary; - -import static com.rusefi.ui.LiveDataPane.CPP_SUFFIX; - -/** - * todo: kill this legacy class? - * @see StateDictionary - */ -@Deprecated -public enum LiveDataView { - // todo: code generate this part of the enum with some BEFORE/AFTER tag? - AC_CONTROL(live_data_e.LDS_ac_control, AcControl.VALUES), - FUEL_PUMP(live_data_e.LDS_fuel_pump, FuelPump.VALUES), - MAIN_RELAY(live_data_e.LDS_main_relay, MainRelay.VALUES), - TPS_ACCEL(live_data_e.LDS_tps_accel_state, TpsAccelState.VALUES), - BOOST_CONTROL(live_data_e.LDS_boost_control, BoostControl.VALUES), - LAUNCH_CONTROL(live_data_e.LDS_launch_control_state, LaunchControl.VALUES), - HIGH_PRESSURE(live_data_e.LDS_high_pressure_fuel_pump, HighPressureFuelPump.VALUES), - ; - - private final live_data_e liveDataE; - private final Field[] values; - private final String fileName; - - LiveDataView(live_data_e liveDataE, Field[] values) { - this.liveDataE = liveDataE; - this.values = values; - this.fileName = StateDictionary.INSTANCE.getFileName(liveDataE) + CPP_SUFFIX; - } - - public live_data_e getLiveDataE() { - return liveDataE; - } - - public Field[] getValues() { - return values; - } - - public String getFileName() { - return fileName; - } -} diff --git a/java_console/ui/src/test/java/com/rusefi/ui/livedata/LiveDataParserTest.java b/java_console/ui/src/test/java/com/rusefi/ui/livedata/LiveDataParserTest.java index 593a05ca76..1846e07d68 100644 --- a/java_console/ui/src/test/java/com/rusefi/ui/livedata/LiveDataParserTest.java +++ b/java_console/ui/src/test/java/com/rusefi/ui/livedata/LiveDataParserTest.java @@ -1,9 +1,10 @@ package com.rusefi.ui.livedata; import com.rusefi.CodeWalkthrough; +import com.rusefi.enums.live_data_e; +import com.rusefi.ldmp.StateDictionary; import com.rusefi.livedata.LiveDataParserPanel; import com.rusefi.livedata.LiveDataParserSandbox; -import com.rusefi.livedata.LiveDataView; import com.rusefi.livedata.ParseResult; import org.antlr.v4.runtime.tree.ParseTree; import org.antlr.v4.runtime.tree.ParseTreeWalker; @@ -15,6 +16,7 @@ import java.util.Map; import java.util.TreeMap; import static com.rusefi.CodeWalkthrough.TRUE_CONDITION; +import static com.rusefi.ui.LiveDataPane.CPP_SUFFIX; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; @@ -91,7 +93,8 @@ public class LiveDataParserTest { @Test public void testConfigurationInRealSourceCode() throws IOException, URISyntaxException { - String sourceCode = LiveDataParserPanel.getContent(LiveDataParserPanel.class, LiveDataView.BOOST_CONTROL.getFileName()); + String fileName = StateDictionary.INSTANCE.getFileName(live_data_e.LDS_boost_control); + String sourceCode = LiveDataParserPanel.getContent(LiveDataParserPanel.class, fileName + CPP_SUFFIX); assertTrue(sourceCode.length() > 100); ParseTree tree = LiveDataParserPanel.getParseTree(sourceCode);