Sha256: f7fbd81778d419ea9c013167c7394df4b84a2d39d595001317776566a57ef0bb

Contents?: true

Size: 1.34 KB

Versions: 1

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 )

  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

  # 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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
y_nelson-2.0.5 lib/y_nelson/transition.rb