Esempio n. 1
0
 @Override
 public final int diff(final Item it, final Collation coll, final InputInfo ii)
     throws QueryException {
   return it.type.isUntyped()
       ? coll == null ? Token.diff(string(), it.string(ii)) : coll.compare(string(), it.string(ii))
       : -it.diff(this, coll, ii);
 }
Esempio n. 2
0
 @Override
 public final boolean eq(
     final Item it, final Collation coll, final StaticContext sc, final InputInfo ii)
     throws QueryException {
   return it.type.isUntyped()
       ? coll == null
           ? Token.eq(string(), it.string(ii))
           : coll.compare(string(), it.string(ii)) == 0
       : it.eq(this, coll, sc, ii);
 }
Esempio n. 3
0
 @Override
 public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
   final byte[] s;
   if (exprs.length == 0) {
     final Item it = ctxValue(qc).item(qc, info);
     if (it instanceof FItem) throw FISTRING_X.get(ii, it.type);
     s = it == null ? Token.EMPTY : it.string(ii);
   } else {
     s = toEmptyToken(arg(0, qc), qc);
   }
   return Int.get(Token.length(s));
 }
Esempio n. 4
0
 @Override
 Expr opt(final QueryContext ctx, final VarScope scp) throws QueryException {
   if (sig == Function._UNIT_TEST_URIS || sig == Function._UNIT_TEST && expr.length == 0) {
     for (final StaticFunc fn : ctx.funcs.funcs()) {
       if (fn.compiled()) continue;
       final Ann ann = fn.ann;
       for (int i = ann.size(); --i >= 0; ) {
         if (Token.eq(ann.names[i].uri(), QueryText.UNITURI)) {
           fn.compile(ctx);
           break;
         }
       }
     }
   }
   return super.opt(ctx, scp);
 }
Esempio n. 5
0
 @Override
 public final int diff(final Item it, final Collation coll, final InputInfo ii)
     throws QueryException {
   return Token.diff(
       binary(ii), it instanceof Bin ? ((Bin) it).binary(ii) : decode(it.string(ii), ii));
 }