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

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

本文整理了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

/** Copies the contents of buffer into the termBuffer array.
 *  @param buffer the buffer to copy
 */
public final void setTermBuffer(String buffer) {
 termText = null;
 int length = buffer.length();
 char[] newCharBuffer = growTermBuffer(length);
 if (newCharBuffer != null) {
  termBuffer = newCharBuffer;
 }
 buffer.getChars(0, length, termBuffer, 0);
 termLength = length;
}

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

/** Copies the contents of buffer into the termBuffer array.
 *  @param buffer the buffer to copy
 */
public final void setTermBuffer(String buffer) {
 termText = null;
 int length = buffer.length();
 char[] newCharBuffer = growTermBuffer(length);
 if (newCharBuffer != null) {
  termBuffer = newCharBuffer;
 }
 buffer.getChars(0, length, termBuffer, 0);
 termLength = length;
}

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

/** Copies the contents of buffer, starting at offset for
 *  length characters, into the termBuffer array.
 *  @param buffer the buffer to copy
 *  @param offset the index in the buffer of the first character to copy
 *  @param length the number of characters to copy
 */
public final void setTermBuffer(char[] buffer, int offset, int length) {
 termText = null;
 char[] newCharBuffer = growTermBuffer(length);
 if (newCharBuffer != null) {
  termBuffer = newCharBuffer;
 }
 System.arraycopy(buffer, offset, termBuffer, 0, length);
 termLength = length;
}

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

/** Copies the contents of buffer, starting at offset for
 *  length characters, into the termBuffer array.
 *  @param buffer the buffer to copy
 *  @param offset the index in the buffer of the first character to copy
 *  @param length the number of characters to copy
 */
public final void setTermBuffer(char[] buffer, int offset, int length) {
 termText = null;
 char[] newCharBuffer = growTermBuffer(length);
 if (newCharBuffer != null) {
  termBuffer = newCharBuffer;
 }
 System.arraycopy(buffer, offset, termBuffer, 0, length);
 termLength = length;
}

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

/** Copies the contents of buffer, starting at offset and continuing
 *  for length characters, into the termBuffer array.
 *  @param buffer the buffer to copy
 *  @param offset the index in the buffer of the first character to copy
 *  @param length the number of characters to copy
 */
public final void setTermBuffer(String buffer, int offset, int length) {
 assert offset <= buffer.length();
 assert offset + length <= buffer.length();
 termText = null;
 char[] newCharBuffer = growTermBuffer(length);
 if (newCharBuffer != null) {
  termBuffer = newCharBuffer;
 }
 buffer.getChars(offset, offset + length, termBuffer, 0);
 termLength = length;
}

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

/** Copies the contents of buffer, starting at offset and continuing
 *  for length characters, into the termBuffer array.
 *  @param buffer the buffer to copy
 *  @param offset the index in the buffer of the first character to copy
 *  @param length the number of characters to copy
 */
public final void setTermBuffer(String buffer, int offset, int length) {
 assert offset <= buffer.length();
 assert offset + length <= buffer.length();
 termText = null;
 char[] newCharBuffer = growTermBuffer(length);
 if (newCharBuffer != null) {
  termBuffer = newCharBuffer;
 }
 buffer.getChars(offset, offset + length, termBuffer, 0);
 termLength = length;
}

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

/** Grows the termBuffer to at least size newSize, preserving the
 *  existing content. Note: If the next operation is to change
 *  the contents of the term buffer use
 *  {@link #setTermBuffer(char[], int, int)},
 *  {@link #setTermBuffer(String)}, or
 *  {@link #setTermBuffer(String, int, int)}
 *  to optimally combine the resize with the setting of the termBuffer.
 *  @param newSize minimum size of the new termBuffer
 *  @return newly created termBuffer with length >= newSize
 */
public char[] resizeTermBuffer(int newSize) {
 char[] newCharBuffer = growTermBuffer(newSize);
 if (termBuffer == null) {
  // If there were termText, then preserve it.
  // note that if termBuffer is null then newCharBuffer cannot be null
  assert newCharBuffer != null;
  if (termText != null) {
   termText.getChars(0, termText.length(), newCharBuffer, 0);
  }
  termBuffer = newCharBuffer;
 } else if (newCharBuffer != null) {
  // Note: if newCharBuffer != null then termBuffer needs to grow.
  // If there were a termBuffer, then preserve it
  System.arraycopy(termBuffer, 0, newCharBuffer, 0, termBuffer.length);
  termBuffer = newCharBuffer;      
 }
 termText = null;
 return termBuffer;
}

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

/** Grows the termBuffer to at least size newSize, preserving the
 *  existing content. Note: If the next operation is to change
 *  the contents of the term buffer use
 *  {@link #setTermBuffer(char[], int, int)},
 *  {@link #setTermBuffer(String)}, or
 *  {@link #setTermBuffer(String, int, int)}
 *  to optimally combine the resize with the setting of the termBuffer.
 *  @param newSize minimum size of the new termBuffer
 *  @return newly created termBuffer with length >= newSize
 */
public char[] resizeTermBuffer(int newSize) {
 char[] newCharBuffer = growTermBuffer(newSize);
 if (termBuffer == null) {
  // If there were termText, then preserve it.
  // note that if termBuffer is null then newCharBuffer cannot be null
  assert newCharBuffer != null;
  if (termText != null) {
   termText.getChars(0, termText.length(), newCharBuffer, 0);
  }
  termBuffer = newCharBuffer;
 } else if (newCharBuffer != null) {
  // Note: if newCharBuffer != null then termBuffer needs to grow.
  // If there were a termBuffer, then preserve it
  System.arraycopy(termBuffer, 0, newCharBuffer, 0, termBuffer.length);
  termBuffer = newCharBuffer;      
 }
 termText = null;
 return termBuffer;
}

相关文章