//------------------------------------------------------------------------------ // checks if a course is already scheduled. Because courses are returned as // numbers from Cashman network and not Job type, we can't check for the // instance, we have to find it //------------------------------------------------------------------------------ private bool IsScheduled(Job j) { if (completedPrior != null) { if (completedPrior.Count > 0) { for (int i = 0; i < completedPrior.Count; i++) { if (j.GetID() == completedPrior[i].GetID()) { return(true); } } } } for (int i = 0; i < finalPlan.Count; i++) { Machine m = finalPlan[i]; if (m.GetCurrentJobProcessing().GetID() == j.GetID()) { return(true); } } return(false); }
//------------------------------------------------------------------------------ // find by retrieving job and looking at when it was scheduled // only called if the job actually has prerequisites // //------------------------------------------------------------------------------ private int[] GetMostRecentPrereq(List <CourseNode> groups) { int mostRecentPrereqYear = -1; int mostRecentPrereqQuarter = -1; for (int i = 1; i < groups.Count; i++) { for (int j = 0; j < finalPlan.Count; j++) { Machine m = finalPlan[j]; if (m.GetCurrentJobProcessing() == null || groups[i].prereqs[0] == null) { continue; } if (m.GetCurrentJobProcessing().GetID() == groups[i].prereqs[0].prerequisiteID) { //found the course if (m.GetCurrentJobProcessing().GetYearScheduled() > mostRecentPrereqYear || (m.GetCurrentJobProcessing().GetYearScheduled() == mostRecentPrereqYear && m.GetCurrentJobProcessing().GetQuarterScheduled() > mostRecentPrereqQuarter)) { //now check if it is more recent mostRecentPrereqYear = m.GetCurrentJobProcessing().GetYearScheduled(); mostRecentPrereqQuarter = m.GetCurrentJobProcessing().GetQuarterScheduled(); } } } } return(new int[] { mostRecentPrereqYear, mostRecentPrereqQuarter }); }
//------------------------------------------------------------------------------ // checks if a course is already scheduled. Because courses are returned as // numbers from Cashman network and not Job type, we can't check for the // instance, we have to find it //------------------------------------------------------------------------------ private bool IsScheduled(Job j) { for (int i = 0; i < finalPlan.Count; i++) { Machine m = finalPlan[i]; if (m.GetCurrentJobProcessing().GetID() == j.GetID()) { return(true); } } return(false); }