public medNode[] getMedArray() { int medCount = 1; if (firstMed == null) { medNode[] temp = new medNode[0]; return(temp); } else { MS = firstMed; while (MS.getNextMed() != null) { medCount++; MS = MS.getNextMed(); } medNode[] meds = new medNode[medCount]; MS = firstMed; for (int i = 0; i < medCount; i++) { meds[i] = MS; MS = MS.getNextMed(); } return(meds); } }
public medNode findMed(string medName) { if (firstMed == null) { //If first med is null there are no meds M.debug("First Med is null"); return(null); } else { MS = firstMed; while (MS.getNextMed() != null) { if (MS.getName().Equals(medName)) { //Return first found med with proper name M.debug("Return found value"); return(MS); } } //returning null if nothing found M.debug("Nothing found returning null"); return(null); } }
public eventNode(string nameX, DateTime endTimeX, medNode linkedMedX) { name = nameX; endTime = endTimeX; med = linkedMedX; reminder = false; }
public timerNode(String timerNameX, medNode medX, string pathNameX) { timerName = timerNameX; med = medX; pathName = pathNameX; counter = Counter.Master(); running = false; }
public timerNode() { //Defult constructor prevTimer = null; nextTimer = null; med = null; counter = Counter.Master(); running = false; }
public timerNode(String timerNameX, timerNode prevTimerX, timerNode nextTimerX) { //Constructor that is going to be used the most often. Used when > 2 paths created timerName = timerNameX; prevTimer = prevTimerX; nextTimer = nextTimerX; med = null; counter = Counter.Master(); running = false; }
public timerNode(String timerNameX, timerNode prevTimerX) { //Constructor for when only the prev path is know (The second path created) timerName = timerNameX; prevTimer = prevTimerX; prevTimer = null; med = null; counter = Counter.Master(); running = false; }
public timerNode(String timerNameX) { //Constructor used for the first path created prevTimer = null; nextTimer = null; timerName = timerNameX; med = null; counter = Counter.Master(); running = false; }
public void remove() { if (prevMed != null) { prevMed.setNextMed(nextMed); } if (nextMed != null) { nextMed.setPrevMed(prevMed); } nextMed = null; prevMed = null; }
public void addTimer(String pathNameX, String timerNameX, String medNameX) { medNode medToAdd = null; medToAdd = medMaster.findMed(medNameX); if (medToAdd == null) { Console.WriteLine("That medication does not exsist"); } else { if (firstPath == null) { Console.WriteLine("There are not paths"); } else { PS = firstPath; pathNode pathToAddTo = null; while (PS.getNextPath() != null) { if (PS.getPathName().Equals(pathNameX)) { pathToAddTo = PS; } PS = PS.getNextPath(); } if (pathToAddTo == null) { Console.WriteLine("That path does not exsist"); } else { pathToAddTo.getTimers().addTimer(timerNameX, medToAdd, pathToAddTo.getPathName()); M.debug("Med added"); } } } }
public void printMeds() { if (firstMed == null) { Console.WriteLine("There are no meds to display"); } else { MS = firstMed; while (MS != null) { MS.toString(); M.BL(); MS = MS.getNextMed(); } } }
public void addTimer(String timerNodeX, medNode medX, string pathNameX) { /* * Three Conditions * First Timer == null - No Timers - firstTimer = New Path * First Timer.getNext() == null - One Timer - firstTimer.getNext().setNext(New Timer) * First Timer.getNext() != null - > Two Timers - find last and assign */ if (firstTimer == null) { timerNode newTimer = new timerNode(timerNodeX, medX, pathNameX); firstTimer = newTimer; Console.ForegroundColor = ConsoleColor.DarkGray; M.debug("New Timer Created, assigned to firstTimer"); } else if (firstTimer.getNextTimer() == null) { timerNode newTimer = new timerNode(timerNodeX, medX, pathNameX); firstTimer.setNextTimer(newTimer); //firstTimer.next = newPath newTimer.setPrevTimer(firstTimer); M.debug("New Timer Created, registered as second Timer created"); } else { TS = firstTimer; while (TS.getNextTimer() != null) { //Find last path TS = TS.getNextTimer(); } timerNode newPath = new timerNode(timerNodeX, medX, pathNameX); TS.setNextTimer(newPath); //lastPath.next = newPath newPath.setPrevTimer(TS); //newPath.last = lastPath M.debug("Timer created, Unkown TImer possiton, Prev/Next Timer values assigned accordingly"); } }
public void addMed(String medNameX, String medDoesX, TimeSpan treatTimeX) { /* * Three Conditions * First med == null - No meds - Firstmed = New med * First med.getNext() == null - One Med - FirstMed.getNext().setNext(New med) * First med.getNext() != null - > Two meds - find last and assign */ if (firstMed == null) { medNode newMed = new medNode(medNameX, medDoesX, treatTimeX); firstMed = newMed; Console.ForegroundColor = ConsoleColor.DarkGray; M.debug("New Med Created, assigned to firstMed"); } else if (firstMed.getNextMed() == null) { medNode newMed = new medNode(medNameX, medDoesX, treatTimeX); firstMed.setNextMed(newMed); //firstMed.next = newMed newMed.setPrevMed(firstMed); M.debug("New Med Created, registered as second med created"); } else { MS = firstMed; while (MS.getNextMed() != null) { //Find last med MS = MS.getNextMed(); } medNode newMed = new medNode(medNameX, medDoesX, treatTimeX); MS.setNextMed(newMed); //lastPath.next = newMed newMed.setPrevMed(MS); //newMed.last = lastPath M.debug("Med created, Unkown Med possiton, Prev/Next med values assigned accordingly"); } }
public void addEvent(String eventNameX, DateTime endTimeX, medNode linkedMedX) { /* * Three Conditions * First Event == null - No Events - firstEvent = New Path * First Event.getNext() == null - One Event - firstEvent.getNext().setNext(New Event) * First Event.getNext() != null - > Two Events - find last and assign */ if (firstEvent == null) { eventNode newEvent = new eventNode(eventNameX, endTimeX, linkedMedX); firstEvent = newEvent; M.debug("New Event Created, assigned to firstEvent"); } else if (firstEvent.getNextEvent() == null) { eventNode newEvent = new eventNode(eventNameX, endTimeX, linkedMedX); firstEvent.setNextEvent(newEvent); //firstEvent.next = newPath newEvent.setPrevEvent(firstEvent); M.debug("New Event Created, registered as second Event created"); } else { ES = firstEvent; while (ES.getNextEvent() != null) { //Find last path ES = ES.getNextEvent(); } eventNode newPath = new eventNode(eventNameX, endTimeX, linkedMedX); ES.setNextEvent(newPath); //lastPath.next = newPath newPath.setPrevEvent(ES); //newPath.last = lastPath M.debug("Event created, Unkown Event possiton, Prev/Next Event values assigned accordingly"); } }
private static medNodeControl master; //Singleton master copy #endregion #region Constructors public medNodeControl() { firstMed = null; MS = null; }
public void setMed(medNode medX) { med = medX; }
public void setPrevMed(medNode prevMedX) { prevMed = prevMedX; }
public void setNextMed(medNode nextMedX) { nextMed = nextMedX; }
public void setLinkMed(medNode linkedMedX) { med = linkedMedX; }