com.ifcomputer.minerva
Class Minerva

java.lang.Object
  |
  +--com.ifcomputer.minerva.Minerva

public class Minerva
extends java.lang.Object

The class Minerva is used as user interface to the Minerva engine.


Constructor Summary
Minerva(java.applet.Applet applet, java.lang.String[] args)
          This function initializes a new Minerva engine.
Minerva(java.lang.String[] args)
          This function initializes a new Minerva engine.
 
Method Summary
 void addInterface(com.ifcomputer.minerva.MrvaSysBip bip)
          Add a set of external predicates to MINERVA.
 void cleanupLiterals()
          This functions starts the garbage collection for the literal pool
 boolean execute(java.lang.String name)
          Executes a parameterless predicate.
 boolean execute(java.lang.String name, com.ifcomputer.minerva.MinervaTerm arg1)
          Executes a predicate with arity 1.
 boolean execute(java.lang.String name, com.ifcomputer.minerva.MinervaTerm[] args)
          Executes a predicate with the given arguments.
 boolean execute(java.lang.String name, com.ifcomputer.minerva.MinervaTerm arg1, com.ifcomputer.minerva.MinervaTerm arg2)
          Executes a predicate with arity 2.
 boolean execute(java.lang.String name, com.ifcomputer.minerva.MinervaTerm arg1, com.ifcomputer.minerva.MinervaTerm arg2, com.ifcomputer.minerva.MinervaTerm arg3)
          Executes a predicate with arity 3.
 boolean execute(java.lang.String name, com.ifcomputer.minerva.MinervaTerm arg1, com.ifcomputer.minerva.MinervaTerm arg2, com.ifcomputer.minerva.MinervaTerm arg3, com.ifcomputer.minerva.MinervaTerm arg4)
          Executes a predicate with arity 4.
 int getExitValue()
          returns the value by which minerva has been terminated (using the predicate halt(ExitValue)).
 java.lang.String[] getSystemArguments()
          This function returns the system arguments passed to the Minerva engine.
 java.lang.String[] getUserArguments()
          This function returns the user arguments passed to the Minerva engine.
 boolean is_daemon()
          returns true, if minerva should not be terminated with System.exit when main/1 has been executed
 boolean isDefined(java.lang.String name, int arity)
          This function tests if a predicated is defined.
 void load(java.lang.String name)
           
 void loadClass(java.lang.String name)
          Load a class defining MINERVA builtins.
 void setApplet(java.applet.Applet applet)
          Sets the applet in which MINERVA will be executed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Minerva

public Minerva(java.lang.String[] args)
        throws java.io.IOException,
               MinervaSystemError
This function initializes a new Minerva engine.

