User Tools

Site Tools


01_user_documentation:07_rgg_xl:02_xl:08_object:04_generator

Generators

For the XL language, a generator expression is an expression that can produce multiple values. These generator are following the design of internal iterators. The XL programming language defines several types of generator expressions. Additionally to the expressions described bellow, expressions of type java.lang.Iterable can also be used as generator expressions, they yield all values of the corresponding external iterator.

Generator Methods

As generator expressions are handled by internal iterators, the declaration of generator methods, i. e., methods which return multiple values in succession, is easy. Such a method has to receive an additional argument for the consumer to which it can pass its return values one after another.

→ Read more...

Range Operator

The expression a : b using the range operator also defines a generator expression. The range operator is defined for operand types int and long and yields the values a, a+1, . . . , b.

→ Read more...

Array Generator

The array generator a[:] is a generator expression which yields all values of the elements of the array a, starting with the element at index 0.

→ Read more...

Guard Operator

The guard operator a :: b defines a generator expression which yields a if b is true and no value at all if b is false.

→ Read more...

Filter Methods

Filter methods are a generalization of the guard operator. Their input is a sequence of values. For each value, a filter method decides whether to yield a result or not. In contrast to the guard operator, the result may differ from the input in value or even in type.

→ Read more...

01_user_documentation/07_rgg_xl/02_xl/08_object/04_generator.txt · Last modified: 2025/08/20 10:32 by gaetan