Skip to content

Action Node

Mikołaj Milewski edited this page Apr 5, 2025 · 1 revision

Overview

Action Node represents a single step or action in an Activity. It is one of the fundamental building blocks of the Activity in Stateflows framework.

Action Nodes can have multiple incoming and outgoing Flows to accept input and pass on output Tokens.

An Action Node consists of:

  • Name, uniquely identifying the Action Node within the Activity,
  • Logic, code that is invoked when the Action Node is executed,
  • Incoming Flows, passing input Tokens into the node,
  • Outgoing Flows, passing output Tokens outside the node.

Definition

In UML, an Action Node is represented as a rectangle with rounded corners:

stateDiagram-v2
ActionNode --> NextNode : Result
Loading

Equivalent Stateflows notation of an Action Node:

Lambda style

    /* fragment of Activity definition */
    .AddAction("ProcessData",
        async c =>
        {
            /* logic to process data */
        },
        b => b.AddFlow<Result>("NextNode")
    )
    .AddAction("NextNode",
        async c =>
        {
            /* subsequent logic */
        }
    )

Using lambda style means that the Action Node is defined by its name and logic, with flows specified using a fluent builder.

Typed style

    public class ProcessData : IActionNode
    {
        public async Task ExecuteAsync()
        {
            /* logic to process data */
        }
    }

    public class NextNode : IActionNode
    {
        public async Task ExecuteAsync()
        {
            /* subsequent logic */
        }
    }

    /* fragment of Activity definition */
    .AddAction<ProcessData>(b => b
        .AddFlow<Result, NextNode>()
    )
    .AddAction<NextNode>()

Using typed style means that the Action Node is represented by a class implementing the IActionNode interface.

Overview
Installation
Behaviors
   State Machines
       Building blocks
           States
               State
               Composite State
               Orthogonal State
               Final State
           Pseudostates
               Choice
               Junction
               Fork
               Join
           Transitions
               Transition
               Default Transition
               Internal Transition
       Concepts
           Evaluation of Transitions
   Activities
       Building blocks
           Nodes
               Action Node
               Decision Node
               Merge Node
               Initial Node
               Final Node
               Input Node
               Output Node
               Fork Node
               Join Node
               Accept Event Action Node
               Send Event Action Node
               Data Store Node
               Structured Activity Node
               Iterative Activity Node
               Parallel Activity Node
           Flows
               Data Flow
               Control Flow
       Concepts
           Implicit fork and join
   Actions

Clone this wiki locally