package nxm.sys.inc;

import java.util.HashMap;
import java.util.Map;

/** Definitions of constants defining data types, modes, and representations.
    For historical reasons (and for compatibility with X-Midas), the data types
    and representations used by NeXtMidas do not mirror the standard Java types.
    However, analogues for most of the NeXtMidas data types are readily
    available in Java (though the names differ). This interface provides the
    identifiers necessary to properly work with the NeXtMidas data types from
    within Java.<br>
    <br>
    <a id="types"><b>NeXtMidas Data Types</b></a><br>
    The following table summarizes the data types used by NeXtMidas. Take
    careful note of the integer types (XLONG, LONG, INT) as they differ
    significantly from their Java counter-parts.
    <table style="margin-left:auto;margin-right:auto;width:90%;" border="1">
      <caption style="visibility:hidden">""</caption>
      <tr><td style="text-align:center;" rowspan="2"><b>Identifier</b></td>
          <td style="text-align:center;" rowspan="2"><b>Midas Name</b></td>
          <td style="text-align:center;" rowspan="2"><b>Java Representation</b></td>
          <td style="text-align:center;" colspan="3"><b>NeXtMidas Type Character
                                         </b></td></tr>
      <tr><td style="text-align:center;"><b>Data Type<br>
                 {@link #DATA_TYPE_LIST}</b></td>
          <td style="text-align:center;"><b>Result Type<br>
                 {@link #RESULT_TYPE_LIST}</b></td></tr>
      <tr><td>{@link #ASCII}</td>
          <td>ASCII String</td>
          <td>&nbsp;</td>
          <td style="text-align:center;">A</td>
          <td style="text-align:center;">A</td></tr>
      <tr><td>{@link #ASCII256}</td>
          <td>256 ASCII character String</td>
          <td>&nbsp;</td>
          <td style="text-align:center;">Z</td>
          <td style="text-align:center;"></td></tr>
      <tr><td>{@link #STRING}</td>
          <td>Unicode String</td>
          <td>{@link java.lang.String}</td>
          <td style="text-align:center;">&nbsp;</td>
          <td style="text-align:center;">S</td></tr>
      <tr><td>{@link #OBJECT}</td>
          <td>Java Object</td>
          <td>{@link java.lang.Object}</td>
          <td style="text-align:center;">&nbsp;</td>
          <td style="text-align:center;">O</td></tr>
      <tr><td>{@link #TABLE}</td>
          <td>Table</td>
          <td>&nbsp;</td>
          <td style="text-align:center;">&nbsp;</td>
          <td style="text-align:center;">T</td></tr>
      <tr><td>{@link #BYTE}</td>
          <td>Byte</td>
          <td>{@link java.lang.Byte}</td>
          <td style="text-align:center;">B</td>
          <td style="text-align:center;">B</td></tr>
      <tr><td>{@link #DOUBLE}</td>
          <td>Double</td>
          <td>{@link java.lang.Double}</td>
          <td style="text-align:center;">D</td>
          <td style="text-align:center;">D</td></tr>
      <tr><td>{@link #FLOAT}</td>
          <td>Float</td>
          <td>{@link java.lang.Float}</td>
          <td style="text-align:center;">F</td>
          <td style="text-align:center;">F</td></tr>
      <tr><td>{@link #XLONG}</td>
          <td>Extra Long Integer</td>
          <td>{@link java.lang.Long}</td>
          <td style="text-align:center;">X</td>
          <td style="text-align:center;">X</td></tr>
      <tr><td>{@link #LONG}</td>
          <td>Long Integer</td>
          <td>{@link java.lang.Integer}</td>
          <td style="text-align:center;">L</td>
          <td style="text-align:center;">L</td></tr>
      <tr><td>{@link #INT}</td>
          <td>(Short) Integer</td>
          <td>{@link java.lang.Short}</td>
          <td style="text-align:center;">I</td>
          <td style="text-align:center;">I</td></tr>
      <tr><td>{@link #JINT}</td>
          <td>12-Bit Integer</td>
          <td></td>
          <td style="text-align:center;">J</td>
          <td style="text-align:center;">J</td></tr>
      <tr><td>{@link #NIBBLE}</td>
          <td>Packed Nibble</td>
          <td>{@link java.lang.Byte}</td>
          <td style="text-align:center;">N</td>
          <td style="text-align:center;">N</td></tr>
      <tr><td>{@link #PACKED}</td>
          <td>Packed Bit</td>
          <td>{@link java.lang.Byte}</td>
          <td style="text-align:center;">P</td>
          <td style="text-align:center;">P</td></tr>
      <tr><td>{@link #BOOL}</td>
          <td>Boolean</td>
          <td>{@link java.lang.Boolean}</td>
          <td style="text-align:center;"></td>
          <td style="text-align:center;">Z</td></tr>
      <tr><td>{@link #ULAW}</td>
          <td>U-Law</td>
          <td><i>TBD</i></td>
          <td style="text-align:center;"><i>TBD</i></td>
          <td style="text-align:center;"><i>TBD</i></td></tr>
      <tr><td>{@link #ALAW}</td>
          <td>A-Law</td>
          <td><i>TBD</i></td>
          <td style="text-align:center;"><i>TBD</i></td>
          <td style="text-align:center;"><i>TBD</i></td></tr>
      <tr><td>{@link #NUMBER}</td>
          <td>Generic Number</td>
          <td>&nbsp;</td>
          <td style="text-align:center;">&nbsp;</td>
          <td style="text-align:center;">N</td></tr>
      <tr><td>{@link #XMVALUE}</td>
          <td>Generic XMValue</td>
          <td>{@link nxm.sys.lib.XMValue}</td>
          <td style="text-align:center;">V</td>
          <td style="text-align:center;">V</td></tr>
      <tr><td>{@link #XMVALUE_LIST}</td>
          <td>XMValue List (Collection)</td>
          <td>{@link nxm.sys.lib.XMValue}</td>
          <td style="text-align:center;">C</td>
          <td style="text-align:center;">C</td></tr>
      <tr><td>{@link #XMVALUE_KVLIST}</td>
          <td>XMValue Key-Value List</td>
          <td>{@link nxm.sys.lib.XMValue}</td>
          <td style="text-align:center;">K</td>
          <td style="text-align:center;">K</td></tr>
      <tr><td>{@link #XMVALUE_TABLE}</td>
          <td>XMValue Table (Hash table)</td>
          <td>{@link nxm.sys.lib.XMValue}</td>
          <td style="text-align:center;">H</td>
          <td style="text-align:center;">H</td></tr>
    </table><br>
    <br>
    Note: The NeXtMidas ASCII type represents a block of eight 8-bit ASCII
          characters (please see {@link #ASCII} for further details).<br>
    <br>
    <a id="modes"><b>NeXtMidas Data Modes</b></a><br>
    Along with the standard data types NeXtMidas supports the use of
    multi-value entities (or arrays). Multi-valued types with special
    names/meanings include:<br>
    <table style="margin-left:auto;margin-right:auto;width:90%;" border="1">
      <caption style="visibility:hidden">""</caption>
      <tr><td style="text-align:center;"><b>Identifier</b></td>
          <td style="text-align:center;"><b>Common Name</b></td>
          <td style="text-align:center;"><b>Number of Elements</b></td>
          <td style="text-align:center;"><b>Type Character</b></td></tr>
      <tr><td>{@link #SCALAR}</td>
          <td>Scalar</td>
          <td style="text-align:center;">1</td>
          <td style="text-align:center;">S</td></tr>
      <tr><td>{@link #COMPLEX}</td>
          <td>Complex</td>
          <td style="text-align:center;">2</td>
          <td style="text-align:center;">C</td></tr>
      <tr><td>{@link #VECTOR}</td>
          <td>Vector</td>
          <td style="text-align:center;">3</td>
          <td style="text-align:center;">V</td></tr>
      <tr><td>{@link #QUAD}</td>
          <td>Quad</td>
          <td style="text-align:center;">4</td>
          <td style="text-align:center;">Q</td></tr>
      <tr><td>{@link #MATRIX}</td>
          <td>Matrix</td>
          <td style="text-align:center;">9</td>
          <td style="text-align:center;">M</td></tr>
      <tr><td>{@link #XMODE}</td>
          <td>10-Element Array</td>
          <td style="text-align:center;">10</td>
          <td style="text-align:center;">X</td></tr>
      <tr><td>{@link #TRANSMATRIX}</td>
          <td>Transformation Matrix</td>
          <td style="text-align:center;">16</td>
          <td style="text-align:center;">T</td></tr>
      <tr><td>{@link #AMODE}</td>
          <td>32-Element Array (used to allow long strings in BLUE files)</td>
          <td style="text-align:center;">32</td>
          <td style="text-align:center;">A</td></tr>
      <tr><td>{@link #NONHOMOGENEOUS}</td>
          <td>Nonhomogeneous</td>
          <td style="text-align:center;">n/a</td>
          <td style="text-align:center;">NH</td></tr>
    </table><br>
    <br>
    Additionally NeXtMidas supports generic references to multi-valued types
    which are identified by the character indicating the number of elements
    contained. Thus a 2-element array can be be either referred to as a
    <code>C</code> (complex) or as a <code>2</code> (2-Element Array). It is
    preferable that the letter identifier be used when the data matches the
    meaning of the identifier (e.g. a 9-Element Array should use <code>9</code>
    if it does not represent a 3x3 matrix and it should use <code>M</code> if
    it represents a matrix), however this rule is not always followed and some
    methods may improperly select between letter and number identifiers.<br>
    <br>
    The following summarizes the numerical identifiers.
    <table style="margin-left:auto;margin-right:auto;width:90%;" border="1">
      <caption style="visibility:hidden">""</caption>
      <tr><td style="text-align:center;"><b>Identifier</b></td>
          <td style="text-align:center;"><b>Common Name</b></td>
          <td style="text-align:center;"><b>Number of Elements</b></td>
          <td style="text-align:center;"><b>Type Character</b></td></tr>
      <tr><td>&nbsp;</td>
          <td><i>N</i>-Element Array</td>
          <td style="text-align:center;">1 .. 9</td>
          <td style="text-align:center;">1 .. 9</td></tr>
    </table><br>
    <br>
    <a id="byte_ordering"><b>NeXtMidas Byte Ordering</b></a><br>
    NeXtMidas is able to work with numbers with differing binary
    representations. The following summarizes the different binary
    representations which NeXtMidas may work with.
    <table style="margin-left:auto;margin-right:auto;width:90%;" border="1">
      <caption style="visibility:hidden">""</caption>
      <tr><td style="text-align:center;"><b>Identifier</b></td>
          <td style="text-align:center;"><b>Description</b></td>
          <td style="text-align:center;"><b>NeXtMidas/X-Midas<br>
                                File Marker</b></td>
          <td style="text-align:center;"><b>Typical Uses</b></td></tr>
      <tr><td>{@link #IEEE}</td>
          <td>IEEE format with Big-Endian Byte Ordering</td>
          <td style="text-align:center;"><code>"IEEE"</code></td>
          <td>Typical of most systems from Sun Microsystems<br>
              Used internally by Java on Big-Endian machines</td></tr>
      <tr><td>{@link #EEEI}</td>
          <td>IEEE format with Little-Endian Byte Ordering</td>
          <td style="text-align:center;"><code>"EEEI"</code></td>
          <td>Standard for Intel x86 processors<br>
              Used internally by Java on Little-Endian machines</td></tr>
      <tr><td>{@link #VAX}</td>
          <td>VAX Format with Little-Endian Byte Ordering</td>
          <td style="text-align:center;"><code>"VAX "</code></td>
          <td>Used on VAX machines</td></tr>
      <tr><td>{@link #CRAY}</td>
          <td>CRAY Format with Big-Endian Byte Ordering</td>
          <td style="text-align:center;"><code>"CRAY"</code></td>
          <td>Used on Cray machines</td></tr>
    </table>

    @see nxm.sys.lib.Data

    @author Jeff Schoen
 */
