Difference between revisions of "Extensions.Util.ListSort"

From emotive
Jump to navigation Jump to search
(Edited by Ngoc Tran. Add util_Chk001 and fix other (shall -> will))
Line 1: Line 1:
 
{{DISPLAYTITLE:  '''ListSort'''}}[[Category:Util]]
 
{{DISPLAYTITLE:  '''ListSort'''}}[[Category:Util]]
 
== Classification ==
 
== Classification ==
{{ClassificationActivity | ListSort | Creates a sorted list of the given list | [[Term]] | [[Extensions.Util|OTX Util extension]] | [[Extensions.Util#Terms|Util related terms]] | - | - }}
+
{{ClassificationActivity | ListSort | Creates a sorted list of the given list | [[Term]] | [[Extensions.Util|OTX Util extension]] | [[Extensions.Util#Terms|Util related terms]] | - | [[Extensions.Util.UtilChk001|Util_Chk001 - For the [[ListSort]] term the item Type of the list will be of [[Core.DataTypes.SimpleDataType|SimpleType]]]] }}
  
 
== OTL Syntax ==
 
== OTL Syntax ==
Line 9: Line 9:
  
 
== Description ==
 
== Description ==
The OTX '''ListSort''' term is a ListTerm that returns a copy of the given list in ascending order.
+
The OTX '''ListSort''' term is a ListTerm that returns a copy of the given list in ascending order. The comparison criterion is the same as used by the Relational operations description. <br/>
 +
The order of equal values (e.g. for quantities 1000 m and 1 km) after the sorting is not specified.
  
 
{{TermReturnValue| [[Core.DataTypes.ComplexDataType.List|List]] | The sorted list of the given list.}}
 
{{TermReturnValue| [[Core.DataTypes.ComplexDataType.List|List]] | The sorted list of the given list.}}
Line 16: Line 17:
 
{| {{TableHeader}}
 
{| {{TableHeader}}
 
{{TableRowPropertiesHeader}}
 
{{TableRowPropertiesHeader}}
{{TableRowPropertie2| List | [[Core.DataTypes.ComplexDataType.List|List]] | [[Term]] | - | [1..1] | The List from which the sorted list shall be created.}}
+
{{TableRowPropertie2| List | [[Core.DataTypes.ComplexDataType.List|List]] | [[Term]] | - | [1..1] | The List from which the sorted list will be created.}}
 
|}
 
|}
  
Line 27: Line 28:
 
/// Flow
 
/// Flow
  
 +
// Result: List1 = {0, 2, 3, 4, 5, 6, 7, 8, 9, 10}
 
List1 = Util.ListSort({9, 3, 2, 0, 10, 4, 6, 8, 5, 7});
 
List1 = Util.ListSort({9, 3, 2, 0, 10, 4, 6, 8, 5, 7});
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 04:22, 17 February 2020

Classification

Name ListSort
Short Description Creates a sorted list of the given list
Class Term
Extension OTX Util extension
Group Util related terms
Exceptions -
Checker Rules [[Extensions.Util.UtilChk001|Util_Chk001 - For the ListSort term the item Type of the list will be of SimpleType]]
Standard Compliant Yes

OTL Syntax

ListTerm Util.ListSort(ListTerm list);

Description

The OTX ListSort term is a ListTerm that returns a copy of the given list in ascending order. The comparison criterion is the same as used by the Relational operations description.
The order of equal values (e.g. for quantities 1000 m and 1 km) after the sorting is not specified.

Return Value

The Term returns the value, see table below.

Icons Note.png In OTX, Terms are categorized according to its return data type!
Data Type Description
List The sorted list of the given list.

Properties

Name Data Type Class Default Cardinality Description
List List Term - [1..1] The List from which the sorted list will be created.

OTL Examples

/// Local Declarations

List<Integer> List1;

/// Flow

// Result: List1 = {0, 2, 3, 4, 5, 6, 7, 8, 9, 10}
List1 = Util.ListSort({9, 3, 2, 0, 10, 4, 6, 8, 5, 7});

See also

Compare
CopyByteField
GetRandomNumber
IsInitialized
ListIndexOf
ListIndexOfAny
ListReverse
Max
Min
StringFormat