/** * 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; }
@Override public Item item(final QueryContext qc, final InputInfo ii) throws QueryException { final String form = string(toToken(exprs[0], qc)); final int es = exprs.length; final Object[] args = new Object[es - 1]; for (int e = 1; e < es; e++) { final Item it = exprs[e].item(qc, info); args[e - 1] = it == null ? null : it.type.isUntyped() ? string(it.string(info)) : it.toJava(); } try { return Str.get(String.format(form, args)); } catch (final RuntimeException ex) { throw ERRFORMAT_X_X.get(info, Util.className(ex), ex); } }