Module: YPetri::Simulation::Places::Access

Defined in:
lib/y_petri/simulation/places/access.rb

Instance Method Summary collapse

Instance Method Details

#c2a(arg = nil) ⇒ Object

With no arguments, 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 is performed.



19
20
21
# File 'lib/y_petri/simulation/places/access.rb', line 19

def c2a arg=nil
  if arg.nil? then @c2a else @c2a * arg end
end

#clamped_pp(ids = nil) ⇒ Object

Clamped places of the simulation (belonging to the net).



53
54
55
# File 'lib/y_petri/simulation/places/access.rb', line 53

def clamped_pp( ids=nil )
  clamped_places( ids ).sources
end

#f2a(arg = nil) ⇒ Object

With no arguments, 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 is performed.



11
12
13
# File 'lib/y_petri/simulation/places/access.rb', line 11

def f2a arg=nil
  if arg.nil? then @f2a else @f2a * arg end
end

#free_pp(ids = nil) ⇒ Object

Free places of the simulation (belonging to the net).



47
48
49
# File 'lib/y_petri/simulation/places/access.rb', line 47

def free_pp( ids=nil )
  free_places( ids ).sources
end

#includes_place?(id) ⇒ Boolean Also known as: include_place?

Does a place belong to the simulation?

Returns:

  • (Boolean)


25
26
27
28
29
30
# File 'lib/y_petri/simulation/places/access.rb', line 25

def includes_place? id
  true.tap { begin; place id
             rescue NameError, TypeError
               return false
             end }
end

#nclamped(ids = nil) ⇒ Object Also known as: clamped_pn

Names of free places. Arguments are handled as with #clamped_places.



72
73
74
# File 'lib/y_petri/simulation/places/access.rb', line 72

def nclamped ids=nil
  clamped_places( ids ).names
end

#nfree(ids = nil) ⇒ Object Also known as: free_pn

Names of free places. Arguments are handled as with #free_places.



65
66
67
# File 'lib/y_petri/simulation/places/access.rb', line 65

def nfree ids=nil
  free_places( ids ).names
end

#p(id) ⇒ Object

Place of the simulation (belonging to the net).



35
36
37
# File 'lib/y_petri/simulation/places/access.rb', line 35

def p( id )
  place( id ).source
end

#pn(ids = nil) ⇒ Object

Places’ names. Arguments, if any, are treated as in #places method.



59
60
61
# File 'lib/y_petri/simulation/places/access.rb', line 59

def pn( ids=nil )
  places( ids ).names
end

#pp(ids = nil) ⇒ Object

Places of the simulation (belonging to the net).



41
42
43
# File 'lib/y_petri/simulation/places/access.rb', line 41

def pp( ids=nil )
  places( ids ).sources
end