Purpose: To find customer charges that do not have required matching
categories. Matching requirements can change.
Example: A charge in category A requires a charge in Category B. Or a
charge in category A requires a charge in Category B and Category C.
Data structure: Customer object with customer id, a Vector of customer
charge objects, Category Object with the category name and a Vector of
charge codes, Customer charge object with charge code, charge description,
etc .
I want to use Jess because the matching rules can be changed and/or added by
the application.
There will only be 1 customer at a time in working memory, but all the
categories will reside in working memory.
The matching rules may require multiple categories. If I were to code this
in Java I would do something
like:
while (customer charges)
if category_A contains customer_charge then
cat_a_flag = TRUE
if category_B contains customer_charge then
cat_b_flag = TRUE
end while
if (cat_a_flag and not cat_b_flag) then
print "charge missing have A without B
end
while (customer charges)
if category_A contains customer_charge then
cat_a_flag = TRUE
if category_B contains customer_charge then
cat_b_flag = TRUE
if category_C contains customer_charge then
cat_c_flag = TRUE
end while
if (cat_a_flag and not cat_b_flag and not cat_c_flag) then
print "charge missing have A without B and without C
end
I'm having trouble designing/coding this in Jess. Specifically getting the
iterator for the vector of customer charges.
I'm basically trying to duplicate the pseudo code above.
(deftemplate Customer "Java Object"
(declare (from-class com.accuserverx.accucharge.batchprocess.Customer)))
(deftemplate ChargeCategory "Java Object"
(declare (from-class
com.accuserverx.accucharge.batchprocess.ChargeCategory)))
(deftemplate Charges "Java Object"
(declare (from-class com.accuserverx.accucharge.batchprocess.Charges)))
(deftemplate flags (slot surgflag (default FALSE)) (slot anestflag (default
FALSE)))
(defrule rule_test
; get customer charge vector of Charges where the vector is not null
(Customer (customerCharges ?chgVect&:(neq ?chgVect nil)))
; get the iterator for the charge vector to use in the while
(bind ?chgitr (?chgVect iterator))
I get a "Bad slot value" error on the second parenthesis in the bind.
--
View this message in context:
http://www.nabble.com/Java-Vector-iterator-Application-Design-issue-tp14689345p14689345.html
Sent from the Jess mailing list archive at Nabble.com.
--------------------------------------------------------------------
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]
--------------------------------------------------------------------