public interface DataTypes {

  /** This is a pipe-separated (<code>|</code>) list of the logical states that
      indicate a true value. Note that this must start and end with a pipe character
      (<code>|</code>) in order to be compatible with the existing implementation.
      <br>
      True States = <code>{@value}</code>
  */
  static final String trueStates = "|Y|YES|T|TRUE|ON|";

  /** This is a pipe-separated (<code>|</code>) list of the logical states that
      indicate a false value. Note that this must start and end with a pipe character
      (<code>|</code>) in order to be compatible with the existing implementation.
      <br>
      False States = <code>{@value}</code>
  */
  static final String falseStates = "|N|NO|F|FALSE|OFF|";

  /** List of valid data representations.
      Value = <code>{@value}</code>
  */
  static final String repList = "IEEE,EEEI,VAX,CRAY";

  /** List of valid data modes. <br><br> Value = <code>{@value}</code> */
  static final String modeList = "S,C,V,Q,M,X,T,A,1,2,3,4,5,6,7,8,9";

  /** List of valid numeric data types. <br><br> Value = <code>{@value}</code> */
  static final String numericTypeList = "D,F,X,L,I,B,N,P";

  /** List of valid data types, including ASCII. <br><br> Value = <code>{@value}</code> */
  static final String typeList = numericTypeList+",A";

