// set custom values for calculation parameters private void setCustomParams(double[] params) { for (int i = 0; i < 5; i++) { if (params[i] == -1) { params[i] = methodParams.get(this.getCalcMethod().getId())[i]; methodParams.put(CalculationMethod.Custom.getId(), params); } else { methodParams.get(CalculationMethod.Custom.getId())[i] = params[i]; } } this.setCalcMethod(CalculationMethod.Custom); }
private void init() { // Initialize vars this.setDhuhrMinutes(0); this.setAdjustHighLats(1); // Adjusting Methods for Higher Latitudes None = 0; // No adjustment MidNight = 1; // middle of night OneSeventh = 2; // 1/7th of night AngleBased = 3; // angle/60th of night // http://moonsighting.com/how-we.html if (this.lat >= 48.5) this.setAdjustHighLats(3); // Time Names timeNames = new ArrayList<String>(); timeNames.add("Fajr"); timeNames.add("Sunrise"); timeNames.add("Dhuhr"); timeNames.add("Asr"); timeNames.add("Sunset"); timeNames.add("Maghrib"); timeNames.add("Isha"); // --------------------- Technical Settings -------------------- numIterations = 1; // number of iterations needed to compute // times // ------------------- Calc Method Parameters -------------------- // Tuning offsets {fajr, sunrise, dhuhr, asr, sunset, maghrib, isha} offsets = new int[7]; offsets[0] = 0; offsets[1] = 0; offsets[2] = 0; offsets[3] = 0; offsets[4] = 0; offsets[5] = 0; offsets[6] = 0; /* * * fa : fajr angle ms : maghrib selector (0 = angle; 1 = minutes after * sunset) mv : maghrib parameter value (in angle or minutes) is : isha * selector (0 = angle; 1 = minutes after maghrib) iv : isha parameter * value (in angle or minutes) */ methodParams = new HashMap<Integer, double[]>(); // Jafari double[] Jvalues = {16, 0, 4, 0, 14}; methodParams.put(Integer.valueOf(CalculationMethod.Jafari.getId()), Jvalues); // Karachi double[] Kvalues = {18, 1, 0, 0, 18}; methodParams.put(Integer.valueOf(CalculationMethod.Karachi.getId()), Kvalues); // ISNA double[] Ivalues = {15, 1, 0, 0, 15}; methodParams.put(Integer.valueOf(CalculationMethod.ISNA.getId()), Ivalues); // MWL double[] MWvalues = {18, 1, 0, 0, 17}; methodParams.put(Integer.valueOf(CalculationMethod.MWL.getId()), MWvalues); // Makkah double[] MKvalues = {18.5, 1, 0, 1, 90}; methodParams.put(Integer.valueOf(CalculationMethod.Makkah.getId()), MKvalues); // Egypt double[] Evalues = {19.5, 1, 0, 0, 17.5}; methodParams.put(Integer.valueOf(CalculationMethod.Egypt.getId()), Evalues); // Tehran double[] Tvalues = {17.7, 0, 4.5, 0, 14}; methodParams.put(Integer.valueOf(CalculationMethod.Tehran.getId()), Tvalues); // Custom double[] Cvalues = {18, 1, 0, 0, 17}; methodParams.put(Integer.valueOf(CalculationMethod.Custom.getId()), Cvalues); // computeDayTimes(); }