Sha256: 1153b95b4d7eb3b6390a8c86c531f99058d032944211f654f548e8c1f078162b

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 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
  
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
MINT-statemachine-1.2.3 lib/statemachine/superstate.rb
MINT-statemachine-1.2.2 lib/statemachine/superstate.rb