lib/y_petri.rb in y_petri-2.0.2 vs lib/y_petri.rb in y_petri-2.0.3
- old
+ new
@@ -1,7 +1,5 @@
-#encoding: utf-8
-
require 'gnuplot'
require 'csv'
require 'graphviz'
require 'y_support/local_object'
@@ -10,12 +8,12 @@
require 'y_support/unicode'
require 'y_support/typing'
require 'y_support/core_ext/hash'
require 'y_support/core_ext/array'
require 'y_support/stdlib_ext/matrix'
-
require 'y_support/abstract_algebra'
+require 'y_support/kde'
require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/array/extract_options'
require_relative 'y_petri/version'
@@ -44,12 +42,10 @@
# fluid transition between Fixnum and Bignum, there should be fluid
# transition between token amount representation as Integer (discrete) or
# Float (continuous) - the decision should be on the simulator.
#
module YPetri
- DEBUG = false
-
DEFAULT_SIMULATION_SETTINGS = lambda do
{ step_size: 0.02,
sampling_period: 2,
target_time: 60 }
end
@@ -64,78 +60,53 @@
singleton_class.instance_variable_set :@YPetriManipulator, Manipulator.new )
end
}
end
- delegate( :workspace,
- :place, :transition,
- :p, :t,
+ delegate( :workspace, to: :y_petri_manipulator )
+
+ # Petri net-related methods.
+ delegate( :Place, :Transition, :Net,
+ :place, :transition, :pl, :tr,
:places, :transitions, :nets,
- :simulations,
:pp, :tt, :nn,
+ :net_point,
+ :net_selection,
+ :net, :ne,
+ :net_point_reset,
+ :net_point_set,
+ to: :y_petri_manipulator )
+
+ # Simulation-related methods.
+ delegate( :simulation_point, :ssc_point, :cc_point, :imc_point,
+ :simulation_selection, :ssc_selection,
+ :cc_selection, :imc_selection,
+ :simulations,
:clamp_collections,
- :inital_marking_collections,
+ :initial_marking_collections,
:simulation_settings_collections,
+ :clamp_collection_names, :cc_names,
+ :initial_marking_collection_names, :imc_names,
+ :simulation_settings_collection_names, :ssc_names,
+ :set_clamp_collection, :set_cc,
+ :set_initial_marking_collection, :set_imc,
+ :set_simulation_settings_collection, :set_ssc,
+ :new_timed_simulation,
:clamp_cc, :initial_marking_cc, :simulation_settings_cc,
- :Place,
- :Transition,
- :Net,
- :net_point_reset,
- :net_point_to, :net→,
- :net,
- :simulation_point_reset,
- :simulation_point_to,
- :simulation,
:simulation_point_position,
- :cc_point_reset,
- :cc_point_to, :cc→,
+ :simulation,
:clamp_collection, :cc,
- :cc_point_position,
- :imc_point_reset,
- :imc_point_to, :imc→,
:initial_marking_collection, :imc,
- :imc_point_position,
- :ssc_point_reset,
- :ssc_point_to, :ssc→,
:simulation_settings_collection, :ssc,
- :ssc_point_position,
- :net_selection,
- :simulation_selection,
- :ssc_selection,
- :cc_selection,
- :imc_selection,
- :net_selection_clear,
- :net_select!,
- :net_select,
- :net_unselect,
- :simulation_selection_clear,
- :simulation_select!,
- :simulation_select,
- :simulation_unselect,
- :cc_selection_clear,
- :cc_select!,
- :cc_select,
- :cc_unselect,
- :imc_selection_clear,
- :imc_select!,
- :imc_select,
- :imc_unselect,
- :ssc_selection_clear,
- :ssc_select!,
- :ssc_select,
- :ssc_unselect,
:clamp,
- :initial_marking, :im,
- :set_step, :set_step_size,
- :set_time, :set_target_time,
- :set_sampling,
+ :initial_marking,
+ :set_step, :set_time, :set_sampling,
:set_simulation_method,
:new_timed_simulation,
:run!,
:print_recording,
:plot,
:plot_selected,
:plot_state,
:plot_flux,
- :plot_all,
to: :y_petri_manipulator )
end