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 @ 46

Revision 46, 1.6 KB checked in by bmcguffin, 9 years ago (diff)

Added file: XMLWriter, in package Scriptbuilder.structures. It holds static methods which ither classes that implement I_XML_Writable may find useful. Also restructured the toXML method of many classes to utilize this new class.

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