コード例 #1
0
        public ActionResult Index(string id = "")
        {
            var model = new FullList();

            model.Location     = new SelectList(db.Locations, "Id", "Name");
            model.Reader       = new SelectList(db.Readers, "Id", "Name");
            model.Site         = new SelectList(db.Sites, "Id", "Name");
            ViewBag.LookUpType = id;
            return(View(model));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: DirectoryLister.cs プロジェクト: tarik1603/Antd
        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);
                }
            }
        }
コード例 #4
0
        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
                    }
                }
            }
        }
コード例 #5
0
 public void CopyTo(Array array, int arrayIndex)
 {
     FullList.CopyTo(array, arrayIndex);
 }
コード例 #6
0
 public virtual void CopyTo(Array array, int index)
 {
     FullList.CopyTo(array, index);
 }
コード例 #7
0
        private IFullList <Control> Find(string expression, TextSearchOptions searchOptions, bool recursive, bool stopAtFirst)
        {
            bool caseInsensitive = (searchOptions & TextSearchOptions.CaseInsensitive) != 0;

            IFullList <Control> result = new FullList <Control>();

            if ((searchOptions & TextSearchOptions.Regex) == 0)
            {
                bool partial = (searchOptions & TextSearchOptions.Partial) != 0;
                // text
                if (caseInsensitive)
                {
                    // case insensitive text
                    expression = expression.ToUpperInvariant();

                    if (partial)
                    {
                        // case insensitive partial text
                        doFind(root, result, delegate(Control c)
                        {
                            string test = c.ID;
                            if (string.IsNullOrEmpty(test))
                            {
                                return(false);
                            }
                            test = test.ToUpperInvariant();
                            return(test.Contains(expression));
                        }, recursive, stopAtFirst);
                    }
                    else
                    {
                        // case insensitive exact text
                        doFind(root, result,
                               delegate(Control c) { return(string.Compare(c.ID, expression, StringComparison.OrdinalIgnoreCase) == 0); },
                               recursive, stopAtFirst);
                    }
                }
                else
                {
                    // case sensitive text
                    if (partial)
                    {
                        // case sensitive partial text
                        doFind(root, result, delegate(Control c) { return(c.ID.Contains(expression)); }, recursive, stopAtFirst);
                    }
                    else
                    {
                        // case sensitive exact text
                        doFind(root, result,
                               delegate(Control c) { return(string.Compare(c.ID, expression, StringComparison.Ordinal) == 0); },
                               recursive, stopAtFirst);
                    }
                }
            }
            else
            {
                // regex
                // we silently ignore the partial flag
                RegexOptions opts = caseInsensitive ? RegexOptions.IgnoreCase : RegexOptions.None;
                doFind(root, result, delegate(Control c) { return(Regex.IsMatch(c.ID, expression, opts)); }, recursive, stopAtFirst);
            }

            return(result);
        }
コード例 #8
0
        private IFullList<Control> Find(string expression, TextSearchOptions searchOptions, bool recursive, bool stopAtFirst)
        {
            bool caseInsensitive = (searchOptions & TextSearchOptions.CaseInsensitive) != 0;

            IFullList<Control> result = new FullList<Control>();

            if ((searchOptions & TextSearchOptions.Regex) == 0)
            {
                bool partial = (searchOptions & TextSearchOptions.Partial) != 0;
                // text
                if (caseInsensitive)
                {
                    // case insensitive text
                    expression = expression.ToUpperInvariant();

                    if (partial)
                    {
                        // case insensitive partial text
                        doFind(root, result, delegate(Control c)
                                             	{
                                             		string test = c.ID;
                                             		if (string.IsNullOrEmpty(test))
                                             			return false;
                                             		test = test.ToUpperInvariant();
                                             		return (test.Contains(expression));
                                             	}, recursive, stopAtFirst);
                    }
                    else
                    {
                        // case insensitive exact text
                        doFind(root, result,
                               delegate(Control c) { return (string.Compare(c.ID, expression, StringComparison.OrdinalIgnoreCase) == 0); },
                               recursive, stopAtFirst);
                    }
                }
                else
                {
                    // case sensitive text
                    if (partial)
                    {
                        // case sensitive partial text
                        doFind(root, result, delegate(Control c) { return (c.ID.Contains(expression)); }, recursive, stopAtFirst);
                    }
                    else
                    {
                        // case sensitive exact text
                        doFind(root, result,
                               delegate(Control c) { return (string.Compare(c.ID, expression, StringComparison.Ordinal) == 0); },
                               recursive, stopAtFirst);
                    }
                }
            }
            else
            {
                // regex
                // we silently ignore the partial flag
                RegexOptions opts = caseInsensitive ? RegexOptions.IgnoreCase : RegexOptions.None;
                doFind(root, result, delegate(Control c) { return (Regex.IsMatch(c.ID, expression, opts)); }, recursive, stopAtFirst);
            }

            return result;
        }