コード例 #1
0
            public override bool LessThan(System.Object o1, System.Object o2)
            {
                SpansCell spans1 = (SpansCell)o1;
                SpansCell spans2 = (SpansCell)o2;

                if (spans1.Doc() == spans2.Doc())
                {
                    if (spans1.Start() == spans2.Start())
                    {
                        if (spans1.End() == spans2.End())
                        {
                            return(spans1.index > spans2.index);
                        }
                        else
                        {
                            return(spans1.End() < spans2.End());
                        }
                    }
                    else
                    {
                        return(spans1.Start() < spans2.Start());
                    }
                }
                else
                {
                    return(spans1.Doc() < spans2.Doc());
                }
            }
コード例 #2
0
            public override bool LessThan(System.Object o1, System.Object o2)
            {
                SpansCell spans1 = (SpansCell)o1;
                SpansCell spans2 = (SpansCell)o2;

                if (spans1.Doc() == spans2.Doc())
                {
                    return(NearSpansOrdered.DocSpansOrdered(spans1, spans2));
                }
                else
                {
                    return(spans1.Doc() < spans2.Doc());
                }
            }
コード例 #3
0
        public override bool Next()
        {
            if (FirstTime)
            {
                InitList(true);
                ListToQueue(); // initialize queue
                FirstTime = false;
            }
            else if (More)
            {
                if (Min().Next())      // trigger further scanning
                {
                    Queue.UpdateTop(); // maintain queue
                }
                else
                {
                    More = false;
                }
            }

            while (More)
            {
                bool queueStale = false;

                if (Min().Doc() != Max.Doc()) // maintain list
                {
                    QueueToList();
                    queueStale = true;
                }

                // skip to doc w/ all clauses

                while (More && First.Doc() < Last.Doc())
                {
                    More = First.SkipTo(Last.Doc()); // skip first upto last
                    FirstToLast();                   // and move it to the end
                    queueStale = true;
                }

                if (!More)
                {
                    return(false);
                }

                // found doc w/ all clauses

                if (queueStale) // maintain the queue
                {
                    ListToQueue();
                    queueStale = false;
                }

                if (AtMatch())
                {
                    return(true);
                }

                More = Min().Next();
                if (More)
                {
                    Queue.UpdateTop(); // maintain queue
                }
            }
            return(false); // no more matches
        }
コード例 #4
0
        public virtual bool Next()
        {
            if (firstTime)
            {
                InitList(true);
                ListToQueue();                 // initialize queue
                firstTime = false;
            }
            else if (more)
            {
                if (Min().Next())
                {
                    // trigger further scanning
                    queue.AdjustTop();                     // maintain queue
                }
                else
                {
                    more = false;
                }
            }

            while (more)
            {
                bool queueStale = false;

                if (Min().Doc() != max.Doc())
                {
                    // maintain list
                    QueueToList();
                    queueStale = true;
                }

                // skip to doc w/ all clauses

                while (more && first.Doc() < last.Doc())
                {
                    more = first.SkipTo(last.Doc());   // skip first upto last
                    FirstToLast();                     // and move it to the end
                    queueStale = true;
                }

                if (!more)
                {
                    return(false);
                }

                // found doc w/ all clauses

                if (queueStale)
                {
                    // maintain the queue
                    ListToQueue();
                    queueStale = false;
                }

                if (AtMatch())
                {
                    return(true);
                }

                more = Min().Next();
                if (more)
                {
                    queue.AdjustTop();                     // maintain queue
                }
            }
            return(false);            // no more matches
        }
コード例 #5
0
        public virtual bool Next()
        {
            if (firstTime)
            {
                InitList(true);
                ListToQueue();                 // initialize queue
                firstTime = false;
            }
            else if (more)
            {
                more = Min().Next();                 // trigger further scanning
                if (more)
                {
                    queue.AdjustTop();                     // maintain queue
                }
            }

            while (more)
            {
                bool queueStale = false;

                if (Min().Doc() != max.Doc())
                {
                    // maintain list
                    QueueToList();
                    queueStale = true;
                }

                // skip to doc w/ all clauses

                while (more && first.Doc() < last.Doc())
                {
                    more = first.SkipTo(last.Doc());   // skip first upto last
                    FirstToLast();                     // and move it to the end
                    queueStale = true;
                }

                if (!more)
                {
                    return(false);
                }

                // found doc w/ all clauses

                if (queueStale)
                {
                    // maintain the queue
                    ListToQueue();
                    queueStale = false;
                }

                if (AtMatch())
                {
                    return(true);
                }

                // trigger further scanning
                if (inOrder && CheckSlop())
                {
                    /* There is a non ordered match within slop and an ordered match is needed. */
                    more = FirstNonOrderedNextToPartialList();
                    if (more)
                    {
                        PartialListToQueue();
                    }
                }
                else
                {
                    more = Min().Next();
                    if (more)
                    {
                        queue.AdjustTop();                         // maintain queue
                    }
                }
            }
            return(false);            // no more matches
        }