Previous Next        Current Page: NeXtMidas Training / Getting Started - Part 2 / Advanced Results Parameters / Type Casting
back
Start Here   
Background   
Common Midas Concepts   
Getting Started - Part 1   
Getting Started - Part 2   
   - Advanced Results Parameters   
      - Tables   
         - Creating   
         - Accessing   
         - Modifying   
         - Advanced   
      - In-Line Functions   
      - Objects   
         - The Invoke and New Commands   
      - Using Carets   
      - Using Flag Strings   
      - Automatic Type Conversion   
      - Type Casting   
   + Lab 3   
   + Threads in NeXtMidas   
   + Lab 4   
Working with Files   
Option Trees   
Macros - Part 1 (Basics)   
Macros - Part 2 (Graphics)   
NetBeans - Part 1 (Setup)   
NetBeans - Part 2 (GUIs)   
NetBeans - Part 3 (Profiler)   
Eclipse - Part 1 (Setup)   
Eclipse - Part 2 (GUIs)   
Primitives   
WebStart   
Maps & Imagery   
X-Midas Interoperability   
RMIF & Remoting   
Installing NeXtMidas   
Support & Maintenance   
File Handlers   


  • Type Casting
    • It is possible to manually cast a value to a given type.
      • This is done by prefixing the value with a type specifier.
        nM> res L:pi 3.14
        <Casting to an integer discards any fractional part.>
        nM> res pi
          L: PI              = 3
        
      • The types for integers match the Midas types, not Java types.
      Data Type Type Specifier
      Signed Byte B:
      Signed (Short) Integer I:
      Signed Long Integer L:
      Signed Extra-Long Integer X:
      Single-Precision Floating Point F:
      Double-Precision Floating Point D:
      ASCII (similar to S:) A:
      String S:
      Generic Number (same as D:) N:
      Untranslated (do not substitute results values) U:
      Unknown (same as D: for numbers, S: all others) _:
      Message (used only in processMessage) M:
      Table T:
      Object O:
      Boolean Z:
      List (X-Midas 4.6.0+ only) C:
      Table (X-Midas 4.6.0+ only) H:
      KVList (X-Midas 4.6.0+ only) K:
      XMValue (X-Midas 4.6.0+ only) V:
Data types not yet in BLUE ICD
  • Support for boolean was added in NeXtMidas 2.5.0. It has not been formally added to the Blue File CCD or X-Midas; however X-Midas has reserved the 'Z' type letter for this purpose.
  • X-Midas 4.6.0+ List ('C'), Table ('H'), KVList ('K'), and XMValue ('V') data types have not been formally added to the Blue File CCD or NeXtMidas.
X-Midas Users Take Note:
Use of A: is discouraged in NeXtMidas, S: should be used in place of it. The presence of A: is maintained for the benefit of X-Midas users, but may be deprecated in the future.
Don't Make This Mistake:
There are several key differences between ASCII (A:) values and String (S:) values:
  • ASCII values store 7-bit ASCII characters, Strings can store Unicode characters.
  • ASCII values are Fortran strings (trailing space is discarded), Strings can have trailing white space.
  • ASCII values are typically allocated in 8-byte blocks similar to the usage of the ASCII type in a Blue File (e.g. the XA value "ABC" takes up 80 bytes, "ABC" followed by 77 spaces that get ignored), Strings use only the space required.
  • ASCII values are treated as unquoted and can lose case sensitivity within a table in situations that a normal String would not. (While this is not ideal, it matches legacy behavior.)

back