Esempio n. 1
0
            public ImmutableList <ItemData> .Builder GetItems(ImmutableHashSet <string> globsToIgnore)
            {
                ImmutableList <ItemData> .Builder items;
                if (_previous == null)
                {
                    items = ImmutableList.CreateBuilder <ItemData>();
                }
                else
                {
                    var globsToIgnoreForPreviousOperations = globsToIgnore;

                    //  If this is a remove operation, then add any globs that will be removed
                    //  to the list of globs to ignore in previous operations
                    var removeOperation = _operation as RemoveOperation;
                    if (removeOperation != null)
                    {
                        var globsToIgnoreBuilder = removeOperation.GetRemovedGlobs();
                        foreach (var globToRemove in globsToIgnoreForPreviousOperations)
                        {
                            globsToIgnoreBuilder.Add(globToRemove);
                        }
                        globsToIgnoreForPreviousOperations = globsToIgnoreBuilder.ToImmutable();
                    }

                    items = _previous.GetItems(globsToIgnoreForPreviousOperations);
                }

                _operation.Apply(items, globsToIgnore);

                //  TODO: cache result if any globs were executed

                return(items);
            }
Esempio n. 2
0
        ICollection <ItemData> GetItems(string itemType)
        {
            LazyItemList itemList = GetItemList(itemType);

            if (itemList == null)
            {
                return(ImmutableList <ItemData> .Empty);
            }
            return(itemList.GetItems(ImmutableHashSet <string> .Empty).Where(itemData => itemData.ConditionResult).ToList());
        }