Example #1
0
        public MedicationNode getNextMedRemove()
        {
            MedicationNode returnValue = nextMed;

            nextMed = nextMed.getNextMed();
            return(returnValue);
        }
Example #2
0
 public pathNode(pathNode nextPathX, pathNode prevPathX, String pathNameX)
 {
     nextPath   = nextPathX;
     prevPath   = prevPathX;
     pathName   = pathNameX;
     medScanner = null;
 }
Example #3
0
        public void removeTimer(MedicationNode toRemove)
        {
            if (!toRemove.Equals(firstTimer))
            {
                if (toRemove.getNextMed() != null)
                {
                    toRemove.getNextMed().setPrevMed(toRemove.getPrevMed());
                }

                if (toRemove.getPrevMed() != null)
                {
                    toRemove.getPrevMed().setNextMed(toRemove.getNextMed());
                }
            }

            else
            {
                if (toRemove.getNextMed() != null)
                {
                    toRemove.getNextMed().setPrevMed(null);
                }

                firstTimer = toRemove.getNextMed();
            }
        }
Example #4
0
 public pathNode()
 {
     nextPath   = null;
     prevPath   = null;
     pathName   = null;
     medScanner = null;
 }
Example #5
0
        public counter()
        {
            Thread burner = new Thread(() => TimerCallback());             //Lambda thread?? I don't know I asked the internet and it works, leave off. I'll read more about it later.

            burner.Start();
            firstTimer   = null;
            timerScanner = null;
        }
Example #6
0
 public MedicationNode()
 {
     treatmentTime = 0;
     nextMed       = null;
     prevMed       = null;
     medication    = null;
     meds          = new medicationControl();
 }
Example #7
0
        public void removeNode()
        {
            if (this.nextMed != null)
            {
                this.nextMed.prevMed = this.prevMed;
            }

            if (this.prevMed != null)
            {
                this.prevMed.nextMed = this.nextMed;
            }
        }
Example #8
0
        public void TimerCallback()
        {
            /*
             * there should be a call back in this method if there is another timer in the same path. It should ask if you would like to start that one next
             * I think this whole method needs to be reworked to have that function correctly thouhgt
             */
            Console.WriteLine("running");
            do
            {
                if (firstTimer != null)
                {
                    if (firstTimer.getNextMed() == null)
                    {
                        timerScanner = firstTimer;
                        while (timerScanner != null)
                        {
                            TimeSpan Delta = DateTime.Now - timerScanner.getStart();
                            timerScanner.setTimeRemaing(timerScanner.getRunTime() - Delta);
                            //Console.WriteLine(timerScanner.getTimeRemaining());
                            if (timerScanner.getTimeRemaining().TotalSeconds <= 0)
                            {
                                Console.WriteLine("Timer " + timerScanner.getMedication().getMedicationName() + " Has Finished");
                                removeTimer(timerScanner);
                            }
                            timerScanner = timerScanner.getNextMed();
                        }
                    }

                    else
                    {
                        timerScanner = firstTimer;
                        while (timerScanner != null)
                        {
                            TimeSpan Delta = DateTime.Now - timerScanner.getStart();
                            timerScanner.setTimeRemaing(timerScanner.getRunTime() - Delta);
                            //Console.WriteLine(timerScanner.getTimeRemaining());
                            if (timerScanner.getTimeRemaining().TotalSeconds <= 0)
                            {
                                Console.WriteLine("Timer " + timerScanner.getMedication().getMedicationName() + " Has Finished");
                                removeTimer(timerScanner);
                            }
                            timerScanner = timerScanner.getNextMed();
                        }
                    }
                }
            } while (true);
        }
