| 1 | package tmcsim.common; |
|---|
| 2 | |
|---|
| 3 | import java.io.Serializable; |
|---|
| 4 | |
|---|
| 5 | /** |
|---|
| 6 | * IncidentLocation contains information regarding incident |
|---|
| 7 | * locations. These locations are referenced within the |
|---|
| 8 | * Paramics control portion of the CAD Simulator. The data |
|---|
| 9 | * within these objects is read in from a simulation script, |
|---|
| 10 | * and must correspond to valid locations within the loaded |
|---|
| 11 | * paramics network. |
|---|
| 12 | * |
|---|
| 13 | * @author |
|---|
| 14 | * @version |
|---|
| 15 | */ |
|---|
| 16 | @SuppressWarnings("serial") |
|---|
| 17 | public class ParamicsLocation implements Serializable { |
|---|
| 18 | |
|---|
| 19 | /** |
|---|
| 20 | * Enumeration with XML tag names. |
|---|
| 21 | * @author Matthew Cechini |
|---|
| 22 | */ |
|---|
| 23 | public static enum XML_TAGS { |
|---|
| 24 | /** Route. */ |
|---|
| 25 | ROUTE ("Route"), |
|---|
| 26 | /** Route direction. */ |
|---|
| 27 | DIRECTION ("Direction"), |
|---|
| 28 | /** Location type. */ |
|---|
| 29 | LOC_TYPE ("Location_type"), |
|---|
| 30 | /** Location postmile. */ |
|---|
| 31 | POSTMILE ("Postmile"); |
|---|
| 32 | |
|---|
| 33 | public String tag; |
|---|
| 34 | |
|---|
| 35 | private XML_TAGS(String t) { |
|---|
| 36 | tag = t; |
|---|
| 37 | } |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | /** Unique ID for this IncidentLocation. */ |
|---|
| 41 | public String locationID = null; |
|---|
| 42 | |
|---|
| 43 | /** Route name of incident location. */ |
|---|
| 44 | public String incidentRoute = null; |
|---|
| 45 | |
|---|
| 46 | /** Route direction of incident location. */ |
|---|
| 47 | public String incidentDirection = null; |
|---|
| 48 | |
|---|
| 49 | /** Route postmile of incident location. */ |
|---|
| 50 | public String incidentPostmile = null; |
|---|
| 51 | |
|---|
| 52 | /** Type of incident location. */ |
|---|
| 53 | public String incidentLocType = null; |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | /** |
|---|
| 57 | * Constructor. |
|---|
| 58 | * |
|---|
| 59 | * @param id Unique ID. |
|---|
| 60 | */ |
|---|
| 61 | public ParamicsLocation(String id) { |
|---|
| 62 | locationID = id; |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | /** |
|---|
| 66 | * Receive the tag name and value data from a parsed XML node. |
|---|
| 67 | * Set the corresponding data member with the new value. |
|---|
| 68 | * |
|---|
| 69 | * @param tag_value XML tag name. |
|---|
| 70 | * @param value XML tag value. |
|---|
| 71 | */ |
|---|
| 72 | public void readXMLNode(String tag_name, String value) { |
|---|
| 73 | |
|---|
| 74 | if(tag_name.equals(XML_TAGS.ROUTE.tag)) |
|---|
| 75 | incidentRoute = value; |
|---|
| 76 | else if(tag_name.equals(XML_TAGS.DIRECTION.tag)) |
|---|
| 77 | incidentDirection = value; |
|---|
| 78 | else if(tag_name.equals(XML_TAGS.POSTMILE.tag)) |
|---|
| 79 | incidentPostmile = value; |
|---|
| 80 | else if(tag_name.equals(XML_TAGS.LOC_TYPE.tag)) |
|---|
| 81 | incidentLocType = value; |
|---|
| 82 | |
|---|
| 83 | } |
|---|
| 84 | } |
|---|