-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSysMLActivity.java
More file actions
52 lines (51 loc) · 1.55 KB
/
Copy pathSysMLActivity.java
File metadata and controls
52 lines (51 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package sysmlinjava.common;
/**
* SysMLinJava representation of the SysML activity. {@code SysMLActivity} is a
* functional interface specification. The {@code perform()} operation performs
* the Java statements that define an activity within the context of the
* {@code SysMLBlock} in which it is declared.
* <p>
* The {@code SysMLActivity} should be declared as a field in the extended
* {@code SysMLBlock} class. The field should be annotated with the
* {@code Activity} annotation. It should then be implemented as an instance of
* a Lambda function in the override of the {@code SysMLBlock}'s
* {@code createActivies()} operation. An example is as follows:
*
* <pre>
:
@Activity
protected SysMLActivity targetActivity;
:
@Override
protected void createActivities()
{
targetActivity = () ->
{
do
{
findTarget();
trackTarget();
if(engagementAuthorized())
{
engageTarget();
assessEngagement();
}
}
while(!(targetDestroyed() || engagementDenied()));
});
}
:
* </pre>
*
* @author ModelerOne
*
*/
@FunctionalInterface
public interface SysMLActivity extends SysMLInterface
{
/**
* Perform the implemented activity in the context of the {@code SysMLBlock}
* that contains the implementation of the functional interface.
*/
void perform();
}