Lucene.Net
3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
|
An AttributeSource contains a list of different Attributes, and methods to add and get them. There can only be a single instance of an attribute in the same AttributeSource instance. This is ensured by passing in the actual type of the Attribute (Class<Attribute>) to the AddAttribute{T}(), which then checks if an instance of that type is already present. If yes, it returns the instance, otherwise it creates a new instance and returns it. More...
Inherited by Lucene.Net.Analysis.TokenStream, and Lucene.Net.Index.DocInverterPerThread.SingleTokenAttributeSource.
Classes | |
class | AttributeFactory |
An AttributeFactory creates instances of Attributes. More... | |
class | State |
This class holds the state of an AttributeSource. More... | |
Public Member Functions | |
AttributeSource () | |
An AttributeSource using the default attribute factory AttributeSource.AttributeFactory.DEFAULT_ATTRIBUTE_FACTORY. | |
AttributeSource (AttributeSource input) | |
An AttributeSource that uses the same attributes as the supplied one. | |
AttributeSource (AttributeFactory factory) | |
An AttributeSource using the supplied AttributeFactory for creating new IAttribute instances. | |
virtual IEnumerable< Type > | GetAttributeTypesIterator () |
Returns a new iterator that iterates the attribute classes in the same order they were added in. Signature for Java 1.5: public Iterator<Class<? extends Attribute>> getAttributeClassesIterator() | |
virtual IEnumerable< Attribute > | GetAttributeImplsIterator () |
Returns a new iterator that iterates all unique Attribute implementations. This iterator may contain less entries that GetAttributeTypesIterator, if one instance implements more than one Attribute interface. Signature for Java 1.5: public Iterator<AttributeImpl> getAttributeImplsIterator() | |
virtual void | AddAttributeImpl (Attribute att) |
Expert: Adds a custom AttributeImpl instance with one or more Attribute interfaces. | |
virtual T | AddAttribute< T > () |
The caller must pass in a Class<? extends Attribute> value. This method first checks if an instance of that class is already in this AttributeSource and returns it. Otherwise a new instance is created, added to this AttributeSource and returned. | |
virtual bool | HasAttribute< T > () |
The caller must pass in a Class<? extends Attribute> value. Returns true, iff this AttributeSource contains the passed-in Attribute. | |
virtual T | GetAttribute< T > () |
The caller must pass in a Class<? extends Attribute> value. Returns the instance of the passed in Attribute contained in this AttributeSource | |
virtual void | ClearAttributes () |
Resets all Attributes in this AttributeSource by calling Attribute.Clear() on each Attribute implementation. | |
virtual State | CaptureState () |
Captures the state of all Attributes. The return value can be passed to RestoreState to restore the state of this or another AttributeSource. | |
virtual void | RestoreState (State state) |
Restores this state by copying the values of all attribute implementations that this state contains into the attributes implementations of the targetStream. The targetStream must contain a corresponding instance for each argument contained in this state (e.g. it is not possible to restore the state of an AttributeSource containing a TermAttribute into a AttributeSource using a Token instance as implementation). | |
override int | GetHashCode () |
override bool | Equals (System.Object obj) |
override System.String | ToString () |
virtual AttributeSource | CloneAttributes () |
Performs a clone of all Attribute instances returned in a new AttributeSource instance. This method can be used to e.g. create another TokenStream with exactly the same attributes (using AttributeSource(AttributeSource)) | |
Properties | |
virtual AttributeFactory | Factory [get] |
Returns the used AttributeFactory. | |
virtual bool | HasAttributes [get] |
Returns true, iff this AttributeSource has any attributes | |
An AttributeSource contains a list of different Attributes, and methods to add and get them. There can only be a single instance of an attribute in the same AttributeSource instance. This is ensured by passing in the actual type of the Attribute (Class<Attribute>) to the AddAttribute{T}(), which then checks if an instance of that type is already present. If yes, it returns the instance, otherwise it creates a new instance and returns it.
Definition at line 36 of file AttributeSource.cs.
Lucene.Net.Util.AttributeSource.AttributeSource | ( | ) |
An AttributeSource using the default attribute factory AttributeSource.AttributeFactory.DEFAULT_ATTRIBUTE_FACTORY.
Definition at line 109 of file AttributeSource.cs.
Lucene.Net.Util.AttributeSource.AttributeSource | ( | AttributeSource | input | ) |
An AttributeSource that uses the same attributes as the supplied one.
Definition at line 114 of file AttributeSource.cs.
Lucene.Net.Util.AttributeSource.AttributeSource | ( | AttributeFactory | factory | ) |
An AttributeSource using the supplied AttributeFactory for creating new IAttribute instances.
Definition at line 127 of file AttributeSource.cs.
|
virtual |
The caller must pass in a Class<? extends Attribute> value. This method first checks if an instance of that class is already in this AttributeSource and returns it. Otherwise a new instance is created, added to this AttributeSource and returned.
T | : | IAttribute |
Definition at line 244 of file AttributeSource.cs.
|
virtual |
Expert: Adds a custom AttributeImpl instance with one or more Attribute interfaces.
<font color="red">Please note: It is not guaranteed, that att
is added to the AttributeSource
, because the provided attributes may already exist. You should always retrieve the wanted attributes using GetAttribute{T} after adding with this method and cast to your class. The recommended way to use custom implementations is using an AttributeFactory </font>
Definition at line 184 of file AttributeSource.cs.
|
virtual |
Captures the state of all Attributes. The return value can be passed to RestoreState to restore the state of this or another AttributeSource.
Definition at line 364 of file AttributeSource.cs.
|
virtual |
Resets all Attributes in this AttributeSource by calling Attribute.Clear() on each Attribute implementation.
Definition at line 353 of file AttributeSource.cs.
|
virtual |
Performs a clone of all Attribute instances returned in a new AttributeSource instance. This method can be used to e.g. create another TokenStream with exactly the same attributes (using AttributeSource(AttributeSource))
Definition at line 483 of file AttributeSource.cs.
override bool Lucene.Net.Util.AttributeSource.Equals | ( | System.Object | obj | ) |
Definition at line 413 of file AttributeSource.cs.
|
virtual |
The caller must pass in a Class<? extends Attribute> value. Returns the instance of the passed in Attribute contained in this AttributeSource
<throws> IllegalArgumentException if this AttributeSource does not contain the Attribute. It is recommended to always use AddAttribute{T} even in consumers of TokenStreams, because you cannot know if a specific TokenStream really uses a specific Attribute. AddAttribute{T} will automatically make the attribute available. If you want to only use the attribute, if it is available (to optimize consuming), use HasAttribute. </throws>
T | : | IAttribute |
Definition at line 290 of file AttributeSource.cs.
|
virtual |
Returns a new iterator that iterates all unique Attribute implementations. This iterator may contain less entries that GetAttributeTypesIterator, if one instance implements more than one Attribute interface. Signature for Java 1.5: public Iterator<AttributeImpl> getAttributeImplsIterator()
Definition at line 160 of file AttributeSource.cs.
|
virtual |
Returns a new iterator that iterates the attribute classes in the same order they were added in. Signature for Java 1.5: public Iterator<Class<? extends Attribute>> getAttributeClassesIterator()
Note that this return value is different from Java in that it enumerates over the values and not the keys
Definition at line 149 of file AttributeSource.cs.
override int Lucene.Net.Util.AttributeSource.GetHashCode | ( | ) |
Definition at line 401 of file AttributeSource.cs.
|
virtual |
The caller must pass in a Class<? extends Attribute> value. Returns true, iff this AttributeSource contains the passed-in Attribute.
\
T | : | IAttribute |
Definition at line 272 of file AttributeSource.cs.
|
virtual |
Restores this state by copying the values of all attribute implementations that this state contains into the attributes implementations of the targetStream. The targetStream must contain a corresponding instance for each argument contained in this state (e.g. it is not possible to restore the state of an AttributeSource containing a TermAttribute into a AttributeSource using a Token instance as implementation).
Note that this method does not affect attributes of the targetStream that are not contained in this state. In other words, if for example the targetStream contains an OffsetAttribute, but this state doesn't, then the value of the OffsetAttribute remains unchanged. It might be desirable to reset its value to the default, in which case the caller should first call AttributeSource.ClearAttributes() on the targetStream.
Definition at line 384 of file AttributeSource.cs.
override System.String Lucene.Net.Util.AttributeSource.ToString | ( | ) |
Definition at line 459 of file AttributeSource.cs.
|
get |
Returns the used AttributeFactory.
Definition at line 137 of file AttributeSource.cs.
|
get |
Returns true, iff this AttributeSource has any attributes
Definition at line 265 of file AttributeSource.cs.