Example usage for java.util Date after

List of usage examples for java.util Date after

Introduction

In this page you can find the example usage for java.util Date after.

Prototype

public boolean after(Date when) 

Source Link

Document

Tests if this date is after the specified date.

Usage

From source file:com.l2jfree.gameserver.script.DateRange.java

/**
 * /*from  w  ww. jav  a  2s  . c  om*/
 * @param date
 * @return true if date is after startDate and before endDate
 */
public boolean isWithinRange(Date date) {
    return date.after(_startDate) && date.before(_endDate);
}

From source file:com.china317.gmmp.gmmp_report_analysis.App.java

private static void analysisBaoChe(String yyyyMMdd, ApplicationContext context) throws Exception {
    try {//from  w  w w.  jav a2s  .  c om
        log.info("[Baoche App started]");
        String businessType = "3";
        // System.out.println("[classpath]"+System.getProperty("java.class.path"));//classpaht
        // System.out.println("[path]"+System.getProperty("user.dir"));//?

        log.info("[Baoche get baseVehicle begin---------]");
        VehicleDao vehicleDao = (VehicleDao) context.getBean("vehicleDao");
        List<Vehicle> vehs = vehicleDao.getBaseVehicleByDate(yyyyMMdd, businessType);

        List<List<Vehicle>> list_tm = ListUtil.splitList(vehs, 400);
        log.info("[Baoche get baseVehicle end1---------],vehicle total:" + vehs.size());
        log.info("[Baoche get baseVehicle end2---------],list_tm total:" + list_tm.size());
        for (List<Vehicle> vls : list_tm) {
            Map<String, Vehicle> vehMap = new HashMap<String, Vehicle>();

            log.info("[Baoche code set init------]");
            HashSet<String> codes = new HashSet<String>();
            for (Vehicle v : vls) {
                codes.add(v.getCode());
                vehMap.put(v.getCode(), v);
            }

            log.info("[Baoche code set end------]" + "setSize:" + vehMap.size());
            List<VehicleLocate> list = new ArrayList<VehicleLocate>();
            if (codes.size() > 0) {
                VehicleLocateDao vehicleLocateDao_gmmpraw = (VehicleLocateDao) context
                        .getBean("vehicleLocateDaoGmmpRaw");
                list = vehicleLocateDao_gmmpraw.findHistoryByParams(yyyyMMdd, codes);
                log.info("[Baoche this time total Points Size]:" + list.size());
            }

            Map<String, List<VehicleLocate>> map = new HashMap<String, List<VehicleLocate>>();
            for (VehicleLocate entity : list) {

                if (entity.getGpsSpeed() < 160) {
                    // businessType
                    Vehicle tmpV = vehMap.get(entity.getCode());
                    entity.setBusinessType(tmpV.getBusinessType());
                    List<VehicleLocate> records = map.get(entity.getCode());
                    if (records == null) {
                        records = new ArrayList<VehicleLocate>();
                    }
                    long lastlong = DateTime.accountTime3(entity.getGpsTime(), entity.getGetTime());
                    if (lastlong <= 10 * 60) {
                        records.add(entity);
                    }
                    map.put(entity.getCode(), records);
                }

            }

            log.info("analysis begin ,total:" + map.size());

            Iterator<String> it = map.keySet().iterator();
            while (it.hasNext()) {
                String key = it.next();
                List<VehicleLocate> tmps = map.get(key);
                log.info("analysis vehicle code:" + key + "sort list begin, list size:" + tmps.size());
                Collections.sort(tmps, new Comparator<VehicleLocate>() {
                    public int compare(VehicleLocate o1, VehicleLocate o2) {
                        Date d1 = o1.getGpsTime();
                        Date d2 = o2.getGpsTime();
                        if (d1.after(d2)) {
                            return 1;
                        } else if (d1.before(d2)) {
                            return -1;
                        } else {
                            return 0;
                        }
                    }
                });
                log.info("analysis vehicle code:" + key + "sort list end");

                log.info("analysis vehicle code:" + key + "OVERSPEED OFFLINE ANALYSIS begin");
                for (int i = 0; i < tmps.size(); i++) {
                    VehicleLocate e = tmps.get(i);
                    AreaAddProcessor.addAreaRuleInfo(e);
                    /*
                     * log.info("[Baoche vehcilelocate properties]" +
                     * e.getCode() + "; gpstime:" + e.getGpsTime() +
                     * "; gpsSpeed:" + e.getGpsSpeed() + "; businessType:" +
                     * e.getBusinessType() + "; lon:" + e.getLon() +
                     * "; lat:" + e.getLat() + "; acc:" + e.getACCState());
                     */
                    BaocheAnalysisImp.getInstance().overSpeedAnalysis(e);
                    // BaocheAnalysisImp.getInstance().offlineAnalysis(e,
                    // yyyyMMdd);

                    // ??
                    BaocheAnalysisImp.getInstance().xlpAlarmAnalysis(e);

                    // ?
                    BaocheAnalysisImp.getInstance().putLastRecord(e);
                }

                // BaocheAnalysisImp.getInstance().clear();
                log.info("analysis vehicle code:" + key + "OVERSPEED OFFLINE ANALYSIS end");

                log.info("result: overspeed:" + BaocheAnalysisImp.getInstance().getOverSpeedRecordsSize()
                        + "; offline:" + BaocheAnalysisImp.getInstance().getOfflineRecordsSize());

            }
            LybcOverSpeedRecordsStoreIntoDB(BaocheAnalysisImp.getInstance().getOverSpeedRecords(), context);
            // 
            IntOutNoneRecordsStoreIntoDB(BaocheAnalysisImp.getInstance().getIniOutNoneRecords(), context);

            // 
            InOutMoreRecordsStoreIntoDB(BaocheAnalysisImp.getInstance().getIniOutMoreRecords(), context);

        }

        log.info("analysis end");

        log.info("[Baoche ended]");
    } catch (Exception e) {
        log.error(e);
    }
}

