Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## alice.tuprolog
Class Library

    java.lang.Object
      alice.tuprolog.Library

All Implemented Interfaces:
  IPrimitives, java.io.Serializable

Direct Known Subclasses:
  BuiltIn

public abstract class Library
extends java.lang.Object
implements java.io.Serializable, IPrimitives

This abstract class is the base class for developing tuProlog built-in libraries, which can be dynamically loaded by prolog objects.

Each library can expose to engine:

- a theory (as a string assigned to theory field)
- builtin predicates: each method whose signature is boolean name_arity(Term arg0, Term arg1,...) is considered a built-in predicate provided by the library
- builtin evaluable functors: each method whose signature is Term name_arity(Term arg0, Term arg1,...) is considered a built-in functors provided by the library

See Also:
  Serialized Form

Field Summary
`protected Prolog` | `engine` prolog core which loaded the library

Constructor Summary
`Library()`

Method Summary
`void` | `dismiss()` method invoked by prolog engine when library is going to be removed
`protected Term` | `evalExpression(Term term)` Evaluates an expression.
`Prolog` | `getEngine()` Gets the engine to which the library is bound
`java.lang.String` | `getName()` Gets the name of the library.
`java.util.List[]` | `getPrimitives()` gets the list of predicates defined in the library
`java.lang.String[][]` | `getSynonymMap()` Gets the synonym mapping, as array of elements like { synonym, original name}
`java.lang.String` | `getTheory()` Gets the theory provided with the library Empty theory is provided by default.
`protected boolean` | `match(Term a0, Term a1)` tries to unify two terms The runtime (demonstration) context currently used by the engine is deployed and altered.
`void` | `onSolveBegin(Term goal)` method invoked when the engine is going to demonstrate a goal
`void` | `onSolveEnd()` method invoked when the engine has finished a demostration
`protected boolean` | `unify(Term a0, Term a1)` tries to unify two terms The runtime (demonstration) context currently used by the engine is deployed and altered.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### engine

    protected Prolog engine

  prolog core which loaded the library

Constructor Detail

### Library

    public Library()

Method Detail

### getName

    public java.lang.String getName()

  Gets the name of the library. By default the name is the class name.

  Returns:
    the library name

### getTheory

    public java.lang.String getTheory()

  Gets the theory provided with the library Empty theory is provided by default.

### getSynonymMap

    public java.lang.String[][] getSynonymMap()

  Gets the synonym mapping, as array of elements like { synonym, original name}

### getEngine

    public Prolog getEngine()

  Gets the engine to which the library is bound

  Returns:
    the engine

### unify

    protected boolean unify(Term a0,
                            Term a1)

  tries to unify two terms The runtime (demonstration) context currently used by the engine is deployed and altered.

### match

    protected boolean match(Term a0,
                            Term a1)

  tries to unify two terms The runtime (demonstration) context currently used by the engine is deployed and altered.

### evalExpression

    protected Term evalExpression(Term term)

  Evaluates an expression. Returns null value if the argument is not an evaluable expression The runtime (demo) context currently used by the engine is deployed and altered.

### dismiss

    public void dismiss()

  method invoked by prolog engine when library is going to be removed

### onSolveBegin

    public void onSolveBegin(Term goal)

  method invoked when the engine is going to demonstrate a goal

### onSolveEnd

    public void onSolveEnd()

  method invoked when the engine has finished a demostration

### getPrimitives

    public java.util.List[] getPrimitives()

  gets the list of predicates defined in the library

  Specified by:
    `getPrimitives` in interface `IPrimitives`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD