repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
ModeShape/modeshape
modeshape-schematic/src/main/java/org/modeshape/schematic/internal/document/BsonUtils.java
BsonUtils.readObjectId
public static ObjectId readObjectId(byte[] bytes) { // Compute the values in big-endian ... int time = ((bytes[0] & 0xff) << 24) + ((bytes[1] & 0xff) << 16) + ((bytes[2] & 0xff) << 8) + ((bytes[3] & 0xff) << 0); int machine = ((bytes[4] & 0xff) << 16) + ((bytes[5] & 0xff) << 8) + ((bytes[6] & 0xff) << 0); int process = ((bytes[7] & 0xff) << 8) + ((bytes[8] & 0xff) << 0); int inc = ((bytes[9] & 0xff) << 16) + ((bytes[10] & 0xff) << 8) + ((bytes[11] & 0xff) << 0); // Create the value object ... return new ObjectId(time, machine, process, inc); }
java
public static ObjectId readObjectId(byte[] bytes) { // Compute the values in big-endian ... int time = ((bytes[0] & 0xff) << 24) + ((bytes[1] & 0xff) << 16) + ((bytes[2] & 0xff) << 8) + ((bytes[3] & 0xff) << 0); int machine = ((bytes[4] & 0xff) << 16) + ((bytes[5] & 0xff) << 8) + ((bytes[6] & 0xff) << 0); int process = ((bytes[7] & 0xff) << 8) + ((bytes[8] & 0xff) << 0); int inc = ((bytes[9] & 0xff) << 16) + ((bytes[10] & 0xff) << 8) + ((bytes[11] & 0xff) << 0); // Create the value object ... return new ObjectId(time, machine, process, inc); }
[ "public", "static", "ObjectId", "readObjectId", "(", "byte", "[", "]", "bytes", ")", "{", "// Compute the values in big-endian ...", "int", "time", "=", "(", "(", "bytes", "[", "0", "]", "&", "0xff", ")", "<<", "24", ")", "+", "(", "(", "bytes", "[", "...
The BSON specification (or rather the <a href="http://www.mongodb.org/display/DOCS/Object+IDs">MongoDB documentation</a>) defines the structure of this data: <p> <quote>"A BSON ObjectID is a 12-byte value consisting of a 4-byte timestamp (seconds since epoch), a 3-byte machine id, a 2-byte process id, and a 3-byte counter. Note that the timestamp and counter fields must be stored big endian unlike the rest of BSON. This is because they are compared byte-by-byte and we want to ensure a mostly increasing order."</quote> </p> @param bytes @return the ObjectId
[ "The", "BSON", "specification", "(", "or", "rather", "the", "<a", "href", "=", "http", ":", "//", "www", ".", "mongodb", ".", "org", "/", "display", "/", "DOCS", "/", "Object", "+", "IDs", ">", "MongoDB", "documentation<", "/", "a", ">", ")", "define...
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-schematic/src/main/java/org/modeshape/schematic/internal/document/BsonUtils.java#L108-L117
square/picasso
picasso/src/main/java/com/squareup/picasso3/RequestCreator.java
RequestCreator.resizeDimen
@NonNull public RequestCreator resizeDimen(int targetWidthResId, int targetHeightResId) { Resources resources = picasso.context.getResources(); int targetWidth = resources.getDimensionPixelSize(targetWidthResId); int targetHeight = resources.getDimensionPixelSize(targetHeightResId); return resize(targetWidth, targetHeight); }
java
@NonNull public RequestCreator resizeDimen(int targetWidthResId, int targetHeightResId) { Resources resources = picasso.context.getResources(); int targetWidth = resources.getDimensionPixelSize(targetWidthResId); int targetHeight = resources.getDimensionPixelSize(targetHeightResId); return resize(targetWidth, targetHeight); }
[ "@", "NonNull", "public", "RequestCreator", "resizeDimen", "(", "int", "targetWidthResId", ",", "int", "targetHeightResId", ")", "{", "Resources", "resources", "=", "picasso", ".", "context", ".", "getResources", "(", ")", ";", "int", "targetWidth", "=", "resour...
Resize the image to the specified dimension size. Use 0 as desired dimension to resize keeping aspect ratio.
[ "Resize", "the", "image", "to", "the", "specified", "dimension", "size", ".", "Use", "0", "as", "desired", "dimension", "to", "resize", "keeping", "aspect", "ratio", "." ]
train
https://github.com/square/picasso/blob/89f55b76e3be2b65e5997b7698f782f16f8547e3/picasso/src/main/java/com/squareup/picasso3/RequestCreator.java#L228-L234
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/parallel/ParallelIterate.java
ParallelIterate.newPooledExecutor
public static ExecutorService newPooledExecutor(String poolName, boolean useDaemonThreads) { return ParallelIterate.newPooledExecutor(ParallelIterate.getDefaultMaxThreadPoolSize(), poolName, useDaemonThreads); }
java
public static ExecutorService newPooledExecutor(String poolName, boolean useDaemonThreads) { return ParallelIterate.newPooledExecutor(ParallelIterate.getDefaultMaxThreadPoolSize(), poolName, useDaemonThreads); }
[ "public", "static", "ExecutorService", "newPooledExecutor", "(", "String", "poolName", ",", "boolean", "useDaemonThreads", ")", "{", "return", "ParallelIterate", ".", "newPooledExecutor", "(", "ParallelIterate", ".", "getDefaultMaxThreadPoolSize", "(", ")", ",", "poolNa...
Returns a brand new ExecutorService using the specified poolName and uses the optional property named to set the maximum thread pool size. The same poolName may be used more than once resulting in multiple pools with the same name.
[ "Returns", "a", "brand", "new", "ExecutorService", "using", "the", "specified", "poolName", "and", "uses", "the", "optional", "property", "named", "to", "set", "the", "maximum", "thread", "pool", "size", ".", "The", "same", "poolName", "may", "be", "used", "...
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/parallel/ParallelIterate.java#L1361-L1364
micronaut-projects/micronaut-core
runtime/src/main/java/io/micronaut/discovery/registration/AutoRegistration.java
AutoRegistration.validateName
protected void validateName(String name, String typeDescription) { if (!APPLICATION_NAME_PATTERN.matcher(name).matches()) { throw new DiscoveryException(typeDescription + " [" + name + "] must start with a letter, end with a letter or digit and contain only letters, digits or hyphens. Example: foo-bar"); } }
java
protected void validateName(String name, String typeDescription) { if (!APPLICATION_NAME_PATTERN.matcher(name).matches()) { throw new DiscoveryException(typeDescription + " [" + name + "] must start with a letter, end with a letter or digit and contain only letters, digits or hyphens. Example: foo-bar"); } }
[ "protected", "void", "validateName", "(", "String", "name", ",", "String", "typeDescription", ")", "{", "if", "(", "!", "APPLICATION_NAME_PATTERN", ".", "matcher", "(", "name", ")", ".", "matches", "(", ")", ")", "{", "throw", "new", "DiscoveryException", "(...
Validate the given application name. @param name The application name @param typeDescription The detailed information about name
[ "Validate", "the", "given", "application", "name", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/runtime/src/main/java/io/micronaut/discovery/registration/AutoRegistration.java#L107-L111
AzureAD/azure-activedirectory-library-for-java
src/main/java/com/microsoft/aad/adal4j/AuthenticationContext.java
AuthenticationContext.acquireToken
public Future<AuthenticationResult> acquireToken(final String resource, final UserAssertion userAssertion, final AsymmetricKeyCredential credential, final AuthenticationCallback callback) { this.validateOnBehalfOfRequestInput(resource, userAssertion, credential, true); ClientAssertion clientAssertion = JwtHelper .buildJwt(credential, this.authenticationAuthority.getSelfSignedJwtAudience()); final ClientAuthentication clientAuth = createClientAuthFromClientAssertion(clientAssertion); return acquireTokenOnBehalfOf(resource, userAssertion, clientAuth, callback); }
java
public Future<AuthenticationResult> acquireToken(final String resource, final UserAssertion userAssertion, final AsymmetricKeyCredential credential, final AuthenticationCallback callback) { this.validateOnBehalfOfRequestInput(resource, userAssertion, credential, true); ClientAssertion clientAssertion = JwtHelper .buildJwt(credential, this.authenticationAuthority.getSelfSignedJwtAudience()); final ClientAuthentication clientAuth = createClientAuthFromClientAssertion(clientAssertion); return acquireTokenOnBehalfOf(resource, userAssertion, clientAuth, callback); }
[ "public", "Future", "<", "AuthenticationResult", ">", "acquireToken", "(", "final", "String", "resource", ",", "final", "UserAssertion", "userAssertion", ",", "final", "AsymmetricKeyCredential", "credential", ",", "final", "AuthenticationCallback", "callback", ")", "{",...
Acquires an access token from the authority on behalf of a user. It requires using a user token previously received. Uses certificate to authenticate client. @param resource Identifier of the target resource that is the recipient of the requested token. @param userAssertion userAssertion to use as Authorization grant @param credential The certificate based client credential to use for token acquisition. @param callback optional callback object for non-blocking execution. @return A {@link Future} object representing the {@link AuthenticationResult} of the call. It contains Access Token and the Access Token's expiration time. Refresh Token property will be null for this overload. @throws AuthenticationException {@link AuthenticationException}
[ "Acquires", "an", "access", "token", "from", "the", "authority", "on", "behalf", "of", "a", "user", ".", "It", "requires", "using", "a", "user", "token", "previously", "received", ".", "Uses", "certificate", "to", "authenticate", "client", "." ]
train
https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/main/java/com/microsoft/aad/adal4j/AuthenticationContext.java#L297-L307
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.updateRepositoryFile
public GitlabSimpleRepositoryFile updateRepositoryFile(GitlabProject project, String path, String branchName, String commitMsg, String content) throws IOException { String tailUrl = GitlabProject.URL + "/" + project.getId() + "/repository/files/" + sanitizePath(path); GitlabHTTPRequestor requestor = retrieve().method(PUT); return requestor .with("branch", branchName) .with("encoding", "base64") .with("commit_message", commitMsg) .with("content", content) .to(tailUrl, GitlabSimpleRepositoryFile.class); }
java
public GitlabSimpleRepositoryFile updateRepositoryFile(GitlabProject project, String path, String branchName, String commitMsg, String content) throws IOException { String tailUrl = GitlabProject.URL + "/" + project.getId() + "/repository/files/" + sanitizePath(path); GitlabHTTPRequestor requestor = retrieve().method(PUT); return requestor .with("branch", branchName) .with("encoding", "base64") .with("commit_message", commitMsg) .with("content", content) .to(tailUrl, GitlabSimpleRepositoryFile.class); }
[ "public", "GitlabSimpleRepositoryFile", "updateRepositoryFile", "(", "GitlabProject", "project", ",", "String", "path", ",", "String", "branchName", ",", "String", "commitMsg", ",", "String", "content", ")", "throws", "IOException", "{", "String", "tailUrl", "=", "G...
Updates the content of an existing file in the repository @param project The Project @param path The file path inside the repository @param branchName The name of a repository branch @param commitMsg The commit message @param content The base64 encoded content of the file @throws IOException on gitlab api call error
[ "Updates", "the", "content", "of", "an", "existing", "file", "in", "the", "repository" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L2229-L2239
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/AbstractExtraLanguageGenerator.java
AbstractExtraLanguageGenerator.getExpectedType
protected LightweightTypeReference getExpectedType(XtendExecutable executable, JvmTypeReference declaredReturnType) { if (declaredReturnType == null) { // Try to get any inferred return type. if (executable instanceof XtendFunction) { final XtendFunction function = (XtendFunction) executable; final JvmOperation operation = this.sarlAssociations.getDirectlyInferredOperation(function); if (operation != null) { return Utils.toLightweightTypeReference(operation.getReturnType(), this.services); } } if (!getEarlyExitComputer().isEarlyExit(executable.getExpression())) { return getExpectedType(executable.getExpression()); } return null; } if (!"void".equals(declaredReturnType.getIdentifier())) { //$NON-NLS-1$ return Utils.toLightweightTypeReference(declaredReturnType, this.services); } return null; }
java
protected LightweightTypeReference getExpectedType(XtendExecutable executable, JvmTypeReference declaredReturnType) { if (declaredReturnType == null) { // Try to get any inferred return type. if (executable instanceof XtendFunction) { final XtendFunction function = (XtendFunction) executable; final JvmOperation operation = this.sarlAssociations.getDirectlyInferredOperation(function); if (operation != null) { return Utils.toLightweightTypeReference(operation.getReturnType(), this.services); } } if (!getEarlyExitComputer().isEarlyExit(executable.getExpression())) { return getExpectedType(executable.getExpression()); } return null; } if (!"void".equals(declaredReturnType.getIdentifier())) { //$NON-NLS-1$ return Utils.toLightweightTypeReference(declaredReturnType, this.services); } return null; }
[ "protected", "LightweightTypeReference", "getExpectedType", "(", "XtendExecutable", "executable", ",", "JvmTypeReference", "declaredReturnType", ")", "{", "if", "(", "declaredReturnType", "==", "null", ")", "{", "// Try to get any inferred return type.", "if", "(", "executa...
Replies the expected type of the given executable. @param executable the executable. @param declaredReturnType the declared return type, if one. @return the expected type or {@code null} if none ({@code void}).
[ "Replies", "the", "expected", "type", "of", "the", "given", "executable", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/AbstractExtraLanguageGenerator.java#L789-L808
cdapio/tigon
tigon-api/src/main/java/co/cask/tigon/internal/io/Schema.java
Schema.enumWith
public static Schema enumWith(Iterable<String> values) { Set<String> uniqueValues = ImmutableSet.copyOf(values); Preconditions.checkArgument(uniqueValues.size() > 0, "No enum value provided."); Preconditions.checkArgument(Iterables.size(values) == uniqueValues.size(), "Duplicate enum value is not allowed."); return new Schema(Type.ENUM, uniqueValues, null, null, null, null, null, null); }
java
public static Schema enumWith(Iterable<String> values) { Set<String> uniqueValues = ImmutableSet.copyOf(values); Preconditions.checkArgument(uniqueValues.size() > 0, "No enum value provided."); Preconditions.checkArgument(Iterables.size(values) == uniqueValues.size(), "Duplicate enum value is not allowed."); return new Schema(Type.ENUM, uniqueValues, null, null, null, null, null, null); }
[ "public", "static", "Schema", "enumWith", "(", "Iterable", "<", "String", ">", "values", ")", "{", "Set", "<", "String", ">", "uniqueValues", "=", "ImmutableSet", ".", "copyOf", "(", "values", ")", ";", "Preconditions", ".", "checkArgument", "(", "uniqueValu...
Creates a {@link Schema} of {@link Type#ENUM ENUM} type, with the given enum values. The set of values given should be unique and must contains at least one value. The ordering of values in the enum type schema would be the same as the {@link Iterable#iterator()} order. @param values Enum values. @return A {@link Schema} of {@link Type#ENUM ENUM} type.
[ "Creates", "a", "{", "@link", "Schema", "}", "of", "{", "@link", "Type#ENUM", "ENUM", "}", "type", "with", "the", "given", "enum", "values", ".", "The", "set", "of", "values", "given", "should", "be", "unique", "and", "must", "contains", "at", "least", ...
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/internal/io/Schema.java#L147-L152
h2oai/h2o-2
src/main/java/hex/deeplearning/Neurons.java
Softmax.bprop
protected void bprop(int target) { assert (target != missing_int_value); // no correction of weights/biases for missing label float m = momentum(); float r = _minfo.adaDelta() ? 0 : rate(_minfo.get_processed_total()) * (1f - m); float g; //partial derivative dE/dy * dy/dnet final float rows = _a.size(); for( int row = 0; row < rows; row++ ) { final float t = (row == target ? 1f : 0f); final float y = _a.get(row); //dy/dnet = derivative of softmax = (1-y)*y if (params.loss == Loss.CrossEntropy) { //nothing else needed, -dCE/dy * dy/dnet = target - y //cf. http://www.stanford.edu/group/pdplab/pdphandbook/handbookch6.html g = t - y; } else { assert(params.loss == Loss.MeanSquare); //-dMSE/dy = target-y g = (t - y) * (1f - y) * y; } // this call expects dE/dnet bprop(row, g, r, m); } }
java
protected void bprop(int target) { assert (target != missing_int_value); // no correction of weights/biases for missing label float m = momentum(); float r = _minfo.adaDelta() ? 0 : rate(_minfo.get_processed_total()) * (1f - m); float g; //partial derivative dE/dy * dy/dnet final float rows = _a.size(); for( int row = 0; row < rows; row++ ) { final float t = (row == target ? 1f : 0f); final float y = _a.get(row); //dy/dnet = derivative of softmax = (1-y)*y if (params.loss == Loss.CrossEntropy) { //nothing else needed, -dCE/dy * dy/dnet = target - y //cf. http://www.stanford.edu/group/pdplab/pdphandbook/handbookch6.html g = t - y; } else { assert(params.loss == Loss.MeanSquare); //-dMSE/dy = target-y g = (t - y) * (1f - y) * y; } // this call expects dE/dnet bprop(row, g, r, m); } }
[ "protected", "void", "bprop", "(", "int", "target", ")", "{", "assert", "(", "target", "!=", "missing_int_value", ")", ";", "// no correction of weights/biases for missing label", "float", "m", "=", "momentum", "(", ")", ";", "float", "r", "=", "_minfo", ".", ...
Backpropagation for classification Update every weight as follows: w += -rate * dE/dw Compute dE/dw via chain rule: dE/dw = dE/dy * dy/dnet * dnet/dw, where net = sum(xi*wi)+b and y = activation function @param target actual class label
[ "Backpropagation", "for", "classification", "Update", "every", "weight", "as", "follows", ":", "w", "+", "=", "-", "rate", "*", "dE", "/", "dw", "Compute", "dE", "/", "dw", "via", "chain", "rule", ":", "dE", "/", "dw", "=", "dE", "/", "dy", "*", "d...
train
https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/deeplearning/Neurons.java#L1003-L1025
Erudika/para
para-client/src/main/java/com/erudika/para/client/ParaClient.java
ParaClient.deleteChildren
public void deleteChildren(ParaObject obj, String type2) { if (obj == null || obj.getId() == null || type2 == null) { return; } MultivaluedMap<String, String> params = new MultivaluedHashMap<>(); params.putSingle("childrenonly", "true"); String url = Utils.formatMessage("{0}/links/{1}", obj.getObjectURI(), type2); invokeDelete(url, params); }
java
public void deleteChildren(ParaObject obj, String type2) { if (obj == null || obj.getId() == null || type2 == null) { return; } MultivaluedMap<String, String> params = new MultivaluedHashMap<>(); params.putSingle("childrenonly", "true"); String url = Utils.formatMessage("{0}/links/{1}", obj.getObjectURI(), type2); invokeDelete(url, params); }
[ "public", "void", "deleteChildren", "(", "ParaObject", "obj", ",", "String", "type2", ")", "{", "if", "(", "obj", "==", "null", "||", "obj", ".", "getId", "(", ")", "==", "null", "||", "type2", "==", "null", ")", "{", "return", ";", "}", "Multivalued...
Deletes all child objects permanently. @param obj the object to execute this method on @param type2 the children's type.
[ "Deletes", "all", "child", "objects", "permanently", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L1158-L1166
Azure/azure-sdk-for-java
datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/TrustedIdProvidersInner.java
TrustedIdProvidersInner.updateAsync
public Observable<TrustedIdProviderInner> updateAsync(String resourceGroupName, String accountName, String trustedIdProviderName, UpdateTrustedIdProviderParameters parameters) { return updateWithServiceResponseAsync(resourceGroupName, accountName, trustedIdProviderName, parameters).map(new Func1<ServiceResponse<TrustedIdProviderInner>, TrustedIdProviderInner>() { @Override public TrustedIdProviderInner call(ServiceResponse<TrustedIdProviderInner> response) { return response.body(); } }); }
java
public Observable<TrustedIdProviderInner> updateAsync(String resourceGroupName, String accountName, String trustedIdProviderName, UpdateTrustedIdProviderParameters parameters) { return updateWithServiceResponseAsync(resourceGroupName, accountName, trustedIdProviderName, parameters).map(new Func1<ServiceResponse<TrustedIdProviderInner>, TrustedIdProviderInner>() { @Override public TrustedIdProviderInner call(ServiceResponse<TrustedIdProviderInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TrustedIdProviderInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "trustedIdProviderName", ",", "UpdateTrustedIdProviderParameters", "parameters", ")", "{", "return", "updateWithServic...
Updates the specified trusted identity provider. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Store account. @param trustedIdProviderName The name of the trusted identity provider. This is used for differentiation of providers in the account. @param parameters Parameters supplied to update the trusted identity provider. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TrustedIdProviderInner object
[ "Updates", "the", "specified", "trusted", "identity", "provider", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/TrustedIdProvidersInner.java#L538-L545
ocelotds/ocelot
ocelot-dashboard/src/main/java/org/ocelotds/dashboard/services/ServiceTools.java
ServiceTools.getTemplateOfIterable
String getTemplateOfIterable(Type[] actualTypeArguments, IJsonMarshaller jsonMarshaller) { String res = "["; for (Type actualTypeArgument : actualTypeArguments) { String template = _getTemplateOfType(actualTypeArgument, jsonMarshaller); res += template + "," + template; break; } return res + "]"; }
java
String getTemplateOfIterable(Type[] actualTypeArguments, IJsonMarshaller jsonMarshaller) { String res = "["; for (Type actualTypeArgument : actualTypeArguments) { String template = _getTemplateOfType(actualTypeArgument, jsonMarshaller); res += template + "," + template; break; } return res + "]"; }
[ "String", "getTemplateOfIterable", "(", "Type", "[", "]", "actualTypeArguments", ",", "IJsonMarshaller", "jsonMarshaller", ")", "{", "String", "res", "=", "\"[\"", ";", "for", "(", "Type", "actualTypeArgument", ":", "actualTypeArguments", ")", "{", "String", "temp...
Get template of iterable class from generic type @param actualTypeArguments @return
[ "Get", "template", "of", "iterable", "class", "from", "generic", "type" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-dashboard/src/main/java/org/ocelotds/dashboard/services/ServiceTools.java#L267-L275
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/denoise/wavelet/UtilDenoiseWavelet.java
UtilDenoiseWavelet.universalThreshold
public static double universalThreshold(ImageGray image , double noiseSigma ) { int w = image.width; int h = image.height; return noiseSigma*Math.sqrt(2*Math.log(Math.max(w,h))); }
java
public static double universalThreshold(ImageGray image , double noiseSigma ) { int w = image.width; int h = image.height; return noiseSigma*Math.sqrt(2*Math.log(Math.max(w,h))); }
[ "public", "static", "double", "universalThreshold", "(", "ImageGray", "image", ",", "double", "noiseSigma", ")", "{", "int", "w", "=", "image", ".", "width", ";", "int", "h", "=", "image", ".", "height", ";", "return", "noiseSigma", "*", "Math", ".", "sq...
<p> Computes the universal threshold defined in [1], which is the threshold used by VisuShrink. The same threshold is used by other algorithms. </p> <p> threshold = &sigma; sqrt( 2*log(max(w,h))<br> where (w,h) is the image's width and height. </p> <p> [1] D. L. Donoho and I. M. Johnstone, "Ideal spatial adaption via wavelet shrinkage." Biometrika, vol 81, pp. 425-455, 1994 </p> @param image Input image. Only the width and height are used in computing this thresold. @param noiseSigma Estimated noise sigma. @return universal threshold.
[ "<p", ">", "Computes", "the", "universal", "threshold", "defined", "in", "[", "1", "]", "which", "is", "the", "threshold", "used", "by", "VisuShrink", ".", "The", "same", "threshold", "is", "used", "by", "other", "algorithms", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/denoise/wavelet/UtilDenoiseWavelet.java#L101-L106
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/XmlReader.java
XmlReader.readFloat
public float readFloat(float defaultValue, String attribute) { return Float.parseFloat(getValue(String.valueOf(defaultValue), attribute)); }
java
public float readFloat(float defaultValue, String attribute) { return Float.parseFloat(getValue(String.valueOf(defaultValue), attribute)); }
[ "public", "float", "readFloat", "(", "float", "defaultValue", ",", "String", "attribute", ")", "{", "return", "Float", ".", "parseFloat", "(", "getValue", "(", "String", ".", "valueOf", "(", "defaultValue", ")", ",", "attribute", ")", ")", ";", "}" ]
Read a float. @param defaultValue The value returned if attribute not found. @param attribute The float name (must not be <code>null</code>). @return The float value. @throws LionEngineException If invalid argument.
[ "Read", "a", "float", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/XmlReader.java#L260-L263
mfornos/humanize
humanize-slim/src/main/java/humanize/text/ExtendedMessageFormat.java
ExtendedMessageFormat.getQuotedString
private void getQuotedString(String pattern, ParsePosition pos, boolean escapingOn) { appendQuotedString(pattern, pos, null, escapingOn); }
java
private void getQuotedString(String pattern, ParsePosition pos, boolean escapingOn) { appendQuotedString(pattern, pos, null, escapingOn); }
[ "private", "void", "getQuotedString", "(", "String", "pattern", ",", "ParsePosition", "pos", ",", "boolean", "escapingOn", ")", "{", "appendQuotedString", "(", "pattern", ",", "pos", ",", "null", ",", "escapingOn", ")", ";", "}" ]
Consume quoted string only @param pattern pattern to parse @param pos current parse position @param escapingOn whether to process escaped quotes
[ "Consume", "quoted", "string", "only" ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/text/ExtendedMessageFormat.java#L475-L479
mkopylec/charon-spring-boot-starter
src/main/java/com/github/mkopylec/charon/core/http/RequestForwarder.java
RequestForwarder.prepareForwardedRequestHeaders
protected void prepareForwardedRequestHeaders(RequestData request, ForwardDestination destination) { HttpHeaders headers = request.getHeaders(); headers.set(HOST, destination.getUri().getAuthority()); headers.remove(TE); }
java
protected void prepareForwardedRequestHeaders(RequestData request, ForwardDestination destination) { HttpHeaders headers = request.getHeaders(); headers.set(HOST, destination.getUri().getAuthority()); headers.remove(TE); }
[ "protected", "void", "prepareForwardedRequestHeaders", "(", "RequestData", "request", ",", "ForwardDestination", "destination", ")", "{", "HttpHeaders", "headers", "=", "request", ".", "getHeaders", "(", ")", ";", "headers", ".", "set", "(", "HOST", ",", "destinat...
Remove any protocol-level headers from the clients request that do not apply to the new request we are sending to the remote server. @param request @param destination
[ "Remove", "any", "protocol", "-", "level", "headers", "from", "the", "clients", "request", "that", "do", "not", "apply", "to", "the", "new", "request", "we", "are", "sending", "to", "the", "remote", "server", "." ]
train
https://github.com/mkopylec/charon-spring-boot-starter/blob/9a3aa4ffd0bae6a1f94cd983bbf17cd36f4ff594/src/main/java/com/github/mkopylec/charon/core/http/RequestForwarder.java#L114-L118
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/spell/LuceneSpellChecker.java
LuceneSpellChecker.getFulltextStatement
private String getFulltextStatement(QueryRootNode aqt) throws RepositoryException { final String[] stmt = new String[1]; aqt.accept(new TraversingQueryNodeVisitor() { @Override public Object visit(RelationQueryNode node, Object o) throws RepositoryException { if (stmt[0] == null && node.getOperation() == RelationQueryNode.OPERATION_SPELLCHECK) { stmt[0] = node.getStringValue(); } return super.visit(node, o); } }, null); return stmt[0]; }
java
private String getFulltextStatement(QueryRootNode aqt) throws RepositoryException { final String[] stmt = new String[1]; aqt.accept(new TraversingQueryNodeVisitor() { @Override public Object visit(RelationQueryNode node, Object o) throws RepositoryException { if (stmt[0] == null && node.getOperation() == RelationQueryNode.OPERATION_SPELLCHECK) { stmt[0] = node.getStringValue(); } return super.visit(node, o); } }, null); return stmt[0]; }
[ "private", "String", "getFulltextStatement", "(", "QueryRootNode", "aqt", ")", "throws", "RepositoryException", "{", "final", "String", "[", "]", "stmt", "=", "new", "String", "[", "1", "]", ";", "aqt", ".", "accept", "(", "new", "TraversingQueryNodeVisitor", ...
Returns the fulltext statement of a spellcheck relation query node or <code>null</code> if none exists in the abstract query tree. @param aqt the abstract query tree. @return the fulltext statement or <code>null</code>. @throws RepositoryException
[ "Returns", "the", "fulltext", "statement", "of", "a", "spellcheck", "relation", "query", "node", "or", "<code", ">", "null<", "/", "code", ">", "if", "none", "exists", "in", "the", "abstract", "query", "tree", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/spell/LuceneSpellChecker.java#L198-L214
riversun/d6
src/main/java/org/riversun/d6/core/D6Crud.java
D6Crud.execUpdate
public boolean execUpdate(D6Model modelObj, D6Inex includeExcludeColumnNames) { boolean retVal = false; if (modelObj == null) { return retVal; } final D6CrudUpdateHelper d6CrudUpdateHelper = new D6CrudUpdateHelper(modelObj.getClass()); final String updateSQL = d6CrudUpdateHelper.createUpdatePreparedSQLStatement(includeExcludeColumnNames); log("#execUpdate updateSQL=" + updateSQL); final Connection conn = createConnection(); try { PreparedStatement preparedStmt = null; // There is a possibility that the error occurs in one single update // statement. // Therefore, turn the auto commit off. conn.setAutoCommit(false); preparedStmt = conn.prepareStatement(updateSQL); d6CrudUpdateHelper.map(modelObj, preparedStmt, includeExcludeColumnNames); // execute SQL preparedStmt.executeUpdate(); // finally commit conn.commit(); retVal = true; } catch (SQLException e) { loge("#execUpdate", e); retVal = false; } catch (D6Exception e) { // catch from helper loge("#execUpdate", e); retVal = false; } finally { try { conn.close(); } catch (SQLException e) { retVal = false; loge("#execUpdate", e); } } return retVal; }
java
public boolean execUpdate(D6Model modelObj, D6Inex includeExcludeColumnNames) { boolean retVal = false; if (modelObj == null) { return retVal; } final D6CrudUpdateHelper d6CrudUpdateHelper = new D6CrudUpdateHelper(modelObj.getClass()); final String updateSQL = d6CrudUpdateHelper.createUpdatePreparedSQLStatement(includeExcludeColumnNames); log("#execUpdate updateSQL=" + updateSQL); final Connection conn = createConnection(); try { PreparedStatement preparedStmt = null; // There is a possibility that the error occurs in one single update // statement. // Therefore, turn the auto commit off. conn.setAutoCommit(false); preparedStmt = conn.prepareStatement(updateSQL); d6CrudUpdateHelper.map(modelObj, preparedStmt, includeExcludeColumnNames); // execute SQL preparedStmt.executeUpdate(); // finally commit conn.commit(); retVal = true; } catch (SQLException e) { loge("#execUpdate", e); retVal = false; } catch (D6Exception e) { // catch from helper loge("#execUpdate", e); retVal = false; } finally { try { conn.close(); } catch (SQLException e) { retVal = false; loge("#execUpdate", e); } } return retVal; }
[ "public", "boolean", "execUpdate", "(", "D6Model", "modelObj", ",", "D6Inex", "includeExcludeColumnNames", ")", "{", "boolean", "retVal", "=", "false", ";", "if", "(", "modelObj", "==", "null", ")", "{", "return", "retVal", ";", "}", "final", "D6CrudUpdateHelp...
Update Model Object @param modelObj @param includeExcludeColumnNames @return true:DB operation success false:failure
[ "Update", "Model", "Object" ]
train
https://github.com/riversun/d6/blob/2798bd876b9380dbfea8182d11ad306cb1b0e114/src/main/java/org/riversun/d6/core/D6Crud.java#L229-L287
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/config/util/BeanDefinitionParserUtils.java
BeanDefinitionParserUtils.setPropertyValue
public static void setPropertyValue(BeanDefinitionBuilder builder, String propertyValue, String propertyName) { if (StringUtils.hasText(propertyValue)) { builder.addPropertyValue(propertyName, propertyValue); } }
java
public static void setPropertyValue(BeanDefinitionBuilder builder, String propertyValue, String propertyName) { if (StringUtils.hasText(propertyValue)) { builder.addPropertyValue(propertyName, propertyValue); } }
[ "public", "static", "void", "setPropertyValue", "(", "BeanDefinitionBuilder", "builder", ",", "String", "propertyValue", ",", "String", "propertyName", ")", "{", "if", "(", "StringUtils", ".", "hasText", "(", "propertyValue", ")", ")", "{", "builder", ".", "addP...
Sets the property value on bean definition in case value is set properly. @param builder the bean definition builder to be configured @param propertyValue the property value @param propertyName the name of the property
[ "Sets", "the", "property", "value", "on", "bean", "definition", "in", "case", "value", "is", "set", "properly", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/util/BeanDefinitionParserUtils.java#L48-L52
jmxtrans/jmxtrans
jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/naming/KeyUtils.java
KeyUtils.getPrefixedKeyString
public static String getPrefixedKeyString(Query query, Result result, List<String> typeNames) { StringBuilder sb = new StringBuilder(); addTypeName(query, result, typeNames, sb); addKeyString(query, result, sb); return sb.toString(); }
java
public static String getPrefixedKeyString(Query query, Result result, List<String> typeNames) { StringBuilder sb = new StringBuilder(); addTypeName(query, result, typeNames, sb); addKeyString(query, result, sb); return sb.toString(); }
[ "public", "static", "String", "getPrefixedKeyString", "(", "Query", "query", ",", "Result", "result", ",", "List", "<", "String", ">", "typeNames", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "addTypeName", "(", "query", ",",...
Gets the key string, without rootPrefix or Alias @param query the query @param result the result @param typeNames the type names @return the key string
[ "Gets", "the", "key", "string", "without", "rootPrefix", "or", "Alias" ]
train
https://github.com/jmxtrans/jmxtrans/blob/496f342de3bcf2c2226626374b7a16edf8f4ba2a/jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/naming/KeyUtils.java#L89-L94
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/MjdbcFactory.java
MjdbcFactory.createDataSource
public static DataSource createDataSource(String url, String userName, String password) throws SQLException { try { return MjdbcPoolBinder.createDataSource(url, userName, password); } catch (NoClassDefFoundError ex) { throw new NoClassDefFoundError(ERROR_COULDNT_FIND_POOL_PROVIDER); } }
java
public static DataSource createDataSource(String url, String userName, String password) throws SQLException { try { return MjdbcPoolBinder.createDataSource(url, userName, password); } catch (NoClassDefFoundError ex) { throw new NoClassDefFoundError(ERROR_COULDNT_FIND_POOL_PROVIDER); } }
[ "public", "static", "DataSource", "createDataSource", "(", "String", "url", ",", "String", "userName", ",", "String", "password", ")", "throws", "SQLException", "{", "try", "{", "return", "MjdbcPoolBinder", ".", "createDataSource", "(", "url", ",", "userName", "...
Returns new Pooled {@link DataSource} implementation <p/> In case this function won't work - use {@link #createDataSource(java.util.Properties)} @param url Database connection url @param userName Database user name @param password Database user password @return new Pooled {@link DataSource} implementation @throws SQLException
[ "Returns", "new", "Pooled", "{", "@link", "DataSource", "}", "implementation", "<p", "/", ">", "In", "case", "this", "function", "won", "t", "work", "-", "use", "{", "@link", "#createDataSource", "(", "java", ".", "util", ".", "Properties", ")", "}" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/MjdbcFactory.java#L160-L166
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java
AsyncMutateInBuilder.arrayPrependAll
public <T> AsyncMutateInBuilder arrayPrependAll(String path, Collection<T> values, SubdocOptionsBuilder optionsBuilder) { this.mutationSpecs.add(new MutationSpec(Mutation.ARRAY_PUSH_FIRST, path, new MultiValue<T>(values), optionsBuilder)); return this; }
java
public <T> AsyncMutateInBuilder arrayPrependAll(String path, Collection<T> values, SubdocOptionsBuilder optionsBuilder) { this.mutationSpecs.add(new MutationSpec(Mutation.ARRAY_PUSH_FIRST, path, new MultiValue<T>(values), optionsBuilder)); return this; }
[ "public", "<", "T", ">", "AsyncMutateInBuilder", "arrayPrependAll", "(", "String", "path", ",", "Collection", "<", "T", ">", "values", ",", "SubdocOptionsBuilder", "optionsBuilder", ")", "{", "this", ".", "mutationSpecs", ".", "add", "(", "new", "MutationSpec", ...
Prepend multiple values at once in an existing array, pushing all values in the collection's iteration order to the front/start of the array. First value becomes the first element of the array, second value the second, etc... All existing values are shifted right in the array, by the number of inserted elements. Each item in the collection is inserted as an individual element of the array, but a bit of overhead is saved compared to individual {@link #arrayPrepend(String, Object, boolean)} (String, Object)} by grouping mutations in a single packet. For example given an array [ A, B, C ], prepending the values X and Y yields [ X, Y, A, B, C ] and not [ [ X, Y ], A, B, C ]. @param path the path of the array. @param values the collection of values to insert at the front of the array as individual elements. @param optionsBuilder {@link SubdocOptionsBuilder} @param <T> the type of data in the collection (must be JSON serializable).
[ "Prepend", "multiple", "values", "at", "once", "in", "an", "existing", "array", "pushing", "all", "values", "in", "the", "collection", "s", "iteration", "order", "to", "the", "front", "/", "start", "of", "the", "array", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java#L933-L936
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostBodyUtil.java
HttpPostBodyUtil.findNonWhitespace
static int findNonWhitespace(String sb, int offset) { int result; for (result = offset; result < sb.length(); result ++) { if (!Character.isWhitespace(sb.charAt(result))) { break; } } return result; }
java
static int findNonWhitespace(String sb, int offset) { int result; for (result = offset; result < sb.length(); result ++) { if (!Character.isWhitespace(sb.charAt(result))) { break; } } return result; }
[ "static", "int", "findNonWhitespace", "(", "String", "sb", ",", "int", "offset", ")", "{", "int", "result", ";", "for", "(", "result", "=", "offset", ";", "result", "<", "sb", ".", "length", "(", ")", ";", "result", "++", ")", "{", "if", "(", "!", ...
Find the first non whitespace @return the rank of the first non whitespace
[ "Find", "the", "first", "non", "whitespace" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostBodyUtil.java#L129-L137
FlyingHe/UtilsMaven
src/main/java/com/github/flyinghe/tools/ImgCompressUtils.java
ImgCompressUtils.imgCompressByWH
public static void imgCompressByWH(String srcFile, String desFile, int width, int height, Float quality) { ImgCompressUtils.imgCompressByWH(srcFile, desFile, width, height, quality, false); }
java
public static void imgCompressByWH(String srcFile, String desFile, int width, int height, Float quality) { ImgCompressUtils.imgCompressByWH(srcFile, desFile, width, height, quality, false); }
[ "public", "static", "void", "imgCompressByWH", "(", "String", "srcFile", ",", "String", "desFile", ",", "int", "width", ",", "int", "height", ",", "Float", "quality", ")", "{", "ImgCompressUtils", ".", "imgCompressByWH", "(", "srcFile", ",", "desFile", ",", ...
根据指定宽高和压缩质量进行压缩,如果指定宽或者高大于源图片则按照源图片大小宽高压缩 @param srcFile 指定原图片地址 @param desFile 指定压缩后图片存放地址,包括图片名称 @param width 指定压缩宽 @param height 指定压缩高 @param quality 指定压缩质量,范围[0.0,1.0],如果指定为null则按照默认值
[ "根据指定宽高和压缩质量进行压缩,如果指定宽或者高大于源图片则按照源图片大小宽高压缩" ]
train
https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/ImgCompressUtils.java#L37-L39
gpein/jcache-jee7
src/main/java/io/github/gpein/jcache/service/JCacheService.java
JCacheService.setStatistics
public void setStatistics(boolean enabled) { all().forEach(cache -> updateStatistics(cache.getName(), new Cache(false, enabled))); }
java
public void setStatistics(boolean enabled) { all().forEach(cache -> updateStatistics(cache.getName(), new Cache(false, enabled))); }
[ "public", "void", "setStatistics", "(", "boolean", "enabled", ")", "{", "all", "(", ")", ".", "forEach", "(", "cache", "->", "updateStatistics", "(", "cache", ".", "getName", "(", ")", ",", "new", "Cache", "(", "false", ",", "enabled", ")", ")", ")", ...
Enable or disable statistics for all caches @param enabled true for enabling all
[ "Enable", "or", "disable", "statistics", "for", "all", "caches" ]
train
https://github.com/gpein/jcache-jee7/blob/492dd3bb6423cdfb064e7005952a7b79fe4cd7aa/src/main/java/io/github/gpein/jcache/service/JCacheService.java#L90-L92
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java
ProcessContext.addDataUsageFor
public void addDataUsageFor(String activity, String attribute) throws CompatibilityException { setDataUsageFor(activity, attribute, new HashSet<>(validUsageModes)); }
java
public void addDataUsageFor(String activity, String attribute) throws CompatibilityException { setDataUsageFor(activity, attribute, new HashSet<>(validUsageModes)); }
[ "public", "void", "addDataUsageFor", "(", "String", "activity", ",", "String", "attribute", ")", "throws", "CompatibilityException", "{", "setDataUsageFor", "(", "activity", ",", "attribute", ",", "new", "HashSet", "<>", "(", "validUsageModes", ")", ")", ";", "}...
Adds a data attribute for an activity.<br> The given activity/attributes have to be known by the context, i.e. be contained in the activity/attribute list. @param activity Activity for which the attribute usage is set. @param attribute Attribute used by the given activity. @throws ParameterException @throws CompatibilityException @throws IllegalArgumentException If the given activity/attributes are not known. @see #getActivities() @see #getAttributes() @see #setAttributes(Set)
[ "Adds", "a", "data", "attribute", "for", "an", "activity", ".", "<br", ">", "The", "given", "activity", "/", "attributes", "have", "to", "be", "known", "by", "the", "context", "i", ".", "e", ".", "be", "contained", "in", "the", "activity", "/", "attrib...
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java#L631-L633
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.replaceEntry
public static boolean replaceEntry(File zip, String path, byte[] bytes, File destZip) { return replaceEntry(zip, new ByteSource(path, bytes), destZip); }
java
public static boolean replaceEntry(File zip, String path, byte[] bytes, File destZip) { return replaceEntry(zip, new ByteSource(path, bytes), destZip); }
[ "public", "static", "boolean", "replaceEntry", "(", "File", "zip", ",", "String", "path", ",", "byte", "[", "]", "bytes", ",", "File", "destZip", ")", "{", "return", "replaceEntry", "(", "zip", ",", "new", "ByteSource", "(", "path", ",", "bytes", ")", ...
Copies an existing ZIP file and replaces a given entry in it. @param zip an existing ZIP file (only read). @param path new ZIP entry path. @param bytes new entry bytes (or <code>null</code> if directory). @param destZip new ZIP file created. @return <code>true</code> if the entry was replaced.
[ "Copies", "an", "existing", "ZIP", "file", "and", "replaces", "a", "given", "entry", "in", "it", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2538-L2540
bigdatagenomics/convert
convert/src/main/java/org/bdgenomics/convert/AbstractConverter.java
AbstractConverter.warnOrThrow
protected final void warnOrThrow(final S source, final String message, final Throwable cause, final ConversionStringency stringency, final Logger logger) throws ConversionException { checkNotNull(stringency, logger); if (stringency.isLenient()) { if (cause != null) { logger.warn(String.format("could not convert %s to %s, %s", sourceClass.toString(), targetClass.toString(), message), cause); } else { logger.warn("could not convert {} to {}, {}", sourceClass.toString(), targetClass.toString(), message); } } else if (stringency.isStrict()) { throw new ConversionException(String.format("could not convert %s to %s, %s", sourceClass.toString(), targetClass.toString(), message), cause, source, sourceClass, targetClass); } }
java
protected final void warnOrThrow(final S source, final String message, final Throwable cause, final ConversionStringency stringency, final Logger logger) throws ConversionException { checkNotNull(stringency, logger); if (stringency.isLenient()) { if (cause != null) { logger.warn(String.format("could not convert %s to %s, %s", sourceClass.toString(), targetClass.toString(), message), cause); } else { logger.warn("could not convert {} to {}, {}", sourceClass.toString(), targetClass.toString(), message); } } else if (stringency.isStrict()) { throw new ConversionException(String.format("could not convert %s to %s, %s", sourceClass.toString(), targetClass.toString(), message), cause, source, sourceClass, targetClass); } }
[ "protected", "final", "void", "warnOrThrow", "(", "final", "S", "source", ",", "final", "String", "message", ",", "final", "Throwable", "cause", ",", "final", "ConversionStringency", "stringency", ",", "final", "Logger", "logger", ")", "throws", "ConversionExcepti...
If the conversion stringency is lenient, log a warning with the specified message, or if the conversion stringency is strict, throw a ConversionException with the specified message and cause. @param source source @param message message @param cause cause @param stringency conversion stringency, must not be null @param logger logger, must not be null @throws ConversionException if the specified conversion stringency is strict @throws NullPointerException if either conversion stringency or logger are null
[ "If", "the", "conversion", "stringency", "is", "lenient", "log", "a", "warning", "with", "the", "specified", "message", "or", "if", "the", "conversion", "stringency", "is", "strict", "throw", "a", "ConversionException", "with", "the", "specified", "message", "an...
train
https://github.com/bigdatagenomics/convert/blob/6bc1ddbef933742971af414cbb90fa41c1673358/convert/src/main/java/org/bdgenomics/convert/AbstractConverter.java#L108-L126
synchronoss/cpo-api
cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java
CassandraCpoAdapter.processUpdateGroup
protected <T> long processUpdateGroup(T[] arr, String groupType, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, Session sess) throws CpoException { CpoClass cpoClass; List<CpoFunction> cpoFunctions; CpoFunction cpoFunction; CassandraBoundStatementFactory boundStatementFactory = null; Logger localLogger = logger; try { cpoClass = metaDescriptor.getMetaClass(arr[0]); cpoFunctions = cpoClass.getFunctionGroup(getGroupType(arr[0], groupType, groupName, sess), groupName).getFunctions(); localLogger = LoggerFactory.getLogger(cpoClass.getMetaClass()); int numStatements=0; localLogger.info("=================== Class=<" + arr[0].getClass() + "> Type=<" + groupType + "> Name=<" + groupName + "> ========================="); ArrayList<CassandraBoundStatementFactory> statemetnFactories = new ArrayList<>(); for (T obj : arr) { for (CpoFunction function : cpoFunctions) { boundStatementFactory = new CassandraBoundStatementFactory(sess, this, cpoClass, function, obj, wheres, orderBy, nativeExpressions); statemetnFactories.add(boundStatementFactory); numStatements++; } } executeBatchStatements(sess, statemetnFactories); localLogger.info("=================== " + numStatements + " Updates - Class=<" + arr[0].getClass() + "> Type=<" + groupType + "> Name=<" + groupName + "> ========================="); } catch (Throwable t) { String msg = "ProcessUpdateGroup failed:" + groupType + "," + groupName + "," + arr[0].getClass().getName(); // TODO FIX This // localLogger.error("bound values:" + this.parameterToString(jq)); localLogger.error(msg, t); throw new CpoException(msg, t); } return unknownModifyCount; }
java
protected <T> long processUpdateGroup(T[] arr, String groupType, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, Session sess) throws CpoException { CpoClass cpoClass; List<CpoFunction> cpoFunctions; CpoFunction cpoFunction; CassandraBoundStatementFactory boundStatementFactory = null; Logger localLogger = logger; try { cpoClass = metaDescriptor.getMetaClass(arr[0]); cpoFunctions = cpoClass.getFunctionGroup(getGroupType(arr[0], groupType, groupName, sess), groupName).getFunctions(); localLogger = LoggerFactory.getLogger(cpoClass.getMetaClass()); int numStatements=0; localLogger.info("=================== Class=<" + arr[0].getClass() + "> Type=<" + groupType + "> Name=<" + groupName + "> ========================="); ArrayList<CassandraBoundStatementFactory> statemetnFactories = new ArrayList<>(); for (T obj : arr) { for (CpoFunction function : cpoFunctions) { boundStatementFactory = new CassandraBoundStatementFactory(sess, this, cpoClass, function, obj, wheres, orderBy, nativeExpressions); statemetnFactories.add(boundStatementFactory); numStatements++; } } executeBatchStatements(sess, statemetnFactories); localLogger.info("=================== " + numStatements + " Updates - Class=<" + arr[0].getClass() + "> Type=<" + groupType + "> Name=<" + groupName + "> ========================="); } catch (Throwable t) { String msg = "ProcessUpdateGroup failed:" + groupType + "," + groupName + "," + arr[0].getClass().getName(); // TODO FIX This // localLogger.error("bound values:" + this.parameterToString(jq)); localLogger.error(msg, t); throw new CpoException(msg, t); } return unknownModifyCount; }
[ "protected", "<", "T", ">", "long", "processUpdateGroup", "(", "T", "[", "]", "arr", ",", "String", "groupType", ",", "String", "groupName", ",", "Collection", "<", "CpoWhere", ">", "wheres", ",", "Collection", "<", "CpoOrderBy", ">", "orderBy", ",", "Coll...
DOCUMENT ME! @param arr DOCUMENT ME! @param groupType DOCUMENT ME! @param groupName DOCUMENT ME! @param sess DOCUMENT ME! @return DOCUMENT ME! @throws CpoException DOCUMENT ME!
[ "DOCUMENT", "ME!" ]
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L2133-L2169
alkacon/opencms-core
src/org/opencms/jsp/util/CmsDynamicFunctionBeanWrapper.java
CmsDynamicFunctionBeanWrapper.getJsp
public String getJsp() { if (m_functionBean == null) { return ""; } Format format = m_functionBean.getMainFormat(); CmsDynamicFunctionFormatWrapper wrapper = new CmsDynamicFunctionFormatWrapper(m_cms, format); return wrapper.getJsp(); }
java
public String getJsp() { if (m_functionBean == null) { return ""; } Format format = m_functionBean.getMainFormat(); CmsDynamicFunctionFormatWrapper wrapper = new CmsDynamicFunctionFormatWrapper(m_cms, format); return wrapper.getJsp(); }
[ "public", "String", "getJsp", "(", ")", "{", "if", "(", "m_functionBean", "==", "null", ")", "{", "return", "\"\"", ";", "}", "Format", "format", "=", "m_functionBean", ".", "getMainFormat", "(", ")", ";", "CmsDynamicFunctionFormatWrapper", "wrapper", "=", "...
Gets the JSP file name of the wrapped dynamic function bean's main format.<p> @return a jsp file name
[ "Gets", "the", "JSP", "file", "name", "of", "the", "wrapped", "dynamic", "function", "bean", "s", "main", "format", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsDynamicFunctionBeanWrapper.java#L107-L115
awslabs/amazon-sqs-java-messaging-lib
src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java
AmazonSQSMessagingClientWrapper.changeMessageVisibilityBatch
public ChangeMessageVisibilityBatchResult changeMessageVisibilityBatch(ChangeMessageVisibilityBatchRequest changeMessageVisibilityBatchRequest) throws JMSException { try { prepareRequest(changeMessageVisibilityBatchRequest); return amazonSQSClient.changeMessageVisibilityBatch(changeMessageVisibilityBatchRequest); } catch (AmazonClientException e) { throw handleException(e, "changeMessageVisibilityBatch"); } }
java
public ChangeMessageVisibilityBatchResult changeMessageVisibilityBatch(ChangeMessageVisibilityBatchRequest changeMessageVisibilityBatchRequest) throws JMSException { try { prepareRequest(changeMessageVisibilityBatchRequest); return amazonSQSClient.changeMessageVisibilityBatch(changeMessageVisibilityBatchRequest); } catch (AmazonClientException e) { throw handleException(e, "changeMessageVisibilityBatch"); } }
[ "public", "ChangeMessageVisibilityBatchResult", "changeMessageVisibilityBatch", "(", "ChangeMessageVisibilityBatchRequest", "changeMessageVisibilityBatchRequest", ")", "throws", "JMSException", "{", "try", "{", "prepareRequest", "(", "changeMessageVisibilityBatchRequest", ")", ";", ...
Calls <code>changeMessageVisibilityBatch</code> and wraps <code>AmazonClientException</code>. This is used to for negative acknowledge of messages in batch, so that messages can be received again without any delay. @param changeMessageVisibilityBatchRequest Container for the necessary parameters to execute the changeMessageVisibilityBatch service method on AmazonSQS. @return The response from the changeMessageVisibilityBatch service method, as returned by AmazonSQS. @throws JMSException
[ "Calls", "<code", ">", "changeMessageVisibilityBatch<", "/", "code", ">", "and", "wraps", "<code", ">", "AmazonClientException<", "/", "code", ">", ".", "This", "is", "used", "to", "for", "negative", "acknowledge", "of", "messages", "in", "batch", "so", "that"...
train
https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java#L387-L395
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java
FileMetadata.readMetadata
public Metadata readMetadata(InputStream stream, Charset encoding, String filePath, @Nullable CharHandler otherHandler) { LineCounter lineCounter = new LineCounter(filePath, encoding); FileHashComputer fileHashComputer = new FileHashComputer(filePath); LineOffsetCounter lineOffsetCounter = new LineOffsetCounter(); if (otherHandler != null) { CharHandler[] handlers = {lineCounter, fileHashComputer, lineOffsetCounter, otherHandler}; readFile(stream, encoding, filePath, handlers); } else { CharHandler[] handlers = {lineCounter, fileHashComputer, lineOffsetCounter}; readFile(stream, encoding, filePath, handlers); } return new Metadata(lineCounter.lines(), lineCounter.nonBlankLines(), fileHashComputer.getHash(), lineOffsetCounter.getOriginalLineStartOffsets(), lineOffsetCounter.getOriginalLineEndOffsets(), lineOffsetCounter.getLastValidOffset()); }
java
public Metadata readMetadata(InputStream stream, Charset encoding, String filePath, @Nullable CharHandler otherHandler) { LineCounter lineCounter = new LineCounter(filePath, encoding); FileHashComputer fileHashComputer = new FileHashComputer(filePath); LineOffsetCounter lineOffsetCounter = new LineOffsetCounter(); if (otherHandler != null) { CharHandler[] handlers = {lineCounter, fileHashComputer, lineOffsetCounter, otherHandler}; readFile(stream, encoding, filePath, handlers); } else { CharHandler[] handlers = {lineCounter, fileHashComputer, lineOffsetCounter}; readFile(stream, encoding, filePath, handlers); } return new Metadata(lineCounter.lines(), lineCounter.nonBlankLines(), fileHashComputer.getHash(), lineOffsetCounter.getOriginalLineStartOffsets(), lineOffsetCounter.getOriginalLineEndOffsets(), lineOffsetCounter.getLastValidOffset()); }
[ "public", "Metadata", "readMetadata", "(", "InputStream", "stream", ",", "Charset", "encoding", ",", "String", "filePath", ",", "@", "Nullable", "CharHandler", "otherHandler", ")", "{", "LineCounter", "lineCounter", "=", "new", "LineCounter", "(", "filePath", ",",...
Compute hash of a file ignoring line ends differences. Maximum performance is needed.
[ "Compute", "hash", "of", "a", "file", "ignoring", "line", "ends", "differences", ".", "Maximum", "performance", "is", "needed", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java#L51-L66
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/stereo/StereoTool.java
StereoTool.allCoplanar
public static boolean allCoplanar(Vector3d planeNormal, Point3d pointInPlane, Point3d... points) { for (Point3d point : points) { double distance = StereoTool.signedDistanceToPlane(planeNormal, pointInPlane, point); if (distance < PLANE_TOLERANCE) { continue; } else { return false; } } return true; }
java
public static boolean allCoplanar(Vector3d planeNormal, Point3d pointInPlane, Point3d... points) { for (Point3d point : points) { double distance = StereoTool.signedDistanceToPlane(planeNormal, pointInPlane, point); if (distance < PLANE_TOLERANCE) { continue; } else { return false; } } return true; }
[ "public", "static", "boolean", "allCoplanar", "(", "Vector3d", "planeNormal", ",", "Point3d", "pointInPlane", ",", "Point3d", "...", "points", ")", "{", "for", "(", "Point3d", "point", ":", "points", ")", "{", "double", "distance", "=", "StereoTool", ".", "s...
Check that all the points in the list are coplanar (in the same plane) as the plane defined by the planeNormal and the pointInPlane. @param planeNormal the normal to the plane @param pointInPlane any point know to be in the plane @param points an array of points to test @return false if any of the points is not in the plane
[ "Check", "that", "all", "the", "points", "in", "the", "list", "are", "coplanar", "(", "in", "the", "same", "plane", ")", "as", "the", "plane", "defined", "by", "the", "planeNormal", "and", "the", "pointInPlane", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/stereo/StereoTool.java#L181-L191
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/factory/LinearSolverFactory_DDRM.java
LinearSolverFactory_DDRM.leastSquaresQrPivot
public static LinearSolverDense<DMatrixRMaj> leastSquaresQrPivot(boolean computeNorm2 , boolean computeQ ) { QRColPivDecompositionHouseholderColumn_DDRM decomposition = new QRColPivDecompositionHouseholderColumn_DDRM(); if( computeQ ) return new SolvePseudoInverseQrp_DDRM(decomposition,computeNorm2); else return new LinearSolverQrpHouseCol_DDRM(decomposition,computeNorm2); }
java
public static LinearSolverDense<DMatrixRMaj> leastSquaresQrPivot(boolean computeNorm2 , boolean computeQ ) { QRColPivDecompositionHouseholderColumn_DDRM decomposition = new QRColPivDecompositionHouseholderColumn_DDRM(); if( computeQ ) return new SolvePseudoInverseQrp_DDRM(decomposition,computeNorm2); else return new LinearSolverQrpHouseCol_DDRM(decomposition,computeNorm2); }
[ "public", "static", "LinearSolverDense", "<", "DMatrixRMaj", ">", "leastSquaresQrPivot", "(", "boolean", "computeNorm2", ",", "boolean", "computeQ", ")", "{", "QRColPivDecompositionHouseholderColumn_DDRM", "decomposition", "=", "new", "QRColPivDecompositionHouseholderColumn_DDR...
<p> Linear solver which uses QR pivot decomposition. These solvers can handle singular systems and should never fail. For singular systems, the solution might not be as accurate as a pseudo inverse that uses SVD. </p> <p> For singular systems there are multiple correct solutions. The optimal 2-norm solution is the solution vector with the minimal 2-norm and is unique. If the optimal solution is not computed then the basic solution is returned. See {@link org.ejml.dense.row.linsol.qr.BaseLinearSolverQrp_DDRM} for details. There is only a runtime difference for small matrices, 2-norm solution is slower. </p> <p> Two different solvers are available. Compute Q will compute the Q matrix once then use it multiple times. If the solution for a single vector is being found then this should be set to false. If the pseudo inverse is being found or the solution matrix has more than one columns AND solve is being called numerous multiples times then this should be set to true. </p> @param computeNorm2 true to compute the minimum 2-norm solution for singular systems. Try true. @param computeQ Should it precompute Q or use house holder. Try false; @return Pseudo inverse type solver using QR with column pivots.
[ "<p", ">", "Linear", "solver", "which", "uses", "QR", "pivot", "decomposition", ".", "These", "solvers", "can", "handle", "singular", "systems", "and", "should", "never", "fail", ".", "For", "singular", "systems", "the", "solution", "might", "not", "be", "as...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/factory/LinearSolverFactory_DDRM.java#L156-L164
Mangopay/mangopay2-java-sdk
src/main/java/com/mangopay/core/APIs/ApiBase.java
ApiBase.getObject
protected <T extends Dto> T getObject(Class<T> classOfT, String methodKey, String entityId) throws Exception { return getObject(classOfT, methodKey, entityId, ""); }
java
protected <T extends Dto> T getObject(Class<T> classOfT, String methodKey, String entityId) throws Exception { return getObject(classOfT, methodKey, entityId, ""); }
[ "protected", "<", "T", "extends", "Dto", ">", "T", "getObject", "(", "Class", "<", "T", ">", "classOfT", ",", "String", "methodKey", ",", "String", "entityId", ")", "throws", "Exception", "{", "return", "getObject", "(", "classOfT", ",", "methodKey", ",", ...
Gets the Dto instance from API. @param <T> Type on behalf of which the request is being called. @param classOfT Type on behalf of which the request is being called. @param methodKey Relevant method key. @param entityId Entity identifier. @return The Dto instance returned from API. @throws Exception
[ "Gets", "the", "Dto", "instance", "from", "API", "." ]
train
https://github.com/Mangopay/mangopay2-java-sdk/blob/037cecb44ea62def63b507817fd9961649151157/src/main/java/com/mangopay/core/APIs/ApiBase.java#L306-L308
apache/groovy
subprojects/groovy-macro/src/main/groovy/org/codehaus/groovy/macro/transform/MacroCallTransformingVisitor.java
MacroCallTransformingVisitor.tryMacroMethod
private boolean tryMacroMethod(MethodCallExpression call, ExtensionMethodNode macroMethod, Object[] macroArguments) { Expression result = (Expression) InvokerHelper.invokeStaticMethod( macroMethod.getExtensionMethodNode().getDeclaringClass().getTypeClass(), macroMethod.getName(), macroArguments ); if (result == null) { // Allow macro methods to return null as an indicator that they didn't match a method call return false; } call.setObjectExpression(MACRO_STUB_INSTANCE); call.setMethod(new ConstantExpression(MACRO_STUB_METHOD_NAME)); // TODO check that we reset everything here call.setSpreadSafe(false); call.setSafe(false); call.setImplicitThis(false); call.setArguments(result); call.setGenericsTypes(GenericsType.EMPTY_ARRAY); return true; }
java
private boolean tryMacroMethod(MethodCallExpression call, ExtensionMethodNode macroMethod, Object[] macroArguments) { Expression result = (Expression) InvokerHelper.invokeStaticMethod( macroMethod.getExtensionMethodNode().getDeclaringClass().getTypeClass(), macroMethod.getName(), macroArguments ); if (result == null) { // Allow macro methods to return null as an indicator that they didn't match a method call return false; } call.setObjectExpression(MACRO_STUB_INSTANCE); call.setMethod(new ConstantExpression(MACRO_STUB_METHOD_NAME)); // TODO check that we reset everything here call.setSpreadSafe(false); call.setSafe(false); call.setImplicitThis(false); call.setArguments(result); call.setGenericsTypes(GenericsType.EMPTY_ARRAY); return true; }
[ "private", "boolean", "tryMacroMethod", "(", "MethodCallExpression", "call", ",", "ExtensionMethodNode", "macroMethod", ",", "Object", "[", "]", "macroArguments", ")", "{", "Expression", "result", "=", "(", "Expression", ")", "InvokerHelper", ".", "invokeStaticMethod"...
Attempts to call given macroMethod @param call MethodCallExpression before the transformation @param macroMethod a macro method candidate @param macroArguments arguments to pass to @return true if call succeeded and current call was transformed
[ "Attempts", "to", "call", "given", "macroMethod" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-macro/src/main/groovy/org/codehaus/groovy/macro/transform/MacroCallTransformingVisitor.java#L140-L163
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java
DefaultElementProducer.getIndex
@Override public Section getIndex(String title, int nesting, List<? extends BaseStyler> stylers) throws VectorPrintException, InstantiationException, IllegalAccessException { if (nesting < 1) { throw new VectorPrintException("chapter numbering starts with 1, wrong number: " + nesting); } if (sections.get(nesting) == null) { sections.put(nesting, new ArrayList<>(10)); } Section current; if (nesting == 1) { List<Section> chapters = sections.get(1); current = new Chapter(createElement(title, Paragraph.class, stylers), chapters.size() + 1); chapters.add(current); } else { List<Section> parents = sections.get(nesting - 1); Section parent = parents.get(parents.size() - 1); current = parent.addSection(createParagraph(title, stylers)); sections.get(nesting).add(current); } return styleHelper.style(current, null, stylers); }
java
@Override public Section getIndex(String title, int nesting, List<? extends BaseStyler> stylers) throws VectorPrintException, InstantiationException, IllegalAccessException { if (nesting < 1) { throw new VectorPrintException("chapter numbering starts with 1, wrong number: " + nesting); } if (sections.get(nesting) == null) { sections.put(nesting, new ArrayList<>(10)); } Section current; if (nesting == 1) { List<Section> chapters = sections.get(1); current = new Chapter(createElement(title, Paragraph.class, stylers), chapters.size() + 1); chapters.add(current); } else { List<Section> parents = sections.get(nesting - 1); Section parent = parents.get(parents.size() - 1); current = parent.addSection(createParagraph(title, stylers)); sections.get(nesting).add(current); } return styleHelper.style(current, null, stylers); }
[ "@", "Override", "public", "Section", "getIndex", "(", "String", "title", ",", "int", "nesting", ",", "List", "<", "?", "extends", "BaseStyler", ">", "stylers", ")", "throws", "VectorPrintException", ",", "InstantiationException", ",", "IllegalAccessException", "{...
create the Section, style the title, style the section and return the styled section. @param title @param nesting @param stylers @return @throws VectorPrintException @throws InstantiationException @throws IllegalAccessException
[ "create", "the", "Section", "style", "the", "title", "style", "the", "section", "and", "return", "the", "styled", "section", "." ]
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L592-L612
rapidpro/expressions
java/src/main/java/io/rapidpro/expressions/functions/ExcelFunctions.java
ExcelFunctions.weekday
public static int weekday(EvaluationContext ctx, Object date) { int iso = Conversions.toDateOrDateTime(date, ctx).get(ChronoField.DAY_OF_WEEK); return iso < 7 ? iso + 1 : 1; }
java
public static int weekday(EvaluationContext ctx, Object date) { int iso = Conversions.toDateOrDateTime(date, ctx).get(ChronoField.DAY_OF_WEEK); return iso < 7 ? iso + 1 : 1; }
[ "public", "static", "int", "weekday", "(", "EvaluationContext", "ctx", ",", "Object", "date", ")", "{", "int", "iso", "=", "Conversions", ".", "toDateOrDateTime", "(", "date", ",", "ctx", ")", ".", "get", "(", "ChronoField", ".", "DAY_OF_WEEK", ")", ";", ...
Returns the day of the week of a date (1 for Sunday to 7 for Saturday)
[ "Returns", "the", "day", "of", "the", "week", "of", "a", "date", "(", "1", "for", "Sunday", "to", "7", "for", "Saturday", ")" ]
train
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/java/src/main/java/io/rapidpro/expressions/functions/ExcelFunctions.java#L333-L336
citiususc/hipster
hipster-core/src/main/java/es/usc/citius/hipster/model/function/impl/ADStarNodeExpander.java
ADStarNodeExpander.makeNode
public N makeNode(N from, Transition<A, S> transition){ return nodeFactory.makeNode(from, transition); }
java
public N makeNode(N from, Transition<A, S> transition){ return nodeFactory.makeNode(from, transition); }
[ "public", "N", "makeNode", "(", "N", "from", ",", "Transition", "<", "A", ",", "S", ">", "transition", ")", "{", "return", "nodeFactory", ".", "makeNode", "(", "from", ",", "transition", ")", ";", "}" ]
Creates a new node from the parent and a transition, calling the node factory. @param from parent node @param transition transition between the parent and the new node @return new node created by the node factory
[ "Creates", "a", "new", "node", "from", "the", "parent", "and", "a", "transition", "calling", "the", "node", "factory", "." ]
train
https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/model/function/impl/ADStarNodeExpander.java#L287-L289
roboconf/roboconf-platform
core/roboconf-dm/src/main/java/net/roboconf/dm/internal/api/impl/RandomMngrImpl.java
RandomMngrImpl.findAgentContext
private InstanceContext findAgentContext( Application application, Instance instance ) { Instance scopedInstance = InstanceHelpers.findScopedInstance( instance ); return new InstanceContext( application, scopedInstance ); }
java
private InstanceContext findAgentContext( Application application, Instance instance ) { Instance scopedInstance = InstanceHelpers.findScopedInstance( instance ); return new InstanceContext( application, scopedInstance ); }
[ "private", "InstanceContext", "findAgentContext", "(", "Application", "application", ",", "Instance", "instance", ")", "{", "Instance", "scopedInstance", "=", "InstanceHelpers", ".", "findScopedInstance", "(", "instance", ")", ";", "return", "new", "InstanceContext", ...
Builds an instance context corresponding to an agent. @param application an application @param instance an instance @return an instance context made up of the application and the right scoped instance
[ "Builds", "an", "instance", "context", "corresponding", "to", "an", "agent", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm/src/main/java/net/roboconf/dm/internal/api/impl/RandomMngrImpl.java#L306-L310
xcesco/kripton
kripton-core/src/main/java/com/abubusoft/kripton/common/CharMatcher.java
CharMatcher.collapseFrom
public String collapseFrom(CharSequence sequence, char replacement) { // This implementation avoids unnecessary allocation. int len = sequence.length(); for (int i = 0; i < len; i++) { char c = sequence.charAt(i); if (matches(c)) { if (c == replacement && (i == len - 1 || !matches(sequence.charAt(i + 1)))) { // a no-op replacement i++; } else { StringBuilder builder = new StringBuilder(len) .append(sequence.subSequence(0, i)) .append(replacement); return finishCollapseFrom(sequence, i + 1, len, replacement, builder, true); } } } // no replacement needed return sequence.toString(); }
java
public String collapseFrom(CharSequence sequence, char replacement) { // This implementation avoids unnecessary allocation. int len = sequence.length(); for (int i = 0; i < len; i++) { char c = sequence.charAt(i); if (matches(c)) { if (c == replacement && (i == len - 1 || !matches(sequence.charAt(i + 1)))) { // a no-op replacement i++; } else { StringBuilder builder = new StringBuilder(len) .append(sequence.subSequence(0, i)) .append(replacement); return finishCollapseFrom(sequence, i + 1, len, replacement, builder, true); } } } // no replacement needed return sequence.toString(); }
[ "public", "String", "collapseFrom", "(", "CharSequence", "sequence", ",", "char", "replacement", ")", "{", "// This implementation avoids unnecessary allocation.", "int", "len", "=", "sequence", ".", "length", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";"...
Returns a string copy of the input character sequence, with each group of consecutive characters that match this matcher replaced by a single replacement character. For example: <pre> {@code CharMatcher.anyOf("eko").collapseFrom("bookkeeper", '-')}</pre> ... returns {@code "b-p-r"}. <p>The default implementation uses {@link #indexIn(CharSequence)} to find the first matching character, then iterates the remainder of the sequence calling {@link #matches(char)} for each character. @param sequence the character sequence to replace matching groups of characters in @param replacement the character to append to the result string in place of each group of matching characters in {@code sequence} @return the new string
[ "Returns", "a", "string", "copy", "of", "the", "input", "character", "sequence", "with", "each", "group", "of", "consecutive", "characters", "that", "match", "this", "matcher", "replaced", "by", "a", "single", "replacement", "character", ".", "For", "example", ...
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/CharMatcher.java#L1469-L1489
alkacon/opencms-core
src/org/opencms/ade/configuration/formatters/CmsFormatterBeanParser.java
CmsFormatterBeanParser.parseMetaMappings
private List<CmsMetaMapping> parseMetaMappings(I_CmsXmlContentLocation formatterLoc) { List<CmsMetaMapping> mappings = new ArrayList<CmsMetaMapping>(); for (I_CmsXmlContentValueLocation mappingLoc : formatterLoc.getSubValues(N_META_MAPPING)) { String key = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_KEY)); String element = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_ELEMENT)); String defaultValue = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_DEFAULT)); String orderStr = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_ORDER)); int order = 1000; if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(orderStr)) { try { order = Integer.parseInt(orderStr); } catch (NumberFormatException e) { // nothing to do } } CmsMetaMapping mapping = new CmsMetaMapping(key, element, order, defaultValue); mappings.add(mapping); } return mappings; }
java
private List<CmsMetaMapping> parseMetaMappings(I_CmsXmlContentLocation formatterLoc) { List<CmsMetaMapping> mappings = new ArrayList<CmsMetaMapping>(); for (I_CmsXmlContentValueLocation mappingLoc : formatterLoc.getSubValues(N_META_MAPPING)) { String key = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_KEY)); String element = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_ELEMENT)); String defaultValue = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_DEFAULT)); String orderStr = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_ORDER)); int order = 1000; if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(orderStr)) { try { order = Integer.parseInt(orderStr); } catch (NumberFormatException e) { // nothing to do } } CmsMetaMapping mapping = new CmsMetaMapping(key, element, order, defaultValue); mappings.add(mapping); } return mappings; }
[ "private", "List", "<", "CmsMetaMapping", ">", "parseMetaMappings", "(", "I_CmsXmlContentLocation", "formatterLoc", ")", "{", "List", "<", "CmsMetaMapping", ">", "mappings", "=", "new", "ArrayList", "<", "CmsMetaMapping", ">", "(", ")", ";", "for", "(", "I_CmsXm...
Parses the mappings.<p> @param formatterLoc the formatter value location @return the mappings
[ "Parses", "the", "mappings", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/formatters/CmsFormatterBeanParser.java#L788-L808
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java
AbstractExecutableMemberWriter.addReceiverAnnotations
protected void addReceiverAnnotations(ExecutableElement member, TypeMirror rcvrType, List<? extends AnnotationMirror> annotationMirrors, Content tree) { writer.addReceiverAnnotationInfo(member, rcvrType, annotationMirrors, tree); tree.addContent(Contents.SPACE); tree.addContent(utils.getTypeName(rcvrType, false)); LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, RECEIVER_TYPE, rcvrType); tree.addContent(writer.getTypeParameterLinks(linkInfo)); tree.addContent(Contents.SPACE); tree.addContent("this"); }
java
protected void addReceiverAnnotations(ExecutableElement member, TypeMirror rcvrType, List<? extends AnnotationMirror> annotationMirrors, Content tree) { writer.addReceiverAnnotationInfo(member, rcvrType, annotationMirrors, tree); tree.addContent(Contents.SPACE); tree.addContent(utils.getTypeName(rcvrType, false)); LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, RECEIVER_TYPE, rcvrType); tree.addContent(writer.getTypeParameterLinks(linkInfo)); tree.addContent(Contents.SPACE); tree.addContent("this"); }
[ "protected", "void", "addReceiverAnnotations", "(", "ExecutableElement", "member", ",", "TypeMirror", "rcvrType", ",", "List", "<", "?", "extends", "AnnotationMirror", ">", "annotationMirrors", ",", "Content", "tree", ")", "{", "writer", ".", "addReceiverAnnotationInf...
Add the receiver annotations information. @param member the member to write receiver annotations for. @param rcvrType the receiver type. @param descList list of annotation description. @param tree the content tree to which the information will be added.
[ "Add", "the", "receiver", "annotations", "information", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java#L171-L180
CloudBees-community/syslog-java-client
src/main/java/com/cloudbees/syslog/SyslogMessage.java
SyslogMessage.toSyslogMessage
public void toSyslogMessage(@Nonnull MessageFormat messageFormat, @Nonnull Writer out) throws IOException { switch (messageFormat) { case RFC_3164: toRfc3164SyslogMessage(out); break; case RFC_5424: toRfc5424SyslogMessage(out); break; case RFC_5425: toRfc5425SyslogMessage(out); break; default: throw new IllegalStateException("Unsupported message format '" + messageFormat + "'"); } }
java
public void toSyslogMessage(@Nonnull MessageFormat messageFormat, @Nonnull Writer out) throws IOException { switch (messageFormat) { case RFC_3164: toRfc3164SyslogMessage(out); break; case RFC_5424: toRfc5424SyslogMessage(out); break; case RFC_5425: toRfc5425SyslogMessage(out); break; default: throw new IllegalStateException("Unsupported message format '" + messageFormat + "'"); } }
[ "public", "void", "toSyslogMessage", "(", "@", "Nonnull", "MessageFormat", "messageFormat", ",", "@", "Nonnull", "Writer", "out", ")", "throws", "IOException", "{", "switch", "(", "messageFormat", ")", "{", "case", "RFC_3164", ":", "toRfc3164SyslogMessage", "(", ...
Generates a Syslog message complying to the <a href="http://tools.ietf.org/html/rfc5424">RFC-5424</a> format or to the <a href="http://tools.ietf.org/html/rfc3164">RFC-3164</a> format. @param messageFormat message format @param out output {@linkplain Writer}
[ "Generates", "a", "Syslog", "message", "complying", "to", "the", "<a", "href", "=", "http", ":", "//", "tools", ".", "ietf", ".", "org", "/", "html", "/", "rfc5424", ">", "RFC", "-", "5424<", "/", "a", ">", "format", "or", "to", "the", "<a", "href"...
train
https://github.com/CloudBees-community/syslog-java-client/blob/41e01206e4ce17c6d225ffb443bf19792a3f3c3a/src/main/java/com/cloudbees/syslog/SyslogMessage.java#L268-L282
gosu-lang/gosu-lang
gosu-core/src/main/java/gw/internal/gosu/parser/ClassCache.java
ClassCache.isPackage
private boolean isPackage( StringBuilder s, int i ) { try { String maybePackage = s.substring( 0, i ); if( getPackageMethod().invoke( _module.getModuleClassLoader(), maybePackage ) != null ) { return true; } } catch( Exception e ) { throw new RuntimeException( e ); } return false; }
java
private boolean isPackage( StringBuilder s, int i ) { try { String maybePackage = s.substring( 0, i ); if( getPackageMethod().invoke( _module.getModuleClassLoader(), maybePackage ) != null ) { return true; } } catch( Exception e ) { throw new RuntimeException( e ); } return false; }
[ "private", "boolean", "isPackage", "(", "StringBuilder", "s", ",", "int", "i", ")", "{", "try", "{", "String", "maybePackage", "=", "s", ".", "substring", "(", "0", ",", "i", ")", ";", "if", "(", "getPackageMethod", "(", ")", ".", "invoke", "(", "_mo...
Short-circuit the case where com.foo.Fred is not a class name, but com.foo is a package. Avoid the expensive test for com.foo$Fred as a an inner class (and then com$foo$Fred). <p> Yes, java supports a package and a class having the same name, but in this case we are checking for an inner class of a class having the same name as a package... Let's just not support references to those in Gosu in the name of both sanity and performance. <p> Warning this design decision was not vetted through various committees, architect round tables, community processes, or guys with beards.
[ "Short", "-", "circuit", "the", "case", "where", "com", ".", "foo", ".", "Fred", "is", "not", "a", "class", "name", "but", "com", ".", "foo", "is", "a", "package", ".", "Avoid", "the", "expensive", "test", "for", "com", ".", "foo$Fred", "as", "a", ...
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/ClassCache.java#L219-L230
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java
AStar.addAStarListener
public void addAStarListener(AStarListener<ST, PT> listener) { if (this.listeners == null) { this.listeners = new ArrayList<>(); } this.listeners.add(listener); }
java
public void addAStarListener(AStarListener<ST, PT> listener) { if (this.listeners == null) { this.listeners = new ArrayList<>(); } this.listeners.add(listener); }
[ "public", "void", "addAStarListener", "(", "AStarListener", "<", "ST", ",", "PT", ">", "listener", ")", "{", "if", "(", "this", ".", "listeners", "==", "null", ")", "{", "this", ".", "listeners", "=", "new", "ArrayList", "<>", "(", ")", ";", "}", "th...
Add listener on A* algorithm events. @param listener the listener.
[ "Add", "listener", "on", "A", "*", "algorithm", "events", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java#L91-L96
reactor/reactor-netty
src/main/java/reactor/netty/http/client/HttpClient.java
HttpClient.cookieCodec
public final HttpClient cookieCodec(ClientCookieEncoder encoder) { ClientCookieDecoder decoder = encoder == ClientCookieEncoder.LAX ? ClientCookieDecoder.LAX : ClientCookieDecoder.STRICT; return cookieCodec(encoder, decoder); }
java
public final HttpClient cookieCodec(ClientCookieEncoder encoder) { ClientCookieDecoder decoder = encoder == ClientCookieEncoder.LAX ? ClientCookieDecoder.LAX : ClientCookieDecoder.STRICT; return cookieCodec(encoder, decoder); }
[ "public", "final", "HttpClient", "cookieCodec", "(", "ClientCookieEncoder", "encoder", ")", "{", "ClientCookieDecoder", "decoder", "=", "encoder", "==", "ClientCookieEncoder", ".", "LAX", "?", "ClientCookieDecoder", ".", "LAX", ":", "ClientCookieDecoder", ".", "STRICT...
Configure the {@link ClientCookieEncoder}, {@link ClientCookieDecoder} will be chosen based on the encoder @param encoder the preferred ClientCookieEncoder @return a new {@link HttpClient}
[ "Configure", "the", "{", "@link", "ClientCookieEncoder", "}", "{", "@link", "ClientCookieDecoder", "}", "will", "be", "chosen", "based", "on", "the", "encoder" ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/http/client/HttpClient.java#L459-L463
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.accessRestriction_u2f_id_validate_POST
public void accessRestriction_u2f_id_validate_POST(Long id, String clientData, String registrationData) throws IOException { String qPath = "/me/accessRestriction/u2f/{id}/validate"; StringBuilder sb = path(qPath, id); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "clientData", clientData); addBody(o, "registrationData", registrationData); exec(qPath, "POST", sb.toString(), o); }
java
public void accessRestriction_u2f_id_validate_POST(Long id, String clientData, String registrationData) throws IOException { String qPath = "/me/accessRestriction/u2f/{id}/validate"; StringBuilder sb = path(qPath, id); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "clientData", clientData); addBody(o, "registrationData", registrationData); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "accessRestriction_u2f_id_validate_POST", "(", "Long", "id", ",", "String", "clientData", ",", "String", "registrationData", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/accessRestriction/u2f/{id}/validate\"", ";", "StringBuilder", "...
Validate your U2F account REST: POST /me/accessRestriction/u2f/{id}/validate @param registrationData [required] @param clientData [required] @param id [required] The Id of the restriction
[ "Validate", "your", "U2F", "account" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L4215-L4222
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/collect/Iterators.java
Iterators.removeAll
@CanIgnoreReturnValue public static boolean removeAll(Iterator<?> removeFrom, Collection<?> elementsToRemove) { return removeIf(removeFrom, in(elementsToRemove)); }
java
@CanIgnoreReturnValue public static boolean removeAll(Iterator<?> removeFrom, Collection<?> elementsToRemove) { return removeIf(removeFrom, in(elementsToRemove)); }
[ "@", "CanIgnoreReturnValue", "public", "static", "boolean", "removeAll", "(", "Iterator", "<", "?", ">", "removeFrom", ",", "Collection", "<", "?", ">", "elementsToRemove", ")", "{", "return", "removeIf", "(", "removeFrom", ",", "in", "(", "elementsToRemove", ...
Traverses an iterator and removes every element that belongs to the provided collection. The iterator will be left exhausted: its {@code hasNext()} method will return {@code false}. @param removeFrom the iterator to (potentially) remove elements from @param elementsToRemove the elements to remove @return {@code true} if any element was removed from {@code iterator}
[ "Traverses", "an", "iterator", "and", "removes", "every", "element", "that", "belongs", "to", "the", "provided", "collection", ".", "The", "iterator", "will", "be", "left", "exhausted", ":", "its", "{", "@code", "hasNext", "()", "}", "method", "will", "retur...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/Iterators.java#L220-L223
junit-team/junit4
src/main/java/org/junit/runner/Description.java
Description.createSuiteDescription
public static Description createSuiteDescription(Class<?> testClass, Annotation... annotations) { return new Description(testClass, testClass.getName(), annotations); }
java
public static Description createSuiteDescription(Class<?> testClass, Annotation... annotations) { return new Description(testClass, testClass.getName(), annotations); }
[ "public", "static", "Description", "createSuiteDescription", "(", "Class", "<", "?", ">", "testClass", ",", "Annotation", "...", "annotations", ")", "{", "return", "new", "Description", "(", "testClass", ",", "testClass", ".", "getName", "(", ")", ",", "annota...
Create a <code>Description</code> named after <code>testClass</code> @param testClass A not null {@link Class} containing tests @param annotations meta-data about the test, for downstream interpreters @return a <code>Description</code> of <code>testClass</code>
[ "Create", "a", "<code", ">", "Description<", "/", "code", ">", "named", "after", "<code", ">", "testClass<", "/", "code", ">" ]
train
https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runner/Description.java#L134-L136
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/util/TunableFactory.java
TunableFactory.get
@SuppressWarnings("unchecked") public synchronized static <T extends TunableConstants> T get(Properties p, Class<T> c) { T cfg = getDefault(c); if (p != null && p.containsKey(TUNE_MARKER) && p.containsKey(cfg.getClass().getName() + ".tuning")) { cfg = (T) cfg.clone(); apply(p, cfg); } return cfg; }
java
@SuppressWarnings("unchecked") public synchronized static <T extends TunableConstants> T get(Properties p, Class<T> c) { T cfg = getDefault(c); if (p != null && p.containsKey(TUNE_MARKER) && p.containsKey(cfg.getClass().getName() + ".tuning")) { cfg = (T) cfg.clone(); apply(p, cfg); } return cfg; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "synchronized", "static", "<", "T", "extends", "TunableConstants", ">", "T", "get", "(", "Properties", "p", ",", "Class", "<", "T", ">", "c", ")", "{", "T", "cfg", "=", "getDefault", "(", "c",...
Provide tuning object with initialized information from the properties file. @param p Properties from the execution context @param c Tunable class @param <T> type of requested tunable class @return Created and initialized object
[ "Provide", "tuning", "object", "with", "initialized", "information", "from", "the", "properties", "file", "." ]
train
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/util/TunableFactory.java#L91-L101
line/centraldogma
server/src/main/java/com/linecorp/centraldogma/server/internal/storage/repository/git/GitRepository.java
GitRepository.cloneTo
public void cloneTo(File newRepoDir, GitRepositoryFormat format) { cloneTo(newRepoDir, format, (current, total) -> { /* no-op */ }); }
java
public void cloneTo(File newRepoDir, GitRepositoryFormat format) { cloneTo(newRepoDir, format, (current, total) -> { /* no-op */ }); }
[ "public", "void", "cloneTo", "(", "File", "newRepoDir", ",", "GitRepositoryFormat", "format", ")", "{", "cloneTo", "(", "newRepoDir", ",", "format", ",", "(", "current", ",", "total", ")", "->", "{", "/* no-op */", "}", ")", ";", "}" ]
Clones this repository into a new one. @param format the repository format
[ "Clones", "this", "repository", "into", "a", "new", "one", "." ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/storage/repository/git/GitRepository.java#L1499-L1501
ow2-chameleon/fuchsia
importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveCommandClass.java
ZWaveCommandClass.getInstance
public static ZWaveCommandClass getInstance(int i, ZWaveNode node, ZWaveController controller) { return ZWaveCommandClass.getInstance(i, node, controller, null); }
java
public static ZWaveCommandClass getInstance(int i, ZWaveNode node, ZWaveController controller) { return ZWaveCommandClass.getInstance(i, node, controller, null); }
[ "public", "static", "ZWaveCommandClass", "getInstance", "(", "int", "i", ",", "ZWaveNode", "node", ",", "ZWaveController", "controller", ")", "{", "return", "ZWaveCommandClass", ".", "getInstance", "(", "i", ",", "node", ",", "controller", ",", "null", ")", ";...
Gets an instance of the right command class. Returns null if the command class is not found. @param i the code to instantiate @param node the node this instance commands. @param controller the controller to send messages to. @return the ZWaveCommandClass instance that was instantiated, null otherwise
[ "Gets", "an", "instance", "of", "the", "right", "command", "class", ".", "Returns", "null", "if", "the", "command", "class", "is", "not", "found", "." ]
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveCommandClass.java#L180-L182
phax/ph-schedule
ph-schedule/src/main/java/com/helger/schedule/quartz/trigger/JDK8TriggerBuilder.java
JDK8TriggerBuilder.withIdentity
@Nonnull public JDK8TriggerBuilder <T> withIdentity (final String name) { m_aTriggerKey = new TriggerKey (name, null); return this; }
java
@Nonnull public JDK8TriggerBuilder <T> withIdentity (final String name) { m_aTriggerKey = new TriggerKey (name, null); return this; }
[ "@", "Nonnull", "public", "JDK8TriggerBuilder", "<", "T", ">", "withIdentity", "(", "final", "String", "name", ")", "{", "m_aTriggerKey", "=", "new", "TriggerKey", "(", "name", ",", "null", ")", ";", "return", "this", ";", "}" ]
Use a <code>TriggerKey</code> with the given name and default group to identify the Trigger. <p> If none of the 'withIdentity' methods are set on the JDK8TriggerBuilder, then a random, unique TriggerKey will be generated. </p> @param name the name element for the Trigger's TriggerKey @return the updated JDK8TriggerBuilder @see TriggerKey @see ITrigger#getKey()
[ "Use", "a", "<code", ">", "TriggerKey<", "/", "code", ">", "with", "the", "given", "name", "and", "default", "group", "to", "identify", "the", "Trigger", ".", "<p", ">", "If", "none", "of", "the", "withIdentity", "methods", "are", "set", "on", "the", "...
train
https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-schedule/src/main/java/com/helger/schedule/quartz/trigger/JDK8TriggerBuilder.java#L143-L148
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.readSiblingsForResourceId
public List<CmsResource> readSiblingsForResourceId(CmsUUID resourceId, CmsResourceFilter filter) throws CmsException { CmsResource pseudoResource = new CmsResource( null, resourceId, null, 0, false, 0, null, null, 0, null, 0, null, 0, 0, 0, 0, 0, 0); return readSiblings(pseudoResource, filter); }
java
public List<CmsResource> readSiblingsForResourceId(CmsUUID resourceId, CmsResourceFilter filter) throws CmsException { CmsResource pseudoResource = new CmsResource( null, resourceId, null, 0, false, 0, null, null, 0, null, 0, null, 0, 0, 0, 0, 0, 0); return readSiblings(pseudoResource, filter); }
[ "public", "List", "<", "CmsResource", ">", "readSiblingsForResourceId", "(", "CmsUUID", "resourceId", ",", "CmsResourceFilter", "filter", ")", "throws", "CmsException", "{", "CmsResource", "pseudoResource", "=", "new", "CmsResource", "(", "null", ",", "resourceId", ...
Reads all resources with the given resource id.<p> @param resourceId the resource id for which we want the siblings @param filter the resource filter used to read the resources @return the siblings which share the given resource id @throws CmsException if something goes wrong
[ "Reads", "all", "resources", "with", "the", "given", "resource", "id", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L3450-L3473
dfoerderreuther/console-builder
console-builder/src/main/java/de/eleon/console/builder/AskBuilder.java
AskBuilder.answer
public <T> T answer(Function<String, T> function, final String validationErrorMessage) { validateWith(functionValidator(function, validationErrorMessage)); return function.apply(answer()); }
java
public <T> T answer(Function<String, T> function, final String validationErrorMessage) { validateWith(functionValidator(function, validationErrorMessage)); return function.apply(answer()); }
[ "public", "<", "T", ">", "T", "answer", "(", "Function", "<", "String", ",", "T", ">", "function", ",", "final", "String", "validationErrorMessage", ")", "{", "validateWith", "(", "functionValidator", "(", "function", ",", "validationErrorMessage", ")", ")", ...
Return user input as T @param function {@link Function} or {@link de.eleon.console.builder.functional.Transformer} for value conversion @param validationErrorMessage error message if function conversion fails @param <T> the return type @return user input as T
[ "Return", "user", "input", "as", "T" ]
train
https://github.com/dfoerderreuther/console-builder/blob/814bee4a1a812a3a39a9b239e5eccb525b944e65/console-builder/src/main/java/de/eleon/console/builder/AskBuilder.java#L135-L138
jenkinsci/java-client-api
jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java
JenkinsServer.createJob
public JenkinsServer createJob(FolderJob folder, String jobName, String jobXml) throws IOException { return createJob(folder, jobName, jobXml, false); }
java
public JenkinsServer createJob(FolderJob folder, String jobName, String jobXml) throws IOException { return createJob(folder, jobName, jobXml, false); }
[ "public", "JenkinsServer", "createJob", "(", "FolderJob", "folder", ",", "String", "jobName", ",", "String", "jobXml", ")", "throws", "IOException", "{", "return", "createJob", "(", "folder", ",", "jobName", ",", "jobXml", ",", "false", ")", ";", "}" ]
Create a job on the server using the provided xml and in the provided folder @param folder {@link FolderJob} @param jobName name of the job to be created. @param jobXml the <code>config.xml</code> which should be used to create the job. @throws IOException in case of an error.
[ "Create", "a", "job", "on", "the", "server", "using", "the", "provided", "xml", "and", "in", "the", "provided", "folder" ]
train
https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java#L372-L374
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/PublicEndpoint.java
PublicEndpoint.withMetrics
public PublicEndpoint withMetrics(java.util.Map<String, Double> metrics) { setMetrics(metrics); return this; }
java
public PublicEndpoint withMetrics(java.util.Map<String, Double> metrics) { setMetrics(metrics); return this; }
[ "public", "PublicEndpoint", "withMetrics", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "Double", ">", "metrics", ")", "{", "setMetrics", "(", "metrics", ")", ";", "return", "this", ";", "}" ]
Custom metrics that your app reports to Amazon Pinpoint. @param metrics Custom metrics that your app reports to Amazon Pinpoint. @return Returns a reference to this object so that method calls can be chained together.
[ "Custom", "metrics", "that", "your", "app", "reports", "to", "Amazon", "Pinpoint", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/PublicEndpoint.java#L410-L413
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/report/AbstractOutputFileReporter.java
AbstractOutputFileReporter.createReportFile
private void createReportFile(String reportFileName, String content) { File targetDirectory = new File(getReportDirectory()); if (!targetDirectory.exists()) { if (!targetDirectory.mkdirs()) { throw new CitrusRuntimeException("Unable to create report output directory: " + getReportDirectory()); } } try (Writer fileWriter = new FileWriter(new File(targetDirectory, reportFileName))) { fileWriter.append(content); fileWriter.flush(); log.info("Generated test report: " + targetDirectory + File.separator + reportFileName); } catch (IOException e) { log.error("Failed to create test report", e); } }
java
private void createReportFile(String reportFileName, String content) { File targetDirectory = new File(getReportDirectory()); if (!targetDirectory.exists()) { if (!targetDirectory.mkdirs()) { throw new CitrusRuntimeException("Unable to create report output directory: " + getReportDirectory()); } } try (Writer fileWriter = new FileWriter(new File(targetDirectory, reportFileName))) { fileWriter.append(content); fileWriter.flush(); log.info("Generated test report: " + targetDirectory + File.separator + reportFileName); } catch (IOException e) { log.error("Failed to create test report", e); } }
[ "private", "void", "createReportFile", "(", "String", "reportFileName", ",", "String", "content", ")", "{", "File", "targetDirectory", "=", "new", "File", "(", "getReportDirectory", "(", ")", ")", ";", "if", "(", "!", "targetDirectory", ".", "exists", "(", "...
Creates the HTML report file @param reportFileName The report file to write @param content The String content of the report file
[ "Creates", "the", "HTML", "report", "file" ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/report/AbstractOutputFileReporter.java#L54-L69
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java
ExcelUtil.read03BySax
public static Excel03SaxReader read03BySax(String path, int sheetIndex, RowHandler rowHandler) { try { return new Excel03SaxReader(rowHandler).read(path, sheetIndex); } catch (NoClassDefFoundError e) { throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG); } }
java
public static Excel03SaxReader read03BySax(String path, int sheetIndex, RowHandler rowHandler) { try { return new Excel03SaxReader(rowHandler).read(path, sheetIndex); } catch (NoClassDefFoundError e) { throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG); } }
[ "public", "static", "Excel03SaxReader", "read03BySax", "(", "String", "path", ",", "int", "sheetIndex", ",", "RowHandler", "rowHandler", ")", "{", "try", "{", "return", "new", "Excel03SaxReader", "(", "rowHandler", ")", ".", "read", "(", "path", ",", "sheetInd...
Sax方式读取Excel03 @param path 路径 @param sheetIndex Sheet索引,-1表示全部Sheet, 0表示第一个Sheet @param rowHandler 行处理器 @return {@link Excel03SaxReader} @since 3.2.0
[ "Sax方式读取Excel03" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L174-L180
glookast/commons-timecode
src/main/java/com/glookast/commons/timecode/TimecodeDuration.java
TimecodeDuration.valueOf
public static TimecodeDuration valueOf(String timecode, int timecodeBase) throws IllegalArgumentException { return valueOf(timecode, timecodeBase, StringType.NORMAL); }
java
public static TimecodeDuration valueOf(String timecode, int timecodeBase) throws IllegalArgumentException { return valueOf(timecode, timecodeBase, StringType.NORMAL); }
[ "public", "static", "TimecodeDuration", "valueOf", "(", "String", "timecode", ",", "int", "timecodeBase", ")", "throws", "IllegalArgumentException", "{", "return", "valueOf", "(", "timecode", ",", "timecodeBase", ",", "StringType", ".", "NORMAL", ")", ";", "}" ]
Returns a TimecodeDuration instance for given timecode string and timecode base. Acceptable inputs are the normal representation HH:MM:SS:FF for non drop frame and HH:MM:SS:FF for drop frame @param timecode @param timecodeBase @return the TimecodeDuration @throws IllegalArgumentException
[ "Returns", "a", "TimecodeDuration", "instance", "for", "given", "timecode", "string", "and", "timecode", "base", ".", "Acceptable", "inputs", "are", "the", "normal", "representation", "HH", ":", "MM", ":", "SS", ":", "FF", "for", "non", "drop", "frame", "and...
train
https://github.com/glookast/commons-timecode/blob/ec2f682a51d1cc435d0b42d80de48ff15adb4ee8/src/main/java/com/glookast/commons/timecode/TimecodeDuration.java#L99-L102
googleapis/google-cloud-java
google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchClient.java
ProductSearchClient.updateProduct
public final Product updateProduct(Product product, FieldMask updateMask) { UpdateProductRequest request = UpdateProductRequest.newBuilder().setProduct(product).setUpdateMask(updateMask).build(); return updateProduct(request); }
java
public final Product updateProduct(Product product, FieldMask updateMask) { UpdateProductRequest request = UpdateProductRequest.newBuilder().setProduct(product).setUpdateMask(updateMask).build(); return updateProduct(request); }
[ "public", "final", "Product", "updateProduct", "(", "Product", "product", ",", "FieldMask", "updateMask", ")", "{", "UpdateProductRequest", "request", "=", "UpdateProductRequest", ".", "newBuilder", "(", ")", ".", "setProduct", "(", "product", ")", ".", "setUpdate...
Makes changes to a Product resource. Only the `display_name`, `description`, and `labels` fields can be updated right now. <p>If labels are updated, the change will not be reflected in queries until the next index time. <p>Possible errors: <p>&#42; Returns NOT_FOUND if the Product does not exist. &#42; Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters. &#42; Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters. &#42; Returns INVALID_ARGUMENT if product_category is present in update_mask. <p>Sample code: <pre><code> try (ProductSearchClient productSearchClient = ProductSearchClient.create()) { Product product = Product.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Product response = productSearchClient.updateProduct(product, updateMask); } </code></pre> @param product The Product resource which replaces the one on the server. product.name is immutable. @param updateMask The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask paths include `product_labels`, `display_name`, and `description`. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Makes", "changes", "to", "a", "Product", "resource", ".", "Only", "the", "display_name", "description", "and", "labels", "fields", "can", "be", "updated", "right", "now", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchClient.java#L822-L827
sdl/odata
odata_processor/src/main/java/com/sdl/odata/processor/write/BatchMethodHandler.java
BatchMethodHandler.getRequestType
private Type getRequestType(ODataRequest oDataRequest, ODataUri oDataUri) throws ODataTargetTypeException { TargetType targetType = WriteMethodUtil.getTargetType(oDataRequest, entityDataModel, oDataUri); return entityDataModel.getType(targetType.typeName()); }
java
private Type getRequestType(ODataRequest oDataRequest, ODataUri oDataUri) throws ODataTargetTypeException { TargetType targetType = WriteMethodUtil.getTargetType(oDataRequest, entityDataModel, oDataUri); return entityDataModel.getType(targetType.typeName()); }
[ "private", "Type", "getRequestType", "(", "ODataRequest", "oDataRequest", ",", "ODataUri", "oDataUri", ")", "throws", "ODataTargetTypeException", "{", "TargetType", "targetType", "=", "WriteMethodUtil", ".", "getTargetType", "(", "oDataRequest", ",", "entityDataModel", ...
Returns request type for the given odata uri. @param oDataUri the odata uri @return the request type @throws ODataTargetTypeException if unable to determine request type
[ "Returns", "request", "type", "for", "the", "given", "odata", "uri", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_processor/src/main/java/com/sdl/odata/processor/write/BatchMethodHandler.java#L201-L204
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java
GeneratedDConnectionDaoImpl.queryByDisplayName
public Iterable<DConnection> queryByDisplayName(java.lang.String displayName) { return queryByField(null, DConnectionMapper.Field.DISPLAYNAME.getFieldName(), displayName); }
java
public Iterable<DConnection> queryByDisplayName(java.lang.String displayName) { return queryByField(null, DConnectionMapper.Field.DISPLAYNAME.getFieldName(), displayName); }
[ "public", "Iterable", "<", "DConnection", ">", "queryByDisplayName", "(", "java", ".", "lang", ".", "String", "displayName", ")", "{", "return", "queryByField", "(", "null", ",", "DConnectionMapper", ".", "Field", ".", "DISPLAYNAME", ".", "getFieldName", "(", ...
query-by method for field displayName @param displayName the specified attribute @return an Iterable of DConnections for the specified displayName
[ "query", "-", "by", "method", "for", "field", "displayName" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L79-L81
wwadge/bonecp
bonecp/src/main/java/com/jolbox/bonecp/StatementCache.java
StatementCache.calculateCacheKey
public String calculateCacheKey(String sql, int autoGeneratedKeys) { StringBuilder tmp = new StringBuilder(sql.length()+4); tmp.append(sql); tmp.append(autoGeneratedKeys); return tmp.toString(); }
java
public String calculateCacheKey(String sql, int autoGeneratedKeys) { StringBuilder tmp = new StringBuilder(sql.length()+4); tmp.append(sql); tmp.append(autoGeneratedKeys); return tmp.toString(); }
[ "public", "String", "calculateCacheKey", "(", "String", "sql", ",", "int", "autoGeneratedKeys", ")", "{", "StringBuilder", "tmp", "=", "new", "StringBuilder", "(", "sql", ".", "length", "(", ")", "+", "4", ")", ";", "tmp", ".", "append", "(", "sql", ")",...
Alternate version of autoGeneratedKeys. @param sql @param autoGeneratedKeys @return cache key to use.
[ "Alternate", "version", "of", "autoGeneratedKeys", "." ]
train
https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/StatementCache.java#L115-L120
before/uadetector
modules/uadetector-core/src/main/java/net/sf/uadetector/internal/data/domain/BrowserPattern.java
BrowserPattern.compareInt
private static int compareInt(final int a, final int b) { int result = 0; if (a > b) { result = 1; } else if (a < b) { result = -1; } return result; }
java
private static int compareInt(final int a, final int b) { int result = 0; if (a > b) { result = 1; } else if (a < b) { result = -1; } return result; }
[ "private", "static", "int", "compareInt", "(", "final", "int", "a", ",", "final", "int", "b", ")", "{", "int", "result", "=", "0", ";", "if", "(", "a", ">", "b", ")", "{", "result", "=", "1", ";", "}", "else", "if", "(", "a", "<", "b", ")", ...
Compares to integers. @param a first integer @param b second integer @return {@code -1} if {@code a} is less, {@code 0} if equal, or {@code 1} if greater than {@code b}
[ "Compares", "to", "integers", "." ]
train
https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/internal/data/domain/BrowserPattern.java#L198-L206
datastax/java-driver
query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/QueryBuilder.java
QueryBuilder.subtract
@NonNull public static Term subtract(@NonNull Term left, @NonNull Term right) { return new BinaryArithmeticTerm(ArithmeticOperator.DIFFERENCE, left, right); }
java
@NonNull public static Term subtract(@NonNull Term left, @NonNull Term right) { return new BinaryArithmeticTerm(ArithmeticOperator.DIFFERENCE, left, right); }
[ "@", "NonNull", "public", "static", "Term", "subtract", "(", "@", "NonNull", "Term", "left", ",", "@", "NonNull", "Term", "right", ")", "{", "return", "new", "BinaryArithmeticTerm", "(", "ArithmeticOperator", ".", "DIFFERENCE", ",", "left", ",", "right", ")"...
The difference of two terms, as in {@code WHERE k = left - right}.
[ "The", "difference", "of", "two", "terms", "as", "in", "{" ]
train
https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/QueryBuilder.java#L195-L198
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/internal/ResettableInputStream.java
ResettableInputStream.newResettableInputStream
public static ResettableInputStream newResettableInputStream( FileInputStream fis, String errmsg) { try { return new ResettableInputStream(fis); } catch (IOException e) { throw new SdkClientException(errmsg, e); } }
java
public static ResettableInputStream newResettableInputStream( FileInputStream fis, String errmsg) { try { return new ResettableInputStream(fis); } catch (IOException e) { throw new SdkClientException(errmsg, e); } }
[ "public", "static", "ResettableInputStream", "newResettableInputStream", "(", "FileInputStream", "fis", ",", "String", "errmsg", ")", "{", "try", "{", "return", "new", "ResettableInputStream", "(", "fis", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{"...
Convenient factory method to construct a new resettable input stream for the given file input stream, converting any IOException into SdkClientException with the given error message. <p> Note the creation of a {@link ResettableInputStream} would entail physically opening a file. If the opened file is meant to be closed only (in a finally block) by the very same code block that created it, then it is necessary that the release method must not be called while the execution is made in other stack frames. In such case, as other stack frames may inadvertently or indirectly call the close method of the stream, the creator of the stream would need to explicitly disable the accidental closing via {@link ResettableInputStream#disableClose()}, so that the release method becomes the only way to truly close the opened file.
[ "Convenient", "factory", "method", "to", "construct", "a", "new", "resettable", "input", "stream", "for", "the", "given", "file", "input", "stream", "converting", "any", "IOException", "into", "SdkClientException", "with", "the", "given", "error", "message", ".", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/internal/ResettableInputStream.java#L297-L304
gocd/gocd
base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java
DirectoryScanner.accountForIncludedDir
private void accountForIncludedDir(String name, File file, boolean fast) { processIncluded(name, file, dirsIncluded, dirsExcluded, dirsDeselected); if (fast && couldHoldIncluded(name) && !contentsExcluded(name)) { scandir(file, name + File.separator, fast); } }
java
private void accountForIncludedDir(String name, File file, boolean fast) { processIncluded(name, file, dirsIncluded, dirsExcluded, dirsDeselected); if (fast && couldHoldIncluded(name) && !contentsExcluded(name)) { scandir(file, name + File.separator, fast); } }
[ "private", "void", "accountForIncludedDir", "(", "String", "name", ",", "File", "file", ",", "boolean", "fast", ")", "{", "processIncluded", "(", "name", ",", "file", ",", "dirsIncluded", ",", "dirsExcluded", ",", "dirsDeselected", ")", ";", "if", "(", "fast...
Process included directory. @param name path of the directory relative to the directory of the FileSet. @param file directory as File. @param fast whether to perform fast scans.
[ "Process", "included", "directory", "." ]
train
https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java#L1139-L1144
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/JSONAssetConverter.java
JSONAssetConverter.writeValue
public static void writeValue(OutputStream stream, Object pojo) throws IOException { DataModelSerializer.serializeAsStream(pojo, stream); }
java
public static void writeValue(OutputStream stream, Object pojo) throws IOException { DataModelSerializer.serializeAsStream(pojo, stream); }
[ "public", "static", "void", "writeValue", "(", "OutputStream", "stream", ",", "Object", "pojo", ")", "throws", "IOException", "{", "DataModelSerializer", ".", "serializeAsStream", "(", "pojo", ",", "stream", ")", ";", "}" ]
Write a JSON representation of the asset to a stream @param stream The stream to write to @param pojo The asset to write @throws IOException
[ "Write", "a", "JSON", "representation", "of", "the", "asset", "to", "a", "stream" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/JSONAssetConverter.java#L36-L38
steveohara/j2mod
src/main/java/com/ghgande/j2mod/modbus/facade/AbstractModbusMaster.java
AbstractModbusMaster.readCoils
public BitVector readCoils(int unitId, int ref, int count) throws ModbusException { checkTransaction(); if (readCoilsRequest == null) { readCoilsRequest = new ReadCoilsRequest(); } readCoilsRequest.setUnitID(unitId); readCoilsRequest.setReference(ref); readCoilsRequest.setBitCount(count); transaction.setRequest(readCoilsRequest); transaction.execute(); BitVector bv = ((ReadCoilsResponse) getAndCheckResponse()).getCoils(); bv.forceSize(count); return bv; }
java
public BitVector readCoils(int unitId, int ref, int count) throws ModbusException { checkTransaction(); if (readCoilsRequest == null) { readCoilsRequest = new ReadCoilsRequest(); } readCoilsRequest.setUnitID(unitId); readCoilsRequest.setReference(ref); readCoilsRequest.setBitCount(count); transaction.setRequest(readCoilsRequest); transaction.execute(); BitVector bv = ((ReadCoilsResponse) getAndCheckResponse()).getCoils(); bv.forceSize(count); return bv; }
[ "public", "BitVector", "readCoils", "(", "int", "unitId", ",", "int", "ref", ",", "int", "count", ")", "throws", "ModbusException", "{", "checkTransaction", "(", ")", ";", "if", "(", "readCoilsRequest", "==", "null", ")", "{", "readCoilsRequest", "=", "new",...
Reads a given number of coil states from the slave. Note that the number of bits in the bit vector will be forced to the number originally requested. @param unitId the slave unit id. @param ref the offset of the coil to start reading from. @param count the number of coil states to be read. @return a <tt>BitVector</tt> instance holding the received coil states. @throws ModbusException if an I/O error, a slave exception or a transaction error occurs.
[ "Reads", "a", "given", "number", "of", "coil", "states", "from", "the", "slave", "." ]
train
https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/facade/AbstractModbusMaster.java#L89-L102
vvakame/JsonPullParser
jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java
JsonModelCoder.get
public T get(InputStream stream, OnJsonObjectAddListener listener) throws IOException, JsonFormatException { JsonPullParser parser = JsonPullParser.newParser(stream); return get(parser, listener); }
java
public T get(InputStream stream, OnJsonObjectAddListener listener) throws IOException, JsonFormatException { JsonPullParser parser = JsonPullParser.newParser(stream); return get(parser, listener); }
[ "public", "T", "get", "(", "InputStream", "stream", ",", "OnJsonObjectAddListener", "listener", ")", "throws", "IOException", ",", "JsonFormatException", "{", "JsonPullParser", "parser", "=", "JsonPullParser", ".", "newParser", "(", "stream", ")", ";", "return", "...
Attempts to parse the given data as an object.<br> Accepts {@link OnJsonObjectAddListener}; allows you to peek various intermittent instances as parsing goes. @param stream JSON-formatted data @param listener {@link OnJsonObjectAddListener} to notify @return An object instance @throws IOException @throws JsonFormatException The given data is malformed, or its type is unexpected
[ "Attempts", "to", "parse", "the", "given", "data", "as", "an", "object", ".", "<br", ">", "Accepts", "{", "@link", "OnJsonObjectAddListener", "}", ";", "allows", "you", "to", "peek", "various", "intermittent", "instances", "as", "parsing", "goes", "." ]
train
https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java#L201-L205
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/JUnitMatchers.java
JUnitMatchers.hasJUnitAnnotation
public static boolean hasJUnitAnnotation(MethodTree tree, VisitorState state) { MethodSymbol methodSym = getSymbol(tree); if (methodSym == null) { return false; } if (hasJUnitAttr(methodSym)) { return true; } return findSuperMethods(methodSym, state.getTypes()).stream() .anyMatch(JUnitMatchers::hasJUnitAttr); }
java
public static boolean hasJUnitAnnotation(MethodTree tree, VisitorState state) { MethodSymbol methodSym = getSymbol(tree); if (methodSym == null) { return false; } if (hasJUnitAttr(methodSym)) { return true; } return findSuperMethods(methodSym, state.getTypes()).stream() .anyMatch(JUnitMatchers::hasJUnitAttr); }
[ "public", "static", "boolean", "hasJUnitAnnotation", "(", "MethodTree", "tree", ",", "VisitorState", "state", ")", "{", "MethodSymbol", "methodSym", "=", "getSymbol", "(", "tree", ")", ";", "if", "(", "methodSym", "==", "null", ")", "{", "return", "false", "...
Checks if a method, or any overridden method, is annotated with any annotation from the org.junit package.
[ "Checks", "if", "a", "method", "or", "any", "overridden", "method", "is", "annotated", "with", "any", "annotation", "from", "the", "org", ".", "junit", "package", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/JUnitMatchers.java#L81-L91
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/user/UserCoreDao.java
UserCoreDao.queryForLike
public TResult queryForLike(String fieldName, ColumnValue value) { String where = buildWhereLike(fieldName, value); String[] whereArgs = buildWhereArgs(value); TResult result = userDb.query(getTableName(), table.getColumnNames(), where, whereArgs, null, null, null); prepareResult(result); return result; }
java
public TResult queryForLike(String fieldName, ColumnValue value) { String where = buildWhereLike(fieldName, value); String[] whereArgs = buildWhereArgs(value); TResult result = userDb.query(getTableName(), table.getColumnNames(), where, whereArgs, null, null, null); prepareResult(result); return result; }
[ "public", "TResult", "queryForLike", "(", "String", "fieldName", ",", "ColumnValue", "value", ")", "{", "String", "where", "=", "buildWhereLike", "(", "fieldName", ",", "value", ")", ";", "String", "[", "]", "whereArgs", "=", "buildWhereArgs", "(", "value", ...
Query for the row where the field is like the value @param fieldName field name @param value column value @return result @since 3.0.1
[ "Query", "for", "the", "row", "where", "the", "field", "is", "like", "the", "value" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/user/UserCoreDao.java#L338-L345
hibernate/hibernate-ogm
infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/persistencestrategy/counter/ClusteredCounterHandler.java
ClusteredCounterHandler.getCounterOrCreateIt
protected StrongCounter getCounterOrCreateIt(String counterName, int initialValue) { CounterManager counterManager = EmbeddedCounterManagerFactory.asCounterManager( cacheManager ); if ( !counterManager.isDefined( counterName ) ) { LOG.tracef( "Counter %s is not defined, creating it", counterName ); // global configuration is mandatory in order to define // a new clustered counter with persistent storage validateGlobalConfiguration(); counterManager.defineCounter( counterName, CounterConfiguration.builder( CounterType.UNBOUNDED_STRONG ) .initialValue( initialValue ) .storage( Storage.PERSISTENT ) .build() ); } StrongCounter strongCounter = counterManager.getStrongCounter( counterName ); return strongCounter; }
java
protected StrongCounter getCounterOrCreateIt(String counterName, int initialValue) { CounterManager counterManager = EmbeddedCounterManagerFactory.asCounterManager( cacheManager ); if ( !counterManager.isDefined( counterName ) ) { LOG.tracef( "Counter %s is not defined, creating it", counterName ); // global configuration is mandatory in order to define // a new clustered counter with persistent storage validateGlobalConfiguration(); counterManager.defineCounter( counterName, CounterConfiguration.builder( CounterType.UNBOUNDED_STRONG ) .initialValue( initialValue ) .storage( Storage.PERSISTENT ) .build() ); } StrongCounter strongCounter = counterManager.getStrongCounter( counterName ); return strongCounter; }
[ "protected", "StrongCounter", "getCounterOrCreateIt", "(", "String", "counterName", ",", "int", "initialValue", ")", "{", "CounterManager", "counterManager", "=", "EmbeddedCounterManagerFactory", ".", "asCounterManager", "(", "cacheManager", ")", ";", "if", "(", "!", ...
Create a counter if one is not defined already, otherwise return the existing one. @param counterName unique name for the counter @param initialValue initial value for the counter @return a {@link StrongCounter}
[ "Create", "a", "counter", "if", "one", "is", "not", "defined", "already", "otherwise", "return", "the", "existing", "one", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/persistencestrategy/counter/ClusteredCounterHandler.java#L47-L66
OpenLiberty/open-liberty
dev/com.ibm.ws.opentracing.1.2/src/com/ibm/ws/opentracing/OpentracingService.java
OpentracingService.process
public static boolean process(final URI uri, final String path, final SpanFilterType type) { final String methodName = "process"; String newExcludeFilterString = OpentracingConfiguration.getServerSkipPattern(); if (!compare(excludeFilterString, newExcludeFilterString)) { updateFilters(newExcludeFilterString); } boolean result = true; // Copy the static reference locally so that it doesn't matter if the static list // is updated while we're processing since that will just overwrite the reference final SpanFilter[] filters = allFilters; for (int i = 0; i < filters.length; i++) { result = filters[i].process(result, uri, path, type); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "filter " + filters[i] + " set result to " + result); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Checking to see if this request should be excluded. request uri=" + uri + ", path=" + path + " result=" + (result ? "INCLUDE" : "EXCLUDE")); } return result; }
java
public static boolean process(final URI uri, final String path, final SpanFilterType type) { final String methodName = "process"; String newExcludeFilterString = OpentracingConfiguration.getServerSkipPattern(); if (!compare(excludeFilterString, newExcludeFilterString)) { updateFilters(newExcludeFilterString); } boolean result = true; // Copy the static reference locally so that it doesn't matter if the static list // is updated while we're processing since that will just overwrite the reference final SpanFilter[] filters = allFilters; for (int i = 0; i < filters.length; i++) { result = filters[i].process(result, uri, path, type); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "filter " + filters[i] + " set result to " + result); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName, "Checking to see if this request should be excluded. request uri=" + uri + ", path=" + path + " result=" + (result ? "INCLUDE" : "EXCLUDE")); } return result; }
[ "public", "static", "boolean", "process", "(", "final", "URI", "uri", ",", "final", "String", "path", ",", "final", "SpanFilterType", "type", ")", "{", "final", "String", "methodName", "=", "\"process\"", ";", "String", "newExcludeFilterString", "=", "Opentracin...
Return true if a span for the specified URI and type should be included. @param uri The URI of the request. @param type The type of the request. @return true if a span for the specified URI and type should be included.
[ "Return", "true", "if", "a", "span", "for", "the", "specified", "URI", "and", "type", "should", "be", "included", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.opentracing.1.2/src/com/ibm/ws/opentracing/OpentracingService.java#L158-L186
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addAnnotationInfo
public boolean addAnnotationInfo(int indent, Doc doc, Parameter param, Content tree) { return addAnnotationInfo(indent, doc, param.annotations(), false, tree); }
java
public boolean addAnnotationInfo(int indent, Doc doc, Parameter param, Content tree) { return addAnnotationInfo(indent, doc, param.annotations(), false, tree); }
[ "public", "boolean", "addAnnotationInfo", "(", "int", "indent", ",", "Doc", "doc", ",", "Parameter", "param", ",", "Content", "tree", ")", "{", "return", "addAnnotationInfo", "(", "indent", ",", "doc", ",", "param", ".", "annotations", "(", ")", ",", "fals...
Add the annotatation types for the given doc and parameter. @param indent the number of spaces to indent the parameters. @param doc the doc to write annotations for. @param param the parameter to write annotations for. @param tree the content tree to which the annotation types will be added
[ "Add", "the", "annotatation", "types", "for", "the", "given", "doc", "and", "parameter", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1873-L1876
m-m-m/util
reflect/src/main/java/net/sf/mmm/util/reflect/base/ReflectionUtilImpl.java
ReflectionUtilImpl.visitResources
private static void visitResources(File packageDirectory, StringBuilder qualifiedNameBuilder, int qualifiedNamePrefixLength, ResourceVisitor visitor) { for (File childFile : packageDirectory.listFiles()) { String fileName = childFile.getName(); qualifiedNameBuilder.setLength(qualifiedNamePrefixLength); if (childFile.isDirectory()) { StringBuilder subBuilder = new StringBuilder(qualifiedNameBuilder); subBuilder.append(fileName); subBuilder.append('/'); if (visitor.visitPackage(subBuilder.toString())) { visitResources(childFile, subBuilder, subBuilder.length(), visitor); } } else { qualifiedNameBuilder.append(fileName); visitor.visitResource(qualifiedNameBuilder.toString()); } } }
java
private static void visitResources(File packageDirectory, StringBuilder qualifiedNameBuilder, int qualifiedNamePrefixLength, ResourceVisitor visitor) { for (File childFile : packageDirectory.listFiles()) { String fileName = childFile.getName(); qualifiedNameBuilder.setLength(qualifiedNamePrefixLength); if (childFile.isDirectory()) { StringBuilder subBuilder = new StringBuilder(qualifiedNameBuilder); subBuilder.append(fileName); subBuilder.append('/'); if (visitor.visitPackage(subBuilder.toString())) { visitResources(childFile, subBuilder, subBuilder.length(), visitor); } } else { qualifiedNameBuilder.append(fileName); visitor.visitResource(qualifiedNameBuilder.toString()); } } }
[ "private", "static", "void", "visitResources", "(", "File", "packageDirectory", ",", "StringBuilder", "qualifiedNameBuilder", ",", "int", "qualifiedNamePrefixLength", ",", "ResourceVisitor", "visitor", ")", "{", "for", "(", "File", "childFile", ":", "packageDirectory", ...
This method scans the given {@code packageDirectory} recursively for resources. @param packageDirectory is the directory representing the {@link Package}. @param qualifiedNameBuilder is a {@link StringBuilder} containing the qualified prefix (the {@link Package} with a trailing dot). @param qualifiedNamePrefixLength the length of the prefix used to rest the string-builder after reuse. @param visitor is the {@link ResourceVisitor}.
[ "This", "method", "scans", "the", "given", "{", "@code", "packageDirectory", "}", "recursively", "for", "resources", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/reflect/src/main/java/net/sf/mmm/util/reflect/base/ReflectionUtilImpl.java#L636-L653
Azure/azure-sdk-for-java
containerinstance/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2018_02_01_preview/implementation/ContainerGroupsInner.java
ContainerGroupsInner.createOrUpdateAsync
public Observable<ContainerGroupInner> createOrUpdateAsync(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, containerGroupName, containerGroup).map(new Func1<ServiceResponse<ContainerGroupInner>, ContainerGroupInner>() { @Override public ContainerGroupInner call(ServiceResponse<ContainerGroupInner> response) { return response.body(); } }); }
java
public Observable<ContainerGroupInner> createOrUpdateAsync(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, containerGroupName, containerGroup).map(new Func1<ServiceResponse<ContainerGroupInner>, ContainerGroupInner>() { @Override public ContainerGroupInner call(ServiceResponse<ContainerGroupInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ContainerGroupInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "containerGroupName", ",", "ContainerGroupInner", "containerGroup", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceG...
Create or update container groups. Create or update container groups with specified configurations. @param resourceGroupName The name of the resource group. @param containerGroupName The name of the container group. @param containerGroup The properties of the container group to be created or updated. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Create", "or", "update", "container", "groups", ".", "Create", "or", "update", "container", "groups", "with", "specified", "configurations", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2018_02_01_preview/implementation/ContainerGroupsInner.java#L470-L477
javafxports/javafxmobile-plugin
src/main/java/org/javafxports/jfxmobile/plugin/android/task/ApkBuilder.java
ApkBuilder.checkInputFile
private static void checkInputFile(File file) throws FileNotFoundException, ApkCreationException { if (file.isDirectory()) { throw new ApkCreationException("%s is a directory!", file); } if (file.exists()) { if (!file.canRead()) { throw new ApkCreationException("Cannot read %s", file); } } else { throw new FileNotFoundException(String.format("%s does not exist", file)); } }
java
private static void checkInputFile(File file) throws FileNotFoundException, ApkCreationException { if (file.isDirectory()) { throw new ApkCreationException("%s is a directory!", file); } if (file.exists()) { if (!file.canRead()) { throw new ApkCreationException("Cannot read %s", file); } } else { throw new FileNotFoundException(String.format("%s does not exist", file)); } }
[ "private", "static", "void", "checkInputFile", "(", "File", "file", ")", "throws", "FileNotFoundException", ",", "ApkCreationException", "{", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "ApkCreationException", "(", "\"%s is a directo...
Checks an input {@link File} object. This checks the following: - the file is not an existing directory. - that the file exists (if <var>throwIfDoesntExist</var> is <code>false</code>) and can be read. @param file the File to check @throws FileNotFoundException if the file is not here. @throws ApkCreationException If the file is a folder or a file that cannot be read.
[ "Checks", "an", "input", "{" ]
train
https://github.com/javafxports/javafxmobile-plugin/blob/a9bef513b7e1bfa85f9a668226e6943c6d9f847f/src/main/java/org/javafxports/jfxmobile/plugin/android/task/ApkBuilder.java#L981-L993
amaembo/streamex
src/main/java/one/util/streamex/DoubleStreamEx.java
DoubleStreamEx.maxByInt
public OptionalDouble maxByInt(DoubleToIntFunction keyExtractor) { return collect(PrimitiveBox::new, (box, d) -> { int key = keyExtractor.applyAsInt(d); if (!box.b || box.i < key) { box.b = true; box.i = key; box.d = d; } }, PrimitiveBox.MAX_INT).asDouble(); }
java
public OptionalDouble maxByInt(DoubleToIntFunction keyExtractor) { return collect(PrimitiveBox::new, (box, d) -> { int key = keyExtractor.applyAsInt(d); if (!box.b || box.i < key) { box.b = true; box.i = key; box.d = d; } }, PrimitiveBox.MAX_INT).asDouble(); }
[ "public", "OptionalDouble", "maxByInt", "(", "DoubleToIntFunction", "keyExtractor", ")", "{", "return", "collect", "(", "PrimitiveBox", "::", "new", ",", "(", "box", ",", "d", ")", "->", "{", "int", "key", "=", "keyExtractor", ".", "applyAsInt", "(", "d", ...
Returns the maximum element of this stream according to the provided key extractor function. <p> This is a terminal operation. @param keyExtractor a non-interfering, stateless function @return an {@code OptionalDouble} describing the first element of this stream for which the highest value was returned by key extractor, or an empty {@code OptionalDouble} if the stream is empty @since 0.1.2
[ "Returns", "the", "maximum", "element", "of", "this", "stream", "according", "to", "the", "provided", "key", "extractor", "function", "." ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/DoubleStreamEx.java#L1028-L1037
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.ip_reverse_ipReverse_GET
public OvhReverseIp ip_reverse_ipReverse_GET(String ip, String ipReverse) throws IOException { String qPath = "/ip/{ip}/reverse/{ipReverse}"; StringBuilder sb = path(qPath, ip, ipReverse); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhReverseIp.class); }
java
public OvhReverseIp ip_reverse_ipReverse_GET(String ip, String ipReverse) throws IOException { String qPath = "/ip/{ip}/reverse/{ipReverse}"; StringBuilder sb = path(qPath, ip, ipReverse); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhReverseIp.class); }
[ "public", "OvhReverseIp", "ip_reverse_ipReverse_GET", "(", "String", "ip", ",", "String", "ipReverse", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ip/{ip}/reverse/{ipReverse}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "ip", ...
Get this object properties REST: GET /ip/{ip}/reverse/{ipReverse} @param ip [required] @param ipReverse [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L432-L437
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseScsru2csr_bufferSizeExt
public static int cusparseScsru2csr_bufferSizeExt( cusparseHandle handle, int m, int n, int nnz, Pointer csrVal, Pointer csrRowPtr, Pointer csrColInd, csru2csrInfo info, long[] pBufferSizeInBytes) { return checkResult(cusparseScsru2csr_bufferSizeExtNative(handle, m, n, nnz, csrVal, csrRowPtr, csrColInd, info, pBufferSizeInBytes)); }
java
public static int cusparseScsru2csr_bufferSizeExt( cusparseHandle handle, int m, int n, int nnz, Pointer csrVal, Pointer csrRowPtr, Pointer csrColInd, csru2csrInfo info, long[] pBufferSizeInBytes) { return checkResult(cusparseScsru2csr_bufferSizeExtNative(handle, m, n, nnz, csrVal, csrRowPtr, csrColInd, info, pBufferSizeInBytes)); }
[ "public", "static", "int", "cusparseScsru2csr_bufferSizeExt", "(", "cusparseHandle", "handle", ",", "int", "m", ",", "int", "n", ",", "int", "nnz", ",", "Pointer", "csrVal", ",", "Pointer", "csrRowPtr", ",", "Pointer", "csrColInd", ",", "csru2csrInfo", "info", ...
Description: Wrapper that sorts sparse matrix stored in CSR format (without exposing the permutation).
[ "Description", ":", "Wrapper", "that", "sorts", "sparse", "matrix", "stored", "in", "CSR", "format", "(", "without", "exposing", "the", "permutation", ")", "." ]
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L14284-L14296
qiujiayu/AutoLoadCache
src/main/java/com/jarvis/cache/script/AbstractScriptParser.java
AbstractScriptParser.getDefinedCacheKey
public String getDefinedCacheKey(String keyEL, Object target, Object[] arguments, Object retVal, boolean hasRetVal) throws Exception { return this.getElValue(keyEL, target, arguments, retVal, hasRetVal, String.class); }
java
public String getDefinedCacheKey(String keyEL, Object target, Object[] arguments, Object retVal, boolean hasRetVal) throws Exception { return this.getElValue(keyEL, target, arguments, retVal, hasRetVal, String.class); }
[ "public", "String", "getDefinedCacheKey", "(", "String", "keyEL", ",", "Object", "target", ",", "Object", "[", "]", "arguments", ",", "Object", "retVal", ",", "boolean", "hasRetVal", ")", "throws", "Exception", "{", "return", "this", ".", "getElValue", "(", ...
根据请求参数和执行结果值,进行构造缓存Key @param keyEL 生成缓存Key的表达式 @param target AOP 拦截到的实例 @param arguments 参数 @param retVal 结果值 @param hasRetVal 是否有retVal @return CacheKey 缓存Key @throws Exception 异常
[ "根据请求参数和执行结果值,进行构造缓存Key" ]
train
https://github.com/qiujiayu/AutoLoadCache/blob/8121c146f1a420fa6d6832e849acadb547c13622/src/main/java/com/jarvis/cache/script/AbstractScriptParser.java#L77-L80
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/LocaleUtils.java
LocaleUtils.toLocale
public static Locale toLocale(String localeString) { if ((localeString == null) || (localeString.length() == 0)) { Locale locale = Locale.getDefault(); if(log.isLoggable(Level.WARNING)) { log.warning("Locale name in faces-config.xml null or empty, setting locale to default locale : " + locale.toString()); } return locale; } int separatorCountry = localeString.indexOf('_'); char separator; if (separatorCountry >= 0) { separator = '_'; } else { separatorCountry = localeString.indexOf('-'); separator = '-'; } String language; String country; String variant; if (separatorCountry < 0) { language = localeString; country = ""; variant = ""; } else { language = localeString.substring(0, separatorCountry); int separatorVariant = localeString.indexOf(separator, separatorCountry + 1); if (separatorVariant < 0) { country = localeString.substring(separatorCountry + 1); variant = ""; } else { country = localeString.substring(separatorCountry + 1, separatorVariant); variant = localeString.substring(separatorVariant + 1); } } return new Locale(language, country, variant); }
java
public static Locale toLocale(String localeString) { if ((localeString == null) || (localeString.length() == 0)) { Locale locale = Locale.getDefault(); if(log.isLoggable(Level.WARNING)) { log.warning("Locale name in faces-config.xml null or empty, setting locale to default locale : " + locale.toString()); } return locale; } int separatorCountry = localeString.indexOf('_'); char separator; if (separatorCountry >= 0) { separator = '_'; } else { separatorCountry = localeString.indexOf('-'); separator = '-'; } String language; String country; String variant; if (separatorCountry < 0) { language = localeString; country = ""; variant = ""; } else { language = localeString.substring(0, separatorCountry); int separatorVariant = localeString.indexOf(separator, separatorCountry + 1); if (separatorVariant < 0) { country = localeString.substring(separatorCountry + 1); variant = ""; } else { country = localeString.substring(separatorCountry + 1, separatorVariant); variant = localeString.substring(separatorVariant + 1); } } return new Locale(language, country, variant); }
[ "public", "static", "Locale", "toLocale", "(", "String", "localeString", ")", "{", "if", "(", "(", "localeString", "==", "null", ")", "||", "(", "localeString", ".", "length", "(", ")", "==", "0", ")", ")", "{", "Locale", "locale", "=", "Locale", ".", ...
Converts a locale string to <code>Locale</code> class. Accepts both '_' and '-' as separators for locale components. @param localeString string representation of a locale @return Locale instance, compatible with the string representation
[ "Converts", "a", "locale", "string", "to", "<code", ">", "Locale<", "/", "code", ">", "class", ".", "Accepts", "both", "_", "and", "-", "as", "separators", "for", "locale", "components", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/LocaleUtils.java#L45-L97
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/linalg/util/ND4JFileUtils.java
ND4JFileUtils.createTempFile
public static File createTempFile(String prefix, String suffix) { String p = System.getProperty(ND4JSystemProperties.ND4J_TEMP_DIR_PROPERTY); try { if (p == null || p.isEmpty()) { return File.createTempFile(prefix, suffix); } else { return File.createTempFile(prefix, suffix, new File(p)); } } catch (IOException e){ throw new RuntimeException("Error creating temporary file", e); } }
java
public static File createTempFile(String prefix, String suffix) { String p = System.getProperty(ND4JSystemProperties.ND4J_TEMP_DIR_PROPERTY); try { if (p == null || p.isEmpty()) { return File.createTempFile(prefix, suffix); } else { return File.createTempFile(prefix, suffix, new File(p)); } } catch (IOException e){ throw new RuntimeException("Error creating temporary file", e); } }
[ "public", "static", "File", "createTempFile", "(", "String", "prefix", ",", "String", "suffix", ")", "{", "String", "p", "=", "System", ".", "getProperty", "(", "ND4JSystemProperties", ".", "ND4J_TEMP_DIR_PROPERTY", ")", ";", "try", "{", "if", "(", "p", "=="...
Create a temporary file in the location specified by {@link ND4JSystemProperties#ND4J_TEMP_DIR_PROPERTY} if set, or the default temporary directory (usually specified by java.io.tmpdir system property) @param prefix Prefix for generating file's name; must be at least 3 characeters @param suffix Suffix for generating file's name; may be null (".tmp" will be used if null) @return A temporary file
[ "Create", "a", "temporary", "file", "in", "the", "location", "specified", "by", "{" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/util/ND4JFileUtils.java#L40-L51
ehcache/ehcache3
impl/src/main/java/org/ehcache/config/builders/PooledExecutionServiceConfigurationBuilder.java
PooledExecutionServiceConfigurationBuilder.defaultPool
public PooledExecutionServiceConfigurationBuilder defaultPool(String alias, int minSize, int maxSize) { PooledExecutionServiceConfigurationBuilder other = new PooledExecutionServiceConfigurationBuilder(this); other.defaultPool = new Pool(alias, minSize, maxSize); return other; }
java
public PooledExecutionServiceConfigurationBuilder defaultPool(String alias, int minSize, int maxSize) { PooledExecutionServiceConfigurationBuilder other = new PooledExecutionServiceConfigurationBuilder(this); other.defaultPool = new Pool(alias, minSize, maxSize); return other; }
[ "public", "PooledExecutionServiceConfigurationBuilder", "defaultPool", "(", "String", "alias", ",", "int", "minSize", ",", "int", "maxSize", ")", "{", "PooledExecutionServiceConfigurationBuilder", "other", "=", "new", "PooledExecutionServiceConfigurationBuilder", "(", "this",...
Adds a default pool configuration to the returned builder. @param alias the pool alias @param minSize the minimum number of threads in the pool @param maxSize the maximum number of threads in the pool @return a new builder with the added default pool
[ "Adds", "a", "default", "pool", "configuration", "to", "the", "returned", "builder", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/PooledExecutionServiceConfigurationBuilder.java#L63-L67
graphhopper/graphhopper
api/src/main/java/com/graphhopper/GHRequest.java
GHRequest.addPoint
public GHRequest addPoint(GHPoint point, double favoredHeading) { if (point == null) throw new IllegalArgumentException("point cannot be null"); if (!possibleToAdd) throw new IllegalStateException("Please call empty constructor if you intent to use " + "more than two places via addPoint method."); points.add(point); validateAzimuthValue(favoredHeading); favoredHeadings.add(favoredHeading); return this; }
java
public GHRequest addPoint(GHPoint point, double favoredHeading) { if (point == null) throw new IllegalArgumentException("point cannot be null"); if (!possibleToAdd) throw new IllegalStateException("Please call empty constructor if you intent to use " + "more than two places via addPoint method."); points.add(point); validateAzimuthValue(favoredHeading); favoredHeadings.add(favoredHeading); return this; }
[ "public", "GHRequest", "addPoint", "(", "GHPoint", "point", ",", "double", "favoredHeading", ")", "{", "if", "(", "point", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"point cannot be null\"", ")", ";", "if", "(", "!", "possibleToAdd", ...
Add stopover point to routing request. <p> @param point geographical position (see GHPoint) @param favoredHeading north based azimuth (clockwise) in (0, 360) or NaN for equal preference
[ "Add", "stopover", "point", "to", "routing", "request", ".", "<p", ">" ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/api/src/main/java/com/graphhopper/GHRequest.java#L137-L149
jtmelton/appsensor
execution-modes/appsensor-kafka-server/src/main/java/org/owasp/appsensor/kafka/KafkaRequestHandler.java
KafkaRequestHandler.onAdd
@Override public void onAdd(Response response) { ensureInitialized(); KeyValuePair keyValuePair = new KeyValuePair(KafkaConstants.RESPONSE_TYPE, gson.toJson(response)); String message = gson.toJson(keyValuePair); try { kafkaSender.send(buildTopicNames(response), message); } catch (InterruptedException | ExecutionException e) { logger.error("Failed to send add response message to output topic.", e); } }
java
@Override public void onAdd(Response response) { ensureInitialized(); KeyValuePair keyValuePair = new KeyValuePair(KafkaConstants.RESPONSE_TYPE, gson.toJson(response)); String message = gson.toJson(keyValuePair); try { kafkaSender.send(buildTopicNames(response), message); } catch (InterruptedException | ExecutionException e) { logger.error("Failed to send add response message to output topic.", e); } }
[ "@", "Override", "public", "void", "onAdd", "(", "Response", "response", ")", "{", "ensureInitialized", "(", ")", ";", "KeyValuePair", "keyValuePair", "=", "new", "KeyValuePair", "(", "KafkaConstants", ".", "RESPONSE_TYPE", ",", "gson", ".", "toJson", "(", "re...
This implementation of onAdd watches for responses, and immediately sends them out to the appropriate exchange/queue for routing to the necessary client application(s)
[ "This", "implementation", "of", "onAdd", "watches", "for", "responses", "and", "immediately", "sends", "them", "out", "to", "the", "appropriate", "exchange", "/", "queue", "for", "routing", "to", "the", "necessary", "client", "application", "(", "s", ")" ]
train
https://github.com/jtmelton/appsensor/blob/c3b4e9ada50fdee974e0d618ec4bdfabc2163798/execution-modes/appsensor-kafka-server/src/main/java/org/owasp/appsensor/kafka/KafkaRequestHandler.java#L136-L148
ThreeTen/threetenbp
src/main/java/org/threeten/bp/jdk8/Jdk8Methods.java
Jdk8Methods.requireNonNull
public static <T> T requireNonNull(T value, String parameterName) { if (value == null) { throw new NullPointerException(parameterName + " must not be null"); } return value; }
java
public static <T> T requireNonNull(T value, String parameterName) { if (value == null) { throw new NullPointerException(parameterName + " must not be null"); } return value; }
[ "public", "static", "<", "T", ">", "T", "requireNonNull", "(", "T", "value", ",", "String", "parameterName", ")", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "parameterName", "+", "\" must not be null\"", ")"...
Ensures that the argument is non-null. @param <T> the value type @param value the value to check @param parameterName the name of the parameter @return the checked non-null value @throws NullPointerException if the value is null
[ "Ensures", "that", "the", "argument", "is", "non", "-", "null", "." ]
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/jdk8/Jdk8Methods.java#L77-L82
alkacon/opencms-core
src/org/opencms/configuration/CmsElementWithAttrsParamConfigHelper.java
CmsElementWithAttrsParamConfigHelper.generateXml
public void generateXml(Element parent, I_CmsConfigurationParameterHandler config) { if (config != null) { Element elem = parent.addElement(m_name); for (String attrName : m_attrs) { String value = config.getConfiguration().get(attrName); if (value != null) { elem.addAttribute(attrName, value); } } } }
java
public void generateXml(Element parent, I_CmsConfigurationParameterHandler config) { if (config != null) { Element elem = parent.addElement(m_name); for (String attrName : m_attrs) { String value = config.getConfiguration().get(attrName); if (value != null) { elem.addAttribute(attrName, value); } } } }
[ "public", "void", "generateXml", "(", "Element", "parent", ",", "I_CmsConfigurationParameterHandler", "config", ")", "{", "if", "(", "config", "!=", "null", ")", "{", "Element", "elem", "=", "parent", ".", "addElement", "(", "m_name", ")", ";", "for", "(", ...
Generates the XML configuration from the given configuration object.<p> @param parent the parent element @param config the configuration
[ "Generates", "the", "XML", "configuration", "from", "the", "given", "configuration", "object", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsElementWithAttrsParamConfigHelper.java#L108-L119
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/NetworkSecurityGroupsInner.java
NetworkSecurityGroupsInner.updateTagsAsync
public Observable<NetworkSecurityGroupInner> updateTagsAsync(String resourceGroupName, String networkSecurityGroupName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, tags).map(new Func1<ServiceResponse<NetworkSecurityGroupInner>, NetworkSecurityGroupInner>() { @Override public NetworkSecurityGroupInner call(ServiceResponse<NetworkSecurityGroupInner> response) { return response.body(); } }); }
java
public Observable<NetworkSecurityGroupInner> updateTagsAsync(String resourceGroupName, String networkSecurityGroupName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, tags).map(new Func1<ServiceResponse<NetworkSecurityGroupInner>, NetworkSecurityGroupInner>() { @Override public NetworkSecurityGroupInner call(ServiceResponse<NetworkSecurityGroupInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "NetworkSecurityGroupInner", ">", "updateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "networkSecurityGroupName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "updateTagsWithServiceResponseAsyn...
Updates a network security group tags. @param resourceGroupName The name of the resource group. @param networkSecurityGroupName The name of the network security group. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "a", "network", "security", "group", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/NetworkSecurityGroupsInner.java#L708-L715
jmeetsma/Iglu-Http
src/main/java/org/ijsberg/iglu/server/http/module/SimpleJettyServletContext.java
SimpleJettyServletContext.addInitParameters
public static void addInitParameters(Holder holder, Properties subSection) { //TODO rename initparam to property Properties properties = PropertiesSupport.getSubsection(subSection, "initparam"); // System.out.println("PROPS:" + properties); for (Object key : properties.keySet()) { // System.out.println(key + "->" + properties.get(key)); holder.setInitParameter(key.toString(), (String)properties.get(key)); } }
java
public static void addInitParameters(Holder holder, Properties subSection) { //TODO rename initparam to property Properties properties = PropertiesSupport.getSubsection(subSection, "initparam"); // System.out.println("PROPS:" + properties); for (Object key : properties.keySet()) { // System.out.println(key + "->" + properties.get(key)); holder.setInitParameter(key.toString(), (String)properties.get(key)); } }
[ "public", "static", "void", "addInitParameters", "(", "Holder", "holder", ",", "Properties", "subSection", ")", "{", "//TODO rename initparam to property", "Properties", "properties", "=", "PropertiesSupport", ".", "getSubsection", "(", "subSection", ",", "\"initparam\"",...
/* public static void addInitParameters(Map<Object, String> params, Properties subSection) { Properties properties = PropertiesSupport.getSubsection(subSection, "initparam"); for (Object key : properties.keySet()) { params.put(key, subSection.getProperty(key.toString())); } }
[ "/", "*", "public", "static", "void", "addInitParameters", "(", "Map<Object", "String", ">", "params", "Properties", "subSection", ")", "{", "Properties", "properties", "=", "PropertiesSupport", ".", "getSubsection", "(", "subSection", "initparam", ")", ";", "for"...
train
https://github.com/jmeetsma/Iglu-Http/blob/5b5ed3b417285dc79b7aa013bf2340bb5ba1ffbe/src/main/java/org/ijsberg/iglu/server/http/module/SimpleJettyServletContext.java#L316-L324
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getCharacterHeroPoints
public void getCharacterHeroPoints(String API, String name, Callback<List<String>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); gw2API.getCharacterHeroPoints(name, API).enqueue(callback); }
java
public void getCharacterHeroPoints(String API, String name, Callback<List<String>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); gw2API.getCharacterHeroPoints(name, API).enqueue(callback); }
[ "public", "void", "getCharacterHeroPoints", "(", "String", "API", ",", "String", "name", ",", "Callback", "<", "List", "<", "String", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "Param...
For more info on character hero points API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters#Heropoints">here</a><br/> @param API API key @param name name of character @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception invalid API key | empty character name @throws NullPointerException if given {@link Callback} is empty
[ "For", "more", "info", "on", "character", "hero", "points", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "characters#Heropoints", ">", "here<", "/", "a", ">", "<br"...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L765-L768
lucee/Lucee
core/src/main/java/lucee/runtime/config/XMLConfigFactory.java
XMLConfigFactory.getChildByName
static Element getChildByName(Node parent, String nodeName) { return getChildByName(parent, nodeName, false); }
java
static Element getChildByName(Node parent, String nodeName) { return getChildByName(parent, nodeName, false); }
[ "static", "Element", "getChildByName", "(", "Node", "parent", ",", "String", "nodeName", ")", "{", "return", "getChildByName", "(", "parent", ",", "nodeName", ",", "false", ")", ";", "}" ]
return first direct child Elements of a Element with given Name @param parent @param nodeName @return matching children
[ "return", "first", "direct", "child", "Elements", "of", "a", "Element", "with", "given", "Name" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigFactory.java#L211-L213
micronaut-projects/micronaut-core
core/src/main/java/io/micronaut/core/annotation/AnnotationValue.java
AnnotationValue.getValue
public <T> Optional<T> getValue(ArgumentConversionContext<T> conversionContext) { return get(AnnotationMetadata.VALUE_MEMBER, conversionContext); }
java
public <T> Optional<T> getValue(ArgumentConversionContext<T> conversionContext) { return get(AnnotationMetadata.VALUE_MEMBER, conversionContext); }
[ "public", "<", "T", ">", "Optional", "<", "T", ">", "getValue", "(", "ArgumentConversionContext", "<", "T", ">", "conversionContext", ")", "{", "return", "get", "(", "AnnotationMetadata", ".", "VALUE_MEMBER", ",", "conversionContext", ")", ";", "}" ]
Get the value of the {@code value} member of the annotation. @param conversionContext The conversion context @param <T> The type @return The result
[ "Get", "the", "value", "of", "the", "{", "@code", "value", "}", "member", "of", "the", "annotation", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/annotation/AnnotationValue.java#L176-L178
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/GaussianFilter.java
GaussianFilter.makeKernel
public static Kernel makeKernel(float radius) { int r = (int) Math.ceil(radius); int rows = r * 2 + 1; float[] matrix = new float[rows]; float sigma = radius / 3; float sigma22 = 2 * sigma * sigma; float sigmaPi2 = 2 * ImageMath.PI * sigma; float sqrtSigmaPi2 = (float) Math.sqrt(sigmaPi2); float radius2 = radius * radius; float total = 0; int index = 0; for (int row = -r; row <= r; row++) { float distance = row * row; if (distance > radius2) matrix[index] = 0; else matrix[index] = (float) Math.exp(-(distance) / sigma22) / sqrtSigmaPi2; total += matrix[index]; index++; } for (int i = 0; i < rows; i++) matrix[i] /= total; return new Kernel(rows, 1, matrix); }
java
public static Kernel makeKernel(float radius) { int r = (int) Math.ceil(radius); int rows = r * 2 + 1; float[] matrix = new float[rows]; float sigma = radius / 3; float sigma22 = 2 * sigma * sigma; float sigmaPi2 = 2 * ImageMath.PI * sigma; float sqrtSigmaPi2 = (float) Math.sqrt(sigmaPi2); float radius2 = radius * radius; float total = 0; int index = 0; for (int row = -r; row <= r; row++) { float distance = row * row; if (distance > radius2) matrix[index] = 0; else matrix[index] = (float) Math.exp(-(distance) / sigma22) / sqrtSigmaPi2; total += matrix[index]; index++; } for (int i = 0; i < rows; i++) matrix[i] /= total; return new Kernel(rows, 1, matrix); }
[ "public", "static", "Kernel", "makeKernel", "(", "float", "radius", ")", "{", "int", "r", "=", "(", "int", ")", "Math", ".", "ceil", "(", "radius", ")", ";", "int", "rows", "=", "r", "*", "2", "+", "1", ";", "float", "[", "]", "matrix", "=", "n...
Make a Gaussian blur kernel. @param radius the blur radius @return the kernel
[ "Make", "a", "Gaussian", "blur", "kernel", "." ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/GaussianFilter.java#L176-L200
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/core/filler/AbstractMessageAwareFiller.java
AbstractMessageAwareFiller.getProperty
protected <T> T getProperty(String alias, Class<T> targetType) { String k = resolveKey(alias); return k == null ? null : resolver.getProperty(k, targetType); }
java
protected <T> T getProperty(String alias, Class<T> targetType) { String k = resolveKey(alias); return k == null ? null : resolver.getProperty(k, targetType); }
[ "protected", "<", "T", ">", "T", "getProperty", "(", "String", "alias", ",", "Class", "<", "T", ">", "targetType", ")", "{", "String", "k", "=", "resolveKey", "(", "alias", ")", ";", "return", "k", "==", "null", "?", "null", ":", "resolver", ".", "...
Returns the value of first property represented by the provided alias that has a value (not {@code null}). @param alias the property alias to resolve @param targetType the expected type of the property value @param <T> the type of the property value @return The property value or null
[ "Returns", "the", "value", "of", "first", "property", "represented", "by", "the", "provided", "alias", "that", "has", "a", "value", "(", "not", "{", "@code", "null", "}", ")", "." ]
train
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/filler/AbstractMessageAwareFiller.java#L105-L108
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java
JvmTypesBuilder.addAnnotations
public void addAnnotations(/* @Nullable */ JvmAnnotationTarget target, /* @Nullable */ Iterable<? extends XAnnotation> annotations) { if(annotations == null || target == null) return; for (XAnnotation annotation : annotations) { addAnnotation(target, annotation); } }
java
public void addAnnotations(/* @Nullable */ JvmAnnotationTarget target, /* @Nullable */ Iterable<? extends XAnnotation> annotations) { if(annotations == null || target == null) return; for (XAnnotation annotation : annotations) { addAnnotation(target, annotation); } }
[ "public", "void", "addAnnotations", "(", "/* @Nullable */", "JvmAnnotationTarget", "target", ",", "/* @Nullable */", "Iterable", "<", "?", "extends", "XAnnotation", ">", "annotations", ")", "{", "if", "(", "annotations", "==", "null", "||", "target", "==", "null",...
Translates {@link XAnnotation XAnnotations} to {@link JvmAnnotationReference JvmAnnotationReferences} and adds them to the given {@link JvmAnnotationTarget}. @param target the annotation target. If <code>null</code> this method does nothing. @param annotations the annotations. If <code>null</code> this method does nothing.
[ "Translates", "{", "@link", "XAnnotation", "XAnnotations", "}", "to", "{", "@link", "JvmAnnotationReference", "JvmAnnotationReferences", "}", "and", "adds", "them", "to", "the", "given", "{", "@link", "JvmAnnotationTarget", "}", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java#L1354-L1360
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroup.java
CommandGroup.createButtonBar
public JComponent createButtonBar(final ColumnSpec columnSpec, final RowSpec rowSpec) { return createButtonBar(columnSpec, rowSpec, null); }
java
public JComponent createButtonBar(final ColumnSpec columnSpec, final RowSpec rowSpec) { return createButtonBar(columnSpec, rowSpec, null); }
[ "public", "JComponent", "createButtonBar", "(", "final", "ColumnSpec", "columnSpec", ",", "final", "RowSpec", "rowSpec", ")", "{", "return", "createButtonBar", "(", "columnSpec", ",", "rowSpec", ",", "null", ")", ";", "}" ]
Create a button bar with buttons for all the commands in this. @param columnSpec Custom columnSpec for each column containing a button, can be <code>null</code>. @param rowSpec Custom rowspec for the buttonbar, can be <code>null</code>. @return never null
[ "Create", "a", "button", "bar", "with", "buttons", "for", "all", "the", "commands", "in", "this", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroup.java#L446-L448