groimp-platform:xl-lambda
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
groimp-platform:xl-lambda [2024/05/06 11:54] – TimOb | groimp-platform:xl-lambda [2024/05/06 12:05] (current) – [custom rules] TimOb | ||
---|---|---|---|
Line 37: | Line 37: | ||
By using a Object function (eg. ObjectToFloat, | By using a Object function (eg. ObjectToFloat, | ||
For example the follwing lambda function will only work with node of the module A but can therefore also use attributes of this moduel: | For example the follwing lambda function will only work with node of the module A but can therefore also use attributes of this moduel: | ||
- | < | + | < |
ObjectToFloat getLen = A a => float a.len; | ObjectToFloat getLen = A a => float a.len; | ||
Line 43: | Line 43: | ||
</ | </ | ||
- | This works with module types and interfaces. | + | This works with module types and interfaces, for example the following code would let all Node implementing the Organ interface add one to the age. |
+ | <code java> | ||
+ | public interface organ{ | ||
+ | public int age; | ||
+ | |||
+ | public void setAge(int a); | ||
+ | public int getAge(); | ||
+ | |||
+ | } | ||
+ | public void ageing(){ | ||
+ | ObjectToVoid grow = organ o => void o.setAge(o.getAge()+1); | ||
+ | grow.evaluateVoid((*organ*)); | ||
+ | |||
+ | } | ||
+ | </ | ||
====== Generators ====== | ====== Generators ====== |
groimp-platform/xl-lambda.txt · Last modified: 2024/05/06 12:05 by TimOb