/* * 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; /** * 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 { public ParamicsEvent() { super(ScriptEventType.PARAMICS_EVENT); } public String status = ""; public String type = ""; public ArrayList laneNums = new ArrayList(); public String locationID = ""; @Override public String openTag(String s) { return "<" + s + ">\n"; } @Override public String closeTag(String s) { return "\n"; } @Override public String emptyTag(String s) { return "<" + s + "/>\n"; } @Override public String toXML() { String output = openTag(ELEMENT.PARAMICS.tag + " LocationID=\"" + locationID + "\""); output += openTag(ELEMENT.Status.tag); output += status; output += closeTag(ELEMENT.Status.tag); output += openTag(ELEMENT.Incident_type.tag); output += type; output += closeTag(ELEMENT.Incident_type.tag); for (Integer lane : laneNums) { output += openTag(ELEMENT.Lane_number.tag); output += lane; output += closeTag(ELEMENT.Lane_number.tag); } output += closeTag(ELEMENT.PARAMICS.tag); return output; } }