// Path: statefulj-fsm/src/main/java/org/statefulj/fsm/model/Action.java
// public interface Action<T> {
// 
// 	/**
// 	 * Called to execute an action based off a State Transition.
// 	 *
// 	 * @param stateful The Stateful Entity
// 	 * @param event The ocurring Event
// 	 * @param args A set of optional arguments passed into the onEvent method of the {@link org.statefulj.fsm.FSM}
// 	 * @throws RetryException thrown when the event must be retried due to Stale state or some other error condition
// 	 */
// 	void execute(T stateful, String event, Object ... args) throws RetryException;
// 
// }
// 
// Path: statefulj-fsm/src/main/java/org/statefulj/fsm/model/State.java
// public interface State<T> {
// 
// 	/**
// 	 * Name of the State.  This value is persisted as the State value in the Stateful Entity.
// 	 *
// 	 * @return Name of the State
// 	 */
// 	String getName();
// 
// 	/**
// 	 * Returns the Transition for an Event
// 	 *
// 	 * @param event The event
// 	 * @return The Transition for this event
// 	 *
// 	 */
// 	Transition<T> getTransition(String event);
// 
// 	/**
// 	 * Whether this State is an End State
// 	 *
// 	 * @return if true, then this is an End State
// 	 */
// 	boolean isEndState();
// 
// 	/**
// 	 * Whether this is a Blocking State.  If Blocking, event will not process unless there is an explicit Transition for the
// 	 * event.  If blocked, the FSM will retry the event until the FSM transitions out of the blocked State
// 	 *
// 	 * @return if true, then State is a "blocking" state
// 	 */
// 	public boolean isBlocking();
// 
// 	/**
// 	 * Set whether or not this is a Blocking State
// 	 *
// 	 * @param isBlocking if true, then this is a blocking State
// 	 */
// 	public void setBlocking(boolean isBlocking);
// 
// 	/**
// 	 * Remove a Transition from the State
// 	 *
// 	 * @param event Remove the transition for this Event
// 	 */
// 	public void removeTransition(String event);
// 
// 	/**
// 	 * Add a {@link org.statefulj.fsm.model.Transition}
// 	 *
// 	 * @param event The event to add the {@link org.statefulj.fsm.model.Transition}
// 	 * @param transition The {@link org.statefulj.fsm.model.Transition}
// 	 */
// 	public void addTransition(String event, Transition<T> transition);
// 
// 	/**
// 	 * Add a deterministic Transition with an Action
// 	 *
// 	 * @param event The event to add the {@link org.statefulj.fsm.model.Transition}
// 	 * @param next The next State
// 	 * @param action The resulting {@link org.statefulj.fsm.model.Action}
// 	 */
// 	public void addTransition(String event, State<T> next, Action<T> action);
// 
// 	/**
// 	 * Add a deterministic Transition with no Action
// 	 *
// 	 * @param event The event to add the {@link org.statefulj.fsm.model.Transition}
// 	 * @param next The next State
// 	 */
// 	public void addTransition(String event, State<T> next);
// 
// }
// 
// Path: statefulj-fsm/src/main/java/org/statefulj/fsm/model/StateActionPair.java
// public interface StateActionPair<T> {
// 	
// 	/**
// 	 * @return the {@link org.statefulj.fsm.model.State}
// 	 */
// 	State<T> getState();
// 
// 	/**
// 	 * @return {@link org.statefulj.fsm.model.Action}
// 	 */
// 	Action<T> getAction();
// 	
// }
// 
// Path: statefulj-fsm/src/main/java/org/statefulj/fsm/model/Transition.java
// public interface Transition<T> {
// 
// 	/**
// 	 * Return the {@link org.statefulj.fsm.model.StateActionPair}
// 	 *
// 	 * @param stateful the Stateful Entity
// 	 *
// 	 * @return the {@link org.statefulj.fsm.model.StateActionPair}
// 	 * @param event The occurring Event
// 	 * @param args Optional parameters that was passed into the FSM
// 	 *
// 	 * @throws RetryException is thrown if there is an error determining the next State and Action and the FSM should
// 	 *         re-process the event
// 	 */
// 	StateActionPair<T> getStateActionPair(T stateful, String event, Object ... args) throws RetryException;
// }


