Not (SelectionCriterion function): Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 22: | Line 22: | ||
<td>A <var>SelectionCriterion</var> object variable to contain the new object instance. </td></tr> | <td>A <var>SelectionCriterion</var> object variable to contain the new object instance. </td></tr> | ||
<tr><th><var>%(SelectionCriterion For</var> itemtype)</th> | <tr><th><var>%(SelectionCriterion For</var> itemtype)</th> | ||
<td>This optional specification of the class in parentheses indicates that the method is shared and does not operate on a specific instance. If you use this option, however, you must include the collection item type to which the selection expression will be applied, like this: <code>%(selectionCriterion For <i>itemtype</i>):</code> </td></tr> | <td>This optional specification of the class in parentheses indicates that the method is [[Notation conventions for methods#Shared methods|shared]] and does not operate on a specific instance. If you use this option, however, you must include the collection item type to which the selection expression will be applied, like this: <code>%(selectionCriterion For <i>itemtype</i>):</code> </td></tr> | ||
<tr><th>selectionCriterion</th> | <tr><th>selectionCriterion</th> | ||
<td>A SelectionCriterion object. </td></tr> | <td>A SelectionCriterion object. </td></tr> |
Revision as of 20:39, 28 July 2011
Matches an item if it does not meet the criterion (SelectionCriterion class)
This shared method creates a new SelectionCriterion object
that is a logical negation of its SelectionCriterion parameter.
A Not criterion returns true for a collection item if Not's
component SelectionCriterion expression is false for the item;
otherwise it returns true.
The collection searching method that makes use of this SelectionCriterion specifies:
- Whether to return the first item or item number or all items that satisfy the selection criterion.
- Where in the collection to begin searching.
Syntax
%selectionCriterion = [%(SelectionCriterion For itemType):]Not( selectionCriterion)
Syntax terms
%selectionCriterion | A SelectionCriterion object variable to contain the new object instance. |
---|---|
%(SelectionCriterion For itemtype) | This optional specification of the class in parentheses indicates that the method is shared and does not operate on a specific instance. If you use this option, however, you must include the collection item type to which the selection expression will be applied, like this: %(selectionCriterion For itemtype): |
selectionCriterion | A SelectionCriterion object. |
Usage Notes
The Not constructor is never necessary, and anything you can do with the Not can be done (probably more clearly) otherwise. For example, the following two criteria are identical:
%sel = not(gt(this(90)) %sel = le(this(90))
And the following two criteria are identical:
%sel = not(or(lt(this,70), ge(this,95))) %sel = and(ge(this,70), lt(this,95))
And these criteria are identical:
%sel = not(true) %sel = false
Internally, Nots are always converted to the inverse of the parameter criterion.