<commit_before>import 'state.dart';
import 'dart:async';

class StateManager{
  
  Map<String,State> _stateMap;
  State _currentState;
  StreamSubscription _currentSubscription;
  
  StateManager(){
    
    _stateMap = new Map<String,State>();                  
  }
  
  void addState(String name,State state){
    _stateMap[name]=state;
  }
  
  void addStateMap(Map<String,State> map){
    _stateMap.addAll(map);
  }
  
  void initState(String state){
    _currentState = _stateMap[state];
    _currentSubscription = _currentState.listen((message){print("Message: $message");},
            onDone: onDoneHandler);

    //Testing pause-resume
    _currentSubscription.pause();
    new Timer(const Duration(seconds: 1), _currentSubscription.resume);
  }
  
  void onDoneHandler(){
      if(_currentState.nextState != null){
        print("Next State"); 
        nextState();
      }else{
        print("The End");
      }
    }
  
  void nextState(){
    _currentState = _stateMap[_currentState.nextState];
    _currentSubscription = _currentState.listen((message){print("Message: $message");},
        onDone: onDoneHandler);
  }
  
  
}<commit_msg>removed test added 2 functions for state manipulation<commit_after>import 'state.dart';
import 'dart:async';

class StateManager{
  
  Map<String,State> _stateMap;
  State _currentState;
  StreamSubscription _currentSubscription;
  
  StateManager(){
    
    _stateMap = new Map<String,State>();                  
  }
  
  void addState(String name,State state){
    _stateMap[name]=state;
  }
  
  void addStateMap(Map<String,State> map){
    _stateMap.addAll(map);
  }
  
  void initState(String state){
    _currentState = _stateMap[state];
    _currentSubscription = _currentState.listen((message){print("Message: $message");},
            onDone: onDoneHandler);
  }
  
  void onDoneHandler(){
      if(_currentState.nextState != null){
        print("Next State"); 
        nextState();
      }else{
        print("The End");
      }
    }
  
  void nextState(){
    _currentState = _stateMap[_currentState.nextState];
    _currentSubscription = _currentState.listen((message){print("Message: $message");},
        onDone: onDoneHandler);
  }

	void pauseState(){
		_currentSubscription.pause();
	}

	void resumeState(){
		_currentSubscription.resume();
	}
  
  
}
{'fraction_non_alphanumeric': 0.12446167097329888, 'fraction_numerical': 0.0008613264427217916, 'mean_word_length': 3.239051094890511, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5484707', 'n_tokens_mistral': 717, 'n_tokens_neox': 717, 'n_words': 129}