modhelxs.state_management
Class ManagedInterfaceBlock

java.lang.Object
  extended by modhelxs.abstractsemantics.NamedEntity
      extended by modhelxs.abstractsemantics.ObservableEntity
          extended by modhelxs.abstractsemantics.Block
              extended by modhelxs.abstractsemantics.InterfaceBlock
                  extended by modhelxs.state_management.ManagedInterfaceBlock
All Implemented Interfaces:
Block, InterfaceBlock, NamedEntity, ObservableEntity
Direct Known Subclasses:
DE_SDF_DumbInterfaceBlock, DE_TFSM_InterfaceBlock, PlainManagedInterfaceBlock, TimedManagedInterfaceBlock

public abstract class ManagedInterfaceBlock
extends InterfaceBlock

An InterfaceBlock with default management for state changes.


Field Summary
private  TransientValue<java.lang.Boolean> internal_was_updated_
          Transient value telling whether the internal model was updated during this snapshot.
private  State myState_
          The state of the block, managing the revert and commit operations on its state values.
private  TransientValue<java.lang.Boolean> was_updated_
          Transient value telling whether the block was updated during this snapshot.
 
Constructor Summary
ManagedInterfaceBlock(java.lang.String name, Model<?> model, java.lang.Object... properties)
           
 
Method Summary
private  boolean checkNotManagedFields()
          Check for fields that are not final and are not manageable by a State object.
abstract  void doEndOfSnapshot()
          The endOfSnapshot behavior of the interface block.
abstract  void doGhostUpdate()
          The update behavior of the interface block when the internal model is not updated.
abstract  void doPostUpdate()
          The update behavior of the interface block after updating the internal model.
abstract  void doPreSetup()
          Some pre-setup behavior necessary for subclasses.
abstract  void doPreUpdate()
          The update behavior of the interface block before updating the internal model.
abstract  void doReset()
          The reset behavior of the interface block.
abstract  void doSetup()
          The setup behavior of the block.
abstract  void doStartOfSnapshot()
          The start of snapshot behavior of the block.
 void endOfSnapshot()
          The endOfSnapshot behavior of the ManagedInterfaceBlock, which calls doEndOfSnapshot() and manages the state values.
 void endOfUpdate()
          End of a partial update (produce partial outputs to the outer model).
 void initFromProperties(java.lang.String... assignments)
          Initialize the state values and parameters of the block from its properties.
 boolean internalWasUpdated()
          Tell whether the internal model was updated during this snapshot.
 void reset()
          The reset behavior of the ManagedInterfaceBlock, which manages the state values and calls doReset().
 void setup()
          The setup behavior of the ManagedInterfaceBlock, which manages the state values and calls doSetup().
abstract  boolean shouldUpdateModel()
          Should the internal model be updated.
 void startOfSnapshot()
          Start a new snapshot (observation round).
 void startOfUpdate()
          Start a partial update (get partial inputs from the outer model).
 void update()
          The update behavior of the ManagedInterfaceBlock, which calls doPreUpdate(), doPostUpdate() and manages the state values.
 boolean wasUpdated()
          Tell whether the block was updated during this snapshot.
 
Methods inherited from class modhelxs.abstractsemantics.InterfaceBlock
adaptIn, adaptOut, connect, connectFromModel, createAdaptationRelation, emitObservationRequests, getAdaptation, getInputPins, getInternalModel, getOutputPins, prep, validate, wrapup
 
Methods inherited from class modhelxs.abstractsemantics.Block
connectFromInterfaceBlock, connectFromRegularBlock, getEngine, getMoC, getParent, getSolver, getTimeOfRequest, hasObservationRequest, sanityCheck, setParent
 
Methods inherited from class modhelxs.abstractsemantics.ObservableEntity
addPin, getInterface, getPin
 
Methods inherited from class modhelxs.abstractsemantics.NamedEntity
getName, getProperties, getProperty, hasProperty, removeProperty, setName, setProperties, setProperty, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface modhelxs.ecore.Block
getParent
 
Methods inherited from interface modhelxs.ecore.ObservableEntity
getInterface
 
Methods inherited from interface modhelxs.ecore.NamedEntity
getName, getProperties, setName
 

Field Detail

was_updated_

private TransientValue<java.lang.Boolean> was_updated_
Transient value telling whether the block was updated during this snapshot.


internal_was_updated_

private TransientValue<java.lang.Boolean> internal_was_updated_
Transient value telling whether the internal model was updated during this snapshot.


myState_

private State myState_
The state of the block, managing the revert and commit operations on its state values.

Constructor Detail

ManagedInterfaceBlock

public ManagedInterfaceBlock(java.lang.String name,
                             Model<?> model,
                             java.lang.Object... properties)
Method Detail

checkNotManagedFields

private boolean checkNotManagedFields()
Check for fields that are not final and are not manageable by a State object.


wasUpdated

public boolean wasUpdated()
Tell whether the block was updated during this snapshot.


internalWasUpdated

public boolean internalWasUpdated()
Tell whether the internal model was updated during this snapshot.


initFromProperties

public void initFromProperties(java.lang.String... assignments)
Initialize the state values and parameters of the block from its properties.


doStartOfSnapshot

public abstract void doStartOfSnapshot()
The start of snapshot behavior of the block.


doPreSetup

public abstract void doPreSetup()
Some pre-setup behavior necessary for subclasses.


doSetup

public abstract void doSetup()
The setup behavior of the block.


startOfSnapshot

public final void startOfSnapshot()
Description copied from class: ObservableEntity
Start a new snapshot (observation round).

Overrides:
startOfSnapshot in class InterfaceBlock

setup

public final void setup()
The setup behavior of the ManagedInterfaceBlock, which manages the state values and calls doSetup().

Overrides:
setup in class InterfaceBlock

doReset

public abstract void doReset()
The reset behavior of the interface block.


reset

public final void reset()
The reset behavior of the ManagedInterfaceBlock, which manages the state values and calls doReset().

Overrides:
reset in class InterfaceBlock

startOfUpdate

public void startOfUpdate()
Description copied from class: ObservableEntity
Start a partial update (get partial inputs from the outer model).

Specified by:
startOfUpdate in class ObservableEntity

endOfUpdate

public void endOfUpdate()
Description copied from class: ObservableEntity
End of a partial update (produce partial outputs to the outer model).

Specified by:
endOfUpdate in class ObservableEntity

doPreUpdate

public abstract void doPreUpdate()
The update behavior of the interface block before updating the internal model.


shouldUpdateModel

public abstract boolean shouldUpdateModel()
Should the internal model be updated.


doPostUpdate

public abstract void doPostUpdate()
The update behavior of the interface block after updating the internal model.


doGhostUpdate

public abstract void doGhostUpdate()
The update behavior of the interface block when the internal model is not updated.


update

public final void update()
The update behavior of the ManagedInterfaceBlock, which calls doPreUpdate(), doPostUpdate() and manages the state values.

Overrides:
update in class InterfaceBlock

doEndOfSnapshot

public abstract void doEndOfSnapshot()
The endOfSnapshot behavior of the interface block.


endOfSnapshot

public final void endOfSnapshot()
The endOfSnapshot behavior of the ManagedInterfaceBlock, which calls doEndOfSnapshot() and manages the state values.

Overrides:
endOfSnapshot in class InterfaceBlock