Index: trunk/src/scriptbuilder/structures/events/UnitEvent.java
===================================================================
--- trunk/src/scriptbuilder/structures/events/UnitEvent.java	(revision 76)
+++ trunk/src/scriptbuilder/structures/events/UnitEvent.java	(revision 145)
@@ -22,8 +22,11 @@
     /**
      * Constructor.
+     * //TODO: when created, add a unit to the main units list that is contained within SimulationScript
      */
     public UnitEvent()
     {
+        
         super(ScriptEventType.UNIT_EVENT);
+        
     }
 
Index: trunk/src/scriptbuilder/structures/ScriptEvent.java
===================================================================
--- trunk/src/scriptbuilder/structures/ScriptEvent.java	(revision 107)
+++ trunk/src/scriptbuilder/structures/ScriptEvent.java	(revision 145)
@@ -83,5 +83,5 @@
     public int length;
     
-    private TimeSlice slice;
+    public TimeSlice slice;
 
     /**
Index: trunk/src/scriptbuilder/structures/MyScriptHandler.java
===================================================================
--- trunk/src/scriptbuilder/structures/MyScriptHandler.java	(revision 138)
+++ trunk/src/scriptbuilder/structures/MyScriptHandler.java	(revision 145)
@@ -304,5 +304,5 @@
 
         docPosition.push(ELEMENT.byName(qName));
-
+        
         try
         {
@@ -612,4 +612,5 @@
      * SAX Handler method. Executes at the close of each XML element.
      */
+    //todo: interpret this function better so that what is loaded from the XML file is easier to know.
     @Override
     public void endElement(String uri, String localName, String qName)
@@ -670,4 +671,6 @@
             {
                 cad.Header_Type = pcData.remove(currentElement);
+//                //change where the data is loaded in here
+//                currInc.insertCadData((int) currentEventTime, cad);
             }
             else if (currentElement == ELEMENT.Beat && docPosition.peek() == ELEMENT.HEADER_INFO)
Index: trunk/src/scriptbuilder/structures/ELEMENT.java
===================================================================
--- trunk/src/scriptbuilder/structures/ELEMENT.java	(revision 138)
+++ trunk/src/scriptbuilder/structures/ELEMENT.java	(revision 145)
@@ -35,4 +35,5 @@
     LOCATION_INFO,
     NEW_UNIT,
+    //todo: change this paramics to traffic modeler
     PARAMICS,//EVENT
     RADIO_EVALUATION,
Index: trunk/src/scriptbuilder/structures/SimulationScript.java
===================================================================
--- trunk/src/scriptbuilder/structures/SimulationScript.java	(revision 131)
+++ trunk/src/scriptbuilder/structures/SimulationScript.java	(revision 145)
@@ -21,4 +21,5 @@
  *
  * @author Bryan McGuffin <bmcguffi@calpoly.edu>
+ * @author Sebastien Danthinne <sdanthin@calpoly.edu>
  * @version 2017/06/22
  */
@@ -61,8 +62,9 @@
      * The units which participate in Unit events.
      */
-    public List<Unit> units;
+    public List<Unit> units; 
 
     //Somewhere in the code, something assumes that the list of incidents
     //contains exactly 10 items. Until I can find and un-break that, this will do.
+    //todo: this incident fill count error
     private final int INCIDENT_FILL_COUNT = 10;
 
@@ -76,4 +78,6 @@
      */
     private MyScriptHandler sh;
+    
+    public boolean saved;
 
     //TODO: Pretty much everything in this constructor is dummy data.
@@ -89,4 +93,5 @@
         units = new ArrayList<Unit>();
         numberOfIncidents = 0;
+        saved = true;
 
         //Backfill with null incidents
@@ -96,15 +101,47 @@
         }
     }
-
+    
+    /**
+     * checks and sees if this object has the unit passed.
+     * @param unitID
+     * @return does this SimulationScript have unitnum?
+     */
+    public boolean hasUnit(String unitID){
+        boolean indicator = false;
+        if(units.size()!=0){
+            for(Unit u : units){
+               if(unitID.equals(u.UnitNum)){
+                   indicator = true;
+               }
+            }
+        }
+            
+        return indicator;
+    }
+    /**
+     * creates a dummy unit that only has unit number
+     * @param unitNum 
+     */
+    public void addDummyUnit(String unitNum){
+        Unit dummy = new Unit();
+        dummy.UnitNum = unitNum;
+        units.add(dummy);
+    }
     /**
      * Update the script's observers.
-     *
+     * 
      */
     public void update()
     {
         // The script has changed, notify observers
+        //use to rewrite the save indicator
+        //System.out.println("Script changed");
         setChanged();
         notifyObservers(this);
-    }
+        saved = false;
+        
+        
+    }
+    
 
     /**
@@ -154,4 +191,26 @@
         {
             System.out.println("ERROR LOADING SCRIPT");
+            ex.printStackTrace();
+        }
+        System.out.println("H");
+        for(Unit testUnit : units){
+            System.out.println(testUnit.toXML());
+        }
+        this.update();
+    }
+    
+    /**
+     * Load in an existing list of units from an XML file.
+     * @param f the file containing the units
+     */
+    public void loadUnitsFromFile(File f){
+        try
+        {
+            SAXParserFactory.newInstance().newSAXParser().parse(f, sh);
+            units.addAll(sh.getUnits());
+        }
+        catch (Exception ex)
+        {
+            System.out.println("ERROR LOADING UNITS");
             ex.printStackTrace();
         }
@@ -197,4 +256,5 @@
             ex.printStackTrace();
         }
+        saved = true;
     }
 