  /** List of valid data mode characters. <br><br> Value = <code>{@value}</code> */
  static final String DATA_MODE_LIST = "SCVQMTA";

  /** List of valid multiple data mode characters. <br><br> Value = <code>{@value}</code> */
  static final String MULT_DATA_MODE_LIST = "123456789X";

  /** List of valid  data mode characters that match # in the checkFormat mode. <br><br>
      Value = <code>{@value}</code>
  */
  static final String NUMERIC_DATA_TYPE_LIST = "DFXLIJBNP"; // J added in 4.1.2 Jeff NXM-3894 contribution

  /** List of valid data type characters that match # in the checkFormat type. <br><br>
      Value = <code>{@value}</code>
      @see #RESULT_TYPE_LIST
      @see #CONVERT_TYPE_LIST
  */
//  static final String DATA_TYPE_LIST = NUMERIC_DATA_TYPE_LIST+"A";
  static final String DATA_TYPE_LIST = NUMERIC_DATA_TYPE_LIST+"A,Z"; // NXM-3570

  /** An extended list of valid data type characters that match # in the checkFormat type. <br><br>
      Value = <code>{@value}</code>
      @see #RESULT_TYPE_LIST
      @see #CONVERT_TYPE_LIST
      @since NeXtMidas 3.9.3 for NXM-3021
   */
  String EXTENDED_DATA_TYPE_LIST = DATA_TYPE_LIST+"UV";

