Sha256: 5ea7eb958e275305e5874a6d973ec0f50f8f9a75d4a868964fd32c978ab876c7

Contents?: true

Size: 1.17 KB

Versions: 34

Compression:

Stored size: 1.17 KB

Contents

#encoding: utf-8

require_relative 'a'
require_relative 'A'
require_relative 't'
require_relative 'T'
require_relative 's'
require_relative 'S'
require_relative 'ts'
require_relative 'Ts'
require_relative 'tS'
require_relative 'TS'

# A mixin with transition types.
# 
class YPetri::Simulation::TransitionRepresentation
  module Types
    attr_reader :type

    def type_init *args
      extend case source.type
             when :A then Type_A
             when :TS then Type_TS
             when :Ts then Type_Ts
             when :tS then Type_tS
             when :ts then Type_ts
             else fail TypeError, "Unknown tr. type #{source.type}!" end
      init
    end

    # The transition's type.
    # 
    def type
      return :A if A?
      if T? then S? ? :TS : :Ts else S? ? :tS : :ts end
    end

    # Is this a TS transition?
    # 
    def TS?
      type == :TS
    end

    # Is this a Ts transition?
    # 
    def Ts?
      type == :Ts
    end

    # Is this a tS transition?
    # 
    def tS?
      type == :tS
    end

    # Is this a ts transition?
    # 
    def ts?
      type == :ts
    end
  end # module Types
end # class YPetri::Simulation::TransitionRepresentation

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
y_petri-2.2.4 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.2.3 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.2.2 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.2.1 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.2.0 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.51 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.50 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.49 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.48 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.47 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.46 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.45 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.44 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.42 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.40 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.39 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.37 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.36 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.35 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.34 lib/y_petri/simulation/transition_representation/types.rb