Data conversion between Java and B-Prolog

The following table converts data from Java to Prolog:
Java Prolog
Integer integer
Double real
Long integer
BigInteger integer
Boolean integer
Character string (list of codes)
String string (list of integers)
Object array list
Object $addr(I1,I2)
Notice that no primitive data type can be converted into Prolog. Data conversion from Prolog to Java follows the same protocol but a string is converted to an array of Integers rather than a String, and a Prolog atom is converted to a Java String.
Prolog Java
integer Integer
real Double
atom String
string Object array
list Object array
structure Object

The conversion between arrays and lists needs further explanation. A Java array of some type is converted into a list of elements of the corresponding converted type. For instance, an Integer array is converted into a list of integers. In contrast, a Prolog list, whatever type whose elements is, is converted into an array of Object type. When an array element is used as a specific type, it must be casted to that type.

Neng-Fa Zhou 2012-01-03