コード例 #1
0
ファイル: ProtectDebugInfo.java プロジェクト: gspandy/jPOS-EE
  private void protect(Context ctx) {

    /* wipe by removing entries from the context  */
    for (String s : wipedEntrys) ctx.remove(s);
    /* Protect entry items */
    for (String s : protectedEntrys) {
      Object o = ctx.get(s);
      if (o instanceof ISOMsg) {
        ISOMsg m = (ISOMsg) ctx.get(s);
        if (m != null) {
          m = (ISOMsg) m.clone();
          ctx.put(s, m); // place a clone in the context
          for (String p : protectISO) protectField(m, Integer.parseInt(p));
        }
      }
      if (o instanceof FSDMsg) {
        FSDMsg m = (FSDMsg) ctx.get(s);
        if (m != null) {
          for (String p : protectFSD) protectField(m, p);
        }
      }
      if (o instanceof String) {
        String p = (String) ctx.get(s);
        if (p != null) {
          ctx.put(s, protect(p));
        }
      }
    }
  }
コード例 #2
0
ファイル: TestCFG2_127.java プロジェクト: pabloloyola/soot
  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;
  }
コード例 #3
0
ファイル: RealTimeChart.java プロジェクト: paulcony/XJTLU
 public void run() {
   while (true) {
     try {
       System.out.println(context.get());
       timeSeries.add(new Millisecond(), context.get(), true);
       Thread.sleep(300);
     } catch (InterruptedException e) {
     }
   }
 }
コード例 #4
0
ファイル: TestCFG2_127.java プロジェクト: pabloloyola/soot
  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;
    }
  }
コード例 #5
0
ファイル: TestCFG2_127.java プロジェクト: pabloloyola/soot
  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
ファイル: TestCFG2_127.java プロジェクト: pabloloyola/soot
  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;
    }
  }
コード例 #7
0
ファイル: TestCFG2_127.java プロジェクト: pabloloyola/soot
  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;
    }
  }
コード例 #8
0
ファイル: TestCFG2_127.java プロジェクト: pabloloyola/soot
  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;
    }
  }
コード例 #9
0
    protected Enter(Context context) {
		DEBUG.P(this,"Enter(1)");
		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);
		annotate = Annotate.instance(context);
		lint = Lint.instance(context);

		predefClassDef = make.ClassDef(
			make.Modifiers(PUBLIC),
			syms.predefClass.name, null, null, null, null);
		//predefClass是一个ClassSymbol(PUBLIC|ACYCLIC, names.empty, rootPackage)
		//且它的Scope members_field已有成员(几个基本类型符号(symbols for basic types)及其他操作符)
		//请参考Systab类的predefClass字段说明
		predefClassDef.sym = syms.predefClass;

		todo = Todo.instance(context);
		fileManager = context.get(JavaFileManager.class);
		
		names = Name.Table.instance(context);    //我加上的
		DEBUG.P(0,this,"Enter(1)");
    }
コード例 #10
0
ファイル: TestCFG2_127.java プロジェクト: pabloloyola/soot
  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);
  }
コード例 #11
0
ファイル: MyURL.java プロジェクト: russtam/few
  public String toString() {
    HttpServletRequest request = Context.get().getRequest();

    StringBuilder stringBuilder = new StringBuilder();
    if (!(page != null && page.toLowerCase().startsWith("http"))) {
      if (!secure) stringBuilder.append("http://");
      else stringBuilder.append("https://");

      if (Utils.isNotNull(WEB_SERVER_HOST)) stringBuilder.append(WEB_SERVER_HOST);
      else stringBuilder.append(request.getServerName());

      if (!secure && WEB_SERVER_HTTP_PORT != 0 && WEB_SERVER_HTTP_PORT != 80) {
        stringBuilder.append(":");
        stringBuilder.append(WEB_SERVER_HTTP_PORT);
      } else if (secure && WEB_SERVER_HTTPS_PORT != 0 && WEB_SERVER_HTTPS_PORT != 443) {
        stringBuilder.append(":");
        stringBuilder.append(WEB_SERVER_HTTPS_PORT);
      } else if (request.getServerPort() != 80) {
        stringBuilder.append(":");
        stringBuilder.append(request.getServerPort());
      }
    }
    stringBuilder.append(page);

    encodeParameters(stringBuilder);

    return stringBuilder.toString();
  }
コード例 #12
0
ファイル: Names.java プロジェクト: bttelle/error-prone-javac
 public static Names instance(Context context) {
   Names instance = context.get(namesKey);
   if (instance == null) {
     instance = new Names(context);
     context.put(namesKey, instance);
   }
   return instance;
 }
