Class: StateMachineChecker::Labeling

Inherits:
Object
  • Object
show all
Defined in:
lib/state_machine_checker/labeling.rb

Overview

A mapping from states to the values of each atom.

Instance Method Summary collapse

Constructor Details

#initialize(atoms, machine, instance_generator) ⇒ Labeling

Returns a new instance of Labeling.

Parameters:

  • atoms (Enumerator<CTL::Atom>)

    the atoms which will be the labels.

  • machine (FiniteStateMachine)

    the machine to generate labels for.

  • instance_generator (Proc)

    a nullary function which returns an instance of an object in the initial state.


8
9
10
# File 'lib/state_machine_checker/labeling.rb', line 8

def initialize(atoms, machine, instance_generator)
  @labels_by_state = build_map(atoms, machine, instance_generator)
end

Instance Method Details

#for_state(state) ⇒ Set<CTL::Atom>

Get the labels for the given state.

Parameters:

  • state (Symbol)

Returns:

  • (Set<CTL::Atom>)

    the atoms which are true in the state


16
17
18
# File 'lib/state_machine_checker/labeling.rb', line 16

def for_state(state)
  labels_by_state[state]
end