From source file:com.liferay.jenkins.tools.AfterTimestampMatcher.java

@Override
public boolean matches(Build jenkinsBuild) {
    Date date = new Date(jenkinsBuild.getTimestamp());

    if (date.after(start)) {
        return true;
    }//from ww w.  j  av a2s. co m

    return false;
}

From source file:com.china317.gmmp.gmmp_report_analysis.App.java

private static void analysisDgm(String yyyyMMdd, ApplicationContext context) {
    try {//from   w  w w  .  j  a v a 2 s  . c o  m
        log.info("[Dgm App started]");
        String businessType = "1";

        DgmAnalysisImp.getInstance().clear();
        // System.out.println("[classpath]"+System.getProperty("java.class.path"));//classpaht
        // System.out.println("[path]"+System.getProperty("user.dir"));//?

        log.info("[Dgm get baseVehicle begin---------]");
        VehicleDao vehicleDao = (VehicleDao) context.getBean("vehicleDao");
        List<Vehicle> vehs = vehicleDao.getBaseVehicleByDate(yyyyMMdd, businessType);

        List<List<Vehicle>> list_tm = ListUtil.splitList(vehs, 400);
        log.info("[Dgm get baseVehicle end1---------],vehicle total:" + vehs.size());
        log.info("[Dgm get baseVehicle end2---------],list_tm total:" + list_tm.size());
        for (List<Vehicle> vls : list_tm) {
            Map<String, Vehicle> vehMap = new HashMap<String, Vehicle>();

            log.info("[Dgm code set init------]");
            HashSet<String> codes = new HashSet<String>();
            for (Vehicle v : vls) {
                codes.add(v.getCode());
                vehMap.put(v.getCode(), v);
            }

            log.info("[Dgm code set end------]" + "setSize:" + vehMap.size());
            List<VehicleLocate> list = new ArrayList<VehicleLocate>();
            if (codes.size() > 0) {
                VehicleLocateDao vehicleLocateDao_gmmpraw = (VehicleLocateDao) context
                        .getBean("vehicleLocateDaoGmmpRaw");
                list = vehicleLocateDao_gmmpraw.findHistoryByParams(yyyyMMdd, codes);
                log.info("[Dgm this time total Points Size]:" + list.size());
            }

            Map<String, List<VehicleLocate>> map = new HashMap<String, List<VehicleLocate>>();
            for (VehicleLocate entity : list) {
                if (entity.getGpsSpeed() < 160) {
                    // businessType
                    Vehicle tmpV = vehMap.get(entity.getCode());
                    entity.setBusinessType(tmpV.getBusinessType());
                    List<VehicleLocate> records = map.get(entity.getCode());
                    if (records == null) {
                        records = new ArrayList<VehicleLocate>();
                    }
                    long lastlong = DateTime.accountTime3(entity.getGpsTime(), entity.getGetTime());
                    if (lastlong <= 10 * 60) {
                        records.add(entity);
                    }
                    map.put(entity.getCode(), records);
                }
            }

            log.info("analysis begin ,total:" + map.size());

            Iterator<String> it = map.keySet().iterator();
            int index = 0;
            while (it.hasNext()) {
                index++;
                String key = it.next();
                List<VehicleLocate> tmps = map.get(key);
                log.info("[Dgm]" + index + "analysis vehicle code:" + key + "sort list begin, list size:"
                        + tmps.size());
                Collections.sort(tmps, new Comparator<VehicleLocate>() {
                    public int compare(VehicleLocate o1, VehicleLocate o2) {
                        Date d1 = o1.getGpsTime();
                        Date d2 = o2.getGpsTime();
                        if (d1.after(d2)) {
                            return 1;
                        } else if (d1.before(d2)) {
                            return -1;
                        } else {
                            return 0;
                        }
                    }
                });
                log.info("analysis vehicle code:" + key + "sort list end");

                DgmAnalysisImp.getInstance().fatigueAnalysis(tmps, yyyyMMdd);
                log.info("-------Fatigue Analysis end");

                for (int i = 0; i < tmps.size(); i++) {
                    VehicleLocate e = tmps.get(i);
                    AreaAddProcessor.addAreaRuleInfo(e);
                    /*
                     * log.info("[Dgm vehcilelocate properties]" +
                     * e.getCode() + "; gpstime:" + e.getGpsTime() +
                     * "; gpsSpeed:" + e.getGpsSpeed() + "; businessType:" +
                     * e.getBusinessType() + "; lon:" + e.getLon() +
                     * "; lat:" + e.getLat() + "; acc:" + e.getACCState());
                     */
                    DgmAnalysisImp.getInstance().addZeroBegin(e);
                    DgmAnalysisImp.getInstance().overSpeedAnalysis(e);
                    DgmAnalysisImp.getInstance().offlineAnalysis(e, yyyyMMdd);
                    DgmAnalysisImp.getInstance().fobiddenAnalysis(e, i, tmps.size(), yyyyMMdd);
                    DgmAnalysisImp.getInstance().illegalParkingAnalysis(e);
                    DgmAnalysisImp.getInstance().illegalInOutAnalysis(e);

                    // ?
                    DgmAnalysisImp.getInstance().putLastRecord(e);
                }

                log.info("analysis vehicle code:" + key + "OVERSPEED OFFLINE ANALYSIS end");

                log.info("result: overspeed:" + DgmAnalysisImp.getInstance().getOverSpeedRecordsSize()
                        + "; offline:" + DgmAnalysisImp.getInstance().getOfflineRecordsSize());

                // DgmAnalysisImp.getInstance().clear();
            }
            FatigueRecordsStoreIntoDB(DgmAnalysisImp.getInstance().getFatigueMap(), context);
            log.info("--------Fatigue store into DB end");
            // OverSpeedRecordsStoreIntoDB(DgmAnalysisImp.getInstance()
            // .getOverSpeedMap(), context);

            DgmOverSpeedRecordsStoreIntoDB(DgmAnalysisImp.getInstance().getOverSpeedMap(), context);

            DgmEntryExitStoreIntoDB(DgmAnalysisImp.getInstance().getExitMap(), context);
            DgmFobbidenStoreIntoDB(DgmAnalysisImp.getInstance().getForbiddeningMap(), context);
            DgmIllegalParkingStoreIntoDB(DgmAnalysisImp.getInstance().getIllegalParking(), context);
        }

        log.info("analysis end");

        log.info("[Dgm ended]");
    } catch (Exception e) {
        log.error(e);
    }
}