  /** List of valid Result type characters that match * in the checkFormat type.
      Note that this includes all of the characters in {@link #DATA_TYPE_LIST}. <br><br>
      Value = <code>{@value}</code>
      @see #DATA_TYPE_LIST
      @see #CONVERT_TYPE_LIST
   */
  static final String RESULT_TYPE_LIST = DATA_TYPE_LIST+"SOTZ"+"VCKH"; // "VCHK" = XMValue

  /** List of valid Conversion type characters. Note that this includes all of
      the characters in {@link #RESULT_TYPE_LIST} plus the following:
      <table>
        <caption style="visibility:hidden">""</caption>
        <tr>
          <th>Type</th>
          <th>Meaning</th>
        </tr>
        <tr>
          <td style="text-align:center;"><code>_</code></td>
          <td>Type not known, attempt to figure out automatically.</td>
        </tr>
        <tr>
          <td style="text-align:center;"><code>U</code></td>
          <td>Do not translate.</td>
        </tr>
        <tr>
          <td style="text-align:center;"><code>Q</code></td>
          <td>Quoted, type is specified along with value (e.g.
              <code>L:FOO</code>).</td>
        </tr>
      </table>
      @see #DATA_TYPE_LIST
      @see #RESULT_TYPE_LIST
   */
  static final String CONVERT_TYPE_LIST = RESULT_TYPE_LIST+"_UQ";


