当前位置: 首页>>代码示例>>C#>>正文


C# Frame.Rewind方法代码示例

本文整理汇总了C#中Frame.Rewind方法的典型用法代码示例。如果您正苦于以下问题:C# Frame.Rewind方法的具体用法?C# Frame.Rewind怎么用?C# Frame.Rewind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Frame的用法示例。


在下文中一共展示了Frame.Rewind方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SeekExact


//.........这里部分代码省略.........
                                    break;
                                }
                                targetUpto++;
                            }

                            if (cmp == 0)
                            {
                                cmp = Term_Renamed.Length - target.Length;
                            }
                            targetUpto = targetUptoMid;
                        }

                        if (cmp < 0)
                        {
                            // Common case: target term is after current
                            // term, ie, app is seeking multiple terms
                            // in sorted order
                            // if (DEBUG) {
                            //   System.out.println("  target is after current (shares prefixLen=" + targetUpto + "); frame.ord=" + lastFrame.ord);
                            // }
                            CurrentFrame = lastFrame;
                        }
                        else if (cmp > 0)
                        {
                            // Uncommon case: target term
                            // is before current term; this means we can
                            // keep the currentFrame but we must rewind it
                            // (so we scan from the start)
                            TargetBeforeCurrentLength = 0;
                            // if (DEBUG) {
                            //   System.out.println("  target is before current (shares prefixLen=" + targetUpto + "); rewind frame ord=" + lastFrame.ord);
                            // }
                            CurrentFrame = lastFrame;
                            CurrentFrame.Rewind();
                        }
                        else
                        {
                            // Target is exactly the same as current term
                            Debug.Assert(Term_Renamed.Length == target.Length);
                            if (TermExists)
                            {
                                // if (DEBUG) {
                                //   System.out.println("  target is same as current; return true");
                                // }
                                return true;
                            }
                            else
                            {
                                // if (DEBUG) {
                                //   System.out.println("  target is same as current but term doesn't exist");
                                // }
                            }
                            //validIndexPrefix = currentFrame.depth;
                            //term.length = target.length;
                            //return termExists;
                        }
                    }
                    else
                    {
                        TargetBeforeCurrentLength = -1;
                        arc = OuterInstance.Index.GetFirstArc(Arcs[0]);

                        // Empty string prefix must have an output (block) in the index!
                        Debug.Assert(arc.Final);
                        Debug.Assert(arc.Output != null);
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:66,代码来源:BlockTreeTermsReader.cs

示例2: SeekCeil


//.........这里部分代码省略.........
                                    break;
                                }
                                targetUpto++;
                            }

                            if (cmp == 0)
                            {
                                cmp = Term_Renamed.Length - target.Length;
                            }
                            targetUpto = targetUptoMid;
                        }

                        if (cmp < 0)
                        {
                            // Common case: target term is after current
                            // term, ie, app is seeking multiple terms
                            // in sorted order
                            //if (DEBUG) {
                            //System.out.println("  target is after current (shares prefixLen=" + targetUpto + "); clear frame.scanned ord=" + lastFrame.ord);
                            //}
                            CurrentFrame = lastFrame;
                        }
                        else if (cmp > 0)
                        {
                            // Uncommon case: target term
                            // is before current term; this means we can
                            // keep the currentFrame but we must rewind it
                            // (so we scan from the start)
                            TargetBeforeCurrentLength = 0;
                            //if (DEBUG) {
                            //System.out.println("  target is before current (shares prefixLen=" + targetUpto + "); rewind frame ord=" + lastFrame.ord);
                            //}
                            CurrentFrame = lastFrame;
                            CurrentFrame.Rewind();
                        }
                        else
                        {
                            // Target is exactly the same as current term
                            Debug.Assert(Term_Renamed.Length == target.Length);
                            if (TermExists)
                            {
                                //if (DEBUG) {
                                //System.out.println("  target is same as current; return FOUND");
                                //}
                                return SeekStatus.FOUND;
                            }
                            else
                            {
                                //if (DEBUG) {
                                //System.out.println("  target is same as current but term doesn't exist");
                                //}
                            }
                        }
                    }
                    else
                    {
                        TargetBeforeCurrentLength = -1;
                        arc = OuterInstance.Index.GetFirstArc(Arcs[0]);

                        // Empty string prefix must have an output (block) in the index!
                        Debug.Assert(arc.Final);
                        Debug.Assert(arc.Output != null);

                        //if (DEBUG) {
                        //System.out.println("    no seek state; push root frame");
                        //}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:67,代码来源:BlockTreeTermsReader.cs

示例3: ComputeBlockStats


//.........这里部分代码省略.........
                        stats.IndexNodeCount = OuterInstance.Index.NodeCount;
                        stats.IndexArcCount = OuterInstance.Index.ArcCount;
                        stats.IndexNumBytes = OuterInstance.Index.SizeInBytes();
                    }

                    CurrentFrame = StaticFrame;
                    FST<BytesRef>.Arc<BytesRef> arc;
                    if (OuterInstance.Index != null)
                    {
                        arc = OuterInstance.Index.GetFirstArc(Arcs[0]);
                        // Empty string prefix must have an output in the index!
                        Debug.Assert(arc.Final);
                    }
                    else
                    {
                        arc = null;
                    }

                    // Empty string prefix must have an output in the
                    // index!
                    CurrentFrame = PushFrame(arc, OuterInstance.RootCode, 0);
                    CurrentFrame.FpOrig = CurrentFrame.Fp;
                    CurrentFrame.LoadBlock();
                    ValidIndexPrefix = 0;

                    stats.StartBlock(CurrentFrame, !(CurrentFrame.IsLastInFloor));

                    while (true)
                    {
                        // Pop finished blocks
                        while (CurrentFrame.NextEnt == CurrentFrame.EntCount)
                        {
                            stats.EndBlock(CurrentFrame);
                            if (!CurrentFrame.IsLastInFloor)
                            {
                                CurrentFrame.LoadNextFloorBlock();
                                stats.StartBlock(CurrentFrame, true);
                            }
                            else
                            {
                                if (CurrentFrame.Ord == 0)
                                {
                                    goto allTermsBreak;
                                }
                                long lastFP = CurrentFrame.FpOrig;
                                CurrentFrame = Stack[CurrentFrame.Ord - 1];
                                Debug.Assert(lastFP == CurrentFrame.LastSubFP);
                                // if (DEBUG) {
                                //   System.out.println("  reset validIndexPrefix=" + validIndexPrefix);
                                // }
                            }
                        }

                        while (true)
                        {
                            if (CurrentFrame.Next())
                            {
                                // Push to new block:
                                CurrentFrame = PushFrame(null, CurrentFrame.LastSubFP, Term_Renamed.Length);
                                CurrentFrame.FpOrig = CurrentFrame.Fp;
                                // this is a "next" frame -- even if it's
                                // floor'd we must pretend it isn't so we don't
                                // try to scan to the right floor frame:
                                CurrentFrame.IsFloor = false;
                                //currentFrame.hasTerms = true;
                                CurrentFrame.LoadBlock();
                                stats.StartBlock(CurrentFrame, !CurrentFrame.IsLastInFloor);
                            }
                            else
                            {
                                stats.Term(Term_Renamed);
                                break;
                            }
                        }
                        //allTermsContinue:;
                    }
                allTermsBreak:

                    stats.Finish();

                    // Put root frame back:
                    CurrentFrame = StaticFrame;
                    if (OuterInstance.Index != null)
                    {
                        arc = OuterInstance.Index.GetFirstArc(Arcs[0]);
                        // Empty string prefix must have an output in the index!
                        Debug.Assert(arc.Final);
                    }
                    else
                    {
                        arc = null;
                    }
                    CurrentFrame = PushFrame(arc, OuterInstance.RootCode, 0);
                    CurrentFrame.Rewind();
                    CurrentFrame.LoadBlock();
                    ValidIndexPrefix = 0;
                    Term_Renamed.Length = 0;

                    return stats;
                }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:101,代码来源:BlockTreeTermsReader.cs


注:本文中的Frame.Rewind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。