fUML.Semantics.CommonBehaviors.Communications.ObjectActivation_EventDispatchLoopExecution Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fuml Show documentation
Show all versions of fuml Show documentation
This open source software is a reference implementation, consisting of software and related files, for the OMG specification called the Semantics of a Foundational Subset for Executable UML Models (fUML). The reference implementation is intended to implement the execution semantics of UML activity models, accepting an XMI file from a conformant UML model as its input and providing an execution trace of the selected activity model(s) as its output. The core execution engine, which is directly generated from the normative syntactic and semantic models for fUML, may also be used as a library implementation of fUML in other software.
/*
* Initial version copyright 2008 Lockheed Martin Corporation, except
* as stated in the file entitled Licensing-Information.
*
* All modifications copyright 2009-2017 Data Access Technologies, Inc.
*
* Licensed under the Academic Free License version 3.0
* (http://www.opensource.org/licenses/afl-3.0.php), except as stated
* in the file entitled Licensing-Information.
*/
package fUML.Semantics.CommonBehaviors.Communications;
import fUML.Semantics.Classes.Kernel.Value;
import fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution;
public class ObjectActivation_EventDispatchLoopExecution extends Execution {
public ObjectActivation self = null;
public ObjectActivation_EventDispatchLoopExecution(ObjectActivation self) {
this.self = self;
}
public int signalCount = 0;
public void _startObjectBehavior() {
// *** This should start the EventDispatchLoop ***
this.context = self.object;
} // _startObjectBehavior
public void _send(
fUML.Semantics.CommonBehaviors.Communications.ArrivalSignal signal) {
// Signal the arrival of a new signal instance in the event pool.
// *** This should send an ArrivalSignal to the EventDispatchLoop. ***
this.signalCount = this.signalCount + 1;
if (this.signalCount == 1) {
ExecutionQueue.enqueue(this);
}
} // _send
@Override
public void execute() {
this.self.dispatchNextEvent();
signalCount = signalCount - 1;
if (this.signalCount > 0) {
ExecutionQueue.enqueue(this);
}
}
@Override
public Value new_() {
return new ObjectActivation_EventDispatchLoopExecution(this.self);
}
@Override
public String toString() {
return "EventDispatchLoopExecution(" + this.self.object + ")";
}
}