View Javadoc
1   package org.opentrafficsim.sim0mq.publisher;
2   
3   import org.djutils.immutablecollections.Immutable;
4   import org.djutils.immutablecollections.ImmutableLinkedHashSet;
5   import org.djutils.immutablecollections.ImmutableSet;
6   import org.opentrafficsim.core.gtu.Gtu;
7   import org.opentrafficsim.core.network.Network;
8   
9   /**
10   * Transceiver for GTU ids.
11   * <p>
12   * Copyright (c) 2020-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
13   * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
14   * </p>
15   * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
16   * @author <a href="https://github.com/peter-knoppers">Peter Knoppers</a>
17   * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
18   */
19  public class GtuIdTransceiver extends AbstractIdTransceiver
20  {
21      /**
22       * Construct a GtuIdTransceiver.
23       * @param network the OTS network
24       */
25      public GtuIdTransceiver(final Network network)
26      {
27          super(network, "GTU id transceiver");
28      }
29  
30      @Override
31      ImmutableSet<Gtu> getSet()
32      {
33          return new ImmutableLinkedHashSet<Gtu>(getNetwork().getGTUs(), Immutable.WRAP);
34      }
35  
36      @Override
37      public String toString()
38      {
39          return "GtuIdTransceiver [network=" + getNetwork().getId() + ", super=" + super.toString() + "]";
40      }
41  
42  }