y_petri 2.4.3 → 2.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 06d8f9b1a6908fc67194dfd3191b23507f464902
4
- data.tar.gz: 48003b2be2c2ec91037fff8da8af9105db5a2e1a
3
+ metadata.gz: c63e099442746fc3480cc52b48b42e861628a4ce
4
+ data.tar.gz: ca4e673252e6d4f6423de630b42c3ebaef6a1900
5
5
  SHA512:
6
- metadata.gz: 36b5c04eba5b0890245f665d2275aa27668e8bec8080cf26b211e4b061302a7358bf7537b41d1acb9c81ea841680cb0b56075e170f79c78b34de77dbddffb88a
7
- data.tar.gz: 7bed185007a8c5cbc55da85f8e654678a359c3f7d8157c8abe651f8d6735b1950e90e62bcbff2f1eb0323ebd747c487d7e6e4f60d7f94c0961c5eea55580a74a
6
+ metadata.gz: fa7d484e3812dc8f8cf049a07c387d62742081921995c0b60912eaa4de17c5f6fd95e5c74debd34cc1318b108aba53fc75137f837a7e3593aa205be3251618cf
7
+ data.tar.gz: 6db8186f8252fb678dae074bd418e430c254e458b4b63ca4953c87bf3261e948e8843abf1cbb20ec2e61ad0a7395065277e871a243605dc5ee3f214e568b287c
@@ -65,7 +65,7 @@ class YPetri::Net::State::Feature::Assignment < YPetri::Net::State::Feature
65
65
  # The constructor of an assignment feature takes 1 ordered and 1 named
66
66
  # (+:transition+) argument, which must identify the place and the transitions.
67
67
  #
68
- def initialize place, transition: transition
68
+ def initialize place, transition: transition()
69
69
  @place = net.place( place )
70
70
  @transition = net.transition( transition )
71
71
  @place_index_in_codomain = @transition.codomain.index( @place ) or
@@ -206,7 +206,7 @@ class YPetri::Simulation
206
206
  # of the new instance is the same as the creator's. Arguments can partially or
207
207
  # wholly modify the attributes of the duplicate.
208
208
  #
209
- def dup( marking: marking, recording: recording, **named_args )
209
+ def dup( marking: marking(), recording: recording(), **named_args )
210
210
  named_args.reverse_merge! settings( true )
211
211
  self.class.new( named_args ).tap do |duplicate|
212
212
  duplicate.recorder.reset! recording: recording
@@ -190,7 +190,7 @@ module YPetri::Simulation::Timed
190
190
  # Customized dup method that allows to modify the attributes of
191
191
  # the duplicate upon creation.
192
192
  #
193
- def dup time: time, **named_args
193
+ def dup time: time(), **named_args
194
194
  super( **named_args ).tap { |instance| instance.reset_time! time }
195
195
  end
196
196
 
@@ -3,6 +3,12 @@
3
3
  # Mixin for the transitions with assignment action.
4
4
  #
5
5
  module YPetri::Transition::Type_A
6
+ # For assignment transitions, "function" refers to their action closure.
7
+ #
8
+ def function
9
+ action_closure
10
+ end
11
+
6
12
  # Transition's action (before validation).
7
13
  #
8
14
  def action
@@ -3,6 +3,12 @@
3
3
  # Mixin for timed Petri net transitions.
4
4
  #
5
5
  module YPetri::Transition::Type_T
6
+ # For timed transitions, "function" refers to their rate closure.
7
+ #
8
+ def function
9
+ rate_closure
10
+ end
11
+
6
12
  # Transition's action (before validation). Requires Δt as an argument.
7
13
  #
8
14
  def action Δt
@@ -1,8 +1,14 @@
1
1
  # encoding: utf-8
2
2
 
3
- # Mixin for timed non-assignment timeless Petri net transitions.
3
+ # Mixin for timeless non-assignment Petri net transitions.
4
4
  #
5
5
  module YPetri::Transition::Type_t
6
+ # For timeless transitions, "function" refers to their action closure.
7
+ #
8
+ def function
9
+ action_closure
10
+ end
11
+
6
12
  # Result of the transition's "function", regardless of the #enabled? status.
7
13
  #
8
14
  def action
@@ -1,4 +1,4 @@
1
1
  module YPetri
2
- VERSION = "2.4.3"
2
+ VERSION = "2.4.4"
3
3
  DEBUG = false
4
4
  end
@@ -72,6 +72,7 @@ describe ::YPetri::Transition do
72
72
  @t1.codomain_marking.must_equal [ @p1.marking, @p3.marking ]
73
73
  @t1.domain_marking.must_equal [@p2.marking ]
74
74
  @t1.zero_action.must_equal [0, 0]
75
+ @t1.action_closure.must_equal @t1.function
75
76
  end
76
77
  end
77
78
 
@@ -103,6 +104,7 @@ describe ::YPetri::Transition do
103
104
  [ @p1.marking, @p5.marking ].must_equal [2, 4]
104
105
  @t2.fire!
105
106
  [ @p1.marking, @p5.marking ].must_equal [3, 3]
107
+ @t1.action_closure.must_equal @t1.function
106
108
  end
107
109
  end
108
110
 
@@ -120,6 +122,7 @@ describe ::YPetri::Transition do
120
122
  @t1.domain.must_equal [@p5]
121
123
  [ @p1.marking, @p5.marking ].must_equal [1, 5]
122
124
  @t1.rate_closure.arity.must_equal 0
125
+ @t1.rate_closure.must_equal @t1.function
123
126
  @t1.fire! 0.5
124
127
  [ @p1.marking, @p5.marking ].must_equal [1.5, 4.5]
125
128
  end
@@ -158,6 +161,7 @@ describe ::YPetri::Transition do
158
161
  assert_in_epsilon 1.63, @p2.marking, 1e-15
159
162
  assert_in_epsilon 3.4, @p3.marking, 1e-15
160
163
  assert_in_epsilon 4.37, @p4.marking, 1e-15
164
+ @TS1.rate_closure.must_equal @TS1.function
161
165
  end
162
166
  end
163
167
  end
@@ -219,6 +223,7 @@ describe "upstream and downstream reference mτs of places and transitions" do
219
223
  assert @t.assignment_action?
220
224
  @t.domain.must_equal []
221
225
  @t.action_closure.arity.must_equal 0
226
+ @t.action_closure.must_equal @t.function
222
227
  @t.fire!
223
228
  @p.marking.must_equal 1
224
229
  end
@@ -7,8 +7,6 @@ require_relative '../lib/y_petri' # tested component itself
7
7
  # require 'y_petri'
8
8
  # require 'sy'
9
9
 
10
- include Pyper if require 'pyper'
11
-
12
10
  describe YPetri::World do
13
11
  before do
14
12
  @w = YPetri::World.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: y_petri
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.3
4
+ version: 2.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - boris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-22 00:00:00.000000000 Z
11
+ date: 2016-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -283,7 +283,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
283
283
  version: '0'
284
284
  requirements: []
285
285
  rubyforge_project:
286
- rubygems_version: 2.2.2
286
+ rubygems_version: 2.5.1
287
287
  signing_key:
288
288
  specification_version: 4
289
289
  summary: Systems modelling and simulation gem. Biologically inspired, but concerns