module YPetri::Net::NodeAccess
Access to nodes (places and transitions) of a Petri net.
Public Instance Methods
include?(id)
click to toggle source
Inquirer whether the net includes a node.
# File lib/y_petri/net/node_access.rb, line 20 def include? id include_place?( id ) || include_transition?( id ) end
include_place?(id)
click to toggle source
Does the net include a place?
# File lib/y_petri/net/node_access.rb, line 6 def include_place? id begin place( id ) and true rescue NameError, TypeError; false end end
include_transition?(id)
click to toggle source
Does the net include a transition?
# File lib/y_petri/net/node_access.rb, line 14 def include_transition? id begin; transition( id ) and true; rescue NameError, TypeError; false end end
place(id)
click to toggle source
Returns the net's place identified by the argument.
Calls superclass method
# File lib/y_petri/net/node_access.rb, line 26 def place id ( super rescue Place().instance( id ) ).tap do |p| fail TypeError, "No place #{id} in the net!" unless places.include? p end