001    /*
002     * Zmanim Java API
003     * Copyright (C) 2004-2010 Eliyahu Hershfeld
004     *
005     * This program is free software; you can redistribute it and/or modify it under the terms of the
006     * GNU General Public License as published by the Free Software Foundation; either version 2 of the
007     * License, or (at your option) any later version.
008     *
009     * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
010     * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
011     * General Public License for more details.
012     *
013     * You should have received a copy of the GNU General Public License along with this program; if
014     * not, write to the Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA
015     * 02111-1307, USA or connect to: http://www.fsf.org/copyleft/gpl.html
016     */
017    package net.sourceforge.zmanim;
018    
019    import java.util.Date;
020    
021    import net.sourceforge.zmanim.util.AstronomicalCalculator;
022    import net.sourceforge.zmanim.util.GeoLocation;
023    
024    /**
025     * This class extends ZmanimCalendar and provides many more zmanim than
026     * available in the ZmanimCalendar. The basis for most zmanim in this class are
027     * from the <em>sefer</em> <b>Yisroel Vehazmanim</b> by <b>Rabbi Yisroel Dovid
028     * Harfenes</b>. <br />
029     * For an example of the number of different <em>zmanim</em> made available by
030     * this class, there are methods to return 12 different calculations for
031     * <em>alos</em> (dawn) available in this class. The real power of this API is
032     * the ease in calculating <em>zmanim</em> that are not part of the API. The
033     * methods for doing <em>zmanim</em> calculations not present in this or it's
034     * superclass the {@link ZmanimCalendar} are contained in the
035     * {@link AstronomicalCalendar}, the base class of the calendars in our API
036     * since they are generic methods for calculating time based on degrees or time
037     * before or after {@link #getSunrise sunrise} and {@link #getSunset sunset} and
038     * are of interest for calculation beyond <em>zmanim</em> calculations. Here are
039     * some examples: <br />
040     * First create the Calendar for the location you would like to calculate:
041     * 
042     * <pre>
043     * String locationName = &quot;Lakewood, NJ&quot;;
044     * double latitude = 40.0828; //Lakewood, NJ
045     * double longitude = -74.2094; //Lakewood, NJ
046     * double elevation = 0;
047     * //the String parameter in getTimeZone() has to be a valid timezone listed in {@link java.util.TimeZone#getAvailableIDs()}
048     * TimeZone timeZone = TimeZone.getTimeZone(&quot;America/New_York&quot;);
049     * GeoLocation location = new GeoLocation(locationName, latitude, longitude,
050     *              elevation, timeZone);
051     * ComplexZmanimCalendar czc = new ComplexZmanimCalendar(location);
052     * </pre>
053     * 
054     * Note: For locations such as Israel where the beginning and end of daylight
055     * savings time can fluctuate from year to year create a
056     * {@link java.util.SimpleTimeZone} with the known start and end of DST. <br />
057     * To get alos calculated as 14&deg; below the horizon (as calculated in the
058     * calendars published in Montreal) use:
059     * 
060     * <pre>
061     * Date alos14 = czc.getSunriseOffsetByDegrees(14);
062     * </pre>
063     * 
064     * To get <em>mincha gedola</em> calculated based on the MGA using a <em>shaah
065     * zmanis</em> based on the day starting 16.1&deg; below the horizon (and ending
066     * 16.1&deg; after sunset the following calculation can be used:
067     * 
068     * <pre>
069     * Date minchaGedola = czc.getTimeOffset(czc.getAlos16point1Degrees(), czc
070     *              .getShaahZmanis16Point1Degrees() * 6.5);
071     * </pre>
072     * 
073     * A little more complex example would be calculating <em>plag hamincha</em>
074     * based on a shaah zmanis that was not present in this class. While a drop more
075     * complex it is still rather easy. For example if you wanted to calculate
076     * <em>plag</em> based on the day starting 12&deg; before sunrise and ending
077     * 12&deg; after sunset as calculated in the calendars in Manchester, England
078     * (there is nothing that would prevent your calculating the day using sunrise
079     * and sunset offsets that are not identical degrees, but this would lead to
080     * chatzos being a time other than the {@link #getSunTransit() solar transit}
081     * (solar midday)). The steps involved would be to first calculate the
082     * <em>shaah zmanis</em> and than use that time in milliseconds to calculate
083     * 10.75 hours after sunrise starting at 12&deg; before sunset
084     * 
085     * <pre>
086     * long shaahZmanis = czc.getTemporalHour(czc.getSunriseOffsetByDegrees(12), czc
087     *              .getSunsetOffsetByDegrees(12));
088     * Date plag = getTimeOffset(czc.getSunriseOffsetByDegrees(12),
089     *              shaahZmanis * 10.75);
090     * </pre>
091     * 
092     * <h2>Disclaimer:</h2> While I did my best to get accurate results please do
093     * not rely on these zmanim for <em>halacha lemaaseh</em>
094     * 
095     * @author &copy; Eliyahu Hershfeld 2004 - 2010
096     * @version 1.2
097     */
098    public class ComplexZmanimCalendar extends ZmanimCalendar {
099            private static final long serialVersionUID = 1;
100    
101            /**
102             * The zenith of 3.7&deg; below {@link #GEOMETRIC_ZENITH geometric zenith}
103             * (90&deg;). This calculation is used for calculating <em>tzais</em>
104             * (nightfall) according to some opinions. This calculation is based on the
105             * opinion of the Geonim that <em>tzais</em> is the time it takes to walk
106             * 3/4 of a Mil at 18 minutes a Mil, or 13.5 minutes after sunset. The sun
107             * is 3.7&deg below {@link #GEOMETRIC_ZENITH geometric zenith} at this time
108             * in Jerusalem on March 16, about 4 days before the equinox, the day that a
109             * solar hour is one hour.
110             * 
111             * TODO AT see #getTzaisGeonim3Point7Degrees()
112             */
113            protected static final double ZENITH_3_POINT_7 = GEOMETRIC_ZENITH + 3.7;
114    
115            /**
116             * The zenith of 5.95&deg; below {@link #GEOMETRIC_ZENITH geometric zenith}
117             * (90&deg;). This calculation is used for calculating <em>tzais</em>
118             * (nightfall) according to some opinions. This calculation is based on the
119             * position of the sun 24 minutes after sunset in Jerusalem on March 16,
120             * about 4 days before the equinox, the day that a solar hour is one hour,
121             * which calculates to 5.95&deg; below {@link #GEOMETRIC_ZENITH geometric
122             * zenith}
123             * 
124             * @see #getTzaisGeonim5Point95Degrees()
125             */
126            protected static final double ZENITH_5_POINT_95 = GEOMETRIC_ZENITH + 5.95;
127    
128            /**
129             * The zenith of 7.083&deg; below {@link #GEOMETRIC_ZENITH geometric zenith}
130             * (90&deg;). This is often referred to as 7&deg;5' or 7&deg; and 5 minutes.
131             * This calculation is used for calculating <em>alos</em> (dawn) and
132             * <em>tzais</em> (nightfall) according to some opinions. This calculation
133             * is based on the position of the sun 30 minutes after sunset in Jerusalem
134             * on March 16, about 4 days before the equinox, the day that a solar hour
135             * is one hour, which calculates to 7.0833333&deg; below
136             * {@link #GEOMETRIC_ZENITH geometric zenith}. This is time some opinions
137             * consider dark enough for 3 stars to be visible. This is the opinion of
138             * the Shu"t Melamed Leho'il, Shu"t Binyan Tziyon, Tenuvas Sadeh and very
139             * close to the time of the Mekor Chesed on the Sefer chasidim.
140             * 
141             * @see #getTzaisGeonim7Point083Degrees()
142             * @see #getBainHasmashosRT13Point5MinutesBefore7Point083Degrees()
143             */
144            protected static final double ZENITH_7_POINT_083 = GEOMETRIC_ZENITH + 7
145                            + (5 / 60);
146    
147            /**
148             * The zenith of 10.2&deg; below {@link #GEOMETRIC_ZENITH geometric zenith}
149             * (90&deg;). This calculation is used for calculating <em>misheyakir</em>
150             * according to some opinions. This calculation is based on the position of
151             * the sun 45 minutes before {@link #getSunrise sunrise} in Jerusalem on
152             * March 16, about 4 days before the equinox, the day that a solar hour is
153             * one hour which calculates to 10.2&deg; below {@link #GEOMETRIC_ZENITH
154             * geometric zenith}
155             * 
156             * @see #getMisheyakir10Point2Degrees()
157             */
158            protected static final double ZENITH_10_POINT_2 = GEOMETRIC_ZENITH + 10.2;
159    
160            /**
161             * The zenith of 11&deg; below {@link #GEOMETRIC_ZENITH geometric zenith}
162             * (90&deg;). This calculation is used for calculating <em>misheyakir</em>
163             * according to some opinions. This calculation is based on the position of
164             * the sun 48 minutes before {@link #getSunrise sunrise} in Jerusalem on
165             * March 16, about 4 days before the equinox, the day that a solar hour is
166             * one hour which calculates to 11&deg; below {@link #GEOMETRIC_ZENITH
167             * geometric zenith}
168             * 
169             * @see #getMisheyakir11Degrees()
170             */
171            protected static final double ZENITH_11_DEGREES = GEOMETRIC_ZENITH + 11;
172    
173            /**
174             * The zenith of 11.5&deg; below {@link #GEOMETRIC_ZENITH geometric zenith}
175             * (90&deg;). This calculation is used for calculating <em>misheyakir</em>
176             * according to some opinions. This calculation is based on the position of
177             * the sun 52 minutes before {@link #getSunrise sunrise} in Jerusalem on
178             * March 16, about 4 days before the equinox, the day that a solar hour is
179             * one hour which calculates to 11.5&deg; below {@link #GEOMETRIC_ZENITH
180             * geometric zenith}
181             * 
182             * @see #getMisheyakir11Point5Degrees()
183             */
184            protected static final double ZENITH_11_POINT_5 = GEOMETRIC_ZENITH + 11.5;
185    
186            /**
187             * The zenith of 13&deg; below {@link #GEOMETRIC_ZENITH geometric zenith}
188             * (90&deg;). This calculation is used for calculating
189             * <em>Rabainu Tam's bain hashmashos</em> according to some opinions. <br/>
190             * <br/>
191             * <b>FIXME:</b> See comments on {@link #getBainHasmashosRT13Degrees}. This
192             * should be changed to 13.2477 after confirmation.
193             * 
194             * @see #getBainHasmashosRT13Degrees
195             * 
196             */
197            protected static final double ZENITH_13_DEGREES = GEOMETRIC_ZENITH + 13;
198    
199            /**
200             * The zenith of 19.8&deg; below {@link #GEOMETRIC_ZENITH geometric zenith}
201             * (90&deg;). This calculation is used for calculating <em>alos</em> (dawn)
202             * and <em>tzais</em> (nightfall) according to some opinions. This
203             * calculation is based on the position of the sun 90 minutes after sunset
204             * in Jerusalem on March 16, about 4 days before the equinox, the day that a
205             * solar hour is one hour which calculates to 19.8&deg; below
206             * {@link #GEOMETRIC_ZENITH geometric zenith}
207             * 
208             * @see #getTzais19Point8Degrees()
209             * @see #getAlos19Point8Degrees()
210             * @see #getAlos90()
211             * @see #getTzais90()
212             */
213            protected static final double ZENITH_19_POINT_8 = GEOMETRIC_ZENITH + 19.8;
214    
215            /**
216             * The zenith of 26&deg; below {@link #GEOMETRIC_ZENITH geometric zenith}
217             * (90&deg;). This calculation is used for calculating <em>alos</em> (dawn)
218             * and <em>tzais</em> (nightfall) according to some opinions. This
219             * calculation is based on the position of the sun {@link #getAlos120() 120
220             * minutes} after sunset in Jerusalem on March 16, about 4 days before the
221             * equinox, the day that a solar hour is one hour which calculates to
222             * 26&deg; below {@link #GEOMETRIC_ZENITH geometric zenith}
223             * 
224             * @see #getAlos26Degrees()
225             * @see #getTzais26Degrees()
226             * @see #getAlos120()
227             * @see #getTzais120()
228             */
229            protected static final double ZENITH_26_DEGREES = GEOMETRIC_ZENITH + 26.0;
230    
231            private double ateretTorahSunsetOffset = 40;
232    
233            public ComplexZmanimCalendar(GeoLocation location) {
234                    super(location);
235            }
236    
237            /**
238             * Default constructor will set a default {@link GeoLocation#GeoLocation()},
239             * a default {@link AstronomicalCalculator#getDefault()
240             * AstronomicalCalculator} and default the calendar to the current date.
241             * 
242             * @see AstronomicalCalendar#AstronomicalCalendar()
243             */
244            public ComplexZmanimCalendar() {
245                    super();
246            }
247    
248            /**
249             * Method to return a <em>shaah zmanis</em> (temporal hour) calculated using
250             * a 19.8&deg; dip. This calculation divides the day based on the opinion of
251             * the MGA that the day runs from dawn to dusk. Dawn for this calculation is
252             * when the sun is 19.8&deg; below the eastern geometric horizon before
253             * sunrise. Dusk for this is when the sun is 19.8&deg; below the western
254             * geometric horizon after sunset. This day is split into 12 equal parts
255             * with each part being a <em>shaah zmanis</em>.
256             * 
257             * @return the <code>long</code> millisecond length of a
258             *         <em>shaah zmanis</em>.
259             */
260            public long getShaahZmanis19Point8Degrees() {
261                    return getTemporalHour(getAlos19Point8Degrees(),
262                                    getTzais19Point8Degrees());
263            }
264    
265            /**
266             * Method to return a <em>shaah zmanis</em> (temporal hour) calculated using
267             * a 18&deg; dip. This calculation divides the day based on the opinion of
268             * the MGA that the day runs from dawn to dusk. Dawn for this calculation is
269             * when the sun is 18&deg; below the eastern geometric horizon before
270             * sunrise. Dusk for this is when the sun is 18&deg; below the western
271             * geometric horizon after sunset. This day is split into 12 equal parts
272             * with each part being a <em>shaah zmanis</em>.
273             * 
274             * @return the <code>long</code> millisecond length of a
275             *         <em>shaah zmanis</em>.
276             */
277            public long getShaahZmanis18Degrees() {
278                    return getTemporalHour(getAlos18Degrees(), getTzais18Degrees());
279            }
280    
281            /**
282             * Method to return a <em>shaah zmanis</em> (temporal hour) calculated using
283             * a dip of 26&deg;. This calculation divides the day based on the opinion
284             * of the MGA that the day runs from dawn to dusk. Dawn for this calculation
285             * is when the sun is {@link #getAlos26Degrees() 26&deg;} below the eastern
286             * geometric horizon before sunrise. Dusk for this is when the sun is
287             * {@link #getTzais26Degrees() 26&deg;} below the western geometric horizon
288             * after sunset. This day is split into 12 equal parts with each part being
289             * a <em>shaah zmanis</em>.
290             * 
291             * @return the <code>long</code> millisecond length of a
292             *         <em>shaah zmanis</em>.
293             */
294            public long getShaahZmanis26Degrees() {
295                    return getTemporalHour(getAlos26Degrees(), getTzais26Degrees());
296            }
297    
298            /**
299             * Method to return a <em>shaah zmanis</em> (temporal hour) calculated using
300             * a dip of 16.1&deg;. This calculation divides the day based on the opinion
301             * that the day runs from dawn to dusk. Dawn for this calculation is when
302             * the sun is 16.1&deg; below the eastern geometric horizon before sunrise
303             * and dusk is when the sun is 16.1&deg; below the western geometric horizon
304             * after sunset. This day is split into 12 equal parts with each part being
305             * a <em>shaah zmanis</em>.
306             * 
307             * @return the <code>long</code> millisecond length of a
308             *         <em>shaah zmanis</em>.
309             * @see #getAlos16Point1Degrees()
310             * @see #getTzais16Point1Degrees()
311             * @see #getSofZmanShmaMGA16Point1Degrees()
312             * @see #getSofZmanTfilaMGA16Point1Degrees()
313             * @see #getMinchaGedola16Point1Degrees()
314             * @see #getMinchaKetana16Point1Degrees()
315             * @see #getPlagHamincha16Point1Degrees()
316             */
317    
318            public long getShaahZmanis16Point1Degrees() {
319                    return getTemporalHour(getAlos16Point1Degrees(),
320                                    getTzais16Point1Degrees());
321            }
322    
323            /**
324             * Method to return a <em>shaah zmanis</em> (solar hour) according to the
325             * opinion of the MGA. This calculation divides the day based on the opinion
326             * of the <em>MGA</em> that the day runs from dawn to dusk. Dawn for this
327             * calculation is 60 minutes before sunrise and dusk is 60 minutes after
328             * sunset. This day is split into 12 equal parts with each part being a
329             * <em>shaah zmanis</em>. Alternate mothods of calculating a
330             * <em>shaah zmanis</em> are available in the subclass
331             * {@link ComplexZmanimCalendar}
332             * 
333             * @return the <code>long</code> millisecond length of a
334             *         <em>shaah zmanis</em>.
335             */
336            public long getShaahZmanis60Minutes() {
337                    return getTemporalHour(getAlos60(), getTzais60());
338            }
339    
340            /**
341             * Method to return a <em>shaah zmanis</em> (solar hour) according to the
342             * opinion of the MGA. This calculation divides the day based on the opinion
343             * of the <em>MGA</em> that the day runs from dawn to dusk. Dawn for this
344             * calculation is 72 minutes before sunrise and dusk is 72 minutes after
345             * sunset. This day is split into 12 equal parts with each part being a
346             * <em>shaah zmanis</em>. Alternate mothods of calculating a
347             * <em>shaah zmanis</em> are available in the subclass
348             * {@link ComplexZmanimCalendar}
349             * 
350             * @return the <code>long</code> millisecond length of a
351             *         <em>shaah zmanis</em>.
352             */
353            public long getShaahZmanis72Minutes() {
354                    return getShaahZmanisMGA();
355            }
356    
357            /**
358             * Method to return a <em>shaah zmanis</em> (temporal hour) according to the
359             * opinion of the MGA based on <em>alos</em> being
360             * {@link #getAlos72Zmanis() 72} minutes <em>zmaniyos</em> before
361             * {@link #getSunrise() sunrise}. This calculation divides the day based on
362             * the opinion of the <em>MGA</em> that the day runs from dawn to dusk. Dawn
363             * for this calculation is 72 minutes <em>zmaniyos</em> before sunrise and
364             * dusk is 72 minutes <em>zmaniyos</em> after sunset. This day is split into
365             * 12 equal parts with each part being a <em>shaah zmanis</em>. This is
366             * identical to 1/10th of the day from {@link #getSunrise() sunrise} to
367             * {@link #getSunset() sunset}.
368             * 
369             * @return the <code>long</code> millisecond length of a
370             *         <em>shaah zmanis</em>.
371             * @see #getAlos72Zmanis()
372             * @see #getTzais72Zmanis()
373             */
374            public long getShaahZmanis72MinutesZmanis() {
375                    return getTemporalHour(getAlos72Zmanis(), getTzais72Zmanis());
376            }
377    
378            /**
379             * Method to return a <em>shaah zmanis</em> (temporal hour) calculated using
380             * a dip of 90 minutes. This calculation divides the day based on the
381             * opinion of the MGA that the day runs from dawn to dusk. Dawn for this
382             * calculation is 90 minutes before sunrise and dusk is 90 minutes after
383             * sunset. This day is split into 12 equal parts with each part being a
384             * <em>shaah zmanis</em>.
385             * 
386             * @return the <code>long</code> millisecond length of a
387             *         <em>shaah zmanis</em>.
388             */
389            public long getShaahZmanis90Minutes() {
390                    return getTemporalHour(getAlos90(), getTzais90());
391            }
392    
393            /**
394             * Method to return a <em>shaah zmanis</em> (temporal hour) according to the
395             * opinion of the MGA based on <em>alos</em> being
396             * {@link #getAlos90Zmanis() 90} minutes <em>zmaniyos</em> before
397             * {@link #getSunrise() sunrise}. This calculation divides the day based on
398             * the opinion of the <em>MGA</em> that the day runs from dawn to dusk. Dawn
399             * for this calculation is 90 minutes <em>zmaniyos</em> before sunrise and
400             * dusk is 90 minutes <em>zmaniyos</em> after sunset. This day is split into
401             * 12 equal parts with each part being a <em>shaah zmanis</em>. This is
402             * identical to 1/8th of the day from {@link #getSunrise() sunrise} to
403             * {@link #getSunset() sunset}.
404             * 
405             * @return the <code>long</code> millisecond length of a
406             *         <em>shaah zmanis</em>.
407             * @see #getAlos90Zmanis()
408             * @see #getTzais90Zmanis()
409             */
410            public long getShaahZmanis90MinutesZmanis() {
411                    return getTemporalHour(getAlos90Zmanis(), getTzais90Zmanis());
412            }
413    
414            /**
415             * Method to return a <em>shaah zmanis</em> (temporal hour) according to the
416             * opinion of the MGA based on <em>alos</em> being
417             * {@link #getAlos96Zmanis() 96} minutes <em>zmaniyos</em> before
418             * {@link #getSunrise() sunrise}. This calculation divides the day based on
419             * the opinion of the <em>MGA</em> that the day runs from dawn to dusk. Dawn
420             * for this calculation is 96 minutes <em>zmaniyos</em> before sunrise and
421             * dusk is 96 minutes <em>zmaniyos</em> after sunset. This day is split into
422             * 12 equal parts with each part being a <em>shaah zmanis</em>. This is
423             * identical to 1/7.5th of the day from {@link #getSunrise() sunrise} to
424             * {@link #getSunset() sunset}.
425             * 
426             * @return the <code>long</code> millisecond length of a
427             *         <em>shaah zmanis</em>.
428             * @see #getAlos96Zmanis()
429             * @see #getTzais96Zmanis()
430             */
431            public long getShaahZmanis96MinutesZmanis() {
432                    return getTemporalHour(getAlos96Zmanis(), getTzais96Zmanis());
433            }
434    
435            /**
436             * Method to return a <em>shaah zmanis</em> (temporal hour) according to the
437             * opinion of the Chacham Yosef Harari-Raful of Yeshivat Ateret Torah
438             * calculated with <em>alos</em> being 1/10th of sunrise to sunset day, or
439             * {@link #getAlos72Zmanis() 72} minutes <em>zmaniyos</em> of such a day
440             * before {@link #getSunrise() sunrise}, and tzais is usually calculated as
441             * {@link #getTzaisAteretTorah() 40 minutes} after {@link #getSunset()
442             * sunset}. This day is split into 12 equal parts with each part being a
443             * <em>shaah zmanis</em>. Note that with this system, chatzos (mid-day) will
444             * not be the point that the sun is {@link #getSunTransit() halfway across
445             * the sky}.
446             * 
447             * @return the <code>long</code> millisecond length of a
448             *         <em>shaah zmanis</em>.
449             * @see #getAlos72Zmanis()
450             * @see #getTzaisAteretTorah()
451             * @see #getAteretTorahSunsetOffset()
452             * @see #setAteretTorahSunsetOffset(double)
453             */
454            public long getShaahZmanisAteretTorah() {
455                    return getTemporalHour(getAlos72Zmanis(), getTzaisAteretTorah());
456            }
457    
458            /**
459             * Method to return a <em>shaah zmanis</em> (temporal hour) calculated using
460             * a dip of 96 minutes. This calculation divides the day based on the
461             * opinion of the MGA that the day runs from dawn to dusk. Dawn for this
462             * calculation is 96 minutes before sunrise and dusk is 96 minutes after
463             * sunset. This day is split into 12 equal parts with each part being a
464             * <em>shaah zmanis</em>.
465             * 
466             * @return the <code>long</code> millisecond length of a
467             *         <em>shaah zmanis</em>.
468             */
469            public long getShaahZmanis96Minutes() {
470                    return getTemporalHour(getAlos96(), getTzais96());
471            }
472    
473            /**
474             * Method to return a <em>shaah zmanis</em> (temporal hour) calculated using
475             * a dip of 120 minutes. This calculation divides the day based on the
476             * opinion of the MGA that the day runs from dawn to dusk. Dawn for this
477             * calculation is 120 minutes before sunrise and dusk is 120 minutes after
478             * sunset. This day is split into 12 equal parts with each part being a
479             * <em>shaah zmanis</em>.
480             * 
481             * @return the <code>long</code> millisecond length of a
482             *         <em>shaah zmanis</em>.
483             */
484            public long getShaahZmanis120Minutes() {
485                    return getTemporalHour(getAlos120(), getTzais120());
486            }
487    
488            /**
489             * Method to return a <em>shaah zmanis</em> (temporal hour) according to the
490             * opinion of the MGA based on <em>alos</em> being
491             * {@link #getAlos120Zmanis() 120} minutes <em>zmaniyos</em> before
492             * {@link #getSunrise() sunrise}. This calculation divides the day based on
493             * the opinion of the <em>MGA</em> that the day runs from dawn to dusk. Dawn
494             * for this calculation is 120 minutes <em>zmaniyos</em> before sunrise and
495             * dusk is 120 minutes <em>zmaniyos</em> after sunset. This day is split
496             * into 12 equal parts with each part being a <em>shaah zmanis</em>. This is
497             * identical to 1/6th of the day from {@link #getSunrise() sunrise} to
498             * {@link #getSunset() sunset}.
499             * 
500             * @return the <code>long</code> millisecond length of a
501             *         <em>shaah zmanis</em>.
502             * @see #getAlos120Zmanis()
503             * @see #getTzais120Zmanis()
504             */
505            public long getShaahZmanis120MinutesZmanis() {
506                    return getTemporalHour(getAlos120Zmanis(), getTzais120Zmanis());
507            }
508    
509            /**
510             * This method returns the time of <em>plag hamincha</em>. This is
511             * calculated as 10.75 hours after {@link #getAlos96Zmanis() dawn}. The
512             * formula used is:<br/>
513             * 10.75 * {@link #getShaahZmanis96MinutesZmanis()} after
514             * {@link #getAlos96Zmanis() dawn}.
515             * 
516             * @return the <code>Date</code> of the time of <em>plag hamincha</em>.
517             */
518            public Date getPlagHamincha120MinutesZmanis() {
519                    return getTimeOffset(getAlos120Zmanis(),
520                                    getShaahZmanis120MinutesZmanis() * 10.75);
521            }
522    
523            /**
524             * This method returns the time of <em>plag hamincha</em>. This is
525             * calculated as 10.75 hours after {@link #getAlos72() dawn}. The formula
526             * used is:<br/>
527             * 10.75 {@link #getShaahZmanis72Minutes()} after {@link #getAlos72()}.
528             * 
529             * @return the <code>Date</code> of the time of <em>plag hamincha</em>.
530             */
531            public Date getPlagHamincha120Minutes() {
532                    return getTimeOffset(getAlos120(), getShaahZmanis120Minutes() * 10.75);
533            }
534    
535            /**
536             * Method to return <em>alos</em> (dawn) calculated using 60 minutes before
537             * {@link #getSeaLevelSunrise() sea level sunrise} on the time to walk the
538             * distance of 4 <em>Mil</em> at 15 minutes a <em>Mil</em> (the opinion of
539             * the Chavas Yair. See the Divray Malkiel). This is based on the opinion of
540             * most <em>Rishonim</em> who stated that the time of the <em>Neshef</em>
541             * (time between dawn and sunrise) does not vary by the time of year or
542             * location but purely depends on the time it takes to walk the distance of
543             * 4 <em>Mil</em>.
544             * 
545             * @return the <code>Date</code> representing the time.
546             */
547            public Date getAlos60() {
548                    return getTimeOffset(getSeaLevelSunrise(), -60 * MINUTE_MILLIS);
549            }
550    
551            /**
552             * Method to return <em>alos</em> (dawn) calculated using 72 minutes
553             * <em>zmaniyos</em>( <em>GR"A</em> and the <em>Baal Hatanya</em>) or 1/10th
554             * of the day before sea level sunrise. This is based on an 18 minute
555             * <em>Mil</em> so the time for 4 <em>Mil</em> is 72 minutes which is 1/10th
556             * of a day (12 * 60 = 720) based on the day starting at
557             * {@link #getSeaLevelSunrise() sea level sunrise} and ending at
558             * {@link #getSeaLevelSunset() sea level sunset}. The actual alculation is
559             * {@link #getSeaLevelSunrise()}- ( {@link #getShaahZmanisGra()} * 1.2).
560             * This calculation is used in the calendars published by
561             * <em>Hisachdus Harabanim D'Artzos Habris Ve'Kanada</em>
562             * 
563             * @return the <code>Date</code> representing the time.
564             * @see #getShaahZmanisGra()
565             */
566            public Date getAlos72Zmanis() {
567                    long shaahZmanis = getShaahZmanisGra();
568                    if (shaahZmanis == Long.MIN_VALUE) {
569                            return null;
570                    }
571                    return getTimeOffset(getSeaLevelSunrise(), (long) (shaahZmanis * -1.2));
572            }
573    
574            /**
575             * Method to return <em>alos</em> (dawn) calculated using 96 minutes before
576             * {@link #getSeaLevelSunrise() sea level sunrise} based on the time to walk
577             * the distance of 4 <em>Mil</em> at 24 minutes a <em>Mil</em>. This is
578             * based on the opinion of most <em>Rishonim</em> who stated that the time
579             * of the <em>Neshef</em> (time between dawn and sunrise) does not vary by
580             * the time of year or location but purely depends on the time it takes to
581             * walk the distance of 4 <em>Mil</em>.
582             * 
583             * @return the <code>Date</code> representing the time.
584             */
585            public Date getAlos96() {
586                    return getTimeOffset(getSeaLevelSunrise(), -96 * MINUTE_MILLIS);
587            }
588    
589            /**
590             * Method to return <em>alos</em> (dawn) calculated using 90 minutes
591             * <em>zmaniyos</em>( <em>GR"A</em> and the <em>Baal Hatanya</em>) or 1/8th
592             * of the day before sea level sunrise. This is based on a 22.5 minute
593             * <em>Mil</em> so the time for 4 <em>Mil</em> is 90 minutes which is 1/8th
594             * of a day (12 * 60 = 720) /8 =90 based on the day starting at
595             * {@link #getSunrise() sunrise} and ending at {@link #getSunset() sunset}.
596             * The actual calculation is {@link #getSunrise()} - (
597             * {@link #getShaahZmanisGra()} * 1.5).
598             * 
599             * @return the <code>Date</code> representing the time.
600             * @see #getShaahZmanisGra()
601             */
602            public Date getAlos90Zmanis() {
603                    long shaahZmanis = getShaahZmanisGra();
604                    if (shaahZmanis == Long.MIN_VALUE) {
605                            return null;
606                    }
607                    return getTimeOffset(getSeaLevelSunrise(), (long) (shaahZmanis * -1.5));
608            }
609    
610            /**
611             * Method to return <em>alos</em> (dawn) calculated using 90 minutes
612             * <em>zmaniyos</em>( <em>GR"A</em> and the <em>Baal Hatanya</em>) or 1/8th
613             * of the day before sea level sunrise. This is based on a 24 minute
614             * <em>Mil</em> so the time for 4 <em>Mil</em> is 90 minutes which is
615             * 1/7.5th of a day (12 * 60 = 720) / 7.5 =96 based on the day starting at
616             * {@link #getSunrise() sunrise} and ending at {@link #getSunset() sunset}.
617             * The actual calculation is {@link #getSunrise()} - (
618             * {@link #getShaahZmanisGra()} * 1.6).
619             * 
620             * @return the <code>Date</code> representing the time.
621             * @see #getShaahZmanisGra()
622             */
623            public Date getAlos96Zmanis() {
624                    long shaahZmanis = getShaahZmanisGra();
625                    if (shaahZmanis == Long.MIN_VALUE) {
626                            return null;
627                    }
628                    return getTimeOffset(getSeaLevelSunrise(), (long) (shaahZmanis * -1.6));
629            }
630    
631            /**
632             * Method to return <em>alos</em> (dawn) calculated using 90 minutes before
633             * {@link #getSeaLevelSunrise() sea level sunrise} on the time to walk the
634             * distance of 4 <em>Mil</em> at 22.5 minutes a <em>Mil</em>. This is based
635             * on the opinion of most <em>Rishonim</em> who stated that the time of the
636             * <em>Neshef</em> (time between dawn and sunrise) does not vary by the time
637             * of year or location but purely depends on the time it takes to walk the
638             * distance of 4 <em>Mil</em>.
639             * 
640             * @return the <code>Date</code> representing the time.
641             */
642            public Date getAlos90() {
643                    return getTimeOffset(getSeaLevelSunrise(), -90 * MINUTE_MILLIS);
644            }
645    
646            /**
647             * Method to return <em>alos</em> (dawn) calculated using 120 minutes before
648             * {@link #getSeaLevelSunrise() sea level sunrise} (no adjustment for
649             * elevation is made) based on the time to walk the distance of 5
650             * <em>Mil</em>( <em>Ula</em>) at 24 minutes a <em>Mil</em>. This is based
651             * on the opinion of most <em>Rishonim</em> who stated that the time of the
652             * <em>Neshef</em> (time between dawn and sunrise) does not vary by the time
653             * of year or location but purely depends on the time it takes to walk the
654             * distance of 5 <em>Mil</em>(<em>Ula</em>).
655             * 
656             * @return the <code>Date</code> representing the time.
657             */
658            public Date getAlos120() {
659                    return getTimeOffset(getSeaLevelSunrise(), -120 * MINUTE_MILLIS);
660            }
661    
662            /**
663             * Method to return <em>alos</em> (dawn) calculated using 120 minutes
664             * <em>zmaniyos</em>( <em>GR"A</em> and the <em>Baal Hatanya</em>) or 1/6th
665             * of the day before sea level sunrise. This is based on a 24 minute
666             * <em>Mil</em> so the time for 5 <em>Mil</em> is 120 minutes which is 1/6th
667             * of a day (12 * 60 = 720) / 6 =120 based on the day starting at
668             * {@link #getSunrise() sunrise} and ending at {@link #getSunset() sunset}.
669             * The actual calculation is {@link #getSunrise()} - (
670             * {@link #getShaahZmanisGra()} * 2).
671             * 
672             * @return the <code>Date</code> representing the time.
673             * @see #getShaahZmanisGra()
674             */
675            public Date getAlos120Zmanis() {
676                    long shaahZmanis = getShaahZmanisGra();
677                    if (shaahZmanis == Long.MIN_VALUE) {
678                            return null;
679                    }
680                    return getTimeOffset(getSeaLevelSunrise(), shaahZmanis * -2);
681            }
682    
683            /**
684             * Method to return <em>alos</em> (dawn) calculated when the sun is
685             * {@link #ZENITH_26_DEGREES 26&deg;} below the eastern geometric horizon
686             * before sunrise. This calculation is based on the same calculation of
687             * {@link #getAlos120() 120 minutes} but uses a degree based calculation
688             * instead of 120 exact minutes. This calculation is based on the position
689             * of the sun 120 minutes before sunrise in Jerusalem in the equinox which
690             * calculates to 26&deg; below {@link #GEOMETRIC_ZENITH geometric zenith}.
691             * 
692             * @return the <code>Date</code> representing <em>alos</em>.
693             * @see #ZENITH_26_DEGREES
694             * @see #getAlos120()
695             * @see #getTzais120()
696             */
697            public Date getAlos26Degrees() {
698                    return getSunriseOffsetByDegrees(ZENITH_26_DEGREES);
699            }
700    
701            /**
702             * to return <em>alos</em> (dawn) calculated when the sun is
703             * {@link #ASTRONOMICAL_ZENITH 18&deg;} below the eastern geometric horizon
704             * before sunrise.
705             * 
706             * @return the <code>Date</code> representing <em>alos</em>.
707             * @see #ASTRONOMICAL_ZENITH
708             */
709            public Date getAlos18Degrees() {
710                    return getSunriseOffsetByDegrees(ASTRONOMICAL_ZENITH);
711            }
712    
713            /**
714             * Method to return <em>alos</em> (dawn) calculated when the sun is
715             * {@link #ZENITH_19_POINT_8 19.8&deg;} below the eastern geometric horizon
716             * before sunrise. This calculation is based on the same calculation of
717             * {@link #getAlos90() 90 minutes} but uses a degree based calculation
718             * instead of 90 exact minutes. This calculation is based on the position of
719             * the sun 90 minutes before sunrise in Jerusalem in the equinox which
720             * calculates to 19.8&deg; below {@link #GEOMETRIC_ZENITH geometric zenith}
721             * 
722             * @return the <code>Date</code> representing <em>alos</em>.
723             * @see #ZENITH_19_POINT_8
724             * @see #getAlos90()
725             */
726            public Date getAlos19Point8Degrees() {
727                    return getSunriseOffsetByDegrees(ZENITH_19_POINT_8);
728            }
729    
730            /**
731             * Method to return <em>alos</em> (dawn) calculated when the sun is
732             * {@link #ZENITH_16_POINT_1 16.1&deg;} below the eastern geometric horizon
733             * before sunrise. This calculation is based on the same calculation of
734             * {@link #getAlos72() 72 minutes} but uses a degree based calculation
735             * instead of 72 exact minutes. This calculation is based on the position of
736             * the sun 72 minutes before sunrise in Jerusalem in the equinox which
737             * calculates to 16.1&deg; below {@link #GEOMETRIC_ZENITH geometric zenith}.
738             * 
739             * @return the <code>Date</code> representing <em>alos</em>.
740             * @see #ZENITH_16_POINT_1
741             * @see #getAlos72()
742             */
743            public Date getAlos16Point1Degrees() {
744                    return getSunriseOffsetByDegrees(ZENITH_16_POINT_1);
745            }
746    
747            /**
748             * This method returns <em>misheyakir</em> based on the position of the sun
749             * when it is {@link #ZENITH_11_DEGREES 11.5&deg;} below
750             * {@link #GEOMETRIC_ZENITH geometric zenith} (90&deg;). This calculation is
751             * used for calculating <em>misheyakir</em> according to some opinions. This
752             * calculation is based on the position of the sun 52 minutes before
753             * {@link #getSunrise sunrise}in Jerusalem in the equinox which calculates
754             * to 11.5&deg; below {@link #GEOMETRIC_ZENITH geometric zenith}
755             * 
756             * @see #ZENITH_11_POINT_5
757             */
758            public Date getMisheyakir11Point5Degrees() {
759                    return getSunriseOffsetByDegrees(ZENITH_11_POINT_5);
760            }
761    
762            /**
763             * This method returns <em>misheyakir</em> based on the position of the sun
764             * when it is {@link #ZENITH_11_DEGREES 11&deg;} below
765             * {@link #GEOMETRIC_ZENITH geometric zenith} (90&deg;). This calculation is
766             * used for calculating <em>misheyakir</em> according to some opinions. This
767             * calculation is based on the position of the sun 48 minutes before
768             * {@link #getSunrise sunrise}in Jerusalem in the equinox which calculates
769             * to 11&deg; below {@link #GEOMETRIC_ZENITH geometric zenith}
770             * 
771             * @see #ZENITH_11_DEGREES
772             */
773            public Date getMisheyakir11Degrees() {
774                    return getSunriseOffsetByDegrees(ZENITH_11_DEGREES);
775            }
776    
777            /**
778             * This method returns <em>misheyakir</em> based on the position of the sun
779             * when it is {@link #ZENITH_10_POINT_2 10.2&deg;} below
780             * {@link #GEOMETRIC_ZENITH geometric zenith} (90&deg;). This calculation is
781             * used for calculating <em>misheyakir</em> according to some opinions. This
782             * calculation is based on the position of the sun 45 minutes before
783             * {@link #getSunrise sunrise} in Jerusalem in the equinox which calculates
784             * to 10.2&deg; below {@link #GEOMETRIC_ZENITH geometric zenith}
785             * 
786             * @see #ZENITH_10_POINT_2
787             */
788            public Date getMisheyakir10Point2Degrees() {
789                    return getSunriseOffsetByDegrees(ZENITH_10_POINT_2);
790            }
791    
792            /**
793             * This method returns the latest <em>zman krias shema</em> (time to say
794             * Shema in the morning) in the opinion of the <em>MG"A</em> based on
795             * <em>alos</em> being {@link #getAlos19Point8Degrees()() 19.8&deg;} before
796             * {@link #getSunrise() sunrise}. This time is 3
797             * <em>{@link #getShaahZmanis19Point8Degrees() shaos zmaniyos}</em> (solar
798             * hours) after {@link #getAlos19Point8Degrees() dawn} based on the opinion
799             * of the <em>MG"A</em> that the day is calculated from dawn to nightfall
800             * with both being 19.8&deg; below sunrise or sunset. This returns the time
801             * of 3 {@link #getShaahZmanis19Point8Degrees()} after
802             * {@link #getAlos19Point8Degrees() dawn}.
803             * 
804             * @return the <code>Date</code> of the latest zman shema.
805             * @see #getShaahZmanis19Point8Degrees()
806             * @see #getAlos19Point8Degrees()
807             */
808            public Date getSofZmanShmaMGA19Point8Degrees() {
809                    return getTimeOffset(getAlos19Point8Degrees(),
810                                    getShaahZmanis19Point8Degrees() * 3);
811            }
812    
813            /**
814             * This method returns the latest <em>zman krias shema</em> (time to say
815             * Shema in the morning) in the opinion of the <em>MG"A</em> based on
816             * <em>alos</em> being {@link #getAlos16Point1Degrees()() 16.1&deg;} before
817             * {@link #getSunrise() sunrise}. This time is 3
818             * <em>{@link #getShaahZmanis16Point1Degrees() shaos zmaniyos}</em> (solar
819             * hours) after {@link #getAlos16Point1Degrees() dawn} based on the opinion
820             * of the <em>MG"A</em> that the day is calculated from dawn to nightfall
821             * with both being 16.1&deg; below sunrise or sunset. This returns the time
822             * of 3 {@link #getShaahZmanis16Point1Degrees()} after
823             * {@link #getAlos16Point1Degrees() dawn}.
824             * 
825             * @return the <code>Date</code> of the latest zman shema.
826             * @see #getShaahZmanis16Point1Degrees()
827             * @see #getAlos16Point1Degrees()
828             */
829            public Date getSofZmanShmaMGA16Point1Degrees() {
830                    return getTimeOffset(getAlos16Point1Degrees(),
831                                    getShaahZmanis16Point1Degrees() * 3);
832            }
833    
834            /**
835             * This method returns the latest <em>zman krias shema</em> (time to say
836             * Shema in the morning) in the opinion of the <em>MG"A</em> based on
837             * <em>alos</em> being {@link #getAlos72() 72} minutes before
838             * {@link #getSunrise() sunrise}. This time is 3
839             * <em>{@link #getShaahZmanis72Minutes() shaos zmaniyos}</em> (solar hours)
840             * after {@link #getAlos72() dawn} based on the opinion of the <em>MG"A</em>
841             * that the day is calculated from a {@link #getAlos72() dawn} of 72 minutes
842             * before sunrise to {@link #getTzais72() nightfall} of 72 minutes after
843             * sunset. This returns the time of 3 * {@link #getShaahZmanis72Minutes()}
844             * after {@link #getAlos72() dawn}. This class returns an identical time to
845             * {@link #getSofZmanShmaMGA()} and is repeated here for clarity.
846             * 
847             * @return the <code>Date</code> of the latest zman shema.
848             * @see #getShaahZmanis72Minutes()
849             * @see #getAlos72()
850             * @see #getSofZmanShmaMGA()
851             */
852            public Date getSofZmanShmaMGA72Minutes() {
853                    return getSofZmanShmaMGA();
854            }
855    
856            /**
857             * This method returns the latest <em>zman krias shema</em> (time to say
858             * Shema in the morning) in the opinion of the <em>MG"A</em> based on
859             * <em>alos</em> being {@link #getAlos72Zmanis() 72} minutes
860             * <em>zmaniyos</em>, or 1/10th of the day before {@link #getSunrise()
861             * sunrise}. This time is 3
862             * <em>{@link #getShaahZmanis90MinutesZmanis() shaos zmaniyos}</em> (solar
863             * hours) after {@link #getAlos72Zmanis() dawn} based on the opinion of the
864             * <em>MG"A</em> that the day is calculated from a
865             * {@link #getAlos72Zmanis() dawn} of 72 minutes <em>zmaniyos</em>, or
866             * 1/10th of the day before {@link #getSeaLevelSunrise() sea level sunrise}
867             * to {@link #getTzais72Zmanis() nightfall} of 72 minutes <em>zmaniyos</em>
868             * after {@link #getSeaLevelSunset() sea level sunset}. This returns the
869             * time of 3 * {@link #getShaahZmanis72MinutesZmanis()} after
870             * {@link #getAlos72Zmanis() dawn}.
871             * 
872             * @return the <code>Date</code> of the latest zman shema.
873             * @see #getShaahZmanis72MinutesZmanis()
874             * @see #getAlos72Zmanis()
875             */
876            public Date getSofZmanShmaMGA72MinutesZmanis() {
877                    return getTimeOffset(getAlos72Zmanis(),
878                                    getShaahZmanis72MinutesZmanis() * 3);
879            }
880    
881            /**
882             * This method returns the latest <em>zman krias shema</em> (time to say
883             * Shema in the morning) in the opinion of the <em>MG"A</em> based on
884             * <em>alos</em> being {@link #getAlos90() 90} minutes before
885             * {@link #getSunrise() sunrise}. This time is 3
886             * <em>{@link #getShaahZmanis90Minutes() shaos zmaniyos}</em> (solar hours)
887             * after {@link #getAlos90() dawn} based on the opinion of the <em>MG"A</em>
888             * that the day is calculated from a {@link #getAlos90() dawn} of 90 minutes
889             * before sunrise to {@link #getTzais90() nightfall} of 90 minutes after
890             * sunset. This returns the time of 3 * {@link #getShaahZmanis90Minutes()}
891             * after {@link #getAlos90() dawn}.
892             * 
893             * @return the <code>Date</code> of the latest zman shema.
894             * @see #getShaahZmanis90Minutes()
895             * @see #getAlos90()
896             */
897            public Date getSofZmanShmaMGA90Minutes() {
898                    return getTimeOffset(getAlos90(), getShaahZmanis90Minutes() * 3);
899            }
900    
901            /**
902             * This method returns the latest <em>zman krias shema</em> (time to say
903             * Shema in the morning) in the opinion of the <em>MG"A</em> based on
904             * <em>alos</em> being {@link #getAlos90Zmanis() 90} minutes
905             * <em>zmaniyos</em> before {@link #getSunrise() sunrise}. This time is 3
906             * <em>{@link #getShaahZmanis90MinutesZmanis() shaos zmaniyos}</em> (solar
907             * hours) after {@link #getAlos90Zmanis() dawn} based on the opinion of the
908             * <em>MG"A</em> that the day is calculated from a
909             * {@link #getAlos90Zmanis() dawn} of 90 minutes <em>zmaniyos</em> before
910             * sunrise to {@link #getTzais90Zmanis() nightfall} of 90 minutes
911             * <em>zmaniyos</em> after sunset. This returns the time of 3 *
912             * {@link #getShaahZmanis90MinutesZmanis()} after {@link #getAlos90Zmanis()
913             * dawn}.
914             * 
915             * @return the <code>Date</code> of the latest zman shema.
916             * @see #getShaahZmanis90MinutesZmanis()
917             * @see #getAlos90Zmanis()
918             */
919            public Date getSofZmanShmaMGA90MinutesZmanis() {
920                    return getTimeOffset(getAlos90Zmanis(),
921                                    getShaahZmanis90MinutesZmanis() * 3);
922            }
923    
924            /**
925             * This method returns the latest <em>zman krias shema</em> (time to say
926             * Shema in the morning) in the opinion of the <em>MG"A</em> based on
927             * <em>alos</em> being {@link #getAlos96() 96} minutes before
928             * {@link #getSunrise() sunrise}. This time is 3
929             * <em>{@link #getShaahZmanis96Minutes() shaos zmaniyos}</em> (solar hours)
930             * after {@link #getAlos96() dawn} based on the opinion of the <em>MG"A</em>
931             * that the day is calculated from a {@link #getAlos96() dawn} of 96 minutes
932             * before sunrise to {@link #getTzais96() nightfall} of 96 minutes after
933             * sunset. This returns the time of 3 * {@link #getShaahZmanis96Minutes()}
934             * after {@link #getAlos96() dawn}.
935             * 
936             * @return the <code>Date</code> of the latest zman shema.
937             * @see #getShaahZmanis96Minutes()
938             * @see #getAlos96()
939             */
940            public Date getSofZmanShmaMGA96Minutes() {
941                    return getTimeOffset(getAlos96(), getShaahZmanis96Minutes() * 3);
942            }
943    
944            /**
945             * This method returns the latest <em>zman krias shema</em> (time to say
946             * Shema in the morning) in the opinion of the <em>MG"A</em> based on
947             * <em>alos</em> being {@link #getAlos90Zmanis() 96} minutes
948             * <em>zmaniyos</em> before {@link #getSunrise() sunrise}. This time is 3
949             * <em>{@link #getShaahZmanis96MinutesZmanis() shaos zmaniyos}</em> (solar
950             * hours) after {@link #getAlos96Zmanis() dawn} based on the opinion of the
951             * <em>MG"A</em> that the day is calculated from a
952             * {@link #getAlos96Zmanis() dawn} of 96 minutes <em>zmaniyos</em> before
953             * sunrise to {@link #getTzais90Zmanis() nightfall} of 96 minutes
954             * <em>zmaniyos</em> after sunset. This returns the time of 3 *
955             * {@link #getShaahZmanis96MinutesZmanis()} after {@link #getAlos96Zmanis()
956             * dawn}.
957             * 
958             * @return the <code>Date</code> of the latest zman shema.
959             * @see #getShaahZmanis96MinutesZmanis()
960             * @see #getAlos96Zmanis()
961             */
962            public Date getSofZmanShmaMGA96MinutesZmanis() {
963                    return getTimeOffset(getAlos96Zmanis(),
964                                    getShaahZmanis96MinutesZmanis() * 3);
965            }
966    
967            /**
968             * This method returns the latest <em>zman krias shema</em> (time to say
969             * Shema in the morning) calculated as 3 hours (regular and not zmaniyos)
970             * before {@link ZmanimCalendar#getChatzos()}. This is the opinion of the
971             * <em>Shach</em> in the
972             * <em>Nekudas Hakesef (Yora Deah 184), Shevus Yaakov, Chasan Sofer</em> and
973             * others.This returns the time of 3 hours before
974             * {@link ZmanimCalendar#getChatzos()}.
975             * 
976             * @return the <code>Date</code> of the latest zman shema.
977             * @see ZmanimCalendar#getChatzos()
978             * @see #getSofZmanTfila2HoursBeforeChatzos()
979             */
980            public Date getSofZmanShma3HoursBeforeChatzos() {
981                    return getTimeOffset(getChatzos(), -180 * MINUTE_MILLIS);
982            }
983    
984            /**
985             * This method returns the latest <em>zman krias shema</em> (time to say
986             * Shema in the morning) in the opinion of the <em>MG"A</em> based on
987             * <em>alos</em> being {@link #getAlos120() 120} minutes or 1/6th of the day
988             * before {@link #getSunrise() sunrise}. This time is 3
989             * <em>{@link #getShaahZmanis120Minutes() shaos zmaniyos}</em> (solar hours)
990             * after {@link #getAlos120() dawn} based on the opinion of the
991             * <em>MG"A</em> that the day is calculated from a {@link #getAlos120()
992             * dawn} of 120 minutes before sunrise to {@link #getTzais120() nightfall}
993             * of 120 minutes after sunset. This returns the time of 3 *
994             * {@link #getShaahZmanis120Minutes()} after {@link #getAlos120() dawn}.
995             * 
996             * @return the <code>Date</code> of the latest zman shema.
997             * @see #getShaahZmanis120Minutes()
998             * @see #getAlos120()
999             */
1000            public Date getSofZmanShmaMGA120Minutes() {
1001                    return getTimeOffset(getAlos120(), getShaahZmanis120Minutes() * 3);
1002            }
1003    
1004            /**
1005             * This method returns the latest <em>zman krias shema</em> (time to say
1006             * Shema in the morning) based on the opinion that the day starts at
1007             * <em>{@link #getAlos16Point1Degrees() alos 16.1&deg;}</em> and ends at
1008             * {@link #getSeaLevelSunset() sea level sunset}. 3 shaos zmaniyos are
1009             * calculated based on this day and added to
1010             * {@link #getAlos16Point1Degrees() alos}to reach this time. This time is 3
1011             * <em>shaos zmaniyos</em> (solar hours) after
1012             * {@link #getAlos16Point1Degrees() dawn} based on the opinion that the day
1013             * is calculated from a {@link #getAlos16Point1Degrees() alos 16.1&deg;} to
1014             * {@link #getSeaLevelSunset() sea level sunset}.<br />
1015             * <b>Note: </b> Based on this calculation <em>chatzos</em> will not be at
1016             * midday.
1017             * 
1018             * @return the <code>Date</code> of the latest zman shema based on this day.
1019             * @see #getAlos16Point1Degrees()
1020             * @see #getSeaLevelSunset()
1021             */
1022            public Date getSofZmanShmaAlos16Point1ToSunset() {
1023                    long shaahZmanis = getTemporalHour(getAlos16Point1Degrees(),
1024                                    getSeaLevelSunset());
1025                    return getTimeOffset(getAlos16Point1Degrees(), shaahZmanis * 3);
1026            }
1027    
1028            /**
1029             * This method returns the latest <em>zman krias shema</em> (time to say
1030             * Shema in the morning) based on the opinion that the day starts at
1031             * <em>{@link #getAlos16Point1Degrees() alos 16.1&deg;}</em> and ends at
1032             * {@link #getTzaisGeonim7Point083Degrees() tzais 7.083&deg;}. 3
1033             * <em>shaos zmaniyos</em> are calculated based on this day and added to
1034             * {@link #getAlos16Point1Degrees() alos} to reach this time. This time is 3
1035             * <em>shaos zmaniyos</em> (temporal hours) after
1036             * {@link #getAlos16Point1Degrees() alos 16.1&deg;} based on the opinion
1037             * that the day is calculated from a {@link #getAlos16Point1Degrees() alos
1038             * 16.1&deg;} to
1039             * <em>{@link #getTzaisGeonim7Point083Degrees() tzais 7.083&deg;}</em>.<br />
1040             * <b>Note: </b> Based on this calculation <em>chatzos</em> will not be at
1041             * midday.
1042             * 
1043             * @return the <code>Date</code> of the latest zman shema based on this
1044             *         calculation.
1045             * @see #getAlos16Point1Degrees()
1046             * @see #getTzaisGeonim7Point083Degrees()
1047             */
1048            public Date getSofZmanShmaAlos16Point1ToTzaisGeonim7Point083Degrees() {
1049                    long shaahZmanis = getTemporalHour(getAlos16Point1Degrees(),
1050                                    getTzaisGeonim7Point083Degrees());
1051                    return getTimeOffset(getAlos16Point1Degrees(), shaahZmanis * 3);
1052            }
1053    
1054            /**
1055             * From the GR"A in Kol Eliyahu on Berachos #173 that states that zman krias
1056             * shema is calculated as half the time from {@link #getSeaLevelSunrise()
1057             * sea level sunset} to fixed local chatzos. The GR"A himself seems to
1058             * contradic this when he stated that zman krias shema is 1/4 of the day
1059             * from sunrise to sunset. See Sarah Lamoed #25 in Yisroel Vehazmanim Vol
1060             * III page 1016.
1061             * 
1062             * @return the <code>Date</code> of the latest zman shema based on this
1063             *         calculation.
1064             * @see #getFixedLocalChatzos()
1065             */
1066            public Date getSofZmanShmaKolEliyahu() {
1067                    Date chatzos = getFixedLocalChatzos();
1068                    if (chatzos == null || getSunrise() == null) {
1069                            return null;
1070                    }
1071                    long diff = (chatzos.getTime() - getSeaLevelSunrise().getTime()) / 2;
1072                    return getTimeOffset(chatzos, -diff);
1073            }
1074    
1075            /**
1076             * This method returns the latest <em>zman tfila</em> (time to say the
1077             * morning prayers) in the opinion of the <em>MG"A</em> based on
1078             * <em>alos</em> being {@link #getAlos19Point8Degrees()() 19.8&deg;} before
1079             * {@link #getSunrise() sunrise}. This time is 4
1080             * <em>{@link #getShaahZmanis19Point8Degrees() shaos zmaniyos}</em> (solar
1081             * hours) after {@link #getAlos19Point8Degrees() dawn} based on the opinion
1082             * of the <em>MG"A</em> that the day is calculated from dawn to nightfall
1083             * with both being 19.8&deg; below sunrise or sunset. This returns the time
1084             * of 4 {@link #getShaahZmanis19Point8Degrees()} after
1085             * {@link #getAlos19Point8Degrees() dawn}.
1086             * 
1087             * @return the <code>Date</code> of the latest zman shema.
1088             * 
1089             * @see #getShaahZmanis19Point8Degrees()
1090             * @see #getAlos19Point8Degrees()
1091             */
1092            public Date getSofZmanTfilaMGA19Point8Degrees() {
1093                    return getTimeOffset(getAlos19Point8Degrees(),
1094                                    getShaahZmanis19Point8Degrees() * 4);
1095            }
1096    
1097            /**
1098             * This method returns the latest <em>zman tfila</em> (time to say the
1099             * morning prayers) in the opinion of the <em>MG"A</em> based on
1100             * <em>alos</em> being {@link #getAlos19Point8Degrees()() 16.1&deg;} before
1101             * {@link #getSunrise() sunrise}. This time is 4
1102             * <em>{@link #getShaahZmanis16Point1Degrees() shaos zmaniyos}</em> (solar
1103             * hours) after {@link #getAlos16Point1Degrees() dawn} based on the opinion
1104             * of the <em>MG"A</em> that the day is calculated from dawn to nightfall
1105             * with both being 16.1&deg; below sunrise or sunset. This returns the time
1106             * of 4 {@link #getShaahZmanis16Point1Degrees()} after
1107             * {@link #getAlos16Point1Degrees() dawn}.
1108             * 
1109             * @return the <code>Date</code> of the latest zman shema.
1110             * 
1111             * @see #getShaahZmanis16Point1Degrees()
1112             * @see #getAlos16Point1Degrees()
1113             */
1114            public Date getSofZmanTfilaMGA16Point1Degrees() {
1115                    return getTimeOffset(getAlos16Point1Degrees(),
1116                                    getShaahZmanis16Point1Degrees() * 4);
1117            }
1118    
1119            /**
1120             * This method returns the latest <em>zman tfila</em> (time to say the
1121             * morning prayers) in the opinion of the <em>MG"A</em> based on
1122             * <em>alos</em> being {@link #getAlos72() 72} minutes before
1123             * {@link #getSunrise() sunrise}. This time is 4
1124             * <em>{@link #getShaahZmanis72Minutes() shaos zmaniyos}</em> (solar hours)
1125             * after {@link #getAlos72() dawn} based on the opinion of the <em>MG"A</em>
1126             * that the day is calculated from a {@link #getAlos72() dawn} of 72 minutes
1127             * before sunrise to {@link #getTzais72() nightfall} of 72 minutes after
1128             * sunset. This returns the time of 4 * {@link #getShaahZmanis72Minutes()}
1129             * after {@link #getAlos72() dawn}. This class returns an identical time to
1130             * {@link #getSofZmanTfilaMGA()} and is repeated here for clarity.
1131             * 
1132             * @return the <code>Date</code> of the latest zman tfila.
1133             * @see #getShaahZmanis72Minutes()
1134             * @see #getAlos72()
1135             * @see #getSofZmanShmaMGA()
1136             */
1137            public Date getSofZmanTfilaMGA72Minutes() {
1138                    return getSofZmanTfilaMGA();
1139            }
1140    
1141            /**
1142             * This method returns the latest <em>zman tfila</em> (time to the morning
1143             * prayers) in the opinion of the <em>MG"A</em> based on <em>alos</em> being
1144             * {@link #getAlos72Zmanis() 72} minutes <em>zmaniyos</em> before
1145             * {@link #getSunrise() sunrise}. This time is 4
1146             * <em>{@link #getShaahZmanis72MinutesZmanis() shaos zmaniyos}</em> (solar
1147             * hours) after {@link #getAlos72Zmanis() dawn} based on the opinion of the
1148             * <em>MG"A</em> that the day is calculated from a
1149             * {@link #getAlos72Zmanis() dawn} of 72 minutes <em>zmaniyos</em> before
1150             * sunrise to {@link #getTzais72Zmanis() nightfall} of 72 minutes
1151             * <em>zmaniyos</em> after sunset. This returns the time of 4 *
1152             * {@link #getShaahZmanis72MinutesZmanis()} after {@link #getAlos72Zmanis()
1153             * dawn}.
1154             * 
1155             * @return the <code>Date</code> of the latest zman shema.
1156             * @see #getShaahZmanis72MinutesZmanis()
1157             * @see #getAlos72Zmanis()
1158             */
1159            public Date getSofZmanTfilaMGA72MinutesZmanis() {
1160                    return getTimeOffset(getAlos72Zmanis(),
1161                                    getShaahZmanis72MinutesZmanis() * 4);
1162            }
1163    
1164            /**
1165             * This method returns the latest <em>zman tfila</em> (time to say the
1166             * morning prayers) in the opinion of the <em>MG"A</em> based on
1167             * <em>alos</em> being {@link #getAlos90() 90} minutes before
1168             * {@link #getSunrise() sunrise}. This time is 4
1169             * <em>{@link #getShaahZmanis90Minutes() shaos zmaniyos}</em> (solar hours)
1170             * after {@link #getAlos90() dawn} based on the opinion of the <em>MG"A</em>
1171             * that the day is calculated from a {@link #getAlos90() dawn} of 90 minutes
1172             * before sunrise to {@link #getTzais90() nightfall} of 90 minutes after
1173             * sunset. This returns the time of 4 * {@link #getShaahZmanis90Minutes()}
1174             * after {@link #getAlos90() dawn}.
1175             * 
1176             * @return the <code>Date</code> of the latest zman tfila.
1177             * @see #getShaahZmanis90Minutes()
1178             * @see #getAlos90()
1179             */
1180            public Date getSofZmanTfilaMGA90Minutes() {
1181                    return getTimeOffset(getAlos90(), getShaahZmanis90Minutes() * 4);
1182            }
1183    
1184            /**
1185             * This method returns the latest <em>zman tfila</em> (time to the morning
1186             * prayers) in the opinion of the <em>MG"A</em> based on <em>alos</em> being
1187             * {@link #getAlos90Zmanis() 90} minutes <em>zmaniyos</em> before
1188             * {@link #getSunrise() sunrise}. This time is 4
1189             * <em>{@link #getShaahZmanis90MinutesZmanis() shaos zmaniyos}</em> (solar
1190             * hours) after {@link #getAlos90Zmanis() dawn} based on the opinion of the
1191             * <em>MG"A</em> that the day is calculated from a
1192             * {@link #getAlos90Zmanis() dawn} of 90 minutes <em>zmaniyos</em> before
1193             * sunrise to {@link #getTzais90Zmanis() nightfall} of 90 minutes
1194             * <em>zmaniyos</em> after sunset. This returns the time of 4 *
1195             * {@link #getShaahZmanis90MinutesZmanis()} after {@link #getAlos90Zmanis()
1196             * dawn}.
1197             * 
1198             * @return the <code>Date</code> of the latest zman shema.
1199             * @see #getShaahZmanis90MinutesZmanis()
1200             * @see #getAlos90Zmanis()
1201             */
1202            public Date getSofZmanTfilaMGA90MinutesZmanis() {
1203                    return getTimeOffset(getAlos90Zmanis(),
1204                                    getShaahZmanis90MinutesZmanis() * 4);
1205            }
1206    
1207            /**
1208             * This method returns the latest <em>zman tfila</em> (time to say the
1209             * morning prayers) in the opinion of the <em>MG"A</em> based on
1210             * <em>alos</em> being {@link #getAlos96() 96} minutes before
1211             * {@link #getSunrise() sunrise}. This time is 4
1212             * <em>{@link #getShaahZmanis96Minutes() shaos zmaniyos}</em> (solar hours)
1213             * after {@link #getAlos96() dawn} based on the opinion of the <em>MG"A</em>
1214             * that the day is calculated from a {@link #getAlos96() dawn} of 96 minutes
1215             * before sunrise to {@link #getTzais96() nightfall} of 96 minutes after
1216             * sunset. This returns the time of 4 * {@link #getShaahZmanis96Minutes()}
1217             * after {@link #getAlos96() dawn}.
1218             * 
1219             * @return the <code>Date</code> of the latest zman tfila.
1220             * @see #getShaahZmanis96Minutes()
1221             * @see #getAlos96()
1222             */
1223            public Date getSofZmanTfilaMGA96Minutes() {
1224                    return getTimeOffset(getAlos96(), getShaahZmanis96Minutes() * 4);
1225            }
1226    
1227            /**
1228             * This method returns the latest <em>zman tfila</em> (time to the morning
1229             * prayers) in the opinion of the <em>MG"A</em> based on <em>alos</em> being
1230             * {@link #getAlos96Zmanis() 96} minutes <em>zmaniyos</em> before
1231             * {@link #getSunrise() sunrise}. This time is 4
1232             * <em>{@link #getShaahZmanis96MinutesZmanis() shaos zmaniyos}</em> (solar
1233             * hours) after {@link #getAlos96Zmanis() dawn} based on the opinion of the
1234             * <em>MG"A</em> that the day is calculated from a
1235             * {@link #getAlos96Zmanis() dawn} of 96 minutes <em>zmaniyos</em> before
1236             * sunrise to {@link #getTzais96Zmanis() nightfall} of 96 minutes
1237             * <em>zmaniyos</em> after sunset. This returns the time of 4 *
1238             * {@link #getShaahZmanis96MinutesZmanis()} after {@link #getAlos96Zmanis()
1239             * dawn}.
1240             * 
1241             * @return the <code>Date</code> of the latest zman shema.
1242             * @see #getShaahZmanis90MinutesZmanis()
1243             * @see #getAlos90Zmanis()
1244             */
1245            public Date getSofZmanTfilaMGA96MinutesZmanis() {
1246                    return getTimeOffset(getAlos96Zmanis(),
1247                                    getShaahZmanis96MinutesZmanis() * 4);
1248            }
1249    
1250            /**
1251             * This method returns the latest <em>zman tfila</em> (time to say the
1252             * morning prayers) in the opinion of the <em>MG"A</em> based on
1253             * <em>alos</em> being {@link #getAlos120() 120} minutes before
1254             * {@link #getSunrise() sunrise}. This time is 4
1255             * <em>{@link #getShaahZmanis120Minutes() shaos zmaniyos}</em> (solar hours)
1256             * after {@link #getAlos120() dawn} based on the opinion of the
1257             * <em>MG"A</em> that the day is calculated from a {@link #getAlos120()
1258             * dawn} of 120 minutes before sunrise to {@link #getTzais120() nightfall}
1259             * of 120 minutes after sunset. This returns the time of 4 *
1260             * {@link #getShaahZmanis120Minutes()} after {@link #getAlos120() dawn}.
1261             * 
1262             * @return the <code>Date</code> of the latest zman shema.
1263             * @see #getShaahZmanis120Minutes()
1264             * @see #getAlos120()
1265             */
1266            public Date getSofZmanTfilaMGA120Minutes() {
1267                    return getTimeOffset(getAlos120(), getShaahZmanis120Minutes() * 4);
1268            }
1269    
1270            /**
1271             * This method returns the latest <em>zman tfila</em> (time to say the
1272             * morning prayers) calculated as 2 hours befor
1273             * {@link ZmanimCalendar#getChatzos()}. This is based on the opinions that
1274             * calculate <em>sof zman krias shema</em> as
1275             * {@link #getSofZmanShma3HoursBeforeChatzos()}. This returns the time of 2
1276             * hours before {@link ZmanimCalendar#getChatzos()}.
1277             * 
1278             * @return the <code>Date</code> of the latest zman shema.
1279             * @see ZmanimCalendar#getChatzos()
1280             * @see #getSofZmanShma3HoursBeforeChatzos()
1281             */
1282            public Date getSofZmanTfila2HoursBeforeChatzos() {
1283                    return getTimeOffset(getChatzos(), -120 * MINUTE_MILLIS);
1284            }
1285    
1286            /**
1287             * This method returns mincha gedola calculated as 30 minutes after
1288             * <em>{@link #getChatzos() chatzos}</em> and not 1/2 of a
1289             * <em>{@link #getShaahZmanisGra() shaah zmanis}</em> after
1290             * <em>{@link #getChatzos() chatzos}</em> as calculated by
1291             * {@link #getMinchaGedola}. Some use this time to delay the start of mincha
1292             * in the winter when 1/2 of a
1293             * <em>{@link #getShaahZmanisGra() shaah zmanis}</em> is less than 30
1294             * minutes. See {@link #getMinchaGedolaGreaterThan30()}for a conveniance
1295             * method that returns the later of the 2 calculations. One should not use
1296             * this time to start <em>mincha</em> before the standard
1297             * <em>{@link #getMinchaGedola() mincha gedola}</em>. See <em>Shulchan Aruch
1298             * Orach Chayim Siman Raish Lamed Gimel seif alef</em> and the
1299             * <em>Shaar Hatziyon seif katan ches</em>.
1300             * 
1301             * @return the <code>Date</code> of 30 mintes after <em>chatzos</em>.
1302             * @see #getMinchaGedola()
1303             * @see #getMinchaGedolaGreaterThan30()
1304             */
1305            public Date getMinchaGedola30Minutes() {
1306                    return getTimeOffset(getChatzos(), MINUTE_MILLIS * 30);
1307            }
1308    
1309            /**
1310             * This method returns the time of <em>mincha gedola</em> according to the
1311             * Magen Avraham with the day starting 72 minutes before sunrise and ending
1312             * 72 minutes after sunset. This is the earliest time to pray
1313             * <em>mincha</em>. For more information on this see the documentation on
1314             * <em>{@link #getMinchaGedola() mincha gedola}</em>. This is calculated as
1315             * 6.5 {@link #getTemporalHour() solar hours} after alos. The calculation
1316             * used is 6.5 * {@link #getShaahZmanis72Minutes()} after
1317             * {@link #getAlos72() alos}.
1318             * 
1319             * @see #getAlos72()()
1320             * @see #getMinchaGedola()
1321             * @see #getMinchaKetana()
1322             * @see ZmanimCalendar#getMinchaGedola()
1323             * @return the <code>Date</code> of the time of mincha gedola.
1324             */
1325            public Date getMinchaGedola72Minutes() {
1326                    return getTimeOffset(getAlos72(), getShaahZmanis72Minutes() * 6.5);
1327            }
1328    
1329            /**
1330             * This method returns the time of <em>mincha gedola</em> according to the
1331             * Magen Avraham with the day starting and ending 16.1&deg; below the
1332             * horizon. This is the earliest time to pray <em>mincha</em>. For more
1333             * information on this see the documentation on
1334             * <em>{@link #getMinchaGedola() mincha gedola}</em>. This is calculated as
1335             * 6.5 {@link #getTemporalHour() solar hours} after alos. The calculation
1336             * used is 6.5 * {@link #getShaahZmanis16Point1Degrees()} after
1337             * {@link #getAlos16Point1Degrees() alos}.
1338             * 
1339             * @see #getShaahZmanis16Point1Degrees()
1340             * @see #getMinchaGedola()
1341             * @see #getMinchaKetana()
1342             * @return the <code>Date</code> of the time of mincha gedola.
1343             */
1344            public Date getMinchaGedola16Point1Degrees() {
1345                    return getTimeOffset(getAlos16Point1Degrees(),
1346                                    getShaahZmanis16Point1Degrees() * 6.5);
1347            }
1348    
1349            /**
1350             * This is a conveniance methd that returns the later of
1351             * {@link #getMinchaGedola()} and {@link #getMinchaGedola30Minutes()}. In the
1352             * winter when a <em>{@link #getShaahZmanisGra() shaah zmanis}</em> is less
1353             * than 30 minutes {@link #getMinchaGedola30Minutes()} will be returned,
1354             * otherwise {@link #getMinchaGedola()} will be returned.
1355             * 
1356             * @return the <code>Date</code> of the later of {@link #getMinchaGedola()}
1357             *         and {@link #getMinchaGedola30Minutes()}
1358             */
1359            public Date getMinchaGedolaGreaterThan30() {
1360                    if (getMinchaGedola30Minutes() == null || getMinchaGedola() == null) {
1361                            return null;
1362                    } else {
1363                            return getMinchaGedola30Minutes().compareTo(getMinchaGedola()) > 0 ? getMinchaGedola30Minutes()
1364                                            : getMinchaGedola();
1365                    }
1366            }
1367    
1368            /**
1369             * This method returns the time of <em>mincha ketana</em> according to the
1370             * Magen Avraham with the day starting and ending 16.1&deg; below the
1371             * horizon. This is the perfered earliest time to pray <em>mincha</em> in
1372             * the opinion of the Ramba"m and others. For more information on this see
1373             * the documentation on <em>{@link #getMinchaGedola() mincha gedola}</em>.
1374             * This is calculated as 9.5 {@link #getTemporalHour() solar hours} after
1375             * alos. The calculation used is 9.5 *
1376             * {@link #getShaahZmanis16Point1Degrees()} after
1377             * {@link #getAlos16Point1Degrees() alos}.
1378             * 
1379             * @see #getShaahZmanis16Point1Degrees()
1380             * @see #getMinchaGedola()
1381             * @see #getMinchaKetana()
1382             * @return the <code>Date</code> of the time of mincha ketana.
1383             */
1384            public Date getMinchaKetana16Point1Degrees() {
1385                    return getTimeOffset(getAlos16Point1Degrees(),
1386                                    getShaahZmanis16Point1Degrees() * 9.5);
1387            }
1388    
1389            /**
1390             * This method returns the time of <em>mincha ketana</em> according to the
1391             * Magen Avraham with the day starting 72 minutes before sunrise and ending
1392             * 72 minutes after sunset. This is the perfered earliest time to pray
1393             * <em>mincha</em> in the opinion of the Ramba"m and others. For more
1394             * information on this see the documentation on
1395             * <em>{@link #getMinchaGedola() mincha gedola}</em>. This is calculated as
1396             * 9.5 {@link #getShaahZmanis72Minutes()} after alos. The calculation used
1397             * is 9.5 * {@link #getShaahZmanis72Minutes()} after {@link #getAlos72()
1398             * alos}.
1399             * 
1400             * @see #getShaahZmanis16Point1Degrees()
1401             * @see #getMinchaGedola()
1402             * @see #getMinchaKetana()
1403             * @return the <code>Date</code> of the time of mincha ketana.
1404             */
1405            public Date getMinchaKetana72Minutes() {
1406                    return getTimeOffset(getAlos72(), getShaahZmanis72Minutes() * 9.5);
1407            }
1408    
1409            /**
1410             * This method returns the time of <em>plag hamincha</em>. This is
1411             * calculated as 10.75 hours after {@link #getAlos72() dawn}. The formula
1412             * used is:<br/>
1413             * 10.75 {@link #getShaahZmanis72Minutes()} after {@link #getAlos72()}.
1414             * 
1415             * @return the <code>Date</code> of the time of <em>plag hamincha</em>.
1416             */
1417            public Date getPlagHamincha60Minutes() {
1418                    return getTimeOffset(getAlos60(), getShaahZmanis60Minutes() * 10.75);
1419            }
1420    
1421            /**
1422             * This method returns the time of <em>plag hamincha</em>. This is
1423             * calculated as 10.75 hours after {@link #getAlos72() dawn}. The formula
1424             * used is:<br/>
1425             * 10.75 {@link #getShaahZmanis72Minutes()} after {@link #getAlos72()}.
1426             * 
1427             * @return the <code>Date</code> of the time of <em>plag hamincha</em>.
1428             */
1429            public Date getPlagHamincha72Minutes() {
1430                    return getTimeOffset(getAlos72(), getShaahZmanis72Minutes() * 10.75);
1431            }
1432    
1433            /**
1434             * This method returns the time of <em>plag hamincha</em>. This is
1435             * calculated as 10.75 hours after {@link #getAlos90() dawn}. The formula
1436             * used is:<br/>
1437             * 10.75 {@link #getShaahZmanis90Minutes()} after {@link #getAlos90()}.
1438             * 
1439             * @return the <code>Date</code> of the time of <em>plag hamincha</em>.
1440             */
1441            public Date getPlagHamincha90Minutes() {
1442                    return getTimeOffset(getAlos90(), getShaahZmanis90Minutes() * 10.75);
1443            }
1444    
1445            /**
1446             * This method returns the time of <em>plag hamincha</em>. This is
1447             * calculated as 10.75 hours after {@link #getAlos96() dawn}. The formula
1448             * used is:<br/>
1449             * 10.75 {@link #getShaahZmanis96Minutes()} after {@link #getAlos96()}.
1450             * 
1451             * @return the <code>Date</code> of the time of <em>plag hamincha</em>.
1452             */
1453            public Date getPlagHamincha96Minutes() {
1454                    return getTimeOffset(getAlos96(), getShaahZmanis96Minutes() * 10.75);
1455            }
1456    
1457            /**
1458             * This method returns the time of <em>plag hamincha</em>. This is
1459             * calculated as 10.75 hours after {@link #getAlos96Zmanis() dawn}. The
1460             * formula used is:<br/>
1461             * 10.75 * {@link #getShaahZmanis96MinutesZmanis()} after
1462             * {@link #getAlos96Zmanis() dawn}.
1463             * 
1464             * @return the <code>Date</code> of the time of <em>plag hamincha</em>.
1465             */
1466            public Date getPlagHamincha96MinutesZmanis() {
1467                    return getTimeOffset(getAlos96Zmanis(),
1468                                    getShaahZmanis96MinutesZmanis() * 10.75);
1469            }
1470    
1471            /**
1472             * This method returns the time of <em>plag hamincha</em>. This is
1473             * calculated as 10.75 hours after {@link #getAlos90Zmanis() dawn}. The
1474             * formula used is:<br/>
1475             * 10.75 * {@link #getShaahZmanis90MinutesZmanis()} after
1476             * {@link #getAlos90Zmanis() dawn}.
1477             * 
1478             * @return the <code>Date</code> of the time of <em>plag hamincha</em>.
1479             */
1480            public Date getPlagHamincha90MinutesZmanis() {
1481                    return getTimeOffset(getAlos90Zmanis(),
1482                                    getShaahZmanis90MinutesZmanis() * 10.75);
1483            }
1484    
1485            /**
1486             * This method returns the time of <em>plag hamincha</em>. This is
1487             * calculated as 10.75 hours after {@link #getAlos72Zmanis() dawn}. The
1488             * formula used is:<br/>
1489             * 10.75 * {@link #getShaahZmanis72MinutesZmanis()} after
1490             * {@link #getAlos72Zmanis() dawn}.
1491             * 
1492             * @return the <code>Date</code> of the time of <em>plag hamincha</em>.
1493             */
1494            public Date getPlagHamincha72MinutesZmanis() {
1495                    return getTimeOffset(getAlos72Zmanis(),
1496                                    getShaahZmanis72MinutesZmanis() * 10.75);
1497            }
1498    
1499            /**
1500             * This method returns the time of <em>plag hamincha</em> based on the
1501             * opinion that the day starts at
1502             * <em>{@link #getAlos16Point1Degrees() alos 16.1&deg;}</em> and ends at
1503             * <em>{@link #getTzais16Point1Degrees() tzais 16.1&deg;}</em>. This is
1504             * calculated as 10.75 hours <em>zmaniyos</em> after
1505             * {@link #getAlos16Point1Degrees() dawn}. The formula is<br/>
1506             * 10.75 * {@link #getShaahZmanis16Point1Degrees()} after
1507             * {@link #getAlos16Point1Degrees()}.
1508             * 
1509             * @return the <code>Date</code> of the time of <em>plag hamincha</em>.
1510             */
1511            public Date getPlagHamincha16Point1Degrees() {
1512                    return getTimeOffset(getAlos16Point1Degrees(),
1513                                    getShaahZmanis16Point1Degrees() * 10.75);
1514            }
1515    
1516            /**
1517             * This method returns the time of <em>plag hamincha</em> based on the
1518             * opinion that the day starts at
1519             * <em>{@link #getAlos19Point8Degrees() alos 19.8&deg;}</em> and ends at
1520             * <em>{@link #getTzais19Point8Degrees() tzais 19.8&deg;}</em>. This is
1521             * calculated as 10.75 hours <em>zmaniyos</em> after
1522             * {@link #getAlos19Point8Degrees() dawn}. The formula is<br/>
1523             * 10.75 * {@link #getShaahZmanis19Point8Degrees()} after
1524             * {@link #getAlos19Point8Degrees()}.
1525             * 
1526             * @return the <code>Date</code> of the time of <em>plag hamincha</em>.
1527             */
1528            public Date getPlagHamincha19Point8Degrees() {
1529                    return getTimeOffset(getAlos19Point8Degrees(),
1530                                    getShaahZmanis19Point8Degrees() * 10.75);
1531            }
1532    
1533            /**
1534             * This method returns the time of <em>plag hamincha</em> based on the
1535             * opinion that the day starts at
1536             * <em>{@link #getAlos26Degrees() alos 26&deg;}</em> and ends at
1537             * <em>{@link #getTzais26Degrees() tzais 26&deg;}</em>. This is calculated
1538             * as 10.75 hours <em>zmaniyos</em> after {@link #getAlos26Degrees() dawn}.
1539             * The formula is<br/>
1540             * 10.75 * {@link #getShaahZmanis26Degrees()} after
1541             * {@link #getAlos26Degrees()}.
1542             * 
1543             * @return the <code>Date</code> of the time of <em>plag hamincha</em>.
1544             */
1545            public Date getPlagHamincha26Degrees() {
1546                    return getTimeOffset(getAlos26Degrees(),
1547                                    getShaahZmanis26Degrees() * 10.75);
1548            }
1549    
1550            /**
1551             * This method returns the time of <em>plag hamincha</em> based on the
1552             * opinion that the day starts at
1553             * <em>{@link #getAlos18Degrees() alos 18&deg;}</em> and ends at
1554             * <em>{@link #getTzais18Degrees() tzais 18&deg;}</em>. This is calculated
1555             * as 10.75 hours <em>zmaniyos</em> after {@link #getAlos18Degrees() dawn}.
1556             * The formula is<br/>
1557             * 10.75 * {@link #getShaahZmanis18Degrees()} after
1558             * {@link #getAlos18Degrees()}.
1559             * 
1560             * @return the <code>Date</code> of the time of <em>plag hamincha</em>.
1561             */
1562            public Date getPlagHamincha18Degrees() {
1563                    return getTimeOffset(getAlos18Degrees(),
1564                                    getShaahZmanis18Degrees() * 10.75);
1565            }
1566    
1567            /**
1568             * This method returns the time of <em>plag hamincha</em> based on the
1569             * opinion that the day starts at
1570             * <em>{@link #getAlos16Point1Degrees() alos 16.1&deg;}</em> and ends at
1571             * {@link #getSunset() sunset}. 10.75 shaos zmaniyos are calculated based on
1572             * this day and added to {@link #getAlos16Point1Degrees() alos} to reach
1573             * this time. This time is 10.75 <em>shaos zmaniyos</em> (temporal hours)
1574             * after {@link #getAlos16Point1Degrees() dawn} based on the opinion that
1575             * the day is calculated from a {@link #getAlos16Point1Degrees() dawn} of
1576             * 16.1 degrees before sunrise to {@link #getSeaLevelSunset() sea level
1577             * sunset}. This returns the time of 10.75 * the calculated
1578             * <em>shaah zmanis</em> after {@link #getAlos16Point1Degrees() dawn}.
1579             * 
1580             * @return the <code>Date</code> of the plag.
1581             * @see #getAlos16Point1Degrees()
1582             * @see #getSeaLevelSunset()
1583             */
1584            public Date getPlagAlosToSunset() {
1585                    long shaahZmanis = getTemporalHour(getAlos16Point1Degrees(),
1586                                    getSeaLevelSunset());
1587                    return getTimeOffset(getAlos16Point1Degrees(), shaahZmanis * 10.75);
1588            }
1589    
1590            /**
1591             * This method returns the time of <em>plag hamincha</em> based on the
1592             * opinion that the day starts at
1593             * <em>{@link #getAlos16Point1Degrees() alos 16.1&deg;}</em> and ends at
1594             * {@link #getTzaisGeonim7Point083Degrees() tzais}. 10.75 shaos zmaniyos are
1595             * calculated based on this day and added to
1596             * {@link #getAlos16Point1Degrees() alos} to reach this time. This time is
1597             * 10.75 <em>shaos zmaniyos</em> (temporal hours) after
1598             * {@link #getAlos16Point1Degrees() dawn} based on the opinion that the day
1599             * is calculated from a {@link #getAlos16Point1Degrees() dawn} of 16.1
1600             * degrees before sunrise to {@link #getTzaisGeonim7Point083Degrees() tzais}
1601             * . This returns the time of 10.75 * the calculated <em>shaah zmanis</em>
1602             * after {@link #getAlos16Point1Degrees() dawn}.
1603             * 
1604             * @return the <code>Date</code> of the plag.
1605             * @see #getAlos16Point1Degrees()
1606             * @see #getTzaisGeonim7Point083Degrees()
1607             */
1608            public Date getPlagAlos16Point1ToTzaisGeonim7Point083Degrees() {
1609                    long shaahZmanis = getTemporalHour(getAlos16Point1Degrees(),
1610                                    getTzaisGeonim7Point083Degrees());
1611                    return getTimeOffset(getAlos16Point1Degrees(), shaahZmanis * 10.75);
1612            }
1613    
1614            /**
1615             * This method returns Bain Hashmashos of Rabainu Tam calculated as the time
1616             * the sun is 13&deg; below {@link #GEOMETRIC_ZENITH geometric zenith}
1617             * (90&deg;). <br/>
1618             * <br/>
1619             * <b>FIXME:</b> As per Yisroel Vehazmanim Vol III page 1028 No 50, the
1620             * 13&deg; is slightly inaccurate. He lists it as a drop less than 13&deg;.
1621             * Calculations show that is seems to be 13.2477&deg; below the horizon at
1622             * that time. This makes a difference of 1 minute and 10 seconds in
1623             * Jerusalem in the Equinox, and 1 minute 29 seconds in the solstice. for NY
1624             * in the solstice, the difference is 1 minute 56 seconds.
1625             * 
1626             * @return the <code>Date</code> of the sun being 13&deg; below
1627             *         {@link #GEOMETRIC_ZENITH geometric zenith} (90&deg;).
1628             * @see #ZENITH_13_DEGREES
1629             * 
1630             */
1631            public Date getBainHasmashosRT13Degrees() {
1632                    return getSunsetOffsetByDegrees(ZENITH_13_DEGREES);
1633            }
1634    
1635            /**
1636             * This method returns Bain Hashmashos of Rabainu Tam calculated as a 58.5
1637             * minute offset after sunset. Bain hashmashos is 3/4 of a mil before tzais
1638             * or 3 1/4 mil after sunset. With a mil calculated as 18 minutes, 3.25 * 18
1639             * = 58.5 minutes.
1640             * 
1641             * @return the <code>Date</code> of 58.5 minutes after sunset
1642             * 
1643             */
1644            public Date getBainHasmashosRT58Point5Minutes() {
1645                    return getTimeOffset(getSeaLevelSunset(), 58.5 * MINUTE_MILLIS);
1646            }
1647    
1648            /**
1649             * This method returns the time of <em>bain hashmashos</em> based on the
1650             * calculation of 13.5 minutes (3/4 of an 18 minute mil before shkiah
1651             * calculated as {@link #getTzaisGeonim7Point083Degrees() 7.083&deg;}.
1652             * 
1653             * @return the <code>Date</code> of the bain hashmashos of Rabainu Tam in
1654             *         this calculation.
1655             * @see #getTzaisGeonim7Point083Degrees()
1656             */
1657            public Date getBainHasmashosRT13Point5MinutesBefore7Point083Degrees() {
1658                    return getTimeOffset(getSunsetOffsetByDegrees(ZENITH_7_POINT_083),
1659                                    -13.5 * MINUTE_MILLIS);
1660            }
1661    
1662            /**
1663             * This method returns <em>bain hashmashos</em> of Rabainu Tam calculated in
1664             * the opinion of the Divray Yosef (see Yisrael Vehazmanim) calculated
1665             * 5/18th (27.77%) of the time between alos (calculated as 19.8&deg; before
1666             * sunrise) and sunrise. This is added to sunset to arrive at the time for
1667             * bain hashmashos of Rabainu Tam).
1668             * 
1669             * @return the <code>Date</code> of bain hashmashos of Rabainu Tam for this
1670             *         calculation.
1671             */
1672            public Date getBainHasmashosRT2Stars() {
1673                    Date alos19Point8 = getAlos19Point8Degrees();
1674                    Date sunrise = getSeaLevelSunrise();
1675                    if (alos19Point8 == null || sunrise == null) {
1676                            return null;
1677                    }
1678                    return getTimeOffset(getSeaLevelSunset(),
1679                                    (sunrise.getTime() - alos19Point8.getTime()) * (5 / 18d));
1680            }
1681    
1682            /**
1683             * This method returns the <em>tzais</em> (nightfall) based on the opinion
1684             * of the <em>Geonim</em> calculated at the sun's position at
1685             * {@link #ZENITH_5_POINT_95 5.95&deg;} below the western horizon.
1686             * 
1687             * @return the <code>Date</code> representing the time when the sun is
1688             *         5.95&deg; below sea level.
1689             * @see #ZENITH_5_POINT_95
1690             */
1691            // public Date getTzaisGeonim3Point7Degrees() {
1692            // return getSunsetOffsetByDegrees(ZENITH_3_POINT_7);
1693            // }
1694            /**
1695             * This method returns the <em>tzais</em> (nightfall) based on the opinion
1696             * of the <em>Geonim</em> calculated at the sun's position at
1697             * {@link #ZENITH_5_POINT_95 5.95&deg;} below the western horizon.
1698             * 
1699             * @return the <code>Date</code> representing the time when the sun is
1700             *         5.95&deg; below sea level.
1701             * @see #ZENITH_5_POINT_95
1702             */
1703            public Date getTzaisGeonim5Point95Degrees() {
1704                    return getSunsetOffsetByDegrees(ZENITH_5_POINT_95);
1705            }
1706    
1707            /**
1708             * This method returns the <em>tzais</em> (nightfall) based on the opinion
1709             * of the <em>Geonim</em> calculated at the sun's position at
1710             * {@link #ZENITH_7_POINT_083 7.083&deg;} below the western horizon.
1711             * 
1712             * @return the <code>Date</code> representing the time when the sun is
1713             *         7.083&deg; below sea level.
1714             * @see #ZENITH_7_POINT_083
1715             */
1716            public Date getTzaisGeonim7Point083Degrees() {
1717                    return getSunsetOffsetByDegrees(ZENITH_7_POINT_083);
1718            }
1719    
1720            /**
1721             * This method returns the <em>tzais</em> (nightfall) based on the opinion
1722             * of the <em>Geonim</em> calculated at the sun's position at
1723             * {@link #ZENITH_8_POINT_5 8.5&deg;} below the western horizon.
1724             * 
1725             * @return the <code>Date</code> representing the time when the sun is
1726             *         8.5&deg; below sea level.
1727             * @see #ZENITH_8_POINT_5
1728             */
1729            public Date getTzaisGeonim8Point5Degrees() {
1730                    return getSunsetOffsetByDegrees(ZENITH_8_POINT_5);
1731            }
1732    
1733            /**
1734             * This method returns the <em>tzais</em> (nightfall) based on the opinion
1735             * of the Chavas Yair and Divray Malkiel that the time to walk the distance
1736             * of a Mil is 15 minutes for a total of 60 minutes for 4 mil after
1737             * {@link #getSeaLevelSunset() sea level sunset}.
1738             * 
1739             * @return the <code>Date</code> representing 60 minutes after sea level
1740             *         sunset.
1741             * @see #getAlos60()
1742             */
1743            public Date getTzais60() {
1744                    return getTimeOffset(getSeaLevelSunset(), 60 * MINUTE_MILLIS);
1745            }
1746    
1747            /**
1748             * This method returns tzais usually calculated as 40 minutes after sunset.
1749             * Please note that Chacham Yosef Harari-Raful of Yeshivat Ateret Torah who
1750             * uses this time, does so only for calculating various other zmanai hayom
1751             * such as Sof Zman Krias Shema and Plag Hamincha. His calendars do not
1752             * publish a zman for Tzais. It should also be noted that Chacham
1753             * Harari-Raful provided a 25 minute zman for Israel. This API uses 40
1754             * minutes year round in any place on the globe by default. This offset can
1755             * be changed by calling {@link #setAteretTorahSunsetOffset(double)}.
1756             * 
1757             * @return the <code>Date</code> representing 40 minutes after sea level
1758             *         sunset
1759             * @see #getAteretTorahSunsetOffset()
1760             * @see #setAteretTorahSunsetOffset(double)
1761             */
1762            public Date getTzaisAteretTorah() {
1763                    return getTimeOffset(getSeaLevelSunset(), getAteretTorahSunsetOffset()
1764                                    * MINUTE_MILLIS);
1765            }
1766    
1767            /**
1768             * Returns the offset in minutes after sunset used to calculate
1769             * <em>tzais</em> for the Ateret Torah zmanim. The defaullt value is 40
1770             * minutes.
1771             * 
1772             * @return the number of minutes after sunset for Tzais.
1773             * @see #setAteretTorahSunsetOffset(double)
1774             */
1775            public double getAteretTorahSunsetOffset() {
1776                    return ateretTorahSunsetOffset;
1777            }
1778    
1779            /**
1780             * Allows setting the offset in minutes after sunset for the Ateret Torah
1781             * zmanim. The default if unset is 40 minutes. Chacham Yosef Harari-Raful of
1782             * Yeshivat Ateret Torah uses 40 minutes globally with the exception of
1783             * Israel where a 25 minute offset is used. This 25 minute (or any other)
1784             * offset can be overridden by this methd. This offset impacts all Ateret
1785             * Torah methods.
1786             * 
1787             * @param ateretTorahSunsetOffset
1788             *            the number of minutes after sunset to use as an offset for the
1789             *            Ateret Torah <em>tzais</em>
1790             * @see #getAteretTorahSunsetOffset()
1791             */
1792            public void setAteretTorahSunsetOffset(double ateretTorahSunsetOffset) {
1793                    this.ateretTorahSunsetOffset = ateretTorahSunsetOffset;
1794            }
1795    
1796            /**
1797             * This method returns the latest <em>zman krias shema</em> (time to say
1798             * Shema in the morning) based on the calculation of Chacham Yosef
1799             * Harari-Raful of Yeshivat Ateret Torah, that the day starts
1800             * {@link #getAlos72Zmanis() 1/10th of the day} before sunrise and is
1801             * usually calculated as ending {@link #getTzaisAteretTorah() 40 minutes
1802             * after sunset}. <em>shaos zmaniyos</em> are calculated based on this day
1803             * and added to {@link #getAlos72Zmanis() alos} to reach this time. This
1804             * time is 3 <em> {@link #getShaahZmanisAteretTorah() shaos zmaniyos}</em>
1805             * (temporal hours) after {@link #getAlos72Zmanis() alos 72 zmaniyos}.<br />
1806             * <b>Note: </b> Based on this calculation <em>chatzos</em> will not be at
1807             * midday.
1808             * 
1809             * @return the <code>Date</code> of the latest zman shema based on this
1810             *         calculation.
1811             * @see #getAlos72Zmanis()
1812             * @see #getTzaisAteretTorah()
1813             * @see #getAteretTorahSunsetOffset()
1814             * @see #setAteretTorahSunsetOffset(double)
1815             * @see #getShaahZmanisAteretTorah()
1816             */
1817            public Date getSofZmanShmaAteretTorah() {
1818                    return getTimeOffset(getAlos72Zmanis(), getShaahZmanisAteretTorah() * 3);
1819            }
1820    
1821            /**
1822             * This method returns the latest <em>zman tfila</em> (time to say the
1823             * morning prayers) based on the calculation of Chacham Yosef Harari-Raful
1824             * of Yeshivat Ateret Torah, that the day starts {@link #getAlos72Zmanis()
1825             * 1/10th of the day} before sunrise and and is usually calculated as ending
1826             * {@link #getTzaisAteretTorah() 40 minutes after sunset}.
1827             * <em>shaos zmaniyos</em> are calculated based on this day and added to
1828             * {@link #getAlos72Zmanis() alos} to reach this time. This time is 4
1829             * <em>{@link #getShaahZmanisAteretTorah() shaos zmaniyos}</em> (temporal
1830             * hours) after {@link #getAlos72Zmanis() alos 72 zmaniyos}.<br />
1831             * <b>Note: </b> Based on this calculation <em>chatzos</em> will not be at
1832             * midday.
1833             * 
1834             * @return the <code>Date</code> of the latest zman shema based on this
1835             *         calculation.
1836             * @see #getAlos72Zmanis()
1837             * @see #getTzaisAteretTorah()
1838             * @see #getShaahZmanisAteretTorah()
1839             * @see #setAteretTorahSunsetOffset(double)
1840             */
1841            public Date getSofZmanTfilahAteretTorah() {
1842                    return getTimeOffset(getAlos72Zmanis(), getShaahZmanisAteretTorah() * 4);
1843            }
1844    
1845            /**
1846             * This method returns the time of <em>mincha gedola</em> based on the
1847             * calculation of Chacham Yosef Harari-Raful of Yeshivat Ateret Torah, that
1848             * the day starts {@link #getAlos72Zmanis() 1/10th of the day} before
1849             * sunrise and and is usually calculated as ending
1850             * {@link #getTzaisAteretTorah() 40 minutes after sunset}. This is the
1851             * perfered earliest time to pray <em>mincha</em> in the opinion of the
1852             * Ramba"m and others. For more information on this see the documentation on
1853             * <em>{@link #getMinchaGedola() mincha gedola}</em>. This is calculated as
1854             * 6.5 {@link #getShaahZmanisAteretTorah() solar hours} after alos. The
1855             * calculation used is 6.5 * {@link #getShaahZmanisAteretTorah()} after
1856             * {@link #getAlos72Zmanis() alos}.
1857             * 
1858             * @see #getAlos72Zmanis()
1859             * @see #getTzaisAteretTorah()
1860             * @see #getShaahZmanisAteretTorah()
1861             * @see #getMinchaGedola()
1862             * @see #getMinchaKetanaAteretTorah()
1863             * @see ZmanimCalendar#getMinchaGedola()
1864             * @return the <code>Date</code> of the time of mincha gedola.
1865             */
1866            public Date getMinchaGedolaAteretTorah() {
1867                    return getTimeOffset(getAlos72Zmanis(),
1868                                    getShaahZmanisAteretTorah() * 6.5);
1869            }
1870    
1871            /**
1872             * This method returns the time of <em>mincha ketana</em> based on the
1873             * calculation of Chacham Yosef Harari-Raful of Yeshivat Ateret Torah, that
1874             * the day starts {@link #getAlos72Zmanis() 1/10th of the day} before
1875             * sunrise and and is usually calculated as ending
1876             * {@link #getTzaisAteretTorah() 40 minutes after sunset}. This is the
1877             * perfered earliest time to pray <em>mincha</em> in the opinion of the
1878             * Ramba"m and others. For more information on this see the documentation on
1879             * <em>{@link #getMinchaGedola() mincha gedola}</em>. This is calculated as
1880             * 9.5 {@link #getShaahZmanisAteretTorah() solar hours} after
1881             * {@link #getAlos72Zmanis() alos}. The calculation used is 9.5 *
1882             * {@link #getShaahZmanisAteretTorah()} after {@link #getAlos72Zmanis()
1883             * alos}.
1884             * 
1885             * @see #getAlos72Zmanis()
1886             * @see #getTzaisAteretTorah()
1887             * @see #getShaahZmanisAteretTorah()
1888             * @see #getMinchaGedola()
1889             * @see #getMinchaKetana()
1890             * @return the <code>Date</code> of the time of mincha ketana.
1891             */
1892            public Date getMinchaKetanaAteretTorah() {
1893                    return getTimeOffset(getAlos72Zmanis(),
1894                                    getShaahZmanisAteretTorah() * 9.5);
1895            }
1896    
1897            /**
1898             * This method returns the time of <em>plag hamincha</em> based on the
1899             * calculation of Chacham Yosef Harari-Raful of Yeshivat Ateret Torah, that
1900             * the day starts {@link #getAlos72Zmanis() 1/10th of the day} before
1901             * sunrise and and is usually calculated as ending
1902             * {@link #getTzaisAteretTorah() 40 minutes after sunset}.
1903             * <em>shaos zmaniyos</em> are calculated based on this day and added to
1904             * {@link #getAlos72Zmanis() alos} to reach this time. This time is 10.75
1905             * <em>{@link #getShaahZmanisAteretTorah() shaos zmaniyos}</em> (temporal
1906             * hours) after {@link #getAlos72Zmanis() dawn}.
1907             * 
1908             * @return the <code>Date</code> of the plag.
1909             * @see #getAlos72Zmanis()
1910             * @see #getTzaisAteretTorah()
1911             * @see #getShaahZmanisAteretTorah()
1912             */
1913            public Date getPlagHaminchaAteretTorah() {
1914                    return getTimeOffset(getAlos72Zmanis(),
1915                                    getShaahZmanisAteretTorah() * 10.75);
1916            }
1917    
1918            /**
1919             * This method returns the time of <em>misheyakir</em> based on the common
1920             * calculation of the Syrian community in NY that the alos is a fixed minute
1921             * offset from day starting {@link #getAlos72Zmanis() 1/10th of the day}
1922             * before sunrise. The common offsets are 6 minutes (based on th Pri
1923             * Megadim, but not linked to the calculation of Alos as 1/10th of the day),
1924             * 8 and 18 minutes (possibly attributed to Chacham Baruch Ben Haim). Since
1925             * there is no universal accepted offset, the user of this API will have to
1926             * specify one. Chacham Yosef Harari-Raful of Yeshivat Ateret Torah does not
1927             * supply any zman for misheyakir and does not endorse any specific
1928             * calculation for misheyakir. For that reason, this method is not enabled.
1929             * 
1930             * @param minutes
1931             *            the number of minutes after alos calculated as
1932             *            {@link #getAlos72Zmanis() 1/10th of the day}
1933             * @return the <code>Date</code> of misheyakir
1934             * @see #getAlos72Zmanis()
1935             */
1936            // public Date getMesheyakirAteretTorah(double minutes) {
1937            // return getTimeOffset(getAlos72Zmanis(), minutes * MINUTE_MILLIS);
1938            // }
1939            /**
1940             * Method to return <em>tzais</em> (dusk) calculated as 72 minutes zmaniyos,
1941             * or 1/10th of the day after {@link #getSeaLevelSunset() sea level sunset}.
1942             * 
1943             * @return the <code>Date</code> representing the time.
1944             * @see #getAlos72Zmanis()
1945             */
1946            public Date getTzais72Zmanis() {
1947                    long shaahZmanis = getShaahZmanisGra();
1948                    if (shaahZmanis == Long.MIN_VALUE) {
1949                            return null;
1950                    }
1951                    return getTimeOffset(getSeaLevelSunset(), shaahZmanis * 1.2);
1952            }
1953    
1954            /**
1955             * Method to return <em>tzais</em> (dusk) calculated using 90 minutes
1956             * zmaniyos (<em>GR"A</em> and the <em>Baal Hatanya</em>) after
1957             * {@link #getSeaLevelSunset() sea level sunset}.
1958             * 
1959             * @return the <code>Date</code> representing the time.
1960             * @see #getAlos90Zmanis()
1961             */
1962            public Date getTzais90Zmanis() {
1963                    long shaahZmanis = getShaahZmanisGra();
1964                    if (shaahZmanis == Long.MIN_VALUE) {
1965                            return null;
1966                    }
1967                    return getTimeOffset(getSeaLevelSunset(), shaahZmanis * 1.5);
1968            }
1969    
1970            /**
1971             * Method to return <em>tzais</em> (dusk) calculated using 96 minutes
1972             * zmaniyos (<em>GR"A</em> and the <em>Baal Hatanya</em>) after
1973             * {@link #getSeaLevelSunset() sea level sunset}.
1974             * 
1975             * @return the <code>Date</code> representing the time.
1976             * @see #getAlos96Zmanis()
1977             */
1978            public Date getTzais96Zmanis() {
1979                    long shaahZmanis = getShaahZmanisGra();
1980                    if (shaahZmanis == Long.MIN_VALUE) {
1981                            return null;
1982                    }
1983                    return getTimeOffset(getSeaLevelSunset(), shaahZmanis * 1.6);
1984            }
1985    
1986            /**
1987             * Method to return <em>tzais</em> (dusk) calculated as 90 minutes after sea
1988             * level sunset. This method returns <em>tzais</em> (nightfall) based on the
1989             * opinion of the Magen Avraham that the time to walk the distance of a Mil
1990             * in the Ramba"m's opinion is 18 minutes for a total of 90 minutes based on
1991             * the opinion of <em>Ula</em> who calculated <em>tzais</em> as 5 Mil after
1992             * sea level shkiah (sunset). A similar calculation
1993             * {@link #getTzais19Point8Degrees()}uses solar position calculations based
1994             * on this time.
1995             * 
1996             * @return the <code>Date</code> representing the time.
1997             * @see #getTzais19Point8Degrees()
1998             * @see #getAlos90()
1999             */
2000            public Date getTzais90() {
2001                    return getTimeOffset(getSeaLevelSunset(), 90 * MINUTE_MILLIS);
2002            }
2003    
2004            /**
2005             * This method returns <em>tzais</em> (nightfall) based on the opinion of
2006             * the Magen Avraham that the time to walk the distance of a Mil in the
2007             * Ramba"ms opinion is 2/5 of an hour (24 minutes) for a total of 120
2008             * minutes based on the opinion of <em>Ula</em> who calculated
2009             * <em>tzais</em> as 5 Mil after sea level shkiah (sunset). A similar
2010             * calculation {@link #getTzais26Degrees()} uses temporal calculations based
2011             * on this time.
2012             * 
2013             * @return the <code>Date</code> representing the time.
2014             * @see #getTzais26Degrees()
2015             * @see #getAlos120()
2016             */
2017            public Date getTzais120() {
2018                    return getTimeOffset(getSeaLevelSunset(), 120 * MINUTE_MILLIS);
2019            }
2020    
2021            /**
2022             * Method to return <em>tzais</em> (dusk) calculated using 120 minutes
2023             * zmaniyos (<em>GR"A</em> and the <em>Baal Hatanya</em>) after
2024             * {@link #getSeaLevelSunset() sea level sunset}.
2025             * 
2026             * @return the <code>Date</code> representing the time.
2027             * @see #getAlos120Zmanis()
2028             */
2029            public Date getTzais120Zmanis() {
2030                    long shaahZmanis = getShaahZmanisGra();
2031                    if (shaahZmanis == Long.MIN_VALUE) {
2032                            return null;
2033                    }
2034                    return getTimeOffset(getSeaLevelSunset(), shaahZmanis * 2.0);
2035            }
2036    
2037            /**
2038             * For information on how this is calculated see the comments on
2039             * {@link #getAlos16Point1Degrees()}
2040             * 
2041             * @return the <code>Date</code> representing the time.
2042             * @see #getTzais72()
2043             * @see #getAlos16Point1Degrees() for more information on this calculation.
2044             */
2045            public Date getTzais16Point1Degrees() {
2046                    return getSunsetOffsetByDegrees(ZENITH_16_POINT_1);
2047            }
2048    
2049            /**
2050             * For information on how this is calculated see the comments on
2051             * {@link #getAlos26Degrees()}
2052             * 
2053             * @return the <code>Date</code> representing the time.
2054             * @see #getTzais120()
2055             * @see #getAlos26Degrees()
2056             */
2057            public Date getTzais26Degrees() {
2058                    return getSunsetOffsetByDegrees(ZENITH_26_DEGREES);
2059            }
2060    
2061            /**
2062             * For information on how this is calculated see the comments on
2063             * {@link #getAlos18Degrees()}
2064             * 
2065             * @return the <code>Date</code> representing the time.
2066             * @see #getAlos18Degrees()
2067             */
2068            public Date getTzais18Degrees() {
2069                    return getSunsetOffsetByDegrees(ASTRONOMICAL_ZENITH);
2070            }
2071    
2072            /**
2073             * For information on how this is calculated see the comments on
2074             * {@link #getAlos19Point8Degrees()}
2075             * 
2076             * @return the <code>Date</code> representing the time.
2077             * @see #getTzais90()
2078             * @see #getAlos19Point8Degrees()
2079             */
2080            public Date getTzais19Point8Degrees() {
2081                    return getSunsetOffsetByDegrees(ZENITH_19_POINT_8);
2082            }
2083    
2084            /**
2085             * A method to return <em>tzais</em> (dusk) calculated as 96 minutes after
2086             * sea level sunset. For information on how this is calculated see the
2087             * comments on {@link #getAlos96()}.
2088             * 
2089             * @return the <code>Date</code> representing the time.
2090             * @see #getAlos96()
2091             */
2092            public Date getTzais96() {
2093                    return getTimeOffset(getSeaLevelSunset(), 96 * MINUTE_MILLIS);
2094            }
2095    
2096            /**
2097             * A method that returns the local time for fixed <em>chatzos</em>. This
2098             * time is noon and midnight adjusted from standard time to account for the
2099             * local latitude. The 360&deg; of the globe divided by 24 calculates to
2100             * 15&deg; per hour with 4 minutes per degree, so at a longitude of 0 , 15,
2101             * 30 etc Chatzos in 12:00 noon. Lakewood, NJ whose longitude is -74.2094 is
2102             * 0.7906 away from the closest multiple of 15 at -75&deg;. This is
2103             * multiplied by 4 to yeild 3 minutes and 10 seconds for a chatzos of
2104             * 11:56:50. This method is not tied to the theoretical 15&deg; timezones,
2105             * but will adjust to the actual timezone and <a
2106             * href="http://en.wikipedia.org/wiki/Daylight_saving_time">Daylight saving
2107             * time</a>.
2108             * 
2109             * @return the Date representing the local <em>chatzos</em>
2110             * @see GeoLocation#getLocalMeanTimeOffset()
2111             */
2112            public Date getFixedLocalChatzos() {
2113                    return getTimeOffset(getDateFromTime(12.0
2114                                    - getGeoLocation().getTimeZone().getRawOffset() / HOUR_MILLIS),
2115                                    -getGeoLocation().getLocalMeanTimeOffset());
2116            }
2117    
2118            /**
2119             * A method that returns the latest <em>zman krias shema</em> (time to say
2120             * Shema in the morning) calculated as 3 hours before
2121             * {@link #getFixedLocalChatzos()}.
2122             * 
2123             * @return the <code>Date</code> of the latest zman shema.
2124             * @see #getFixedLocalChatzos()
2125             * @see #getSofZmanTfilaFixedLocal()
2126             */
2127            public Date getSofZmanShmaFixedLocal() {
2128                    return getTimeOffset(getFixedLocalChatzos(), -180 * MINUTE_MILLIS);
2129            }
2130    
2131            /**
2132             * This method returns the latest <em>zman tfila</em> (time to say the
2133             * morning prayers) calculated as 2 hours before
2134             * {@link #getFixedLocalChatzos()}.
2135             * 
2136             * @return the <code>Date</code> of the latest zman tfila.
2137             * @see #getFixedLocalChatzos()
2138             * @see #getSofZmanShmaFixedLocal()
2139             */
2140            public Date getSofZmanTfilaFixedLocal() {
2141                    return getTimeOffset(getFixedLocalChatzos(), -120 * MINUTE_MILLIS);
2142            }
2143    
2144            /**
2145             * @see java.lang.Object#equals(Object)
2146             */
2147            public boolean equals(Object object) {
2148                    if (this == object) {
2149                            return true;
2150                    }
2151                    if (!(object instanceof ComplexZmanimCalendar)) {
2152                            return false;
2153                    }
2154                    ComplexZmanimCalendar cCal = (ComplexZmanimCalendar) object;
2155                    // return getCalendar().getTime().equals(cCal.getCalendar().getTime())
2156                    return getCalendar().equals(cCal.getCalendar())
2157                                    && getGeoLocation().equals(cCal.getGeoLocation())
2158                                    && getAstronomicalCalculator().equals(
2159                                                    cCal.getAstronomicalCalculator());
2160            }
2161    
2162            /**
2163             * @see java.lang.Object#hashCode()
2164             */
2165            public int hashCode() {
2166                    int result = 17;
2167                    result = 37 * result + getClass().hashCode(); // needed or this and
2168                                                                                                                    // subclasses will
2169                                                                                                                    // return identical hash
2170                    result += 37 * result + getCalendar().hashCode();
2171                    result += 37 * result + getGeoLocation().hashCode();
2172                    result += 37 * result + getAstronomicalCalculator().hashCode();
2173                    return result;
2174            }
2175    }