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

source: tmcsimulator-scriptbuilder/trunk/src/scriptbuilder/structures/events/CHPRadioEvent.java @ 35

Revision 35, 1.8 KB checked in by bmcguffin, 9 years ago (diff)

Added toXML implementation for Audio, CAD detail, Unit, Paramics, Telephone, and CHP radio events.

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.events;
7
8import java.util.ArrayList;
9import scriptbuilder.structures.ELEMENT;
10import scriptbuilder.structures.I_XML_Writable;
11import scriptbuilder.structures.ScriptEvent;
12
13/**
14 * Data model for a CHP radio event. A CHP radio transmission has a
15 * conversation, with dialog between a field unit and a dispatch center. It also
16 * has an audio file which has that conversation acted out.
17 *
18 * @author Bryan McGuffin
19 */
20public class CHPRadioEvent extends ScriptEvent implements I_XML_Writable
21{
22
23    public CHPRadioEvent()
24    {
25        super(ScriptEventType.CHP_RADIO_EVENT);
26    }
27
28    public ArrayList<String> lines = new ArrayList<String>();
29
30    public ArrayList<String> roles = new ArrayList<String>();
31
32    public String radioFile = "";
33
34    @Override
35    public String toXML()
36    {
37        String output = openTag(ELEMENT.CHP_RADIO.tag + " RadioFile=\"" + radioFile + "\"");
38        output += openTag(ELEMENT.DIALOG.tag);
39
40        for (int i = 0; i < lines.size(); i++)
41        {
42            output += openTag(ELEMENT.LINE.tag + " Role=\"" + roles.get(i) + "\"");
43            output += lines.get(i);
44            output += closeTag(ELEMENT.LINE.tag);
45        }
46
47        output += closeTag(ELEMENT.DIALOG.tag);
48        output += closeTag(ELEMENT.CHP_RADIO.tag);
49
50        return output;
51    }
52
53    @Override
54    public String openTag(String s)
55    {
56        return "<" + s + ">\n";
57    }
58
59    @Override
60    public String closeTag(String s)
61    {
62        return "</" + s + ">\n";
63    }
64
65    @Override
66    public String emptyTag(String s)
67    {
68        return "<" + s + "/>\n";
69    }
70
71}
Note: See TracBrowser for help on using the repository browser.