Class: PgVerify::Model::Component

Inherits:
Object
  • Object
show all
Defined in:
lib/pg-verify/model/component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Component

Returns a new instance of Component.



24
25
26
27
28
29
30
31
# File 'lib/pg-verify/model/component.rb', line 24

def initialize(args = {})
    @name = ( args[:name] || raise('Blubb') )
    @states = ( args[:states] || [] )
    @transitions = ( args[:transitions] || [] )
    @represents_fault = args[:represents_fault].nil? ? false : args[:represents_fault]
    @source_location =  ( args[:source_location] )
    @init_expression =  args[:init_expression]
end

Instance Attribute Details

#init_expressionObject

A Model::ParsedExpression used as the init expression. This expression must hold true initially. It can be used to restrict or set the initial state and variables. Can be left as nil in order to not restrict anything



22
23
24
# File 'lib/pg-verify/model/component.rb', line 22

def init_expression
  @init_expression
end

#nameObject

The name of this component as a symbol



8
9
10
# File 'lib/pg-verify/model/component.rb', line 8

def name
  @name
end

#represents_faultObject

Flag on whether this component is used to represent a fault.



14
15
16
# File 'lib/pg-verify/model/component.rb', line 14

def represents_fault
  @represents_fault
end

#source_locationObject

The source location of this components definition



16
17
18
# File 'lib/pg-verify/model/component.rb', line 16

def source_location
  @source_location
end

#statesObject

A list of symbols representing states



10
11
12
# File 'lib/pg-verify/model/component.rb', line 10

def states
  @states
end

#transitionsObject

A list of transitions between states



12
13
14
# File 'lib/pg-verify/model/component.rb', line 12

def transitions
  @transitions
end

Instance Method Details

#represents_fault?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/pg-verify/model/component.rb', line 33

def represents_fault?()
    return @represents_fault
end