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

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

Added javadoc for several files.

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    /**
24     * Constructor.
25     */
26    public ParamicsEvent()
27    {
28        super(ScriptEventType.PARAMICS_EVENT);
29    }
30
31    public String status = "";
32
33    public String type = "";
34
35    public ArrayList<Integer> laneNums = new ArrayList<Integer>();
36
37    public String locationID = "";
38
39    @Override
40    public String toXML()
41    {
42        String output = XMLWriter.openTag(ELEMENT.PARAMICS.tag + " LocationID=\"" + locationID + "\"");
43
44        output += XMLWriter.simpleTag(status, ELEMENT.Status);
45
46        if (!type.equals(""))
47        {
48            output += XMLWriter.simpleTag(type, ELEMENT.Incident_type);
49        }
50
51        for (Integer lane : laneNums)
52        {
53            output += XMLWriter.simpleTag("" + lane, ELEMENT.Lane_number);
54        }
55        output += XMLWriter.closeTag(ELEMENT.PARAMICS.tag);
56
57        return output;
58    }
59
60}
Note: See TracBrowser for help on using the repository browser.