Class AttLinkedList
java.lang.Object
com.github.oeuvres.alix.lucene.analysis.AttLinkedList
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFirst(char[] buffer, int copyOffset, int copyLength, int startOffset, int endOffset) Prepend a state at start of the list.voidaddFirst(org.apache.lucene.analysis.tokenattributes.CharTermAttribute term, int startOffset, int endOffset) Prepend a state at start of the list.voidaddFirst(org.apache.lucene.analysis.tokenattributes.CharTermAttribute term, org.apache.lucene.analysis.tokenattributes.OffsetAttribute offsets) Prepend a state at start of the list.voidaddLast(char[] buffer, int copyOffset, int copyLength, int startOffset, int endOffset) Append a state at end of the list.voidaddLast(org.apache.lucene.analysis.tokenattributes.CharTermAttribute term, int startOffset, int endOffset) Append a state at end of the list.voidaddLast(org.apache.lucene.analysis.tokenattributes.CharTermAttribute term, org.apache.lucene.analysis.tokenattributes.OffsetAttribute offsets) Prepend a state at end of the list.booleanisEmpty()voidremoveFirst(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 implementingCharTermAttribute.copyBuffer(char[], int, int), copy startOffset and endOffset inOffsetAttribute.setOffset(int, int).voidremoveLast(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 implementingCharTermAttribute.copyBuffer(char[], int, int), copy startOffset and endOffset inOffsetAttribute.setOffset(int, int).toString()
-
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. LikeDeque.addFirst(Object).- Parameters:
term- chars Attribute.offsets-OffsetAttribute.startOffset()andOffsetAttribute.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. LikeDeque.addFirst(Object).- Parameters:
term- chars Attribute.startOffset- likeOffsetAttribute.startOffset().endOffset- likeOffsetAttribute.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 aCharTermAttribute, usingCharTermAttribute.buffer()and free offsets. LikeDeque.addFirst(Object).- Parameters:
buffer- chars of source AttributeCharTermAttribute.buffer().copyOffset- like inCharTermAttribute.copyBuffer(char[], int, int).copyLength- like forCharTermAttribute.copyBuffer(char[], int, int).startOffset- likeOffsetAttribute.startOffset().endOffset- likeOffsetAttribute.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. LikeDeque.addLast(Object).- Parameters:
term- chars Attribute.offsets-OffsetAttribute.startOffset()andOffsetAttribute.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. LikeDeque.addLast(Object).- Parameters:
term- chars Attribute.startOffset- likeOffsetAttribute.startOffset().endOffset- likeOffsetAttribute.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 aCharTermAttribute, usingCharTermAttribute.buffer()and free offsets. LikeDeque.addLast(Object).- Parameters:
buffer- chars of source AttributeCharTermAttribute.buffer().copyOffset- like inCharTermAttribute.copyBuffer(char[], int, int).copyLength- like forCharTermAttribute.copyBuffer(char[], int, int).startOffset- likeOffsetAttribute.startOffset().endOffset- likeOffsetAttribute.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 implementingCharTermAttribute.copyBuffer(char[], int, int), copy startOffset and endOffset inOffsetAttribute.setOffset(int, int). LikeDeque.removeFirst().- Parameters:
term- attribute where chars are copied to.offsets-AttributeImplwith 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 implementingCharTermAttribute.copyBuffer(char[], int, int), copy startOffset and endOffset inOffsetAttribute.setOffset(int, int). LikeDeque.removeLast().- Parameters:
term- attribute where chars are copied to.offsets-AttributeImplwith offsets in source text.
-
toString
-