Creates CronConstraint to ensure that either day-of-year or month is assigned a specific value.

@return newly created CronConstraint instance, never {@code null};
343398
public static CronConstraint ensureEitherDayOfYearOrMonth() {
        return new CronConstraint("Both, a day-of-year AND a day-of-month or day-of-week, are not supported.") {
            private static final long serialVersionUID = 520379111876897579L;

            @Override
            public boolean validate(Cron cron) {
                CronField dayOfYearField = cron.retrieve(CronFieldName.DAY_OF_YEAR);
                if (dayOfYearField != null && !(dayOfYearField.getExpression() instanceof QuestionMark)) {
                    return cron.retrieve(CronFieldName.DAY_OF_WEEK).getExpression() instanceof QuestionMark
                            && cron.retrieve(CronFieldName.DAY_OF_MONTH).getExpression() instanceof QuestionMark;
                }

                return true;
            }
        };
    }
846232
private static ChronoUnit create(DateUnit dateUnit) {
        switch (dateUnit) {
            case YEAR:
                return ChronoUnit.YEARS;
            case MONTH:
                return ChronoUnit.MONTHS;
            case DAY:
                return ChronoUnit.DAYS;
            case HOUR:
                return ChronoUnit.HOURS;
            case MINUTE:
                return ChronoUnit.MINUTES;
            case SECOND:
                return ChronoUnit.SECONDS;
            default:
                throw new DateUtilException("没有单位：" + dateUnit);
        }
    }
587560
public function createCalendar()
    {
        $calendar = new Calendar();

        if (!is_null($this->timezone)) {
            $calendar->setTimezone($this->timezone);
        }

        if (!is_null($this->prodid)) {
            $calendar->setProdId($this->prodid);
        }

        return $calendar;
    }
912647
public function withDateAt(int $year = null, int $month = null, int $day = null) : self
    {
        if (null === $year && null === $month && null === $day) {
            return $this;
        }
        
        $year  = $year === null ? $this->year() : $year;
        $month = $month ?: $this->month();
        $day   = $day   ?: $this->day();
        
        $instance = clone $this;
        
        $instance->date->setDate($year, $month, $day);
        
        return $instance;
    }
661730
public static Calendar toCalendar(final Instant self) {
        Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
        cal.setTime(toDate(self));
        return cal;
    }
176647
@Nonnull
  public T build ()
  {
    if (m_aScheduleBuilder == null)
      m_aScheduleBuilder = SimpleScheduleBuilder.simpleSchedule ();
    final IMutableTrigger trig = m_aScheduleBuilder.build ();
    trig.setCalendarName (m_sCalendarName);
    trig.setDescription (m_sDescription);
    trig.setStartTime (m_aStartTime);
    trig.setEndTime (m_aEndTime);
    if (m_aKey == null)
      m_aKey = new TriggerKey (Key.createUniqueName (null), null);
    trig.setKey (m_aKey);
    if (m_aJobKey != null)
      trig.setJobKey (m_aJobKey);
    trig.setPriority (m_nPriority);

    if (!m_aJobDataMap.isEmpty ())
      trig.setJobDataMap (m_aJobDataMap);
    return GenericReflection.uncheckedCast (trig);
  }
1283676
public static Date newDate(final int year, final int month, final int day, final int hour,
		final int min, final int sec)
	{
		return newDate(year, month, day, hour, min, sec, 0);
	}
1028651
public static Calendar getInstance()
    {
        return createCalendar(TimeZone.getDefault(), Locale.getDefault(Locale.Category.FORMAT));
    }
535752
public static function createGregorianDate($year = null, $month = null, $day = null, $timezone = null)
    {
        return static::createGregorian($year, $month, $day, null, null, null, $timezone);
    }
28537
private static CronDefinition unixCrontab() {
        return CronDefinitionBuilder.defineCron()
                .withMinutes().and()
                .withHours().and()
                .withDayOfMonth().and()
                .withMonth().and()
                .withDayOfWeek().withValidRange(0, 7).withMondayDoWValue(1).withIntMapping(7, 0).and()
                .enforceStrictRanges()
                .instance();
    }
262707
public static function create($year = null, $month = null, $day = null, $hour = null, $min = null, $second = null)
    {
        return Carbon::create($year, $month, $day, $hour, $min, $second);
    }
788068
public Cron map(final Cron cron) {
        Preconditions.checkNotNull(cron, "Cron must not be null");
        final List<CronField> fields = new ArrayList<>();
        for (final CronFieldName name : CronFieldName.values()) {
            if (mappings.containsKey(name)) {
                fields.add(mappings.get(name).apply(cron.retrieve(name)));
            }
        }
        return cronRules.apply(new SingleCron(to, fields)).validate();
    }
258246
@VisibleForTesting
    static Function<CronField, CronField> returnAlwaysExpression(final CronFieldName name) {
        return field -> new CronField(name, always(), FieldConstraintsBuilder.instance().forField(name).createConstraintsInstance());
    }
708278
@MemberOrder(sequence = "2")
    public Order create(
            @ParameterLayout(named="Order Number")
            final String number,
            @ParameterLayout(named="Customer Name")
            final String customerName,
            @ParameterLayout(named="Order Date")
            final LocalDate date,
            @Parameter(optionality = Optionality.OPTIONAL)
            @ParameterLayout(named="Preferences")
            final String preferences) {
        final Order obj = container.newTransientInstance(Order.class);
        obj.setNumber(number);
        obj.setDate(date);
        obj.setCustomerName(customerName);
        obj.setPreferences(preferences);
        container.persistIfNotAlready(obj);
        return obj;
    }
1349261
public FieldConstraintsBuilder forField(final CronFieldName field) {
        switch (field) {
            case SECOND:
            case MINUTE:
                endRange = 59;
                return this;
            case HOUR:
                endRange = 23;
                return this;
            case DAY_OF_WEEK:
                stringMapping = daysOfWeekMapping();
                endRange = 6;
                return this;
            case DAY_OF_MONTH:
                startRange = 1;
                endRange = 31;
                return this;
            case MONTH:
                stringMapping = monthsMapping();
                startRange = 1;
                endRange = 12;
                return this;
            case DAY_OF_YEAR:
                startRange = 1;
                endRange = 366;
                return this;
            default:
                return this;
        }
    }
1192831
protected Calendar createJavaCalendar (final long timeStamp)
  {
    final Calendar calendar = createJavaCalendar ();
    calendar.setTime (new Date (timeStamp));
    return calendar;
  }
1064629
@SuppressWarnings("unchecked")
    private ChronoZonedDateTimeImpl<D> create(Instant instant, ZoneId zone) {
        return (ChronoZonedDateTimeImpl<D>)ofInstant(getChronology(), instant, zone);
    }