Example #9
0
        public void addMedication(double treatmentTime, medication medToAdd)
        {
            if (nextMed != null)
            {
                medScanner = nextMed;
                while (nextMed.getNextMed() != null)
                {
                    medScanner = medScanner.getNextMed();
                }

                medScanner.addMedicationNode(treatmentTime, medToAdd);
            }

            else
            {
                nextMed = new MedicationNode(treatmentTime, medToAdd);
            }
        }
 public void addTimer(MedicationNode timerToAdd)
 {
     if (firstTimer == null)
     {
         firstTimer = timerToAdd;
         timerToAdd.calculateEndTime();
         timerToAdd.removeNode();
         firstTimer.setNextMed(null);
         firstTimer.setPrevMed(null);
     }
     else
     {
         timerScanner = firstTimer;
         while (timerScanner.getNextMed() != null)
         {
             timerScanner = timerScanner.getNextMed();
         }
         timerScanner.setNextMed(timerToAdd);
         timerToAdd.setNextMed(timerScanner);
     }
 }
Example #11
0
        public MedicationNode(double treatmentTimeX, MedicationNode nextMedX, MedicationNode prevMedX, medication medicationX)
        {
            if (treatmentTimeX >= 0)
            {
                treatmentTime = treatmentTimeX;
            }

            if (nextMedX != null)
            {
                nextMed = nextMedX;
            }

            if (prevMedX != null)
            {
                prevMed = prevMedX;
            }
            if (medicationX != null)
            {
                medication = medicationX;
            }
            meds = new medicationControl();
        }
Example #12
0
 public void setPrevMed(MedicationNode prevMedX)
 {
     prevMed = prevMedX;
 }
Example #13
0
 public void setNextMed(MedicationNode nextMedX)
 {
     nextMed = nextMedX;
 }
Example #14
0
 public void addMedicationNode()
 {
     this.nextMed = new MedicationNode();
     this.nextMed.setPrevMed(this);
 }
Example #15
0
 public void addMedicationNode(double treatmentTime, medication medication)
 {
     this.nextMed = new MedicationNode(treatmentTime, medication);
     this.nextMed.setPrevMed(this);
 }
Example #16
0
 public void addMedicationNode(MedicationNode medToAdd)
 {
     this.nextMed         = medToAdd;
     this.nextMed.prevMed = this;
 }
        public void TimerCallback()
        {
            Console.WriteLine("running");
            do
            {
                if (firstTimer != null)
                {
                    if (firstTimer.getNextMed() == null)
                    {
                        timerScanner = firstTimer;
                        while (timerScanner != null)
                        {
                            TimeSpan Delta = DateTime.Now - timerScanner.getStart();
                            timerScanner.setTimeRemaing(timerScanner.getRunTime() - Delta);
                            Console.WriteLine(timerScanner.getTimeRemaining());
                            if (timerScanner.getTimeRemaining().TotalSeconds <= 0)
                            {
                                Console.WriteLine("Timer " + timerScanner.getMedication().getMedicationName() + " Has Finished");
                                if (timerScanner.getNextMed() != null)
                                {
                                    timerScanner.getNextMed().setPrevMed(timerScanner.getPrevMed());
                                }

                                if (timerScanner.getPrevMed() != null)
                                {
                                    timerScanner.getPrevMed().setNextMed(timerScanner.getNextMed());
                                }

                                firstTimer = null;
                            }
                            timerScanner = timerScanner.getNextMed();
                        }
                    }

                    else
                    {
                        timerScanner = firstTimer;
                        while (timerScanner != null)
                        {
                            TimeSpan Delta = DateTime.Now - timerScanner.getStart();
                            timerScanner.setTimeRemaing(timerScanner.getRunTime() - Delta);
                            Console.WriteLine(timerScanner.getTimeRemaining());
                            if (timerScanner.getTimeRemaining().TotalSeconds <= 0)
                            {
                                Console.WriteLine("Timer " + timerScanner.getMedication().getMedicationName() + " Has Finished");
                                if (timerScanner.getNextMed() != null)
                                {
                                    timerScanner.getNextMed().setPrevMed(timerScanner.getPrevMed());
                                }

                                if (timerScanner.getPrevMed() != null)
                                {
                                    timerScanner.getPrevMed().setNextMed(timerScanner.getNextMed());
                                }
                            }
                            timerScanner = timerScanner.getNextMed();
                        }
                    }
                }
            } while (true);
        }