Hi!

Have you already had a look at the manual? There are some sections on
integrating Jess and Java.

In Jess you can easily create Java objects using the (new) function. E.g.,
in order to create a Vector and append some values you just say

(bind ?v (new java.util.Vector))
(call ?v addElement (new java.lang.String "hello"))
(call ?v addElement (new java.lang.String "world"))

You can also omit the call command yielding statements like

(?v addElement (new java.lang.Integer 5))

When you declare a JavaBean using (defclass) Jess defines a deftemplate
containing one slot per property. Further, there is a slot named "OBJECT"
containing the reference to your JavaBean object. You have to use that
reference in order to call the object's methods. Example:

(defrule your-rule
     (aproxy (allowedCountries ?allowedCountries) ... (OBJECT ?proxy))
     ( ... (?proxy selectAllPositions ...) )

One more thing:

How did you define your ProxyAccount class? Normally, only properties
accessible via the usual JavaBean getter/setter methods appear as slots in
the deftemplate. Member variables (e.g., m_countries looks like one) do not
show (encapsulation!!!).

Thomas

________________________________

Dipl.-Inform. Thomas Barnekow
Fraunhofer IAO, Competence Center Software Technology
                                               
 mail:   Nobelstra�e 12, D-70569 Stuttgart,    
         Germany                               
                                               
 phone:  +49 (0) 711 / 970 - 2346              
                                               
 fax:    +49 (0) 711 / 970 - 2300              
                                               
 mobile: +49 (0) 172 / 7126018                 
                                               
 email:  [EMAIL PROTECTED]            
                                               
 web:    http://www.swt.iao.fhg.de             
                                               





                                                                                      
                    "Gupta, Lokesh"                                                   
                    <lokesh.gupta@gs.        To:     [EMAIL PROTECTED]            
                    com>                     cc:                                      
                    Sent by:                 Subject:     JESS: How to create a new   
                    owner-jess-users@        object                                   
                    sandia.gov                                                        
                                                                                      
                                                                                      
                    17.03.00 02:58                                                    
                    Please respond to                                                 
                    "Gupta, Lokesh"                                                   
                                                                                      
                                                                                      




Please take a look at the following rule:

(defclass aproxy ProxyAccount)
(defclass cprice CheckPrice)

(defrule ChecksForExistence
           ?aproxy <- (aproxy (allowedCountries ?allowedCountries)
(allowedCurrencies ?allowedCurrencies) (allowedProducts ?allowedProducts)
(class ?class) (m_assetClasses ?m_assetClasses) (m_countries ?m_countries)
(m_currencies ?m_currencies) (m_dTotalValue ?m_dTotalValue) (m_productList
?m_productList) (m_vPositions ?m_vPositions) (totalAmount ?totalAmount)
(OBJECT ?o))
           (test (> ?totalAmount 300000.0))

           ;; QUESTION?
           ;; I need to create a new CheckPrice object and pass it to the
selectAllPositions method of ?aproxy.

           ;;(test (> (call (call selectAllPositions (new CheckPrice 5.0))
size) 0))

           =>
           (printout t "Test successful" crlf)
)

How can I create this CheckPrice object?

Thanks

Lokesh
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify
[EMAIL PROTECTED]
---------------------------------------------------------------------





---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to