Sha256: 3b53b935b1e6202b153cb8f6df4cd8c09f5be2f712a1e4c22e18a0761a717c61

Contents?: true

Size: 1.34 KB

Versions: 11

Compression:

Stored size: 1.34 KB

Contents

# YNelson::Transition is based on YPetri::Transition and offers similar
# interface. "Functions", on which transitions of a functional Petri net
# are based, are analogical to 'formulas' of a spreadsheet.
# 
class YNelson::Transition < YPetri::Transition
  include YNelson::Yzz
  alias call along # .( :dim ) rather than .along( :dim )

  # Produces the inspect string of the place.
  # 
  def inspect
    # Calling the ancestor's #inspect.
    YPetri::Transition.instance_method( :inspect ).bind( self ).call
  end

  # Returns a string briefly describing the place.
  # 
  def to_s
    YPetri::Transition.instance_method( :to_s ).bind( self ).call
  end

  private

  # YNelson extends this YPetri::Transition private method, so that a zz
  # connection is automatically created along dimension [:domain, i] for
  # i-th domain place of the transition.
  # 
  def inform_upstream_places
    upstream_places.each_with_index { |p, i|
      along( YNelson.Dimension self, :domain, i ) >> p
    }
    super
  end

  # YNelson extends this YPetri::Transition private method, so that a zz
  # connection is autimatically created along along dimension [:codomain, i]
  # for i-th codomain place of the transition.
  # 
  def inform_downstream_places
    downstream_places.each_with_index { |p, i|
      along( YNelson.Dimension self, :codomain, i ) >> p
    }
    super
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
y_nelson-2.3.8 lib/y_nelson/transition.rb
y_nelson-2.3.7 lib/y_nelson/transition.rb
y_nelson-2.3.6 lib/y_nelson/transition.rb
y_nelson-2.3.4 lib/y_nelson/transition.rb
y_nelson-2.3.3 lib/y_nelson/transition.rb
y_nelson-2.3.2 lib/y_nelson/transition.rb
y_nelson-2.3.0 lib/y_nelson/transition.rb
y_nelson-2.1.0 lib/y_nelson/transition.rb
y_nelson-2.0.8 lib/y_nelson/transition.rb
y_nelson-2.0.7 lib/y_nelson/transition.rb
y_nelson-2.0.6 lib/y_nelson/transition.rb