private static List <char> CreateListWithVoting(AllPairsSuffixPrefixResule allPairsSuffixPrefixResule, SortedList sl, int patternCount, int patternLength) { var fullList = new FullList(); var overlap = 0; var cursor = 0; var queuePattern = allPairsSuffixPrefixResule.PatternQueue; var queueOverlap = allPairsSuffixPrefixResule.OverlapQueue; for (int i = 0; i < patternCount - 1; i++) { var pattern = sl.SortedElementArray[queuePattern[i]]; cursor = cursor - overlap; for (int j = 0; j < overlap; j++) { fullList.Update(cursor, pattern.CodeChars[j]); cursor++; } for (int j = overlap; j < patternLength; j++) { cursor++; fullList.Add(pattern.CodeChars[j]); } overlap = queueOverlap[i]; } cursor = cursor - overlap; var patternLocal = sl.SortedElementArray[queuePattern[patternCount - 1]]; for (int i = 0; i < overlap; i++) { fullList.Update(cursor, patternLocal.CodeChars[i]); cursor++; } var overlapLast = queueOverlap[patternCount - 1]; for (int i = overlap; i < patternLength - overlapLast; i++) { fullList.Add(patternLocal.CodeChars[i]); cursor++; } for (int i = 0; i < overlapLast; i++) { fullList.Update(i, patternLocal.CodeChars[patternLength - overlapLast - 1 + i]); } var list = new List <char>(); foreach (var e in fullList.Src) { var m = GetMax(e); list.Add(Decode(m)); } return(list); }
private void WalkDirectoryTree(DirectoryInfo root, bool getSubDir) { FileInfo[] files = null; try { files = root.GetFiles("*.*"); } catch (UnauthorizedAccessException e) { Console.WriteLine(e.Message); } catch (DirectoryNotFoundException e) { Console.WriteLine(e.Message); } if (files == null) { return; } foreach (var fi in files) { FullList2.Add(new DirItemModel { isFile = true, path = fi.FullName, name = Path.GetFileName(fi.FullName) }); FullList.Add(fi.FullName); } var subDirs = root.GetDirectories(); foreach (var dirInfo in subDirs) { FullList2.Add(new DirItemModel { isFile = false, path = dirInfo.FullName, name = Path.GetDirectoryName(dirInfo.FullName) }); FullList.Add(dirInfo.FullName); if (getSubDir) { WalkDirectoryTree(dirInfo, true); } } }
public void MakeShortRawList() { // zeroadjustmentVal = AdjustmentInterface.GetZeroAdjustmentValue(); // This is for when we are ready to test the zero adjustment use case. while (!ShallStop) { for (int i = 0; i < 1000; i++) // 1000 being the amount of samples we want to process at a time { FullList.Add(_collection.Take()); // Adda 1000 samples into the treatment list. } if (FullList.Count >= 1000) // If the list is longer than the 5 sec window in the graph { for (int i = FullList.Count - 1000; i < FullList.Count - 16; i += 17) // Runs to full count minus 16, because otherwise the downsampling would stop. Does this mean we loose 16 points of data / one downsampled point? { Total = 0; ZeroAdjustedAverage = 0; Total = FullList[i].Voltage + FullList[i + 16].Voltage + FullList[i + 15].Voltage + FullList[i + 14].Voltage + FullList[i + 13].Voltage + FullList[i + 12].Voltage + FullList[i + 11].Voltage + FullList[i + 10].Voltage + FullList[i + 9].Voltage + FullList[i + 8].Voltage + FullList[i + 7].Voltage + FullList[i + 6].Voltage + FullList[i + 5].Voltage + FullList[i + 4].Voltage + FullList[i + 3].Voltage + FullList[i + 2].Voltage + FullList[i + 1].Voltage; ZeroAdjustedAverage = (Total / 17) - zeroadjustmentVal; _graphCollection.Add(new RawData(0, ZeroAdjustedAverage)); // There is not added a time stamp. // _filterCollection.Add(new RawData(0, ZeroAdjustedAverage)); // This is for when we are ready to test filter } } } }