Am 05.12.2013 16:44, schrieb Alexandre Patry:
On 2013-12-04 12:33, Sebastian wrote:
Hi,
I'm highly interested in ruta, and its potential applications in
industrial
applications. Right know I'm trying to create a simple toy condition
extension that is simply a case insensitive INLIST condition. It is
completely based on the InListCondition class, I also declared an
implementation of the IRutaConditionExtension interface.
With primitve types everything seems to work great, except when the
condition is used with a variable :
STRINGLIST MonthsList = {"january", ...};
DECLARE Month;
ANY{INSENSITIVEINLIST(MonthsList) -> MARK(Month)};
I get a class cast exception when the condition is being created,
because
MonthsList is a SimpleTypeExpression and I'm expecting a
StringListExpression.
Am I doing something wrong ? I suppose there is a way to resolve the
variable to the actual list, but I missed it somehow.
It may not help you to get your toy extension working, but for small
lists I like to use regular expressions where case insensitiveness is
free:
W{REGEXP("(?i)january|february|march|...|december") -> MARK(Month)}
Just wanted to mention that the REGEXP condition has also an optional
argument for case-insensivity and there are also the simple regexp rules
for such use cases, which ignore the filtering and the basic tokens.
Best,
Peter
Regards,
Alexandre