Previous Next        Current Page: NeXtMidas Training / Primitives / Special Variables / List of Variables / M
back
Start Here   
Background   
Common Midas Concepts   
Getting Started - Part 1   
Getting Started - Part 2   
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   
   + Overview   
   + Open, Process, Close   
   + Building   
   + The NeXtMidas API   
   + Lab 1   
   - Special Variables   
      - List of Variables   
         - M   
         - MA   
         - MQ, MR, MW   
   + Lab 2   
   + Lab 3*   
   + Files in a Primitive   
   + Lab 4   
   + Lab 5*   
   + Test Macros   
   + Lab 6   
   + Real Time Controls   
   + Lab 7   
   + Working with Messages   
   + Lab 8   
   + Primitive Restarts   
   + Introduction to DSP   
   + Lab 9   
   - Commands executing commands   
WebStart   
Maps & Imagery   
X-Midas Interoperability   
RMIF & Remoting   
Installing NeXtMidas   
Support & Maintenance   
File Handlers   


  • The current Midas context (M):
    • Handles input and output.
    • Usually used for output from the primitive:
      M.info(<string>) Writes out "INFO:" string to the terminal.
      M.warning(<string>) Writes out "WARN:" string to the terminal.
      M.error(<string>) Writes out "ERROR:" string to the terminal and aborts.
    • Also used as the reference context when opening a file.
      new DataFile(M, <fileName>)
    • It is important to use the above methods in place of System.out.println(...) since the NeXtMidas methods handle special cases where output may need to be temporarily redirected.
  • Something very cool:
    • In Java everything is string-able. This allows anything to be concatenated to a string using a plus sign (+). For example:
      double freq = ...;
      String user = ...;
      Table  conf = ...;
      ...
      M.info("MYPRIM: Setting freq="+freq+" user="+user+" config="+conf);
Java Experts Take Note:
Calling M.error(<string>) is intended to make things easier for those new to Java. It is very similar to throwing new MidasException(<string>). Those familiar with Java should throw the exception, as that enables the normal Java code-path checking.

back