Dan Mosedale wrote:
> 
> Paul Sandoz <[EMAIL PROTECTED]> writes:
> >
> >       Example:
> >
> >       (name == "X" && nickname == "Y") ||
> >       (email 'contains' "ZSxsxZ" || !(fax="123"))
> >
> >       Note sure how to do it beyond creating interfaces to
> >       cater for statements and operators i.e. defining
> >       a binary tree representing the statement where the
> >       nodes are operations. Not sure i am using the correct
> >       terminology but you see these types of things
> >       when looking at compiler books, if one feels
> >       so inclined, when referring to parsing statements.
> 
> I think the term you're looking for is "expression" rather than
> statement.  And yeah, a binary tree sounds like just the right
> representation.

This would be a wonderful improvement.  So each leaf node would be a
condition (i.e. a field name and a value), and each non-leaf node would
be an operator (e.g. AND or OR).  So far, this sounds good.  Now how
about adding operators like XOR.  I could see that working, but in
practice, XOR probably wouldn't be so useful... rather you might want a
custom operator that says "return True iff exactly one of an entire
group of conditions is true".  I don't think it would be possible to
implement this type of operator using a strictly binary tree... it would
need to be a tree structure that allows for more than two child nodes. 
This would also make the internal representation more similar to the way
it would be displayed in the GUI (where a binary tree would require a
slightly different internal representation).  If I'm not clear on this
point, I can write up an example.

Here's the (IMHO excellent) GUI suggestion that Matthew Thomas posted on
4/22/00:

<quote author="mpt">
Well, I don't know how hard the back-end work would be, but the GUI
design is already done ... I designed this when I first saw the filter
GUI in 4.x in 1998.

By default, it would look like this:

Filter messages which match
+--------------------------------------------------------------+-+
|[all of the following  :^]                   (  More  ) : X : |A|
| |                                                            |:|
| +-[subject :^] [contains    :^] [|                   ] : X : |:|
|                                                              |:|
|                                                              |:|
|                                                              |:|
|                                                              |:|
|                                                              |:|
|                                                              |:|
|                                                              |:|
|                                                              |V|
+--------------------------------------------------------------+-+
and perform the action [move to folder :^] [Trash    :^]


That's not really all that more complicated than the 4.x GUI, for those
who just want simple filters. The only addition is the `X' buttons,
which delete the current row -- something which you can't do in 4.x (if
you want to delete a row other than the last one in 4.x, you're stuck).

But for those users who want full Boolean filters, by selecting `all of
the following' or `any of the following' from the popup menus

+----------------------+
| subject              |
| sender               |
| body                 |
| date                 |
| priority             |
| to                   |
| to or CC             |
| age in days          |
|----------------------|
| all of the following |
| any of the following |
+----------------------+,

they could pretty easily get to something like this:

Filter messages which match
+--------------------------------------------------------------+-+
|[all of the following  :^]                   (  More  ) : X : |A|
| |                                                            |:|
| +-[any of the following  :^]                (  More  ) ( X ) |:|
| |  |                                                         |:|
| |  +-[sender  :^] [ends with   :^] [bucksch.org      ] ( X ) |:|
| |  |                                                         |:|
| |  +-[sender  :^] [contains    :^] [garcia           ] ( X ) |:|
| |                                                            |:|
| +-[subject :^] [contains    :^] [[OFFTOPIC]          ] ( X ) |:|
|                                                              |:|
|                                                              |V|
+--------------------------------------------------------------+-+
and perform the action [delete message :^]

I'd like to see the same GUI used in the Find dialog for messages and
bookmarks and stuff too.
</quote>

I agree that this would be a very nice GUI (easy to follow the logic). 
But another thing to consider is that the GUI would allow you to design
things that would be simplified when saved.  Then when re-opened, they
would be shown in their more simple (yet logically identical) form. 
Example:

[all of the following  :^]
 |
 +-[all of the following  :^]
    |
    +-[all of the following  :^]
       |
       +-[sender  :^]  [contains  :^]   [nospam    ]

should be reduced to:
[sender  :^]  [contains  :^]   [nospam   ]

since there's only one condition, no operator is needed.  But it would
be user un-friendly to disallow the creation of such in the GUI.

                                                The Amigo

Reply via email to