// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static class approx_sun_coord {
//     double D;   /* Declination of the Sun */
//     double EqT; /* The Equation of Time */
//     double R;   /* The distance of the Sun from the Earth
//                in astronomical units (AU)  */
//     double SD;  /* The angular semidiameter of the Sun in degrees */
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static class date_t {
//     int year, month, day;
// 
//     /**
//      * @param day starts from 1
//      * @param month starts from 1, like the old ITL
//      */
//     date_t set(int day, int month, int year) {
//         this.year = year;
//         this.month = month;
//         this.day = day;
//         return this;
//     }
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static class location {
//     /* In original C: The struct members ordering guarantees that the compiler does
//      * not add any padding bytes when compiling for 64-bit machines */
// 
//     double longitude;   /* Observer's longitude */
//     double latitude;    /* Observer's latitude */
//     double altitude;    /* Observer's altitude in meters */
//     double timezone;    /* Observer's timezone (in hours) relative
//                               to Universal Coordinated Time (UTC) */
//     int daylight;    /* Daylight Savings Time (DST) Flag
//                               Set to 1 if DST is on, 0 otherwise */
//     AsrMethod asr_method;  /* Asr Method: Shafii or Hanafi */
//     CalcMethod calc_method; /* Fajr and Isha Calculation method */
//     ExtremeMethod extr_method; /* Extreme latitude method */
//     String name;    /* Observer's location name */
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// enum round_t {
//     UP, DOWN, NEAREST
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static final double KAABA_LATITUDE = (21.42249);
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static final double KAABA_LONGITUDE = (39.82620);
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static final double M_PI = (3.141592653589793);
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static final double ONE_MINUTE = (60.0 / 3600.0);


import static org.arabeyes.itl.newmethod.DefsModule.ONE_MINUTE;
import org.arabeyes.itl.newmethod.DefsModule.approx_sun_coord;
import org.arabeyes.itl.newmethod.DefsModule.date_t;
import org.arabeyes.itl.newmethod.DefsModule.location;
import org.arabeyes.itl.newmethod.DefsModule.round_t;
import static java.lang.Math.acos;
import static java.lang.Math.asin;
import static java.lang.Math.atan2;
import static java.lang.Math.ceil;
import static java.lang.Math.cos;
import static java.lang.Math.floor;
import static java.lang.Math.sin;
import static java.lang.Math.sqrt;
import static java.lang.Math.tan;
import static org.arabeyes.itl.newmethod.DefsModule.KAABA_LATITUDE;
import static org.arabeyes.itl.newmethod.DefsModule.KAABA_LONGITUDE;
import static org.arabeyes.itl.newmethod.DefsModule.M_PI;
/*
 Islamic Prayer Times and Qibla Direction Library
 By Mohamed A.M. Bamakhrama (mohamed@alumni.tum.de)
 Licensed under the BSD license shown in file LICENSE

 This is a "clean-room" implementation that uses simpler but
 approximate methods. This implementation should be easier
 to maintain and debug. However, we need to first to test it
 throughly before replacing the old method. Currently, it
 supports calculating the prayer times and qibla location for
 "normal" latitudes. However, "extreme latitude" methods are
 still missing.
*/
package org.arabeyes.itl.newmethod;



class PrayerModule {
    static CalcMethod calc_methods[] = {
            new CalcMethod(MethodId.MWL, "Muslim World League (MWL)",
                    IshaFlag.ANGLE, 18, 17),
            new CalcMethod(MethodId.ISNA, "Islamic Society of North America (ISNA)",
                    IshaFlag.ANGLE, 15, 15),
            new CalcMethod(MethodId.EGAS, "Egyptian General Authority of Survey",
                    IshaFlag.ANGLE, 19.5, 17.5),
            new CalcMethod(MethodId.UMAQ, "Umm Al-Qura University, Makkah",
                    IshaFlag.OFFSET, 18.5, 90),
            new CalcMethod(MethodId.UIS, "University of Islamic Sciences, Karachi",
                    IshaFlag.ANGLE, 18, 18)
    };

    /**
     * Convert a given angle specified in degrees into radians
     */
    private static double to_radians(double x) {
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static class approx_sun_coord {
//     double D;   /* Declination of the Sun */
//     double EqT; /* The Equation of Time */
//     double R;   /* The distance of the Sun from the Earth
//                in astronomical units (AU)  */
//     double SD;  /* The angular semidiameter of the Sun in degrees */
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static class date_t {
//     int year, month, day;
// 
//     /**
//      * @param day starts from 1
//      * @param month starts from 1, like the old ITL
//      */
//     date_t set(int day, int month, int year) {
//         this.year = year;
//         this.month = month;
//         this.day = day;
//         return this;
//     }
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static class location {
//     /* In original C: The struct members ordering guarantees that the compiler does
//      * not add any padding bytes when compiling for 64-bit machines */
// 
//     double longitude;   /* Observer's longitude */
//     double latitude;    /* Observer's latitude */
//     double altitude;    /* Observer's altitude in meters */
//     double timezone;    /* Observer's timezone (in hours) relative
//                               to Universal Coordinated Time (UTC) */
//     int daylight;    /* Daylight Savings Time (DST) Flag
//                               Set to 1 if DST is on, 0 otherwise */
//     AsrMethod asr_method;  /* Asr Method: Shafii or Hanafi */
//     CalcMethod calc_method; /* Fajr and Isha Calculation method */
//     ExtremeMethod extr_method; /* Extreme latitude method */
//     String name;    /* Observer's location name */
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// enum round_t {
//     UP, DOWN, NEAREST
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static final double KAABA_LATITUDE = (21.42249);
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static final double KAABA_LONGITUDE = (39.82620);
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static final double M_PI = (3.141592653589793);
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static final double ONE_MINUTE = (60.0 / 3600.0);


// Path: itl/src/main/java/org/arabeyes/itl/newmethod/PrayerModule.java
import static org.arabeyes.itl.newmethod.DefsModule.ONE_MINUTE;
import org.arabeyes.itl.newmethod.DefsModule.approx_sun_coord;
import org.arabeyes.itl.newmethod.DefsModule.date_t;
import org.arabeyes.itl.newmethod.DefsModule.location;
import org.arabeyes.itl.newmethod.DefsModule.round_t;
import static java.lang.Math.acos;
import static java.lang.Math.asin;
import static java.lang.Math.atan2;
import static java.lang.Math.ceil;
import static java.lang.Math.cos;
import static java.lang.Math.floor;
import static java.lang.Math.sin;
import static java.lang.Math.sqrt;
import static java.lang.Math.tan;
import static org.arabeyes.itl.newmethod.DefsModule.KAABA_LATITUDE;
import static org.arabeyes.itl.newmethod.DefsModule.KAABA_LONGITUDE;
import static org.arabeyes.itl.newmethod.DefsModule.M_PI;

/*
 Islamic Prayer Times and Qibla Direction Library
 By Mohamed A.M. Bamakhrama (mohamed@alumni.tum.de)
 Licensed under the BSD license shown in file LICENSE

 This is a "clean-room" implementation that uses simpler but
 approximate methods. This implementation should be easier
 to maintain and debug. However, we need to first to test it
 throughly before replacing the old method. Currently, it
 supports calculating the prayer times and qibla location for
 "normal" latitudes. However, "extreme latitude" methods are
 still missing.
*/
package org.arabeyes.itl.newmethod;



class PrayerModule {
    static CalcMethod calc_methods[] = {
            new CalcMethod(MethodId.MWL, "Muslim World League (MWL)",
                    IshaFlag.ANGLE, 18, 17),
            new CalcMethod(MethodId.ISNA, "Islamic Society of North America (ISNA)",
                    IshaFlag.ANGLE, 15, 15),
            new CalcMethod(MethodId.EGAS, "Egyptian General Authority of Survey",
                    IshaFlag.ANGLE, 19.5, 17.5),
            new CalcMethod(MethodId.UMAQ, "Umm Al-Qura University, Makkah",
                    IshaFlag.OFFSET, 18.5, 90),
            new CalcMethod(MethodId.UIS, "University of Islamic Sciences, Karachi",
                    IshaFlag.ANGLE, 18, 18)
    };

    /**
     * Convert a given angle specified in degrees into radians
     */
    private static double to_radians(double x) {
        return ((x) * M_PI) / 180.0;