Difference between revisions of "Extensions.Util.ListIndexOf"

From emotive
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE:  '''ListIndexOf'''}}[[Category:Util]]
 
{{DISPLAYTITLE:  '''ListIndexOf'''}}[[Category:Util]]
 
== Classification ==
 
== Classification ==
{{ClassificationActivity | ListIndexOf | UPDATING...<!--Create an event source for change event--> | [[Term]] | [[Extensions.Util|OTX Util extension]] | UPDATING... | UPDATING... | UPDATING... }}
+
{{ClassificationActivity | ListIndexOf | Gets the first index of a given value | [[Term]] | [[Extensions.Util|OTX Util extension]] | [[Extensions.Util#Terms|Util related terms]] | - | - }}
  
 
== OTL Syntax ==
 
== OTL Syntax ==
UPDATING...<!--
 
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
EventSourceTerm = EventHandling.MonitorChangeEventSource(Variable);
+
IntegerTerm Util.ListIndexOf(ListTerm list, Term value);
 
</syntaxhighlight>
 
</syntaxhighlight>
-->
 
  
 
== Description ==
 
== Description ==
UPDATING...<!--
+
The OTX '''ListIndexOf''' term is an IntegerTerm that returns the first index of a given value in the List. In case the value is not contained inside the list, -1 will be returned.
The OTX '''MonitorChangeEventSource''' term creates an event source that monitors the value of a variable and an event triggers when the value changed. Event queue should start immediately as soon as the event source is created.
 
  
{{Note|The case when a value to a previously uninitialized variable is assigned to count as a change event and make no mistake.}}
+
{{TermReturnValue| [[Core.DataTypes.SimpleDataType.Integer|Integer]] | The first index of a given value in the List. In case the value is not contained inside the list, -1 will be returned.}}
 
 
{{TermReturnValue| [[Extensions.EventHandling.EventSource|EventSource]] | '''The EventSource''', the changes in the value of a variable monitored.}}
 
  
 
== Properties ==
 
== Properties ==
UPDATING...//
 
 
{| {{TableHeader}}
 
{| {{TableHeader}}
 
{{TableRowPropertiesHeader}}
 
{{TableRowPropertiesHeader}}
{{TableRowPropertie1| Variable | - | [[Variable]] | - | [1] | The variable which has to be monitored.}}
+
{{TableRowPropertie1| List | [[Core.DataTypes.ComplexDataType.List|List]] | [[Term]] | - | [1..1] | The List which shall be checked for the value.}}
 +
{{TableRowPropertie2| Value | - | [[Term]] | - | [1..1] | The value whose index in the List shall be determined.}}
 
|}
 
|}
-->
 
  
 
== OTL Examples ==
 
== OTL Examples ==
UPDATING...<!--
 
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
Boolean Bool1 = false;
+
/// Local Declarations
EventHandling.EventSource EventSource1;
+
 
EventHandling.Event Event1;
+
Integer Integer1;
 +
 
 +
/// Flow
  
EventSource1 = EventHandling.MonitorChangeEventSource(Bool1);
+
Integer1 = Util.ListIndexOf({&AA, &AB, &AC}, &AB);
parallel
 
{
 
  lane
 
  {
 
      Bool1 = true;
 
  }
 
  lane
 
  {
 
      EventHandling.WaitForEvent({EventSource1}, Event1);
 
  }
 
}
 
 
</syntaxhighlight>
 
</syntaxhighlight>
-->
 
  
 
== See also ==
 
== See also ==

Latest revision as of 03:01, 8 November 2018

Classification

Name ListIndexOf
Short Description Gets the first index of a given value
Class Term
Extension OTX Util extension
Group Util related terms
Exceptions -
Checker Rules -
Standard Compliant Yes

OTL Syntax

IntegerTerm Util.ListIndexOf(ListTerm list, Term value);

Description

The OTX ListIndexOf term is an IntegerTerm that returns the first index of a given value in the List. In case the value is not contained inside the list, -1 will be returned.

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
Integer The first index of a given value in the List. In case the value is not contained inside the list, -1 will be returned.

Properties

Name Data Type Class Default Cardinality Description
List List Term - [1..1] The List which shall be checked for the value.
Value - Term - [1..1] The value whose index in the List shall be determined.

OTL Examples

/// Local Declarations

Integer Integer1;

/// Flow

Integer1 = Util.ListIndexOf({&AA, &AB, &AC}, &AB);

See also

Compare
CopyByteField
GetRandomNumber
IsInitialized
ListIndexOfAny
ListReverse
ListSort
Max
Min
StringFormat