Skip to content

Commit

Permalink
Avoid creating new calendar object and rename files to "lakewood_"
Browse files Browse the repository at this point in the history
  • Loading branch information
Sternbach-Software authored Oct 6, 2023
1 parent cad11ae commit fbf4f0d
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@ public static void main(String[] args) throws IOException {
LocalDate end = LocalDate.of(9999, 1, 1);
LocalDate current = start;
JewishCalendar cal = new JewishCalendar(current);
GregorianCalendar gregorian = new GregorianCalendar(current.getYear(), current.getMonthValue() - 1, current.getDayOfMonth());
JewishDate date = new JewishDate(current);
ComplexZmanimCalendar zcal = new ComplexZmanimCalendar(new GeoLocation("Lakewood, NJ", 40.096, -74.222, 29.02, TimeZone.getTimeZone("America/New_York")));
List<FullCalendar> calendars = new ArrayList<>();
List<FullZmanim> zmanim = new ArrayList<>();

// cal.isUseModernHolidays();
// cal.setUseModernHolidays();
// cal.setInIsrael();
// cal.getInIsrael();
// cal.getIsMukafChoma();
// cal.setIsMukafChoma();
while (current.isBefore(end)) {
//TODO work in progress:
Expand All @@ -41,28 +39,32 @@ public static void main(String[] args) throws IOException {
cal.isMoridHatalRecited();*/

current = current.plusDays(1L);
cal.setDate(current);
gregorian.roll(Calendar.DATE, true);
date.forward(Calendar.DATE, 1);
zcal.setCalendar(new GregorianCalendar(current.getYear(), current.getMonthValue() - 1, current.getDayOfMonth()));
cal.setDate(current);
zcal.setCalendar(gregorian);
}
//write calendars to file:

File calendarOutput = new File("calendar.csv");
File calendarOutput = new File("lakewood_calendar.csv");
BufferedWriter calendarWriter = new BufferedWriter(new FileWriter(calendarOutput));
calendarWriter.write(FullCalendar.fields);
calendarWriter.newLine();
for (FullCalendar calendar : calendars) {
calendarWriter.write(calendar.toString());
calendarWriter.newLine();
}
File zmanimOutput = new File("zmanim.csv");
calendarWriter.close();

File zmanimOutput = new File("lakewood_zmanim.csv");
BufferedWriter zmanimWriter = new BufferedWriter(new FileWriter(zmanimOutput));
zmanimWriter.write(FullZmanim.fields);
zmanimWriter.newLine();
for (FullZmanim zman : zmanim) {
zmanimWriter.write(zman.toString());
zmanimWriter.newLine();
}
zmanimWriter.close();
}

static class FullZmanim {
Expand Down

0 comments on commit fbf4f0d

Please sign in to comment.