List of usage examples for java.util Calendar clear
public final void clear()
Calendar
undefined. From source file:org.apache.olingo.fit.proxy.v4.EntityCreateTestITCase.java
@Test public void createEmployee() { final Integer id = 101; final Employee employee = getContainer().newEntityInstance(Employee.class); employee.setPersonID(id);// w ww .j a va 2 s . c o m employee.setFirstName("Fabio"); employee.setLastName("Martelli"); PrimitiveCollection<String> value = getContainer().newPrimitiveCollection(String.class); value.add("fabio.martelli@tirasa.net"); employee.setEmails(value); final Calendar date = Calendar.getInstance(TimeZone.getTimeZone("GMT")); date.clear(); date.set(2011, 3, 4, 9, 0, 0); employee.setDateHired(new Timestamp(date.getTimeInMillis())); final Address homeAddress = getContainer().newComplexInstance(HomeAddress.class); homeAddress.setCity("Pescara"); homeAddress.setPostalCode("65100"); homeAddress.setStreet("viale Gabriele D'Annunzio 256"); employee.setHomeAddress(homeAddress); value = getContainer().newPrimitiveCollection(String.class); value.add("3204725072"); value.add("08569930"); employee.setNumbers(value); getContainer().getPeople().add(employee); getContainer().flush(); Employee actual = getContainer().getPeople().getByKey(id, Employee.class).load(); assertNotNull(actual); assertEquals(id, actual.getPersonID()); assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity()); getService().getContext().detachAll(); actual = getContainer().getPeople().getByKey(id, Employee.class).load(); assertNotNull(actual); assertEquals(id, actual.getPersonID()); assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity()); getContainer().getPeople().delete(actual.getPersonID()); getContainer().flush(); try { getContainer().getPeople().getByKey(id, Employee.class).load(); fail(); } catch (IllegalArgumentException e) { } getService().getContext().detachAll(); try { getContainer().getPeople().getByKey(id, Employee.class).load(); fail(); } catch (IllegalArgumentException e) { } }
From source file:com.fowlcorp.homebank4android.gui.AccountRecyclerAdapter.java
@Override public void onBindViewHolder(final OperationViewHolder holder, final int position) { final Operation operation = listOperation.get(position); final Calendar myDate = Calendar.getInstance(); myDate.clear(); myDate.setTime(operation.getDate().getTime()); final SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy", Locale.FRANCE); holder.getRootLayout().setOnClickListener(new OnClickListener() { @SuppressWarnings("unchecked") @Override/*www. ja v a 2s . co m*/ public void onClick(View v) { Intent intent = new Intent(activity.getApplicationContext(), DetailedCardActivity.class); Bundle bdl = new Bundle(); try { bdl.putString("Date", df.format(myDate.getTime())); } catch (Exception e) { } try { bdl.putString("Category", (operation.getCategory().getParent() == null ? "" : operation.getCategory().getParent().getName() + ": ") + operation.getCategory().getName()); } catch (Exception e) { } try { bdl.putString("Payee", operation.getPayee().getName()); } catch (Exception e) { } try { bdl.putString("Wording", operation.getWording()); } catch (Exception e) { } try { bdl.putString("Amount", String.valueOf(Round.roundAmount(operation.getAmount()))); } catch (Exception e) { } try { bdl.putInt("Type", operation.getPayMode()); } catch (Exception e) { } // try { // intent.putExtra("Info", operation.getInfo()); // } catch (Exception e) { // } try { bdl.putBoolean("Reconciled", operation.isReconciled()); } catch (Exception e) { } try { bdl.putBoolean("Remind", operation.isRemind()); } catch (Exception e) { } try { Log.d("Debug", String.valueOf(operation.isSplit())); bdl.putBoolean("Split", operation.isSplit()); } catch (Exception e) { } try { bdl.putSerializable("Couple", operation.getSplits()); } catch (Exception e) { e.printStackTrace(); } intent.putExtras(bdl); // Pair datePair = Pair.create(holder.getDate(), "date"); // Pair categoryPair = Pair.create(holder.getCategory(), "category"); // Pair wordingPair = Pair.create(holder.getWording(), "wording"); // Pair payeePair = Pair.create(holder.getPayee(), "payee"); // Pair amountPair = Pair.create(holder.getAmount(), "amount"); Pair<View, String> cardPair = Pair.create((View) holder.getCard(), "card"); // Pair iconPair = Pair.create(holder.getMode(), "icon"); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, cardPair); ActivityCompat.startActivity(activity, intent, options.toBundle()); //activity.startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(activity).toBundle()); //activity.startActivity(intent); } }); try { holder.getDate().setText(activity.getString(R.string.Date) + " : " + df.format(myDate.getTime())); } catch (Exception e) { } try { holder.getPayee().setText(activity.getString(R.string.Payee) + " : " + operation.getPayee().getName()); } catch (Exception e) { } try { holder.getWording().setText(activity.getString(R.string.Wording) + " : " + operation.getWording()); } catch (Exception e) { } if (!operation.isSplit()) { holder.getSplitLinear().removeAllViews(); holder.getUnSplitLinear().setVisibility(LinearLayout.VISIBLE); try { holder.getCategory() .setText(activity.getString(R.string.Wording) + " : " + (operation.getCategory().getParent() == null ? "" : operation.getCategory().getParent().getName() + ": ") + operation.getCategory().getName()); } catch (Exception e) { } } else { holder.getUnSplitLinear().setVisibility(LinearLayout.GONE); LinearLayout splitLayout = holder.getSplitLinear(); splitLayout.removeAllViews(); LayoutInflater inflater = activity.getLayoutInflater(); for (Triplet subOp : operation.getSplits()) { View view = inflater.inflate(R.layout.split_layout, null); TextView category = (TextView) view.findViewById(R.id.splitLayout_category); TextView memo = (TextView) view.findViewById(R.id.splitLayout_memo); TextView amount = (TextView) view.findViewById(R.id.splitLayout_amount); //System.out.println(activity.getString(R.string.cardLayout_category) + " " + (subOp.getCategory().getParent() == null ? "" :subOp.getCategory().getParent().getName() + ": ") + subOp.getCategory().getName()); category.setText(activity.getString(R.string.Category) + " : " + (subOp.getCategory().getParent() == null ? "" : subOp.getCategory().getParent().getName() + ": ") + subOp.getCategory().getName()); amount.setText(colorText(activity.getString(R.string.Amount) + " : ", "" + Round.roundAmount(subOp.getAmount()))); memo.setText(activity.getString(R.string.Category) + " : " + operation.getWording()); splitLayout.addView(view); } } try { holder.getAmount().setText(colorText(activity.getString(R.string.Amount) + " : ", String.valueOf(Round.roundAmount(operation.getAmount())))); } catch (Exception e) { } try { holder.getBalance().setText(colorText(activity.getString(R.string.Balance) + " : ", String.valueOf(Round.roundAmount(operation.getBalanceAccount())))); } catch (Exception e) { } if (operation.isSplit()) { holder.getOption().setImageResource(R.drawable.split); } else if (operation.isRemind()) { holder.getOption().setImageResource(R.drawable.remind); holder.getCard().setCardBackgroundColor(Color.parseColor("#ffebee")); } else { holder.getOption().setImageDrawable(null); } if (!operation.isReconciled() && !operation.isRemind()) { holder.getCard().setCardBackgroundColor(Color.parseColor("#fff3e0")); } else if (operation.isReconciled()) { holder.getCard().setCardBackgroundColor(Color.parseColor("#ffffff")); } try { switch (operation.getPayMode()) { case PayMode.CREDIT_CARD: holder.getMode().setImageResource(R.drawable.mastercard); break; case PayMode.DEBIT_CARD: holder.getMode().setImageResource(R.drawable.card); break; case PayMode.CASH: holder.getMode().setImageResource(R.drawable.cash); break; case PayMode.TRANSFERT: holder.getMode().setImageResource(R.drawable.transfert); break; case PayMode.ELECTRONIC_PAYMENT: holder.getMode().setImageResource(R.drawable.nfc); break; case PayMode.CHEQUE: holder.getMode().setImageResource(R.drawable.cheque); break; default: holder.getMode().setImageDrawable(null); break; } } catch (Exception e) { } }
From source file:org.apache.olingo.fit.proxy.EntityCreateTestITCase.java
@Test public void createEmployee() { final Integer id = 101; final Employee employee = getContainer().newEntityInstance(Employee.class); employee.setPersonID(id);// ww w .ja va2s. c o m employee.setFirstName("Fabio"); employee.setLastName("Martelli"); PrimitiveCollection<String> value = getContainer().newPrimitiveCollection(String.class); value.add("fabio.martelli@tirasa.net"); employee.setEmails(value); final Calendar date = Calendar.getInstance(TimeZone.getTimeZone("GMT")); date.clear(); date.set(2011, 3, 4, 9, 0, 0); employee.setDateHired(new Timestamp(date.getTimeInMillis())); final Address homeAddress = getContainer().newComplexInstance(HomeAddress.class); homeAddress.setCity("Pescara"); homeAddress.setPostalCode("65100"); homeAddress.setStreet("viale Gabriele D'Annunzio 256"); employee.setHomeAddress(homeAddress); value = getContainer().newPrimitiveCollection(String.class); value.add("3204725072"); value.add("08569930"); employee.setNumbers(value); getContainer().getPeople().add(employee); getContainer().flush(); Employee actual = getContainer().getPeople().getByKey(id, Employee.class).load(); assertNotNull(actual); assertEquals(id, actual.getPersonID()); Assert.assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity()); getService().getContext().detachAll(); actual = getContainer().getPeople().getByKey(id, Employee.class).load(); assertNotNull(actual); assertEquals(id, actual.getPersonID()); Assert.assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity()); getContainer().getPeople().delete(actual.getPersonID()); getContainer().flush(); try { getContainer().getPeople().getByKey(id, Employee.class).load(); fail(); } catch (IllegalArgumentException e) { // Expected } getService().getContext().detachAll(); try { getContainer().getPeople().getByKey(id, Employee.class).load(); fail(); } catch (IllegalArgumentException e) { // Expected } }
From source file:com.sunchenbin.store.feilong.core.date.DateUtil.java
/** * <code>week</code>.//from w w w . j a v a 2 s . c om * * <pre> * 2015-7-29 14:08 * * DateUtil.getFirstWeekOfSpecifyDateYear(NOW, Calendar.FRIDAY) * return 2015-01-02 00:00:00.000 * * DateUtil.getFirstWeekOfSpecifyDateYear(NOW, Calendar.MONDAY) * return 2015-01-05 00:00:00.000 * </pre> * * @param date * * @param week * 1 ?2 3 4 5 6 7, ? {@link Calendar#SUNDAY}, {@link Calendar#MONDAY}, {@link Calendar#TUESDAY}, * {@link Calendar#WEDNESDAY}, {@link Calendar#THURSDAY}, {@link Calendar#FRIDAY}, {@link Calendar#SATURDAY} * @return the first week of specify date year * @see Calendar#SUNDAY * @see Calendar#MONDAY * @see Calendar#TUESDAY * @see Calendar#WEDNESDAY * @see Calendar#THURSDAY * @see Calendar#FRIDAY * @see Calendar#SATURDAY * @since 1.3.0 */ public static Date getFirstWeekOfSpecifyDateYear(Date date, int week) { Calendar calendar = toCalendar(date); calendar.clear(); calendar.set(Calendar.YEAR, getYear(date)); calendar.set(Calendar.MONTH, Calendar.JANUARY); calendar.set(Calendar.DAY_OF_WEEK_IN_MONTH, 1); calendar.set(Calendar.DAY_OF_WEEK, week); //DAY_OF_WEEK_IN_MONTH ? DAY_OF_WEEK ,??? // WEEK_OF_MONTH WEEK_OF_YEAR ??,? ? getFirstDayOfWeek() getMinimalDaysInFirstWeek() //DAY_OF_MONTH 1 7 DAY_OF_WEEK_IN_MONTH 1 //8 14 DAY_OF_WEEK_IN_MONTH 2,? //DAY_OF_WEEK_IN_MONTH 0 DAY_OF_WEEK_IN_MONTH 1 ? //?,,? DAY_OF_WEEK = SUNDAY, DAY_OF_WEEK_IN_MONTH = -1 //?,???? //, 31 , DAY_OF_WEEK_IN_MONTH -1 DAY_OF_WEEK_IN_MONTH 5 DAY_OF_WEEK_IN_MONTH 4 ?? return CalendarUtil.toDate(calendar); }
From source file:com.github.amsacode.predict4java.PassPredictor.java
public SatPassTime nextSatPass(final Date date, final boolean windBack) throws SatNotFoundException { int aosAzimuth = 0; int losAzimuth = 0; double maxElevation = 0; double elevation = 0; String polePassed = DEADSPOT_NONE; // get the current position final Calendar cal = Calendar.getInstance(TZ); cal.clear(); cal.setTimeInMillis(date.getTime()); // wind back time 1/4 of an orbit if (windBack) { double meanMotion = tle.getMeanmo(); cal.add(Calendar.MINUTE, (int) (-24.0 * 60.0 / meanMotion / 4.0)); }//from w w w . jav a 2s . co m SatPos satPos = getSatPos(cal.getTime()); SatPos prevPos = satPos; // test for the elevation being above the horizon if (satPos.getElevation() > 0.0) { // move time forward in 30 second intervals until the sat goes below // the horizon do { satPos = getPosition(cal, 60); } while (satPos.getElevation() > 0.0); // move time forward 3/4 orbit cal.add(Calendar.MINUTE, threeQuarterOrbitMinutes()); } Date tca = null; // now find the next time it comes above the horizon do { satPos = getPosition(cal, 60); final Date now = cal.getTime(); elevation = satPos.getElevation(); if (elevation > maxElevation) { maxElevation = elevation; tca = now; } } while (satPos.getElevation() < 0.0); // refine it to 5 seconds cal.add(Calendar.SECOND, -60); do { satPos = getPosition(cal, 5); final Date now = cal.getTime(); elevation = satPos.getElevation(); if (elevation > maxElevation) { maxElevation = elevation; tca = now; } prevPos = satPos; } while (satPos.getElevation() < 0.0); final Date startDate = satPos.getTime(); aosAzimuth = (int) ((satPos.getAzimuth() / (2.0 * Math.PI)) * 360.0); // now find when it goes below do { satPos = getPosition(cal, 30); final Date now = cal.getTime(); final String currPolePassed = getPolePassed(prevPos, satPos); if (!currPolePassed.equals(DEADSPOT_NONE)) { polePassed = currPolePassed; } log.debug("Current pole passed: " + polePassed); elevation = satPos.getElevation(); if (elevation > maxElevation) { maxElevation = elevation; tca = now; } prevPos = satPos; } while (satPos.getElevation() > 0.0); // refine it to 5 seconds cal.add(Calendar.SECOND, -30); do { satPos = getPosition(cal, 5); final Date now = cal.getTime(); elevation = satPos.getElevation(); if (elevation > maxElevation) { maxElevation = elevation; tca = now; } } while (satPos.getElevation() > 0.0); final Date endDate = satPos.getTime(); losAzimuth = (int) ((satPos.getAzimuth() / (2.0 * Math.PI)) * 360.0); return new SatPassTime(startDate, endDate, tca, polePassed, aosAzimuth, losAzimuth, (maxElevation / (2.0 * Math.PI)) * 360.0); }
From source file:org.apache.olingo.fit.proxy.v4.EntityCreateTestITCase.java
@Test public void createWithBackNavigation() { final Integer id = 102; // ------------------------------- // Create a new order // ------------------------------- Order order = getContainer().newEntityInstance(Order.class); order.setOrderID(id);/*from w w w . ja v a 2s .c o m*/ final Calendar orderDate = Calendar.getInstance(TimeZone.getTimeZone("GMT")); orderDate.clear(); orderDate.set(2011, 3, 4, 16, 3, 57); order.setOrderDate(new Timestamp(orderDate.getTimeInMillis())); order.setShelfLife(BigDecimal.TEN); PrimitiveCollection<BigDecimal> osl = getContainer().newPrimitiveCollection(BigDecimal.class); osl.add(BigDecimal.TEN.negate()); osl.add(BigDecimal.TEN); order.setOrderShelfLifes(osl); // ------------------------------- // ------------------------------- // Create a new customer // ------------------------------- final Customer customer = getContainer().newEntityInstance(Customer.class); customer.setPersonID(id); customer.setPersonID(id); customer.setFirstName("Fabio"); customer.setLastName("Martelli"); customer.setCity("Pescara"); PrimitiveCollection<String> value = getContainer().newPrimitiveCollection(String.class); value.add("fabio.martelli@tirasa.net"); customer.setEmails(value); final Address homeAddress = getContainer().newComplexInstance(HomeAddress.class); homeAddress.setCity("Pescara"); homeAddress.setPostalCode("65100"); homeAddress.setStreet("viale Gabriele D'Annunzio 256"); customer.setHomeAddress(homeAddress); value = getContainer().newPrimitiveCollection(String.class); value.add("3204725072"); value.add("08569930"); customer.setNumbers(value); final OrderCollection orders = getContainer().newEntityCollection(OrderCollection.class); orders.add(order); customer.setOrders(orders); // ------------------------------- // ------------------------------- // Link customer to order // ------------------------------- order.setCustomerForOrder(customer); // ------------------------------- getContainer().getOrders().add(order); getContainer().flush(); assertEquals(id, order.getOrderID()); assertEquals(id, customer.getPersonID()); Customer actual = readCustomer(getContainer(), id); assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity()); assertEquals(1, actual.getOrders().execute().size()); assertEquals(id, actual.getOrders().iterator().next().getOrderID()); order = getContainer().getOrders().getByKey(id); assertNotNull(order); assertEquals(id, order.getCustomerForOrder().load().getPersonID()); getContainer().getOrders().delete(actual.getOrders()); getContainer().flush(); try { getContainer().getOrders().getByKey(id).load(); fail(); } catch (IllegalArgumentException e) { } actual = readCustomer(getContainer(), id); assertTrue(actual.getOrders().isEmpty()); getContainer().getCustomers().delete(actual.getPersonID()); getContainer().flush(); try { getContainer().getCustomers().getByKey(id).load(); fail(); } catch (IllegalArgumentException e) { } }
From source file:edu.cornell.mannlib.vitro.webapp.controller.freemarker.DumpTestController.java
private Employee getEmployee() { Calendar c = Calendar.getInstance(); c.set(1982, Calendar.MAY, 5); c = DateUtils.truncate(c, Calendar.DATE); Employee jdoe = new Employee("John", "Doe", 34523, c.getTime()); jdoe.setFavoriteColors("blue", "green"); jdoe.setSalary(65000);/*from w ww . j a va 2 s. co m*/ c.clear(); c.set(1975, Calendar.OCTOBER, 25); c = DateUtils.truncate(c, Calendar.DATE); Employee jsmith = new Employee("Jane", "Smith", 78234, c.getTime()); jsmith.setFavoriteColors("red", "orange"); jdoe.setSupervisor(jsmith); return jdoe; }
From source file:uk.org.funcube.fcdw.satellite.PassPredictor.java
public SatPassTime nextSatPass(final Date date, final boolean windBack) throws InvalidTleException, SatNotFoundException { int aosAzimuth = 0; int losAzimuth = 0; double maxElevation = 0; double elevation = 0; validateData();/*from w ww. j a v a 2 s . co m*/ String polePassed = DEADSPOT_NONE; // get the current position final Calendar cal = Calendar.getInstance(TZ); cal.clear(); cal.setTimeInMillis(date.getTime()); // wind back time 1/4 of an orbit if (windBack) { cal.add(Calendar.MINUTE, (int) (-24.0 * 60.0 / meanMotion / 4.0)); } SatPos satPos = getSatPos(cal.getTime()); SatPos prevPos = satPos; // test for the elevation being above the horizon if (satPos.getElevation() > 0.0) { // move time forward in 30 second intervals until the sat goes below // the horizon do { satPos = getPosition(cal, 60); } while (satPos.getElevation() > 0.0); // move time forward 3/4 orbit cal.add(Calendar.MINUTE, threeQuarterOrbitMinutes()); } // now find the next time it comes above the horizon do { satPos = getPosition(cal, 60); final Date now = cal.getTime(); elevation = satPos.getElevation(); if (elevation > maxElevation) { maxElevation = elevation; tca = now; } } while (satPos.getElevation() < 0.0); // refine it to 5 seconds cal.add(Calendar.SECOND, -60); do { satPos = getPosition(cal, 5); final Date now = cal.getTime(); elevation = satPos.getElevation(); if (elevation > maxElevation) { maxElevation = elevation; tca = now; } prevPos = satPos; } while (satPos.getElevation() < 0.0); final Date startDate = satPos.getTime(); aosAzimuth = (int) ((satPos.getAzimuth() / (2.0 * Math.PI)) * 360.0); // now find when it goes below do { satPos = getPosition(cal, 30); final Date now = cal.getTime(); final String currPolePassed = getPolePassed(prevPos, satPos); if (!currPolePassed.equals(DEADSPOT_NONE)) { polePassed = currPolePassed; } log.debug("Current pole passed: " + polePassed); elevation = satPos.getElevation(); if (elevation > maxElevation) { maxElevation = elevation; tca = now; } prevPos = satPos; } while (satPos.getElevation() > 0.0); newTLE = true; validateData(); // refine it to 5 seconds cal.add(Calendar.SECOND, -30); do { satPos = getPosition(cal, 5); final Date now = cal.getTime(); elevation = satPos.getElevation(); if (elevation > maxElevation) { maxElevation = elevation; tca = now; } } while (satPos.getElevation() > 0.0); final Date endDate = satPos.getTime(); losAzimuth = (int) ((satPos.getAzimuth() / (2.0 * Math.PI)) * 360.0); return new SatPassTime(startDate, endDate, tca, polePassed, aosAzimuth, losAzimuth, (maxElevation / (2.0 * Math.PI)) * 360.0); }
From source file:com.epam.dlab.configuration.SchedulerConfiguration.java
/** Build the schedule from user' schedule. * @throws ParseException//from w ww. jav a 2 s .co m */ public void build() throws ParseException { SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss"); String[] unitArray = schedule.split(","); realSchedule.clear(); for (int i = 0; i < unitArray.length; i++) { Calendar date = Calendar.getInstance(); int[] time = getTime(unitArray[i]); try { df.parse(StringUtils.join(time, ':')); } catch (Exception e) { throw new ParseException("Cannot parse date " + unitArray[i] + ". " + e.getLocalizedMessage(), e); } date.clear(); date.set(1, 1, 1, time[0], time[1], time[2]); realSchedule.put(df.format(date.getTime()), date); } adjustStartTime(); }
From source file:uk.me.g4dpz.satellite.PassPredictor.java
/** * * Find the next satellite pass for a specific date * * @param date The date fo find the next pass for * @param windBack Whether to wind back 1/4 of an orbit * @return The satellite pass time/* w w w . j ava 2 s . c o m*/ * @throws InvalidTleException * @throws SatNotFoundException */ public SatPassTime nextSatPass(final Date date, final boolean windBack) throws InvalidTleException, SatNotFoundException { int aosAzimuth; int losAzimuth; double maxElevation = 0; double elevation; validateData(); String polePassed = DEADSPOT_NONE; // get the current position final Calendar cal = Calendar.getInstance(TZ); cal.clear(); cal.setTimeInMillis(date.getTime()); // wind back time 1/4 of an orbit if (windBack) { cal.add(Calendar.MINUTE, (int) (-24.0 * 60.0 / meanMotion / 4.0)); } SatPos satPos = getSatPos(cal.getTime()); SatPos prevPos = satPos; // test for the elevation being above the horizon if (satPos.getElevation() > 0.0) { // move time forward in 30 second intervals until the sat goes below // the horizon do { satPos = getPosition(cal, 60); } while (satPos.getElevation() > 0.0); // move time forward 3/4 orbit cal.add(Calendar.MINUTE, threeQuarterOrbitMinutes()); } // now find the next time it comes above the horizon do { satPos = getPosition(cal, 60); final Date now = cal.getTime(); elevation = satPos.getElevation(); if (elevation > maxElevation) { maxElevation = elevation; tca = now; } } while (satPos.getElevation() < 0.0); // refine it to 5 seconds cal.add(Calendar.SECOND, -60); do { satPos = getPosition(cal, 5); final Date now = cal.getTime(); elevation = satPos.getElevation(); if (elevation > maxElevation) { maxElevation = elevation; tca = now; } prevPos = satPos; } while (satPos.getElevation() < 0.0); final Date startDate = satPos.getTime(); aosAzimuth = (int) ((satPos.getAzimuth() / (2.0 * Math.PI)) * 360.0); // now find when it goes below do { satPos = getPosition(cal, 30); final Date now = cal.getTime(); final String currPolePassed = getPolePassed(prevPos, satPos); if (!currPolePassed.equals(DEADSPOT_NONE)) { polePassed = currPolePassed; } log.debug("Current pole passed: " + polePassed); elevation = satPos.getElevation(); if (elevation > maxElevation) { maxElevation = elevation; tca = now; } prevPos = satPos; } while (satPos.getElevation() > 0.0); newTLE = true; validateData(); // refine it to 5 seconds cal.add(Calendar.SECOND, -30); do { satPos = getPosition(cal, 5); final Date now = cal.getTime(); elevation = satPos.getElevation(); if (elevation > maxElevation) { maxElevation = elevation; tca = now; } } while (satPos.getElevation() > 0.0); final Date endDate = satPos.getTime(); losAzimuth = (int) ((satPos.getAzimuth() / (2.0 * Math.PI)) * 360.0); return new SatPassTime(startDate, endDate, tca, polePassed, aosAzimuth, losAzimuth, (maxElevation / (2.0 * Math.PI)) * 360.0); }