View Javadoc
1   package org.sim0mq.message.federationmanager;
2   
3   import org.sim0mq.Sim0MQException;
4   import org.sim0mq.message.Sim0MQMessage;
5   
6   /**
7    * RequestStatus, FM.5. Message sent by the Federation Manager to enquire the status of the simulation. The answer to this
8    * message is MC.1 "Status". Since the message type id clarifies the function of this message and no information exchange is
9    * necessary, the payload field can be empty.
10   * <p>
11   * Copyright (c) 2019-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
12   * BSD-style license. See <a href="http://sim0mq.org/docs/current/license.html">Sim0MQ License</a>.
13   * </p>
14   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
15   */
16  public class FM5RequestStatus extends Sim0MQMessage
17  {
18      /** the unique message id. */
19      private static final String MESSAGETYPE = "FM.5";
20  
21      /** */
22      private static final long serialVersionUID = 20190712L;
23  
24      /**
25       * @param federationId the federation id can be coded using different types. Examples are two 64-bit longs indicating a
26       *            UUID, or a String with a UUID number, a String with meaningful identification, or a short or an int with a
27       *            simulation run number.
28       * @param senderId The sender id can be used to send back a message to the sender at some later time.
29       * @param receiverId The receiver id can be used to check whether the message is meant for us, or should be discarded (or an
30       *            error can be sent if we receive a message not meant for us).
31       * @param messageId The unique message number is meant to confirm with a callback that the message has been received
32       *            correctly. The number is unique for the sender, so not globally within the federation.
33       * @throws Sim0MQException on unknown data type
34       * @throws NullPointerException when one of the parameters is null
35       */
36      @SuppressWarnings("checkstyle:parameternumber")
37      public FM5RequestStatus(final Object federationId, final Object senderId, final Object receiverId, final Object messageId)
38              throws Sim0MQException, NullPointerException
39      {
40          super(true, federationId, senderId, receiverId, MESSAGETYPE, messageId, null);
41      }
42  
43      /**
44       * @param objectArray Object[]; Full message object array
45       * @throws Sim0MQException on unknown data type
46       * @throws NullPointerException when one of the parameters is null
47       */
48      public FM5RequestStatus(final Object[] objectArray) throws Sim0MQException, NullPointerException
49      {
50          super(objectArray, 0, MESSAGETYPE);
51      }
52  
53      /**
54       * Builder for the RequestStatus Message. Can string setters together, and call build() at the end to build the actual
55       * message.
56       * <p>
57       * Copyright (c) 2019-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
58       * <br>
59       * BSD-style license. See <a href="http://sim0mq.org/docs/current/license.html">Sim0MQ License</a>.
60       * </p>
61       * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
62       */
63      public static class Builder extends Sim0MQMessage.Builder<FM5RequestStatus.Builder>
64      {
65          /**
66           * Empty constructor.
67           */
68          public Builder()
69          {
70              // nothing to do.
71          }
72  
73          @Override
74          public FM5RequestStatus build() throws Sim0MQException, NullPointerException
75          {
76              return new FM5RequestStatus(this.federationId, this.senderId, this.receiverId, this.messageId);
77          }
78  
79      }
80  }