Live Data: dead code

This commit is contained in:
rusefillc 2022-01-24 21:15:35 -05:00
parent 217ea1f283
commit 5c40e59d81
4 changed files with 6 additions and 96 deletions

View File

@ -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();
}
}

View File

@ -12,7 +12,7 @@ import java.util.Map;
import java.util.TreeMap;
/**
* @see LiveDataParserPanelSandbox
*
*/
public class LiveDataParserSandbox {
public static void main(String[] args) {

View File

@ -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;
}
}

View File

@ -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);