Search in sources :

Example 1 with And

use of com.cronutils.model.field.expression.And in project cron-utils by jmrozanec.

the class AndFieldValueGeneratorTest method setUp.

@Before
public void setUp() {
    constraints = FieldConstraintsBuilder.instance().createConstraintsInstance();
    fieldValueGenerator = new AndFieldValueGenerator(new CronField(CronFieldName.MONTH, new And().and(new On(new IntegerFieldValue(VALUE0))).and(new On(new IntegerFieldValue(VALUE1))).and(new On(new IntegerFieldValue(VALUE2))), constraints));
}
Also used : And(com.cronutils.model.field.expression.And) IntegerFieldValue(com.cronutils.model.field.value.IntegerFieldValue) CronField(com.cronutils.model.field.CronField) On(com.cronutils.model.field.expression.On) Before(org.junit.Before)

Example 2 with And

use of com.cronutils.model.field.expression.And in project cron-utils by jmrozanec.

the class AndDayOfWeekValueGenerator method generateCandidatesNotIncludingIntervalExtremes.

@Override
protected List<Integer> generateCandidatesNotIncludingIntervalExtremes(final int start, final int end) {
    final List<Integer> values = new ArrayList<>();
    final And and = (And) cronField.getExpression();
    for (final FieldExpression expression : and.getExpressions()) {
        final CronField cronField = new CronField(CronFieldName.DAY_OF_WEEK, expression, this.cronField.getConstraints());
        final List<Integer> candidatesList = FieldValueGeneratorFactory.createDayOfWeekValueGeneratorInstance(cronField, year, month, mondayDoWValue).generateCandidates(start, end);
        // add them to the master list
        if (candidatesList != null) {
            values.addAll(candidatesList);
        }
    }
    return values;
}
Also used : And(com.cronutils.model.field.expression.And) ArrayList(java.util.ArrayList) FieldExpression(com.cronutils.model.field.expression.FieldExpression) CronField(com.cronutils.model.field.CronField)

Aggregations

CronField (com.cronutils.model.field.CronField)2 And (com.cronutils.model.field.expression.And)2 FieldExpression (com.cronutils.model.field.expression.FieldExpression)1 On (com.cronutils.model.field.expression.On)1 IntegerFieldValue (com.cronutils.model.field.value.IntegerFieldValue)1 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1