private boolean funcLocMixVeloOk(ccr.app.Context ctx1, ccr.app.Context ctx2) { java.lang.String v1 = (java.lang.String) ctx1.get(Context.FLD_OBJECT); java.lang.String v2 = (java.lang.String) ctx1.get(Context.FLD_TIMESTAMP); java.lang.String v3 = (java.lang.String) ctx2.get(Context.FLD_OBJECT); java.lang.String v4 = (java.lang.String) ctx2.get(Context.FLD_TIMESTAMP); if (v1 == null || v2 == null || v3 == null || v4 == null) { return false; } java.util.StringTokenizer st = new java.util.StringTokenizer(v1); double x1 = Double.parseDouble(st.nextToken()); double y1 = Double.parseDouble(st.nextToken()); st = new java.util.StringTokenizer(v3); double x2 = Double.parseDouble(st.nextToken()); double y2 = Double.parseDouble(st.nextToken()); double dist = Coordinates.calDist(x1, y1, x2, y2); long t = TimeFormat.convert(v4) - TimeFormat.convert(v2) - STAY_TIME; boolean result = false; double vmin = (VELOCITY * ((double) t / 1000) - 2 * ERR) / ((double) t / 1000); double vmax = (VELOCITY * ((double) t / 1000) + 2 * ERR) / ((double) t / 1000); double ve = dist / ((double) t / 1000); if (ve >= vmin && ve <= vmax) { result = true; } return result; }
private boolean filterLocSkip1Walk(ccr.app.Context ctx1, ccr.app.Context ctx2) { int c1 = Integer.parseInt((java.lang.String) ctx1.get(Context.FLD_OWNER)); int c2 = Integer.parseInt((java.lang.String) ctx2.get(Context.FLD_OWNER)); long t1 = TimeFormat.convert((java.lang.String) ctx1.get(Context.FLD_TIMESTAMP)); long t2 = TimeFormat.convert((java.lang.String) ctx2.get(Context.FLD_TIMESTAMP)); if (c1 + 2 == c2 && t2 - t1 >= 2 * (long) (WALK_DIST / VELOCITY * 1000)) { return true; } else { return false; } }
private boolean filterLocCons2Walk(ccr.app.Context ctx1, ccr.app.Context ctx2) { int c1 = Integer.parseInt((java.lang.String) ctx1.get(Context.FLD_OWNER)); int c2 = Integer.parseInt((java.lang.String) ctx2.get(Context.FLD_OWNER)); long t1 = TimeFormat.convert((java.lang.String) ctx1.get(Context.FLD_TIMESTAMP)); long t2 = TimeFormat.convert((java.lang.String) ctx2.get(Context.FLD_TIMESTAMP)); if (c1 + 1 == c2 && t2 - t1 > STAY_TIME + 100) { return true; } else { return false; } }
private ccr.app.Context generateCtx() { ccr.app.Context ctx = new ccr.app.Context(); ctx.put(Context.FLD_CATEGORY, getCategory()); ctx.put(Context.FLD_SUBJECT, getSubject()); ctx.put(Context.FLD_PREDICATE, getPredicate()); ctx.put(Context.FLD_OBJECT, getObject()); ctx.put(Context.FLD_START_FROM, getStartFrom()); ctx.put(Context.FLD_END_AT, getEndAt()); ctx.put(Context.FLD_SITE, getSite()); ctx.put(Context.FLD_OWNER, getOwner()); ctx.put(Context.FLD_TIMESTAMP, TimeFormat.convert(timestamp)); return ctx; }
private ccr.app.Coordinates toCoordinates(ccr.app.Context ctx) { java.util.StringTokenizer st = new java.util.StringTokenizer((java.lang.String) ctx.get(Context.FLD_OBJECT)); double x = Double.parseDouble(st.nextToken()); double y = Double.parseDouble(st.nextToken()); return new ccr.app.Coordinates(x, y); }
private boolean funcLocDistOk(ccr.app.Context ctx1, ccr.app.Context ctx2) { java.lang.String v1 = (java.lang.String) ctx1.get(Context.FLD_OBJECT); java.lang.String v2 = (java.lang.String) ctx2.get(Context.FLD_OBJECT); if (v1 == null || v2 == null) { return false; } java.util.StringTokenizer st = new java.util.StringTokenizer(v1); double x1 = Double.parseDouble(st.nextToken()); double y1 = Double.parseDouble(st.nextToken()); st = new java.util.StringTokenizer(v2); double x2 = Double.parseDouble(st.nextToken()); double y2 = Double.parseDouble(st.nextToken()); double dist = Coordinates.calDist(x1, y1, x2, y2); boolean result = false; if (dist <= 2 * ERR) { result = true; } return result; }