View Javadoc

1   package cz.cuni.amis.pogamut.usar2004.agent.module.geometry;
2   
3   import cz.cuni.amis.pogamut.usar2004.agent.module.datatypes.GeometryType;
4   import cz.cuni.amis.pogamut.usar2004.communication.messages.usarinfomessages.GeometryMessage;
5   
6   /**
7    * Parent class for all possible geometry subjects. It covers the basic and
8    * common properties for all the geometry subjects.
9    *
10   * @author vejmanm
11   */
12  public abstract class SuperGeometry
13  {
14      protected GeometryMessage lastMessage;
15      protected GeometryType geoType;
16  
17      /**
18       * Ctor.
19       *
20       * @param type Geometry type describes particular subject about which we
21       * want to know about. It is used to distinguish incoming message from the
22       * server.
23       */
24      protected SuperGeometry(GeometryType type)
25      {
26          this.geoType = type;
27      }
28  
29      /**
30       * Used to make sure the object is filled.
31       *
32       * @return Returns true if the object is filled with Geo. message.
33       */
34      public Boolean isReady()
35      {
36          return (lastMessage != null);
37      }
38  
39      /**
40       * Type describes the vehicle type. It will be one of the following values:
41       * "GroundVehicle”, “LeggedRobot”, “NauticVehicle”, or “AerialVehicle” of
42       * "Camera" or some kind of sensor or effecter or "MisPkg".
43       *
44       * @return Returns type of the geometry message.
45       */
46      public String getType()
47      {
48          return lastMessage.getType();
49      }
50  
51      /**
52       * Name of the subject that this geometry message concerns.
53       *
54       * @return Returns the name of the Geometry item.
55       */
56      public String getName()
57      {
58          return lastMessage.getName();
59      }
60  
61      /**
62       * GeometryType is a descriptor used for creating particular instance and
63       * for getting type information about particular configuration subject.
64       *
65       * @return Returns GeometryType.
66       */
67      public GeometryType getGeometryType()
68      {
69          return geoType;
70      }
71  
72      /**
73       * Method used for updating the message object that provides particular
74       * properties for given type. Note that this object is created by yylex
75       * parser and contains properties for all configuration subject types. But
76       * only relevat to individual Geometry Subject are filled.
77       *
78       * @param message Geometry message from server.
79       */
80      public void updateMessage(GeometryMessage message)
81      {
82          //if(message.getType().equalsIgnoreCase(SensorType))
83          lastMessage = message;
84      }
85  }