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   * Draw a line on the whiteboard.
29   */
30  public class WhiteboardDraw extends DefConCommand {
31      /**
32       * Line begin.
33       */
34      private DefConLocation firstPoint = null;
35  
36      /**
37       * Line end.
38       */
39      private DefConLocation secondPoint = null;
40  
41  /**
42                       * Creates new instance of command WhiteboardDraw.
43                            
44                  Draw a line on the whiteboard. 
45          
46                       @param
47                        firstPoint Line begin.
48                       @param
49                        secondPoint Line end.
50                   */
51      public WhiteboardDraw(DefConLocation firstPoint, DefConLocation secondPoint) {
52          this.firstPoint = firstPoint;
53  
54          this.secondPoint = secondPoint;
55      }
56  
57  /**
58                           * Cloning constructor...
59                           * @param original
60                           */
61      public WhiteboardDraw(WhiteboardDraw original) {
62          this.firstPoint = original.firstPoint;
63  
64          this.secondPoint = original.secondPoint;
65      }
66  
67      /**
68       * Line begin.
69       *
70       * @return DefConLocation
71       */
72      public DefConLocation getFirstPoint() {
73          return this.firstPoint;
74      }
75  
76      /**
77       * Line begin.
78       *
79       * @param firstPoint
80       *
81       * @return this object, allows you to chain setters
82       */
83      public WhiteboardDraw setFirstPoint(DefConLocation firstPoint) {
84          this.firstPoint = firstPoint;
85  
86          return this;
87      }
88  
89      /**
90       * Line end.
91       *
92       * @return DefConLocation
93       */
94      public DefConLocation getSecondPoint() {
95          return this.secondPoint;
96      }
97  
98      /**
99       * Line end.
100      *
101      * @param secondPoint
102      *
103      * @return this object, allows you to chain setters
104      */
105     public WhiteboardDraw setSecondPoint(DefConLocation secondPoint) {
106         this.secondPoint = secondPoint;
107 
108         return this;
109     }
110 
111     /**
112      * Performs the command - to be used only by the {@link DefConCommandExecutor}.
113      */
114     @Override
115     public void perform() {
116         DefConLocation firstPoint = getFirstPoint();
117         DefConLocation secondPoint = getSecondPoint();
118         JBot.WhiteboardDraw((float) firstPoint.getX(), (float) firstPoint.getY(),
119             (float) secondPoint.getX(), (float) secondPoint.getY());
120     }
121 
122     /**
123      * Returns human readable serialization of the message.
124      *
125      * @return human readable string
126      */
127     @Override
128     public String toString() {
129         return "WhiteboardDraw[" + getStringizedFields() + "; FirstPoint = " + this.firstPoint +
130         "; SecondPoint = " + this.secondPoint + "]";
131     }
132 
133     /**
134      * Returns message in html format.
135      *
136      * @return html message
137      */
138     public String toHtmlString() {
139         return "<p><b>WhiteboardDraw:</b></p>" + "<p><i>FirstPoint:</i> " + this.firstPoint +
140         "</p>" + "<p><i>SecondPoint:</i> " + this.secondPoint + "</p>";
141     }
142 }