Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
general
stups
ProB 2 Jupyter Kernel
Commits
0c62d6a5
Commit
0c62d6a5
authored
Dec 08, 2020
by
dgelessus
Browse files
Use new ProB 2 APIs for getting visualization commands by name
parent
a654e73e
Pipeline
#50947
passed with stage
in 7 minutes and 24 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/prob2/jupyter/commands/DotCommand.java
View file @
0c62d6a5
...
...
@@ -101,11 +101,12 @@ public final class DotCommand implements Command {
}
final
Trace
trace
=
this
.
animationSelector
.
getCurrentTrace
();
final
DotVisualizationCommand
dotCommand
=
DotVisualizationCommand
.
getAll
(
trace
.
getCurrentState
())
.
stream
()
.
filter
(
i
->
command
.
equals
(
i
.
getCommand
()))
.
findAny
()
.
orElseThrow
(()
->
new
UserErrorException
(
"No such dot command: "
+
command
));
final
DotVisualizationCommand
dotCommand
;
try
{
dotCommand
=
DotVisualizationCommand
.
getByName
(
command
,
trace
.
getCurrentState
());
}
catch
(
final
IllegalArgumentException
e
)
{
throw
new
UserErrorException
(
"No such dot command: "
+
command
,
e
);
}
// Provide source code (if any) to error highlighter
final
Supplier
<
String
>
execute
=
()
->
dotCommand
.
visualizeAsSvgToString
(
dotCommandArgs
);
...
...
src/main/java/de/prob2/jupyter/commands/TableCommand.java
View file @
0c62d6a5
...
...
@@ -73,11 +73,7 @@ public final class TableCommand implements Command {
final
String
code
=
kernel
.
insertLetVariables
(
args
.
get
(
EXPRESSION_PARAM
));
final
IEvalElement
formula
=
CommandUtils
.
withSourceCode
(
code
,
()
->
kernel
.
parseFormula
(
code
,
FormulaExpand
.
EXPAND
));
final
TableData
table
=
TableVisualizationCommand
.
getAll
(
trace
.
getCurrentState
())
.
stream
()
.
filter
(
c
->
"expr_as_table"
.
equals
(
c
.
getCommand
()))
.
findAny
()
.
orElseThrow
(
AssertionError:
:
new
)
final
TableData
table
=
TableVisualizationCommand
.
getByName
(
TableVisualizationCommand
.
EXPRESSION_AS_TABLE_NAME
,
trace
.
getCurrentState
())
.
visualize
(
Collections
.
singletonList
(
formula
));
final
StringBuilder
sbPlain
=
new
StringBuilder
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment