Chain is a logical group of states, that resembles a linked list. The start state is the head of the *Chain* and the end state is the tail of the *Chain*.

Active bindings

state_id

Chain class state_id

Methods

Public methods


Method new()

Initialise Chain class

Usage

Chain$new(steps = list())

Arguments

steps

(list(State), optional): List of states to be chained in-order. (default: list())

Examples

library(stepfunctions)
s1_pass = Pass$new('Step - One')
s2_pass = Pass$new('Step - two')
s3_pass = Pass$new('Step - three')
chain1 = Chain$new(c(s1_pass, s2_pass))
chain2 = Chain$new(c(s3_pass, chain1))


Method append()

Add a state at the tail end of the chain.

Usage

Chain$append(step)

Arguments

step

(State): State to insert at the tail end of the chain.


Method accept()

placeholder

Usage

Chain$accept(visitor)

Arguments

visitor

placeholder


Method format()

class formatting

Usage

Chain$format()


Method clone()

The objects of this class are cloneable with this method.

Usage

Chain$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

## ------------------------------------------------ ## Method `Chain$new` ## ------------------------------------------------ library(stepfunctions) s1_pass = Pass$new('Step - One') s2_pass = Pass$new('Step - two') s3_pass = Pass$new('Step - three') chain1 = Chain$new(c(s1_pass, s2_pass)) chain2 = Chain$new(c(s3_pass, chain1))