View Javadoc

1   package cz.cuni.amis.pogamut.usar2004.communication.messages.usarcommands;
2   
3   import cz.cuni.amis.pogamut.base.communication.messages.*;
4   import cz.cuni.amis.pogamut.usar2004.communication.messages.datatypes.CustomTypes.*;
5   
6   /**
7    *
8    * There are two types of query command. One queries the geometry information,
9    * and another queries the configuration information.
10   *
11   * Corresponding GameBots command is GETGEO.
12   *
13   */
14  public class GetGeo extends CommandMessage
15  {
16      public GetGeo(String Type, String Name)
17      {
18          this.Type = Type;
19          this.Name = Name;
20      }
21  
22      /**
23       * <p></p>WARNING: this is empty-command constructor, you have to use
24       * setters to fill it up!
25       */
26      public GetGeo()
27      {
28      }
29      /////// Properties BEGIN
30      protected String Type = null;
31  
32      public String getType()
33      {
34          return Type;
35      }
36  
37      public GetGeo setType(String Type)
38      {
39          this.Type = Type;
40          return this;
41      }
42      /*
43       * The “{Name string}” is optional. If it’s omitted, the command queries the
44       * geometry information for all the sensors/effecters with the specified
45       * type. Otherwise, only the sensor/effecter with the name and type will be
46       * queried. The return message is a GEO message.
47       */
48      protected String Name = null;
49  
50      public String getName()
51      {
52          return Name;
53      }
54  
55      public GetGeo setName(String Name)
56      {
57          this.Name = Name;
58          return this;
59      }
60  
61      /*
62       * Example: GETGEO {Type Sonar} GETGEO {Type MisPkg} GETGEO {Type Robot}
63       * GETGEO {Type Effecter}
64       */
65      /////// Properties END
66      /////// Extra Java code BEGIN
67      /////// Additional code from xslt BEGIN
68      /////// Additional code from xslt END
69      /////// Extra Java from XML BEGIN
70      /////// Extra Java from XML END
71      /////// Extra Java code END
72      /**
73       * Cloning constructor.
74       */
75      public GetGeo(GetGeo original)
76      {
77          this.Type = original.Type;
78          this.Name = original.Name;
79      }
80  
81      @Override
82      public String toString()
83      {
84          return toMessage();
85      }
86  
87      public String toHtmlString()
88      {
89          return super.toString()
90                  + "<b>Type</b> : "
91                  + String.valueOf(Type)
92                  + " <br/> "
93                  + "<b>Name</b> : "
94                  + String.valueOf(Name)
95                  + " <br/> "
96                  + "";
97      }
98  
99      public String toMessage()
100     {
101         StringBuilder buf = new StringBuilder();
102 
103         buf.append("GETGEO");
104 
105         if(Type != null)
106         {
107             buf.append(" {Type ").append(Type).append("}");
108         }
109 
110         if(Name != null)
111         {
112             buf.append(" {Name ").append(Name).append("}");
113         }
114         return buf.toString();
115     }
116 }