Class CharTermAttributeImpl

    • Constructor Detail

      • CharTermAttributeImpl

        public CharTermAttributeImpl()
    • Method Detail

      • term

        @Deprecated
        public String term()
        Deprecated.
        Description copied from interface: TermAttribute
        Returns the Token's term text. This method has a performance penalty because the text is stored internally in a char[]. If possible, use TermAttribute.termBuffer() and TermAttribute.termLength() directly instead. If you really need a String, use this method, which is nothing more than a convenience call to new String(token.termBuffer(), 0, token.termLength())
        Specified by:
        term in interface TermAttribute
      • copyBuffer

        public final void copyBuffer​(char[] buffer,
                                     int offset,
                                     int length)
        Description copied from interface: CharTermAttribute
        Copies the contents of buffer, starting at offset for length characters, into the termBuffer array.
        Specified by:
        copyBuffer in interface CharTermAttribute
        Parameters:
        buffer - the buffer to copy
        offset - the index in the buffer of the first character to copy
        length - the number of characters to copy
      • setTermBuffer

        @Deprecated
        public void setTermBuffer​(char[] buffer,
                                  int offset,
                                  int length)
        Deprecated.
        Description copied from interface: TermAttribute
        Copies the contents of buffer, starting at offset for length characters, into the termBuffer array.
        Specified by:
        setTermBuffer in interface TermAttribute
        Parameters:
        buffer - the buffer to copy
        offset - the index in the buffer of the first character to copy
        length - the number of characters to copy
      • setTermBuffer

        @Deprecated
        public void setTermBuffer​(String buffer)
        Deprecated.
        Description copied from interface: TermAttribute
        Copies the contents of buffer into the termBuffer array.
        Specified by:
        setTermBuffer in interface TermAttribute
        Parameters:
        buffer - the buffer to copy
      • setTermBuffer

        @Deprecated
        public void setTermBuffer​(String buffer,
                                  int offset,
                                  int length)
        Deprecated.
        Description copied from interface: TermAttribute
        Copies the contents of buffer, starting at offset and continuing for length characters, into the termBuffer array.
        Specified by:
        setTermBuffer in interface TermAttribute
        Parameters:
        buffer - the buffer to copy
        offset - the index in the buffer of the first character to copy
        length - the number of characters to copy
      • resizeBuffer

        public final char[] resizeBuffer​(int newSize)
        Description copied from interface: CharTermAttribute
        Grows the termBuffer to at least size newSize, preserving the existing content.
        Specified by:
        resizeBuffer in interface CharTermAttribute
        Parameters:
        newSize - minimum size of the new termBuffer
        Returns:
        newly created termBuffer with length >= newSize
      • termLength

        @Deprecated
        public int termLength()
        Deprecated.
        Description copied from interface: TermAttribute
        Return number of valid characters (length of the term) in the termBuffer array.
        Specified by:
        termLength in interface TermAttribute
      • setLength

        public final CharTermAttribute setLength​(int length)
        Description copied from interface: CharTermAttribute
        Set number of valid characters (length of the term) in the termBuffer array. Use this to truncate the termBuffer or to synchronize with external manipulation of the termBuffer. Note: to grow the size of the array, use CharTermAttribute.resizeBuffer(int) first.
        Specified by:
        setLength in interface CharTermAttribute
        Parameters:
        length - the truncated length
      • setTermLength

        @Deprecated
        public void setTermLength​(int length)
        Deprecated.
        Description copied from interface: TermAttribute
        Set number of valid characters (length of the term) in the termBuffer array. Use this to truncate the termBuffer or to synchronize with external manipulation of the termBuffer. Note: to grow the size of the array, use TermAttribute.resizeTermBuffer(int) first.
        Specified by:
        setTermLength in interface TermAttribute
        Parameters:
        length - the truncated length
      • charAt

        public final char charAt​(int index)
        Specified by:
        charAt in interface CharSequence
      • append

        public final CharTermAttribute append​(String s)
        Description copied from interface: CharTermAttribute
        Appends the specified String to this character sequence.

        The characters of the String argument are appended, in order, increasing the length of this sequence by the length of the argument. If argument is null, then the four characters "null" are appended.

        Specified by:
        append in interface CharTermAttribute
      • append

        public final CharTermAttribute append​(StringBuilder s)
        Description copied from interface: CharTermAttribute
        Appends the specified StringBuilder to this character sequence.

        The characters of the StringBuilder argument are appended, in order, increasing the length of this sequence by the length of the argument. If argument is null, then the four characters "null" are appended.

        Specified by:
        append in interface CharTermAttribute
      • append

        public final CharTermAttribute append​(CharTermAttribute ta)
        Description copied from interface: CharTermAttribute
        Appends the contents of the other CharTermAttribute to this character sequence.

        The characters of the CharTermAttribute argument are appended, in order, increasing the length of this sequence by the length of the argument. If argument is null, then the four characters "null" are appended.

        Specified by:
        append in interface CharTermAttribute
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • clear

        public void clear()
        Description copied from class: AttributeImpl
        Clears the values in this AttributeImpl and resets it to its default value. If this implementation implements more than one Attribute interface it clears all.
        Specified by:
        clear in class AttributeImpl
      • clone

        public Object clone()
        Description copied from class: AttributeImpl
        Shallow clone. Subclasses must override this if they need to clone any members deeply,
        Overrides:
        clone in class AttributeImpl
      • toString

        public String toString()
        Returns solely the term text as specified by the CharSequence interface.

        This method changed the behavior with Lucene 3.1, before it returned a String representation of the whole term with all attributes. This affects especially the Token subclass.

        Specified by:
        toString in interface CharSequence
        Overrides:
        toString in class AttributeImpl
      • copyTo

        public void copyTo​(AttributeImpl target)
        Description copied from class: AttributeImpl
        Copies the values from this Attribute into the passed-in target attribute. The target implementation must support all the Attributes this implementation supports.
        Specified by:
        copyTo in class AttributeImpl