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.1.33 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.31 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.30 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.26 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.25 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.24 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.22 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.21 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.20 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.18 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.17 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.16 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.12 lib/y_petri/simulation/transition_representation/types.rb
y_petri-2.1.11 lib/y_petri/simulation/transition_representation/types.rb