  //////////////////////////////////////////////////////////////////////////////////////////////////
  // Modes
  //////////////////////////////////////////////////////////////////////////////////////////////////
  /** Mode='S': Scalar or other 1-dimensional or non-dimensional value. */
  static final byte SCALAR = (byte)'S';

  /** Mode='C': Complex or other 2-dimensional value. */
  static final byte COMPLEX = (byte)'C';

  /** Mode='V': Vector or other 3-dimensional value. */
  static final byte VECTOR = (byte)'V';

  /** Mode='Q': Quad or other 4-dimensional value. */
  static final byte QUAD = (byte)'Q';

  /** Mode='M': Matrix or other 3x3-dimensional value. */
  static final byte MATRIX = (byte)'M';

  /** Mode='X': Ten element or dimensional value. */
  static final byte XMODE = (byte)'X';

  /** Mode='T': TransMatrix or other 4x4-dimensional value. */
  static final byte TRANSMATRIX = (byte)'T';

  /** Mode='A': Thirty-two element or dimensional value. */
  static final byte AMODE = (byte)'A';

  //////////////////////////////////////////////////////////////////////////////////////////////////
  // Types
  //////////////////////////////////////////////////////////////////////////////////////////////////
  /** Type 'P': N-bit values packed into 8-bit words.
      <br><br>
      Note: Packed bits are for storage and transport only. Prior to processing,
      packed data is automatically normalized to a full byte.
   */
  static final byte PACKED = (byte)'P';

  /** Type 'N': (Packed Nibble) Signed 4-bit values packed into 8-bit words.
      <br><br>
      Note: Nibbles are used for storage and transport only. Prior to processing,
      Nibble data is automatically normalized to a full byte.
   */
  static final byte NIBBLE = (byte)'N';

  /** Type 'u': Signed 8-bit u-Law value. <i>Not currently implemented.</i> */
  static final byte ULAW = (byte)'u';

  /** Type 'a': Signed 8-bit a-Law value. <i>Not currently implemented.</i> */
  static final byte ALAW = (byte)'a';

  /** Type 'B': Signed 8-bit Byte value (see {@link #BMIN}, {@link #BMAX}). */
  static final byte BYTE = (byte)'B';

  /** Type 'J': Signed 12-bit Integer value (see {@link #IMIN}, {@link #IMAX}).
      Note: 12 bits are used for storage and transport only. Prior to processing,
      JINT data is left shifted to full 16 bit INTs.
   */
  static final byte JINT = (byte)'J';  // NXM-3894 Jeff contribution

  /** Type 'I': Signed 16-bit (Short) Integer value (see {@link #IMIN}, {@link #IMAX}). */
  static final byte INT = (byte)'I';

  /** Type 'U': Signed 16-bit (Short) Unsigned Integer value - this has only limited support.
   *  @since NeXtMidas 3.9.3 */
  byte UINT = (byte)'U';

  /** Type 'L': Signed 32-bit Long Integer value (see {@link #LMIN}, {@link #LMAX}). */
  static final byte LONG = (byte)'L';

  /** Type 'V': Signed 32-bit Unsigned Long Integer value - this has only limited support.
   *  @since NeXtMidas 3.9.3 */
  byte ULONG = (byte)'V';

  /** Type 'X': Signed 64-bit Extra-Long Integer value (see {@link #XMIN}, {@link #XMAX}). */
  static final byte XLONG = (byte)'X';

  /** Type 'F': Signed 32-bit Floating Point value (see {@link #FMIN}, {@link #FMAX}). */
  static final byte FLOAT = (byte)'F';

  /** Type 'D': Signed 64-bit Floating Point value (see {@link #DMIN}, {@link #DMAX}). */
  static final byte DOUBLE = (byte)'D';

  /** Type 'Z': Boolean value. <br><br>
      <i>Note: Prior to NeXtMidas 2.5.0 the value of this constant was 'J' not 'Z'. This was
      corrected to match Midas standards as of 2.5.0.</i>
   */
  static final byte BOOL = (byte)'Z';  // <-- prior to 2.5.0 this was 'J'

