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

source: tmcsimulator-scriptbuilder/trunk/src/scriptbuilder/structures/events/ParamicsEvent.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 Paramics event. Paramics data has a status, an event type, a
15 * location ID, and some number of affected lanes.
16 *
17 * @author Bryan McGuffin
18 */
19public class ParamicsEvent extends ScriptEvent implements I_XML_Writable
20{
21
22    public ParamicsEvent()
23    {
24        super(ScriptEventType.PARAMICS_EVENT);
25    }
26
27    public String status = "";
28
29    public String type = "";
30
31    public ArrayList<Integer> laneNums = new ArrayList<Integer>();
32
33    public String locationID = "";
34
35    @Override
36    public String openTag(String s)
37    {
38        return "<" + s + ">\n";
39    }
40
41    @Override
42    public String closeTag(String s)
43    {
44        return "</" + s + ">\n";
45    }
46
47    @Override
48    public String emptyTag(String s)
49    {
50        return "<" + s + "/>\n";
51    }
52
53    @Override
54    public String toXML()
55    {
56        String output = openTag(ELEMENT.PARAMICS.tag + " LocationID=\"" + locationID + "\"");
57
58        output += openTag(ELEMENT.Status.tag);
59        output += status;
60        output += closeTag(ELEMENT.Status.tag);
61
62        output += openTag(ELEMENT.Incident_type.tag);
63        output += type;
64        output += closeTag(ELEMENT.Incident_type.tag);
65
66        for (Integer lane : laneNums)
67        {
68            output += openTag(ELEMENT.Lane_number.tag);
69            output += lane;
70            output += closeTag(ELEMENT.Lane_number.tag);
71        }
72        output += closeTag(ELEMENT.PARAMICS.tag);
73
74        return output;
75    }
76
77}
Note: See TracBrowser for help on using the repository browser.