Class: YPetri::Simulation::PlaceRepresentation
- Inherits:
-
NodeRepresentation
- Object
- NodeRepresentation
- 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 NodeRepresentation
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).
Methods inherited from NodeRepresentation
Constructor Details
#initialize(net_place) ⇒ PlaceRepresentation
Expect a single YPetri place as an argument.
17 18 19 20 |
# File 'lib/y_petri/simulation/place_representation.rb', line 17 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.
24 25 26 |
# File 'lib/y_petri/simulation/place_representation.rb', line 24 def clamp=( value ) simulation.set_marking_clamp( self, to: value ) end |
#clamped? ⇒ Boolean
Is the place clamped in the current simulation?
55 56 57 |
# File 'lib/y_petri/simulation/place_representation.rb', line 55 def clamped? simulation.marking_clamps.places.include? self end |
#free? ⇒ Boolean
Is the place free in the current simulation?
49 50 51 |
# File 'lib/y_petri/simulation/place_representation.rb', line 49 def free? simulation.initial_markings.places.include? self end |
#initial_marking ⇒ Object
Initial marking value (or nil, if the place is free).
43 44 45 |
# File 'lib/y_petri/simulation/place_representation.rb', line 43 def initial_marking simulation.initial_marking( self ) if free? end |
#initial_marking=(value) ⇒ Object
Setter of initial marking.
30 31 32 |
# File 'lib/y_petri/simulation/place_representation.rb', line 30 def initial_marking=( value ) simulation.set_initial_marking( self, to: value ) end |
#m ⇒ Object Also known as: marking
Get the current marking of this place in the simulation.
73 74 75 |
# File 'lib/y_petri/simulation/place_representation.rb', line 73 def m m_vector[ self ] end |
#m=(value) ⇒ Object
Set the marking of this place in the simulation.
61 62 63 |
# File 'lib/y_petri/simulation/place_representation.rb', line 61 def m=( value ) m_vector.set self, value end |
#m_vector_index ⇒ Object
Index.
11 12 13 |
# File 'lib/y_petri/simulation/place_representation.rb', line 11 def m_vector_index places.index( self ) end |
#marking=(value) ⇒ Object
Alias of #m=
67 68 69 |
# File 'lib/y_petri/simulation/place_representation.rb', line 67 def marking=( value ) m=( value ) end |
#marking_clamp ⇒ Object Also known as: clamp
Marking clamp value (or nil, if the place is clamped).
36 37 38 |
# File 'lib/y_petri/simulation/place_representation.rb', line 36 def marking_clamp simulation.marking_clamp( self ) if clamped? end |