  /** Type 'H': Non-Homogeneous record format for Type 3000/5000/6000 files. This only appears in
      the main header of a BLUE file and is not used within macros or the shell.
      @see #XMVALUE_TABLE
   */
  static final byte NONHOMOGENEOUS = (byte)'H';

  /** Type 'N': A generic number, defaults to {@link #DOUBLE} */
  static final byte NUMBER = (byte)'N';

  /** Type 'A': Block of eight 8-bit ASCII values (not Unicode). Note that this differs
      from {@link #STRING} in two <b>extremely</b> important ways:
      <ol>
        <li>All values (i.e. characters) are 8-bit UTF-8 ASCII characters and
            are not in the Unicode format used by the Java type
            {@link java.lang.Character}. (This is done for historical reasons and
            for compatibility with X-Midas.)</li>
        <li>This type of data represents a block of <b>exactly</b> eight
            ASCII characters. If it holds a string that is less than eight
            characters in length, it will be padded with spaces out to fill the
            entire eight-character block. (This is done for historical reasons
            and for compatibility with X-Midas.)</li>
      </ol>
      @see #STRING
      @see nxm.sys.inc.AsciiMap
   */
  static final byte ASCII = (byte)'A';


  /** Type 'Z': Block of 256 8-bit ASCII values (not Unicode). Note that this differs
      from {@link #STRING} in two <b>extremely</b> important ways:
      <ol>
        <li>All values (i.e. characters) are 8-bit UTF-8 ASCII characters and
            are not in the Unicode format used by the Java type
            {@link java.lang.Character}. (This is done for historical reasons and
            for compatibility with X-Midas.)</li>
        <li>This type of data represents a block of <b>exactly</b> eight
            ASCII characters. If it holds a string that is less than eight
            characters in length, it will be padded with spaces out to fill the
            entire eight-character block. (This is done for historical reasons
            and for compatibility with X-Midas.)</li>
      </ol>
      @see #STRING
      @see nxm.sys.inc.AsciiMap
  */
  static final byte ASCII256 = (byte)'Z'; // Z-MODE NXM-3570


  /** Type 'S': A standard Unicode string as used in Java (see {@link java.lang.String}).
      Note that this differs significantly from the NeXtMidas ASCII type
      (please see {@link #ASCII} for further explanation).
      @see #ASCII
      @see java.lang.String
   */
  static final byte STRING = (byte)'S';

  /** Type 'O': Generic Java Object (see {@link java.lang.Object}). */
  static final byte OBJECT = (byte)'O';

  /** Type 'T': Generic Table Object (see {@link nxm.sys.lib.Table}). */
  static final byte TABLE = (byte)'T';

  /** Type 'V': A generic {@link nxm.sys.lib.XMValue} for compatibility with X-Midas.
      @since NeXtMidas 2.7.1
   */
  static final byte XMVALUE = (byte)'V';

  /** Type 'C': {@link nxm.sys.lib.XMValue#LIST} for compatibility with X-Midas.
      @since NeXtMidas 2.7.1
   */
  static final byte XMVALUE_LIST = (byte)'C';

  /** Type 'K': {@link nxm.sys.lib.XMValue#KVLIST} for compatibility with X-Midas.
      @since NeXtMidas 2.7.1
   */
  static final byte XMVALUE_KVLIST = (byte)'K';

  /** Type 'H': {@link nxm.sys.lib.XMValue#TABLE} for compatibility with X-Midas.
      @see nxm.sys.lib.XMValue
      @see #NONHOMOGENEOUS
      @since NeXtMidas 2.7.1
   */
  static final byte XMVALUE_TABLE = (byte)'H';


  //////////////////////////////////////////////////////////////////////////////////////////////////
  // DataRep
  //////////////////////////////////////////////////////////////////////////////////////////////////
  /** DataRep 'I': IEEE data representation. The IEEE standard with big-endian byte ordering. */
  static final byte IEEE = (byte)'I';

  /** DataRep 'E': EEEI data representation. The IEEE standard with little-endian byte ordering. */
  static final byte EEEI = (byte)'E';

  /** DataRep 'V': VAX data representation. This is the byte ordering used by VAX systems. */
  static final byte VAX = (byte)'V';

