/** * Creates an instance of {@link ObjectGenerator} which generates values in order they are specified. When values * are depleted, it starts again from the beginning of the list. * * @param values List of values. * @param <T> Type instance of {@link ObjectGenerator} will generate. * @return An instance of {@link ObjectGenerator} which generates values in order they are specified. */ public static <T> ObjectGenerator<T> circular(List<T> values) { return wrap(new CircularValue<>(unwrap(values))); }
/** * Creates an instance of {@link ObjectGenerator} which generates values in order they are specified. When values * are depleted, it starts again from the beginning of the list. * * @param values List of values. * @param <T> Type instance of {@link ObjectGenerator} will generate. * @return An instance of {@link ObjectGenerator} which generates values in order they are specified. */ public static <T> ObjectGenerator<T> circular(List<T> values) { return wrap(new CircularValue<>(unwrap(values))); }
/** * Circular value definition. * * @return Circular value definition rule. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public Rule circularValue() { return Sequence(function("circular", bracketList(value())), push(new CircularValue((List) pop()))); }
/** * Circular value definition. * * @return Circular value definition rule. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public Rule circularValue() { return Sequence(function("circular", bracketList(value())), push(new CircularValue((List) pop()))); }