Java Code Examples for org.joda.time.LocalDateTime#isAfter()

The following examples show how to use org.joda.time.LocalDateTime#isAfter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnalysisHelper.java    From act with GNU General Public License v3.0 6 votes vote down vote up
/**
 * This function picks the best scan file based on two critereon: a) The scan file has to be a positive scan file
 * b) The scan file has to be of the latest lcms run for the well.
 * @param db The db to query scan files from
 * @param well The well being used for the analysis
 * @param <T> The platewell type abstraction
 * @return The best ScanFile
 * @throws Exception
 */
public static <T extends PlateWell<T>> ScanFile pickBestScanFileForWell(DB db, T well) throws Exception {
  List<ScanFile> scanFiles = ScanFile.getScanFileByPlateIDRowAndColumn(
      db, well.getPlateId(), well.getPlateRow(), well.getPlateColumn());

  // TODO: We only analyze positive scan files for now since we are not confident with the negative scan file results.
  // Since we perform multiple scans on the same well, we need to categorize the data based on date.
  ScanFile latestScanFiles = null;
  LocalDateTime latestDateTime = null;

  for (ScanFile scanFile : scanFiles) {
    if (!scanFile.isNegativeScanFile()) {
      LocalDateTime scanDate = scanFile.getDateFromScanFileTitle();

      // Pick the newest scan files
      if (latestDateTime == null || scanDate.isAfter(latestDateTime)) {
        latestScanFiles = scanFile;
        latestDateTime = scanDate;
      }
    }
  }

  return latestScanFiles;
}
 
Example 2
Source File: HistoDataServiceImpl.java    From ipst with Mozilla Public License 2.0 6 votes vote down vote up
private boolean matches(HistoKey k, Map<String, Object> map, QueryParams query) {
    if (query.getHorizon() != null && !query.getHorizon().equals(k.getHorizon())) {
        return false;
    }
    if (query.getDayTimeFrom() != null && query.getDayTimeTo() != null) {
        LocalDateTime check = new DateTime(k.getDateTime()).toLocalDateTime();
        LocalDateTime from = new DateTime(query.getDayTimeFrom()).toLocalDateTime();
        LocalDateTime to = new DateTime(query.getDayTimeTo()).toLocalDateTime();

        LocalDateTime start = new DateTime(k.getDateTime()).toLocalDateTime().withHourOfDay(from.getHourOfDay())
                .withMinuteOfHour(from.getMinuteOfHour()).withSecondOfMinute(from.getSecondOfMinute());
        LocalDateTime end = new DateTime(k.getDateTime()).toLocalDateTime().withHourOfDay(to.getHourOfDay())
                .withMinuteOfHour(to.getMinuteOfHour()).withSecondOfMinute(to.getSecondOfMinute());
        if (check.isAfter(end) || check.isBefore(start)) {
            return false;
        }
    }
    if (query.getForecastTime() >= 0) {
        if (k.getForecastDistance() != query.getForecastTime()) {
            return false;
        }
    }
    return true;
}
 
Example 3
Source File: Times.java    From prayer-times-android with Apache License 2.0 6 votes vote down vote up
@Nullable
private static Pair<Alarm, LocalDateTime> getNextAlarm(Times t) {
    Alarm alarm = null;
    LocalDateTime time = null;
    for (Alarm a : t.getUserAlarms()) {
        if (!a.isEnabled()) continue;
        LocalDateTime nextAlarm = a.getNextAlarm();
        if (nextAlarm == null) continue;
        if (time == null || time.isAfter(nextAlarm)) {
            alarm = a;
            time = nextAlarm;
        }
    }
    if (alarm == null)
        return null;
    alarm.setCity(t);
    return new Pair<>(alarm, time);
}
 
Example 4
Source File: Times.java    From prayer-times-android with Apache License 2.0 6 votes vote down vote up
@Nullable
private static Pair<Alarm, LocalDateTime> getNextAlarm(Times t) {
    Alarm alarm = null;
    LocalDateTime time = null;
    for (Alarm a : t.getUserAlarms()) {
        if (!a.isEnabled()) continue;
        LocalDateTime nextAlarm = a.getNextAlarm();
        if (nextAlarm == null) continue;
        if (time == null || time.isAfter(nextAlarm)) {
            alarm = a;
            time = nextAlarm;
        }
    }
    if (alarm == null)
        return null;
    alarm.setCity(t);
    return new Pair<>(alarm, time);
}