View Javadoc

1   package cz.cuni.amis.pogamut.usar2004.communication.messages.usarinfomessages;
2   
3   import java.util.*;
4   import cz.cuni.amis.pogamut.base.communication.messages.*;
5   import cz.cuni.amis.pogamut.usar2004.communication.messages.datatypes.CustomTypes.*;
6   
7   /**
8    * Serves for the purpose of testing the parser. Warning - first item in
9    * PROTOTYPES is null!
10   */
11  public class InfoMessages
12  {
13      public static final String[] PROTOTYPES = new String[]
14      {
15          null // dummy
16          , NfoMessage.PROTOTYPE,
17          MissionPackageMessage.PROTOTYPE,
18          SensorMessage.PROTOTYPE,
19          StateMessage.PROTOTYPE,
20          GeometryMessage.PROTOTYPE,
21          ResponseMessage.PROTOTYPE,
22          ConfigurationMessage.PROTOTYPE,
23          KillMessage.PROTOTYPE
24      };
25      /**
26       * Serves to initialize map
27       */
28      private static final Map<String, Class<? extends InfoMessage>> prototypeMap =
29              new HashMap<String, Class<? extends InfoMessage>>();
30      /**
31       * Unmodifiable map message.PROTOTYPE -> message.class
32       */
33      public static final Map<String, Class<? extends InfoMessage>> PROTOTYPE_MAP;
34  
35      static
36      {
37          prototypeMap.put(NfoMessage.PROTOTYPE, NfoMessage.class);
38          prototypeMap.put(MissionPackageMessage.PROTOTYPE, MissionPackageMessage.class);
39          prototypeMap.put(SensorMessage.PROTOTYPE, SensorMessage.class);
40          prototypeMap.put(StateMessage.PROTOTYPE, StateMessage.class);
41          prototypeMap.put(GeometryMessage.PROTOTYPE, GeometryMessage.class);
42          prototypeMap.put(ResponseMessage.PROTOTYPE, ResponseMessage.class);
43          prototypeMap.put(ConfigurationMessage.PROTOTYPE, ConfigurationMessage.class);
44          prototypeMap.put(KillMessage.PROTOTYPE, KillMessage.class);
45          PROTOTYPE_MAP = Collections.unmodifiableMap(prototypeMap);
46      }
47  }