/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package scriptbuilder.structures.events; import java.util.ArrayList; import scriptbuilder.structures.ELEMENT; import scriptbuilder.structures.I_XML_Writable; import scriptbuilder.structures.ScriptEvent; import scriptbuilder.structures.XMLBuilder; /** * Data model for a Paramics event. Paramics data has a status, an event type, a * location ID, and some number of affected lanes. * * @author Bryan McGuffin */ public class ParamicsEvent extends ScriptEvent implements I_XML_Writable { /** * Constructor. */ public ParamicsEvent() { super(ScriptEventType.PARAMICS_EVENT); } public String status = ""; public String type = ""; public ArrayList laneNums = new ArrayList(); public String locationID = ""; @Override public String toXML() { String output = XMLBuilder.openTag(ELEMENT.PARAMICS.tag + " LocationID=\"" + locationID + "\""); output += XMLBuilder.simpleTag(status, ELEMENT.Status); if (!type.equals("")) { output += XMLBuilder.simpleTag(type, ELEMENT.Incident_type); } for (Integer lane : laneNums) { output += XMLBuilder.simpleTag("" + lane, ELEMENT.Lane_number); } output += XMLBuilder.closeTag(ELEMENT.PARAMICS.tag); return output; } }