tock / ai.tock.bot.engine.dialog / DialogState

# DialogState

`data class DialogState` (source)

The Dialog state.

### Constructors

#### <init> | The Dialog state. `DialogState(currentIntent: Intent? = null, entityValues: MutableMap<String, EntityStateValue> = mutableMapOf(), context: MutableMap<String, Any> = mutableMapOf(), userLocation: UserLocation? = null, nextActionState: NextUserActionState? = null)`

### Properties

#### context | The context of the dialog, a versatile map. `val context: MutableMap<String, Any>`
#### currentIntent | The current Intent of the dialog, can be null. `var currentIntent: Intent?`
#### entityValues | The current entity values (with their history). `val entityValues: MutableMap<String, EntityStateValue>`
#### nextActionState | The NextUserActionState if any. If not null, it will be applied to the next user action, with NLP custom qualifiers. `var nextActionState: NextUserActionState?`
#### userLocation | The current UserLocation if any. `var userLocation: UserLocation?`

### Functions

#### changeValue | Change an entity value. Keep previous entity values history. `fun changeValue(entity: Entity, newValue: Value?): Unit` `fun changeValue(newValue: EntityValue): Unit` `fun changeValue(role: String, newValue: EntityValue?): Unit`
#### cleanupState | Same than resetState but remove also entity values history. `fun cleanupState(): Unit`
#### hasEntity | `fun hasEntity(role: String): Boolean`
#### hasEntityPredefinedValue | Does this event contains specified predefined value entity? `fun hasEntityPredefinedValue(role: String, value: String): Boolean`
#### resetAllEntityValues | Reset all entity values. Keep entity values history. `fun resetAllEntityValues(): Unit`
#### resetState | Reset all entity values, context values, userLocation and nextActionState but keep entity values history. `fun resetState(): Unit`
#### resetValue | Reset the value of an entity. Keep entity values history. `fun resetValue(role: String): Unit`
#### setContextValue | Updates persistent context value. Do not store Collection or Map in the context, only plain objects or typed arrays. `fun setContextValue(name: String, value: Any?): Unit`
#### setValue | Set a new entity value. Remove previous entity values history. `fun setValue(role: String, value: EntityValue): Unit` `fun setValue(entity: Entity, value: Value): Unit`

### Companion Object Functions

#### initFromDialogState | Init a new state from the specified state. `fun initFromDialogState(dialog: DialogState): DialogState`