Index: trunk/src/scriptbuilder/structures/TimeSlice.java
===================================================================
--- trunk/src/scriptbuilder/structures/TimeSlice.java	(revision 142)
+++ trunk/src/scriptbuilder/structures/TimeSlice.java	(revision 145)
@@ -56,4 +56,8 @@
     }
 
+    
+    public ScriptIncident getIncident(){
+        return thisIncident;
+    }
     /**
      * Add a new script event to this time slice. Sort events by event type.
@@ -77,4 +81,6 @@
     public int getX()
     {
+//        System.out.println("position: " + seconds / ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION
+//                * ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK);
         return seconds / ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION
                 * ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK;
@@ -210,4 +216,5 @@
     public String toXML()
     {
+        //eventsCopy2 is used to clear out eventsCopy with one element contained
         ArrayList<I_ScriptEvent> eventsCopy = new ArrayList<I_ScriptEvent>();
         ArrayList<I_ScriptEvent> eventsCopy2 = new ArrayList<I_ScriptEvent>();
Index: trunk/src/scriptbuilder/structures/CadData.java
===================================================================
--- trunk/src/scriptbuilder/structures/CadData.java	(revision 143)
+++ trunk/src/scriptbuilder/structures/CadData.java	(revision 145)
@@ -15,14 +15,31 @@
         locInfo = new ArrayList<Location_Info>();
     }
+    
+    /**
+     * Constructor to add type and location, where TruncLoc is the first 5 letters of the fullloc.
+     * @param Header_Type
+     * @param Header_FullLoc 
+     */
+    public CadData(String Header_Type, String Header_FullLoc)
+    {
+        this.Header_Type = Header_Type;
+        this.Header_FullLoc = Header_FullLoc;
+//        if(Header_FullLoc.length()>10)
+//        {
+//            this.Header_TruncLoc = Header_FullLoc.substring(0,9);
+//        }
+        this.Header_TruncLoc = Header_FullLoc;
+        locInfo = new ArrayList<Location_Info>();
+    }
 
     public TimeSlice tSlice;
 
-    public String Header_Type = "DEFAULT";
+    public String Header_Type = "";
 
     public String Header_Beat = "";
 
-    public String Header_TruncLoc = "Default Location (short)";
-
-    public String Header_FullLoc = "Default Location (long)";
+    public String Header_TruncLoc = "";
+
+    public String Header_FullLoc = "";
 
     public String Master_Inc_Num = "";
@@ -134,6 +151,7 @@
         }
 
-        if (hasHeaderInfo() || true) //checking to see if header info is always necessary
-        {
+        if (hasHeaderInfo()) //checking to see if header info is always necessary
+        {
+            //todo: make this logic trigger only once per incident
             output += XMLWriter.openTag(ELEMENT.HEADER_INFO.tag);
 
Index: trunk/src/scriptbuilder/structures/.directory
===================================================================
--- trunk/src/scriptbuilder/structures/.directory	(revision 145)
+++ trunk/src/scriptbuilder/structures/.directory	(revision 145)
@@ -0,0 +1,5 @@
+[Dolphin]
+Timestamp=2019,10,31,15,57,42
+Version=4
+ViewMode=1
+VisibleRoles=CustomizedDetails,Details_text,Details_size,Details_modificationtime,Details_type,Details_tags,Details_group,Details_permissions
Index: trunk/src/scriptbuilder/structures/ScriptIncident.java
===================================================================
--- trunk/src/scriptbuilder/structures/ScriptIncident.java	(revision 131)
+++ trunk/src/scriptbuilder/structures/ScriptIncident.java	(revision 145)
@@ -46,5 +46,5 @@
      */
     public String description;
-
+    
     /**
      * Length, in seconds, of the incident.
@@ -72,5 +72,5 @@
     public int eventCount = 0;
 
-    SimulationScript script;
+    public SimulationScript script;
 
     /**
@@ -135,4 +135,31 @@
         this.setOffset(offset);
     }
+    
+//    /**
+//     * Constructor with type and location parameters.
+//     * @param color
+//     * @param number
+//     * @param name
+//     * @param description
+//     * @param script
+//     * @param offset
+//     * @param type
+//     * @param location 
+//     */
+//    public ScriptIncident(Color color, int number, String name,
+//            String description, SimulationScript script,
+//            int offset, String type, String location)
+//    {
+//        this.color = color;
+//        this.number = number;
+//        this.name = name;
+//        this.description = description;
+//        this.script = script;
+//        slices = new TreeMap<Integer, TimeSlice>();
+//        this.setOffset(offset);
+//        this.location = location;
+//        this.type = type;
+//        insertCadData(offset, new CadData(type,location));
+//    }
 
     /**
@@ -293,5 +320,5 @@
     }
 
-    void insertCadData(long currentEventTime, CadData cad)
+    public void insertCadData(long currentEventTime, CadData cad)
     {
         int time = (int) currentEventTime;
@@ -305,4 +332,13 @@
         slice = slices.get(time);
         slice.cadData = cad;
+    }
+    
+    public CadData getCadData(long currentEventTime)
+    {
+        int time = (int) currentEventTime;
+        TimeSlice slice;
+        
+        slice = slices.get(time);
+        return slice.cadData;
     }
 
Index: trunk/src/scriptbuilder/structures/units/Unit.java
===================================================================
--- trunk/src/scriptbuilder/structures/units/Unit.java	(revision 46)
+++ trunk/src/scriptbuilder/structures/units/Unit.java	(revision 145)
@@ -102,4 +102,11 @@
         Unit_Status = "";
     }
+    
+    public boolean equals(Unit u){
+        return UnitNum.equals(u.UnitNum);
+    }
+    public boolean equals(String num){
+        return UnitNum.equals(num);
+    }
 
     @Override
