SubsetNew (FloatNamedArraylist function): Difference between revisions
m (1 revision) |
m (1 revision) |
||
Line 14: | Line 14: | ||
SubsetNew is available in ''Sirius Mods'' version 7.6 and later. | SubsetNew is available in ''Sirius Mods'' version 7.6 and later. | ||
==Syntax== | ==Syntax== | ||
<p class="code">%fnamraylNew = %fnamrayl:SubsetNew(criterion) | |||
</p> | |||
===Syntax Terms=== | ===Syntax Terms=== | ||
<dl> | <dl> | ||
Line 56: | Line 57: | ||
of objects of the <tt>annual</tt> class that is defined in the | of objects of the <tt>annual</tt> class that is defined in the | ||
request in the [[Minimum (FloatNamedArraylist function)#Examples|FloatNamedArraylist Minimum function example]]. | request in the [[Minimum (FloatNamedArraylist function)#Examples|FloatNamedArraylist Minimum function example]]. | ||
< | <p class="code">%fann is floatnamedArraylist of object annual | ||
%fannNew is floatnamedArraylist of object annual | |||
%fann = new | |||
%fann(12) = newa(621, 650) | |||
%fann(14) = newa(334, 343) | |||
%fann(15) = newa(288, 276) | |||
%fann(13) = newa(141, 182) | |||
%fann(11) = newa(131, 115) | |||
%sel is object selectionCriterion for object annual | |||
%sel = LT(chg, 0) | |||
%fannNew = %fann:findSubsetNew(%sel) | |||
%fannNew:print(myprint) | |||
</ | </p> | ||
The result shows the default print formatting of item number (position) | The result shows the default print formatting of item number (position) | ||
and item name (float) | and item name (float) | ||
followed by colons, then the item value (<tt>myprint</tt> output): | followed by colons, then the item value (<tt>myprint</tt> output): | ||
< | <p class="code">1: 12: ybegin=621, yend=650 | ||
2: 13: ybegin=141, yend=182 | |||
3: 14: ybegin=334, yend=343 | |||
</p> | |||
</ |
Revision as of 20:54, 28 January 2011
<section begin=dpl_desc/>Return all matching FloatNamedArrayl<section end=dpl_desc/>
SubsetNew is a member of the FloatNamedArraylist class.
This function searches the entire FloatNamedArraylist to find and return all items that match a specified criterion. The criterion is supplied by the SelectionCriterion object that is the required SubsetNew parameter. If no item satisfies the criterion, SubsetNew returns an empty FloatNamedArraylist.
SubsetNew is available in Sirius Mods version 7.6 and later.
Syntax
%fnamraylNew = %fnamrayl:SubsetNew(criterion)
Syntax Terms
- %fnamraylNew
- A FloatNamedArraylist variable of the same type as the method FloatNamedArraylist (%fnamrayl) to contain the items that are located by the search. If %fnamraylNew is not empty, its contents are discarded before it is populated by the return items from SubsetNew.
- %fnamrayl
- A FloatNamedArraylist object.
- criterion
- A SelectionCriterion object, which is a relational expression that is applied to a %fnamrayl item value to determine whether the value satisfies the expression. The expression consists of a function, an operator, and a numeric or string value. For example, LT(this, -11) is the criterion this < -11, where this is an identity function that simply returns the item's value. The items that satisfy this expression populate the FloatNamedArraylist that SubsetNew returns. The function in the criterion is a method value (a method or class member name literal, or a method variable) for a method that operates on items of the type specified on the %fnamrayl declaration and that returns a numeric or string value. This is described further in "Specifying a SelectionCriterion's parameters".
Usage Notes
- FindNextItem is similar to SubsetNew except that it returns just the first matching item it encounters.
Examples
In the following fragment, a SubsetNew call is applied to a FloatNamedArraylist of objects of the annual class that is defined in the request in the FloatNamedArraylist Minimum function example.
%fann is floatnamedArraylist of object annual %fannNew is floatnamedArraylist of object annual %fann = new %fann(12) = newa(621, 650) %fann(14) = newa(334, 343) %fann(15) = newa(288, 276) %fann(13) = newa(141, 182) %fann(11) = newa(131, 115) %sel is object selectionCriterion for object annual %sel = LT(chg, 0) %fannNew = %fann:findSubsetNew(%sel) %fannNew:print(myprint)
The result shows the default print formatting of item number (position) and item name (float) followed by colons, then the item value (myprint output):
1: 12: ybegin=621, yend=650 2: 13: ybegin=141, yend=182 3: 14: ybegin=334, yend=343