Class: YPetri::Simulation::PlaceRepresentation
- Inherits:
-
ElementRepresentation
- Object
- ElementRepresentation
- YPetri::Simulation::PlaceRepresentation
- Defined in:
- lib/y_petri/simulation/place_representation.rb
Instance Attribute Summary collapse
-
#quantum ⇒ Object
readonly
Returns the value of attribute quantum.
Attributes inherited from ElementRepresentation
Instance Method Summary collapse
-
#clamp=(value) ⇒ Object
Setter of clamp.
-
#clamped? ⇒ Boolean
Is the place clamped in the current simulation?.
-
#free? ⇒ Boolean
Is the place free in the current simulation?.
-
#initial_marking ⇒ Object
Initial marking value (or nil, if the place is free).
-
#initial_marking=(value) ⇒ Object
Setter of initial marking.
-
#initialize(net_place) ⇒ PlaceRepresentation
constructor
Expect a single YPetri place as an argument.
-
#m ⇒ Object
(also: #marking)
Get the current marking of this place in the simulation.
-
#m=(value) ⇒ Object
Set the marking of this place in the simulation.
-
#m_vector_index ⇒ Object
Index.
-
#marking=(value) ⇒ Object
Alias of #m=.
-
#marking_clamp ⇒ Object
(also: #clamp)
Marking clamp value (or nil, if the place is clamped).
Constructor Details
#initialize(net_place) ⇒ PlaceRepresentation
Expect a single YPetri place as an argument.
16 17 18 19 |
# File 'lib/y_petri/simulation/place_representation.rb', line 16 def initialize net_place super @quantum = source.quantum end |
Instance Attribute Details
#quantum ⇒ Object (readonly)
Returns the value of attribute quantum.
7 8 9 |
# File 'lib/y_petri/simulation/place_representation.rb', line 7 def quantum @quantum end |
Instance Method Details
#clamp=(value) ⇒ Object
Setter of clamp.
23 24 25 |
# File 'lib/y_petri/simulation/place_representation.rb', line 23 def clamp=( value ) simulation.set_marking_clamp( of: self, to: value ) end |
#clamped? ⇒ Boolean
Is the place clamped in the current simulation?
54 55 56 |
# File 'lib/y_petri/simulation/place_representation.rb', line 54 def clamped? simulation.marking_clamps.places.include? self end |
#free? ⇒ Boolean
Is the place free in the current simulation?
48 49 50 |
# File 'lib/y_petri/simulation/place_representation.rb', line 48 def free? simulation.initial_marking.places.include? self end |
#initial_marking ⇒ Object
Initial marking value (or nil, if the place is free).
42 43 44 |
# File 'lib/y_petri/simulation/place_representation.rb', line 42 def initial_marking simulation.initial_marking[ self ] if free? end |
#initial_marking=(value) ⇒ Object
Setter of initial marking.
29 30 31 |
# File 'lib/y_petri/simulation/place_representation.rb', line 29 def initial_marking=( value ) simulation.set_initial_marking( of: self, to: value ) end |
#m ⇒ Object Also known as: marking
Get the current marking of this place in the simulation.
72 73 74 |
# File 'lib/y_petri/simulation/place_representation.rb', line 72 def m m_vector[ self ] end |
#m=(value) ⇒ Object
Set the marking of this place in the simulation.
60 61 62 |
# File 'lib/y_petri/simulation/place_representation.rb', line 60 def m=( value ) m_vector.set self, value end |
#m_vector_index ⇒ Object
Index
10 11 12 |
# File 'lib/y_petri/simulation/place_representation.rb', line 10 def m_vector_index places.index( self ) end |
#marking=(value) ⇒ Object
Alias of #m=
66 67 68 |
# File 'lib/y_petri/simulation/place_representation.rb', line 66 def marking=( value ) m=( value ) end |
#marking_clamp ⇒ Object Also known as: clamp
Marking clamp value (or nil, if the place is clamped).
35 36 37 |
# File 'lib/y_petri/simulation/place_representation.rb', line 35 def marking_clamp simulation.marking_clamp of: self if clamped? end |