New (SortOrder constructor): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
Line 1: Line 1:
{{Template:SortOrder:New subtitle}}
{{Template:SortOrder:New subtitle}}
   
   
This method creates a new instance of the SortOrder class.
This method creates a new instance of the <var>SortOrder</var> class.
The SortOrder created by New is empty, that is, without a
The <var>SortOrder</var> created by <var>New</var> is empty, that is, without a
sorting order or sorting key.
sorting order or sorting key.
Applied as the parameter of a Sort or SortNew method, an empty SortOrder
Applied as the parameter of a [[Collections|collection]] class [[Collections#Sorting an Arraylist using one sort criterion|sorting method]], an empty <var>SortOrder</var>
produces a copy of the input collection.
produces a copy of the input collection.
==Syntax==
==Syntax==
Line 10: Line 10:
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th><i>%sord</i>
<tr><th>%sortOrder
</th><td>A SortOrder object variable to contain the new object instance.
</th><td>A <var>SortOrder</var> object variable to contain the new object instance.
</td></tr></table>
</td></tr>
<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>
</table>


==Usage notes==
==Usage notes==
<ul>
<ul>
<li>New is a constructor and as such can be called with no object,
<li><var>New</var> is a constructor and as such can be called with no object,
with an explicit class
with an explicit class
name and collection item type, or with an object variable, even if
name and collection item type, or with an object variable, even if
that object is null:
that object is null:
<p class="code"><nowiki>%sord = new
<p class="code">%sortOrder = new
   
   
%sord = %(sortOrder for object stringlist):new
%sortOrder = %(sortOrder for object stringlist):new
   
   
%sord = %sord:new
%sortOrder = %sortOrder:new
   
   
%arraylist2 = %arraylist1:sortnew(new)
%arraylist2 = %arraylist1:sortnew(new)
</nowiki></p>
</p>
</ul>
</ul>
==See also==
==See also==
{{Template:SortOrder:New footer}}
{{Template:SortOrder:New footer}}

Revision as of 21:55, 29 June 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) 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: %(SortOrder For itemtype):

Usage notes

  • New is a constructor and as such can be called with no object, with an explicit class name and collection item type, or with an object variable, even if that object is null:

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

See also