Skip to content
Snippets Groups Projects
Commit 6303d930 authored by Sebastian Krings's avatar Sebastian Krings
Browse files

switch plugin output to list, managed to get the resulting state printed on the console…..

parent edd36d1f
Branches
No related tags found
No related merge requests found
...@@ -16,34 +16,27 @@ import de.prob.prolog.term.PrologTerm; ...@@ -16,34 +16,27 @@ import de.prob.prolog.term.PrologTerm;
public final class GetPluginResultCommand implements IComposableCommand { public final class GetPluginResultCommand implements IComposableCommand {
private final String resultID; private final String resultID;
private String result; private ListPrologTerm result;
public GetPluginResultCommand(final String resultID) { public GetPluginResultCommand(final String resultID) {
this.resultID = resultID; this.resultID = resultID;
} }
public String getResult() { public ListPrologTerm getResult() {
return result; return result;
} }
public void processResult( public void processResult(
final ISimplifiedROMap<String, PrologTerm> bindings) final ISimplifiedROMap<String, PrologTerm> bindings)
throws CommandException { throws CommandException {
ListPrologTerm list;
try { try {
list = BindingGenerator.getList(bindings, "Bindings"); result = BindingGenerator.getList(bindings, "Bindings");
} catch (ResultParserException e) { } catch (ResultParserException e) {
CommandException commandException = new CommandException( CommandException commandException = new CommandException(
e.getLocalizedMessage(), e); e.getLocalizedMessage(), e);
commandException.notifyUserOnce(); commandException.notifyUserOnce();
throw commandException; throw commandException;
} }
for (PrologTerm term : list) {
int nextCharCode = BindingGenerator.getInteger(term).getValue()
.intValue();
result += (char) nextCharCode;
}
} }
public void writeCommand(final IPrologTermOutput pto) { public void writeCommand(final IPrologTermOutput pto) {
......
...@@ -44,6 +44,7 @@ import de.prob.core.command.StartAnimationCommand; ...@@ -44,6 +44,7 @@ import de.prob.core.command.StartAnimationCommand;
import de.prob.core.command.internal.InternalLoadCommand; import de.prob.core.command.internal.InternalLoadCommand;
import de.prob.exceptions.ProBException; import de.prob.exceptions.ProBException;
import de.prob.logging.Logger; import de.prob.logging.Logger;
import de.prob.prolog.term.ListPrologTerm;
public class StartUnitAnalysisHandler extends AbstractHandler implements public class StartUnitAnalysisHandler extends AbstractHandler implements
IHandler { IHandler {
...@@ -130,11 +131,11 @@ public class StartUnitAnalysisHandler extends AbstractHandler implements ...@@ -130,11 +131,11 @@ public class StartUnitAnalysisHandler extends AbstractHandler implements
// TODO: get resulting state and fill attributes // TODO: get resulting state and fill attributes
GetPluginResultCommand stateValuesCommand = new GetPluginResultCommand( GetPluginResultCommand stateValuesCommand = new GetPluginResultCommand(
"Static Analysis Result"); "Grounded Result State");
animator.execute(stateValuesCommand); animator.execute(stateValuesCommand);
String output = stateValuesCommand.getResult(); ListPrologTerm output = stateValuesCommand.getResult();
System.out.println(output); System.out.println(output);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment