@Override protected void eval() { currentIndex = nextIndex(); val = values.get(currentIndex).get(); }
/** * 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))); }
@Override protected void eval() { currentIndex = nextIndex(); val = values.get(currentIndex).get(); }
/** * 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()))); }
@Override public void reset() { super.reset(); values.get(nextIndex()).reset(); }
/** * 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()))); }
@Override public void reset() { super.reset(); values.get(nextIndex()).reset(); }