Class CharArrayMap<TValue>
A simple class that stores key System.Strings as char[]'s in a hash table. Note that this is not a general purpose class. For example, it cannot remove items from the map, nor does it resize its hash table to be smaller, etc. It is designed to be quick to retrieve items by char[] keys without the necessity of converting to a System.String first.
You must specify the required LuceneVersion compatibility when creating CharArrayMap:
- As of 3.1, supplementary characters are properly lowercased.
Inheritance
Implements
Inherited Members
Namespace: Lucene.Net.Analysis.Util
Assembly: Lucene.Net.Analysis.Common.dll
Syntax
public class CharArrayMap<TValue> : ICharArrayMap, IDictionary<string, TValue>, ICollection<KeyValuePair<string, TValue>>, IEnumerable<KeyValuePair<string, TValue>>, IEnumerable
Type Parameters
Name | Description |
---|---|
TValue |
Constructors
| Improve this Doc View SourceCharArrayMap(LuceneVersion, IDictionary<String, TValue>, Boolean)
Creates a map from the mappings in another map.
Declaration
public CharArrayMap(LuceneVersion matchVersion, IDictionary<string, TValue> c, bool ignoreCase)
Parameters
Type | Name | Description |
---|---|---|
LuceneVersion | matchVersion | compatibility match version see Version note above for details. |
System.Collections.Generic.IDictionary<System.String, TValue> | c | a map ( |
System.Boolean | ignoreCase |
|
CharArrayMap(LuceneVersion, Int32, Boolean)
Create map with enough capacity to hold startSize
terms
Declaration
public CharArrayMap(LuceneVersion matchVersion, int startSize, bool ignoreCase)
Parameters
Type | Name | Description |
---|---|---|
LuceneVersion | matchVersion | lucene compatibility version - see CharArrayMap<TValue> for details. |
System.Int32 | startSize | the initial capacity |
System.Boolean | ignoreCase |
|
Properties
| Improve this Doc View SourceCount
Gets the number of key/value pairs contained in the CharArrayMap<TValue>.
Declaration
public virtual int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
IsReadOnly
true
if the CharArrayMap<TValue> is read-only; otherwise false
.
Declaration
public virtual bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Item[ICharSequence]
Gets or sets the value associated with the specified key.
Declaration
public virtual TValue this[ICharSequence key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
ICharSequence | key | The key of the value to get or set. |
Property Value
Type | Description |
---|---|
TValue |
Item[Char[]]
Gets or sets the value associated with the specified key.
Declaration
public virtual TValue this[char[] key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | key | The key of the value to get or set. |
Property Value
Type | Description |
---|---|
TValue |
Item[Char[], Int32, Int32]
Gets or sets the value associated with the specified key.
Declaration
public virtual TValue this[char[] key, int offset, int length] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | key | The key of the value to get or set. |
System.Int32 | offset | The position of the |
System.Int32 | length | The total length of the |
Property Value
Type | Description |
---|---|
TValue |
Item[Object]
Gets or sets the value associated with the specified key.
Declaration
public virtual TValue this[object key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Object | key | The key of the value to get or set. |
Property Value
Type | Description |
---|---|
TValue |
Item[String]
Gets or sets the value associated with the specified key.
Declaration
public virtual TValue this[string key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key of the value to get or set. |
Property Value
Type | Description |
---|---|
TValue |
Keys
Gets a collection containing the keys in the CharArrayMap<TValue>.
Declaration
public virtual ICollection<string> Keys { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<System.String> |
MatchVersion
The Lucene version corresponding to the compatibility behavior that this instance emulates
Declaration
public virtual LuceneVersion MatchVersion { get; }
Property Value
Type | Description |
---|---|
LuceneVersion |
Values
Gets a collection containing the values in the CharArrayMap<TValue>. This specialized collection can be enumerated in order to read its values and overrides System.Object.ToString() in order to display a string representation of the values.
Declaration
public ICollection<TValue> Values { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<TValue> |
Methods
| Improve this Doc View SourceAdd(KeyValuePair<String, TValue>)
Adds the
Declaration
public virtual void Add(KeyValuePair<string, TValue> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<System.String, TValue> | item | A |
Add(String, TValue)
Adds the value
for the passed in key
.
Declaration
public virtual void Add(string key, TValue value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The string-able type to be added/updated in the dictionary. |
TValue | value | The corresponding value for the given |
Clear()
Clears all entries in this map. This method is supported for reusing, but not System.Collections.Generic.IDictionary<TKey, TValue>.Remove(TKey).
Declaration
public virtual void Clear()
ContainsKey(ICharSequence)
true
if the text
ICharSequence is in the Keys;
otherwise false
Declaration
public virtual bool ContainsKey(ICharSequence text)
Parameters
Type | Name | Description |
---|---|---|
ICharSequence | text |
Returns
Type | Description |
---|---|
System.Boolean |
ContainsKey(Char[])
true
if the entire Keys is the same as the
text
char[] being passed in;
otherwise false
.
Declaration
public virtual bool ContainsKey(char[] text)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | text |
Returns
Type | Description |
---|---|
System.Boolean |
ContainsKey(Char[], Int32, Int32)
true
if the length
chars of text
starting at offset
are in the Keys
Declaration
public virtual bool ContainsKey(char[] text, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | text | |
System.Int32 | offset | |
System.Int32 | length |
Returns
Type | Description |
---|---|
System.Boolean |
ContainsKey(Object)
true
if the o
System.Object.ToString() is in the Keys;
otherwise false
Declaration
public virtual bool ContainsKey(object o)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o |
Returns
Type | Description |
---|---|
System.Boolean |
ContainsKey(String)
true
if the text
System.String is in the Keys;
otherwise false
Declaration
public virtual bool ContainsKey(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text |
Returns
Type | Description |
---|---|
System.Boolean |
CopyTo(CharArrayMap<TValue>)
Copies all items in the current CharArrayMap<TValue> to the passed in CharArrayMap<TValue>.
Declaration
public virtual void CopyTo(CharArrayMap<TValue> map)
Parameters
Type | Name | Description |
---|---|---|
CharArrayMap<TValue> | map |
CopyTo(KeyValuePair<String, TValue>[], Int32)
Copies all items in the current dictionary the array
starting at the arrayIndex
.
The array is assumed to already be dimensioned to fit the elements in this dictionary; otherwise a System.ArgumentOutOfRangeException
will be thrown.
Declaration
public virtual void CopyTo(KeyValuePair<string, TValue>[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<System.String, TValue>[] | array | The array to copy the items into. |
System.Int32 | arrayIndex | A 32-bit integer that represents the index in |
EmptyMap()
Returns an empty, unmodifiable map.
Declaration
public static CharArrayMap<TValue> EmptyMap()
Returns
Type | Description |
---|---|
CharArrayMap<TValue> |
EntrySet()
Declaration
public CharArrayMap<TValue>.EntrySet_ EntrySet()
Returns
Type | Description |
---|---|
CharArrayMap.EntrySet_<> |
Equals(Object)
LUCENENET Specific - test for value equality similar to how it is done in Java
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | Another dictionary to test the values of |
Returns
Type | Description |
---|---|
System.Boolean |
|
Overrides
Get(ICharSequence)
returns the value of the mapping of the chars inside this ICharSequence
Declaration
public virtual TValue Get(ICharSequence text)
Parameters
Type | Name | Description |
---|---|---|
ICharSequence | text |
Returns
Type | Description |
---|---|
TValue |
Get(Char[])
returns the value of the mapping of the chars inside this text
Declaration
public virtual TValue Get(char[] text)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | text |
Returns
Type | Description |
---|---|
TValue |
Get(Char[], Int32, Int32)
returns the value of the mapping of length
chars of text
starting at offset
Declaration
public virtual TValue Get(char[] text, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | text | |
System.Int32 | offset | |
System.Int32 | length |
Returns
Type | Description |
---|---|
TValue |
Get(Object)
returns the value of the mapping of the chars inside this System.Object.ToString()
Declaration
public virtual TValue Get(object o)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o |
Returns
Type | Description |
---|---|
TValue |
Get(String)
returns the value of the mapping of the chars inside this System.String
Declaration
public virtual TValue Get(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text |
Returns
Type | Description |
---|---|
TValue |
GetEnumerator()
Returns an enumerator that iterates through the CharArrayMap<TValue>.
Declaration
public virtual IEnumerator<KeyValuePair<string, TValue>> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<System.String, TValue>> |
GetHashCode()
LUCENENET Specific - override required by .NET because we override Equals to simulate Java's value equality checking.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
Put(ICharSequence)
Adds a placeholder with the given text
as the key.
Primarily for internal use by CharArraySet.
Declaration
public virtual bool Put(ICharSequence text)
Parameters
Type | Name | Description |
---|---|---|
ICharSequence | text |
Returns
Type | Description |
---|---|
System.Boolean |
Put(ICharSequence, TValue)
Add the given mapping.
Declaration
public virtual TValue Put(ICharSequence text, TValue value)
Parameters
Type | Name | Description |
---|---|---|
ICharSequence | text | |
TValue | value |
Returns
Type | Description |
---|---|
TValue |
Put(Char[])
Adds a placeholder with the given text
as the key.
Primarily for internal use by CharArraySet.
Declaration
public virtual bool Put(char[] text)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | text |
Returns
Type | Description |
---|---|
System.Boolean |
Put(Char[], TValue)
Add the given mapping. If ignoreCase is true for this Set, the text array will be directly modified. The user should never modify this text array after calling this method.
Declaration
public virtual TValue Put(char[] text, TValue value)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | text | |
TValue | value |
Returns
Type | Description |
---|---|
TValue |
Put(Object)
Adds a placeholder with the given o
as the key.
Primarily for internal use by CharArraySet.
Declaration
public virtual bool Put(object o)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o |
Returns
Type | Description |
---|---|
System.Boolean |
Put(Object, TValue)
Add the given mapping using the System.Object.ToString() representation
of o
in the System.Globalization.CultureInfo.InvariantCulture.
Declaration
public virtual TValue Put(object o, TValue value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | |
TValue | value |
Returns
Type | Description |
---|---|
TValue |
Put(String)
Adds a placeholder with the given text
as the key.
Primarily for internal use by CharArraySet.
Declaration
public virtual bool Put(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text |
Returns
Type | Description |
---|---|
System.Boolean |
Put(String, TValue)
Add the given mapping.
Declaration
public virtual TValue Put(string text, TValue value)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | |
TValue | value |
Returns
Type | Description |
---|---|
TValue |
PutAll(IDictionary<ICharSequence, TValue>)
This implementation enumerates over the specified IDictionary{ICharSequence,TValue}'s entries, and calls this map's Put(ICharSequence, TValue) operation once for each entry.
Declaration
public virtual void PutAll(IDictionary<ICharSequence, TValue> collection)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<ICharSequence, TValue> | collection | A dictionary of values to add/update in the current map. |
PutAll(IDictionary<Char[], TValue>)
This implementation enumerates over the specified IDictionary{char[],TValue}'s entries, and calls this map's Put(Char[], TValue) operation once for each entry.
Declaration
public virtual void PutAll(IDictionary<char[], TValue> collection)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.Char[], TValue> | collection | A dictionary of values to add/update in the current map. |
PutAll(IDictionary<Object, TValue>)
This implementation enumerates over the specified IDictionary{object,TValue}'s entries, and calls this map's Put(Object, TValue) operation once for each entry.
Declaration
public virtual void PutAll(IDictionary<object, TValue> collection)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.Object, TValue> | collection | A dictionary of values to add/update in the current map. |
PutAll(IDictionary<String, TValue>)
This implementation enumerates over the specified IDictionary{string,TValue}'s entries, and calls this map's Put(String, TValue) operation once for each entry.
Declaration
public virtual void PutAll(IDictionary<string, TValue> collection)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.String, TValue> | collection | A dictionary of values to add/update in the current map. |
PutAll(IEnumerable<KeyValuePair<ICharSequence, TValue>>)
This implementation enumerates over the specified IEnumerable{KeyValuePair{ICharSequence,TValue}}'s entries, and calls this map's Put(ICharSequence, TValue) operation once for each entry.
Declaration
public virtual void PutAll(IEnumerable<KeyValuePair<ICharSequence, TValue>> collection)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<ICharSequence, TValue>> | collection | The values to add/update in the current map. |
PutAll(IEnumerable<KeyValuePair<Char[], TValue>>)
This implementation enumerates over the specified IEnumerable{KeyValuePair{char[],TValue}}'s entries, and calls this map's Put(Char[], TValue) operation once for each entry.
Declaration
public virtual void PutAll(IEnumerable<KeyValuePair<char[], TValue>> collection)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.Char[], TValue>> | collection | The values to add/update in the current map. |
PutAll(IEnumerable<KeyValuePair<Object, TValue>>)
This implementation enumerates over the specified IEnumerable{KeyValuePair{object,TValue}}'s entries, and calls this map's Put(Object, TValue) operation once for each entry.
Declaration
public virtual void PutAll(IEnumerable<KeyValuePair<object, TValue>> collection)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.Object, TValue>> | collection | The values to add/update in the current map. |
PutAll(IEnumerable<KeyValuePair<String, TValue>>)
This implementation enumerates over the specified IEnumerable{KeyValuePair{string,TValue}}'s entries, and calls this map's Put(String, TValue) operation once for each entry.
Declaration
public virtual void PutAll(IEnumerable<KeyValuePair<string, TValue>> collection)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, TValue>> | collection | The values to add/update in the current map. |
ToString()
Returns a string that represents the current object. (Inherited from System.Object.)
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
TryGetValue(ICharSequence, out TValue)
Gets the value associated with the specified key.
Declaration
public virtual bool TryGetValue(ICharSequence key, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
ICharSequence | key | The key of the value to get. |
TValue | value | When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized. |
Returns
Type | Description |
---|---|
System.Boolean |
|
TryGetValue(Char[], out TValue)
Gets the value associated with the specified key.
Declaration
public virtual bool TryGetValue(char[] key, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | key | The key of the value to get. |
TValue | value | When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized. |
Returns
Type | Description |
---|---|
System.Boolean |
|
TryGetValue(Char[], Int32, Int32, out TValue)
Gets the value associated with the specified key.
Declaration
public virtual bool TryGetValue(char[] key, int offset, int length, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | key | The key of the value to get. |
System.Int32 | offset | The position of the |
System.Int32 | length | The total length of the |
TValue | value | When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized. |
Returns
Type | Description |
---|---|
System.Boolean |
|
TryGetValue(Object, out TValue)
Gets the value associated with the specified key.
Declaration
public virtual bool TryGetValue(object key, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | key | The key of the value to get. |
TValue | value | When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized. |
Returns
Type | Description |
---|---|
System.Boolean |
|
TryGetValue(String, out TValue)
Gets the value associated with the specified key.
Declaration
public virtual bool TryGetValue(string key, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key of the value to get. |
TValue | value | When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Returns an enumerator that iterates through the CharArrayMap<TValue>.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |