Maximum (UnicodeNamedArraylist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{Template:UnicodeNamedArraylist:Maximum subtitle}}
{{Template:UnicodeNamedArraylist:Maximum subtitle}}
 
<var>Maximum</var> returns the subscript name of the <var>UnicodeNamedArraylist</var> item that has the maximum value after the application of a specified function to each item.  The function applied to each <var>UnicodeNamedArraylist</var> item, which you specify with the required <var class="term">itemFunction</var> argument, must be a method that operates on the item type and returns a <var class="product">User Language</var> [[Intrinsic classes|intrinsic]] datatype (<var>Float</var>, <var>String</var>, <var>Longstring</var>, or <var>Unicode</var>) value.
<var>Maximum</var> returns the name of the <var>UnicodeNamedArraylist</var> item that has the maximum value as returned by a specified function.  The function applied to each <var>UnicodeNamedArraylist</var> item, which you specify with the required <var class="term">itemFunction</var> argument, must be a method that operates on the item type and returns a <var class="product">User Language</var> [[Intrinsic classes|intrinsic]] datatype (<var>Float</var>, <var>String</var>, or <var>Unicode</var>) value.
 
==Syntax==
==Syntax==
{{Template:UnicodeNamedArraylist:Maximum syntax}}
{{Template:UnicodeNamedArraylist:Maximum syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>unicode</th>
<tr><th>%unicode</th>
<td>A Unicode string to contain the subscript name of the item in the indicated <var>UnicodeNamedArraylist</var>that has the maximum value after the argument function has been applied. </td></tr>
<td>A Unicode variable to contain the name of the item in the indicated <var>UnicodeNamedArraylist</var>that has the maximum value as returned by the argument function. </td></tr>
<tr><th>%uniNal</th>
<tr><th>uniNal</th>
<td>A <var>UnicodeNamedArraylist</var>object. </td></tr>
<td>A <var>UnicodeNamedArraylist</var> object. </td></tr>
<tr><th>itemFunction</th>
<tr><th>itemFunction</th>
<td>A method value (a method name literal, a [[Method variables|method variable]], or even a method that returns a method value) for a method that operates on objects of the type specified on the <var class="term">uniNal</var> declaration and that returns a numeric or string value.
<td>A method value (a method name literal, a [[Method variables|method variable]], or even a method that returns a method value) that operates on objects of the type specified on the <var class="term">uniNal</var> declaration and that returns an intrinsic value.
<p>The special identity function, <var>This</var>, is the default <var class="term">itemFunction</var> value for the <var>Maximum</var> and <var>Minimum</var> methods. See [[Collections#Using the This function as the Maximum parameter|"Using the This function as the Maximum parameter"]].</p></td></tr>
<p>The special identity function, <var>This</var>, is the default <var class="term">itemFunction</var> value for the <var>Maximum</var> and <var>Minimum</var> methods. See [[Collections#Using the This function as the Maximum parameter|"Using the This function as the Maximum parameter"]].</p></td></tr>
</table>
</table>
==Usage notes==
<ul>
<li>If <var class="term">itemFunction</var> returns <var>String</var> or <var>Unicode</var> values, <var>Maximum</var> uses the collating sequence of EBCDIC or Unicode, respectively, to determine which item has the greatest value. If <var class="term">itemFunction</var> returns a numeric type, numeric comparisons are used. See the second [[Maximum (NamedArraylist function)#Examples|"example"]] for the <var>NamedArraylist</var> <var>Maximum</var> function.
<li>If the values returned by <var class="term">itemFunction</var> for two or more <var>UnicodeNamedArraylist</var> items are equal, maximum, values, <var>Maximum</var> returns the name of that item which is closest to the beginning of the <var>UnicodeNamedArraylist</var>.


==Usage notes==
<li>The parameter for <var>Maximum</var> is a method value, not a <var class="product">User Language</var> expression. That is, you cannot provide a function that itself has an argument (say, <code>ToIntegerPower(2)</code>) as the <var>Maximum</var> parameter.  The [[Maximum (Arraylist function)#Maximum and Minimum with local method|"Maximum and Minimum with local method"]] example shows a way to apply <var>[[ToIntegerPower and ToPower (Float functions)|ToIntegerPower]]</var> with <var>Maximum</var>.
<ul><li>If the function applied by <var>Maximum</var> returns string values, <var>Maximum</var> uses the decimal-equivalent value of the character bytes and determines the number of the item that has the greatest value.  Lowercase letters are first ranked alphabetically; then uppercase letters, also ranked alphabetically; finally followed by the numbers; that is: <code>'a'..'z','A'..'Z',0..9</code>.
<li>If two or more <var>UnicodeNamedArraylist </var> items have equal, maximum, values, <var>Maximum</var> returns the position of the item that appears closest to the beginning of the <var>UnicodeNamedArraylist </var>.
<li>The parameter for <var>Maximum</var> is a method value, not a <var class="product">User Language</var> expression. That is, you cannot provide a function that itself has an argument (say, <var>[[ToIntegerPower and ToPower (Float functions)|ToIntegerPower(2)]]</var>) as the <var>Maximum</var> parameter.  The [[Maximum (Arraylist function)|"Maximum/Minimum with local method"]] example shows a way to apply <var>[[ToIntegerPower and ToPower (Float functions)|ToIntegerPower]]</var> with <var>Maximum</var>.
</ul>
</ul>


==Examples==
==Examples==
For examples of <var>Maximum</var> (and <var>Minimum</var>) calls, see the [[Minimum (FloatNamedArraylist function)#Examples|"FloatNamedArraylist Minimum function example"]] in the <var>Minimum</var> method description, and [[Collections#Finding collection maxima and minima, and sorting|"Finding collection maxima and minima, and sorting"]].
For examples of <var>Maximum</var> (and <var>Minimum</var>) calls, see the [[Minimum (FloatNamedArraylist function)#Examples|"FloatNamedArraylist Minimum function example"]] in
 
the <var>Minimum</var> method description, and [[Collections#Finding collection maxima and minima, and sorting|"Finding collection maxima and minima, and sorting"]], and the [[Maximum (NamedArraylist function)#Examples|"NamedArraylist Maximum function example"]].
==See also==
==See also==
<ul><li>The <var>[[Minimum (UnicodeNamedArraylist function)|Minimum]]</var> function is the opposite of the <var>Maximum</var> function.</ul>
<ul><li>The <var>[[Minimum (UnicodeNamedArraylist function)|Minimum]]</var> function is the opposite of the <var>Maximum</var> function.</ul>
{{Template:UnicodeNamedArraylist:Maximum footer}}
{{Template:UnicodeNamedArraylist:Maximum footer}}

Latest revision as of 20:32, 1 November 2012

Name of item with maximum value or maximum value of function applied to items (UnicodeNamedArraylist class)


Maximum returns the name of the UnicodeNamedArraylist item that has the maximum value as returned by a specified function. The function applied to each UnicodeNamedArraylist item, which you specify with the required itemFunction argument, must be a method that operates on the item type and returns a User Language intrinsic datatype (Float, String, or Unicode) value.

Syntax

%unicode = uniNal:Maximum[( [itemFunction])]

Syntax terms

%unicode A Unicode variable to contain the name of the item in the indicated UnicodeNamedArraylistthat has the maximum value as returned by the argument function.
uniNal A UnicodeNamedArraylist object.
itemFunction A method value (a method name literal, a method variable, or even a method that returns a method value) that operates on objects of the type specified on the uniNal declaration and that returns an intrinsic value.

The special identity function, This, is the default itemFunction value for the Maximum and Minimum methods. See "Using the This function as the Maximum parameter".

Usage notes

  • If itemFunction returns String or Unicode values, Maximum uses the collating sequence of EBCDIC or Unicode, respectively, to determine which item has the greatest value. If itemFunction returns a numeric type, numeric comparisons are used. See the second "example" for the NamedArraylist Maximum function.
  • If the values returned by itemFunction for two or more UnicodeNamedArraylist items are equal, maximum, values, Maximum returns the name of that item which is closest to the beginning of the UnicodeNamedArraylist.
  • The parameter for Maximum is a method value, not a User Language expression. That is, you cannot provide a function that itself has an argument (say, ToIntegerPower(2)) as the Maximum parameter. The "Maximum and Minimum with local method" example shows a way to apply ToIntegerPower with Maximum.

Examples

For examples of Maximum (and Minimum) calls, see the "FloatNamedArraylist Minimum function example" in the Minimum method description, and "Finding collection maxima and minima, and sorting", and the "NamedArraylist Maximum function example".

See also

  • The Minimum function is the opposite of the Maximum function.