forked from SysMLinJavaModeler/SysMLinJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSysMLDoActivity.java
More file actions
57 lines (55 loc) · 1.8 KB
/
Copy pathSysMLDoActivity.java
File metadata and controls
57 lines (55 loc) · 1.8 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
53
54
55
56
57
package sysmlinjava.statemachine;
import java.util.Optional;
import sysmlinjava.blocks.SysMLBlock;
import sysmlinjava.common.SysMLInterface;
/**
* Functional interface specifying the activity performed while in the state.
* That is, the activity to perform by the {@code SysMLState}'s
* {@code doActivity()} operation.<br>
* <p>
* The {@code SysMLDoActivity} should be declared as a field in the extended
* {@code SysMLStateMachine} class. The field should be annotated with the
* {@code DoActivity} annotation. It should then be implemented as an instance
* of a functional interface - a lambda function - in the override of the
* {@code SysMLStateMachine}'s {@code createStateDoActivities()} operation to
* provide the function with access to the state machine's properties. An
* example follows.
*
* <pre>
* {@code
public SysMLDoActivity developPlan;
:
public void createStateDoActivities()
{
:
developPlan = (contextBlock) ->
{
gatherIntelligence();
developOptions();
selectOption();
optionIntoPlan();
reviewPlan()
};
:
}
}
* </pre>
*
*
* @author ModelerOne
*
*/
@FunctionalInterface
public interface SysMLDoActivity extends SysMLInterface
{
/**
* Specification of the activity to be performed while state machine is in the
* associated state, i.e. the activity to be performed by the state's
* {@code doActivity} element. This function must be realized by an instance of
* a lambda expression.
*
* @param contextBlock Optional block in whose context the state's associated
* state machine executes.
*/
void perform(Optional<? extends SysMLBlock> contextBlock);
}