Class: StateMachine::OOStructuredFSM::ConditionalState
Overview
Class responsible for handling conditional state.
Instance Method Summary
collapse
#attribute_capture, #class_capture, #comment_capture, #conditional_capture, #idle_capture, #include_capture, #module_capture, #repetition_capture, #variable_capture
Constructor Details
Returns a new instance of ConditionalState.
12
13
14
|
# File 'lib/kuniri/state_machine/OO_structured_fsm/conditional_state.rb', line 12
def initialize(pLanguage)
@language = pLanguage
end
|
Instance Method Details
#add_conditional_element(pFlag, pElementFile, pConditional) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/kuniri/state_machine/OO_structured_fsm/conditional_state.rb', line 38
def add_conditional_element(pFlag, pElementFile, pConditional)
if pFlag == StateMachine::GLOBAL_FUNCTION_STATE
pElementFile.global_functions
.last.add_conditional(pConditional)
elsif pFlag == StateMachine::METHOD_STATE
pElementFile.classes.last.methods
.last.add_conditional(pConditional)
elsif pFlag == StateMachine::CONSTRUCTOR_STATE
pElementFile.classes.last.constructors
.last.add_conditional(pConditional)
end
return pElementFile
end
|
#constructor_capture ⇒ Object
26
27
28
29
|
# File 'lib/kuniri/state_machine/OO_structured_fsm/conditional_state.rb', line 26
def constructor_capture
reset_flag
@language.rewind_state
end
|
#execute(pElementFile, pLine) ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/kuniri/state_machine/OO_structured_fsm/conditional_state.rb', line 53
def execute(pElementFile, pLine)
conditional = @language.conditionalHandler.get_conditional(pLine)
flag = @language.flagFunctionBehaviour
if (conditional)
pElementFile = add_conditional_element(flag,
pElementFile, conditional)
end
if (@language.endBlockHandler.has_end_of_block?(pLine))
if (flag == StateMachine::GLOBAL_FUNCTION_STATE)
function_capture
elsif (flag == StateMachine::METHOD_STATE)
method_capture
elsif (flag == StateMachine::CONSTRUCTOR_STATE)
constructor_capture
end
end
return pElementFile
end
|
#function_capture ⇒ Object
32
33
34
35
|
# File 'lib/kuniri/state_machine/OO_structured_fsm/conditional_state.rb', line 32
def function_capture
reset_flag
@language.rewind_state
end
|
#handle_line(pLine) ⇒ Object
16
17
|
# File 'lib/kuniri/state_machine/OO_structured_fsm/conditional_state.rb', line 16
def handle_line(pLine)
end
|
#method_capture ⇒ Object
20
21
22
23
|
# File 'lib/kuniri/state_machine/OO_structured_fsm/conditional_state.rb', line 20
def method_capture
reset_flag
@language.rewind_state
end
|