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 startTimer(string pathNameX) { if (firstPath == null) { Console.WriteLine("No paths exist"); } else { PS = firstPath; while (PS.getNextPath() != null) { if (PS.getPathName().Equals(pathNameX)) { PS.getTimers().startFirstTimer(); } PS = PS.getNextPath(); } } }
public void editPath(String pathName) { if (firstPath != null) { //If firstPath == null there are no paths PS = firstPath; pathNode toEdit = null; while (PS.getNextPath() != null) { if (PS.getPathName().Equals(pathName)) { //Finding the first path with that name, storing it, and breaking out of the loop toEdit = PS; break; } PS = PS.getNextPath(); } if (toEdit == null) { //No path by that name Console.WriteLine("There is no path by that name. Please make sure it was spelt correctly, this is Case Sensative"); } else { //The path was found Console.WriteLine("What would you like to do in path " + pathName + "?"); M.BL(); Console.WriteLine("1) Edit the Path's name"); Console.WriteLine("2) Edit the timer set in Path " + pathName); M.BL(); ConsoleKeyInfo answer = Console.ReadKey(); M.BL(); M.BL(); switch (answer.KeyChar) { case '1': { toEdit.changePathName(pathName); break; } case '2': { Console.WriteLine("What timer would you like to edit?"); M.BL(); M.BL(); toEdit.getTimers().printTimers(); string timerToEdit = Console.ReadLine(); toEdit.getTimers().editTimer(timerToEdit); M.BL(); break; } default: { Console.WriteLine("that is not an option"); M.BL(); break; } } } } else { Console.WriteLine("There are no paths to Edit. Please Create some First"); } }