コード例 #13
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);
 }
コード例 #14
0
ファイル: RealTimeChart.java プロジェクト: paulcony/XJTLU
 @Override
 public void update(Observable arg0, Object arg1) {
   // TODO Auto-generated method stub
   if (arg0 instanceof Context) {
     Context tep = (Context) arg0;
     timeSeries.add(new Millisecond(), tep.get(), true);
     jfreechart.fireChartChanged();
   }
 }
コード例 #15
0
 public <T> T get(Class<T> type, String[] searchOrder) {
   if (searchOrder == null) {
     searchOrder = getDefaultSearchOrder();
   }
   for (String contextName : searchOrder) {
     Context context = contexts.get(contextName);
     T object = context.get(type);
     if (object != null) return object;
   }
   return null;
 }
コード例 #16
0
ファイル: TestCFG2_127.java プロジェクト: pabloloyola/soot
  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;
  }
コード例 #17
0
 /**
  * searches an object based on type in the default search order. if this environment contains the
  * given context, the search skips contexts registered after it.
  */
 public <T> T get(Class<T> type, Context requester) {
   String[] searchOrder = getDefaultSearchOrder();
   int searchPosition = 0;
   for (int i = 0; i < searchOrder.length; i++) {
     if (contexts.get(searchOrder[i]) == requester) {
       searchPosition = i + 1;
       break;
     }
   }
   for (int i = searchPosition; i < searchOrder.length; i++) {
     Context context = contexts.get(searchOrder[i]);
     T object = context.get(type);
     if (object != null) return object;
   }
   return null;
 }
コード例 #18
0
 public Object get(String name, String[] searchOrder, boolean nullIfNotFound) {
   if (searchOrder == null) {
     searchOrder = getDefaultSearchOrder();
   }
   for (String contextName : searchOrder) {
     Context context = contexts.get(contextName);
     if (context.has(name)) {
       return context.get(name);
     }
   }
   if (nullIfNotFound) {
     return null;
   } else {
     throw new JbpmException("Null value found for " + name + " but null is not allowed");
   }
 }
コード例 #19
0
  /**
   * Implements the Contextualizable interface using bean introspection.
   *
   * @param aContext {@inheritDoc}
   * @throws CheckstyleException {@inheritDoc}
   * @see Contextualizable
   */
  public final void contextualize(Context aContext) throws CheckstyleException {
    final BeanUtilsBean beanUtils = createBeanUtilsBean();

    // TODO: debug log messages
    final Collection<String> attributes = aContext.getAttributeNames();

    for (final String key : attributes) {
      final Object value = aContext.get(key);

      try {
        beanUtils.copyProperty(this, key, value);
      } catch (final InvocationTargetException e) {
        // TODO: log.debug("The bean " + this.getClass()
        // + " is not interested in " + value)
        throw new CheckstyleException(
            "cannot set property "
                + key
                + " to value "
                + value
                + " in bean "
                + this.getClass().getName(),
            e);
      } catch (final IllegalAccessException e) {
        throw new CheckstyleException(
            "cannot access " + key + " in " + this.getClass().getName(), e);
      } catch (final IllegalArgumentException e) {
        throw new CheckstyleException(
            "illegal value '"
                + value
                + "' for property '"
                + key
                + "' of bean "
                + this.getClass().getName(),
            e);
      } catch (final ConversionException e) {
        throw new CheckstyleException(
            "illegal value '"
                + value
                + "' for property '"
                + key
                + "' of bean "
                + this.getClass().getName(),
            e);
      }
    }
  }
コード例 #20
0
ファイル: Enter.java プロジェクト: loverdos/javac-openjdk7
  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);
    names = Names.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);

    Options options = Options.instance(context);
    pkginfoOpt = PkgInfo.get(options);
  }
コード例 #21
0
 static ClassWriter instance(Context context) {
   ClassWriter instance = context.get(ClassWriter.class);
   if (instance == null) instance = new ClassWriter(context);
   return instance;
 }
コード例 #22
0
 /** Get the symbol table instance. */
 public static Symtab instance(Context context) {
   Symtab instance = (Symtab) context.get(symtabKey);
   if (instance == null) instance = new Symtab(context);
   return instance;
 }
コード例 #23
0
ファイル: Enter.java プロジェクト: loverdos/javac-openjdk7
 public static Enter instance(Context context) {
   Enter instance = context.get(enterKey);
   if (instance == null) instance = new Enter(context);
   return instance;
 }
コード例 #24
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);
 }