modhelxs.mocs.de
Class DEMoC

java.lang.Object
  extended by modhelxs.abstractsemantics.NamedEntity
      extended by modhelxs.abstractsemantics.ModelOfComputation<T>
          extended by modhelxs.abstractsemantics.ModelOfComputationImpl<java.lang.Double>
              extended by modhelxs.mocs.de.AbstractDEMoC
                  extended by modhelxs.mocs.de.DEMoC
All Implemented Interfaces:
ModelOfComputation, NamedEntity

public class DEMoC
extends AbstractDEMoC

DEMoC implements a Discrete Events MoCs.

Author:
boulange

Nested Class Summary
protected  class DEMoC.DEEvent
          An event in DE.
 
Field Summary
protected  Block block_to_update_
          The next block to update (chosen by 'schedule').
protected  java.util.List<UpdateTrigger> events_
          The list of DE events for the blocks.
protected  int n_turns_
          The number of schedule/update/propagate turns in this snapshot.
protected  BlockStructureNavHelper nav_helper_
          A navigation helper to ease the navigation in the block structure.
protected  java.util.List<Block> sorted_blocks_
          A list of the blocks of the structure is topological order.
 
Fields inherited from class modhelxs.mocs.de.AbstractDEMoC
current_time_, de_clock_, NID_PROPERTY
 
Constructor Summary
DEMoC()
           
DEMoC(java.lang.String name)
           
 
Method Summary
 boolean canGoFurther(BlockStructure s)
          Tell if it is possible to compute more information.
private  void computeCurrentTime()
          Compute the current time by looking at the tag of the first tagged event on the DE clock.
 void endOfSnapshot(BlockStructure s)
          End of the snapshot => update internal state, produce outputs.
 void endOfUpdate(BlockStructure s)
          Called at the end of an update of an inner block (produce partial outputs for the upper model).
 void propagate(BlockStructure s)
          Propagate new information produced by the update of a block.
 void reset(BlockStructure s)
          Reset for a new computation of the current snapshot (called at least once at the beginning of the snapshot).
 void schedule(BlockStructure s)
          Choose a block to be updated.
 void setup(BlockStructure s)
          Setup for simulation.
 void startOfUpdate(BlockStructure s)
          Called at the beginning of an update of an inner block (get partial inputs from the upper model).
 void update(BlockStructure s)
          Update a block.
 
Methods inherited from class modhelxs.mocs.de.AbstractDEMoC
getClock, getCurrentTime, isNotInstantaneouslyDependent, removeNotInstantaneouslyDependent, setNotInstantaneouslyDependent
 
Methods inherited from class modhelxs.abstractsemantics.ModelOfComputationImpl
createToken, duplicateToken, emitObservationRequests, getTokenValue, prep, setTokenValue, startOfSnapshot, validate, wrapup
 
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.NamedEntity
getName, getProperties, setName
 

Field Detail

events_

protected java.util.List<UpdateTrigger> events_
The list of DE events for the blocks.


nav_helper_

protected BlockStructureNavHelper nav_helper_
A navigation helper to ease the navigation in the block structure.


sorted_blocks_

protected java.util.List<Block> sorted_blocks_
A list of the blocks of the structure is topological order.


block_to_update_

protected Block block_to_update_
The next block to update (chosen by 'schedule').


n_turns_

protected int n_turns_
The number of schedule/update/propagate turns in this snapshot.

Constructor Detail

DEMoC

public DEMoC()

DEMoC

public DEMoC(java.lang.String name)
Method Detail

computeCurrentTime

private void computeCurrentTime()
Compute the current time by looking at the tag of the first tagged event on the DE clock.


setup

public void setup(BlockStructure s)
Description copied from class: ModelOfComputation
Setup for simulation. Called after prep, before the first snapshot.

Overrides:
setup in class ModelOfComputationImpl<java.lang.Double>
Parameters:
s - the block structure of the model driven by this MoC

reset

public void reset(BlockStructure s)
Description copied from class: ModelOfComputation
Reset for a new computation of the current snapshot (called at least once at the beginning of the snapshot).

Overrides:
reset in class ModelOfComputationImpl<java.lang.Double>

startOfUpdate

public void startOfUpdate(BlockStructure s)
Description copied from class: ModelOfComputation
Called at the beginning of an update of an inner block (get partial inputs from the upper model).

Specified by:
startOfUpdate in class ModelOfComputation<java.lang.Double>

schedule

public void schedule(BlockStructure s)
Description copied from class: ModelOfComputation
Choose a block to be updated.

Specified by:
schedule in class ModelOfComputation<java.lang.Double>

update

public void update(BlockStructure s)
Description copied from class: ModelOfComputation
Update a block.

Specified by:
update in class ModelOfComputation<java.lang.Double>

propagate

public void propagate(BlockStructure s)
Description copied from class: ModelOfComputation
Propagate new information produced by the update of a block.

Specified by:
propagate in class ModelOfComputation<java.lang.Double>

canGoFurther

public boolean canGoFurther(BlockStructure s)
Description copied from class: ModelOfComputation
Tell if it is possible to compute more information.

Specified by:
canGoFurther in class ModelOfComputation<java.lang.Double>

endOfUpdate

public void endOfUpdate(BlockStructure s)
Description copied from class: ModelOfComputation
Called at the end of an update of an inner block (produce partial outputs for the upper model).

Specified by:
endOfUpdate in class ModelOfComputation<java.lang.Double>

endOfSnapshot

public void endOfSnapshot(BlockStructure s)
Description copied from class: ModelOfComputation
End of the snapshot => update internal state, produce outputs.

Overrides:
endOfSnapshot in class ModelOfComputationImpl<java.lang.Double>