OTX Reference  
OpenTestSystem.Otx.Core.Terms.ToInteger Class Reference

Convert expression to Integer More...

Inheritance diagram for OpenTestSystem.Otx.Core.Terms.ToInteger:
Inheritance graph

Public Attributes

Term term
 The expression (term) to be converted to Integer More...
 
- Public Attributes inherited from OpenTestSystem.Otx.Core.Terms.Term
MetaData metaData
 Store additional More...
 

Detailed Description

Convert expression to Integer

The ToInteger term returns the Integer equivalent of the argument. If the argument is Boolean true it returns 1 and Boolean false it returns 0. If the argument is FLoat it returns the integer part (truncated) of the value. If the argument is ByteField it returns the Integer value of the byte field. For interpretation of the ByteField, little endian byte order and n-bit two's complement shall be used, where n is the ByteField's size multiplied by 8. If the argument is String it returns the Integer value of the string or throws an exception if this is not possible.

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.
Exceptions
Core.Exceptions.OutOfBoundsExceptionIt is thrown in the ByteField case only: if the ByteField is empty or its size is greater than 8 bytes (in that case, the value space of xsd:long is exceeded, see Annex A). Conversions from Float INF, -INF or NAN shall result this exception, or if the value exceeds the value range of Integer.
Core.Exceptions.TypeMismatchExceptionIt is thrown in the String case only: if the String does not constitute an integer value literal.
Syntax
IntegerTerm = ToInteger(Term)
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");

Member Data Documentation

◆ term

Term OpenTestSystem.Otx.Core.Terms.ToInteger.term

The expression (term) to be converted to Integer