import { DateTime } from 'luxon'; import { GeoLocation } from './GeoLocation'; /** * A wrapper class for astronomical times / zmanim that is mostly intended to allow sorting collections of astronomical times. * It has fields for both date/time and duration based zmanim, name / labels as well as a longer description or explanation of a * zman. *

* Here is an example of various ways of sorting zmanim. *

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

 * String locationName = "Lakewood, NJ";
 * double latitude = 40.0828; // Lakewood, NJ
 * double longitude = -74.2094; // Lakewood, NJ
 * double elevation = 20; // optional elevation correction in Meters
 * // the String parameter in getTimeZone() has to be a valid timezone listed in {@link java.util.TimeZone#getAvailableIDs()}
 * TimeZone timeZone = TimeZone.getTimeZone("America/New_York");
 * GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
 * ComplexZmanimCalendar czc = new ComplexZmanimCalendar(location);
 * Zman sunset = new Zman(czc.getSunset(), "Sunset");
 * Zman shaah16 = new Zman(czc.getShaahZmanis16Point1Degrees(), "Shaah zmanis 16.1");
 * Zman sunrise = new Zman(czc.getSunrise(), "Sunrise");
 * Zman shaah = new Zman(czc.getShaahZmanisGra(), "Shaah zmanis GRA");
 * ArrayList<Zman> zl = new ArrayList<Zman>();
 * zl.add(sunset);
 * zl.add(shaah16);
 * zl.add(sunrise);
 * zl.add(shaah);
 * //will sort sunset, shaah 1.6, sunrise, shaah GRA
 * System.out.println(zl);
 * Collections.sort(zl, Zman.DATE_ORDER);
 * // will sort sunrise, sunset, shaah, shaah 1.6 (the last 2 are not in any specific order)
 * Collections.sort(zl, Zman.DURATION_ORDER);
 * // will sort sunrise, sunset (the first 2 are not in any specific order), shaah GRA, shaah 1.6
 * Collections.sort(zl, Zman.NAME_ORDER);
 * // will sort shaah 1.6, shaah GRA, sunrise, sunset
 * 
* * @author © Eliyahu Hershfeld 2007-2020 * @todo Add secondary sorting. As of now the {@code Comparator}s in this class do not sort by secondary order. This means that when sorting a * {@link java.util.Collection} of zmanim and using the {@link #DATE_ORDER} {@code Comparator} will have the duration based zmanim * at the end, but they will not be sorted by duration. This should be N/A for label based sorting. */ export declare class Zman { /** * The name / label of the zman. */ label: string | null; /** * The {@link Date} of the zman */ zman?: DateTime; /** * The duration if the zman is a {@link AstronomicalCalendar#getTemporalHour() temporal hour} (or the various * shaah zmanis base times such as {@link ZmanimCalendar#getShaahZmanisGra() shaah Zmanis GRA} or * {@link ComplexZmanimCalendar#getShaahZmanis16Point1Degrees() shaah Zmanis 16.1°}). */ duration?: number; /** * A longer description or explanation of a zman. */ description?: string; /** * The location information of the zman. */ geoLocation?: GeoLocation; /** * The constructor setting a {@link Date} based zman and a label. * @param date the Date of the zman. * @param label the label of the zman such as "Sof Zman Krias Shema GRA". * @see #Zman(Date, GeoLocation, String) */ constructor(date: DateTime, label: string | null); /** * The constructor setting a duration based zman such as * {@link AstronomicalCalendar#getTemporalHour() temporal hour} (or the various shaah zmanis times such as * {@link ZmanimCalendar#getShaahZmanisGra() shaah zmanis GRA} or * {@link ComplexZmanimCalendar#getShaahZmanis16Point1Degrees() shaah Zmanis 16.1°}) and label. * @param duration a duration based zman such as ({@link AstronomicalCalendar#getTemporalHour()} * @param label the label of the zman such as "Shaah Zmanis GRA". * @see #Zman(Date, String) */ constructor(duration: number, label: string | null); constructor(date: DateTime, geoLocation: GeoLocation, label: string | null); /** * A {@link Comparator} that will compare and sort zmanim by date/time order. Compares its two arguments by the zman's date/time * order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater * than the second. * Please note that this class will handle cases where either the {@code Zman} is a null or {@link #getZman()} returns a null. */ static compareDateOrder(zman1: Zman, zman2: Zman): number; /** * A {@link Comparator} that will compare and sort zmanim by zmanim label order. Compares its two arguments by the zmanim label * name order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater * than the second. * Please note that this class will sort cases where either the {@code Zman} is a null or {@link #label} returns a null * as empty {@code String}s. */ static compareNameOrder(zman1: Zman, zman2: Zman): number; /** * A {@link Comparator} that will compare and sort duration based zmanim such as * {@link AstronomicalCalendar#getTemporalHour() temporal hour} (or the various shaah zmanis times * such as {@link ZmanimCalendar#getShaahZmanisGra() shaah zmanis GRA} or * {@link ComplexZmanimCalendar#getShaahZmanis16Point1Degrees() shaah zmanis 16.1°}). Returns a negative * integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. * Please note that this class will sort cases where {@code Zman} is a null. */ static compareDurationOrder(zman1: Zman, zman2: Zman): number; /** * A method that returns an XML formatted String representing the serialized Object. Very * similar to the toString method but the return value is in an xml format. The format currently used (subject to * change) is: * *
     * <Zman>
     *  <Label>Sof Zman Krias Shema GRA</Label>
     *  <Zman>1969-02-08T09:37:56.820</Zman>
     *  <TimeZone>
     *    <TimezoneName>America/Montreal</TimezoneName>
     *    <TimeZoneDisplayName>Eastern Standard Time</TimeZoneDisplayName>
     *    <TimezoneGMTOffset>-5</TimezoneGMTOffset>
     *    <TimezoneDSTOffset>1</TimezoneDSTOffset>
     *  </TimeZone>
     *  <Duration>0</Duration>
     *  <Description>Sof Zman Krias Shema GRA is 3 sha'os zmaniyos calculated from sunrise to sunset.</Description>
     * </Zman>
     * 
* @return The XML formatted String. * @deprecated */ toXML(): void; toString(): string; } export declare type ZmanWithZmanDate = Zman & { zman: DateTime; }; export declare type ZmanWithDuration = Zman & { duration: number; };