modhelxs.abstractsemantics
Class BlockStructure

java.lang.Object
  extended by modhelxs.abstractsemantics.NamedEntity
      extended by modhelxs.abstractsemantics.BlockStructure
All Implemented Interfaces:
BlockStructure, NamedEntity

public class BlockStructure
extends NamedEntity
implements BlockStructure

A BlockStructure is a set of blocks with relations between their pins. A BlockStructure has no meaning by itself, it is interpreted according to a model of computation for computing its behavior.

Author:
boulange

Field Summary
private  java.util.Collection<Block> blocks_
          The blocks which belong to this structure.
private  Model<?> model_
          The model this structure belongs to.
private  java.util.Collection<Relation> relations_
          The relations between the pins of these blocks.
 
Constructor Summary
BlockStructure(java.lang.String name)
           
 
Method Summary
 void add(Block b)
          Add a block to this structure.
 Relation createRelation(Pin source, Pin target)
          Create a relation between two pins in the structure.
 void emitObservationRequests()
          After the end of the snapshot, the clocks have been reset, and it is time to post observation requests in the form of ticks.
 void endOfSnapshot()
          End of the observation round, the observable can update its internal state.
 java.util.Collection<Block> getBlocks()
          Get the blocks that belong to this structure.
 Model<?> getModel()
          Get the model this structure belongs to.
 java.util.Collection<Relation> getRelations()
          Get the relations between the pins of the blocks of this structure.
 void prep()
          Initialize the behavior of the structure.
 void reset()
          Reset the computation of the outputs and next state of the observable.
 void sanityCheck()
          Perform sanity check before setup.
 void setModel(Model<?> model_)
          Set the model this structure belongs to.
 void setup()
          Setup the structure for a simulation.
 int size()
          Get the number of blocks in this structure.
 void startOfSnapshot()
          Start a new snapshot.
 boolean validate()
          Validate the computation of the observation.
 void wrapup()
          Cleanup at the end of the simulation.
 
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

blocks_

private java.util.Collection<Block> blocks_
The blocks which belong to this structure.


relations_

private java.util.Collection<Relation> relations_
The relations between the pins of these blocks.


model_

private Model<?> model_
The model this structure belongs to.

Constructor Detail

BlockStructure

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

getBlocks

public java.util.Collection<Block> getBlocks()
Description copied from interface: BlockStructure
Get the blocks that belong to this structure.

Specified by:
getBlocks in interface BlockStructure

size

public int size()
Get the number of blocks in this structure.


add

public void add(Block b)
Add a block to this structure.


getRelations

public java.util.Collection<Relation> getRelations()
Description copied from interface: BlockStructure
Get the relations between the pins of the blocks of this structure.

Specified by:
getRelations in interface BlockStructure

createRelation

public Relation createRelation(Pin source,
                               Pin target)
Create a relation between two pins in the structure.


getModel

public Model<?> getModel()
Description copied from interface: BlockStructure
Get the model this structure belongs to.

Specified by:
getModel in interface BlockStructure

setModel

public void setModel(Model<?> model_)
Set the model this structure belongs to.


prep

public void prep()
Initialize the behavior of the structure. Called at the beginning of the simulation, before the setup. This call is delegated to the blocks of the structure.


sanityCheck

public void sanityCheck()
Perform sanity check before setup.


setup

public void setup()
Setup the structure for a simulation. Called at the beginning of a simulation before the first snapshot, but after prep. This call is delegated to the blocks of the structure.


startOfSnapshot

public void startOfSnapshot()
Start a new snapshot. Called at the beginning of the snapshot, before the first call to update. This call is delegated to the blocks of the structure.


reset

public void reset()
Reset the computation of the outputs and next state of the observable. Called each time the computation of the snapshot is reset, before the first call to update. This call is delegated to the blocks of the structure.


validate

public boolean validate()
Validate the computation of the observation. Answer true if the observable agrees with the observed values. Called each time the computation of the snapshot is done, before calling endOfSnapshot. This call is delegated to the blocks of the structure.

Returns:
true if all the blocks validate the snapshot.

endOfSnapshot

public void endOfSnapshot()
End of the observation round, the observable can update its internal state. Called each time a snapshot has been validated, before calling emitObservationRequests. This call is delegated to the blocks of the structure.


emitObservationRequests

public void emitObservationRequests()
After the end of the snapshot, the clocks have been reset, and it is time to post observation requests in the form of ticks. Called after the end of each snapshot. This call is delegated to the blocks of the structure.


wrapup

public void wrapup()
Cleanup at the end of the simulation. This call is delegated to the blocks of the structure.