Options
All
  • Public
  • Public/Protected
  • All
Menu

Class State

Represents a state of a variable. E.g. the discrete variable Gender might have two states, Male and Female.

Note that a continuous variable always has a single state.

Hierarchy

  • State

Index

Constructors

constructor

  • new State(): State
  • new State(name: string): State
  • new State(name: string, value: any): State
  • Initializes a new instance of the {@link com.bayesserver.State} class.

    Returns State

  • Initializes a new instance of the {@link com.bayesserver.State} class with the specified [name].

    Parameters

    • name: string

      The name for the state. Can be null.

    Returns State

  • Initializes a new instance of the {@link com.bayesserver.State} class with the specified [name] and [value].

    Parameters

    • name: string

      The name for the state. Can be null.

    • value: any

      Optional value for the state. When the state is added to a variable, this value must be compatible with the {@link com.bayesserver.StateValueType} set on the variable.

    Returns State

Accessors

customProperties

  • Gets custom properties associated with this instance.

    Custom properties allow storage of custom information, which will be saved with the network.

    Returns CustomPropertyCollection

description

  • get description(): string
  • set description(value: string): void
  • Gets an optional description for the state.

    Returns string

  • Sets an optional description for the state.

    Parameters

    • value: string

    Returns void

index

  • get index(): number
  • Gets the index of the state in a variable's {@link com.bayesserver.Variable#getStates} collection. Equals -1 if the {@link com.bayesserver.State} does not belong to a variable.

    Returns number

name

  • get name(): string
  • set name(value: string): void
  • Gets the name of the state.

    Returns string

  • Sets the name of the state.

    Parameters

    • value: string

    Returns void

states

  • Gets the {@link com.bayesserver.StateCollection} the state belongs to, if any.

    Returns StateCollection

    The {@link com.bayesserver.StateCollection} that this instance belongs to. Can be null.

value

  • get value(): any
  • set value(value: any): void
  • Gets an optional value for a state, such as an interval for discretized variables.

    When a {@link com.bayesserver.State} is added to a {@link com.bayesserver.Variable} this value must be compatible with the {@link com.bayesserver.StateValueType} set on the variable.

    Returns any

  • Sets an optional value for a state, such as an interval for discretized variables.

    When a {@link com.bayesserver.State} is added to a {@link com.bayesserver.Variable} this value must be compatible with the {@link com.bayesserver.StateValueType} set on the variable.

    Parameters

    • value: any

    Returns void

variable

  • Gets the {@link com.bayesserver.Variable} the state belongs to, if any.

    If this instance is a child of another state, the state hierarchy is traversed to reach the variable of the root state, if any.

    Returns Variable

    The {@link com.bayesserver.Variable} that this instance belongs to. Can be null.

Methods

_setIndex

  • _setIndex(value: number): void
  • Parameters

    • value: number

    Returns void

_setStates

_setVariable

  • Parameters

    Returns void

copy

  • Copies this instance.

    Returns State

    A new {@link com.bayesserver.State} instance.

toString

  • toString(): string
  • Returns the name of the state, or an empty string if the name is null.

    Returns string

    A {@link String} containing the name of the state which is empty if the name is null.

Static _uus_x_

  • Parameters

    Returns void