Interface PrologEngine

All Known Implementing Classes:
JIPPrologEngine

public interface PrologEngine

A wrapper for the prolog engine-- this allows us to switch the implementation if need be.


Method Summary
 java.util.LinkedList multilineQuery(java.lang.String multiline)
          Query prolog with a bunch of lines, then get back the solution set for the last line.
 java.util.LinkedList query(java.lang.String prologCode)
          Query prolog and get back its replies.
 java.util.LinkedList query(java.lang.String prologCode, java.lang.String[] variableNames)
          Queries and returns the values of variables in the answer.
 void readFile(java.lang.String fileName)
          Read a file into the engine.
 

Method Detail

readFile

public void readFile(java.lang.String fileName)
Read a file into the engine.

Throws:
java.lang.RuntimeException - if the load fails.

query

public java.util.LinkedList query(java.lang.String prologCode)
Query prolog and get back its replies.

Parameters:
prologCode - the prolog code that forms the query.
Returns:
strings of the replies.
Throws:
java.lang.RuntimeException - for the inevitable screwup.

multilineQuery

public java.util.LinkedList multilineQuery(java.lang.String multiline)
Query prolog with a bunch of lines, then get back the solution set for the last line. Lines are split over the period character.

Parameters:
multiline - the multiline code, delimited by periods, that forms the query.
Returns:
the last response, and only the last response.
Throws:
java.lang.RuntimeException - when things go wrong.

query

public java.util.LinkedList query(java.lang.String prologCode,
                                  java.lang.String[] variableNames)
Queries and returns the values of variables in the answer.

Parameters:
prologCode - the query.
Returns:
a LinkedList of string arrays parallel to the variables.
Throws:
java.lang.RuntimeException - for the usual bloody stupid mistakes you always make.