modhelxs.abstractsemantics
Class InterfaceBlock

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

public abstract class InterfaceBlock
extends Block
implements InterfaceBlock

An InterfaceBlock is a special kind of Block. Its behavior is given by a ModHel'X model. An InterfaceBlock adapts behavior between its interface and the interface of its inner model.


Field Summary
private  java.util.List<Relation> adaptation_
          The relations between the pins of the interface block and the pins of the internal model.
private  java.util.Set<Pin> inputpins_
          The set of input pins (cached value).
private  Model<?> internal_
          The internal model of this interface block.
private  java.util.Set<Pin> outputpins_
          The set of output pins (cached value).
 
Constructor Summary
InterfaceBlock(java.lang.String name, Model<?> model, java.lang.Object... properties)
           
 
Method Summary
abstract  void adaptIn()
          Adapt data, time and control from the outer model to the inner one.
abstract  void adaptOut()
          Adapt data, time and control from the inner model to the outer one.
 Relation connect(Pin mine, Pin other)
          Connect one of my pins to another pin.
 Relation connectFromModel(Model<?> model, Pin other, Pin mine)
          Connect pin other of Model model to my pin mine.
 Relation createAdaptationRelation(Pin source, Pin target)
          Create a relation between a pin of the interface block and a pin of the internal model (or vice versa).
 void emitObservationRequests()
          Emit observation request for future snapshots by creating ticks on clocks.
 void endOfSnapshot()
          End of the observation round, the observable can update its internal state.
 java.util.Collection<Relation> getAdaptation()
          Get the relations between the interface of this block and the interface of its internal model.
 java.util.Collection<Pin> getInputPins()
          Get the input pins of this entity.
 Model<?> getInternalModel()
          Get the internal model of this interface block.
 java.util.Collection<Pin> getOutputPins()
          Get the output ins of this entity.
 void prep()
          Initialize the entity.
 void reset()
          Reset the computation of the outputs and next state for the current snapshot.
 void setup()
          Prepare for the simulation.
 void startOfSnapshot()
          Start a new snapshot (observation round).
 void update()
          Update the interface of the observable: take inputs into account, update outputs.
 boolean validate()
          Validate the computation of the observation.
 void wrapup()
          Cleanup at the end of the simulation.
 
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, endOfUpdate, getInterface, getPin, startOfUpdate
 
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

internal_

private Model<?> internal_
The internal model of this interface block.


adaptation_

private java.util.List<Relation> adaptation_
The relations between the pins of the interface block and the pins of the internal model.


inputpins_

private java.util.Set<Pin> inputpins_
The set of input pins (cached value).


outputpins_

private java.util.Set<Pin> outputpins_
The set of output pins (cached value).

Constructor Detail

InterfaceBlock

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

adaptIn

public abstract void adaptIn()
Adapt data, time and control from the outer model to the inner one.


adaptOut

public abstract void adaptOut()
Adapt data, time and control from the inner model to the outer one.


getAdaptation

public java.util.Collection<Relation> getAdaptation()
Description copied from interface: InterfaceBlock
Get the relations between the interface of this block and the interface of its internal model.

Specified by:
getAdaptation in interface InterfaceBlock

getInternalModel

public Model<?> getInternalModel()
Description copied from interface: InterfaceBlock
Get the internal model of this interface block.

Specified by:
getInternalModel in interface InterfaceBlock

connect

public Relation connect(Pin mine,
                        Pin other)
Connect one of my pins to another pin.

Overrides:
connect in class Block

createAdaptationRelation

public Relation createAdaptationRelation(Pin source,
                                         Pin target)
Create a relation between a pin of the interface block and a pin of the internal model (or vice versa).


connectFromModel

public Relation connectFromModel(Model<?> model,
                                 Pin other,
                                 Pin mine)
Connect pin other of Model model to my pin mine.

Overrides:
connectFromModel in class Block

prep

public void prep()
Description copied from class: ObservableEntity
Initialize the entity. Called after loading the model, before the simulation starts.

Specified by:
prep in class ObservableEntity

setup

public void setup()
Description copied from class: ObservableEntity
Prepare for the simulation. Called after prep, before the first step of the simulation.

Specified by:
setup in class ObservableEntity

startOfSnapshot

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

Specified by:
startOfSnapshot in class ObservableEntity

reset

public void reset()
Description copied from class: ObservableEntity
Reset the computation of the outputs and next state for the current snapshot.

Specified by:
reset in class ObservableEntity

update

public void update()
Description copied from class: ObservableEntity
Update the interface of the observable: take inputs into account, update outputs.

Specified by:
update in class ObservableEntity

validate

public boolean validate()
Description copied from class: ObservableEntity
Validate the computation of the observation. Answer true if the observable agrees with the observed values.

Specified by:
validate in class ObservableEntity

endOfSnapshot

public void endOfSnapshot()
Description copied from class: ObservableEntity
End of the observation round, the observable can update its internal state.

Specified by:
endOfSnapshot in class ObservableEntity

emitObservationRequests

public void emitObservationRequests()
Description copied from class: ObservableEntity
Emit observation request for future snapshots by creating ticks on clocks.

Specified by:
emitObservationRequests in class ObservableEntity

wrapup

public void wrapup()
Description copied from class: ObservableEntity
Cleanup at the end of the simulation.

Specified by:
wrapup in class ObservableEntity

getInputPins

public java.util.Collection<Pin> getInputPins()
Description copied from class: ObservableEntity
Get the input pins of this entity.

Overrides:
getInputPins in class Block

getOutputPins

public java.util.Collection<Pin> getOutputPins()
Description copied from class: ObservableEntity
Get the output ins of this entity.

Overrides:
getOutputPins in class Block