コード例 #1
0
ファイル: Behaviour.cs プロジェクト: Sushiy/CodeSamples
    public void Delete()
    {
        if (behaviourRoot != null)
        {
            behaviourRoot.Delete();
            behaviourRoot = null;
        }
        activeTasks.Clear();

        tree.SetBehaviour(null);
    }
コード例 #2
0
ファイル: SearchNode.cs プロジェクト: james-windows/james
        public void Delete(string search, string path, int pos = 0, string debugging = "")
        {
            TraversalOption nextStep = new TraversalOption(Label, search, pos);

            switch (nextStep.option)
            {
            case TraversalOptions.MoveNext:
                if (NextNode == null)
                {
                    return;
                }
                NextNode.Delete(search, path, pos);
                break;

            case TraversalOptions.MoveDown:
                if (ChildNode != null)
                {
                    ChildNode.Delete(search, path, pos + nextStep.commonPrefixLength, debugging + Label);
                    Results.Remove(item => item.ComparePath(path));
                    if (Results.Count == StaticVariables.ResultListLength - 1)
                    {
                        RefillResults();
                    }
                    if (Results.Count == 0 && NextNode != null)
                    {
                        Items     = NextNode.Items;
                        Results   = NextNode.Results;
                        Label     = NextNode.Label;
                        ChildNode = NextNode.ChildNode;
                        NextNode  = NextNode.NextNode;
                    }
                }
                break;

            case TraversalOptions.Found:
                Items.Where(item => item.ComparePath(path)).ToList().ForEach(item => item.Delete());
                Items.RemoveAll(item => item.ComparePath(path));
                ResultItems.RemoveAll(item => item.ComparePath(path));
                break;

            default:
                return;
            }
        }
コード例 #3
0
        public void Delete(string Path)
        {
            string[] Split = Path.Split(new char[] { ':' }, 2);

            foreach (var ChildNode in Children)
            {
                if (ChildNode.GetAttributeString() == Split[0])
                {
                    if (Split.Length == 1)
                    {
                        Children.Remove(ChildNode);
                        return;
                    }

                    ChildNode.Delete(Split[1]);
                    return;
                }
            }
        }