From source file:authentication.jwt.NotBeforeTimeClaimsVerifier.java

/** {@inheritDoc} */
@Override//from   ww w  . java2  s  .  co m
public void verify(final JWT jwt) {
    final ReadOnlyJWTClaimsSet claims;
    try {
        claims = jwt.getJWTClaimsSet();
    } catch (final ParseException exception) {
        throw new JwtTokenException("Invalid JWT.");
    }
    final Date notBeforeTime = claims.getNotBeforeTime();
    if (notBeforeTime == null || notBeforeTime.after(new Date())) {
        throw new JwtTokenException("Not before is after sysdate");
    }
}

From source file:com.microsoft.projectoxford.face.samples.helper.StorageHelper.java

public static ArrayList<String> runQuery(String from, String to, String courseId) {

    ArrayList<ParseObject> listTrainings = new ArrayList<>();
    ArrayList<String> list = new ArrayList<>();
    ParseQuery<ParseObject> query = ParseQuery.getQuery("List");

    query.whereEqualTo("Code", courseId);

    try {//from   w  w w.j ava  2 s.  c o m
        listTrainings = (ArrayList<ParseObject>) (query.find());
    } catch (com.parse.ParseException e) {
        e.printStackTrace();
    }
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    Date date, toDate, fromDate;
    for (ParseObject course : listTrainings) {
        try {
            date = sdf.parse(course.get("Date").toString());
            toDate = sdf.parse(to);
            fromDate = sdf.parse(from);
            if ((date.after(fromDate) && toDate.after(date)) || date.equals(fromDate) || date.equals(toDate)) {
                list.add(course.get("Names").toString());
            }

        } catch (ParseException e) {
            e.printStackTrace();
        }

    }

    return list;
}

