Options
All
  • Public
  • Public/Protected
  • All
Menu

Class StateCollection

Represents a collection of states belonging to a {@link com.bayesserver.Variable}.

Note that a continuous variable always has a single state.

see

com.bayesserver.State

Hierarchy

  • StateCollection

Implements

Index

Constructors

constructor

Accessors

isReadOnly

  • get isReadOnly(): boolean
  • inheritdoc

    Returns boolean

size

  • get size(): number
  • inheritdoc

    Returns number

variable

  • Gets the {@link com.bayesserver.Variable} this collection belongs to. This is null if this is a child state collection.

    Returns Variable

    The variable that owns this collection.

Methods

_2ad2e5f4b2884a52bf8bfc07ce8953d3

  • _2ad2e5f4b2884a52bf8bfc07ce8953d3(): void

__@iterator

  • __@iterator(): Iterator<State>

_uvq_x_

  • _uvq_x_(p_autogen17: State, p_autogen18: string, p_autogen19: string): void
  • Parameters

    • p_autogen17: State
    • p_autogen18: string
    • p_autogen19: string

    Returns void

_uvr_x_

  • _uvr_x_(p_autogen20: string): void
  • Parameters

    • p_autogen20: string

    Returns void

_vqu_x_

  • _vqu_x_(): void
  • Returns void

clear

  • clear(): void
  • inheritdoc

    Returns void

findByValue

  • findByValue(value: any): State
  • Finds the state whose {@link com.bayesserver.State#getValue value}/> matches the given [value], or null if a match is not found.

    For discretized variables, each {@link com.bayesserver.State#getValue} is an {@link com.bayesserver.Interval}, and this method returns the state whose interval contains the given [value].

    Parameters

    • value: any

      The value to match to a {@link com.bayesserver.State#getValue}.

    Returns State

    The matching {@link com.bayesserver.State} or null if a match is not found.

get

  • get(name: string): State
  • get(name: string, throwIfNotFound: boolean): State
  • get(index: number): State
  • Performs a case sensitive lookup.

    Parameters

    • name: string

      The name of the {@link com.bayesserver.State} to find.

    Returns State

    A {@link com.bayesserver.State} with the specified name if found; otherwise null.

  • Performs a case sensitive lookup.

    Parameters

    • name: string

      The name of the {@link com.bayesserver.State} to find.

    • throwIfNotFound: boolean

      When true throws an exception if the name is not found.

    Returns State

    The {@link com.bayesserver.State} with the specified name; otherwise null.

  • Gets the {@link com.bayesserver.State} at the specified index.

    Parameters

    • index: number

    Returns State

    The state.

includes

  • includes(item: State): boolean
  • Determines whether a {@link com.bayesserver.State} is in the collection. The operation is O(1).

    Parameters

    • item: State

      The {@link com.bayesserver.State} to locate in the collection. The value can be null.

    Returns boolean

    true if [item] is found in the collection; otherwise, false.

indexOf

  • indexOf(item: State): number
  • Determines the index of a specific {@link com.bayesserver.State} in the collection. This operation is O(1).

    Parameters

    • item: State

      The state to find. The value can be null.

    Returns number

    The index of the state in the collection, or -1 if not found.

insert

  • insert(index: number, item: State): void
  • Inserts an element into the collection at the specified index.

    exception

    ReferenceError Raised when [item] is null.

    exception

    Error Raised if the state already belongs to a network.

    exception

    RangeError index is less than 0.-or-index is equal to or greater than the collection count.

    Parameters

    • index: number

      The zero based index at which to add the element.

    • item: State

      The item to insert. Cannot be null.

    Returns void

push

  • push(...items: State[]): number
  • Parameters

    Returns number

remove

  • remove(item: State): boolean
  • inheritdoc

    Parameters

    Returns boolean

removeAt

  • removeAt(index: number): State
  • Removes an element from the collection at the specified index.

    exception

    RangeError index is less than 0.-or-index is equal to or greater than the collection count.

    Parameters

    • index: number

      The zero based index at which to remove the element.

    Returns State

set

  • set(index: number, value: State): void
  • Sets the {@link com.bayesserver.State} at the specified index.

    Parameters

    • index: number
    • value: State

      The state.

    Returns void