source: tmcsimulator-scriptbuilder/trunk/src/scriptbuilder/structures/events/ParamicsEvent.java @ 47

Revision 47, 1.5 KB checked in by bmcguffin, 9 years ago (diff)

Updated toXML behaviors for several classes to bring final adjustments in line with desired output.

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 Paramics event. Paramics data has a status, an event type, a
16 * location ID, and some number of affected lanes.
17 *
18 * @author Bryan McGuffin
19 */
20public class ParamicsEvent extends ScriptEvent implements I_XML_Writable
21{
22
23    public ParamicsEvent()
24    {
25        super(ScriptEventType.PARAMICS_EVENT);
26    }
27
28    public String status = "";
29
30    public String type = "";
31
32    public ArrayList<Integer> laneNums = new ArrayList<Integer>();
33
34    public String locationID = "";
35
36    @Override
37    public String toXML()
38    {
39        String output = XMLWriter.openTag(ELEMENT.PARAMICS.tag + " LocationID=\"" + locationID + "\"");
40
41        output += XMLWriter.simpleTag(status, ELEMENT.Status);
42
43        if (!type.equals(""))
44        {
45            output += XMLWriter.simpleTag(type, ELEMENT.Incident_type);
46        }
47
48        for (Integer lane : laneNums)
49        {
50            output += XMLWriter.simpleTag("" + lane, ELEMENT.Lane_number);
51        }
52        output += XMLWriter.closeTag(ELEMENT.PARAMICS.tag);
53
54        return output;
55    }
56
57}
Note: See TracBrowser for help on using the repository browser.