Пример #1
0
 private void removeFirstLocationFromList()
 {
     //remove the first location in list
     _FirstLocation = _CurrentLocation.NextLocation;
     _FirstLocation.PreviousLocation = null;
     _CurrentLocation = _FirstLocation;
 }
Пример #2
0
 private void removeOnlyLocationFromList()
 {
     //if only one location in list remove it.
     _FirstLocation   = null;
     _CurrentLocation = null;
     _LastLocation    = null;
 }
Пример #3
0
 private void removeLastLocationFromList()
 {
     //remove location from the end of the list
     _LastLocation = _CurrentLocation.PreviousLocation;
     _LastLocation.NextLocation = null;
     _CurrentLocation           = _LastLocation;
 }
Пример #4
0
 public void Remove(MemoryLocation memLoc)
 {
     //public wrapper for removing a location
     _CurrentLocation = memLoc;
     removeCurrentLocation();
     renumberMemoryLocations();
 }
Пример #5
0
 private void removeCurrentLocationFromList()
 {
     //remove location from the middle of the list
     _CurrentLocation.NextLocation.PreviousLocation = _CurrentLocation.PreviousLocation;
     _CurrentLocation.PreviousLocation.NextLocation = _CurrentLocation.NextLocation;
     _CurrentLocation = _CurrentLocation.PreviousLocation;
 }
Пример #6
0
 private void addLocationToEndOfList(MemoryLocation n)
 {
     // add location to the end of the list
     n.PreviousLocation = _LastLocation;
     n.PreviousLocation.NextLocation = n;
     _LastLocation    = n;
     _CurrentLocation = n;
 }
Пример #7
0
        public void AddAfter(int index, string wordValue)
        {
            //add given word after given index in the list.
            MemoryLocation newLoc = new MemoryLocation();

            newLoc.Word(wordValue);
            this.AddAfter(index, newLoc);
        }
Пример #8
0
 private void addLocationToListAfterCurrentLocation(MemoryLocation n)
 {
     // add location to a specified location in the list
     n.PreviousLocation            = _CurrentLocation;
     n.NextLocation                = _CurrentLocation.NextLocation;
     _CurrentLocation.NextLocation = n;
     _CurrentLocation              = n;
 }
Пример #9
0
 public void Bind(MemoryLocation memLoc)
 {
     //This is done because the = operator for setting can not be overloaded.
     this.NextLocation     = memLoc.NextLocation;
     this.PreviousLocation = memLoc.PreviousLocation;
     this.ID       = memLoc.ID;
     this.HasError = memLoc.HasError;
     this.Word(memLoc.Word());
 }
Пример #10
0
 private void addLocationToStartOfList(MemoryLocation n)
 {
     //add location to the start of the list
     if (_CurrentLocation == null)
     {
         _LastLocation = n;
     }
     _FirstLocation   = n;
     _CurrentLocation = n;
 }
Пример #11
0
 public void moveToNextLocation()
 {
     //move along memory locations to next in list from current location
     if (_CurrentLocation != null)
     {
         if (_CurrentLocation.NextLocation != null)
         {
             _CurrentLocation = _CurrentLocation.NextLocation;
         }
     }
 }
Пример #12
0
 public void moveToPreviousLocation()
 {
     //move along memory location to previous in list from the current location
     if (_CurrentLocation != null)
     {
         if (_CurrentLocation.PreviousLocation != null)
         {
             _CurrentLocation = _CurrentLocation.PreviousLocation;
         }
     }
 }
Пример #13
0
 public void Add(MemoryLocation memLoc)
 {
     //public wrapper for adding a memory location
     try
     {
         this.addLocationToList(memLoc);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #14
0
 public void AddAfter(int index, MemoryLocation memLoc)
 {
     //add location after a given index in the list
     try
     {
         _CurrentLocation = Locations(index);
         this.addLocationToList(memLoc);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #15
0
        public int Count()
        {
            //returns the count of memory locations
            int            countInt = 0;
            MemoryLocation loc      = _FirstLocation;

            while (loc != null)
            {
                countInt += 1;
                loc       = loc.NextLocation;
            }
            return(countInt);
        }
Пример #16
0
 private void addLocationToLocationList(MemoryLocation curLocation, ref System.Collections.Generic.List <MemoryLocation> alLocations)
 {
     //Add location to Generic List given
     if (curLocation == null)
     {
         //do nothing
     }
     else
     {
         alLocations.Add(curLocation);
         addLocationToLocationList(curLocation.NextLocation, ref alLocations);
     }
 }
Пример #17
0
        public List <MemoryLocation> Locations()
        {
            //returns all memory locations in order
            List <MemoryLocation> retList = new List <MemoryLocation>();
            MemoryLocation        loc     = _FirstLocation;

            while (loc != null)
            {
                retList.Add(loc);
                loc = loc.NextLocation;
            }
            return(retList);
        }
Пример #18
0
        private void renumberMemoryLocations()
        {
            //set the id of each location to proper numbers zero based index.
            MemoryLocation memLoc        = _FirstLocation;
            int            memLocCounter = 0;

            while (memLoc != null)
            {
                memLoc.ID      = memLocCounter;
                memLoc         = memLoc.NextLocation;
                memLocCounter += 1;
            }
            //_CurrentLocation = _LastLocation
        }
Пример #19
0
 private void addLocationToArrayList(MemoryLocation curLocation, ref ArrayList alLocations)
 {
     //add locations to array list given
     if (curLocation == null)
     {
         //do nothing
     }
     else
     {
         string s = "";
         s += curLocation.Word().WordString;
         alLocations.Add(s);
         addLocationToArrayList(curLocation.NextLocation, ref alLocations);
     }
 }
Пример #20
0
        public int addInstuction(MemoryLocation myLoc, int programID)
        {
            //build connection
            SqlConnection conn = new SqlConnection(editonlyConnection);
            //build new command
            SqlCommand comm = new SqlCommand();
            //set command properties
            // ERROR: Not supported in C#: WithStatement

            int retInt;

            //open the connection to the database
            conn.Open();
            //executes the command that does not return a record set
            retInt = comm.ExecuteNonQuery();
            //close the connection to the database
            conn.Close();
            return(retInt);
        }
Пример #21
0
 private void addLocationToList(MemoryLocation n)
 {
     //add memory location to list
     if (_FirstLocation == null)
     {
         addLocationToStartOfList(n);
     }
     else
     {
         if (_CurrentLocation.NextLocation != null)
         {
             addLocationToListAfterCurrentLocation(n);
         }
         else
         {
             addLocationToEndOfList(n);
         }
     }
     renumberMemoryLocations();
 }
Пример #22
0
        public int Add(string wordValue)
        {
            //public wrappper for adding a word value
            MemoryLocation newLoc = new MemoryLocation();
            int            result;

            try
            {
                newLoc.Word(wordValue);

                result = 1;
            }
            catch
            {
                newLoc.Word("0000");
                newLoc.HasError = true;
                result          = -1;
            }
            this.Add(newLoc);
            return(result);
        }
Пример #23
0
 //Private Sub advancePointer()
 //    _Pointer.Advance()
 //End Sub
 private void goToBranch(MemoryLocation storLoc)
 {
     //moves pointer to the new memory location
     _Pointer.Bind(storLoc);
     needToAdvancePointer = false;
 }