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

Revision 203, 1.7 KB checked in by jdalbey, 6 years ago (diff)

XMLWriter.java name changed to XMLBuilder. Add pretty printing methods (ticket #237).

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