New (SortOrder constructor): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
m (misc cleanup)
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<span style="font-size:120%; color:black"><b>Create SortOrder object that has no sorting order or sorting key</b></span>
{{Template:SortOrder:New subtitle}}
[[Category:SortOrder methods|New constructor]]
<!--DPL?? Category:SortOrder methods|New constructor: Create SortOrder object that has no sorting order or sorting key-->
<!--DPL?? Category:System methods|New (SortOrder constructor): Create SortOrder object that has no sorting order or sorting key-->
<p>
New is a member of the [[SortOrder class]].
</p>
   
   
This method creates a new instance of the SortOrder class.
The <var>SortOrder</var> instance created by <var>New</var> is empty, that is, without a
The SortOrder created by New 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==
  %sord = New
{{Template:SortOrder:New syntax}}
 
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table>
<tr><th><i>%sord</i>
<tr><th>%sortOrder</th>
</th><td>A SortOrder object variable to contain the new object instance.
<td>A <var>SortOrder</var> object variable to contain the new object instance.</td></tr>
</td></tr></table>


==Usage Notes==
<tr><th nowrap><var>[%(SortOrder For </var>itemType<var>):]</var></th>
<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>
 
==Usage notes==
<ul>
<ul>
<li>New 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"><nowiki>%sord = new
   
   
%sord = %(sortOrder for object stringlist):new
%sord = %(SortOrder for object stringlist):new
   
   
%sord = %sord:new
%sord = %sord:new
</p>
%arraylist2 = %arraylist1:sortnew(new)
<p class="note">'''Note:'''
</nowiki></p>
As shown above, if you explicitly specify the
class name, you must include the item datatype of the collection to be sorted, just as on a <var>SortOrder</var> object variable's [[SortOrder class#Declaring a SortOrder object variable|declaration]]. </p>
 
<var>New</var> can also be invoked directly as a parameter of a <var>[[Sort (Arraylist subroutine)|Sort]]</var> subroutine or <var>[[SortNew (GenericNamedArraylist function)|SortNew]]</var> function:
<p class="code">%arraylist2 = %arraylist1:sortnew(new)
</p>
</ul>
</ul>
==See also==
{{Template:SortOrder:New footer}}

Latest revision as of 16:09, 6 April 2015

Create a new, null SortOrder (SortOrder class)


The SortOrder instance 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

    Note: As shown above, if you explicitly specify the class name, you must include the item datatype of the collection to be sorted, just as on a SortOrder object variable's declaration.

    New can also be invoked directly as a parameter of a Sort subroutine or SortNew function:

    %arraylist2 = %arraylist1:sortnew(new)

See also