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

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

Added javadoc for several files.

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 */
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    /**
25     * Constructor.
26     */
27    public CHPRadioEvent()
28    {
29        super(ScriptEventType.CHP_RADIO_EVENT);
30    }
31
32    /**
33     * List of the lines of dialog in this event.
34     */
35    public ArrayList<String> lines = new ArrayList<String>();
36
37    /**
38     * List of the corresponding roles for each line of dialog.
39     */
40    public ArrayList<String> roles = new ArrayList<String>();
41
42    /**
43     * Path for the audio file to be played during this event.
44     */
45    public String radioFile = "";
46
47    @Override
48    public String toXML()
49    {
50        String output = XMLWriter.openTag(ELEMENT.CHP_RADIO.tag + " RadioFile=\"" + radioFile + "\"");
51        output += XMLWriter.openTag(ELEMENT.DIALOG.tag);
52
53        for (int i = 0; i < lines.size(); i++)
54        {
55            output += XMLWriter.openTag(ELEMENT.LINE.tag + " Role=\"" + roles.get(i) + "\"");
56            output += lines.get(i);
57            output += XMLWriter.closeTag(ELEMENT.LINE.tag);
58        }
59
60        output += XMLWriter.closeTag(ELEMENT.DIALOG.tag);
61        output += XMLWriter.closeTag(ELEMENT.CHP_RADIO.tag);
62
63        return output;
64    }
65}
Note: See TracBrowser for help on using the repository browser.