Re: [rules-users] rule with array

2012-02-16 Thread shawn
Thanks~~ -- View this message in context: http://drools.46999.n3.nabble.com/rule-with-array-tp3747680p3752097.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://list

Re: [rules-users] rule with array

2012-02-16 Thread Mark Proctor
On 15/02/2012 18:36, shawn wrote: > yeah, I have thought about it. But if I use function, I have to write three > for loops. like: > > /*function Boolean findSubject(Request request) { > > Pointer sPointer = request.getSubjectPath(); > Pointer aPointer = request.getAuthorTable(); >

Re: [rules-users] rule with array

2012-02-16 Thread shawn
Thank you~ -- View this message in context: http://drools.46999.n3.nabble.com/rule-with-array-tp3747680p3749524.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://li

Re: [rules-users] rule with array

2012-02-15 Thread Wolfgang Laun
On 15/02/2012, shawn wrote: > I found someone idea. It's kind of like split array. > when > Request( $sPath : getSubjectPath() ) // get two dimensional array > then > for( int i = 0; i < $sPath.length; i++ ) { > > insert( $sPath[i]); > > } > But I don't know

Re: [rules-users] rule with array

2012-02-15 Thread shawn
I found someone idea. It's kind of like split array. when Request( $sPath : getSubjectPath() ) // get two dimensional array then for( int i = 0; i < $sPath.length; i++ ) { insert( $sPath[i]); } But I don't know how to find the facts

Re: [rules-users] rule with array

2012-02-15 Thread shawn
yeah, I have thought about it. But if I use function, I have to write three for loops. like: /*function Boolean findSubject(Request request) { Pointer sPointer = request.getSubjectPath(); Pointer aPointer = request.getAuthorTable(); for( int i = 0; i < p.length; i++ ) {

Re: [rules-users] rule with array

2012-02-15 Thread Wolfgang Laun
Consider writing a DRL function that does the test and call it in an inline eval(). -W On 15 February 2012 18:26, shawn wrote: > Hi, > I meet a problem to find an element in an array. > First, I have a 2 dimensional array and a 1 dimensional array. > I need to compare whether the element in 2 di

[rules-users] rule with array

2012-02-15 Thread shawn
Hi, I meet a problem to find an element in an array. First, I have a 2 dimensional array and a 1 dimensional array. I need to compare whether the element in 2 dimensional array is as same as 1 dimensional array. How to solve it? Like: In Java - int [][] A; int [] B; how to iterate array A and array