modhelxs.abstractsemantics
Class ModelOfComputation<T extends java.lang.Comparable<? super T>>

java.lang.Object
  extended by modhelxs.abstractsemantics.NamedEntity
      extended by modhelxs.abstractsemantics.ModelOfComputation<T>
All Implemented Interfaces:
ModelOfComputation, NamedEntity
Direct Known Subclasses:
ModelOfComputationImpl

public abstract class ModelOfComputation<T extends java.lang.Comparable<? super T>>
extends NamedEntity
implements ModelOfComputation

A ModelOfComputation models the rules for combining the behavior of the blocks in a structure.

Author:
boulange

Constructor Summary
ModelOfComputation(java.lang.String name)
           
 
Method Summary
abstract  boolean canGoFurther(BlockStructure s)
          Tell if it is possible to compute more information.
abstract  Token createToken(java.lang.Object val)
          Create a new token for this MoC.
abstract  Token duplicateToken(Token t)
          Duplicate a token (return a new, different token, associated to the same value.
abstract  void emitObservationRequests(BlockStructure s)
          Place ticks on clocks to request to be observed in future snapshots.
abstract  void endOfSnapshot(BlockStructure s)
          End of the snapshot => update internal state, produce outputs.
abstract  void endOfUpdate(BlockStructure s)
          Called at the end of an update of an inner block (produce partial outputs for the upper model).
abstract  Clock<T> getClock()
          Get the observation clock of this MoC.
abstract  T getCurrentTime()
          Get the current time of this MoC.
abstract  java.lang.Object getTokenValue(Token t)
          Get the value associated to a token by this MoC.
abstract  void prep(BlockStructure s)
          Prepare for simulation.
abstract  void propagate(BlockStructure s)
          Propagate new information produced by the update of a block.
abstract  void reset(BlockStructure s)
          Reset for a new computation of the current snapshot (called at least once at the beginning of the snapshot).
abstract  void schedule(BlockStructure s)
          Choose a block to be updated.
abstract  void setTokenValue(Token t, java.lang.Object val)
          Set the value associated to a token by this MoC.
abstract  void setup(BlockStructure s)
          Setup for simulation.
abstract  void startOfSnapshot(BlockStructure s)
          Start the computation of a new snapshot on structure s.
abstract  void startOfUpdate(BlockStructure s)
          Called at the beginning of an update of an inner block (get partial inputs from the upper model).
abstract  void update(BlockStructure s)
          Update a block.
abstract  boolean validate(BlockStructure s)
          Tell if the current computation of the snapshot is valid according to the semantics of this MoC.
abstract  void wrapup(BlockStructure s)
          End of the simulation => release resources and clean up.
 
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
 

Constructor Detail

ModelOfComputation

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

getClock

public abstract Clock<T> getClock()
Get the observation clock of this MoC.


getCurrentTime

public abstract T getCurrentTime()
Get the current time of this MoC.


getTokenValue

public abstract java.lang.Object getTokenValue(Token t)
Get the value associated to a token by this MoC.


setTokenValue

public abstract void setTokenValue(Token t,
                                   java.lang.Object val)
Set the value associated to a token by this MoC.


createToken

public abstract Token createToken(java.lang.Object val)
Create a new token for this MoC.


duplicateToken

public abstract Token duplicateToken(Token t)
Duplicate a token (return a new, different token, associated to the same value.


prep

public abstract void prep(BlockStructure s)
Prepare for simulation. This is called early, just after loading the model, before the execution starts.

Parameters:
s - the block structure of the model driven by this MoC

setup

public abstract void setup(BlockStructure s)
Setup for simulation. Called after prep, before the first snapshot.

Parameters:
s - the block structure of the model driven by this MoC

startOfSnapshot

public abstract void startOfSnapshot(BlockStructure s)
Start the computation of a new snapshot on structure s.


reset

public abstract void reset(BlockStructure s)
Reset for a new computation of the current snapshot (called at least once at the beginning of the snapshot).


schedule

public abstract void schedule(BlockStructure s)
Choose a block to be updated.


update

public abstract void update(BlockStructure s)
Update a block.


propagate

public abstract void propagate(BlockStructure s)
Propagate new information produced by the update of a block.


canGoFurther

public abstract boolean canGoFurther(BlockStructure s)
Tell if it is possible to compute more information.


validate

public abstract boolean validate(BlockStructure s)
Tell if the current computation of the snapshot is valid according to the semantics of this MoC.


endOfSnapshot

public abstract void endOfSnapshot(BlockStructure s)
End of the snapshot => update internal state, produce outputs.


emitObservationRequests

public abstract void emitObservationRequests(BlockStructure s)
Place ticks on clocks to request to be observed in future snapshots.


startOfUpdate

public abstract void startOfUpdate(BlockStructure s)
Called at the beginning of an update of an inner block (get partial inputs from the upper model).


endOfUpdate

public abstract void endOfUpdate(BlockStructure s)
Called at the end of an update of an inner block (produce partial outputs for the upper model).


wrapup

public abstract void wrapup(BlockStructure s)
End of the simulation => release resources and clean up.