Calculate the start-of-year point of a supplied {@link Calendar}.

<p>
The returned {@link Calendar} has its fields unsynced. Note: if {@code origin} has
unsynced field, it may cause side-effect.
</p>

@param origin
@return
557907
public static Calendar startOfYear(Calendar origin) {
        Calendar cal = (Calendar) origin.clone();
        cal.set(Calendar.MILLISECOND, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.DAY_OF_YEAR, 1);
        return cal;
    }
1216383
private synchronized void load(int year) {
        if (alreadyLoadedYears.contains(year)) {
            return;
        }

        alreadyLoadedYears.add(year);

        ZonedDateTime st = ZonedDateTime.of(LocalDate.now().with(TemporalAdjusters.firstDayOfYear()), LocalTime.MIN, ZoneId.systemDefault());
        ZonedDateTime et = ZonedDateTime.of(LocalDate.now().with(TemporalAdjusters.lastDayOfYear()), LocalTime.MAX, ZoneId.systemDefault());

        try {
            startBatchUpdates();

            /*
             * Convert start and end times from new java.time API to old API and then to ical API :-)
             */
            Period period = new Period(
                    new DateTime(Date.from(st.toInstant())),
                    new DateTime(Date.from(et.toInstant())));

            Rule[] rules = new Rule[]{new PeriodRule(period)};
            Filter filter = new Filter(rules, Filter.MATCH_ANY);

            @SuppressWarnings("unchecked")
            Collection<VEvent> events = filter.filter(calendar.getComponents(Component.VEVENT));

            for (VEvent evt : events) {

                if (loadedEventIds.contains(evt.getUid())) {
                    continue;
                }

                loadedEventIds.add(evt.getUid());

                ICalCalendarEntry entry = new ICalCalendarEntry(evt);

                ZonedDateTime entryStart = ZonedDateTime.ofInstant(evt.getStartDate().getDate().toInstant(), ZoneId.systemDefault());

                ZonedDateTime entryEnd = ZonedDateTime.ofInstant(evt
                                .getEndDate().getDate().toInstant(),
                        ZoneId.systemDefault());

                if (entryEnd.toLocalDate().isAfter(entryStart.toLocalDate())) {
                    entryEnd = entryEnd.minusDays(1);
                    entry.setFullDay(true);
                }

                entry.setInterval(new Interval(entryStart, entryEnd));

                final Property prop = evt.getProperty("RRULE");
                if (prop instanceof RRule) {
                    RRule rrule = (RRule) prop;
                    entry.setRecurrenceRule("RRULE:" + rrule.getValue());
                }

                addEntry(entry);
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            stopBatchUpdates();
        }
    }
10092
public static Date addYear(Date date1, int addYear) {
        Date resultDate = null;
        Calendar c = Calendar.getInstance();
        c.setTime(date1); // 设置当前日期
        c.add(Calendar.YEAR, addYear); // 日期加1
        resultDate = c.getTime(); // 结果
        return resultDate;
    }
191435
public Calendar adjustDate(final Calendar startDate, final int increment, final NonWorkingDayChecker<Calendar> checker) {
        final Calendar cal = (Calendar) startDate.clone();

        while (checker.isNonWorkingDay(cal)) {
            cal.add(Calendar.DAY_OF_MONTH, increment);
        }

        return cal;
    }
460143
public JTSPointExpression<Point> startPoint() {
        if (startPoint == null) {
            startPoint = JTSGeometryExpressions.pointOperation(SpatialOps.START_POINT, mixin);
        }
        return startPoint;
    }
700006
public static Calendar addWeeks(Calendar origin, int value) {
        Calendar cal = sync((Calendar) origin.clone());
        cal.add(Calendar.WEEK_OF_YEAR, value);
        return sync(cal);
    }
733318
public static Calendar beginOfQuarter(Calendar calendar) {
		calendar.set(Calendar.MONTH, calendar.get(DateField.MONTH.getValue()) / 3 * 3);
		calendar.set(Calendar.DAY_OF_MONTH, 1);
		return beginOfDay(calendar);
	}
476511
public String getEasterSundayOrthodox(int year, int days) {
        int A = year%4;
        int B = year%7;
        int C = year%19;
        int D = (19*C+15)%30;
        int E = ((2*A + 4*B -D + 34))%7;
        int Month = (int)(Math.floor ((D + E + 114) / 31));
        int Day = ((D + E + 114)% 31) +1;

        /*

        int K = year / 100;
        int M = 15 + ( ( 3 * K + 3 ) / 4 ) - ( ( 8 * K + 13 ) / 25 );
        int S = 2 - ( (3 * K + 3) / 4 );
        int A = year % 19;
        int D = ( 19 * A + M ) % 30;
        int R = ( D / 29) + ( ( D / 28 ) - ( D / 29 ) * ( A / 11 ) );
        int OG = 21 + D - R;
        int SZ = 7 - ( year + ( year / 4 ) + S ) % 7;
        int OE = 7 - ( OG - SZ ) % 7;
        int OS = OG + OE; */

        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        Calendar c = Calendar.getInstance();
        String date;


        date = String.format("%04d-%02d-%02d", year, Month, Day );

        try{
            c.setTime(formatter.parse(date));
            c.add(Calendar.DAY_OF_MONTH, days);
            c.add(Calendar.DAY_OF_MONTH, getJulianDifference(year));
            date = formatter.format(c.getTime());
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return date;
    }
1275911
private static final long trueMonthStart(long month)
    {
        long start = cache.get(month);

        if (start == CalendarCache.EMPTY)
        {
            // Make a guess at when the month started, using the average length
            long origin = HIJRA_MILLIS
                        + (long)Math.floor(month * CalendarAstronomer.SYNODIC_MONTH) * ONE_DAY;

            double age = moonAge(origin);

            if (moonAge(origin) >= 0) {
                // The month has already started
                do {
                    origin -= ONE_DAY;
                    age = moonAge(origin);
                } while (age >= 0);
            }
            else {
                // Preceding month has not ended yet.
                do {
                    origin += ONE_DAY;
                    age = moonAge(origin);
                } while (age < 0);
            }

            start = (origin - HIJRA_MILLIS) / ONE_DAY + 1;

            cache.put(month, start);
        }
        return start;
    }
134159
public Point getOrigin() {
        if (this.origin == null) {
            double x = MercatorProjection.tileToPixel(this.tileX, this.tileSize);
            double y = MercatorProjection.tileToPixel(this.tileY, this.tileSize);
            this.origin = new Point(x, y);
        }
        return this.origin;
    }
814608
public static Date beginOfYear(@NotNull final Date date) {
		return DateUtils.truncate(date, Calendar.YEAR);
	}
1121667
public static Calendar addSeconds(Calendar origin, int value) {
        Calendar cal = sync((Calendar) origin.clone());
        cal.add(Calendar.SECOND, value);
        return sync(cal);
    }
414231
function(year) {
			var date = this._validate(year, this.minMonth, this.minDay,
				$.calendars.local.invalidYear || $.calendars.regionalOptions[''].invalidYear);
			return (date.year() < 0 ? this.local.epochs[0] : this.local.epochs[1]);
		}
1339947
private void initializeDefaultCentury() {
        calendar.setTimeInMillis(System.currentTimeMillis());
        calendar.add( Calendar.YEAR, -80 );
        parseAmbiguousDatesAsAfter(calendar.getTime());
    }
326665
public static Calendar startOfMinute(Calendar origin) {
        Calendar cal = (Calendar) origin.clone();
        cal.set(Calendar.MILLISECOND, 0);
        cal.set(Calendar.SECOND, 0);
        return cal;
    }
1105058
public Layer setOrigin (Origin origin) {
    this.origin = origin;
    setFlag(Flag.ODIRTY, true);
    return this;
  }
1150052
public static Date dateReservedYear(int year, boolean is000) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.YEAR, year);

        return is000 ? dateReservedYear000(calendar) : dateReservedYear999(calendar);
    }