From 0c2896e4e3cb24351ff61f790f8dfa497ace0554 Mon Sep 17 00:00:00 2001
From: dgelessus <dgelessus@users.noreply.github.com>
Date: Thu, 2 Jul 2020 18:40:25 +0200
Subject: [PATCH] Use new ProB 2 API methods for handling pretty operation
 names

---
 .../java/de/prob2/jupyter/CommandUtils.java   | 26 -------------------
 .../prob2/jupyter/commands/ExecCommand.java   |  5 ++--
 2 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/src/main/java/de/prob2/jupyter/CommandUtils.java b/src/main/java/de/prob2/jupyter/CommandUtils.java
index 212d82d..7cb21e0 100644
--- a/src/main/java/de/prob2/jupyter/CommandUtils.java
+++ b/src/main/java/de/prob2/jupyter/CommandUtils.java
@@ -54,32 +54,6 @@ public final class CommandUtils {
 		throw new AssertionError("Utility class");
 	}
 	
-	public static @NotNull String prettyOperationName(final @NotNull String name) {
-		switch (name) {
-			case "$setup_constants":
-				return "SETUP_CONSTANTS";
-			
-			case "$initialise_machine":
-				return "INITIALISATION";
-			
-			default:
-				return name;
-		}
-	}
-	
-	public static @NotNull String unprettyOperationName(final @NotNull String name) {
-		switch (name) {
-			case "SETUP_CONSTANTS":
-				return "$setup_constants";
-			
-			case "INITIALISATION":
-				return "$initialise_machine";
-			
-			default:
-				return name;
-		}
-	}
-	
 	/**
 	 * <p>
 	 * Split an argument string according to the given parameter specification.
diff --git a/src/main/java/de/prob2/jupyter/commands/ExecCommand.java b/src/main/java/de/prob2/jupyter/commands/ExecCommand.java
index f391438..2d3d73c 100644
--- a/src/main/java/de/prob2/jupyter/commands/ExecCommand.java
+++ b/src/main/java/de/prob2/jupyter/commands/ExecCommand.java
@@ -71,7 +71,7 @@ public final class ExecCommand implements Command {
 	@Override
 	public @NotNull DisplayData run(final @NotNull ParsedArguments args) {
 		final Trace trace = this.animationSelector.getCurrentTrace();
-		final String translatedOpName = CommandUtils.unprettyOperationName(args.get(OPERATION_PARAM));
+		final String translatedOpName = Transition.unprettifyName(args.get(OPERATION_PARAM));
 		final String predicate;
 		if (!args.get(PREDICATE_PARAM).isPresent()) {
 			predicate = "1=1";
@@ -103,8 +103,7 @@ public final class ExecCommand implements Command {
 				final List<String> opNames = this.animationSelector.getCurrentTrace()
 					.getNextTransitions()
 					.stream()
-					.map(Transition::getName)
-					.map(CommandUtils::prettyOperationName)
+					.map(Transition::getPrettyName)
 					.distinct()
 					.filter(s -> s.startsWith(prefix))
 					.sorted()
-- 
GitLab