Parameters:
args - Arguments to parametrize the Minerva engine and to pass to the Minerva application (as parameter of the main/1 predicate). The following parameters are accepted as system arguments. All arguments, starting from the first non system argument, are declared as user parameter and passed as a list to the predicate main/1. If a parameter has an argument (like -sp <path>), than the parametername and its argument have to be passed in two consecutive elements of the array args.
-sp <pathlist>
Sets the searchpath. When Minerva tries to open a file in reading mode, than all directories listed in the pathlist are searched for the file (if the filename is neither relativ to the root of the filesystem not to the current working directory).
-p <filename>
Loads the property file from the file named filename. The property file is usually part of a minerva archive (*.mca).
-l <filename>
Loads compiled minerva code from a file named filename.
-b <classname>
Loads the class classname. Minerva assumes that classname is a subclass of MrvaSysBip, i.e. that it declares and implements Minerva predicates in Java.
-c <filename>
Loads a Minerva archive (*.mca file) from a file named filename.
-v
Sets the verbose mode for Minerva. In this mode Minerva prints some text to System.err to inform the user about some internal actions of the Minerva engine (like auto loading of Minerva code, garbage collection, etc).
-debug
Starts the Minerva engine in the debug mode. In this mode, it's possible to debug compiled minerva code.
-unicode
This arguments states, that all textfiles that will be manipulated by Minerva contain by default unicode characters.
-encoding <encoding>
This sets the default encoding scheme for textfiles to "encoding".
-syntax [strict|classic]
Sets the the mode for the Minerva tokenizer to "strict" or "classic". In "classic" mode all characters which an character code greater than 255 are interpreted as lower case characters. In "strict" mode the type of characters is determined through the java.lang.Character class.
--
This is a pseudo argument. It declares that all the following arguments should be interpreted as user parameters (which have to be passed as arguments to the predicate main/1.

Minerva

public Minerva(java.applet.Applet applet,
               java.lang.String[] args)
        throws java.io.IOException,
               MinervaSystemError
This function initializes a new Minerva engine.

Parameters:
applet - If Minerva is started as Applet, then pass the applet as parameter to the Minerva engine. Otherwise set this parameter to null.
args - Arguments to parametrize the Minerva engine and to pass to the Minerva application (as parameter of the main/1 predicate).
See Also:
Minerva(String[])
Method Detail

getExitValue

public int getExitValue()
returns the value by which minerva has been terminated (using the predicate halt(ExitValue)).


is_daemon

public boolean is_daemon()
returns true, if minerva should not be terminated with System.exit when main/1 has been executed


getUserArguments

public java.lang.String[] getUserArguments()
This function returns the user arguments passed to the Minerva engine. The user arguments dont contain the system arguments passed to Minerva. The user arguments are passed as argument to the predicate main/1.


cleanupLiterals

public void cleanupLiterals()
This functions starts the garbage collection for the literal pool


getSystemArguments

public java.lang.String[] getSystemArguments()
This function returns the system arguments passed to the Minerva engine. The system arguments dont contain the user arguments passed to Minerva. The system arguments are passed as argument to the predicate main/1.


loadClass

public void loadClass(java.lang.String name)
               throws MinervaSystemError
Load a class defining MINERVA builtins. To be able to load the class, the classfile must be suited in a directory named by the classpath variable.

Parameters:
name - class name
MinervaSystemError

load

public void load(java.lang.String name)
          throws java.io.IOException,
                 MinervaSystemError
java.io.IOException
MinervaSystemError

setApplet

public void setApplet(java.applet.Applet applet)
Sets the applet in which MINERVA will be executed.

Parameters:
applet - The applet in which MINERVA will be executed.

addInterface

public void addInterface(com.ifcomputer.minerva.MrvaSysBip bip)
                  throws MinervaSystemError
Add a set of external predicates to MINERVA.

Parameters:
bip - An instance of MrvaSysBip declaring and implementing a set of MINERVA predicates.
MinervaSystemError

execute

public boolean execute(java.lang.String name)
                throws MinervaSystemError
Executes a parameterless predicate.

Parameters:
name - the name of the predicate (arity is 0)
MinervaSystemError

execute

public boolean execute(java.lang.String name,
                       com.ifcomputer.minerva.MinervaTerm arg1)
                throws MinervaSystemError
Executes a predicate with arity 1.

Parameters:
name - predicate name
arg1 - the argument of the predicate
MinervaSystemError

execute

public boolean execute(java.lang.String name,
                       com.ifcomputer.minerva.MinervaTerm arg1,
                       com.ifcomputer.minerva.MinervaTerm arg2)
                throws MinervaSystemError
Executes a predicate with arity 2.

Parameters:
name - predicate name
arg1 - 1st argument
arg2 - 2nd argument
MinervaSystemError

execute

public boolean execute(java.lang.String name,
                       com.ifcomputer.minerva.MinervaTerm arg1,
                       com.ifcomputer.minerva.MinervaTerm arg2,
                       com.ifcomputer.minerva.MinervaTerm arg3)
                throws MinervaSystemError
Executes a predicate with arity 3.

Parameters:
name - predicate name
arg1 - 1st argument
arg2 - 2nd argument
arg3 - 3th argument
MinervaSystemError

execute

public boolean execute(java.lang.String name,
                       com.ifcomputer.minerva.MinervaTerm arg1,
                       com.ifcomputer.minerva.MinervaTerm arg2,
                       com.ifcomputer.minerva.MinervaTerm arg3,
                       com.ifcomputer.minerva.MinervaTerm arg4)
                throws MinervaSystemError
Executes a predicate with arity 4.

Parameters:
name - predicate name
arg1 - 1st argument
arg2 - 2nd argument
arg3 - 3th argument
arg4 - 4th argument
MinervaSystemError

execute

public boolean execute(java.lang.String name,
                       com.ifcomputer.minerva.MinervaTerm[] args)
                throws MinervaSystemError
Executes a predicate with the given arguments.

Parameters:
name - predicate name (arity is args.length)
args - the arguments of the predicate
MinervaSystemError

isDefined

public boolean isDefined(java.lang.String name,
                         int arity)
This function tests if a predicated is defined.

Parameters:
name - the name of the predicate