|
|||||||||
Home >> All >> alice >> tuprolog >> [ lib overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
alice.tuprolog.lib
Class JavaLibrary

java.lang.Objectalice.tuprolog.Library
alice.tuprolog.lib.JavaLibrary
- All Implemented Interfaces:
- java.io.Serializable
- public class JavaLibrary
- extends alice.tuprolog.Library
this library allows the exploitation of any java available resource from prolog sources.
refer to tuProlog documentation and articles for more information
Field Summary | |
private java.util.HashMap |
currentObjects
java objects referenced by prolog terms (keys) |
private java.util.HashMap |
currentObjects_inverse
inverse map useful for implementation issue |
private int |
id
progressive conter used to identify registered objects |
private java.util.HashMap |
staticObjects
|
private java.util.HashMap |
staticObjects_inverse
|
Fields inherited from class alice.tuprolog.Library |
theory |
Constructor Summary | |
JavaLibrary()
|
Method Summary | |
boolean |
array_byte_list_2(alice.tuprolog.Struct g)
bidirectional conversion of a byte array and a prolog list |
boolean |
array_byte_to_array_object_2(alice.tuprolog.Struct g)
conversion of java byte array to an array of generic object |
boolean |
array_float_to_array_object_2(alice.tuprolog.Struct g)
conversion of java float array to an array of generic object |
boolean |
array_int_list_2(alice.tuprolog.Struct g)
bidirectional conversion of an int array and a prolog list |
boolean |
array_int_to_array_object_2(alice.tuprolog.Struct g)
conversion of java int array to an array of generic object |
protected alice.tuprolog.Term |
bindObject(java.lang.Object obj)
bind and object to a new generated id |
protected boolean |
bindObject(alice.tuprolog.Term id,
java.lang.Object obj)
tries to bind specified id to a provided java object |
void |
dismiss()
method invoked by prolog engine when library is going to be removed |
protected alice.tuprolog.Term |
getGroundObject(alice.tuprolog.Term term,
int id)
get a ground object id related to a term id |
protected int |
getObjId()
|
protected java.lang.String |
getRawAtom(java.lang.String st)
get atom without eventually present ' ' at the begin and at the end |
java.lang.Object |
getRegisteredObject(alice.tuprolog.Struct id)
gets a registered object (returns null if not presents) |
boolean |
java_array(java.lang.String type,
int nargs,
alice.tuprolog.Term id)
java array creation |
boolean |
java_call_3(alice.tuprolog.Struct g)
object method invocation |
boolean |
java_class_2(alice.tuprolog.Struct g)
get the class given the name |
boolean |
java_class_4(alice.tuprolog.Struct g)
java class creation (dynamic compilation) |
private boolean |
java_get(alice.tuprolog.Term objId,
alice.tuprolog.Term fieldTerm,
alice.tuprolog.Term what)
|
boolean |
java_object_3(alice.tuprolog.Struct g)
java object creation |
private boolean |
java_set(alice.tuprolog.Term objId,
alice.tuprolog.Term fieldTerm,
alice.tuprolog.Term what)
|
void |
onSolveBegin(alice.tuprolog.Term goal)
method invoked when the engine is going to demonstrate a goal |
private boolean |
parse_arg(java.lang.Object[] values,
java.lang.Class[] types,
int i,
alice.tuprolog.Term t)
|
private boolean |
parse_as(java.lang.Object[] values,
java.lang.Class[] types,
int i,
alice.tuprolog.Term castWhat,
alice.tuprolog.Term castTo)
parsing 'as' operator, which allows to define the specific class of an argument |
private Signature |
parseArg(java.lang.Object[] objs)
|
(package private) Signature |
parseArg(alice.tuprolog.Struct method)
creation of method signature from prolog data |
private boolean |
parseResult(alice.tuprolog.Term id,
java.lang.Object obj)
parses return value of a method invokation |
protected void |
preregisterObjects()
objects actually pre-registered in order to be available since the beginning of demonstration |
private void |
readObject(java.io.ObjectInputStream in)
handling readObject method is necessary in order to have the library reconstructed after a serialization |
boolean |
register(alice.tuprolog.Struct id,
java.lang.Object obj)
registers an object with a specified id |
protected void |
registerObject(alice.tuprolog.Term term,
java.lang.Object obj)
|
boolean |
string_atom_2(alice.tuprolog.Struct g)
bidirectional conversion of java string and a prolog atom |
private void |
writeObject(java.io.ObjectOutputStream out)
handling writeObject method is necessary in order to make the library serializable, 'nullyfing' eventually objects registered in maps |
Methods inherited from class alice.tuprolog.Library |
getEngine, getRenamedCopy, getTheory, onSolveEnd, setEngine, unify |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
currentObjects
private java.util.HashMap currentObjects
- java objects referenced by prolog terms (keys)
currentObjects_inverse
private java.util.HashMap currentObjects_inverse
- inverse map useful for implementation issue
staticObjects
private java.util.HashMap staticObjects
staticObjects_inverse
private java.util.HashMap staticObjects_inverse
id
private int id
- progressive conter used to identify registered objects
Constructor Detail |
JavaLibrary
public JavaLibrary()
Method Detail |
dismiss
public void dismiss()
- Description copied from class:
alice.tuprolog.Library
- method invoked by prolog engine when library is
going to be removed
onSolveBegin
public void onSolveBegin(alice.tuprolog.Term goal)
- Description copied from class:
alice.tuprolog.Library
- method invoked when the engine is going
to demonstrate a goal
preregisterObjects
protected void preregisterObjects()
- objects actually pre-registered in order to be
available since the beginning of demonstration
java_object_3
public boolean java_object_3(alice.tuprolog.Struct g)
- java object creation
java_class_2
public boolean java_class_2(alice.tuprolog.Struct g)
- get the class given the name
java_class_4
public boolean java_class_4(alice.tuprolog.Struct g)
- java class creation
(dynamic compilation)
java_call_3
public boolean java_call_3(alice.tuprolog.Struct g)
- object method invocation
java_set
private boolean java_set(alice.tuprolog.Term objId, alice.tuprolog.Term fieldTerm, alice.tuprolog.Term what)
java_get
private boolean java_get(alice.tuprolog.Term objId, alice.tuprolog.Term fieldTerm, alice.tuprolog.Term what)
java_array
public boolean java_array(java.lang.String type, int nargs, alice.tuprolog.Term id)
- java array creation
parseArg
Signature parseArg(alice.tuprolog.Struct method)
- creation of method signature from prolog data
parseArg
private Signature parseArg(java.lang.Object[] objs)
parse_arg
private boolean parse_arg(java.lang.Object[] values, java.lang.Class[] types, int i, alice.tuprolog.Term t)
parse_as
private boolean parse_as(java.lang.Object[] values, java.lang.Class[] types, int i, alice.tuprolog.Term castWhat, alice.tuprolog.Term castTo)
- parsing 'as' operator, which allows
to define the specific class of an argument
parseResult
private boolean parseResult(alice.tuprolog.Term id, java.lang.Object obj)
- parses return value
of a method invokation
array_int_list_2
public boolean array_int_list_2(alice.tuprolog.Struct g)
- bidirectional conversion of an int array
and a prolog list
array_byte_list_2
public boolean array_byte_list_2(alice.tuprolog.Struct g)
- bidirectional conversion of a byte array
and a prolog list
string_atom_2
public boolean string_atom_2(alice.tuprolog.Struct g)
- bidirectional conversion of java string
and a prolog atom
array_int_to_array_object_2
public boolean array_int_to_array_object_2(alice.tuprolog.Struct g)
- conversion of java int array to
an array of generic object
array_byte_to_array_object_2
public boolean array_byte_to_array_object_2(alice.tuprolog.Struct g)
- conversion of java byte array to
an array of generic object
array_float_to_array_object_2
public boolean array_float_to_array_object_2(alice.tuprolog.Struct g)
- conversion of java float array to
an array of generic object
register
public boolean register(alice.tuprolog.Struct id, java.lang.Object obj) throws InvalidObjectIdException
- registers an object with a specified id
getRegisteredObject
public java.lang.Object getRegisteredObject(alice.tuprolog.Struct id) throws InvalidObjectIdException
- gets a registered object
(returns null if not presents)
bindObject
protected boolean bindObject(alice.tuprolog.Term id, java.lang.Object obj)
- tries to bind specified id to a provided java object
bindObject
protected alice.tuprolog.Term bindObject(java.lang.Object obj)
- bind and object to a new generated id
getGroundObject
protected alice.tuprolog.Term getGroundObject(alice.tuprolog.Term term, int id)
- get a ground object id related to a term id
getObjId
protected int getObjId()
registerObject
protected void registerObject(alice.tuprolog.Term term, java.lang.Object obj)
getRawAtom
protected java.lang.String getRawAtom(java.lang.String st)
- get atom without eventually present ' ' at the begin and at the end
writeObject
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
- handling writeObject method is necessary in order to
make the library serializable, 'nullyfing' eventually
objects registered in maps
readObject
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
- handling readObject method is necessary in order to
have the library reconstructed after a serialization
|
|||||||||
Home >> All >> alice >> tuprolog >> [ lib overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |