I’m trying to have a function call a function from a rule. To make a very long story short, I’m doing this to adjust time offsets to randomize lights. I have a couple of single rules working that have a lot of duplicate code for different lights, and I want to put it all into functions. It is getting messy, so I did not want to paste it here. Instead, here is a bit of pseudo code.
val org.eclipse.xtext.xbase.lib.Functions.Function0 computeRandom [|
computes and returns an int number of minutes to make it look slightly different each day of the week
]
val org.eclipse.xtext.xbase.lib.Functions.Function0 computeSunriseOffset [|
computes and returns an int based on month so I can have lights turn on before/after sunrise based on time of year
]
val org.eclipse.xtext.xbase.lib.Functions.Function5 findTime4Timer
takes a bunch of variables based on which light it is controlling and needs to call the above and other functions
]
the rule does a “.apply” to run the findTime4Timer function. However, if I do a .“apply” in the findTime4Timer function, I get an error “during the execution of rule testing me: cannot invoke method public abstract java.lang.Object org.eclipse.xtext.xbase.lib.Functions$Function2.apply(java.lang.Object,java.lang.Object) on null”
If I remove the “.apply” in the findTime4Timer function, that error goes away, but no values come back from the called functions.
Any ideas?
Thanks!