Module: YPetri::Simulation::Places::Access
- Defined in:
- lib/y_petri/simulation/places/access.rb
Instance Method Summary collapse
-
#c2a(arg = nil) ⇒ Object
With no arguments, acts as a reader of c2a – the correspondence matrix between clamped places and all places.
-
#f2a(arg = nil) ⇒ Object
With no arguments, acts as a reader of f2a – the correspondence matrix between free places and all places.
-
#includes_place?(place) ⇒ Boolean
(also: #include_place?)
Does a place belong to the simulation?.
-
#p(place) ⇒ Object
Net’s place.
Instance Method Details
#c2a(arg = nil) ⇒ Object
With no arguments, acts as a reader of c2a – the correspondence matrix between clamped places and all places. If argument is given, it is assumed to be a column vector, and multiplication with c2a is performed.
19 20 21 |
# File 'lib/y_petri/simulation/places/access.rb', line 19 def c2a arg=nil arg.nil? ? @c2a : @c2a * arg end |
#f2a(arg = nil) ⇒ Object
With no arguments, acts as a reader of f2a – the correspondence matrix between free places and all places. If argument is given, it is assumed to be a column vector, and multiplication with f2a is performed.
11 12 13 |
# File 'lib/y_petri/simulation/places/access.rb', line 11 def f2a arg=nil arg.nil? ? @f2a : @f2a * arg end |
#includes_place?(place) ⇒ Boolean Also known as: include_place?
Does a place belong to the simulation?
25 26 27 28 29 |
# File 'lib/y_petri/simulation/places/access.rb', line 25 def includes_place? place true.tap { begin; place place; rescue NameError, TypeError return false end } end |
#p(place) ⇒ Object
Net’s place.
34 35 36 |
# File 'lib/y_petri/simulation/places/access.rb', line 34 def p( place ) place( place ).source end |