repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/internal/resilience/RobustLoaderWriterResilienceStrategy.java
RobustLoaderWriterResilienceStrategy.putAllFailure
@Override public void putAllFailure(Map<? extends K, ? extends V> entries, StoreAccessException e) { try { loaderWriter.writeAll(entries.entrySet()); // FIXME: bad typing that we should fix } catch(BulkCacheWritingException e1) { throw e1; } catch (Exception e1) { throw ExceptionFactory.newCacheWritingException(e1, e); } finally { cleanup(entries.keySet(), e); } }
java
@Override public void putAllFailure(Map<? extends K, ? extends V> entries, StoreAccessException e) { try { loaderWriter.writeAll(entries.entrySet()); // FIXME: bad typing that we should fix } catch(BulkCacheWritingException e1) { throw e1; } catch (Exception e1) { throw ExceptionFactory.newCacheWritingException(e1, e); } finally { cleanup(entries.keySet(), e); } }
[ "@", "Override", "public", "void", "putAllFailure", "(", "Map", "<", "?", "extends", "K", ",", "?", "extends", "V", ">", "entries", ",", "StoreAccessException", "e", ")", "{", "try", "{", "loaderWriter", ".", "writeAll", "(", "entries", ".", "entrySet", ...
Write all entries to the loader-writer. @param entries the entries being put @param e the triggered failure
[ "Write", "all", "entries", "to", "the", "loader", "-", "writer", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/resilience/RobustLoaderWriterResilienceStrategy.java#L290-L301
graphql-java/graphql-java
src/main/java/graphql/schema/diff/DiffSet.java
DiffSet.diffSet
public static DiffSet diffSet(GraphQLSchema schemaOld, GraphQLSchema schemaNew) { Map<String, Object> introspectionOld = introspect(schemaOld); Map<String, Object> introspectionNew = introspect(schemaNew); return diffSet(introspectionOld, introspectionNew); }
java
public static DiffSet diffSet(GraphQLSchema schemaOld, GraphQLSchema schemaNew) { Map<String, Object> introspectionOld = introspect(schemaOld); Map<String, Object> introspectionNew = introspect(schemaNew); return diffSet(introspectionOld, introspectionNew); }
[ "public", "static", "DiffSet", "diffSet", "(", "GraphQLSchema", "schemaOld", ",", "GraphQLSchema", "schemaNew", ")", "{", "Map", "<", "String", ",", "Object", ">", "introspectionOld", "=", "introspect", "(", "schemaOld", ")", ";", "Map", "<", "String", ",", ...
Creates a diff set out of the result of 2 schemas. @param schemaOld the older schema @param schemaNew the newer schema @return a diff set representing them
[ "Creates", "a", "diff", "set", "out", "of", "the", "result", "of", "2", "schemas", "." ]
train
https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/schema/diff/DiffSet.java#L63-L67
cdk/cdk
base/core/src/main/java/org/openscience/cdk/atomtype/CDKAtomTypeMatcher.java
CDKAtomTypeMatcher.countAttachedBonds
private int countAttachedBonds(List<IBond> connectedBonds, IAtom atom, IBond.Order order, String symbol) { // count the number of double bonded oxygens int neighborcount = connectedBonds.size(); int doubleBondedAtoms = 0; for (int i = neighborcount - 1; i >= 0; i--) { IBond bond = connectedBonds.get(i); if (bond.getOrder() == order) { if (bond.getAtomCount() == 2) { if (symbol != null) { // if other atom is of the given element (by its symbol) if (bond.getOther(atom).getSymbol().equals(symbol)) { doubleBondedAtoms++; } } else { doubleBondedAtoms++; } } } } return doubleBondedAtoms; }
java
private int countAttachedBonds(List<IBond> connectedBonds, IAtom atom, IBond.Order order, String symbol) { // count the number of double bonded oxygens int neighborcount = connectedBonds.size(); int doubleBondedAtoms = 0; for (int i = neighborcount - 1; i >= 0; i--) { IBond bond = connectedBonds.get(i); if (bond.getOrder() == order) { if (bond.getAtomCount() == 2) { if (symbol != null) { // if other atom is of the given element (by its symbol) if (bond.getOther(atom).getSymbol().equals(symbol)) { doubleBondedAtoms++; } } else { doubleBondedAtoms++; } } } } return doubleBondedAtoms; }
[ "private", "int", "countAttachedBonds", "(", "List", "<", "IBond", ">", "connectedBonds", ",", "IAtom", "atom", ",", "IBond", ".", "Order", "order", ",", "String", "symbol", ")", "{", "// count the number of double bonded oxygens", "int", "neighborcount", "=", "co...
Count the number of doubly bonded atoms. @param connectedBonds bonds connected to the atom @param atom the atom being looked at @param order the desired bond order of the attached bonds @param symbol If not null, then it only counts the double bonded atoms which match the given symbol. @return the number of doubly bonded atoms
[ "Count", "the", "number", "of", "doubly", "bonded", "atoms", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/atomtype/CDKAtomTypeMatcher.java#L2451-L2471
cryptomator/cryptolib
src/main/java/org/cryptomator/cryptolib/Cryptors.java
Cryptors.ciphertextSize
public static long ciphertextSize(long cleartextSize, Cryptor cryptor) { checkArgument(cleartextSize >= 0, "expected cleartextSize to be positive, but was %s", cleartextSize); long cleartextChunkSize = cryptor.fileContentCryptor().cleartextChunkSize(); long ciphertextChunkSize = cryptor.fileContentCryptor().ciphertextChunkSize(); long overheadPerChunk = ciphertextChunkSize - cleartextChunkSize; long numFullChunks = cleartextSize / cleartextChunkSize; // floor by int-truncation long additionalCleartextBytes = cleartextSize % cleartextChunkSize; long additionalCiphertextBytes = (additionalCleartextBytes == 0) ? 0 : additionalCleartextBytes + overheadPerChunk; assert additionalCiphertextBytes >= 0; return ciphertextChunkSize * numFullChunks + additionalCiphertextBytes; }
java
public static long ciphertextSize(long cleartextSize, Cryptor cryptor) { checkArgument(cleartextSize >= 0, "expected cleartextSize to be positive, but was %s", cleartextSize); long cleartextChunkSize = cryptor.fileContentCryptor().cleartextChunkSize(); long ciphertextChunkSize = cryptor.fileContentCryptor().ciphertextChunkSize(); long overheadPerChunk = ciphertextChunkSize - cleartextChunkSize; long numFullChunks = cleartextSize / cleartextChunkSize; // floor by int-truncation long additionalCleartextBytes = cleartextSize % cleartextChunkSize; long additionalCiphertextBytes = (additionalCleartextBytes == 0) ? 0 : additionalCleartextBytes + overheadPerChunk; assert additionalCiphertextBytes >= 0; return ciphertextChunkSize * numFullChunks + additionalCiphertextBytes; }
[ "public", "static", "long", "ciphertextSize", "(", "long", "cleartextSize", ",", "Cryptor", "cryptor", ")", "{", "checkArgument", "(", "cleartextSize", ">=", "0", ",", "\"expected cleartextSize to be positive, but was %s\"", ",", "cleartextSize", ")", ";", "long", "cl...
Calculates the size of the ciphertext resulting from the given cleartext encrypted with the given cryptor. @param cleartextSize Length of a unencrypted payload. @param cryptor The cryptor which defines the cleartext/ciphertext ratio @return Ciphertext length of a <code>cleartextSize</code>-sized cleartext encrypted with <code>cryptor</code>. Not including the {@link FileHeader#getFilesize() length of the header}.
[ "Calculates", "the", "size", "of", "the", "ciphertext", "resulting", "from", "the", "given", "cleartext", "encrypted", "with", "the", "given", "cryptor", "." ]
train
https://github.com/cryptomator/cryptolib/blob/33bc881f6ee7d4924043ea6309efd2c063ec3638/src/main/java/org/cryptomator/cryptolib/Cryptors.java#L65-L75
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.setMilliseconds
public static Date setMilliseconds(final Date date, final int amount) { return set(date, Calendar.MILLISECOND, amount); }
java
public static Date setMilliseconds(final Date date, final int amount) { return set(date, Calendar.MILLISECOND, amount); }
[ "public", "static", "Date", "setMilliseconds", "(", "final", "Date", "date", ",", "final", "int", "amount", ")", "{", "return", "set", "(", "date", ",", "Calendar", ".", "MILLISECOND", ",", "amount", ")", ";", "}" ]
Sets the milliseconds field to a date returning a new object. The original {@code Date} is unchanged. @param date the date, not null @param amount the amount to set @return a new {@code Date} set with the specified value @throws IllegalArgumentException if the date is null @since 2.4
[ "Sets", "the", "milliseconds", "field", "to", "a", "date", "returning", "a", "new", "object", ".", "The", "original", "{", "@code", "Date", "}", "is", "unchanged", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L631-L633
pravega/pravega
common/src/main/java/io/pravega/common/lang/ProcessStarter.java
ProcessStarter.sysProp
public ProcessStarter sysProp(String name, Object value) { this.systemProps.put(name, value.toString()); return this; }
java
public ProcessStarter sysProp(String name, Object value) { this.systemProps.put(name, value.toString()); return this; }
[ "public", "ProcessStarter", "sysProp", "(", "String", "name", ",", "Object", "value", ")", "{", "this", ".", "systemProps", ".", "put", "(", "name", ",", "value", ".", "toString", "(", ")", ")", ";", "return", "this", ";", "}" ]
Includes the given System Property as part of the start. @param name The System Property Name. @param value The System Property Value. This will have toString() invoked on it. @return This object instance.
[ "Includes", "the", "given", "System", "Property", "as", "part", "of", "the", "start", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/lang/ProcessStarter.java#L70-L73
cloudant/java-cloudant
cloudant-client/src/main/java/com/cloudant/client/api/Database.java
Database.invokeUpdateHandler
public String invokeUpdateHandler(String updateHandlerUri, String docId, Params params) { assertNotEmpty(params, "params"); return db.invokeUpdateHandler(updateHandlerUri, docId, params.getInternalParams()); }
java
public String invokeUpdateHandler(String updateHandlerUri, String docId, Params params) { assertNotEmpty(params, "params"); return db.invokeUpdateHandler(updateHandlerUri, docId, params.getInternalParams()); }
[ "public", "String", "invokeUpdateHandler", "(", "String", "updateHandlerUri", ",", "String", "docId", ",", "Params", "params", ")", "{", "assertNotEmpty", "(", "params", ",", "\"params\"", ")", ";", "return", "db", ".", "invokeUpdateHandler", "(", "updateHandlerUr...
Invokes an Update Handler. <P>Example usage:</P> <pre> {@code final String newValue = "foo bar"; Params params = new Params() .addParam("field", "title") .addParam("value", newValue); String output = db.invokeUpdateHandler("example/example_update", "exampleId", params); } </pre> <pre> Params params = new Params() .addParam("field", "foo") .addParam("value", "bar"); String output = dbClient.invokeUpdateHandler("designDoc/update1", "docId", params); </pre> @param updateHandlerUri The Update Handler URI, in the format: <code>designDoc/update1</code> @param docId The document id to update. If no id is provided, then a document will be created. @param params The query parameters as {@link Params}. @return The output of the request. @see <a href="https://console.bluemix.net/docs/services/Cloudant/api/design_documents.html#update-handlers" target="_blank">Design documents - update handlers</a>
[ "Invokes", "an", "Update", "Handler", ".", "<P", ">", "Example", "usage", ":", "<", "/", "P", ">", "<pre", ">", "{", "@code", "final", "String", "newValue", "=", "foo", "bar", ";", "Params", "params", "=", "new", "Params", "()", ".", "addParam", "(",...
train
https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L1378-L1382
xwiki/xwiki-rendering
xwiki-rendering-transformations/xwiki-rendering-transformation-icon/src/main/java/org/xwiki/rendering/internal/transformation/icon/IconTransformation.java
IconTransformation.mergeTree
private void mergeTree(Block targetTree, Block sourceTree) { for (Block block : sourceTree.getChildren()) { // Check if the current block exists in the target tree at the same place in the tree int pos = indexOf(targetTree.getChildren(), block); if (pos > -1) { Block foundBlock = targetTree.getChildren().get(pos); mergeTree(foundBlock, block); } else { targetTree.addChild(block); } } }
java
private void mergeTree(Block targetTree, Block sourceTree) { for (Block block : sourceTree.getChildren()) { // Check if the current block exists in the target tree at the same place in the tree int pos = indexOf(targetTree.getChildren(), block); if (pos > -1) { Block foundBlock = targetTree.getChildren().get(pos); mergeTree(foundBlock, block); } else { targetTree.addChild(block); } } }
[ "private", "void", "mergeTree", "(", "Block", "targetTree", ",", "Block", "sourceTree", ")", "{", "for", "(", "Block", "block", ":", "sourceTree", ".", "getChildren", "(", ")", ")", "{", "// Check if the current block exists in the target tree at the same place in the t...
Merged two XDOM trees. @param targetTree the tree to merge into @param sourceTree the tree to merge
[ "Merged", "two", "XDOM", "trees", "." ]
train
https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-transformations/xwiki-rendering-transformation-icon/src/main/java/org/xwiki/rendering/internal/transformation/icon/IconTransformation.java#L155-L167
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java
ElementsExceptionsFactory.newResourceNotFoundException
public static ResourceNotFoundException newResourceNotFoundException(Throwable cause, String message, Object... args) { return new ResourceNotFoundException(format(message, args), cause); }
java
public static ResourceNotFoundException newResourceNotFoundException(Throwable cause, String message, Object... args) { return new ResourceNotFoundException(format(message, args), cause); }
[ "public", "static", "ResourceNotFoundException", "newResourceNotFoundException", "(", "Throwable", "cause", ",", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "new", "ResourceNotFoundException", "(", "format", "(", "message", ",", "args", ")...
Constructs and initializes a new {@link ResourceNotFoundException} with the given {@link Throwable cause} and {@link String message} formatted with the given {@link Object[] arguments}. @param cause {@link Throwable} identified as the reason this {@link ResourceNotFoundException} was thrown. @param message {@link String} describing the {@link ResourceNotFoundException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link ResourceNotFoundException} with the given {@link Throwable cause} and {@link String message}. @see org.cp.elements.lang.ResourceNotFoundException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "ResourceNotFoundException", "}", "with", "the", "given", "{", "@link", "Throwable", "cause", "}", "and", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", ...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L509-L513
saxsys/SynchronizeFX
transmitter/websocket-transmitter/src/main/java/de/saxsys/synchronizefx/websocket/SychronizeFXWebsocketServer.java
SychronizeFXWebsocketServer.onOpen
public void onOpen(final Session session, final String channelName) { final SynchronizeFXWebsocketChannel channel; synchronized (channels) { channel = getChannelOrFail(channelName); clients.put(session, channel); } channel.newClient(session); }
java
public void onOpen(final Session session, final String channelName) { final SynchronizeFXWebsocketChannel channel; synchronized (channels) { channel = getChannelOrFail(channelName); clients.put(session, channel); } channel.newClient(session); }
[ "public", "void", "onOpen", "(", "final", "Session", "session", ",", "final", "String", "channelName", ")", "{", "final", "SynchronizeFXWebsocketChannel", "channel", ";", "synchronized", "(", "channels", ")", "{", "channel", "=", "getChannelOrFail", "(", "channelN...
Pass {@link OnOpen} events of the Websocket API to this method to handle new clients. @param session The client that has connected. @param channelName The name of the channel this client connected too. @throws IllegalArgumentException If the channel passed as argument does not exist.
[ "Pass", "{", "@link", "OnOpen", "}", "events", "of", "the", "Websocket", "API", "to", "this", "method", "to", "handle", "new", "clients", "." ]
train
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/transmitter/websocket-transmitter/src/main/java/de/saxsys/synchronizefx/websocket/SychronizeFXWebsocketServer.java#L172-L179
Azure/azure-sdk-for-java
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java
InstanceFailoverGroupsInner.deleteAsync
public Observable<Void> deleteAsync(String resourceGroupName, String locationName, String failoverGroupName) { return deleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> deleteAsync(String resourceGroupName, String locationName, String failoverGroupName) { return deleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "deleteAsync", "(", "String", "resourceGroupName", ",", "String", "locationName", ",", "String", "failoverGroupName", ")", "{", "return", "deleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "locationName", ",", "f...
Deletes a failover group. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param locationName The name of the region where the resource is located. @param failoverGroupName The name of the failover group. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Deletes", "a", "failover", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java#L428-L435
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/WikisApi.java
WikisApi.updatePage
public WikiPage updatePage(Object projectIdOrPath, String slug, String title, String content) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("title", title) .withParam("slug", slug, true) .withParam("content", content); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "wikis", slug); return (response.readEntity(WikiPage.class)); }
java
public WikiPage updatePage(Object projectIdOrPath, String slug, String title, String content) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("title", title) .withParam("slug", slug, true) .withParam("content", content); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "wikis", slug); return (response.readEntity(WikiPage.class)); }
[ "public", "WikiPage", "updatePage", "(", "Object", "projectIdOrPath", ",", "String", "slug", ",", "String", "title", ",", "String", "content", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "wit...
Updates an existing project wiki page. The user must have permission to change an existing wiki page. <pre><code>GitLab Endpoint: PUT /projects/:id/wikis/:slug</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param slug the slug of the project's wiki page, required @param title the title of a snippet, optional @param content the content of a page, optional. Either title or content must be supplied. @return a WikiPage instance with info on the updated page @throws GitLabApiException if any exception occurs
[ "Updates", "an", "existing", "project", "wiki", "page", ".", "The", "user", "must", "have", "permission", "to", "change", "an", "existing", "wiki", "page", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/WikisApi.java#L146-L155
uscexp/grappa.extension
src/main/java/com/github/uscexp/grappa/extension/interpreter/ProcessStore.java
ProcessStore.setLocalVariable
public boolean setLocalVariable(Object key, Object value) { boolean success = false; if (working.size() > 0) { Map<Object, Object> map = working.get(working.size() - 1); map.put(key, value); success = true; } return success; }
java
public boolean setLocalVariable(Object key, Object value) { boolean success = false; if (working.size() > 0) { Map<Object, Object> map = working.get(working.size() - 1); map.put(key, value); success = true; } return success; }
[ "public", "boolean", "setLocalVariable", "(", "Object", "key", ",", "Object", "value", ")", "{", "boolean", "success", "=", "false", ";", "if", "(", "working", ".", "size", "(", ")", ">", "0", ")", "{", "Map", "<", "Object", ",", "Object", ">", "map"...
set a new local variable, on the highest block hierarchy. @param key name of the variable @param value value of the variable @return true if at least one local block hierarchy exists else false
[ "set", "a", "new", "local", "variable", "on", "the", "highest", "block", "hierarchy", "." ]
train
https://github.com/uscexp/grappa.extension/blob/a6001eb6eee434a09e2870e7513f883c7fdaea94/src/main/java/com/github/uscexp/grappa/extension/interpreter/ProcessStore.java#L322-L331
gallandarakhneorg/afc
advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java
ZoomableGraphicsContext.fillText
public void fillText(String text, double x, double y) { this.gc.fillText(text, doc2fxX(x), doc2fxY(y)); }
java
public void fillText(String text, double x, double y) { this.gc.fillText(text, doc2fxX(x), doc2fxY(y)); }
[ "public", "void", "fillText", "(", "String", "text", ",", "double", "x", ",", "double", "y", ")", "{", "this", ".", "gc", ".", "fillText", "(", "text", ",", "doc2fxX", "(", "x", ")", ",", "doc2fxY", "(", "y", ")", ")", ";", "}" ]
Fills the given string of text at position x, y with the current fill paint attribute. A {@code null} text value will be ignored. <p>This method will be affected by any of the global common, fill, or text attributes as specified in the Rendering Attributes Table of {@link GraphicsContext}. @param text the string of text or null. @param x position on the x axis. @param y position on the y axis.
[ "Fills", "the", "given", "string", "of", "text", "at", "position", "x", "y", "with", "the", "current", "fill", "paint", "attribute", ".", "A", "{", "@code", "null", "}", "text", "value", "will", "be", "ignored", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L1093-L1095
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterDecoder.java
CharacterDecoder.decodeBuffer
public void decodeBuffer(InputStream aStream, OutputStream bStream) throws IOException { int i; int totalBytes = 0; PushbackInputStream ps = new PushbackInputStream (aStream); decodeBufferPrefix(ps, bStream); while (true) { int length; try { length = decodeLinePrefix(ps, bStream); for (i = 0; (i+bytesPerAtom()) < length; i += bytesPerAtom()) { decodeAtom(ps, bStream, bytesPerAtom()); totalBytes += bytesPerAtom(); } if ((i + bytesPerAtom()) == length) { decodeAtom(ps, bStream, bytesPerAtom()); totalBytes += bytesPerAtom(); } else { decodeAtom(ps, bStream, length - i); totalBytes += (length - i); } decodeLineSuffix(ps, bStream); } catch (CEStreamExhausted e) { break; } } decodeBufferSuffix(ps, bStream); }
java
public void decodeBuffer(InputStream aStream, OutputStream bStream) throws IOException { int i; int totalBytes = 0; PushbackInputStream ps = new PushbackInputStream (aStream); decodeBufferPrefix(ps, bStream); while (true) { int length; try { length = decodeLinePrefix(ps, bStream); for (i = 0; (i+bytesPerAtom()) < length; i += bytesPerAtom()) { decodeAtom(ps, bStream, bytesPerAtom()); totalBytes += bytesPerAtom(); } if ((i + bytesPerAtom()) == length) { decodeAtom(ps, bStream, bytesPerAtom()); totalBytes += bytesPerAtom(); } else { decodeAtom(ps, bStream, length - i); totalBytes += (length - i); } decodeLineSuffix(ps, bStream); } catch (CEStreamExhausted e) { break; } } decodeBufferSuffix(ps, bStream); }
[ "public", "void", "decodeBuffer", "(", "InputStream", "aStream", ",", "OutputStream", "bStream", ")", "throws", "IOException", "{", "int", "i", ";", "int", "totalBytes", "=", "0", ";", "PushbackInputStream", "ps", "=", "new", "PushbackInputStream", "(", "aStream...
Decode the text from the InputStream and write the decoded octets to the OutputStream. This method runs until the stream is exhausted. @exception CEFormatException An error has occured while decoding @exception CEStreamExhausted The input stream is unexpectedly out of data
[ "Decode", "the", "text", "from", "the", "InputStream", "and", "write", "the", "decoded", "octets", "to", "the", "OutputStream", ".", "This", "method", "runs", "until", "the", "stream", "is", "exhausted", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterDecoder.java#L151-L179
hdbeukel/james-core
src/main/java/org/jamesframework/core/problems/constraints/validations/UnanimousValidation.java
UnanimousValidation.addValidation
public void addValidation(Object key, Validation validation){ initMapOnce(); validations.put(key, validation); // update aggregated value passedAll = passedAll && validation.passed(); }
java
public void addValidation(Object key, Validation validation){ initMapOnce(); validations.put(key, validation); // update aggregated value passedAll = passedAll && validation.passed(); }
[ "public", "void", "addValidation", "(", "Object", "key", ",", "Validation", "validation", ")", "{", "initMapOnce", "(", ")", ";", "validations", ".", "put", "(", "key", ",", "validation", ")", ";", "// update aggregated value", "passedAll", "=", "passedAll", "...
Add a validation object. A key is required that can be used to retrieve the validation object. @param key key used to retrieve the validation object @param validation validation object
[ "Add", "a", "validation", "object", ".", "A", "key", "is", "required", "that", "can", "be", "used", "to", "retrieve", "the", "validation", "object", "." ]
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/problems/constraints/validations/UnanimousValidation.java#L60-L65
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/math/SparseSquareMatrix.java
SparseSquareMatrix.get
public double get(int i, int j) { if (i < 0 || i >= N) throw new IllegalArgumentException("Illegal index " + i + " should be > 0 and < " + N); if (j < 0 || j >= N) throw new IllegalArgumentException("Illegal index " + j + " should be > 0 and < " + N); return rows[i].get(j); }
java
public double get(int i, int j) { if (i < 0 || i >= N) throw new IllegalArgumentException("Illegal index " + i + " should be > 0 and < " + N); if (j < 0 || j >= N) throw new IllegalArgumentException("Illegal index " + j + " should be > 0 and < " + N); return rows[i].get(j); }
[ "public", "double", "get", "(", "int", "i", ",", "int", "j", ")", "{", "if", "(", "i", "<", "0", "||", "i", ">=", "N", ")", "throw", "new", "IllegalArgumentException", "(", "\"Illegal index \"", "+", "i", "+", "\" should be > 0 and < \"", "+", "N", ")"...
access a value at i,j @param i @param j @return return A[i][j]
[ "access", "a", "value", "at", "i", "j" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/math/SparseSquareMatrix.java#L87-L93
rubenlagus/TelegramBots
telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAudio.java
SendAudio.setAudio
public SendAudio setAudio(File file) { Objects.requireNonNull(file, "file cannot be null!"); this.audio = new InputFile(file, file.getName()); return this; }
java
public SendAudio setAudio(File file) { Objects.requireNonNull(file, "file cannot be null!"); this.audio = new InputFile(file, file.getName()); return this; }
[ "public", "SendAudio", "setAudio", "(", "File", "file", ")", "{", "Objects", ".", "requireNonNull", "(", "file", ",", "\"file cannot be null!\"", ")", ";", "this", ".", "audio", "=", "new", "InputFile", "(", "file", ",", "file", ".", "getName", "(", ")", ...
Use this method to set the audio to a new file @param file New audio file
[ "Use", "this", "method", "to", "set", "the", "audio", "to", "a", "new", "file" ]
train
https://github.com/rubenlagus/TelegramBots/blob/d62354915d7664597a40fd9858f16bce67ef1478/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAudio.java#L108-L112
jhipster/jhipster
jhipster-framework/src/main/java/io/github/jhipster/service/QueryService.java
QueryService.buildSpecification
protected Specification<ENTITY> buildSpecification(StringFilter filter, Function<Root<ENTITY>, Expression<String>> metaclassFunction) { if (filter.getEquals() != null) { return equalsSpecification(metaclassFunction, filter.getEquals()); } else if (filter.getIn() != null) { return valueIn(metaclassFunction, filter.getIn()); } else if (filter.getContains() != null) { return likeUpperSpecification(metaclassFunction, filter.getContains()); } else if (filter.getSpecified() != null) { return byFieldSpecified(metaclassFunction, filter.getSpecified()); } return null; }
java
protected Specification<ENTITY> buildSpecification(StringFilter filter, Function<Root<ENTITY>, Expression<String>> metaclassFunction) { if (filter.getEquals() != null) { return equalsSpecification(metaclassFunction, filter.getEquals()); } else if (filter.getIn() != null) { return valueIn(metaclassFunction, filter.getIn()); } else if (filter.getContains() != null) { return likeUpperSpecification(metaclassFunction, filter.getContains()); } else if (filter.getSpecified() != null) { return byFieldSpecified(metaclassFunction, filter.getSpecified()); } return null; }
[ "protected", "Specification", "<", "ENTITY", ">", "buildSpecification", "(", "StringFilter", "filter", ",", "Function", "<", "Root", "<", "ENTITY", ">", ",", "Expression", "<", "String", ">", ">", "metaclassFunction", ")", "{", "if", "(", "filter", ".", "get...
Helper function to return a specification for filtering on a {@link String} field, where equality, containment, and null/non-null conditions are supported. @param filter the individual attribute filter coming from the frontend. @param metaclassFunction lambda, which based on a Root&lt;ENTITY&gt; returns Expression - basicaly picks a column @return a Specification
[ "Helper", "function", "to", "return", "a", "specification", "for", "filtering", "on", "a", "{", "@link", "String", "}", "field", "where", "equality", "containment", "and", "null", "/", "non", "-", "null", "conditions", "are", "supported", "." ]
train
https://github.com/jhipster/jhipster/blob/5dcf4239c7cc035e188ef02447d3c628fac5c5d9/jhipster-framework/src/main/java/io/github/jhipster/service/QueryService.java#L101-L112
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmAttributes.java
XsdAsmAttributes.numericAdjustment
private static void numericAdjustment(MethodVisitor mVisitor, String javaType) { adjustmentsMapper.getOrDefault(javaType, XsdAsmAttributes::doubleAdjustment).accept(mVisitor); }
java
private static void numericAdjustment(MethodVisitor mVisitor, String javaType) { adjustmentsMapper.getOrDefault(javaType, XsdAsmAttributes::doubleAdjustment).accept(mVisitor); }
[ "private", "static", "void", "numericAdjustment", "(", "MethodVisitor", "mVisitor", ",", "String", "javaType", ")", "{", "adjustmentsMapper", ".", "getOrDefault", "(", "javaType", ",", "XsdAsmAttributes", "::", "doubleAdjustment", ")", ".", "accept", "(", "mVisitor"...
Applies a cast to numeric types, i.e. int, short, long, to double. @param mVisitor The visitor of the attribute constructor. @param javaType The type of the argument received in the constructor.
[ "Applies", "a", "cast", "to", "numeric", "types", "i", ".", "e", ".", "int", "short", "long", "to", "double", "." ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmAttributes.java#L280-L282
aspectran/aspectran
web/src/main/java/com/aspectran/web/support/cors/DefaultCorsProcessor.java
DefaultCorsProcessor.rejectRequest
protected void rejectRequest(Translet translet, CorsException ce) throws CorsException { HttpServletResponse res = translet.getResponseAdaptee(); res.setStatus(ce.getHttpStatusCode()); translet.setAttribute(CORS_HTTP_STATUS_CODE, ce.getHttpStatusCode()); translet.setAttribute(CORS_HTTP_STATUS_TEXT, ce.getMessage()); throw ce; }
java
protected void rejectRequest(Translet translet, CorsException ce) throws CorsException { HttpServletResponse res = translet.getResponseAdaptee(); res.setStatus(ce.getHttpStatusCode()); translet.setAttribute(CORS_HTTP_STATUS_CODE, ce.getHttpStatusCode()); translet.setAttribute(CORS_HTTP_STATUS_TEXT, ce.getMessage()); throw ce; }
[ "protected", "void", "rejectRequest", "(", "Translet", "translet", ",", "CorsException", "ce", ")", "throws", "CorsException", "{", "HttpServletResponse", "res", "=", "translet", ".", "getResponseAdaptee", "(", ")", ";", "res", ".", "setStatus", "(", "ce", ".", ...
Invoked when one of the CORS checks failed. The default implementation sets the response status to 403. @param translet the Translet instance @param ce the CORS Exception @throws CorsException if the request is denied
[ "Invoked", "when", "one", "of", "the", "CORS", "checks", "failed", ".", "The", "default", "implementation", "sets", "the", "response", "status", "to", "403", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/web/src/main/java/com/aspectran/web/support/cors/DefaultCorsProcessor.java#L158-L166
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/VoiceApi.java
VoiceApi.attachUserData
public ApiSuccessResponse attachUserData(String id, UserDataOperationId userData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = attachUserDataWithHttpInfo(id, userData); return resp.getData(); }
java
public ApiSuccessResponse attachUserData(String id, UserDataOperationId userData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = attachUserDataWithHttpInfo(id, userData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "attachUserData", "(", "String", "id", ",", "UserDataOperationId", "userData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "attachUserDataWithHttpInfo", "(", "id", ",", "userData", ")"...
Attach user data to a call Attach the provided data to the specified call. This adds the data to the call even if data already exists with the provided keys. @param id The connection ID of the call. (required) @param userData The data to attach to the call. This is an array of objects with the properties key, type, and value. (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Attach", "user", "data", "to", "a", "call", "Attach", "the", "provided", "data", "to", "the", "specified", "call", ".", "This", "adds", "the", "data", "to", "the", "call", "even", "if", "data", "already", "exists", "with", "the", "provided", "keys", "."...
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L434-L437
Stratio/bdt
src/main/java/com/stratio/qa/specs/DcosSpec.java
DcosSpec.checkComponentConstraints
@Then("^The role '(.+?)' of the service '(.+?)' with instance '(.+?)' complies the constraints '(.+?)'$") public void checkComponentConstraints(String role, String service, String instance, String constraints) throws Exception { checkComponentConstraint(role, service, instance, constraints.split(",")); }
java
@Then("^The role '(.+?)' of the service '(.+?)' with instance '(.+?)' complies the constraints '(.+?)'$") public void checkComponentConstraints(String role, String service, String instance, String constraints) throws Exception { checkComponentConstraint(role, service, instance, constraints.split(",")); }
[ "@", "Then", "(", "\"^The role '(.+?)' of the service '(.+?)' with instance '(.+?)' complies the constraints '(.+?)'$\"", ")", "public", "void", "checkComponentConstraints", "(", "String", "role", ",", "String", "service", ",", "String", "instance", ",", "String", "constraints"...
Check if a role of a service complies the established constraints @param role name of role of a service @param service name of service of exhibitor @param instance name of instance of a service @param constraints all stablished contraints separated by a semicolumn. Example: constraint1,constraint2,... @throws Exception
[ "Check", "if", "a", "role", "of", "a", "service", "complies", "the", "established", "constraints" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DcosSpec.java#L536-L539
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java
WebSocketClientHandshaker00.newHandshakeRequest
@Override protected FullHttpRequest newHandshakeRequest() { // Make keys int spaces1 = WebSocketUtil.randomNumber(1, 12); int spaces2 = WebSocketUtil.randomNumber(1, 12); int max1 = Integer.MAX_VALUE / spaces1; int max2 = Integer.MAX_VALUE / spaces2; int number1 = WebSocketUtil.randomNumber(0, max1); int number2 = WebSocketUtil.randomNumber(0, max2); int product1 = number1 * spaces1; int product2 = number2 * spaces2; String key1 = Integer.toString(product1); String key2 = Integer.toString(product2); key1 = insertRandomCharacters(key1); key2 = insertRandomCharacters(key2); key1 = insertSpaces(key1, spaces1); key2 = insertSpaces(key2, spaces2); byte[] key3 = WebSocketUtil.randomBytes(8); ByteBuffer buffer = ByteBuffer.allocate(4); buffer.putInt(number1); byte[] number1Array = buffer.array(); buffer = ByteBuffer.allocate(4); buffer.putInt(number2); byte[] number2Array = buffer.array(); byte[] challenge = new byte[16]; System.arraycopy(number1Array, 0, challenge, 0, 4); System.arraycopy(number2Array, 0, challenge, 4, 4); System.arraycopy(key3, 0, challenge, 8, 8); expectedChallengeResponseBytes = Unpooled.wrappedBuffer(WebSocketUtil.md5(challenge)); // Get path URI wsURL = uri(); String path = rawPath(wsURL); // Format request FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path); HttpHeaders headers = request.headers(); if (customHeaders != null) { headers.add(customHeaders); } headers.set(HttpHeaderNames.UPGRADE, WEBSOCKET) .set(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE) .set(HttpHeaderNames.HOST, websocketHostValue(wsURL)) .set(HttpHeaderNames.ORIGIN, websocketOriginValue(wsURL)) .set(HttpHeaderNames.SEC_WEBSOCKET_KEY1, key1) .set(HttpHeaderNames.SEC_WEBSOCKET_KEY2, key2); String expectedSubprotocol = expectedSubprotocol(); if (expectedSubprotocol != null && !expectedSubprotocol.isEmpty()) { headers.set(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL, expectedSubprotocol); } // Set Content-Length to workaround some known defect. // See also: http://www.ietf.org/mail-archive/web/hybi/current/msg02149.html headers.set(HttpHeaderNames.CONTENT_LENGTH, key3.length); request.content().writeBytes(key3); return request; }
java
@Override protected FullHttpRequest newHandshakeRequest() { // Make keys int spaces1 = WebSocketUtil.randomNumber(1, 12); int spaces2 = WebSocketUtil.randomNumber(1, 12); int max1 = Integer.MAX_VALUE / spaces1; int max2 = Integer.MAX_VALUE / spaces2; int number1 = WebSocketUtil.randomNumber(0, max1); int number2 = WebSocketUtil.randomNumber(0, max2); int product1 = number1 * spaces1; int product2 = number2 * spaces2; String key1 = Integer.toString(product1); String key2 = Integer.toString(product2); key1 = insertRandomCharacters(key1); key2 = insertRandomCharacters(key2); key1 = insertSpaces(key1, spaces1); key2 = insertSpaces(key2, spaces2); byte[] key3 = WebSocketUtil.randomBytes(8); ByteBuffer buffer = ByteBuffer.allocate(4); buffer.putInt(number1); byte[] number1Array = buffer.array(); buffer = ByteBuffer.allocate(4); buffer.putInt(number2); byte[] number2Array = buffer.array(); byte[] challenge = new byte[16]; System.arraycopy(number1Array, 0, challenge, 0, 4); System.arraycopy(number2Array, 0, challenge, 4, 4); System.arraycopy(key3, 0, challenge, 8, 8); expectedChallengeResponseBytes = Unpooled.wrappedBuffer(WebSocketUtil.md5(challenge)); // Get path URI wsURL = uri(); String path = rawPath(wsURL); // Format request FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path); HttpHeaders headers = request.headers(); if (customHeaders != null) { headers.add(customHeaders); } headers.set(HttpHeaderNames.UPGRADE, WEBSOCKET) .set(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE) .set(HttpHeaderNames.HOST, websocketHostValue(wsURL)) .set(HttpHeaderNames.ORIGIN, websocketOriginValue(wsURL)) .set(HttpHeaderNames.SEC_WEBSOCKET_KEY1, key1) .set(HttpHeaderNames.SEC_WEBSOCKET_KEY2, key2); String expectedSubprotocol = expectedSubprotocol(); if (expectedSubprotocol != null && !expectedSubprotocol.isEmpty()) { headers.set(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL, expectedSubprotocol); } // Set Content-Length to workaround some known defect. // See also: http://www.ietf.org/mail-archive/web/hybi/current/msg02149.html headers.set(HttpHeaderNames.CONTENT_LENGTH, key3.length); request.content().writeBytes(key3); return request; }
[ "@", "Override", "protected", "FullHttpRequest", "newHandshakeRequest", "(", ")", "{", "// Make keys", "int", "spaces1", "=", "WebSocketUtil", ".", "randomNumber", "(", "1", ",", "12", ")", ";", "int", "spaces2", "=", "WebSocketUtil", ".", "randomNumber", "(", ...
<p> Sends the opening request to the server: </p> <pre> GET /demo HTTP/1.1 Upgrade: WebSocket Connection: Upgrade Host: example.com Origin: http://example.com Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5 Sec-WebSocket-Key2: 12998 5 Y3 1 .P00 ^n:ds[4U </pre>
[ "<p", ">", "Sends", "the", "opening", "request", "to", "the", "server", ":", "<", "/", "p", ">" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java#L112-L180
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.addActionError
public static void addActionError( ServletRequest request, String propertyName, String messageKey, Object messageArg1, Object messageArg2 ) { Object[] messageArgs = new Object[]{ messageArg1, messageArg2 }; InternalUtils.addActionError( propertyName, new ActionMessage( messageKey, messageArgs ), request ); }
java
public static void addActionError( ServletRequest request, String propertyName, String messageKey, Object messageArg1, Object messageArg2 ) { Object[] messageArgs = new Object[]{ messageArg1, messageArg2 }; InternalUtils.addActionError( propertyName, new ActionMessage( messageKey, messageArgs ), request ); }
[ "public", "static", "void", "addActionError", "(", "ServletRequest", "request", ",", "String", "propertyName", ",", "String", "messageKey", ",", "Object", "messageArg1", ",", "Object", "messageArg2", ")", "{", "Object", "[", "]", "messageArgs", "=", "new", "Obje...
Add a property-related message that will be shown with the Errors and Error tags. @param request the current ServletRequest. @param propertyName the name of the property with which to associate this error. @param messageKey the message-resources key for the message. @param messageArg1 the first argument to the message @param messageArg2 the second argument to the message
[ "Add", "a", "property", "-", "related", "message", "that", "will", "be", "shown", "with", "the", "Errors", "and", "Error", "tags", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L1069-L1074
RestComm/load-balancer
jar/src/main/java/org/mobicents/tools/http/urlrewriting/BalancerUrlRewriteFilter.java
BalancerUrlRewriteFilter.doFilter
public void doFilter(final HttpRequest httpRequest, MessageEvent e) throws IOException, ServletException { HttpServletRequest servletRequest = new NettyHttpServletRequestAdaptor(httpRequest, e.getChannel()); final HttpServletRequest hsRequest = (HttpServletRequest) servletRequest; if (urlRewriter != null) { String newUrl = urlRewriter.processRequest(hsRequest); if(!newUrl.equals(httpRequest.getUri())) { if (log.isDebugEnabled()) log.debug("request rewrited from : [" + httpRequest.getUri() + "] to : ["+newUrl+"]"); httpRequest.setUri(newUrl); } else { if (log.isDebugEnabled()) log.debug("request not rewrited : [" + httpRequest.getUri() + "]"); } } else { if (log.isDebugEnabled()) { log.debug("urlRewriter engine not loaded ignoring request (could be a conf file problem)"); } } }
java
public void doFilter(final HttpRequest httpRequest, MessageEvent e) throws IOException, ServletException { HttpServletRequest servletRequest = new NettyHttpServletRequestAdaptor(httpRequest, e.getChannel()); final HttpServletRequest hsRequest = (HttpServletRequest) servletRequest; if (urlRewriter != null) { String newUrl = urlRewriter.processRequest(hsRequest); if(!newUrl.equals(httpRequest.getUri())) { if (log.isDebugEnabled()) log.debug("request rewrited from : [" + httpRequest.getUri() + "] to : ["+newUrl+"]"); httpRequest.setUri(newUrl); } else { if (log.isDebugEnabled()) log.debug("request not rewrited : [" + httpRequest.getUri() + "]"); } } else { if (log.isDebugEnabled()) { log.debug("urlRewriter engine not loaded ignoring request (could be a conf file problem)"); } } }
[ "public", "void", "doFilter", "(", "final", "HttpRequest", "httpRequest", ",", "MessageEvent", "e", ")", "throws", "IOException", ",", "ServletException", "{", "HttpServletRequest", "servletRequest", "=", "new", "NettyHttpServletRequestAdaptor", "(", "httpRequest", ",",...
The main method called for each request that this filter is mapped for. @param request the request to filter @throws IOException @throws ServletException
[ "The", "main", "method", "called", "for", "each", "request", "that", "this", "filter", "is", "mapped", "for", "." ]
train
https://github.com/RestComm/load-balancer/blob/54768d0b81004b2653d429720016ad2617fe754f/jar/src/main/java/org/mobicents/tools/http/urlrewriting/BalancerUrlRewriteFilter.java#L98-L120
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyView.java
CmsPatternPanelMonthlyView.addCheckBox
private void addCheckBox(final String internalValue, String labelMessageKey) { CmsCheckBox box = new CmsCheckBox(Messages.get().key(labelMessageKey)); box.setInternalValue(internalValue); box.addValueChangeHandler(new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> event) { if (handleChange()) { m_controller.weeksChange(internalValue, event.getValue()); } } }); m_weekPanel.add(box); m_checkboxes.add(box); }
java
private void addCheckBox(final String internalValue, String labelMessageKey) { CmsCheckBox box = new CmsCheckBox(Messages.get().key(labelMessageKey)); box.setInternalValue(internalValue); box.addValueChangeHandler(new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> event) { if (handleChange()) { m_controller.weeksChange(internalValue, event.getValue()); } } }); m_weekPanel.add(box); m_checkboxes.add(box); }
[ "private", "void", "addCheckBox", "(", "final", "String", "internalValue", ",", "String", "labelMessageKey", ")", "{", "CmsCheckBox", "box", "=", "new", "CmsCheckBox", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "labelMessageKey", ")", ")", ";", ...
Creates a check box and adds it to the week panel and the checkboxes. @param internalValue the internal value of the checkbox @param labelMessageKey key for the label of the checkbox
[ "Creates", "a", "check", "box", "and", "adds", "it", "to", "the", "week", "panel", "and", "the", "checkboxes", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyView.java#L295-L311
OpenNTF/JavascriptAggregator
jaggr-service/src/main/java/com/ibm/jaggr/service/impl/AggregatorImpl.java
AggregatorImpl.createCacheBundle
public String createCacheBundle(String bundleSymbolicName, String bundleFileName) throws IOException { final String sourceMethod = "createCacheBundle"; //$NON-NLS-1$ final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{bundleSymbolicName, bundleFileName}); } // Serialize the cache getCacheManager().serializeCache(); // De-serialize the control file to obtain the cache control data File controlFile = new File(getWorkingDirectory(), CacheControl.CONTROL_SERIALIZATION_FILENAME); CacheControl control = null; ObjectInputStream ois = new ObjectInputStream(new FileInputStream(controlFile));; try { control = (CacheControl)ois.readObject(); } catch (Exception ex) { throw new IOException(ex); } finally { IOUtils.closeQuietly(ois); } if (control.getInitStamp() != 0) { return Messages.AggregatorImpl_3; } // create the bundle manifest InputStream is = AggregatorImpl.class.getClassLoader().getResourceAsStream(MANIFEST_TEMPLATE); StringWriter writer = new StringWriter(); CopyUtil.copy(is, writer); String template = writer.toString(); String manifest = MessageFormat.format(template, new Object[]{ Long.toString(new Date().getTime()), getContributingBundle().getHeaders().get("Bundle-Version"), //$NON-NLS-1$ bundleSymbolicName, AggregatorUtil.getCacheBust(this) }); // create the jar File bundleFile = new File(bundleFileName); ZipUtil.Packer packer = new ZipUtil.Packer(); packer.open(bundleFile); try { packer.packEntryFromStream("META-INF/MANIFEST.MF", new ByteArrayInputStream(manifest.getBytes("UTF-8")), new Date().getTime()); //$NON-NLS-1$ //$NON-NLS-2$ packer.packDirectory(getWorkingDirectory(), JAGGR_CACHE_DIRECTORY); } finally { packer.close(); } String result = bundleFile.getCanonicalPath(); if (isTraceLogging) { log.exiting(sourceClass, sourceMethod, result); } return result; }
java
public String createCacheBundle(String bundleSymbolicName, String bundleFileName) throws IOException { final String sourceMethod = "createCacheBundle"; //$NON-NLS-1$ final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{bundleSymbolicName, bundleFileName}); } // Serialize the cache getCacheManager().serializeCache(); // De-serialize the control file to obtain the cache control data File controlFile = new File(getWorkingDirectory(), CacheControl.CONTROL_SERIALIZATION_FILENAME); CacheControl control = null; ObjectInputStream ois = new ObjectInputStream(new FileInputStream(controlFile));; try { control = (CacheControl)ois.readObject(); } catch (Exception ex) { throw new IOException(ex); } finally { IOUtils.closeQuietly(ois); } if (control.getInitStamp() != 0) { return Messages.AggregatorImpl_3; } // create the bundle manifest InputStream is = AggregatorImpl.class.getClassLoader().getResourceAsStream(MANIFEST_TEMPLATE); StringWriter writer = new StringWriter(); CopyUtil.copy(is, writer); String template = writer.toString(); String manifest = MessageFormat.format(template, new Object[]{ Long.toString(new Date().getTime()), getContributingBundle().getHeaders().get("Bundle-Version"), //$NON-NLS-1$ bundleSymbolicName, AggregatorUtil.getCacheBust(this) }); // create the jar File bundleFile = new File(bundleFileName); ZipUtil.Packer packer = new ZipUtil.Packer(); packer.open(bundleFile); try { packer.packEntryFromStream("META-INF/MANIFEST.MF", new ByteArrayInputStream(manifest.getBytes("UTF-8")), new Date().getTime()); //$NON-NLS-1$ //$NON-NLS-2$ packer.packDirectory(getWorkingDirectory(), JAGGR_CACHE_DIRECTORY); } finally { packer.close(); } String result = bundleFile.getCanonicalPath(); if (isTraceLogging) { log.exiting(sourceClass, sourceMethod, result); } return result; }
[ "public", "String", "createCacheBundle", "(", "String", "bundleSymbolicName", ",", "String", "bundleFileName", ")", "throws", "IOException", "{", "final", "String", "sourceMethod", "=", "\"createCacheBundle\"", ";", "//$NON-NLS-1$\r", "final", "boolean", "isTraceLogging",...
Command handler to create a cache primer bundle containing the contents of the cache directory. @param bundleSymbolicName the symbolic name of the bundle to be created @param bundleFileName the filename of the bundle to be created @return the string to be displayed in the console (the fully qualified filename of the bundle if successful or an error message otherwise) @throws IOException
[ "Command", "handler", "to", "create", "a", "cache", "primer", "bundle", "containing", "the", "contents", "of", "the", "cache", "directory", "." ]
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-service/src/main/java/com/ibm/jaggr/service/impl/AggregatorImpl.java#L783-L833
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecValidator.java
ContentSpecValidator.preValidateXML
private boolean preValidateXML(final KeyValueNode<String> keyValueNode, final String wrappedValue, final String format) { Document doc = null; String errorMsg = null; try { String fixedXML = DocBookUtilities.escapeForXML(wrappedValue); if (CommonConstants.DOCBOOK_50_TITLE.equalsIgnoreCase(format)) { fixedXML = DocBookUtilities.addDocBook50Namespace(fixedXML); } doc = XMLUtilities.convertStringToDocument(fixedXML); } catch (Exception e) { errorMsg = e.getMessage(); } // If the doc variable is null then an error occurred somewhere if (doc == null) { final String line = keyValueNode.getText(); if (errorMsg != null) { log.error(String.format(ProcessorConstants.ERROR_INVALID_METADATA_MSG, keyValueNode.getKey(), errorMsg, line)); } else { log.error(String.format(ProcessorConstants.ERROR_INVALID_METADATA_NO_ERROR_MSG, keyValueNode.getKey(), line)); } return false; } return true; }
java
private boolean preValidateXML(final KeyValueNode<String> keyValueNode, final String wrappedValue, final String format) { Document doc = null; String errorMsg = null; try { String fixedXML = DocBookUtilities.escapeForXML(wrappedValue); if (CommonConstants.DOCBOOK_50_TITLE.equalsIgnoreCase(format)) { fixedXML = DocBookUtilities.addDocBook50Namespace(fixedXML); } doc = XMLUtilities.convertStringToDocument(fixedXML); } catch (Exception e) { errorMsg = e.getMessage(); } // If the doc variable is null then an error occurred somewhere if (doc == null) { final String line = keyValueNode.getText(); if (errorMsg != null) { log.error(String.format(ProcessorConstants.ERROR_INVALID_METADATA_MSG, keyValueNode.getKey(), errorMsg, line)); } else { log.error(String.format(ProcessorConstants.ERROR_INVALID_METADATA_NO_ERROR_MSG, keyValueNode.getKey(), line)); } return false; } return true; }
[ "private", "boolean", "preValidateXML", "(", "final", "KeyValueNode", "<", "String", ">", "keyValueNode", ",", "final", "String", "wrappedValue", ",", "final", "String", "format", ")", "{", "Document", "doc", "=", "null", ";", "String", "errorMsg", "=", "null"...
Performs the pre validation on keyvalue nodes that may be used as XML to ensure it is at least valid XML. @param keyValueNode The key value node being validated. @param wrappedValue The wrapped value, as it would appear in a build. @param format @return True if the content is valid otherwise false.
[ "Performs", "the", "pre", "validation", "on", "keyvalue", "nodes", "that", "may", "be", "used", "as", "XML", "to", "ensure", "it", "is", "at", "least", "valid", "XML", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecValidator.java#L430-L457
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java
BeetlUtil.render
public static Writer render(Template templateContent, Map<String, Object> bindingMap, Writer writer) { templateContent.binding(bindingMap); templateContent.renderTo(writer); return writer; }
java
public static Writer render(Template templateContent, Map<String, Object> bindingMap, Writer writer) { templateContent.binding(bindingMap); templateContent.renderTo(writer); return writer; }
[ "public", "static", "Writer", "render", "(", "Template", "templateContent", ",", "Map", "<", "String", ",", "Object", ">", "bindingMap", ",", "Writer", "writer", ")", "{", "templateContent", ".", "binding", "(", "bindingMap", ")", ";", "templateContent", ".", ...
渲染模板 @param templateContent {@link Template} @param bindingMap 绑定参数 @param writer {@link Writer} 渲染后写入的目标Writer @return {@link Writer}
[ "渲染模板" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java#L223-L227
threerings/nenya
core/src/main/java/com/threerings/geom/GeomUtil.java
GeomUtil.whichSide
public static int whichSide (Point p1, double theta, Point p2) { // obtain the point defining the right hand normal (N) theta += Math.PI/2; int x = p1.x + (int)Math.round(1000*Math.cos(theta)), y = p1.y + (int)Math.round(1000*Math.sin(theta)); // now dot the vector from p1->p2 with the vector from p1->N, if it's positive, we're on // the right hand side, if it's negative we're on the left hand side and if it's zero, // we're on the line return dot(p1.x, p1.y, p2.x, p2.y, x, y); }
java
public static int whichSide (Point p1, double theta, Point p2) { // obtain the point defining the right hand normal (N) theta += Math.PI/2; int x = p1.x + (int)Math.round(1000*Math.cos(theta)), y = p1.y + (int)Math.round(1000*Math.sin(theta)); // now dot the vector from p1->p2 with the vector from p1->N, if it's positive, we're on // the right hand side, if it's negative we're on the left hand side and if it's zero, // we're on the line return dot(p1.x, p1.y, p2.x, p2.y, x, y); }
[ "public", "static", "int", "whichSide", "(", "Point", "p1", ",", "double", "theta", ",", "Point", "p2", ")", "{", "// obtain the point defining the right hand normal (N)", "theta", "+=", "Math", ".", "PI", "/", "2", ";", "int", "x", "=", "p1", ".", "x", "+...
Returns less than zero if <code>p2</code> is on the left hand side of the line created by <code>p1</code> and <code>theta</code> and greater than zero if it is on the right hand side. In theory, it will return zero if the point is on the line, but due to rounding errors it almost always decides that it's not exactly on the line. @param p1 the point on the line whose side we're checking. @param theta the (logical) angle defining the line. @param p2 the point that lies on one side or the other of the line.
[ "Returns", "less", "than", "zero", "if", "<code", ">", "p2<", "/", "code", ">", "is", "on", "the", "left", "hand", "side", "of", "the", "line", "created", "by", "<code", ">", "p1<", "/", "code", ">", "and", "<code", ">", "theta<", "/", "code", ">",...
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/geom/GeomUtil.java#L160-L171
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java
VirtualMachineScaleSetVMsInner.beginUpdate
public VirtualMachineScaleSetVMInner beginUpdate(String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).toBlocking().single().body(); }
java
public VirtualMachineScaleSetVMInner beginUpdate(String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).toBlocking().single().body(); }
[ "public", "VirtualMachineScaleSetVMInner", "beginUpdate", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ",", "String", "instanceId", ",", "VirtualMachineScaleSetVMInner", "parameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "res...
Updates a virtual machine of a VM scale set. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. @param instanceId The instance ID of the virtual machine. @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation. @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 VirtualMachineScaleSetVMInner object if successful.
[ "Updates", "a", "virtual", "machine", "of", "a", "VM", "scale", "set", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java#L769-L771
wcm-io/wcm-io-tooling
maven/plugins/json-dialog-conversion-plugin/src/main/java/io/wcm/maven/plugins/jsondlgcnv/DialogConverter.java
DialogConverter.addCommonAttrMappings
private void addCommonAttrMappings(JSONObject root, JSONObject node) throws JSONException { for (String property : GRANITE_COMMON_ATTR_PROPERTIES) { String[] mapping = { "${./" + property + "}", "${\'./granite:" + property + "\'}" }; mapProperty(root, node, "granite:" + property, mapping); } if (root.has(NN_GRANITE_DATA)) { // the root has granite:data defined, copy it before applying data-* properties node.put(NN_GRANITE_DATA, root.get(NN_GRANITE_DATA)); } // map data-* prefixed properties to granite:data child for (Map.Entry<String, Object> entry : getProperties(root).entrySet()) { if (!StringUtils.startsWith(entry.getKey(), DATA_PREFIX)) { continue; } // add the granite:data child if necessary JSONObject dataNode; if (!node.has(NN_GRANITE_DATA)) { dataNode = new JSONObject(); node.put(NN_GRANITE_DATA, dataNode); } else { dataNode = node.getJSONObject(NN_GRANITE_DATA); } // set up the property mapping String nameWithoutPrefix = entry.getKey().substring(DATA_PREFIX.length()); mapProperty(root, dataNode, nameWithoutPrefix, "${./" + entry.getKey() + "}"); } }
java
private void addCommonAttrMappings(JSONObject root, JSONObject node) throws JSONException { for (String property : GRANITE_COMMON_ATTR_PROPERTIES) { String[] mapping = { "${./" + property + "}", "${\'./granite:" + property + "\'}" }; mapProperty(root, node, "granite:" + property, mapping); } if (root.has(NN_GRANITE_DATA)) { // the root has granite:data defined, copy it before applying data-* properties node.put(NN_GRANITE_DATA, root.get(NN_GRANITE_DATA)); } // map data-* prefixed properties to granite:data child for (Map.Entry<String, Object> entry : getProperties(root).entrySet()) { if (!StringUtils.startsWith(entry.getKey(), DATA_PREFIX)) { continue; } // add the granite:data child if necessary JSONObject dataNode; if (!node.has(NN_GRANITE_DATA)) { dataNode = new JSONObject(); node.put(NN_GRANITE_DATA, dataNode); } else { dataNode = node.getJSONObject(NN_GRANITE_DATA); } // set up the property mapping String nameWithoutPrefix = entry.getKey().substring(DATA_PREFIX.length()); mapProperty(root, dataNode, nameWithoutPrefix, "${./" + entry.getKey() + "}"); } }
[ "private", "void", "addCommonAttrMappings", "(", "JSONObject", "root", ",", "JSONObject", "node", ")", "throws", "JSONException", "{", "for", "(", "String", "property", ":", "GRANITE_COMMON_ATTR_PROPERTIES", ")", "{", "String", "[", "]", "mapping", "=", "{", "\"...
Adds property mappings on a replacement node for Granite common attributes. @param root the root node @param node the replacement node @throws JSONException
[ "Adds", "property", "mappings", "on", "a", "replacement", "node", "for", "Granite", "common", "attributes", "." ]
train
https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/maven/plugins/json-dialog-conversion-plugin/src/main/java/io/wcm/maven/plugins/jsondlgcnv/DialogConverter.java#L370-L401
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/search/util/HeapList.java
HeapList.AddEx
public T AddEx(T value) { if (m_Count < m_Capacity) { m_Array[++m_Count] = value; UpHeap(); return null; } else if (m_Capacity == 0) return value; else if (greaterThan(m_Array[1], value)) { T retVal = m_Array[1]; m_Array[1] = value; DownHeap(); return retVal; } else return value; }
java
public T AddEx(T value) { if (m_Count < m_Capacity) { m_Array[++m_Count] = value; UpHeap(); return null; } else if (m_Capacity == 0) return value; else if (greaterThan(m_Array[1], value)) { T retVal = m_Array[1]; m_Array[1] = value; DownHeap(); return retVal; } else return value; }
[ "public", "T", "AddEx", "(", "T", "value", ")", "{", "if", "(", "m_Count", "<", "m_Capacity", ")", "{", "m_Array", "[", "++", "m_Count", "]", "=", "value", ";", "UpHeap", "(", ")", ";", "return", "null", ";", "}", "else", "if", "(", "m_Capacity", ...
/ If no object was thrown (heap was not yes populated) return null
[ "/", "If", "no", "object", "was", "thrown", "(", "heap", "was", "not", "yes", "populated", ")", "return", "null" ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/search/util/HeapList.java#L95-L109
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/util/GosuObjectUtil.java
GosuObjectUtil.max
public static Object max(Comparable c1, Comparable c2) { if (c1 != null && c2 != null) { return c1.compareTo(c2) >= 0 ? c1 : c2; } else { return c1 != null ? c1 : c2; } }
java
public static Object max(Comparable c1, Comparable c2) { if (c1 != null && c2 != null) { return c1.compareTo(c2) >= 0 ? c1 : c2; } else { return c1 != null ? c1 : c2; } }
[ "public", "static", "Object", "max", "(", "Comparable", "c1", ",", "Comparable", "c2", ")", "{", "if", "(", "c1", "!=", "null", "&&", "c2", "!=", "null", ")", "{", "return", "c1", ".", "compareTo", "(", "c2", ")", ">=", "0", "?", "c1", ":", "c2",...
Null safe comparison of Comparables. @param c1 the first comparable, may be null @param c2 the second comparable, may be null @return <ul> <li>If both objects are non-null and unequal, the greater object. <li>If both objects are non-null and equal, c1. <li>If one of the comparables is null, the non-null object. <li>If both the comparables are null, null is returned. </ul>
[ "Null", "safe", "comparison", "of", "Comparables", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuObjectUtil.java#L280-L286
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/UnsynchronizedOverridesSynchronized.java
UnsynchronizedOverridesSynchronized.ignore
private static boolean ignore(MethodTree method, VisitorState state) { return firstNonNull( new TreeScanner<Boolean, Void>() { @Override public Boolean visitBlock(BlockTree tree, Void unused) { switch (tree.getStatements().size()) { case 0: return true; case 1: return scan(getOnlyElement(tree.getStatements()), null); default: return false; } } @Override public Boolean visitReturn(ReturnTree tree, Void unused) { return scan(tree.getExpression(), null); } @Override public Boolean visitExpressionStatement(ExpressionStatementTree tree, Void unused) { return scan(tree.getExpression(), null); } @Override public Boolean visitTypeCast(TypeCastTree tree, Void unused) { return scan(tree.getExpression(), null); } @Override public Boolean visitMethodInvocation(MethodInvocationTree node, Void aVoid) { ExpressionTree receiver = ASTHelpers.getReceiver(node); return receiver instanceof IdentifierTree && ((IdentifierTree) receiver).getName().contentEquals("super") && overrides(ASTHelpers.getSymbol(method), ASTHelpers.getSymbol(node)); } private boolean overrides(MethodSymbol sym, MethodSymbol other) { return !sym.isStatic() && !other.isStatic() && (((sym.flags() | other.flags()) & Flags.SYNTHETIC) == 0) && sym.name.contentEquals(other.name) && sym.overrides( other, sym.owner.enclClass(), state.getTypes(), /* checkResult= */ false); } }.scan(method.getBody(), null), false); }
java
private static boolean ignore(MethodTree method, VisitorState state) { return firstNonNull( new TreeScanner<Boolean, Void>() { @Override public Boolean visitBlock(BlockTree tree, Void unused) { switch (tree.getStatements().size()) { case 0: return true; case 1: return scan(getOnlyElement(tree.getStatements()), null); default: return false; } } @Override public Boolean visitReturn(ReturnTree tree, Void unused) { return scan(tree.getExpression(), null); } @Override public Boolean visitExpressionStatement(ExpressionStatementTree tree, Void unused) { return scan(tree.getExpression(), null); } @Override public Boolean visitTypeCast(TypeCastTree tree, Void unused) { return scan(tree.getExpression(), null); } @Override public Boolean visitMethodInvocation(MethodInvocationTree node, Void aVoid) { ExpressionTree receiver = ASTHelpers.getReceiver(node); return receiver instanceof IdentifierTree && ((IdentifierTree) receiver).getName().contentEquals("super") && overrides(ASTHelpers.getSymbol(method), ASTHelpers.getSymbol(node)); } private boolean overrides(MethodSymbol sym, MethodSymbol other) { return !sym.isStatic() && !other.isStatic() && (((sym.flags() | other.flags()) & Flags.SYNTHETIC) == 0) && sym.name.contentEquals(other.name) && sym.overrides( other, sym.owner.enclClass(), state.getTypes(), /* checkResult= */ false); } }.scan(method.getBody(), null), false); }
[ "private", "static", "boolean", "ignore", "(", "MethodTree", "method", ",", "VisitorState", "state", ")", "{", "return", "firstNonNull", "(", "new", "TreeScanner", "<", "Boolean", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Boolean", "visitB...
Don't flag methods that are empty or trivially delegate to a super-implementation.
[ "Don", "t", "flag", "methods", "that", "are", "empty", "or", "trivially", "delegate", "to", "a", "super", "-", "implementation", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/UnsynchronizedOverridesSynchronized.java#L88-L136
CloudSlang/cs-actions
cs-powershell/src/main/java/io/cloudslang/content/services/WSManRemoteShellService.java
WSManRemoteShellService.deleteShell
private void deleteShell(HttpClientService csHttpClient, HttpClientInputs httpClientInputs, String shellId, WSManRequestInputs wsManRequestInputs) throws RuntimeException, IOException, URISyntaxException, TransformerException, XPathExpressionException, SAXException, ParserConfigurationException { String documentStr = ResourceLoader.loadAsString(DELETE_SHELL_REQUEST_XML); documentStr = createDeleteShellRequestBody(documentStr, httpClientInputs.getUrl(), shellId, String.valueOf(wsManRequestInputs.getMaxEnvelopeSize()), wsManRequestInputs.getWinrmLocale(), String.valueOf(wsManRequestInputs.getOperationTimeout())); Map<String, String> deleteShellResult = executeRequestWithBody(csHttpClient, httpClientInputs, documentStr); if (WSManUtils.isSpecificResponseAction(deleteShellResult.get(RETURN_RESULT), DELETE_RESPONSE_ACTION)) { return; } else if (WSManUtils.isFaultResponse(deleteShellResult.get(RETURN_RESULT))) { throw new RuntimeException(WSManUtils.getResponseFault(deleteShellResult.get(RETURN_RESULT))); } else { throw new RuntimeException(UNEXPECTED_SERVICE_RESPONSE + deleteShellResult.get(RETURN_RESULT)); } }
java
private void deleteShell(HttpClientService csHttpClient, HttpClientInputs httpClientInputs, String shellId, WSManRequestInputs wsManRequestInputs) throws RuntimeException, IOException, URISyntaxException, TransformerException, XPathExpressionException, SAXException, ParserConfigurationException { String documentStr = ResourceLoader.loadAsString(DELETE_SHELL_REQUEST_XML); documentStr = createDeleteShellRequestBody(documentStr, httpClientInputs.getUrl(), shellId, String.valueOf(wsManRequestInputs.getMaxEnvelopeSize()), wsManRequestInputs.getWinrmLocale(), String.valueOf(wsManRequestInputs.getOperationTimeout())); Map<String, String> deleteShellResult = executeRequestWithBody(csHttpClient, httpClientInputs, documentStr); if (WSManUtils.isSpecificResponseAction(deleteShellResult.get(RETURN_RESULT), DELETE_RESPONSE_ACTION)) { return; } else if (WSManUtils.isFaultResponse(deleteShellResult.get(RETURN_RESULT))) { throw new RuntimeException(WSManUtils.getResponseFault(deleteShellResult.get(RETURN_RESULT))); } else { throw new RuntimeException(UNEXPECTED_SERVICE_RESPONSE + deleteShellResult.get(RETURN_RESULT)); } }
[ "private", "void", "deleteShell", "(", "HttpClientService", "csHttpClient", ",", "HttpClientInputs", "httpClientInputs", ",", "String", "shellId", ",", "WSManRequestInputs", "wsManRequestInputs", ")", "throws", "RuntimeException", ",", "IOException", ",", "URISyntaxExceptio...
Deletes the remote shell. @param csHttpClient @param httpClientInputs @param shellId @param wsManRequestInputs @throws RuntimeException @throws IOException @throws URISyntaxException @throws TransformerException @throws XPathExpressionException @throws SAXException @throws ParserConfigurationException
[ "Deletes", "the", "remote", "shell", "." ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-powershell/src/main/java/io/cloudslang/content/services/WSManRemoteShellService.java#L319-L331
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/EvaluationUtils.java
EvaluationUtils.matthewsCorrelation
public static double matthewsCorrelation(long tp, long fp, long fn, long tn) { double numerator = ((double) tp) * tn - ((double) fp) * fn; double denominator = Math.sqrt(((double) tp + fp) * (tp + fn) * (tn + fp) * (tn + fn)); return numerator / denominator; }
java
public static double matthewsCorrelation(long tp, long fp, long fn, long tn) { double numerator = ((double) tp) * tn - ((double) fp) * fn; double denominator = Math.sqrt(((double) tp + fp) * (tp + fn) * (tn + fp) * (tn + fn)); return numerator / denominator; }
[ "public", "static", "double", "matthewsCorrelation", "(", "long", "tp", ",", "long", "fp", ",", "long", "fn", ",", "long", "tn", ")", "{", "double", "numerator", "=", "(", "(", "double", ")", "tp", ")", "*", "tn", "-", "(", "(", "double", ")", "fp"...
Calculate the binary Matthews correlation coefficient from counts @param tp True positive count @param fp False positive counts @param fn False negative counts @param tn True negative count @return Matthews correlation coefficient
[ "Calculate", "the", "binary", "Matthews", "correlation", "coefficient", "from", "counts" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/EvaluationUtils.java#L153-L157
datacleaner/AnalyzerBeans
core/src/main/java/org/eobjects/analyzer/lifecycle/LifeCycleHelper.java
LifeCycleHelper.assignProvidedProperties
public void assignProvidedProperties(ComponentDescriptor<?> descriptor, Object component) { AssignProvidedCallback callback = new AssignProvidedCallback(_injectionManager); callback.onEvent(component, descriptor); }
java
public void assignProvidedProperties(ComponentDescriptor<?> descriptor, Object component) { AssignProvidedCallback callback = new AssignProvidedCallback(_injectionManager); callback.onEvent(component, descriptor); }
[ "public", "void", "assignProvidedProperties", "(", "ComponentDescriptor", "<", "?", ">", "descriptor", ",", "Object", "component", ")", "{", "AssignProvidedCallback", "callback", "=", "new", "AssignProvidedCallback", "(", "_injectionManager", ")", ";", "callback", "."...
Assigns/injects {@link Provided} property values to a component. @param descriptor @param component
[ "Assigns", "/", "injects", "{", "@link", "Provided", "}", "property", "values", "to", "a", "component", "." ]
train
https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/core/src/main/java/org/eobjects/analyzer/lifecycle/LifeCycleHelper.java#L134-L137
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java
SourceLineAnnotation.forEntireMethod
public static SourceLineAnnotation forEntireMethod(JavaClass javaClass, @CheckForNull Method method) { String sourceFile = javaClass.getSourceFileName(); if (method == null) { return createUnknown(javaClass.getClassName(), sourceFile); } Code code = method.getCode(); LineNumberTable lineNumberTable = method.getLineNumberTable(); if (code == null || lineNumberTable == null) { return createUnknown(javaClass.getClassName(), sourceFile); } return forEntireMethod(javaClass.getClassName(), sourceFile, lineNumberTable, code.getLength()); }
java
public static SourceLineAnnotation forEntireMethod(JavaClass javaClass, @CheckForNull Method method) { String sourceFile = javaClass.getSourceFileName(); if (method == null) { return createUnknown(javaClass.getClassName(), sourceFile); } Code code = method.getCode(); LineNumberTable lineNumberTable = method.getLineNumberTable(); if (code == null || lineNumberTable == null) { return createUnknown(javaClass.getClassName(), sourceFile); } return forEntireMethod(javaClass.getClassName(), sourceFile, lineNumberTable, code.getLength()); }
[ "public", "static", "SourceLineAnnotation", "forEntireMethod", "(", "JavaClass", "javaClass", ",", "@", "CheckForNull", "Method", "method", ")", "{", "String", "sourceFile", "=", "javaClass", ".", "getSourceFileName", "(", ")", ";", "if", "(", "method", "==", "n...
Create a SourceLineAnnotation covering an entire method. @param javaClass JavaClass containing the method @param method the method @return a SourceLineAnnotation for the entire method
[ "Create", "a", "SourceLineAnnotation", "covering", "an", "entire", "method", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L281-L293
hawkular/hawkular-apm
api/src/main/java/org/hawkular/apm/api/services/ConfigurationLoader.java
ConfigurationLoader.getConfiguration
public static CollectorConfiguration getConfiguration(String type) { return loadConfig(PropertyUtil.getProperty(HAWKULAR_APM_CONFIG, DEFAULT_URI), type); }
java
public static CollectorConfiguration getConfiguration(String type) { return loadConfig(PropertyUtil.getProperty(HAWKULAR_APM_CONFIG, DEFAULT_URI), type); }
[ "public", "static", "CollectorConfiguration", "getConfiguration", "(", "String", "type", ")", "{", "return", "loadConfig", "(", "PropertyUtil", ".", "getProperty", "(", "HAWKULAR_APM_CONFIG", ",", "DEFAULT_URI", ")", ",", "type", ")", ";", "}" ]
This method returns the collector configuration. @param type The type, or null if default (jvm) @return The collection configuration
[ "This", "method", "returns", "the", "collector", "configuration", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/api/src/main/java/org/hawkular/apm/api/services/ConfigurationLoader.java#L66-L68
OpenLiberty/open-liberty
dev/com.ibm.ws.transaction.cdi/src/com/ibm/tx/jta/cdi/interceptors/Required.java
Required.required
@AroundInvoke public Object required(final InvocationContext context) throws Exception { return runUnderUOWManagingEnablement(UOWSynchronizationRegistry.UOW_TYPE_GLOBAL_TRANSACTION, true, context, "REQUIRED"); }
java
@AroundInvoke public Object required(final InvocationContext context) throws Exception { return runUnderUOWManagingEnablement(UOWSynchronizationRegistry.UOW_TYPE_GLOBAL_TRANSACTION, true, context, "REQUIRED"); }
[ "@", "AroundInvoke", "public", "Object", "required", "(", "final", "InvocationContext", "context", ")", "throws", "Exception", "{", "return", "runUnderUOWManagingEnablement", "(", "UOWSynchronizationRegistry", ".", "UOW_TYPE_GLOBAL_TRANSACTION", ",", "true", ",", "context...
<p>If called outside a transaction context, the interceptor must begin a new JTA transaction, the managed bean method execution must then continue inside this transaction context, and the transaction must be completed by the interceptor.</p> <p>If called inside a transaction context, the managed bean method execution must then continue inside this transaction context.</p>
[ "<p", ">", "If", "called", "outside", "a", "transaction", "context", "the", "interceptor", "must", "begin", "a", "new", "JTA", "transaction", "the", "managed", "bean", "method", "execution", "must", "then", "continue", "inside", "this", "transaction", "context",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transaction.cdi/src/com/ibm/tx/jta/cdi/interceptors/Required.java#L37-L42
mongodb/stitch-android-sdk
core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/DocumentVersionInfo.java
DocumentVersionInfo.getVersionedFilter
static BsonDocument getVersionedFilter( @Nonnull final BsonValue documentId, @Nullable final BsonValue version ) { final BsonDocument filter = new BsonDocument("_id", documentId); if (version == null) { filter.put(DOCUMENT_VERSION_FIELD, new BsonDocument("$exists", BsonBoolean.FALSE)); } else { filter.put(DOCUMENT_VERSION_FIELD, version); } return filter; }
java
static BsonDocument getVersionedFilter( @Nonnull final BsonValue documentId, @Nullable final BsonValue version ) { final BsonDocument filter = new BsonDocument("_id", documentId); if (version == null) { filter.put(DOCUMENT_VERSION_FIELD, new BsonDocument("$exists", BsonBoolean.FALSE)); } else { filter.put(DOCUMENT_VERSION_FIELD, version); } return filter; }
[ "static", "BsonDocument", "getVersionedFilter", "(", "@", "Nonnull", "final", "BsonValue", "documentId", ",", "@", "Nullable", "final", "BsonValue", "version", ")", "{", "final", "BsonDocument", "filter", "=", "new", "BsonDocument", "(", "\"_id\"", ",", "documentI...
Returns a query filter for the given document _id and version. The version is allowed to be null. The query will match only if there is either no version on the document in the database in question if we have no reference of the version or if the version matches the database's version. @param documentId the _id of the document. @param version the expected version of the document, if any. @return a query filter for the given document _id and version for a remote operation.
[ "Returns", "a", "query", "filter", "for", "the", "given", "document", "_id", "and", "version", ".", "The", "version", "is", "allowed", "to", "be", "null", ".", "The", "query", "will", "match", "only", "if", "there", "is", "either", "no", "version", "on",...
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/DocumentVersionInfo.java#L242-L253
samskivert/samskivert
src/main/java/com/samskivert/util/ArrayUtil.java
ArrayUtil.append
public static <T extends Object> T[] append (T[] values, T value) { return insert(values, value, values.length); }
java
public static <T extends Object> T[] append (T[] values, T value) { return insert(values, value, values.length); }
[ "public", "static", "<", "T", "extends", "Object", ">", "T", "[", "]", "append", "(", "T", "[", "]", "values", ",", "T", "value", ")", "{", "return", "insert", "(", "values", ",", "value", ",", "values", ".", "length", ")", ";", "}" ]
Creates a new array one larger than the supplied array and with the specified value inserted into the last slot. The type of the values array will be preserved.
[ "Creates", "a", "new", "array", "one", "larger", "than", "the", "supplied", "array", "and", "with", "the", "specified", "value", "inserted", "into", "the", "last", "slot", ".", "The", "type", "of", "the", "values", "array", "will", "be", "preserved", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ArrayUtil.java#L847-L850
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/ColumnList.java
ColumnList.getAlias
public String getAlias(SchemaTableTree stt, String column) { return getAlias(stt.getSchemaTable(), column, stt.getStepDepth()); }
java
public String getAlias(SchemaTableTree stt, String column) { return getAlias(stt.getSchemaTable(), column, stt.getStepDepth()); }
[ "public", "String", "getAlias", "(", "SchemaTableTree", "stt", ",", "String", "column", ")", "{", "return", "getAlias", "(", "stt", ".", "getSchemaTable", "(", ")", ",", "column", ",", "stt", ".", "getStepDepth", "(", ")", ")", ";", "}" ]
get an alias if the column is already in the list @param stt @param column @return
[ "get", "an", "alias", "if", "the", "column", "is", "already", "in", "the", "list" ]
train
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/ColumnList.java#L165-L167
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
MethodUtils.invokeMethod
public static Object invokeMethod(final Object object, final String methodName) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { return invokeMethod(object, methodName, ArrayUtils.EMPTY_OBJECT_ARRAY, null); }
java
public static Object invokeMethod(final Object object, final String methodName) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { return invokeMethod(object, methodName, ArrayUtils.EMPTY_OBJECT_ARRAY, null); }
[ "public", "static", "Object", "invokeMethod", "(", "final", "Object", "object", ",", "final", "String", "methodName", ")", "throws", "NoSuchMethodException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "return", "invokeMethod", "(", "object", ...
<p>Invokes a named method without parameters.</p> <p>This method delegates the method search to {@link #getMatchingAccessibleMethod(Class, String, Class[])}.</p> <p>This is a convenient wrapper for {@link #invokeMethod(Object object,String methodName, Object[] args, Class[] parameterTypes)}. </p> @param object invoke method on this object @param methodName get method with this name @return The value returned by the invoked method @throws NoSuchMethodException if there is no such accessible method @throws InvocationTargetException wraps an exception thrown by the method invoked @throws IllegalAccessException if the requested method is not accessible via reflection @since 3.4
[ "<p", ">", "Invokes", "a", "named", "method", "without", "parameters", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java#L96-L99
finmath/finmath-lib
src/main/java6/net/finmath/montecarlo/interestrate/modelplugins/AbstractLIBORCovarianceModel.java
AbstractLIBORCovarianceModel.getCovariance
public RandomVariableInterface getCovariance(double time, int component1, int component2, RandomVariableInterface[] realizationAtTimeIndex) { int timeIndex = timeDiscretization.getTimeIndex(time); if(timeIndex < 0) { timeIndex = Math.abs(timeIndex)-2; } return getCovariance(timeIndex, component1, component2, realizationAtTimeIndex); }
java
public RandomVariableInterface getCovariance(double time, int component1, int component2, RandomVariableInterface[] realizationAtTimeIndex) { int timeIndex = timeDiscretization.getTimeIndex(time); if(timeIndex < 0) { timeIndex = Math.abs(timeIndex)-2; } return getCovariance(timeIndex, component1, component2, realizationAtTimeIndex); }
[ "public", "RandomVariableInterface", "getCovariance", "(", "double", "time", ",", "int", "component1", ",", "int", "component2", ",", "RandomVariableInterface", "[", "]", "realizationAtTimeIndex", ")", "{", "int", "timeIndex", "=", "timeDiscretization", ".", "getTimeI...
Returns the instantaneous covariance calculated from factor loadings. @param time The time <i>t</i> at which covariance is requested. @param component1 Index of component <i>i</i>. @param component2 Index of component <i>j</i>. @param realizationAtTimeIndex The realization of the stochastic process. @return The instantaneous covariance between component <i>i</i> and <i>j</i>.
[ "Returns", "the", "instantaneous", "covariance", "calculated", "from", "factor", "loadings", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/interestrate/modelplugins/AbstractLIBORCovarianceModel.java#L127-L134
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/codec/HexUtils.java
HexUtils.bytesToHex
public static final String bytesToHex(byte[] bs, int off, int length) { if (bs.length <= off || bs.length < off + length) throw new IllegalArgumentException(); StringBuilder sb = new StringBuilder(length * 2); bytesToHexAppend(bs, off, length, sb); return sb.toString(); }
java
public static final String bytesToHex(byte[] bs, int off, int length) { if (bs.length <= off || bs.length < off + length) throw new IllegalArgumentException(); StringBuilder sb = new StringBuilder(length * 2); bytesToHexAppend(bs, off, length, sb); return sb.toString(); }
[ "public", "static", "final", "String", "bytesToHex", "(", "byte", "[", "]", "bs", ",", "int", "off", ",", "int", "length", ")", "{", "if", "(", "bs", ".", "length", "<=", "off", "||", "bs", ".", "length", "<", "off", "+", "length", ")", "throw", ...
Converts a byte array into a string of lower case hex chars. @param bs A byte array @param off The index of the first byte to read @param length The number of bytes to read. @return the string of hex chars.
[ "Converts", "a", "byte", "array", "into", "a", "string", "of", "lower", "case", "hex", "chars", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/codec/HexUtils.java#L19-L25
grpc/grpc-java
netty/src/main/java/io/grpc/netty/NettyChannelBuilder.java
NettyChannelBuilder.withOption
public <T> NettyChannelBuilder withOption(ChannelOption<T> option, T value) { channelOptions.put(option, value); return this; }
java
public <T> NettyChannelBuilder withOption(ChannelOption<T> option, T value) { channelOptions.put(option, value); return this; }
[ "public", "<", "T", ">", "NettyChannelBuilder", "withOption", "(", "ChannelOption", "<", "T", ">", "option", ",", "T", "value", ")", "{", "channelOptions", ".", "put", "(", "option", ",", "value", ")", ";", "return", "this", ";", "}" ]
Specifies a channel option. As the underlying channel as well as network implementation may ignore this value applications should consider it a hint.
[ "Specifies", "a", "channel", "option", ".", "As", "the", "underlying", "channel", "as", "well", "as", "network", "implementation", "may", "ignore", "this", "value", "applications", "should", "consider", "it", "a", "hint", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyChannelBuilder.java#L191-L194
mbenson/therian
core/src/main/java/therian/util/Positions.java
Positions.readOnly
public static <T> Position.Readable<T> readOnly(final T value) { return readOnly(Validate.notNull(value, "value").getClass(), value); }
java
public static <T> Position.Readable<T> readOnly(final T value) { return readOnly(Validate.notNull(value, "value").getClass(), value); }
[ "public", "static", "<", "T", ">", "Position", ".", "Readable", "<", "T", ">", "readOnly", "(", "final", "T", "value", ")", "{", "return", "readOnly", "(", "Validate", ".", "notNull", "(", "value", ",", "\"value\"", ")", ".", "getClass", "(", ")", ",...
Get a read-only position of value {@code value} (type of {@code value#getClass()}. @param value not {@code null} @return Position.Readable
[ "Get", "a", "read", "-", "only", "position", "of", "value", "{", "@code", "value", "}", "(", "type", "of", "{", "@code", "value#getClass", "()", "}", "." ]
train
https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/util/Positions.java#L167-L169
alkacon/opencms-core
src/org/opencms/ade/contenteditor/CmsContentService.java
CmsContentService.getContentDocument
private CmsXmlContent getContentDocument(CmsFile file, boolean fromCache) throws CmsXmlException { CmsXmlContent content = null; if (fromCache) { content = getSessionCache().getCacheXmlContent(file.getStructureId()); } if (content == null) { content = CmsXmlContentFactory.unmarshal(getCmsObject(), file); getSessionCache().setCacheXmlContent(file.getStructureId(), content); } return content; }
java
private CmsXmlContent getContentDocument(CmsFile file, boolean fromCache) throws CmsXmlException { CmsXmlContent content = null; if (fromCache) { content = getSessionCache().getCacheXmlContent(file.getStructureId()); } if (content == null) { content = CmsXmlContentFactory.unmarshal(getCmsObject(), file); getSessionCache().setCacheXmlContent(file.getStructureId(), content); } return content; }
[ "private", "CmsXmlContent", "getContentDocument", "(", "CmsFile", "file", ",", "boolean", "fromCache", ")", "throws", "CmsXmlException", "{", "CmsXmlContent", "content", "=", "null", ";", "if", "(", "fromCache", ")", "{", "content", "=", "getSessionCache", "(", ...
Returns the XML content document.<p> @param file the resource file @param fromCache <code>true</code> to use the cached document @return the content document @throws CmsXmlException if reading the XML fails
[ "Returns", "the", "XML", "content", "document", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/contenteditor/CmsContentService.java#L1762-L1773
docker-java/docker-java
src/main/java/com/github/dockerjava/core/util/FiltersBuilder.java
FiltersBuilder.withLabels
public FiltersBuilder withLabels(Map<String, String> labels) { withFilter("label", labelsMapToList(labels).toArray(new String[labels.size()])); return this; }
java
public FiltersBuilder withLabels(Map<String, String> labels) { withFilter("label", labelsMapToList(labels).toArray(new String[labels.size()])); return this; }
[ "public", "FiltersBuilder", "withLabels", "(", "Map", "<", "String", ",", "String", ">", "labels", ")", "{", "withFilter", "(", "\"label\"", ",", "labelsMapToList", "(", "labels", ")", ".", "toArray", "(", "new", "String", "[", "labels", ".", "size", "(", ...
Filter by labels @param labels {@link Map} of labels that contains label keys and values
[ "Filter", "by", "labels" ]
train
https://github.com/docker-java/docker-java/blob/c5c89327108abdc50aa41d7711d4743b8bac75fe/src/main/java/com/github/dockerjava/core/util/FiltersBuilder.java#L84-L87
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java
DocBookBuilder.addToZip
protected void addToZip(final String path, final String file, BuildData buildData) throws BuildProcessingException { try { buildData.getOutputFiles().put(path, file.getBytes(ENCODING)); } catch (UnsupportedEncodingException e) { /* UTF-8 is a valid format so this should exception should never get thrown */ throw new BuildProcessingException(e); } }
java
protected void addToZip(final String path, final String file, BuildData buildData) throws BuildProcessingException { try { buildData.getOutputFiles().put(path, file.getBytes(ENCODING)); } catch (UnsupportedEncodingException e) { /* UTF-8 is a valid format so this should exception should never get thrown */ throw new BuildProcessingException(e); } }
[ "protected", "void", "addToZip", "(", "final", "String", "path", ",", "final", "String", "file", ",", "BuildData", "buildData", ")", "throws", "BuildProcessingException", "{", "try", "{", "buildData", ".", "getOutputFiles", "(", ")", ".", "put", "(", "path", ...
Adds a file to the files ZIP. @param path The path to add the file to. @param file The file to add to the ZIP. @param buildData Information and data structures for the build.
[ "Adds", "a", "file", "to", "the", "files", "ZIP", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java#L3897-L3904
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/NotesApi.java
NotesApi.getIssueNote
public Note getIssueNote(Object projectIdOrPath, Integer issueIid, Integer noteId) throws GitLabApiException { Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes", noteId); return (response.readEntity(Note.class)); }
java
public Note getIssueNote(Object projectIdOrPath, Integer issueIid, Integer noteId) throws GitLabApiException { Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes", noteId); return (response.readEntity(Note.class)); }
[ "public", "Note", "getIssueNote", "(", "Object", "projectIdOrPath", ",", "Integer", "issueIid", ",", "Integer", "noteId", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "getDefaultPer...
Get the specified issues's note. @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param issueIid the issue IID to get the notes for @param noteId the ID of the Note to get @return a Note instance for the specified IDs @throws GitLabApiException if any exception occurs
[ "Get", "the", "specified", "issues", "s", "note", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/NotesApi.java#L140-L144
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/WikisApi.java
WikisApi.deletePage
public void deletePage(Object projectIdOrPath, String slug) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "wikis", slug); }
java
public void deletePage(Object projectIdOrPath, String slug) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "wikis", slug); }
[ "public", "void", "deletePage", "(", "Object", "projectIdOrPath", ",", "String", "slug", ")", "throws", "GitLabApiException", "{", "delete", "(", "Response", ".", "Status", ".", "NO_CONTENT", ",", "null", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "pro...
Deletes an existing project wiki page. This is an idempotent function and deleting a non-existent page does not cause an error. <pre><code>GitLab Endpoint: DELETE /projects/:id/wikis/:slug</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param slug the slug of the project's wiki page @throws GitLabApiException if any exception occurs
[ "Deletes", "an", "existing", "project", "wiki", "page", ".", "This", "is", "an", "idempotent", "function", "and", "deleting", "a", "non", "-", "existent", "page", "does", "not", "cause", "an", "error", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/WikisApi.java#L167-L169
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/FutureManagementChannel.java
FutureManagementChannel.setChannel
protected boolean setChannel(final Channel newChannel) { if(newChannel == null) { return false; } synchronized (lock) { if(state != State.OPEN || channel != null) { return false; } this.channel = newChannel; this.channel.addCloseHandler(new CloseHandler<Channel>() { @Override public void handleClose(final Channel closed, final IOException exception) { synchronized (lock) { if(FutureManagementChannel.this.channel == closed) { FutureManagementChannel.this.channel = null; } lock.notifyAll(); } } }); lock.notifyAll(); return true; } }
java
protected boolean setChannel(final Channel newChannel) { if(newChannel == null) { return false; } synchronized (lock) { if(state != State.OPEN || channel != null) { return false; } this.channel = newChannel; this.channel.addCloseHandler(new CloseHandler<Channel>() { @Override public void handleClose(final Channel closed, final IOException exception) { synchronized (lock) { if(FutureManagementChannel.this.channel == closed) { FutureManagementChannel.this.channel = null; } lock.notifyAll(); } } }); lock.notifyAll(); return true; } }
[ "protected", "boolean", "setChannel", "(", "final", "Channel", "newChannel", ")", "{", "if", "(", "newChannel", "==", "null", ")", "{", "return", "false", ";", "}", "synchronized", "(", "lock", ")", "{", "if", "(", "state", "!=", "State", ".", "OPEN", ...
Set the channel. This will return whether the channel could be set successfully or not. @param newChannel the channel @return whether the operation succeeded or not
[ "Set", "the", "channel", ".", "This", "will", "return", "whether", "the", "channel", "could", "be", "set", "successfully", "or", "not", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/FutureManagementChannel.java#L186-L209
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java
RenameFileExtensions.moveFile
public static boolean moveFile(final File srcFile, final File destDir) throws IOException, FileIsADirectoryException { return RenameFileExtensions.renameFile(srcFile, destDir, true); }
java
public static boolean moveFile(final File srcFile, final File destDir) throws IOException, FileIsADirectoryException { return RenameFileExtensions.renameFile(srcFile, destDir, true); }
[ "public", "static", "boolean", "moveFile", "(", "final", "File", "srcFile", ",", "final", "File", "destDir", ")", "throws", "IOException", ",", "FileIsADirectoryException", "{", "return", "RenameFileExtensions", ".", "renameFile", "(", "srcFile", ",", "destDir", "...
Moves the given source file to the destination Directory. @param srcFile The source file. @param destDir The destination directory. @return true if the file was moved otherwise false. @throws IOException Signals that an I/O exception has occurred. @throws FileIsADirectoryException the file is A directory exception
[ "Moves", "the", "given", "source", "file", "to", "the", "destination", "Directory", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java#L266-L270
Bedework/bw-util
bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java
XmlUtil.getAttrVal
public static String getAttrVal(final Element el, final String name) throws SAXException { Attr at = el.getAttributeNode(name); if (at == null) { return null; } return at.getValue(); }
java
public static String getAttrVal(final Element el, final String name) throws SAXException { Attr at = el.getAttributeNode(name); if (at == null) { return null; } return at.getValue(); }
[ "public", "static", "String", "getAttrVal", "(", "final", "Element", "el", ",", "final", "String", "name", ")", "throws", "SAXException", "{", "Attr", "at", "=", "el", ".", "getAttributeNode", "(", "name", ")", ";", "if", "(", "at", "==", "null", ")", ...
Return the value of the named attribute of the given element. @param el Element @param name String name of desired attribute @return String attribute value or null @throws SAXException
[ "Return", "the", "value", "of", "the", "named", "attribute", "of", "the", "given", "element", "." ]
train
https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L218-L226
apache/incubator-atlas
repository/src/main/java/org/apache/atlas/gremlin/GremlinExpressionFactory.java
GremlinExpressionFactory.generateAdjacentVerticesExpression
public GroovyExpression generateAdjacentVerticesExpression(GroovyExpression parent, AtlasEdgeDirection dir) { return new FunctionCallExpression(TraversalStepType.FLAT_MAP_TO_ELEMENTS, parent, getGremlinFunctionName(dir)); }
java
public GroovyExpression generateAdjacentVerticesExpression(GroovyExpression parent, AtlasEdgeDirection dir) { return new FunctionCallExpression(TraversalStepType.FLAT_MAP_TO_ELEMENTS, parent, getGremlinFunctionName(dir)); }
[ "public", "GroovyExpression", "generateAdjacentVerticesExpression", "(", "GroovyExpression", "parent", ",", "AtlasEdgeDirection", "dir", ")", "{", "return", "new", "FunctionCallExpression", "(", "TraversalStepType", ".", "FLAT_MAP_TO_ELEMENTS", ",", "parent", ",", "getGreml...
Generates an expression that gets the vertices adjacent to the vertex in 'parent' in the specified direction. @param parent @param dir @return
[ "Generates", "an", "expression", "that", "gets", "the", "vertices", "adjacent", "to", "the", "vertex", "in", "parent", "in", "the", "specified", "direction", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/gremlin/GremlinExpressionFactory.java#L464-L466
code4everything/util
src/main/java/com/zhazhapan/util/office/MsWordUtils.java
MsWordUtils.appendImage
public static void appendImage(XWPFRun run, String imagePath, int pictureType, int width, int height) throws IOException, InvalidFormatException { InputStream input = new FileInputStream(imagePath); run.addPicture(input, pictureType, imagePath, Units.toEMU(width), Units.toEMU(height)); }
java
public static void appendImage(XWPFRun run, String imagePath, int pictureType, int width, int height) throws IOException, InvalidFormatException { InputStream input = new FileInputStream(imagePath); run.addPicture(input, pictureType, imagePath, Units.toEMU(width), Units.toEMU(height)); }
[ "public", "static", "void", "appendImage", "(", "XWPFRun", "run", ",", "String", "imagePath", ",", "int", "pictureType", ",", "int", "width", ",", "int", "height", ")", "throws", "IOException", ",", "InvalidFormatException", "{", "InputStream", "input", "=", "...
添加一张图片 @param run {@link XWPFRun} @param imagePath 图片路径 @param pictureType 图片类型 @param width 宽度 @param height 长度 @throws IOException 异常 @throws InvalidFormatException 异常
[ "添加一张图片" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/office/MsWordUtils.java#L73-L77
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/util/ScriptUtil.java
ScriptUtil.getScriptFromSourceExpression
public static ExecutableScript getScriptFromSourceExpression(String language, Expression sourceExpression, ScriptFactory scriptFactory) { ensureNotEmpty(NotValidException.class, "Script language", language); ensureNotNull(NotValidException.class, "Script source expression", sourceExpression); return scriptFactory.createScriptFromSource(language, sourceExpression); }
java
public static ExecutableScript getScriptFromSourceExpression(String language, Expression sourceExpression, ScriptFactory scriptFactory) { ensureNotEmpty(NotValidException.class, "Script language", language); ensureNotNull(NotValidException.class, "Script source expression", sourceExpression); return scriptFactory.createScriptFromSource(language, sourceExpression); }
[ "public", "static", "ExecutableScript", "getScriptFromSourceExpression", "(", "String", "language", ",", "Expression", "sourceExpression", ",", "ScriptFactory", "scriptFactory", ")", "{", "ensureNotEmpty", "(", "NotValidException", ".", "class", ",", "\"Script language\"", ...
Creates a new {@link ExecutableScript} from a dynamic source. Dynamic means that the source is an expression which will be evaluated during execution. @param language the language of the script @param sourceExpression the expression which evaluates to the source code @param scriptFactory the script factory used to create the script @return the newly created script @throws NotValidException if language is null or empty or sourceExpression is null
[ "Creates", "a", "new", "{", "@link", "ExecutableScript", "}", "from", "a", "dynamic", "source", ".", "Dynamic", "means", "that", "the", "source", "is", "an", "expression", "which", "will", "be", "evaluated", "during", "execution", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/ScriptUtil.java#L125-L129
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/ECKey.java
ECKey.findRecoveryId
public byte findRecoveryId(Sha256Hash hash, ECDSASignature sig) { byte recId = -1; for (byte i = 0; i < 4; i++) { ECKey k = ECKey.recoverFromSignature(i, sig, hash, isCompressed()); if (k != null && k.pub.equals(pub)) { recId = i; break; } } if (recId == -1) throw new RuntimeException("Could not construct a recoverable key. This should never happen."); return recId; }
java
public byte findRecoveryId(Sha256Hash hash, ECDSASignature sig) { byte recId = -1; for (byte i = 0; i < 4; i++) { ECKey k = ECKey.recoverFromSignature(i, sig, hash, isCompressed()); if (k != null && k.pub.equals(pub)) { recId = i; break; } } if (recId == -1) throw new RuntimeException("Could not construct a recoverable key. This should never happen."); return recId; }
[ "public", "byte", "findRecoveryId", "(", "Sha256Hash", "hash", ",", "ECDSASignature", "sig", ")", "{", "byte", "recId", "=", "-", "1", ";", "for", "(", "byte", "i", "=", "0", ";", "i", "<", "4", ";", "i", "++", ")", "{", "ECKey", "k", "=", "ECKey...
Returns the recovery ID, a byte with value between 0 and 3, inclusive, that specifies which of 4 possible curve points was used to sign a message. This value is also referred to as "v". @throws RuntimeException if no recovery ID can be found.
[ "Returns", "the", "recovery", "ID", "a", "byte", "with", "value", "between", "0", "and", "3", "inclusive", "that", "specifies", "which", "of", "4", "possible", "curve", "points", "was", "used", "to", "sign", "a", "message", ".", "This", "value", "is", "a...
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/ECKey.java#L947-L959
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebApp.java
WebApp.acceptAnnotationsFrom
protected boolean acceptAnnotationsFrom(String className, boolean acceptPartial, boolean acceptExcluded) { String methodName = "acceptAnnotationsFrom"; // Don't unnecessarily obtain the annotation targets table: // No seed annotations will be obtained when the module is metadata-complete. if (config.isMetadataComplete()) { if (!acceptPartial && !acceptExcluded) { return false; } } try { WebAnnotations webAppAnnotations = getModuleContainer().adapt(WebAnnotations.class); AnnotationTargets_Targets table = webAppAnnotations.getAnnotationTargets(); return ( table.isSeedClassName(className) || (acceptPartial && table.isPartialClassName(className)) || (acceptExcluded && table.isExcludedClassName(className)) ); } catch (UnableToAdaptException e) { logger.logp(Level.FINE, CLASS_NAME, methodName, "caught UnableToAdaptException: " + e); return false; } }
java
protected boolean acceptAnnotationsFrom(String className, boolean acceptPartial, boolean acceptExcluded) { String methodName = "acceptAnnotationsFrom"; // Don't unnecessarily obtain the annotation targets table: // No seed annotations will be obtained when the module is metadata-complete. if (config.isMetadataComplete()) { if (!acceptPartial && !acceptExcluded) { return false; } } try { WebAnnotations webAppAnnotations = getModuleContainer().adapt(WebAnnotations.class); AnnotationTargets_Targets table = webAppAnnotations.getAnnotationTargets(); return ( table.isSeedClassName(className) || (acceptPartial && table.isPartialClassName(className)) || (acceptExcluded && table.isExcludedClassName(className)) ); } catch (UnableToAdaptException e) { logger.logp(Level.FINE, CLASS_NAME, methodName, "caught UnableToAdaptException: " + e); return false; } }
[ "protected", "boolean", "acceptAnnotationsFrom", "(", "String", "className", ",", "boolean", "acceptPartial", ",", "boolean", "acceptExcluded", ")", "{", "String", "methodName", "=", "\"acceptAnnotationsFrom\"", ";", "// Don't unnecessarily obtain the annotation targets table:"...
Tell if annotations on a target class are to be processed. This is controlled by the metadata-complete and absolute ordering settings of the web module. Metadata complete may be set for the web-module as a whole, or may be set individually on fragments. Annotations are ignored when the target class is in a metadata complete region. When an absolute ordering element is present in the web module descriptor, jars not listed are excluded from annotation processing. Control parameters are provided to allow testing for the several usage cases. See {@link com.ibm.wsspi.anno.classsource.ClassSource_Aggregate} for detailed documentation. Caution: Extra testing is necessary for annotations on inherited methods. An inherited methods have two associated classes: The class which defined the method and the class which is using the method definition. Caution: Extra testing is necessary for inheritable annotations. Normally, class annotations apply only to the class which provides the annotation definition. As a special case, a class annotation may be declared as being inherited, in which case the annotation applies to all subclasses of the class which has the annotation definition. @param className The name of the class which is to be tested. @param acceptPartial Control parameter: Tell if partial classes are accepted. @param acceptExcluded Control parameter: Tell if excluded classes are accepted. @return True if annotations are accepted from the class. Otherwise, false.
[ "Tell", "if", "annotations", "on", "a", "target", "class", "are", "to", "be", "processed", ".", "This", "is", "controlled", "by", "the", "metadata", "-", "complete", "and", "absolute", "ordering", "settings", "of", "the", "web", "module", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebApp.java#L754-L778
samskivert/samskivert
src/main/java/com/samskivert/util/Config.java
Config.getValue
public long getValue (String name, long defval) { String val = _props.getProperty(name); if (val != null) { try { defval = Long.parseLong(val); } catch (NumberFormatException nfe) { log.warning("Malformed long integer property", "name", name, "value", val); } } return defval; }
java
public long getValue (String name, long defval) { String val = _props.getProperty(name); if (val != null) { try { defval = Long.parseLong(val); } catch (NumberFormatException nfe) { log.warning("Malformed long integer property", "name", name, "value", val); } } return defval; }
[ "public", "long", "getValue", "(", "String", "name", ",", "long", "defval", ")", "{", "String", "val", "=", "_props", ".", "getProperty", "(", "name", ")", ";", "if", "(", "val", "!=", "null", ")", "{", "try", "{", "defval", "=", "Long", ".", "pars...
Fetches and returns the value for the specified configuration property. If the value is not specified in the associated properties file, the supplied default value is returned instead. If the property specified in the file is poorly formatted (not and integer, not in proper array specification), a warning message will be logged and the default value will be returned. @param name name of the property. @param defval the value to return if the property is not specified in the config file. @return the value of the requested property.
[ "Fetches", "and", "returns", "the", "value", "for", "the", "specified", "configuration", "property", ".", "If", "the", "value", "is", "not", "specified", "in", "the", "associated", "properties", "file", "the", "supplied", "default", "value", "is", "returned", ...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/Config.java#L135-L146
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/ShortField.java
ShortField.setValue
public int setValue(double value, boolean bDisplayOption, int moveMode) { // Set this field's value Short tempshort = new Short((short)value); int errorCode = this.setData(tempshort, bDisplayOption, moveMode); return errorCode; }
java
public int setValue(double value, boolean bDisplayOption, int moveMode) { // Set this field's value Short tempshort = new Short((short)value); int errorCode = this.setData(tempshort, bDisplayOption, moveMode); return errorCode; }
[ "public", "int", "setValue", "(", "double", "value", ",", "boolean", "bDisplayOption", ",", "int", "moveMode", ")", "{", "// Set this field's value", "Short", "tempshort", "=", "new", "Short", "(", "(", "short", ")", "value", ")", ";", "int", "errorCode", "=...
/* Set the Value of this field as a double. @param value The value of this field. @param iDisplayOption If true, display the new field. @param iMoveMove The move mode. @return An error code (NORMAL_RETURN for success).
[ "/", "*", "Set", "the", "Value", "of", "this", "field", "as", "a", "double", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ShortField.java#L191-L196
cdk/cdk
base/silent/src/main/java/org/openscience/cdk/silent/SilentChemObjectBuilder.java
SilentChemObjectBuilder.getSystemProp
private static boolean getSystemProp(final String key, final boolean defaultValue) { String val = System.getProperty(key); if (val == null) val = System.getenv(key); if (val == null) { return defaultValue; } else if (val.isEmpty()) { return true; } else { switch (val.toLowerCase(Locale.ROOT)) { case "t": case "true": case "1": return true; case "f": case "false": case "0": return false; default: throw new IllegalArgumentException("Invalid value, expected true/false: " + val); } } }
java
private static boolean getSystemProp(final String key, final boolean defaultValue) { String val = System.getProperty(key); if (val == null) val = System.getenv(key); if (val == null) { return defaultValue; } else if (val.isEmpty()) { return true; } else { switch (val.toLowerCase(Locale.ROOT)) { case "t": case "true": case "1": return true; case "f": case "false": case "0": return false; default: throw new IllegalArgumentException("Invalid value, expected true/false: " + val); } } }
[ "private", "static", "boolean", "getSystemProp", "(", "final", "String", "key", ",", "final", "boolean", "defaultValue", ")", "{", "String", "val", "=", "System", ".", "getProperty", "(", "key", ")", ";", "if", "(", "val", "==", "null", ")", "val", "=", ...
an error rather than return false. The default can also be specified.
[ "an", "error", "rather", "than", "return", "false", ".", "The", "default", "can", "also", "be", "specified", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/silent/src/main/java/org/openscience/cdk/silent/SilentChemObjectBuilder.java#L91-L113
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/PathUtils.java
PathUtils.getChildUnder
public static String getChildUnder(String path, String parentPath) { int start = parentPath.length(); String local = path.substring(start, path.length()); String name = getFirstPathComponent(local); return name; }
java
public static String getChildUnder(String path, String parentPath) { int start = parentPath.length(); String local = path.substring(start, path.length()); String name = getFirstPathComponent(local); return name; }
[ "public", "static", "String", "getChildUnder", "(", "String", "path", ",", "String", "parentPath", ")", "{", "int", "start", "=", "parentPath", ".", "length", "(", ")", ";", "String", "local", "=", "path", ".", "substring", "(", "start", ",", "path", "."...
Answer the first path element of a path which follows a leading sub-path. For example, for path "/grandParent/parent/child/grandChild" and leading sub-path "/grandParent/parent", answer "child". The result is unpredictable if the leading path does not start the target path, and does not reach a separator character in the target path. An exception will be thrown if the leading path is longer than the target path. @param path The path from which to obtain a path element. @param leadingPath A leading sub-path of the target path. @return The first path element of the target path following the leading sub-path.
[ "Answer", "the", "first", "path", "element", "of", "a", "path", "which", "follows", "a", "leading", "sub", "-", "path", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/PathUtils.java#L861-L866
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java
LoggingSystem.get
public static LoggingSystem get(ClassLoader classLoader) { String loggingSystem = System.getProperty(SYSTEM_PROPERTY); if (StringUtils.hasLength(loggingSystem)) { if (NONE.equals(loggingSystem)) { return new NoOpLoggingSystem(); } return get(classLoader, loggingSystem); } return SYSTEMS.entrySet().stream() .filter((entry) -> ClassUtils.isPresent(entry.getKey(), classLoader)) .map((entry) -> get(classLoader, entry.getValue())).findFirst() .orElseThrow(() -> new IllegalStateException( "No suitable logging system located")); }
java
public static LoggingSystem get(ClassLoader classLoader) { String loggingSystem = System.getProperty(SYSTEM_PROPERTY); if (StringUtils.hasLength(loggingSystem)) { if (NONE.equals(loggingSystem)) { return new NoOpLoggingSystem(); } return get(classLoader, loggingSystem); } return SYSTEMS.entrySet().stream() .filter((entry) -> ClassUtils.isPresent(entry.getKey(), classLoader)) .map((entry) -> get(classLoader, entry.getValue())).findFirst() .orElseThrow(() -> new IllegalStateException( "No suitable logging system located")); }
[ "public", "static", "LoggingSystem", "get", "(", "ClassLoader", "classLoader", ")", "{", "String", "loggingSystem", "=", "System", ".", "getProperty", "(", "SYSTEM_PROPERTY", ")", ";", "if", "(", "StringUtils", ".", "hasLength", "(", "loggingSystem", ")", ")", ...
Detect and return the logging system in use. Supports Logback and Java Logging. @param classLoader the classloader @return the logging system
[ "Detect", "and", "return", "the", "logging", "system", "in", "use", ".", "Supports", "Logback", "and", "Java", "Logging", "." ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java#L151-L164
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/RevisionHistoryHelper.java
RevisionHistoryHelper.revisionHistoryToJson
public static Map<String, Object> revisionHistoryToJson(List<InternalDocumentRevision> history, Map<String, ? extends Attachment> attachments, boolean shouldInline, int minRevPos) { Misc.checkNotNull(history, "History"); Misc.checkArgument(history.size() > 0, "History must have at least one DocumentRevision."); Misc.checkArgument(checkHistoryIsInDescendingOrder(history), "History must be in descending order."); InternalDocumentRevision currentNode = history.get(0); Map<String, Object> m = currentNode.asMap(); if (attachments != null && !attachments.isEmpty()) { // graft attachments on to m for this particular revision here addAttachments(attachments, m, shouldInline, minRevPos); } m.put(CouchConstants._revisions, createRevisions(history)); return m; }
java
public static Map<String, Object> revisionHistoryToJson(List<InternalDocumentRevision> history, Map<String, ? extends Attachment> attachments, boolean shouldInline, int minRevPos) { Misc.checkNotNull(history, "History"); Misc.checkArgument(history.size() > 0, "History must have at least one DocumentRevision."); Misc.checkArgument(checkHistoryIsInDescendingOrder(history), "History must be in descending order."); InternalDocumentRevision currentNode = history.get(0); Map<String, Object> m = currentNode.asMap(); if (attachments != null && !attachments.isEmpty()) { // graft attachments on to m for this particular revision here addAttachments(attachments, m, shouldInline, minRevPos); } m.put(CouchConstants._revisions, createRevisions(history)); return m; }
[ "public", "static", "Map", "<", "String", ",", "Object", ">", "revisionHistoryToJson", "(", "List", "<", "InternalDocumentRevision", ">", "history", ",", "Map", "<", "String", ",", "?", "extends", "Attachment", ">", "attachments", ",", "boolean", "shouldInline",...
<p>Serialise a branch's revision history, in the form of a list of {@link InternalDocumentRevision}s, into the JSON format expected by CouchDB's _bulk_docs endpoint.</p> @param history list of {@code DocumentRevision}s. This should be a complete list from the revision furthest down the branch to the root. @param attachments list of {@code Attachment}s, if any. This allows the {@code _attachments} dictionary to be correctly serialised. If there are no attachments, set to null. @param shouldInline whether to upload attachments inline or separately via multipart/related. @param minRevPos generation number of most recent ancestor on the remote database. If the {@code revpos} value of a given attachment is greater than {@code minRevPos}, then it is newer than the version on the remote database and must be sent. Otherwise, a stub can be sent. @return JSON-serialised {@code String} suitable for sending to CouchDB's _bulk_docs endpoint. @see DocumentRevs
[ "<p", ">", "Serialise", "a", "branch", "s", "revision", "history", "in", "the", "form", "of", "a", "list", "of", "{", "@link", "InternalDocumentRevision", "}", "s", "into", "the", "JSON", "format", "expected", "by", "CouchDB", "s", "_bulk_docs", "endpoint", ...
train
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/RevisionHistoryHelper.java#L145-L165
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLInverseFunctionalObjectPropertyAxiomImpl_CustomFieldSerializer.java
OWLInverseFunctionalObjectPropertyAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLInverseFunctionalObjectPropertyAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLInverseFunctionalObjectPropertyAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLInverseFunctionalObjectPropertyAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ...
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLInverseFunctionalObjectPropertyAxiomImpl_CustomFieldSerializer.java#L95-L98
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java
AbstractExecutableMemberWriter.getErasureAnchor
protected String getErasureAnchor(ExecutableElement executableElement) { final StringBuilder buf = new StringBuilder(name(executableElement) + "("); List<? extends VariableElement> parameters = executableElement.getParameters(); boolean foundTypeVariable = false; for (int i = 0; i < parameters.size(); i++) { if (i > 0) { buf.append(","); } TypeMirror t = parameters.get(i).asType(); SimpleTypeVisitor9<Boolean, Void> stv = new SimpleTypeVisitor9<Boolean, Void>() { boolean foundTypeVariable = false; @Override public Boolean visitArray(ArrayType t, Void p) { visit(t.getComponentType()); buf.append(utils.getDimension(t)); return foundTypeVariable; } @Override public Boolean visitTypeVariable(TypeVariable t, Void p) { buf.append(utils.asTypeElement(t).getQualifiedName()); foundTypeVariable = true; return foundTypeVariable; } @Override public Boolean visitDeclared(DeclaredType t, Void p) { buf.append(utils.getQualifiedTypeName(t)); return foundTypeVariable; } @Override protected Boolean defaultAction(TypeMirror e, Void p) { buf.append(e); return foundTypeVariable; } }; boolean isTypeVariable = stv.visit(t); if (!foundTypeVariable) { foundTypeVariable = isTypeVariable; } } buf.append(")"); return foundTypeVariable ? writer.getName(buf.toString()) : null; }
java
protected String getErasureAnchor(ExecutableElement executableElement) { final StringBuilder buf = new StringBuilder(name(executableElement) + "("); List<? extends VariableElement> parameters = executableElement.getParameters(); boolean foundTypeVariable = false; for (int i = 0; i < parameters.size(); i++) { if (i > 0) { buf.append(","); } TypeMirror t = parameters.get(i).asType(); SimpleTypeVisitor9<Boolean, Void> stv = new SimpleTypeVisitor9<Boolean, Void>() { boolean foundTypeVariable = false; @Override public Boolean visitArray(ArrayType t, Void p) { visit(t.getComponentType()); buf.append(utils.getDimension(t)); return foundTypeVariable; } @Override public Boolean visitTypeVariable(TypeVariable t, Void p) { buf.append(utils.asTypeElement(t).getQualifiedName()); foundTypeVariable = true; return foundTypeVariable; } @Override public Boolean visitDeclared(DeclaredType t, Void p) { buf.append(utils.getQualifiedTypeName(t)); return foundTypeVariable; } @Override protected Boolean defaultAction(TypeMirror e, Void p) { buf.append(e); return foundTypeVariable; } }; boolean isTypeVariable = stv.visit(t); if (!foundTypeVariable) { foundTypeVariable = isTypeVariable; } } buf.append(")"); return foundTypeVariable ? writer.getName(buf.toString()) : null; }
[ "protected", "String", "getErasureAnchor", "(", "ExecutableElement", "executableElement", ")", "{", "final", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", "name", "(", "executableElement", ")", "+", "\"(\"", ")", ";", "List", "<", "?", "extends", "Va...
For backward compatibility, include an anchor using the erasures of the parameters. NOTE: We won't need this method anymore after we fix see tags so that they use the type instead of the erasure. @param executableElement the ExecutableElement to anchor to. @return the 1.4.x style anchor for the executable element.
[ "For", "backward", "compatibility", "include", "an", "anchor", "using", "the", "erasures", "of", "the", "parameters", ".", "NOTE", ":", "We", "won", "t", "need", "this", "method", "anymore", "after", "we", "fix", "see", "tags", "so", "that", "they", "use",...
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java#L304-L350
OpenLiberty/open-liberty
dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAExEntityManager.java
JPAExEntityManager.parentHasSameExPc
private static final boolean parentHasSameExPc(JPAPuId parentPuIds[], JPAPuId puId) { for (JPAPuId parentPuId : parentPuIds) { if (parentPuId.equals(puId)) { return true; } } return false; }
java
private static final boolean parentHasSameExPc(JPAPuId parentPuIds[], JPAPuId puId) { for (JPAPuId parentPuId : parentPuIds) { if (parentPuId.equals(puId)) { return true; } } return false; }
[ "private", "static", "final", "boolean", "parentHasSameExPc", "(", "JPAPuId", "parentPuIds", "[", "]", ",", "JPAPuId", "puId", ")", "{", "for", "(", "JPAPuId", "parentPuId", ":", "parentPuIds", ")", "{", "if", "(", "parentPuId", ".", "equals", "(", "puId", ...
Returns true if the caller and callee have declared the same @ PersistneceContext in their components.
[ "Returns", "true", "if", "the", "caller", "and", "callee", "have", "declared", "the", "same" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAExEntityManager.java#L762-L772
arakelian/more-commons
src/main/java/com/arakelian/core/utils/DateUtils.java
DateUtils.toZonedDateTimeUtc
private static ZonedDateTime toZonedDateTimeUtc(final long epochValue, final EpochUnits units) { Preconditions.checkArgument(units != null, "units must be non-null"); final Instant instant = units.toInstant(epochValue); return ZonedDateTime.ofInstant(instant, ZoneOffset.UTC); }
java
private static ZonedDateTime toZonedDateTimeUtc(final long epochValue, final EpochUnits units) { Preconditions.checkArgument(units != null, "units must be non-null"); final Instant instant = units.toInstant(epochValue); return ZonedDateTime.ofInstant(instant, ZoneOffset.UTC); }
[ "private", "static", "ZonedDateTime", "toZonedDateTimeUtc", "(", "final", "long", "epochValue", ",", "final", "EpochUnits", "units", ")", "{", "Preconditions", ".", "checkArgument", "(", "units", "!=", "null", ",", "\"units must be non-null\"", ")", ";", "final", ...
Returns a <code>ZonedDateTime</code> from the given epoch value. @param epoch value in milliseconds @return a <code>ZonedDateTime</code> or null if the date is not valid
[ "Returns", "a", "<code", ">", "ZonedDateTime<", "/", "code", ">", "from", "the", "given", "epoch", "value", "." ]
train
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/DateUtils.java#L640-L644
landawn/AbacusUtil
src/com/landawn/abacus/util/CSVUtil.java
CSVUtil.exportCSV
public static long exportCSV(final Writer out, final ResultSet rs) throws UncheckedSQLException, UncheckedIOException { return exportCSV(out, rs, 0, Long.MAX_VALUE, true, true); }
java
public static long exportCSV(final Writer out, final ResultSet rs) throws UncheckedSQLException, UncheckedIOException { return exportCSV(out, rs, 0, Long.MAX_VALUE, true, true); }
[ "public", "static", "long", "exportCSV", "(", "final", "Writer", "out", ",", "final", "ResultSet", "rs", ")", "throws", "UncheckedSQLException", ",", "UncheckedIOException", "{", "return", "exportCSV", "(", "out", ",", "rs", ",", "0", ",", "Long", ".", "MAX_...
Exports the data from database to CVS. Title will be added at the first line and columns will be quoted. @param out @param rs @return
[ "Exports", "the", "data", "from", "database", "to", "CVS", ".", "Title", "will", "be", "added", "at", "the", "first", "line", "and", "columns", "will", "be", "quoted", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/CSVUtil.java#L922-L924
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.writeHistoryProject
public void writeHistoryProject(CmsDbContext dbc, int publishTag, long publishDate) throws CmsDataAccessException { getHistoryDriver(dbc).writeProject(dbc, publishTag, publishDate); }
java
public void writeHistoryProject(CmsDbContext dbc, int publishTag, long publishDate) throws CmsDataAccessException { getHistoryDriver(dbc).writeProject(dbc, publishTag, publishDate); }
[ "public", "void", "writeHistoryProject", "(", "CmsDbContext", "dbc", ",", "int", "publishTag", ",", "long", "publishDate", ")", "throws", "CmsDataAccessException", "{", "getHistoryDriver", "(", "dbc", ")", ".", "writeProject", "(", "dbc", ",", "publishTag", ",", ...
Creates an historical entry of the current project.<p> @param dbc the current database context @param publishTag the version @param publishDate the date of publishing @throws CmsDataAccessException if operation was not successful
[ "Creates", "an", "historical", "entry", "of", "the", "current", "project", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L9870-L9873
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.attributeAbsent
public static void attributeAbsent(Class<?> aClass,Attribute aField){ throw new XmlMappingAttributeDoesNotExistException(MSG.INSTANCE.message(xmlMappingAttributeDoesNotExistException2,aField.getName(),aClass.getSimpleName(),"API")); }
java
public static void attributeAbsent(Class<?> aClass,Attribute aField){ throw new XmlMappingAttributeDoesNotExistException(MSG.INSTANCE.message(xmlMappingAttributeDoesNotExistException2,aField.getName(),aClass.getSimpleName(),"API")); }
[ "public", "static", "void", "attributeAbsent", "(", "Class", "<", "?", ">", "aClass", ",", "Attribute", "aField", ")", "{", "throw", "new", "XmlMappingAttributeDoesNotExistException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "xmlMappingAttributeDoesNotExist...
Thrown if the attribute doesn't exist in aClass. @param aClass class that not contains aField @param aField the missing field
[ "Thrown", "if", "the", "attribute", "doesn", "t", "exist", "in", "aClass", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L499-L501
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java
AccountsInner.getStorageAccount
public StorageAccountInfoInner getStorageAccount(String resourceGroupName, String accountName, String storageAccountName) { return getStorageAccountWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName).toBlocking().single().body(); }
java
public StorageAccountInfoInner getStorageAccount(String resourceGroupName, String accountName, String storageAccountName) { return getStorageAccountWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName).toBlocking().single().body(); }
[ "public", "StorageAccountInfoInner", "getStorageAccount", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "storageAccountName", ")", "{", "return", "getStorageAccountWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",",...
Gets the specified Azure Storage account linked to the given Data Lake Analytics account. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account. @param accountName The name of the Data Lake Analytics account from which to retrieve Azure storage account details. @param storageAccountName The name of the Azure Storage account for which to retrieve the details. @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 StorageAccountInfoInner object if successful.
[ "Gets", "the", "specified", "Azure", "Storage", "account", "linked", "to", "the", "given", "Data", "Lake", "Analytics", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L192-L194
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java
CollationBuilder.insertNodeBetween
private int insertNodeBetween(int index, int nextIndex, long node) { assert(previousIndexFromNode(node) == 0); assert(nextIndexFromNode(node) == 0); assert(nextIndexFromNode(nodes.elementAti(index)) == nextIndex); // Append the new node and link it to the existing nodes. int newIndex = nodes.size(); node |= nodeFromPreviousIndex(index) | nodeFromNextIndex(nextIndex); nodes.addElement(node); // nodes[index].nextIndex = newIndex node = nodes.elementAti(index); nodes.setElementAt(changeNodeNextIndex(node, newIndex), index); // nodes[nextIndex].previousIndex = newIndex if(nextIndex != 0) { node = nodes.elementAti(nextIndex); nodes.setElementAt(changeNodePreviousIndex(node, newIndex), nextIndex); } return newIndex; }
java
private int insertNodeBetween(int index, int nextIndex, long node) { assert(previousIndexFromNode(node) == 0); assert(nextIndexFromNode(node) == 0); assert(nextIndexFromNode(nodes.elementAti(index)) == nextIndex); // Append the new node and link it to the existing nodes. int newIndex = nodes.size(); node |= nodeFromPreviousIndex(index) | nodeFromNextIndex(nextIndex); nodes.addElement(node); // nodes[index].nextIndex = newIndex node = nodes.elementAti(index); nodes.setElementAt(changeNodeNextIndex(node, newIndex), index); // nodes[nextIndex].previousIndex = newIndex if(nextIndex != 0) { node = nodes.elementAti(nextIndex); nodes.setElementAt(changeNodePreviousIndex(node, newIndex), nextIndex); } return newIndex; }
[ "private", "int", "insertNodeBetween", "(", "int", "index", ",", "int", "nextIndex", ",", "long", "node", ")", "{", "assert", "(", "previousIndexFromNode", "(", "node", ")", "==", "0", ")", ";", "assert", "(", "nextIndexFromNode", "(", "node", ")", "==", ...
Inserts a new node into the list, between list-adjacent items. The node's previous and next indexes must not be set yet. @return the new node's index
[ "Inserts", "a", "new", "node", "into", "the", "list", "between", "list", "-", "adjacent", "items", ".", "The", "node", "s", "previous", "and", "next", "indexes", "must", "not", "be", "set", "yet", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java#L728-L745
aoindustries/semanticcms-openfile-servlet
src/main/java/com/semanticcms/openfile/servlet/OpenFile.java
OpenFile.addFileOpener
public static void addFileOpener(ServletContext servletContext, FileOpener fileOpener, String ... extensions) { synchronized(fileOpenersLock) { @SuppressWarnings("unchecked") Map<String,FileOpener> fileOpeners = (Map<String,FileOpener>)servletContext.getAttribute(FILE_OPENERS_REQUEST_ATTRIBUTE_NAME); if(fileOpeners == null) { fileOpeners = new HashMap<>(); servletContext.setAttribute(FILE_OPENERS_REQUEST_ATTRIBUTE_NAME, fileOpeners); } for(String extension : extensions) { if(fileOpeners.containsKey(extension)) throw new IllegalStateException("File opener already registered: " + extension); fileOpeners.put(extension, fileOpener); } } }
java
public static void addFileOpener(ServletContext servletContext, FileOpener fileOpener, String ... extensions) { synchronized(fileOpenersLock) { @SuppressWarnings("unchecked") Map<String,FileOpener> fileOpeners = (Map<String,FileOpener>)servletContext.getAttribute(FILE_OPENERS_REQUEST_ATTRIBUTE_NAME); if(fileOpeners == null) { fileOpeners = new HashMap<>(); servletContext.setAttribute(FILE_OPENERS_REQUEST_ATTRIBUTE_NAME, fileOpeners); } for(String extension : extensions) { if(fileOpeners.containsKey(extension)) throw new IllegalStateException("File opener already registered: " + extension); fileOpeners.put(extension, fileOpener); } } }
[ "public", "static", "void", "addFileOpener", "(", "ServletContext", "servletContext", ",", "FileOpener", "fileOpener", ",", "String", "...", "extensions", ")", "{", "synchronized", "(", "fileOpenersLock", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")",...
Registers a file opener. @param extensions The simple extensions, in lowercase, not including the dot, such as "dia"
[ "Registers", "a", "file", "opener", "." ]
train
https://github.com/aoindustries/semanticcms-openfile-servlet/blob/d22b2580b57708311949ac1088e3275355774921/src/main/java/com/semanticcms/openfile/servlet/OpenFile.java#L115-L128
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/FFmpegMuxer.java
FFmpegMuxer.packageH264Keyframe
private void packageH264Keyframe(ByteBuffer encodedData, MediaCodec.BufferInfo bufferInfo) { mH264Keyframe.position(mH264MetaSize); mH264Keyframe.put(encodedData); // BufferOverflow }
java
private void packageH264Keyframe(ByteBuffer encodedData, MediaCodec.BufferInfo bufferInfo) { mH264Keyframe.position(mH264MetaSize); mH264Keyframe.put(encodedData); // BufferOverflow }
[ "private", "void", "packageH264Keyframe", "(", "ByteBuffer", "encodedData", ",", "MediaCodec", ".", "BufferInfo", "bufferInfo", ")", "{", "mH264Keyframe", ".", "position", "(", "mH264MetaSize", ")", ";", "mH264Keyframe", ".", "put", "(", "encodedData", ")", ";", ...
Adds the SPS + PPS data to the ByteBuffer containing a h264 keyframe @param encodedData @param bufferInfo
[ "Adds", "the", "SPS", "+", "PPS", "data", "to", "the", "ByteBuffer", "containing", "a", "h264", "keyframe" ]
train
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/FFmpegMuxer.java#L313-L316
riversun/finbin
src/main/java/org/riversun/finbin/BinarySearcher.java
BinarySearcher.indexOf
public int indexOf(byte[] srcBytes, byte[] searchBytes, int startIndex) { final int endIndex = srcBytes.length - 1; return indexOf(srcBytes, searchBytes, startIndex, endIndex); }
java
public int indexOf(byte[] srcBytes, byte[] searchBytes, int startIndex) { final int endIndex = srcBytes.length - 1; return indexOf(srcBytes, searchBytes, startIndex, endIndex); }
[ "public", "int", "indexOf", "(", "byte", "[", "]", "srcBytes", ",", "byte", "[", "]", "searchBytes", ",", "int", "startIndex", ")", "{", "final", "int", "endIndex", "=", "srcBytes", ".", "length", "-", "1", ";", "return", "indexOf", "(", "srcBytes", ",...
Returns the index within this byte-array of the first occurrence of the specified(search bytes) byte array.<br> Starting the search at the specified index<br> @param srcBytes @param searchBytes @param startIndex @return
[ "Returns", "the", "index", "within", "this", "byte", "-", "array", "of", "the", "first", "occurrence", "of", "the", "specified", "(", "search", "bytes", ")", "byte", "array", ".", "<br", ">", "Starting", "the", "search", "at", "the", "specified", "index<br...
train
https://github.com/riversun/finbin/blob/d1db86a0d2966dcf47087340bbd0727a9d508b3e/src/main/java/org/riversun/finbin/BinarySearcher.java#L65-L68
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/VoiceApi.java
VoiceApi.setFocusTimeCall
public ApiSuccessResponse setFocusTimeCall(String id, SetFocusTimeData setFocusTimeData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = setFocusTimeCallWithHttpInfo(id, setFocusTimeData); return resp.getData(); }
java
public ApiSuccessResponse setFocusTimeCall(String id, SetFocusTimeData setFocusTimeData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = setFocusTimeCallWithHttpInfo(id, setFocusTimeData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "setFocusTimeCall", "(", "String", "id", ",", "SetFocusTimeData", "setFocusTimeData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "setFocusTimeCallWithHttpInfo", "(", "id", ",", "setFocu...
Set the focus time of call Set the focus time to the specified call. @param id The connection ID of the call. (required) @param setFocusTimeData Request parameters. (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Set", "the", "focus", "time", "of", "call", "Set", "the", "focus", "time", "to", "the", "specified", "call", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L4083-L4086
deeplearning4j/deeplearning4j
datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/ColorConversionTransform.java
ColorConversionTransform.doTransform
@Override protected ImageWritable doTransform(ImageWritable image, Random random) { if (image == null) { return null; } Mat mat = (Mat) converter.convert(image.getFrame()); Mat result = new Mat(); try { cvtColor(mat, result, conversionCode); } catch (Exception e) { throw new RuntimeException(e); } return new ImageWritable(converter.convert(result)); }
java
@Override protected ImageWritable doTransform(ImageWritable image, Random random) { if (image == null) { return null; } Mat mat = (Mat) converter.convert(image.getFrame()); Mat result = new Mat(); try { cvtColor(mat, result, conversionCode); } catch (Exception e) { throw new RuntimeException(e); } return new ImageWritable(converter.convert(result)); }
[ "@", "Override", "protected", "ImageWritable", "doTransform", "(", "ImageWritable", "image", ",", "Random", "random", ")", "{", "if", "(", "image", "==", "null", ")", "{", "return", "null", ";", "}", "Mat", "mat", "=", "(", "Mat", ")", "converter", ".", ...
Takes an image and returns a transformed image. Uses the random object in the case of random transformations. @param image to transform, null == end of stream @param random object to use (or null for deterministic) @return transformed image
[ "Takes", "an", "image", "and", "returns", "a", "transformed", "image", ".", "Uses", "the", "random", "object", "in", "the", "case", "of", "random", "transformations", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/ColorConversionTransform.java#L81-L97
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/GitLabApiClient.java
GitLabApiClient.enableRequestResponseLogging
void enableRequestResponseLogging(Logger logger, Level level, int maxEntityLength, List<String> maskedHeaderNames) { MaskingLoggingFilter loggingFilter = new MaskingLoggingFilter(logger, level, maxEntityLength, maskedHeaderNames); clientConfig.register(loggingFilter); // Recreate the Client instance if already created. if (apiClient != null) { createApiClient(); } }
java
void enableRequestResponseLogging(Logger logger, Level level, int maxEntityLength, List<String> maskedHeaderNames) { MaskingLoggingFilter loggingFilter = new MaskingLoggingFilter(logger, level, maxEntityLength, maskedHeaderNames); clientConfig.register(loggingFilter); // Recreate the Client instance if already created. if (apiClient != null) { createApiClient(); } }
[ "void", "enableRequestResponseLogging", "(", "Logger", "logger", ",", "Level", "level", ",", "int", "maxEntityLength", ",", "List", "<", "String", ">", "maskedHeaderNames", ")", "{", "MaskingLoggingFilter", "loggingFilter", "=", "new", "MaskingLoggingFilter", "(", "...
Enable the logging of the requests to and the responses from the GitLab server API. @param logger the Logger instance to log to @param level the logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST) @param maxEntitySize maximum number of entity bytes to be logged. When logging if the maxEntitySize is reached, the entity logging will be truncated at maxEntitySize and "...more..." will be added at the end of the log entry. If maxEntitySize is <= 0, entity logging will be disabled @param maskedHeaderNames a list of header names that should have the values masked
[ "Enable", "the", "logging", "of", "the", "requests", "to", "and", "the", "responses", "from", "the", "GitLab", "server", "API", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GitLabApiClient.java#L253-L262
gallandarakhneorg/afc
core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java
MathUtil.getCohenSutherlandCode
@Pure public static int getCohenSutherlandCode(int px, int py, int rxmin, int rymin, int rxmax, int rymax) { assert rxmin <= rxmax : AssertMessages.lowerEqualParameters(2, rxmin, 4, rxmax); assert rymin <= rymax : AssertMessages.lowerEqualParameters(3, rymin, 5, rymax); // initialised as being inside of clip window int code = COHEN_SUTHERLAND_INSIDE; if (px < rxmin) { // to the left of clip window code |= COHEN_SUTHERLAND_LEFT; } if (px > rxmax) { // to the right of clip window code |= COHEN_SUTHERLAND_RIGHT; } if (py < rymin) { // to the bottom of clip window code |= COHEN_SUTHERLAND_BOTTOM; } if (py > rymax) { // to the top of clip window code |= COHEN_SUTHERLAND_TOP; } return code; }
java
@Pure public static int getCohenSutherlandCode(int px, int py, int rxmin, int rymin, int rxmax, int rymax) { assert rxmin <= rxmax : AssertMessages.lowerEqualParameters(2, rxmin, 4, rxmax); assert rymin <= rymax : AssertMessages.lowerEqualParameters(3, rymin, 5, rymax); // initialised as being inside of clip window int code = COHEN_SUTHERLAND_INSIDE; if (px < rxmin) { // to the left of clip window code |= COHEN_SUTHERLAND_LEFT; } if (px > rxmax) { // to the right of clip window code |= COHEN_SUTHERLAND_RIGHT; } if (py < rymin) { // to the bottom of clip window code |= COHEN_SUTHERLAND_BOTTOM; } if (py > rymax) { // to the top of clip window code |= COHEN_SUTHERLAND_TOP; } return code; }
[ "@", "Pure", "public", "static", "int", "getCohenSutherlandCode", "(", "int", "px", ",", "int", "py", ",", "int", "rxmin", ",", "int", "rymin", ",", "int", "rxmax", ",", "int", "rymax", ")", "{", "assert", "rxmin", "<=", "rxmax", ":", "AssertMessages", ...
Compute the zone where the point is against the given rectangle according to the <a href="http://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm">Cohen-Sutherland algorithm</a>. @param px is the coordinates of the points. @param py is the coordinates of the points. @param rxmin is the min of the coordinates of the rectangle. @param rymin is the min of the coordinates of the rectangle. @param rxmax is the max of the coordinates of the rectangle. @param rymax is the max of the coordinates of the rectangle. @return the zone @see MathConstants#COHEN_SUTHERLAND_BOTTOM @see MathConstants#COHEN_SUTHERLAND_TOP @see MathConstants#COHEN_SUTHERLAND_LEFT @see MathConstants#COHEN_SUTHERLAND_RIGHT @see MathConstants#COHEN_SUTHERLAND_INSIDE
[ "Compute", "the", "zone", "where", "the", "point", "is", "against", "the", "given", "rectangle", "according", "to", "the", "<a", "href", "=", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Cohen%E2%80%93Sutherland_algorithm", ">", ...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java#L489-L512
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java
GlobalUsersInner.beginResetPasswordAsync
public Observable<Void> beginResetPasswordAsync(String userName, ResetPasswordPayload resetPasswordPayload) { return beginResetPasswordWithServiceResponseAsync(userName, resetPasswordPayload).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginResetPasswordAsync(String userName, ResetPasswordPayload resetPasswordPayload) { return beginResetPasswordWithServiceResponseAsync(userName, resetPasswordPayload).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginResetPasswordAsync", "(", "String", "userName", ",", "ResetPasswordPayload", "resetPasswordPayload", ")", "{", "return", "beginResetPasswordWithServiceResponseAsync", "(", "userName", ",", "resetPasswordPayload", ")", ".", "...
Resets the user password on an environment This operation can take a while to complete. @param userName The name of the user. @param resetPasswordPayload Represents the payload for resetting passwords. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Resets", "the", "user", "password", "on", "an", "environment", "This", "operation", "can", "take", "a", "while", "to", "complete", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java#L1023-L1030
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/DataModelSerializer.java
DataModelSerializer.getClassForFieldName
private static ClassAndMethod getClassForFieldName(String fieldName, Class<?> classToLookForFieldIn) { return internalGetClassForFieldName(fieldName, classToLookForFieldIn, false); }
java
private static ClassAndMethod getClassForFieldName(String fieldName, Class<?> classToLookForFieldIn) { return internalGetClassForFieldName(fieldName, classToLookForFieldIn, false); }
[ "private", "static", "ClassAndMethod", "getClassForFieldName", "(", "String", "fieldName", ",", "Class", "<", "?", ">", "classToLookForFieldIn", ")", "{", "return", "internalGetClassForFieldName", "(", "fieldName", ",", "classToLookForFieldIn", ",", "false", ")", ";",...
Gets a class for a JSON field name, by looking in a given Class for an appropriate setter. The setter is assumed not to be a Collection. @param fieldName the name to use to search for the getter. @param classToLookForFieldIn the Class to search for the getter within. @return instance of ClassAndMethod if one is found, null otherwise
[ "Gets", "a", "class", "for", "a", "JSON", "field", "name", "by", "looking", "in", "a", "given", "Class", "for", "an", "appropriate", "setter", ".", "The", "setter", "is", "assumed", "not", "to", "be", "a", "Collection", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/DataModelSerializer.java#L395-L397
phax/ph-oton
ph-oton-uicore/src/main/java/com/helger/photon/uicore/html/swf/HCSWFObject.java
HCSWFObject.addFlashVar
@Nonnull public final HCSWFObject addFlashVar (@Nonnull final String sName, final Object aValue) { if (!JSMarshaller.isJSIdentifier (sName)) throw new IllegalArgumentException ("The name '" + sName + "' is not a legal JS identifier!"); if (m_aFlashVars == null) m_aFlashVars = new CommonsLinkedHashMap <> (); m_aFlashVars.put (sName, aValue); return this; }
java
@Nonnull public final HCSWFObject addFlashVar (@Nonnull final String sName, final Object aValue) { if (!JSMarshaller.isJSIdentifier (sName)) throw new IllegalArgumentException ("The name '" + sName + "' is not a legal JS identifier!"); if (m_aFlashVars == null) m_aFlashVars = new CommonsLinkedHashMap <> (); m_aFlashVars.put (sName, aValue); return this; }
[ "@", "Nonnull", "public", "final", "HCSWFObject", "addFlashVar", "(", "@", "Nonnull", "final", "String", "sName", ",", "final", "Object", "aValue", ")", "{", "if", "(", "!", "JSMarshaller", ".", "isJSIdentifier", "(", "sName", ")", ")", "throw", "new", "Il...
Add a parameter to be passed to the Flash object @param sName Parameter name @param aValue Parameter value @return this
[ "Add", "a", "parameter", "to", "be", "passed", "to", "the", "Flash", "object" ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uicore/src/main/java/com/helger/photon/uicore/html/swf/HCSWFObject.java#L168-L178
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java
IntegralImageOps.convolveSparse
public static int convolveSparse(GrayS32 integral , IntegralKernel kernel , int x , int y ) { return ImplIntegralImageOps.convolveSparse(integral, kernel, x, y); }
java
public static int convolveSparse(GrayS32 integral , IntegralKernel kernel , int x , int y ) { return ImplIntegralImageOps.convolveSparse(integral, kernel, x, y); }
[ "public", "static", "int", "convolveSparse", "(", "GrayS32", "integral", ",", "IntegralKernel", "kernel", ",", "int", "x", ",", "int", "y", ")", "{", "return", "ImplIntegralImageOps", ".", "convolveSparse", "(", "integral", ",", "kernel", ",", "x", ",", "y",...
Convolves a kernel around a single point in the integral image. @param integral Input integral image. Not modified. @param kernel Convolution kernel. @param x Pixel the convolution is performed at. @param y Pixel the convolution is performed at. @return Value of the convolution
[ "Convolves", "a", "kernel", "around", "a", "single", "point", "in", "the", "integral", "image", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java#L340-L343
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/xml/Ra10XmlGen.java
Ra10XmlGen.writeXmlBody
@Override public void writeXmlBody(Definition def, Writer out) throws IOException { writeConnectorVersion(out); int indent = 1; writeIndent(out, indent); out.write("<display-name>Display Name</display-name>"); writeEol(out); writeIndent(out, indent); out.write("<vendor-name>Red Hat Inc</vendor-name>"); writeEol(out); writeIndent(out, indent); out.write("<spec-version>1.0</spec-version>"); writeEol(out); writeIndent(out, indent); out.write("<eis-type>Test RA</eis-type>"); writeEol(out); writeIndent(out, indent); out.write("<version>0.1</version>"); writeEol(out); writeIndent(out, indent); out.write("<resourceadapter>"); writeEol(out); writeOutbound(def, out, indent + 1); writeIndent(out, indent); out.write("</resourceadapter>"); writeEol(out); out.write("</connector>"); writeEol(out); }
java
@Override public void writeXmlBody(Definition def, Writer out) throws IOException { writeConnectorVersion(out); int indent = 1; writeIndent(out, indent); out.write("<display-name>Display Name</display-name>"); writeEol(out); writeIndent(out, indent); out.write("<vendor-name>Red Hat Inc</vendor-name>"); writeEol(out); writeIndent(out, indent); out.write("<spec-version>1.0</spec-version>"); writeEol(out); writeIndent(out, indent); out.write("<eis-type>Test RA</eis-type>"); writeEol(out); writeIndent(out, indent); out.write("<version>0.1</version>"); writeEol(out); writeIndent(out, indent); out.write("<resourceadapter>"); writeEol(out); writeOutbound(def, out, indent + 1); writeIndent(out, indent); out.write("</resourceadapter>"); writeEol(out); out.write("</connector>"); writeEol(out); }
[ "@", "Override", "public", "void", "writeXmlBody", "(", "Definition", "def", ",", "Writer", "out", ")", "throws", "IOException", "{", "writeConnectorVersion", "(", "out", ")", ";", "int", "indent", "=", "1", ";", "writeIndent", "(", "out", ",", "indent", "...
Output xml @param def definition @param out Writer @throws IOException ioException
[ "Output", "xml" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/xml/Ra10XmlGen.java#L45-L78
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/cloud/PointCloudUtils.java
PointCloudUtils.autoScale
public static double autoScale( List<Point3D_F64> cloud , double target ) { Point3D_F64 mean = new Point3D_F64(); Point3D_F64 stdev = new Point3D_F64(); statistics(cloud, mean, stdev); double scale = target/(Math.max(Math.max(stdev.x,stdev.y),stdev.z)); int N = cloud.size(); for (int i = 0; i < N ; i++) { cloud.get(i).scale(scale); } return scale; }
java
public static double autoScale( List<Point3D_F64> cloud , double target ) { Point3D_F64 mean = new Point3D_F64(); Point3D_F64 stdev = new Point3D_F64(); statistics(cloud, mean, stdev); double scale = target/(Math.max(Math.max(stdev.x,stdev.y),stdev.z)); int N = cloud.size(); for (int i = 0; i < N ; i++) { cloud.get(i).scale(scale); } return scale; }
[ "public", "static", "double", "autoScale", "(", "List", "<", "Point3D_F64", ">", "cloud", ",", "double", "target", ")", "{", "Point3D_F64", "mean", "=", "new", "Point3D_F64", "(", ")", ";", "Point3D_F64", "stdev", "=", "new", "Point3D_F64", "(", ")", ";", ...
Automatically rescales the point cloud based so that it has a standard deviation of 'target' @param cloud The point cloud @param target The desired standard deviation of the cloud. Try 100 @return The selected scale factor
[ "Automatically", "rescales", "the", "point", "cloud", "based", "so", "that", "it", "has", "a", "standard", "deviation", "of", "target" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/cloud/PointCloudUtils.java#L42-L57
gaixie/jibu-core
src/main/java/org/gaixie/jibu/utils/SQLBuilder.java
SQLBuilder.beanToSQLClause
public static String beanToSQLClause(Object bean, String split) throws JibuException { StringBuilder sb = new StringBuilder(); try{ if(null != bean ) { BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass()); PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors(); for( PropertyDescriptor pd : pds ){ String clause = columnClause(" "+pd.getName(), pd.getPropertyType(), pd.getReadMethod().invoke(bean)); if (null != clause) { sb.append(clause + split+" \n"); } } } } catch( Exception e){ throw new JibuException(e.getMessage()); } return sb.toString(); }
java
public static String beanToSQLClause(Object bean, String split) throws JibuException { StringBuilder sb = new StringBuilder(); try{ if(null != bean ) { BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass()); PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors(); for( PropertyDescriptor pd : pds ){ String clause = columnClause(" "+pd.getName(), pd.getPropertyType(), pd.getReadMethod().invoke(bean)); if (null != clause) { sb.append(clause + split+" \n"); } } } } catch( Exception e){ throw new JibuException(e.getMessage()); } return sb.toString(); }
[ "public", "static", "String", "beanToSQLClause", "(", "Object", "bean", ",", "String", "split", ")", "throws", "JibuException", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "try", "{", "if", "(", "null", "!=", "bean", ")", "{", ...
通过 Bean 实例转化为 SQL 语句段,只转化非空属性。 <p> 支持的属性类型有 int, Integer, float, Float, boolean, Boolean ,Date</p> @param bean Bean 实例 @param split sql 语句的分隔符,如 " AND " 或 " , " @return SQl 语句段,如果所有属性值都为空,返回 ""。 @exception JibuException 转化失败时抛出
[ "通过", "Bean", "实例转化为", "SQL", "语句段,只转化非空属性。", "<p", ">", "支持的属性类型有", "int", "Integer", "float", "Float", "boolean", "Boolean", "Date<", "/", "p", ">" ]
train
https://github.com/gaixie/jibu-core/blob/d5462f2883321c82d898c8752b7e5eba4b7dc184/src/main/java/org/gaixie/jibu/utils/SQLBuilder.java#L49-L71
statefulj/statefulj
statefulj-common/src/main/java/org/statefulj/common/utils/ReflectionUtils.java
ReflectionUtils.getField
public static Field getField(final Class<?> clazz, final String fieldName) { //Define return type // Field field = null; //For each class in the hierarchy starting with the current class, try to find the declared field // for (Class<?> current = clazz; current != null && field == null; current = current.getSuperclass()) { try { //Attempt to get the field, if exception is thrown continue to the next class // field = current .getDeclaredField( fieldName ); } catch (final NoSuchFieldException e) { //ignore and continue searching // } } //Return the field we found // return field; }
java
public static Field getField(final Class<?> clazz, final String fieldName) { //Define return type // Field field = null; //For each class in the hierarchy starting with the current class, try to find the declared field // for (Class<?> current = clazz; current != null && field == null; current = current.getSuperclass()) { try { //Attempt to get the field, if exception is thrown continue to the next class // field = current .getDeclaredField( fieldName ); } catch (final NoSuchFieldException e) { //ignore and continue searching // } } //Return the field we found // return field; }
[ "public", "static", "Field", "getField", "(", "final", "Class", "<", "?", ">", "clazz", ",", "final", "String", "fieldName", ")", "{", "//Define return type", "//", "Field", "field", "=", "null", ";", "//For each class in the hierarchy starting with the current class,...
Climb the class hierarchy starting with the clazz provided, looking for the field with fieldName @param clazz starting class to search at @param fieldName name of the field we are looking for @return Field which was found, or null if nothing was found
[ "Climb", "the", "class", "hierarchy", "starting", "with", "the", "clazz", "provided", "looking", "for", "the", "field", "with", "fieldName" ]
train
https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-common/src/main/java/org/statefulj/common/utils/ReflectionUtils.java#L187-L215
apache/reef
lang/java/reef-common/src/main/java/org/apache/reef/util/logging/LoggingScopeFactory.java
LoggingScopeFactory.getNewLoggingScope
public LoggingScope getNewLoggingScope(final String msg, final Object[] params) { return new LoggingScopeImpl(LOG, logLevel, msg, params); }
java
public LoggingScope getNewLoggingScope(final String msg, final Object[] params) { return new LoggingScopeImpl(LOG, logLevel, msg, params); }
[ "public", "LoggingScope", "getNewLoggingScope", "(", "final", "String", "msg", ",", "final", "Object", "[", "]", "params", ")", "{", "return", "new", "LoggingScopeImpl", "(", "LOG", ",", "logLevel", ",", "msg", ",", "params", ")", ";", "}" ]
Get a new instance of LoggingScope with msg and params through new. @param msg @param params @return
[ "Get", "a", "new", "instance", "of", "LoggingScope", "with", "msg", "and", "params", "through", "new", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/logging/LoggingScopeFactory.java#L101-L103
micrometer-metrics/micrometer
micrometer-core/src/main/java/io/micrometer/core/instrument/binder/db/DatabaseTableMetrics.java
DatabaseTableMetrics.monitor
public static void monitor(MeterRegistry registry, DataSource dataSource, String dataSourceName, String tableName, Iterable<Tag> tags) { new DatabaseTableMetrics(dataSource, dataSourceName, tableName, tags).bindTo(registry); }
java
public static void monitor(MeterRegistry registry, DataSource dataSource, String dataSourceName, String tableName, Iterable<Tag> tags) { new DatabaseTableMetrics(dataSource, dataSourceName, tableName, tags).bindTo(registry); }
[ "public", "static", "void", "monitor", "(", "MeterRegistry", "registry", ",", "DataSource", "dataSource", ",", "String", "dataSourceName", ",", "String", "tableName", ",", "Iterable", "<", "Tag", ">", "tags", ")", "{", "new", "DatabaseTableMetrics", "(", "dataSo...
Record the row count for an individual database table. @param registry The registry to bind metrics to. @param dataSource The data source to use to run the row count query. @param dataSourceName The name prefix of the metrics. @param tableName The name of the table to report table size for. @param tags Tags to apply to all recorded metrics.
[ "Record", "the", "row", "count", "for", "an", "individual", "database", "table", "." ]
train
https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/db/DatabaseTableMetrics.java#L97-L99
roboconf/roboconf-platform
miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/RenderingManager.java
RenderingManager.buildRenderer
private IRenderer buildRenderer( File outputDirectory, ApplicationTemplate applicationTemplate, File applicationDirectory, Renderer renderer, Map<String,String> typeAnnotations ) { IRenderer result = null; switch( renderer ) { case HTML: result = new HtmlRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations ); break; case MARKDOWN: result = new MarkdownRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations ); break; case FOP: result = new FopRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations ); break; case PDF: result = new PdfRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations ); break; default: break; } return result; }
java
private IRenderer buildRenderer( File outputDirectory, ApplicationTemplate applicationTemplate, File applicationDirectory, Renderer renderer, Map<String,String> typeAnnotations ) { IRenderer result = null; switch( renderer ) { case HTML: result = new HtmlRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations ); break; case MARKDOWN: result = new MarkdownRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations ); break; case FOP: result = new FopRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations ); break; case PDF: result = new PdfRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations ); break; default: break; } return result; }
[ "private", "IRenderer", "buildRenderer", "(", "File", "outputDirectory", ",", "ApplicationTemplate", "applicationTemplate", ",", "File", "applicationDirectory", ",", "Renderer", "renderer", ",", "Map", "<", "String", ",", "String", ">", "typeAnnotations", ")", "{", ...
Builds the right renderer. @param outputDirectory @param applicationTemplate @param applicationDirectory @param renderer @param typeAnnotations @return a renderer
[ "Builds", "the", "right", "renderer", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/RenderingManager.java#L178-L208
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/query/parsing/impl/Neo4jPropertyHelper.java
Neo4jPropertyHelper.isIdProperty
public boolean isIdProperty(OgmEntityPersister persister, List<String> namesWithoutAlias) { String join = StringHelper.join( namesWithoutAlias, "." ); Type propertyType = persister.getPropertyType( namesWithoutAlias.get( 0 ) ); String[] identifierColumnNames = persister.getIdentifierColumnNames(); if ( propertyType.isComponentType() ) { String[] embeddedColumnNames = persister.getPropertyColumnNames( join ); for ( String embeddedColumn : embeddedColumnNames ) { if ( !ArrayHelper.contains( identifierColumnNames, embeddedColumn ) ) { return false; } } return true; } return ArrayHelper.contains( identifierColumnNames, join ); }
java
public boolean isIdProperty(OgmEntityPersister persister, List<String> namesWithoutAlias) { String join = StringHelper.join( namesWithoutAlias, "." ); Type propertyType = persister.getPropertyType( namesWithoutAlias.get( 0 ) ); String[] identifierColumnNames = persister.getIdentifierColumnNames(); if ( propertyType.isComponentType() ) { String[] embeddedColumnNames = persister.getPropertyColumnNames( join ); for ( String embeddedColumn : embeddedColumnNames ) { if ( !ArrayHelper.contains( identifierColumnNames, embeddedColumn ) ) { return false; } } return true; } return ArrayHelper.contains( identifierColumnNames, join ); }
[ "public", "boolean", "isIdProperty", "(", "OgmEntityPersister", "persister", ",", "List", "<", "String", ">", "namesWithoutAlias", ")", "{", "String", "join", "=", "StringHelper", ".", "join", "(", "namesWithoutAlias", ",", "\".\"", ")", ";", "Type", "propertyTy...
Check if the property is part of the identifier of the entity. @param persister the {@link OgmEntityPersister} of the entity with the property @param namesWithoutAlias the path to the property with all the aliases resolved @return {@code true} if the property is part of the id, {@code false} otherwise.
[ "Check", "if", "the", "property", "is", "part", "of", "the", "identifier", "of", "the", "entity", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/query/parsing/impl/Neo4jPropertyHelper.java#L164-L178
santhosh-tekuri/jlibs
xml/src/main/java/jlibs/xml/xsl/TransformerUtil.java
TransformerUtil.setOutputProperties
public static Transformer setOutputProperties(Transformer transformer, boolean omitXMLDeclaration, int indentAmount, String encoding){ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXMLDeclaration ? "yes" : "no"); // indentation if(indentAmount>0){ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OUTPUT_KEY_INDENT_AMOUT, String.valueOf(indentAmount)); } if(!StringUtil.isWhitespace(encoding)) transformer.setOutputProperty(OutputKeys.ENCODING, encoding.trim()); return transformer; }
java
public static Transformer setOutputProperties(Transformer transformer, boolean omitXMLDeclaration, int indentAmount, String encoding){ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXMLDeclaration ? "yes" : "no"); // indentation if(indentAmount>0){ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OUTPUT_KEY_INDENT_AMOUT, String.valueOf(indentAmount)); } if(!StringUtil.isWhitespace(encoding)) transformer.setOutputProperty(OutputKeys.ENCODING, encoding.trim()); return transformer; }
[ "public", "static", "Transformer", "setOutputProperties", "(", "Transformer", "transformer", ",", "boolean", "omitXMLDeclaration", ",", "int", "indentAmount", ",", "String", "encoding", ")", "{", "transformer", ".", "setOutputProperty", "(", "OutputKeys", ".", "OMIT_X...
to set various output properties on given transformer. @param transformer transformer on which properties are set @param omitXMLDeclaration omit xml declaration or not @param indentAmount the number fo spaces used for indentation. use <=0, in case you dont want indentation @param encoding required encoding. use null to don't set any encoding @return the same transformer which is passed as argument
[ "to", "set", "various", "output", "properties", "on", "given", "transformer", "." ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/xml/src/main/java/jlibs/xml/xsl/TransformerUtil.java#L44-L57
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/inject/writer/AbstractClassFileWriter.java
AbstractClassFileWriter.writeClassToDisk
protected void writeClassToDisk(File targetDir, ClassWriter classWriter, String className) throws IOException { if (targetDir != null) { String fileName = className.replace('.', '/') + ".class"; File targetFile = new File(targetDir, fileName); targetFile.getParentFile().mkdirs(); try (OutputStream outputStream = Files.newOutputStream(targetFile.toPath())) { writeClassToDisk(outputStream, classWriter); } } }
java
protected void writeClassToDisk(File targetDir, ClassWriter classWriter, String className) throws IOException { if (targetDir != null) { String fileName = className.replace('.', '/') + ".class"; File targetFile = new File(targetDir, fileName); targetFile.getParentFile().mkdirs(); try (OutputStream outputStream = Files.newOutputStream(targetFile.toPath())) { writeClassToDisk(outputStream, classWriter); } } }
[ "protected", "void", "writeClassToDisk", "(", "File", "targetDir", ",", "ClassWriter", "classWriter", ",", "String", "className", ")", "throws", "IOException", "{", "if", "(", "targetDir", "!=", "null", ")", "{", "String", "fileName", "=", "className", ".", "r...
Writes the class file to disk in the given directory. @param targetDir The target directory @param classWriter The current class writer @param className The class name @throws IOException if there is a problem writing the class to disk
[ "Writes", "the", "class", "file", "to", "disk", "in", "the", "given", "directory", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/writer/AbstractClassFileWriter.java#L834-L845
massfords/jaxb-visitor
src/main/java/com/massfords/jaxb/CreateTraversingVisitorClass.java
CreateTraversingVisitorClass.addGetterAndSetter
private void addGetterAndSetter(JDefinedClass traversingVisitor, JFieldVar field) { String propName = Character.toUpperCase(field.name().charAt(0)) + field.name().substring(1); traversingVisitor.method(JMod.PUBLIC, field.type(), "get" + propName).body()._return(field); JMethod setVisitor = traversingVisitor.method(JMod.PUBLIC, void.class, "set" + propName); JVar visParam = setVisitor.param(field.type(), "aVisitor"); setVisitor.body().assign(field, visParam); }
java
private void addGetterAndSetter(JDefinedClass traversingVisitor, JFieldVar field) { String propName = Character.toUpperCase(field.name().charAt(0)) + field.name().substring(1); traversingVisitor.method(JMod.PUBLIC, field.type(), "get" + propName).body()._return(field); JMethod setVisitor = traversingVisitor.method(JMod.PUBLIC, void.class, "set" + propName); JVar visParam = setVisitor.param(field.type(), "aVisitor"); setVisitor.body().assign(field, visParam); }
[ "private", "void", "addGetterAndSetter", "(", "JDefinedClass", "traversingVisitor", ",", "JFieldVar", "field", ")", "{", "String", "propName", "=", "Character", ".", "toUpperCase", "(", "field", ".", "name", "(", ")", ".", "charAt", "(", "0", ")", ")", "+", ...
Convenience method to add a getter and setter method for the given field. @param traversingVisitor @param field
[ "Convenience", "method", "to", "add", "a", "getter", "and", "setter", "method", "for", "the", "given", "field", "." ]
train
https://github.com/massfords/jaxb-visitor/blob/0d66cd4d8b6700b5eb67c028a87b53792be895b8/src/main/java/com/massfords/jaxb/CreateTraversingVisitorClass.java#L151-L157