parent
b8ad330a37
commit
3899d6a36e
|
@ -26,6 +26,10 @@ bool AcController::getAcState() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (engineTooFast) {
|
||||||
|
invokeMethodRed();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
auto clt = Sensor::get(SensorType::Clt);
|
auto clt = Sensor::get(SensorType::Clt);
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,11 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
|
|
||||||
import static com.devexperts.logging.Logging.getLogging;
|
import static com.devexperts.logging.Logging.getLogging;
|
||||||
|
|
||||||
public class CodeWalkthrough {
|
public class CodeWalkthrough {
|
||||||
private static final Logging log = getLogging(CodeWalkthrough.class);
|
private static final Logging log = getLogging(CodeWalkthrough.class);
|
||||||
// inactive statements within inactive branch of code - light red
|
|
||||||
public static final Color INACTIVE_BRANCH = new Color(255, 102, 102);
|
|
||||||
// active statements - light green
|
// active statements - light green
|
||||||
public static final Color ACTIVE_STATEMENT = new Color(102, 255, 102);
|
public static final Color ACTIVE_STATEMENT = new Color(102, 255, 102);
|
||||||
// cost past active return statement
|
// cost past active return statement
|
||||||
|
@ -98,18 +95,22 @@ public class CodeWalkthrough {
|
||||||
if (log.debugEnabled())
|
if (log.debugEnabled())
|
||||||
log.debug("CONDITIONAL: REQUESTING VALUE " + conditionVariable);
|
log.debug("CONDITIONAL: REQUESTING VALUE " + conditionVariable);
|
||||||
|
|
||||||
Boolean state = (Boolean) valueSource.getValue(conditionVariable);
|
if (currentState.isEmpty()) {
|
||||||
BranchingState branchingState = BranchingState.valueOf(state);
|
painter.paintBackground(PASSIVE_CODE, new Range(ctx));
|
||||||
if (log.debugEnabled())
|
|
||||||
log.debug("CURRENT STATE ADD " + state);
|
|
||||||
currentState.add(branchingState);
|
|
||||||
if (branchingState == BranchingState.BROKEN) {
|
|
||||||
brokenConditions.add(conditionVariable);
|
|
||||||
painter.paintBackground(BROKEN_CODE, new Range(ctx));
|
|
||||||
} else if (branchingState == BranchingState.TRUE) {
|
|
||||||
painter.paintBackground(TRUE_CONDITION, new Range(ctx));
|
|
||||||
} else {
|
} else {
|
||||||
painter.paintBackground(FALSE_CONDITION, new Range(ctx));
|
Boolean state = (Boolean) valueSource.getValue(conditionVariable);
|
||||||
|
BranchingState branchingState = BranchingState.valueOf(state);
|
||||||
|
if (log.debugEnabled())
|
||||||
|
log.debug("CURRENT STATE ADD " + state);
|
||||||
|
currentState.add(branchingState);
|
||||||
|
if (branchingState == BranchingState.BROKEN) {
|
||||||
|
brokenConditions.add(conditionVariable);
|
||||||
|
painter.paintBackground(BROKEN_CODE, new Range(ctx));
|
||||||
|
} else if (branchingState == BranchingState.TRUE) {
|
||||||
|
painter.paintBackground(TRUE_CONDITION, new Range(ctx));
|
||||||
|
} else {
|
||||||
|
painter.paintBackground(FALSE_CONDITION, new Range(ctx));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +136,7 @@ public class CodeWalkthrough {
|
||||||
if (isAlive == BranchingState.BROKEN) {
|
if (isAlive == BranchingState.BROKEN) {
|
||||||
color = BROKEN_CODE;
|
color = BROKEN_CODE;
|
||||||
} else {
|
} else {
|
||||||
color = isAlive == BranchingState.TRUE ? ACTIVE_STATEMENT : INACTIVE_BRANCH;
|
color = isAlive == BranchingState.TRUE ? ACTIVE_STATEMENT : PASSIVE_CODE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Range range = new Range(ctx);
|
Range range = new Range(ctx);
|
||||||
|
|
|
@ -34,7 +34,7 @@ import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this panel shows a live view of rusEFI firmware C/C++ code
|
* this panel shows a live view of rusEFI firmware C/C++ code
|
||||||
* @see LiveDataParserPanelSandbox
|
* @see LiveDataParserSandbox
|
||||||
*/
|
*/
|
||||||
public class LiveDataParserPanel {
|
public class LiveDataParserPanel {
|
||||||
private static final Logging log = getLogging(LiveDataParserPanel.class);
|
private static final Logging log = getLogging(LiveDataParserPanel.class);
|
||||||
|
|
|
@ -17,6 +17,7 @@ import java.awt.event.ActionListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Andrey Belomutskiy, (c) 2013-2020
|
* Andrey Belomutskiy, (c) 2013-2020
|
||||||
|
* @see LiveDataParserPanel
|
||||||
*/
|
*/
|
||||||
public class LiveDataPane {
|
public class LiveDataPane {
|
||||||
/**
|
/**
|
||||||
|
@ -90,7 +91,7 @@ public class LiveDataPane {
|
||||||
legend.add(new JLabel("Legend:"));
|
legend.add(new JLabel("Legend:"));
|
||||||
legend.add(createLabel(CodeWalkthrough.TRUE_CONDITION, "'true' condition"));
|
legend.add(createLabel(CodeWalkthrough.TRUE_CONDITION, "'true' condition"));
|
||||||
legend.add(createLabel(CodeWalkthrough.FALSE_CONDITION, "'false' condition"));
|
legend.add(createLabel(CodeWalkthrough.FALSE_CONDITION, "'false' condition"));
|
||||||
legend.add(createLabel(CodeWalkthrough.INACTIVE_BRANCH, "inactive branch"));
|
legend.add(createLabel(CodeWalkthrough.PASSIVE_CODE, "inactive code"));
|
||||||
legend.add(createLabel(CodeWalkthrough.ACTIVE_STATEMENT, "active branch"));
|
legend.add(createLabel(CodeWalkthrough.ACTIVE_STATEMENT, "active branch"));
|
||||||
legend.add(createLabel(CodeWalkthrough.BROKEN_CODE, "No live data"));
|
legend.add(createLabel(CodeWalkthrough.BROKEN_CODE, "No live data"));
|
||||||
|
|
||||||
|
|
|
@ -74,9 +74,7 @@ public class LiveDataParserTest {
|
||||||
verify(painter).paintBackground(eq(Color.green), any());
|
verify(painter).paintBackground(eq(Color.green), any());
|
||||||
|
|
||||||
verify(painter, times(4)).paintBackground(eq(CodeWalkthrough.ACTIVE_STATEMENT), any());
|
verify(painter, times(4)).paintBackground(eq(CodeWalkthrough.ACTIVE_STATEMENT), any());
|
||||||
verify(painter, times(1)).paintBackground(eq(CodeWalkthrough.INACTIVE_BRANCH), any());
|
verify(painter, times(4)).paintBackground(eq(CodeWalkthrough.PASSIVE_CODE), any());
|
||||||
|
|
||||||
verify(painter, times(3)).paintBackground(eq(CodeWalkthrough.PASSIVE_CODE), any());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private SourceCodePainter run(VariableValueSource valueSource, String sourceCode) {
|
private SourceCodePainter run(VariableValueSource valueSource, String sourceCode) {
|
||||||
|
|
Loading…
Reference in New Issue