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

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

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

Common default implementation of a model of computation features.

Author:
boulange

Field Summary
(package private)  java.util.Map<Token,java.lang.Object> tokenValues_
          Association of values to tokens.
 
Constructor Summary
ModelOfComputationImpl(java.lang.String name)
           
 
Method Summary
 Token createToken(java.lang.Object val)
          Create a new token for this MoC.
 Token duplicateToken(Token tok)
          Duplicate a token (return a new, different token, associated to the same value.
 void emitObservationRequests(BlockStructure s)
          Place ticks on clocks to request to be observed in future snapshots.
 void endOfSnapshot(BlockStructure s)
          End of the snapshot => update internal state, produce outputs.
 java.lang.Object getTokenValue(Token t)
          Get the value associated to a token by this MoC.
 void prep(BlockStructure s)
          Prepare for simulation.
 void reset(BlockStructure s)
          Reset for a new computation of the current snapshot (called at least once at the beginning of the snapshot).
 void setTokenValue(Token t, java.lang.Object val)
          Set the value associated to a token by this MoC.
 void setup(BlockStructure s)
          Setup for simulation.
 void startOfSnapshot(BlockStructure s)
          Start the computation of a new snapshot on structure s.
 boolean validate(BlockStructure s)
          Tell if the current computation of the snapshot is valid according to the semantics of this MoC.
 void wrapup(BlockStructure s)
          End of the simulation => release resources and clean up.
 
Methods inherited from class modhelxs.abstractsemantics.ModelOfComputation
canGoFurther, endOfUpdate, getClock, getCurrentTime, propagate, schedule, startOfUpdate, update
 
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

tokenValues_

java.util.Map<Token,java.lang.Object> tokenValues_
Association of values to tokens.

Constructor Detail

ModelOfComputationImpl

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

getTokenValue

public java.lang.Object getTokenValue(Token t)
Description copied from class: ModelOfComputation
Get the value associated to a token by this MoC.

Specified by:
getTokenValue in class ModelOfComputation<T extends java.lang.Comparable<? super T>>

setTokenValue

public void setTokenValue(Token t,
                          java.lang.Object val)
Description copied from class: ModelOfComputation
Set the value associated to a token by this MoC.

Specified by:
setTokenValue in class ModelOfComputation<T extends java.lang.Comparable<? super T>>

createToken

public Token createToken(java.lang.Object val)
Description copied from class: ModelOfComputation
Create a new token for this MoC.

Specified by:
createToken in class ModelOfComputation<T extends java.lang.Comparable<? super T>>

duplicateToken

public Token duplicateToken(Token tok)
Description copied from class: ModelOfComputation
Duplicate a token (return a new, different token, associated to the same value.

Specified by:
duplicateToken in class ModelOfComputation<T extends java.lang.Comparable<? super T>>

prep

public void prep(BlockStructure s)
Description copied from class: ModelOfComputation
Prepare for simulation. This is called early, just after loading the model, before the execution starts.

Specified by:
prep in class ModelOfComputation<T extends java.lang.Comparable<? super T>>
Parameters:
s - the block structure of the model driven by this MoC

setup

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

Specified by:
setup in class ModelOfComputation<T extends java.lang.Comparable<? super T>>
Parameters:
s - the block structure of the model driven by this MoC

startOfSnapshot

public void startOfSnapshot(BlockStructure s)
Description copied from class: ModelOfComputation
Start the computation of a new snapshot on structure s.

Specified by:
startOfSnapshot in class ModelOfComputation<T extends java.lang.Comparable<? super T>>

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).

Specified by:
reset in class ModelOfComputation<T extends java.lang.Comparable<? super T>>

validate

public boolean validate(BlockStructure s)
Description copied from class: ModelOfComputation
Tell if the current computation of the snapshot is valid according to the semantics of this MoC.

Specified by:
validate in class ModelOfComputation<T extends java.lang.Comparable<? super T>>

endOfSnapshot

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

Specified by:
endOfSnapshot in class ModelOfComputation<T extends java.lang.Comparable<? super T>>

emitObservationRequests

public void emitObservationRequests(BlockStructure s)
Description copied from class: ModelOfComputation
Place ticks on clocks to request to be observed in future snapshots.

Specified by:
emitObservationRequests in class ModelOfComputation<T extends java.lang.Comparable<? super T>>

wrapup

public void wrapup(BlockStructure s)
Description copied from class: ModelOfComputation
End of the simulation => release resources and clean up.

Specified by:
wrapup in class ModelOfComputation<T extends java.lang.Comparable<? super T>>