~slub.team/goobi-indexserver/3.x

« back to all changes in this revision

Viewing changes to lucene/src/java/org/apache/lucene/analysis/tokenattributes/TermAttribute.java

  • Committer: Sebastian Meyer
  • Date: 2012-08-03 09:12:40 UTC
  • Revision ID: sebastian.meyer@slub-dresden.de-20120803091240-x6861b0vabq1xror
Remove Lucene and Solr source code and add patches instead
Fix Bug #985487: Auto-suggestion for the search interface

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package org.apache.lucene.analysis.tokenattributes;
2
 
 
3
 
/**
4
 
 * Licensed to the Apache Software Foundation (ASF) under one or more
5
 
 * contributor license agreements.  See the NOTICE file distributed with
6
 
 * this work for additional information regarding copyright ownership.
7
 
 * The ASF licenses this file to You under the Apache License, Version 2.0
8
 
 * (the "License"); you may not use this file except in compliance with
9
 
 * the License.  You may obtain a copy of the License at
10
 
 *
11
 
 *     http://www.apache.org/licenses/LICENSE-2.0
12
 
 *
13
 
 * Unless required by applicable law or agreed to in writing, software
14
 
 * distributed under the License is distributed on an "AS IS" BASIS,
15
 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 
 * See the License for the specific language governing permissions and
17
 
 * limitations under the License.
18
 
 */
19
 
 
20
 
import org.apache.lucene.util.Attribute;
21
 
 
22
 
/**
23
 
 * The term text of a Token.
24
 
 * @deprecated Use {@link CharTermAttribute} instead.
25
 
 */
26
 
@Deprecated
27
 
public interface TermAttribute extends Attribute {
28
 
  /** Returns the Token's term text.
29
 
   * 
30
 
   * This method has a performance penalty
31
 
   * because the text is stored internally in a char[].  If
32
 
   * possible, use {@link #termBuffer()} and {@link
33
 
   * #termLength()} directly instead.  If you really need a
34
 
   * String, use this method, which is nothing more than
35
 
   * a convenience call to <b>new String(token.termBuffer(), 0, token.termLength())</b>
36
 
   */
37
 
  public String term();
38
 
  
39
 
  /** Copies the contents of buffer, starting at offset for
40
 
   *  length characters, into the termBuffer array.
41
 
   *  @param buffer the buffer to copy
42
 
   *  @param offset the index in the buffer of the first character to copy
43
 
   *  @param length the number of characters to copy
44
 
   */
45
 
  public void setTermBuffer(char[] buffer, int offset, int length);
46
 
 
47
 
  /** Copies the contents of buffer into the termBuffer array.
48
 
   *  @param buffer the buffer to copy
49
 
   */
50
 
  public void setTermBuffer(String buffer);
51
 
 
52
 
  /** Copies the contents of buffer, starting at offset and continuing
53
 
   *  for length characters, into the termBuffer array.
54
 
   *  @param buffer the buffer to copy
55
 
   *  @param offset the index in the buffer of the first character to copy
56
 
   *  @param length the number of characters to copy
57
 
   */
58
 
  public void setTermBuffer(String buffer, int offset, int length);
59
 
  
60
 
  /** Returns the internal termBuffer character array which
61
 
   *  you can then directly alter.  If the array is too
62
 
   *  small for your token, use {@link
63
 
   *  #resizeTermBuffer(int)} to increase it.  After
64
 
   *  altering the buffer be sure to call {@link
65
 
   *  #setTermLength} to record the number of valid
66
 
   *  characters that were placed into the termBuffer. */
67
 
  public char[] termBuffer();
68
 
 
69
 
  /** Grows the termBuffer to at least size newSize, preserving the
70
 
   *  existing content. Note: If the next operation is to change
71
 
   *  the contents of the term buffer use
72
 
   *  {@link #setTermBuffer(char[], int, int)},
73
 
   *  {@link #setTermBuffer(String)}, or
74
 
   *  {@link #setTermBuffer(String, int, int)}
75
 
   *  to optimally combine the resize with the setting of the termBuffer.
76
 
   *  @param newSize minimum size of the new termBuffer
77
 
   *  @return newly created termBuffer with length >= newSize
78
 
   */
79
 
  public char[] resizeTermBuffer(int newSize);
80
 
 
81
 
  /** Return number of valid characters (length of the term)
82
 
   *  in the termBuffer array. */
83
 
  public int termLength();
84
 
  
85
 
  /** Set number of valid characters (length of the term) in
86
 
   *  the termBuffer array. Use this to truncate the termBuffer
87
 
   *  or to synchronize with external manipulation of the termBuffer.
88
 
   *  Note: to grow the size of the array,
89
 
   *  use {@link #resizeTermBuffer(int)} first.
90
 
   *  @param length the truncated length
91
 
   */
92
 
  public void setTermLength(int length);
93
 
}