| 1 | package tmcsim.client.cadclientgui.data; |
|---|
| 2 | |
|---|
| 3 | import java.io.Serializable; |
|---|
| 4 | |
|---|
| 5 | import tmcsim.client.cadclientgui.enums.CADDataEnums; |
|---|
| 6 | |
|---|
| 7 | /** |
|---|
| 8 | * This class is a further subdivision of Incident to hold data. |
|---|
| 9 | * |
|---|
| 10 | * @author Vincent |
|---|
| 11 | * |
|---|
| 12 | */ |
|---|
| 13 | public class IncidentActivities implements Serializable { |
|---|
| 14 | |
|---|
| 15 | /* The init variables are set only from the XML script (readXMLNode method) |
|---|
| 16 | * and are only used for resetCADDataSimulation purposes |
|---|
| 17 | */ |
|---|
| 18 | private String init_vehicle = ""; |
|---|
| 19 | private String init_activity = ""; |
|---|
| 20 | private String init_location = ""; |
|---|
| 21 | private String init_comment = ""; |
|---|
| 22 | private String init_disp = ""; |
|---|
| 23 | |
|---|
| 24 | private String vehicle; |
|---|
| 25 | private String activity; |
|---|
| 26 | private String location; |
|---|
| 27 | private String comment; |
|---|
| 28 | private String disp; |
|---|
| 29 | |
|---|
| 30 | /* |
|---|
| 31 | * Constructor. Initializes all objects to avoid null pointers. |
|---|
| 32 | */ |
|---|
| 33 | public IncidentActivities() { |
|---|
| 34 | vehicle = ""; |
|---|
| 35 | activity = ""; |
|---|
| 36 | location = ""; |
|---|
| 37 | comment = ""; |
|---|
| 38 | disp = ""; |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | public void resetCADDataSimulation(){ |
|---|
| 42 | vehicle = init_vehicle; |
|---|
| 43 | activity = init_activity; |
|---|
| 44 | location = init_location; |
|---|
| 45 | comment = init_comment; |
|---|
| 46 | disp = init_disp; |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | public String getVehicle() { |
|---|
| 50 | return vehicle; |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | public void setVehicle(String vehicle) { |
|---|
| 54 | this.vehicle = vehicle; |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | public String getActivity() { |
|---|
| 58 | return activity; |
|---|
| 59 | } |
|---|
| 60 | |
|---|
| 61 | public void setActivity(String activity) { |
|---|
| 62 | this.activity = activity; |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | public String getLocation() { |
|---|
| 66 | return location; |
|---|
| 67 | } |
|---|
| 68 | |
|---|
| 69 | public void setLocation(String location) { |
|---|
| 70 | this.location = location; |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | public String getComment() { |
|---|
| 74 | return comment; |
|---|
| 75 | } |
|---|
| 76 | |
|---|
| 77 | public void setComment(String comment) { |
|---|
| 78 | this.comment = comment; |
|---|
| 79 | } |
|---|
| 80 | |
|---|
| 81 | public String getDisp() { |
|---|
| 82 | return disp; |
|---|
| 83 | } |
|---|
| 84 | |
|---|
| 85 | public void setDisp(String disp) { |
|---|
| 86 | this.disp = disp; |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | /* |
|---|
| 90 | * Called from the tmc.simulator.cadclient.data.Incident.java. Handles |
|---|
| 91 | * storing data based on script tag. |
|---|
| 92 | */ |
|---|
| 93 | public void readXMLNode(String tag_name, String value) { |
|---|
| 94 | if (tag_name.equals(CADDataEnums.INC_ACTIVITIES.VEHICLE.tag)) { |
|---|
| 95 | init_vehicle = value; |
|---|
| 96 | setVehicle(value); |
|---|
| 97 | } else if (tag_name.equals(CADDataEnums.INC_ACTIVITIES.ACTIVITY.tag)) { |
|---|
| 98 | init_activity = value; |
|---|
| 99 | setActivity(value); |
|---|
| 100 | } else if (tag_name.equals(CADDataEnums.INC_ACTIVITIES.LOCATION.tag)) { |
|---|
| 101 | init_location = value; |
|---|
| 102 | setLocation(value); |
|---|
| 103 | } else if (tag_name.equals(CADDataEnums.INC_ACTIVITIES.COMMENT.tag)) { |
|---|
| 104 | init_comment = value; |
|---|
| 105 | setComment(value); |
|---|
| 106 | } else if (tag_name.equals(CADDataEnums.INC_ACTIVITIES.DISP.tag)) { |
|---|
| 107 | init_disp = value; |
|---|
| 108 | setDisp(value); |
|---|
| 109 | } |
|---|
| 110 | } |
|---|
| 111 | |
|---|
| 112 | } |
|---|