package CommunicationLayer;

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

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

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

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

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

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

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

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

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

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

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

    /**
     * Create a new LearningOutputMsg embedded in the given message
     * at the given base offset and length.
     */
    public LearningOutputMsg(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 <LearningOutputMsg> \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 += "  [output=";
        for (int i = 0; i < 24; i++) {
          s += Float.toString(getElement_output(i))+" ";
        }
        s += "]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      return s;
    }

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

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

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

    /**
     * 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
    //   Offset (bits): 8
    //   Size (bits): 8
    /////////////////////////////////////////////////////////

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

    /**
     * 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: output
    //   Field type: float[]
    //   Offset (bits): 16
    //   Size of each element (bits): 32
    /////////////////////////////////////////////////////////

    /**
     * Return whether the field 'output' is signed (true).
     */
    public static boolean isSigned_output() {
        return true;
    }

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

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

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

    /**
     * Return the entire array 'output' as a float[]
     */
    public float[] get_output() {
        float[] tmp = new float[24];
        for (int index0 = 0; index0 < numElements_output(0); index0++) {
            tmp[index0] = getElement_output(index0);
        }
        return tmp;
    }

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

    /**
     * Return an element (as a float) of the array 'output'
     */
    public float getElement_output(int index1) {
        return (float)getFloatElement(offsetBits_output(index1), 32);
    }

    /**
     * Set an element of the array 'output'
     */
    public void setElement_output(int index1, float value) {
        setFloatElement(offsetBits_output(index1), 32, value);
    }

    /**
     * Return the total size, in bytes, of the array 'output'
     */
    public static int totalSize_output() {
        return (768 / 8);
    }

    /**
     * Return the total size, in bits, of the array 'output'
     */
    public static int totalSizeBits_output() {
        return 768;
    }

    /**
     * Return the size, in bytes, of each element of the array 'output'
     */
    public static int elementSize_output() {
        return (32 / 8);
    }

    /**
     * Return the size, in bits, of each element of the array 'output'
     */
    public static int elementSizeBits_output() {
        return 32;
    }

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

    /**
     * Return the number of elements in the array 'output'
     */
    public static int numElements_output() {
        return 24;
    }

    /**
     * Return the number of elements in the array 'output'
     * for the given dimension.
     */
    public static int numElements_output(int dimension) {
      int array_dims[] = { 24,  };
        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];
    }

}
