/** *

Wrapper to hold the logic variables and the control function * that get updated at each communication round.

* * @author Michael Schuresko * @version %I%, %G% * @since 1.0 */ public class StateBundle { ILogicVarBundle m_logicVars; IControlFunc m_controlFunc; /** * */ public StateBundle() { m_logicVars = null; m_controlFunc = null; } /** * copy constructor */ public StateBundle(StateBundle src) { if(src != null && src.m_logicVars != null) { m_logicVars = src.m_logicVars.makeCopy(); } else { m_logicVars = null; } if(src != null && src.m_controlFunc != null) { m_controlFunc = src.m_controlFunc.makeCopy(); } else { m_controlFunc = null; } } /** * constructor with parameters. * Does not copy input parameters, simply points at them instead */ public StateBundle(ILogicVarBundle vars, IControlFunc func) { m_logicVars = vars; m_controlFunc = func; } public ILogicVarBundle getVars() { return m_logicVars; } public IControlFunc getControlFunc() { return m_controlFunc; } /** * @return this */ public StateBundle setVars(ILogicVarBundle logicVars) { m_logicVars = logicVars; return this; } /** * @return this */ public StateBundle setControlFunc(IControlFunc controlFunc) { m_controlFunc = controlFunc; return this; } /** * deep copy for state buncle (relies on deep copy for * IControlFunc.makeCopy() and ILogicVarBundle.makeCopy() ) */ StateBundle makeCopy() { return new StateBundle(this); } }