|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mbs.services.cu.generator.DefaultControlUnitModel
public class DefaultControlUnitModel
Default implementation of ControlUnitModel
interface.
| Field Summary | |
|---|---|
protected CUAdminCallback |
callback
Reference to CUAdminCallback instance |
protected java.lang.String |
id
the control unit type for which this object is model |
protected java.util.Hashtable |
stateVarValues
a Hashtable with the state var values. |
protected java.lang.String |
type
the control unit id for which this object is model |
| Constructor Summary | |
|---|---|
DefaultControlUnitModel(java.lang.String type,
java.lang.String id)
Constructs the model. |
|
| Method Summary | |
|---|---|
CUAdminCallback |
getControlUnitCallback()
Returns control unit callback. |
java.lang.String |
getId()
Returns the CU Id for which this object is model. |
protected java.util.Hashtable |
getModelInitValues(java.util.Hashtable table)
This method is invoked when the model is created or the model is reset. |
java.lang.String |
getType()
Returns the CU TYPE for which this object is model. |
java.lang.Object |
queryStateVariable(java.lang.String varId)
Retrieves state variable value by its Id. |
void |
release()
Free the resources for the model. |
void |
reset()
Resets the model. |
void |
setControlUnitCallback(CUAdminCallback callback)
|
protected void |
updateStateVariableList()
This methods is called in the constructor of the class. |
boolean |
updateSV(java.lang.String stateVarId,
java.lang.Object stateVarValue)
Check if the old value of the state variable stateVarId is different from the new one and notify all listeners that have registered interest in the state var with the given id. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Hashtable stateVarValues
protected java.lang.String type
protected java.lang.String id
protected CUAdminCallback callback
| Constructor Detail |
|---|
public DefaultControlUnitModel(java.lang.String type,
java.lang.String id)
type - type of the control unitid - id of the control unit| Method Detail |
|---|
protected void updateStateVariableList()
stateVarValues hashtable into a String array
and put that array back in the hashtable under the key
ControlConstants.SV_LIST_SV_ID.
Note: ControlConstants.SV_LIST_SV_ID is not
included in the array.
Note: If you add/remove values in the stateVarValues
hashtable outside of the getModelInitValues method, be aware
to call this method to update the state variable list.
public boolean updateSV(java.lang.String stateVarId,
java.lang.Object stateVarValue)
stateVarValue parameter is null,
then listeners receive event for the current value of the model.
updateSV in interface ControlUnitModelstateVarId - state variable IdstateVarValue - a new value for the state variable, may be null
true if state variable event is sent, otherwise false
public java.lang.Object queryStateVariable(java.lang.String varId)
throws java.lang.IllegalArgumentException
ControlUnitModel
queryStateVariable in interface ControlUnitModelvarId - the id of required state variable.
java.lang.IllegalArgumentException - if there is
no state variable with this Id in this control unitorg.mbs.services.control.generator.ControlUnitModel#queryStateVariable(java.lang.String)public java.lang.String getId()
ControlUnitModel
getId in interface ControlUnitModelorg.mbs.services.control.generator.ControlUnitModel#getId()public java.lang.String getType()
ControlUnitModel
getType in interface ControlUnitModelorg.mbs.services.control.generator.ControlUnitModel#getType()
public void reset()
throws java.lang.Exception
reset in interface ControlUnitModeljava.lang.Exception - thrown if error during reset occursprotected java.util.Hashtable getModelInitValues(java.util.Hashtable table)
table parameter is null,
while in the second case it holds the current values of the state variables.
The methods should return the initial values for the model object; key is state variable id, value is the default value.
The default implementation just clears the given table, or creates a new one if it is not created.
table - table where to store model init values.
If null, then a new Hashtable object is created.
Hashtable object.public void release()
release in interface ControlUnitModelpublic void setControlUnitCallback(CUAdminCallback callback)
setControlUnitCallback in interface ControlUnitModelorg.mbs.services.control.generator.ControlUnitModel#setControlUnitCallback(org.msb.services.cu.spi.CUAdminCallback)public CUAdminCallback getControlUnitCallback()
ControlUnitModel
getControlUnitCallback in interface ControlUnitModelorg.mbs.services.control.generator.ControlUnitModel#getControlUnitCallback()
|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||