View Javadoc

1   /*
2      IMPORTANT !!!
3   
4      DO NOT EDIT THIS FILE. IT IS GENERATED FROM APPROPRIATE XML FILE
5      BY THE MessagesGenerator.xslt.
6      MODIFY THAT FILE INSTEAD OF THIS ONE.
7   
8    */
9   package cz.cuni.amis.pogamut.defcon.communication.messages.commands;
10  
11  import cz.cuni.amis.pogamut.base.communication.messages.*;
12  import cz.cuni.amis.pogamut.base.communication.worldview.*;
13  import cz.cuni.amis.pogamut.base.communication.worldview.object.*;
14  import cz.cuni.amis.pogamut.defcon.base3d.worldview.object.DefConLocation;
15  import cz.cuni.amis.pogamut.defcon.communication.messages.*;
16  import cz.cuni.amis.pogamut.defcon.communication.messages.commands.*;
17  import cz.cuni.amis.pogamut.defcon.communication.messages.infos.*;
18  import cz.cuni.amis.pogamut.defcon.consts.*;
19  import cz.cuni.amis.pogamut.defcon.consts.state.*;
20  import cz.cuni.amis.utils.exception.*;
21  
22  import java.util.*;
23  
24  import javabot.*;
25  
26  
27  /**
28   * Requests to change game speed.
29   */
30  public class RequestGameSpeed extends DefConCommand {
31      /**
32       * Requested speed.
33       */
34      private GameSpeed speed = null;
35  
36  /**
37                       * Creates new instance of command RequestGameSpeed.
38                            
39                  Requests to change game speed. 
40          
41                       @param
42                        speed Requested speed.
43                   */
44      public RequestGameSpeed(GameSpeed speed) {
45          this.speed = speed;
46      }
47  
48  /**
49                           * Cloning constructor...
50                           * @param original
51                           */
52      public RequestGameSpeed(RequestGameSpeed original) {
53          this.speed = original.speed;
54      }
55  
56      /**
57       * Requested speed.
58       *
59       * @return GameSpeed
60       */
61      public GameSpeed getSpeed() {
62          return this.speed;
63      }
64  
65      /**
66       * Requested speed.
67       *
68       * @param speed
69       *
70       * @return this object, allows you to chain setters
71       */
72      public RequestGameSpeed setSpeed(GameSpeed speed) {
73          this.speed = speed;
74  
75          return this;
76      }
77  
78      /**
79       * Performs the command - to be used only by the {@link DefConCommandExecutor}.
80       */
81      @Override
82      public void perform() {
83          JBot.RequestGameSpeed(getSpeed().factor);
84      }
85  
86      /**
87       * Returns human readable serialization of the message.
88       *
89       * @return human readable string
90       */
91      @Override
92      public String toString() {
93          return "RequestGameSpeed[" + getStringizedFields() + "; Speed = " + this.speed + "]";
94      }
95  
96      /**
97       * Returns message in html format.
98       *
99       * @return html message
100      */
101     public String toHtmlString() {
102         return "<p><b>RequestGameSpeed:</b></p>" + "<p><i>Speed:</i> " + this.speed + "</p>";
103     }
104 }