import java.lang.Integer; import java.lang.Boolean; /** *
* Implementation of ILogicVarBundle for storing no variables. * Preferable to just passing a null pointer for correctness-checking * reasons. *
* @author Michael Schuresko * @version %I%, %G% * @since 1.0 */ class NullLogicVarBundle implements ILogicVarBundle { public NullLogicVarBundle() { m_nId = -1;} public NullLogicVarBundle(int nId) { m_nId = nId; } public NullLogicVarBundle(NullLogicVarBundle src) { m_nId = src.m_nId; } /** * makes a copy and returns it */ public ILogicVarBundle makeCopy() { return new NullLogicVarBundle(this); } /** * Does nothing, for the time being. */ public void init() { } /** * gets an Integer (wrapping an int) referred to by an object. * returns null if refObject is of invalid type * or indexes an invalid logic var. * * Note: The original specification only allowed boolean * variables in this place. Obviously some applications may * want to use collections of boolean variables to represent * integers over a finite fixed range, or rationals with * finite fixed precision over a finite fixed range. * This function is merely provided as a shortcut towards this end. */ public Integer getIntVar(Object refObject) { return null; } /** * Removes any values indexed by refObject * @param refObject remove values associated with this. */ public void removeVar(Object refObject) { return; } /** * inserts an integer value (see getIntvar). Returns false * if this insert was not permitted * @see getIntVar */ public boolean insertIntVar(Object refObject, int nValue) { return false; } /** * gets a Boolean (wrapping a boolean) referred to by an object. * returns null if refObject is of invalid type * or indexes an invalid logic var. */ public Boolean getBoolVar(Object refObject) { return null; } /** * inserts an boolean value (see getBoolVar). Returns false * if this insert was not permitted * @see getBoolVar */ public boolean insertBoolVar(Object refObject, boolean bValue) { return false; } int m_nId; /** * Gets unique Id of this agent */ public int getId() { return m_nId; } /** * Sets unique Id of this agent */ public void setId(int nId) { m_nId = nId; } }