예제 #1
0
 public boolean waitForLambda(long waitMs, Lambda expression) {
   try {
     boolean ret = expression.func();
     long endMs = System.currentTimeMillis() + waitMs;
     while (!failure && !ret && (System.currentTimeMillis() <= endMs)) {
       Thread.sleep(5);
       ret = expression.func();
     }
     assertFalse(failure);
     return ret;
   } catch (Exception e) {
     fail("exception during lambda evaluation");
     return false;
   }
 }
예제 #2
0
 protected Lambda substitute(IDContext context, String name, Lambda lambda) {
   return name.equals(this.name) ? lambda.deepCopy() : this;
 }
예제 #3
0
  Lambda(Lambda l) {
    this.id = l.getId();
    this.exp = copy(l.getExpression());

    copyEnvironment(l);
  }
예제 #4
0
 @Override
 public void calc(Env env) {
   if (cond == null || cond.test(env)) env.value += env.baseValue * _lambda.calc(env);
 }
예제 #5
0
 @Test
 public void testIdentity() {
   Lambda<Object, Object> id = identity();
   assert id == id.map(id);
 }