コード例 #1
0
 @Override
 public void checkValue(Context context, IValue value) throws PromptoError {
   Context child = context.newChildContext();
   child.registerValue(new Variable(new Identifier("value"), AnyType.instance()));
   child.setValue(new Identifier("value"), value);
   Object test = expression.interpret(child);
   if (!Boolean.TRUE.equals(test))
     throw new InvalidDataError(
         (value == null ? "null" : value.toString()) + " does not match:" + expression.toString());
 }
コード例 #2
0
 private IValue evaluateItemIteratorNoIndex(IType elemType, Context context) throws PromptoError {
   IValue src = source.interpret(context);
   Iterator<IValue> iterator = getIterator(context, src);
   while (iterator.hasNext()) {
     Context child = context.newChildContext();
     child.registerValue(new Variable(v1, elemType));
     child.setValue(v1, iterator.next());
     IValue value = instructions.interpret(child);
     if (value != null) return value;
   }
   return null;
 }