From 0eef62b4d41d3b189cbcf7c83c6d100c68c259a5 Mon Sep 17 00:00:00 2001 From: dgelessus <dgelessus@users.noreply.github.com> Date: Tue, 18 Mar 2025 13:09:32 +0100 Subject: [PATCH] Use new trace-based dot/table visualization APIs --- src/main/java/de/prob2/jupyter/commands/DotCommand.java | 8 ++++---- src/main/java/de/prob2/jupyter/commands/TableCommand.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/prob2/jupyter/commands/DotCommand.java b/src/main/java/de/prob2/jupyter/commands/DotCommand.java index ea3bd3c..09ecfea 100644 --- a/src/main/java/de/prob2/jupyter/commands/DotCommand.java +++ b/src/main/java/de/prob2/jupyter/commands/DotCommand.java @@ -71,7 +71,7 @@ public final class DotCommand implements Command { public @NotNull String getHelpBody() { final StringBuilder sb = new StringBuilder("The following dot visualisation commands are available:\n\n"); final Trace trace = this.animationSelector.getCurrentTrace(); - final GetAllDotCommands cmd = new GetAllDotCommands(trace.getCurrentState()); + final GetAllDotCommands cmd = new GetAllDotCommands(trace); trace.getStateSpace().execute(cmd); for (final DynamicCommandItem item : cmd.getCommands()) { sb.append("* `"); @@ -99,7 +99,7 @@ public final class DotCommand implements Command { final Trace trace = this.animationSelector.getCurrentTrace(); final DotVisualizationCommand dotCommand; try { - dotCommand = DotVisualizationCommand.getByName(command, trace.getCurrentState()); + dotCommand = DotVisualizationCommand.getByName(command, trace); } catch (final IllegalArgumentException e) { throw new UserErrorException("No such dot command: " + command, e); } @@ -131,10 +131,10 @@ public final class DotCommand implements Command { return new ParameterCompleters(ImmutableMap.of( COMMAND_PARAM, (commandName, at) -> { final Trace trace = this.animationSelector.getCurrentTrace(); - final GetAllDotCommands cmd = new GetAllDotCommands(trace.getCurrentState()); + final GetAllDotCommands cmd = new GetAllDotCommands(trace); trace.getStateSpace().execute(cmd); final String prefix = commandName.substring(0, at); - final List<String> commands = DotVisualizationCommand.getAll(trace.getCurrentState()) + final List<String> commands = DotVisualizationCommand.getAll(trace) .stream() .filter(DynamicCommandItem::isAvailable) .map(DynamicCommandItem::getCommand) diff --git a/src/main/java/de/prob2/jupyter/commands/TableCommand.java b/src/main/java/de/prob2/jupyter/commands/TableCommand.java index 15486a0..a4bff3d 100644 --- a/src/main/java/de/prob2/jupyter/commands/TableCommand.java +++ b/src/main/java/de/prob2/jupyter/commands/TableCommand.java @@ -72,7 +72,7 @@ public final class TableCommand implements Command { final Trace trace = this.animationSelector.getCurrentTrace(); final IEvalElement formula = kernel.parseFormula(args.get(EXPRESSION_PARAM), FormulaExpand.EXPAND); - final TableData table = TableVisualizationCommand.getByName(TableVisualizationCommand.EXPRESSION_AS_TABLE_NAME, trace.getCurrentState()) + final TableData table = TableVisualizationCommand.getByName(TableVisualizationCommand.EXPRESSION_AS_TABLE_NAME, trace) .visualize(Collections.singletonList(formula)); final StringBuilder sbPlain = new StringBuilder(); -- GitLab