_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q171200 | StringUtil.convertCharset | test | public static String convertCharset(final String source, final String srcCharsetName, final String newCharsetName) {
if (srcCharsetName.equals(newCharsetName)) {
return source;
}
return StringUtil.newString(StringUtil.getBytes(source, srcCharsetName), newCharsetName);
} | java | {
"resource": ""
} |
q171201 | StringUtil.isCharAtEqual | test | public static boolean isCharAtEqual(final String string, final int index, final char charToCompare) {
if ((index < 0) || (index >= string.length())) {
return false;
}
return string.charAt(index) == charToCompare;
} | java | {
"resource": ""
} |
q171202 | StringUtil.surround | test | public static String surround(String string, final String prefix, final String suffix) {
if (!string.startsWith(prefix)) {
string = prefix + string;
}
if (!string.endsWith(suffix)) {
string += suffix;
}
return string;
} | java | {
"resource": ""
} |
q171203 | StringUtil.prefix | test | public static String prefix(String string, final String prefix) {
if (!string.startsWith(prefix)) {
string = prefix + string;
}
return string;
} | java | {
"resource": ""
} |
q171204 | StringUtil.suffix | test | public static String suffix(String string, final String suffix) {
if (!string.endsWith(suffix)) {
string += suffix;
}
return string;
} | java | {
"resource": ""
} |
q171205 | StringUtil.cutToIndexOf | test | public static String cutToIndexOf(String string, final String substring) {
int i = string.indexOf(substring);
if (i != -1) {
string = string.substring(0, i);
}
return string;
} | java | {
"resource": ""
} |
q171206 | StringUtil.cutFromIndexOf | test | public static String cutFromIndexOf(String string, final String substring) {
int i = string.indexOf(substring);
if (i != -1) {
string = string.substring(i);
}
return string;
} | java | {
"resource": ""
} |
q171207 | StringUtil.cutPrefix | test | public static String cutPrefix(String string, final String prefix) {
if (string.startsWith(prefix)) {
string = string.substring(prefix.length());
}
return string;
} | java | {
"resource": ""
} |
q171208 | StringUtil.cutSuffix | test | public static String cutSuffix(String string, final String suffix) {
if (string.endsWith(suffix)) {
string = string.substring(0, string.length() - suffix.length());
}
return string;
} | java | {
"resource": ""
} |
q171209 | StringUtil.cutSurrounding | test | public static String cutSurrounding(final String string, final String prefix, final String suffix) {
int start = 0;
int end = string.length();
if (string.startsWith(prefix)) {
start = prefix.length();
}
if (string.endsWith(suffix)) {
end -= suffix.length();
}
if (end <= start) {
return StringPool.EMPTY;
}
return string.substring(start, end);
} | java | {
"resource": ""
} |
q171210 | StringUtil.insert | test | public static String insert(final String src, final String insert, int offset) {
if (offset < 0) {
offset = 0;
}
if (offset > src.length()) {
offset = src.length();
}
StringBuilder sb = new StringBuilder(src);
sb.insert(offset, insert);
return sb.toString();
} | java | {
"resource": ""
} |
q171211 | StringUtil.repeat | test | public static String repeat(final String source, int count) {
StringBand result = new StringBand(count);
while (count > 0) {
result.append(source);
count--;
}
return result.toString();
} | java | {
"resource": ""
} |
q171212 | StringUtil.reverse | test | public static String reverse(final String s) {
StringBuilder result = new StringBuilder(s.length());
for (int i = s.length() -1; i >= 0; i--) {
result.append(s.charAt(i));
}
return result.toString();
} | java | {
"resource": ""
} |
q171213 | StringUtil.maxCommonPrefix | test | public static String maxCommonPrefix(final String one, final String two) {
final int minLength = Math.min(one.length(), two.length());
final StringBuilder sb = new StringBuilder(minLength);
for (int pos = 0; pos < minLength; pos++) {
final char currentChar = one.charAt(pos);
if (currentChar != two.charAt(pos)) {
break;
}
sb.append(currentChar);
}
return sb.toString();
} | java | {
"resource": ""
} |
q171214 | StringUtil.findCommonPrefix | test | public static String findCommonPrefix(final String... strings) {
StringBuilder prefix = new StringBuilder();
int index = 0;
char c = 0;
loop:
while (true) {
for (int i = 0; i < strings.length; i++) {
String s = strings[i];
if (index == s.length()) {
break loop;
}
if (i == 0) {
c = s.charAt(index);
} else {
if (s.charAt(index) != c) {
break loop;
}
}
}
index++;
prefix.append(c);
}
return prefix.length() == 0 ? StringPool.EMPTY : prefix.toString();
} | java | {
"resource": ""
} |
q171215 | StringUtil.shorten | test | public static String shorten(String s, int length, final String suffix) {
length -= suffix.length();
if (s.length() > length) {
for (int j = length; j >= 0; j--) {
if (CharUtil.isWhitespace(s.charAt(j))) {
length = j;
break;
}
}
String temp = s.substring(0, length);
s = temp.concat(suffix);
}
return s;
} | java | {
"resource": ""
} |
q171216 | StringUtil.toUpperCase | test | public static String toUpperCase(final String s, Locale locale) {
if (s == null) {
return null;
}
StringBuilder sb = null;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c > 127) {
// found non-ascii char, fallback to the slow unicode detection
if (locale == null) {
locale = Locale.getDefault();
}
return s.toUpperCase(locale);
}
if ((c >= 'a') && (c <= 'z')) {
if (sb == null) {
sb = new StringBuilder(s);
}
sb.setCharAt(i, (char)(c - 32));
}
}
if (sb == null) {
return s;
}
return sb.toString();
} | java | {
"resource": ""
} |
q171217 | StringUtil.removeQuotes | test | public static String removeQuotes(final String string) {
if (
(startsWithChar(string, '\'') && endsWithChar(string, '\'')) ||
(startsWithChar(string, '"') && endsWithChar(string, '"')) ||
(startsWithChar(string, '`') && endsWithChar(string, '`'))
) {
return substring(string, 1, -1);
}
return string;
} | java | {
"resource": ""
} |
q171218 | StringUtil.toHexString | test | public static String toHexString(final byte[] bytes) {
char[] chars = new char[bytes.length * 2];
int i = 0;
for (byte b : bytes) {
chars[i++] = CharUtil.int2hex((b & 0xF0) >> 4);
chars[i++] = CharUtil.int2hex(b & 0x0F);
}
return new String(chars);
} | java | {
"resource": ""
} |
q171219 | StringUtil.getBytes | test | public static byte[] getBytes(final String string) {
try {
return string.getBytes(JoddCore.encoding);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} | java | {
"resource": ""
} |
q171220 | StringUtil.detectQuoteChar | test | public static char detectQuoteChar(final String str) {
if (str.length() < 2) {
return 0;
}
final char c = str.charAt(0);
if (c != str.charAt(str.length() - 1)) {
return 0;
}
if (c == '\'' || c == '"' || c == '`') {
return c;
}
return 0;
} | java | {
"resource": ""
} |
q171221 | AnnotationVisitor.visit | test | public void visit(final String name, final Object value) {
if (av != null) {
av.visit(name, value);
}
} | java | {
"resource": ""
} |
q171222 | AnnotationVisitor.visitEnum | test | public void visitEnum(final String name, final String descriptor, final String value) {
if (av != null) {
av.visitEnum(name, descriptor, value);
}
} | java | {
"resource": ""
} |
q171223 | AnnotationVisitor.visitAnnotation | test | public AnnotationVisitor visitAnnotation(final String name, final String descriptor) {
if (av != null) {
return av.visitAnnotation(name, descriptor);
}
return null;
} | java | {
"resource": ""
} |
q171224 | DbEntityManager.registerType | test | public <E> DbEntityDescriptor<E> registerType(final Class<E> type) {
DbEntityDescriptor<E> ded = createDbEntityDescriptor(type);
DbEntityDescriptor<E> existing = descriptorsMap.put(type, ded);
if (log.isDebugEnabled()) {
log.debug("Register " + type.getName() + " as " + ded.getTableName());
}
if (existing != null) {
if (ded.getType() == type) {
return ded;
}
throw new DbOomException("Type already registered: " + existing.getType());
}
existing = entityNamesMap.put(ded.getEntityName(), ded);
if (existing != null) {
throw new DbOomException("Name '" + ded.getEntityName() + "' already mapped to an entity: " + existing.getType());
}
return ded;
} | java | {
"resource": ""
} |
q171225 | DbEntityManager.registerEntity | test | public <E> DbEntityDescriptor<E> registerEntity(final Class<E> type, final boolean force) {
if (force) {
removeEntity(type);
}
return registerEntity(type);
} | java | {
"resource": ""
} |
q171226 | DbEntityManager.removeEntity | test | public <E> DbEntityDescriptor<E> removeEntity(final Class<E> type) {
DbEntityDescriptor<E> ded = descriptorsMap.remove(type);
if (ded == null) {
ded = createDbEntityDescriptor(type);
}
entityNamesMap.remove(ded.getEntityName());
tableNamesMap.remove(ded.getTableName());
return ded;
} | java | {
"resource": ""
} |
q171227 | DbEntityManager.createEntityInstance | test | public <E> E createEntityInstance(final Class<E> type) {
try {
return ClassUtil.newInstance(type);
} catch (Exception ex) {
throw new DbOomException(ex);
}
} | java | {
"resource": ""
} |
q171228 | WrapperProxettaFactory.setTargetInterface | test | public WrapperProxettaFactory setTargetInterface(final Class targetInterface) {
if (!targetInterface.isInterface()) {
throw new ProxettaException("Not an interface: " + targetInterface.getName());
}
this.targetInterface = targetInterface;
return this;
} | java | {
"resource": ""
} |
q171229 | WrapperProxettaFactory.injectTargetIntoWrapper | test | public void injectTargetIntoWrapper(final Object target, final Object wrapper) {
ProxettaUtil.injectTargetIntoWrapper(target, wrapper, targetFieldName);
} | java | {
"resource": ""
} |
q171230 | AnnotatedPropertyInterceptor.lookupAnnotatedProperties | test | protected PropertyDescriptor[] lookupAnnotatedProperties(final Class type) {
PropertyDescriptor[] properties = annotatedProperties.get(type);
if (properties != null) {
return properties;
}
ClassDescriptor cd = ClassIntrospector.get().lookup(type);
PropertyDescriptor[] allProperties = cd.getAllPropertyDescriptors();
List<PropertyDescriptor> list = new ArrayList<>();
for (PropertyDescriptor propertyDescriptor : allProperties) {
Annotation ann = null;
if (propertyDescriptor.getFieldDescriptor() != null) {
ann = propertyDescriptor.getFieldDescriptor().getField().getAnnotation(annotations);
}
if (ann == null && propertyDescriptor.getWriteMethodDescriptor() != null) {
ann = propertyDescriptor.getWriteMethodDescriptor().getMethod().getAnnotation(annotations);
}
if (ann == null && propertyDescriptor.getReadMethodDescriptor() != null) {
ann = propertyDescriptor.getReadMethodDescriptor().getMethod().getAnnotation(annotations);
}
if (ann != null) {
list.add(propertyDescriptor);
}
}
if (list.isEmpty()) {
properties = EMPTY;
} else {
properties = list.toArray(new PropertyDescriptor[0]);
}
annotatedProperties.put(type, properties);
return properties;
} | java | {
"resource": ""
} |
q171231 | DbDetector.detectDatabaseAndConfigureDbOom | test | public DbServer detectDatabaseAndConfigureDbOom(
final ConnectionProvider cp,
final DbOomConfig dbOomConfig) {
cp.init();
final Connection connection = cp.getConnection();
final DbServer dbServer = detectDatabase(connection);
cp.closeConnection(connection);
dbServer.accept(dbOomConfig);
return dbServer;
} | java | {
"resource": ""
} |
q171232 | GzipResponseStream.close | test | @Override
public void close() throws IOException {
if (closed) {
return;
}
if (gzipstream != null) {
flushToGZip();
gzipstream.close();
gzipstream = null;
} else {
if (bufferCount > 0) {
output.write(buffer, 0, bufferCount);
bufferCount = 0;
}
}
output.close();
closed = true;
} | java | {
"resource": ""
} |
q171233 | GzipResponseStream.write | test | @Override
public void write(final int b) throws IOException {
if (closed) {
throw new IOException("Cannot write to a closed output stream");
}
if (bufferCount >= buffer.length) {
flushToGZip();
}
buffer[bufferCount++] = (byte) b;
} | java | {
"resource": ""
} |
q171234 | RemoveSessionFromUrlFilter.doFilter | test | @Override
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
if (isRequestedSessionIdFromURL(httpRequest)) {
HttpSession session = httpRequest.getSession(false);
if (session != null) {
session.invalidate(); // clear session if session id in URL
}
}
// wrap response to remove URL encoding
HttpServletResponseWrapper wrappedResponse = new HttpServletResponseWrapper(httpResponse) {
@Override
public String encodeRedirectUrl(final String url) {
return url;
}
@Override
public String encodeRedirectURL(final String url) {
return url;
}
@Override
public String encodeUrl(final String url) {
return url;
}
@Override
public String encodeURL(final String url) {
return url;
}
};
chain.doFilter(request, wrappedResponse);
} | java | {
"resource": ""
} |
q171235 | EmailAttachment.getEncodedName | test | public String getEncodedName() {
if (name == null) {
return null;
}
try {
return MimeUtility.encodeText(name);
} catch (final UnsupportedEncodingException ueex) {
throw new MailException(ueex);
}
} | java | {
"resource": ""
} |
q171236 | EmailAttachment.toByteArray | test | public byte[] toByteArray() {
final FastByteArrayOutputStream out;
if (size != -1) {
out = new FastByteArrayOutputStream(size);
} else {
out = new FastByteArrayOutputStream();
}
writeToStream(out);
return out.toByteArray();
} | java | {
"resource": ""
} |
q171237 | EmailAttachment.writeToFile | test | public void writeToFile(final File destination) {
InputStream input = null;
final OutputStream output;
try {
input = getDataSource().getInputStream();
output = new FileOutputStream(destination);
StreamUtil.copy(input, output);
}
catch (final IOException ioex) {
throw new MailException(ioex);
}
finally {
StreamUtil.close(input);
}
} | java | {
"resource": ""
} |
q171238 | EmailAttachment.writeToStream | test | public void writeToStream(final OutputStream out) {
InputStream input = null;
try {
input = getDataSource().getInputStream();
StreamUtil.copy(input, out);
}
catch (final IOException ioex) {
throw new MailException(ioex);
}
finally {
StreamUtil.close(input);
}
} | java | {
"resource": ""
} |
q171239 | InvokeReplacerMethodAdapter.appendArgument | test | protected static String appendArgument(final String desc, final String type) {
int ndx = desc.indexOf(')');
return desc.substring(0, ndx) + type + desc.substring(ndx);
} | java | {
"resource": ""
} |
q171240 | InvokeReplacerMethodAdapter.prependArgument | test | protected static String prependArgument(final String desc, final String type) {
int ndx = desc.indexOf('(');
ndx++;
return desc.substring(0, ndx) + type + desc.substring(ndx);
} | java | {
"resource": ""
} |
q171241 | InvokeReplacerMethodAdapter.changeReturnType | test | protected static String changeReturnType(final String desc, final String type) {
int ndx = desc.indexOf(')');
return desc.substring(0, ndx + 1) + type;
} | java | {
"resource": ""
} |
q171242 | StripHtmlTagAdapter.text | test | @Override
public void text(final CharSequence text) {
if (!strip) {
super.text(text);
return;
}
int textLength = text.length();
char[] dest = new char[textLength];
int ndx = 0;
boolean regularChar = true;
for (int i = 0; i < textLength; i++) {
char c = text.charAt(i);
if (CharUtil.isWhitespace(c)) {
if (regularChar) {
regularChar = false;
c = ' ';
} else {
continue;
}
} else {
regularChar = true;
}
dest[ndx] = c;
ndx++;
}
if (regularChar || (ndx != 1)) {
super.text(CharBuffer.wrap(dest, 0, ndx));
strippedCharsCount += textLength - ndx;
} else {
strippedCharsCount += textLength;
}
} | java | {
"resource": ""
} |
q171243 | TypeConverterManager.register | test | public <T> void register(final Class<T> type, final TypeConverter<T> typeConverter) {
converters.put(type, typeConverter);
} | java | {
"resource": ""
} |
q171244 | TypeConverterManager.lookup | test | public <T> TypeConverter<T> lookup(final Class<T> type) {
return converters.get(type);
} | java | {
"resource": ""
} |
q171245 | NodeSelector.select | test | public List<Node> select(final String query) {
Collection<List<CssSelector>> selectorsCollection = CSSelly.parse(query);
return select(selectorsCollection);
} | java | {
"resource": ""
} |
q171246 | NodeSelector.select | test | public List<Node> select(final Collection<List<CssSelector>> selectorsCollection) {
List<Node> results = new ArrayList<>();
for (List<CssSelector> selectors : selectorsCollection) {
processSelectors(results, selectors);
}
return results;
} | java | {
"resource": ""
} |
q171247 | NodeSelector.processSelectors | test | protected void processSelectors(final List<Node> results, final List<CssSelector> selectors) {
List<Node> selectedNodes = select(rootNode, selectors);
for (Node selectedNode : selectedNodes) {
if (!results.contains(selectedNode)) {
results.add(selectedNode);
}
}
} | java | {
"resource": ""
} |
q171248 | NodeSelector.selectFirst | test | public Node selectFirst(final String query) {
List<Node> selectedNodes = select(query);
if (selectedNodes.isEmpty()) {
return null;
}
return selectedNodes.get(0);
} | java | {
"resource": ""
} |
q171249 | NodeSelector.walkDescendantsIteratively | test | protected void walkDescendantsIteratively(final LinkedList<Node> nodes, final CssSelector cssSelector, final List<Node> result) {
while (!nodes.isEmpty()) {
Node node = nodes.removeFirst();
selectAndAdd(node, cssSelector, result);
// append children in walking order to be processed right after this node
int childCount = node.getChildNodesCount();
for (int i = childCount - 1; i >= 0; i--) {
nodes.addFirst(node.getChild(i));
}
}
} | java | {
"resource": ""
} |
q171250 | NodeSelector.walk | test | protected void walk(final Node rootNode, final CssSelector cssSelector, final List<Node> result) {
// previous combinator determines the behavior
CssSelector previousCssSelector = cssSelector.getPrevCssSelector();
Combinator combinator = previousCssSelector != null ?
previousCssSelector.getCombinator() :
Combinator.DESCENDANT;
switch (combinator) {
case DESCENDANT:
LinkedList<Node> nodes = new LinkedList<>();
int childCount = rootNode.getChildNodesCount();
for (int i = 0; i < childCount; i++) {
nodes.add(rootNode.getChild(i));
// recursive
// selectAndAdd(node, cssSelector, result);
// walk(node, cssSelector, result);
}
walkDescendantsIteratively(nodes, cssSelector, result);
break;
case CHILD:
childCount = rootNode.getChildNodesCount();
for (int i = 0; i < childCount; i++) {
Node node = rootNode.getChild(i);
selectAndAdd(node, cssSelector, result);
}
break;
case ADJACENT_SIBLING:
Node node = rootNode.getNextSiblingElement();
if (node != null) {
selectAndAdd(node, cssSelector, result);
}
break;
case GENERAL_SIBLING:
node = rootNode;
while (true) {
node = node.getNextSiblingElement();
if (node == null) {
break;
}
selectAndAdd(node, cssSelector, result);
}
break;
} } | java | {
"resource": ""
} |
q171251 | NodeSelector.selectAndAdd | test | protected void selectAndAdd(final Node node, final CssSelector cssSelector, final List<Node> result) {
// ignore all nodes that are not elements
if (node.getNodeType() != Node.NodeType.ELEMENT) {
return;
}
boolean matched = cssSelector.accept(node);
if (matched) {
// check for duplicates
if (result.contains(node)) {
return;
}
// no duplicate found, add it to the results
result.add(node);
}
} | java | {
"resource": ""
} |
q171252 | NodeSelector.filter | test | protected boolean filter(final List<Node> currentResults, final Node node, final CssSelector cssSelector, final int index) {
return cssSelector.accept(currentResults, node, index);
} | java | {
"resource": ""
} |
q171253 | CSSellyLexer.zzUnpackCMap | test | private static char [] zzUnpackCMap(final String packed) {
char [] map = new char[0x110000];
int i = 0; /* index in packed string */
int j = 0; /* index in unpacked array */
while (i < 128) {
int count = packed.charAt(i++);
char value = packed.charAt(i++);
do map[j++] = value; while (--count > 0);
}
return map;
} | java | {
"resource": ""
} |
q171254 | CSSellyLexer.zzRefill | test | private boolean zzRefill() {
if (zzBuffer == null) {
zzBuffer = zzChars;
zzEndRead += zzChars.length;
return false;
}
return true;
} | java | {
"resource": ""
} |
q171255 | DbPager.page | test | protected <T> PageData<T> page(String sql, final Map params, final int page, final int pageSize, final String sortColumnName, final boolean ascending, final Class[] target) {
if (sortColumnName != null) {
sql = buildOrderSql(sql, sortColumnName, ascending);
}
int from = (page - 1) * pageSize;
String pageSql = buildPageSql(sql, from, pageSize);
DbSqlBuilder dbsql = sql(pageSql);
DbOomQuery query = query(dbsql);
query.setMaxRows(pageSize);
query.setFetchSize(pageSize);
query.setMap(params);
List<T> list = query.list(pageSize, target);
query.close();
String countSql = buildCountSql(sql);
dbsql = sql(countSql);
query = query(dbsql);
query.setMap(params);
long count = query.executeCount();
query.close();
return new PageData<>(page, (int) count, pageSize, list);
} | java | {
"resource": ""
} |
q171256 | DbPager.removeSelect | test | protected String removeSelect(String sql) {
int ndx = StringUtil.indexOfIgnoreCase(sql, "select");
if (ndx != -1) {
sql = sql.substring(ndx + 6); // select.length()
}
return sql;
} | java | {
"resource": ""
} |
q171257 | DbPager.removeToFrom | test | protected String removeToFrom(String sql) {
int from = 0;
int fromCount = 1;
int selectCount = 0;
int lastNdx = 0;
while (true) {
int ndx = StringUtil.indexOfIgnoreCase(sql, "from", from);
if (ndx == -1) {
break;
}
// count selects in left part
String left = sql.substring(lastNdx, ndx);
selectCount += StringUtil.countIgnoreCase(left, "select");
if (fromCount >= selectCount) {
sql = sql.substring(ndx);
break;
}
// find next 'from'
lastNdx = ndx;
from = ndx + 4;
fromCount++;
}
return sql;
} | java | {
"resource": ""
} |
q171258 | DbPager.removeLastOrderBy | test | protected String removeLastOrderBy(String sql) {
int ndx = StringUtil.lastIndexOfIgnoreCase(sql, "order by");
if (ndx != -1) {
int ndx2 = sql.lastIndexOf(sql, ')');
if (ndx > ndx2) {
sql = sql.substring(0, ndx);
}
}
return sql;
} | java | {
"resource": ""
} |
q171259 | HtmlDecoder.decode | test | public static String decode(final String html) {
int ndx = html.indexOf('&');
if (ndx == -1) {
return html;
}
StringBuilder result = new StringBuilder(html.length());
int lastIndex = 0;
int len = html.length();
mainloop:
while (ndx != -1) {
result.append(html.substring(lastIndex, ndx));
lastIndex = ndx;
while (html.charAt(lastIndex) != ';') {
lastIndex++;
if (lastIndex == len) {
lastIndex = ndx;
break mainloop;
}
}
if (html.charAt(ndx + 1) == '#') {
// decimal/hex
char c = html.charAt(ndx + 2);
int radix;
if ((c == 'x') || (c == 'X')) {
radix = 16;
ndx += 3;
} else {
radix = 10;
ndx += 2;
}
String number = html.substring(ndx, lastIndex);
int i = Integer.parseInt(number, radix);
result.append((char) i);
lastIndex++;
} else {
// token
String encodeToken = html.substring(ndx + 1, lastIndex);
char[] replacement = ENTITY_MAP.get(encodeToken);
if (replacement == null) {
result.append('&');
lastIndex = ndx + 1;
} else {
result.append(replacement);
lastIndex++;
}
}
ndx = html.indexOf('&', lastIndex);
}
result.append(html.substring(lastIndex));
return result.toString();
} | java | {
"resource": ""
} |
q171260 | HtmlDecoder.detectName | test | public static String detectName(final char[] input, int ndx) {
final Ptr ptr = new Ptr();
int firstIndex = 0;
int lastIndex = ENTITY_NAMES.length - 1;
int len = input.length;
char[] lastName = null;
final BinarySearchBase binarySearch = new BinarySearchBase() {
@Override
protected int compare(final int index) {
char[] name = ENTITY_NAMES[index];
if (ptr.offset >= name.length) {
return -1;
}
return name[ptr.offset] - ptr.c;
}
};
while (true) {
ptr.c = input[ndx];
if (!CharUtil.isAlphaOrDigit(ptr.c)) {
return lastName != null ? new String(lastName) : null;
}
firstIndex = binarySearch.findFirst(firstIndex, lastIndex);
if (firstIndex < 0) {
return lastName != null ? new String(lastName) : null;
}
char[] element = ENTITY_NAMES[firstIndex];
if (element.length == ptr.offset + 1) {
// total match, remember position, continue for finding the longer name
lastName = ENTITY_NAMES[firstIndex];
}
lastIndex = binarySearch.findLast(firstIndex, lastIndex);
if (firstIndex == lastIndex) {
// only one element found, check the rest
for (int i = ptr.offset; i < element.length; i++) {
if (element[i] != input[ndx]) {
return lastName != null ? new String(lastName) : null;
}
ndx++;
}
return new String(element);
}
ptr.offset++;
ndx++;
if (ndx == len) {
return lastName != null ? new String(lastName) : null;
}
}
} | java | {
"resource": ""
} |
q171261 | HsqlDbPager.buildOrderSql | test | @Override
protected String buildOrderSql(String sql, final String column, final boolean ascending) {
sql += " order by " + column;
if (!ascending) {
sql += " desc";
}
return sql;
} | java | {
"resource": ""
} |
q171262 | HsqlDbPager.buildPageSql | test | @Override
protected String buildPageSql(String sql, final int from, final int pageSize) {
sql = removeSelect(sql);
return "select LIMIT " + from + ' ' + pageSize + sql;
} | java | {
"resource": ""
} |
q171263 | DbEntityDescriptor.resolveColumnsAndProperties | test | private void resolveColumnsAndProperties(final Class type) {
PropertyDescriptor[] allProperties = ClassIntrospector.get().lookup(type).getAllPropertyDescriptors();
List<DbEntityColumnDescriptor> decList = new ArrayList<>(allProperties.length);
int idcount = 0;
HashSet<String> names = new HashSet<>(allProperties.length);
for (PropertyDescriptor propertyDescriptor : allProperties) {
DbEntityColumnDescriptor dec =
DbMetaUtil.resolveColumnDescriptors(this, propertyDescriptor, isAnnotated, columnNamingStrategy);
if (dec != null) {
if (!names.add(dec.getColumnName())) {
throw new DbOomException("Duplicate column name: " + dec.getColumnName());
}
decList.add(dec);
if (dec.isId) {
idcount++;
}
}
}
if (decList.isEmpty()) {
throw new DbOomException("No column mappings in entity: " + type);
}
columnDescriptors = decList.toArray(new DbEntityColumnDescriptor[0]);
Arrays.sort(columnDescriptors);
// extract ids from sorted list
if (idcount > 0) {
idColumnDescriptors = new DbEntityColumnDescriptor[idcount];
idcount = 0;
for (DbEntityColumnDescriptor dec : columnDescriptors) {
if (dec.isId) {
idColumnDescriptors[idcount++] = dec;
}
}
}
} | java | {
"resource": ""
} |
q171264 | DbEntityDescriptor.findByColumnName | test | public DbEntityColumnDescriptor findByColumnName(final String columnName) {
if (columnName == null) {
return null;
}
init();
for (DbEntityColumnDescriptor columnDescriptor : columnDescriptors) {
if (columnDescriptor.columnName.equalsIgnoreCase(columnName)) {
return columnDescriptor;
}
}
return null;
} | java | {
"resource": ""
} |
q171265 | DbEntityDescriptor.findByPropertyName | test | public DbEntityColumnDescriptor findByPropertyName(final String propertyName) {
if (propertyName == null) {
return null;
}
init();
for (DbEntityColumnDescriptor columnDescriptor : columnDescriptors) {
if (columnDescriptor.propertyName.equals(propertyName)) {
return columnDescriptor;
}
}
return null;
} | java | {
"resource": ""
} |
q171266 | DbEntityDescriptor.getPropertyName | test | public String getPropertyName(final String columnName) {
DbEntityColumnDescriptor dec = findByColumnName(columnName);
return dec == null ? null : dec.propertyName;
} | java | {
"resource": ""
} |
q171267 | DbEntityDescriptor.getColumnName | test | public String getColumnName(final String propertyName) {
DbEntityColumnDescriptor dec = findByPropertyName(propertyName);
return dec == null ? null : dec.columnName;
} | java | {
"resource": ""
} |
q171268 | DbEntityDescriptor.getIdValue | test | public Object getIdValue(final E object) {
final String propertyName = getIdPropertyName();
return BeanUtil.declared.getProperty(object, propertyName);
} | java | {
"resource": ""
} |
q171269 | DbEntityDescriptor.setIdValue | test | public void setIdValue(final E object, final Object value) {
final String propertyName = getIdPropertyName();
BeanUtil.declared.setProperty(object, propertyName, value);
} | java | {
"resource": ""
} |
q171270 | DbEntityDescriptor.getKeyValue | test | public String getKeyValue(final E object) {
Object idValue = getIdValue(object);
String idValueString = idValue == null ? StringPool.NULL : idValue.toString();
return type.getName().concat(StringPool.COLON).concat(idValueString);
} | java | {
"resource": ""
} |
q171271 | StringBand.append | test | public StringBand append(String s) {
if (s == null) {
s = StringPool.NULL;
}
if (index >= array.length) {
expandCapacity();
}
array[index++] = s;
length += s.length();
return this;
} | java | {
"resource": ""
} |
q171272 | StringBand.setIndex | test | public void setIndex(final int newIndex) {
if (newIndex < 0) {
throw new ArrayIndexOutOfBoundsException(newIndex);
}
if (newIndex > array.length) {
String[] newArray = new String[newIndex];
System.arraycopy(array, 0, newArray, 0, index);
array = newArray;
}
if (newIndex > index) {
for (int i = index; i < newIndex; i++) {
array[i] = StringPool.EMPTY;
}
} else if (newIndex < index) {
for (int i = newIndex; i < index; i++) {
array[i] = null;
}
}
index = newIndex;
length = calculateLength();
} | java | {
"resource": ""
} |
q171273 | StringBand.expandCapacity | test | protected void expandCapacity() {
String[] newArray = new String[array.length << 1];
System.arraycopy(array, 0, newArray, 0, index);
array = newArray;
} | java | {
"resource": ""
} |
q171274 | StringBand.calculateLength | test | protected int calculateLength() {
int len = 0;
for (int i = 0; i < index; i++) {
len += array[i].length();
}
return len;
} | java | {
"resource": ""
} |
q171275 | ScopedProxyManager.createMixingMessage | test | protected String createMixingMessage(final BeanDefinition targetBeanDefinition, final BeanDefinition refBeanDefinition) {
return "Scopes mixing detected: " +
refBeanDefinition.name + "@" + refBeanDefinition.scope.getClass().getSimpleName() + " -> " +
targetBeanDefinition.name + "@" + targetBeanDefinition.scope.getClass().getSimpleName();
} | java | {
"resource": ""
} |
q171276 | ScopedProxyManager.createScopedProxyBean | test | protected Object createScopedProxyBean(final PetiteContainer petiteContainer, final BeanDefinition refBeanDefinition) {
Class beanType = refBeanDefinition.type;
Class proxyClass = proxyClasses.get(beanType);
if (proxyClass == null) {
// create proxy class only once
if (refBeanDefinition instanceof ProxettaBeanDefinition) {
// special case, double proxy!
ProxettaBeanDefinition pbd =
(ProxettaBeanDefinition) refBeanDefinition;
ProxyProxetta proxetta = Proxetta.proxyProxetta().withAspects(ArraysUtil.insert(pbd.proxyAspects, aspect, 0));
proxetta.setClassNameSuffix("$ScopedProxy");
proxetta.setVariableClassName(true);
ProxyProxettaFactory builder = proxetta.proxy().setTarget(pbd.originalTarget);
proxyClass = builder.define();
proxyClasses.put(beanType, proxyClass);
}
else {
ProxyProxetta proxetta = Proxetta.proxyProxetta().withAspect(aspect);
proxetta.setClassNameSuffix("$ScopedProxy");
proxetta.setVariableClassName(true);
ProxyProxettaFactory builder = proxetta.proxy().setTarget(beanType);
proxyClass = builder.define();
proxyClasses.put(beanType, proxyClass);
}
}
Object proxy;
try {
proxy = ClassUtil.newInstance(proxyClass);
Field field = proxyClass.getField("$__petiteContainer$0");
field.set(proxy, petiteContainer);
field = proxyClass.getField("$__name$0");
field.set(proxy, refBeanDefinition.name);
} catch (Exception ex) {
throw new PetiteException(ex);
}
return proxy;
} | java | {
"resource": ""
} |
q171277 | LoopingTagSupport.loopBody | test | protected void loopBody() throws JspException {
JspFragment body = getJspBody();
if (body == null) {
return;
}
LoopIterator loopIterator = new LoopIterator(start, end, step, modulus);
if (status != null) {
getJspContext().setAttribute(status, loopIterator);
}
while (loopIterator.next()) {
TagUtil.invokeBody(body);
}
if (status != null) {
getJspContext().removeAttribute(status);
}
} | java | {
"resource": ""
} |
q171278 | DirWatcher.init | test | protected void init() {
File[] filesArray = dir.listFiles();
filesCount = 0;
if (filesArray != null) {
filesCount = filesArray.length;
for (File file : filesArray) {
if (!acceptFile(file)) {
continue;
}
map.put(file, new MutableLong(file.lastModified()));
}
}
} | java | {
"resource": ""
} |
q171279 | DirWatcher.acceptFile | test | protected boolean acceptFile(final File file) {
if (!file.isFile()) {
return false; // ignore non-files
}
String fileName = file.getName();
if (ignoreDotFiles) {
if (fileName.startsWith(StringPool.DOT)) {
return false; // ignore hidden files
}
}
if (patterns == null) {
return true;
}
return Wildcard.matchOne(fileName, patterns) != -1;
} | java | {
"resource": ""
} |
q171280 | DirWatcher.useWatchFile | test | public DirWatcher useWatchFile(final String name) {
watchFile = new File(dir, name);
if (!watchFile.isFile() || !watchFile.exists()) {
try {
FileUtil.touch(watchFile);
} catch (IOException ioex) {
throw new DirWatcherException("Invalid watch file: " + name, ioex);
}
}
watchFileLastAccessTime = watchFile.lastModified();
return this;
} | java | {
"resource": ""
} |
q171281 | DirWatcher.start | test | public void start(final long pollingInterval) {
if (timer == null) {
if (!startBlank) {
init();
}
timer = new Timer(true);
timer.schedule(new WatchTask(), 0, pollingInterval);
}
} | java | {
"resource": ""
} |
q171282 | DirWatcher.onChange | test | protected void onChange(final DirWatcherEvent.Type type, final File file) {
listeners.accept(new DirWatcherEvent(type, file));
} | java | {
"resource": ""
} |
q171283 | CompositeEnumeration.add | test | public void add(final Enumeration<T> enumeration) {
if (allEnumerations.contains(enumeration)) {
throw new IllegalArgumentException("Duplicate enumeration");
}
allEnumerations.add(enumeration);
} | java | {
"resource": ""
} |
q171284 | FieldWriter.computeFieldInfoSize | test | int computeFieldInfoSize() {
// The access_flags, name_index, descriptor_index and attributes_count fields use 8 bytes.
int size = 8;
// For ease of reference, we use here the same attribute order as in Section 4.7 of the JVMS.
if (constantValueIndex != 0) {
// ConstantValue attributes always use 8 bytes.
symbolTable.addConstantUtf8(Constants.CONSTANT_VALUE);
size += 8;
}
// Before Java 1.5, synthetic fields are represented with a Synthetic attribute.
if ((accessFlags & Opcodes.ACC_SYNTHETIC) != 0
&& symbolTable.getMajorVersion() < Opcodes.V1_5) {
// Synthetic attributes always use 6 bytes.
symbolTable.addConstantUtf8(Constants.SYNTHETIC);
size += 6;
}
if (signatureIndex != 0) {
// Signature attributes always use 8 bytes.
symbolTable.addConstantUtf8(Constants.SIGNATURE);
size += 8;
}
// ACC_DEPRECATED is ASM specific, the ClassFile format uses a Deprecated attribute instead.
if ((accessFlags & Opcodes.ACC_DEPRECATED) != 0) {
// Deprecated attributes always use 6 bytes.
symbolTable.addConstantUtf8(Constants.DEPRECATED);
size += 6;
}
if (lastRuntimeVisibleAnnotation != null) {
size +=
lastRuntimeVisibleAnnotation.computeAnnotationsSize(
Constants.RUNTIME_VISIBLE_ANNOTATIONS);
}
if (lastRuntimeInvisibleAnnotation != null) {
size +=
lastRuntimeInvisibleAnnotation.computeAnnotationsSize(
Constants.RUNTIME_INVISIBLE_ANNOTATIONS);
}
if (lastRuntimeVisibleTypeAnnotation != null) {
size +=
lastRuntimeVisibleTypeAnnotation.computeAnnotationsSize(
Constants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS);
}
if (lastRuntimeInvisibleTypeAnnotation != null) {
size +=
lastRuntimeInvisibleTypeAnnotation.computeAnnotationsSize(
Constants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS);
}
if (firstAttribute != null) {
size += firstAttribute.computeAttributesSize(symbolTable);
}
return size;
} | java | {
"resource": ""
} |
q171285 | FieldWriter.putFieldInfo | test | void putFieldInfo(final ByteVector output) {
boolean useSyntheticAttribute = symbolTable.getMajorVersion() < Opcodes.V1_5;
// Put the access_flags, name_index and descriptor_index fields.
int mask = useSyntheticAttribute ? Opcodes.ACC_SYNTHETIC : 0;
output.putShort(accessFlags & ~mask).putShort(nameIndex).putShort(descriptorIndex);
// Compute and put the attributes_count field.
// For ease of reference, we use here the same attribute order as in Section 4.7 of the JVMS.
int attributesCount = 0;
if (constantValueIndex != 0) {
++attributesCount;
}
if ((accessFlags & Opcodes.ACC_SYNTHETIC) != 0 && useSyntheticAttribute) {
++attributesCount;
}
if (signatureIndex != 0) {
++attributesCount;
}
if ((accessFlags & Opcodes.ACC_DEPRECATED) != 0) {
++attributesCount;
}
if (lastRuntimeVisibleAnnotation != null) {
++attributesCount;
}
if (lastRuntimeInvisibleAnnotation != null) {
++attributesCount;
}
if (lastRuntimeVisibleTypeAnnotation != null) {
++attributesCount;
}
if (lastRuntimeInvisibleTypeAnnotation != null) {
++attributesCount;
}
if (firstAttribute != null) {
attributesCount += firstAttribute.getAttributeCount();
}
output.putShort(attributesCount);
// Put the field_info attributes.
// For ease of reference, we use here the same attribute order as in Section 4.7 of the JVMS.
if (constantValueIndex != 0) {
output
.putShort(symbolTable.addConstantUtf8(Constants.CONSTANT_VALUE))
.putInt(2)
.putShort(constantValueIndex);
}
if ((accessFlags & Opcodes.ACC_SYNTHETIC) != 0 && useSyntheticAttribute) {
output.putShort(symbolTable.addConstantUtf8(Constants.SYNTHETIC)).putInt(0);
}
if (signatureIndex != 0) {
output
.putShort(symbolTable.addConstantUtf8(Constants.SIGNATURE))
.putInt(2)
.putShort(signatureIndex);
}
if ((accessFlags & Opcodes.ACC_DEPRECATED) != 0) {
output.putShort(symbolTable.addConstantUtf8(Constants.DEPRECATED)).putInt(0);
}
if (lastRuntimeVisibleAnnotation != null) {
lastRuntimeVisibleAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_VISIBLE_ANNOTATIONS), output);
}
if (lastRuntimeInvisibleAnnotation != null) {
lastRuntimeInvisibleAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_INVISIBLE_ANNOTATIONS), output);
}
if (lastRuntimeVisibleTypeAnnotation != null) {
lastRuntimeVisibleTypeAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS), output);
}
if (lastRuntimeInvisibleTypeAnnotation != null) {
lastRuntimeInvisibleTypeAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS), output);
}
if (firstAttribute != null) {
firstAttribute.putAttributes(symbolTable, output);
}
} | java | {
"resource": ""
} |
q171286 | Target.ofValue | test | public static Target ofValue(final Object value, final ScopeData scopeData) {
return new Target(value, null, scopeData, null, VALUE_INSTANCE_CREATOR);
} | java | {
"resource": ""
} |
q171287 | Target.writeValue | test | public void writeValue(final InjectionPoint injectionPoint, final Object propertyValue, final boolean silent) {
writeValue(injectionPoint.targetName(), propertyValue, silent);
} | java | {
"resource": ""
} |
q171288 | DecoraParser.decorate | test | public void decorate(final Writer writer, final char[] pageContent, final char[] decoraContent) throws IOException {
DecoraTag[] decoraTags = parseDecorator(decoraContent);
parsePage(pageContent, decoraTags);
writeDecoratedPage(writer, decoraContent, pageContent, decoraTags);
} | java | {
"resource": ""
} |
q171289 | DecoraParser.parsePage | test | protected void parsePage(final char[] pageContent, final DecoraTag[] decoraTags) {
LagartoParser lagartoParser = new LagartoParser(pageContent);
PageRegionExtractor writer = new PageRegionExtractor(decoraTags);
lagartoParser.parse(writer);
} | java | {
"resource": ""
} |
q171290 | DecoraParser.writeDecoratedPage | test | protected void writeDecoratedPage(final Writer out, final char[] decoratorContent, final char[] pageContent, final DecoraTag[] decoraTags) throws IOException {
int ndx = 0;
for (DecoraTag decoraTag : decoraTags) {
// [1] just copy content before the Decora tag
int decoratorLen = decoraTag.getStartIndex() - ndx;
if (decoratorLen <= 0) {
continue;
}
out.write(decoratorContent, ndx, decoratorLen);
ndx = decoraTag.getEndIndex();
// [2] now write region at the place of Decora tag
int regionLen = decoraTag.getRegionLength();
if (regionLen == 0) {
if (decoraTag.hasDefaultValue()) {
out.write(decoratorContent, decoraTag.getDefaultValueStart(), decoraTag.getDefaultValueLength());
}
} else {
writeRegion(out, pageContent, decoraTag, decoraTags);
}
}
// write remaining content
out.write(decoratorContent, ndx, decoratorContent.length - ndx);
} | java | {
"resource": ""
} |
q171291 | DecoraParser.writeRegion | test | protected void writeRegion(final Writer out, final char[] pageContent, final DecoraTag decoraTag, final DecoraTag[] decoraTags) throws IOException {
int regionStart = decoraTag.getRegionStart();
int regionLen = decoraTag.getRegionLength();
int regionEnd = regionStart + regionLen;
for (DecoraTag innerDecoraTag : decoraTags) {
if (decoraTag == innerDecoraTag) {
continue;
}
if (decoraTag.isRegionUndefined()) {
continue;
}
if (innerDecoraTag.isInsideOtherTagRegion(decoraTag)) {
// write everything from region start to the inner Decora tag
out.write(pageContent, regionStart, innerDecoraTag.getRegionTagStart() - regionStart);
regionStart = innerDecoraTag.getRegionTagEnd();
}
}
// write remaining content of the region
out.write(pageContent, regionStart, regionEnd - regionStart);
} | java | {
"resource": ""
} |
q171292 | HttpTunnel.start | test | public void start() throws IOException {
serverSocket = new ServerSocket(listenPort, socketBacklog);
serverSocket.setReuseAddress(true);
executorService = Executors.newFixedThreadPool(threadPoolSize);
running = true;
while (running) {
Socket socket = serverSocket.accept();
socket.setKeepAlive(false);
executorService.execute(onSocketConnection(socket));
}
executorService.shutdown();
} | java | {
"resource": ""
} |
q171293 | ProcessRunner.run | test | public static ProcessResult run(final Process process) throws InterruptedException {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final StreamGobbler outputGobbler = new StreamGobbler(process.getInputStream(), baos, OUTPUT_PREFIX);
final StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), baos, ERROR_PREFIX);
outputGobbler.start();
errorGobbler.start();
final int result = process.waitFor();
outputGobbler.waitFor();
errorGobbler.waitFor();
return new ProcessResult(result, baos.toString());
} | java | {
"resource": ""
} |
q171294 | ImapSslServer.getStore | test | @Override
protected IMAPSSLStore getStore(final Session session) {
SimpleAuthenticator simpleAuthenticator = (SimpleAuthenticator) authenticator;
final URLName url;
if (simpleAuthenticator == null) {
url = new URLName(
PROTOCOL_IMAP,
host, port,
StringPool.EMPTY, null, null);
}
else {
final PasswordAuthentication pa = simpleAuthenticator.getPasswordAuthentication();
url = new URLName(
PROTOCOL_IMAP,
host, port,
StringPool.EMPTY,
pa.getUserName(), pa.getPassword());
}
return new IMAPSSLStore(session, url);
} | java | {
"resource": ""
} |
q171295 | GzipResponseWrapper.createOutputStream | test | public ServletOutputStream createOutputStream() throws IOException {
GzipResponseStream gzstream = new GzipResponseStream(origResponse);
gzstream.setBuffer(threshold);
return gzstream;
} | java | {
"resource": ""
} |
q171296 | ColumnsSelectChunk.init | test | @Override
public void init(final TemplateData templateData) {
super.init(templateData);
if (hint != null) {
templateData.incrementHintsCount();
}
} | java | {
"resource": ""
} |
q171297 | ColumnsSelectChunk.appendAlias | test | protected void appendAlias(final StringBuilder query, final DbEntityDescriptor ded, final DbEntityColumnDescriptor dec) {
final ColumnAliasType columnAliasType = templateData.getColumnAliasType();
if (columnAliasType == null || columnAliasType == ColumnAliasType.TABLE_REFERENCE) {
final String tableName = ded.getTableName();
final String columnName = dec.getColumnNameForQuery();
templateData.registerColumnDataForTableRef(tableRef, tableName);
query.append(tableRef).append(columnAliasSeparator).append(columnName);
} else
if (columnAliasType == ColumnAliasType.COLUMN_CODE) {
final String tableName = ded.getTableName();
final String columnName = dec.getColumnName();
final String code = templateData.registerColumnDataForColumnCode(tableName, columnName);
query.append(code);
} else
if (columnAliasType == ColumnAliasType.TABLE_NAME) {
final String tableName = ded.getTableNameForQuery();
final String columnName = dec.getColumnNameForQuery();
query.append(tableName).append(columnAliasSeparator).append(columnName);
}
} | java | {
"resource": ""
} |
q171298 | ColumnsSelectChunk.appendColumnName | test | protected void appendColumnName(final StringBuilder query, final DbEntityDescriptor ded, final DbEntityColumnDescriptor dec) {
query.append(resolveTable(tableRef, ded)).append('.').append(dec.getColumnName());
if (templateData.getColumnAliasType() != null) { // create column aliases
query.append(AS);
switch (templateData.getColumnAliasType()) {
case TABLE_NAME: {
final String tableName = ded.getTableNameForQuery();
query.append(tableName).append(columnAliasSeparator).append(dec.getColumnNameForQuery());
break;
}
case TABLE_REFERENCE: {
final String tableName = ded.getTableName();
templateData.registerColumnDataForTableRef(tableRef, tableName);
query.append(tableRef).append(columnAliasSeparator).append(dec.getColumnNameForQuery());
break;
}
case COLUMN_CODE: {
final String tableName = ded.getTableName();
final String code = templateData.registerColumnDataForColumnCode(tableName, dec.getColumnName());
query.append(code);
break;
}
}
}
} | java | {
"resource": ""
} |
q171299 | InExRules.addRule | test | protected void addRule(final D ruleDefinition, final boolean include) {
if (rules == null) {
rules = new ArrayList<>();
}
if (include) {
includesCount++;
} else {
excludesCount++;
}
Rule<R> newRule = new Rule<>(makeRule(ruleDefinition), include);
if (rules.contains(newRule)) {
return;
}
rules.add(newRule);
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.