Model Details

Unique ID generation

AMALTHEA uses a named based schema to reference other elements inside of a model.
A custom implementation is used instead of the standard EMF mechanism, which uses an index based implementation.
The target element id is identified by the following schema:

java.net.URLEncoder.encode(<name of element>, StandardCharsets.UTF_8.toString)) + "?type=" + <element>.eClass.name

Samples:

Referencing a Runnable element with name foo in a TaskRunnableCall looks like the following snippet:

<calls xsi:type="am:TaskRunnableCall" runnable="foo?type=Runnable" />

Interfaces and base objects

Several interfaces and abstract classes are defined in the common model.
They provide basic common functionality for all objects, which are extending it, like the possibility to add CustomAttributes or Tags. Tags are available at different elements with the purpose to group them together or to annotate them.

Transient back pointers

AMALTHEA maintains a (small) number of back pointers in the model. A transient reference of an object ‘points back’ to the object referring to it. This allows easier navigation, at the expense of greater memory use.

Current back pointers

The data model has some intermediate objects to express the call of a runnable or the access to a label.
These objects are containments of Task or Runnable and can have additional attributes. The back pointers support an easy way to answer queries like “Which tasks call runnable x ?” or “Which functions read label y ?”.

Back pointer (read only) Reference
LabelAccess labelAccesses data Label
ChannelAccess channelAccesses data Channel
SemaphoreAccess semaphoreAccesses semaphore Semaphore
TaskRunnableCall taskRunnableCalls runnable Runnable
RunnableCall runnableCalls runnable Runnable

All elements with memory representation (e.g. labels, runnables) can be mapped to exactly one memory. The back pointer provides a list of all elements that are assigned to a specific memory.

Back pointer (read only) Reference
Mapping mappings memory Memory
AbstractElementMapping mappings abstractElement AbstractElementMemoryInformation

Labels and runnables can be located in exactly one section. The back pointer provides a list of all elements that are assigned to a specific section.

Back pointer (read only) Reference
Label labels section Section
Runnable runnables section Section

CustomEvent and InterProcessStimulus can have explicit triggers. The pointer is established from CustomEventTrigger and InterProcessTrigger. The back pointers provides easier access to the triggering runnables / processes.

Back pointer (read only) Reference
CustomEventTrigger explicitTriggers event CustomEvent
InterProcessTrigger explicitTriggers stimulus InterProcessStimulus

Implementation

Xcore:

In addition to a reference <reference> there is a transient reference named <reference>LinkInt .
The visiblity in the generated code and in the user interface is controlled by @GenModel annotations.

class TaskRunnableCall extends CallSequenceItem
{	...
	refers Runnable[1] runnable
	
	// hidden link (internal)
	@GenModel(property="None", suppressedGetVisibility="true", suppressedSetVisibility="true"))
	refers transient Runnable[1] runnableLinkInt opposite taskRunnableCalls
}

class Runnable extends AbstractElementMemoryInformation
{	...	
	// back pointer (readonly)
	@GenModel(property="Readonly", suppressedSetVisibility="true")
	@GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert")
	refers transient TaskRunnableCall[] taskRunnableCalls opposite runnableLinkInt 
}

Classes and references:

Generated code:

EMF code generation allows the use of dynamic templates. AMALTHEA uses this technology to additionally set the transient value in the setter code of the standard value. The dynamic template is triggered by the name pattern '<reference>' and '<reference>LinkInt'.

public class TaskRunnableCallImpl ... {
	...
	public void setRunnable(org.eclipse.app4mc.amalthea.model.Runnable newRunnable) {
		...
 		//Additional setting transient value for transient bi-directional reference
 		setRunnableLinkInt(newRunnable);
	}
}

User Interface