-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathToUpper.xtend
More file actions
33 lines (23 loc) · 877 Bytes
/
ToUpper.xtend
File metadata and controls
33 lines (23 loc) · 877 Bytes
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
package de.grammarcraft.xtend.firstflow
package class ToUpper extends FunctionUnit {
new() { super('ToUpper') }
// input port
public val (String)=>void input = [msg | input(msg)]
def input(String msg) { processInput(msg) }
// output port
public val output = new OutputPort<String>('''«this».output''',
[forwardIntegrationError]
)
override (String)=>void getTheOneAndOnlyInputPort() {
return input;
}
// convenient operator for function units defining one and only one output port:
// defines operator "->", used as function unit connector
def void operator_mappedTo((String)=>void operation) {
output -> operation
}
// This method implements the semantic of the function unit
private def processInput(String msg) {
output.forward(msg.toUpperCase);
}
}