org.apache.lucene.analysis.Token.growTermBuffer()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(232)

本文整理了Java中org.apache.lucene.analysis.Token.growTermBuffer()方法的一些代码示例,展示了Token.growTermBuffer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Token.growTermBuffer()方法的具体详情如下:
包路径:org.apache.lucene.analysis.Token
类名称:Token
方法名:growTermBuffer

Token.growTermBuffer介绍

[英]Allocates a buffer char[] of at least newSize
[中]

代码示例

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

  1. /** Copies the contents of buffer into the termBuffer array.
  2. * @param buffer the buffer to copy
  3. */
  4. public final void setTermBuffer(String buffer) {
  5. termText = null;
  6. int length = buffer.length();
  7. char[] newCharBuffer = growTermBuffer(length);
  8. if (newCharBuffer != null) {
  9. termBuffer = newCharBuffer;
  10. }
  11. buffer.getChars(0, length, termBuffer, 0);
  12. termLength = length;
  13. }

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. /** Copies the contents of buffer into the termBuffer array.
  2. * @param buffer the buffer to copy
  3. */
  4. public final void setTermBuffer(String buffer) {
  5. termText = null;
  6. int length = buffer.length();
  7. char[] newCharBuffer = growTermBuffer(length);
  8. if (newCharBuffer != null) {
  9. termBuffer = newCharBuffer;
  10. }
  11. buffer.getChars(0, length, termBuffer, 0);
  12. termLength = length;
  13. }

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

  1. /** Copies the contents of buffer, starting at offset for
  2. * length characters, into the termBuffer array.
  3. * @param buffer the buffer to copy
  4. * @param offset the index in the buffer of the first character to copy
  5. * @param length the number of characters to copy
  6. */
  7. public final void setTermBuffer(char[] buffer, int offset, int length) {
  8. termText = null;
  9. char[] newCharBuffer = growTermBuffer(length);
  10. if (newCharBuffer != null) {
  11. termBuffer = newCharBuffer;
  12. }
  13. System.arraycopy(buffer, offset, termBuffer, 0, length);
  14. termLength = length;
  15. }

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. /** Copies the contents of buffer, starting at offset for
  2. * length characters, into the termBuffer array.
  3. * @param buffer the buffer to copy
  4. * @param offset the index in the buffer of the first character to copy
  5. * @param length the number of characters to copy
  6. */
  7. public final void setTermBuffer(char[] buffer, int offset, int length) {
  8. termText = null;
  9. char[] newCharBuffer = growTermBuffer(length);
  10. if (newCharBuffer != null) {
  11. termBuffer = newCharBuffer;
  12. }
  13. System.arraycopy(buffer, offset, termBuffer, 0, length);
  14. termLength = length;
  15. }

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. /** Copies the contents of buffer, starting at offset and continuing
  2. * for length characters, into the termBuffer array.
  3. * @param buffer the buffer to copy
  4. * @param offset the index in the buffer of the first character to copy
  5. * @param length the number of characters to copy
  6. */
  7. public final void setTermBuffer(String buffer, int offset, int length) {
  8. assert offset <= buffer.length();
  9. assert offset + length <= buffer.length();
  10. termText = null;
  11. char[] newCharBuffer = growTermBuffer(length);
  12. if (newCharBuffer != null) {
  13. termBuffer = newCharBuffer;
  14. }
  15. buffer.getChars(offset, offset + length, termBuffer, 0);
  16. termLength = length;
  17. }

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

  1. /** Copies the contents of buffer, starting at offset and continuing
  2. * for length characters, into the termBuffer array.
  3. * @param buffer the buffer to copy
  4. * @param offset the index in the buffer of the first character to copy
  5. * @param length the number of characters to copy
  6. */
  7. public final void setTermBuffer(String buffer, int offset, int length) {
  8. assert offset <= buffer.length();
  9. assert offset + length <= buffer.length();
  10. termText = null;
  11. char[] newCharBuffer = growTermBuffer(length);
  12. if (newCharBuffer != null) {
  13. termBuffer = newCharBuffer;
  14. }
  15. buffer.getChars(offset, offset + length, termBuffer, 0);
  16. termLength = length;
  17. }

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. /** Grows the termBuffer to at least size newSize, preserving the
  2. * existing content. Note: If the next operation is to change
  3. * the contents of the term buffer use
  4. * {@link #setTermBuffer(char[], int, int)},
  5. * {@link #setTermBuffer(String)}, or
  6. * {@link #setTermBuffer(String, int, int)}
  7. * to optimally combine the resize with the setting of the termBuffer.
  8. * @param newSize minimum size of the new termBuffer
  9. * @return newly created termBuffer with length >= newSize
  10. */
  11. public char[] resizeTermBuffer(int newSize) {
  12. char[] newCharBuffer = growTermBuffer(newSize);
  13. if (termBuffer == null) {
  14. // If there were termText, then preserve it.
  15. // note that if termBuffer is null then newCharBuffer cannot be null
  16. assert newCharBuffer != null;
  17. if (termText != null) {
  18. termText.getChars(0, termText.length(), newCharBuffer, 0);
  19. }
  20. termBuffer = newCharBuffer;
  21. } else if (newCharBuffer != null) {
  22. // Note: if newCharBuffer != null then termBuffer needs to grow.
  23. // If there were a termBuffer, then preserve it
  24. System.arraycopy(termBuffer, 0, newCharBuffer, 0, termBuffer.length);
  25. termBuffer = newCharBuffer;
  26. }
  27. termText = null;
  28. return termBuffer;
  29. }

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

  1. /** Grows the termBuffer to at least size newSize, preserving the
  2. * existing content. Note: If the next operation is to change
  3. * the contents of the term buffer use
  4. * {@link #setTermBuffer(char[], int, int)},
  5. * {@link #setTermBuffer(String)}, or
  6. * {@link #setTermBuffer(String, int, int)}
  7. * to optimally combine the resize with the setting of the termBuffer.
  8. * @param newSize minimum size of the new termBuffer
  9. * @return newly created termBuffer with length >= newSize
  10. */
  11. public char[] resizeTermBuffer(int newSize) {
  12. char[] newCharBuffer = growTermBuffer(newSize);
  13. if (termBuffer == null) {
  14. // If there were termText, then preserve it.
  15. // note that if termBuffer is null then newCharBuffer cannot be null
  16. assert newCharBuffer != null;
  17. if (termText != null) {
  18. termText.getChars(0, termText.length(), newCharBuffer, 0);
  19. }
  20. termBuffer = newCharBuffer;
  21. } else if (newCharBuffer != null) {
  22. // Note: if newCharBuffer != null then termBuffer needs to grow.
  23. // If there were a termBuffer, then preserve it
  24. System.arraycopy(termBuffer, 0, newCharBuffer, 0, termBuffer.length);
  25. termBuffer = newCharBuffer;
  26. }
  27. termText = null;
  28. return termBuffer;
  29. }

相关文章