src/org/nutz/lang/util/CronSequenceGenerator.java
private int findNext(BitSet bits, int value, Calendar calendar, int field, int nextField, List<Integer> lowerOrders) {
		int nextValue = bits.nextSetBit(value);
		// roll over if needed
		if (nextValue == -1) {
			calendar.add(nextField, 1);
			reset(calendar, Arrays.asList(field));
			nextValue = bits.nextSetBit(0);
		}
		if (nextValue != value) {
			calendar.set(field, nextValue);
			reset(calendar, lowerOrders);
		}
		return nextValue;
	}
private int findNext(BitSet bits, int value, Calendar calendar, int field, int nextField, List<Integer> lowerOrders) {
		int nextValue = bits.nextSetBit(value);
		// roll over if needed
		if (nextValue == -1) {
			calendar.add(nextField, 1);
			reset(calendar, Arrays.asList(field));
			nextValue = bits.nextSetBit(0);
		}
		if (nextValue != value) {
			calendar.set(field, nextValue);
			reset(calendar, lowerOrders);
		}
		return nextValue;
	}
private int findNext ( BitSet bits , int value , Calendar calendar , int field , int nextField , List < Integer > lowerOrders ) { int nextValue = bits . nextSetBit ( value ) ; // roll over if needed if ( nextValue == - 1 ) { calendar . add ( nextField , 1 ) ; reset ( calendar , Arrays . asList ( field ) ) ; nextValue = bits . nextSetBit ( 0 ) ; } if ( nextValue != value ) { calendar . set ( field , nextValue ) ; reset ( calendar , lowerOrders ) ; } return nextValue ; }
Search the bits provided for the next set bit after the value provided,
and reset the calendar.
@param bits a {@link BitSet} representing the allowed values of the field
@param value the current value of the field
@param calendar the calendar to increment as we move through the bits
@param field the field to increment in the calendar (@see
{@link Calendar} for the static constants defining valid fields)
@param lowerOrders the Calendar field ids that should be reset (i.e. the
ones of lower significance than the field of interest)
@return the value of the calendar field that is next in the sequence
Search the bits provided for the next set bit after the value provided and reset the calendar .