Class: StateMachineChecker::StateResult

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

Overview

The result of checking whether this state satisfies a formula.

Instance Method Summary collapse

Constructor Details

#initialize(satisfied, path) ⇒ StateResult

Returns a new instance of StateResult.

Parameters:

  • satisfied (Boolean)
  • path (Array<Symbol>)

6
7
8
9
# File 'lib/state_machine_checker/state_result.rb', line 6

def initialize(satisfied, path)
  @satisfied = satisfied
  @path = path
end

Instance Method Details

#and(other) ⇒ Object


45
46
47
48
49
50
51
# File 'lib/state_machine_checker/state_result.rb', line 45

def and(other)
  if !other.satisfied?
    other
  else
    self
  end
end

#counterexampleArray<Symbol>

A counterexample demonstrating that the formula is not satisfied from this state.

Returns:

  • (Array<Symbol>)

    an array of the names of transitions.


31
32
33
34
35
# File 'lib/state_machine_checker/state_result.rb', line 31

def counterexample
  unless satisfied?
    path
  end
end

#or(other) ⇒ Object


37
38
39
40
41
42
43
# File 'lib/state_machine_checker/state_result.rb', line 37

def or(other)
  if satisfied?
    self
  else
    other
  end
end

#satisfied?true, false

Whether the formula is satisfied from this state.

Returns:

  • (true, false)

14
15
16
# File 'lib/state_machine_checker/state_result.rb', line 14

def satisfied?
  satisfied
end

#witnessArray<Symbol>

A witness that the formula is satisfied from this state.

Returns:

  • (Array<Symbol>)

    an array of the names of transitions.


21
22
23
24
25
# File 'lib/state_machine_checker/state_result.rb', line 21

def witness
  if satisfied?
    path
  end
end