org.eclipse.ohf.stem.core.model
Interface Decorator

All Superinterfaces:
org.eclipse.emf.ecore.EObject, Identifiable, org.eclipse.emf.common.notify.Notifier, SanityChecker
All Known Subinterfaces:
AggregatingSEIRDiseaseModel, AggregatingSIDiseaseModel, AggregatingSIRDiseaseModel, DeterministicSEIRDiseaseModel, DeterministicSIDiseaseModel, DeterministicSIRDiseaseModel, DiseaseModel, EdgeDecorator, GraphDecorator, Infector, NodeDecorator, SEIR, SI, SIInfector, SIR, StandardDiseaseModel, StandardInfector, StandardStochasticDiseaseModel, StochasticDiseaseModel, StochasticSEIRDiseaseModel, StochasticSIDiseaseModel, StochasticSIRDiseaseModel, TestEdgeDecorator1, TestGraphDecorator1, TestNodeDecorator1, TestScenarioGraphDecorator1
All Known Implementing Classes:
AggregatingSEIRDiseaseModelImpl, AggregatingSIDiseaseModelImpl, AggregatingSIRDiseaseModelImpl, DecoratorImpl, DeterministicSEIRDiseaseModelImpl, DeterministicSIDiseaseModelImpl, DeterministicSIRDiseaseModelImpl, DiseaseModelImpl, EdgeDecoratorImpl, GraphDecoratorImpl, InfectorImpl, NodeDecoratorImpl, SEIRImpl, SIImpl, SIInfectorImpl, SIRImpl, StandardDiseaseModelImpl, StandardInfectorImpl, StandardStochasticDiseaseModelImpl, StochasticDiseaseModelImpl, StochasticSEIRDiseaseModelImpl, StochasticSIDiseaseModelImpl, StochasticSIRDiseaseModelImpl, TestEdgeDecorator1Impl, TestGraphDecorator1Impl, TestNodeDecorator1Impl, TestScenarioGraphDecorator1Impl

public interface Decorator
extends Identifiable

A Decorator represents a computational component that can modify or "decorate" a Graph.

The method #decorateGraph(Graph) is called once for each Decorator instance during the creation of the canonical Graph (see Model.getCanonicalGraph(org.eclipse.emf.common.util.URI)). Typically, this method would add additional DynamicLabels to the Graph under construction. For example, a disease model would be implemented as a Decorator and it would add DynamicLabels to the Nodes of the Graph that represent the state of the disease at each Node.

After the canonical Graph is created, the method #updateLabels(Graph, STEMTime, long) will be called once every time the Scenario is "stepped" (see Scenario.step()). The DynamicLabels that it updates are those that were added to the Graph in the #decorateGraph(Graph) method call. A reference to each of those DynamicLabels is kept in a collection (see getLabelsToUpdate()) maintained by the Decorator. The #updateLabels(Graph, STEMTime, long) method computes the "next" value of all of the DynamicLabels in that collection.

For maximum flexibility, the nature of that LabelValue and its computation are not defined or restricted. For instance, the Decorator could compute the LabelValue from the contents of the Graph, read the value from a file, obtain it from a real-time datasource such as a weather station or something accessible from a web site or a web service.


Method Summary
 void decorateGraph()
          Augment the graph by adding components (Edges, Nodes, Labels).
 Graph getGraph()
           
 org.eclipse.emf.common.util.EList<DynamicLabel> getLabelsToUpdate()
           
 void resetLabels()
          Process each of the DynamicLabels that this decorator is responsible for and reset their "current" value to be the initial value assigned during the call to the method decorateGraph()
 void setGraph(Graph value)
          Sets the value of the 'Graph' container reference.
 void updateLabels(STEMTime time, long timerPeriod)
          Process each of the DynamicLabels that this Decorator is responsible for and determine their "next" value.
 
Methods inherited from interface org.eclipse.ohf.stem.core.common.Identifiable
getDublinCore, getTypeURI, getURI, sane, setDublinCore, setTypeURI, setURI
 
Methods inherited from interface org.eclipse.emf.ecore.EObject
eAllContents, eClass, eContainer, eContainingFeature, eContainmentFeature, eContents, eCrossReferences, eGet, eGet, eIsProxy, eIsSet, eResource, eSet, eUnset
 
Methods inherited from interface org.eclipse.emf.common.notify.Notifier
eAdapters, eDeliver, eNotify, eSetDeliver
 

Method Detail

getGraph

Graph getGraph()
Returns:
the Graph that the Decorator decorates.

setGraph

void setGraph(Graph value)
Sets the value of the 'Graph' container reference.

Parameters:
value - the new value of the 'Graph' container reference.
See Also:
getGraph()

getLabelsToUpdate

org.eclipse.emf.common.util.EList<DynamicLabel> getLabelsToUpdate()
Returns:
the list of DynamicLabels that this Decorator is responsible for updating.

decorateGraph

void decorateGraph()
Augment the graph by adding components (Edges, Nodes, Labels). The added components, in particular DynamicLabels, can be modified later during a call to #updateLabels(Graph, STEMTime). A side effect of this call is that it adds the decorator to the collection maintained by the Graph.


updateLabels

void updateLabels(STEMTime time,
                  long timerPeriod)
Process each of the DynamicLabels that this Decorator is responsible for and determine their "next" value.

Parameters:
time - the time to be used when determining the changes to be made to the Graph
timePeriod - the number of milliseconds difference between the time and the previous time value.

resetLabels

void resetLabels()
Process each of the DynamicLabels that this decorator is responsible for and reset their "current" value to be the initial value assigned during the call to the method decorateGraph()