repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
jbundle/jbundle
base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HScreenField.java
HScreenField.printHtmlControlDesc
public void printHtmlControlDesc(PrintWriter out, String strFieldDesc, int iHtmlAttributes) { """ display this field's description in html format. @param out The html out stream. @param strFieldDesc The field description. @param iHtmlAttribures The attributes. """ if ((iHtmlAttributes & HtmlConstants.HTML_ADD_DESC_COLUMN) != 0) out.println("<td align=\"right\">" + strFieldDesc + "</td>"); }
java
public void printHtmlControlDesc(PrintWriter out, String strFieldDesc, int iHtmlAttributes) { if ((iHtmlAttributes & HtmlConstants.HTML_ADD_DESC_COLUMN) != 0) out.println("<td align=\"right\">" + strFieldDesc + "</td>"); }
[ "public", "void", "printHtmlControlDesc", "(", "PrintWriter", "out", ",", "String", "strFieldDesc", ",", "int", "iHtmlAttributes", ")", "{", "if", "(", "(", "iHtmlAttributes", "&", "HtmlConstants", ".", "HTML_ADD_DESC_COLUMN", ")", "!=", "0", ")", "out", ".", "println", "(", "\"<td align=\\\"right\\\">\"", "+", "strFieldDesc", "+", "\"</td>\"", ")", ";", "}" ]
display this field's description in html format. @param out The html out stream. @param strFieldDesc The field description. @param iHtmlAttribures The attributes.
[ "display", "this", "field", "s", "description", "in", "html", "format", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HScreenField.java#L76-L80
meertensinstituut/mtas
src/main/java/mtas/parser/function/util/MtasFunctionParserFunction.java
MtasFunctionParserFunction.getResponse
public final MtasFunctionParserFunctionResponse getResponse(long[] args, long n) { """ Gets the response. @param args the args @param n the n @return the response """ if (dataType.equals(CodecUtil.DATA_TYPE_LONG)) { try { long l = getValueLong(args, n); return new MtasFunctionParserFunctionResponseLong(l, true); } catch (IOException e) { log.debug(e); return new MtasFunctionParserFunctionResponseLong(0, false); } } else if (dataType.equals(CodecUtil.DATA_TYPE_DOUBLE)) { try { double d = getValueDouble(args, n); return new MtasFunctionParserFunctionResponseDouble(d, true); } catch (IOException e) { log.debug(e); return new MtasFunctionParserFunctionResponseDouble(0, false); } } else { return null; } }
java
public final MtasFunctionParserFunctionResponse getResponse(long[] args, long n) { if (dataType.equals(CodecUtil.DATA_TYPE_LONG)) { try { long l = getValueLong(args, n); return new MtasFunctionParserFunctionResponseLong(l, true); } catch (IOException e) { log.debug(e); return new MtasFunctionParserFunctionResponseLong(0, false); } } else if (dataType.equals(CodecUtil.DATA_TYPE_DOUBLE)) { try { double d = getValueDouble(args, n); return new MtasFunctionParserFunctionResponseDouble(d, true); } catch (IOException e) { log.debug(e); return new MtasFunctionParserFunctionResponseDouble(0, false); } } else { return null; } }
[ "public", "final", "MtasFunctionParserFunctionResponse", "getResponse", "(", "long", "[", "]", "args", ",", "long", "n", ")", "{", "if", "(", "dataType", ".", "equals", "(", "CodecUtil", ".", "DATA_TYPE_LONG", ")", ")", "{", "try", "{", "long", "l", "=", "getValueLong", "(", "args", ",", "n", ")", ";", "return", "new", "MtasFunctionParserFunctionResponseLong", "(", "l", ",", "true", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "log", ".", "debug", "(", "e", ")", ";", "return", "new", "MtasFunctionParserFunctionResponseLong", "(", "0", ",", "false", ")", ";", "}", "}", "else", "if", "(", "dataType", ".", "equals", "(", "CodecUtil", ".", "DATA_TYPE_DOUBLE", ")", ")", "{", "try", "{", "double", "d", "=", "getValueDouble", "(", "args", ",", "n", ")", ";", "return", "new", "MtasFunctionParserFunctionResponseDouble", "(", "d", ",", "true", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "log", ".", "debug", "(", "e", ")", ";", "return", "new", "MtasFunctionParserFunctionResponseDouble", "(", "0", ",", "false", ")", ";", "}", "}", "else", "{", "return", "null", ";", "}", "}" ]
Gets the response. @param args the args @param n the n @return the response
[ "Gets", "the", "response", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/parser/function/util/MtasFunctionParserFunction.java#L57-L78
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/dispatcher/DataContextUtils.java
DataContextUtils.replaceDataReferencesInString
public static String replaceDataReferencesInString(final String input, final Map<String, Map<String, String>> data) { """ Replace the embedded properties of the form '${key.name}' in the input Strings with the value from the data context @param input input string @param data data context map @return string with values substituted, or original string """ return replaceDataReferencesInString(input, data, null, false); }
java
public static String replaceDataReferencesInString(final String input, final Map<String, Map<String, String>> data) { return replaceDataReferencesInString(input, data, null, false); }
[ "public", "static", "String", "replaceDataReferencesInString", "(", "final", "String", "input", ",", "final", "Map", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "data", ")", "{", "return", "replaceDataReferencesInString", "(", "input", ",", "data", ",", "null", ",", "false", ")", ";", "}" ]
Replace the embedded properties of the form '${key.name}' in the input Strings with the value from the data context @param input input string @param data data context map @return string with values substituted, or original string
[ "Replace", "the", "embedded", "properties", "of", "the", "form", "$", "{", "key", ".", "name", "}", "in", "the", "input", "Strings", "with", "the", "value", "from", "the", "data", "context" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/dispatcher/DataContextUtils.java#L254-L256
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java
TypeConverter.convertToShort
public static short convertToShort (@Nullable final Object aSrcValue, final short nDefault) { """ Convert the passed source value to short @param aSrcValue The source value. May be <code>null</code>. @param nDefault The default value to be returned if an error occurs during type conversion. @return The converted value. @throws RuntimeException If the converter itself throws an exception @see TypeConverterProviderBestMatch """ final Short aValue = convert (aSrcValue, Short.class, null); return aValue == null ? nDefault : aValue.shortValue (); }
java
public static short convertToShort (@Nullable final Object aSrcValue, final short nDefault) { final Short aValue = convert (aSrcValue, Short.class, null); return aValue == null ? nDefault : aValue.shortValue (); }
[ "public", "static", "short", "convertToShort", "(", "@", "Nullable", "final", "Object", "aSrcValue", ",", "final", "short", "nDefault", ")", "{", "final", "Short", "aValue", "=", "convert", "(", "aSrcValue", ",", "Short", ".", "class", ",", "null", ")", ";", "return", "aValue", "==", "null", "?", "nDefault", ":", "aValue", ".", "shortValue", "(", ")", ";", "}" ]
Convert the passed source value to short @param aSrcValue The source value. May be <code>null</code>. @param nDefault The default value to be returned if an error occurs during type conversion. @return The converted value. @throws RuntimeException If the converter itself throws an exception @see TypeConverterProviderBestMatch
[ "Convert", "the", "passed", "source", "value", "to", "short" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java#L415-L419
QSFT/Doradus
doradus-common/src/main/java/com/dell/doradus/common/Utils.java
Utils.joinURIQuery
public static String joinURIQuery(Map<String, String> uriParams) { """ Concatenate and encode the given name/value pairs into a valid URI query string. This method is the complement of {@link #parseURIQuery(String)}. @param uriParams Unencoded name/value pairs. @return URI query in the form {name 1}={value 1}{@literal &}...{@literal &}{name}={value n}. """ StringBuilder buffer = new StringBuilder(); for (String name : uriParams.keySet()) { String value = uriParams.get(name); if (buffer.length() > 0) { buffer.append("&"); } buffer.append(Utils.urlEncode(name)); if (!Utils.isEmpty(value)) { buffer.append("="); buffer.append(Utils.urlEncode(value)); } } return buffer.toString(); }
java
public static String joinURIQuery(Map<String, String> uriParams) { StringBuilder buffer = new StringBuilder(); for (String name : uriParams.keySet()) { String value = uriParams.get(name); if (buffer.length() > 0) { buffer.append("&"); } buffer.append(Utils.urlEncode(name)); if (!Utils.isEmpty(value)) { buffer.append("="); buffer.append(Utils.urlEncode(value)); } } return buffer.toString(); }
[ "public", "static", "String", "joinURIQuery", "(", "Map", "<", "String", ",", "String", ">", "uriParams", ")", "{", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "String", "name", ":", "uriParams", ".", "keySet", "(", ")", ")", "{", "String", "value", "=", "uriParams", ".", "get", "(", "name", ")", ";", "if", "(", "buffer", ".", "length", "(", ")", ">", "0", ")", "{", "buffer", ".", "append", "(", "\"&\"", ")", ";", "}", "buffer", ".", "append", "(", "Utils", ".", "urlEncode", "(", "name", ")", ")", ";", "if", "(", "!", "Utils", ".", "isEmpty", "(", "value", ")", ")", "{", "buffer", ".", "append", "(", "\"=\"", ")", ";", "buffer", ".", "append", "(", "Utils", ".", "urlEncode", "(", "value", ")", ")", ";", "}", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}" ]
Concatenate and encode the given name/value pairs into a valid URI query string. This method is the complement of {@link #parseURIQuery(String)}. @param uriParams Unencoded name/value pairs. @return URI query in the form {name 1}={value 1}{@literal &}...{@literal &}{name}={value n}.
[ "Concatenate", "and", "encode", "the", "given", "name", "/", "value", "pairs", "into", "a", "valid", "URI", "query", "string", ".", "This", "method", "is", "the", "complement", "of", "{", "@link", "#parseURIQuery", "(", "String", ")", "}", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/Utils.java#L1733-L1747
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visitSee
@Override public R visitSee(SeeTree node, P p) { """ {@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction} """ return defaultAction(node, p); }
java
@Override public R visitSee(SeeTree node, P p) { return defaultAction(node, p); }
[ "@", "Override", "public", "R", "visitSee", "(", "SeeTree", "node", ",", "P", "p", ")", "{", "return", "defaultAction", "(", "node", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction}
[ "{", "@inheritDoc", "}", "This", "implementation", "calls", "{", "@code", "defaultAction", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L333-L336
dmak/jaxb-xew-plugin
src/main/java/com/sun/tools/xjc/addon/xew/XmlElementWrapperPlugin.java
XmlElementWrapperPlugin.deleteClass
private void deleteClass(Outline outline, JDefinedClass clazz) { """ Remove the given class from it's parent class or package it is defined in. """ if (clazz.parentContainer().isClass()) { // The candidate class is an inner class. Remove the class from its parent class. JDefinedClass parentClass = (JDefinedClass) clazz.parentContainer(); writeSummary("\tRemoving class " + clazz.fullName() + " from class " + parentClass.fullName()); for (Iterator<JDefinedClass> iter = parentClass.classes(); iter.hasNext();) { if (iter.next().equals(clazz)) { iter.remove(); break; } } } else { // The candidate class is in a package. Remove the class from the package. JPackage parentPackage = (JPackage) clazz.parentContainer(); writeSummary("\tRemoving class " + clazz.fullName() + " from package " + parentPackage.name()); parentPackage.remove(clazz); // And also remove the class from model. for (Iterator<? extends ClassOutline> iter = outline.getClasses().iterator(); iter.hasNext();) { ClassOutline classOutline = iter.next(); if (classOutline.implClass == clazz) { outline.getModel().beans().remove(classOutline.target); Set<Object> packageClasses = getPrivateField(classOutline._package(), "classes"); packageClasses.remove(classOutline); iter.remove(); break; } } } }
java
private void deleteClass(Outline outline, JDefinedClass clazz) { if (clazz.parentContainer().isClass()) { // The candidate class is an inner class. Remove the class from its parent class. JDefinedClass parentClass = (JDefinedClass) clazz.parentContainer(); writeSummary("\tRemoving class " + clazz.fullName() + " from class " + parentClass.fullName()); for (Iterator<JDefinedClass> iter = parentClass.classes(); iter.hasNext();) { if (iter.next().equals(clazz)) { iter.remove(); break; } } } else { // The candidate class is in a package. Remove the class from the package. JPackage parentPackage = (JPackage) clazz.parentContainer(); writeSummary("\tRemoving class " + clazz.fullName() + " from package " + parentPackage.name()); parentPackage.remove(clazz); // And also remove the class from model. for (Iterator<? extends ClassOutline> iter = outline.getClasses().iterator(); iter.hasNext();) { ClassOutline classOutline = iter.next(); if (classOutline.implClass == clazz) { outline.getModel().beans().remove(classOutline.target); Set<Object> packageClasses = getPrivateField(classOutline._package(), "classes"); packageClasses.remove(classOutline); iter.remove(); break; } } } }
[ "private", "void", "deleteClass", "(", "Outline", "outline", ",", "JDefinedClass", "clazz", ")", "{", "if", "(", "clazz", ".", "parentContainer", "(", ")", ".", "isClass", "(", ")", ")", "{", "// The candidate class is an inner class. Remove the class from its parent class.", "JDefinedClass", "parentClass", "=", "(", "JDefinedClass", ")", "clazz", ".", "parentContainer", "(", ")", ";", "writeSummary", "(", "\"\\tRemoving class \"", "+", "clazz", ".", "fullName", "(", ")", "+", "\" from class \"", "+", "parentClass", ".", "fullName", "(", ")", ")", ";", "for", "(", "Iterator", "<", "JDefinedClass", ">", "iter", "=", "parentClass", ".", "classes", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "if", "(", "iter", ".", "next", "(", ")", ".", "equals", "(", "clazz", ")", ")", "{", "iter", ".", "remove", "(", ")", ";", "break", ";", "}", "}", "}", "else", "{", "// The candidate class is in a package. Remove the class from the package.", "JPackage", "parentPackage", "=", "(", "JPackage", ")", "clazz", ".", "parentContainer", "(", ")", ";", "writeSummary", "(", "\"\\tRemoving class \"", "+", "clazz", ".", "fullName", "(", ")", "+", "\" from package \"", "+", "parentPackage", ".", "name", "(", ")", ")", ";", "parentPackage", ".", "remove", "(", "clazz", ")", ";", "// And also remove the class from model.", "for", "(", "Iterator", "<", "?", "extends", "ClassOutline", ">", "iter", "=", "outline", ".", "getClasses", "(", ")", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "ClassOutline", "classOutline", "=", "iter", ".", "next", "(", ")", ";", "if", "(", "classOutline", ".", "implClass", "==", "clazz", ")", "{", "outline", ".", "getModel", "(", ")", ".", "beans", "(", ")", ".", "remove", "(", "classOutline", ".", "target", ")", ";", "Set", "<", "Object", ">", "packageClasses", "=", "getPrivateField", "(", "classOutline", ".", "_package", "(", ")", ",", "\"classes\"", ")", ";", "packageClasses", ".", "remove", "(", "classOutline", ")", ";", "iter", ".", "remove", "(", ")", ";", "break", ";", "}", "}", "}", "}" ]
Remove the given class from it's parent class or package it is defined in.
[ "Remove", "the", "given", "class", "from", "it", "s", "parent", "class", "or", "package", "it", "is", "defined", "in", "." ]
train
https://github.com/dmak/jaxb-xew-plugin/blob/d564d6bf8e50c46b056cdb4b46d1d4bee4adfbe3/src/main/java/com/sun/tools/xjc/addon/xew/XmlElementWrapperPlugin.java#L928-L962
rterp/GMapsFX
GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptObject.java
JavascriptObject.setProperty
protected void setProperty(String propertyName, JavascriptEnum propertyValue) { """ Sets a property on this Javascript object for which the value is a JavascriptEnum The value is set to what is returned by the getEnumValue() method on the JavascriptEnum @param propertyName The name of the property. @param propertyValue The value of the property. """ jsObject.setMember(propertyName, propertyValue.getEnumValue()); }
java
protected void setProperty(String propertyName, JavascriptEnum propertyValue) { jsObject.setMember(propertyName, propertyValue.getEnumValue()); }
[ "protected", "void", "setProperty", "(", "String", "propertyName", ",", "JavascriptEnum", "propertyValue", ")", "{", "jsObject", ".", "setMember", "(", "propertyName", ",", "propertyValue", ".", "getEnumValue", "(", ")", ")", ";", "}" ]
Sets a property on this Javascript object for which the value is a JavascriptEnum The value is set to what is returned by the getEnumValue() method on the JavascriptEnum @param propertyName The name of the property. @param propertyValue The value of the property.
[ "Sets", "a", "property", "on", "this", "Javascript", "object", "for", "which", "the", "value", "is", "a", "JavascriptEnum" ]
train
https://github.com/rterp/GMapsFX/blob/4623d3f768e8ad78fc50ee32dd204d236e01059f/GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptObject.java#L169-L171
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/SSOCookieHelperImpl.java
SSOCookieHelperImpl.createCookie
public Cookie createCookie(HttpServletRequest req, String cookieValue) { """ Creates the SSO cookie with max age of <code>-1</code>, path set to <code>/</code>, and an optional domain name. The cookie's <code>secure</code> flag depends on the <code>ssoRequiresSSL</code> configuration. @param req the HTTP servlet request. @param cookieValue the value used to create the cookie from. @return ssoCookie the SSO cookie. """ return createCookie(req, getSSOCookiename(), cookieValue, config.getSSORequiresSSL()); }
java
public Cookie createCookie(HttpServletRequest req, String cookieValue) { return createCookie(req, getSSOCookiename(), cookieValue, config.getSSORequiresSSL()); }
[ "public", "Cookie", "createCookie", "(", "HttpServletRequest", "req", ",", "String", "cookieValue", ")", "{", "return", "createCookie", "(", "req", ",", "getSSOCookiename", "(", ")", ",", "cookieValue", ",", "config", ".", "getSSORequiresSSL", "(", ")", ")", ";", "}" ]
Creates the SSO cookie with max age of <code>-1</code>, path set to <code>/</code>, and an optional domain name. The cookie's <code>secure</code> flag depends on the <code>ssoRequiresSSL</code> configuration. @param req the HTTP servlet request. @param cookieValue the value used to create the cookie from. @return ssoCookie the SSO cookie.
[ "Creates", "the", "SSO", "cookie", "with", "max", "age", "of", "<code", ">", "-", "1<", "/", "code", ">", "path", "set", "to", "<code", ">", "/", "<", "/", "code", ">", "and", "an", "optional", "domain", "name", ".", "The", "cookie", "s", "<code", ">", "secure<", "/", "code", ">", "flag", "depends", "on", "the", "<code", ">", "ssoRequiresSSL<", "/", "code", ">", "configuration", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/SSOCookieHelperImpl.java#L171-L173
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/FunctionExtensions.java
FunctionExtensions.curry
@Pure public static <P1, P2, P3, P4, RESULT> Function3<P2, P3, P4, RESULT> curry( final Function4<? super P1, ? super P2, ? super P3, ? super P4, ? extends RESULT> function, final P1 argument) { """ Curries a function that takes four arguments. @param function the original function. May not be <code>null</code>. @param argument the fixed first argument of {@code function}. @return a function that takes three arguments. Never <code>null</code>. """ if (function == null) throw new NullPointerException("function"); return new Function3<P2, P3, P4, RESULT>() { @Override public RESULT apply(P2 p2, P3 p3, P4 p4) { return function.apply(argument, p2, p3, p4); } }; }
java
@Pure public static <P1, P2, P3, P4, RESULT> Function3<P2, P3, P4, RESULT> curry( final Function4<? super P1, ? super P2, ? super P3, ? super P4, ? extends RESULT> function, final P1 argument) { if (function == null) throw new NullPointerException("function"); return new Function3<P2, P3, P4, RESULT>() { @Override public RESULT apply(P2 p2, P3 p3, P4 p4) { return function.apply(argument, p2, p3, p4); } }; }
[ "@", "Pure", "public", "static", "<", "P1", ",", "P2", ",", "P3", ",", "P4", ",", "RESULT", ">", "Function3", "<", "P2", ",", "P3", ",", "P4", ",", "RESULT", ">", "curry", "(", "final", "Function4", "<", "?", "super", "P1", ",", "?", "super", "P2", ",", "?", "super", "P3", ",", "?", "super", "P4", ",", "?", "extends", "RESULT", ">", "function", ",", "final", "P1", "argument", ")", "{", "if", "(", "function", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"function\"", ")", ";", "return", "new", "Function3", "<", "P2", ",", "P3", ",", "P4", ",", "RESULT", ">", "(", ")", "{", "@", "Override", "public", "RESULT", "apply", "(", "P2", "p2", ",", "P3", "p3", ",", "P4", "p4", ")", "{", "return", "function", ".", "apply", "(", "argument", ",", "p2", ",", "p3", ",", "p4", ")", ";", "}", "}", ";", "}" ]
Curries a function that takes four arguments. @param function the original function. May not be <code>null</code>. @param argument the fixed first argument of {@code function}. @return a function that takes three arguments. Never <code>null</code>.
[ "Curries", "a", "function", "that", "takes", "four", "arguments", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/FunctionExtensions.java#L104-L115
Stratio/stratio-cassandra
src/java/org/apache/cassandra/streaming/StreamPlan.java
StreamPlan.requestRanges
public StreamPlan requestRanges(InetAddress from, InetAddress connecting, String keyspace, Collection<Range<Token>> ranges) { """ Request data in {@code keyspace} and {@code ranges} from specific node. @param from endpoint address to fetch data from. @param connecting Actual connecting address for the endpoint @param keyspace name of keyspace @param ranges ranges to fetch @return this object for chaining """ return requestRanges(from, connecting, keyspace, ranges, new String[0]); }
java
public StreamPlan requestRanges(InetAddress from, InetAddress connecting, String keyspace, Collection<Range<Token>> ranges) { return requestRanges(from, connecting, keyspace, ranges, new String[0]); }
[ "public", "StreamPlan", "requestRanges", "(", "InetAddress", "from", ",", "InetAddress", "connecting", ",", "String", "keyspace", ",", "Collection", "<", "Range", "<", "Token", ">", ">", "ranges", ")", "{", "return", "requestRanges", "(", "from", ",", "connecting", ",", "keyspace", ",", "ranges", ",", "new", "String", "[", "0", "]", ")", ";", "}" ]
Request data in {@code keyspace} and {@code ranges} from specific node. @param from endpoint address to fetch data from. @param connecting Actual connecting address for the endpoint @param keyspace name of keyspace @param ranges ranges to fetch @return this object for chaining
[ "Request", "data", "in", "{", "@code", "keyspace", "}", "and", "{", "@code", "ranges", "}", "from", "specific", "node", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/streaming/StreamPlan.java#L71-L74
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java
SARLQuickfixProvider.removeToNextSeparator
public boolean removeToNextSeparator(Issue issue, IXtextDocument document, String separator) throws BadLocationException { """ Remove the element related to the issue, and the whitespaces after the element until the given separator. @param issue the issue. @param document the document. @param separator the separator to consider. @return <code>true</code> if the separator was found, <code>false</code> if not. @throws BadLocationException if there is a problem with the location of the element. """ // Skip spaces after the identifier until the separator int index = issue.getOffset() + issue.getLength(); char c = document.getChar(index); while (Character.isWhitespace(c)) { index++; c = document.getChar(index); } // Test if it next non-space character is the separator final boolean foundSeparator = document.getChar(index) == separator.charAt(0); if (foundSeparator) { index++; c = document.getChar(index); // Skip the previous spaces while (Character.isWhitespace(c)) { index++; c = document.getChar(index); } final int newLength = index - issue.getOffset(); document.replace(issue.getOffset(), newLength, ""); //$NON-NLS-1$ } return foundSeparator; }
java
public boolean removeToNextSeparator(Issue issue, IXtextDocument document, String separator) throws BadLocationException { // Skip spaces after the identifier until the separator int index = issue.getOffset() + issue.getLength(); char c = document.getChar(index); while (Character.isWhitespace(c)) { index++; c = document.getChar(index); } // Test if it next non-space character is the separator final boolean foundSeparator = document.getChar(index) == separator.charAt(0); if (foundSeparator) { index++; c = document.getChar(index); // Skip the previous spaces while (Character.isWhitespace(c)) { index++; c = document.getChar(index); } final int newLength = index - issue.getOffset(); document.replace(issue.getOffset(), newLength, ""); //$NON-NLS-1$ } return foundSeparator; }
[ "public", "boolean", "removeToNextSeparator", "(", "Issue", "issue", ",", "IXtextDocument", "document", ",", "String", "separator", ")", "throws", "BadLocationException", "{", "// Skip spaces after the identifier until the separator", "int", "index", "=", "issue", ".", "getOffset", "(", ")", "+", "issue", ".", "getLength", "(", ")", ";", "char", "c", "=", "document", ".", "getChar", "(", "index", ")", ";", "while", "(", "Character", ".", "isWhitespace", "(", "c", ")", ")", "{", "index", "++", ";", "c", "=", "document", ".", "getChar", "(", "index", ")", ";", "}", "// Test if it next non-space character is the separator", "final", "boolean", "foundSeparator", "=", "document", ".", "getChar", "(", "index", ")", "==", "separator", ".", "charAt", "(", "0", ")", ";", "if", "(", "foundSeparator", ")", "{", "index", "++", ";", "c", "=", "document", ".", "getChar", "(", "index", ")", ";", "// Skip the previous spaces", "while", "(", "Character", ".", "isWhitespace", "(", "c", ")", ")", "{", "index", "++", ";", "c", "=", "document", ".", "getChar", "(", "index", ")", ";", "}", "final", "int", "newLength", "=", "index", "-", "issue", ".", "getOffset", "(", ")", ";", "document", ".", "replace", "(", "issue", ".", "getOffset", "(", ")", ",", "newLength", ",", "\"\"", ")", ";", "//$NON-NLS-1$", "}", "return", "foundSeparator", ";", "}" ]
Remove the element related to the issue, and the whitespaces after the element until the given separator. @param issue the issue. @param document the document. @param separator the separator to consider. @return <code>true</code> if the separator was found, <code>false</code> if not. @throws BadLocationException if there is a problem with the location of the element.
[ "Remove", "the", "element", "related", "to", "the", "issue", "and", "the", "whitespaces", "after", "the", "element", "until", "the", "given", "separator", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L383-L409
javagl/ND
nd-iteration/src/main/java/de/javagl/nd/iteration/tuples/j/LongTupleNeighborhoodIterables.java
LongTupleNeighborhoodIterables.vonNeumannNeighborhoodIterable
public static Iterable<MutableLongTuple> vonNeumannNeighborhoodIterable( LongTuple center, final int radius) { """ Creates an iterable that provides iterators for iterating over the Von Neumann neighborhood of the given center and the given radius.<br> <br> Also see <a href="../../package-summary.html#Neighborhoods"> Neighborhoods</a> @param center The center of the Von Neumann neighborhood. A copy of this tuple will be stored internally. @param radius The radius of the Von Neumann neighborhood @return The iterable """ final LongTuple localCenter = LongTuples.copy(center); return new Iterable<MutableLongTuple>() { @Override public Iterator<MutableLongTuple> iterator() { return new VonNeumannLongTupleIterator(localCenter, radius); } }; }
java
public static Iterable<MutableLongTuple> vonNeumannNeighborhoodIterable( LongTuple center, final int radius) { final LongTuple localCenter = LongTuples.copy(center); return new Iterable<MutableLongTuple>() { @Override public Iterator<MutableLongTuple> iterator() { return new VonNeumannLongTupleIterator(localCenter, radius); } }; }
[ "public", "static", "Iterable", "<", "MutableLongTuple", ">", "vonNeumannNeighborhoodIterable", "(", "LongTuple", "center", ",", "final", "int", "radius", ")", "{", "final", "LongTuple", "localCenter", "=", "LongTuples", ".", "copy", "(", "center", ")", ";", "return", "new", "Iterable", "<", "MutableLongTuple", ">", "(", ")", "{", "@", "Override", "public", "Iterator", "<", "MutableLongTuple", ">", "iterator", "(", ")", "{", "return", "new", "VonNeumannLongTupleIterator", "(", "localCenter", ",", "radius", ")", ";", "}", "}", ";", "}" ]
Creates an iterable that provides iterators for iterating over the Von Neumann neighborhood of the given center and the given radius.<br> <br> Also see <a href="../../package-summary.html#Neighborhoods"> Neighborhoods</a> @param center The center of the Von Neumann neighborhood. A copy of this tuple will be stored internally. @param radius The radius of the Von Neumann neighborhood @return The iterable
[ "Creates", "an", "iterable", "that", "provides", "iterators", "for", "iterating", "over", "the", "Von", "Neumann", "neighborhood", "of", "the", "given", "center", "and", "the", "given", "radius", ".", "<br", ">", "<br", ">", "Also", "see", "<a", "href", "=", "..", "/", "..", "/", "package", "-", "summary", ".", "html#Neighborhoods", ">", "Neighborhoods<", "/", "a", ">" ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-iteration/src/main/java/de/javagl/nd/iteration/tuples/j/LongTupleNeighborhoodIterables.java#L133-L145
alkacon/opencms-core
src/org/opencms/cache/CmsVfsDiskCache.java
CmsVfsDiskCache.saveFile
public static File saveFile(String rfsName, byte[] content) throws IOException { """ Saves the given file content to a RFS file of the given name (full path).<p> If the required parent folders do not exists, they are also created.<p> @param rfsName the RFS name of the file to save the content in @param content the content of the file to save @return a reference to the File that was saved @throws IOException in case of disk access errors """ File f = new File(rfsName); File p = f.getParentFile(); if (!p.exists()) { // create parent folders p.mkdirs(); } // write file contents FileOutputStream fs = new FileOutputStream(f); fs.write(content); fs.close(); return f; }
java
public static File saveFile(String rfsName, byte[] content) throws IOException { File f = new File(rfsName); File p = f.getParentFile(); if (!p.exists()) { // create parent folders p.mkdirs(); } // write file contents FileOutputStream fs = new FileOutputStream(f); fs.write(content); fs.close(); return f; }
[ "public", "static", "File", "saveFile", "(", "String", "rfsName", ",", "byte", "[", "]", "content", ")", "throws", "IOException", "{", "File", "f", "=", "new", "File", "(", "rfsName", ")", ";", "File", "p", "=", "f", ".", "getParentFile", "(", ")", ";", "if", "(", "!", "p", ".", "exists", "(", ")", ")", "{", "// create parent folders", "p", ".", "mkdirs", "(", ")", ";", "}", "// write file contents", "FileOutputStream", "fs", "=", "new", "FileOutputStream", "(", "f", ")", ";", "fs", ".", "write", "(", "content", ")", ";", "fs", ".", "close", "(", ")", ";", "return", "f", ";", "}" ]
Saves the given file content to a RFS file of the given name (full path).<p> If the required parent folders do not exists, they are also created.<p> @param rfsName the RFS name of the file to save the content in @param content the content of the file to save @return a reference to the File that was saved @throws IOException in case of disk access errors
[ "Saves", "the", "given", "file", "content", "to", "a", "RFS", "file", "of", "the", "given", "name", "(", "full", "path", ")", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cache/CmsVfsDiskCache.java#L72-L85
sagiegurari/fax4j
src/main/java/org/fax4j/spi/vbs/VBSFaxClientSpi.java
VBSFaxClientSpi.invokeScript
protected ProcessOutput invokeScript(String script) { """ Invokes the VB script and returns the output. @param script The script to invoke @return The script output """ File file=null; try { //create temporary file file=File.createTempFile("fax4j_",".vbs"); } catch(IOException exception) { throw new FaxException("Unable to create temporary vbscript file.",exception); } file.deleteOnExit(); //generate command string StringBuilder buffer=new StringBuilder(); buffer.append(this.getVBSExePath()); buffer.append(" \""); buffer.append(file.getAbsolutePath()); buffer.append("\""); String command=buffer.toString(); try { //write script to file IOHelper.writeTextFile(script,file); } catch(IOException exception) { throw new FaxException("Unable to write vbscript to temporary file.",exception); } //get logger Logger logger=this.getLogger(); logger.logDebug(new Object[]{"Invoking command: ",command," script:",Logger.SYSTEM_EOL,script},null); //execute command ProcessOutput vbsOutput=ProcessExecutorHelper.executeProcess(this,command); //get exit code int exitCode=vbsOutput.getExitCode(); //delete temp file boolean fileDeleted=file.delete(); logger.logDebug(new Object[]{"Temp script file deleted: ",String.valueOf(fileDeleted)},null); if(exitCode!=0) { throw new FaxException("Error while invoking script, exit code: "+exitCode+" script output:\n"+vbsOutput.getOutputText()+"\nScript error:\n"+vbsOutput.getErrorText()); } return vbsOutput; }
java
protected ProcessOutput invokeScript(String script) { File file=null; try { //create temporary file file=File.createTempFile("fax4j_",".vbs"); } catch(IOException exception) { throw new FaxException("Unable to create temporary vbscript file.",exception); } file.deleteOnExit(); //generate command string StringBuilder buffer=new StringBuilder(); buffer.append(this.getVBSExePath()); buffer.append(" \""); buffer.append(file.getAbsolutePath()); buffer.append("\""); String command=buffer.toString(); try { //write script to file IOHelper.writeTextFile(script,file); } catch(IOException exception) { throw new FaxException("Unable to write vbscript to temporary file.",exception); } //get logger Logger logger=this.getLogger(); logger.logDebug(new Object[]{"Invoking command: ",command," script:",Logger.SYSTEM_EOL,script},null); //execute command ProcessOutput vbsOutput=ProcessExecutorHelper.executeProcess(this,command); //get exit code int exitCode=vbsOutput.getExitCode(); //delete temp file boolean fileDeleted=file.delete(); logger.logDebug(new Object[]{"Temp script file deleted: ",String.valueOf(fileDeleted)},null); if(exitCode!=0) { throw new FaxException("Error while invoking script, exit code: "+exitCode+" script output:\n"+vbsOutput.getOutputText()+"\nScript error:\n"+vbsOutput.getErrorText()); } return vbsOutput; }
[ "protected", "ProcessOutput", "invokeScript", "(", "String", "script", ")", "{", "File", "file", "=", "null", ";", "try", "{", "//create temporary file", "file", "=", "File", ".", "createTempFile", "(", "\"fax4j_\"", ",", "\".vbs\"", ")", ";", "}", "catch", "(", "IOException", "exception", ")", "{", "throw", "new", "FaxException", "(", "\"Unable to create temporary vbscript file.\"", ",", "exception", ")", ";", "}", "file", ".", "deleteOnExit", "(", ")", ";", "//generate command string", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", ")", ";", "buffer", ".", "append", "(", "this", ".", "getVBSExePath", "(", ")", ")", ";", "buffer", ".", "append", "(", "\" \\\"\"", ")", ";", "buffer", ".", "append", "(", "file", ".", "getAbsolutePath", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"\\\"\"", ")", ";", "String", "command", "=", "buffer", ".", "toString", "(", ")", ";", "try", "{", "//write script to file", "IOHelper", ".", "writeTextFile", "(", "script", ",", "file", ")", ";", "}", "catch", "(", "IOException", "exception", ")", "{", "throw", "new", "FaxException", "(", "\"Unable to write vbscript to temporary file.\"", ",", "exception", ")", ";", "}", "//get logger", "Logger", "logger", "=", "this", ".", "getLogger", "(", ")", ";", "logger", ".", "logDebug", "(", "new", "Object", "[", "]", "{", "\"Invoking command: \"", ",", "command", ",", "\" script:\"", ",", "Logger", ".", "SYSTEM_EOL", ",", "script", "}", ",", "null", ")", ";", "//execute command", "ProcessOutput", "vbsOutput", "=", "ProcessExecutorHelper", ".", "executeProcess", "(", "this", ",", "command", ")", ";", "//get exit code", "int", "exitCode", "=", "vbsOutput", ".", "getExitCode", "(", ")", ";", "//delete temp file", "boolean", "fileDeleted", "=", "file", ".", "delete", "(", ")", ";", "logger", ".", "logDebug", "(", "new", "Object", "[", "]", "{", "\"Temp script file deleted: \"", ",", "String", ".", "valueOf", "(", "fileDeleted", ")", "}", ",", "null", ")", ";", "if", "(", "exitCode", "!=", "0", ")", "{", "throw", "new", "FaxException", "(", "\"Error while invoking script, exit code: \"", "+", "exitCode", "+", "\" script output:\\n\"", "+", "vbsOutput", ".", "getOutputText", "(", ")", "+", "\"\\nScript error:\\n\"", "+", "vbsOutput", ".", "getErrorText", "(", ")", ")", ";", "}", "return", "vbsOutput", ";", "}" ]
Invokes the VB script and returns the output. @param script The script to invoke @return The script output
[ "Invokes", "the", "VB", "script", "and", "returns", "the", "output", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/vbs/VBSFaxClientSpi.java#L656-L708
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java
AsciiSet.replaceNonMembers
public String replaceNonMembers(String input, char replacement) { """ Replace all characters in the input string with the replacement character. """ if (!contains(replacement)) { throw new IllegalArgumentException(replacement + " is not a member of " + pattern); } return containsAll(input) ? input : replaceNonMembersImpl(input, replacement); }
java
public String replaceNonMembers(String input, char replacement) { if (!contains(replacement)) { throw new IllegalArgumentException(replacement + " is not a member of " + pattern); } return containsAll(input) ? input : replaceNonMembersImpl(input, replacement); }
[ "public", "String", "replaceNonMembers", "(", "String", "input", ",", "char", "replacement", ")", "{", "if", "(", "!", "contains", "(", "replacement", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "replacement", "+", "\" is not a member of \"", "+", "pattern", ")", ";", "}", "return", "containsAll", "(", "input", ")", "?", "input", ":", "replaceNonMembersImpl", "(", "input", ",", "replacement", ")", ";", "}" ]
Replace all characters in the input string with the replacement character.
[ "Replace", "all", "characters", "in", "the", "input", "string", "with", "the", "replacement", "character", "." ]
train
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java#L203-L208
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/IdGenerator.java
IdGenerator.extractTimestampMiniAscii
public static long extractTimestampMiniAscii(String idMiniAscii) throws NumberFormatException { """ Extracts the (UNIX) timestamp from a mini ASCII id (radix {@link Character#MAX_RADIX}). @param idMiniAscii @return the UNIX timestamp (milliseconds) @throws NumberFormatException """ return extractTimestampMini(Long.parseLong(idMiniAscii, Character.MAX_RADIX)); }
java
public static long extractTimestampMiniAscii(String idMiniAscii) throws NumberFormatException { return extractTimestampMini(Long.parseLong(idMiniAscii, Character.MAX_RADIX)); }
[ "public", "static", "long", "extractTimestampMiniAscii", "(", "String", "idMiniAscii", ")", "throws", "NumberFormatException", "{", "return", "extractTimestampMini", "(", "Long", ".", "parseLong", "(", "idMiniAscii", ",", "Character", ".", "MAX_RADIX", ")", ")", ";", "}" ]
Extracts the (UNIX) timestamp from a mini ASCII id (radix {@link Character#MAX_RADIX}). @param idMiniAscii @return the UNIX timestamp (milliseconds) @throws NumberFormatException
[ "Extracts", "the", "(", "UNIX", ")", "timestamp", "from", "a", "mini", "ASCII", "id", "(", "radix", "{", "@link", "Character#MAX_RADIX", "}", ")", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/IdGenerator.java#L430-L432
defei/codelogger-utils
src/main/java/org/codelogger/utils/ArrayUtils.java
ArrayUtils.indexOf
public static <T> int indexOf(final T[] array, final T element) { """ 查找指定元素在给定数组中的索引。</br> Returns the index within given array of the first occurrence of the specified element.<br> If not found any array element equals specified, return <span style="color:blue">-1</span>. @param array 一个不为null的数组。any not null array. @param element 任何对象。any object. @return 返回指定元素在给定的数组中的第一个索引。 <br> 如果没找到则返回 <span style="color:blue">-1</span>.</br> the index within given array of the first occurrence of the specified element. """ for (int i = 0; i < array.length; i++) { if (JudgeUtils.equals(array[i], element)) { return i; } } return INDEX_OF_NOT_FOUND; }
java
public static <T> int indexOf(final T[] array, final T element) { for (int i = 0; i < array.length; i++) { if (JudgeUtils.equals(array[i], element)) { return i; } } return INDEX_OF_NOT_FOUND; }
[ "public", "static", "<", "T", ">", "int", "indexOf", "(", "final", "T", "[", "]", "array", ",", "final", "T", "element", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", "{", "if", "(", "JudgeUtils", ".", "equals", "(", "array", "[", "i", "]", ",", "element", ")", ")", "{", "return", "i", ";", "}", "}", "return", "INDEX_OF_NOT_FOUND", ";", "}" ]
查找指定元素在给定数组中的索引。</br> Returns the index within given array of the first occurrence of the specified element.<br> If not found any array element equals specified, return <span style="color:blue">-1</span>. @param array 一个不为null的数组。any not null array. @param element 任何对象。any object. @return 返回指定元素在给定的数组中的第一个索引。 <br> 如果没找到则返回 <span style="color:blue">-1</span>.</br> the index within given array of the first occurrence of the specified element.
[ "查找指定元素在给定数组中的索引。<", "/", "br", ">", "Returns", "the", "index", "within", "given", "array", "of", "the", "first", "occurrence", "of", "the", "specified", "element", ".", "<br", ">", "If", "not", "found", "any", "array", "element", "equals", "specified", "return", "<span", "style", "=", "color", ":", "blue", ">", "-", "1<", "/", "span", ">", "." ]
train
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/ArrayUtils.java#L149-L157
pmlopes/yoke
framework/src/main/java/com/jetdrone/vertx/yoke/engine/StringPlaceholderEngine.java
StringPlaceholderEngine.render
@Override public void render(final String file, final Map<String, Object> context, final Handler<AsyncResult<Buffer>> handler) { """ An interpreter for strings with named placeholders. For example given the string "hello ${myName}" and the map <code> Map&lt;String, Object&gt; map = new HashMap&lt;&gt;(); map.put("myName", "world"); </code> the call returns "hello world" It replaces every occurrence of a named placeholder with its given value in the map. If there is a named place holder which is not found in the map then the string will retain that placeholder. Likewise, if there is an entry in the map that does not have its respective placeholder, it is ignored. """ // verify if the file is still fresh in the cache read(prefix + file, new AsyncResultHandler<String>() { @Override public void handle(AsyncResult<String> asyncResult) { if (asyncResult.failed()) { handler.handle(new YokeAsyncResult<Buffer>(asyncResult.cause())); } else { try { handler.handle(new YokeAsyncResult<>(parseStringValue(asyncResult.result(), context, new HashSet<String>()))); } catch (IllegalArgumentException iae) { handler.handle(new YokeAsyncResult<Buffer>(iae)); } } } }); }
java
@Override public void render(final String file, final Map<String, Object> context, final Handler<AsyncResult<Buffer>> handler) { // verify if the file is still fresh in the cache read(prefix + file, new AsyncResultHandler<String>() { @Override public void handle(AsyncResult<String> asyncResult) { if (asyncResult.failed()) { handler.handle(new YokeAsyncResult<Buffer>(asyncResult.cause())); } else { try { handler.handle(new YokeAsyncResult<>(parseStringValue(asyncResult.result(), context, new HashSet<String>()))); } catch (IllegalArgumentException iae) { handler.handle(new YokeAsyncResult<Buffer>(iae)); } } } }); }
[ "@", "Override", "public", "void", "render", "(", "final", "String", "file", ",", "final", "Map", "<", "String", ",", "Object", ">", "context", ",", "final", "Handler", "<", "AsyncResult", "<", "Buffer", ">", ">", "handler", ")", "{", "// verify if the file is still fresh in the cache", "read", "(", "prefix", "+", "file", ",", "new", "AsyncResultHandler", "<", "String", ">", "(", ")", "{", "@", "Override", "public", "void", "handle", "(", "AsyncResult", "<", "String", ">", "asyncResult", ")", "{", "if", "(", "asyncResult", ".", "failed", "(", ")", ")", "{", "handler", ".", "handle", "(", "new", "YokeAsyncResult", "<", "Buffer", ">", "(", "asyncResult", ".", "cause", "(", ")", ")", ")", ";", "}", "else", "{", "try", "{", "handler", ".", "handle", "(", "new", "YokeAsyncResult", "<>", "(", "parseStringValue", "(", "asyncResult", ".", "result", "(", ")", ",", "context", ",", "new", "HashSet", "<", "String", ">", "(", ")", ")", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "iae", ")", "{", "handler", ".", "handle", "(", "new", "YokeAsyncResult", "<", "Buffer", ">", "(", "iae", ")", ")", ";", "}", "}", "}", "}", ")", ";", "}" ]
An interpreter for strings with named placeholders. For example given the string "hello ${myName}" and the map <code> Map&lt;String, Object&gt; map = new HashMap&lt;&gt;(); map.put("myName", "world"); </code> the call returns "hello world" It replaces every occurrence of a named placeholder with its given value in the map. If there is a named place holder which is not found in the map then the string will retain that placeholder. Likewise, if there is an entry in the map that does not have its respective placeholder, it is ignored.
[ "An", "interpreter", "for", "strings", "with", "named", "placeholders", "." ]
train
https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/engine/StringPlaceholderEngine.java#L72-L89
scireum/server-sass
src/main/java/org/serversass/Parser.java
Parser.joinOperations
private Expression joinOperations(Expression result, String operation, Expression next) { """ /* Takes care of operator precedence by modifying the AST appropriately """ if (!(result instanceof Operation)) { return new Operation(operation, result, next); } Operation farRight = (Operation) result; while (farRight.getRight() instanceof Operation) { farRight = (Operation) farRight.getRight(); } if (!farRight.isProtect() && ("+".equals(farRight.getOperation()) || "-".equals(farRight.getOperation()))) { farRight.setRight(new Operation(operation, farRight.getRight(), next)); return result; } return new Operation(operation, result, next); }
java
private Expression joinOperations(Expression result, String operation, Expression next) { if (!(result instanceof Operation)) { return new Operation(operation, result, next); } Operation farRight = (Operation) result; while (farRight.getRight() instanceof Operation) { farRight = (Operation) farRight.getRight(); } if (!farRight.isProtect() && ("+".equals(farRight.getOperation()) || "-".equals(farRight.getOperation()))) { farRight.setRight(new Operation(operation, farRight.getRight(), next)); return result; } return new Operation(operation, result, next); }
[ "private", "Expression", "joinOperations", "(", "Expression", "result", ",", "String", "operation", ",", "Expression", "next", ")", "{", "if", "(", "!", "(", "result", "instanceof", "Operation", ")", ")", "{", "return", "new", "Operation", "(", "operation", ",", "result", ",", "next", ")", ";", "}", "Operation", "farRight", "=", "(", "Operation", ")", "result", ";", "while", "(", "farRight", ".", "getRight", "(", ")", "instanceof", "Operation", ")", "{", "farRight", "=", "(", "Operation", ")", "farRight", ".", "getRight", "(", ")", ";", "}", "if", "(", "!", "farRight", ".", "isProtect", "(", ")", "&&", "(", "\"+\"", ".", "equals", "(", "farRight", ".", "getOperation", "(", ")", ")", "||", "\"-\"", ".", "equals", "(", "farRight", ".", "getOperation", "(", ")", ")", ")", ")", "{", "farRight", ".", "setRight", "(", "new", "Operation", "(", "operation", ",", "farRight", ".", "getRight", "(", ")", ",", "next", ")", ")", ";", "return", "result", ";", "}", "return", "new", "Operation", "(", "operation", ",", "result", ",", "next", ")", ";", "}" ]
/* Takes care of operator precedence by modifying the AST appropriately
[ "/", "*", "Takes", "care", "of", "operator", "precedence", "by", "modifying", "the", "AST", "appropriately" ]
train
https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Parser.java#L556-L570
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/string/Levenshtein.java
Levenshtein.QGram
public static <T extends Levenshtein> T QGram(String baseTarget, String compareTarget) { """ Returns a new Q-Gram (Ukkonen) instance with compare target string @see QGram @param baseTarget @param compareTarget @return """ return QGram(baseTarget, compareTarget, null); }
java
public static <T extends Levenshtein> T QGram(String baseTarget, String compareTarget) { return QGram(baseTarget, compareTarget, null); }
[ "public", "static", "<", "T", "extends", "Levenshtein", ">", "T", "QGram", "(", "String", "baseTarget", ",", "String", "compareTarget", ")", "{", "return", "QGram", "(", "baseTarget", ",", "compareTarget", ",", "null", ")", ";", "}" ]
Returns a new Q-Gram (Ukkonen) instance with compare target string @see QGram @param baseTarget @param compareTarget @return
[ "Returns", "a", "new", "Q", "-", "Gram", "(", "Ukkonen", ")", "instance", "with", "compare", "target", "string" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Levenshtein.java#L184-L186
Coveros/selenified
src/main/java/com/coveros/selenified/application/WaitFor.java
WaitFor.alertMatches
public void alertMatches(double seconds, String expectedAlertPattern) { """ Waits up to the provided wait time for an alert present on the page has content matching the expected patten. This information will be logged and recorded, with a screenshot for traceability and added debugging support. @param expectedAlertPattern the expected text of the alert @param seconds the number of seconds to wait """ try { double timeTook = popup(seconds); timeTook = popupMatches(seconds - timeTook, expectedAlertPattern); checkAlertMatches(expectedAlertPattern, seconds, timeTook); } catch (TimeoutException e) { checkAlertMatches(expectedAlertPattern, seconds, seconds); } }
java
public void alertMatches(double seconds, String expectedAlertPattern) { try { double timeTook = popup(seconds); timeTook = popupMatches(seconds - timeTook, expectedAlertPattern); checkAlertMatches(expectedAlertPattern, seconds, timeTook); } catch (TimeoutException e) { checkAlertMatches(expectedAlertPattern, seconds, seconds); } }
[ "public", "void", "alertMatches", "(", "double", "seconds", ",", "String", "expectedAlertPattern", ")", "{", "try", "{", "double", "timeTook", "=", "popup", "(", "seconds", ")", ";", "timeTook", "=", "popupMatches", "(", "seconds", "-", "timeTook", ",", "expectedAlertPattern", ")", ";", "checkAlertMatches", "(", "expectedAlertPattern", ",", "seconds", ",", "timeTook", ")", ";", "}", "catch", "(", "TimeoutException", "e", ")", "{", "checkAlertMatches", "(", "expectedAlertPattern", ",", "seconds", ",", "seconds", ")", ";", "}", "}" ]
Waits up to the provided wait time for an alert present on the page has content matching the expected patten. This information will be logged and recorded, with a screenshot for traceability and added debugging support. @param expectedAlertPattern the expected text of the alert @param seconds the number of seconds to wait
[ "Waits", "up", "to", "the", "provided", "wait", "time", "for", "an", "alert", "present", "on", "the", "page", "has", "content", "matching", "the", "expected", "patten", ".", "This", "information", "will", "be", "logged", "and", "recorded", "with", "a", "screenshot", "for", "traceability", "and", "added", "debugging", "support", "." ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/WaitFor.java#L510-L518
strator-dev/greenpepper
greenpepper/core/src/main/java/com/greenpepper/util/CollectionUtil.java
CollectionUtil.removeLast
public static <T> T removeLast( List<T> list ) { """ <p>removeLast.</p> @param list a {@link java.util.List} object. @param <T> a T object. @return a T object. """ return remove( list, list.size() - 1 ); }
java
public static <T> T removeLast( List<T> list ) { return remove( list, list.size() - 1 ); }
[ "public", "static", "<", "T", ">", "T", "removeLast", "(", "List", "<", "T", ">", "list", ")", "{", "return", "remove", "(", "list", ",", "list", ".", "size", "(", ")", "-", "1", ")", ";", "}" ]
<p>removeLast.</p> @param list a {@link java.util.List} object. @param <T> a T object. @return a T object.
[ "<p", ">", "removeLast", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/util/CollectionUtil.java#L226-L229
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFS.java
VFS.mountZip
public static Closeable mountZip(VirtualFile zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException { """ Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file system when closed. @param zipFile a zip file in the VFS @param mountPoint the point at which the filesystem should be mounted @param tempFileProvider the temporary file provider @return a handle @throws IOException if an error occurs """ return mountZip(zipFile.openStream(), zipFile.getName(), mountPoint, tempFileProvider); }
java
public static Closeable mountZip(VirtualFile zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException { return mountZip(zipFile.openStream(), zipFile.getName(), mountPoint, tempFileProvider); }
[ "public", "static", "Closeable", "mountZip", "(", "VirtualFile", "zipFile", ",", "VirtualFile", "mountPoint", ",", "TempFileProvider", "tempFileProvider", ")", "throws", "IOException", "{", "return", "mountZip", "(", "zipFile", ".", "openStream", "(", ")", ",", "zipFile", ".", "getName", "(", ")", ",", "mountPoint", ",", "tempFileProvider", ")", ";", "}" ]
Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file system when closed. @param zipFile a zip file in the VFS @param mountPoint the point at which the filesystem should be mounted @param tempFileProvider the temporary file provider @return a handle @throws IOException if an error occurs
[ "Create", "and", "mount", "a", "zip", "file", "into", "the", "filesystem", "returning", "a", "single", "handle", "which", "will", "unmount", "and", "close", "the", "file", "system", "when", "closed", "." ]
train
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFS.java#L367-L369
upwork/java-upwork
src/com/Upwork/api/Routers/Activities/Team.java
Team.updateActivity
public JSONObject updateActivity(String company, String team, String code, HashMap<String, String> params) throws JSONException { """ Update specific oTask/Activity record within a team @param company Company ID @param team Team ID @param code Specific code @param params Parameters @throws JSONException If error occurred @return {@link JSONObject} """ return oClient.put("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/tasks/" + code, params); }
java
public JSONObject updateActivity(String company, String team, String code, HashMap<String, String> params) throws JSONException { return oClient.put("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/tasks/" + code, params); }
[ "public", "JSONObject", "updateActivity", "(", "String", "company", ",", "String", "team", ",", "String", "code", ",", "HashMap", "<", "String", ",", "String", ">", "params", ")", "throws", "JSONException", "{", "return", "oClient", ".", "put", "(", "\"/otask/v1/tasks/companies/\"", "+", "company", "+", "\"/teams/\"", "+", "team", "+", "\"/tasks/\"", "+", "code", ",", "params", ")", ";", "}" ]
Update specific oTask/Activity record within a team @param company Company ID @param team Team ID @param code Specific code @param params Parameters @throws JSONException If error occurred @return {@link JSONObject}
[ "Update", "specific", "oTask", "/", "Activity", "record", "within", "a", "team" ]
train
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Activities/Team.java#L111-L113
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.deleteEventHubConsumerGroup
public void deleteEventHubConsumerGroup(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { """ Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. @param name The name of the consumer group to delete. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorDetailsException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ deleteEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).toBlocking().single().body(); }
java
public void deleteEventHubConsumerGroup(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { deleteEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).toBlocking().single().body(); }
[ "public", "void", "deleteEventHubConsumerGroup", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "String", "eventHubEndpointName", ",", "String", "name", ")", "{", "deleteEventHubConsumerGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ",", "eventHubEndpointName", ",", "name", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. @param name The name of the consumer group to delete. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorDetailsException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Delete", "a", "consumer", "group", "from", "an", "Event", "Hub", "-", "compatible", "endpoint", "in", "an", "IoT", "hub", ".", "Delete", "a", "consumer", "group", "from", "an", "Event", "Hub", "-", "compatible", "endpoint", "in", "an", "IoT", "hub", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L1977-L1979
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.setMapConfigs
public Config setMapConfigs(Map<String, MapConfig> mapConfigs) { """ Sets the map of {@link com.hazelcast.core.IMap} configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param mapConfigs the IMap configuration map to set @return this config instance """ this.mapConfigs.clear(); this.mapConfigs.putAll(mapConfigs); for (final Entry<String, MapConfig> entry : this.mapConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
java
public Config setMapConfigs(Map<String, MapConfig> mapConfigs) { this.mapConfigs.clear(); this.mapConfigs.putAll(mapConfigs); for (final Entry<String, MapConfig> entry : this.mapConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
[ "public", "Config", "setMapConfigs", "(", "Map", "<", "String", ",", "MapConfig", ">", "mapConfigs", ")", "{", "this", ".", "mapConfigs", ".", "clear", "(", ")", ";", "this", ".", "mapConfigs", ".", "putAll", "(", "mapConfigs", ")", ";", "for", "(", "final", "Entry", "<", "String", ",", "MapConfig", ">", "entry", ":", "this", ".", "mapConfigs", ".", "entrySet", "(", ")", ")", "{", "entry", ".", "getValue", "(", ")", ".", "setName", "(", "entry", ".", "getKey", "(", ")", ")", ";", "}", "return", "this", ";", "}" ]
Sets the map of {@link com.hazelcast.core.IMap} configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param mapConfigs the IMap configuration map to set @return this config instance
[ "Sets", "the", "map", "of", "{", "@link", "com", ".", "hazelcast", ".", "core", ".", "IMap", "}", "configurations", "mapped", "by", "config", "name", ".", "The", "config", "name", "may", "be", "a", "pattern", "with", "which", "the", "configuration", "will", "be", "obtained", "in", "the", "future", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L495-L502
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java
TitlePaneIconifyButtonPainter.paintBackground
private void paintBackground(Graphics2D g, JComponent c, int width, int height, ButtonColors colors) { """ Paint the background of the button using the specified colors. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component. @param colors the color set to use to paint the button. """ g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g.setColor(colors.top); g.drawLine(1, 0, width - 2, 0); g.setColor(colors.leftOuter); g.drawLine(0, 0, 0, height - 4); g.drawLine(1, height - 3, 1, height - 3); g.setColor(colors.leftInner); g.drawLine(1, 1, 1, height - 4); g.drawLine(2, height - 3, 2, height - 3); g.setColor(colors.edge); g.drawLine(width - 1, 0, width - 1, height - 2); g.drawLine(3, height - 2, width - 2, height - 2); g.setColor(colors.edgeShade); g.drawLine(2, height - 2, 2, height - 2); g.setColor(colors.shadow); g.drawLine(4, height - 1, width - 1, height - 1); g.setColor(colors.interior); g.fillRect(1, 1, width - 1, height - 3); g.drawLine(3, height - 3, width - 2, height - 3); }
java
private void paintBackground(Graphics2D g, JComponent c, int width, int height, ButtonColors colors) { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g.setColor(colors.top); g.drawLine(1, 0, width - 2, 0); g.setColor(colors.leftOuter); g.drawLine(0, 0, 0, height - 4); g.drawLine(1, height - 3, 1, height - 3); g.setColor(colors.leftInner); g.drawLine(1, 1, 1, height - 4); g.drawLine(2, height - 3, 2, height - 3); g.setColor(colors.edge); g.drawLine(width - 1, 0, width - 1, height - 2); g.drawLine(3, height - 2, width - 2, height - 2); g.setColor(colors.edgeShade); g.drawLine(2, height - 2, 2, height - 2); g.setColor(colors.shadow); g.drawLine(4, height - 1, width - 1, height - 1); g.setColor(colors.interior); g.fillRect(1, 1, width - 1, height - 3); g.drawLine(3, height - 3, width - 2, height - 3); }
[ "private", "void", "paintBackground", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ",", "ButtonColors", "colors", ")", "{", "g", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_ANTIALIASING", ",", "RenderingHints", ".", "VALUE_ANTIALIAS_OFF", ")", ";", "g", ".", "setColor", "(", "colors", ".", "top", ")", ";", "g", ".", "drawLine", "(", "1", ",", "0", ",", "width", "-", "2", ",", "0", ")", ";", "g", ".", "setColor", "(", "colors", ".", "leftOuter", ")", ";", "g", ".", "drawLine", "(", "0", ",", "0", ",", "0", ",", "height", "-", "4", ")", ";", "g", ".", "drawLine", "(", "1", ",", "height", "-", "3", ",", "1", ",", "height", "-", "3", ")", ";", "g", ".", "setColor", "(", "colors", ".", "leftInner", ")", ";", "g", ".", "drawLine", "(", "1", ",", "1", ",", "1", ",", "height", "-", "4", ")", ";", "g", ".", "drawLine", "(", "2", ",", "height", "-", "3", ",", "2", ",", "height", "-", "3", ")", ";", "g", ".", "setColor", "(", "colors", ".", "edge", ")", ";", "g", ".", "drawLine", "(", "width", "-", "1", ",", "0", ",", "width", "-", "1", ",", "height", "-", "2", ")", ";", "g", ".", "drawLine", "(", "3", ",", "height", "-", "2", ",", "width", "-", "2", ",", "height", "-", "2", ")", ";", "g", ".", "setColor", "(", "colors", ".", "edgeShade", ")", ";", "g", ".", "drawLine", "(", "2", ",", "height", "-", "2", ",", "2", ",", "height", "-", "2", ")", ";", "g", ".", "setColor", "(", "colors", ".", "shadow", ")", ";", "g", ".", "drawLine", "(", "4", ",", "height", "-", "1", ",", "width", "-", "1", ",", "height", "-", "1", ")", ";", "g", ".", "setColor", "(", "colors", ".", "interior", ")", ";", "g", ".", "fillRect", "(", "1", ",", "1", ",", "width", "-", "1", ",", "height", "-", "3", ")", ";", "g", ".", "drawLine", "(", "3", ",", "height", "-", "3", ",", "width", "-", "2", ",", "height", "-", "3", ")", ";", "}" ]
Paint the background of the button using the specified colors. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component. @param colors the color set to use to paint the button.
[ "Paint", "the", "background", "of", "the", "button", "using", "the", "specified", "colors", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java#L244-L264
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/Criteria.java
Criteria.addLessThanField
public void addLessThanField(String attribute, Object value) { """ Adds Less Than (<) criteria, customer_id < person_id @param attribute The field name to be used @param value The field to compare with """ // PAW // addSelectionCriteria(FieldCriteria.buildLessCriteria(attribute, value, getAlias())); addSelectionCriteria(FieldCriteria.buildLessCriteria(attribute, value, getUserAlias(attribute))); }
java
public void addLessThanField(String attribute, Object value) { // PAW // addSelectionCriteria(FieldCriteria.buildLessCriteria(attribute, value, getAlias())); addSelectionCriteria(FieldCriteria.buildLessCriteria(attribute, value, getUserAlias(attribute))); }
[ "public", "void", "addLessThanField", "(", "String", "attribute", ",", "Object", "value", ")", "{", "// PAW\r", "// addSelectionCriteria(FieldCriteria.buildLessCriteria(attribute, value, getAlias()));\r", "addSelectionCriteria", "(", "FieldCriteria", ".", "buildLessCriteria", "(", "attribute", ",", "value", ",", "getUserAlias", "(", "attribute", ")", ")", ")", ";", "}" ]
Adds Less Than (<) criteria, customer_id < person_id @param attribute The field name to be used @param value The field to compare with
[ "Adds", "Less", "Than", "(", "<", ")", "criteria", "customer_id", "<", "person_id" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/Criteria.java#L549-L554
Netflix/eureka
eureka-core/src/main/java/com/netflix/eureka/cluster/PeerEurekaNodes.java
PeerEurekaNodes.isThisMyUrl
public boolean isThisMyUrl(String url) { """ Checks if the given service url contains the current host which is trying to replicate. Only after the EIP binding is done the host has a chance to identify itself in the list of replica nodes and needs to take itself out of replication traffic. @param url the service url of the replica node that the check is made. @return true, if the url represents the current node which is trying to replicate, false otherwise. """ final String myUrlConfigured = serverConfig.getMyUrl(); if (myUrlConfigured != null) { return myUrlConfigured.equals(url); } return isInstanceURL(url, applicationInfoManager.getInfo()); }
java
public boolean isThisMyUrl(String url) { final String myUrlConfigured = serverConfig.getMyUrl(); if (myUrlConfigured != null) { return myUrlConfigured.equals(url); } return isInstanceURL(url, applicationInfoManager.getInfo()); }
[ "public", "boolean", "isThisMyUrl", "(", "String", "url", ")", "{", "final", "String", "myUrlConfigured", "=", "serverConfig", ".", "getMyUrl", "(", ")", ";", "if", "(", "myUrlConfigured", "!=", "null", ")", "{", "return", "myUrlConfigured", ".", "equals", "(", "url", ")", ";", "}", "return", "isInstanceURL", "(", "url", ",", "applicationInfoManager", ".", "getInfo", "(", ")", ")", ";", "}" ]
Checks if the given service url contains the current host which is trying to replicate. Only after the EIP binding is done the host has a chance to identify itself in the list of replica nodes and needs to take itself out of replication traffic. @param url the service url of the replica node that the check is made. @return true, if the url represents the current node which is trying to replicate, false otherwise.
[ "Checks", "if", "the", "given", "service", "url", "contains", "the", "current", "host", "which", "is", "trying", "to", "replicate", ".", "Only", "after", "the", "EIP", "binding", "is", "done", "the", "host", "has", "a", "chance", "to", "identify", "itself", "in", "the", "list", "of", "replica", "nodes", "and", "needs", "to", "take", "itself", "out", "of", "replication", "traffic", "." ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/cluster/PeerEurekaNodes.java#L235-L241
jamesagnew/hapi-fhir
hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/terminologies/LoincToDEConvertor.java
LoincToDEConvertor.makeUnits
private CodeableConcept makeUnits(String text, String ucum) { """ 18606-4: MMAT. 18665-0: PRF. 18671-8: TX. 55400-6: DT; 8251-1: FT """ if (Utilities.noString(text) && Utilities.noString(ucum)) return null; CodeableConcept cc = new CodeableConcept(); cc.setText(text); cc.getCoding().add(new Coding().setCode(ucum).setSystem("http://unitsofmeasure.org")); return cc; }
java
private CodeableConcept makeUnits(String text, String ucum) { if (Utilities.noString(text) && Utilities.noString(ucum)) return null; CodeableConcept cc = new CodeableConcept(); cc.setText(text); cc.getCoding().add(new Coding().setCode(ucum).setSystem("http://unitsofmeasure.org")); return cc; }
[ "private", "CodeableConcept", "makeUnits", "(", "String", "text", ",", "String", "ucum", ")", "{", "if", "(", "Utilities", ".", "noString", "(", "text", ")", "&&", "Utilities", ".", "noString", "(", "ucum", ")", ")", "return", "null", ";", "CodeableConcept", "cc", "=", "new", "CodeableConcept", "(", ")", ";", "cc", ".", "setText", "(", "text", ")", ";", "cc", ".", "getCoding", "(", ")", ".", "add", "(", "new", "Coding", "(", ")", ".", "setCode", "(", "ucum", ")", ".", "setSystem", "(", "\"http://unitsofmeasure.org\"", ")", ")", ";", "return", "cc", ";", "}" ]
18606-4: MMAT. 18665-0: PRF. 18671-8: TX. 55400-6: DT; 8251-1: FT
[ "18606", "-", "4", ":", "MMAT", ".", "18665", "-", "0", ":", "PRF", ".", "18671", "-", "8", ":", "TX", ".", "55400", "-", "6", ":", "DT", ";", "8251", "-", "1", ":", "FT" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/terminologies/LoincToDEConvertor.java#L277-L284
kite-sdk/kite
kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/SignalManager.java
SignalManager.signalReady
public void signalReady(Constraints viewConstraints) { """ Create a signal for the specified constraints. @param viewConstraints The constraints to create a signal for. @throws DatasetException if the signal could not be created. """ try { rootFileSystem.mkdirs(signalDirectory); } catch (IOException e) { throw new DatasetIOException("Unable to create signal manager directory: " + signalDirectory, e); } String normalizedConstraints = getNormalizedConstraints(viewConstraints); Path signalPath = new Path(signalDirectory, normalizedConstraints); try{ // create the output stream to overwrite the current contents, if the directory or file // exists it will be overwritten to get a new timestamp FSDataOutputStream os = rootFileSystem.create(signalPath, true); os.close(); } catch (IOException e) { throw new DatasetIOException("Could not access signal path: " + signalPath, e); } }
java
public void signalReady(Constraints viewConstraints) { try { rootFileSystem.mkdirs(signalDirectory); } catch (IOException e) { throw new DatasetIOException("Unable to create signal manager directory: " + signalDirectory, e); } String normalizedConstraints = getNormalizedConstraints(viewConstraints); Path signalPath = new Path(signalDirectory, normalizedConstraints); try{ // create the output stream to overwrite the current contents, if the directory or file // exists it will be overwritten to get a new timestamp FSDataOutputStream os = rootFileSystem.create(signalPath, true); os.close(); } catch (IOException e) { throw new DatasetIOException("Could not access signal path: " + signalPath, e); } }
[ "public", "void", "signalReady", "(", "Constraints", "viewConstraints", ")", "{", "try", "{", "rootFileSystem", ".", "mkdirs", "(", "signalDirectory", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "DatasetIOException", "(", "\"Unable to create signal manager directory: \"", "+", "signalDirectory", ",", "e", ")", ";", "}", "String", "normalizedConstraints", "=", "getNormalizedConstraints", "(", "viewConstraints", ")", ";", "Path", "signalPath", "=", "new", "Path", "(", "signalDirectory", ",", "normalizedConstraints", ")", ";", "try", "{", "// create the output stream to overwrite the current contents, if the directory or file", "// exists it will be overwritten to get a new timestamp", "FSDataOutputStream", "os", "=", "rootFileSystem", ".", "create", "(", "signalPath", ",", "true", ")", ";", "os", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "DatasetIOException", "(", "\"Could not access signal path: \"", "+", "signalPath", ",", "e", ")", ";", "}", "}" ]
Create a signal for the specified constraints. @param viewConstraints The constraints to create a signal for. @throws DatasetException if the signal could not be created.
[ "Create", "a", "signal", "for", "the", "specified", "constraints", "." ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/SignalManager.java#L66-L85
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/RDBMDistributedLayoutStore.java
RDBMDistributedLayoutStore.getUserLayout
@Override public DistributedUserLayout getUserLayout(IPerson person, IUserProfile profile) { """ Returns the layout for a user decorated with any specified decorator. The layout returned is a composite layout for non fragment owners and a regular layout for layout owners. A composite layout is made up of layout pieces from potentially multiple incorporated layouts. If no layouts are defined then the composite layout will be the same as the user's personal layout fragment or PLF, the one holding only those UI elements that they own or incorporated elements that they have been allowed to changed. """ final DistributedUserLayout layout = this._getUserLayout(person, profile); return layout; }
java
@Override public DistributedUserLayout getUserLayout(IPerson person, IUserProfile profile) { final DistributedUserLayout layout = this._getUserLayout(person, profile); return layout; }
[ "@", "Override", "public", "DistributedUserLayout", "getUserLayout", "(", "IPerson", "person", ",", "IUserProfile", "profile", ")", "{", "final", "DistributedUserLayout", "layout", "=", "this", ".", "_getUserLayout", "(", "person", ",", "profile", ")", ";", "return", "layout", ";", "}" ]
Returns the layout for a user decorated with any specified decorator. The layout returned is a composite layout for non fragment owners and a regular layout for layout owners. A composite layout is made up of layout pieces from potentially multiple incorporated layouts. If no layouts are defined then the composite layout will be the same as the user's personal layout fragment or PLF, the one holding only those UI elements that they own or incorporated elements that they have been allowed to changed.
[ "Returns", "the", "layout", "for", "a", "user", "decorated", "with", "any", "specified", "decorator", ".", "The", "layout", "returned", "is", "a", "composite", "layout", "for", "non", "fragment", "owners", "and", "a", "regular", "layout", "for", "layout", "owners", ".", "A", "composite", "layout", "is", "made", "up", "of", "layout", "pieces", "from", "potentially", "multiple", "incorporated", "layouts", ".", "If", "no", "layouts", "are", "defined", "then", "the", "composite", "layout", "will", "be", "the", "same", "as", "the", "user", "s", "personal", "layout", "fragment", "or", "PLF", "the", "one", "holding", "only", "those", "UI", "elements", "that", "they", "own", "or", "incorporated", "elements", "that", "they", "have", "been", "allowed", "to", "changed", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/RDBMDistributedLayoutStore.java#L337-L343
alkacon/opencms-core
src/org/opencms/file/wrapper/CmsObjectWrapper.java
CmsObjectWrapper.copyResource
public void copyResource(String source, String destination, CmsResourceCopyMode siblingMode) throws CmsException, CmsIllegalArgumentException { """ Copies a resource.<p> Iterates through all configured resource wrappers till the first returns <code>true</code>.<p> @see I_CmsResourceWrapper#copyResource(CmsObject, String, String, CmsResource.CmsResourceCopyMode) @see CmsObject#copyResource(String, String, CmsResource.CmsResourceCopyMode) @param source the name of the resource to copy (full path) @param destination the name of the copy destination (full path) @param siblingMode indicates how to handle siblings during copy @throws CmsException if something goes wrong @throws CmsIllegalArgumentException if the <code>destination</code> argument is null or of length 0 """ boolean exec = false; // iterate through all wrappers and call "copyResource" till one does not return null List<I_CmsResourceWrapper> wrappers = getWrappers(); Iterator<I_CmsResourceWrapper> iter = wrappers.iterator(); while (iter.hasNext()) { I_CmsResourceWrapper wrapper = iter.next(); exec = wrapper.copyResource(m_cms, source, destination, siblingMode); if (exec) { break; } } // delegate the call to the CmsObject if (!exec) { m_cms.copyResource(source, destination, siblingMode); } }
java
public void copyResource(String source, String destination, CmsResourceCopyMode siblingMode) throws CmsException, CmsIllegalArgumentException { boolean exec = false; // iterate through all wrappers and call "copyResource" till one does not return null List<I_CmsResourceWrapper> wrappers = getWrappers(); Iterator<I_CmsResourceWrapper> iter = wrappers.iterator(); while (iter.hasNext()) { I_CmsResourceWrapper wrapper = iter.next(); exec = wrapper.copyResource(m_cms, source, destination, siblingMode); if (exec) { break; } } // delegate the call to the CmsObject if (!exec) { m_cms.copyResource(source, destination, siblingMode); } }
[ "public", "void", "copyResource", "(", "String", "source", ",", "String", "destination", ",", "CmsResourceCopyMode", "siblingMode", ")", "throws", "CmsException", ",", "CmsIllegalArgumentException", "{", "boolean", "exec", "=", "false", ";", "// iterate through all wrappers and call \"copyResource\" till one does not return null", "List", "<", "I_CmsResourceWrapper", ">", "wrappers", "=", "getWrappers", "(", ")", ";", "Iterator", "<", "I_CmsResourceWrapper", ">", "iter", "=", "wrappers", ".", "iterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "I_CmsResourceWrapper", "wrapper", "=", "iter", ".", "next", "(", ")", ";", "exec", "=", "wrapper", ".", "copyResource", "(", "m_cms", ",", "source", ",", "destination", ",", "siblingMode", ")", ";", "if", "(", "exec", ")", "{", "break", ";", "}", "}", "// delegate the call to the CmsObject", "if", "(", "!", "exec", ")", "{", "m_cms", ".", "copyResource", "(", "source", ",", "destination", ",", "siblingMode", ")", ";", "}", "}" ]
Copies a resource.<p> Iterates through all configured resource wrappers till the first returns <code>true</code>.<p> @see I_CmsResourceWrapper#copyResource(CmsObject, String, String, CmsResource.CmsResourceCopyMode) @see CmsObject#copyResource(String, String, CmsResource.CmsResourceCopyMode) @param source the name of the resource to copy (full path) @param destination the name of the copy destination (full path) @param siblingMode indicates how to handle siblings during copy @throws CmsException if something goes wrong @throws CmsIllegalArgumentException if the <code>destination</code> argument is null or of length 0
[ "Copies", "a", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/wrapper/CmsObjectWrapper.java#L125-L146
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Prism.java
Prism.getVertices
@Override public Point3d[] getVertices() { """ Returns the vertices of an n-fold polygon of given radius and center @return """ Point3d[] polygon = new Point3d[2*n]; Matrix3d m = new Matrix3d(); Point3d center = new Point3d(0, 0, height/2); for (int i = 0; i < n; i++) { polygon[i] = new Point3d(0, circumscribedRadius, 0); m.rotZ(i*2*Math.PI/n); m.transform(polygon[i]); polygon[n+i] = new Point3d(polygon[i]); polygon[i].sub(center); polygon[n+i].add(center); } return polygon; }
java
@Override public Point3d[] getVertices() { Point3d[] polygon = new Point3d[2*n]; Matrix3d m = new Matrix3d(); Point3d center = new Point3d(0, 0, height/2); for (int i = 0; i < n; i++) { polygon[i] = new Point3d(0, circumscribedRadius, 0); m.rotZ(i*2*Math.PI/n); m.transform(polygon[i]); polygon[n+i] = new Point3d(polygon[i]); polygon[i].sub(center); polygon[n+i].add(center); } return polygon; }
[ "@", "Override", "public", "Point3d", "[", "]", "getVertices", "(", ")", "{", "Point3d", "[", "]", "polygon", "=", "new", "Point3d", "[", "2", "*", "n", "]", ";", "Matrix3d", "m", "=", "new", "Matrix3d", "(", ")", ";", "Point3d", "center", "=", "new", "Point3d", "(", "0", ",", "0", ",", "height", "/", "2", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "polygon", "[", "i", "]", "=", "new", "Point3d", "(", "0", ",", "circumscribedRadius", ",", "0", ")", ";", "m", ".", "rotZ", "(", "i", "*", "2", "*", "Math", ".", "PI", "/", "n", ")", ";", "m", ".", "transform", "(", "polygon", "[", "i", "]", ")", ";", "polygon", "[", "n", "+", "i", "]", "=", "new", "Point3d", "(", "polygon", "[", "i", "]", ")", ";", "polygon", "[", "i", "]", ".", "sub", "(", "center", ")", ";", "polygon", "[", "n", "+", "i", "]", ".", "add", "(", "center", ")", ";", "}", "return", "polygon", ";", "}" ]
Returns the vertices of an n-fold polygon of given radius and center @return
[ "Returns", "the", "vertices", "of", "an", "n", "-", "fold", "polygon", "of", "given", "radius", "and", "center" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Prism.java#L101-L118
googleapis/google-cloud-java
google-cloud-clients/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1beta1/CloudSchedulerClient.java
CloudSchedulerClient.updateJob
public final Job updateJob(Job job, FieldMask updateMask) { """ Updates a job. <p>If successful, the updated [Job][google.cloud.scheduler.v1beta1.Job] is returned. If the job does not exist, `NOT_FOUND` is returned. <p>If UpdateJob does not successfully return, it is possible for the job to be in an [Job.State.UPDATE_FAILED][google.cloud.scheduler.v1beta1.Job.State.UPDATE_FAILED] state. A job in this state may not be executed. If this happens, retry the UpdateJob request until a successful response is received. <p>Sample code: <pre><code> try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) { Job job = Job.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Job response = cloudSchedulerClient.updateJob(job, updateMask); } </code></pre> @param job Required. <p>The new job properties. [name][google.cloud.scheduler.v1beta1.Job.name] must be specified. <p>Output only fields cannot be modified using UpdateJob. Any value specified for an output only field will be ignored. @param updateMask A mask used to specify which fields of the job are being updated. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ UpdateJobRequest request = UpdateJobRequest.newBuilder().setJob(job).setUpdateMask(updateMask).build(); return updateJob(request); }
java
public final Job updateJob(Job job, FieldMask updateMask) { UpdateJobRequest request = UpdateJobRequest.newBuilder().setJob(job).setUpdateMask(updateMask).build(); return updateJob(request); }
[ "public", "final", "Job", "updateJob", "(", "Job", "job", ",", "FieldMask", "updateMask", ")", "{", "UpdateJobRequest", "request", "=", "UpdateJobRequest", ".", "newBuilder", "(", ")", ".", "setJob", "(", "job", ")", ".", "setUpdateMask", "(", "updateMask", ")", ".", "build", "(", ")", ";", "return", "updateJob", "(", "request", ")", ";", "}" ]
Updates a job. <p>If successful, the updated [Job][google.cloud.scheduler.v1beta1.Job] is returned. If the job does not exist, `NOT_FOUND` is returned. <p>If UpdateJob does not successfully return, it is possible for the job to be in an [Job.State.UPDATE_FAILED][google.cloud.scheduler.v1beta1.Job.State.UPDATE_FAILED] state. A job in this state may not be executed. If this happens, retry the UpdateJob request until a successful response is received. <p>Sample code: <pre><code> try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) { Job job = Job.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Job response = cloudSchedulerClient.updateJob(job, updateMask); } </code></pre> @param job Required. <p>The new job properties. [name][google.cloud.scheduler.v1beta1.Job.name] must be specified. <p>Output only fields cannot be modified using UpdateJob. Any value specified for an output only field will be ignored. @param updateMask A mask used to specify which fields of the job are being updated. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Updates", "a", "job", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1beta1/CloudSchedulerClient.java#L523-L528
graknlabs/grakn
common/util/CommonUtil.java
CommonUtil.containsOnly
public static boolean containsOnly(Stream stream, long size) { """ Helper which lazily checks if a {@link Stream} contains the number specified WARNING: This consumes the stream rendering it unusable afterwards @param stream the {@link Stream} to check the count against @param size the expected number of elements in the stream @return true if the expected size is found """ long count = 0L; Iterator it = stream.iterator(); while(it.hasNext()){ it.next(); if(++count > size) return false; } return size == count; }
java
public static boolean containsOnly(Stream stream, long size){ long count = 0L; Iterator it = stream.iterator(); while(it.hasNext()){ it.next(); if(++count > size) return false; } return size == count; }
[ "public", "static", "boolean", "containsOnly", "(", "Stream", "stream", ",", "long", "size", ")", "{", "long", "count", "=", "0L", ";", "Iterator", "it", "=", "stream", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "it", ".", "next", "(", ")", ";", "if", "(", "++", "count", ">", "size", ")", "return", "false", ";", "}", "return", "size", "==", "count", ";", "}" ]
Helper which lazily checks if a {@link Stream} contains the number specified WARNING: This consumes the stream rendering it unusable afterwards @param stream the {@link Stream} to check the count against @param size the expected number of elements in the stream @return true if the expected size is found
[ "Helper", "which", "lazily", "checks", "if", "a", "{", "@link", "Stream", "}", "contains", "the", "number", "specified", "WARNING", ":", "This", "consumes", "the", "stream", "rendering", "it", "unusable", "afterwards" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/common/util/CommonUtil.java#L71-L81
aws/aws-sdk-java
aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/message/SignatureVerifier.java
SignatureVerifier.createPublicKey
private PublicKey createPublicKey(String cert) { """ Build a PublicKey object from a cert @param cert The cert body @return A public key """ try { CertificateFactory fact = CertificateFactory.getInstance("X.509"); InputStream stream = new ByteArrayInputStream(cert.getBytes(Charset.forName("UTF-8"))); X509Certificate cer = (X509Certificate) fact.generateCertificate(stream); validateCertificate(cer); return cer.getPublicKey(); } catch (SdkBaseException e) { throw e; } catch (Exception e) { throw new SdkClientException("Could not create public key from certificate", e); } }
java
private PublicKey createPublicKey(String cert) { try { CertificateFactory fact = CertificateFactory.getInstance("X.509"); InputStream stream = new ByteArrayInputStream(cert.getBytes(Charset.forName("UTF-8"))); X509Certificate cer = (X509Certificate) fact.generateCertificate(stream); validateCertificate(cer); return cer.getPublicKey(); } catch (SdkBaseException e) { throw e; } catch (Exception e) { throw new SdkClientException("Could not create public key from certificate", e); } }
[ "private", "PublicKey", "createPublicKey", "(", "String", "cert", ")", "{", "try", "{", "CertificateFactory", "fact", "=", "CertificateFactory", ".", "getInstance", "(", "\"X.509\"", ")", ";", "InputStream", "stream", "=", "new", "ByteArrayInputStream", "(", "cert", ".", "getBytes", "(", "Charset", ".", "forName", "(", "\"UTF-8\"", ")", ")", ")", ";", "X509Certificate", "cer", "=", "(", "X509Certificate", ")", "fact", ".", "generateCertificate", "(", "stream", ")", ";", "validateCertificate", "(", "cer", ")", ";", "return", "cer", ".", "getPublicKey", "(", ")", ";", "}", "catch", "(", "SdkBaseException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "SdkClientException", "(", "\"Could not create public key from certificate\"", ",", "e", ")", ";", "}", "}" ]
Build a PublicKey object from a cert @param cert The cert body @return A public key
[ "Build", "a", "PublicKey", "object", "from", "a", "cert" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/message/SignatureVerifier.java#L196-L208
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/StandardAnnotationMaps.java
StandardAnnotationMaps.overrideOf
private static <T> T overrideOf(Class<T> clazz, Class<?> targetType, Annotation annotation) { """ Creates a new instance of the clazz with the target type and annotation as parameters if available. """ try { if (annotation != null) { try { return clazz.getConstructor(Class.class, annotation.annotationType()).newInstance(targetType, annotation); } catch (final NoSuchMethodException no) {} } try { return clazz.getConstructor(Class.class).newInstance(targetType); } catch (final NoSuchMethodException no) {} return clazz.newInstance(); } catch (final Exception e) { throw new DynamoDBMappingException("could not instantiate " + clazz, e); } }
java
private static <T> T overrideOf(Class<T> clazz, Class<?> targetType, Annotation annotation) { try { if (annotation != null) { try { return clazz.getConstructor(Class.class, annotation.annotationType()).newInstance(targetType, annotation); } catch (final NoSuchMethodException no) {} } try { return clazz.getConstructor(Class.class).newInstance(targetType); } catch (final NoSuchMethodException no) {} return clazz.newInstance(); } catch (final Exception e) { throw new DynamoDBMappingException("could not instantiate " + clazz, e); } }
[ "private", "static", "<", "T", ">", "T", "overrideOf", "(", "Class", "<", "T", ">", "clazz", ",", "Class", "<", "?", ">", "targetType", ",", "Annotation", "annotation", ")", "{", "try", "{", "if", "(", "annotation", "!=", "null", ")", "{", "try", "{", "return", "clazz", ".", "getConstructor", "(", "Class", ".", "class", ",", "annotation", ".", "annotationType", "(", ")", ")", ".", "newInstance", "(", "targetType", ",", "annotation", ")", ";", "}", "catch", "(", "final", "NoSuchMethodException", "no", ")", "{", "}", "}", "try", "{", "return", "clazz", ".", "getConstructor", "(", "Class", ".", "class", ")", ".", "newInstance", "(", "targetType", ")", ";", "}", "catch", "(", "final", "NoSuchMethodException", "no", ")", "{", "}", "return", "clazz", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "throw", "new", "DynamoDBMappingException", "(", "\"could not instantiate \"", "+", "clazz", ",", "e", ")", ";", "}", "}" ]
Creates a new instance of the clazz with the target type and annotation as parameters if available.
[ "Creates", "a", "new", "instance", "of", "the", "clazz", "with", "the", "target", "type", "and", "annotation", "as", "parameters", "if", "available", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/StandardAnnotationMaps.java#L432-L446
OpenLiberty/open-liberty
dev/com.ibm.ws.session/src/com/ibm/ws/session/store/memory/MemoryStore.java
MemoryStore.remoteInvalidate
public void remoteInvalidate(String sessionId, boolean backendUpdate) { """ /* Called as a result of an InvalidateAll(true) call on another JVM. We don't really invalidate, just set max inactive interval to 0 so that the next run of the invalidator will whack it. """ // backendUpdate not used here...there is no backend for in-memory if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { StringBuffer sb = new StringBuffer("{").append(sessionId).append(",").append(backendUpdate).append("} ").append(appNameForLogging); LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[REMOVE_INVALIDATE], sb.toString()); } ISession iSess = (ISession) _sessions.get(sessionId); if (iSess != null) { iSess.setMaxInactiveInterval(0); // let invalidator whack it } }
java
public void remoteInvalidate(String sessionId, boolean backendUpdate) { // backendUpdate not used here...there is no backend for in-memory if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { StringBuffer sb = new StringBuffer("{").append(sessionId).append(",").append(backendUpdate).append("} ").append(appNameForLogging); LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[REMOVE_INVALIDATE], sb.toString()); } ISession iSess = (ISession) _sessions.get(sessionId); if (iSess != null) { iSess.setMaxInactiveInterval(0); // let invalidator whack it } }
[ "public", "void", "remoteInvalidate", "(", "String", "sessionId", ",", "boolean", "backendUpdate", ")", "{", "// backendUpdate not used here...there is no backend for in-memory", "if", "(", "com", ".", "ibm", ".", "ejs", ".", "ras", ".", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "LoggingUtil", ".", "SESSION_LOGGER_CORE", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "\"{\"", ")", ".", "append", "(", "sessionId", ")", ".", "append", "(", "\",\"", ")", ".", "append", "(", "backendUpdate", ")", ".", "append", "(", "\"} \"", ")", ".", "append", "(", "appNameForLogging", ")", ";", "LoggingUtil", ".", "SESSION_LOGGER_CORE", ".", "logp", "(", "Level", ".", "FINE", ",", "methodClassName", ",", "methodNames", "[", "REMOVE_INVALIDATE", "]", ",", "sb", ".", "toString", "(", ")", ")", ";", "}", "ISession", "iSess", "=", "(", "ISession", ")", "_sessions", ".", "get", "(", "sessionId", ")", ";", "if", "(", "iSess", "!=", "null", ")", "{", "iSess", ".", "setMaxInactiveInterval", "(", "0", ")", ";", "// let invalidator whack it", "}", "}" ]
/* Called as a result of an InvalidateAll(true) call on another JVM. We don't really invalidate, just set max inactive interval to 0 so that the next run of the invalidator will whack it.
[ "/", "*", "Called", "as", "a", "result", "of", "an", "InvalidateAll", "(", "true", ")", "call", "on", "another", "JVM", ".", "We", "don", "t", "really", "invalidate", "just", "set", "max", "inactive", "interval", "to", "0", "so", "that", "the", "next", "run", "of", "the", "invalidator", "will", "whack", "it", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/store/memory/MemoryStore.java#L644-L654
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java
PathOverrideService.getGroupIdsInPathProfile
public String getGroupIdsInPathProfile(int profileId, int pathId) { """ First we get the oldGroups by looking at the database to find the path/profile match @param profileId ID of profile @param pathId ID of path @return Comma-delimited list of groups IDs """ return (String) sqlService.getFromTable(Constants.PATH_PROFILE_GROUP_IDS, Constants.GENERIC_ID, pathId, Constants.DB_TABLE_PATH); }
java
public String getGroupIdsInPathProfile(int profileId, int pathId) { return (String) sqlService.getFromTable(Constants.PATH_PROFILE_GROUP_IDS, Constants.GENERIC_ID, pathId, Constants.DB_TABLE_PATH); }
[ "public", "String", "getGroupIdsInPathProfile", "(", "int", "profileId", ",", "int", "pathId", ")", "{", "return", "(", "String", ")", "sqlService", ".", "getFromTable", "(", "Constants", ".", "PATH_PROFILE_GROUP_IDS", ",", "Constants", ".", "GENERIC_ID", ",", "pathId", ",", "Constants", ".", "DB_TABLE_PATH", ")", ";", "}" ]
First we get the oldGroups by looking at the database to find the path/profile match @param profileId ID of profile @param pathId ID of path @return Comma-delimited list of groups IDs
[ "First", "we", "get", "the", "oldGroups", "by", "looking", "at", "the", "database", "to", "find", "the", "path", "/", "profile", "match" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java#L326-L329
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.getApps
public List<OneLoginApp> getApps(HashMap<String, String> queryParameters) throws OAuthSystemException, OAuthProblemException, URISyntaxException { """ Gets a list of OneLoginApp resources. @param queryParameters Query parameters of the Resource Parameters to filter the result of the list @return List of OneLoginApp @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see com.onelogin.sdk.model.OneLoginApp @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/apps/get-apps">Get Apps documentation</a> """ return getApps(queryParameters, this.maxResults); }
java
public List<OneLoginApp> getApps(HashMap<String, String> queryParameters) throws OAuthSystemException, OAuthProblemException, URISyntaxException { return getApps(queryParameters, this.maxResults); }
[ "public", "List", "<", "OneLoginApp", ">", "getApps", "(", "HashMap", "<", "String", ",", "String", ">", "queryParameters", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", "URISyntaxException", "{", "return", "getApps", "(", "queryParameters", ",", "this", ".", "maxResults", ")", ";", "}" ]
Gets a list of OneLoginApp resources. @param queryParameters Query parameters of the Resource Parameters to filter the result of the list @return List of OneLoginApp @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see com.onelogin.sdk.model.OneLoginApp @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/apps/get-apps">Get Apps documentation</a>
[ "Gets", "a", "list", "of", "OneLoginApp", "resources", "." ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L1647-L1649
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/FormLoginExtensionProcessor.java
FormLoginExtensionProcessor.setUpAFullUrl
private String setUpAFullUrl(HttpServletRequest req, String loginErrorPage, boolean bCtx) { """ Set up an error page as a full URL (http;//host:port/ctx/path) @param req @param loginErrorPage @return errorPage """ String errorPage = null; if (loginErrorPage != null) { if (loginErrorPage.startsWith("http://") || loginErrorPage.startsWith("https://")) { return loginErrorPage; } if (!loginErrorPage.startsWith("/")) loginErrorPage = "/" + loginErrorPage; StringBuffer URL = req.getRequestURL(); String URLString = URL.toString(); int index = URLString.indexOf("//"); index = URLString.indexOf("/", index + 2); int endindex = URLString.length(); if (bCtx) { String ctx = req.getContextPath(); if (ctx.equals("/")) ctx = ""; errorPage = ctx + loginErrorPage; } else { errorPage = loginErrorPage; } URL.replace(index, endindex, errorPage); errorPage = URL.toString(); } return errorPage; }
java
private String setUpAFullUrl(HttpServletRequest req, String loginErrorPage, boolean bCtx) { String errorPage = null; if (loginErrorPage != null) { if (loginErrorPage.startsWith("http://") || loginErrorPage.startsWith("https://")) { return loginErrorPage; } if (!loginErrorPage.startsWith("/")) loginErrorPage = "/" + loginErrorPage; StringBuffer URL = req.getRequestURL(); String URLString = URL.toString(); int index = URLString.indexOf("//"); index = URLString.indexOf("/", index + 2); int endindex = URLString.length(); if (bCtx) { String ctx = req.getContextPath(); if (ctx.equals("/")) ctx = ""; errorPage = ctx + loginErrorPage; } else { errorPage = loginErrorPage; } URL.replace(index, endindex, errorPage); errorPage = URL.toString(); } return errorPage; }
[ "private", "String", "setUpAFullUrl", "(", "HttpServletRequest", "req", ",", "String", "loginErrorPage", ",", "boolean", "bCtx", ")", "{", "String", "errorPage", "=", "null", ";", "if", "(", "loginErrorPage", "!=", "null", ")", "{", "if", "(", "loginErrorPage", ".", "startsWith", "(", "\"http://\"", ")", "||", "loginErrorPage", ".", "startsWith", "(", "\"https://\"", ")", ")", "{", "return", "loginErrorPage", ";", "}", "if", "(", "!", "loginErrorPage", ".", "startsWith", "(", "\"/\"", ")", ")", "loginErrorPage", "=", "\"/\"", "+", "loginErrorPage", ";", "StringBuffer", "URL", "=", "req", ".", "getRequestURL", "(", ")", ";", "String", "URLString", "=", "URL", ".", "toString", "(", ")", ";", "int", "index", "=", "URLString", ".", "indexOf", "(", "\"//\"", ")", ";", "index", "=", "URLString", ".", "indexOf", "(", "\"/\"", ",", "index", "+", "2", ")", ";", "int", "endindex", "=", "URLString", ".", "length", "(", ")", ";", "if", "(", "bCtx", ")", "{", "String", "ctx", "=", "req", ".", "getContextPath", "(", ")", ";", "if", "(", "ctx", ".", "equals", "(", "\"/\"", ")", ")", "ctx", "=", "\"\"", ";", "errorPage", "=", "ctx", "+", "loginErrorPage", ";", "}", "else", "{", "errorPage", "=", "loginErrorPage", ";", "}", "URL", ".", "replace", "(", "index", ",", "endindex", ",", "errorPage", ")", ";", "errorPage", "=", "URL", ".", "toString", "(", ")", ";", "}", "return", "errorPage", ";", "}" ]
Set up an error page as a full URL (http;//host:port/ctx/path) @param req @param loginErrorPage @return errorPage
[ "Set", "up", "an", "error", "page", "as", "a", "full", "URL", "(", "http", ";", "//", "host", ":", "port", "/", "ctx", "/", "path", ")" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/FormLoginExtensionProcessor.java#L262-L290
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_ssl_GET
public ArrayList<Long> serviceName_ssl_GET(String serviceName, String fingerprint, String serial, OvhSslTypeEnum type) throws IOException { """ Ssl for this iplb REST: GET /ipLoadbalancing/{serviceName}/ssl @param type [required] Filter the value of type property (=) @param serial [required] Filter the value of serial property (like) @param fingerprint [required] Filter the value of fingerprint property (like) @param serviceName [required] The internal name of your IP load balancing """ String qPath = "/ipLoadbalancing/{serviceName}/ssl"; StringBuilder sb = path(qPath, serviceName); query(sb, "fingerprint", fingerprint); query(sb, "serial", serial); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<Long> serviceName_ssl_GET(String serviceName, String fingerprint, String serial, OvhSslTypeEnum type) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/ssl"; StringBuilder sb = path(qPath, serviceName); query(sb, "fingerprint", fingerprint); query(sb, "serial", serial); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "Long", ">", "serviceName_ssl_GET", "(", "String", "serviceName", ",", "String", "fingerprint", ",", "String", "serial", ",", "OvhSslTypeEnum", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadbalancing/{serviceName}/ssl\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"fingerprint\"", ",", "fingerprint", ")", ";", "query", "(", "sb", ",", "\"serial\"", ",", "serial", ")", ";", "query", "(", "sb", ",", "\"type\"", ",", "type", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t2", ")", ";", "}" ]
Ssl for this iplb REST: GET /ipLoadbalancing/{serviceName}/ssl @param type [required] Filter the value of type property (=) @param serial [required] Filter the value of serial property (like) @param fingerprint [required] Filter the value of fingerprint property (like) @param serviceName [required] The internal name of your IP load balancing
[ "Ssl", "for", "this", "iplb" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1914-L1922
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java
ElementMatchers.anyOf
public static <T extends MethodDescription> ElementMatcher.Junction<T> anyOf(Method... value) { """ Creates a matcher that matches any of the given methods as {@link MethodDescription}s by the {@link java.lang.Object#equals(Object)} method. None of the values must be {@code null}. @param value The input values to be compared against. @param <T> The type of the matched object. @return A matcher that checks for the equality with any of the given objects. """ return definedMethod(anyOf(new MethodList.ForLoadedMethods(new Constructor<?>[0], value))); }
java
public static <T extends MethodDescription> ElementMatcher.Junction<T> anyOf(Method... value) { return definedMethod(anyOf(new MethodList.ForLoadedMethods(new Constructor<?>[0], value))); }
[ "public", "static", "<", "T", "extends", "MethodDescription", ">", "ElementMatcher", ".", "Junction", "<", "T", ">", "anyOf", "(", "Method", "...", "value", ")", "{", "return", "definedMethod", "(", "anyOf", "(", "new", "MethodList", ".", "ForLoadedMethods", "(", "new", "Constructor", "<", "?", ">", "[", "0", "]", ",", "value", ")", ")", ")", ";", "}" ]
Creates a matcher that matches any of the given methods as {@link MethodDescription}s by the {@link java.lang.Object#equals(Object)} method. None of the values must be {@code null}. @param value The input values to be compared against. @param <T> The type of the matched object. @return A matcher that checks for the equality with any of the given objects.
[ "Creates", "a", "matcher", "that", "matches", "any", "of", "the", "given", "methods", "as", "{", "@link", "MethodDescription", "}", "s", "by", "the", "{", "@link", "java", ".", "lang", ".", "Object#equals", "(", "Object", ")", "}", "method", ".", "None", "of", "the", "values", "must", "be", "{", "@code", "null", "}", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L392-L394
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCCallableStatement.java
JDBCCallableStatement.getClob
public synchronized Clob getClob(int parameterIndex) throws SQLException { """ <!-- start generic documentation --> Retrieves the value of the designated JDBC <code>CLOB</code> parameter as a <code>java.sql.Clob</code> object in the Java programming language. <!-- end generic documentation --> <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> HSQLDB supports this feature. <p> </div> <!-- end release-specific documentation --> @param parameterIndex the first parameter is 1, the second is 2, and so on @return the parameter value as a <code>Clob</code> object in the Java programming language. If the value was SQL <code>NULL</code>, the value <code>null</code> is returned. @exception SQLException if a database access error occurs or this method is called on a closed <code>CallableStatement</code> @exception SQLFeatureNotSupportedException if the JDBC driver does not support this method @since JDK 1.2 (JDK 1.1.x developers: read the overview for JDBCParameterMetaData) """ Object o = getObject(parameterIndex); if (o == null) { return null; } if (o instanceof ClobDataID) { return new JDBCClobClient(session, (ClobDataID) o); } throw Util.sqlException(ErrorCode.X_42561); }
java
public synchronized Clob getClob(int parameterIndex) throws SQLException { Object o = getObject(parameterIndex); if (o == null) { return null; } if (o instanceof ClobDataID) { return new JDBCClobClient(session, (ClobDataID) o); } throw Util.sqlException(ErrorCode.X_42561); }
[ "public", "synchronized", "Clob", "getClob", "(", "int", "parameterIndex", ")", "throws", "SQLException", "{", "Object", "o", "=", "getObject", "(", "parameterIndex", ")", ";", "if", "(", "o", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "o", "instanceof", "ClobDataID", ")", "{", "return", "new", "JDBCClobClient", "(", "session", ",", "(", "ClobDataID", ")", "o", ")", ";", "}", "throw", "Util", ".", "sqlException", "(", "ErrorCode", ".", "X_42561", ")", ";", "}" ]
<!-- start generic documentation --> Retrieves the value of the designated JDBC <code>CLOB</code> parameter as a <code>java.sql.Clob</code> object in the Java programming language. <!-- end generic documentation --> <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> HSQLDB supports this feature. <p> </div> <!-- end release-specific documentation --> @param parameterIndex the first parameter is 1, the second is 2, and so on @return the parameter value as a <code>Clob</code> object in the Java programming language. If the value was SQL <code>NULL</code>, the value <code>null</code> is returned. @exception SQLException if a database access error occurs or this method is called on a closed <code>CallableStatement</code> @exception SQLFeatureNotSupportedException if the JDBC driver does not support this method @since JDK 1.2 (JDK 1.1.x developers: read the overview for JDBCParameterMetaData)
[ "<!", "--", "start", "generic", "documentation", "--", ">" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCCallableStatement.java#L1169-L1182
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/spec/ScanSpec.java
ScanSpec.withValueMap
public ScanSpec withValueMap(Map<String, Object> valueMap) { """ Applicable only when an expression has been specified. Used to specify the actual values for the attribute-value placeholders. @see ScanRequest#withExpressionAttributeValues(Map) """ if (valueMap == null) this.valueMap = null; else this.valueMap = Collections.unmodifiableMap(new LinkedHashMap<String, Object>(valueMap)); return this; }
java
public ScanSpec withValueMap(Map<String, Object> valueMap) { if (valueMap == null) this.valueMap = null; else this.valueMap = Collections.unmodifiableMap(new LinkedHashMap<String, Object>(valueMap)); return this; }
[ "public", "ScanSpec", "withValueMap", "(", "Map", "<", "String", ",", "Object", ">", "valueMap", ")", "{", "if", "(", "valueMap", "==", "null", ")", "this", ".", "valueMap", "=", "null", ";", "else", "this", ".", "valueMap", "=", "Collections", ".", "unmodifiableMap", "(", "new", "LinkedHashMap", "<", "String", ",", "Object", ">", "(", "valueMap", ")", ")", ";", "return", "this", ";", "}" ]
Applicable only when an expression has been specified. Used to specify the actual values for the attribute-value placeholders. @see ScanRequest#withExpressionAttributeValues(Map)
[ "Applicable", "only", "when", "an", "expression", "has", "been", "specified", ".", "Used", "to", "specify", "the", "actual", "values", "for", "the", "attribute", "-", "value", "placeholders", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/spec/ScanSpec.java#L184-L190
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/ST_AsGeoJSON.java
ST_AsGeoJSON.toGeojsonGeometryCollection
public static void toGeojsonGeometryCollection(GeometryCollection geometryCollection, StringBuilder sb) { """ A GeoJSON object with type "GeometryCollection" is a geometry object which represents a collection of geometry objects. A geometry collection must have a member with the name "geometries". The value corresponding to "geometries"is an array. Each element in this array is a GeoJSON geometry object. Syntax: { "type": "GeometryCollection", "geometries": [ { "type": "Point", "coordinates": [100.0, 0.0] }, { "type": "LineString", "coordinates": [ [101.0, 0.0], [102.0, 1.0] ] } ] } @param geometryCollection @param sb """ sb.append("{\"type\":\"GeometryCollection\",\"geometries\":["); for (int i = 0; i < geometryCollection.getNumGeometries(); i++) { Geometry geom = geometryCollection.getGeometryN(i); if (geom instanceof Point) { toGeojsonPoint((Point) geom, sb); } else if (geom instanceof LineString) { toGeojsonLineString((LineString) geom, sb); } else if (geom instanceof Polygon) { toGeojsonPolygon((Polygon) geom, sb); } if (i < geometryCollection.getNumGeometries() - 1) { sb.append(","); } } sb.append("]}"); }
java
public static void toGeojsonGeometryCollection(GeometryCollection geometryCollection, StringBuilder sb) { sb.append("{\"type\":\"GeometryCollection\",\"geometries\":["); for (int i = 0; i < geometryCollection.getNumGeometries(); i++) { Geometry geom = geometryCollection.getGeometryN(i); if (geom instanceof Point) { toGeojsonPoint((Point) geom, sb); } else if (geom instanceof LineString) { toGeojsonLineString((LineString) geom, sb); } else if (geom instanceof Polygon) { toGeojsonPolygon((Polygon) geom, sb); } if (i < geometryCollection.getNumGeometries() - 1) { sb.append(","); } } sb.append("]}"); }
[ "public", "static", "void", "toGeojsonGeometryCollection", "(", "GeometryCollection", "geometryCollection", ",", "StringBuilder", "sb", ")", "{", "sb", ".", "append", "(", "\"{\\\"type\\\":\\\"GeometryCollection\\\",\\\"geometries\\\":[\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "geometryCollection", ".", "getNumGeometries", "(", ")", ";", "i", "++", ")", "{", "Geometry", "geom", "=", "geometryCollection", ".", "getGeometryN", "(", "i", ")", ";", "if", "(", "geom", "instanceof", "Point", ")", "{", "toGeojsonPoint", "(", "(", "Point", ")", "geom", ",", "sb", ")", ";", "}", "else", "if", "(", "geom", "instanceof", "LineString", ")", "{", "toGeojsonLineString", "(", "(", "LineString", ")", "geom", ",", "sb", ")", ";", "}", "else", "if", "(", "geom", "instanceof", "Polygon", ")", "{", "toGeojsonPolygon", "(", "(", "Polygon", ")", "geom", ",", "sb", ")", ";", "}", "if", "(", "i", "<", "geometryCollection", ".", "getNumGeometries", "(", ")", "-", "1", ")", "{", "sb", ".", "append", "(", "\",\"", ")", ";", "}", "}", "sb", ".", "append", "(", "\"]}\"", ")", ";", "}" ]
A GeoJSON object with type "GeometryCollection" is a geometry object which represents a collection of geometry objects. A geometry collection must have a member with the name "geometries". The value corresponding to "geometries"is an array. Each element in this array is a GeoJSON geometry object. Syntax: { "type": "GeometryCollection", "geometries": [ { "type": "Point", "coordinates": [100.0, 0.0] }, { "type": "LineString", "coordinates": [ [101.0, 0.0], [102.0, 1.0] ] } ] } @param geometryCollection @param sb
[ "A", "GeoJSON", "object", "with", "type", "GeometryCollection", "is", "a", "geometry", "object", "which", "represents", "a", "collection", "of", "geometry", "objects", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/ST_AsGeoJSON.java#L256-L272
jdereg/java-util
src/main/java/com/cedarsoftware/util/UrlUtilities.java
UrlUtilities.getContentFromUrl
@Deprecated public static byte[] getContentFromUrl(String url, String proxyServer, int port, Map inCookies, Map outCookies, boolean allowAllCerts) { """ Get content from the passed in URL. This code will open a connection to the passed in server, fetch the requested content, and return it as a byte[]. Anyone using the proxy calls such as this one should have that managed by the jvm with -D parameters: http.proxyHost http.proxyPort (default: 80) http.nonProxyHosts (should always include localhost) https.proxyHost https.proxyPort Example: -Dhttp.proxyHost=proxy.example.org -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxy.example.org -Dhttps.proxyPort=8080 -Dhttp.nonProxyHosts=*.foo.com|localhost|*.td.afg @param url URL to hit @param proxyServer String named of proxy server @param port port to access proxy server @param inCookies Map of session cookies (or null if not needed) @param outCookies Map of session cookies (or null if not needed) @param allowAllCerts if true, SSL connection will always be trusted. @return byte[] of content fetched from URL. @deprecated As of release 1.13.0, replaced by {@link #getContentFromUrl(String, java.util.Map, java.util.Map, boolean)} """ // if proxy server is passed Proxy proxy = null; if (proxyServer != null) { proxy = new Proxy(java.net.Proxy.Type.HTTP, new InetSocketAddress(proxyServer, port)); } return getContentFromUrl(url, inCookies, outCookies, proxy, allowAllCerts); }
java
@Deprecated public static byte[] getContentFromUrl(String url, String proxyServer, int port, Map inCookies, Map outCookies, boolean allowAllCerts) { // if proxy server is passed Proxy proxy = null; if (proxyServer != null) { proxy = new Proxy(java.net.Proxy.Type.HTTP, new InetSocketAddress(proxyServer, port)); } return getContentFromUrl(url, inCookies, outCookies, proxy, allowAllCerts); }
[ "@", "Deprecated", "public", "static", "byte", "[", "]", "getContentFromUrl", "(", "String", "url", ",", "String", "proxyServer", ",", "int", "port", ",", "Map", "inCookies", ",", "Map", "outCookies", ",", "boolean", "allowAllCerts", ")", "{", "// if proxy server is passed", "Proxy", "proxy", "=", "null", ";", "if", "(", "proxyServer", "!=", "null", ")", "{", "proxy", "=", "new", "Proxy", "(", "java", ".", "net", ".", "Proxy", ".", "Type", ".", "HTTP", ",", "new", "InetSocketAddress", "(", "proxyServer", ",", "port", ")", ")", ";", "}", "return", "getContentFromUrl", "(", "url", ",", "inCookies", ",", "outCookies", ",", "proxy", ",", "allowAllCerts", ")", ";", "}" ]
Get content from the passed in URL. This code will open a connection to the passed in server, fetch the requested content, and return it as a byte[]. Anyone using the proxy calls such as this one should have that managed by the jvm with -D parameters: http.proxyHost http.proxyPort (default: 80) http.nonProxyHosts (should always include localhost) https.proxyHost https.proxyPort Example: -Dhttp.proxyHost=proxy.example.org -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxy.example.org -Dhttps.proxyPort=8080 -Dhttp.nonProxyHosts=*.foo.com|localhost|*.td.afg @param url URL to hit @param proxyServer String named of proxy server @param port port to access proxy server @param inCookies Map of session cookies (or null if not needed) @param outCookies Map of session cookies (or null if not needed) @param allowAllCerts if true, SSL connection will always be trusted. @return byte[] of content fetched from URL. @deprecated As of release 1.13.0, replaced by {@link #getContentFromUrl(String, java.util.Map, java.util.Map, boolean)}
[ "Get", "content", "from", "the", "passed", "in", "URL", ".", "This", "code", "will", "open", "a", "connection", "to", "the", "passed", "in", "server", "fetch", "the", "requested", "content", "and", "return", "it", "as", "a", "byte", "[]", "." ]
train
https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/UrlUtilities.java#L923-L934
graphhopper/graphhopper
client-hc/src/main/java/com/graphhopper/api/MatrixResponse.java
MatrixResponse.getWeight
public double getWeight(int from, int to) { """ Returns the weight for the specific entry (from -&gt; to) in arbitrary units ('costs'). """ if (hasErrors()) { throw new IllegalStateException("Cannot return weight (" + from + "," + to + ") if errors occured " + getErrors()); } if (from >= weights.length) { throw new IllegalStateException("Cannot get 'from' " + from + " from weights with size " + weights.length); } else if (to >= weights[from].length) { throw new IllegalStateException("Cannot get 'to' " + to + " from weights with size " + weights[from].length); } return weights[from][to]; }
java
public double getWeight(int from, int to) { if (hasErrors()) { throw new IllegalStateException("Cannot return weight (" + from + "," + to + ") if errors occured " + getErrors()); } if (from >= weights.length) { throw new IllegalStateException("Cannot get 'from' " + from + " from weights with size " + weights.length); } else if (to >= weights[from].length) { throw new IllegalStateException("Cannot get 'to' " + to + " from weights with size " + weights[from].length); } return weights[from][to]; }
[ "public", "double", "getWeight", "(", "int", "from", ",", "int", "to", ")", "{", "if", "(", "hasErrors", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cannot return weight (\"", "+", "from", "+", "\",\"", "+", "to", "+", "\") if errors occured \"", "+", "getErrors", "(", ")", ")", ";", "}", "if", "(", "from", ">=", "weights", ".", "length", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cannot get 'from' \"", "+", "from", "+", "\" from weights with size \"", "+", "weights", ".", "length", ")", ";", "}", "else", "if", "(", "to", ">=", "weights", "[", "from", "]", ".", "length", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cannot get 'to' \"", "+", "to", "+", "\" from weights with size \"", "+", "weights", "[", "from", "]", ".", "length", ")", ";", "}", "return", "weights", "[", "from", "]", "[", "to", "]", ";", "}" ]
Returns the weight for the specific entry (from -&gt; to) in arbitrary units ('costs').
[ "Returns", "the", "weight", "for", "the", "specific", "entry", "(", "from", "-", "&gt", ";", "to", ")", "in", "arbitrary", "units", "(", "costs", ")", "." ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/client-hc/src/main/java/com/graphhopper/api/MatrixResponse.java#L134-L145
bazaarvoice/emodb
web/src/main/java/com/bazaarvoice/emodb/web/migrator/DistributedMigratorRangeMonitor.java
DistributedMigratorRangeMonitor.claimMigrationRangeTasks
private List<ClaimedTask> claimMigrationRangeTasks(int max) { """ Claims migration range tasks that have been queued by the leader and are ready to scan. """ try { Date claimTime = new Date(); List<ScanRangeTask> migrationRangeTasks = _workflow.claimScanRangeTasks(max, QUEUE_CLAIM_TTL); if (migrationRangeTasks.isEmpty()) { return ImmutableList.of(); } List<ClaimedTask> newlyClaimedTasks = Lists.newArrayListWithCapacity(migrationRangeTasks.size()); for (ScanRangeTask task : migrationRangeTasks) { final ClaimedTask claimedTask = new ClaimedTask(task, claimTime); // Record that the task is claimed locally boolean alreadyClaimed = _claimedTasks.putIfAbsent(task.getId(), claimedTask) != null; if (alreadyClaimed) { _log.warn("Workflow returned migration range task that is already claimed: {}", task); // Do not acknowledge the task, let it expire naturally. Eventually it should come up again // after the previous claim has been released. } else { _log.info("Claimed migration range task: {}", task); newlyClaimedTasks.add(claimedTask); // Schedule a follow-up to ensure the scanning service assigns it a thread // in a reasonable amount of time. _backgroundService.schedule( new Runnable() { @Override public void run() { validateClaimedTaskHasStarted(claimedTask); } }, CLAIM_START_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS); } } return newlyClaimedTasks; } catch (Exception e) { _log.error("Failed to start next available migration range", e); return ImmutableList.of(); } }
java
private List<ClaimedTask> claimMigrationRangeTasks(int max) { try { Date claimTime = new Date(); List<ScanRangeTask> migrationRangeTasks = _workflow.claimScanRangeTasks(max, QUEUE_CLAIM_TTL); if (migrationRangeTasks.isEmpty()) { return ImmutableList.of(); } List<ClaimedTask> newlyClaimedTasks = Lists.newArrayListWithCapacity(migrationRangeTasks.size()); for (ScanRangeTask task : migrationRangeTasks) { final ClaimedTask claimedTask = new ClaimedTask(task, claimTime); // Record that the task is claimed locally boolean alreadyClaimed = _claimedTasks.putIfAbsent(task.getId(), claimedTask) != null; if (alreadyClaimed) { _log.warn("Workflow returned migration range task that is already claimed: {}", task); // Do not acknowledge the task, let it expire naturally. Eventually it should come up again // after the previous claim has been released. } else { _log.info("Claimed migration range task: {}", task); newlyClaimedTasks.add(claimedTask); // Schedule a follow-up to ensure the scanning service assigns it a thread // in a reasonable amount of time. _backgroundService.schedule( new Runnable() { @Override public void run() { validateClaimedTaskHasStarted(claimedTask); } }, CLAIM_START_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS); } } return newlyClaimedTasks; } catch (Exception e) { _log.error("Failed to start next available migration range", e); return ImmutableList.of(); } }
[ "private", "List", "<", "ClaimedTask", ">", "claimMigrationRangeTasks", "(", "int", "max", ")", "{", "try", "{", "Date", "claimTime", "=", "new", "Date", "(", ")", ";", "List", "<", "ScanRangeTask", ">", "migrationRangeTasks", "=", "_workflow", ".", "claimScanRangeTasks", "(", "max", ",", "QUEUE_CLAIM_TTL", ")", ";", "if", "(", "migrationRangeTasks", ".", "isEmpty", "(", ")", ")", "{", "return", "ImmutableList", ".", "of", "(", ")", ";", "}", "List", "<", "ClaimedTask", ">", "newlyClaimedTasks", "=", "Lists", ".", "newArrayListWithCapacity", "(", "migrationRangeTasks", ".", "size", "(", ")", ")", ";", "for", "(", "ScanRangeTask", "task", ":", "migrationRangeTasks", ")", "{", "final", "ClaimedTask", "claimedTask", "=", "new", "ClaimedTask", "(", "task", ",", "claimTime", ")", ";", "// Record that the task is claimed locally", "boolean", "alreadyClaimed", "=", "_claimedTasks", ".", "putIfAbsent", "(", "task", ".", "getId", "(", ")", ",", "claimedTask", ")", "!=", "null", ";", "if", "(", "alreadyClaimed", ")", "{", "_log", ".", "warn", "(", "\"Workflow returned migration range task that is already claimed: {}\"", ",", "task", ")", ";", "// Do not acknowledge the task, let it expire naturally. Eventually it should come up again", "// after the previous claim has been released.", "}", "else", "{", "_log", ".", "info", "(", "\"Claimed migration range task: {}\"", ",", "task", ")", ";", "newlyClaimedTasks", ".", "add", "(", "claimedTask", ")", ";", "// Schedule a follow-up to ensure the scanning service assigns it a thread", "// in a reasonable amount of time.", "_backgroundService", ".", "schedule", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "validateClaimedTaskHasStarted", "(", "claimedTask", ")", ";", "}", "}", ",", "CLAIM_START_TIMEOUT", ".", "toMillis", "(", ")", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}", "}", "return", "newlyClaimedTasks", ";", "}", "catch", "(", "Exception", "e", ")", "{", "_log", ".", "error", "(", "\"Failed to start next available migration range\"", ",", "e", ")", ";", "return", "ImmutableList", ".", "of", "(", ")", ";", "}", "}" ]
Claims migration range tasks that have been queued by the leader and are ready to scan.
[ "Claims", "migration", "range", "tasks", "that", "have", "been", "queued", "by", "the", "leader", "and", "are", "ready", "to", "scan", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/migrator/DistributedMigratorRangeMonitor.java#L141-L182
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/MbeanImplCodeGen.java
MbeanImplCodeGen.writeVars
private void writeVars(Definition def, Writer out, int indent) throws IOException { """ Output class vars @param def definition @param out Writer @param indent space number @throws IOException ioException """ writeWithIndent(out, indent, "/** JNDI name */\n"); writeWithIndent(out, indent, "private static final String JNDI_NAME = \"java:/eis/" + def.getDefaultValue() + "\";\n\n"); writeWithIndent(out, indent, "/** MBeanServer instance */\n"); writeWithIndent(out, indent, "private MBeanServer mbeanServer;\n\n"); writeWithIndent(out, indent, "/** Object Name */\n"); writeWithIndent(out, indent, "private String objectName;\n\n"); writeWithIndent(out, indent, "/** The actual ObjectName instance */\n"); writeWithIndent(out, indent, "private ObjectName on;\n\n"); writeWithIndent(out, indent, "/** Registered */\n"); writeWithIndent(out, indent, "private boolean registered;\n\n"); }
java
private void writeVars(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/** JNDI name */\n"); writeWithIndent(out, indent, "private static final String JNDI_NAME = \"java:/eis/" + def.getDefaultValue() + "\";\n\n"); writeWithIndent(out, indent, "/** MBeanServer instance */\n"); writeWithIndent(out, indent, "private MBeanServer mbeanServer;\n\n"); writeWithIndent(out, indent, "/** Object Name */\n"); writeWithIndent(out, indent, "private String objectName;\n\n"); writeWithIndent(out, indent, "/** The actual ObjectName instance */\n"); writeWithIndent(out, indent, "private ObjectName on;\n\n"); writeWithIndent(out, indent, "/** Registered */\n"); writeWithIndent(out, indent, "private boolean registered;\n\n"); }
[ "private", "void", "writeVars", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/** JNDI name */\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"private static final String JNDI_NAME = \\\"java:/eis/\"", "+", "def", ".", "getDefaultValue", "(", ")", "+", "\"\\\";\\n\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/** MBeanServer instance */\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"private MBeanServer mbeanServer;\\n\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/** Object Name */\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"private String objectName;\\n\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/** The actual ObjectName instance */\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"private ObjectName on;\\n\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/** Registered */\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"private boolean registered;\\n\\n\"", ")", ";", "}" ]
Output class vars @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "class", "vars" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/MbeanImplCodeGen.java#L124-L141
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/internal/provisioning/api/MusicOnHoldApi.java
MusicOnHoldApi.sendMOHSettings
public SendMOHSettingsResponse sendMOHSettings(String musicFile, Boolean musicEnabled) throws ApiException { """ Update MOH settings. Adds or updates MOH setting. @param musicFile The Name of WAV file. (required) @param musicEnabled Define is music enabled/disabled. (required) @return SendMOHSettingsResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<SendMOHSettingsResponse> resp = sendMOHSettingsWithHttpInfo(musicFile, musicEnabled); return resp.getData(); }
java
public SendMOHSettingsResponse sendMOHSettings(String musicFile, Boolean musicEnabled) throws ApiException { ApiResponse<SendMOHSettingsResponse> resp = sendMOHSettingsWithHttpInfo(musicFile, musicEnabled); return resp.getData(); }
[ "public", "SendMOHSettingsResponse", "sendMOHSettings", "(", "String", "musicFile", ",", "Boolean", "musicEnabled", ")", "throws", "ApiException", "{", "ApiResponse", "<", "SendMOHSettingsResponse", ">", "resp", "=", "sendMOHSettingsWithHttpInfo", "(", "musicFile", ",", "musicEnabled", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
Update MOH settings. Adds or updates MOH setting. @param musicFile The Name of WAV file. (required) @param musicEnabled Define is music enabled/disabled. (required) @return SendMOHSettingsResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Update", "MOH", "settings", ".", "Adds", "or", "updates", "MOH", "setting", "." ]
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/MusicOnHoldApi.java#L617-L620
alkacon/opencms-core
src/org/opencms/main/OpenCmsServlet.java
OpenCmsServlet.tryCustomErrorPage
private boolean tryCustomErrorPage(CmsObject cms, HttpServletRequest req, HttpServletResponse res, int errorCode) { """ Tries to load a site specific error page. If @param cms {@link CmsObject} used for reading the resource (site root and uri get adjusted!) @param req the current request @param res the current response @param errorCode the error code to display @return a flag, indicating if the custom error page could be loaded. """ String siteRoot = OpenCms.getSiteManager().matchRequest(req).getSiteRoot(); CmsSite site = OpenCms.getSiteManager().getSiteForSiteRoot(siteRoot); if (site != null) { // store current site root and URI String currentSiteRoot = cms.getRequestContext().getSiteRoot(); String currentUri = cms.getRequestContext().getUri(); try { if (site.getErrorPage() != null) { String rootPath = site.getErrorPage(); if (loadCustomErrorPage(cms, req, res, rootPath)) { return true; } } String rootPath = CmsStringUtil.joinPaths(siteRoot, "/.errorpages/handle" + errorCode + ".html"); if (loadCustomErrorPage(cms, req, res, rootPath)) { return true; } } finally { cms.getRequestContext().setSiteRoot(currentSiteRoot); cms.getRequestContext().setUri(currentUri); } } return false; }
java
private boolean tryCustomErrorPage(CmsObject cms, HttpServletRequest req, HttpServletResponse res, int errorCode) { String siteRoot = OpenCms.getSiteManager().matchRequest(req).getSiteRoot(); CmsSite site = OpenCms.getSiteManager().getSiteForSiteRoot(siteRoot); if (site != null) { // store current site root and URI String currentSiteRoot = cms.getRequestContext().getSiteRoot(); String currentUri = cms.getRequestContext().getUri(); try { if (site.getErrorPage() != null) { String rootPath = site.getErrorPage(); if (loadCustomErrorPage(cms, req, res, rootPath)) { return true; } } String rootPath = CmsStringUtil.joinPaths(siteRoot, "/.errorpages/handle" + errorCode + ".html"); if (loadCustomErrorPage(cms, req, res, rootPath)) { return true; } } finally { cms.getRequestContext().setSiteRoot(currentSiteRoot); cms.getRequestContext().setUri(currentUri); } } return false; }
[ "private", "boolean", "tryCustomErrorPage", "(", "CmsObject", "cms", ",", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ",", "int", "errorCode", ")", "{", "String", "siteRoot", "=", "OpenCms", ".", "getSiteManager", "(", ")", ".", "matchRequest", "(", "req", ")", ".", "getSiteRoot", "(", ")", ";", "CmsSite", "site", "=", "OpenCms", ".", "getSiteManager", "(", ")", ".", "getSiteForSiteRoot", "(", "siteRoot", ")", ";", "if", "(", "site", "!=", "null", ")", "{", "// store current site root and URI", "String", "currentSiteRoot", "=", "cms", ".", "getRequestContext", "(", ")", ".", "getSiteRoot", "(", ")", ";", "String", "currentUri", "=", "cms", ".", "getRequestContext", "(", ")", ".", "getUri", "(", ")", ";", "try", "{", "if", "(", "site", ".", "getErrorPage", "(", ")", "!=", "null", ")", "{", "String", "rootPath", "=", "site", ".", "getErrorPage", "(", ")", ";", "if", "(", "loadCustomErrorPage", "(", "cms", ",", "req", ",", "res", ",", "rootPath", ")", ")", "{", "return", "true", ";", "}", "}", "String", "rootPath", "=", "CmsStringUtil", ".", "joinPaths", "(", "siteRoot", ",", "\"/.errorpages/handle\"", "+", "errorCode", "+", "\".html\"", ")", ";", "if", "(", "loadCustomErrorPage", "(", "cms", ",", "req", ",", "res", ",", "rootPath", ")", ")", "{", "return", "true", ";", "}", "}", "finally", "{", "cms", ".", "getRequestContext", "(", ")", ".", "setSiteRoot", "(", "currentSiteRoot", ")", ";", "cms", ".", "getRequestContext", "(", ")", ".", "setUri", "(", "currentUri", ")", ";", "}", "}", "return", "false", ";", "}" ]
Tries to load a site specific error page. If @param cms {@link CmsObject} used for reading the resource (site root and uri get adjusted!) @param req the current request @param res the current response @param errorCode the error code to display @return a flag, indicating if the custom error page could be loaded.
[ "Tries", "to", "load", "a", "site", "specific", "error", "page", ".", "If" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsServlet.java#L398-L423
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/message/Message5WH_Builder.java
Message5WH_Builder.setWhere
public Message5WH_Builder setWhere(Object where, RecognitionException lineAndColumn) { """ Sets the Where? part of the message. Line and column information are taken from the recognition exception, if they are larger than 0. Nothing will be set if the two parameters are null. @param where location for Where? @param lineAndColumn source for the Where? part @return self to allow chaining """ if(where!=null && lineAndColumn!=null){ IsAntlrRuntimeObject iaro = IsAntlrRuntimeObject.create(lineAndColumn); this.setWhere(where, iaro.getLine(), iaro.getColumn()); } return this; }
java
public Message5WH_Builder setWhere(Object where, RecognitionException lineAndColumn){ if(where!=null && lineAndColumn!=null){ IsAntlrRuntimeObject iaro = IsAntlrRuntimeObject.create(lineAndColumn); this.setWhere(where, iaro.getLine(), iaro.getColumn()); } return this; }
[ "public", "Message5WH_Builder", "setWhere", "(", "Object", "where", ",", "RecognitionException", "lineAndColumn", ")", "{", "if", "(", "where", "!=", "null", "&&", "lineAndColumn", "!=", "null", ")", "{", "IsAntlrRuntimeObject", "iaro", "=", "IsAntlrRuntimeObject", ".", "create", "(", "lineAndColumn", ")", ";", "this", ".", "setWhere", "(", "where", ",", "iaro", ".", "getLine", "(", ")", ",", "iaro", ".", "getColumn", "(", ")", ")", ";", "}", "return", "this", ";", "}" ]
Sets the Where? part of the message. Line and column information are taken from the recognition exception, if they are larger than 0. Nothing will be set if the two parameters are null. @param where location for Where? @param lineAndColumn source for the Where? part @return self to allow chaining
[ "Sets", "the", "Where?", "part", "of", "the", "message", ".", "Line", "and", "column", "information", "are", "taken", "from", "the", "recognition", "exception", "if", "they", "are", "larger", "than", "0", ".", "Nothing", "will", "be", "set", "if", "the", "two", "parameters", "are", "null", "." ]
train
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/message/Message5WH_Builder.java#L175-L181
Impetus/Kundera
src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/schemamanager/HBaseSchemaManager.java
HBaseSchemaManager.createOrUpdateTable
private void createOrUpdateTable(String tablename, HTableDescriptor hTableDescriptor) { """ Creates the or update table. @param tablename the tablename @param hTableDescriptor the h table descriptor """ try { if (admin.isTableAvailable(tablename)) { admin.modifyTable(tablename, hTableDescriptor); } else { admin.createTable(hTableDescriptor); } } catch (IOException ioex) { logger.error("Either table isn't in enabled state or some network problem, Caused by: ", ioex); throw new SchemaGenerationException(ioex, "Either table isn't in enabled state or some network problem."); } }
java
private void createOrUpdateTable(String tablename, HTableDescriptor hTableDescriptor) { try { if (admin.isTableAvailable(tablename)) { admin.modifyTable(tablename, hTableDescriptor); } else { admin.createTable(hTableDescriptor); } } catch (IOException ioex) { logger.error("Either table isn't in enabled state or some network problem, Caused by: ", ioex); throw new SchemaGenerationException(ioex, "Either table isn't in enabled state or some network problem."); } }
[ "private", "void", "createOrUpdateTable", "(", "String", "tablename", ",", "HTableDescriptor", "hTableDescriptor", ")", "{", "try", "{", "if", "(", "admin", ".", "isTableAvailable", "(", "tablename", ")", ")", "{", "admin", ".", "modifyTable", "(", "tablename", ",", "hTableDescriptor", ")", ";", "}", "else", "{", "admin", ".", "createTable", "(", "hTableDescriptor", ")", ";", "}", "}", "catch", "(", "IOException", "ioex", ")", "{", "logger", ".", "error", "(", "\"Either table isn't in enabled state or some network problem, Caused by: \"", ",", "ioex", ")", ";", "throw", "new", "SchemaGenerationException", "(", "ioex", ",", "\"Either table isn't in enabled state or some network problem.\"", ")", ";", "}", "}" ]
Creates the or update table. @param tablename the tablename @param hTableDescriptor the h table descriptor
[ "Creates", "the", "or", "update", "table", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/schemamanager/HBaseSchemaManager.java#L456-L474
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/ValidationObjUtil.java
ValidationObjUtil.objectDeepCopyWithBlackList
public static <T> T objectDeepCopyWithBlackList(Object from, Object to, Class<?> baseClass, String... blockFields) { """ Object deep copy with black list t. @param <T> the type parameter @param from the from @param to the to @param baseClass the base class @param blockFields the block fields @return the t """ List<String> bFields = getDeclaredFields(baseClass); for (String blockField : blockFields) { bFields.add(blockField); } return objectDeepCopyWithBlackList(from, to, bFields.toArray(new String[bFields.size()])); }
java
public static <T> T objectDeepCopyWithBlackList(Object from, Object to, Class<?> baseClass, String... blockFields) { List<String> bFields = getDeclaredFields(baseClass); for (String blockField : blockFields) { bFields.add(blockField); } return objectDeepCopyWithBlackList(from, to, bFields.toArray(new String[bFields.size()])); }
[ "public", "static", "<", "T", ">", "T", "objectDeepCopyWithBlackList", "(", "Object", "from", ",", "Object", "to", ",", "Class", "<", "?", ">", "baseClass", ",", "String", "...", "blockFields", ")", "{", "List", "<", "String", ">", "bFields", "=", "getDeclaredFields", "(", "baseClass", ")", ";", "for", "(", "String", "blockField", ":", "blockFields", ")", "{", "bFields", ".", "add", "(", "blockField", ")", ";", "}", "return", "objectDeepCopyWithBlackList", "(", "from", ",", "to", ",", "bFields", ".", "toArray", "(", "new", "String", "[", "bFields", ".", "size", "(", ")", "]", ")", ")", ";", "}" ]
Object deep copy with black list t. @param <T> the type parameter @param from the from @param to the to @param baseClass the base class @param blockFields the block fields @return the t
[ "Object", "deep", "copy", "with", "black", "list", "t", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/ValidationObjUtil.java#L435-L444
aws/aws-sdk-java
aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/RouteResponse.java
RouteResponse.withResponseModels
public RouteResponse withResponseModels(java.util.Map<String, String> responseModels) { """ <p> Represents the response models of a route response. </p> @param responseModels Represents the response models of a route response. @return Returns a reference to this object so that method calls can be chained together. """ setResponseModels(responseModels); return this; }
java
public RouteResponse withResponseModels(java.util.Map<String, String> responseModels) { setResponseModels(responseModels); return this; }
[ "public", "RouteResponse", "withResponseModels", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "responseModels", ")", "{", "setResponseModels", "(", "responseModels", ")", ";", "return", "this", ";", "}" ]
<p> Represents the response models of a route response. </p> @param responseModels Represents the response models of a route response. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Represents", "the", "response", "models", "of", "a", "route", "response", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/RouteResponse.java#L134-L137
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.deletePrebuiltAsync
public Observable<OperationStatus> deletePrebuiltAsync(UUID appId, String versionId, UUID prebuiltId) { """ Deletes a prebuilt entity extractor from the application. @param appId The application ID. @param versionId The version ID. @param prebuiltId The prebuilt entity extractor ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object """ return deletePrebuiltWithServiceResponseAsync(appId, versionId, prebuiltId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> deletePrebuiltAsync(UUID appId, String versionId, UUID prebuiltId) { return deletePrebuiltWithServiceResponseAsync(appId, versionId, prebuiltId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "deletePrebuiltAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "prebuiltId", ")", "{", "return", "deletePrebuiltWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "prebuiltId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "OperationStatus", ">", ",", "OperationStatus", ">", "(", ")", "{", "@", "Override", "public", "OperationStatus", "call", "(", "ServiceResponse", "<", "OperationStatus", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Deletes a prebuilt entity extractor from the application. @param appId The application ID. @param versionId The version ID. @param prebuiltId The prebuilt entity extractor ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Deletes", "a", "prebuilt", "entity", "extractor", "from", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L4807-L4814
ow2-chameleon/fuchsia
bases/knx/calimero/src/main/java/tuwien/auto/calimero/link/medium/RawFrameFactory.java
RawFrameFactory.createPL110
public static RawFrame createPL110(byte[] data, int offset) throws KNXFormatException { """ Creates a raw frame out of a byte array for the PL110 communication medium. <p> @param data byte array containing the PL110 raw frame structure @param offset start offset of frame structure in <code>data</code>, 0 &lt;= offset &lt; <code>data.length</code> @return the created PL110 raw frame @throws KNXFormatException on no valid frame structure """ if ((data[0] & 0x10) == 0x10) return new PL110LData(data, offset); return new PL110Ack(data, offset); }
java
public static RawFrame createPL110(byte[] data, int offset) throws KNXFormatException { if ((data[0] & 0x10) == 0x10) return new PL110LData(data, offset); return new PL110Ack(data, offset); }
[ "public", "static", "RawFrame", "createPL110", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "throws", "KNXFormatException", "{", "if", "(", "(", "data", "[", "0", "]", "&", "0x10", ")", "==", "0x10", ")", "return", "new", "PL110LData", "(", "data", ",", "offset", ")", ";", "return", "new", "PL110Ack", "(", "data", ",", "offset", ")", ";", "}" ]
Creates a raw frame out of a byte array for the PL110 communication medium. <p> @param data byte array containing the PL110 raw frame structure @param offset start offset of frame structure in <code>data</code>, 0 &lt;= offset &lt; <code>data.length</code> @return the created PL110 raw frame @throws KNXFormatException on no valid frame structure
[ "Creates", "a", "raw", "frame", "out", "of", "a", "byte", "array", "for", "the", "PL110", "communication", "medium", ".", "<p", ">" ]
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/link/medium/RawFrameFactory.java#L140-L145
jenkinsci/jenkins
core/src/main/java/hudson/model/AbstractProject.java
AbstractProject.checkAndRecord
private void checkAndRecord(AbstractProject that, TreeMap<Integer, RangeSet> r, Collection<R> builds) { """ Helper method for getDownstreamRelationship. For each given build, find the build number range of the given project and put that into the map. """ for (R build : builds) { RangeSet rs = build.getDownstreamRelationship(that); if(rs==null || rs.isEmpty()) continue; int n = build.getNumber(); RangeSet value = r.get(n); if(value==null) r.put(n,rs); else value.add(rs); } }
java
private void checkAndRecord(AbstractProject that, TreeMap<Integer, RangeSet> r, Collection<R> builds) { for (R build : builds) { RangeSet rs = build.getDownstreamRelationship(that); if(rs==null || rs.isEmpty()) continue; int n = build.getNumber(); RangeSet value = r.get(n); if(value==null) r.put(n,rs); else value.add(rs); } }
[ "private", "void", "checkAndRecord", "(", "AbstractProject", "that", ",", "TreeMap", "<", "Integer", ",", "RangeSet", ">", "r", ",", "Collection", "<", "R", ">", "builds", ")", "{", "for", "(", "R", "build", ":", "builds", ")", "{", "RangeSet", "rs", "=", "build", ".", "getDownstreamRelationship", "(", "that", ")", ";", "if", "(", "rs", "==", "null", "||", "rs", ".", "isEmpty", "(", ")", ")", "continue", ";", "int", "n", "=", "build", ".", "getNumber", "(", ")", ";", "RangeSet", "value", "=", "r", ".", "get", "(", "n", ")", ";", "if", "(", "value", "==", "null", ")", "r", ".", "put", "(", "n", ",", "rs", ")", ";", "else", "value", ".", "add", "(", "rs", ")", ";", "}", "}" ]
Helper method for getDownstreamRelationship. For each given build, find the build number range of the given project and put that into the map.
[ "Helper", "method", "for", "getDownstreamRelationship", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/AbstractProject.java#L1660-L1674
UrielCh/ovh-java-sdk
ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java
ApiOvhRouter.serviceName_privateLink_peerServiceName_PUT
public void serviceName_privateLink_peerServiceName_PUT(String serviceName, String peerServiceName, OvhPrivateLink body) throws IOException { """ Alter this object properties REST: PUT /router/{serviceName}/privateLink/{peerServiceName} @param body [required] New object properties @param serviceName [required] The internal name of your Router offer @param peerServiceName [required] Service name of the other side of this link """ String qPath = "/router/{serviceName}/privateLink/{peerServiceName}"; StringBuilder sb = path(qPath, serviceName, peerServiceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_privateLink_peerServiceName_PUT(String serviceName, String peerServiceName, OvhPrivateLink body) throws IOException { String qPath = "/router/{serviceName}/privateLink/{peerServiceName}"; StringBuilder sb = path(qPath, serviceName, peerServiceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_privateLink_peerServiceName_PUT", "(", "String", "serviceName", ",", "String", "peerServiceName", ",", "OvhPrivateLink", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/router/{serviceName}/privateLink/{peerServiceName}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "peerServiceName", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /router/{serviceName}/privateLink/{peerServiceName} @param body [required] New object properties @param serviceName [required] The internal name of your Router offer @param peerServiceName [required] Service name of the other side of this link
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java#L331-L335
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/QueryRequest.java
QueryRequest.withExclusiveStartKey
public QueryRequest withExclusiveStartKey(java.util.Map<String, AttributeValue> exclusiveStartKey) { """ <p> The primary key of the first item that this operation will evaluate. Use the value that was returned for <code>LastEvaluatedKey</code> in the previous operation. </p> <p> The data type for <code>ExclusiveStartKey</code> must be String, Number or Binary. No set data types are allowed. </p> @param exclusiveStartKey The primary key of the first item that this operation will evaluate. Use the value that was returned for <code>LastEvaluatedKey</code> in the previous operation.</p> <p> The data type for <code>ExclusiveStartKey</code> must be String, Number or Binary. No set data types are allowed. @return Returns a reference to this object so that method calls can be chained together. """ setExclusiveStartKey(exclusiveStartKey); return this; }
java
public QueryRequest withExclusiveStartKey(java.util.Map<String, AttributeValue> exclusiveStartKey) { setExclusiveStartKey(exclusiveStartKey); return this; }
[ "public", "QueryRequest", "withExclusiveStartKey", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "AttributeValue", ">", "exclusiveStartKey", ")", "{", "setExclusiveStartKey", "(", "exclusiveStartKey", ")", ";", "return", "this", ";", "}" ]
<p> The primary key of the first item that this operation will evaluate. Use the value that was returned for <code>LastEvaluatedKey</code> in the previous operation. </p> <p> The data type for <code>ExclusiveStartKey</code> must be String, Number or Binary. No set data types are allowed. </p> @param exclusiveStartKey The primary key of the first item that this operation will evaluate. Use the value that was returned for <code>LastEvaluatedKey</code> in the previous operation.</p> <p> The data type for <code>ExclusiveStartKey</code> must be String, Number or Binary. No set data types are allowed. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "primary", "key", "of", "the", "first", "item", "that", "this", "operation", "will", "evaluate", ".", "Use", "the", "value", "that", "was", "returned", "for", "<code", ">", "LastEvaluatedKey<", "/", "code", ">", "in", "the", "previous", "operation", ".", "<", "/", "p", ">", "<p", ">", "The", "data", "type", "for", "<code", ">", "ExclusiveStartKey<", "/", "code", ">", "must", "be", "String", "Number", "or", "Binary", ".", "No", "set", "data", "types", "are", "allowed", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/QueryRequest.java#L1866-L1869
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/lof/LOF.java
LOF.computeLOFScores
private void computeLOFScores(KNNQuery<O> knnq, DBIDs ids, DoubleDataStore lrds, WritableDoubleDataStore lofs, DoubleMinMax lofminmax) { """ Compute local outlier factors. @param knnq KNN query @param ids IDs to process @param lrds Local reachability distances @param lofs Local outlier factor storage @param lofminmax Score minimum/maximum tracker """ FiniteProgress progressLOFs = LOG.isVerbose() ? new FiniteProgress("Local Outlier Factor (LOF) scores", ids.size(), LOG) : null; double lof; for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { lof = computeLOFScore(knnq, iter, lrds); lofs.putDouble(iter, lof); // update minimum and maximum lofminmax.put(lof); LOG.incrementProcessed(progressLOFs); } LOG.ensureCompleted(progressLOFs); }
java
private void computeLOFScores(KNNQuery<O> knnq, DBIDs ids, DoubleDataStore lrds, WritableDoubleDataStore lofs, DoubleMinMax lofminmax) { FiniteProgress progressLOFs = LOG.isVerbose() ? new FiniteProgress("Local Outlier Factor (LOF) scores", ids.size(), LOG) : null; double lof; for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { lof = computeLOFScore(knnq, iter, lrds); lofs.putDouble(iter, lof); // update minimum and maximum lofminmax.put(lof); LOG.incrementProcessed(progressLOFs); } LOG.ensureCompleted(progressLOFs); }
[ "private", "void", "computeLOFScores", "(", "KNNQuery", "<", "O", ">", "knnq", ",", "DBIDs", "ids", ",", "DoubleDataStore", "lrds", ",", "WritableDoubleDataStore", "lofs", ",", "DoubleMinMax", "lofminmax", ")", "{", "FiniteProgress", "progressLOFs", "=", "LOG", ".", "isVerbose", "(", ")", "?", "new", "FiniteProgress", "(", "\"Local Outlier Factor (LOF) scores\"", ",", "ids", ".", "size", "(", ")", ",", "LOG", ")", ":", "null", ";", "double", "lof", ";", "for", "(", "DBIDIter", "iter", "=", "ids", ".", "iter", "(", ")", ";", "iter", ".", "valid", "(", ")", ";", "iter", ".", "advance", "(", ")", ")", "{", "lof", "=", "computeLOFScore", "(", "knnq", ",", "iter", ",", "lrds", ")", ";", "lofs", ".", "putDouble", "(", "iter", ",", "lof", ")", ";", "// update minimum and maximum", "lofminmax", ".", "put", "(", "lof", ")", ";", "LOG", ".", "incrementProcessed", "(", "progressLOFs", ")", ";", "}", "LOG", ".", "ensureCompleted", "(", "progressLOFs", ")", ";", "}" ]
Compute local outlier factors. @param knnq KNN query @param ids IDs to process @param lrds Local reachability distances @param lofs Local outlier factor storage @param lofminmax Score minimum/maximum tracker
[ "Compute", "local", "outlier", "factors", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/lof/LOF.java#L202-L213
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java
ExcelUtil.read03BySax
public static Excel03SaxReader read03BySax(File file, int sheetIndex, RowHandler rowHandler) { """ Sax方式读取Excel03 @param file 文件 @param sheetIndex Sheet索引,-1表示全部Sheet, 0表示第一个Sheet @param rowHandler 行处理器 @return {@link Excel03SaxReader} @since 3.2.0 """ try { return new Excel03SaxReader(rowHandler).read(file, sheetIndex); } catch (NoClassDefFoundError e) { throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG); } }
java
public static Excel03SaxReader read03BySax(File file, int sheetIndex, RowHandler rowHandler) { try { return new Excel03SaxReader(rowHandler).read(file, sheetIndex); } catch (NoClassDefFoundError e) { throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG); } }
[ "public", "static", "Excel03SaxReader", "read03BySax", "(", "File", "file", ",", "int", "sheetIndex", ",", "RowHandler", "rowHandler", ")", "{", "try", "{", "return", "new", "Excel03SaxReader", "(", "rowHandler", ")", ".", "read", "(", "file", ",", "sheetIndex", ")", ";", "}", "catch", "(", "NoClassDefFoundError", "e", ")", "{", "throw", "new", "DependencyException", "(", "ObjectUtil", ".", "defaultIfNull", "(", "e", ".", "getCause", "(", ")", ",", "e", ")", ",", "PoiChecker", ".", "NO_POI_ERROR_MSG", ")", ";", "}", "}" ]
Sax方式读取Excel03 @param file 文件 @param sheetIndex Sheet索引,-1表示全部Sheet, 0表示第一个Sheet @param rowHandler 行处理器 @return {@link Excel03SaxReader} @since 3.2.0
[ "Sax方式读取Excel03" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L157-L163
op4j/op4j
src/main/java/org/op4j/functions/FnNumber.java
FnNumber.roundBigDecimal
public static final Function<BigDecimal,BigDecimal> roundBigDecimal(final int scale, final RoundingMode roundingMode) { """ <p> It rounds the target object with the specified scale and rounding mode </p> @param scale the scale to be used @param roundingMode the {@link RoundingMode} to round the input with @return the {@link BigDecimal} """ return new RoundBigDecimal(scale, roundingMode); }
java
public static final Function<BigDecimal,BigDecimal> roundBigDecimal(final int scale, final RoundingMode roundingMode) { return new RoundBigDecimal(scale, roundingMode); }
[ "public", "static", "final", "Function", "<", "BigDecimal", ",", "BigDecimal", ">", "roundBigDecimal", "(", "final", "int", "scale", ",", "final", "RoundingMode", "roundingMode", ")", "{", "return", "new", "RoundBigDecimal", "(", "scale", ",", "roundingMode", ")", ";", "}" ]
<p> It rounds the target object with the specified scale and rounding mode </p> @param scale the scale to be used @param roundingMode the {@link RoundingMode} to round the input with @return the {@link BigDecimal}
[ "<p", ">", "It", "rounds", "the", "target", "object", "with", "the", "specified", "scale", "and", "rounding", "mode", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnNumber.java#L278-L280
hawkular/hawkular-apm
api/src/main/java/org/hawkular/apm/api/model/config/CollectorConfiguration.java
CollectorConfiguration.getProperty
public String getProperty(String name, String def) { """ This method returns the property associated with the supplied name. The system properties will be checked first, and if not available, then the collector configuration properties. @param name The name of the required property @param def The optional default value @return The property value, or if not found then the default """ String ret=PropertyUtil.getProperty(name, null); if (ret == null) { if (getProperties().containsKey(name)) { ret = getProperties().get(name); } else { ret = def; } } if (log.isLoggable(Level.FINEST)) { log.finest("Get property '"+name+"' (default="+def+") = "+ret); } return ret; }
java
public String getProperty(String name, String def) { String ret=PropertyUtil.getProperty(name, null); if (ret == null) { if (getProperties().containsKey(name)) { ret = getProperties().get(name); } else { ret = def; } } if (log.isLoggable(Level.FINEST)) { log.finest("Get property '"+name+"' (default="+def+") = "+ret); } return ret; }
[ "public", "String", "getProperty", "(", "String", "name", ",", "String", "def", ")", "{", "String", "ret", "=", "PropertyUtil", ".", "getProperty", "(", "name", ",", "null", ")", ";", "if", "(", "ret", "==", "null", ")", "{", "if", "(", "getProperties", "(", ")", ".", "containsKey", "(", "name", ")", ")", "{", "ret", "=", "getProperties", "(", ")", ".", "get", "(", "name", ")", ";", "}", "else", "{", "ret", "=", "def", ";", "}", "}", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINEST", ")", ")", "{", "log", ".", "finest", "(", "\"Get property '\"", "+", "name", "+", "\"' (default=\"", "+", "def", "+", "\") = \"", "+", "ret", ")", ";", "}", "return", "ret", ";", "}" ]
This method returns the property associated with the supplied name. The system properties will be checked first, and if not available, then the collector configuration properties. @param name The name of the required property @param def The optional default value @return The property value, or if not found then the default
[ "This", "method", "returns", "the", "property", "associated", "with", "the", "supplied", "name", ".", "The", "system", "properties", "will", "be", "checked", "first", "and", "if", "not", "available", "then", "the", "collector", "configuration", "properties", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/api/src/main/java/org/hawkular/apm/api/model/config/CollectorConfiguration.java#L72-L87
eurekaclinical/eurekaclinical-common
src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java
EurekaClinicalClient.doGet
protected <T> T doGet(String path, Class<T> cls, MultivaluedMap<String, String> headers) throws ClientException { """ Gets the resource specified by the path. @param <T> the type of the resource. @param path the path to the resource. Cannot be <code>null</code>. @param cls the type of the resource. Cannot be <code>null</code>. @param headers any headers. if no Accepts header is provided, an Accepts header for JSON will be added. @return the resource. @throws ClientException if a status code other than 200 (OK) is returned. """ this.readLock.lock(); try { WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.GET).getRequestBuilder(); requestBuilder = ensureJsonHeaders(headers, requestBuilder, false, true); ClientResponse response = requestBuilder.get(ClientResponse.class); errorIfStatusNotEqualTo(response, ClientResponse.Status.OK); return response.getEntity(cls); } catch (ClientHandlerException ex) { throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage()); } finally { this.readLock.unlock(); } }
java
protected <T> T doGet(String path, Class<T> cls, MultivaluedMap<String, String> headers) throws ClientException { this.readLock.lock(); try { WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.GET).getRequestBuilder(); requestBuilder = ensureJsonHeaders(headers, requestBuilder, false, true); ClientResponse response = requestBuilder.get(ClientResponse.class); errorIfStatusNotEqualTo(response, ClientResponse.Status.OK); return response.getEntity(cls); } catch (ClientHandlerException ex) { throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage()); } finally { this.readLock.unlock(); } }
[ "protected", "<", "T", ">", "T", "doGet", "(", "String", "path", ",", "Class", "<", "T", ">", "cls", ",", "MultivaluedMap", "<", "String", ",", "String", ">", "headers", ")", "throws", "ClientException", "{", "this", ".", "readLock", ".", "lock", "(", ")", ";", "try", "{", "WebResource", ".", "Builder", "requestBuilder", "=", "getResourceWrapper", "(", ")", ".", "rewritten", "(", "path", ",", "HttpMethod", ".", "GET", ")", ".", "getRequestBuilder", "(", ")", ";", "requestBuilder", "=", "ensureJsonHeaders", "(", "headers", ",", "requestBuilder", ",", "false", ",", "true", ")", ";", "ClientResponse", "response", "=", "requestBuilder", ".", "get", "(", "ClientResponse", ".", "class", ")", ";", "errorIfStatusNotEqualTo", "(", "response", ",", "ClientResponse", ".", "Status", ".", "OK", ")", ";", "return", "response", ".", "getEntity", "(", "cls", ")", ";", "}", "catch", "(", "ClientHandlerException", "ex", ")", "{", "throw", "new", "ClientException", "(", "ClientResponse", ".", "Status", ".", "INTERNAL_SERVER_ERROR", ",", "ex", ".", "getMessage", "(", ")", ")", ";", "}", "finally", "{", "this", ".", "readLock", ".", "unlock", "(", ")", ";", "}", "}" ]
Gets the resource specified by the path. @param <T> the type of the resource. @param path the path to the resource. Cannot be <code>null</code>. @param cls the type of the resource. Cannot be <code>null</code>. @param headers any headers. if no Accepts header is provided, an Accepts header for JSON will be added. @return the resource. @throws ClientException if a status code other than 200 (OK) is returned.
[ "Gets", "the", "resource", "specified", "by", "the", "path", "." ]
train
https://github.com/eurekaclinical/eurekaclinical-common/blob/1867102ff43fe94e519f76a074d5f5923e9be61c/src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java#L242-L255
calimero-project/calimero-core
src/tuwien/auto/calimero/knxnetip/servicetype/PacketHelper.java
PacketHelper.toPacket
public static byte[] toPacket(final ServiceType type) { """ Creates a packet with a KNXnet/IP message header v1.0, containing the specified service <code>type</code>, and generates the corresponding byte representation of this structure. @param type service type to pack @return the packet as byte array """ final KNXnetIPHeader h = new KNXnetIPHeader(type.svcType, type.getStructLength()); final ByteArrayOutputStream os = new ByteArrayOutputStream(h.getTotalLength()); os.write(h.toByteArray(), 0, h.getStructLength()); return type.toByteArray(os); }
java
public static byte[] toPacket(final ServiceType type) { final KNXnetIPHeader h = new KNXnetIPHeader(type.svcType, type.getStructLength()); final ByteArrayOutputStream os = new ByteArrayOutputStream(h.getTotalLength()); os.write(h.toByteArray(), 0, h.getStructLength()); return type.toByteArray(os); }
[ "public", "static", "byte", "[", "]", "toPacket", "(", "final", "ServiceType", "type", ")", "{", "final", "KNXnetIPHeader", "h", "=", "new", "KNXnetIPHeader", "(", "type", ".", "svcType", ",", "type", ".", "getStructLength", "(", ")", ")", ";", "final", "ByteArrayOutputStream", "os", "=", "new", "ByteArrayOutputStream", "(", "h", ".", "getTotalLength", "(", ")", ")", ";", "os", ".", "write", "(", "h", ".", "toByteArray", "(", ")", ",", "0", ",", "h", ".", "getStructLength", "(", ")", ")", ";", "return", "type", ".", "toByteArray", "(", "os", ")", ";", "}" ]
Creates a packet with a KNXnet/IP message header v1.0, containing the specified service <code>type</code>, and generates the corresponding byte representation of this structure. @param type service type to pack @return the packet as byte array
[ "Creates", "a", "packet", "with", "a", "KNXnet", "/", "IP", "message", "header", "v1", ".", "0", "containing", "the", "specified", "service", "<code", ">", "type<", "/", "code", ">", "and", "generates", "the", "corresponding", "byte", "representation", "of", "this", "structure", "." ]
train
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/knxnetip/servicetype/PacketHelper.java#L63-L69
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/util/ByteBufJsonHelper.java
ByteBufJsonHelper.findSectionClosingPosition
public static int findSectionClosingPosition(ByteBuf buf, int startOffset, char openingChar, char closingChar) { """ Finds the position of the correct closing character, taking into account the fact that before the correct one, other sub section with same opening and closing characters can be encountered. This implementation starts for the current {@link ByteBuf#readerIndex() readerIndex} + startOffset. @param buf the {@link ByteBuf} where to search for the end of a section enclosed in openingChar and closingChar. @param startOffset the offset at which to start reading (from buffer's readerIndex). @param openingChar the section opening char, used to detect a sub-section. @param closingChar the section closing char, used to detect the end of a sub-section / this section. @return the section closing position or -1 if not found. """ int from = buf.readerIndex() + startOffset; int length = buf.writerIndex() - from; if (length < 0) { throw new IllegalArgumentException("startOffset must not go beyond the readable byte length of the buffer"); } return buf.forEachByte(from, length, new ClosingPositionBufProcessor(openingChar, closingChar, true)); }
java
public static int findSectionClosingPosition(ByteBuf buf, int startOffset, char openingChar, char closingChar) { int from = buf.readerIndex() + startOffset; int length = buf.writerIndex() - from; if (length < 0) { throw new IllegalArgumentException("startOffset must not go beyond the readable byte length of the buffer"); } return buf.forEachByte(from, length, new ClosingPositionBufProcessor(openingChar, closingChar, true)); }
[ "public", "static", "int", "findSectionClosingPosition", "(", "ByteBuf", "buf", ",", "int", "startOffset", ",", "char", "openingChar", ",", "char", "closingChar", ")", "{", "int", "from", "=", "buf", ".", "readerIndex", "(", ")", "+", "startOffset", ";", "int", "length", "=", "buf", ".", "writerIndex", "(", ")", "-", "from", ";", "if", "(", "length", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"startOffset must not go beyond the readable byte length of the buffer\"", ")", ";", "}", "return", "buf", ".", "forEachByte", "(", "from", ",", "length", ",", "new", "ClosingPositionBufProcessor", "(", "openingChar", ",", "closingChar", ",", "true", ")", ")", ";", "}" ]
Finds the position of the correct closing character, taking into account the fact that before the correct one, other sub section with same opening and closing characters can be encountered. This implementation starts for the current {@link ByteBuf#readerIndex() readerIndex} + startOffset. @param buf the {@link ByteBuf} where to search for the end of a section enclosed in openingChar and closingChar. @param startOffset the offset at which to start reading (from buffer's readerIndex). @param openingChar the section opening char, used to detect a sub-section. @param closingChar the section closing char, used to detect the end of a sub-section / this section. @return the section closing position or -1 if not found.
[ "Finds", "the", "position", "of", "the", "correct", "closing", "character", "taking", "into", "account", "the", "fact", "that", "before", "the", "correct", "one", "other", "sub", "section", "with", "same", "opening", "and", "closing", "characters", "can", "be", "encountered", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/util/ByteBufJsonHelper.java#L120-L129
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java
DevicesInner.installUpdates
public void installUpdates(String deviceName, String resourceGroupName) { """ Installs the updates on the data box edge/gateway device. @param deviceName The device name. @param resourceGroupName The resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ installUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).toBlocking().last().body(); }
java
public void installUpdates(String deviceName, String resourceGroupName) { installUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).toBlocking().last().body(); }
[ "public", "void", "installUpdates", "(", "String", "deviceName", ",", "String", "resourceGroupName", ")", "{", "installUpdatesWithServiceResponseAsync", "(", "deviceName", ",", "resourceGroupName", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Installs the updates on the data box edge/gateway device. @param deviceName The device name. @param resourceGroupName The resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Installs", "the", "updates", "on", "the", "data", "box", "edge", "/", "gateway", "device", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L1442-L1444
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java
RecommendationsInner.resetAllFiltersForWebAppAsync
public Observable<Void> resetAllFiltersForWebAppAsync(String resourceGroupName, String siteName) { """ Reset all recommendation opt-out settings for an app. Reset all recommendation opt-out settings for an app. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Name of the app. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return resetAllFiltersForWebAppWithServiceResponseAsync(resourceGroupName, siteName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> resetAllFiltersForWebAppAsync(String resourceGroupName, String siteName) { return resetAllFiltersForWebAppWithServiceResponseAsync(resourceGroupName, siteName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "resetAllFiltersForWebAppAsync", "(", "String", "resourceGroupName", ",", "String", "siteName", ")", "{", "return", "resetAllFiltersForWebAppWithServiceResponseAsync", "(", "resourceGroupName", ",", "siteName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Reset all recommendation opt-out settings for an app. Reset all recommendation opt-out settings for an app. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Name of the app. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Reset", "all", "recommendation", "opt", "-", "out", "settings", "for", "an", "app", ".", "Reset", "all", "recommendation", "opt", "-", "out", "settings", "for", "an", "app", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java#L1146-L1153
alkacon/opencms-core
src/org/opencms/search/galleries/CmsGallerySearch.java
CmsGallerySearch.searchById
public CmsGallerySearchResult searchById(CmsUUID id, Locale locale) throws CmsException { """ Searches by structure id.<p> @param id the structure id of the document to search for @param locale the locale for which the search result should be returned @return the search result @throws CmsException if something goes wrong """ I_CmsSearchDocument sDoc = m_index.getDocument( CmsSearchField.FIELD_ID, id.toString(), CmsGallerySearchResult.getRequiredSolrFields()); CmsGallerySearchResult result = null; if ((sDoc != null) && (sDoc.getDocument() != null)) { result = new CmsGallerySearchResult(sDoc, m_cms, 100, locale); } else { CmsResource res = m_cms.readResource(id, CmsResourceFilter.ALL); result = new CmsGallerySearchResult(m_cms, res); } return result; }
java
public CmsGallerySearchResult searchById(CmsUUID id, Locale locale) throws CmsException { I_CmsSearchDocument sDoc = m_index.getDocument( CmsSearchField.FIELD_ID, id.toString(), CmsGallerySearchResult.getRequiredSolrFields()); CmsGallerySearchResult result = null; if ((sDoc != null) && (sDoc.getDocument() != null)) { result = new CmsGallerySearchResult(sDoc, m_cms, 100, locale); } else { CmsResource res = m_cms.readResource(id, CmsResourceFilter.ALL); result = new CmsGallerySearchResult(m_cms, res); } return result; }
[ "public", "CmsGallerySearchResult", "searchById", "(", "CmsUUID", "id", ",", "Locale", "locale", ")", "throws", "CmsException", "{", "I_CmsSearchDocument", "sDoc", "=", "m_index", ".", "getDocument", "(", "CmsSearchField", ".", "FIELD_ID", ",", "id", ".", "toString", "(", ")", ",", "CmsGallerySearchResult", ".", "getRequiredSolrFields", "(", ")", ")", ";", "CmsGallerySearchResult", "result", "=", "null", ";", "if", "(", "(", "sDoc", "!=", "null", ")", "&&", "(", "sDoc", ".", "getDocument", "(", ")", "!=", "null", ")", ")", "{", "result", "=", "new", "CmsGallerySearchResult", "(", "sDoc", ",", "m_cms", ",", "100", ",", "locale", ")", ";", "}", "else", "{", "CmsResource", "res", "=", "m_cms", ".", "readResource", "(", "id", ",", "CmsResourceFilter", ".", "ALL", ")", ";", "result", "=", "new", "CmsGallerySearchResult", "(", "m_cms", ",", "res", ")", ";", "}", "return", "result", ";", "}" ]
Searches by structure id.<p> @param id the structure id of the document to search for @param locale the locale for which the search result should be returned @return the search result @throws CmsException if something goes wrong
[ "Searches", "by", "structure", "id", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/galleries/CmsGallerySearch.java#L169-L184
apollographql/apollo-android
apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java
ResponseField.forList
public static ResponseField forList(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { """ Factory method for creating a Field instance representing {@link Type#LIST}. @param responseName alias for the result of a field @param fieldName name of the field in the GraphQL operation @param arguments arguments to be passed along with the field @param optional whether the arguments passed along are optional or required @param conditions list of conditions for this field @return Field instance representing {@link Type#LIST} """ return new ResponseField(Type.LIST, responseName, fieldName, arguments, optional, conditions); }
java
public static ResponseField forList(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { return new ResponseField(Type.LIST, responseName, fieldName, arguments, optional, conditions); }
[ "public", "static", "ResponseField", "forList", "(", "String", "responseName", ",", "String", "fieldName", ",", "Map", "<", "String", ",", "Object", ">", "arguments", ",", "boolean", "optional", ",", "List", "<", "Condition", ">", "conditions", ")", "{", "return", "new", "ResponseField", "(", "Type", ".", "LIST", ",", "responseName", ",", "fieldName", ",", "arguments", ",", "optional", ",", "conditions", ")", ";", "}" ]
Factory method for creating a Field instance representing {@link Type#LIST}. @param responseName alias for the result of a field @param fieldName name of the field in the GraphQL operation @param arguments arguments to be passed along with the field @param optional whether the arguments passed along are optional or required @param conditions list of conditions for this field @return Field instance representing {@link Type#LIST}
[ "Factory", "method", "for", "creating", "a", "Field", "instance", "representing", "{", "@link", "Type#LIST", "}", "." ]
train
https://github.com/apollographql/apollo-android/blob/a78869a76e17f77e42c7a88f0099914fe7ffa5b6/apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java#L145-L148
jeremylong/DependencyCheck
utils/src/main/java/org/owasp/dependencycheck/utils/Checksum.java
Checksum.getSHA256Checksum
public static String getSHA256Checksum(String text) { """ Calculates the SHA1 checksum of the specified text. @param text the text to generate the SHA1 checksum @return the hex representation of the SHA1 """ final byte[] data = stringToBytes(text); return getChecksum(SHA256, data); }
java
public static String getSHA256Checksum(String text) { final byte[] data = stringToBytes(text); return getChecksum(SHA256, data); }
[ "public", "static", "String", "getSHA256Checksum", "(", "String", "text", ")", "{", "final", "byte", "[", "]", "data", "=", "stringToBytes", "(", "text", ")", ";", "return", "getChecksum", "(", "SHA256", ",", "data", ")", ";", "}" ]
Calculates the SHA1 checksum of the specified text. @param text the text to generate the SHA1 checksum @return the hex representation of the SHA1
[ "Calculates", "the", "SHA1", "checksum", "of", "the", "specified", "text", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Checksum.java#L180-L183
mabe02/lanterna
src/main/java/com/googlecode/lanterna/terminal/IOSafeTerminalAdapter.java
IOSafeTerminalAdapter.createDoNothingOnExceptionAdapter
public static IOSafeTerminal createDoNothingOnExceptionAdapter(Terminal terminal) { """ Creates a wrapper around a Terminal that exposes it as a IOSafeTerminal. If any IOExceptions occur, they will be silently ignored and for those method with a non-void return type, null will be returned. @param terminal Terminal to wrap @return IOSafeTerminal wrapping the supplied terminal """ if (terminal instanceof ExtendedTerminal) { // also handle Runtime-type: return createDoNothingOnExceptionAdapter((ExtendedTerminal)terminal); } else { return new IOSafeTerminalAdapter(terminal, new DoNothingAndOrReturnNull()); } }
java
public static IOSafeTerminal createDoNothingOnExceptionAdapter(Terminal terminal) { if (terminal instanceof ExtendedTerminal) { // also handle Runtime-type: return createDoNothingOnExceptionAdapter((ExtendedTerminal)terminal); } else { return new IOSafeTerminalAdapter(terminal, new DoNothingAndOrReturnNull()); } }
[ "public", "static", "IOSafeTerminal", "createDoNothingOnExceptionAdapter", "(", "Terminal", "terminal", ")", "{", "if", "(", "terminal", "instanceof", "ExtendedTerminal", ")", "{", "// also handle Runtime-type:", "return", "createDoNothingOnExceptionAdapter", "(", "(", "ExtendedTerminal", ")", "terminal", ")", ";", "}", "else", "{", "return", "new", "IOSafeTerminalAdapter", "(", "terminal", ",", "new", "DoNothingAndOrReturnNull", "(", ")", ")", ";", "}", "}" ]
Creates a wrapper around a Terminal that exposes it as a IOSafeTerminal. If any IOExceptions occur, they will be silently ignored and for those method with a non-void return type, null will be returned. @param terminal Terminal to wrap @return IOSafeTerminal wrapping the supplied terminal
[ "Creates", "a", "wrapper", "around", "a", "Terminal", "that", "exposes", "it", "as", "a", "IOSafeTerminal", ".", "If", "any", "IOExceptions", "occur", "they", "will", "be", "silently", "ignored", "and", "for", "those", "method", "with", "a", "non", "-", "void", "return", "type", "null", "will", "be", "returned", "." ]
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/terminal/IOSafeTerminalAdapter.java#L83-L89
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/BeanDescriptor.java
BeanDescriptor.getSetterAnnotation
@SuppressWarnings("unchecked") public <T extends Annotation> T getSetterAnnotation(Method method, Class<T> annotationType) { """ Invokes the annotation of the given type. @param method the given setter method @param annotationType the annotation type to look for @param <T> the annotation type @return the annotation object, or null if not found """ T annotation = method.getAnnotation(annotationType); if (annotation != null) { return annotation; } Annotation[][] parameterAnnotations = method.getParameterAnnotations(); if (parameterAnnotations.length > 0 ) { for (Annotation anno : parameterAnnotations[0]) { if (annotationType.isInstance(anno)) { return (T)anno; } } } return null; }
java
@SuppressWarnings("unchecked") public <T extends Annotation> T getSetterAnnotation(Method method, Class<T> annotationType) { T annotation = method.getAnnotation(annotationType); if (annotation != null) { return annotation; } Annotation[][] parameterAnnotations = method.getParameterAnnotations(); if (parameterAnnotations.length > 0 ) { for (Annotation anno : parameterAnnotations[0]) { if (annotationType.isInstance(anno)) { return (T)anno; } } } return null; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", "extends", "Annotation", ">", "T", "getSetterAnnotation", "(", "Method", "method", ",", "Class", "<", "T", ">", "annotationType", ")", "{", "T", "annotation", "=", "method", ".", "getAnnotation", "(", "annotationType", ")", ";", "if", "(", "annotation", "!=", "null", ")", "{", "return", "annotation", ";", "}", "Annotation", "[", "]", "[", "]", "parameterAnnotations", "=", "method", ".", "getParameterAnnotations", "(", ")", ";", "if", "(", "parameterAnnotations", ".", "length", ">", "0", ")", "{", "for", "(", "Annotation", "anno", ":", "parameterAnnotations", "[", "0", "]", ")", "{", "if", "(", "annotationType", ".", "isInstance", "(", "anno", ")", ")", "{", "return", "(", "T", ")", "anno", ";", "}", "}", "}", "return", "null", ";", "}" ]
Invokes the annotation of the given type. @param method the given setter method @param annotationType the annotation type to look for @param <T> the annotation type @return the annotation object, or null if not found
[ "Invokes", "the", "annotation", "of", "the", "given", "type", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/BeanDescriptor.java#L325-L340
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/AbstractTypeComputer.java
AbstractTypeComputer.getCommonSuperType
protected LightweightTypeReference getCommonSuperType(List<LightweightTypeReference> types, ITypeReferenceOwner owner) { """ Computes the common super type for the given list of types. The list may not be empty. """ return services.getTypeConformanceComputer().getCommonSuperType(types, owner); }
java
protected LightweightTypeReference getCommonSuperType(List<LightweightTypeReference> types, ITypeReferenceOwner owner) { return services.getTypeConformanceComputer().getCommonSuperType(types, owner); }
[ "protected", "LightweightTypeReference", "getCommonSuperType", "(", "List", "<", "LightweightTypeReference", ">", "types", ",", "ITypeReferenceOwner", "owner", ")", "{", "return", "services", ".", "getTypeConformanceComputer", "(", ")", ".", "getCommonSuperType", "(", "types", ",", "owner", ")", ";", "}" ]
Computes the common super type for the given list of types. The list may not be empty.
[ "Computes", "the", "common", "super", "type", "for", "the", "given", "list", "of", "types", ".", "The", "list", "may", "not", "be", "empty", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/AbstractTypeComputer.java#L132-L134
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringParser.java
StringParser.parseIntObj
@Nullable public static Integer parseIntObj (@Nullable final Object aObject) { """ Parse the given {@link Object} as {@link Integer} with radix {@value #DEFAULT_RADIX}. @param aObject The object to parse. May be <code>null</code>. @return <code>null</code> if the object does not represent a valid value. """ return parseIntObj (aObject, DEFAULT_RADIX, null); }
java
@Nullable public static Integer parseIntObj (@Nullable final Object aObject) { return parseIntObj (aObject, DEFAULT_RADIX, null); }
[ "@", "Nullable", "public", "static", "Integer", "parseIntObj", "(", "@", "Nullable", "final", "Object", "aObject", ")", "{", "return", "parseIntObj", "(", "aObject", ",", "DEFAULT_RADIX", ",", "null", ")", ";", "}" ]
Parse the given {@link Object} as {@link Integer} with radix {@value #DEFAULT_RADIX}. @param aObject The object to parse. May be <code>null</code>. @return <code>null</code> if the object does not represent a valid value.
[ "Parse", "the", "given", "{", "@link", "Object", "}", "as", "{", "@link", "Integer", "}", "with", "radix", "{", "@value", "#DEFAULT_RADIX", "}", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L788-L792
Ellzord/JALSE
src/main/java/jalse/entities/Entities.java
Entities.newRecursiveEntityListener
public static EntityListener newRecursiveEntityListener(final Supplier<EntityListener> supplier, final int depth) { """ Creates a recursive entity listener for the supplied entity listener supplier and specified recursion limit. @param supplier Supplier of the entity listener to be added to created entities. @param depth The recursion limit of the listener. @return Recursive entity listener with specified recursion limit. """ if (depth <= 0) { throw new IllegalArgumentException(); } return new RecursiveEntityListener(supplier, depth); }
java
public static EntityListener newRecursiveEntityListener(final Supplier<EntityListener> supplier, final int depth) { if (depth <= 0) { throw new IllegalArgumentException(); } return new RecursiveEntityListener(supplier, depth); }
[ "public", "static", "EntityListener", "newRecursiveEntityListener", "(", "final", "Supplier", "<", "EntityListener", ">", "supplier", ",", "final", "int", "depth", ")", "{", "if", "(", "depth", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "return", "new", "RecursiveEntityListener", "(", "supplier", ",", "depth", ")", ";", "}" ]
Creates a recursive entity listener for the supplied entity listener supplier and specified recursion limit. @param supplier Supplier of the entity listener to be added to created entities. @param depth The recursion limit of the listener. @return Recursive entity listener with specified recursion limit.
[ "Creates", "a", "recursive", "entity", "listener", "for", "the", "supplied", "entity", "listener", "supplier", "and", "specified", "recursion", "limit", "." ]
train
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/Entities.java#L358-L363
netty/netty
codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java
MqttDecoder.decodePayload
private static Result<?> decodePayload( ByteBuf buffer, MqttMessageType messageType, int bytesRemainingInVariablePart, Object variableHeader) { """ Decodes the payload. @param buffer the buffer to decode from @param messageType type of the message being decoded @param bytesRemainingInVariablePart bytes remaining @param variableHeader variable header of the same message @return the payload """ switch (messageType) { case CONNECT: return decodeConnectionPayload(buffer, (MqttConnectVariableHeader) variableHeader); case SUBSCRIBE: return decodeSubscribePayload(buffer, bytesRemainingInVariablePart); case SUBACK: return decodeSubackPayload(buffer, bytesRemainingInVariablePart); case UNSUBSCRIBE: return decodeUnsubscribePayload(buffer, bytesRemainingInVariablePart); case PUBLISH: return decodePublishPayload(buffer, bytesRemainingInVariablePart); default: // unknown payload , no byte consumed return new Result<Object>(null, 0); } }
java
private static Result<?> decodePayload( ByteBuf buffer, MqttMessageType messageType, int bytesRemainingInVariablePart, Object variableHeader) { switch (messageType) { case CONNECT: return decodeConnectionPayload(buffer, (MqttConnectVariableHeader) variableHeader); case SUBSCRIBE: return decodeSubscribePayload(buffer, bytesRemainingInVariablePart); case SUBACK: return decodeSubackPayload(buffer, bytesRemainingInVariablePart); case UNSUBSCRIBE: return decodeUnsubscribePayload(buffer, bytesRemainingInVariablePart); case PUBLISH: return decodePublishPayload(buffer, bytesRemainingInVariablePart); default: // unknown payload , no byte consumed return new Result<Object>(null, 0); } }
[ "private", "static", "Result", "<", "?", ">", "decodePayload", "(", "ByteBuf", "buffer", ",", "MqttMessageType", "messageType", ",", "int", "bytesRemainingInVariablePart", ",", "Object", "variableHeader", ")", "{", "switch", "(", "messageType", ")", "{", "case", "CONNECT", ":", "return", "decodeConnectionPayload", "(", "buffer", ",", "(", "MqttConnectVariableHeader", ")", "variableHeader", ")", ";", "case", "SUBSCRIBE", ":", "return", "decodeSubscribePayload", "(", "buffer", ",", "bytesRemainingInVariablePart", ")", ";", "case", "SUBACK", ":", "return", "decodeSubackPayload", "(", "buffer", ",", "bytesRemainingInVariablePart", ")", ";", "case", "UNSUBSCRIBE", ":", "return", "decodeUnsubscribePayload", "(", "buffer", ",", "bytesRemainingInVariablePart", ")", ";", "case", "PUBLISH", ":", "return", "decodePublishPayload", "(", "buffer", ",", "bytesRemainingInVariablePart", ")", ";", "default", ":", "// unknown payload , no byte consumed", "return", "new", "Result", "<", "Object", ">", "(", "null", ",", "0", ")", ";", "}", "}" ]
Decodes the payload. @param buffer the buffer to decode from @param messageType type of the message being decoded @param bytesRemainingInVariablePart bytes remaining @param variableHeader variable header of the same message @return the payload
[ "Decodes", "the", "payload", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java#L306-L331
mfornos/humanize
humanize-slim/src/main/java/humanize/Humanize.java
Humanize.paceFormat
public static String paceFormat(final Number value, final long interval) { """ Matches a pace (value and interval) with a logical time frame. Very useful for slow paces. e.g. heartbeats, ingested calories, hyperglycemic crises. @param value The number of occurrences within the specified interval @param interval The interval in milliseconds @return an human readable textual representation of the pace """ ResourceBundle b = context.get().getBundle(); PaceParameters params = PaceParameters.begin(b.getString("pace.one")) .none(b.getString("pace.none")) .many(b.getString("pace.many")) .interval(interval); return paceFormat(value, params); }
java
public static String paceFormat(final Number value, final long interval) { ResourceBundle b = context.get().getBundle(); PaceParameters params = PaceParameters.begin(b.getString("pace.one")) .none(b.getString("pace.none")) .many(b.getString("pace.many")) .interval(interval); return paceFormat(value, params); }
[ "public", "static", "String", "paceFormat", "(", "final", "Number", "value", ",", "final", "long", "interval", ")", "{", "ResourceBundle", "b", "=", "context", ".", "get", "(", ")", ".", "getBundle", "(", ")", ";", "PaceParameters", "params", "=", "PaceParameters", ".", "begin", "(", "b", ".", "getString", "(", "\"pace.one\"", ")", ")", ".", "none", "(", "b", ".", "getString", "(", "\"pace.none\"", ")", ")", ".", "many", "(", "b", ".", "getString", "(", "\"pace.many\"", ")", ")", ".", "interval", "(", "interval", ")", ";", "return", "paceFormat", "(", "value", ",", "params", ")", ";", "}" ]
Matches a pace (value and interval) with a logical time frame. Very useful for slow paces. e.g. heartbeats, ingested calories, hyperglycemic crises. @param value The number of occurrences within the specified interval @param interval The interval in milliseconds @return an human readable textual representation of the pace
[ "Matches", "a", "pace", "(", "value", "and", "interval", ")", "with", "a", "logical", "time", "frame", ".", "Very", "useful", "for", "slow", "paces", ".", "e", ".", "g", ".", "heartbeats", "ingested", "calories", "hyperglycemic", "crises", "." ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L2071-L2081
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterReader.java
GrassRasterReader.readUncompressedIntegerRowByNumber
private void readUncompressedIntegerRowByNumber( ByteBuffer rowdata, int rn, RandomAccessFile thefile ) throws IOException, DataFormatException { """ read a row of data from an uncompressed integer map @param rn @param thefile @return @throws IOException @throws DataFormatException """ int cellValue = 0; ByteBuffer cell = ByteBuffer.allocate(rasterMapType); /* The number of bytes that are inside a row in the file. */ int filerowsize = fileWindow.getCols() * rasterMapType; /* Position the file pointer to read the row */ thefile.seek((rn * filerowsize)); /* Read the row of data from the file */ ByteBuffer tmpBuffer = ByteBuffer.allocate(filerowsize); thefile.read(tmpBuffer.array()); /* * Transform the rasterMapType-size-values to a standard 4 bytes integer value */ while( tmpBuffer.hasRemaining() ) { // read the value tmpBuffer.get(cell.array()); /* * Integers can be of 1, 2, or 4 bytes. As rasterBuffer expects 4 byte integers we need * to pad them with 0's. The order of the padding is determined by the ByteOrder of the * buffer. */ if (rasterMapType == 1) { cellValue = (cell.get(0) & 0xff); } else if (rasterMapType == 2) { cellValue = cell.getShort(0); } else if (rasterMapType == 4) { cellValue = cell.getInt(0); } // if (logger.isDebugEnabled()) logger.debug("tmpint=" + cellValue // ); rowdata.putInt(cellValue); } }
java
private void readUncompressedIntegerRowByNumber( ByteBuffer rowdata, int rn, RandomAccessFile thefile ) throws IOException, DataFormatException { int cellValue = 0; ByteBuffer cell = ByteBuffer.allocate(rasterMapType); /* The number of bytes that are inside a row in the file. */ int filerowsize = fileWindow.getCols() * rasterMapType; /* Position the file pointer to read the row */ thefile.seek((rn * filerowsize)); /* Read the row of data from the file */ ByteBuffer tmpBuffer = ByteBuffer.allocate(filerowsize); thefile.read(tmpBuffer.array()); /* * Transform the rasterMapType-size-values to a standard 4 bytes integer value */ while( tmpBuffer.hasRemaining() ) { // read the value tmpBuffer.get(cell.array()); /* * Integers can be of 1, 2, or 4 bytes. As rasterBuffer expects 4 byte integers we need * to pad them with 0's. The order of the padding is determined by the ByteOrder of the * buffer. */ if (rasterMapType == 1) { cellValue = (cell.get(0) & 0xff); } else if (rasterMapType == 2) { cellValue = cell.getShort(0); } else if (rasterMapType == 4) { cellValue = cell.getInt(0); } // if (logger.isDebugEnabled()) logger.debug("tmpint=" + cellValue // ); rowdata.putInt(cellValue); } }
[ "private", "void", "readUncompressedIntegerRowByNumber", "(", "ByteBuffer", "rowdata", ",", "int", "rn", ",", "RandomAccessFile", "thefile", ")", "throws", "IOException", ",", "DataFormatException", "{", "int", "cellValue", "=", "0", ";", "ByteBuffer", "cell", "=", "ByteBuffer", ".", "allocate", "(", "rasterMapType", ")", ";", "/* The number of bytes that are inside a row in the file. */", "int", "filerowsize", "=", "fileWindow", ".", "getCols", "(", ")", "*", "rasterMapType", ";", "/* Position the file pointer to read the row */", "thefile", ".", "seek", "(", "(", "rn", "*", "filerowsize", ")", ")", ";", "/* Read the row of data from the file */", "ByteBuffer", "tmpBuffer", "=", "ByteBuffer", ".", "allocate", "(", "filerowsize", ")", ";", "thefile", ".", "read", "(", "tmpBuffer", ".", "array", "(", ")", ")", ";", "/*\n * Transform the rasterMapType-size-values to a standard 4 bytes integer value\n */", "while", "(", "tmpBuffer", ".", "hasRemaining", "(", ")", ")", "{", "// read the value", "tmpBuffer", ".", "get", "(", "cell", ".", "array", "(", ")", ")", ";", "/*\n * Integers can be of 1, 2, or 4 bytes. As rasterBuffer expects 4 byte integers we need\n * to pad them with 0's. The order of the padding is determined by the ByteOrder of the\n * buffer.\n */", "if", "(", "rasterMapType", "==", "1", ")", "{", "cellValue", "=", "(", "cell", ".", "get", "(", "0", ")", "&", "0xff", ")", ";", "}", "else", "if", "(", "rasterMapType", "==", "2", ")", "{", "cellValue", "=", "cell", ".", "getShort", "(", "0", ")", ";", "}", "else", "if", "(", "rasterMapType", "==", "4", ")", "{", "cellValue", "=", "cell", ".", "getInt", "(", "0", ")", ";", "}", "// if (logger.isDebugEnabled()) logger.debug(\"tmpint=\" + cellValue", "// );", "rowdata", ".", "putInt", "(", "cellValue", ")", ";", "}", "}" ]
read a row of data from an uncompressed integer map @param rn @param thefile @return @throws IOException @throws DataFormatException
[ "read", "a", "row", "of", "data", "from", "an", "uncompressed", "integer", "map" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterReader.java#L1217-L1255
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.getImagePerformanceCountAsync
public Observable<Integer> getImagePerformanceCountAsync(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter) { """ Gets the number of images tagged with the provided {tagIds} that have prediction results from training for the provided iteration {iterationId}. The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and "Cat" tags, then only images tagged with Dog and/or Cat will be returned. @param projectId The project id @param iterationId The iteration id. Defaults to workspace @param getImagePerformanceCountOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the Integer object """ return getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, getImagePerformanceCountOptionalParameter).map(new Func1<ServiceResponse<Integer>, Integer>() { @Override public Integer call(ServiceResponse<Integer> response) { return response.body(); } }); }
java
public Observable<Integer> getImagePerformanceCountAsync(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter) { return getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, getImagePerformanceCountOptionalParameter).map(new Func1<ServiceResponse<Integer>, Integer>() { @Override public Integer call(ServiceResponse<Integer> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Integer", ">", "getImagePerformanceCountAsync", "(", "UUID", "projectId", ",", "UUID", "iterationId", ",", "GetImagePerformanceCountOptionalParameter", "getImagePerformanceCountOptionalParameter", ")", "{", "return", "getImagePerformanceCountWithServiceResponseAsync", "(", "projectId", ",", "iterationId", ",", "getImagePerformanceCountOptionalParameter", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Integer", ">", ",", "Integer", ">", "(", ")", "{", "@", "Override", "public", "Integer", "call", "(", "ServiceResponse", "<", "Integer", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the number of images tagged with the provided {tagIds} that have prediction results from training for the provided iteration {iterationId}. The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and "Cat" tags, then only images tagged with Dog and/or Cat will be returned. @param projectId The project id @param iterationId The iteration id. Defaults to workspace @param getImagePerformanceCountOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the Integer object
[ "Gets", "the", "number", "of", "images", "tagged", "with", "the", "provided", "{", "tagIds", "}", "that", "have", "prediction", "results", "from", "training", "for", "the", "provided", "iteration", "{", "iterationId", "}", ".", "The", "filtering", "is", "on", "an", "and", "/", "or", "relationship", ".", "For", "example", "if", "the", "provided", "tag", "ids", "are", "for", "the", "Dog", "and", "Cat", "tags", "then", "only", "images", "tagged", "with", "Dog", "and", "/", "or", "Cat", "will", "be", "returned", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L1250-L1257
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/Collectors.java
Collectors.groupingBy
public static <T, K> Collector<T, ?, Map<K, List<T>>> groupingBy(Function<? super T, ? extends K> classifier) { """ Returns a {@code Collector} implementing a "group by" operation on input elements of type {@code T}, grouping elements according to a classification function, and returning the results in a {@code Map}. <p>The classification function maps elements to some key type {@code K}. The collector produces a {@code Map<K, List<T>>} whose keys are the values resulting from applying the classification function to the input elements, and whose corresponding values are {@code List}s containing the input elements which map to the associated key under the classification function. <p>There are no guarantees on the type, mutability, serializability, or thread-safety of the {@code Map} or {@code List} objects returned. @implSpec This produces a result similar to: <pre>{@code groupingBy(classifier, toList()); }</pre> @implNote The returned {@code Collector} is not concurrent. For parallel stream pipelines, the {@code combiner} function operates by merging the keys from one map into another, which can be an expensive operation. If preservation of the order in which elements appear in the resulting {@code Map} collector is not required, using {@link #groupingByConcurrent(Function)} may offer better parallel performance. @param <T> the type of the input elements @param <K> the type of the keys @param classifier the classifier function mapping input elements to keys @return a {@code Collector} implementing the group-by operation @see #groupingBy(Function, Collector) @see #groupingBy(Function, Supplier, Collector) @see #groupingByConcurrent(Function) """ return groupingBy(classifier, toList()); }
java
public static <T, K> Collector<T, ?, Map<K, List<T>>> groupingBy(Function<? super T, ? extends K> classifier) { return groupingBy(classifier, toList()); }
[ "public", "static", "<", "T", ",", "K", ">", "Collector", "<", "T", ",", "?", ",", "Map", "<", "K", ",", "List", "<", "T", ">", ">", ">", "groupingBy", "(", "Function", "<", "?", "super", "T", ",", "?", "extends", "K", ">", "classifier", ")", "{", "return", "groupingBy", "(", "classifier", ",", "toList", "(", ")", ")", ";", "}" ]
Returns a {@code Collector} implementing a "group by" operation on input elements of type {@code T}, grouping elements according to a classification function, and returning the results in a {@code Map}. <p>The classification function maps elements to some key type {@code K}. The collector produces a {@code Map<K, List<T>>} whose keys are the values resulting from applying the classification function to the input elements, and whose corresponding values are {@code List}s containing the input elements which map to the associated key under the classification function. <p>There are no guarantees on the type, mutability, serializability, or thread-safety of the {@code Map} or {@code List} objects returned. @implSpec This produces a result similar to: <pre>{@code groupingBy(classifier, toList()); }</pre> @implNote The returned {@code Collector} is not concurrent. For parallel stream pipelines, the {@code combiner} function operates by merging the keys from one map into another, which can be an expensive operation. If preservation of the order in which elements appear in the resulting {@code Map} collector is not required, using {@link #groupingByConcurrent(Function)} may offer better parallel performance. @param <T> the type of the input elements @param <K> the type of the keys @param classifier the classifier function mapping input elements to keys @return a {@code Collector} implementing the group-by operation @see #groupingBy(Function, Collector) @see #groupingBy(Function, Supplier, Collector) @see #groupingByConcurrent(Function)
[ "Returns", "a", "{", "@code", "Collector", "}", "implementing", "a", "group", "by", "operation", "on", "input", "elements", "of", "type", "{", "@code", "T", "}", "grouping", "elements", "according", "to", "a", "classification", "function", "and", "returning", "the", "results", "in", "a", "{", "@code", "Map", "}", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/Collectors.java#L803-L806
rjeschke/txtmark
src/main/java/com/github/rjeschke/txtmark/Utils.java
Utils.readUntil
public final static int readUntil(final StringBuilder out, final String in, final int start, final char end) { """ Reads characters until the 'end' character is encountered. @param out The StringBuilder to write to. @param in The Input String. @param start Starting position. @param end End characters. @return The new position or -1 if no 'end' char was found. """ int pos = start; while (pos < in.length()) { final char ch = in.charAt(pos); if (ch == '\\' && pos + 1 < in.length()) { pos = escape(out, in.charAt(pos + 1), pos); } else { if (ch == end) { break; } out.append(ch); } pos++; } return (pos == in.length()) ? -1 : pos; }
java
public final static int readUntil(final StringBuilder out, final String in, final int start, final char end) { int pos = start; while (pos < in.length()) { final char ch = in.charAt(pos); if (ch == '\\' && pos + 1 < in.length()) { pos = escape(out, in.charAt(pos + 1), pos); } else { if (ch == end) { break; } out.append(ch); } pos++; } return (pos == in.length()) ? -1 : pos; }
[ "public", "final", "static", "int", "readUntil", "(", "final", "StringBuilder", "out", ",", "final", "String", "in", ",", "final", "int", "start", ",", "final", "char", "end", ")", "{", "int", "pos", "=", "start", ";", "while", "(", "pos", "<", "in", ".", "length", "(", ")", ")", "{", "final", "char", "ch", "=", "in", ".", "charAt", "(", "pos", ")", ";", "if", "(", "ch", "==", "'", "'", "&&", "pos", "+", "1", "<", "in", ".", "length", "(", ")", ")", "{", "pos", "=", "escape", "(", "out", ",", "in", ".", "charAt", "(", "pos", "+", "1", ")", ",", "pos", ")", ";", "}", "else", "{", "if", "(", "ch", "==", "end", ")", "{", "break", ";", "}", "out", ".", "append", "(", "ch", ")", ";", "}", "pos", "++", ";", "}", "return", "(", "pos", "==", "in", ".", "length", "(", ")", ")", "?", "-", "1", ":", "pos", ";", "}" ]
Reads characters until the 'end' character is encountered. @param out The StringBuilder to write to. @param in The Input String. @param start Starting position. @param end End characters. @return The new position or -1 if no 'end' char was found.
[ "Reads", "characters", "until", "the", "end", "character", "is", "encountered", "." ]
train
https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Utils.java#L159-L181
Azure/azure-sdk-for-java
policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java
PolicyStatesInner.listQueryResultsForManagementGroupAsync
public Observable<PolicyStatesQueryResultsInner> listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName) { """ Queries policy states for the resources under the management group. @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' @param managementGroupName Management group name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PolicyStatesQueryResultsInner object """ return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName).map(new Func1<ServiceResponse<PolicyStatesQueryResultsInner>, PolicyStatesQueryResultsInner>() { @Override public PolicyStatesQueryResultsInner call(ServiceResponse<PolicyStatesQueryResultsInner> response) { return response.body(); } }); }
java
public Observable<PolicyStatesQueryResultsInner> listQueryResultsForManagementGroupAsync(PolicyStatesResource policyStatesResource, String managementGroupName) { return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName).map(new Func1<ServiceResponse<PolicyStatesQueryResultsInner>, PolicyStatesQueryResultsInner>() { @Override public PolicyStatesQueryResultsInner call(ServiceResponse<PolicyStatesQueryResultsInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PolicyStatesQueryResultsInner", ">", "listQueryResultsForManagementGroupAsync", "(", "PolicyStatesResource", "policyStatesResource", ",", "String", "managementGroupName", ")", "{", "return", "listQueryResultsForManagementGroupWithServiceResponseAsync", "(", "policyStatesResource", ",", "managementGroupName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "PolicyStatesQueryResultsInner", ">", ",", "PolicyStatesQueryResultsInner", ">", "(", ")", "{", "@", "Override", "public", "PolicyStatesQueryResultsInner", "call", "(", "ServiceResponse", "<", "PolicyStatesQueryResultsInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Queries policy states for the resources under the management group. @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' @param managementGroupName Management group name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PolicyStatesQueryResultsInner object
[ "Queries", "policy", "states", "for", "the", "resources", "under", "the", "management", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L164-L171
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectCalendar.java
ProjectCalendar.isWorkingDate
public boolean isWorkingDate(Date date) { """ This method allows the caller to determine if a given date is a working day. This method takes account of calendar exceptions. @param date Date to be tested @return boolean value """ Calendar cal = DateHelper.popCalendar(date); Day day = Day.getInstance(cal.get(Calendar.DAY_OF_WEEK)); DateHelper.pushCalendar(cal); return isWorkingDate(date, day); }
java
public boolean isWorkingDate(Date date) { Calendar cal = DateHelper.popCalendar(date); Day day = Day.getInstance(cal.get(Calendar.DAY_OF_WEEK)); DateHelper.pushCalendar(cal); return isWorkingDate(date, day); }
[ "public", "boolean", "isWorkingDate", "(", "Date", "date", ")", "{", "Calendar", "cal", "=", "DateHelper", ".", "popCalendar", "(", "date", ")", ";", "Day", "day", "=", "Day", ".", "getInstance", "(", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_WEEK", ")", ")", ";", "DateHelper", ".", "pushCalendar", "(", "cal", ")", ";", "return", "isWorkingDate", "(", "date", ",", "day", ")", ";", "}" ]
This method allows the caller to determine if a given date is a working day. This method takes account of calendar exceptions. @param date Date to be tested @return boolean value
[ "This", "method", "allows", "the", "caller", "to", "determine", "if", "a", "given", "date", "is", "a", "working", "day", ".", "This", "method", "takes", "account", "of", "calendar", "exceptions", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L943-L949
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/embedded/EmbeddedGobblin.java
EmbeddedGobblin.distributeJarByClassWithPriority
public EmbeddedGobblin distributeJarByClassWithPriority(Class<?> klazz, int priority) { """ Specify that the input jar should be added to workers' classpath on distributed mode. Jars with lower priority value will appear first in the classpath. Default priority is 0. """ String jar = ClassUtil.findContainingJar(klazz); if (jar == null) { log.warn(String.format("Could not find jar for class %s. This is normal in test runs.", klazz)); return this; } return distributeJarWithPriority(jar, priority); }
java
public EmbeddedGobblin distributeJarByClassWithPriority(Class<?> klazz, int priority) { String jar = ClassUtil.findContainingJar(klazz); if (jar == null) { log.warn(String.format("Could not find jar for class %s. This is normal in test runs.", klazz)); return this; } return distributeJarWithPriority(jar, priority); }
[ "public", "EmbeddedGobblin", "distributeJarByClassWithPriority", "(", "Class", "<", "?", ">", "klazz", ",", "int", "priority", ")", "{", "String", "jar", "=", "ClassUtil", ".", "findContainingJar", "(", "klazz", ")", ";", "if", "(", "jar", "==", "null", ")", "{", "log", ".", "warn", "(", "String", ".", "format", "(", "\"Could not find jar for class %s. This is normal in test runs.\"", ",", "klazz", ")", ")", ";", "return", "this", ";", "}", "return", "distributeJarWithPriority", "(", "jar", ",", "priority", ")", ";", "}" ]
Specify that the input jar should be added to workers' classpath on distributed mode. Jars with lower priority value will appear first in the classpath. Default priority is 0.
[ "Specify", "that", "the", "input", "jar", "should", "be", "added", "to", "workers", "classpath", "on", "distributed", "mode", ".", "Jars", "with", "lower", "priority", "value", "will", "appear", "first", "in", "the", "classpath", ".", "Default", "priority", "is", "0", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/embedded/EmbeddedGobblin.java#L202-L209
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRootValue.java
PactDslRootValue.stringMatcher
public static PactDslRootValue stringMatcher(String regex, String value) { """ Value that must match the regular expression @param regex regular expression @param value example value to use for generated bodies """ if (!value.matches(regex)) { throw new InvalidMatcherException(EXAMPLE + value + "\" does not match regular expression \"" + regex + "\""); } PactDslRootValue rootValue = new PactDslRootValue(); rootValue.setValue(value); rootValue.setMatcher(rootValue.regexp(regex)); return rootValue; }
java
public static PactDslRootValue stringMatcher(String regex, String value) { if (!value.matches(regex)) { throw new InvalidMatcherException(EXAMPLE + value + "\" does not match regular expression \"" + regex + "\""); } PactDslRootValue rootValue = new PactDslRootValue(); rootValue.setValue(value); rootValue.setMatcher(rootValue.regexp(regex)); return rootValue; }
[ "public", "static", "PactDslRootValue", "stringMatcher", "(", "String", "regex", ",", "String", "value", ")", "{", "if", "(", "!", "value", ".", "matches", "(", "regex", ")", ")", "{", "throw", "new", "InvalidMatcherException", "(", "EXAMPLE", "+", "value", "+", "\"\\\" does not match regular expression \\\"\"", "+", "regex", "+", "\"\\\"\"", ")", ";", "}", "PactDslRootValue", "rootValue", "=", "new", "PactDslRootValue", "(", ")", ";", "rootValue", ".", "setValue", "(", "value", ")", ";", "rootValue", ".", "setMatcher", "(", "rootValue", ".", "regexp", "(", "regex", ")", ")", ";", "return", "rootValue", ";", "}" ]
Value that must match the regular expression @param regex regular expression @param value example value to use for generated bodies
[ "Value", "that", "must", "match", "the", "regular", "expression" ]
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRootValue.java#L394-L403
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/Messages.java
Messages.getFormattedMessage
public String getFormattedMessage(String messageKey, Object[] param, String defaultKey) { """ Retrieve a message and format it with the parameters @param messageKey Message key to use @param param Object to use for formatting @param defaultKey The default key to use in case message key is not found @return message formatted with the parameters """ String key = getString(messageKey); String retVal = MessageFormat.format(key, param); return retVal; }
java
public String getFormattedMessage(String messageKey, Object[] param, String defaultKey) { String key = getString(messageKey); String retVal = MessageFormat.format(key, param); return retVal; }
[ "public", "String", "getFormattedMessage", "(", "String", "messageKey", ",", "Object", "[", "]", "param", ",", "String", "defaultKey", ")", "{", "String", "key", "=", "getString", "(", "messageKey", ")", ";", "String", "retVal", "=", "MessageFormat", ".", "format", "(", "key", ",", "param", ")", ";", "return", "retVal", ";", "}" ]
Retrieve a message and format it with the parameters @param messageKey Message key to use @param param Object to use for formatting @param defaultKey The default key to use in case message key is not found @return message formatted with the parameters
[ "Retrieve", "a", "message", "and", "format", "it", "with", "the", "parameters" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/Messages.java#L191-L195
alkacon/opencms-core
src/org/opencms/xml/content/CmsXmlContentProperty.java
CmsXmlContentProperty.firstNotNull
private static <T> T firstNotNull(T o1, T o2) { """ Gets the fist non-null value.<p> @param o1 the first value @param o2 the second value @return the first non-null value """ if (o1 != null) { return o1; } return o2; }
java
private static <T> T firstNotNull(T o1, T o2) { if (o1 != null) { return o1; } return o2; }
[ "private", "static", "<", "T", ">", "T", "firstNotNull", "(", "T", "o1", ",", "T", "o2", ")", "{", "if", "(", "o1", "!=", "null", ")", "{", "return", "o1", ";", "}", "return", "o2", ";", "}" ]
Gets the fist non-null value.<p> @param o1 the first value @param o2 the second value @return the first non-null value
[ "Gets", "the", "fist", "non", "-", "null", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentProperty.java#L261-L267
ironjacamar/ironjacamar
tracer/src/main/java/org/ironjacamar/tracer/TraceEventHelper.java
TraceEventHelper.getType
public static TraceEvent getType(List<TraceEvent> events, String identifier, int... types) { """ Get a specific event type @param events The events @param identifier The connection listener @param types The types @return The first event type found; otherwise <code>null</code> if none """ for (TraceEvent te : events) { for (int type : types) { if (te.getType() == type && (identifier == null || te.getConnectionListener().equals(identifier))) return te; } } return null; }
java
public static TraceEvent getType(List<TraceEvent> events, String identifier, int... types) { for (TraceEvent te : events) { for (int type : types) { if (te.getType() == type && (identifier == null || te.getConnectionListener().equals(identifier))) return te; } } return null; }
[ "public", "static", "TraceEvent", "getType", "(", "List", "<", "TraceEvent", ">", "events", ",", "String", "identifier", ",", "int", "...", "types", ")", "{", "for", "(", "TraceEvent", "te", ":", "events", ")", "{", "for", "(", "int", "type", ":", "types", ")", "{", "if", "(", "te", ".", "getType", "(", ")", "==", "type", "&&", "(", "identifier", "==", "null", "||", "te", ".", "getConnectionListener", "(", ")", ".", "equals", "(", "identifier", ")", ")", ")", "return", "te", ";", "}", "}", "return", "null", ";", "}" ]
Get a specific event type @param events The events @param identifier The connection listener @param types The types @return The first event type found; otherwise <code>null</code> if none
[ "Get", "a", "specific", "event", "type" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/tracer/src/main/java/org/ironjacamar/tracer/TraceEventHelper.java#L1036-L1048
osmdroid/osmdroid
osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/features/SphericalUtil.java
SphericalUtil.computeOffsetOrigin
public static IGeoPoint computeOffsetOrigin(IGeoPoint to, double distance, double heading) { """ Returns the location of origin when provided with a IGeoPoint destination, meters travelled and original heading. Headings are expressed in degrees clockwise from North. This function returns null when no solution is available. @param to The destination IGeoPoint. @param distance The distance travelled, in meters. @param heading The heading in degrees clockwise from north. """ heading = toRadians(heading); distance /= EARTH_RADIUS; // http://lists.maptools.org/pipermail/proj/2008-October/003939.html double n1 = cos(distance); double n2 = sin(distance) * cos(heading); double n3 = sin(distance) * sin(heading); double n4 = sin(toRadians(to.getLatitude())); // There are two solutions for b. b = n2 * n4 +/- sqrt(), one solution results // in the latitude outside the [-90, 90] range. We first try one solution and // back off to the other if we are outside that range. double n12 = n1 * n1; double discriminant = n2 * n2 * n12 + n12 * n12 - n12 * n4 * n4; if (discriminant < 0) { // No real solution which would make sense in IGeoPoint-space. return null; } double b = n2 * n4 + sqrt(discriminant); b /= n1 * n1 + n2 * n2; double a = (n4 - n2 * b) / n1; double fromLatRadians = atan2(a, b); if (fromLatRadians < -PI / 2 || fromLatRadians > PI / 2) { b = n2 * n4 - sqrt(discriminant); b /= n1 * n1 + n2 * n2; fromLatRadians = atan2(a, b); } if (fromLatRadians < -PI / 2 || fromLatRadians > PI / 2) { // No solution which would make sense in IGeoPoint-space. return null; } double fromLngRadians = toRadians(to.getLongitude()) - atan2(n3, n1 * cos(fromLatRadians) - n2 * sin(fromLatRadians)); return new GeoPoint(toDegrees(fromLatRadians), toDegrees(fromLngRadians)); }
java
public static IGeoPoint computeOffsetOrigin(IGeoPoint to, double distance, double heading) { heading = toRadians(heading); distance /= EARTH_RADIUS; // http://lists.maptools.org/pipermail/proj/2008-October/003939.html double n1 = cos(distance); double n2 = sin(distance) * cos(heading); double n3 = sin(distance) * sin(heading); double n4 = sin(toRadians(to.getLatitude())); // There are two solutions for b. b = n2 * n4 +/- sqrt(), one solution results // in the latitude outside the [-90, 90] range. We first try one solution and // back off to the other if we are outside that range. double n12 = n1 * n1; double discriminant = n2 * n2 * n12 + n12 * n12 - n12 * n4 * n4; if (discriminant < 0) { // No real solution which would make sense in IGeoPoint-space. return null; } double b = n2 * n4 + sqrt(discriminant); b /= n1 * n1 + n2 * n2; double a = (n4 - n2 * b) / n1; double fromLatRadians = atan2(a, b); if (fromLatRadians < -PI / 2 || fromLatRadians > PI / 2) { b = n2 * n4 - sqrt(discriminant); b /= n1 * n1 + n2 * n2; fromLatRadians = atan2(a, b); } if (fromLatRadians < -PI / 2 || fromLatRadians > PI / 2) { // No solution which would make sense in IGeoPoint-space. return null; } double fromLngRadians = toRadians(to.getLongitude()) - atan2(n3, n1 * cos(fromLatRadians) - n2 * sin(fromLatRadians)); return new GeoPoint(toDegrees(fromLatRadians), toDegrees(fromLngRadians)); }
[ "public", "static", "IGeoPoint", "computeOffsetOrigin", "(", "IGeoPoint", "to", ",", "double", "distance", ",", "double", "heading", ")", "{", "heading", "=", "toRadians", "(", "heading", ")", ";", "distance", "/=", "EARTH_RADIUS", ";", "// http://lists.maptools.org/pipermail/proj/2008-October/003939.html", "double", "n1", "=", "cos", "(", "distance", ")", ";", "double", "n2", "=", "sin", "(", "distance", ")", "*", "cos", "(", "heading", ")", ";", "double", "n3", "=", "sin", "(", "distance", ")", "*", "sin", "(", "heading", ")", ";", "double", "n4", "=", "sin", "(", "toRadians", "(", "to", ".", "getLatitude", "(", ")", ")", ")", ";", "// There are two solutions for b. b = n2 * n4 +/- sqrt(), one solution results", "// in the latitude outside the [-90, 90] range. We first try one solution and", "// back off to the other if we are outside that range.", "double", "n12", "=", "n1", "*", "n1", ";", "double", "discriminant", "=", "n2", "*", "n2", "*", "n12", "+", "n12", "*", "n12", "-", "n12", "*", "n4", "*", "n4", ";", "if", "(", "discriminant", "<", "0", ")", "{", "// No real solution which would make sense in IGeoPoint-space.", "return", "null", ";", "}", "double", "b", "=", "n2", "*", "n4", "+", "sqrt", "(", "discriminant", ")", ";", "b", "/=", "n1", "*", "n1", "+", "n2", "*", "n2", ";", "double", "a", "=", "(", "n4", "-", "n2", "*", "b", ")", "/", "n1", ";", "double", "fromLatRadians", "=", "atan2", "(", "a", ",", "b", ")", ";", "if", "(", "fromLatRadians", "<", "-", "PI", "/", "2", "||", "fromLatRadians", ">", "PI", "/", "2", ")", "{", "b", "=", "n2", "*", "n4", "-", "sqrt", "(", "discriminant", ")", ";", "b", "/=", "n1", "*", "n1", "+", "n2", "*", "n2", ";", "fromLatRadians", "=", "atan2", "(", "a", ",", "b", ")", ";", "}", "if", "(", "fromLatRadians", "<", "-", "PI", "/", "2", "||", "fromLatRadians", ">", "PI", "/", "2", ")", "{", "// No solution which would make sense in IGeoPoint-space.", "return", "null", ";", "}", "double", "fromLngRadians", "=", "toRadians", "(", "to", ".", "getLongitude", "(", ")", ")", "-", "atan2", "(", "n3", ",", "n1", "*", "cos", "(", "fromLatRadians", ")", "-", "n2", "*", "sin", "(", "fromLatRadians", ")", ")", ";", "return", "new", "GeoPoint", "(", "toDegrees", "(", "fromLatRadians", ")", ",", "toDegrees", "(", "fromLngRadians", ")", ")", ";", "}" ]
Returns the location of origin when provided with a IGeoPoint destination, meters travelled and original heading. Headings are expressed in degrees clockwise from North. This function returns null when no solution is available. @param to The destination IGeoPoint. @param distance The distance travelled, in meters. @param heading The heading in degrees clockwise from north.
[ "Returns", "the", "location", "of", "origin", "when", "provided", "with", "a", "IGeoPoint", "destination", "meters", "travelled", "and", "original", "heading", ".", "Headings", "are", "expressed", "in", "degrees", "clockwise", "from", "North", ".", "This", "function", "returns", "null", "when", "no", "solution", "is", "available", "." ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/features/SphericalUtil.java#L182-L215
recommenders/rival
rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/mahout/GenericRecommenderBuilder.java
GenericRecommenderBuilder.buildRecommender
public Recommender buildRecommender(final DataModel dataModel, final String recType, final String facType, final int iterations, final int factors) throws RecommenderException { """ SVD. @param dataModel the data model @param recType the recommender type (as Mahout class) @param facType the factorizer (as Mahout class) @param iterations number of iterations @param factors number of factors @return the recommender @throws RecommenderException see {@link #buildRecommender(org.apache.mahout.cf.taste.model.DataModel, java.lang.String, java.lang.String, int, int, int, java.lang.String)} """ return buildRecommender(dataModel, recType, null, NO_N, factors, iterations, facType); }
java
public Recommender buildRecommender(final DataModel dataModel, final String recType, final String facType, final int iterations, final int factors) throws RecommenderException { return buildRecommender(dataModel, recType, null, NO_N, factors, iterations, facType); }
[ "public", "Recommender", "buildRecommender", "(", "final", "DataModel", "dataModel", ",", "final", "String", "recType", ",", "final", "String", "facType", ",", "final", "int", "iterations", ",", "final", "int", "factors", ")", "throws", "RecommenderException", "{", "return", "buildRecommender", "(", "dataModel", ",", "recType", ",", "null", ",", "NO_N", ",", "factors", ",", "iterations", ",", "facType", ")", ";", "}" ]
SVD. @param dataModel the data model @param recType the recommender type (as Mahout class) @param facType the factorizer (as Mahout class) @param iterations number of iterations @param factors number of factors @return the recommender @throws RecommenderException see {@link #buildRecommender(org.apache.mahout.cf.taste.model.DataModel, java.lang.String, java.lang.String, int, int, int, java.lang.String)}
[ "SVD", "." ]
train
https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/mahout/GenericRecommenderBuilder.java#L123-L126
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visitVersion
@Override public R visitVersion(VersionTree node, P p) { """ {@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction} """ return defaultAction(node, p); }
java
@Override public R visitVersion(VersionTree node, P p) { return defaultAction(node, p); }
[ "@", "Override", "public", "R", "visitVersion", "(", "VersionTree", "node", ",", "P", "p", ")", "{", "return", "defaultAction", "(", "node", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction}
[ "{", "@inheritDoc", "}", "This", "implementation", "calls", "{", "@code", "defaultAction", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L477-L480
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/LoadBalancerProbesInner.java
LoadBalancerProbesInner.getAsync
public Observable<ProbeInner> getAsync(String resourceGroupName, String loadBalancerName, String probeName) { """ Gets load balancer probe. @param resourceGroupName The name of the resource group. @param loadBalancerName The name of the load balancer. @param probeName The name of the probe. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ProbeInner object """ return getWithServiceResponseAsync(resourceGroupName, loadBalancerName, probeName).map(new Func1<ServiceResponse<ProbeInner>, ProbeInner>() { @Override public ProbeInner call(ServiceResponse<ProbeInner> response) { return response.body(); } }); }
java
public Observable<ProbeInner> getAsync(String resourceGroupName, String loadBalancerName, String probeName) { return getWithServiceResponseAsync(resourceGroupName, loadBalancerName, probeName).map(new Func1<ServiceResponse<ProbeInner>, ProbeInner>() { @Override public ProbeInner call(ServiceResponse<ProbeInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ProbeInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "loadBalancerName", ",", "String", "probeName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "loadBalancerName", ",", "probeName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ProbeInner", ">", ",", "ProbeInner", ">", "(", ")", "{", "@", "Override", "public", "ProbeInner", "call", "(", "ServiceResponse", "<", "ProbeInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets load balancer probe. @param resourceGroupName The name of the resource group. @param loadBalancerName The name of the load balancer. @param probeName The name of the probe. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ProbeInner object
[ "Gets", "load", "balancer", "probe", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/LoadBalancerProbesInner.java#L233-L240
sdl/odata
odata_api/src/main/java/com/sdl/odata/api/service/MediaType.java
MediaType.fromString
public static MediaType fromString(String text) { """ Creates a {@code MediaType} by parsing the specified string. The string must look like a standard MIME type string, for example "text/html" or "application/xml". There can optionally be parameters present, for example "text/html; encoding=UTF-8" or "application/xml; q=0.8". @param text A string representing a media type. @return A {@code MediaType} object. @throws java.lang.IllegalArgumentException If the string is not a valid media type string. """ Matcher matcher = MEDIA_TYPE_PATTERN.matcher(text); if (!matcher.matches()) { throw new IllegalArgumentException("Invalid media type string: " + text); } String type; String subType; if (matcher.group(GROUP_INDEX) != null) { type = matcher.group(GROUP_INDEX); subType = matcher.group(GROUP_INDEX); } else { type = matcher.group(TYPE_INDEX); subType = matcher.group(SUBTYPE_INDEX); } Map<String, String> parametersBuilder = new HashMap<>(); Matcher parametersMatcher = PARAMETER_PATTERN.matcher(matcher.group(GROUP_MATCHER_INDEX)); while (parametersMatcher.find()) { parametersBuilder.put(parametersMatcher.group(1), parametersMatcher.group(2)); } return new MediaType(type, subType, Collections.unmodifiableMap(parametersBuilder)); }
java
public static MediaType fromString(String text) { Matcher matcher = MEDIA_TYPE_PATTERN.matcher(text); if (!matcher.matches()) { throw new IllegalArgumentException("Invalid media type string: " + text); } String type; String subType; if (matcher.group(GROUP_INDEX) != null) { type = matcher.group(GROUP_INDEX); subType = matcher.group(GROUP_INDEX); } else { type = matcher.group(TYPE_INDEX); subType = matcher.group(SUBTYPE_INDEX); } Map<String, String> parametersBuilder = new HashMap<>(); Matcher parametersMatcher = PARAMETER_PATTERN.matcher(matcher.group(GROUP_MATCHER_INDEX)); while (parametersMatcher.find()) { parametersBuilder.put(parametersMatcher.group(1), parametersMatcher.group(2)); } return new MediaType(type, subType, Collections.unmodifiableMap(parametersBuilder)); }
[ "public", "static", "MediaType", "fromString", "(", "String", "text", ")", "{", "Matcher", "matcher", "=", "MEDIA_TYPE_PATTERN", ".", "matcher", "(", "text", ")", ";", "if", "(", "!", "matcher", ".", "matches", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid media type string: \"", "+", "text", ")", ";", "}", "String", "type", ";", "String", "subType", ";", "if", "(", "matcher", ".", "group", "(", "GROUP_INDEX", ")", "!=", "null", ")", "{", "type", "=", "matcher", ".", "group", "(", "GROUP_INDEX", ")", ";", "subType", "=", "matcher", ".", "group", "(", "GROUP_INDEX", ")", ";", "}", "else", "{", "type", "=", "matcher", ".", "group", "(", "TYPE_INDEX", ")", ";", "subType", "=", "matcher", ".", "group", "(", "SUBTYPE_INDEX", ")", ";", "}", "Map", "<", "String", ",", "String", ">", "parametersBuilder", "=", "new", "HashMap", "<>", "(", ")", ";", "Matcher", "parametersMatcher", "=", "PARAMETER_PATTERN", ".", "matcher", "(", "matcher", ".", "group", "(", "GROUP_MATCHER_INDEX", ")", ")", ";", "while", "(", "parametersMatcher", ".", "find", "(", ")", ")", "{", "parametersBuilder", ".", "put", "(", "parametersMatcher", ".", "group", "(", "1", ")", ",", "parametersMatcher", ".", "group", "(", "2", ")", ")", ";", "}", "return", "new", "MediaType", "(", "type", ",", "subType", ",", "Collections", ".", "unmodifiableMap", "(", "parametersBuilder", ")", ")", ";", "}" ]
Creates a {@code MediaType} by parsing the specified string. The string must look like a standard MIME type string, for example "text/html" or "application/xml". There can optionally be parameters present, for example "text/html; encoding=UTF-8" or "application/xml; q=0.8". @param text A string representing a media type. @return A {@code MediaType} object. @throws java.lang.IllegalArgumentException If the string is not a valid media type string.
[ "Creates", "a", "{", "@code", "MediaType", "}", "by", "parsing", "the", "specified", "string", ".", "The", "string", "must", "look", "like", "a", "standard", "MIME", "type", "string", "for", "example", "text", "/", "html", "or", "application", "/", "xml", ".", "There", "can", "optionally", "be", "parameters", "present", "for", "example", "text", "/", "html", ";", "encoding", "=", "UTF", "-", "8", "or", "application", "/", "xml", ";", "q", "=", "0", ".", "8", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/api/service/MediaType.java#L123-L145
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addConstraintsMaxMessage
public FessMessages addConstraintsMaxMessage(String property, String value) { """ Add the created action message for the key 'constraints.Max.message' with parameters. <pre> message: {item} must be less than or equal to {value}. </pre> @param property The property name for the message. (NotNull) @param value The parameter value for message. (NotNull) @return this. (NotNull) """ assertPropertyNotNull(property); add(property, new UserMessage(CONSTRAINTS_Max_MESSAGE, value)); return this; }
java
public FessMessages addConstraintsMaxMessage(String property, String value) { assertPropertyNotNull(property); add(property, new UserMessage(CONSTRAINTS_Max_MESSAGE, value)); return this; }
[ "public", "FessMessages", "addConstraintsMaxMessage", "(", "String", "property", ",", "String", "value", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "CONSTRAINTS_Max_MESSAGE", ",", "value", ")", ")", ";", "return", "this", ";", "}" ]
Add the created action message for the key 'constraints.Max.message' with parameters. <pre> message: {item} must be less than or equal to {value}. </pre> @param property The property name for the message. (NotNull) @param value The parameter value for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "constraints", ".", "Max", ".", "message", "with", "parameters", ".", "<pre", ">", "message", ":", "{", "item", "}", "must", "be", "less", "than", "or", "equal", "to", "{", "value", "}", ".", "<", "/", "pre", ">" ]
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L696-L700
Azure/azure-sdk-for-java
common/azure-common/src/main/java/com/azure/common/implementation/serializer/HttpResponseBodyDecoder.java
HttpResponseBodyDecoder.contains
private static boolean contains(int[] values, int searchValue) { """ Checks an given value exists in an array. @param values array of ints @param searchValue value to check for existence @return true if value exists in the array, false otherwise """ Objects.requireNonNull(values); for (int value : values) { if (searchValue == value) { return true; } } return false; }
java
private static boolean contains(int[] values, int searchValue) { Objects.requireNonNull(values); for (int value : values) { if (searchValue == value) { return true; } } return false; }
[ "private", "static", "boolean", "contains", "(", "int", "[", "]", "values", ",", "int", "searchValue", ")", "{", "Objects", ".", "requireNonNull", "(", "values", ")", ";", "for", "(", "int", "value", ":", "values", ")", "{", "if", "(", "searchValue", "==", "value", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Checks an given value exists in an array. @param values array of ints @param searchValue value to check for existence @return true if value exists in the array, false otherwise
[ "Checks", "an", "given", "value", "exists", "in", "an", "array", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/implementation/serializer/HttpResponseBodyDecoder.java#L412-L420