org.eclipse.ohf.stem.core.graph
Interface Graph

All Superinterfaces:
org.eclipse.emf.ecore.EObject, Identifiable, org.eclipse.emf.common.notify.Notifier, SanityChecker
All Known Implementing Classes:
GraphImpl

public interface Graph
extends Identifiable

A Graph serves two roles in the STEM system. The first is as the canonical data structure that is the representational framework for all STEM simulations. In this form, a Graph, with one exception, matches the theoretical definition of a "graph" in that it has a set of Nodes, a set of Edges between members of the Node set, and a set of Labels that label either a member of the Node set or a member of the Edge set. The one exception is that an additional set of Labels designated as "graph labels" exists. These Labels function as "gloabl variables" and would typically be used during a simulation to hold global state information (for instance, parameters referenced by a Decorator that control it's computations on a graph-wide basis, an example might be a disease model that can change the infectious rate it uses by referencing such a label).

The second role played by a Graph is as a unit of composition in a Model. A Model forms a tree of Graphs and Models. The Graph instances are the leaves of the tree while the Model instances are the root and inner nodes of the tree. In this role, a Graph may not meet the theoretical definition of a "graph". This means that it may only have a set of Labels or a set of Edges, and no Nodes. This "graph fragment" allows sets of Labels and Edges to be defined and then later combined with an existing Graph that does have Nodes. This combination is specified by adding the graph fragment to a Model instance. When the canonical Graph is created, the Labels and Edges are "resolved" by matching their target URI(s) with those of the Nodes in the canonical Graph under construction. Any such Labels or Edges that are unresolved are recorded as UnresolvedIdentifiables.

The Graph has containment relationships for Nodes, Edges and the labels on nodes (i.e., NodeLabels). These support the graph fragment role by allowing a Graph to contain any of the three without the others. The Labels on Edges are contained by the Edge as it is not possible to have such a Label without the Edge. Only one such Label is allowed per Edge.

This interface definition is also an "Annotated Java Interface" that defines one class in a UML "model". The UML class diagram for the model is in the documentation folder of the project. This file and the other interfaces in this Java package are processed by the Eclipse Modeling Framework (aka EMF http://org.eclipse/emf). to automatically generate an implementation of the model. EMF is documented in the book Eclipse Modeling Framework by Budinsky, et al.

TODO copy to the other EMF interfaces.

See Also:
Edge, Node, Label, Model, Scenario

Field Summary
static java.lang.String URI_TYPE_GRAPH_SEGMENT
          This is the segment of the type URI that prefixes all other segments in a graph URI.
 
Method Summary
 void addDynamicLabel(DynamicLabel dynamiclabel)
          Add the Dynamic Label into the graph.
 void addGraph(Graph graph)
          Add the Edges, Nodes and Labels to this Graph.
 org.eclipse.emf.common.util.EList<Decorator> getDecorators()
           
 org.eclipse.emf.common.util.EList<DynamicLabel> getDynamicLabels()
          This collection of Labels contains references to ALL of the dynamic labels in the Graph.
 Edge getEdge(org.eclipse.emf.common.util.URI uri)
          Get the Edge from the graph.
 org.eclipse.emf.common.util.EMap<org.eclipse.emf.common.util.URI,Edge> getEdges()
           
 Label getGraphLabel(org.eclipse.emf.common.util.URI uri)
          Put the Graph Label into the graph.
 org.eclipse.emf.common.util.EMap<org.eclipse.emf.common.util.URI,Label> getGraphLabels()
           
 Node getNode(org.eclipse.emf.common.util.URI uri)
          Get the Node from the graph.
 NodeLabel getNodeLabel(org.eclipse.emf.common.util.URI uri)
          Get the Node Label from the graph.
 org.eclipse.emf.common.util.EMap<org.eclipse.emf.common.util.URI,NodeLabel> getNodeLabels()
           
 org.eclipse.emf.common.util.EList<NodeLabel> getNodeLabelsByTypeURI(org.eclipse.emf.common.util.URI typeURI)
           
 org.eclipse.emf.common.util.EMap<org.eclipse.emf.common.util.URI,Node> getNodes()
           
 int getNumDynamicLabels()
          Return the number of Dynamic Labels in this Graph.
 int getNumEdges()
          Return the number of Edges in this Graph.
 int getNumGraphLabels()
          Return the number of Graph Labels in this Graph.
 int getNumNodeLabels()
          Return the number of Node Labels in this Graph.
 int getNumNodes()
          Return the number of Nodes in this Graph.
 org.eclipse.emf.common.util.EList<UnresolvedIdentifiable> getUnresolvedIdentifiables()
           
 void putEdge(Edge edge)
          Put the Edge into the graph.
 void putGraphLabel(Label label)
          Put the Graph Label into the graph.
 void putNode(Node node)
          Put the Node into the graph.
 void putNodeLabel(NodeLabel label)
          Put the Node Label into the graph.
 void switchToNextValue()
          Make all of the dynamic labels in the model switch to 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
 

Field Detail

URI_TYPE_GRAPH_SEGMENT

static final java.lang.String URI_TYPE_GRAPH_SEGMENT
This is the segment of the type URI that prefixes all other segments in a graph URI.

See Also:
Constant Field Values
Method Detail

getEdges

org.eclipse.emf.common.util.EMap<org.eclipse.emf.common.util.URI,Edge> getEdges()
Returns:
the map

getNodes

org.eclipse.emf.common.util.EMap<org.eclipse.emf.common.util.URI,Node> getNodes()
Returns:
the map

getGraphLabels

org.eclipse.emf.common.util.EMap<org.eclipse.emf.common.util.URI,Label> getGraphLabels()
Returns:
the map

getNodeLabels

org.eclipse.emf.common.util.EMap<org.eclipse.emf.common.util.URI,NodeLabel> getNodeLabels()
Returns:
the mapping between URI and Node labels

getNodeLabelsByTypeURI

org.eclipse.emf.common.util.EList<NodeLabel> getNodeLabelsByTypeURI(org.eclipse.emf.common.util.URI typeURI)
Parameters:
typeURI - the type URI of the desired node labels
Returns:
a list of the NodeLabels that match a specific type URI

getDynamicLabels

org.eclipse.emf.common.util.EList<DynamicLabel> getDynamicLabels()
This collection of Labels contains references to ALL of the dynamic labels in the Graph. It is used by switchToNextValue() to find each of the labels that need to switch.


getDecorators

org.eclipse.emf.common.util.EList<Decorator> getDecorators()
Returns:
the collection of Decorators that decorate this Graph

addGraph

void addGraph(Graph graph)
Add the Edges, Nodes and Labels to this Graph.


putEdge

void putEdge(Edge edge)
Put the Edge into the graph.


getEdge

Edge getEdge(org.eclipse.emf.common.util.URI uri)
Get the Edge from the graph.


putNode

void putNode(Node node)
Put the Node into the graph.


getNode

Node getNode(org.eclipse.emf.common.util.URI uri)
Get the Node from the graph.


putNodeLabel

void putNodeLabel(NodeLabel label)
Put the Node Label into the graph.


getNodeLabel

NodeLabel getNodeLabel(org.eclipse.emf.common.util.URI uri)
Get the Node Label from the graph.


putGraphLabel

void putGraphLabel(Label label)
Put the Graph Label into the graph.


getGraphLabel

Label getGraphLabel(org.eclipse.emf.common.util.URI uri)
Put the Graph Label into the graph.


addDynamicLabel

void addDynamicLabel(DynamicLabel dynamiclabel)
Add the Dynamic Label into the graph.


getNumEdges

int getNumEdges()
Return the number of Edges in this Graph.


getNumNodes

int getNumNodes()
Return the number of Nodes in this Graph.


getNumGraphLabels

int getNumGraphLabels()
Return the number of Graph Labels in this Graph.


getNumNodeLabels

int getNumNodeLabels()
Return the number of Node Labels in this Graph.


getNumDynamicLabels

int getNumDynamicLabels()
Return the number of Dynamic Labels in this Graph.


getUnresolvedIdentifiables

org.eclipse.emf.common.util.EList<UnresolvedIdentifiable> getUnresolvedIdentifiables()
Returns:
a collection that UnresolvedIdentifiable instances that specify the URI's in an Identifiable that could not be resolved.

switchToNextValue

void switchToNextValue()
Make all of the dynamic labels in the model switch to their "next" value. This has the effect of moving the state of the model to the its aggregate value at the next time period.