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.infos;
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   * Carrier unit from the world.
29   */
30  public class Carrier extends DefConUnitObject<CarrierState> {
31      /**
32       * Number of nukes on airbase.
33       */
34      @Updatable
35      private int nukeSupply = 0;
36  
37      /**
38       * Number of fighters on airbase.
39       */
40      @Updatable
41      private int fighterSupply = 0;
42  
43      /**
44       * Number of bombers on airbase.
45       */
46      @Updatable
47      private int bomberSupply = 0;
48  
49  /**
50                                    Creates new instance of object Carrier with specific id.
51                                    
52                  Carrier unit from the world.
53          
54                                    @param id        Game id of this object.
55            @param teamId Id of this object's team.
56            @param location Location of this object.
57            @param visible Visibility of this object.
58            @param state DefCon state of this unit.
59            @param stateCount Number of activations of current state on this unit.
60            @param target Current target of this unit.
61                            
62                               @param
63                                nukeSupply 
64                          Number of nukes on airbase.
65                  
66                               @param
67                                fighterSupply 
68                          Number of fighters on airbase.
69                  
70                               @param
71                                bomberSupply 
72                          Number of bombers on airbase.
73                                       
74            @param time Time of last update of this object (time of first spotting in this case). 
75                           */
76      public Carrier(int id, int teamId, DefConLocation location, boolean visible,
77          CarrierState state, int stateCount, int target, int nukeSupply, int fighterSupply,
78          int bomberSupply, double time) {
79          super(id, UnitType.CARRIER, teamId, location, visible, state, stateCount, target, time);
80  
81          this.nukeSupply = nukeSupply;
82  
83          this.fighterSupply = fighterSupply;
84  
85          this.bomberSupply = bomberSupply;
86      }
87  
88  /**
89                                   * Cloning constructor...
90                                   * @param original
91                                   */
92      public Carrier(Carrier original) {
93          super(original);
94  
95          this.nukeSupply = original.nukeSupply;
96  
97          this.fighterSupply = original.fighterSupply;
98  
99          this.bomberSupply = original.bomberSupply;
100     }
101 
102     /**
103      * Number of nukes on airbase.
104      *
105      * @return int
106      */
107     public int getNukeSupply() {
108         return this.nukeSupply;
109     }
110 
111     /**
112      * Number of fighters on airbase.
113      *
114      * @return int
115      */
116     public int getFighterSupply() {
117         return this.fighterSupply;
118     }
119 
120     /**
121      * Number of bombers on airbase.
122      *
123      * @return int
124      */
125     public int getBomberSupply() {
126         return this.bomberSupply;
127     }
128 
129     /**
130      * Returns human readable serialization of the message.
131      *
132      * @return human readable string
133      */
134     @Override
135     public String toString() {
136         return "Carrier[" + getStringizedFields() + "; NukeSupply = " + this.nukeSupply +
137         "; FighterSupply = " + this.fighterSupply + "; BomberSupply = " + this.bomberSupply + "]";
138     }
139 
140     /**
141      * Returns message in html format.
142      *
143      * @return html message
144      */
145     public String toHtmlString() {
146         return "<p><b>Carrier:</b></p>" + "<p><i>NukeSupply:</i> " + this.nukeSupply + "</p>" +
147         "<p><i>FighterSupply:</i> " + this.fighterSupply + "</p>" + "<p><i>BomberSupply:</i> " +
148         this.bomberSupply + "</p>";
149     }
150 }