repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
alkacon/opencms-core
src-modules/org/opencms/workplace/list/CmsListDirectAction.java
CmsListDirectAction.resolveHelpText
protected String resolveHelpText(Locale locale) { String helpText = getHelpText().key(locale); if ((getColumnForTexts() != null) && (getItem().get(getColumnForTexts()) != null)) { helpText = new MessageFormat(helpText, locale).format(new Object[] {getItem().get(getColumnForTexts())}); } return helpText; }
java
protected String resolveHelpText(Locale locale) { String helpText = getHelpText().key(locale); if ((getColumnForTexts() != null) && (getItem().get(getColumnForTexts()) != null)) { helpText = new MessageFormat(helpText, locale).format(new Object[] {getItem().get(getColumnForTexts())}); } return helpText; }
[ "protected", "String", "resolveHelpText", "(", "Locale", "locale", ")", "{", "String", "helpText", "=", "getHelpText", "(", ")", ".", "key", "(", "locale", ")", ";", "if", "(", "(", "getColumnForTexts", "(", ")", "!=", "null", ")", "&&", "(", "getItem", ...
Help method to resolve the help text to use.<p> @param locale the used locale @return the help text
[ "Help", "method", "to", "resolve", "the", "help", "text", "to", "use", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/list/CmsListDirectAction.java#L68-L75
xwiki/xwiki-rendering
xwiki-rendering-macros/xwiki-rendering-macro-footnotes/src/main/java/org/xwiki/rendering/internal/macro/footnote/PutFootnotesMacro.java
PutFootnotesMacro.createFootnoteBlock
private ListItemBlock createFootnoteBlock(String content, int counter, MacroTransformationContext context) throws MacroExecutionException { List<Block> parsedContent; try { parsedContent = this.contentParser.parse(content, context, false, true).getChildren(); } catch (MacroExecutionException e) { parsedContent = Collections.<Block>singletonList(new WordBlock(content)); } Block result = new WordBlock("^"); DocumentResourceReference reference = new DocumentResourceReference(null); reference.setAnchor(FOOTNOTE_REFERENCE_ID_PREFIX + counter); result = new LinkBlock(Collections.singletonList(result), reference, false); result.setParameter(ID_ATTRIBUTE_NAME, FOOTNOTE_ID_PREFIX + counter); result.setParameter(CLASS_ATTRIBUTE_NAME, "footnoteBackRef"); result = new ListItemBlock(Collections.singletonList(result)); result.addChild(new SpaceBlock()); result.addChildren(parsedContent); return (ListItemBlock) result; }
java
private ListItemBlock createFootnoteBlock(String content, int counter, MacroTransformationContext context) throws MacroExecutionException { List<Block> parsedContent; try { parsedContent = this.contentParser.parse(content, context, false, true).getChildren(); } catch (MacroExecutionException e) { parsedContent = Collections.<Block>singletonList(new WordBlock(content)); } Block result = new WordBlock("^"); DocumentResourceReference reference = new DocumentResourceReference(null); reference.setAnchor(FOOTNOTE_REFERENCE_ID_PREFIX + counter); result = new LinkBlock(Collections.singletonList(result), reference, false); result.setParameter(ID_ATTRIBUTE_NAME, FOOTNOTE_ID_PREFIX + counter); result.setParameter(CLASS_ATTRIBUTE_NAME, "footnoteBackRef"); result = new ListItemBlock(Collections.singletonList(result)); result.addChild(new SpaceBlock()); result.addChildren(parsedContent); return (ListItemBlock) result; }
[ "private", "ListItemBlock", "createFootnoteBlock", "(", "String", "content", ",", "int", "counter", ",", "MacroTransformationContext", "context", ")", "throws", "MacroExecutionException", "{", "List", "<", "Block", ">", "parsedContent", ";", "try", "{", "parsedContent...
Generate the footnote block, a numbered list item containing a backlink to the footnote's reference, and the actual footnote text, parsed into XDOM. @param content the string representation of the actual footnote text; the content of the macro @param counter the current footnote counter @param context the macro transformation context, used for obtaining the correct parser for parsing the content @return the generated footnote block @throws MacroExecutionException if parsing the content fails
[ "Generate", "the", "footnote", "block", "a", "numbered", "list", "item", "containing", "a", "backlink", "to", "the", "footnote", "s", "reference", "and", "the", "actual", "footnote", "text", "parsed", "into", "XDOM", "." ]
train
https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-macros/xwiki-rendering-macro-footnotes/src/main/java/org/xwiki/rendering/internal/macro/footnote/PutFootnotesMacro.java#L210-L229
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java
KeyedStream.asQueryableState
@PublicEvolving public QueryableStateStream<KEY, T> asQueryableState(String queryableStateName) { ValueStateDescriptor<T> valueStateDescriptor = new ValueStateDescriptor<T>( UUID.randomUUID().toString(), getType()); return asQueryableState(queryableStateName, valueStateDescriptor); }
java
@PublicEvolving public QueryableStateStream<KEY, T> asQueryableState(String queryableStateName) { ValueStateDescriptor<T> valueStateDescriptor = new ValueStateDescriptor<T>( UUID.randomUUID().toString(), getType()); return asQueryableState(queryableStateName, valueStateDescriptor); }
[ "@", "PublicEvolving", "public", "QueryableStateStream", "<", "KEY", ",", "T", ">", "asQueryableState", "(", "String", "queryableStateName", ")", "{", "ValueStateDescriptor", "<", "T", ">", "valueStateDescriptor", "=", "new", "ValueStateDescriptor", "<", "T", ">", ...
Publishes the keyed stream as queryable ValueState instance. @param queryableStateName Name under which to the publish the queryable state instance @return Queryable state instance
[ "Publishes", "the", "keyed", "stream", "as", "queryable", "ValueState", "instance", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java#L1003-L1010
samskivert/samskivert
src/main/java/com/samskivert/util/StringUtil.java
StringUtil.parseFloatArray
public static float[] parseFloatArray (String source) { StringTokenizer tok = new StringTokenizer(source, ","); float[] vals = new float[tok.countTokens()]; for (int i = 0; tok.hasMoreTokens(); i++) { try { // trim the whitespace from the token vals[i] = Float.parseFloat(tok.nextToken().trim()); } catch (NumberFormatException nfe) { return null; } } return vals; }
java
public static float[] parseFloatArray (String source) { StringTokenizer tok = new StringTokenizer(source, ","); float[] vals = new float[tok.countTokens()]; for (int i = 0; tok.hasMoreTokens(); i++) { try { // trim the whitespace from the token vals[i] = Float.parseFloat(tok.nextToken().trim()); } catch (NumberFormatException nfe) { return null; } } return vals; }
[ "public", "static", "float", "[", "]", "parseFloatArray", "(", "String", "source", ")", "{", "StringTokenizer", "tok", "=", "new", "StringTokenizer", "(", "source", ",", "\",\"", ")", ";", "float", "[", "]", "vals", "=", "new", "float", "[", "tok", ".", ...
Parses an array of floats from it's string representation. The array should be represented as a bare list of numbers separated by commas, for example: <pre>25.0, .5, 1, 0.99</pre> Any inability to parse the array will result in the function returning null.
[ "Parses", "an", "array", "of", "floats", "from", "it", "s", "string", "representation", ".", "The", "array", "should", "be", "represented", "as", "a", "bare", "list", "of", "numbers", "separated", "by", "commas", "for", "example", ":" ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/StringUtil.java#L844-L857
thymeleaf/thymeleaf
src/main/java/org/thymeleaf/util/TextUtils.java
TextUtils.binarySearch
public static int binarySearch( final boolean caseSensitive, final CharSequence[] values, final char[] text, final int textOffset, final int textLen) { if (values == null) { throw new IllegalArgumentException("Values array cannot be null"); } return binarySearch(caseSensitive, values, 0, values.length, text, textOffset, textLen); }
java
public static int binarySearch( final boolean caseSensitive, final CharSequence[] values, final char[] text, final int textOffset, final int textLen) { if (values == null) { throw new IllegalArgumentException("Values array cannot be null"); } return binarySearch(caseSensitive, values, 0, values.length, text, textOffset, textLen); }
[ "public", "static", "int", "binarySearch", "(", "final", "boolean", "caseSensitive", ",", "final", "CharSequence", "[", "]", "values", ",", "final", "char", "[", "]", "text", ",", "final", "int", "textOffset", ",", "final", "int", "textLen", ")", "{", "if"...
<p> Searches the specified array of texts ({@code values}) for the specified text &mdash;or a fragment, using an (offset,len) specification&mdash; using the binary search algorithm. </p> <p> Note the specified {@code values} parameter <strong>must be lexicographically ordered</strong>. </p> @param caseSensitive whether the comparison must be done in a case-sensitive or case-insensitive way. @param values the array of texts inside which the specified text will be searched. Note that it must be <strong>ordered</strong>. @param text the text to search. @param textOffset the offset of the text to search. @param textLen the length of the text to search. @return index of the search key, if it is contained in the values array; otherwise, {@code (-(insertion point) - 1)}. The insertion point is defined as the point at which the key would be inserted into the array. Note that this guarantees that the return value will be &gt;= 0 if and only if the key is found.
[ "<p", ">", "Searches", "the", "specified", "array", "of", "texts", "(", "{", "@code", "values", "}", ")", "for", "the", "specified", "text", "&mdash", ";", "or", "a", "fragment", "using", "an", "(", "offset", "len", ")", "specification&mdash", ";", "usin...
train
https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/util/TextUtils.java#L1877-L1886
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java
JvmTypesBuilder.setInitializer
public void setInitializer(/* @Nullable */ JvmField field, /* @Nullable */ StringConcatenationClient strategy) { if (field == null || strategy == null) return; removeExistingBody(field); setCompilationStrategy(field, strategy); }
java
public void setInitializer(/* @Nullable */ JvmField field, /* @Nullable */ StringConcatenationClient strategy) { if (field == null || strategy == null) return; removeExistingBody(field); setCompilationStrategy(field, strategy); }
[ "public", "void", "setInitializer", "(", "/* @Nullable */", "JvmField", "field", ",", "/* @Nullable */", "StringConcatenationClient", "strategy", ")", "{", "if", "(", "field", "==", "null", "||", "strategy", "==", "null", ")", "return", ";", "removeExistingBody", ...
Attaches the given compile strategy to the given {@link JvmField} such that the compiler knows how to initialize the {@link JvmField} when it is translated to Java source code. @param field the field to add the initializer to. If <code>null</code> this method does nothing. @param strategy the compilation strategy. If <code>null</code> this method does nothing.
[ "Attaches", "the", "given", "compile", "strategy", "to", "the", "given", "{", "@link", "JvmField", "}", "such", "that", "the", "compiler", "knows", "how", "to", "initialize", "the", "{", "@link", "JvmField", "}", "when", "it", "is", "translated", "to", "Ja...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java#L1244-L1249
cloudant/sync-android
cloudant-sync-datastore-javase/src/main/java/com/cloudant/sync/internal/sqlite/sqlite4java/SQLiteWrapperUtils.java
SQLiteWrapperUtils.longForQuery
public static Long longForQuery(SQLiteConnection conn, String query, Object[] bindArgs) throws SQLiteException { SQLiteStatement stmt = null; try { stmt = conn.prepare(query); if (bindArgs != null && bindArgs.length > 0) { stmt = SQLiteWrapperUtils.bindArguments(stmt, bindArgs); } if (stmt.step()) { return stmt.columnLong(0); } else { throw new IllegalStateException("query failed to return any result: " + query); } } finally { SQLiteWrapperUtils.disposeQuietly(stmt); } }
java
public static Long longForQuery(SQLiteConnection conn, String query, Object[] bindArgs) throws SQLiteException { SQLiteStatement stmt = null; try { stmt = conn.prepare(query); if (bindArgs != null && bindArgs.length > 0) { stmt = SQLiteWrapperUtils.bindArguments(stmt, bindArgs); } if (stmt.step()) { return stmt.columnLong(0); } else { throw new IllegalStateException("query failed to return any result: " + query); } } finally { SQLiteWrapperUtils.disposeQuietly(stmt); } }
[ "public", "static", "Long", "longForQuery", "(", "SQLiteConnection", "conn", ",", "String", "query", ",", "Object", "[", "]", "bindArgs", ")", "throws", "SQLiteException", "{", "SQLiteStatement", "stmt", "=", "null", ";", "try", "{", "stmt", "=", "conn", "."...
Utility method to run the query on the db and return the value in the first column of the first row.
[ "Utility", "method", "to", "run", "the", "query", "on", "the", "db", "and", "return", "the", "value", "in", "the", "first", "column", "of", "the", "first", "row", "." ]
train
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-javase/src/main/java/com/cloudant/sync/internal/sqlite/sqlite4java/SQLiteWrapperUtils.java#L43-L59
maestrano/maestrano-java
src/main/java/com/maestrano/configuration/Sso.java
Sso.buildResponse
public Response buildResponse(String samlResponse) throws MnoException { try { return Response.loadFromBase64XML(this, samlResponse); } catch (Exception e) { throw new MnoException("Could not build Response from samlResponse: " + samlResponse, e); } }
java
public Response buildResponse(String samlResponse) throws MnoException { try { return Response.loadFromBase64XML(this, samlResponse); } catch (Exception e) { throw new MnoException("Could not build Response from samlResponse: " + samlResponse, e); } }
[ "public", "Response", "buildResponse", "(", "String", "samlResponse", ")", "throws", "MnoException", "{", "try", "{", "return", "Response", ".", "loadFromBase64XML", "(", "this", ",", "samlResponse", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "...
Build a {@linkplain Response} with the provided base64 encoded XML string @param samlResponse @return @throws MnoException
[ "Build", "a", "{", "@linkplain", "Response", "}", "with", "the", "provided", "base64", "encoded", "XML", "string" ]
train
https://github.com/maestrano/maestrano-java/blob/e71c6d3172d7645529d678d1cb3ea9e0a59de314/src/main/java/com/maestrano/configuration/Sso.java#L189-L195
alrocar/POIProxy
es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/proxy/POIProxy.java
POIProxy.doRequest
public String doRequest(String url, DescribeService service, String id) throws Exception { RequestService request = requestServices.getRequestService(service.getAuthType()); byte[] data = request.download(url, id, PropertyLocator.getInstance().tempFolder + id + File.separator, service.getAuth()); System.out.println(url); if (service.getCompression() != null && service.getCompression().equals(CompressionEnum.ZIP.format)) { Unzip unzip = new Unzip(); unzip.unzip(PropertyLocator.getInstance().tempFolder + id + File.separator, PropertyLocator.getInstance().tempFolder + id + File.separator + id, true); Downloader opener = new Downloader(); return opener.openFile( PropertyLocator.getInstance().tempFolder + id + File.separator + service.getContentFile()); } return new String(data, service.getEncoding()); }
java
public String doRequest(String url, DescribeService service, String id) throws Exception { RequestService request = requestServices.getRequestService(service.getAuthType()); byte[] data = request.download(url, id, PropertyLocator.getInstance().tempFolder + id + File.separator, service.getAuth()); System.out.println(url); if (service.getCompression() != null && service.getCompression().equals(CompressionEnum.ZIP.format)) { Unzip unzip = new Unzip(); unzip.unzip(PropertyLocator.getInstance().tempFolder + id + File.separator, PropertyLocator.getInstance().tempFolder + id + File.separator + id, true); Downloader opener = new Downloader(); return opener.openFile( PropertyLocator.getInstance().tempFolder + id + File.separator + service.getContentFile()); } return new String(data, service.getEncoding()); }
[ "public", "String", "doRequest", "(", "String", "url", ",", "DescribeService", "service", ",", "String", "id", ")", "throws", "Exception", "{", "RequestService", "request", "=", "requestServices", ".", "getRequestService", "(", "service", ".", "getAuthType", "(", ...
Calls {@link Downloader#downloadFromUrl(String, es.prodevelop.gvsig.mini.utiles.Cancellable)} @param url The url to request to @param service The {@link DescribeService} object @param id The ID of the {@link DescribeService} @return The data downloaded @throws Exception
[ "Calls", "{", "@link", "Downloader#downloadFromUrl", "(", "String", "es", ".", "prodevelop", ".", "gvsig", ".", "mini", ".", "utiles", ".", "Cancellable", ")", "}" ]
train
https://github.com/alrocar/POIProxy/blob/e1dabe738a862478b2580e90d5fc4209a2997868/es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/proxy/POIProxy.java#L657-L675
fedups/com.obdobion.argument
src/main/java/com/obdobion/argument/input/CommandLineParser.java
CommandLineParser.getInstance
static public IParserInput getInstance( final char commandPrefix, final File args) throws IOException { return getInstance(commandPrefix, false, args); }
java
static public IParserInput getInstance( final char commandPrefix, final File args) throws IOException { return getInstance(commandPrefix, false, args); }
[ "static", "public", "IParserInput", "getInstance", "(", "final", "char", "commandPrefix", ",", "final", "File", "args", ")", "throws", "IOException", "{", "return", "getInstance", "(", "commandPrefix", ",", "false", ",", "args", ")", ";", "}" ]
<p> getInstance. </p> @param commandPrefix a char. @param args a {@link java.io.File} object. @return a {@link com.obdobion.argument.input.IParserInput} object. @throws java.io.IOException if any.
[ "<p", ">", "getInstance", ".", "<", "/", "p", ">" ]
train
https://github.com/fedups/com.obdobion.argument/blob/9679aebbeedaef4e592227842fa0e91410708a67/src/main/java/com/obdobion/argument/input/CommandLineParser.java#L112-L118
fcrepo4/fcrepo4
fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java
ViewHelpers.getVersions
public Iterator<Node> getVersions(final Graph graph, final Node subject) { // Mementos should be ordered by date so use the getOrderedVersions. return getOrderedVersions(graph, subject, CONTAINS.asResource()); }
java
public Iterator<Node> getVersions(final Graph graph, final Node subject) { // Mementos should be ordered by date so use the getOrderedVersions. return getOrderedVersions(graph, subject, CONTAINS.asResource()); }
[ "public", "Iterator", "<", "Node", ">", "getVersions", "(", "final", "Graph", "graph", ",", "final", "Node", "subject", ")", "{", "// Mementos should be ordered by date so use the getOrderedVersions.", "return", "getOrderedVersions", "(", "graph", ",", "subject", ",", ...
Return an iterator of Triples for versions. @param graph the graph @param subject the subject @return iterator
[ "Return", "an", "iterator", "of", "Triples", "for", "versions", "." ]
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L106-L110
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/SimpleAttributeDefinitionBuilder.java
SimpleAttributeDefinitionBuilder.create
public static SimpleAttributeDefinitionBuilder create(final String name, final ModelNode node) { ModelType type = node.get(ModelDescriptionConstants.TYPE).asType(); boolean nillable = node.get(ModelDescriptionConstants.NILLABLE).asBoolean(true); boolean expressionAllowed = node.get(ModelDescriptionConstants.EXPRESSIONS_ALLOWED).asBoolean(false); ModelNode defaultValue = nillable ? node.get(ModelDescriptionConstants.DEFAULT) : new ModelNode(); return SimpleAttributeDefinitionBuilder.create(name, type, nillable) .setDefaultValue(defaultValue) .setAllowExpression(expressionAllowed); }
java
public static SimpleAttributeDefinitionBuilder create(final String name, final ModelNode node) { ModelType type = node.get(ModelDescriptionConstants.TYPE).asType(); boolean nillable = node.get(ModelDescriptionConstants.NILLABLE).asBoolean(true); boolean expressionAllowed = node.get(ModelDescriptionConstants.EXPRESSIONS_ALLOWED).asBoolean(false); ModelNode defaultValue = nillable ? node.get(ModelDescriptionConstants.DEFAULT) : new ModelNode(); return SimpleAttributeDefinitionBuilder.create(name, type, nillable) .setDefaultValue(defaultValue) .setAllowExpression(expressionAllowed); }
[ "public", "static", "SimpleAttributeDefinitionBuilder", "create", "(", "final", "String", "name", ",", "final", "ModelNode", "node", ")", "{", "ModelType", "type", "=", "node", ".", "get", "(", "ModelDescriptionConstants", ".", "TYPE", ")", ".", "asType", "(", ...
/* "code" => { "type" => STRING, "description" => "Fully Qualified Name of the Security Vault Implementation.", "expressions-allowed" => false, "nillable" => true, "min-length" => 1L, "max-length" => 2147483647L, "access-type" => "read-write", "storage" => "configuration", "restart-required" => "no-services" },
[ "/", "*", "code", "=", ">", "{", "type", "=", ">", "STRING", "description", "=", ">", "Fully", "Qualified", "Name", "of", "the", "Security", "Vault", "Implementation", ".", "expressions", "-", "allowed", "=", ">", "false", "nillable", "=", ">", "true", ...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/SimpleAttributeDefinitionBuilder.java#L61-L69
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CirculantGraph.java
CirculantGraph.addRange
public CirculantGraph addRange(long offset, long length) { Preconditions.checkArgument(offset >= MINIMUM_OFFSET, "Range offset must be at least " + MINIMUM_OFFSET); Preconditions.checkArgument(length <= vertexCount - offset, "Range length must not be greater than the vertex count minus the range offset."); offsetRanges.add(new OffsetRange(offset, length)); return this; }
java
public CirculantGraph addRange(long offset, long length) { Preconditions.checkArgument(offset >= MINIMUM_OFFSET, "Range offset must be at least " + MINIMUM_OFFSET); Preconditions.checkArgument(length <= vertexCount - offset, "Range length must not be greater than the vertex count minus the range offset."); offsetRanges.add(new OffsetRange(offset, length)); return this; }
[ "public", "CirculantGraph", "addRange", "(", "long", "offset", ",", "long", "length", ")", "{", "Preconditions", ".", "checkArgument", "(", "offset", ">=", "MINIMUM_OFFSET", ",", "\"Range offset must be at least \"", "+", "MINIMUM_OFFSET", ")", ";", "Preconditions", ...
Required configuration for each range of offsets in the graph. @param offset first offset appointing the vertices' position @param length number of contiguous offsets in range @return this
[ "Required", "configuration", "for", "each", "range", "of", "offsets", "in", "the", "graph", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CirculantGraph.java#L81-L90
CleverTap/clevertap-android-sdk
clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java
CleverTapAPI.pushFcmRegistrationId
@SuppressWarnings("WeakerAccess") public void pushFcmRegistrationId(String fcmId, boolean register) { pushDeviceToken(fcmId, register, PushType.FCM); }
java
@SuppressWarnings("WeakerAccess") public void pushFcmRegistrationId(String fcmId, boolean register) { pushDeviceToken(fcmId, register, PushType.FCM); }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "void", "pushFcmRegistrationId", "(", "String", "fcmId", ",", "boolean", "register", ")", "{", "pushDeviceToken", "(", "fcmId", ",", "register", ",", "PushType", ".", "FCM", ")", ";", "}" ]
Sends the FCM registration ID to CleverTap. @param fcmId The FCM registration ID @param register Boolean indicating whether to register or not for receiving push messages from CleverTap. Set this to true to receive push messages from CleverTap, and false to not receive any messages from CleverTap.
[ "Sends", "the", "FCM", "registration", "ID", "to", "CleverTap", "." ]
train
https://github.com/CleverTap/clevertap-android-sdk/blob/be134c06a4f07494c398335ad9ff4976633743e1/clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java#L4821-L4824
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getStorySeasonInfo
public void getStorySeasonInfo(String[] ids, Callback<List<StorySeason>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getStorySeasonInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getStorySeasonInfo(String[] ids, Callback<List<StorySeason>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getStorySeasonInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getStorySeasonInfo", "(", "String", "[", "]", "ids", ",", "Callback", "<", "List", "<", "StorySeason", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(...
For more info on stories seasons API go <a href="https://wiki.guildwars2.com/wiki/API:2/stories/seasons">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of story season id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see StorySeason story season info
[ "For", "more", "info", "on", "stories", "seasons", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "stories", "/", "seasons", ">", "here<", "/", "a", ">", "<br", "...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2466-L2469
galan/commons
src/main/java/de/galan/commons/net/Ports.java
Ports.findFree
public static Integer findFree(int lowIncluse, int highInclusive) { int low = Math.max(1, Math.min(lowIncluse, highInclusive)); int high = Math.min(65535, Math.max(lowIncluse, highInclusive)); Integer result = null; int split = RandomUtils.nextInt(low, high + 1); for (int port = split; port <= high; port++) { if (isFree(port)) { result = port; break; } } if (result == null) { for (int port = low; port < split; port++) { if (isFree(port)) { result = port; break; } } } return result; }
java
public static Integer findFree(int lowIncluse, int highInclusive) { int low = Math.max(1, Math.min(lowIncluse, highInclusive)); int high = Math.min(65535, Math.max(lowIncluse, highInclusive)); Integer result = null; int split = RandomUtils.nextInt(low, high + 1); for (int port = split; port <= high; port++) { if (isFree(port)) { result = port; break; } } if (result == null) { for (int port = low; port < split; port++) { if (isFree(port)) { result = port; break; } } } return result; }
[ "public", "static", "Integer", "findFree", "(", "int", "lowIncluse", ",", "int", "highInclusive", ")", "{", "int", "low", "=", "Math", ".", "max", "(", "1", ",", "Math", ".", "min", "(", "lowIncluse", ",", "highInclusive", ")", ")", ";", "int", "high",...
Returns a free port in the defined range, returns null if none is available.
[ "Returns", "a", "free", "port", "in", "the", "defined", "range", "returns", "null", "if", "none", "is", "available", "." ]
train
https://github.com/galan/commons/blob/45d2f36c69958d3f847e5fed66603ea629471822/src/main/java/de/galan/commons/net/Ports.java#L27-L47
greenmail-mail-test/greenmail
greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMailUtil.java
GreenMailUtil.newMimeMessage
public static MimeMessage newMimeMessage(String mailString) throws MessagingException { return newMimeMessage(EncodingUtil.toStream(mailString, EncodingUtil.CHARSET_EIGHT_BIT_ENCODING)); }
java
public static MimeMessage newMimeMessage(String mailString) throws MessagingException { return newMimeMessage(EncodingUtil.toStream(mailString, EncodingUtil.CHARSET_EIGHT_BIT_ENCODING)); }
[ "public", "static", "MimeMessage", "newMimeMessage", "(", "String", "mailString", ")", "throws", "MessagingException", "{", "return", "newMimeMessage", "(", "EncodingUtil", ".", "toStream", "(", "mailString", ",", "EncodingUtil", ".", "CHARSET_EIGHT_BIT_ENCODING", ")", ...
Convenience method which creates a new {@link MimeMessage} from a string @throws MessagingException
[ "Convenience", "method", "which", "creates", "a", "new", "{", "@link", "MimeMessage", "}", "from", "a", "string" ]
train
https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMailUtil.java#L83-L85
alkacon/opencms-core
src/org/opencms/workflow/CmsExtendedPublishResourceFormatter.java
CmsExtendedPublishResourceFormatter.getMessage
protected String getMessage(String key, String... args) { return Messages.get().getBundle(m_cms.getRequestContext().getLocale()).key(key, args); }
java
protected String getMessage(String key, String... args) { return Messages.get().getBundle(m_cms.getRequestContext().getLocale()).key(key, args); }
[ "protected", "String", "getMessage", "(", "String", "key", ",", "String", "...", "args", ")", "{", "return", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", "m_cms", ".", "getRequestContext", "(", ")", ".", "getLocale", "(", ")", ")", ".", "ke...
Gets a message from the message bundle.<p> @param key the message key @param args the message parameters @return the message from the message bundle
[ "Gets", "a", "message", "from", "the", "message", "bundle", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workflow/CmsExtendedPublishResourceFormatter.java#L153-L156
b3dgs/lionengine
lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/MouseMoveAwt.java
MouseMoveAwt.robotMove
void robotMove(int nx, int ny) { oldX = x; oldY = y; x = nx; y = ny; wx = nx; wy = ny; mx = x - oldX; my = y - oldY; moved = true; }
java
void robotMove(int nx, int ny) { oldX = x; oldY = y; x = nx; y = ny; wx = nx; wy = ny; mx = x - oldX; my = y - oldY; moved = true; }
[ "void", "robotMove", "(", "int", "nx", ",", "int", "ny", ")", "{", "oldX", "=", "x", ";", "oldY", "=", "y", ";", "x", "=", "nx", ";", "y", "=", "ny", ";", "wx", "=", "nx", ";", "wy", "=", "ny", ";", "mx", "=", "x", "-", "oldX", ";", "my...
Move mouse with robot. @param nx The new X. @param ny The new Y.
[ "Move", "mouse", "with", "robot", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/MouseMoveAwt.java#L99-L110
finmath/finmath-lib
src/main/java6/net/finmath/marketdata/model/curves/HazardCurve.java
HazardCurve.createHazardCurveFromSurvivalProbabilities
public static HazardCurve createHazardCurveFromSurvivalProbabilities(String name, double[] times, double[] givenSurvivalProbabilities){ HazardCurve survivalProbabilities = new HazardCurve(name); for(int timeIndex=0; timeIndex<times.length;timeIndex++) { survivalProbabilities.addSurvivalProbability(times[timeIndex], givenSurvivalProbabilities[timeIndex], times[timeIndex] > 0); } return survivalProbabilities; }
java
public static HazardCurve createHazardCurveFromSurvivalProbabilities(String name, double[] times, double[] givenSurvivalProbabilities){ HazardCurve survivalProbabilities = new HazardCurve(name); for(int timeIndex=0; timeIndex<times.length;timeIndex++) { survivalProbabilities.addSurvivalProbability(times[timeIndex], givenSurvivalProbabilities[timeIndex], times[timeIndex] > 0); } return survivalProbabilities; }
[ "public", "static", "HazardCurve", "createHazardCurveFromSurvivalProbabilities", "(", "String", "name", ",", "double", "[", "]", "times", ",", "double", "[", "]", "givenSurvivalProbabilities", ")", "{", "HazardCurve", "survivalProbabilities", "=", "new", "HazardCurve", ...
Create a hazard curve from given times and given discount factors using default interpolation and extrapolation methods. @param name The name of this hazard curve. @param times Array of times as doubles. @param givenSurvivalProbabilities Array of corresponding survival probabilities. @return A new discount factor object.
[ "Create", "a", "hazard", "curve", "from", "given", "times", "and", "given", "discount", "factors", "using", "default", "interpolation", "and", "extrapolation", "methods", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/model/curves/HazardCurve.java#L152-L160
nohana/Amalgam
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
BundleUtils.buildKey
public static String buildKey(Class<?> clazz, String name) { return new StringBuilder().append(clazz.getCanonicalName()).append(".").append(name).toString(); }
java
public static String buildKey(Class<?> clazz, String name) { return new StringBuilder().append(clazz.getCanonicalName()).append(".").append(name).toString(); }
[ "public", "static", "String", "buildKey", "(", "Class", "<", "?", ">", "clazz", ",", "String", "name", ")", "{", "return", "new", "StringBuilder", "(", ")", ".", "append", "(", "clazz", ".", "getCanonicalName", "(", ")", ")", ".", "append", "(", "\".\"...
Build a custom bundle key name, to avoid conflict the bundle key name among the activities. This is also useful to build a intent extra key name. @param clazz the class. @param name the key name, in most case the name is UPPER_UNDERSCORE. @return the full qualified key name.
[ "Build", "a", "custom", "bundle", "key", "name", "to", "avoid", "conflict", "the", "bundle", "key", "name", "among", "the", "activities", ".", "This", "is", "also", "useful", "to", "build", "a", "intent", "extra", "key", "name", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L51-L53
Netflix/zuul
zuul-core/src/main/java/com/netflix/zuul/netty/filter/ZuulEndPointRunner.java
ZuulEndPointRunner.newProxyEndpoint
protected ZuulFilter<HttpRequestMessage, HttpResponseMessage> newProxyEndpoint(HttpRequestMessage zuulRequest) { return new ProxyEndpoint(zuulRequest, getChannelHandlerContext(zuulRequest), getNextStage(), MethodBinding.NO_OP_BINDING); }
java
protected ZuulFilter<HttpRequestMessage, HttpResponseMessage> newProxyEndpoint(HttpRequestMessage zuulRequest) { return new ProxyEndpoint(zuulRequest, getChannelHandlerContext(zuulRequest), getNextStage(), MethodBinding.NO_OP_BINDING); }
[ "protected", "ZuulFilter", "<", "HttpRequestMessage", ",", "HttpResponseMessage", ">", "newProxyEndpoint", "(", "HttpRequestMessage", "zuulRequest", ")", "{", "return", "new", "ProxyEndpoint", "(", "zuulRequest", ",", "getChannelHandlerContext", "(", "zuulRequest", ")", ...
Override to inject your own proxy endpoint implementation @param zuulRequest - the request message @return the proxy endpoint
[ "Override", "to", "inject", "your", "own", "proxy", "endpoint", "implementation" ]
train
https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/netty/filter/ZuulEndPointRunner.java#L187-L189
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/lof/LoOP.java
LoOP.computePLOFs
protected double computePLOFs(Relation<O> relation, KNNQuery<O> knn, WritableDoubleDataStore pdists, WritableDoubleDataStore plofs) { FiniteProgress progressPLOFs = LOG.isVerbose() ? new FiniteProgress("PLOFs for objects", relation.size(), LOG) : null; double nplof = 0.; for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { final KNNList neighbors = knn.getKNNForDBID(iditer, kcomp + 1); // + query // point // use first kref neighbors as comparison set. int ks = 0; double sum = 0.; for(DBIDIter neighbor = neighbors.iter(); neighbor.valid() && ks < kcomp; neighbor.advance()) { if(DBIDUtil.equal(neighbor, iditer)) { continue; } sum += pdists.doubleValue(neighbor); ks++; } double plof = MathUtil.max(pdists.doubleValue(iditer) * ks / sum, 1.0); if(Double.isNaN(plof) || Double.isInfinite(plof)) { plof = 1.0; } plofs.putDouble(iditer, plof); nplof += (plof - 1.0) * (plof - 1.0); LOG.incrementProcessed(progressPLOFs); } LOG.ensureCompleted(progressPLOFs); nplof = lambda * FastMath.sqrt(nplof / relation.size()); if(LOG.isDebuggingFine()) { LOG.debugFine("nplof normalization factor is " + nplof); } return nplof > 0. ? nplof : 1.; }
java
protected double computePLOFs(Relation<O> relation, KNNQuery<O> knn, WritableDoubleDataStore pdists, WritableDoubleDataStore plofs) { FiniteProgress progressPLOFs = LOG.isVerbose() ? new FiniteProgress("PLOFs for objects", relation.size(), LOG) : null; double nplof = 0.; for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { final KNNList neighbors = knn.getKNNForDBID(iditer, kcomp + 1); // + query // point // use first kref neighbors as comparison set. int ks = 0; double sum = 0.; for(DBIDIter neighbor = neighbors.iter(); neighbor.valid() && ks < kcomp; neighbor.advance()) { if(DBIDUtil.equal(neighbor, iditer)) { continue; } sum += pdists.doubleValue(neighbor); ks++; } double plof = MathUtil.max(pdists.doubleValue(iditer) * ks / sum, 1.0); if(Double.isNaN(plof) || Double.isInfinite(plof)) { plof = 1.0; } plofs.putDouble(iditer, plof); nplof += (plof - 1.0) * (plof - 1.0); LOG.incrementProcessed(progressPLOFs); } LOG.ensureCompleted(progressPLOFs); nplof = lambda * FastMath.sqrt(nplof / relation.size()); if(LOG.isDebuggingFine()) { LOG.debugFine("nplof normalization factor is " + nplof); } return nplof > 0. ? nplof : 1.; }
[ "protected", "double", "computePLOFs", "(", "Relation", "<", "O", ">", "relation", ",", "KNNQuery", "<", "O", ">", "knn", ",", "WritableDoubleDataStore", "pdists", ",", "WritableDoubleDataStore", "plofs", ")", "{", "FiniteProgress", "progressPLOFs", "=", "LOG", ...
Compute the LOF values, using the pdist distances. @param relation Data relation @param knn kNN query @param pdists Precomputed distances @param plofs Storage for PLOFs. @return Normalization factor.
[ "Compute", "the", "LOF", "values", "using", "the", "pdist", "distances", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/lof/LoOP.java#L275-L307
Guichaguri/MinimalFTP
src/main/java/com/guichaguri/minimalftp/FTPConnection.java
FTPConnection.addSiteCommand
protected void addSiteCommand(String label, String help, Command cmd) { siteCommands.put(label.toUpperCase(), new CommandInfo(cmd, help, true)); }
java
protected void addSiteCommand(String label, String help, Command cmd) { siteCommands.put(label.toUpperCase(), new CommandInfo(cmd, help, true)); }
[ "protected", "void", "addSiteCommand", "(", "String", "label", ",", "String", "help", ",", "Command", "cmd", ")", "{", "siteCommands", ".", "put", "(", "label", ".", "toUpperCase", "(", ")", ",", "new", "CommandInfo", "(", "cmd", ",", "help", ",", "true"...
Internally registers a SITE sub-command @param label The command name @param help The help message @param cmd The command function
[ "Internally", "registers", "a", "SITE", "sub", "-", "command" ]
train
https://github.com/Guichaguri/MinimalFTP/blob/ddd81e26ec88079ee4c37fe53d8efe420996e9b1/src/main/java/com/guichaguri/minimalftp/FTPConnection.java#L411-L413
rterp/GMapsFX
GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptRuntime.java
JavascriptRuntime.getArrayConstructor
@Override public String getArrayConstructor(String javascriptObjectType, Object[] ary) { String fn = getArrayFunction("new " + javascriptObjectType, ary); return fn; }
java
@Override public String getArrayConstructor(String javascriptObjectType, Object[] ary) { String fn = getArrayFunction("new " + javascriptObjectType, ary); return fn; }
[ "@", "Override", "public", "String", "getArrayConstructor", "(", "String", "javascriptObjectType", ",", "Object", "[", "]", "ary", ")", "{", "String", "fn", "=", "getArrayFunction", "(", "\"new \"", "+", "javascriptObjectType", ",", "ary", ")", ";", "return", ...
Gets an array parameter constructor as a String, which then can be passed to the execute() method. @param javascriptObjectType type The type of JavaScript object array to create @param ary The array elements @return A string which can be passed to the JavaScript environment to create a new array.
[ "Gets", "an", "array", "parameter", "constructor", "as", "a", "String", "which", "then", "can", "be", "passed", "to", "the", "execute", "()", "method", "." ]
train
https://github.com/rterp/GMapsFX/blob/4623d3f768e8ad78fc50ee32dd204d236e01059f/GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptRuntime.java#L93-L97
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/Drawer.java
Drawer.addItemsAtPosition
public void addItemsAtPosition(int position, @NonNull IDrawerItem... drawerItems) { mDrawerBuilder.getItemAdapter().add(position, drawerItems); }
java
public void addItemsAtPosition(int position, @NonNull IDrawerItem... drawerItems) { mDrawerBuilder.getItemAdapter().add(position, drawerItems); }
[ "public", "void", "addItemsAtPosition", "(", "int", "position", ",", "@", "NonNull", "IDrawerItem", "...", "drawerItems", ")", "{", "mDrawerBuilder", ".", "getItemAdapter", "(", ")", ".", "add", "(", "position", ",", "drawerItems", ")", ";", "}" ]
add new items to the current DrawerItem list at a specific position @param position @param drawerItems
[ "add", "new", "items", "to", "the", "current", "DrawerItem", "list", "at", "a", "specific", "position" ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/Drawer.java#L802-L804
pravega/pravega
common/src/main/java/io/pravega/common/Exceptions.java
Exceptions.checkArgument
public static void checkArgument(boolean validCondition, String argName, String message, Object... args) throws IllegalArgumentException { if (!validCondition) { throw new IllegalArgumentException(badArgumentMessage(argName, message, args)); } }
java
public static void checkArgument(boolean validCondition, String argName, String message, Object... args) throws IllegalArgumentException { if (!validCondition) { throw new IllegalArgumentException(badArgumentMessage(argName, message, args)); } }
[ "public", "static", "void", "checkArgument", "(", "boolean", "validCondition", ",", "String", "argName", ",", "String", "message", ",", "Object", "...", "args", ")", "throws", "IllegalArgumentException", "{", "if", "(", "!", "validCondition", ")", "{", "throw", ...
Throws an IllegalArgumentException if the validCondition argument is false. @param validCondition The result of the condition to validate. @param argName The name of the argument (to be included in the exception message). @param message The message to include in the exception. This should not include the name of the argument, as that is already prefixed. @param args Format args for message. These must correspond to String.format() args. @throws IllegalArgumentException If validCondition is false.
[ "Throws", "an", "IllegalArgumentException", "if", "the", "validCondition", "argument", "is", "false", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/Exceptions.java#L208-L212
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/biclustering/AbstractBiclustering.java
AbstractBiclustering.valueAt
protected double valueAt(int row, int col) { iter.seek(row); return relation.get(iter).doubleValue(col); }
java
protected double valueAt(int row, int col) { iter.seek(row); return relation.get(iter).doubleValue(col); }
[ "protected", "double", "valueAt", "(", "int", "row", ",", "int", "col", ")", "{", "iter", ".", "seek", "(", "row", ")", ";", "return", "relation", ".", "get", "(", "iter", ")", ".", "doubleValue", "(", "col", ")", ";", "}" ]
Returns the value of the data matrix at row <code>row</code> and column <code>col</code>. @param row the row in the data matrix according to the current order of rows (refers to database entry <code>database.get(rowIDs[row])</code>) @param col the column in the data matrix according to the current order of rows (refers to the attribute value of an database entry <code>getValue(colIDs[col])</code>) @return the attribute value of the database entry as retrieved by <code>database.get(rowIDs[row]).getValue(colIDs[col])</code>
[ "Returns", "the", "value", "of", "the", "data", "matrix", "at", "row", "<code", ">", "row<", "/", "code", ">", "and", "column", "<code", ">", "col<", "/", "code", ">", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/biclustering/AbstractBiclustering.java#L189-L192
mapbox/mapbox-java
services-core/src/main/java/com/mapbox/core/utils/ColorUtils.java
ColorUtils.toHexString
public static String toHexString(int red, int green, int blue) { String hexColor = String.format("%02X%02X%02X", red, green, blue); if (hexColor.length() < 6) { hexColor = "000000".substring(0, 6 - hexColor.length()) + hexColor; } return hexColor; }
java
public static String toHexString(int red, int green, int blue) { String hexColor = String.format("%02X%02X%02X", red, green, blue); if (hexColor.length() < 6) { hexColor = "000000".substring(0, 6 - hexColor.length()) + hexColor; } return hexColor; }
[ "public", "static", "String", "toHexString", "(", "int", "red", ",", "int", "green", ",", "int", "blue", ")", "{", "String", "hexColor", "=", "String", ".", "format", "(", "\"%02X%02X%02X\"", ",", "red", ",", "green", ",", "blue", ")", ";", "if", "(", ...
Converts red, green, blue values to a hex string that can then be used in a URL when making API request. Note that this does <b>Not</b> add the hex key before the string. @param red the value of the color which needs to be converted @param green the value of the color which needs to be converted @param blue the value of the color which needs to be converted @return the hex color value as a string @since 3.1.0
[ "Converts", "red", "green", "blue", "values", "to", "a", "hex", "string", "that", "can", "then", "be", "used", "in", "a", "URL", "when", "making", "API", "request", ".", "Note", "that", "this", "does", "<b", ">", "Not<", "/", "b", ">", "add", "the", ...
train
https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/ColorUtils.java#L24-L32
stratosphere/stratosphere
stratosphere-core/src/main/java/eu/stratosphere/api/common/PlanExecutor.java
PlanExecutor.createRemoteExecutor
public static PlanExecutor createRemoteExecutor(String hostname, int port, String... jarFiles) { if (hostname == null) { throw new IllegalArgumentException("The hostname must not be null."); } if (port <= 0 || port > 0xffff) { throw new IllegalArgumentException("The port value is out of range."); } Class<? extends PlanExecutor> reClass = loadExecutorClass(REMOTE_EXECUTOR_CLASS); List<String> files = (jarFiles == null || jarFiles.length == 0) ? Collections.<String>emptyList() : Arrays.asList(jarFiles); try { return reClass.getConstructor(String.class, int.class, List.class).newInstance(hostname, port, files); } catch (Throwable t) { throw new RuntimeException("An error occurred while loading the remote executor (" + REMOTE_EXECUTOR_CLASS + ").", t); } }
java
public static PlanExecutor createRemoteExecutor(String hostname, int port, String... jarFiles) { if (hostname == null) { throw new IllegalArgumentException("The hostname must not be null."); } if (port <= 0 || port > 0xffff) { throw new IllegalArgumentException("The port value is out of range."); } Class<? extends PlanExecutor> reClass = loadExecutorClass(REMOTE_EXECUTOR_CLASS); List<String> files = (jarFiles == null || jarFiles.length == 0) ? Collections.<String>emptyList() : Arrays.asList(jarFiles); try { return reClass.getConstructor(String.class, int.class, List.class).newInstance(hostname, port, files); } catch (Throwable t) { throw new RuntimeException("An error occurred while loading the remote executor (" + REMOTE_EXECUTOR_CLASS + ").", t); } }
[ "public", "static", "PlanExecutor", "createRemoteExecutor", "(", "String", "hostname", ",", "int", "port", ",", "String", "...", "jarFiles", ")", "{", "if", "(", "hostname", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The hostname...
Creates an executor that runs the plan on a remote environment. The remote executor is typically used to send the program to a cluster for execution. @param hostname The address of the JobManager to send the program to. @param port The port of the JobManager to send the program to. @param jarFiles A list of jar files that contain the user-defined function (UDF) classes and all classes used from within the UDFs. @return A remote executor. @see eu.stratosphere.client.RemoteExecutor
[ "Creates", "an", "executor", "that", "runs", "the", "plan", "on", "a", "remote", "environment", ".", "The", "remote", "executor", "is", "typically", "used", "to", "send", "the", "program", "to", "a", "cluster", "for", "execution", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/api/common/PlanExecutor.java#L80-L98
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/IntHeapCache.java
IntHeapCache.createHashTable
@Override public Hash2<Integer, V> createHashTable() { return new Hash2<Integer, V>(this) { @Override protected int modifiedHashCode(final int hc) { return IntHeapCache.this.modifiedHash(hc); } @Override protected boolean keyObjIsEqual(final Integer key, final Entry e) { return true; } }; }
java
@Override public Hash2<Integer, V> createHashTable() { return new Hash2<Integer, V>(this) { @Override protected int modifiedHashCode(final int hc) { return IntHeapCache.this.modifiedHash(hc); } @Override protected boolean keyObjIsEqual(final Integer key, final Entry e) { return true; } }; }
[ "@", "Override", "public", "Hash2", "<", "Integer", ",", "V", ">", "createHashTable", "(", ")", "{", "return", "new", "Hash2", "<", "Integer", ",", "V", ">", "(", "this", ")", "{", "@", "Override", "protected", "int", "modifiedHashCode", "(", "final", ...
Modified hash table implementation. Rehash needs to calculate the correct hash code again.
[ "Modified", "hash", "table", "implementation", ".", "Rehash", "needs", "to", "calculate", "the", "correct", "hash", "code", "again", "." ]
train
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/IntHeapCache.java#L58-L71
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java
NNStorage.getFsImageName
public File getFsImageName(StorageLocationType type, long txid) { File lastCandidate = null; for (Iterator<StorageDirectory> it = dirIterator(NameNodeDirType.IMAGE); it.hasNext();) { StorageDirectory sd = it.next(); File fsImage = getStorageFile(sd, NameNodeFile.IMAGE, txid); if(sd.getRoot().canRead() && fsImage.exists()) { if (isPreferred(type, sd)) { return fsImage; } lastCandidate = fsImage; } } return lastCandidate; }
java
public File getFsImageName(StorageLocationType type, long txid) { File lastCandidate = null; for (Iterator<StorageDirectory> it = dirIterator(NameNodeDirType.IMAGE); it.hasNext();) { StorageDirectory sd = it.next(); File fsImage = getStorageFile(sd, NameNodeFile.IMAGE, txid); if(sd.getRoot().canRead() && fsImage.exists()) { if (isPreferred(type, sd)) { return fsImage; } lastCandidate = fsImage; } } return lastCandidate; }
[ "public", "File", "getFsImageName", "(", "StorageLocationType", "type", ",", "long", "txid", ")", "{", "File", "lastCandidate", "=", "null", ";", "for", "(", "Iterator", "<", "StorageDirectory", ">", "it", "=", "dirIterator", "(", "NameNodeDirType", ".", "IMAG...
Return the name of the image file, preferring "type" images. Otherwise, return any image. @return The name of the image file.
[ "Return", "the", "name", "of", "the", "image", "file", "preferring", "type", "images", ".", "Otherwise", "return", "any", "image", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L557-L571
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java
CacheListUtil.addFirst
public static Single<Boolean> addFirst(String cacheKey, Object value) { return addFirst(CacheService.CACHE_CONFIG_BEAN, cacheKey, value); }
java
public static Single<Boolean> addFirst(String cacheKey, Object value) { return addFirst(CacheService.CACHE_CONFIG_BEAN, cacheKey, value); }
[ "public", "static", "Single", "<", "Boolean", ">", "addFirst", "(", "String", "cacheKey", ",", "Object", "value", ")", "{", "return", "addFirst", "(", "CacheService", ".", "CACHE_CONFIG_BEAN", ",", "cacheKey", ",", "value", ")", ";", "}" ]
add element to the list's header @param cacheKey the key for the cached list. @param value the value to be added.
[ "add", "element", "to", "the", "list", "s", "header" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java#L103-L105
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LoadBalancersInner.java
LoadBalancersInner.beginDelete
public void beginDelete(String resourceGroupName, String loadBalancerName) { beginDeleteWithServiceResponseAsync(resourceGroupName, loadBalancerName).toBlocking().single().body(); }
java
public void beginDelete(String resourceGroupName, String loadBalancerName) { beginDeleteWithServiceResponseAsync(resourceGroupName, loadBalancerName).toBlocking().single().body(); }
[ "public", "void", "beginDelete", "(", "String", "resourceGroupName", ",", "String", "loadBalancerName", ")", "{", "beginDeleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "loadBalancerName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", "."...
Deletes the specified load balancer. @param resourceGroupName The name of the resource group. @param loadBalancerName The name of the load balancer. @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
[ "Deletes", "the", "specified", "load", "balancer", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LoadBalancersInner.java#L191-L193
teatrove/teatrove
tea/src/main/java/org/teatrove/tea/engine/TemplateSourceImpl.java
TemplateSourceImpl.sourceSignatureChanged
protected boolean sourceSignatureChanged(String tName, Compiler compiler) throws IOException { TemplateRepository tRepo = TemplateRepository.getInstance(); TemplateInfo templateInfo = tRepo.getTemplateInfo(tName); if(null == templateInfo) { return false; } CompilationUnit unit = compiler.getCompilationUnit(tName, null); if (unit == null) { return false; } return ! unit.signatureEquals(tName, templateInfo.getParameterTypes(), templateInfo.getReturnType()); }
java
protected boolean sourceSignatureChanged(String tName, Compiler compiler) throws IOException { TemplateRepository tRepo = TemplateRepository.getInstance(); TemplateInfo templateInfo = tRepo.getTemplateInfo(tName); if(null == templateInfo) { return false; } CompilationUnit unit = compiler.getCompilationUnit(tName, null); if (unit == null) { return false; } return ! unit.signatureEquals(tName, templateInfo.getParameterTypes(), templateInfo.getReturnType()); }
[ "protected", "boolean", "sourceSignatureChanged", "(", "String", "tName", ",", "Compiler", "compiler", ")", "throws", "IOException", "{", "TemplateRepository", "tRepo", "=", "TemplateRepository", ".", "getInstance", "(", ")", ";", "TemplateInfo", "templateInfo", "=", ...
parses the tea source file and compares the signature to the signature of the current class file in the TemplateRepository @return true if tea source signature is different than the class file signature or class file does not exist
[ "parses", "the", "tea", "source", "file", "and", "compares", "the", "signature", "to", "the", "signature", "of", "the", "current", "class", "file", "in", "the", "TemplateRepository" ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/engine/TemplateSourceImpl.java#L853-L868
vznet/mongo-jackson-mapper
src/main/java/net/vz/mongodb/jackson/DBUpdate.java
DBUpdate.pullAll
public static Builder pullAll(String field, Object... values) { return new Builder().pullAll(field, values); }
java
public static Builder pullAll(String field, Object... values) { return new Builder().pullAll(field, values); }
[ "public", "static", "Builder", "pullAll", "(", "String", "field", ",", "Object", "...", "values", ")", "{", "return", "new", "Builder", "(", ")", ".", "pullAll", "(", "field", ",", "values", ")", ";", "}" ]
Remove all occurances of the values from the array at field @param field The field to remove the values from @param values The values to remove @return this object
[ "Remove", "all", "occurances", "of", "the", "values", "from", "the", "array", "at", "field" ]
train
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/DBUpdate.java#L187-L189
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/Expression.java
Expression.isNot
@NonNull public Expression isNot(@NonNull Expression expression) { if (expression == null) { throw new IllegalArgumentException("expression cannot be null."); } return new BinaryExpression(this, expression, BinaryExpression.OpType.IsNot); }
java
@NonNull public Expression isNot(@NonNull Expression expression) { if (expression == null) { throw new IllegalArgumentException("expression cannot be null."); } return new BinaryExpression(this, expression, BinaryExpression.OpType.IsNot); }
[ "@", "NonNull", "public", "Expression", "isNot", "(", "@", "NonNull", "Expression", "expression", ")", "{", "if", "(", "expression", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"expression cannot be null.\"", ")", ";", "}", "return...
Create an IS NOT expression that evaluates whether or not the current expression is not equal to the given expression. @param expression the expression to compare with the current expression. @return an IS NOT expression.
[ "Create", "an", "IS", "NOT", "expression", "that", "evaluates", "whether", "or", "not", "the", "current", "expression", "is", "not", "equal", "to", "the", "given", "expression", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Expression.java#L784-L790
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InetAddress.java
InetAddress.getAllByName
public static InetAddress[] getAllByName(String host) throws UnknownHostException { return impl.lookupAllHostAddr(host, NETID_UNSET).clone(); }
java
public static InetAddress[] getAllByName(String host) throws UnknownHostException { return impl.lookupAllHostAddr(host, NETID_UNSET).clone(); }
[ "public", "static", "InetAddress", "[", "]", "getAllByName", "(", "String", "host", ")", "throws", "UnknownHostException", "{", "return", "impl", ".", "lookupAllHostAddr", "(", "host", ",", "NETID_UNSET", ")", ".", "clone", "(", ")", ";", "}" ]
Given the name of a host, returns an array of its IP addresses, based on the configured name service on the system. <p> The host name can either be a machine name, such as "<code>java.sun.com</code>", or a textual representation of its IP address. If a literal IP address is supplied, only the validity of the address format is checked. <p> For <code>host</code> specified in <i>literal IPv6 address</i>, either the form defined in RFC 2732 or the literal IPv6 address format defined in RFC 2373 is accepted. A literal IPv6 address may also be qualified by appending a scoped zone identifier or scope_id. The syntax and usage of scope_ids is described <a href="Inet6Address.html#scoped">here</a>. <p> If the host is <tt>null</tt> then an <tt>InetAddress</tt> representing an address of the loopback interface is returned. See <a href="http://www.ietf.org/rfc/rfc3330.txt">RFC&nbsp;3330</a> section&nbsp;2 and <a href="http://www.ietf.org/rfc/rfc2373.txt">RFC&nbsp;2373</a> section&nbsp;2.5.3. </p> <p> If there is a security manager and <code>host</code> is not null and <code>host.length() </code> is not equal to zero, the security manager's <code>checkConnect</code> method is called with the hostname and <code>-1</code> as its arguments to see if the operation is allowed. @param host the name of the host, or <code>null</code>. @return an array of all the IP addresses for a given host name. @exception UnknownHostException if no IP address for the <code>host</code> could be found, or if a scope_id was specified for a global IPv6 address. @exception SecurityException if a security manager exists and its <code>checkConnect</code> method doesn't allow the operation. @see SecurityManager#checkConnect
[ "Given", "the", "name", "of", "a", "host", "returns", "an", "array", "of", "its", "IP", "addresses", "based", "on", "the", "configured", "name", "service", "on", "the", "system", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InetAddress.java#L753-L756
landawn/AbacusUtil
src/com/landawn/abacus/util/Triple.java
Triple.setLeftIf
public <E extends Exception> boolean setLeftIf(final L newLeft, Try.BiPredicate<? super Triple<L, M, R>, ? super L, E> predicate) throws E { if (predicate.test(this, newLeft)) { this.left = newLeft; return true; } return false; }
java
public <E extends Exception> boolean setLeftIf(final L newLeft, Try.BiPredicate<? super Triple<L, M, R>, ? super L, E> predicate) throws E { if (predicate.test(this, newLeft)) { this.left = newLeft; return true; } return false; }
[ "public", "<", "E", "extends", "Exception", ">", "boolean", "setLeftIf", "(", "final", "L", "newLeft", ",", "Try", ".", "BiPredicate", "<", "?", "super", "Triple", "<", "L", ",", "M", ",", "R", ">", ",", "?", "super", "L", ",", "E", ">", "predicate...
Set to the specified <code>newLeft</code> and returns <code>true</code> if <code>predicate</code> returns true. Otherwise returns <code>false</code> without setting the value to new value. @param newLeft @param predicate - the first parameter is current pair, the second parameter is the <code>newLeft</code> @return
[ "Set", "to", "the", "specified", "<code", ">", "newLeft<", "/", "code", ">", "and", "returns", "<code", ">", "true<", "/", "code", ">", "if", "<code", ">", "predicate<", "/", "code", ">", "returns", "true", ".", "Otherwise", "returns", "<code", ">", "f...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Triple.java#L137-L144
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java
UnicodeSet.findIn
@Deprecated public int findIn(CharSequence value, int fromIndex, boolean findNot) { //TODO add strings, optimize, using ICU4C algorithms int cp; for (; fromIndex < value.length(); fromIndex += UTF16.getCharCount(cp)) { cp = UTF16.charAt(value, fromIndex); if (contains(cp) != findNot) { break; } } return fromIndex; }
java
@Deprecated public int findIn(CharSequence value, int fromIndex, boolean findNot) { //TODO add strings, optimize, using ICU4C algorithms int cp; for (; fromIndex < value.length(); fromIndex += UTF16.getCharCount(cp)) { cp = UTF16.charAt(value, fromIndex); if (contains(cp) != findNot) { break; } } return fromIndex; }
[ "@", "Deprecated", "public", "int", "findIn", "(", "CharSequence", "value", ",", "int", "fromIndex", ",", "boolean", "findNot", ")", "{", "//TODO add strings, optimize, using ICU4C algorithms", "int", "cp", ";", "for", "(", ";", "fromIndex", "<", "value", ".", "...
Find the first index at or after fromIndex where the UnicodeSet matches at that index. If findNot is true, then reverse the sense of the match: find the first place where the UnicodeSet doesn't match. If there is no match, length is returned. @deprecated This API is ICU internal only. Use span instead. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "Find", "the", "first", "index", "at", "or", "after", "fromIndex", "where", "the", "UnicodeSet", "matches", "at", "that", "index", ".", "If", "findNot", "is", "true", "then", "reverse", "the", "sense", "of", "the", "match", ":", "find", "the", "first", "...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L4599-L4610
liferay/com-liferay-commerce
commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPOptionWrapper.java
CPOptionWrapper.getDescription
@Override public String getDescription(String languageId, boolean useDefault) { return _cpOption.getDescription(languageId, useDefault); }
java
@Override public String getDescription(String languageId, boolean useDefault) { return _cpOption.getDescription(languageId, useDefault); }
[ "@", "Override", "public", "String", "getDescription", "(", "String", "languageId", ",", "boolean", "useDefault", ")", "{", "return", "_cpOption", ".", "getDescription", "(", "languageId", ",", "useDefault", ")", ";", "}" ]
Returns the localized description of this cp option in the language, optionally using the default language if no localization exists for the requested language. @param languageId the ID of the language @param useDefault whether to use the default language if no localization exists for the requested language @return the localized description of this cp option
[ "Returns", "the", "localized", "description", "of", "this", "cp", "option", "in", "the", "language", "optionally", "using", "the", "default", "language", "if", "no", "localization", "exists", "for", "the", "requested", "language", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPOptionWrapper.java#L306-L309
landawn/AbacusUtil
src/com/landawn/abacus/util/ClassUtil.java
ClassUtil.setPropValue
public static void setPropValue(final Object entity, final String propName, final Object propValue) { setPropValue(entity, propName, propValue, false); }
java
public static void setPropValue(final Object entity, final String propName, final Object propValue) { setPropValue(entity, propName, propValue, false); }
[ "public", "static", "void", "setPropValue", "(", "final", "Object", "entity", ",", "final", "String", "propName", ",", "final", "Object", "propValue", ")", "{", "setPropValue", "(", "entity", ",", "propName", ",", "propValue", ",", "false", ")", ";", "}" ]
Refer to setPropValue(Method, Object, Object). @param entity @param propName is case insensitive @param propValue
[ "Refer", "to", "setPropValue", "(", "Method", "Object", "Object", ")", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/ClassUtil.java#L1913-L1915
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/CollectionUtils.java
CollectionUtils.addAll
public static <T> void addAll(Collection<T> collection, Iterable<? extends T> items) { for (T item : items) { collection.add(item); } }
java
public static <T> void addAll(Collection<T> collection, Iterable<? extends T> items) { for (T item : items) { collection.add(item); } }
[ "public", "static", "<", "T", ">", "void", "addAll", "(", "Collection", "<", "T", ">", "collection", ",", "Iterable", "<", "?", "extends", "T", ">", "items", ")", "{", "for", "(", "T", "item", ":", "items", ")", "{", "collection", ".", "add", "(", ...
Add all the items from an iterable to a collection. @param <T> The type of items in the iterable and the collection @param collection The collection to which the items should be added. @param items The items to add to the collection.
[ "Add", "all", "the", "items", "from", "an", "iterable", "to", "a", "collection", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/CollectionUtils.java#L541-L545
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementImagesImpl.java
ListManagementImagesImpl.deleteImage
public String deleteImage(String listId, String imageId) { return deleteImageWithServiceResponseAsync(listId, imageId).toBlocking().single().body(); }
java
public String deleteImage(String listId, String imageId) { return deleteImageWithServiceResponseAsync(listId, imageId).toBlocking().single().body(); }
[ "public", "String", "deleteImage", "(", "String", "listId", ",", "String", "imageId", ")", "{", "return", "deleteImageWithServiceResponseAsync", "(", "listId", ",", "imageId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ...
Deletes an image from the list with list Id and image Id passed. @param listId List Id of the image list. @param imageId Id of the image. @throws IllegalArgumentException thrown if parameters fail the validation @throws APIErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the String object if successful.
[ "Deletes", "an", "image", "from", "the", "list", "with", "list", "Id", "and", "image", "Id", "passed", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementImagesImpl.java#L418-L420
jbibtex/jbibtex
src/main/java/org/jbibtex/KeyMap.java
KeyMap.putIfMissing
boolean putIfMissing(Key key, V value){ if(containsKey(key)){ return false; } put(key, value); return true; }
java
boolean putIfMissing(Key key, V value){ if(containsKey(key)){ return false; } put(key, value); return true; }
[ "boolean", "putIfMissing", "(", "Key", "key", ",", "V", "value", ")", "{", "if", "(", "containsKey", "(", "key", ")", ")", "{", "return", "false", ";", "}", "put", "(", "key", ",", "value", ")", ";", "return", "true", ";", "}" ]
@return <code>true</code> If the {@link #keySet() key set} of the map was modified, <code>false</code> otherwise. @see #removeIfPresent(Key)
[ "@return", "<code", ">", "true<", "/", "code", ">", "If", "the", "{", "@link", "#keySet", "()", "key", "set", "}", "of", "the", "map", "was", "modified", "<code", ">", "false<", "/", "code", ">", "otherwise", "." ]
train
https://github.com/jbibtex/jbibtex/blob/459c719861c5e92617b91b10ac6888a7b7e5716b/src/main/java/org/jbibtex/KeyMap.java#L15-L24
Azure/azure-sdk-for-java
containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java
ManagedClustersInner.listClusterAdminCredentials
public CredentialResultsInner listClusterAdminCredentials(String resourceGroupName, String resourceName) { return listClusterAdminCredentialsWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); }
java
public CredentialResultsInner listClusterAdminCredentials(String resourceGroupName, String resourceName) { return listClusterAdminCredentialsWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); }
[ "public", "CredentialResultsInner", "listClusterAdminCredentials", "(", "String", "resourceGroupName", ",", "String", "resourceName", ")", "{", "return", "listClusterAdminCredentialsWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ")", ".", "toBlocking"...
Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @param resourceGroupName The name of the resource group. @param resourceName The name of the managed cluster resource. @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 @return the CredentialResultsInner object if successful.
[ "Gets", "cluster", "admin", "credential", "of", "a", "managed", "cluster", ".", "Gets", "cluster", "admin", "credential", "of", "the", "managed", "cluster", "with", "a", "specified", "resource", "group", "and", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java#L573-L575
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/alignment/BamManager.java
BamManager.query
public List<SAMRecord> query(AlignmentFilters<SAMRecord> filters) throws IOException { return query(null, filters, null, SAMRecord.class); }
java
public List<SAMRecord> query(AlignmentFilters<SAMRecord> filters) throws IOException { return query(null, filters, null, SAMRecord.class); }
[ "public", "List", "<", "SAMRecord", ">", "query", "(", "AlignmentFilters", "<", "SAMRecord", ">", "filters", ")", "throws", "IOException", "{", "return", "query", "(", "null", ",", "filters", ",", "null", ",", "SAMRecord", ".", "class", ")", ";", "}" ]
/* These methods aim to provide a very simple, safe and quick way of accessing to a small fragment of the BAM/CRAM file. This must not be used in production for reading big data files. It returns a maximum of 50,000 SAM records, you can use iterator methods for reading more reads.
[ "/", "*", "These", "methods", "aim", "to", "provide", "a", "very", "simple", "safe", "and", "quick", "way", "of", "accessing", "to", "a", "small", "fragment", "of", "the", "BAM", "/", "CRAM", "file", ".", "This", "must", "not", "be", "used", "in", "p...
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/alignment/BamManager.java#L172-L174
mgormley/prim
src/main/java_generated/edu/jhu/prim/arrays/ShortArrays.java
ShortArrays.countCommon
public static short countCommon(short[] indices1, short[] indices2) { short numCommonIndices = 0; int i = 0; int j = 0; while (i < indices1.length && j < indices2.length) { if (indices1[i] < indices2[j]) { i++; } else if (indices2[j] < indices1[i]) { j++; } else { numCommonIndices++; // Equal indices. i++; j++; } } for (; i < indices1.length; i++) { numCommonIndices++; } for (; j < indices2.length; j++) { numCommonIndices++; } return numCommonIndices; }
java
public static short countCommon(short[] indices1, short[] indices2) { short numCommonIndices = 0; int i = 0; int j = 0; while (i < indices1.length && j < indices2.length) { if (indices1[i] < indices2[j]) { i++; } else if (indices2[j] < indices1[i]) { j++; } else { numCommonIndices++; // Equal indices. i++; j++; } } for (; i < indices1.length; i++) { numCommonIndices++; } for (; j < indices2.length; j++) { numCommonIndices++; } return numCommonIndices; }
[ "public", "static", "short", "countCommon", "(", "short", "[", "]", "indices1", ",", "short", "[", "]", "indices2", ")", "{", "short", "numCommonIndices", "=", "0", ";", "int", "i", "=", "0", ";", "int", "j", "=", "0", ";", "while", "(", "i", "<", ...
Counts the number of indices that appear in both arrays. @param indices1 Sorted array of indices. @param indices2 Sorted array of indices.
[ "Counts", "the", "number", "of", "indices", "that", "appear", "in", "both", "arrays", "." ]
train
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/arrays/ShortArrays.java#L215-L238
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/shipping/admin/CarrierConfigurationUrl.java
CarrierConfigurationUrl.getConfigurationUrl
public static MozuUrl getConfigurationUrl(String carrierId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/shipping/admin/carriers/{carrierId}?responseFields={responseFields}"); formatter.formatUrl("carrierId", carrierId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getConfigurationUrl(String carrierId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/shipping/admin/carriers/{carrierId}?responseFields={responseFields}"); formatter.formatUrl("carrierId", carrierId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getConfigurationUrl", "(", "String", "carrierId", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/shipping/admin/carriers/{carrierId}?responseFields={responseFields}\"", ")...
Get Resource Url for GetConfiguration @param carrierId The unique identifier of the carrier. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetConfiguration" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/shipping/admin/CarrierConfigurationUrl.java#L42-L48
ChannelFinder/javaCFClient
src/main/java/gov/bnl/channelfinder/api/ChannelUtil.java
ChannelUtil.getProperty
@Deprecated public static Property getProperty(Channel channel, String propertyName) { Collection<Property> property = Collections2.filter( channel.getProperties(), new PropertyNamePredicate(propertyName)); if (property.size() == 1) return property.iterator().next(); else return null; }
java
@Deprecated public static Property getProperty(Channel channel, String propertyName) { Collection<Property> property = Collections2.filter( channel.getProperties(), new PropertyNamePredicate(propertyName)); if (property.size() == 1) return property.iterator().next(); else return null; }
[ "@", "Deprecated", "public", "static", "Property", "getProperty", "(", "Channel", "channel", ",", "String", "propertyName", ")", "{", "Collection", "<", "Property", ">", "property", "=", "Collections2", ".", "filter", "(", "channel", ".", "getProperties", "(", ...
deprecated - use the channel.getProperty instead Return the property object with the name <tt>propertyName</tt> if it exists on the channel <tt>channel</tt> else return null @param channel - channel @param propertyName - property name @return Property - property object found on channel
[ "deprecated", "-", "use", "the", "channel", ".", "getProperty", "instead" ]
train
https://github.com/ChannelFinder/javaCFClient/blob/000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d/src/main/java/gov/bnl/channelfinder/api/ChannelUtil.java#L122-L131
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringParser.java
StringParser.parseBigInteger
@Nullable public static BigInteger parseBigInteger (@Nullable final String sStr, @Nullable final BigInteger aDefault) { return parseBigInteger (sStr, DEFAULT_RADIX, aDefault); }
java
@Nullable public static BigInteger parseBigInteger (@Nullable final String sStr, @Nullable final BigInteger aDefault) { return parseBigInteger (sStr, DEFAULT_RADIX, aDefault); }
[ "@", "Nullable", "public", "static", "BigInteger", "parseBigInteger", "(", "@", "Nullable", "final", "String", "sStr", ",", "@", "Nullable", "final", "BigInteger", "aDefault", ")", "{", "return", "parseBigInteger", "(", "sStr", ",", "DEFAULT_RADIX", ",", "aDefau...
Parse the given {@link String} as {@link BigInteger} with radix {@value #DEFAULT_RADIX}. @param sStr The String to parse. May be <code>null</code>. @param aDefault The default value to be returned if the passed string could not be converted to a valid value. May be <code>null</code>. @return <code>aDefault</code> if the string does not represent a valid value.
[ "Parse", "the", "given", "{", "@link", "String", "}", "as", "{", "@link", "BigInteger", "}", "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#L1417-L1421
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java
VirtualNetworksInner.listUsageAsync
public Observable<Page<VirtualNetworkUsageInner>> listUsageAsync(final String resourceGroupName, final String virtualNetworkName) { return listUsageWithServiceResponseAsync(resourceGroupName, virtualNetworkName) .map(new Func1<ServiceResponse<Page<VirtualNetworkUsageInner>>, Page<VirtualNetworkUsageInner>>() { @Override public Page<VirtualNetworkUsageInner> call(ServiceResponse<Page<VirtualNetworkUsageInner>> response) { return response.body(); } }); }
java
public Observable<Page<VirtualNetworkUsageInner>> listUsageAsync(final String resourceGroupName, final String virtualNetworkName) { return listUsageWithServiceResponseAsync(resourceGroupName, virtualNetworkName) .map(new Func1<ServiceResponse<Page<VirtualNetworkUsageInner>>, Page<VirtualNetworkUsageInner>>() { @Override public Page<VirtualNetworkUsageInner> call(ServiceResponse<Page<VirtualNetworkUsageInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "VirtualNetworkUsageInner", ">", ">", "listUsageAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "virtualNetworkName", ")", "{", "return", "listUsageWithServiceResponseAsync", "(", "resourceGroupName", ...
Lists usage stats. @param resourceGroupName The name of the resource group. @param virtualNetworkName The name of the virtual network. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;VirtualNetworkUsageInner&gt; object
[ "Lists", "usage", "stats", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java#L1360-L1368
cchantep/acolyte
jdbc-driver/src/main/java/acolyte/jdbc/PreparedStatement.java
PreparedStatement.createBlob
private acolyte.jdbc.Blob createBlob(InputStream stream, long length) throws SQLException { final acolyte.jdbc.Blob blob = acolyte.jdbc.Blob.Nil(); blob.setBytes(0L, createBytes(stream, length)); return blob; }
java
private acolyte.jdbc.Blob createBlob(InputStream stream, long length) throws SQLException { final acolyte.jdbc.Blob blob = acolyte.jdbc.Blob.Nil(); blob.setBytes(0L, createBytes(stream, length)); return blob; }
[ "private", "acolyte", ".", "jdbc", ".", "Blob", "createBlob", "(", "InputStream", "stream", ",", "long", "length", ")", "throws", "SQLException", "{", "final", "acolyte", ".", "jdbc", ".", "Blob", "blob", "=", "acolyte", ".", "jdbc", ".", "Blob", ".", "N...
Creates BLOB from input stream. @param stream Input stream @param length
[ "Creates", "BLOB", "from", "input", "stream", "." ]
train
https://github.com/cchantep/acolyte/blob/a383dff20fadc08ec9306f2f1f24b2a7e0047449/jdbc-driver/src/main/java/acolyte/jdbc/PreparedStatement.java#L1079-L1087
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/MiniMax.java
MiniMax.findMax
private static double findMax(DistanceQuery<?> dq, DBIDIter i, DBIDs cy, double maxDist, double minMaxDist) { for(DBIDIter j = cy.iter(); j.valid(); j.advance()) { double dist = dq.distance(i, j); if(dist > maxDist) { // Stop early, if we already know a better candidate. if(dist >= minMaxDist) { return dist; } maxDist = dist; } } return maxDist; }
java
private static double findMax(DistanceQuery<?> dq, DBIDIter i, DBIDs cy, double maxDist, double minMaxDist) { for(DBIDIter j = cy.iter(); j.valid(); j.advance()) { double dist = dq.distance(i, j); if(dist > maxDist) { // Stop early, if we already know a better candidate. if(dist >= minMaxDist) { return dist; } maxDist = dist; } } return maxDist; }
[ "private", "static", "double", "findMax", "(", "DistanceQuery", "<", "?", ">", "dq", ",", "DBIDIter", "i", ",", "DBIDs", "cy", ",", "double", "maxDist", ",", "double", "minMaxDist", ")", "{", "for", "(", "DBIDIter", "j", "=", "cy", ".", "iter", "(", ...
Find the maximum distance of one object to a set. @param dq Distance query @param i Current object @param cy Set of candidates @param maxDist Known maximum to others @param minMaxDist Early stopping threshold @return Maximum distance
[ "Find", "the", "maximum", "distance", "of", "one", "object", "to", "a", "set", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/MiniMax.java#L380-L392
knowm/Sundial
src/main/java/org/quartz/core/RAMJobStore.java
RAMJobStore.storeJob
@Override public void storeJob(JobDetail newJob, boolean replaceExisting) throws ObjectAlreadyExistsException { JobWrapper jw = new JobWrapper((JobDetail) newJob.clone()); boolean repl = false; synchronized (lock) { if (jobsByKey.get(jw.key) != null) { if (!replaceExisting) { throw new ObjectAlreadyExistsException(newJob); } repl = true; } if (!repl) { // add to jobs by FQN map jobsByKey.put(jw.key, jw); } else { // update job detail JobWrapper orig = jobsByKey.get(jw.key); orig.jobDetail = jw.jobDetail; // already cloned } } }
java
@Override public void storeJob(JobDetail newJob, boolean replaceExisting) throws ObjectAlreadyExistsException { JobWrapper jw = new JobWrapper((JobDetail) newJob.clone()); boolean repl = false; synchronized (lock) { if (jobsByKey.get(jw.key) != null) { if (!replaceExisting) { throw new ObjectAlreadyExistsException(newJob); } repl = true; } if (!repl) { // add to jobs by FQN map jobsByKey.put(jw.key, jw); } else { // update job detail JobWrapper orig = jobsByKey.get(jw.key); orig.jobDetail = jw.jobDetail; // already cloned } } }
[ "@", "Override", "public", "void", "storeJob", "(", "JobDetail", "newJob", ",", "boolean", "replaceExisting", ")", "throws", "ObjectAlreadyExistsException", "{", "JobWrapper", "jw", "=", "new", "JobWrapper", "(", "(", "JobDetail", ")", "newJob", ".", "clone", "(...
Store the given <code>{@link org.quartz.jobs.Job}</code>. @param newJob The <code>Job</code> to be stored. @param replaceExisting If <code>true</code>, any <code>Job</code> existing in the <code> JobStore</code> with the same name & group should be over-written. @throws ObjectAlreadyExistsException if a <code>Job</code> with the same name/group already exists, and replaceExisting is set to false.
[ "Store", "the", "given", "<code", ">", "{", "@link", "org", ".", "quartz", ".", "jobs", ".", "Job", "}", "<", "/", "code", ">", "." ]
train
https://github.com/knowm/Sundial/blob/0d61549fdfb8d6f884a1f2eed7e32ad39e2f4c62/src/main/java/org/quartz/core/RAMJobStore.java#L141-L167
nominanuda/zen-project
zen-webservice/src/main/java/com/nominanuda/hyperapi/HttpClientHyperApiFactory.java
HttpClientHyperApiFactory.getInstance
public <T> T getInstance(String instanceHint, Class<? extends T> apiInterface, T apiImpl) { return STR.notNullOrBlank(instanceHint) ? getInstance(instanceHint, apiInterface) : allowExceptions ? apiImpl : getInstance(apiImpl, apiInterface); }
java
public <T> T getInstance(String instanceHint, Class<? extends T> apiInterface, T apiImpl) { return STR.notNullOrBlank(instanceHint) ? getInstance(instanceHint, apiInterface) : allowExceptions ? apiImpl : getInstance(apiImpl, apiInterface); }
[ "public", "<", "T", ">", "T", "getInstance", "(", "String", "instanceHint", ",", "Class", "<", "?", "extends", "T", ">", "apiInterface", ",", "T", "apiImpl", ")", "{", "return", "STR", ".", "notNullOrBlank", "(", "instanceHint", ")", "?", "getInstance", ...
This one allows to spring-configure both remote prefix and local implementation of apiInterface: if remote url is blank then local implementation will be used. @param instanceHint @param apiImpl @param apiInterface @return
[ "This", "one", "allows", "to", "spring", "-", "configure", "both", "remote", "prefix", "and", "local", "implementation", "of", "apiInterface", ":", "if", "remote", "url", "is", "blank", "then", "local", "implementation", "will", "be", "used", "." ]
train
https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-webservice/src/main/java/com/nominanuda/hyperapi/HttpClientHyperApiFactory.java#L46-L48
apache/incubator-druid
server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java
LookupReferencesManager.getLookupListFromCoordinator
@Nullable private List<LookupBean> getLookupListFromCoordinator(String tier) { try { MutableBoolean firstAttempt = new MutableBoolean(true); Map<String, LookupExtractorFactoryContainer> lookupMap = RetryUtils.retry( () -> { if (firstAttempt.isTrue()) { firstAttempt.setValue(false); } else if (lookupConfig.getCoordinatorRetryDelay() > 0) { // Adding any configured extra time in addition to the retry wait. In RetryUtils, retry wait starts from // a few seconds, that is likely not enough to coordinator to be back to healthy state, e. g. if it // experiences 30-second GC pause. Default is 1 minute Thread.sleep(lookupConfig.getCoordinatorRetryDelay()); } return tryGetLookupListFromCoordinator(tier); }, e -> true, lookupConfig.getCoordinatorFetchRetries() ); if (lookupMap != null) { List<LookupBean> lookupBeanList = new ArrayList<>(); lookupMap.forEach((k, v) -> lookupBeanList.add(new LookupBean(k, null, v))); return lookupBeanList; } else { return null; } } catch (Exception e) { LOG.error(e, "Error while trying to get lookup list from coordinator for tier[%s]", tier); return null; } }
java
@Nullable private List<LookupBean> getLookupListFromCoordinator(String tier) { try { MutableBoolean firstAttempt = new MutableBoolean(true); Map<String, LookupExtractorFactoryContainer> lookupMap = RetryUtils.retry( () -> { if (firstAttempt.isTrue()) { firstAttempt.setValue(false); } else if (lookupConfig.getCoordinatorRetryDelay() > 0) { // Adding any configured extra time in addition to the retry wait. In RetryUtils, retry wait starts from // a few seconds, that is likely not enough to coordinator to be back to healthy state, e. g. if it // experiences 30-second GC pause. Default is 1 minute Thread.sleep(lookupConfig.getCoordinatorRetryDelay()); } return tryGetLookupListFromCoordinator(tier); }, e -> true, lookupConfig.getCoordinatorFetchRetries() ); if (lookupMap != null) { List<LookupBean> lookupBeanList = new ArrayList<>(); lookupMap.forEach((k, v) -> lookupBeanList.add(new LookupBean(k, null, v))); return lookupBeanList; } else { return null; } } catch (Exception e) { LOG.error(e, "Error while trying to get lookup list from coordinator for tier[%s]", tier); return null; } }
[ "@", "Nullable", "private", "List", "<", "LookupBean", ">", "getLookupListFromCoordinator", "(", "String", "tier", ")", "{", "try", "{", "MutableBoolean", "firstAttempt", "=", "new", "MutableBoolean", "(", "true", ")", ";", "Map", "<", "String", ",", "LookupEx...
Returns a list of lookups from the coordinator if the coordinator is available. If it's not available, returns null. @param tier lookup tier name @return list of LookupBean objects, or null
[ "Returns", "a", "list", "of", "lookups", "from", "the", "coordinator", "if", "the", "coordinator", "is", "available", ".", "If", "it", "s", "not", "available", "returns", "null", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java#L385-L417
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/LocaleUtils.java
LocaleUtils.getLocalizedBundleName
public static String getLocalizedBundleName(String bundleName, String localeKey) { String newName = bundleName; int idxSeparator = bundleName.lastIndexOf('.'); if (StringUtils.isNotEmpty(localeKey) && idxSeparator != -1) { newName = bundleName.substring(0, idxSeparator); newName += '_' + localeKey; newName += bundleName.substring(idxSeparator); } return newName; }
java
public static String getLocalizedBundleName(String bundleName, String localeKey) { String newName = bundleName; int idxSeparator = bundleName.lastIndexOf('.'); if (StringUtils.isNotEmpty(localeKey) && idxSeparator != -1) { newName = bundleName.substring(0, idxSeparator); newName += '_' + localeKey; newName += bundleName.substring(idxSeparator); } return newName; }
[ "public", "static", "String", "getLocalizedBundleName", "(", "String", "bundleName", ",", "String", "localeKey", ")", "{", "String", "newName", "=", "bundleName", ";", "int", "idxSeparator", "=", "bundleName", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if",...
Returns the localized bundle name @param bundleName the bundle name @param localeKey the locale key @return the localized bundle name
[ "Returns", "the", "localized", "bundle", "name" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/LocaleUtils.java#L74-L85
aws/aws-sdk-java
aws-java-sdk-codepipeline/src/main/java/com/amazonaws/services/codepipeline/model/PollForJobsRequest.java
PollForJobsRequest.withQueryParam
public PollForJobsRequest withQueryParam(java.util.Map<String, String> queryParam) { setQueryParam(queryParam); return this; }
java
public PollForJobsRequest withQueryParam(java.util.Map<String, String> queryParam) { setQueryParam(queryParam); return this; }
[ "public", "PollForJobsRequest", "withQueryParam", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "queryParam", ")", "{", "setQueryParam", "(", "queryParam", ")", ";", "return", "this", ";", "}" ]
<p> A map of property names and values. For an action type with no queryable properties, this value must be null or an empty map. For an action type with a queryable property, you must supply that property as a key in the map. Only jobs whose action configuration matches the mapped value will be returned. </p> @param queryParam A map of property names and values. For an action type with no queryable properties, this value must be null or an empty map. For an action type with a queryable property, you must supply that property as a key in the map. Only jobs whose action configuration matches the mapped value will be returned. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "map", "of", "property", "names", "and", "values", ".", "For", "an", "action", "type", "with", "no", "queryable", "properties", "this", "value", "must", "be", "null", "or", "an", "empty", "map", ".", "For", "an", "action", "type", "with...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-codepipeline/src/main/java/com/amazonaws/services/codepipeline/model/PollForJobsRequest.java#L179-L182
trustathsh/ifmapj
src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identity.java
Identity.distinguishedNameEquals
private boolean distinguishedNameEquals(String dsn1, String dsn2) { return new X500Principal(dsn1).equals(new X500Principal(dsn2)); }
java
private boolean distinguishedNameEquals(String dsn1, String dsn2) { return new X500Principal(dsn1).equals(new X500Principal(dsn2)); }
[ "private", "boolean", "distinguishedNameEquals", "(", "String", "dsn1", ",", "String", "dsn2", ")", "{", "return", "new", "X500Principal", "(", "dsn1", ")", ".", "equals", "(", "new", "X500Principal", "(", "dsn2", ")", ")", ";", "}" ]
Compare two DSN @param dsn1 Distinguished name (X.500 DSN) string @param dsn2 Distinguished name (X.500 DSN) string @return boolean true if both DSN are equal @since 0.1.5
[ "Compare", "two", "DSN" ]
train
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identity.java#L198-L200
bingoohuang/excel2javabeans
src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java
PoiUtil.searchCell
public static Cell searchCell(Sheet sheet, String searchKey) { if (StringUtils.isEmpty(searchKey)) return null; for (int i = sheet.getFirstRowNum(), ii = sheet.getLastRowNum(); i < ii; ++i) { Cell cell = searchRow(sheet.getRow(i), searchKey); if (cell != null) return cell; } return null; }
java
public static Cell searchCell(Sheet sheet, String searchKey) { if (StringUtils.isEmpty(searchKey)) return null; for (int i = sheet.getFirstRowNum(), ii = sheet.getLastRowNum(); i < ii; ++i) { Cell cell = searchRow(sheet.getRow(i), searchKey); if (cell != null) return cell; } return null; }
[ "public", "static", "Cell", "searchCell", "(", "Sheet", "sheet", ",", "String", "searchKey", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "searchKey", ")", ")", "return", "null", ";", "for", "(", "int", "i", "=", "sheet", ".", "getFirstRowNum...
查找单元格。 @param sheet 表单 @param searchKey 单元格中包含的关键字 @return 单元格,没有找到时返回null
[ "查找单元格。" ]
train
https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java#L361-L370
facebook/fresco
imagepipeline-base/src/main/java/com/facebook/imageutils/BitmapUtil.java
BitmapUtil.decodeDimensionsAndColorSpace
public static ImageMetaData decodeDimensionsAndColorSpace(InputStream is) { Preconditions.checkNotNull(is); ByteBuffer byteBuffer = DECODE_BUFFERS.acquire(); if (byteBuffer == null) { byteBuffer = ByteBuffer.allocate(DECODE_BUFFER_SIZE); } BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; try { options.inTempStorage = byteBuffer.array(); BitmapFactory.decodeStream(is, null, options); ColorSpace colorSpace = null; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { colorSpace = options.outColorSpace; } return new ImageMetaData(options.outWidth, options.outHeight, colorSpace); } finally { DECODE_BUFFERS.release(byteBuffer); } }
java
public static ImageMetaData decodeDimensionsAndColorSpace(InputStream is) { Preconditions.checkNotNull(is); ByteBuffer byteBuffer = DECODE_BUFFERS.acquire(); if (byteBuffer == null) { byteBuffer = ByteBuffer.allocate(DECODE_BUFFER_SIZE); } BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; try { options.inTempStorage = byteBuffer.array(); BitmapFactory.decodeStream(is, null, options); ColorSpace colorSpace = null; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { colorSpace = options.outColorSpace; } return new ImageMetaData(options.outWidth, options.outHeight, colorSpace); } finally { DECODE_BUFFERS.release(byteBuffer); } }
[ "public", "static", "ImageMetaData", "decodeDimensionsAndColorSpace", "(", "InputStream", "is", ")", "{", "Preconditions", ".", "checkNotNull", "(", "is", ")", ";", "ByteBuffer", "byteBuffer", "=", "DECODE_BUFFERS", ".", "acquire", "(", ")", ";", "if", "(", "byt...
Decodes the bounds of an image and returns its width and height or null if the size can't be determined. It also recovers the color space of the image, or null if it can't be determined. @param is the InputStream containing the image data @return the metadata of the image
[ "Decodes", "the", "bounds", "of", "an", "image", "and", "returns", "its", "width", "and", "height", "or", "null", "if", "the", "size", "can", "t", "be", "determined", ".", "It", "also", "recovers", "the", "color", "space", "of", "the", "image", "or", "...
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imageutils/BitmapUtil.java#L134-L154
SonarSource/sonarqube
server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationHandler.java
ChangesOnMyIssueNotificationHandler.toEmailDeliveryRequest
@CheckForNull private static EmailDeliveryRequest toEmailDeliveryRequest(NotificationWithProjectKeys notification, EmailRecipient recipient, Set<String> subscribedProjectKeys) { Set<ChangedIssue> recipientIssuesByProject = notification.getIssues().stream() .filter(issue -> issue.getAssignee().filter(assignee -> recipient.getLogin().equals(assignee.getLogin())).isPresent()) .filter(issue -> subscribedProjectKeys.contains(issue.getProject().getKey())) .collect(toSet(notification.getIssues().size())); if (recipientIssuesByProject.isEmpty()) { return null; } return new EmailDeliveryRequest( recipient.getEmail(), new ChangesOnMyIssuesNotification(notification.getChange(), recipientIssuesByProject)); }
java
@CheckForNull private static EmailDeliveryRequest toEmailDeliveryRequest(NotificationWithProjectKeys notification, EmailRecipient recipient, Set<String> subscribedProjectKeys) { Set<ChangedIssue> recipientIssuesByProject = notification.getIssues().stream() .filter(issue -> issue.getAssignee().filter(assignee -> recipient.getLogin().equals(assignee.getLogin())).isPresent()) .filter(issue -> subscribedProjectKeys.contains(issue.getProject().getKey())) .collect(toSet(notification.getIssues().size())); if (recipientIssuesByProject.isEmpty()) { return null; } return new EmailDeliveryRequest( recipient.getEmail(), new ChangesOnMyIssuesNotification(notification.getChange(), recipientIssuesByProject)); }
[ "@", "CheckForNull", "private", "static", "EmailDeliveryRequest", "toEmailDeliveryRequest", "(", "NotificationWithProjectKeys", "notification", ",", "EmailRecipient", "recipient", ",", "Set", "<", "String", ">", "subscribedProjectKeys", ")", "{", "Set", "<", "ChangedIssue...
Creates the {@link EmailDeliveryRequest} for the specified {@code recipient} with issues from the specified {@code notification} it is the assignee of. @return {@code null} when the recipient is the assignee of no issue in {@code notification}.
[ "Creates", "the", "{", "@link", "EmailDeliveryRequest", "}", "for", "the", "specified", "{", "@code", "recipient", "}", "with", "issues", "from", "the", "specified", "{", "@code", "notification", "}", "it", "is", "the", "assignee", "of", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationHandler.java#L156-L168
playn/playn
scene/src/playn/scene/LayerUtil.java
LayerUtil.screenToLayer
public static Point screenToLayer(Layer layer, XY point, Point into) { Layer parent = layer.parent(); XY cur = (parent == null) ? point : screenToLayer(parent, point, into); return parentToLayer(layer, cur, into); }
java
public static Point screenToLayer(Layer layer, XY point, Point into) { Layer parent = layer.parent(); XY cur = (parent == null) ? point : screenToLayer(parent, point, into); return parentToLayer(layer, cur, into); }
[ "public", "static", "Point", "screenToLayer", "(", "Layer", "layer", ",", "XY", "point", ",", "Point", "into", ")", "{", "Layer", "parent", "=", "layer", ".", "parent", "(", ")", ";", "XY", "cur", "=", "(", "parent", "==", "null", ")", "?", "point", ...
Converts the supplied point from screen coordinates to coordinates relative to the specified layer. The results are stored into {@code into} , which is returned for convenience.
[ "Converts", "the", "supplied", "point", "from", "screen", "coordinates", "to", "coordinates", "relative", "to", "the", "specified", "layer", ".", "The", "results", "are", "stored", "into", "{" ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/LayerUtil.java#L84-L88
google/closure-compiler
src/com/google/javascript/jscomp/GlobalNamespace.java
GlobalNamespace.isGlobalVarReference
private boolean isGlobalVarReference(String name, Scope s) { Var v = s.getVar(name); if (v == null && externsScope != null) { v = externsScope.getVar(name); } return v != null && !v.isLocal(); }
java
private boolean isGlobalVarReference(String name, Scope s) { Var v = s.getVar(name); if (v == null && externsScope != null) { v = externsScope.getVar(name); } return v != null && !v.isLocal(); }
[ "private", "boolean", "isGlobalVarReference", "(", "String", "name", ",", "Scope", "s", ")", "{", "Var", "v", "=", "s", ".", "getVar", "(", "name", ")", ";", "if", "(", "v", "==", "null", "&&", "externsScope", "!=", "null", ")", "{", "v", "=", "ext...
Determines whether a variable name reference in a particular scope is a global variable reference. @param name A variable name (e.g. "a") @param s The scope in which the name is referenced @return Whether the name reference is a global variable reference
[ "Determines", "whether", "a", "variable", "name", "reference", "in", "a", "particular", "scope", "is", "a", "global", "variable", "reference", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/GlobalNamespace.java#L304-L310
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/AbstractRectangularShape1dfx.java
AbstractRectangularShape1dfx.maxYProperty
@Pure public DoubleProperty maxYProperty() { if (this.maxY == null) { this.maxY = new SimpleDoubleProperty(this, MathFXAttributeNames.MAXIMUM_Y) { @Override protected void invalidated() { final double currentMax = get(); final double currentMin = getMinY(); if (currentMin > currentMax) { // min-max constrain is broken minYProperty().set(currentMax); } } }; } return this.maxY; }
java
@Pure public DoubleProperty maxYProperty() { if (this.maxY == null) { this.maxY = new SimpleDoubleProperty(this, MathFXAttributeNames.MAXIMUM_Y) { @Override protected void invalidated() { final double currentMax = get(); final double currentMin = getMinY(); if (currentMin > currentMax) { // min-max constrain is broken minYProperty().set(currentMax); } } }; } return this.maxY; }
[ "@", "Pure", "public", "DoubleProperty", "maxYProperty", "(", ")", "{", "if", "(", "this", ".", "maxY", "==", "null", ")", "{", "this", ".", "maxY", "=", "new", "SimpleDoubleProperty", "(", "this", ",", "MathFXAttributeNames", ".", "MAXIMUM_Y", ")", "{", ...
Replies the property that is the maximum y coordinate of the box. @return the maxY property.
[ "Replies", "the", "property", "that", "is", "the", "maximum", "y", "coordinate", "of", "the", "box", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/AbstractRectangularShape1dfx.java#L247-L263
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/Util.java
Util.iterateUntil
public static int iterateUntil(short[] array, int pos, int length, int min) { while (pos < length && toIntUnsigned(array[pos]) < min) { pos++; } return pos; }
java
public static int iterateUntil(short[] array, int pos, int length, int min) { while (pos < length && toIntUnsigned(array[pos]) < min) { pos++; } return pos; }
[ "public", "static", "int", "iterateUntil", "(", "short", "[", "]", "array", ",", "int", "pos", ",", "int", "length", ",", "int", "min", ")", "{", "while", "(", "pos", "<", "length", "&&", "toIntUnsigned", "(", "array", "[", "pos", "]", ")", "<", "m...
Find the smallest integer larger than pos such that array[pos]&gt;= min. If none can be found, return length. @param array array to search within @param pos starting position of the search @param length length of the array to search @param min minimum value @return x greater than pos such that array[pos] is at least as large as min, pos is is equal to length if it is not possible.
[ "Find", "the", "smallest", "integer", "larger", "than", "pos", "such", "that", "array", "[", "pos", "]", "&gt", ";", "=", "min", ".", "If", "none", "can", "be", "found", "return", "length", "." ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/Util.java#L170-L175
dadoonet/fscrawler
core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java
FsParserAbstract.indexDirectory
private void indexDirectory(String id, fr.pilato.elasticsearch.crawler.fs.beans.Path path) throws Exception { esIndex(fsSettings.getElasticsearch().getIndexFolder(), id, PathParser.toJson(path), null); }
java
private void indexDirectory(String id, fr.pilato.elasticsearch.crawler.fs.beans.Path path) throws Exception { esIndex(fsSettings.getElasticsearch().getIndexFolder(), id, PathParser.toJson(path), null); }
[ "private", "void", "indexDirectory", "(", "String", "id", ",", "fr", ".", "pilato", ".", "elasticsearch", ".", "crawler", ".", "fs", ".", "beans", ".", "Path", "path", ")", "throws", "Exception", "{", "esIndex", "(", "fsSettings", ".", "getElasticsearch", ...
Index a Path object (AKA a folder) in elasticsearch @param id id of the path @param path path object @throws Exception in case of error
[ "Index", "a", "Path", "object", "(", "AKA", "a", "folder", ")", "in", "elasticsearch" ]
train
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java#L526-L531
beanshell/beanshell
src/main/java/bsh/Invocable.java
Invocable.invoke
public synchronized Object invoke(Object base, Object... pars) throws InvocationTargetException { if (null == pars) pars = Reflect.ZERO_ARGS; try { return Primitive.wrap( invokeTarget(base, pars), getReturnType()); } catch (Throwable ite) { throw new InvocationTargetException(ite); } }
java
public synchronized Object invoke(Object base, Object... pars) throws InvocationTargetException { if (null == pars) pars = Reflect.ZERO_ARGS; try { return Primitive.wrap( invokeTarget(base, pars), getReturnType()); } catch (Throwable ite) { throw new InvocationTargetException(ite); } }
[ "public", "synchronized", "Object", "invoke", "(", "Object", "base", ",", "Object", "...", "pars", ")", "throws", "InvocationTargetException", "{", "if", "(", "null", "==", "pars", ")", "pars", "=", "Reflect", ".", "ZERO_ARGS", ";", "try", "{", "return", "...
Abstraction to cleanly apply the primitive result wrapping. @param base represents the base object instance. @param pars parameter arguments @return invocation result @throws InvocationTargetException wrapped target exceptions
[ "Abstraction", "to", "cleanly", "apply", "the", "primitive", "result", "wrapping", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/Invocable.java#L206-L217
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/InsertAllRequest.java
InsertAllRequest.of
public static InsertAllRequest of(TableInfo tableInfo, Iterable<RowToInsert> rows) { return newBuilder(tableInfo.getTableId(), rows).build(); }
java
public static InsertAllRequest of(TableInfo tableInfo, Iterable<RowToInsert> rows) { return newBuilder(tableInfo.getTableId(), rows).build(); }
[ "public", "static", "InsertAllRequest", "of", "(", "TableInfo", "tableInfo", ",", "Iterable", "<", "RowToInsert", ">", "rows", ")", "{", "return", "newBuilder", "(", "tableInfo", ".", "getTableId", "(", ")", ",", "rows", ")", ".", "build", "(", ")", ";", ...
Returns a {@code InsertAllRequest} object given the destination table and the rows to insert.
[ "Returns", "a", "{" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/InsertAllRequest.java#L423-L425
alkacon/opencms-core
src-modules/org/opencms/workplace/CmsReport.java
CmsReport.pageHtml
public String pageHtml(int segment, boolean loadStyles) { if (useNewStyle()) { return super.pageHtml(segment, null, getParamTitle()); } if (segment == HTML_START) { StringBuffer result = new StringBuffer(512); result.append("<!DOCTYPE html>\n"); result.append("<html>\n<head>\n"); result.append("<meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset="); result.append(getEncoding()); result.append("\">\n"); if (loadStyles) { result.append("<link rel=\"stylesheet\" type=\"text/css\" href=\""); result.append(getStyleUri(getJsp(), "workplace.css")); result.append("\">\n"); result.append("<script type=\"text/javascript\">\n"); result.append(dialogScriptSubmit()); result.append("</script>\n"); } return result.toString(); } else { return "</html>"; } }
java
public String pageHtml(int segment, boolean loadStyles) { if (useNewStyle()) { return super.pageHtml(segment, null, getParamTitle()); } if (segment == HTML_START) { StringBuffer result = new StringBuffer(512); result.append("<!DOCTYPE html>\n"); result.append("<html>\n<head>\n"); result.append("<meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset="); result.append(getEncoding()); result.append("\">\n"); if (loadStyles) { result.append("<link rel=\"stylesheet\" type=\"text/css\" href=\""); result.append(getStyleUri(getJsp(), "workplace.css")); result.append("\">\n"); result.append("<script type=\"text/javascript\">\n"); result.append(dialogScriptSubmit()); result.append("</script>\n"); } return result.toString(); } else { return "</html>"; } }
[ "public", "String", "pageHtml", "(", "int", "segment", ",", "boolean", "loadStyles", ")", "{", "if", "(", "useNewStyle", "(", ")", ")", "{", "return", "super", ".", "pageHtml", "(", "segment", ",", "null", ",", "getParamTitle", "(", ")", ")", ";", "}",...
Builds the start html of the page, including setting of DOCTYPE and inserting a header with the content-type.<p> This overloads the default method of the parent class.<p> @param segment the HTML segment (START / END) @param loadStyles if true, the defaul style sheet will be loaded @return the start html of the page
[ "Builds", "the", "start", "html", "of", "the", "page", "including", "setting", "of", "DOCTYPE", "and", "inserting", "a", "header", "with", "the", "content", "-", "type", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/CmsReport.java#L461-L486
micronaut-projects/micronaut-core
views/src/main/java/io/micronaut/views/ViewUtils.java
ViewUtils.normalizeFile
@Nonnull public static String normalizeFile(@Nonnull String path, String extension) { path = path.replace("\\", "/"); if (path.startsWith("/")) { path = path.substring(1); } if (extension != null && !extension.startsWith(".")) { extension = "." + extension; if (path.endsWith(extension)) { int idx = path.indexOf(extension); path = path.substring(0, idx); } } return path; }
java
@Nonnull public static String normalizeFile(@Nonnull String path, String extension) { path = path.replace("\\", "/"); if (path.startsWith("/")) { path = path.substring(1); } if (extension != null && !extension.startsWith(".")) { extension = "." + extension; if (path.endsWith(extension)) { int idx = path.indexOf(extension); path = path.substring(0, idx); } } return path; }
[ "@", "Nonnull", "public", "static", "String", "normalizeFile", "(", "@", "Nonnull", "String", "path", ",", "String", "extension", ")", "{", "path", "=", "path", ".", "replace", "(", "\"\\\\\"", ",", "\"/\"", ")", ";", "if", "(", "path", ".", "startsWith"...
Returns a path that is converted to unix style file separators and never starts with a "/". If an extension is provided and the path ends with the extension, the extension will be stripped. The extension parameter supports extensions that do and do not begin with a ".". @param path The path to normalizeFile @param extension The file extension @return The normalized path
[ "Returns", "a", "path", "that", "is", "converted", "to", "unix", "style", "file", "separators", "and", "never", "starts", "with", "a", "/", ".", "If", "an", "extension", "is", "provided", "and", "the", "path", "ends", "with", "the", "extension", "the", "...
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/views/src/main/java/io/micronaut/views/ViewUtils.java#L61-L75
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java
EnumConstantBuilder.buildEnumConstantComments
public void buildEnumConstantComments(XMLNode node, Content enumConstantsTree) { if (!configuration.nocomment) { writer.addComments(currentElement, enumConstantsTree); } }
java
public void buildEnumConstantComments(XMLNode node, Content enumConstantsTree) { if (!configuration.nocomment) { writer.addComments(currentElement, enumConstantsTree); } }
[ "public", "void", "buildEnumConstantComments", "(", "XMLNode", "node", ",", "Content", "enumConstantsTree", ")", "{", "if", "(", "!", "configuration", ".", "nocomment", ")", "{", "writer", ".", "addComments", "(", "currentElement", ",", "enumConstantsTree", ")", ...
Build the comments for the enum constant. Do nothing if {@link Configuration#nocomment} is set to true. @param node the XML element that specifies which components to document @param enumConstantsTree the content tree to which the documentation will be added
[ "Build", "the", "comments", "for", "the", "enum", "constant", ".", "Do", "nothing", "if", "{", "@link", "Configuration#nocomment", "}", "is", "set", "to", "true", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java#L183-L187
gallandarakhneorg/afc
core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d1/Transform1D.java
Transform1D.setTranslation
public void setTranslation(List<? extends S> path, Direction1D direction, Tuple2D<?> position) { assert position != null : AssertMessages.notNullParameter(3); this.path = path == null || path.isEmpty() ? null : new ArrayList<>(path); this.firstSegmentDirection = detectFirstSegmentDirection(direction); this.curvilineTranslation = position.getX(); this.shiftTranslation = position.getY(); this.isIdentity = null; }
java
public void setTranslation(List<? extends S> path, Direction1D direction, Tuple2D<?> position) { assert position != null : AssertMessages.notNullParameter(3); this.path = path == null || path.isEmpty() ? null : new ArrayList<>(path); this.firstSegmentDirection = detectFirstSegmentDirection(direction); this.curvilineTranslation = position.getX(); this.shiftTranslation = position.getY(); this.isIdentity = null; }
[ "public", "void", "setTranslation", "(", "List", "<", "?", "extends", "S", ">", "path", ",", "Direction1D", "direction", ",", "Tuple2D", "<", "?", ">", "position", ")", "{", "assert", "position", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", ...
Set the position. @param path the path to follow. @param direction is the direction to follow on the path if the path contains only one segment. @param position where <code>x</code> is the curviline coordinate and <code>y</code> is the shift coordinate.
[ "Set", "the", "position", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d1/Transform1D.java#L352-L359
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.setImageColor
public void setImageColor(float r, float g, float b) { setColor(TOP_LEFT, r, g, b); setColor(TOP_RIGHT, r, g, b); setColor(BOTTOM_LEFT, r, g, b); setColor(BOTTOM_RIGHT, r, g, b); }
java
public void setImageColor(float r, float g, float b) { setColor(TOP_LEFT, r, g, b); setColor(TOP_RIGHT, r, g, b); setColor(BOTTOM_LEFT, r, g, b); setColor(BOTTOM_RIGHT, r, g, b); }
[ "public", "void", "setImageColor", "(", "float", "r", ",", "float", "g", ",", "float", "b", ")", "{", "setColor", "(", "TOP_LEFT", ",", "r", ",", "g", ",", "b", ")", ";", "setColor", "(", "TOP_RIGHT", ",", "r", ",", "g", ",", "b", ")", ";", "se...
Set the filter to apply when drawing this image @param r The red component of the filter colour @param g The green component of the filter colour @param b The blue component of the filter colour
[ "Set", "the", "filter", "to", "apply", "when", "drawing", "this", "image" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L358-L363
anotheria/configureme
src/main/java/org/configureme/sources/ConfigurationSourceKey.java
ConfigurationSourceKey.propertyFile
public static final ConfigurationSourceKey propertyFile(final String name){ return new ConfigurationSourceKey(Type.FILE, Format.PROPERTIES, name); }
java
public static final ConfigurationSourceKey propertyFile(final String name){ return new ConfigurationSourceKey(Type.FILE, Format.PROPERTIES, name); }
[ "public", "static", "final", "ConfigurationSourceKey", "propertyFile", "(", "final", "String", "name", ")", "{", "return", "new", "ConfigurationSourceKey", "(", "Type", ".", "FILE", ",", "Format", ".", "PROPERTIES", ",", "name", ")", ";", "}" ]
Creates a new configuration source key for property files. @param name name of the property file. @return a new configuration source key instance for property files
[ "Creates", "a", "new", "configuration", "source", "key", "for", "property", "files", "." ]
train
https://github.com/anotheria/configureme/blob/1f52dd9109349623190586bdf5a592de8016e1fa/src/main/java/org/configureme/sources/ConfigurationSourceKey.java#L201-L203
infinispan/infinispan
core/src/main/java/org/infinispan/util/concurrent/CompletableFutures.java
CompletableFutures.await
public static boolean await(CompletableFuture<?> future, long time, TimeUnit unit) throws InterruptedException { try { requireNonNull(future, "Completable Future must be non-null.").get(time, requireNonNull(unit, "Time Unit must be non-null")); return true; } catch (ExecutionException e) { return true; } catch (java.util.concurrent.TimeoutException e) { return false; } }
java
public static boolean await(CompletableFuture<?> future, long time, TimeUnit unit) throws InterruptedException { try { requireNonNull(future, "Completable Future must be non-null.").get(time, requireNonNull(unit, "Time Unit must be non-null")); return true; } catch (ExecutionException e) { return true; } catch (java.util.concurrent.TimeoutException e) { return false; } }
[ "public", "static", "boolean", "await", "(", "CompletableFuture", "<", "?", ">", "future", ",", "long", "time", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", "{", "try", "{", "requireNonNull", "(", "future", ",", "\"Completable Future must be non...
It waits until the {@link CompletableFuture} is completed. <p> It ignore if the {@link CompletableFuture} is completed normally or exceptionally. @param future the {@link CompletableFuture} to test. @param time the timeout. @param unit the timeout unit. @return {@code true} if completed, {@code false} if timed out. @throws InterruptedException if interrupted while waiting. @throws NullPointerException if {@code future} or {@code unit} is {@code null}.
[ "It", "waits", "until", "the", "{", "@link", "CompletableFuture", "}", "is", "completed", ".", "<p", ">", "It", "ignore", "if", "the", "{", "@link", "CompletableFuture", "}", "is", "completed", "normally", "or", "exceptionally", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/concurrent/CompletableFutures.java#L88-L97
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/transform/OpPredicate.java
OpPredicate.nameEquals
public static OpPredicate nameEquals(final String name){ return new OpPredicate() { @Override public boolean matches(SameDiff sameDiff, DifferentialFunction function) { return function.getOwnName().equals(name); } }; }
java
public static OpPredicate nameEquals(final String name){ return new OpPredicate() { @Override public boolean matches(SameDiff sameDiff, DifferentialFunction function) { return function.getOwnName().equals(name); } }; }
[ "public", "static", "OpPredicate", "nameEquals", "(", "final", "String", "name", ")", "{", "return", "new", "OpPredicate", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "SameDiff", "sameDiff", ",", "DifferentialFunction", "function", ")", ...
Return true if the operation own (user specified) name equals the specified name
[ "Return", "true", "if", "the", "operation", "own", "(", "user", "specified", ")", "name", "equals", "the", "specified", "name" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/transform/OpPredicate.java#L42-L49
alibaba/jstorm
jstorm-core/src/main/java/storm/trident/Stream.java
Stream.minBy
public Stream minBy(String inputFieldName) { Aggregator<ComparisonAggregator.State> min = new Min(inputFieldName); return comparableAggregateStream(inputFieldName, min); }
java
public Stream minBy(String inputFieldName) { Aggregator<ComparisonAggregator.State> min = new Min(inputFieldName); return comparableAggregateStream(inputFieldName, min); }
[ "public", "Stream", "minBy", "(", "String", "inputFieldName", ")", "{", "Aggregator", "<", "ComparisonAggregator", ".", "State", ">", "min", "=", "new", "Min", "(", "inputFieldName", ")", ";", "return", "comparableAggregateStream", "(", "inputFieldName", ",", "m...
This aggregator operation computes the minimum of tuples by the given {@code inputFieldName} and it is assumed that its value is an instance of {@code Comparable}. If the value of tuple with field {@code inputFieldName} is not an instance of {@code Comparable} then it throws {@code ClassCastException} @param inputFieldName input field name @return the new stream with this operation.
[ "This", "aggregator", "operation", "computes", "the", "minimum", "of", "tuples", "by", "the", "given", "{", "@code", "inputFieldName", "}", "and", "it", "is", "assumed", "that", "its", "value", "is", "an", "instance", "of", "{", "@code", "Comparable", "}", ...
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/storm/trident/Stream.java#L482-L485
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java
KeyValueLocator.partitionForKey
private static int partitionForKey(byte[] key, int numPartitions) { CRC32 crc32 = new CRC32(); crc32.update(key); long rv = (crc32.getValue() >> 16) & 0x7fff; return (int) rv &numPartitions - 1; }
java
private static int partitionForKey(byte[] key, int numPartitions) { CRC32 crc32 = new CRC32(); crc32.update(key); long rv = (crc32.getValue() >> 16) & 0x7fff; return (int) rv &numPartitions - 1; }
[ "private", "static", "int", "partitionForKey", "(", "byte", "[", "]", "key", ",", "int", "numPartitions", ")", "{", "CRC32", "crc32", "=", "new", "CRC32", "(", ")", ";", "crc32", ".", "update", "(", "key", ")", ";", "long", "rv", "=", "(", "crc32", ...
Calculate the vbucket for the given key. @param key the key to calculate from. @param numPartitions the number of partitions in the bucket. @return the calculated partition.
[ "Calculate", "the", "vbucket", "for", "the", "given", "key", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java#L239-L244
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/MembershipManager.java
MembershipManager.isMissingMember
boolean isMissingMember(Address address, String uuid) { Map<Object, MemberImpl> m = missingMembersRef.get(); return isHotRestartEnabled() ? m.containsKey(uuid) : m.containsKey(address); }
java
boolean isMissingMember(Address address, String uuid) { Map<Object, MemberImpl> m = missingMembersRef.get(); return isHotRestartEnabled() ? m.containsKey(uuid) : m.containsKey(address); }
[ "boolean", "isMissingMember", "(", "Address", "address", ",", "String", "uuid", ")", "{", "Map", "<", "Object", ",", "MemberImpl", ">", "m", "=", "missingMembersRef", ".", "get", "(", ")", ";", "return", "isHotRestartEnabled", "(", ")", "?", "m", ".", "c...
Returns whether member with given identity (either {@code UUID} or {@code Address} depending on Hot Restart is enabled or not) is a known missing member or not. @param address Address of the missing member @param uuid Uuid of the missing member @return true if it's a known missing member, false otherwise
[ "Returns", "whether", "member", "with", "given", "identity", "(", "either", "{", "@code", "UUID", "}", "or", "{", "@code", "Address", "}", "depending", "on", "Hot", "Restart", "is", "enabled", "or", "not", ")", "is", "a", "known", "missing", "member", "o...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/MembershipManager.java#L953-L956
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackUtility.java
FastTrackUtility.hexdump
public static final String hexdump(byte[] buffer, int offset, int length, boolean ascii, int columns, String prefix) { StringBuilder sb = new StringBuilder(); if (buffer != null) { int index = offset; DecimalFormat df = new DecimalFormat("00000"); while (index < (offset + length)) { if (index + columns > (offset + length)) { columns = (offset + length) - index; } sb.append(prefix); sb.append(df.format(index - offset)); sb.append(":"); sb.append(hexdump(buffer, index, columns, ascii)); sb.append('\n'); index += columns; } } return (sb.toString()); }
java
public static final String hexdump(byte[] buffer, int offset, int length, boolean ascii, int columns, String prefix) { StringBuilder sb = new StringBuilder(); if (buffer != null) { int index = offset; DecimalFormat df = new DecimalFormat("00000"); while (index < (offset + length)) { if (index + columns > (offset + length)) { columns = (offset + length) - index; } sb.append(prefix); sb.append(df.format(index - offset)); sb.append(":"); sb.append(hexdump(buffer, index, columns, ascii)); sb.append('\n'); index += columns; } } return (sb.toString()); }
[ "public", "static", "final", "String", "hexdump", "(", "byte", "[", "]", "buffer", ",", "int", "offset", ",", "int", "length", ",", "boolean", "ascii", ",", "int", "columns", ",", "String", "prefix", ")", "{", "StringBuilder", "sb", "=", "new", "StringBu...
Dump raw data as hex. @param buffer buffer @param offset offset into buffer @param length length of data to dump @param ascii true if ASCII should also be printed @param columns number of columns @param prefix prefix when printing @return hex dump
[ "Dump", "raw", "data", "as", "hex", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackUtility.java#L249-L275
jbundle/jbundle
base/db/physical/src/main/java/org/jbundle/base/db/physical/PhysicalTable.java
PhysicalTable.doSetHandle
public boolean doSetHandle(Object bookmark, int iHandleType) throws DBException { try { if (iHandleType == DBConstants.OBJECT_ID_HANDLE) { return super.doSetHandle(bookmark, iHandleType); //? throw new DBException("Object IDs are not supported for PhysicalTables (non persistent)"); } else return super.doSetHandle(bookmark, iHandleType); } catch (DBException ex) { throw DatabaseException.toDatabaseException(ex); } }
java
public boolean doSetHandle(Object bookmark, int iHandleType) throws DBException { try { if (iHandleType == DBConstants.OBJECT_ID_HANDLE) { return super.doSetHandle(bookmark, iHandleType); //? throw new DBException("Object IDs are not supported for PhysicalTables (non persistent)"); } else return super.doSetHandle(bookmark, iHandleType); } catch (DBException ex) { throw DatabaseException.toDatabaseException(ex); } }
[ "public", "boolean", "doSetHandle", "(", "Object", "bookmark", ",", "int", "iHandleType", ")", "throws", "DBException", "{", "try", "{", "if", "(", "iHandleType", "==", "DBConstants", ".", "OBJECT_ID_HANDLE", ")", "{", "return", "super", ".", "doSetHandle", "(...
Read the record given the ID to this persistent object. Note: You can't use an OBJECT_ID handle, as these tables are non-persistent. @param objectID java.lang.Object The handle to lookup. @return true if found. @exception DBException File exception.
[ "Read", "the", "record", "given", "the", "ID", "to", "this", "persistent", "object", ".", "Note", ":", "You", "can", "t", "use", "an", "OBJECT_ID", "handle", "as", "these", "tables", "are", "non", "-", "persistent", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/physical/src/main/java/org/jbundle/base/db/physical/PhysicalTable.java#L297-L310
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java
Pixel.getGrey
public int getGrey(final int redWeight, final int greenWeight, final int blueWeight){ return Pixel.getGrey(getValue(), redWeight, greenWeight, blueWeight); }
java
public int getGrey(final int redWeight, final int greenWeight, final int blueWeight){ return Pixel.getGrey(getValue(), redWeight, greenWeight, blueWeight); }
[ "public", "int", "getGrey", "(", "final", "int", "redWeight", ",", "final", "int", "greenWeight", ",", "final", "int", "blueWeight", ")", "{", "return", "Pixel", ".", "getGrey", "(", "getValue", "(", ")", ",", "redWeight", ",", "greenWeight", ",", "blueWei...
Calculates the grey value of this pixel using specified weights. @param redWeight weight for red channel @param greenWeight weight for green channel @param blueWeight weight for blue channel @return grey value of pixel for specified weights @throws ArithmeticException divide by zero if the weights sum up to 0. @throws ArrayIndexOutOfBoundsException if this Pixel's index is not in range of the Img's data array. @see #getLuminance() @see #getGrey(int, int, int, int) @since 1.2
[ "Calculates", "the", "grey", "value", "of", "this", "pixel", "using", "specified", "weights", "." ]
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java#L552-L554
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.checkArgPositive
public static int checkArgPositive(final int arg, final String argNameOrErrorMsg) { if (arg <= 0) { if (argNameOrErrorMsg.indexOf(' ') == N.INDEX_NOT_FOUND) { throw new IllegalArgumentException("'" + argNameOrErrorMsg + "' can not be zero or negative: " + arg); } else { throw new IllegalArgumentException(argNameOrErrorMsg); } } return arg; }
java
public static int checkArgPositive(final int arg, final String argNameOrErrorMsg) { if (arg <= 0) { if (argNameOrErrorMsg.indexOf(' ') == N.INDEX_NOT_FOUND) { throw new IllegalArgumentException("'" + argNameOrErrorMsg + "' can not be zero or negative: " + arg); } else { throw new IllegalArgumentException(argNameOrErrorMsg); } } return arg; }
[ "public", "static", "int", "checkArgPositive", "(", "final", "int", "arg", ",", "final", "String", "argNameOrErrorMsg", ")", "{", "if", "(", "arg", "<=", "0", ")", "{", "if", "(", "argNameOrErrorMsg", ".", "indexOf", "(", "'", "'", ")", "==", "N", ".",...
Checks if the specified {@code arg} is positive, and throws {@code IllegalArgumentException} if it is not. @param arg @param argNameOrErrorMsg @throws IllegalArgumentException if the specified {@code arg} is negative.
[ "Checks", "if", "the", "specified", "{", "@code", "arg", "}", "is", "positive", "and", "throws", "{", "@code", "IllegalArgumentException", "}", "if", "it", "is", "not", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L5884-L5894
jeremylong/DependencyCheck
utils/src/main/java/org/owasp/dependencycheck/utils/Downloader.java
Downloader.fetchFile
public void fetchFile(URL url, File outputPath) throws DownloadFailedException { fetchFile(url, outputPath, true); }
java
public void fetchFile(URL url, File outputPath) throws DownloadFailedException { fetchFile(url, outputPath, true); }
[ "public", "void", "fetchFile", "(", "URL", "url", ",", "File", "outputPath", ")", "throws", "DownloadFailedException", "{", "fetchFile", "(", "url", ",", "outputPath", ",", "true", ")", ";", "}" ]
Retrieves a file from a given URL and saves it to the outputPath. @param url the URL of the file to download @param outputPath the path to the save the file to @throws org.owasp.dependencycheck.utils.DownloadFailedException is thrown if there is an error downloading the file
[ "Retrieves", "a", "file", "from", "a", "given", "URL", "and", "saves", "it", "to", "the", "outputPath", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Downloader.java#L65-L67
knowitall/common-java
src/main/java/edu/washington/cs/knowitall/commonlib/Range.java
Range.fromInterval
public static Range fromInterval(int start, int end) { if (start < 0) { throw new IllegalArgumentException("Range start must be >= 0: " + start); } if (end < 0) { throw new IllegalArgumentException("Range end must be >= 0: " + end); } if (end < start) { throw new IllegalArgumentException("Range end must be >= start: " + end + "<" + start); } return new Range(start, end - start); }
java
public static Range fromInterval(int start, int end) { if (start < 0) { throw new IllegalArgumentException("Range start must be >= 0: " + start); } if (end < 0) { throw new IllegalArgumentException("Range end must be >= 0: " + end); } if (end < start) { throw new IllegalArgumentException("Range end must be >= start: " + end + "<" + start); } return new Range(start, end - start); }
[ "public", "static", "Range", "fromInterval", "(", "int", "start", ",", "int", "end", ")", "{", "if", "(", "start", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Range start must be >= 0: \"", "+", "start", ")", ";", "}", "if", "("...
* Returns a new range over the specified interval. @param start The first item in the range (inclusive). @param end The end of the range (exclusive). @return a new range over the interval.
[ "*", "Returns", "a", "new", "range", "over", "the", "specified", "interval", "." ]
train
https://github.com/knowitall/common-java/blob/6c3e7b2f13da5afb1306e87a6c322c55b65fddfc/src/main/java/edu/washington/cs/knowitall/commonlib/Range.java#L58-L69
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/h/AdjustHomographyMatrix.java
AdjustHomographyMatrix.adjustHomographSign
protected void adjustHomographSign( PairLineNorm p , DMatrixRMaj H ) { CommonOps_DDRM.transpose(H,H_t); double val = GeometryMath_F64.innerProd(p.l1, H_t, p.l2); if( val < 0 ) CommonOps_DDRM.scale(-1, H); }
java
protected void adjustHomographSign( PairLineNorm p , DMatrixRMaj H ) { CommonOps_DDRM.transpose(H,H_t); double val = GeometryMath_F64.innerProd(p.l1, H_t, p.l2); if( val < 0 ) CommonOps_DDRM.scale(-1, H); }
[ "protected", "void", "adjustHomographSign", "(", "PairLineNorm", "p", ",", "DMatrixRMaj", "H", ")", "{", "CommonOps_DDRM", ".", "transpose", "(", "H", ",", "H_t", ")", ";", "double", "val", "=", "GeometryMath_F64", ".", "innerProd", "(", "p", ".", "l1", ",...
Since the sign of the homography is ambiguous a point is required to make sure the correct one was selected. @param p test point, used to determine the sign of the matrix.
[ "Since", "the", "sign", "of", "the", "homography", "is", "ambiguous", "a", "point", "is", "required", "to", "make", "sure", "the", "correct", "one", "was", "selected", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/h/AdjustHomographyMatrix.java#L97-L105
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/XPathHelper.java
XPathHelper.getXPath
public String getXPath(NamespaceContext context, String xml, String xPathExpr) { return (String) evaluateXpath(context, xml, xPathExpr, null); }
java
public String getXPath(NamespaceContext context, String xml, String xPathExpr) { return (String) evaluateXpath(context, xml, xPathExpr, null); }
[ "public", "String", "getXPath", "(", "NamespaceContext", "context", ",", "String", "xml", ",", "String", "xPathExpr", ")", "{", "return", "(", "String", ")", "evaluateXpath", "(", "context", ",", "xml", ",", "xPathExpr", ",", "null", ")", ";", "}" ]
Evaluates xPathExpr against xml, returning single match. @param xml xml document to apply XPath to. @param xPathExpr XPath expression to evaluate. @return result of evaluation, null if xml is null.
[ "Evaluates", "xPathExpr", "against", "xml", "returning", "single", "match", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/XPathHelper.java#L28-L30
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
FSNamesystem.addStoredBlock
private boolean addStoredBlock(Block block, DatanodeDescriptor node, DatanodeDescriptor delNodeHint) throws IOException { return addStoredBlockInternal(block, node, delNodeHint, false, null); }
java
private boolean addStoredBlock(Block block, DatanodeDescriptor node, DatanodeDescriptor delNodeHint) throws IOException { return addStoredBlockInternal(block, node, delNodeHint, false, null); }
[ "private", "boolean", "addStoredBlock", "(", "Block", "block", ",", "DatanodeDescriptor", "node", ",", "DatanodeDescriptor", "delNodeHint", ")", "throws", "IOException", "{", "return", "addStoredBlockInternal", "(", "block", ",", "node", ",", "delNodeHint", ",", "fa...
Modify (block-->datanode) map. Remove block from set of needed replications if this takes care of the problem. @return whether or not the block was stored. @throws IOException
[ "Modify", "(", "block", "--", ">", "datanode", ")", "map", ".", "Remove", "block", "from", "set", "of", "needed", "replications", "if", "this", "takes", "care", "of", "the", "problem", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L6217-L6221
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueContainer.java
QueueContainer.txnPeek
public QueueItem txnPeek(long offerId, String transactionId) { QueueItem item = getItemQueue().peek(); if (item == null) { if (offerId == -1) { return null; } TxQueueItem txItem = txMap.get(offerId); if (txItem == null) { return null; } item = new QueueItem(this, txItem.getItemId(), txItem.getData()); return item; } if (store.isEnabled() && item.getData() == null) { try { load(item); } catch (Exception e) { throw new HazelcastException(e); } } return item; }
java
public QueueItem txnPeek(long offerId, String transactionId) { QueueItem item = getItemQueue().peek(); if (item == null) { if (offerId == -1) { return null; } TxQueueItem txItem = txMap.get(offerId); if (txItem == null) { return null; } item = new QueueItem(this, txItem.getItemId(), txItem.getData()); return item; } if (store.isEnabled() && item.getData() == null) { try { load(item); } catch (Exception e) { throw new HazelcastException(e); } } return item; }
[ "public", "QueueItem", "txnPeek", "(", "long", "offerId", ",", "String", "transactionId", ")", "{", "QueueItem", "item", "=", "getItemQueue", "(", ")", ".", "peek", "(", ")", ";", "if", "(", "item", "==", "null", ")", "{", "if", "(", "offerId", "==", ...
Retrieves, but does not remove, the head of the queue. If the queue is empty checks if there is a reserved item with the associated {@code offerId} and returns it. If the item was retrieved from the queue but does not contain any data and the queue store is enabled, this method will try load the data from the data store. @param offerId the ID of the reserved item to be returned if the queue is empty @param transactionId currently ignored @return the head of the queue or a reserved item associated with the {@code offerId} if the queue is empty @throws HazelcastException if there is an exception while loading the data from the queue store
[ "Retrieves", "but", "does", "not", "remove", "the", "head", "of", "the", "queue", ".", "If", "the", "queue", "is", "empty", "checks", "if", "there", "is", "a", "reserved", "item", "with", "the", "associated", "{", "@code", "offerId", "}", "and", "returns...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueContainer.java#L413-L434
watson-developer-cloud/java-sdk
discovery/src/main/java/com/ibm/watson/discovery/v1/query/AggregationDeserializer.java
AggregationDeserializer.collapseMap
private void collapseMap(HashMap<String, Object> objMap) { while (objMap.keySet().size() == 1 && objMap.keySet().contains("")) { HashMap<String, Object> innerMap = (HashMap<String, Object>) objMap.get(""); objMap.clear(); objMap.putAll(innerMap); } }
java
private void collapseMap(HashMap<String, Object> objMap) { while (objMap.keySet().size() == 1 && objMap.keySet().contains("")) { HashMap<String, Object> innerMap = (HashMap<String, Object>) objMap.get(""); objMap.clear(); objMap.putAll(innerMap); } }
[ "private", "void", "collapseMap", "(", "HashMap", "<", "String", ",", "Object", ">", "objMap", ")", "{", "while", "(", "objMap", ".", "keySet", "(", ")", ".", "size", "(", ")", "==", "1", "&&", "objMap", ".", "keySet", "(", ")", ".", "contains", "(...
Condenses the main object map to eliminate unnecessary nesting and allow for proper type conversion when the map is complete. @param objMap Map used to build the structure for the resulting {@link QueryAggregation} object
[ "Condenses", "the", "main", "object", "map", "to", "eliminate", "unnecessary", "nesting", "and", "allow", "for", "proper", "type", "conversion", "when", "the", "map", "is", "complete", "." ]
train
https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/discovery/src/main/java/com/ibm/watson/discovery/v1/query/AggregationDeserializer.java#L197-L203
riversun/string-grabber
src/main/java/org/riversun/string_grabber/StringGrabber.java
StringGrabber.replaceEnclosedIn
public StringGrabber replaceEnclosedIn(String startToken, String endToken, String replacement) { StringCropper cropper = getCropper(); final List<StrPosition> stringEnclosedInWithDetails = cropper.getStringEnclosedInWithDetails(sb.toString(), startToken, endToken); final List<Integer> splitList = new ArrayList<Integer>(); for (StrPosition sp : stringEnclosedInWithDetails) { int splitPointFirst = sp.startIndex - 1; int splitPointSecond = sp.endIndex; splitList.add(splitPointFirst); splitList.add(splitPointSecond); } final Integer[] splitIndexes = splitList.toArray(new Integer[] {}); List<String> splitStringList = cropper.splitByIndex(sb.toString(), splitIndexes); final StringBuilder tempSb = new StringBuilder(); final int strNum = splitStringList.size(); boolean nextIsValue = false; int countOfReplacement = 0; for (int i = 0; i < strNum; i++) { String strPart = splitStringList.get(i); if (nextIsValue) { // position to add into replacement tempSb.append(replacement); countOfReplacement++; if (strPart.startsWith(endToken)) { // is string Blank tempSb.append(strPart); } } else { tempSb.append(strPart); } if (strPart.endsWith(startToken)) { nextIsValue = true; } else { nextIsValue = false; } } sb = tempSb; return StringGrabber.this; }
java
public StringGrabber replaceEnclosedIn(String startToken, String endToken, String replacement) { StringCropper cropper = getCropper(); final List<StrPosition> stringEnclosedInWithDetails = cropper.getStringEnclosedInWithDetails(sb.toString(), startToken, endToken); final List<Integer> splitList = new ArrayList<Integer>(); for (StrPosition sp : stringEnclosedInWithDetails) { int splitPointFirst = sp.startIndex - 1; int splitPointSecond = sp.endIndex; splitList.add(splitPointFirst); splitList.add(splitPointSecond); } final Integer[] splitIndexes = splitList.toArray(new Integer[] {}); List<String> splitStringList = cropper.splitByIndex(sb.toString(), splitIndexes); final StringBuilder tempSb = new StringBuilder(); final int strNum = splitStringList.size(); boolean nextIsValue = false; int countOfReplacement = 0; for (int i = 0; i < strNum; i++) { String strPart = splitStringList.get(i); if (nextIsValue) { // position to add into replacement tempSb.append(replacement); countOfReplacement++; if (strPart.startsWith(endToken)) { // is string Blank tempSb.append(strPart); } } else { tempSb.append(strPart); } if (strPart.endsWith(startToken)) { nextIsValue = true; } else { nextIsValue = false; } } sb = tempSb; return StringGrabber.this; }
[ "public", "StringGrabber", "replaceEnclosedIn", "(", "String", "startToken", ",", "String", "endToken", ",", "String", "replacement", ")", "{", "StringCropper", "cropper", "=", "getCropper", "(", ")", ";", "final", "List", "<", "StrPosition", ">", "stringEnclosedI...
replace specified string enclosed in speficied token @param startToken @param endToken @param replacement @return
[ "replace", "specified", "string", "enclosed", "in", "speficied", "token" ]
train
https://github.com/riversun/string-grabber/blob/b5aadc21fe15f50d35392188dec6ab81dcf8d464/src/main/java/org/riversun/string_grabber/StringGrabber.java#L400-L460
app55/app55-java
src/support/java/com/googlecode/openbeans/EventSetDescriptor.java
EventSetDescriptor.findAddRemoveListenerMethod
private Method findAddRemoveListenerMethod(Class<?> sourceClass, String methodName) throws IntrospectionException { try { return sourceClass.getMethod(methodName, listenerType); } catch (NoSuchMethodException e) { return findAddRemoveListnerMethodWithLessCheck(sourceClass, methodName); } catch (Exception e) { throw new IntrospectionException(Messages.getString("beans.31", //$NON-NLS-1$ methodName, listenerType.getName())); } }
java
private Method findAddRemoveListenerMethod(Class<?> sourceClass, String methodName) throws IntrospectionException { try { return sourceClass.getMethod(methodName, listenerType); } catch (NoSuchMethodException e) { return findAddRemoveListnerMethodWithLessCheck(sourceClass, methodName); } catch (Exception e) { throw new IntrospectionException(Messages.getString("beans.31", //$NON-NLS-1$ methodName, listenerType.getName())); } }
[ "private", "Method", "findAddRemoveListenerMethod", "(", "Class", "<", "?", ">", "sourceClass", ",", "String", "methodName", ")", "throws", "IntrospectionException", "{", "try", "{", "return", "sourceClass", ".", "getMethod", "(", "methodName", ",", "listenerType", ...
Searches for {add|remove}Listener methods in the event source. Parameter check is also performed. @param sourceClass event source class @param methodName method name to search @return found method @throws IntrospectionException if no valid method found
[ "Searches", "for", "{", "add|remove", "}", "Listener", "methods", "in", "the", "event", "source", ".", "Parameter", "check", "is", "also", "performed", "." ]
train
https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/EventSetDescriptor.java#L338-L353
twitter/hraven
hraven-etl/src/main/java/com/twitter/hraven/etl/JobHistoryFileParserHadoop2.java
JobHistoryFileParserHadoop2.populatePut
private void populatePut(Put p, byte[] family, String key, long value) { byte[] valueBytes = null; valueBytes = (value != 0L) ? Bytes.toBytes(value) : Constants.ZERO_LONG_BYTES; byte[] qualifier = Bytes.toBytes(getKey(key).toLowerCase()); p.addColumn(family, qualifier, valueBytes); }
java
private void populatePut(Put p, byte[] family, String key, long value) { byte[] valueBytes = null; valueBytes = (value != 0L) ? Bytes.toBytes(value) : Constants.ZERO_LONG_BYTES; byte[] qualifier = Bytes.toBytes(getKey(key).toLowerCase()); p.addColumn(family, qualifier, valueBytes); }
[ "private", "void", "populatePut", "(", "Put", "p", ",", "byte", "[", "]", "family", ",", "String", "key", ",", "long", "value", ")", "{", "byte", "[", "]", "valueBytes", "=", "null", ";", "valueBytes", "=", "(", "value", "!=", "0L", ")", "?", "Byte...
populates a put for long values @param {@link Put} p @param {@link Constants} family @param String key @param long value
[ "populates", "a", "put", "for", "long", "values" ]
train
https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-etl/src/main/java/com/twitter/hraven/etl/JobHistoryFileParserHadoop2.java#L611-L617
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java
ComputerVisionImpl.recognizePrintedTextAsync
public Observable<OcrResult> recognizePrintedTextAsync(boolean detectOrientation, String url, RecognizePrintedTextOptionalParameter recognizePrintedTextOptionalParameter) { return recognizePrintedTextWithServiceResponseAsync(detectOrientation, url, recognizePrintedTextOptionalParameter).map(new Func1<ServiceResponse<OcrResult>, OcrResult>() { @Override public OcrResult call(ServiceResponse<OcrResult> response) { return response.body(); } }); }
java
public Observable<OcrResult> recognizePrintedTextAsync(boolean detectOrientation, String url, RecognizePrintedTextOptionalParameter recognizePrintedTextOptionalParameter) { return recognizePrintedTextWithServiceResponseAsync(detectOrientation, url, recognizePrintedTextOptionalParameter).map(new Func1<ServiceResponse<OcrResult>, OcrResult>() { @Override public OcrResult call(ServiceResponse<OcrResult> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OcrResult", ">", "recognizePrintedTextAsync", "(", "boolean", "detectOrientation", ",", "String", "url", ",", "RecognizePrintedTextOptionalParameter", "recognizePrintedTextOptionalParameter", ")", "{", "return", "recognizePrintedTextWithServiceRespon...
Optical Character Recognition (OCR) detects printed text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError. @param detectOrientation Whether detect the text orientation in the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it's upside-down). @param url Publicly reachable URL of an image @param recognizePrintedTextOptionalParameter 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 OcrResult object
[ "Optical", "Character", "Recognition", "(", "OCR", ")", "detects", "printed", "text", "in", "an", "image", "and", "extracts", "the", "recognized", "characters", "into", "a", "machine", "-", "usable", "character", "stream", ".", "Upon", "success", "the", "OCR",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L1927-L1934
ttddyy/datasource-proxy
src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java
ProxyDataSourceBuilder.traceMethodsWhen
public ProxyDataSourceBuilder traceMethodsWhen(TracingMethodListener.TracingCondition condition, TracingMethodListener.TracingMessageConsumer messageConsumer) { this.createTracingMethodListener = true; this.tracingCondition = condition; this.tracingMessageConsumer = messageConsumer; return this; }
java
public ProxyDataSourceBuilder traceMethodsWhen(TracingMethodListener.TracingCondition condition, TracingMethodListener.TracingMessageConsumer messageConsumer) { this.createTracingMethodListener = true; this.tracingCondition = condition; this.tracingMessageConsumer = messageConsumer; return this; }
[ "public", "ProxyDataSourceBuilder", "traceMethodsWhen", "(", "TracingMethodListener", ".", "TracingCondition", "condition", ",", "TracingMethodListener", ".", "TracingMessageConsumer", "messageConsumer", ")", "{", "this", ".", "createTracingMethodListener", "=", "true", ";", ...
Enable {@link TracingMethodListener}. When given condition returns {@code true}, it prints out trace log. The condition is used for dynamically turn on/off tracing. The message consumer receives a tracing message that can be printed to console, logger, etc. @param condition decide to turn on/off tracing @param messageConsumer receives trace logging message @return builder @since 1.4.4
[ "Enable", "{", "@link", "TracingMethodListener", "}", "." ]
train
https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java#L928-L933
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateEqual
public static Object validateEqual(Object t1, Object t2, String errorMsg) throws ValidateException { if (false == equal(t1, t2)) { throw new ValidateException(errorMsg); } return t1; }
java
public static Object validateEqual(Object t1, Object t2, String errorMsg) throws ValidateException { if (false == equal(t1, t2)) { throw new ValidateException(errorMsg); } return t1; }
[ "public", "static", "Object", "validateEqual", "(", "Object", "t1", ",", "Object", "t2", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "false", "==", "equal", "(", "t1", ",", "t2", ")", ")", "{", "throw", "new", "Validate...
验证是否相等,不相等抛出异常<br> @param t1 对象1 @param t2 对象2 @param errorMsg 错误信息 @return 相同值 @throws ValidateException 验证异常
[ "验证是否相等,不相等抛出异常<br", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L248-L253
wellner/jcarafe
jcarafe-core/src/main/java/cern/colt/map/AbstractIntObjectMap.java
AbstractIntObjectMap.keyOf
public int keyOf(final Object value) { final int[] foundKey = new int[1]; boolean notFound = forEachPair( new IntObjectProcedure() { public boolean apply(int iterKey, Object iterValue) { boolean found = value == iterValue; if (found) foundKey[0] = iterKey; return !found; } } ); if (notFound) return Integer.MIN_VALUE; return foundKey[0]; }
java
public int keyOf(final Object value) { final int[] foundKey = new int[1]; boolean notFound = forEachPair( new IntObjectProcedure() { public boolean apply(int iterKey, Object iterValue) { boolean found = value == iterValue; if (found) foundKey[0] = iterKey; return !found; } } ); if (notFound) return Integer.MIN_VALUE; return foundKey[0]; }
[ "public", "int", "keyOf", "(", "final", "Object", "value", ")", "{", "final", "int", "[", "]", "foundKey", "=", "new", "int", "[", "1", "]", ";", "boolean", "notFound", "=", "forEachPair", "(", "new", "IntObjectProcedure", "(", ")", "{", "public", "boo...
Returns the first key the given value is associated with. It is often a good idea to first check with {@link #containsValue(Object)} whether there exists an association from a key to this value. Search order is guaranteed to be <i>identical</i> to the order used by method {@link #forEachKey(IntProcedure)}. @param value the value to search for. @return the first key for which holds <tt>get(key) == value</tt>; returns <tt>Integer.MIN_VALUE</tt> if no such key exists.
[ "Returns", "the", "first", "key", "the", "given", "value", "is", "associated", "with", ".", "It", "is", "often", "a", "good", "idea", "to", "first", "check", "with", "{", "@link", "#containsValue", "(", "Object", ")", "}", "whether", "there", "exists", "...
train
https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/map/AbstractIntObjectMap.java#L170-L183
alkacon/opencms-core
src/org/opencms/file/wrapper/CmsObjectWrapper.java
CmsObjectWrapper.readResource
public CmsResource readResource(CmsUUID structureID, CmsResourceFilter filter) throws CmsException { return m_cms.readResource(structureID, filter); }
java
public CmsResource readResource(CmsUUID structureID, CmsResourceFilter filter) throws CmsException { return m_cms.readResource(structureID, filter); }
[ "public", "CmsResource", "readResource", "(", "CmsUUID", "structureID", ",", "CmsResourceFilter", "filter", ")", "throws", "CmsException", "{", "return", "m_cms", ".", "readResource", "(", "structureID", ",", "filter", ")", ";", "}" ]
Delegate method for {@link CmsObject#readResource(CmsUUID, CmsResourceFilter)}.<p> @see CmsObject#readResource(CmsUUID, CmsResourceFilter) @param structureID the ID of the structure to read @param filter the resource filter to use while reading @return the resource that was read @throws CmsException if the resource could not be read for any reason
[ "Delegate", "method", "for", "{", "@link", "CmsObject#readResource", "(", "CmsUUID", "CmsResourceFilter", ")", "}", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/wrapper/CmsObjectWrapper.java#L614-L617