Ejemplo n.º 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;
  }
Ejemplo n.º 2
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;
    }
  }
Ejemplo n.º 3
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;
    }
  }
Ejemplo n.º 4
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;
    }
  }
Ejemplo n.º 5
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;
    }
  }
Ejemplo n.º 6
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;
    }
  }
Ejemplo n.º 7
0
  private Coordinates toCoordinates(Context ctx) {

    StringTokenizer st = new StringTokenizer((String) ctx.get(Context.FLD_OBJECT));
    double x = Double.parseDouble(st.nextToken());
    double y = Double.parseDouble(st.nextToken());
    return new Coordinates(x, y);
  }
Ejemplo n.º 8
0
 private void initContext() {
   context.put(JavacTaskImpl.class, this);
   if (context.get(TaskListener.class) != null)
     context.put(TaskListener.class, (TaskListener) null);
   if (taskListener != null) context.put(TaskListener.class, ccw.wrap(taskListener));
   // initialize compiler's default locale
   context.put(Locale.class, locale);
 }
Ejemplo n.º 9
0
  private boolean funcLocDistOk(Context ctx1, Context ctx2) { // boolean function 1

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

    StringTokenizer st = new StringTokenizer(v1);
    double x1 = Double.parseDouble(st.nextToken());
    double y1 = Double.parseDouble(st.nextToken());
    st = new StringTokenizer(v2);
    double x2 = Double.parseDouble(st.nextToken());
    double y2 = Double.parseDouble(st.nextToken());
    double dist = Coordinates.calDist(x1, y1, x2, y2);

    // The distance should not be larger than two times the allowed error
    boolean result = false;
    if (dist <= 2 * ERR) {
      result = true;
    }

    return result;
  }
Ejemplo n.º 10
0
  protected Enter(Context context) {
    context.put(enterKey, this);

    log = Log.instance(context);
    reader = ClassReader.instance(context);
    make = TreeMaker.instance(context);
    syms = Symtab.instance(context);
    chk = Check.instance(context);
    memberEnter = MemberEnter.instance(context);
    types = Types.instance(context);
    annotate = Annotate.instance(context);
    lint = Lint.instance(context);

    predefClassDef =
        make.ClassDef(make.Modifiers(PUBLIC), syms.predefClass.name, null, null, null, null);
    predefClassDef.sym = syms.predefClass;
    todo = Todo.instance(context);
    fileManager = context.get(JavaFileManager.class);
  }
Ejemplo n.º 11
0
 public static Enter instance(Context context) {
   Enter instance = context.get(enterKey);
   if (instance == null) instance = new Enter(context);
   return instance;
 }
Ejemplo n.º 12
0
 /**
  * Construct a JavaFileObject from the given file.
  *
  * <p><b>TODO: this method is useless here</b>
  *
  * @param file a file
  * @return a JavaFileObject from the standard file manager.
  */
 public JavaFileObject asJavaFileObject(File file) {
   JavacFileManager fm = (JavacFileManager) context.get(JavaFileManager.class);
   return fm.getRegularFile(file);
 }
Ejemplo n.º 13
0
 /** Get the Options instance for this context. */
 public static Options instance(Context context) {
   Options instance = context.get(optionsKey);
   if (instance == null) instance = new Options(context);
   return instance;
 }