import org.statefulj.fsm.model.Action;
import org.statefulj.fsm.model.State;
import org.statefulj.fsm.model.StateActionPair;
import org.statefulj.fsm.model.Transition;
/***
 *
 * Copyright 2014 Andrew Hall
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package org.statefulj.fsm.model.impl;


public class DeterministicTransitionImpl<T> implements Transition<T> {

	private StateActionPair<T> stateActionPair;

	public DeterministicTransitionImpl(State<T> from, State<T> to, String event) {
		stateActionPair = new StateActionPairImpl<T>(to, null);
		from.addTransition(event, this);
	}

// Path: statefulj-fsm/src/main/java/org/statefulj/fsm/model/Action.java
// public interface Action<T> {
// 
// 	/**
// 	 * Called to execute an action based off a State Transition.
// 	 *
// 	 * @param stateful The Stateful Entity
// 	 * @param event The ocurring Event
// 	 * @param args A set of optional arguments passed into the onEvent method of the {@link org.statefulj.fsm.FSM}
// 	 * @throws RetryException thrown when the event must be retried due to Stale state or some other error condition
// 	 */
// 	void execute(T stateful, String event, Object ... args) throws RetryException;
// 
// }
// 
// Path: statefulj-fsm/src/main/java/org/statefulj/fsm/model/State.java
// public interface State<T> {
// 
// 	/**
// 	 * Name of the State.  This value is persisted as the State value in the Stateful Entity.
// 	 *
// 	 * @return Name of the State
// 	 */
// 	String getName();
// 
// 	/**
// 	 * Returns the Transition for an Event
// 	 *
// 	 * @param event The event
// 	 * @return The Transition for this event
// 	 *
// 	 */
// 	Transition<T> getTransition(String event);
// 
// 	/**
// 	 * Whether this State is an End State
// 	 *
// 	 * @return if true, then this is an End State
// 	 */
// 	boolean isEndState();
// 
// 	/**
// 	 * Whether this is a Blocking State.  If Blocking, event will not process unless there is an explicit Transition for the
// 	 * event.  If blocked, the FSM will retry the event until the FSM transitions out of the blocked State
// 	 *
// 	 * @return if true, then State is a "blocking" state
// 	 */
// 	public boolean isBlocking();
// 
// 	/**
// 	 * Set whether or not this is a Blocking State
// 	 *
// 	 * @param isBlocking if true, then this is a blocking State
// 	 */
// 	public void setBlocking(boolean isBlocking);
// 
// 	/**
// 	 * Remove a Transition from the State
// 	 *
// 	 * @param event Remove the transition for this Event
// 	 */
// 	public void removeTransition(String event);
// 
// 	/**
// 	 * Add a {@link org.statefulj.fsm.model.Transition}
// 	 *
// 	 * @param event The event to add the {@link org.statefulj.fsm.model.Transition}
// 	 * @param transition The {@link org.statefulj.fsm.model.Transition}
// 	 */
// 	public void addTransition(String event, Transition<T> transition);
// 
// 	/**
// 	 * Add a deterministic Transition with an Action
// 	 *
// 	 * @param event The event to add the {@link org.statefulj.fsm.model.Transition}
// 	 * @param next The next State
// 	 * @param action The resulting {@link org.statefulj.fsm.model.Action}
// 	 */
// 	public void addTransition(String event, State<T> next, Action<T> action);
// 
// 	/**
// 	 * Add a deterministic Transition with no Action
// 	 *
// 	 * @param event The event to add the {@link org.statefulj.fsm.model.Transition}
// 	 * @param next The next State
// 	 */
// 	public void addTransition(String event, State<T> next);
// 
// }
// 
// Path: statefulj-fsm/src/main/java/org/statefulj/fsm/model/StateActionPair.java
// public interface StateActionPair<T> {
// 	
// 	/**
// 	 * @return the {@link org.statefulj.fsm.model.State}
// 	 */
// 	State<T> getState();
// 
// 	/**
// 	 * @return {@link org.statefulj.fsm.model.Action}
// 	 */
// 	Action<T> getAction();
// 	
// }
// 
// Path: statefulj-fsm/src/main/java/org/statefulj/fsm/model/Transition.java
// public interface Transition<T> {
// 
// 	/**
// 	 * Return the {@link org.statefulj.fsm.model.StateActionPair}
// 	 *
// 	 * @param stateful the Stateful Entity
// 	 *
// 	 * @return the {@link org.statefulj.fsm.model.StateActionPair}
// 	 * @param event The occurring Event
// 	 * @param args Optional parameters that was passed into the FSM
// 	 *
// 	 * @throws RetryException is thrown if there is an error determining the next State and Action and the FSM should
// 	 *         re-process the event
// 	 */
// 	StateActionPair<T> getStateActionPair(T stateful, String event, Object ... args) throws RetryException;
// }


// Path: statefulj-fsm/src/main/java/org/statefulj/fsm/model/impl/DeterministicTransitionImpl.java
import org.statefulj.fsm.model.Action;
import org.statefulj.fsm.model.State;
import org.statefulj.fsm.model.StateActionPair;
import org.statefulj.fsm.model.Transition;

/***
 *
 * Copyright 2014 Andrew Hall
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package org.statefulj.fsm.model.impl;


public class DeterministicTransitionImpl<T> implements Transition<T> {

	private StateActionPair<T> stateActionPair;

	public DeterministicTransitionImpl(State<T> from, State<T> to, String event) {
		stateActionPair = new StateActionPairImpl<T>(to, null);
		from.addTransition(event, this);
	}

	public DeterministicTransitionImpl(State<T> from, State<T> to, String event, Action<T> action) {