def fire(clock = 0)

      # Marking is shuffled each time before it is
      # used so here we can take first found binding
      mapping = Enumerator.new do |y|
                  get_sentry.call(input_markings, clock, y)
                end.first

      return false if mapping.nil?

      tcpn_binding = TCPNBinding.new mapping, input_markings

      call_callbacks :before, Event.new(@name, tcpn_binding, clock, @net)

      tokens_for_outputs = @outputs.map do |o|
        o.block.call(tcpn_binding, clock)
      end

      mapping.each do |place_name, token|
        unless token.kind_of? Token
          t = if token.instance_of? Array
                token
              else
                [ token ]
              end
          t.each do |t|
            unless t.kind_of? Token
              raise InvalidToken.new("#{t.inspect} put by sentry for transition `#{name}` in binding for `#{place_name}`")
            end
          end
        end
        deleted = find_input(place_name).delete(token)
        if deleted.nil?
          raise InvalidToken.new("#{token.inspect} put by sentry for transition `#{name}` does not exists in `#{place_name}`")
        end
      end

      @outputs.each do |o|
        token = tokens_for_outputs.shift
        o.place.add token unless token.nil?
      end

      call_callbacks :after, Event.new(@name, mapping, clock, @net)

      true
    rescue InvalidToken
      raise
    rescue RuntimeError => e
      raise FiringError.new(self, e)
    end
def fire(clock = 0)

      # Marking is shuffled each time before it is
      # used so here we can take first found binding
      mapping = Enumerator.new do |y|
                  get_sentry.call(input_markings, clock, y)
                end.first

      return false if mapping.nil?

      tcpn_binding = TCPNBinding.new mapping, input_markings

      call_callbacks :before, Event.new(@name, tcpn_binding, clock, @net)

      tokens_for_outputs = @outputs.map do |o|
        o.block.call(tcpn_binding, clock)
      end

      mapping.each do |place_name, token|
        unless token.kind_of? Token
          t = if token.instance_of? Array
                token
              else
                [ token ]
              end
          t.each do |t|
            unless t.kind_of? Token
              raise InvalidToken.new("#{t.inspect} put by sentry for transition `#{name}` in binding for `#{place_name}`")
            end
          end
        end
        deleted = find_input(place_name).delete(token)
        if deleted.nil?
          raise InvalidToken.new("#{token.inspect} put by sentry for transition `#{name}` does not exists in `#{place_name}`")
        end
      end

      @outputs.each do |o|
        token = tokens_for_outputs.shift
        o.place.add token unless token.nil?
      end

      call_callbacks :after, Event.new(@name, mapping, clock, @net)

      true
    rescue InvalidToken
      raise
    rescue RuntimeError => e
      raise FiringError.new(self, e)
    end
fire this transition if possible
 returns true if fired false otherwise