Exemplo n.º 1
0
 /**
  * Returns the color for the specified string or {@code null}.
  *
  * @param string string string
  * @return color
  */
 static String color(final byte[] string) {
   for (final Object[] color : COLORS) {
     final int cl = color.length;
     for (int c = 1; c < cl; c++) {
       final Object o = color[c];
       final byte[] col =
           o instanceof byte[]
               ? (byte[]) o
               : Token.token(o instanceof Class ? Util.className((Class<?>) o) : o.toString());
       if (Token.eq(col, string)) return color[0].toString();
     }
   }
   return null;
 }
Exemplo n.º 2
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);
 }