<commit_before>/**
 * Program state management
 * 
 * 
 */
App.state = {
	/**
	 * Wraps makeFirstResponder. Transitions to a given state. Apart from making
	 * the state the first responder, this function is also setting the state
	 * name as a URL location This function is called by the routeHandler when
	 * the URL changes as well as any space where a state change is made.
	 * 
	 * @param stateName
	 * @returns
	 */
	transitionTo: function(state) {			
		if( SC.typeOf(state) === SC.T_HASH ) {
			state = state.location;
		}
		
		if( SC.typeOf(state) === SC.T_STRING ) {
			// Is there such a state?
		    if (!App.state.hasOwnProperty(state)) {
		    	console.log("App.state.transitionTo can't find state %@. Will transition to state START"
								.fmt(state));
		    	state = App.state.START;
		    }
		    else {
		    	// get the object by name
		    	state = App.state[state];
		    }
		}

		// Already in this state? Do nothing then.
		if( App.firstResponder && App.firstResponder === state)
			return state;
		
	    SC.routes.set('location', state.get('name'));
	    document.title = state.get('name');

	    App.makeFirstResponder(state);
		return state;
	},

	/**
	 * Single route handles that gets all route changes. The route name (URL's
	 * fragment) is assumed to be the state name. This routing handler as was<commit_msg>instrumentation<commit_after>/**
 * Program state management
 * 
 * 
 */

App.state = {
	/**
	 * Wraps makeFirstResponder. Transitions to a given state. Apart from making
	 * the state the first responder, this function is also setting the state
	 * name as a URL location This function is called by the routeHandler when
	 * the URL changes as well as any space where a state change is made.
	 * 
	 * @param stateName
	 * @returns
	 */
	transitionTo: function(state) {	
		console.log('transitionTo ' + state);
		if( SC.typeOf(state) === SC.T_HASH ) {
			state = state.location;
		}
		
		if( SC.typeOf(state) === SC.T_STRING ) {
			// Is there such a state?
		    if (!App.state.hasOwnProperty(state)) {
		    	console.log("App.state.transitionTo can't find state %@. Will transition to state START"
								.fmt(state));
		    	state = App.state.START;
		    }
		    else {
		    	// get the object by name
		    	state = App.state[state];
		    }
		}

		// Already in this state? Do nothing then.
		if( App.firstResponder && App.firstResponder === state)
			return state;
		
	    SC.routes.set('location', state.get('name'));
	    document.title = state.get('name');

	    App.makeFirstResponder(state);
		return state;
	},

	/**
	 * Single route handles that gets all route changes. The route name (URL's
	 * fragment) is assumed to be the state name. This routing handler as was
{'fraction_non_alphanumeric': 0.1149467499081895, 'fraction_numerical': 0.0, 'mean_word_length': 2.72640218878249, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5309952', 'n_tokens_mistral': 943, 'n_tokens_neox': 803, 'n_words': 279}