@After public void assureEvaluatorIsSane() { assertTrue(evaluator.getCurrentEnvt().isRootScope()); assertTrue(evaluator.getCurrentEnvt().isRootStackFrame()); assertTrue( "When we are at the root scope and stack frame, the accumulators should be empty as well", evaluator.getAccumulators().empty()); }
@Override public void run() { while (running) { AbstractAST current = eval.getCurrentAST(); Environment env = eval.getCurrentEnvt(); String name = env.getName(); if (current != null) { ISourceLocation stat = current.getLocation(); if (stat != null) { Count currentCount = ast.get(stat); if (currentCount == null) { ast.put(stat, new Count()); names.put(stat, name); } else { currentCount.increment(); } } while (env.getParent() != null && !env.getParent().isRootScope()) { env = env.getParent(); } if (env != null) { Count currentCount = frame.get(env.getLocation()); if (currentCount == null) { frame.put(env.getLocation(), new Count()); names.put(env.getLocation(), env.getName()); } else { currentCount.increment(); } } } try { sleep(resolution); } catch (InterruptedException e) { e.printStackTrace(); } } }