  /** DataRep 'C': CRAY data representation. This is the byte ordering used by Cray systems. */
  static final byte CRAY = (byte)'C';


  //////////////////////////////////////////////////////////////////////////////////////////////////
  // Min/Max Values
  //////////////////////////////////////////////////////////////////////////////////////////////////
  /** The minimum (bounded) value for the NeXtMidas type double. <br><br>Value = <code>{@value}</code> */
  static final double DMIN=-1e37;

  /** The maximum (bounded) value for the NeXtMidas type double. <br><br>Value = <code>{@value}</code> */
  static final double DMAX=1e37;

  /** The minimum (bounded) value for the NeXtMidas type float. <br><br>Value = <code>{@value}</code> */
  static final float FMIN=-1e37f;

  /** The maximum (bounded) value for the NeXtMidas type float. <br><br>Value = <code>{@value}</code> */
  static final float FMAX=1e37f;

  /** The minimum value for the NeXtMidas type extra-long integer. <br> <br>
      Value = <code>{@value} = {@link java.lang.Long#MIN_VALUE} + 1</code>
   */
  static final long XMIN=java.lang.Long.MIN_VALUE+1;

  /** The maximum value for the NeXtMidas type extra-long integer. <br> <br>
      Value = <code>{@value} = {@link java.lang.Long#MAX_VALUE}</code>
   */
  static final long XMAX=java.lang.Long.MAX_VALUE;

  /** The minimum value for the NeXtMidas type long integer. <br> <br>
      Value = <code>{@value} = {@link java.lang.Integer#MIN_VALUE} + 1</code>
   */
  static final int LMIN=java.lang.Integer.MIN_VALUE+1;

  /** The maximum value for the NeXtMidas type long integer. <br> <br>
      Value = <code>{@value} = {@link java.lang.Integer#MAX_VALUE}</code>
   */
  static final int LMAX=java.lang.Integer.MAX_VALUE;

  /** The maximum value for the NeXtMidas type short integer. <br> <br>
      Value = <code>{@value} = {@link java.lang.Short#MIN_VALUE}</code>
   */
  static final short IMIN=java.lang.Short.MIN_VALUE;

  /** The maximum value for the NeXtMidas type (short) integer. <br> <br>
      Value = <code>{@value} = {@link java.lang.Short#MAX_VALUE}</code>
   */
  static final short IMAX=java.lang.Short.MAX_VALUE;

  /** The minimum value for the NeXtMidas type byte. <br> <br>
      Value = <code>{@value} = {@link java.lang.Byte#MIN_VALUE}</code>
   */
  static final byte BMIN=java.lang.Byte.MIN_VALUE;

  /** The maximum value for the NeXtMidas type byte. <br> <br>
      Value = <code>{@value} = {@link java.lang.Byte#MAX_VALUE}</code>
   */
  static final byte BMAX=java.lang.Byte.MAX_VALUE;
  /** The maximum value for the NeXtMidas type packed nibble (4-bit signed integer), 2<sup>3</sup>-1 <br> <br>
      Value = <code>{@value}</code>
    */
  static final byte NMAX=7;

  /** The minimum value for the NeXtMidas type packed nibble (4-bit signed integer), -2<sup>3</sup> <br> <br>
      Value = <code>{@value}</code>
    */
  static final byte NMIN=(-NMAX-1); // == -8

  /** NeXtMidas numeric data types */
  static final Map<Byte,Class<?>> numberTypes = createNumberTypes();

  /** Creates the NeXtMidas numeric data types
      @return NeXtMidas numeric data types
   */
  static Map<Byte,Class<?>> createNumberTypes () {
    Map<Byte,Class<?>> nums = new HashMap<>();
    nums.put(INT, Short.class);
    nums.put(JINT, Short.class);    // to support 12-bit 'J' NXM-3894
    nums.put(DOUBLE, Double.class);
    nums.put(LONG, Integer.class);
    nums.put(BYTE, Byte.class);
    nums.put(XLONG, Long.class);
    nums.put(FLOAT, Float.class);
    return nums;
  }

} // end interface DataTypes
