public void setActual(TrailNode node) { actualEnd = node; }
// Converts a string to a TestReplay object public void parseTestReplayFile(string testReplayString) { bool inActionSection = true; List<string> testStrings = testReplayString.Split('\n').Cast<string>().ToList<string>(); List<string> firstLineWords = testStrings[0].Split(' ').Cast<string>().ToList<string>(); parsePatientInfo(firstLineWords); string startTimeString = testStrings[1]; startTime = Convert.ToDateTime(startTimeString); int foundEndTestLine = 0; List<string> LEGACY_endTestCheckLine = testStrings[2].Split(' ').Cast<string>().ToList<string>(); if (LEGACY_endTestCheckLine[0].Contains('/')) { string endTimeString = testStrings[2]; endTime = Convert.ToDateTime(endTimeString); foundEndTestLine = 1; } for(int i = 2 + foundEndTestLine; i < testStrings.Count; i++) { if (inActionSection) { List<string> lineWords = testStrings[i].Split(' ') .Cast<string>().ToList<string>(); if (lineWords[0] == "line") ((Stroke)testActions[testActions.Count - 1]) .addLineData(parseLineLineData(lineWords)); else if (lineWords[0] == "Stroke") testActions.Add(parseLineStroke(lineWords)); else if (lineWords[0] == "DeleteStroke") testActions.Add(parseLineDelPrevStroke(lineWords)); else if (lineWords[0] == "=====TIMES=====") { inActionSection = false; } else if (lineWords[0] == "=====ERRORS====") { inActionSection = false; } else if (lineWords[0] == "=====NOTES=====") { inActionSection = false; } } else { // Parse all the error objects. Each one should be three nodes plus a Date List<string> lineWords = testStrings[i] .Split('\t').Cast<string>().ToList<string>(); // This is a node completion object. // Should be read as: //begin node '\t' point //end node '\t' point //DateTime if (lineWords.Count == 7) { NodeCompletion completion = new NodeCompletion(); // Get each of the node strings and points from the line for (int j = 0; j < 6; j += 3) { string beginText = lineWords[j]; Point point; point.X = Convert.ToDouble(lineWords[j + 1]); point.Y = Convert.ToDouble(lineWords[j + 2]); bool flip = true; if (testType.ToString().Contains("_H")) flip = false; TrailNode node = new TrailNode(beginText, point, flip); if (j == 0) completion.setBegin(node); if (j == 3) completion.setEnd(node); } DateTime date = new DateTime(); date = Convert.ToDateTime(lineWords[6]); completion.setTime(date); testCompletions.Add(completion); } // This is an error object. // Should be read as: //begin node '\t' point //exp end node '\t' point //act end node '\t' point //DateTime else if(lineWords.Count == 10) { TestError error = new TestError(); // Get each of the node strings and points from the line for(int j = 0; j < 9; j += 3) { string beginText = lineWords[j]; Point point; point.X = Convert.ToDouble(lineWords[j + 1]); point.Y = Convert.ToDouble(lineWords[j + 2]); bool flip = true; if(testType.ToString().Contains("_H")) flip = false; TrailNode node = new TrailNode(beginText, point, flip); if(j == 0) error.setBegin(node); if (j == 3) error.setExpected(node); if (j == 6) error.setActual(node); } DateTime date = new DateTime(); date = Convert.ToDateTime(lineWords[9]); error.setTime(date); testErrors.Add(error); } else if (lineWords.Count >= 5) { DateTime date = new DateTime(); date = DateTime.Parse(lineWords[0] + " " + lineWords[1] + " " + lineWords[2]); lineWords[3] = lineWords[3].Replace("[SPC]", ""); lineWords[4] = lineWords[4].Replace("[SPC]", ""); testNotes.Add( new PatientNote(lineWords[3], lineWords[4], date)); } } } }
public void setExpected(TrailNode node) { expectedEnd = node; }
public void setBegin(TrailNode node) { begin = node; }
// Test error on trails was from a beginning node to an expected incremental // node. Instead, the user went to the actual node. Could come in handy for // analysis purposes. public TestError(TrailNode bgn, TrailNode expected, TrailNode actual) { begin = bgn; expectedEnd = expected; actualEnd = actual; time = DateTime.Now; }
public void setEnd(TrailNode node) { end = node; }
// All node completions involve a beginning TrailNode and an ending TrailNode (they should be one different). // Send in the two TrailNode objects, and make the time now's DateTime. public NodeCompletion(TrailNode bgn, TrailNode ed) { begin = bgn; end = ed; time = DateTime.Now; }