Beispiel #1
0
        /// <summary>
        /// Adds a search criterion to this compound find. Each item will be anded with the previous unless
        /// isOr and/or isOmit are set to true.
        /// </summary>
        /// <param name="fieldName">Field name to search.</param>
        /// <param name="fieldValue">The value to search for</param>
        /// <param name="isOr">Is this find an OR find? Default is AND. Default is false.</param>
        /// <param name="isOmit">Omit records that match this criteria. Default is false</param>
        public void AddSearchCriterion(string fieldName, string fieldValue, Boolean isOr = false, Boolean isOmit = false)
        {
            var fc = new FindCriterion()
            {
                FieldName  = fieldName,
                FieldValue = fieldValue,
                IsOr       = isOr,
                IsOmit     = isOmit
            };

            this.AddSearchCriterion(fc);
        }
Beispiel #2
0
        } // executeFind

        internal void AddSearchCriterion(FindCriterion criterion)
        {
            FindCriteria.Add(criterion);
        }
Beispiel #3
0
        /// <summary>
        /// Adds a search criterion to this compound find. Each item will be anded with the previous unless
        /// isOr and/or isOmit are set to true.
        /// </summary>
        /// <param name="fieldName">Field name to search.</param>
        /// <param name="fieldValue">The value to search for</param>
        /// <param name="isOr">Is this find an OR find? Default is AND. Default is false.</param>
        /// <param name="isOmit">Omit records that match this criteria. Default is false</param>
        public void AddSearchCriterion(string fieldName, string fieldValue, Boolean isOr = false, Boolean isOmit = false)
        {
            var fc = new FindCriterion()
            {
                FieldName = fieldName,
                FieldValue = fieldValue,
                IsOr = isOr,
                IsOmit = isOmit
            };

            this.AddSearchCriterion(fc);
        }
Beispiel #4
0
 internal void AddSearchCriterion(FindCriterion criterion)
 {
     FindCriteria.Add(criterion);
 }
Beispiel #5
0
        public List <BWTNode> FindPath(int color, FindCriterion findCriterion)
        {
            var leafsNumber = (int)Math.Pow(2, _levels);
            var descLeafs   = DescendingTree.GetRange(DescendingTree.Count - leafsNumber, leafsNumber);
            var ascLeafs    = AscendingTree.GetRange(AscendingTree.Count - leafsNumber, leafsNumber);
            var descLeafColorCountGoToTheTop = LeafColorCountDictionaryGoToTheTop(descLeafs, color);
            var ascLeafColorCountGoToTheTop  = LeafColorCountDictionaryGoToTheTop(ascLeafs, color);

            var bridges = new List <List <BWTNode> >();

            foreach (var node in descLeafs)
            {
                BuildBridges(node, ascLeafs, visited: new List <BWTNode>(), currentPath: new List <BWTNode>(), bridges);
            }

            var result = new Dictionary <int, List <BWTNode> >();

            foreach (var bridge in bridges)
            {
                var counter = 0;
                for (int i = 0; i < bridge.Count; i++)
                {
                    if (i != 0)
                    {
                        if (i == bridge.Count - 1)
                        {
                            counter += ascLeafColorCountGoToTheTop[bridge[bridge.Count - 1]];
                        }
                        else
                        {
                            if (bridge[i].LeftChild.Equals(bridge[i - 1]))
                            {
                                if (bridge[i].LeftChildColor == color)
                                {
                                    counter += bridge[i].LeftChildColor;
                                }
                            }
                            if (bridge[i].RightChild.Equals(bridge[i - 1]))
                            {
                                if (bridge[i].RightChildColor == color)
                                {
                                    counter += bridge[i].RightChildColor;
                                }
                            }
                        }
                    }
                    else
                    {
                        counter += descLeafColorCountGoToTheTop[bridge[0]];
                    }
                }
                if (!result.Keys.Contains(counter))
                {
                    result.Add(counter, bridge);
                }
            }
            if (findCriterion == FindCriterion.MaxBranchesOfColor)
            {
                return(BuildPath(result[result.Keys.Max()]));
            }
            else
            {
                return(BuildPath(result[result.Keys.Min()]));
            }
        }