use of de.prob.animator.command.IRawCommand in project prob2 by bendisposto.
the class CommandProcessor method sendCommand.
public IPrologResult sendCommand(final AbstractCommand command) {
String query;
if (command instanceof IRawCommand) {
query = ((IRawCommand) command).getCommand();
if (!query.endsWith(".")) {
query += ".";
}
} else {
PrologTermStringOutput pto = new PrologTermStringOutput();
command.writeCommand(pto);
pto.printAtom("true");
query = pto.fullstop().toString();
}
if (logger.isDebugEnabled()) {
logger.debug(StringUtils.chomp(StringUtils.abbreviate(query, 200)));
}
String result = cli.send(query);
final Start ast = parseResult(result);
IPrologResult extractResult = extractResult(ast);
if (logger.isDebugEnabled()) {
logger.debug(StringUtils.chomp(StringUtils.abbreviate(extractResult.toString(), 200)));
}
return extractResult;
}
Aggregations