Maximum (FloatNamedArraylist function)

From m204wiki
Revision as of 17:28, 4 February 2011 by Wiccan (talk | contribs) (1 revision)
Jump to navigation Jump to search

<section begin=dpl_desc/>Get item that has maximum value<section end=dpl_desc/>

Maximum is a member of the FloatNamedArraylist class.

This function returns the number (subscript) of the FloatNamedArraylist item that has the maximum value after the application of a specified function to each item. The function that gets applied to each FloatNamedArraylist item, which you identify in the argument to Maximum, must be a method that operates on the item type and returns a User Language intrinsic datatype (Float, String, Longstring, or Unicode) value.

The system intrinsic classes are discussed in "Intrinsic classes". Local methods are discussed in ?? refid=localm..

Maximum is available in Sirius Mods version 7.3 and later.

Syntax

%num = %fnamrayl:Maximum(function)

Syntax terms

%num A numeric variable to contain the subscript number of the item in the indicated FloatNamedArraylist that has the maximum value after the argument function has been applied.
%fnamrayl A FloatNamedArraylist object.
function A method value (a method name literal, a method variable, or even a method that returns a method value) for a method that operates on objects of the type specified on the %fnamrayl declaration and that returns a numeric or string value. As of Sirius Mods version 7.6, the special identity function, This, is the default function value for the Maximum and Minimum methods. See Using the This function as the Maximum parameter.

Usage Notes

  • If the function applied by Maximum returns string values, Maximum uses the decimal-equivalent value of the character bytes and determines the number of the item that has the greatest value. Therefore, lowercase letters are ranked alphabetically and the maximum lowercase letter is “z”; the uppercase letters are ranked alphabetically and the maximum uppercase letter is “Z”; “z” ranks lower than all the uppercase letters; and all letters rank lower than any number.
  • If two or more FloatNamedArraylist items have equal, maximum, values, Maximum returns the subscript of the item that appears closest to the beginning of the FloatNamedArraylist.
  • 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. Example "Maximum/Minimum with local method" shows a way to apply ToIntegerPower with Maximum for an Arraylist.
  • The Minimum function is the opposite of the Maximum function.
  • For examples of Maximum (and Minimum) calls, see FloatNamedArraylist Minimum function example in the Minimum method description, and see Finding collection maxima and minima, and sorting.