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 GETCONF.
12   *
13   */
14  public class GetConf extends CommandMessage
15  {
16      public GetConf(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 GetConf()
27      {
28      }
29      /////// Properties BEGIN
30      protected String Type = null;
31  
32      public String getType()
33      {
34          return Type;
35      }
36  
37      public GetConf setType(String Type)
38      {
39          this.Type = Type;
40          return this;
41      }
42      /*
43       * Queries the configuration information for a type (when “{Name string}” is
44       * omitted) or specified sensor/effecter. The return message is a CONF
45       * message.
46       */
47      protected String Name = null;
48  
49      public String getName()
50      {
51          return Name;
52      }
53  
54      public GetConf setName(String Name)
55      {
56          this.Name = Name;
57          return this;
58      }
59  
60      /*
61       * Example: GETCONF {Type RangeScanner} GETCONF {Type MisPkg} GETCONF {Type
62       * Robot} GETCONF {Type Effecter}
63       */
64      /////// Properties END
65      /////// Extra Java code BEGIN
66      /////// Additional code from xslt BEGIN
67      /////// Additional code from xslt END
68      /////// Extra Java from XML BEGIN
69      /////// Extra Java from XML END
70      /////// Extra Java code END
71      /**
72       * Cloning constructor.
73       */
74      public GetConf(GetConf original)
75      {
76          this.Type = original.Type;
77          this.Name = original.Name;
78      }
79  
80      @Override
81      public String toString()
82      {
83          return toMessage();
84      }
85  
86      public String toHtmlString()
87      {
88          return super.toString()
89                  + "<b>Type</b> : "
90                  + String.valueOf(Type)
91                  + " <br/> "
92                  + "<b>Name</b> : "
93                  + String.valueOf(Name)
94                  + " <br/> "
95                  + "";
96      }
97  
98      public String toMessage()
99      {
100         StringBuilder buf = new StringBuilder();
101 
102         buf.append("GETCONF");
103 
104         if(Type != null)
105         {
106             buf.append(" {Type ").append(Type).append("}");
107         }
108 
109         if(Name != null)
110         {
111             buf.append(" {Name ").append(Name).append("}");
112         }
113 
114         return buf.toString();
115     }
116 }