Index: /trunk/src/tmcsim/application.properties
===================================================================
--- /trunk/src/tmcsim/application.properties	(revision 64)
+++ /trunk/src/tmcsim/application.properties	(revision 65)
@@ -1,5 +1,5 @@
-#Thu, 16 Mar 2017 08:26:10 -0700
+#Thu, 16 Mar 2017 08:31:30 -0700
 
-Application.revision=63
+Application.revision=64
 
-Application.buildnumber=44
+Application.buildnumber=45
Index: /trunk/src/tmcsim/client/cadclientgui/data/CADData.java
===================================================================
--- /trunk/src/tmcsim/client/cadclientgui/data/CADData.java	(revision 3)
+++ /trunk/src/tmcsim/client/cadclientgui/data/CADData.java	(revision 65)
@@ -4,30 +4,24 @@
 import java.awt.event.ActionListener;
 import java.io.Serializable;
-import java.rmi.RemoteException;
-import java.rmi.server.UnicastRemoteObject;
 import java.util.Collections;
 import java.util.Vector;
-
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import javax.swing.Timer;
 import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-
 import tmcsim.client.cadclientgui.enums.IncidentEnums;
 import tmcsim.client.cadclientgui.enums.TableHeaders;
 import tmcsim.client.cadclientgui.enums.UnitStatusEnums;
-import tmcsim.interfaces.CADClientInterface;
 
 /**
  * This class holds the data for all the units and incidents. It is responsible
  * for sending out data to all the screens.
- * 
+ *
  * @author Vincent
- * 
+ *
  */
