Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

alice.tuprolog
Class Prolog  view Prolog download Prolog.java

java.lang.Object
  extended byalice.tuprolog.Prolog
All Implemented Interfaces:
java.io.Serializable

public class Prolog
extends java.lang.Object
implements java.io.Serializable

It's the main class of the tuProlog system.

Its instances are prolog machine able to manage theories, loading libraries and solving goals.

a prolog object is instatiable everywhere and anytime. A prolog object (with default libraries) is also serializable and so transportable through the net.


Field Summary
private  PrologVM imp
           
static java.lang.String VERSION
          tuProlog version
 
Constructor Summary
Prolog()
          construction with default libraries: ISOLibrary, MetaLibrary, JavaLibrary, IOLibrary
Prolog(java.lang.String[] libs)
          construction specifying (eventually) libraries
 
Method Summary
 void addOutputListener(OutputListener l)
           
 void addSpyListener(SpyListener l)
           
 void addStateListener(StateListener l)
           
 void addTheory(Theory theory)
          adds (appending) a theory to the current one
 void clearTheory()
          clears current theory
 PrologVM getImpl()
          gets more advanced and technical interface to the engine
 Library getLibrary(java.lang.String name)
          gets a previously loaded library
 Theory getTheory()
          gets current dynamic theory
 boolean isSpy()
          checks if the engine is producing SpyEvent info
 Library loadLibrary(java.lang.String className)
          loads a builtin library
 void removeOutputListener(OutputListener l)
           
 void removeSpyListener(SpyListener l)
           
 void removeStateListener(StateListener l)
           
 void setSpy(boolean on)
          sets spy state: if true the engine produce SpytEvent to listeners
 void setTheory(Theory theory)
          replaces current theory with a new one
 SolveInfo solve(java.lang.String g)
          tries to demonstrate a goal.
 SolveInfo solve(Term g)
          tries to demonstrate a goal.
 void solveEnd()
          accepts current solution
 void solveHalt()
          halts the demonstration
 SolveInfo solveNext()
          tries to find another solution.
 Term toTerm(java.lang.String s)
          gets a term from a string
 void unloadLibrary(java.lang.String className)
          unloads previously loaded builtin library
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
tuProlog version

See Also:
Constant Field Values

imp

private PrologVM imp
Constructor Detail

Prolog

public Prolog()
construction with default libraries: ISOLibrary, MetaLibrary, JavaLibrary, IOLibrary


Prolog

public Prolog(java.lang.String[] libs)
       throws InvalidLibraryException
construction specifying (eventually) libraries

Method Detail

clearTheory

public void clearTheory()
clears current theory


getTheory

public Theory getTheory()
gets current dynamic theory


setTheory

public void setTheory(Theory theory)
               throws InvalidTheoryException
replaces current theory with a new one


addTheory

public void addTheory(Theory theory)
               throws InvalidTheoryException
adds (appending) a theory to the current one


solve

public SolveInfo solve(Term g)
tries to demonstrate a goal.


solve

public SolveInfo solve(java.lang.String g)
                throws MalformedGoalException
tries to demonstrate a goal.


solveNext

public SolveInfo solveNext()
                    throws NoMoreSolutionException
tries to find another solution.


solveEnd

public void solveEnd()
accepts current solution


solveHalt

public void solveHalt()
halts the demonstration


loadLibrary

public Library loadLibrary(java.lang.String className)
                    throws InvalidLibraryException
loads a builtin library


unloadLibrary

public void unloadLibrary(java.lang.String className)
                   throws InvalidLibraryException
unloads previously loaded builtin library


getLibrary

public Library getLibrary(java.lang.String name)
gets a previously loaded library


setSpy

public void setSpy(boolean on)
sets spy state: if true the engine produce SpytEvent to listeners


isSpy

public boolean isSpy()
checks if the engine is producing SpyEvent info


addOutputListener

public void addOutputListener(OutputListener l)

addSpyListener

public void addSpyListener(SpyListener l)

addStateListener

public void addStateListener(StateListener l)

removeOutputListener

public void removeOutputListener(OutputListener l)

removeSpyListener

public void removeSpyListener(SpyListener l)

removeStateListener

public void removeStateListener(StateListener l)

toTerm

public Term toTerm(java.lang.String s)
gets a term from a string


getImpl

public PrologVM getImpl()
gets more advanced and technical interface to the engine