Difference between revisions of "Core.Terms.ToInteger"
Jump to navigation
Jump to search
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:OTX '''ToInteger'''}}[[Category:Core]] | {{DISPLAYTITLE:OTX '''ToInteger'''}}[[Category:Core]] | ||
== Classification == | == Classification == | ||
− | {{ClassificationActivity | ToInteger | Converts an OTX term to a value of the Integer data type | [[Term]] | [[Core|OTX Core library]] | [[Conversion terms]] | | + | {{ClassificationActivity | ToInteger | Converts an OTX term to a value of the Integer data type | [[Term]] | [[Core|OTX Core library]] | [[Conversion terms]] | [[Core.DataTypes.ComplexDataType.OutOfBoundsException|OutOfBoundsException]]<br />[[Core.DataTypes.ComplexDataType.TypeMismatchException|TypeMismatchException]] | - }} |
== OTL Syntax == | == OTL Syntax == | ||
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
− | IntegerTerm | + | IntegerTerm ToInteger(Term) |
</syntaxhighlight> | </syntaxhighlight> | ||
== Description == | == Description == | ||
− | This term | + | This term will return the Integer counterpart of the argument term. |
{{TermReturnValue| [[Core.DataTypes.SimpleDataType.Integer|Integer]] | Returns the Integer counterpart of the argument term.}} | {{TermReturnValue| [[Core.DataTypes.SimpleDataType.Integer|Integer]] | Returns the Integer counterpart of the argument term.}} | ||
Line 15: | Line 15: | ||
== Rules == | == Rules == | ||
* '''Boolean''' | * '''Boolean''' | ||
− | *: Returns 1 if {{FontColor|blue||true}}, otherwise 0 | + | *: Returns 1 if {{FontColor|blue||true}}, otherwise 0 . |
* '''Integer''' | * '''Integer''' | ||
− | *: Returns a copy of the value | + | *: Returns a copy of the value. |
* '''Float''' | * '''Float''' | ||
− | *: | + | *: Returns the integer part (the digits to the left of the decimal point will be truncated and will not be rounded). |
* '''ByteField''' | * '''ByteField''' | ||
− | *: Returns the integer value of the | + | *: Returns the integer value of the ByteField. For interpretation of the ByteField, little endian byte order and n-bit two's complement will be used, where n is the ByteField's size multiplied by 8 (in other words: the total number of bits in the original ByteField). |
* '''String''' | * '''String''' | ||
− | *: Returns the integer value of the string. The string must conform to an [[Core.Terms.IntegerLiteral|IntegerLiteral]]. If not, | + | *: Returns the integer value of the string. The string must conform to an [[Core.Terms.IntegerLiteral|IntegerLiteral]]. If not, the [[Core.DataTypes.ComplexDataType.TypeMismatchException|TypeMismatchException]] is thrown. |
== Properties == | == Properties == | ||
{| {{TableHeader}} | {| {{TableHeader}} | ||
{{TableRowPropertiesHeader}} | {{TableRowPropertiesHeader}} | ||
− | {{TableRowPropertie1| Term | - | [[Term]] | - | [1] | Represents the OTX term that | + | {{TableRowPropertie1| Term | - | [[Term]] | - | [1] | Represents the OTX term that will be converted to a new value of the Integer data type. See conversion rule descriptions above.}} |
|} | |} | ||
== OTL Examples == | == OTL Examples == | ||
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
+ | /// Local Declarations | ||
+ | |||
Integer Integer1; | Integer Integer1; | ||
Integer Integer2; | Integer Integer2; | ||
Integer Integer3; | Integer Integer3; | ||
Integer Integer4; | Integer Integer4; | ||
+ | Integer Integer5; | ||
+ | |||
+ | /// Flow | ||
− | Integer1 = | + | Integer1 = ToInteger(true); |
− | Integer2 = | + | Integer2 = ToInteger(123456); |
− | Integer3 = | + | Integer3 = ToInteger(123.456); |
− | Integer4 = | + | Integer4 = ToInteger(&18 00 FF FF); |
+ | Integer5 = ToInteger("123456"); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 02:11, 7 May 2019
Contents
Classification
Name | ToInteger |
Short Description | Converts an OTX term to a value of the Integer data type |
Class | Term |
Extension | OTX Core library |
Group | Conversion terms |
Exceptions | OutOfBoundsException TypeMismatchException |
Checker Rules | - |
Standard Compliant | Yes |
OTL Syntax
IntegerTerm ToInteger(Term)
Description
This term will return the Integer counterpart of the argument term.
Return Value
The Term returns the value, see table below.
![]()
In OTX, Terms are categorized according to its return data type!
Data Type | Description |
Integer | Returns the Integer counterpart of the argument term. |
Rules
- Boolean
- Returns 1 if true , otherwise 0 .
- Integer
- Returns a copy of the value.
- Float
- Returns the integer part (the digits to the left of the decimal point will be truncated and will not be rounded).
- ByteField
- Returns the integer value of the ByteField. For interpretation of the ByteField, little endian byte order and n-bit two's complement will be used, where n is the ByteField's size multiplied by 8 (in other words: the total number of bits in the original ByteField).
- String
- Returns the integer value of the string. The string must conform to an IntegerLiteral. If not, the TypeMismatchException is thrown.
Properties
Name | Data Type | Class | Default | Cardinality | Description |
Term | - | Term | - | [1] | Represents the OTX term that will be converted to a new value of the Integer data type. See conversion rule descriptions above. |
OTL Examples
/// Local Declarations
Integer Integer1;
Integer Integer2;
Integer Integer3;
Integer Integer4;
Integer Integer5;
/// Flow
Integer1 = ToInteger(true);
Integer2 = ToInteger(123456);
Integer3 = ToInteger(123.456);
Integer4 = ToInteger(&18 00 FF FF);
Integer5 = ToInteger("123456");