예제 #1
0
 @Override
 public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
   final Iter ir = iter(qc);
   final Item it = ir.next();
   if (it == null || ir.size() == 1) return it;
   final Item n = ir.next();
   if (n != null) {
     final ValueBuilder vb = new ValueBuilder().add(it).add(n);
     if (ir.next() != null) vb.add(Str.get(DOTS));
     throw SEQFOUND_X.get(info, vb.value());
   }
   return it;
 }
예제 #2
0
  @Override
  public Iter iter(final QueryContext qc) throws QueryException {
    final Iter ir = exprs[0].iter(qc);
    final long len = ir.size();
    if (len == 0) throw ONEORMORE.get(info);
    if (len > 0) return ir;
    return new Iter() {
      private boolean first = true;

      @Override
      public Item next() throws QueryException {
        final Item it = ir.next();
        if (first) {
          if (it == null) throw ONEORMORE.get(info);
          first = false;
        }
        return it;
      }
    };
  }