예제 #1
0
  private boolean funcLocMixVeloOk(Context ctx1, Context ctx2) { // boolean function 4

    String v1 = (String) ctx1.get(Context.FLD_OBJECT);
    String v2 = (String) ctx1.get(Context.FLD_TIMESTAMP);
    String v3 = (String) ctx2.get(Context.FLD_OBJECT);
    String v4 = (String) ctx2.get(Context.FLD_TIMESTAMP);
    if (v1 == null || v2 == null || v3 == null || v4 == null) {
      return false;
    }

    StringTokenizer st = new StringTokenizer(v1);
    double x1 = Double.parseDouble(st.nextToken());
    double y1 = Double.parseDouble(st.nextToken());
    st = new 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; // Different here

    // The velocity should be between vmin and vmax
    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;
  }
예제 #2
0
 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;
 }
예제 #3
0
 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;
   }
 }
예제 #4
0
 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;
   }
 }
예제 #5
0
  private boolean filterLocSkip1Stay(Context ctx1, Context ctx2) { // filter 3

    int c1 = Integer.parseInt((String) ctx1.get(Context.FLD_OWNER));
    int c2 = Integer.parseInt((String) ctx2.get(Context.FLD_OWNER));
    long t1 = TimeFormat.convert((String) ctx1.get(Context.FLD_TIMESTAMP));
    long t2 = TimeFormat.convert((String) ctx2.get(Context.FLD_TIMESTAMP));
    if (c1 + 2 == c2 && t2 - t1 <= 2 * (STAY_TIME + 100)) { // Skipping 1 and in stay
      return true;
    } else {
      return false;
    }
  }
예제 #6
0
  private boolean filterLocCons2Walk(Context ctx1, Context ctx2) { // filter 2

    int c1 = Integer.parseInt((String) ctx1.get(Context.FLD_OWNER));
    int c2 = Integer.parseInt((String) ctx2.get(Context.FLD_OWNER));
    long t1 = TimeFormat.convert((String) ctx1.get(Context.FLD_TIMESTAMP));
    long t2 = TimeFormat.convert((String) ctx2.get(Context.FLD_TIMESTAMP));
    if (c1 + 1 == c2 && t2 - t1 > STAY_TIME + 100) { // Adjacent and in walk
      return true;
    } else {
      return false;
    }
  }
예제 #7
0
  private boolean filterLocSkip1Walk(Context ctx1, Context ctx2) { // filter 4

    int c1 = Integer.parseInt((String) ctx1.get(Context.FLD_OWNER));
    int c2 = Integer.parseInt((String) ctx2.get(Context.FLD_OWNER));
    long t1 = TimeFormat.convert((String) ctx1.get(Context.FLD_TIMESTAMP));
    long t2 = TimeFormat.convert((String) ctx2.get(Context.FLD_TIMESTAMP));
    if (c1 + 2 == c2
        && t2 - t1 >= 2 * (long) (WALK_DIST / VELOCITY * 1000)) { // Skipping 1 and in walk
      return true;
    } else {
      return false;
    }
  }
예제 #8
0
  private boolean filterLocSkip1Mix(Context ctx1, Context ctx2) { // filter 5

    int c1 = Integer.parseInt((String) ctx1.get(Context.FLD_OWNER));
    int c2 = Integer.parseInt((String) ctx2.get(Context.FLD_OWNER));
    long t1 = TimeFormat.convert((String) ctx1.get(Context.FLD_TIMESTAMP));
    long t2 = TimeFormat.convert((String) ctx2.get(Context.FLD_TIMESTAMP));
    if (c1 + 2 == c2 /*&&*/
        || t2 - t1 > 2 * (STAY_TIME + 100)
            && // Seeded fault
            t2 - t1 < 2 * (long) (WALK_DIST / VELOCITY * 1000)) { // Skipping 1 and in stay and walk
      return true;
    } else {
      return false;
    }
  }
예제 #9
0
  private boolean filterLocCons2Stay(Context ctx1, Context ctx2) { // filter 1

    int c1 = Integer.parseInt((String) ctx1.get(Context.FLD_OWNER));
    int c2 = Integer.parseInt((String) ctx2.get(Context.FLD_OWNER));
    long t1 = TimeFormat.convert((String) ctx1.get(Context.FLD_TIMESTAMP));
    long t2 =
        TimeFormat.convert(
            (String) ctx2.get(Context.FLD_TIMESTAMP)); // System.out.print(" f1:" + t2 + " ");
    if (c1 + 1 == c2 && t2 - t1 <= STAY_TIME + 100) { // Adjacent and in stay
      //	System.out.print(" f1 true ");
      return true;
    } else {
      return false;
    }
  }
예제 #10
0
 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;
 }
예제 #11
0
  private Context generateCtx() {

    Context ctx = new 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());

    // FLD_ID, FLD_TIMESTAMP, FLD_CONSISTENCY are unnecessary

    ctx.put(Context.FLD_TIMESTAMP, TimeFormat.convert(timestamp)); // Set FLD_TIMESTAMP

    return ctx;
  }
예제 #12
0
 private java.lang.String getEndAt() {
   return TimeFormat.convert(System.currentTimeMillis());
 }
예제 #13
0
  private String getStartFrom() {

    return TimeFormat.convert(System.currentTimeMillis());
  }