File

projects/wms-framework/src/lib/baseframework/Dictionary.ts

Description

Base class for dictionary types.

Implements

ISimpleDictionary

Index

Properties
Methods

Properties

Abstract count
Type : number

Gets the count of elements in the dictionary

Abstract internalArray
Type : []
Abstract keys
Type : ICollection<K>

The keys collection

Abstract values
Type : ICollection<V>

The values collection

Methods

Abstract add
add(value: [K, V])
Parameters :
Name Type Optional
value [K, V] No
Returns : void
Abstract addEntry
addEntry(key: K, value: V)

Add a value to the dictionary

Parameters :
Name Type Optional
key K No
value V No
Returns : any
Abstract clear
clear()

Clears the dictionary

Returns : void
Abstract contains
contains(value: [K, V])
Parameters :
Name Type Optional
value [K, V] No
Returns : boolean
Abstract containsKey
containsKey(key: K)
Parameters :
Name Type Optional
key K No
Returns : boolean
Abstract copyTo
copyTo(target: [], index: number)
Parameters :
Name Type Optional
target [] No
index number No
Returns : void
Abstract getItem
getItem(key: K)
Parameters :
Name Type Optional
key K No
Returns : V
Abstract hasKey
hasKey(key: K)

Checks if the dictionary has a key

Parameters :
Name Type Optional
key K No
Returns : any
Abstract remove
remove(value: [K, V])
Parameters :
Name Type Optional
value [K, V] No
Returns : boolean
Abstract removeEntry
removeEntry(key: K)

Removes an entry from the dictionay by key

Parameters :
Name Type Optional
key K No
Returns : any
Abstract setItem
setItem(key: K, value: V)
Parameters :
Name Type Optional
key K No
value V No
Returns : void
Abstract tryGetValue
tryGetValue(key: K, value: (v: V) => void)

Tries to get a value by key

Parameters :
Name Type Optional
key K No
value function No
Returns : any
Abstract
()
Returns : Iterator<, any, undefined>
import { ICollection } from './collections';
import { ISimpleDictionary } from './ISimpleDictionary';

/**
 * Base class for dictionary types.
 *
 * @export
 * @abstract
 * @class Dictionary
 * @implements {ISimpleDictionary<K, V>}
 * @template K
 * @template V
 * @wType System.Collections.Generic.Dictionary`2
 * @wNetSupport
 */
export abstract class Dictionary<K, V> implements ISimpleDictionary<K, V> {
  /**
   * The keys collection
   *
   * @abstract
   * @type {ICollection<K>}
   * @memberof Dictionary
   * @wProperty Keys
   */
  abstract keys: ICollection<K>;

  /**
   * The values collection
   *
   * @abstract
   * @type {ICollection<V>}
   * @memberof Dictionary
   * @wProperty Values
   */
  abstract values: ICollection<V>;

  /**
   * Gets the count of elements in the dictionary
   *
   * @abstract
   * @type {number}
   * @memberof Dictionary
   * @wProperty Count
   */
  abstract count: number;
  abstract internalArray: [K, V][];
  abstract getItem(key: K): V;
  abstract setItem(key: K, value: V): void;

  /**
   * Add a value to the dictionary
   *
   * @abstract
   * @param {[K, V]} value
   * @memberof Dictionary
   * @wMethod Add
   */
  abstract addEntry(key: K, value: V);

  /**
   * Checks if the dictionary has a key
   *
   * @abstract
   * @param {K} key
   * @memberof Dictionary
   * @wMethod ContainsKey
   */
  abstract hasKey(key: K);

  /**
   * Removes an entry from the dictionay by key
   *
   * @abstract
   * @param {K} key
   * @memberof Dictionary
   * @wMethod Remove
   */
  abstract removeEntry(key: K);

  /**
   * Tries to get a value by key
   *
   * @abstract
   * @param {K} key
   * @param {(v: V) => void} value
   * @memberof Dictionary
   * @wMethod TryGetValue
   * @wIgnore
   */
  abstract tryGetValue(key: K, value: (v: V) => void);

  abstract containsKey(key: K): boolean;
  abstract add(value: [K, V]): void;

  /**
   * Clears the dictionary
   *
   * @abstract
   * @memberof Dictionary
   * @wMethod Clear
   */
  abstract clear(): void;
  abstract contains(value: [K, V]): boolean;
  abstract remove(value: [K, V]): boolean;
  abstract copyTo(target: [K, V][], index: number): void;
  abstract [Symbol.iterator](): Iterator<[K, V], any, undefined>;
}

result-matching ""

    No results matching ""