lib/fathom.rb in fathom-0.3.7 vs lib/fathom.rb in fathom-0.5.0

- old
+ new

@@ -1,103 +1,66 @@ # ================ # = Dependencies = # ================ +Dir.glob("#{File.dirname(__FILE__)}/ext/*.rb").each { |file| require file} -# Make decoupling easier with an informed LoadPath -$:.unshift(File.dirname(__FILE__)) -$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), 'fathom'))) +require 'uuid' -require 'rubygems' - -require "gsl" -require 'options_hash' - -require 'ext/open_struct' -require 'ext/array' -require 'ext/string' - module Fathom - lib = File.expand_path(File.dirname(__FILE__)) - $LOAD_PATH.unshift(lib) - # Autoload classes and modules so that we only load as much of the library as we're using. - # This allows us to have a fairly large library without taking up a lot of memory unless we need it. - # autoload :Node, "node" - # autoload :BeliefNode, "node/belief_node" - # autoload :DataCollection, "node/data_collection" - # autoload :DataNode, "node/data_node" - # autoload :DiscreteNode, "node/discrete_node" - # autoload :MCNode, "node/mc_node" - # autoload :PlausibleRange, "node/plausible_range" - # autoload :Fact, "node/fact" - # autoload :Decision, "node/decision" - # autoload :CPMNode, 'node/cpm_node' - # - # autoload :ValueDescription, "value_description" - # autoload :MonteCarloSet, "monte_carlo_set" - # autoload :KnowledgeBase, "knowledge_base" - # - # autoload :Import, "import" - # autoload :ImportNode, "import/import_node" - # autoload :YAMLImport, 'import/yaml_import' - # autoload :CSVImport, 'import/csv_import' - # # autoload :RDFImport, 'import/rdf_import' - # # autoload :SQLiteImport, 'import/sqlite_import' - # - # autoload :Simulation, 'simulation' - # autoload :TickMethods, 'simulation/tick_methods' - # autoload :TickSimulation, 'simulation/tick_simulation' - # - # autoload :Agent, 'agent' - # autoload :Properties, 'agent/properties' - # autoload :AgentCluster, 'agent/agent_cluster' - # - # autoload :EnforcedName, 'node/node_extensions/enforced_name' - # autoload :NumericMethods, 'node/node_extensions/numeric_methods' + class Config + attr_writer :storage + def storage + @storage ||= Hash + end + end - require 'distributions' - module Distributions - autoload :Gaussian, 'distributions/gaussian' - autoload :Uniform, 'distributions/uniform' - autoload :DiscreteGaussian, 'distributions/discrete_gaussian' - autoload :DiscreteUniform, 'distributions/discrete_uniform' + # ================= + # = Configuration = + # ================= + class << self + # A reset-able configuration that provides access to other services (pod storage, say) + def config + @config ||= Config.new + end + + # The reset on the configuration + def reset_config! + @config = Config.new + end end + +end - def knowledge_base - @knowledge_base ||= KnowledgeBase.new - end - alias :kb :knowledge_base +def path(path) + File.expand_path("../fathom/#{path}", __FILE__) end -# Temporary -# include Fathom +# ============= +# = Behaviors = +# ============= +Fathom.autoload :AttributeSystem, path('behaviors/attribute_system') +Fathom.autoload :ContextBehavior, path('behaviors/context_behavior') +Fathom.autoload :Plugins, path('behaviors/plugins') -Fathom.autoload :Node, "node" -Fathom.autoload :BeliefNode, "node/belief_node" -Fathom.autoload :DataCollection, "node/data_collection" -Fathom.autoload :DataNode, "node/data_node" -Fathom.autoload :DiscreteNode, "node/discrete_node" -Fathom.autoload :MCNode, "node/mc_node" -Fathom.autoload :PlausibleRange, "node/plausible_range" -Fathom.autoload :Fact, "node/fact" -Fathom.autoload :Decision, "node/decision" -Fathom.autoload :CPMNode, 'node/cpm_node' +# =============== +# = Data Models = +# =============== +Fathom.autoload :AdjacencyMatrix, path('data/adjacency_matrix') +Fathom.autoload :Definition, path('data/definition') +Fathom.autoload :Edge, path('data/edge') +Fathom.autoload :Network, path('data/network') +Fathom.autoload :Outcome, path('data/outcome') +Fathom.autoload :Property, path('data/property') +Fathom.autoload :Variable, path('data/variable') -Fathom.autoload :ValueDescription, "value_description" -Fathom.autoload :MonteCarloSet, "monte_carlo_set" -Fathom.autoload :KnowledgeBase, "knowledge_base" +# ============ +# = Contexts = +# ============ +Fathom.autoload :NetworkPopulation, path('contexts/network_population') +Fathom.autoload :NetworkTraversal, path('contexts/network_traversal') -Fathom.autoload :Import, "import" -Fathom.autoload :ImportNode, "import/import_node" -Fathom.autoload :YAMLImport, 'import/yaml_import' -Fathom.autoload :CSVImport, 'import/csv_import' - -Fathom.autoload :Simulation, 'simulation' -Fathom.autoload :TickMethods, 'simulation/tick_methods' -Fathom.autoload :TickSimulation, 'simulation/tick_simulation' - -Fathom.autoload :Agent, 'agent' -Fathom.autoload :Properties, 'agent/properties' -Fathom.autoload :AgentCluster, 'agent/agent_cluster' - -Fathom.autoload :EnforcedName, 'node/node_extensions/enforced_name' -Fathom.autoload :NumericMethods, 'node/node_extensions/numeric_methods' +# ========= +# = Roles = +# ========= +Fathom.autoload :NetworkBuilder, path('roles/network_builder') +Fathom.autoload :GeneralGraphTools, path('roles/general_graph_tools')