Show / Hide Table of Contents

    Class DictionaryBase<K, V>

    A base class for implementing a dictionary based on a set collection implementation. See the source code for C5.HashDictionary`2 for an example

    Inheritance
    System.Object
    EnumerableBase<KeyValuePair<K, V>>
    CollectionValueBase<KeyValuePair<K, V>>
    DictionaryBase<K, V>
    HashDictionary<K, V>
    SortedDictionaryBase<K, V>
    Implements
    IDictionary<K, V>
    ICollectionValue<KeyValuePair<K, V>>
    System.Collections.Generic.IEnumerable<KeyValuePair<K, V>>
    IShowable
    IFormattable
    Inherited Members
    CollectionValueBase<KeyValuePair<K, V>>.ListenableEvents
    CollectionValueBase<KeyValuePair<K, V>>.ActiveEvents
    CollectionValueBase<KeyValuePair<K, V>>.CollectionChanged
    CollectionValueBase<KeyValuePair<K, V>>.raiseCollectionChanged()
    CollectionValueBase<KeyValuePair<K, V>>.CollectionCleared
    CollectionValueBase<KeyValuePair<K, V>>.raiseCollectionCleared(Boolean, Int32)
    CollectionValueBase<KeyValuePair<K, V>>.raiseCollectionCleared(Boolean, Int32, Nullable<Int32>)
    CollectionValueBase<KeyValuePair<K, V>>.ItemsAdded
    CollectionValueBase<KeyValuePair<K, V>>.raiseItemsAdded(KeyValuePair<K, V>, Int32)
    CollectionValueBase<KeyValuePair<K, V>>.ItemsRemoved
    CollectionValueBase<KeyValuePair<K, V>>.raiseItemsRemoved(KeyValuePair<K, V>, Int32)
    CollectionValueBase<KeyValuePair<K, V>>.ItemInserted
    CollectionValueBase<KeyValuePair<K, V>>.raiseItemInserted(KeyValuePair<K, V>, Int32)
    CollectionValueBase<KeyValuePair<K, V>>.ItemRemovedAt
    CollectionValueBase<KeyValuePair<K, V>>.raiseItemRemovedAt(KeyValuePair<K, V>, Int32)
    CollectionValueBase<KeyValuePair<K, V>>.raiseForSetThis(Int32, KeyValuePair<K, V>, KeyValuePair<K, V>)
    CollectionValueBase<KeyValuePair<K, V>>.raiseForInsert(Int32, KeyValuePair<K, V>)
    CollectionValueBase<KeyValuePair<K, V>>.raiseForRemove(KeyValuePair<K, V>)
    CollectionValueBase<KeyValuePair<K, V>>.raiseForRemove(KeyValuePair<K, V>, Int32)
    CollectionValueBase<KeyValuePair<K, V>>.raiseForRemoveAt(Int32, KeyValuePair<K, V>)
    CollectionValueBase<KeyValuePair<K, V>>.raiseForUpdate(KeyValuePair<K, V>, KeyValuePair<K, V>)
    CollectionValueBase<KeyValuePair<K, V>>.raiseForUpdate(KeyValuePair<K, V>, KeyValuePair<K, V>, Int32)
    CollectionValueBase<KeyValuePair<K, V>>.raiseForAdd(KeyValuePair<K, V>)
    CollectionValueBase<KeyValuePair<K, V>>.raiseForRemoveAll(ICollectionValue<KeyValuePair<K, V>>)
    CollectionValueBase<KeyValuePair<K, V>>.IsEmpty
    CollectionValueBase<KeyValuePair<K, V>>.Count
    CollectionValueBase<KeyValuePair<K, V>>.CountSpeed
    CollectionValueBase<KeyValuePair<K, V>>.CopyTo(KeyValuePair<K, V>[], Int32)
    CollectionValueBase<KeyValuePair<K, V>>.ToArray()
    CollectionValueBase<KeyValuePair<K, V>>.Apply(Action<KeyValuePair<K, V>>)
    CollectionValueBase<KeyValuePair<K, V>>.Exists(Func<KeyValuePair<K, V>, Boolean>)
    CollectionValueBase<KeyValuePair<K, V>>.Find(Func<KeyValuePair<K, V>, Boolean>, KeyValuePair<K, V>)
    CollectionValueBase<KeyValuePair<K, V>>.All(Func<KeyValuePair<K, V>, Boolean>)
    CollectionValueBase<KeyValuePair<K, V>>.Filter(Func<KeyValuePair<K, V>, Boolean>)
    CollectionValueBase<KeyValuePair<K, V>>.Choose()
    CollectionValueBase<KeyValuePair<K, V>>.Show(System.Text.StringBuilder, Int32, IFormatProvider)
    CollectionValueBase<KeyValuePair<K, V>>.ToString(String, IFormatProvider)
    CollectionValueBase<KeyValuePair<K, V>>.ToString()
    EnumerableBase<KeyValuePair<K, V>>.GetEnumerator()
    EnumerableBase<KeyValuePair<K, V>>.countItems(System.Collections.Generic.IEnumerable<KeyValuePair<K, V>>)
    Namespace: Lucene.Net.Support.C5
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class DictionaryBase<K, V> : CollectionValueBase<KeyValuePair<K, V>>, IDictionary<K, V>, ICollectionValue<KeyValuePair<K, V>>, System.Collections.Generic.IEnumerable<KeyValuePair<K, V>>, IShowable, IFormattable
    Type Parameters
    Name Description
    K
    V

    Constructors

    | Improve this Doc View Source

    DictionaryBase(System.Collections.Generic.IEqualityComparer<K>, MemoryType)

    Declaration
    protected DictionaryBase(System.Collections.Generic.IEqualityComparer<K> keyequalityComparer, MemoryType memoryType)
    Parameters
    Type Name Description
    System.Collections.Generic.IEqualityComparer<K> keyequalityComparer
    MemoryType memoryType

    Fields

    | Improve this Doc View Source

    pairs

    The set collection of entries underlying this dictionary implementation

    Declaration
    protected ICollection<KeyValuePair<K, V>> pairs
    Field Value
    Type Description
    ICollection<KeyValuePair<K, V>>

    Properties

    | Improve this Doc View Source

    ActiveEvents

    Declaration
    public override EventTypeEnum ActiveEvents { get; }
    Property Value
    Type Description
    EventTypeEnum
    Overrides
    Lucene.Net.Support.C5.CollectionValueBase<Lucene.Net.Support.C5.KeyValuePair<K, V>>.ActiveEvents
    | Improve this Doc View Source

    ContainsSpeed

    Declaration
    public virtual Speed ContainsSpeed { get; }
    Property Value
    Type Description
    Speed
    | Improve this Doc View Source

    Count

    Declaration
    public override int Count { get; }
    Property Value
    Type Description
    System.Int32

    The number of entries in the dictionary

    Overrides
    Lucene.Net.Support.C5.CollectionValueBase<Lucene.Net.Support.C5.KeyValuePair<K, V>>.Count
    | Improve this Doc View Source

    CountSpeed

    Declaration
    public override Speed CountSpeed { get; }
    Property Value
    Type Description
    Speed

    The number of entries in the dictionary

    Overrides
    Lucene.Net.Support.C5.CollectionValueBase<Lucene.Net.Support.C5.KeyValuePair<K, V>>.CountSpeed
    | Improve this Doc View Source

    EqualityComparer

    Declaration
    public virtual System.Collections.Generic.IEqualityComparer<K> EqualityComparer { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEqualityComparer<K>
    | Improve this Doc View Source

    Func

    Declaration
    public virtual Func<K, V> Func { get; }
    Property Value
    Type Description
    Func<K, V>
    | Improve this Doc View Source

    IsEmpty

    Declaration
    public override bool IsEmpty { get; }
    Property Value
    Type Description
    System.Boolean

    True if this collection is empty.

    Overrides
    Lucene.Net.Support.C5.CollectionValueBase<Lucene.Net.Support.C5.KeyValuePair<K, V>>.IsEmpty
    | Improve this Doc View Source

    IsReadOnly

    Declaration
    public virtual bool IsReadOnly { get; }
    Property Value
    Type Description
    System.Boolean

    True if dictionary is read only

    | Improve this Doc View Source

    Item[K]

    Indexer by key for dictionary.

    The get method will throw an exception if no entry is found.

    The set method behaves like C5.DictionaryBase`2.UpdateOrAdd(`0,`1).

    Declaration
    public virtual V this[K key] { get; set; }
    Parameters
    Type Name Description
    K key
    Property Value
    Type Description
    V

    The value corresponding to the key

    Exceptions
    Type Condition
    NoSuchItemException

    On get if no entry is found.

    | Improve this Doc View Source

    Keys

    Declaration
    public virtual ICollectionValue<K> Keys { get; }
    Property Value
    Type Description
    ICollectionValue<K>

    A collection containing all the keys of the dictionary

    | Improve this Doc View Source

    ListenableEvents

    Declaration
    public override EventTypeEnum ListenableEvents { get; }
    Property Value
    Type Description
    EventTypeEnum
    Overrides
    Lucene.Net.Support.C5.CollectionValueBase<Lucene.Net.Support.C5.KeyValuePair<K, V>>.ListenableEvents
    | Improve this Doc View Source

    Values

    Declaration
    public virtual ICollectionValue<V> Values { get; }
    Property Value
    Type Description
    ICollectionValue<V>

    A collection containing all the values of the dictionary

    Methods

    | Improve this Doc View Source

    Add(K, V)

    Add a new (key, value) pair (a mapping) to the dictionary.

    Declaration
    public virtual void Add(K key, V value)
    Parameters
    Type Name Description
    K key

    Key to add

    V value

    Value to add

    Exceptions
    Type Condition
    DuplicateNotAllowedException

    if there already is an entry with the same key.

    | Improve this Doc View Source

    AddAll<L, W>(System.Collections.Generic.IEnumerable<KeyValuePair<L, W>>)

    Add the entries from a collection of C5.KeyValuePair`2 pairs to this dictionary.

    TODO: add restrictions L:K and W:V when the .Net SDK allows it

    Declaration
    public virtual void AddAll<L, W>(System.Collections.Generic.IEnumerable<KeyValuePair<L, W>> entries)
        where L : K where W : V
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<KeyValuePair<L, W>> entries
    Type Parameters
    Name Description
    L
    W
    Exceptions
    Type Condition
    DuplicateNotAllowedException

    If the input contains duplicate keys or a key already present in this dictionary.

    | Improve this Doc View Source

    Check()

    Check the integrity of the internal data structures of this dictionary.

    Declaration
    public virtual bool Check()
    Returns
    Type Description
    System.Boolean

    True if check does not fail.

    | Improve this Doc View Source

    Choose()

    Choose some entry in this Dictionary.

    Declaration
    public override KeyValuePair<K, V> Choose()
    Returns
    Type Description
    KeyValuePair<K, V>
    Overrides
    Lucene.Net.Support.C5.CollectionValueBase<Lucene.Net.Support.C5.KeyValuePair<K, V>>.Choose()
    Exceptions
    Type Condition
    NoSuchItemException

    if collection is empty.

    | Improve this Doc View Source

    Clear()

    Remove all entries from the dictionary

    Declaration
    public virtual void Clear()
    | Improve this Doc View Source

    Contains(K)

    Check if there is an entry with a specified key

    Declaration
    public virtual bool Contains(K key)
    Parameters
    Type Name Description
    K key

    The key to look for

    Returns
    Type Description
    System.Boolean

    True if key was found

    | Improve this Doc View Source

    ContainsAll<H>(System.Collections.Generic.IEnumerable<H>)

    Declaration
    public virtual bool ContainsAll<H>(System.Collections.Generic.IEnumerable<H> keys)
        where H : K
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<H> keys
    Returns
    Type Description
    System.Boolean
    Type Parameters
    Name Description
    H
    | Improve this Doc View Source

    Find(ref K, out V)

    Check if there is an entry with a specified key and report the corresponding value if found. This can be seen as a safe form of "val = this[key]".

    Declaration
    public virtual bool Find(ref K key, out V value)
    Parameters
    Type Name Description
    K key

    The key to look for

    V value

    On exit, the value of the entry

    Returns
    Type Description
    System.Boolean

    True if key was found

    | Improve this Doc View Source

    FindOrAdd(K, ref V)

    Look for a specific key in the dictionary. If found, report the corresponding value, else add an entry with the key and the supplied value.

    Declaration
    public virtual bool FindOrAdd(K key, ref V value)
    Parameters
    Type Name Description
    K key

    On entry the key to look for

    V value

    On entry the value to add if the key is not found. On exit the value found if any.

    Returns
    Type Description
    System.Boolean

    True if key was found

    | Improve this Doc View Source

    GetEnumerator()

    Create an enumerator for the collection of entries of the dictionary

    Declaration
    public override System.Collections.Generic.IEnumerator<KeyValuePair<K, V>> GetEnumerator()
    Returns
    Type Description
    System.Collections.Generic.IEnumerator<KeyValuePair<K, V>>

    The enumerator

    Overrides
    Lucene.Net.Support.C5.EnumerableBase<Lucene.Net.Support.C5.KeyValuePair<K, V>>.GetEnumerator()
    | Improve this Doc View Source

    Remove(K)

    Remove an entry with a given key from the dictionary

    Declaration
    public virtual bool Remove(K key)
    Parameters
    Type Name Description
    K key

    The key of the entry to remove

    Returns
    Type Description
    System.Boolean

    True if an entry was found (and removed)

    | Improve this Doc View Source

    Remove(K, out V)

    Remove an entry with a given key from the dictionary and report its value.

    Declaration
    public virtual bool Remove(K key, out V value)
    Parameters
    Type Name Description
    K key

    The key of the entry to remove

    V value

    On exit, the value of the removed entry

    Returns
    Type Description
    System.Boolean

    True if an entry was found (and removed)

    | Improve this Doc View Source

    Show(System.Text.StringBuilder, ref Int32, IFormatProvider)

    Declaration
    public override bool Show(System.Text.StringBuilder stringbuilder, ref int rest, IFormatProvider formatProvider)
    Parameters
    Type Name Description
    System.Text.StringBuilder stringbuilder
    System.Int32 rest
    IFormatProvider formatProvider
    Returns
    Type Description
    System.Boolean
    Overrides
    Lucene.Net.Support.C5.CollectionValueBase<Lucene.Net.Support.C5.KeyValuePair<K, V>>.Show(System.Text.StringBuilder, System.Int32, IFormatProvider)
    | Improve this Doc View Source

    Update(K, V)

    Look for a specific key in the dictionary and if found replace the value with a new one. This can be seen as a non-adding version of "this[key] = val".

    Declaration
    public virtual bool Update(K key, V value)
    Parameters
    Type Name Description
    K key

    The key to look for

    V value

    The new value

    Returns
    Type Description
    System.Boolean

    True if key was found

    | Improve this Doc View Source

    Update(K, V, out V)

    Declaration
    public virtual bool Update(K key, V value, out V oldvalue)
    Parameters
    Type Name Description
    K key
    V value
    V oldvalue
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    UpdateOrAdd(K, V)

    Update value in dictionary corresponding to key if found, else add new entry. More general than "this[key] = val;" by reporting if key was found.

    Declaration
    public virtual bool UpdateOrAdd(K key, V value)
    Parameters
    Type Name Description
    K key

    The key to look for

    V value

    The value to add or replace with.

    Returns
    Type Description
    System.Boolean

    True if entry was updated.

    | Improve this Doc View Source

    UpdateOrAdd(K, V, out V)

    Update value in dictionary corresponding to key if found, else add new entry. More general than "this[key] = val;" by reporting if key was found and the old value if any.

    Declaration
    public virtual bool UpdateOrAdd(K key, V value, out V oldvalue)
    Parameters
    Type Name Description
    K key
    V value
    V oldvalue
    Returns
    Type Description
    System.Boolean

    Events

    | Improve this Doc View Source

    CollectionChanged

    The change event. Will be raised for every change operation on the collection.

    Declaration
    public override event CollectionChangedHandler<KeyValuePair<K, V>> CollectionChanged
    Event Type
    Type Description
    CollectionChangedHandler<KeyValuePair<K, V>>
    Overrides
    Lucene.Net.Support.C5.CollectionValueBase<Lucene.Net.Support.C5.KeyValuePair<K, V>>.CollectionChanged
    | Improve this Doc View Source

    CollectionCleared

    The change event. Will be raised for every change operation on the collection.

    Declaration
    public override event CollectionClearedHandler<KeyValuePair<K, V>> CollectionCleared
    Event Type
    Type Description
    CollectionClearedHandler<KeyValuePair<K, V>>
    Overrides
    Lucene.Net.Support.C5.CollectionValueBase<Lucene.Net.Support.C5.KeyValuePair<K, V>>.CollectionCleared
    | Improve this Doc View Source

    ItemsAdded

    The item added event. Will be raised for every individual addition to the collection.

    Declaration
    public override event ItemsAddedHandler<KeyValuePair<K, V>> ItemsAdded
    Event Type
    Type Description
    ItemsAddedHandler<KeyValuePair<K, V>>
    Overrides
    Lucene.Net.Support.C5.CollectionValueBase<Lucene.Net.Support.C5.KeyValuePair<K, V>>.ItemsAdded
    | Improve this Doc View Source

    ItemsRemoved

    The item added event. Will be raised for every individual removal from the collection.

    Declaration
    public override event ItemsRemovedHandler<KeyValuePair<K, V>> ItemsRemoved
    Event Type
    Type Description
    ItemsRemovedHandler<KeyValuePair<K, V>>
    Overrides
    Lucene.Net.Support.C5.CollectionValueBase<Lucene.Net.Support.C5.KeyValuePair<K, V>>.ItemsRemoved

    Implements

    IDictionary<K, V>
    ICollectionValue<T>
    System.Collections.Generic.IEnumerable<>
    IShowable
    IFormattable
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)