private boolean isKeyword(String s) { if (!identifiersToUpper) { // if not yet converted to uppercase, do it now s = StringUtils.toUpperEnglish(s); } return ParserUtil.isKeyword(s); }
private void appendKeyCondition(StatementBuilder buff) { buff.append(" WHERE "); buff.resetCount(); for (String k : key) { buff.appendExceptFirst(" AND "); buff.append(StringUtils.quoteIdentifier(k)).append("=?"); } }
private ArrayList<DefineCommand> getConstraintCommands() { if (constraintCommands == null) { constraintCommands = New.arrayList(); } return constraintCommands; }
CacheTQ(CacheWriter writer, int maxMemoryKb) { this.maxMemory = maxMemoryKb; lru = new CacheLRU(writer, (int) (maxMemoryKb * 0.8), false); fifo = new CacheLRU(writer, (int) (maxMemoryKb * 0.2), true); setMaxMemory(4 * maxMemoryKb); }
private static String generateSessionId() { byte[] buff = MathUtils.secureRandomBytes(16); return StringUtils.convertBytesToHex(buff); }
@Override public void setMaxMemory(int maxMemoryKb) { this.maxMemory = maxMemoryKb; lru.setMaxMemory((int) (maxMemoryKb * 0.8)); fifo.setMaxMemory((int) (maxMemoryKb * 0.2)); recentlyUsed.setMaxSize(4 * maxMemoryKb); }
private static byte[] getPaddedArrayCopy(byte[] data, int blockSize) { int size = MathUtils.roundUpInt(data.length, blockSize); return Utils.copyBytes(data, size); }
/** * Gets the year. * * <p>The year is in the specified time zone and not UTC. So for * {@code 2015-12-31 19:00:00.00-10:00} the value returned * will be {@code 2015} even though in UTC the year is {@code 2016}.</p> * * @return the year */ public int getYear() { return DateTimeUtils.yearFromDateValue(dateValue); }
/** * Create a new permutations object. * * @param <T> the type * @param in the source array * @param out the target array * @return the generated permutations object */ public static <T> Permutations<T> create(T[] in, T[] out) { return new Permutations<>(in, out, in.length); }
/** * Format an int array to the Java source code that represents this object. * * @param s the int array to convert * @return the Java source code */ protected static String quoteIntArray(int[] s) { return StringUtils.quoteJavaIntArray(s); }
/** * Indents a string with 4 spaces. * * @param s the string * @return the indented string */ public static String indent(String s) { return indent(s, 4, true); }
@Override public CacheObject find(int pos) { CacheObject rec = values[pos & mask]; while (rec != null && rec.getPos() != pos) { rec = rec.cacheChained; } return rec; }
/** * Write an integer at the current position. * The current position is incremented. * * @param x the value */ public void writeInt(int x) { Bits.writeInt(data, pos, x); pos += 4; }
/** * Read a long value. This method reads two int values and combines them. * * @return the long value */ public long readLong() { long x = Bits.readLong(data, pos); pos += 8; return x; }
private void expand(int plus) { // must copy everything, because pos could be 0 and data may be // still required data = Utils.copyBytes(data, (data.length + plus) * 2); }