Class: Flor::Pro::Part

Inherits:
Flor::Procedure show all
Defined in:
lib/flor/punit/part.rb

Constant Summary

Constants inherited from Flor::Procedure

Flor::Procedure::RVARS, Flor::Procedure::TRUE_ATTS

Instance Attribute Summary

Attributes inherited from Node

#message

Instance Method Summary collapse

Methods inherited from Flor::Procedure

[], core?, #debug_msg, #debug_tree, #end, #flank, #heap, inherited, make, names, #prepare_on_receive_last, #trigger_on_error

Methods inherited from Node

#child_id, #cnodes, #cnodes_any?, #cnodes_empty?, #deref, #descendant_of?, #domain, #exid, #fei, #from, #h, #initialize, #lookup_tree, #lookup_value, #message_or_node_payload, #nid, #node_closed?, #node_ended?, #node_open?, #node_payload, #node_payload_ret, #node_status, #node_status_flavour, #on_error_parent, #parent, #payload, #payload_ret, #point, #reheap, #to_procedure_node, #tree

Constructor Details

This class inherits a constructor from Flor::Node

Instance Method Details

#cancelObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/flor/punit/part.rb', line 47

def cancel

  if @node['can'] || from != parent
    #
    # if the node is cancellable or the cancel comes not from the parent
    # the cancelling goes on...
    #
    super

  else
    #
    # else the cancelling does not proceed further (down)
    #
    []
  end
end

#pre_executeObject

-------------------——————–+

ruote           flor       | replies to parent | cancellable        |

-------——-------------——————--------------------- | fork | part | part | immediately | no (not reachable) | | | flunk | r: false | never | no (not reachable) | | flank | flank | flank | immediately | yes | | lose | norep | r: false | never | yes | -------——-------------——————---------------------

reply/r: false, cancellable/c: false

to part, to flank, the subject is the diverging branch



20
21
22
23
# File 'lib/flor/punit/part.rb', line 20

def pre_execute

  @node['atts'] = []
end

#receive_last_attObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/flor/punit/part.rb', line 25

def receive_last_att

  @node['tree'] = Flor.dup(tree)
  @node['replyto'] = nil

  rep = true
  @node['can'] = (heap == 'flank')

  if (r = att('reply', 'rep', 'r')) != nil
    rep = r
  end
  if (c = att('cancellable', 'can', 'c')) != nil
    @node['can'] = c
  end

  fla = @node['can'] ? 'flank' : 'part'
    # so it is possible to have `flank r: true c: false` (iow: `part`)...

  (rep ? wrap('flavour' => fla, 'nid' => parent, 'ret' => nid) : []) +
  super
end