Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ConnectionCollection

A collection of connections.

Hierarchy

  • Collection<Connection, ConnectionCollection>
    • ConnectionCollection

Index

Constructors

constructor

Properties

Private __lookup

__lookup: Hash<string, Connection>
internal

Private __lookupLock

__lookupLock: Object
internal

Methods

add

  • add(value: Connection): boolean
  • Adds a value.

    Parameters

    • value: Connection

      The value.

    Returns boolean

addMany

  • addMany(values: Connection[]): boolean
  • Adds some values.

    Parameters

    • values: Connection[]

      The values.

    Returns boolean

Protected addSuccess

  • addSuccess(value: Connection): void
  • Invoked when an element is added to the collection.

    Parameters

    • value: Connection

      The value.

    Returns void

any

  • any(predicate: IFunction1<Connection, boolean>): boolean
  • any(): boolean
  • Determined whether the collection contains at least one value that matches the specified predicate.

    Parameters

    • predicate: IFunction1<Connection, boolean>

      The predicate.

    Returns boolean

  • Determined whether the collection contains at least one value.

    Returns boolean

Protected arrayFromList

  • arrayFromList(list: Array<Connection>): Connection[]
  • Creates an array from a list.

    Parameters

    • list: Array<Connection>

      The list.

    Returns Connection[]

contains

  • contains(value: Connection): boolean
  • Determines whether the collection contains a value.

    Parameters

    • value: Connection

      The value.

    Returns boolean

Protected createCollection

  • createCollection(): ConnectionCollection
  • Creates a collection.

    Returns ConnectionCollection

first

  • first(predicate: IFunction1<Connection, boolean>): Connection
  • first(): Connection
  • Gets the first value that matches the specified predicate. Throws an exception if there are no such values in the collection.

    Parameters

    • predicate: IFunction1<Connection, boolean>

      The predicate.

    Returns Connection

  • Gets the first value. Throws an exception if there are no values in the collection.

    Returns Connection

firstOrDefault

  • firstOrDefault(): Connection
  • firstOrDefault(predicate: IFunction1<Connection, boolean>): Connection
  • Gets the first value. Returns a default value if there are no values in the collection.

    Returns Connection

  • Gets the first value that matches the specified predicate. Returns a default value if there are no such values in the collection.

    Parameters

    • predicate: IFunction1<Connection, boolean>

      The predicate.

    Returns Connection

forEach

  • forEach(callback: IAction2<Connection, number>): void
  • Executes a callback function once per value.

    Parameters

    • callback: IAction2<Connection, number>

      The callback to execute.

    Returns void

getById

  • getById(id: string): Connection
  • Gets a connection by ID.

    Parameters

    • id: string

      The identifier.

    Returns Connection

    The connection, or null if the connection does not exist.

getCount

  • getCount(): number
  • Gets the count.

    Returns number

getTypeString

  • getTypeString(): string

getValue

  • getValue(): Connection
  • Gets the value.

    Returns Connection

getValues

  • getValues(): Connection[]
  • Gets the values.

    Returns Connection[]

last

  • last(predicate: IFunction1<Connection, boolean>): Connection
  • last(): Connection
  • Gets the last value that matches the specified predicate. Throws an exception if there are no such values in the collection.

    Parameters

    • predicate: IFunction1<Connection, boolean>

      The predicate.

    Returns Connection

  • Gets the last value. Throws an exception if there are no values in the collection.

    Returns Connection

lastOrDefault

  • lastOrDefault(predicate: IFunction1<Connection, boolean>): Connection
  • lastOrDefault(): Connection
  • Gets the last value that matches the specified predicate. Returns a default value if there are no such values in the collection.

    Parameters

    • predicate: IFunction1<Connection, boolean>

      The predicate.

    Returns Connection

  • Gets the last value. Returns a default value if there are no values in the collection.

    Returns Connection

remove

  • remove(value: Connection): boolean
  • Removes a value.

    Parameters

    • value: Connection

      The value.

    Returns boolean

removeAll

  • removeAll(): void
  • Removes all values.

    Returns void

removeFirst

  • removeFirst(condition: IFunction1<Connection, boolean>): Connection
  • removeFirst(): Connection
  • Removes the first value that matches a given condition.

    Parameters

    • condition: IFunction1<Connection, boolean>

    Returns Connection

  • Removes the first value.

    Returns Connection

removeLast

  • removeLast(): Connection
  • removeLast(condition: IFunction1<Connection, boolean>): Connection
  • Removes the last value.

    Returns Connection

  • Removes the last value that matches a given condition.

    Parameters

    • condition: IFunction1<Connection, boolean>

    Returns Connection

removeMany

  • removeMany(values: Connection[]): boolean
  • Removes some values.

    Parameters

    • values: Connection[]

      The values.

    Returns boolean

Protected removeSuccess

  • removeSuccess(value: Connection): void
  • Invoked when an element is removed from the collection.

    Parameters

    • value: Connection

      The value.

    Returns void

replace

  • replace(values: Connection[]): void
  • Replaces the collection with a new set of values.

    Parameters

    • values: Connection[]

      The values.

    Returns void

setValue

  • setValue(value: Connection): void
  • Sets the value.

    Parameters

    • value: Connection

    Returns void

setValues

  • setValues(value: Connection[]): void
  • Sets the values.

    Parameters

    • value: Connection[]

    Returns void

single

  • single(predicate: IFunction1<Connection, boolean>): Connection
  • single(): Connection
  • Gets the only value that matches the specified predicate. Throws an exception if there are no values or more than one value in the collection.

    Parameters

    • predicate: IFunction1<Connection, boolean>

    Returns Connection

  • Gets the only value. Throws an exception if there are no values or more than one value in the collection.

    Returns Connection

singleOrDefault

  • singleOrDefault(): Connection
  • singleOrDefault(predicate: IFunction1<Connection, boolean>): Connection
  • Gets the only value. Returns a default value if there are no values or more than one value in the collection.

    Returns Connection

  • Gets the only value that matches the specified predicate. Returns a default value if there are no values or more than one value in the collection.

    Parameters

    • predicate: IFunction1<Connection, boolean>

    Returns Connection

tryGetById

  • tryGetById(id: string, connection: Holder<Connection>): boolean
  • Tries to get a connection by ID.

    Parameters

    • id: string

      The identifier.

    • connection: Holder<Connection>

      The connection.

    Returns boolean

    The connection, or null if the connection does not exist.

valueAt

  • valueAt(index: number): Connection
  • Gets the value at the specified index. Throws an exception if a value does not exist at that index.

    Parameters

    • index: number

      The index.

    Returns Connection

valueAtOrDefault

  • valueAtOrDefault(index: number): Connection
  • Gets the value at the specified index. Returns a default value if a value does not exist at that index.

    Parameters

    • index: number

      The index.

    Returns Connection

where

  • where(predicate: IFunction2<Connection, number, boolean>): ConnectionCollection
  • Creates a new collection with values that match the specified predicate.

    Parameters

    • predicate: IFunction2<Connection, number, boolean>

      The predicate.

    Returns ConnectionCollection