Sha256: 1027426df825a1c5cd1dace886d6da6bd021995426d3b03525d610cfc095e075

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

module Statemachine

  class Superstate < State #:nodoc:
  
    attr_accessor :startstate_id
    attr_reader :history_id
  
    def initialize(id, superstate, statemachine)
      super(id, superstate, statemachine)
      @startstate = nil
      @history_id = nil
    end
    
    def concrete?
      return false
    end

    def startstate
      return @statemachine.get_state(@startstate_id)
    end

    def resolve_startstate
      return startstate.resolve_startstate
    end

    def substate_exiting(substate)
      @history_id = substate.id
    end
  
    def add_substates(*substate_ids)
      do_substate_adding(substate_ids)
    end
    
    def default_history=(state_id)
      @history_id = @default_history_id = state_id
    end
    
    def reset
      @history_id = @default_history_id
    end

    def to_s
      return "'#{id}' superstate"
    end

    def abstract_states
      return [@id] if not @superstate or @superstate.is_parallel
      ([@id] + @superstate.abstract_states).uniq
    end

    def spontaneous_transition
     nil
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
MINT-statemachine-1.5.0 lib/statemachine/superstate.rb
MINT-statemachine-1.4.1 lib/statemachine/superstate.rb
MINT-statemachine-1.4.0 lib/statemachine/superstate.rb
MINT-statemachine-1.3.2 lib/statemachine/superstate.rb