/**
 * This class is automatically generated by mig. DO NOT EDIT THIS FILE.
 * This class implements a Java interface to the 'UpdatesMsg'
 * message type.
 */

public class UpdatesMsg extends net.tinyos.message.Message {

    /** The default size of this message type in bytes. */
    public static final int DEFAULT_MESSAGE_SIZE = 100;

    /** The Active Message type associated with this message. */
    public static final int AM_TYPE = 35;

    /** Create a new UpdatesMsg of size 100. */
    public UpdatesMsg() {
        super(DEFAULT_MESSAGE_SIZE);
        amTypeSet(AM_TYPE);
    }

    /** Create a new UpdatesMsg of the given data_length. */
    public UpdatesMsg(int data_length) {
        super(data_length);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new UpdatesMsg with the given data_length
     * and base offset.
     */
    public UpdatesMsg(int data_length, int base_offset) {
        super(data_length, base_offset);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new UpdatesMsg using the given byte array
     * as backing store.
     */
    public UpdatesMsg(byte[] data) {
        super(data);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new UpdatesMsg using the given byte array
     * as backing store, with the given base offset.
     */
    public UpdatesMsg(byte[] data, int base_offset) {
        super(data, base_offset);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new UpdatesMsg using the given byte array
     * as backing store, with the given base offset and data length.
     */
    public UpdatesMsg(byte[] data, int base_offset, int data_length) {
        super(data, base_offset, data_length);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new UpdatesMsg embedded in the given message
     * at the given base offset.
     */
    public UpdatesMsg(net.tinyos.message.Message msg, int base_offset) {
        super(msg, base_offset, DEFAULT_MESSAGE_SIZE);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new UpdatesMsg embedded in the given message
     * at the given base offset and length.
     */
    public UpdatesMsg(net.tinyos.message.Message msg, int base_offset, int data_length) {
        super(msg, base_offset, data_length);
        amTypeSet(AM_TYPE);
    }

    /**
    /* Return a String representation of this message. Includes the
     * message type name and the non-indexed field values.
     */
    public String toString() {
      String s = "Message <UpdatesMsg> \n";
      try {
        s += "  [type=0x"+Long.toHexString(get_type())+"]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      try {
        s += "  [output_size=0x"+Long.toHexString(get_output_size())+"]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      try {
        s += "  [updates=";
        for (int i = 0; i < 49; i++) {
          s += "0x"+Long.toHexString(getElement_updates(i) & 0xffff)+" ";
        }
        s += "]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      return s;
    }

    // Message-type-specific access methods appear below.

    /////////////////////////////////////////////////////////
    // Accessor methods for field: type
    //   Field type: short, unsigned
    //   Offset (bits): 0
    //   Size (bits): 8
    /////////////////////////////////////////////////////////

    /**
     * Return whether the field 'type' is signed (false).
     */
    public static boolean isSigned_type() {
        return false;
    }

    /**
     * Return whether the field 'type' is an array (false).
     */
    public static boolean isArray_type() {
        return false;
    }

    /**
     * Return the offset (in bytes) of the field 'type'
     */
    public static int offset_type() {
        return (0 / 8);
    }

    /**
     * Return the offset (in bits) of the field 'type'
     */
    public static int offsetBits_type() {
        return 0;
    }

    /**
     * Return the value (as a short) of the field 'type'
     */
    public short get_type() {
        return (short)getUIntBEElement(offsetBits_type(), 8);
    }

    /**
     * Set the value of the field 'type'
     */
    public void set_type(short value) {
        setUIntBEElement(offsetBits_type(), 8, value);
    }

    /**
     * Return the size, in bytes, of the field 'type'
     */
    public static int size_type() {
        return (8 / 8);
    }

    /**
     * Return the size, in bits, of the field 'type'
     */
    public static int sizeBits_type() {
        return 8;
    }

    /////////////////////////////////////////////////////////
    // Accessor methods for field: output_size
    //   Field type: short, unsigned
    //   Offset (bits): 8
    //   Size (bits): 8
    /////////////////////////////////////////////////////////

    /**
     * Return whether the field 'output_size' is signed (false).
     */
    public static boolean isSigned_output_size() {
        return false;
    }

    /**
     * Return whether the field 'output_size' is an array (false).
     */
    public static boolean isArray_output_size() {
        return false;
    }

    /**
     * Return the offset (in bytes) of the field 'output_size'
     */
    public static int offset_output_size() {
        return (8 / 8);
    }

    /**
     * Return the offset (in bits) of the field 'output_size'
     */
    public static int offsetBits_output_size() {
        return 8;
    }

    /**
     * Return the value (as a short) of the field 'output_size'
     */
    public short get_output_size() {
        return (short)getUIntBEElement(offsetBits_output_size(), 8);
    }

    /**
     * Set the value of the field 'output_size'
     */
    public void set_output_size(short value) {
        setUIntBEElement(offsetBits_output_size(), 8, value);
    }

    /**
     * Return the size, in bytes, of the field 'output_size'
     */
    public static int size_output_size() {
        return (8 / 8);
    }

    /**
     * Return the size, in bits, of the field 'output_size'
     */
    public static int sizeBits_output_size() {
        return 8;
    }

    /////////////////////////////////////////////////////////
    // Accessor methods for field: updates
    //   Field type: int[], unsigned
    //   Offset (bits): 16
    //   Size of each element (bits): 16
    /////////////////////////////////////////////////////////

    /**
     * Return whether the field 'updates' is signed (false).
     */
    public static boolean isSigned_updates() {
        return false;
    }

    /**
     * Return whether the field 'updates' is an array (true).
     */
    public static boolean isArray_updates() {
        return true;
    }

    /**
     * Return the offset (in bytes) of the field 'updates'
     */
    public static int offset_updates(int index1) {
        int offset = 16;
        if (index1 < 0 || index1 >= 49) throw new ArrayIndexOutOfBoundsException();
        offset += 0 + index1 * 16;
        return (offset / 8);
    }

    /**
     * Return the offset (in bits) of the field 'updates'
     */
    public static int offsetBits_updates(int index1) {
        int offset = 16;
        if (index1 < 0 || index1 >= 49) throw new ArrayIndexOutOfBoundsException();
        offset += 0 + index1 * 16;
        return offset;
    }

    /**
     * Return the entire array 'updates' as a int[]
     */
    public int[] get_updates() {
        int[] tmp = new int[49];
        for (int index0 = 0; index0 < numElements_updates(0); index0++) {
            tmp[index0] = getElement_updates(index0);
        }
        return tmp;
    }

    /**
     * Set the contents of the array 'updates' from the given int[]
     */
    public void set_updates(int[] value) {
        for (int index0 = 0; index0 < value.length; index0++) {
            setElement_updates(index0, value[index0]);
        }
    }

    /**
     * Return an element (as a int) of the array 'updates'
     */
    public int getElement_updates(int index1) {
        return (int)getUIntBEElement(offsetBits_updates(index1), 16);
    }

    /**
     * Set an element of the array 'updates'
     */
    public void setElement_updates(int index1, int value) {
        setUIntBEElement(offsetBits_updates(index1), 16, value);
    }

    /**
     * Return the total size, in bytes, of the array 'updates'
     */
    public static int totalSize_updates() {
        return (784 / 8);
    }

    /**
     * Return the total size, in bits, of the array 'updates'
     */
    public static int totalSizeBits_updates() {
        return 784;
    }

    /**
     * Return the size, in bytes, of each element of the array 'updates'
     */
    public static int elementSize_updates() {
        return (16 / 8);
    }

    /**
     * Return the size, in bits, of each element of the array 'updates'
     */
    public static int elementSizeBits_updates() {
        return 16;
    }

    /**
     * Return the number of dimensions in the array 'updates'
     */
    public static int numDimensions_updates() {
        return 1;
    }

    /**
     * Return the number of elements in the array 'updates'
     */
    public static int numElements_updates() {
        return 49;
    }

    /**
     * Return the number of elements in the array 'updates'
     * for the given dimension.
     */
    public static int numElements_updates(int dimension) {
      int array_dims[] = { 49,  };
        if (dimension < 0 || dimension >= 1) throw new ArrayIndexOutOfBoundsException();
        if (array_dims[dimension] == 0) throw new IllegalArgumentException("Array dimension "+dimension+" has unknown size");
        return array_dims[dimension];
    }

}
