public MedicationNode getNextMedRemove() { MedicationNode returnValue = nextMed; nextMed = nextMed.getNextMed(); return(returnValue); }
public pathNode(pathNode nextPathX, pathNode prevPathX, String pathNameX) { nextPath = nextPathX; prevPath = prevPathX; pathName = pathNameX; medScanner = null; }
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(); } }
public pathNode() { nextPath = null; prevPath = null; pathName = null; medScanner = null; }
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; }
public MedicationNode() { treatmentTime = 0; nextMed = null; prevMed = null; medication = null; meds = new medicationControl(); }
public void removeNode() { if (this.nextMed != null) { this.nextMed.prevMed = this.prevMed; } if (this.prevMed != null) { this.prevMed.nextMed = this.nextMed; } }
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); }
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); } }
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(); }
public void setPrevMed(MedicationNode prevMedX) { prevMed = prevMedX; }
public void setNextMed(MedicationNode nextMedX) { nextMed = nextMedX; }
public void addMedicationNode() { this.nextMed = new MedicationNode(); this.nextMed.setPrevMed(this); }
public void addMedicationNode(double treatmentTime, medication medication) { this.nextMed = new MedicationNode(treatmentTime, medication); this.nextMed.setPrevMed(this); }
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); }