module YPetri::Transition::Arcs

Connectivity aspect of a transition.

Public Instance Methods

aa(arg=nil) click to toggle source

Names of the places connected to the transition. The optional argument controls what is returned for unnamed instances, and works just like in Array#names method from y_support/name_magic: The default value (nil) returns nil, true returns the instance itself, and false drops the unnamed instances from the list altogether.

# File lib/y_petri/transition/arcs.rb, line 28
def aa arg=nil
  arcs.names arg
end
arc(id) click to toggle source

Arc (a place connected to this transition) identifier.

# File lib/y_petri/transition/arcs.rb, line 34
def arc id
  place = place( id )
  arcs.find { |p| p == place } or
    fail TypeError, "No place #{id} connected to #{self}!"
end
arcs() click to toggle source

Union of action arcs and test arcs.

# File lib/y_petri/transition/arcs.rb, line 18
def arcs
  domain | codomain
end
codomain_marking() click to toggle source

Marking of the codomain places.

# File lib/y_petri/transition/arcs.rb, line 46
def codomain_marking; codomain.map &:marking end
codomain_pp() click to toggle source

Names of downstream places.

# File lib/y_petri/transition/arcs.rb, line 13
def codomain_pp; codomain.map { |p| p.name || p.object_id } end
Also aliased as: downstream_pp
domain_marking() click to toggle source

Marking of the domain places.

# File lib/y_petri/transition/arcs.rb, line 42
def domain_marking; domain.map &:marking end
domain_pp() click to toggle source

Names of upstream places.

# File lib/y_petri/transition/arcs.rb, line 8
def domain_pp; domain.map { |p| p.name || p.object_id } end
Also aliased as: upstream_pp
downstream_pp()
Alias for: codomain_pp
fire_downstream_recursively() click to toggle source

Recursive firing of the downstream net portion (honors cocked?).

# File lib/y_petri/transition/arcs.rb, line 60
def fire_downstream_recursively
  return false unless cocked?
  uncock
  fire!
  downstream_places.each &:fire_downstream_recursively
  return true
end
fire_upstream_recursively() click to toggle source

Recursive firing of the upstream net portion (honors cocked?).

# File lib/y_petri/transition/arcs.rb, line 50
def fire_upstream_recursively
  return false unless cocked?
  uncock
  upstream_places.each &:fire_upstream_recursively
  fire!
  return true
end
upstream_pp()
Alias for: domain_pp