Re: [eclipse-clp-users] mapping between java and eclipse problem

From: Kish Shen <kisshen_at_...5...>
Date: Mon, 26 Apr 2010 22:45:09 +0100
carole dawood wrote:
> Hello,
> in my CP code, i have a predicate that returns a double and i can not read
> it in my java code, it is displayed as null so how can i read the value ??
> Thank you a lot,
> Carole Dawood
> Computer Science and Engineering
> German University in Cairo
> 

Hi,

I am not quite sure what you mean by 'a predicate that returns a 
double'. Do you mean that one argument of your predicate is instantiated 
to a real (i.e. floating point number)? If this is sent in EXDR format, 
it will map to a Java double, and should be printed (I have just tested 
this).

You should only get null back if the argument was not instantiated, or 
if the argument is instantiated to something that EXDR cannot represent, 
  e.g. a bignum (large integers).

If all you are doing is printing your results from an RPC in Java, then 
you might want to just return the result as a string (still using EXDR 
format), you can convert a term to a string using term_string/2. This 
will then be displayed in normal ECLiPSe format, instead of the much 
less readable format used by the ToString method for CompoundTerms.
The CompoundTerm format is really intended to allow the programmer to 
use the data returned from ECLiPSe, rather than just printing it out.

In fact, if all you are doing is printing your ECLiPSe results in your 
Java program, you may want to think about doing everything directly with 
ECLiPSe, which will make things much easier.

Cheers,

Kish


-- 
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.
Received on Mon Apr 26 2010 - 21:45:17 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST