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

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

Revision 35, 1.9 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 telephone conversation. A conversation is made up of lines
15 * of dialog; each line of dialog in the conversation has some text to be
16 * spoken, and a role for the speaker.
17 *
18 * @author Bryan McGuffin
19 */
20public class TelephoneEvent extends ScriptEvent implements I_XML_Writable
21{
22
23    public TelephoneEvent()
24    {
25        super(ScriptEventType.TELEPHONE_EVENT);
26    }
27
28    public ArrayList<String> lines = new ArrayList<String>();
29
30    public ArrayList<String> roles = new ArrayList<String>();
31
32    @Override
33    public String toXML()
34    {
35        String output = openTag(ELEMENT.TELEPHONE.tag);
36        for (int i = 0; i < lines.size(); i++)
37        {
38            if (roles.get(i).equalsIgnoreCase(ELEMENT.STUDENT.tag))
39            {
40                output += openTag(ELEMENT.STUDENT.tag);
41                output += lines.get(i);
42                output += closeTag(ELEMENT.STUDENT.tag);
43            }
44            else
45            {
46                output += openTag(ELEMENT.INSTRUCTOR.tag + " Role=\"" + roles.get(i) + "\"");
47                output += lines.get(i);
48                output += closeTag(ELEMENT.INSTRUCTOR.tag);
49            }
50        }
51        output += closeTag(ELEMENT.TELEPHONE.tag);
52        return output;
53    }
54
55    @Override
56    public String openTag(String s)
57    {
58        return "<" + s + ">\n";
59    }
60
61    @Override
62    public String closeTag(String s)
63    {
64        return "</" + s + ">\n";
65    }
66
67    @Override
68    public String emptyTag(String s)
69    {
70        return "<" + s + "/>\n";
71    }
72}
Note: See TracBrowser for help on using the repository browser.