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