| Revision 36,
1.3 KB
checked in by bmcguffin, 9 years ago
(diff) |
|
Added toXML implementation for all remaining event classes.
|
| Rev | Line | |
|---|
| 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 | */ |
|---|
| 6 | package scriptbuilder.structures.events; |
|---|
| 7 | |
|---|
| 8 | import scriptbuilder.structures.ELEMENT; |
|---|
| 9 | import scriptbuilder.structures.I_XML_Writable; |
|---|
| 10 | import scriptbuilder.structures.ScriptEvent; |
|---|
| 11 | |
|---|
| 12 | /** |
|---|
| 13 | * Data model for a witness event. A witness has a name, a phone number, and a |
|---|
| 14 | * street address. |
|---|
| 15 | * |
|---|
| 16 | * @author Bryan McGuffin |
|---|
| 17 | */ |
|---|
| 18 | public class WitnessEvent extends ScriptEvent implements I_XML_Writable |
|---|
| 19 | { |
|---|
| 20 | |
|---|
| 21 | /** |
|---|
| 22 | * Constructor. Generate a new script event that has a witness event icon. |
|---|
| 23 | */ |
|---|
| 24 | public WitnessEvent() |
|---|
| 25 | { |
|---|
| 26 | super(ScriptEventType.WITNESS_EVENT); |
|---|
| 27 | } |
|---|
| 28 | |
|---|
| 29 | public String witnessAddress = ""; |
|---|
| 30 | |
|---|
| 31 | public String witnessName = ""; |
|---|
| 32 | |
|---|
| 33 | public String witnessNum = ""; |
|---|
| 34 | |
|---|
| 35 | @Override |
|---|
| 36 | public String toXML() |
|---|
| 37 | { |
|---|
| 38 | return emptyTag(ELEMENT.WITNESS.tag + " Name=\"" + witnessName + "\" Address=\"" |
|---|
| 39 | + witnessAddress + "\" PhoneNum=\"" + witnessNum + "\""); |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | @Override |
|---|
| 43 | public String openTag(String s) |
|---|
| 44 | { |
|---|
| 45 | return "<" + s + ">\n"; |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | @Override |
|---|
| 49 | public String closeTag(String s) |
|---|
| 50 | { |
|---|
| 51 | return "</" + s + ">\n"; |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | @Override |
|---|
| 55 | public String emptyTag(String s) |
|---|
| 56 | { |
|---|
| 57 | return "<" + s + "/>\n"; |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.