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


C# BytesRef.Equals方法代码示例

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


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

示例1: TestFromBytes

        public virtual void TestFromBytes()
        {
            sbyte[] bytes = new sbyte[] { (sbyte)'a', (sbyte)'b', (sbyte)'c', (sbyte)'d' };
            BytesRef b = new BytesRef(bytes);
            Assert.AreEqual(bytes, b.Bytes);
            Assert.AreEqual(0, b.Offset);
            Assert.AreEqual(4, b.Length);

            BytesRef b2 = new BytesRef(bytes, 1, 3);
            Assert.AreEqual("bcd", b2.Utf8ToString());

            Assert.IsFalse(b.Equals(b2));
        }
开发者ID:joyanta,项目名称:lucene.net,代码行数:13,代码来源:TestBytesRef.cs

示例2: Matches

 /// <summary>
 /// returns true if term is within k edits of the query term </summary>
 internal bool Matches(BytesRef term, int k)
 {
     return k == 0 ? term.Equals(TermRef) : Matchers[k].Run(term.Bytes, term.Offset, term.Length);
 }
开发者ID:paulirwin,项目名称:lucene.net,代码行数:6,代码来源:FuzzyTermsEnum.cs

示例3: SeekExact

 public override void SeekExact(BytesRef term, TermState state)
 {
     termOrd = (int) ((OrdTermState) state).Ord;
     SetTerm();
     Debug.Assert(term.Equals(scratch));
 }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:6,代码来源:DirectPostingsFormat.cs

示例4: DirectIntersectTermsEnum


//.........这里部分代码省略.........
                                        if (skipUpto < numSkips)
                                        {
                                            Grow();

                                            int nextState = runAutomaton.Step(states[stateUpto].state, label);

                                            // Automaton is required to accept startTerm:
                                            Debug.Assert(nextState != -1);

                                            stateUpto++;
                                            states[stateUpto].changeOrd = outerInstance.skips[skipOffset + skipUpto++];
                                            states[stateUpto].state = nextState;
                                            states[stateUpto].transitions =
                                                compiledAutomaton.SortedTransitions[nextState];
                                            states[stateUpto].transitionUpto = -1;
                                            states[stateUpto].transitionMax = -1;
                                            //System.out.println("  push " + states[stateUpto].transitions.length + " trans");

                                            // if (DEBUG) {
                                            //   System.out.println("    push skip; changeOrd=" + states[stateUpto].changeOrd);
                                            // }

                                            // Match next label at this same term:
                                            goto nextLabelContinue;
                                        }
                                        else
                                        {
                                            // if (DEBUG) {
                                            //   System.out.println("    linear scan");
                                            // }
                                            // Index exhausted: just scan now (the
                                            // number of scans required will be less
                                            // than the minSkipCount):

                                            int startTermOrd = termOrd;
                                            while (termOrd < outerInstance.terms.Length &&
                                                   outerInstance.Compare(termOrd, startTerm) <= 0)
                                            {
                                                Debug.Assert(termOrd == startTermOrd ||
                                                             outerInstance.skipOffsets[termOrd] ==
                                                             outerInstance.skipOffsets[termOrd + 1]);
                                                termOrd++;
                                            }
                                            Debug.Assert(termOrd - startTermOrd < outerInstance.minSkipCount);
                                            termOrd--;
                                            stateUpto -= skipUpto;
                                            // if (DEBUG) {
                                            //   System.out.println("  end termOrd=" + termOrd);
                                            // }
                                            return;
                                        }
                                    }
                                    else
                                    {
                                        if (skipUpto < numSkips)
                                        {
                                            termOrd = outerInstance.skips[skipOffset + skipUpto];
                                            // if (DEBUG) {
                                            //   System.out.println("  no match; skip to termOrd=" + termOrd);
                                            // }
                                        }
                                        else
                                        {
                                            // if (DEBUG) {
                                            //   System.out.println("  no match; next term");
                                            // }
                                            termOrd++;
                                        }
                                        skipUpto = 0;
                                    }
                                }

                                // startTerm is >= last term so enum will not
                                // return any terms:
                                termOrd--;
                                // if (DEBUG) {
                                //   System.out.println("  beyond end; no terms will match");
                                // }
                                return;
                                nextLabelContinue:
                                ;
                            }
                            nextLabelBreak:
                            ;
                        }

                        int termOffset = outerInstance.termOffsets[termOrd];
                        int termLen = outerInstance.termOffsets[1 + termOrd] - termOffset;

                        if (termOrd >= 0 &&
                            !startTerm.Equals(new BytesRef(outerInstance.termBytes, termOffset, termLen)))
                        {
                            stateUpto -= skipUpto;
                            termOrd--;
                        }
                        // if (DEBUG) {
                        //   System.out.println("  loop end; return termOrd=" + termOrd + " stateUpto=" + stateUpto);
                        // }
                    }
                }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:101,代码来源:DirectPostingsFormat.cs

示例5: seekCeil

//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public SeekStatus seekCeil(util.BytesRef text) throws java.io.IOException
		public override SeekStatus seekCeil(BytesRef text)
		{
		  //System.out.println("te.seek text=" + field.name + ":" + text.utf8ToString() + " this=" + this);
		  current = fstEnum.seekCeil(text);
		  if (current == null)
		  {
			return SeekStatus.END;
		  }
		  else
		  {

			// System.out.println("  got term=" + current.input.utf8ToString());
			// for(int i=0;i<current.output.length;i++) {
			//   System.out.println("    " + Integer.toHexString(current.output.bytes[i]&0xFF));
			// }

			didDecode = false;

			if (text.Equals(current.input))
			{
			  //System.out.println("  found!");
			  return SeekStatus.FOUND;
			}
			else
			{
			  //System.out.println("  not found: " + current.input.utf8ToString());
			  return SeekStatus.NOT_FOUND;
			}
		  }
		}
开发者ID:paulirwin,项目名称:lucene.net,代码行数:32,代码来源:MemoryPostingsFormat.cs

示例6: FinishTerm

 public override void FinishTerm(BytesRef text, TermStats stats)
 {
     Debug.Assert(State == TermsConsumerState.START);
     State = TermsConsumerState.INITIAL;
     Debug.Assert(text.Equals(LastTerm));
     Debug.Assert(stats.DocFreq > 0); // otherwise, this method should not be called.
     Debug.Assert(stats.DocFreq == LastPostingsConsumer.DocFreq);
     SumDocFreq += stats.DocFreq;
     if (fieldInfo.FieldIndexOptions == FieldInfo.IndexOptions.DOCS_ONLY)
     {
         Debug.Assert(stats.TotalTermFreq == -1);
     }
     else
     {
         Debug.Assert(stats.TotalTermFreq == LastPostingsConsumer.TotalTermFreq);
         SumTotalTermFreq += stats.TotalTermFreq;
     }
     @in.FinishTerm(text, stats);
 }
开发者ID:joyanta,项目名称:lucene.net,代码行数:19,代码来源:AssertingPostingsFormat.cs


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