Hi Kathy -

Jess doesn't have a data type that corresponds to 'char', doesn't
recognize "'" as special characters, and doesn't understand escape
sequences except in strings as a way of expressing the escaped
character - i.e., \" . So '\b' is parsed by Jess as a four-character
symbol, quote slash b quote.

So, how do you match a JavaBean property of type 'char'? Well, you can
always use a Jess integer; so

 (defrule checkBlank
     (tRec (code 6))

6 being the ASCII for \b (bell), right?

If the character is printable, you can use either a symbol or a
String, whichever is more appropriate, for example

 (defrule checkBlank
     (tRec (code a))

 (defrule checkBlank
     (tRec (code "\""))  // The double-quote character

All of these will work.

I think Kathy Lee Simunich wrote:
> 
> How would one pattern match a blank character?  Would you use the
> c-syntax
> for blank and other white space as shown below?  Compiling the code
> below
> returns TRUE, but I can only test it by asserting tRec (code '\b') which
> of
> course matches, but is that how it is received from Java?
> The java object for tRec (using defclass instead of the
> deftemplate below), has code defined as a char, where
> it is initialized to ' '.  Should the rule below match correctly?
> 
> (deftemplate tRec
>     (slot code))
> (defrule checkBlank
>     (tRec (code '\b'))     <===does this work?
>     =>
>     (printout t "code is blank" crlf))
> 
> Thanks,
> Kathy Lee Simunich
> Argonne National Lab
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list. List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
> 
> 


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9214                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to