Class Zman


public class Zman extends Object
A wrapper class for a astronomical times / zmanim that is mostly intended to allow sorting collections of astronomical times. It has fields for both date/time and duration based zmanim, name / labels as well as a longer description or explanation of a zman. Here is an example of various ways of sorting zmanim.

First create the Calendar for the location you would like to calculate:

 String locationName = "Lakewood, NJ";
 double latitude = 40.0828; // Lakewood, NJ
 double longitude = -74.2094; // Lakewood, NJ
 double elevation = 20; // optional elevation correction in Meters
 // the String parameter in getTimeZone() has to be a valid timezone listed in TimeZone.getAvailableIDs()
 TimeZone timeZone = TimeZone.getTimeZone("America/New_York");
 GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
 ComplexZmanimCalendar czc = new ComplexZmanimCalendar(location);
 Zman sunset = new Zman(czc.getSunset(), "Sunset");
 Zman shaah16 = new Zman(czc.getShaahZmanis16Point1Degrees(), "Shaah zmanis 16.1");
 Zman sunrise = new Zman(czc.getSunrise(), "Sunrise");
 Zman shaah = new Zman(czc.getShaahZmanisGra(), "Shaah zmanis GRA");
 ArrayList<Zman> zl = new ArrayList<Zman>();
 //will sort sunset, shaah 1.6, sunrise, shaah GRA
 Collections.sort(zl, Zman.DATE_ORDER);
 // will sort sunrise, sunset, shaah, shaah 1.6 (the last 2 are not in any specific order)
 Collections.sort(zl, Zman.DURATION_ORDER);
 // will sort sunrise, sunset (the first 2 are not in any specific order), shaah GRA, shaah 1.6
 Collections.sort(zl, Zman.NAME_ORDER);
 // will sort shaah 1.6, shaah GRA, sunrise, sunset
© Eliyahu Hershfeld 2007-2020
Add secondary sorting. As of now the Comparators in this class do not sort by secondary order. This means that when sorting a Collection of zmanim and using the DATE_ORDER Comparator will have the duration based zmanim at the end, but they will not be sorted by duration. This should be N/A for label based sorting.