New (SortOrder constructor): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 14: Line 14:
</td></tr>
</td></tr>
<tr><th><var>%(SortOrder For</var> itemtype)</th>
<tr><th><var>%(SortOrder 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>%(SortOrder For <i>itemtype</i>):</code> </td></tr>
<td>The optional class name in parentheses denotes a <var>[[Notation conventions for methods#Constructors|Constructor]]</var>. See [[#Usage notes|"Usage notes"]], below, for more information about invoking a <var>SortOrder</var> <var>Constructor</var>.
</td></tr>
</table>
</table>


==Usage notes==
==Usage notes==
<ul>
<ul>
<li><var>New</var> is a constructor and as such can be called with no object,
<li>As described in [[Object variables#Using New or other Constructors|"Using New or other Constructors"]], <var>New</var> can be invoked with no object, with an explicit class specification, or with an object variable in the class, even if that object is <var>Null</var>:
with an explicit class
<p class="code">%sord = new
name and collection item type, or with an object variable, even if
that object is null:
<p class="code">%sortOrder = new
   
   
%sortOrder = %(sortOrder for object stringlist):new
%sord = %(SortOrder for object stringlist):new
   
   
%sortOrder = %sortOrder:new
%sord = %sord:new
   
   
%arraylist2 = %arraylist1:sortnew(new)
%arraylist2 = %arraylist1:sortnew(new)
</p>
</p>
'''Note:'''
As shown above, when explicitly indicating the
class, both the class name and the collection item datatype must be
specified just as they are on the <var>SortOrder</var> object variable's declaration.
</ul>
</ul>
==See also==
==See also==
{{Template:SortOrder:New footer}}
{{Template:SortOrder:New footer}}

Revision as of 22:12, 27 July 2011

Create a new, null SortOrder (SortOrder class)


This method creates a new instance of the SortOrder class. The SortOrder created by New is empty, that is, without a sorting order or sorting key. Applied as the parameter of a collection class sorting method, an empty SortOrder produces a copy of the input collection.

Syntax

%sortOrder = [%(SortOrder For itemType):]New

Syntax terms

%sortOrder A SortOrder object variable to contain the new object instance.
%(SortOrder For itemtype) The optional class name in parentheses denotes a Constructor. See "Usage notes", below, for more information about invoking a SortOrder Constructor.

Usage notes

  • As described in "Using New or other Constructors", New can be invoked with no object, with an explicit class specification, or with an object variable in the class, even if that object is Null:

    %sord = new %sord = %(SortOrder for object stringlist):new %sord = %sord:new %arraylist2 = %arraylist1:sortnew(new)

    Note: As shown above, when explicitly indicating the class, both the class name and the collection item datatype must be specified just as they are on the SortOrder object variable's declaration.

See also