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

Revision 46, 1.4 KB checked in by bmcguffin, 9 years ago (diff)

Added file: XMLWriter, in package Scriptbuilder.structures. It holds static methods which ither classes that implement I_XML_Writable may find useful. Also restructured the toXML method of many classes to utilize this new class.

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.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    @Override
36    public String toXML()
37    {
38        String output = XMLWriter.openTag(ELEMENT.PARAMICS.tag + " LocationID=\"" + locationID + "\"");
39
40        output += XMLWriter.simpleTag(status, ELEMENT.Status);
41
42        output += XMLWriter.simpleTag(type, ELEMENT.Incident_type);
43
44        for (Integer lane : laneNums)
45        {
46            output += XMLWriter.simpleTag(""+lane, ELEMENT.Lane_number);
47        }
48        output += XMLWriter.closeTag(ELEMENT.PARAMICS.tag);
49
50        return output;
51    }
52
53}
Note: See TracBrowser for help on using the repository browser.