Esempio n. 1
0
 private static boolean invoke(
     PageContext pc, List list, UDF udf, ExecutorService es, List<Future<Data<Object>>> futures)
     throws CasterException, PageException {
   ListIterator it = list.listIterator();
   boolean async = es != null;
   Object res, v;
   int index;
   ArgumentIntKey k;
   while (it.hasNext()) {
     index = it.nextIndex();
     k = ArgumentIntKey.init(index);
     v = it.next();
     res =
         _inv(
             pc,
             udf,
             new Object[] {v, Caster.toDoubleValue(k.getString()), list},
             k,
             v,
             es,
             futures);
     if (!async && !Caster.toBooleanValue(res)) return false;
   }
   return true;
 }
Esempio n. 2
0
  private static boolean invoke(
      PageContext pc,
      StringListData sld,
      UDF udf,
      ExecutorService es,
      List<Future<Data<Object>>> futures)
      throws CasterException, PageException {
    Array arr =
        ListUtil.listToArray(
            sld.list, sld.delimiter, sld.includeEmptyFieldsx, sld.multiCharacterDelimiter);

    Iterator<Entry<Key, Object>> it = arr.entryIterator();
    Entry<Key, Object> e;
    boolean async = es != null;
    Object res;
    while (it.hasNext()) {
      e = it.next();
      res =
          _inv(
              pc,
              udf,
              new Object[] {
                e.getValue(), Caster.toDoubleValue(e.getKey().getString()), sld.list, sld.delimiter
              },
              e.getKey(),
              e.getValue(),
              es,
              futures);
      if (!async && !Caster.toBooleanValue(res)) {
        return false;
      }
    }
    return true;
  }
Esempio n. 3
0
  @Override
  public Object invoke(PageContext pc, Object[] args) throws PageException {

    if (args.length == 2) return call(pc, (args[0]), Caster.toFunction(args[1]));
    if (args.length == 3)
      return call(pc, (args[0]), Caster.toFunction(args[1]), Caster.toBooleanValue(args[2]));
    if (args.length == 4)
      return call(
          pc,
          (args[0]),
          Caster.toFunction(args[1]),
          Caster.toBooleanValue(args[2]),
          Caster.toDoubleValue(args[3]));

    throw new FunctionException(pc, "Every", 2, 4, args.length);
  }
Esempio n. 4
0
 private static boolean invoke(
     PageContext pc, Query qry, UDF udf, ExecutorService es, List<Future<Data<Object>>> futures)
     throws CasterException, PageException {
   final int pid = pc.getId();
   ForEachQueryIterator it = new ForEachQueryIterator(qry, pid);
   boolean async = es != null;
   double r;
   Object res, row;
   try {
     while (it.hasNext()) {
       row = it.next();
       r = Caster.toDoubleValue(qry.getCurrentrow(pid));
       res = _inv(pc, udf, new Object[] {row, r, qry}, r, row, es, futures);
       if (!async && !Caster.toBooleanValue(res)) {
         return false;
       }
     }
   } finally {
     it.reset();
   }
   return true;
 }
Esempio n. 5
0
 private static boolean invoke(
     PageContext pc, Array arr, UDF udf, ExecutorService es, List<Future<Data<Object>>> futures)
     throws CasterException, PageException {
   Iterator<Entry<Key, Object>> it = arr.entryIterator();
   Entry<Key, Object> e;
   boolean async = es != null;
   Object res;
   while (it.hasNext()) {
     e = it.next();
     res =
         _inv(
             pc,
             udf,
             new Object[] {e.getValue(), Caster.toDoubleValue(e.getKey().getString()), arr},
             e.getKey(),
             e.getValue(),
             es,
             futures);
     if (!async && !Caster.toBooleanValue(res)) {
       return false;
     }
   }
   return true;
 }
Esempio n. 6
0
 @Override
 public Object invoke(PageContext pc, Object[] args) throws PageException {
   if (args.length == 2) return call(pc, Caster.toString(args[0]), Caster.toDoubleValue(args[1]));
   throw new FunctionException(pc, "Right", 2, 2, args.length);
 }
Esempio n. 7
0
 /**
  * set the value timeout Specifies the maximum amount of time, in seconds, to wait to obtain a
  * lock. If a lock can be obtained within the specified period, execution continues inside the
  * body of the tag. Otherwise, the behavior depends on the value of the throwOnTimeout attribute.
  *
  * @param timeout value to set
  */
 public void setTimeout(Object oTimeout) throws PageException {
   if (oTimeout instanceof TimeSpan)
     this.timeoutInMillis = (int) ((TimeSpan) oTimeout).getMillis();
   else this.timeoutInMillis = (int) (Caster.toDoubleValue(oTimeout) * 1000D);
   // print.out(Caster.toString(timeoutInMillis));
 }