public boolean isPoint() { return start.equals(end); }
public boolean isPoint() { return start.equals(end); }
public boolean isPoint() { return start.equals(end); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TinvDate tinvDate = (TinvDate) o; if (end != null ? !end.equals(tinvDate.end) : tinvDate.end != null) return false; if (start != null ? !start.equals(tinvDate.start) : tinvDate.start != null) return false; return true; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CalendarDateRange that = (CalendarDateRange) o; // All other fields in this class are derived from start or end. return start.equals(that.start) && end.equals(that.end); }
@Override public ProfileFeature getProfileByDate(CalendarDate date) throws IOException { for (ProfileFeature pf : this) { if (pf.getTime().equals(date)) return pf; } return null; }
public int findRunIndex(CalendarDate want) { for (int i=0; i<runOffset.length; i++) if (want.equals(FmrcInv.makeOffsetDate(base, runOffset[i]))) return i; return -1; }
public int findRunIndex(CalendarDate want) { for (int i=0; i<runOffset.length; i++) if (want.equals(FmrcInv.makeOffsetDate(base, runOffset[i]))) return i; return -1; }
public int findRunIndex(CalendarDate want) { for (int i=0; i<runOffset.length; i++) if (want.equals(FmrcInv.makeOffsetDate(base, runOffset[i]))) return i; return -1; }
/** * See if the given CalendarDate appears as a coordinate * * @param date test this * @return true if equals a coordinate */ public boolean hasCalendarDate(CalendarDate date) { List<CalendarDate> cdates = getCalendarDates(); for (CalendarDate cd : cdates) { // LOOK linear search, switch to binary if (date.equals(cd)) return true; } return false; }
/** * See if the given CalendarDate appears as a coordinate * * @param date test this * @return true if equals a coordinate */ public boolean hasCalendarDate(CalendarDate date) { List<CalendarDate> cdates = getCalendarDates(); for (CalendarDate cd : cdates) { // LOOK linear search, switch to binary if (date.equals(cd)) return true; } return false; }
/** * See if the given CalendarDate appears as a coordinate * * @param date test this * @return true if equals a coordinate */ public boolean hasCalendarDate(CalendarDate date) { List<CalendarDate> cdates = getCalendarDates(); for (CalendarDate cd : cdates) { if (date.equals(cd)) return true; } return false; }
ConstantForecastDataset(CalendarDate time) throws FileNotFoundException { this.offset = FmrcInv.getOffsetInHours(base, time); for (CalendarDate d : getForecastDates()) if (d.equals(time)) return; // ok throw new FileNotFoundException("No forecast date of " + time); // we dont got it }
ConstantForecastDataset(CalendarDate time) throws FileNotFoundException { this.offset = FmrcInv.getOffsetInHours(base, time); for (CalendarDate d : getForecastDates()) if (d.equals(time)) return; // ok throw new FileNotFoundException("No forecast date of " + time); // we dont got it }
ConstantForecastDataset(CalendarDate time) throws FileNotFoundException { this.offset = FmrcInv.getOffsetInHours(base, time); for (CalendarDate d : getForecastDates()) if (d.equals(time)) return; // ok throw new FileNotFoundException("No forecast date of " + time); // we dont got it }
public int getOffset(CalendarDate start, CalendarDate end) { if (start.equals(end)) return 0; long start_millis = start.getDateTime().getMillis(); long end_millis = end.getDateTime().getMillis(); // 5 second slop Period p; if (start_millis < end_millis) p = new Period(start_millis, end_millis + 5000, getPeriodType()); else p = new Period(start_millis+5000, end_millis, getPeriodType()); return p.get(getDurationFieldType()); }
public double makeOffsetFromRefDate( CalendarDate date) { if (isCalendarField) { if (date.equals(baseDate)) return 0.0; return date.getDifference(baseDate, periodField); } else { long msecs = date.getDifferenceInMsecs(baseDate); return msecs / period.getValueInMillisecs(); } }
@Test public void FmrcForecastDates() { try { List<CalendarDate> scanForecastTimes = fmrcScan.getForecastDates(); List<CalendarDate> explicitForecastTimes = fmrcExplicit.getForecastDates(); Assert.assertEquals(scanForecastTimes.size(), scanForecastTimes.size()); Assert.assertEquals(explicitForecastTimes.size(), 24); for (int i = 0; i < scanForecastTimes.size(); i++) { Assert.assertTrue(scanForecastTimes.get(i).equals(explicitForecastTimes.get(i))); } } catch (IOException e) { e.printStackTrace(); } }
@Test public void FmrcRunDates() { try { List<CalendarDate> scanRunTimes = fmrcScan.getRunDates(); List<CalendarDate> explicitRunTimes = fmrcExplicit.getRunDates(); Assert.assertEquals(scanRunTimes.size(), 3); Assert.assertEquals(explicitRunTimes.size(), scanRunTimes.size()); for (int i = 0; i < scanRunTimes.size(); i++) { Assert.assertTrue(explicitRunTimes.get(i).equals(scanRunTimes.get(i))); } } catch (IOException e) { e.printStackTrace(); } }
static private void checkPointFeature(PointFeature pobs, CalendarDateUnit timeUnit) throws java.io.IOException { Assert.assertNotNull("PointFeature location", pobs.getLocation()); Assert.assertNotNull("PointFeature time", pobs.getNominalTimeAsCalendarDate()); Assert.assertNotNull("PointFeature dataAll", pobs.getDataAll()); Assert.assertNotNull("PointFeature featureData", pobs.getFeatureData()); Assert.assertEquals("PointFeature makeCalendarDate", timeUnit.makeCalendarDate(pobs.getObservationTime()), pobs.getObservationTimeAsCalendarDate()); assert timeUnit.makeCalendarDate(pobs.getObservationTime()).equals(pobs.getObservationTimeAsCalendarDate()); checkData( pobs.getDataAll()); }