예제 #1
0
        /// <inheritdoc />
        public IEnumerable <Edge> AllWhere(Edge edge)
        {
            var index = this.IndexCoverage.SelectIndex(edge);

            IEnumerable <Edge> result;

            if (index.Item1 == IndexCoverage.None)
            {
                result = _edges;
            }
            else
            {
                IReadOnlyCollection <Edge> r;
                if (_index.TryGetValue(IndexKey.Create(edge, index.Item1.ToMask()), out r))
                {
                    result = r;
                }
                else
                {
                    result = Array.Empty <Edge>();
                }
            }

            if (index.Item2 != TripleMask.None)
            {
                result = result.Where(t => edge.EqualsWithMask(t, index.Item2));
            }

            return(result);
        }
예제 #2
0
        /// <summary>
        /// </summary>
        /// <param name="triple"></param>
        private void RemoveFromIndex(Edge triple)
        {
            Contract.Requires(triple != null);

            foreach (var index in _indexes)
            {
                _index.Remove(IndexKey.Create(triple, index.ToMask()), triple);
            }
        }