CompositeMatcherEditor AND & OR same behaviour

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

CompositeMatcherEditor AND & OR same behaviour

epelene
In Our Application the following API’s of Glazedlist version 1.8 are used :

import ca.odell.glazedlists.matchers.CompositeMatcherEditor;
import ca.odell.glazedlists.matchers.Matcher;
import ca.odell.glazedlists.matchers.MatcherEditor;
import ca.odell.glazedlists.matchers.Matchers;

In the below Class :

package ca.odell.glazedlists.matchers;

                public class CompositeMatcherEditor
                               
                                /** require all matchers in the {@link MatcherEditor} to match */
                                 public static final int AND = 42;
                                 /** require any matchers in the {@link MatcherEditor} to match */
                                 public static final int OR = 24;

we have two MODE : AND, OR to filter the sourcelist(which of type EventList).

Please find the code snippet :
               
if (FilterFormPart.filterOption) {                                                                FilterFormPart.filterOption has values (true, false) depending on Match ALL /Match ANY
                                                compositeMatcherEditor.setMode(CompositeMatcherEditor.OR);
                                } else {
                                                compositeMatcherEditor.setMode(CompositeMatcherEditor.AND);
                                }
               
                                filterList = new FilterList<E>(sourceList, compositeMatcherEditor);


As per the new FilterList<E>(sourceList, compositeMatcherEditor) the result should be UNION of attributes selected for filter if OR operation otherwise AND of attributes selected for filter should be returned.

The main problem here is that in most of the cases OR Mode is behaving exactly as AND Mode that too when we filter the data in the Table with only one attribute or Column but when selecting the other attributes/columns and filtering, the result is fine.

Also, Sometimes there is blank value “ “ returned.

The input provided to the method are perfect and not sure what is causing the discrepancy in the result.


Reply | Threaded
Open this post in threaded view
|

Re: CompositeMatcherEditor AND & OR same behaviour

James Lemieux
Hey Peter,

I'm afraid not much can be gleaned from the small code snippet you included. You have a couple of options:

1) Post more code.
2) Write a test case of the Matcher produced by your compositeMatcherEditor.

I'd most likely want to see the individual MatcherEditors that exist within the CompositeMatcherEditor.

James 

On Thu, Apr 2, 2015 at 8:21 AM, epelene <[hidden email]> wrote:
In Our Application the following API’s of Glazedlist version 1.8 are used :

import ca.odell.glazedlists.matchers.CompositeMatcherEditor;
import ca.odell.glazedlists.matchers.Matcher;
import ca.odell.glazedlists.matchers.MatcherEditor;
import ca.odell.glazedlists.matchers.Matchers;

In the below Class :

package ca.odell.glazedlists.matchers;

                public class CompositeMatcherEditor

                                /** require all matchers in the {@link
MatcherEditor} to match */
                                 public static final int AND = 42;
                                 /** require any matchers in the {@link
MatcherEditor} to match */
                                 public static final int OR = 24;

we have two MODE : AND, OR to filter the sourcelist(which of type
EventList).

Please find the code snippet :

if (FilterFormPart.filterOption) {
FilterFormPart.filterOption has values (true, false) depending on Match ALL
/Match ANY

compositeMatcherEditor.setMode(CompositeMatcherEditor.OR);
                                } else {

compositeMatcherEditor.setMode(CompositeMatcherEditor.AND);
                                }

                                filterList = new FilterList<E>(sourceList,
compositeMatcherEditor);


As per the new FilterList<E>(sourceList, compositeMatcherEditor) the result
should be UNION of attributes selected for filter if OR operation otherwise
AND of attributes selected for filter should be returned.

The main problem here is that in most of the cases OR Mode is behaving
exactly as AND Mode that too when we filter the data in the Table with only
one attribute or Column but when selecting the other attributes/columns and
filtering, the result is fine.

Also, Sometimes there is blank value “ “ returned.

The input provided to the method are perfect and not sure what is causing
the discrepancy in the result.






--
View this message in context: http://glazedlists.1045722.n5.nabble.com/CompositeMatcherEditor-AND-OR-same-behaviour-tp5710204.html
Sent from the GlazedLists - Issues mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: CompositeMatcherEditor AND & OR same behaviour

epelene
In reply to this post by epelene
Hi James
I have attached images of what is happening step by step, is this any good to you?















Reply | Threaded
Open this post in threaded view
|

Re: CompositeMatcherEditor AND & OR same behaviour

dpatwal
In reply to this post by epelene
Hi James,


I would not be possible to share the exact test case.

I am not sure if the screen shot would have helped you.

Do you have bug on the glazedlist related to this as we can other users are also facing the same issues.

http://glazedlists.1045722.n5.nabble.com/Filtered-list-with-OR-ed-CompositeMatcherEditor-td3418452.html

Regards,
Deepak