Warning: Can't use blame annotator:
svn blame failed on trunk/src/scriptbuilder/structures/units/Unit.java: ("Can't find a temporary directory: Internal error", 20014)

source: tmcsimulator-scriptbuilder/trunk/src/scriptbuilder/structures/units/Unit.java @ 38

Revision 38, 4.8 KB checked in by bmcguffin, 9 years ago (diff)

Removed the newLine at the end of each openTag method.

RevLine 
1/*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6package scriptbuilder.structures.units;
7
8import scriptbuilder.structures.ELEMENT;
9import scriptbuilder.structures.I_XML_Writable;
10
11/**
12 * Placeholder until I add some functionality. Represents an officer in a
13 * vehicle on the map. Has a name, ID, position, and status, as well as several
14 * other identifying factors.
15 *
16 * @author Bryan McGuffin
17 */
18public class Unit implements I_XML_Writable
19{
20
21    public String UnitNum;
22
23    public String ID;
24
25    public String Status;
26
27    public String Master_Inc_Num;
28
29    public String Primary;
30
31    public String OOS;
32
33    public String Type;
34
35    public String Curr_Loc;
36
37    public String Destination;
38
39    public String Misc_Info;
40
41    public String Stack;
42
43    public String Area;
44
45    public String Officer;
46
47    public String Badge_Num;
48
49    public String Timer;
50
51    public String Office;
52
53    public String P;
54
55    public String Agy;
56
57    public String Alias;
58
59    public String Unit_Status;
60
61    public Unit()
62    {
63        UnitNum = "";
64
65        ID = "";
66
67        Status = "";
68
69        Master_Inc_Num = "";
70
71        Primary = "";
72
73        OOS = "";
74
75        Type = "";
76
77        Curr_Loc = "";
78
79        Destination = "";
80
81        Misc_Info = "";
82
83        Stack = "";
84
85        Area = "";
86
87        Officer = "";
88
89        Badge_Num = "";
90
91        Timer = "";
92
93        Office = "";
94
95        P = "";
96
97        Agy = "";
98
99        Alias = "";
100
101        Unit_Status = "";
102    }
103
104    @Override
105    public String toXML()
106    {
107        String output = openTag(ELEMENT.NEW_UNIT.tag + " UnitNum=\"" + UnitNum + "\"");
108
109        if (!ID.equals(""))
110        {
111            output += openTag(ELEMENT.ID.tag) + ID + closeTag(ELEMENT.ID.tag);
112        }
113
114        if (!Status.equals(""))
115        {
116            output += openTag(ELEMENT.STATUS.tag) + Status + closeTag(ELEMENT.STATUS.tag);
117        }
118
119        if (!Master_Inc_Num.equals(""))
120        {
121            output += openTag(ELEMENT.MASTER_INC_NUM.tag) + Master_Inc_Num + closeTag(ELEMENT.MASTER_INC_NUM.tag);
122        }
123
124        if (!Primary.equals(""))
125        {
126            output += openTag(ELEMENT.PRIMARY.tag) + Primary + closeTag(ELEMENT.PRIMARY.tag);
127        }
128
129        if (!OOS.equals(""))
130        {
131            output += openTag(ELEMENT.OOS.tag) + OOS + closeTag(ELEMENT.OOS.tag);
132        }
133
134        if (!Type.equals(""))
135        {
136            output += openTag(ELEMENT.TYPE.tag) + Type + closeTag(ELEMENT.TYPE.tag);
137        }
138
139        if (!Curr_Loc.equals(""))
140        {
141            output += openTag(ELEMENT.CURR_LOC.tag) + Curr_Loc + closeTag(ELEMENT.CURR_LOC.tag);
142        }
143
144        if (!Destination.equals(""))
145        {
146            output += openTag(ELEMENT.DESTINATION.tag) + Destination + closeTag(ELEMENT.DESTINATION.tag);
147        }
148
149        if (!Misc_Info.equals(""))
150        {
151            output += openTag(ELEMENT.MISC_INFO.tag) + Misc_Info + closeTag(ELEMENT.MISC_INFO.tag);
152        }
153
154        if (!Stack.equals(""))
155        {
156            output += openTag(ELEMENT.STACK.tag) + Stack + closeTag(ELEMENT.STACK.tag);
157        }
158
159        if (!Area.equals(""))
160        {
161            output += openTag(ELEMENT.AREA.tag) + Area + closeTag(ELEMENT.AREA.tag);
162        }
163
164        if (!Badge_Num.equals(""))
165        {
166            output += openTag(ELEMENT.BADGE_NUM.tag) + Badge_Num + closeTag(ELEMENT.BADGE_NUM.tag);
167        }
168
169        if (!Officer.equals(""))
170        {
171            output += openTag(ELEMENT.OFFICER.tag) + Officer + closeTag(ELEMENT.OFFICER.tag);
172        }
173
174        if (!Office.equals(""))
175        {
176            output += openTag(ELEMENT.OFFICE.tag) + Office + closeTag(ELEMENT.OFFICE.tag);
177        }
178
179        if (!Timer.equals(""))
180        {
181            output += openTag(ELEMENT.TIMER.tag) + Timer + closeTag(ELEMENT.TIMER.tag);
182        }
183
184        if (!P.equals(""))
185        {
186            output += openTag(ELEMENT.P.tag) + P + closeTag(ELEMENT.P.tag);
187        }
188
189        if (!Agy.equals(""))
190        {
191            output += openTag(ELEMENT.AGY.tag) + Agy + closeTag(ELEMENT.AGY.tag);
192        }
193
194        if (!Alias.equals(""))
195        {
196            output += openTag(ELEMENT.ALIAS.tag) + Alias + closeTag(ELEMENT.ALIAS.tag);
197        }
198
199        if (!Unit_Status.equals(""))
200        {
201            output += openTag(ELEMENT.UNIT_STATUS.tag) + Unit_Status + closeTag(ELEMENT.UNIT_STATUS.tag);
202        }
203
204        output += closeTag(ELEMENT.NEW_UNIT.tag);
205        return output;
206    }
207
208    @Override
209    public String openTag(String s)
210    {
211        return "<" + s + ">";
212    }
213
214    @Override
215    public String closeTag(String s)
216    {
217        return "</" + s + ">\n";
218    }
219
220    @Override
221    public String emptyTag(String s)
222    {
223        return "<" + s + "/>\n";
224    }
225}
Note: See TracBrowser for help on using the repository browser.