Difference between revisions of "Core.Terms.ToInteger"
Jump to navigation
Jump to search
(→Rules) |
|||
(20 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | [[Category:Core]] | + | {{DISPLAYTITLE:OTX '''ToInteger'''}}[[Category:Core]] |
== Classification == | == Classification == | ||
− | {{ClassificationActivity | ToInteger | | + | {{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 == |
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
− | + | IntegerTerm ToInteger(Term) | |
</syntaxhighlight> | </syntaxhighlight> | ||
== Description == | == Description == | ||
− | + | This term will return the Integer counterpart of the argument term. | |
− | {{TermReturnValue| [[Integer]] | | + | {{TermReturnValue| [[Core.DataTypes.SimpleDataType.Integer|Integer]] | Returns the Integer counterpart of the argument term.}} |
== 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 [[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] | | + | {{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.}} |
|} | |} | ||
− | == 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 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"); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== See also == | == See also == | ||
− | [[ToBoolean]] <br/> | + | [[Core.Terms.ToBoolean|ToBoolean]] <br/> |
− | [[ToFloat]] <br/> | + | [[Core.Terms.ToFloat|ToFloat]] <br/> |
− | [[ToByteField]] <br/> | + | [[Core.Terms.ToByteField|ToByteField]] <br/> |
− | [[ToString]] | + | [[Core.Terms.ToString|ToString]] |
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");