Class AttLinkedList

java.lang.Object
com.github.oeuvres.alix.lucene.analysis.AttLinkedList

public class AttLinkedList extends Object
A kind of LinkedList of reusable attributes, without AttributeImpl.clone() and other creation of objects, for efficiency. Is used in analysis process to store states that can be recorded from both ends (ex : prefixes and suffixes)
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addFirst(char[] buffer, int copyOffset, int copyLength, int startOffset, int endOffset)
    Prepend a state at start of the list.
    void
    addFirst(org.apache.lucene.analysis.tokenattributes.CharTermAttribute term, int startOffset, int endOffset)
    Prepend a state at start of the list.
    void
    addFirst(org.apache.lucene.analysis.tokenattributes.CharTermAttribute term, org.apache.lucene.analysis.tokenattributes.OffsetAttribute offsets)
    Prepend a state at start of the list.
    void
    addLast(char[] buffer, int copyOffset, int copyLength, int startOffset, int endOffset)
    Append a state at end of the list.
    void
    addLast(org.apache.lucene.analysis.tokenattributes.CharTermAttribute term, int startOffset, int endOffset)
    Append a state at end of the list.
    void
    addLast(org.apache.lucene.analysis.tokenattributes.CharTermAttribute term, org.apache.lucene.analysis.tokenattributes.OffsetAttribute offsets)
    Prepend a state at end of the list.
    boolean
    void
    removeFirst(org.apache.lucene.analysis.tokenattributes.CharTermAttribute term, org.apache.lucene.analysis.tokenattributes.OffsetAttribute offsets)
    Poll the first state from list, copy chars in a CharTermAttribute implementing CharTermAttribute.copyBuffer(char[], int, int), copy startOffset and endOffset in OffsetAttribute.setOffset(int, int).
    void
    removeLast(org.apache.lucene.analysis.tokenattributes.CharTermAttribute term, org.apache.lucene.analysis.tokenattributes.OffsetAttribute offsets)
    Pop the last state from list, copy chars in a CharTermAttribute implementing CharTermAttribute.copyBuffer(char[], int, int), copy startOffset and endOffset in OffsetAttribute.setOffset(int, int).
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • AttLinkedList

      public AttLinkedList()
      Default constructor
  • Method Details

    • addFirst

      public void addFirst(org.apache.lucene.analysis.tokenattributes.CharTermAttribute term, org.apache.lucene.analysis.tokenattributes.OffsetAttribute offsets)
      Prepend a state at start of the list. Like Deque.addFirst(Object).
      Parameters:
      term - chars Attribute.
      offsets - OffsetAttribute.startOffset() and OffsetAttribute.endOffset() in source text.
    • addFirst

      public void addFirst(org.apache.lucene.analysis.tokenattributes.CharTermAttribute term, int startOffset, int endOffset)
      Prepend a state at start of the list. Like Deque.addFirst(Object).
      Parameters:
      term - chars Attribute.
      startOffset - like OffsetAttribute.startOffset().
      endOffset - like OffsetAttribute.endOffset().
    • addFirst

      public void addFirst(char[] buffer, int copyOffset, int copyLength, int startOffset, int endOffset)
      Prepend a state at start of the list. Parameters are designed to efficiently record a substring of a CharTermAttribute, using CharTermAttribute.buffer() and free offsets. Like Deque.addFirst(Object).
      Parameters:
      buffer - chars of source Attribute CharTermAttribute.buffer().
      copyOffset - like in CharTermAttribute.copyBuffer(char[], int, int).
      copyLength - like for CharTermAttribute.copyBuffer(char[], int, int).
      startOffset - like OffsetAttribute.startOffset().
      endOffset - like OffsetAttribute.endOffset().
    • addLast

      public void addLast(org.apache.lucene.analysis.tokenattributes.CharTermAttribute term, org.apache.lucene.analysis.tokenattributes.OffsetAttribute offsets)
      Prepend a state at end of the list. Like Deque.addLast(Object).
      Parameters:
      term - chars Attribute.
      offsets - OffsetAttribute.startOffset() and OffsetAttribute.endOffset() in source text.
    • addLast

      public void addLast(org.apache.lucene.analysis.tokenattributes.CharTermAttribute term, int startOffset, int endOffset)
      Append a state at end of the list. Like Deque.addLast(Object).
      Parameters:
      term - chars Attribute.
      startOffset - like OffsetAttribute.startOffset().
      endOffset - like OffsetAttribute.endOffset().
    • addLast

      public void addLast(char[] buffer, int copyOffset, int copyLength, int startOffset, int endOffset)
      Append a state at end of the list. Parameters are designed to efficiently record a substring of a CharTermAttribute, using CharTermAttribute.buffer() and free offsets. Like Deque.addLast(Object).
      Parameters:
      buffer - chars of source Attribute CharTermAttribute.buffer().
      copyOffset - like in CharTermAttribute.copyBuffer(char[], int, int).
      copyLength - like for CharTermAttribute.copyBuffer(char[], int, int).
      startOffset - like OffsetAttribute.startOffset().
      endOffset - like OffsetAttribute.endOffset().
    • isEmpty

      public boolean isEmpty()
      Returns:
      true if empty, false otherwise.
    • removeFirst

      public void removeFirst(org.apache.lucene.analysis.tokenattributes.CharTermAttribute term, org.apache.lucene.analysis.tokenattributes.OffsetAttribute offsets)
      Poll the first state from list, copy chars in a CharTermAttribute implementing CharTermAttribute.copyBuffer(char[], int, int), copy startOffset and endOffset in OffsetAttribute.setOffset(int, int). Like Deque.removeFirst().
      Parameters:
      term - attribute where chars are copied to.
      offsets - AttributeImpl with offsets in source text.
    • removeLast

      public void removeLast(org.apache.lucene.analysis.tokenattributes.CharTermAttribute term, org.apache.lucene.analysis.tokenattributes.OffsetAttribute offsets)
      Pop the last state from list, copy chars in a CharTermAttribute implementing CharTermAttribute.copyBuffer(char[], int, int), copy startOffset and endOffset in OffsetAttribute.setOffset(int, int). Like Deque.removeLast().
      Parameters:
      term - attribute where chars are copied to.
      offsets - AttributeImpl with offsets in source text.
    • toString

      public String toString()
      Overrides:
      toString in class Object