-public class CADData implements Serializable {
-
+public class CADData implements Serializable
+{
     private final int ONE_SECOND = 1000;
-
     private static Vector<Unit> units;
     private static Vector<Incident> incidents;
@@ -45,6 +39,8 @@
     private static DefaultTableModel assignedIncidentsTableModel;
     private static DefaultTableModel incidentEditorModel;
-
-    public CADData() {
+    private static Logger logger = Logger.getLogger("tmcsim.client");
+
+    public CADData()
+    {
         units = new Vector<Unit>();
         incidents = new Vector<Incident>();
@@ -66,24 +62,31 @@
         handleUpdateTimes();
     }
-    
-    public void clearData(){
+
+    public void clearData()
+    {
         units = new Vector<Unit>();
         incidents = new Vector<Incident>();
     }
-    
-    public void resetSimulation(){
-        for(Incident inc : incidents){
+
+    public void resetSimulation()
+    {
+        for (Incident inc : incidents)
+        {
             inc.resetCADDataSimulation();
         }
-        for(Unit unit : units){
+        for (Unit unit : units)
+        {
             unit.resetCADDataSimulation();
         }
     }
 
-    private void initializeAssignedIncidentsSettings() {
+    private void initializeAssignedIncidentsSettings()
+    {
         Collections
                 .addAll(assignedIncidentsHeaders, TableHeaders.ASSIGNED_INCIDENTS_HEADERS);
-        assignedIncidentsTableModel = new DefaultTableModel() {
-            public boolean isCellEditable(int row, int column) {
+        assignedIncidentsTableModel = new DefaultTableModel()
+        {
+            public boolean isCellEditable(int row, int column)
+            {
                 return false;// This causes all cells to be not editable
             }
@@ -93,8 +96,11 @@
     }
 
-    private void initializeUnitStatusSettings() {
+    private void initializeUnitStatusSettings()
+    {
         Collections.addAll(unitStatusHeaders, TableHeaders.UNIT_STATUS_HEADERS);
-        unitStatusTableModel = new DefaultTableModel() {
-            public boolean isCellEditable(int row, int column) {
+        unitStatusTableModel = new DefaultTableModel()
+        {
+            public boolean isCellEditable(int row, int column)
+            {
                 return false;// This causes all cells to be not editable
             }
@@ -103,8 +109,11 @@
     }
 
-    private void initializeIncidentEditorSettings() {
+    private void initializeIncidentEditorSettings()
+    {
         Collections.addAll(incidentEditorHeaders, TableHeaders.INCIDENT_EDITOR_HEADERS);
-        incidentEditorModel = new DefaultTableModel() {
-            public boolean isCellEditable(int row, int column) {
+        incidentEditorModel = new DefaultTableModel()
+        {
+            public boolean isCellEditable(int row, int column)
+            {
                 return false;// This causes all cells to be not editable
             }
@@ -113,8 +122,11 @@
     }
 
-    private void initializePendingIncidentsSettings() {
+    private void initializePendingIncidentsSettings()
+    {
         Collections.addAll(pendingIncidentsHeaders, TableHeaders.PENDING_INCIDENTS_HEADERS);
-        pendingIncidentsTableModel = new DefaultTableModel() {
-            public boolean isCellEditable(int row, int column) {
+        pendingIncidentsTableModel = new DefaultTableModel()
+        {
+            public boolean isCellEditable(int row, int column)
+            {
                 return false;// This causes all cells to be not editable
             }
@@ -126,9 +138,9 @@
     /**
      * Obtains the list of units from the XML.
-     * 
-     * @param unit
-     *            the new list of units.
-     */
-    public void setUnitsFromXML(Vector<Unit> unit) {
+     *
+     * @param unit the new list of units.
+     */
+    public void setUnitsFromXML(Vector<Unit> unit)
+    {
         units = unit;
     }
@@ -136,9 +148,9 @@
     /**
      * Obtains the list of incidents from the XML.
-     * 
-     * @param incident
-     *            the new list of incidents.
-     */
-    public void setIncidentsFromXML(Vector<Incident> incident) {
+     *
+     * @param incident the new list of incidents.
+     */
+    public void setIncidentsFromXML(Vector<Incident> incident)
+    {
         incidents = incident;
     }
@@ -147,7 +159,10 @@
      * Returns the specified unitNum
      */
-    public Unit getUnit(String unitNum) {
-        for (int i = 0; i < units.size(); i++) {
-            if (units.get(i).getUnitNum().equals(unitNum)) {
+    public Unit getUnit(String unitNum)
+    {
+        for (int i = 0; i < units.size(); i++)
+        {
+            if (units.get(i).getUnitNum().equals(unitNum))
+            {
                 return units.get(i);
             }
@@ -159,7 +174,10 @@
      * Check if it contains an incident with the specified Id.
      */
-    public boolean checkForValidId(int incidentId) {
-        for (int i = 0; i < incidents.size(); i++) {
-            if (incidents.get(i).getLogNum() == incidentId) {
+    public boolean checkForValidId(int incidentId)
+    {
+        for (int i = 0; i < incidents.size(); i++)
+        {
+            if (incidents.get(i).getLogNum() == incidentId)
+            {
                 return true;
             }
@@ -170,12 +188,14 @@
     /**
      * Uses an Incident's masterInc to look up its corresponding ID.
-     * 
-     * @param masterInc
-     *            the Incident's masterInc
+     *
+     * @param masterInc the Incident's masterInc
      * @return the Incident's ID, -1 if invalid masterInc
      */
-    public int getIncidentId(String masterInc) {
-        for (int i = 0; i < incidents.size(); i++) {
-            if (incidents.get(i).getMasterInc().equals(masterInc)) {
+    public int getIncidentId(String masterInc)
+    {
+        for (int i = 0; i < incidents.size(); i++)
+        {
+            if (incidents.get(i).getMasterInc().equals(masterInc))
+            {
                 return incidents.get(i).getLogNum();
             }
@@ -187,21 +207,28 @@
      * Returns the specified incident
      */
-    public Incident getIncident(int incidentId) {
-        for (int i = 0; i < incidents.size(); i++) {
-            if (incidents.get(i).getLogNum() == incidentId) {
+    public Incident getIncident(int incidentId)
+    {
+        for (int i = 0; i < incidents.size(); i++)
+        {
+            if (incidents.get(i).getLogNum() == incidentId)
+            {
                 return incidents.get(i);
             }
         }
-        return null;
+        logger.logp(Level.INFO, "CADData",
+                "getIncident", "id=" + incidentId, "incident not found.");
+        return new Incident(0, "", 0);
     }
 
     /**
      * Sends all the objects for UnitStatus
-     * 
+     *
      * @return DefaultTableModel for UnitStatus
      */
-    public DefaultTableModel tableForUnitStatus() {
+    public DefaultTableModel tableForUnitStatus()
+    {
         toUnitTableVector.clear();
-        for (int i = 0; i < units.size(); i++) {
+        for (int i = 0; i < units.size(); i++)
+        {
             toUnitTableVector.add(units.get(i).toVector());
         }
@@ -213,12 +240,15 @@
     /**
      * Sends all the objects for AssignedIncidents
-     * 
+     *
      * @return DefaultTableModel for AssignedIncidents
      */
-    public DefaultTableModel tableForAssignedIncidents() {
+    public DefaultTableModel tableForAssignedIncidents()
+    {
         toAssignedTableVector.clear();
-        for (int i = 0; i < incidents.size(); i++) {
+        for (int i = 0; i < incidents.size(); i++)
+        {
             if (incidents.get(i).hasOccured()
-                    && incidents.get(i).getIncidentStatus() == IncidentEnums.Assigned) {
+                    && incidents.get(i).getIncidentStatus() == IncidentEnums.Assigned)
+            {
                 toAssignedTableVector.add(incidents.get(i)
                         .toVectorForAssignedIncidents());
@@ -232,12 +262,15 @@
     /**
      * Sends all the objects for PendingIncidents
-     * 
+     *
      * @return DefaultTableModel for PendingIncidents
      */
-    public DefaultTableModel tableForPendingIncidents() {
+    public DefaultTableModel tableForPendingIncidents()
+    {
         toPendingTableVector.clear();
-        for (int i = 0; i < incidents.size(); i++) {
+        for (int i = 0; i < incidents.size(); i++)
+        {
             if (incidents.get(i).hasOccured()
-                    && incidents.get(i).getIncidentStatus() == IncidentEnums.Pending) {
+                    && incidents.get(i).getIncidentStatus() == IncidentEnums.Pending)
+            {
                 toPendingTableVector.add(incidents.get(i)
                         .toVectorForPendingIncidents());
@@ -251,11 +284,14 @@
     /**
      * Sends all the objects for IncidentEditor
-     * 
+     *
      * @return DefaultTableModel for IncidentEditor
      */
-    public DefaultTableModel tableForIncidentEditor() {
+    public DefaultTableModel tableForIncidentEditor()
+    {
         toIncidentEditorVector.clear();
-        for (int i = 0; i < incidents.size(); i++) {
-            if (incidents.get(i).hasOccured()) {
+        for (int i = 0; i < incidents.size(); i++)
+        {
+            if (incidents.get(i).hasOccured())
+            {
                 toIncidentEditorVector.add(incidents.get(i)
                         .toVectorForIncidentEditor());
@@ -270,8 +306,12 @@
      * Sets up a timer to subtract one from the unit's timer every second.
      */
-    public void handleUpdateTimes() {
-        Timer timer = new Timer(ONE_SECOND, new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                for (int i = 0; i < units.size(); i++) {
+    public void handleUpdateTimes()
+    {
+        Timer timer = new Timer(ONE_SECOND, new ActionListener()
+        {
+            public void actionPerformed(ActionEvent e)
+            {
+                for (int i = 0; i < units.size(); i++)
+                {
                     units.get(i).TimerMinusSecond();
                 }
@@ -280,20 +320,25 @@
         timer.start();
     }
-    
-    /**
-     * Assigns the specified unit to the specified incident and updates information in both screens
+
+    /**
+     * Assigns the specified unit to the specified incident and updates
+     * information in both screens
+     *
      * @param unitNum the unit being assigned
      * @param incidentNum the incident being assigned to
      * @param primary whether or not the assigned unit is the primary unit
      */
-    
-    public void unitAssignedToIncident(String unitNum, int incidentNum, boolean primary){
-        if(primary){
+    public void unitAssignedToIncident(String unitNum, int incidentNum, boolean primary)
+    {
+        if (primary)
+        {
             getIncident(incidentNum).setPrimaryAssignedUnitNum(unitNum);
             getIncident(incidentNum).setIncidentStatus(IncidentEnums.Assigned);
-        }else{
+        }
+        else
+        {
             getIncident(incidentNum).addAssignedUnitNum(unitNum);
         }
-            
+
         getUnit(unitNum).setAssignedIncidentId(incidentNum);
         getUnit(unitNum).setMasterInc(getIncident(incidentNum).getMasterInc());
@@ -302,19 +347,25 @@
         getUnit(unitNum).setType(getIncident(incidentNum).getAdditionalInfo().getType());
         getUnit(unitNum).setDestination(getIncident(incidentNum).getIncidentLocation().getAddress());
-        getUnit(unitNum).setArea(getIncident(incidentNum).getIncidentLocation().getArea()); 
+        getUnit(unitNum).setArea(getIncident(incidentNum).getIncidentLocation().getArea());
         getUnit(unitNum).setP(getIncident(incidentNum).getP());
     }
-    
-    /**
-     * Updates information in both incident and unit screens for when a unit has arrived at scene
-     * aka that the unit status is "10-97"
+
+    /**
+     * Updates information in both incident and unit screens for when a unit has
+     * arrived at scene aka that the unit status is "10-97"
+     *
      * @param unitNum the unit which arrived at the scene
      */
-    public void unitArrivedAtIncidentScene(String unitNum, int incidentNum, boolean primary){
-        if(getUnit(unitNum).getAssignedIncidentId() != incidentNum){
-            if(primary){
+    public void unitArrivedAtIncidentScene(String unitNum, int incidentNum, boolean primary)
+    {
+        if (getUnit(unitNum).getAssignedIncidentId() != incidentNum)
+        {
+            if (primary)
+            {
                 getIncident(incidentNum).setPrimaryAssignedUnitNum(unitNum);
                 getIncident(incidentNum).setIncidentStatus(IncidentEnums.Assigned);
-            }else{
+            }
+            else
+            {
                 getIncident(incidentNum).addAssignedUnitNum(unitNum);
             }
@@ -323,5 +374,5 @@
             getUnit(unitNum).setType(getIncident(incidentNum).getAdditionalInfo().getType());
             getUnit(unitNum).setDestination(getIncident(incidentNum).getIncidentLocation().getAddress());
-            getUnit(unitNum).setArea(getIncident(incidentNum).getIncidentLocation().getArea()); 
+            getUnit(unitNum).setArea(getIncident(incidentNum).getIncidentLocation().getArea());
             getUnit(unitNum).setP(getIncident(incidentNum).getP());
         }
@@ -330,13 +381,15 @@
         getUnit(unitNum).setCurrentLocation(getUnit(unitNum).getDestination());
     }
-    
-    /**
-     * Updates information in both incident and unit screens for when a unit has become available again
-     * aka that the unit status is "10-98"
+
+    /**
+     * Updates information in both incident and unit screens for when a unit has
+     * become available again aka that the unit status is "10-98"
+     *
      * @param unitNum the unit which arrived at the scene
      */
-    public void unitAvailable(String unitNum){
+    public void unitAvailable(String unitNum)
+    {
         getIncident(getUnit(unitNum).getAssignedIncidentId()).removeAssignedUnitNum(unitNum);
-        
+
         getUnit(unitNum).setStatus("10-98");
         getUnit(unitNum).setUnitStatus(UnitStatusEnums.Assignable);
@@ -346,5 +399,5 @@
         getUnit(unitNum).setDestination("");
         getUnit(unitNum).setP("");
-        
+
     }
 }
