[top] [up] [next]

Java Interface


The Trinc-Prolog DLL can be used by Java applications. There is one restriction, the Java Virtual Machine does not allow that external DLLs display windows. Thus the Trinc-Prolog DLL can only be used for non-visual tasks.

The file dll\java\JPrologEngine.java contains the class JPrologEngine. With this class Trinc-Prolog engine instances can be created and used.

The class declaration is:

JPrologEngine
    public JPrologEngine()
func Constructor.
pre TRUE
post A new Trinc-Prolog engine will have been created.
public finalize()
func Delete Trinc-Prolog engine
pre TRUE
post The associated Trinc-Prolog instance is deleted
public static int version()
func Return the version of the Trinc-Prolog DLL interface.
pre TRUE
post A version number was returned.
public static void putSettings(String AppName, String AppVersion, String AppHelpFile, String AppCopyright, String AppCompanyName)
func Set the name, version, help file, copyright message and company name of the application. These values are displayed if the user for instance opens the About dialog from inside A TPWIN application being interpreted by the Trinc-Prolog DLL.
pre Any of the parameters may be NULL.
post The supplied values were stored.
public int prove( String GoalToProve )
func Prove the goal.
pre A goal to prove must have been supplied.
post If the goal was proven successfully and a solution was found was TP_SOLUTION returned, if the goal failed then was TP_FAIL returned, else one of the following error codes: "TPERROR_INCORRECT_GOAL", "TPERROR_UNKNOWN_ENGINE" or "TPERROR_PROVE" was returned.
public int continueProve()
func Find the next solution.
pre A solution must have been found by a previous call to the method Prove.
post If the goal was proven successfully and a solution was found was then is JPrologEngine.TP_SOLUTION returned. If the goal failed then JPrologEngine.TP_NO is returned or one of the following error codes:
    JPrologEngine.TPERROR_INCORRECT_GOAL
    JPrologEngine.TPERROR_UNKNOWN_ENGINE
    JPrologEngine.TPERROR_PROVE
public int numVars()
func Return the number of variables in the last solution.
pre A solution was found.
post The number of variables was returned.
public String varName( int Index )
func Return the name of a specific variable from the last solution.
pre A solution was found AND "Index" >= 0 AND "Index" < "NumVars".
post The name of the variable was returned.
public String varValue( int Index )
func Return the value of a specific variable from the last solution.
pre A solution was found AND "Index" >= 0 AND "Index" < "NumVars".
post A string representation of the value was returned.
public int varType( int Index )
func Return the type of the value of a specific variable from the last solution.
pre A solution was found AND "Index" >= 0 AND "Index" < "NumVars".
post One of the following values will be returned:
    JPrologEngine.TPTYPE_UNKNOWN
    JPrologEngine.TPTYPE_EMPTYLIST
    JPrologEngine.TPTYPE_LIST
    JPrologEngine.TPTYPE_EMPTY
    JPrologEngine.TPTYPE_INTEGER
    JPrologEngine.TPTYPE_FLOAT
    JPrologEngine.TPTYPE_STRUCTURE
    JPrologEngine.TPTYPE_ATOM

[top] [up] [next]

 

info@trinc-prolog.com