<commit_before>/**
 * 
 */
package org.epics.css.dal.proxy;

import java.util.EnumSet;

import org.epics.css.dal.DynamicValueCondition;
import org.epics.css.dal.DynamicValueState;
import org.epics.css.dal.context.ConnectionState;

/**
 * This is state machine pattern implementation which helps plug implementator 
 * to properly track of changes of connection state   
 * @author ikriznar
 *
 */
public class ConnectionStateMachine {

	/*
	 * matrix of allowed state transitions
	 */
	private static boolean[][] transitions=
	{
						/* to  INITIA READY  CNTING CNCTED OPERAL CNLOST CNFAIL DSCING DSCTED DSTRED*/
/*   from INITIAL*/			  {false, true,  true,  false, false, false, false, false, false, true},
		/*READY*/			  {true,  false, true,  false, false, false, false, false, false, true},
		/*CONNECTING*/		  {false, false, false, true,  false, false, true,  false, false, true},
		/*CONNECTED*/		  {false, false, false, false, true,  true,  false, true,  false, false},
		/*OPERATIONAL*/		  {false, false, false, false, false, true,  false, true,  false, false},
		/*CONNECTION_LOST*/	  {false, false, false, true,  true,  false, false, true,  false, false},
		/*CONNECTION_FAILED*/ {true,  false, false, false, false, false, false, true,  false, true},
		/*DISCONNECTING*/ 	  {false, false, false, false, false, false, false, false, true,  false},
		/*DISCONNECTED*/ 	  {true,  true,  true,  false, false, false, false, false, false, true}, 
		/*DESTROYED*/		  {false, false, false, false, false, false, false, false, false, false}
	};

	/**
	 * Returns <code>true</code> if transition from state1 to state2 is allowed.
	 * @param state1 initial state
	 * @param state2 target state
	 * @return <code>true</code> if transition from state1 to state2 is allowed
	 */
	public static final boolean isTransitionAllowed(ConnectionState state1, ConnectionState state2) {<commit_msg>Allowed from ConnFail to Connected<commit_after>/**
 * 
 */
package org.epics.css.dal.proxy;

import java.util.EnumSet;

import org.epics.css.dal.DynamicValueCondition;
import org.epics.css.dal.DynamicValueState;
import org.epics.css.dal.context.ConnectionState;

/**
 * This is state machine pattern implementation which helps plug implementator 
 * to properly track of changes of connection state   
 * @author ikriznar
 *
 */
public class ConnectionStateMachine {

	/*
	 * matrix of allowed state transitions
	 */
	private static boolean[][] transitions=
	{
						/* to  INITIA READY  CNTING CNCTED OPERAL CNLOST CNFAIL DSCING DSCTED DSTRED*/
/*   from INITIAL*/			  {false, true,  true,  false, false, false, false, false, false, true},
		/*READY*/			  {true,  false, true,  false, false, false, false, false, false, true},
		/*CONNECTING*/		  {false, false, false, true,  false, false, true,  false, false, true},
		/*CONNECTED*/		  {false, false, false, false, true,  true,  false, true,  false, false},
		/*OPERATIONAL*/		  {false, false, false, false, false, true,  false, true,  false, false},
		/*CONNECTION_LOST*/	  {false, false, false, true,  true,  false, false, true,  false, false},
		/*CONNECTION_FAILED*/ {true,  false, false, true,  false, false, false, true,  false, true},
		/*DISCONNECTING*/ 	  {false, false, false, false, false, false, false, false, true,  false},
		/*DISCONNECTED*/ 	  {true,  true,  true,  false, false, false, false, false, false, true}, 
		/*DESTROYED*/		  {false, false, false, false, false, false, false, false, false, false}
	};

	/**
	 * Returns <code>true</code> if transition from state1 to state2 is allowed.
	 * @param state1 initial state
	 * @param state2 target state
	 * @return <code>true</code> if transition from state1 to state2 is allowed
	 */
	public static final boolean isTransitionAllowed(ConnectionState state1, ConnectionState state2) {
{'fraction_non_alphanumeric': 0.130377408287147, 'fraction_numerical': 0.00422275006598047, 'mean_word_length': 3.8341836734693877, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6005106', 'n_tokens_mistral': 1279, 'n_tokens_neox': 1202, 'n_words': 406}