@Test public void testDaysSinceSolstice() { daysSinceSolsticeTest(11, 2016, 1, 1, 1); daysSinceSolsticeTest(10, 2015, 12, 31, 1); daysSinceSolsticeTest(10, 2016, 12, 31, 1); daysSinceSolsticeTest(0, 2016, 12, 21, 1); daysSinceSolsticeTest(1, 2016, 12, 22, 1); daysSinceSolsticeTest(71, 2016, 3, 1, 1); daysSinceSolsticeTest(70, 2015, 3, 1, 1); daysSinceSolsticeTest(365, 2016, 12, 20, 1); daysSinceSolsticeTest(364, 2015, 12, 20, 1); daysSinceSolsticeTest(0, 2015, 6, 21, -1); daysSinceSolsticeTest(0, 2016, 6, 21, -1); daysSinceSolsticeTest(364, 2015, 6, 20, -1); daysSinceSolsticeTest(365, 2016, 6, 20, -1); }
static int daysSinceSolstice(int dayOfYear, int year, double latitude) { int daysSinceSolistice; final int northernOffset = 10; boolean isLeapYear = CalendarUtil.isLeapYear(year); final int southernOffset = isLeapYear ? 173 : 172; final int daysInYear = isLeapYear ? 366 : 365; if (latitude >= 0) { daysSinceSolistice = dayOfYear + northernOffset; if (daysSinceSolistice >= daysInYear) { daysSinceSolistice = daysSinceSolistice - daysInYear; } } else { daysSinceSolistice = dayOfYear - southernOffset; if (daysSinceSolistice < 0) { daysSinceSolistice = daysSinceSolistice + daysInYear; } } return daysSinceSolistice; }
PrayerTimes { static int daysSinceSolstice(int dayOfYear, int year, double latitude) { int daysSinceSolistice; final int northernOffset = 10; boolean isLeapYear = CalendarUtil.isLeapYear(year); final int southernOffset = isLeapYear ? 173 : 172; final int daysInYear = isLeapYear ? 366 : 365; if (latitude >= 0) { daysSinceSolistice = dayOfYear + northernOffset; if (daysSinceSolistice >= daysInYear) { daysSinceSolistice = daysSinceSolistice - daysInYear; } } else { daysSinceSolistice = dayOfYear - southernOffset; if (daysSinceSolistice < 0) { daysSinceSolistice = daysSinceSolistice + daysInYear; } } return daysSinceSolistice; } }
PrayerTimes { static int daysSinceSolstice(int dayOfYear, int year, double latitude) { int daysSinceSolistice; final int northernOffset = 10; boolean isLeapYear = CalendarUtil.isLeapYear(year); final int southernOffset = isLeapYear ? 173 : 172; final int daysInYear = isLeapYear ? 366 : 365; if (latitude >= 0) { daysSinceSolistice = dayOfYear + northernOffset; if (daysSinceSolistice >= daysInYear) { daysSinceSolistice = daysSinceSolistice - daysInYear; } } else { daysSinceSolistice = dayOfYear - southernOffset; if (daysSinceSolistice < 0) { daysSinceSolistice = daysSinceSolistice + daysInYear; } } return daysSinceSolistice; } PrayerTimes(Coordinates coordinates, DateComponents date, CalculationParameters parameters); }
PrayerTimes { static int daysSinceSolstice(int dayOfYear, int year, double latitude) { int daysSinceSolistice; final int northernOffset = 10; boolean isLeapYear = CalendarUtil.isLeapYear(year); final int southernOffset = isLeapYear ? 173 : 172; final int daysInYear = isLeapYear ? 366 : 365; if (latitude >= 0) { daysSinceSolistice = dayOfYear + northernOffset; if (daysSinceSolistice >= daysInYear) { daysSinceSolistice = daysSinceSolistice - daysInYear; } } else { daysSinceSolistice = dayOfYear - southernOffset; if (daysSinceSolistice < 0) { daysSinceSolistice = daysSinceSolistice + daysInYear; } } return daysSinceSolistice; } PrayerTimes(Coordinates coordinates, DateComponents date, CalculationParameters parameters); Prayer currentPrayer(); Prayer currentPrayer(Date time); Prayer nextPrayer(); Prayer nextPrayer(Date time); Date timeForPrayer(Prayer prayer); }
PrayerTimes { static int daysSinceSolstice(int dayOfYear, int year, double latitude) { int daysSinceSolistice; final int northernOffset = 10; boolean isLeapYear = CalendarUtil.isLeapYear(year); final int southernOffset = isLeapYear ? 173 : 172; final int daysInYear = isLeapYear ? 366 : 365; if (latitude >= 0) { daysSinceSolistice = dayOfYear + northernOffset; if (daysSinceSolistice >= daysInYear) { daysSinceSolistice = daysSinceSolistice - daysInYear; } } else { daysSinceSolistice = dayOfYear - southernOffset; if (daysSinceSolistice < 0) { daysSinceSolistice = daysSinceSolistice + daysInYear; } } return daysSinceSolistice; } PrayerTimes(Coordinates coordinates, DateComponents date, CalculationParameters parameters); Prayer currentPrayer(); Prayer currentPrayer(Date time); Prayer nextPrayer(); Prayer nextPrayer(Date time); Date timeForPrayer(Prayer prayer); final Date fajr; final Date sunrise; final Date dhuhr; final Date asr; final Date maghrib; final Date isha; }