Пример #1
0
        public bool IndexScan(out ReadOnlyCollection <AGraphElement> result, String indexId, IComparable literal,
                              BinaryOperator binOp)
        {
            IIndex index;

            if (!IndexFactory.TryGetIndex(out index, indexId))
            {
                result = null;
                return(false);
            }

            #region binary operation

            switch (binOp)
            {
            case BinaryOperator.Equals:
                if (!index.TryGetValue(out result, literal))
                {
                    result = null;
                    return(false);
                }
                break;

            case BinaryOperator.Greater:
                result = FindElementsIndex(BinaryGreaterMethod, literal, index);
                break;

            case BinaryOperator.GreaterOrEquals:
                result = FindElementsIndex(BinaryGreaterOrEqualMethod, literal, index);
                break;

            case BinaryOperator.LowerOrEquals:
                result = FindElementsIndex(BinaryLowerOrEqualMethod, literal, index);
                break;

            case BinaryOperator.Lower:
                result = FindElementsIndex(BinaryLowerMethod, literal, index);
                break;

            case BinaryOperator.NotEquals:
                result = FindElementsIndex(BinaryNotEqualsMethod, literal, index);
                break;

            default:
                result = null;
                return(false);
            }

            #endregion

            return(result.Count > 0);
        }
        public void TryGetIndexIntegrationTest()
        {
            Assert.Inconclusive("TODO.");

            var    target        = new IndexFactory(); // TODO: Initialize to an appropriate value
            IIndex index         = null;               // TODO: Initialize to an appropriate value
            IIndex indexExpected = null;               // TODO: Initialize to an appropriate value
            string indexName     = string.Empty;       // TODO: Initialize to an appropriate value
            bool   expected      = false;              // TODO: Initialize to an appropriate value
            bool   actual;

            actual = target.TryGetIndex(out index, indexName);
            Assert.AreEqual(indexExpected, index);
            Assert.AreEqual(expected, actual);
        }
Пример #3
0
        public bool SpatialIndexScan(out ReadOnlyCollection <AGraphElement> result, String indexId, IGeometry geometry)
        {
            IIndex index;

            if (!IndexFactory.TryGetIndex(out index, indexId))
            {
                result = null;
                return(false);
            }

            var spatialIndex = index as ISpatialIndex;

            if (spatialIndex != null)
            {
                return(spatialIndex.TryGetValue(out result, geometry));
            }

            result = null;
            return(false);
        }
Пример #4
0
        public bool FulltextIndexScan(out FulltextSearchResult result, String indexId, string searchQuery)
        {
            IIndex index;

            if (!IndexFactory.TryGetIndex(out index, indexId))
            {
                result = null;
                return(false);
            }

            var fulltextIndex = index as IFulltextIndex;

            if (fulltextIndex != null)
            {
                return(fulltextIndex.TryQuery(out result, searchQuery));
            }

            result = null;
            return(false);
        }
Пример #5
0
        public bool RangeIndexScan(out ReadOnlyCollection <AGraphElement> result, String indexId, IComparable leftLimit,
                                   IComparable rightLimit, bool includeLeft, bool includeRight)
        {
            IIndex index;

            if (!IndexFactory.TryGetIndex(out index, indexId))
            {
                result = null;
                return(false);
            }

            var rangeIndex = index as IRangeIndex;

            if (rangeIndex != null)
            {
                return(rangeIndex.Between(out result, leftLimit, rightLimit, includeLeft, includeRight));
            }

            result = null;
            return(false);
        }