Ejemplo n.º 1
0
        //searches the ACV tree and triggers the ACVFound event when it reaches the size limit of the tree
        private void traverseACVTree(ACVTreeNode node, List<Visit> visits, List<Visit> currentACV, int index, int size, int maxSize, Visit isIncluded)
        {
            int count = 0;

            if(node.Visit != null)
                currentACV.Add(node.Visit);

            if (size == maxSize)
            {
                this.ACVFound(this, new ACVFoundArgs(new ACV(currentACV)));
                return;
            }

            for (int i = index; i < visits.Count; i++)
            {

                if (node.Visit == null && isIncluded != null && count < 1)
                {
                    if(isIncluded.equals(visits[i]))
                    {
                        node.addChild(new ACVTreeNode(visits[i], node));
                        count++;
                        break;
                    }
                }
                else
                {
                    node.addChild(new ACVTreeNode(visits[i], node));
                }
            }

            foreach (ACVTreeNode n in node.Children)
            {
                traverseACVTree(n, visits, new List<Visit>(currentACV), ++index, size + 1, maxSize, isIncluded);
            }
        }