From source file:com.liferay.jenkins.tools.BetweenTimestampsMatcher.java

@Override
public boolean matches(Build jenkinsBuild) {
    Date date = new Date(jenkinsBuild.getTimestamp());

    if (date.after(start) && date.before(end)) {
        return true;
    }/*from   w  ww.  j  a  v  a2 s  .  co  m*/

    return false;
}

From source file:com.thoughtworks.inproctester.htmlunit.InProcessWebConnection.java

private void storeCookie(String hostName, String rawCookie) {
    Cookie cookie = cookieParser.parseCookie(hostName, rawCookie);
    Date now = new Date();
    if (cookie.getExpires() != null && now.after(cookie.getExpires())) {
        removeCookie(this.cookieManager, cookie.getName());
    } else {/*from  w w  w .ja va2 s. c o m*/
        this.cookieManager.addCookie(cookie);
    }
}

From source file:Fetch5.java

  public boolean hasExpired() {
  if (expires == null) {
    return false;
  }//  w  w  w  .ja  v a  2s  .  c  o m
  Date now = new Date();
  return now.after(expires);
}

From source file:net.fizzl.redditengine.impl.SerializableCookie.java

@Override
public boolean isExpired(Date date) {
    boolean expired = (expiryDate != null && date.after(expiryDate));
    return expired;
}