repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java | FilesImpl.deleteFromTask | public void deleteFromTask(String jobId, String taskId, String filePath, Boolean recursive, FileDeleteFromTaskOptions fileDeleteFromTaskOptions) {
deleteFromTaskWithServiceResponseAsync(jobId, taskId, filePath, recursive, fileDeleteFromTaskOptions).toBlocking().single().body();
} | java | public void deleteFromTask(String jobId, String taskId, String filePath, Boolean recursive, FileDeleteFromTaskOptions fileDeleteFromTaskOptions) {
deleteFromTaskWithServiceResponseAsync(jobId, taskId, filePath, recursive, fileDeleteFromTaskOptions).toBlocking().single().body();
} | [
"public",
"void",
"deleteFromTask",
"(",
"String",
"jobId",
",",
"String",
"taskId",
",",
"String",
"filePath",
",",
"Boolean",
"recursive",
",",
"FileDeleteFromTaskOptions",
"fileDeleteFromTaskOptions",
")",
"{",
"deleteFromTaskWithServiceResponseAsync",
"(",
"jobId",
... | Deletes the specified task file from the compute node where the task ran.
@param jobId The ID of the job that contains the task.
@param taskId The ID of the task whose file you want to delete.
@param filePath The path to the task file or directory that you want to delete.
@param recursive Whether to delete children of a directory. If the filePath parameter represents a directory instead of a file, you can set recursive to true to delete the directory and all of the files and subdirectories in it. If recursive is false then the directory must be empty or deletion will fail.
@param fileDeleteFromTaskOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Deletes",
"the",
"specified",
"task",
"file",
"from",
"the",
"compute",
"node",
"where",
"the",
"task",
"ran",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L243-L245 |
ManfredTremmel/gwt-bean-validators | mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/AlternateSizeValidator.java | AlternateSizeValidator.isValid | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
String valueAsString = Objects.toString(pvalue, StringUtils.EMPTY);
if (StringUtils.isEmpty(valueAsString)) {
return true;
}
if (ignoreWhiteSpaces) {
valueAsString = valueAsString.replaceAll("\\s", StringUtils.EMPTY);
}
if (ignoreMinus) {
valueAsString = valueAsString.replaceAll("-", StringUtils.EMPTY);
}
if (ignoreSlashes) {
valueAsString = valueAsString.replaceAll("/", StringUtils.EMPTY);
}
return StringUtils.length(valueAsString) == size1 || StringUtils.length(valueAsString) == size2;
} | java | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
String valueAsString = Objects.toString(pvalue, StringUtils.EMPTY);
if (StringUtils.isEmpty(valueAsString)) {
return true;
}
if (ignoreWhiteSpaces) {
valueAsString = valueAsString.replaceAll("\\s", StringUtils.EMPTY);
}
if (ignoreMinus) {
valueAsString = valueAsString.replaceAll("-", StringUtils.EMPTY);
}
if (ignoreSlashes) {
valueAsString = valueAsString.replaceAll("/", StringUtils.EMPTY);
}
return StringUtils.length(valueAsString) == size1 || StringUtils.length(valueAsString) == size2;
} | [
"@",
"Override",
"public",
"final",
"boolean",
"isValid",
"(",
"final",
"Object",
"pvalue",
",",
"final",
"ConstraintValidatorContext",
"pcontext",
")",
"{",
"String",
"valueAsString",
"=",
"Objects",
".",
"toString",
"(",
"pvalue",
",",
"StringUtils",
".",
"EMP... | {@inheritDoc} check if given object is valid.
@see javax.validation.ConstraintValidator#isValid(Object,
javax.validation.ConstraintValidatorContext) | [
"{",
"@inheritDoc",
"}",
"check",
"if",
"given",
"object",
"is",
"valid",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/AlternateSizeValidator.java#L79-L95 |
Azure/azure-sdk-for-java | containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java | ManagedClustersInner.listClusterAdminCredentialsAsync | public Observable<CredentialResultsInner> listClusterAdminCredentialsAsync(String resourceGroupName, String resourceName) {
return listClusterAdminCredentialsWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<CredentialResultsInner>, CredentialResultsInner>() {
@Override
public CredentialResultsInner call(ServiceResponse<CredentialResultsInner> response) {
return response.body();
}
});
} | java | public Observable<CredentialResultsInner> listClusterAdminCredentialsAsync(String resourceGroupName, String resourceName) {
return listClusterAdminCredentialsWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<CredentialResultsInner>, CredentialResultsInner>() {
@Override
public CredentialResultsInner call(ServiceResponse<CredentialResultsInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"CredentialResultsInner",
">",
"listClusterAdminCredentialsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"return",
"listClusterAdminCredentialsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resource... | Gets cluster admin credential of a managed cluster.
Gets cluster admin credential of the managed cluster with a specified resource group and name.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the managed cluster resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CredentialResultsInner object | [
"Gets",
"cluster",
"admin",
"credential",
"of",
"a",
"managed",
"cluster",
".",
"Gets",
"cluster",
"admin",
"credential",
"of",
"the",
"managed",
"cluster",
"with",
"a",
"specified",
"resource",
"group",
"and",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java#L600-L607 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java | VirtualNetworkGatewaysInner.getVpnProfilePackageUrlAsync | public Observable<String> getVpnProfilePackageUrlAsync(String resourceGroupName, String virtualNetworkGatewayName) {
return getVpnProfilePackageUrlWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<String>, String>() {
@Override
public String call(ServiceResponse<String> response) {
return response.body();
}
});
} | java | public Observable<String> getVpnProfilePackageUrlAsync(String resourceGroupName, String virtualNetworkGatewayName) {
return getVpnProfilePackageUrlWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<String>, String>() {
@Override
public String call(ServiceResponse<String> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"String",
">",
"getVpnProfilePackageUrlAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayName",
")",
"{",
"return",
"getVpnProfilePackageUrlWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetworkGatew... | Gets pre-generated VPN profile for P2S client of the virtual network gateway in the specified resource group. The profile needs to be generated first using generateVpnProfile.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayName The name of the virtual network gateway.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Gets",
"pre",
"-",
"generated",
"VPN",
"profile",
"for",
"P2S",
"client",
"of",
"the",
"virtual",
"network",
"gateway",
"in",
"the",
"specified",
"resource",
"group",
".",
"The",
"profile",
"needs",
"to",
"be",
"generated",
"first",
"using",
"generateVpnProfi... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L1824-L1831 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyRep.java | KeyRep.readResolve | protected Object readResolve() throws ObjectStreamException {
try {
if (type == Type.SECRET && RAW.equals(format)) {
return new SecretKeySpec(encoded, algorithm);
} else if (type == Type.PUBLIC && X509.equals(format)) {
KeyFactory f = KeyFactory.getInstance(algorithm);
return f.generatePublic(new X509EncodedKeySpec(encoded));
} else if (type == Type.PRIVATE && PKCS8.equals(format)) {
KeyFactory f = KeyFactory.getInstance(algorithm);
return f.generatePrivate(new PKCS8EncodedKeySpec(encoded));
} else {
throw new NotSerializableException
("unrecognized type/format combination: " +
type + "/" + format);
}
} catch (NotSerializableException nse) {
throw nse;
} catch (Exception e) {
NotSerializableException nse = new NotSerializableException
("java.security.Key: " +
"[" + type + "] " +
"[" + algorithm + "] " +
"[" + format + "]");
nse.initCause(e);
throw nse;
}
} | java | protected Object readResolve() throws ObjectStreamException {
try {
if (type == Type.SECRET && RAW.equals(format)) {
return new SecretKeySpec(encoded, algorithm);
} else if (type == Type.PUBLIC && X509.equals(format)) {
KeyFactory f = KeyFactory.getInstance(algorithm);
return f.generatePublic(new X509EncodedKeySpec(encoded));
} else if (type == Type.PRIVATE && PKCS8.equals(format)) {
KeyFactory f = KeyFactory.getInstance(algorithm);
return f.generatePrivate(new PKCS8EncodedKeySpec(encoded));
} else {
throw new NotSerializableException
("unrecognized type/format combination: " +
type + "/" + format);
}
} catch (NotSerializableException nse) {
throw nse;
} catch (Exception e) {
NotSerializableException nse = new NotSerializableException
("java.security.Key: " +
"[" + type + "] " +
"[" + algorithm + "] " +
"[" + format + "]");
nse.initCause(e);
throw nse;
}
} | [
"protected",
"Object",
"readResolve",
"(",
")",
"throws",
"ObjectStreamException",
"{",
"try",
"{",
"if",
"(",
"type",
"==",
"Type",
".",
"SECRET",
"&&",
"RAW",
".",
"equals",
"(",
"format",
")",
")",
"{",
"return",
"new",
"SecretKeySpec",
"(",
"encoded",
... | Resolve the Key object.
<p> This method supports three Type/format combinations:
<ul>
<li> Type.SECRET/"RAW" - returns a SecretKeySpec object
constructed using encoded key bytes and algorithm
<li> Type.PUBLIC/"X.509" - gets a KeyFactory instance for
the key algorithm, constructs an X509EncodedKeySpec with the
encoded key bytes, and generates a public key from the spec
<li> Type.PRIVATE/"PKCS#8" - gets a KeyFactory instance for
the key algorithm, constructs a PKCS8EncodedKeySpec with the
encoded key bytes, and generates a private key from the spec
</ul>
<p>
@return the resolved Key object
@exception ObjectStreamException if the Type/format
combination is unrecognized, if the algorithm, key format, or
encoded key bytes are unrecognized/invalid, of if the
resolution of the key fails for any reason | [
"Resolve",
"the",
"Key",
"object",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyRep.java#L169-L195 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/learning/NesterovsUpdater.java | NesterovsUpdater.applyUpdater | @Override
public void applyUpdater(INDArray gradient, int iteration, int epoch) {
if (v == null)
throw new IllegalStateException("Updater has not been initialized with view state");
double momentum = config.currentMomentum(iteration, epoch);
double learningRate = config.getLearningRate(iteration, epoch);
//reference https://cs231n.github.io/neural-networks-3/#sgd 2nd equation
//DL4J default is negative step function thus we flipped the signs:
// x += mu * v_prev + (-1 - mu) * v
//i.e., we do params -= updatedGradient, not params += updatedGradient
//v = mu * v - lr * gradient
INDArray vPrev = v.dup(gradientReshapeOrder);
v.muli(momentum).subi(gradient.dup(gradientReshapeOrder).muli(learningRate)); //Modify state array in-place
/*
Next line is equivalent to:
INDArray ret = vPrev.muli(momentum).addi(v.mul(-momentum - 1));
gradient.assign(ret);
*/
Nd4j.getExecutioner().exec(new OldAddOp(vPrev.muli(momentum), v.mul(-momentum - 1), gradient));
} | java | @Override
public void applyUpdater(INDArray gradient, int iteration, int epoch) {
if (v == null)
throw new IllegalStateException("Updater has not been initialized with view state");
double momentum = config.currentMomentum(iteration, epoch);
double learningRate = config.getLearningRate(iteration, epoch);
//reference https://cs231n.github.io/neural-networks-3/#sgd 2nd equation
//DL4J default is negative step function thus we flipped the signs:
// x += mu * v_prev + (-1 - mu) * v
//i.e., we do params -= updatedGradient, not params += updatedGradient
//v = mu * v - lr * gradient
INDArray vPrev = v.dup(gradientReshapeOrder);
v.muli(momentum).subi(gradient.dup(gradientReshapeOrder).muli(learningRate)); //Modify state array in-place
/*
Next line is equivalent to:
INDArray ret = vPrev.muli(momentum).addi(v.mul(-momentum - 1));
gradient.assign(ret);
*/
Nd4j.getExecutioner().exec(new OldAddOp(vPrev.muli(momentum), v.mul(-momentum - 1), gradient));
} | [
"@",
"Override",
"public",
"void",
"applyUpdater",
"(",
"INDArray",
"gradient",
",",
"int",
"iteration",
",",
"int",
"epoch",
")",
"{",
"if",
"(",
"v",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Updater has not been initialized with view s... | Get the nesterov update
@param gradient the gradient to get the update for
@param iteration
@return | [
"Get",
"the",
"nesterov",
"update"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/learning/NesterovsUpdater.java#L68-L91 |
apiman/apiman | common/plugin/src/main/java/io/apiman/common/plugin/PluginClassLoader.java | PluginClassLoader.extractResource | private URL extractResource(ZipEntry zipEntry) throws IOException {
File resourceWorkDir = new File(workDir, "resources");
if (!resourceWorkDir.exists()) {
resourceWorkDir.mkdirs();
}
File resourceFile = new File(resourceWorkDir, zipEntry.getName());
if (!resourceFile.isFile()) {
resourceFile.getParentFile().mkdirs();
File tmpFile = File.createTempFile("res", ".tmp", resourceWorkDir);
tmpFile.deleteOnExit();
InputStream input = null;
OutputStream output = null;
try {
input = this.pluginArtifactZip.getInputStream(zipEntry);
output = new FileOutputStream(tmpFile);
IOUtils.copy(input, output);
output.flush();
tmpFile.renameTo(resourceFile);
} catch (IOException e) {
throw e;
} finally {
IOUtils.closeQuietly(input);
IOUtils.closeQuietly(output);
}
}
return resourceFile.toURI().toURL();
} | java | private URL extractResource(ZipEntry zipEntry) throws IOException {
File resourceWorkDir = new File(workDir, "resources");
if (!resourceWorkDir.exists()) {
resourceWorkDir.mkdirs();
}
File resourceFile = new File(resourceWorkDir, zipEntry.getName());
if (!resourceFile.isFile()) {
resourceFile.getParentFile().mkdirs();
File tmpFile = File.createTempFile("res", ".tmp", resourceWorkDir);
tmpFile.deleteOnExit();
InputStream input = null;
OutputStream output = null;
try {
input = this.pluginArtifactZip.getInputStream(zipEntry);
output = new FileOutputStream(tmpFile);
IOUtils.copy(input, output);
output.flush();
tmpFile.renameTo(resourceFile);
} catch (IOException e) {
throw e;
} finally {
IOUtils.closeQuietly(input);
IOUtils.closeQuietly(output);
}
}
return resourceFile.toURI().toURL();
} | [
"private",
"URL",
"extractResource",
"(",
"ZipEntry",
"zipEntry",
")",
"throws",
"IOException",
"{",
"File",
"resourceWorkDir",
"=",
"new",
"File",
"(",
"workDir",
",",
"\"resources\"",
")",
";",
"if",
"(",
"!",
"resourceWorkDir",
".",
"exists",
"(",
")",
")... | Extracts a resource from the plugin artifact ZIP and saves it to the work
directory. If the resource has already been extracted (we're re-using the
work directory) then this simply returns what is already there.
@param zipEntry a ZIP file entry
@throws IOException if an I/O error has occurred | [
"Extracts",
"a",
"resource",
"from",
"the",
"plugin",
"artifact",
"ZIP",
"and",
"saves",
"it",
"to",
"the",
"work",
"directory",
".",
"If",
"the",
"resource",
"has",
"already",
"been",
"extracted",
"(",
"we",
"re",
"re",
"-",
"using",
"the",
"work",
"dir... | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/plugin/src/main/java/io/apiman/common/plugin/PluginClassLoader.java#L150-L176 |
gallandarakhneorg/afc | core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/AbstractTreeNode.java | AbstractTreeNode.firePropertyParentChanged | protected final void firePropertyParentChanged(N oldParent, N newParent) {
firePropertyParentChanged(new TreeNodeParentChangedEvent(toN(), oldParent, newParent));
} | java | protected final void firePropertyParentChanged(N oldParent, N newParent) {
firePropertyParentChanged(new TreeNodeParentChangedEvent(toN(), oldParent, newParent));
} | [
"protected",
"final",
"void",
"firePropertyParentChanged",
"(",
"N",
"oldParent",
",",
"N",
"newParent",
")",
"{",
"firePropertyParentChanged",
"(",
"new",
"TreeNodeParentChangedEvent",
"(",
"toN",
"(",
")",
",",
"oldParent",
",",
"newParent",
")",
")",
";",
"}"... | Fire the event for the changes node parents.
@param oldParent is the previous parent node
@param newParent is the current parent node | [
"Fire",
"the",
"event",
"for",
"the",
"changes",
"node",
"parents",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/AbstractTreeNode.java#L233-L235 |
landawn/AbacusUtil | src/com/landawn/abacus/util/FloatList.java | FloatList.allMatch | public <E extends Exception> boolean allMatch(Try.FloatPredicate<E> filter) throws E {
return allMatch(0, size(), filter);
} | java | public <E extends Exception> boolean allMatch(Try.FloatPredicate<E> filter) throws E {
return allMatch(0, size(), filter);
} | [
"public",
"<",
"E",
"extends",
"Exception",
">",
"boolean",
"allMatch",
"(",
"Try",
".",
"FloatPredicate",
"<",
"E",
">",
"filter",
")",
"throws",
"E",
"{",
"return",
"allMatch",
"(",
"0",
",",
"size",
"(",
")",
",",
"filter",
")",
";",
"}"
] | Returns whether all elements of this List match the provided predicate.
@param filter
@return | [
"Returns",
"whether",
"all",
"elements",
"of",
"this",
"List",
"match",
"the",
"provided",
"predicate",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/FloatList.java#L905-L907 |
nmdp-bioinformatics/ngs | range/src/main/java/org/nmdp/ngs/range/rtree/RangeGeometries.java | RangeGeometries.closedOpen | public static <N extends Number & Comparable<? super N>> Rectangle closedOpen(final N lower, final N upper) {
checkNotNull(lower);
checkNotNull(upper);
return range(Range.closedOpen(lower, upper));
} | java | public static <N extends Number & Comparable<? super N>> Rectangle closedOpen(final N lower, final N upper) {
checkNotNull(lower);
checkNotNull(upper);
return range(Range.closedOpen(lower, upper));
} | [
"public",
"static",
"<",
"N",
"extends",
"Number",
"&",
"Comparable",
"<",
"?",
"super",
"N",
">",
">",
"Rectangle",
"closedOpen",
"(",
"final",
"N",
"lower",
",",
"final",
"N",
"upper",
")",
"{",
"checkNotNull",
"(",
"lower",
")",
";",
"checkNotNull",
... | Create and return a new rectangle geometry from the specified closed open range <code>[lower..upper)</code>.
@param lower lower endpoint, must not be null
@param upper upper endpoint, must not be null
@return a new rectangle geometry from the specified closed range | [
"Create",
"and",
"return",
"a",
"new",
"rectangle",
"geometry",
"from",
"the",
"specified",
"closed",
"open",
"range",
"<code",
">",
"[",
"lower",
"..",
"upper",
")",
"<",
"/",
"code",
">",
"."
] | train | https://github.com/nmdp-bioinformatics/ngs/blob/277627e4311313a80f5dc110b3185b0d7af32bd0/range/src/main/java/org/nmdp/ngs/range/rtree/RangeGeometries.java#L91-L95 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ClasspathUtility.java | ClasspathUtility.checkResource | private static void checkResource(final List<String> resources, final Pattern searchPattern, final String resourceName) {
if (searchPattern.matcher(resourceName).matches()) {
resources.add(resourceName);
}
} | java | private static void checkResource(final List<String> resources, final Pattern searchPattern, final String resourceName) {
if (searchPattern.matcher(resourceName).matches()) {
resources.add(resourceName);
}
} | [
"private",
"static",
"void",
"checkResource",
"(",
"final",
"List",
"<",
"String",
">",
"resources",
",",
"final",
"Pattern",
"searchPattern",
",",
"final",
"String",
"resourceName",
")",
"{",
"if",
"(",
"searchPattern",
".",
"matcher",
"(",
"resourceName",
")... | Check if the resource match the regex.
@param resources the list of found resources
@param searchPattern the regex pattern
@param resourceName the resource to check and to add | [
"Check",
"if",
"the",
"resource",
"match",
"the",
"regex",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ClasspathUtility.java#L226-L230 |
inkstand-io/scribble | scribble-jcr/src/main/java/io/inkstand/scribble/jcr/JCRAssert.java | JCRAssert.assertNodeExistById | public static void assertNodeExistById(final Session session, final String itemId) throws RepositoryException {
try {
session.getNodeByIdentifier(itemId);
} catch (final ItemNotFoundException e) {
LOG.debug("Item with id {} does not exist", itemId, e);
fail(e.getMessage());
}
} | java | public static void assertNodeExistById(final Session session, final String itemId) throws RepositoryException {
try {
session.getNodeByIdentifier(itemId);
} catch (final ItemNotFoundException e) {
LOG.debug("Item with id {} does not exist", itemId, e);
fail(e.getMessage());
}
} | [
"public",
"static",
"void",
"assertNodeExistById",
"(",
"final",
"Session",
"session",
",",
"final",
"String",
"itemId",
")",
"throws",
"RepositoryException",
"{",
"try",
"{",
"session",
".",
"getNodeByIdentifier",
"(",
"itemId",
")",
";",
"}",
"catch",
"(",
"... | Asserts that an item, identified by it's unique id, is found in the repository session.
@param session
the session to be searched
@param itemId
the item expected to be found
@throws RepositoryException | [
"Asserts",
"that",
"an",
"item",
"identified",
"by",
"it",
"s",
"unique",
"id",
"is",
"found",
"in",
"the",
"repository",
"session",
"."
] | train | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/JCRAssert.java#L117-L124 |
cdk/cdk | base/valencycheck/src/main/java/org/openscience/cdk/tools/SmilesValencyChecker.java | SmilesValencyChecker.couldMatchAtomType | public boolean couldMatchAtomType(IAtom atom, double bondOrderSum, IBond.Order maxBondOrder, IAtomType type) {
logger.debug("couldMatchAtomType: ... matching atom ", atom, " vs ", type);
int hcount = atom.getImplicitHydrogenCount();
int charge = atom.getFormalCharge();
if (charge == type.getFormalCharge()) {
logger.debug("couldMatchAtomType: formal charge matches...");
// if (atom.getHybridization() == type.getHybridization()) {
// logger.debug("couldMatchAtomType: hybridization is OK...");
if (bondOrderSum + hcount <= type.getBondOrderSum()) {
logger.debug("couldMatchAtomType: bond order sum is OK...");
if (!BondManipulator.isHigherOrder(maxBondOrder, type.getMaxBondOrder())) {
logger.debug("couldMatchAtomType: max bond order is OK... We have a match!");
return true;
}
} else {
logger.debug("couldMatchAtomType: no match", "" + (bondOrderSum + hcount), " > ",
"" + type.getBondOrderSum());
}
// }
} else {
logger.debug("couldMatchAtomType: formal charge does NOT match...");
}
logger.debug("couldMatchAtomType: No Match");
return false;
} | java | public boolean couldMatchAtomType(IAtom atom, double bondOrderSum, IBond.Order maxBondOrder, IAtomType type) {
logger.debug("couldMatchAtomType: ... matching atom ", atom, " vs ", type);
int hcount = atom.getImplicitHydrogenCount();
int charge = atom.getFormalCharge();
if (charge == type.getFormalCharge()) {
logger.debug("couldMatchAtomType: formal charge matches...");
// if (atom.getHybridization() == type.getHybridization()) {
// logger.debug("couldMatchAtomType: hybridization is OK...");
if (bondOrderSum + hcount <= type.getBondOrderSum()) {
logger.debug("couldMatchAtomType: bond order sum is OK...");
if (!BondManipulator.isHigherOrder(maxBondOrder, type.getMaxBondOrder())) {
logger.debug("couldMatchAtomType: max bond order is OK... We have a match!");
return true;
}
} else {
logger.debug("couldMatchAtomType: no match", "" + (bondOrderSum + hcount), " > ",
"" + type.getBondOrderSum());
}
// }
} else {
logger.debug("couldMatchAtomType: formal charge does NOT match...");
}
logger.debug("couldMatchAtomType: No Match");
return false;
} | [
"public",
"boolean",
"couldMatchAtomType",
"(",
"IAtom",
"atom",
",",
"double",
"bondOrderSum",
",",
"IBond",
".",
"Order",
"maxBondOrder",
",",
"IAtomType",
"type",
")",
"{",
"logger",
".",
"debug",
"(",
"\"couldMatchAtomType: ... matching atom \"",
",",
"atom",
... | Determines if the atom can be of type AtomType. That is, it sees if this
AtomType only differs in bond orders, or implicit hydrogen count. | [
"Determines",
"if",
"the",
"atom",
"can",
"be",
"of",
"type",
"AtomType",
".",
"That",
"is",
"it",
"sees",
"if",
"this",
"AtomType",
"only",
"differs",
"in",
"bond",
"orders",
"or",
"implicit",
"hydrogen",
"count",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/valencycheck/src/main/java/org/openscience/cdk/tools/SmilesValencyChecker.java#L232-L256 |
groupon/odo | client/src/main/java/com/groupon/odo/client/PathValueClient.java | PathValueClient.setCustomResponse | public boolean setCustomResponse(String pathValue, String requestType, String customData) {
try {
JSONObject path = getPathFromEndpoint(pathValue, requestType);
if (path == null) {
String pathName = pathValue;
createPath(pathName, pathValue, requestType);
path = getPathFromEndpoint(pathValue, requestType);
}
String pathId = path.getString("pathId");
resetResponseOverride(pathId);
setCustomResponse(pathId, customData);
return toggleResponseOverride(pathId, true);
} catch (Exception e) {
e.printStackTrace();
}
return false;
} | java | public boolean setCustomResponse(String pathValue, String requestType, String customData) {
try {
JSONObject path = getPathFromEndpoint(pathValue, requestType);
if (path == null) {
String pathName = pathValue;
createPath(pathName, pathValue, requestType);
path = getPathFromEndpoint(pathValue, requestType);
}
String pathId = path.getString("pathId");
resetResponseOverride(pathId);
setCustomResponse(pathId, customData);
return toggleResponseOverride(pathId, true);
} catch (Exception e) {
e.printStackTrace();
}
return false;
} | [
"public",
"boolean",
"setCustomResponse",
"(",
"String",
"pathValue",
",",
"String",
"requestType",
",",
"String",
"customData",
")",
"{",
"try",
"{",
"JSONObject",
"path",
"=",
"getPathFromEndpoint",
"(",
"pathValue",
",",
"requestType",
")",
";",
"if",
"(",
... | Sets a custom response on an endpoint
@param pathValue path (endpoint) value
@param requestType path request type. "GET", "POST", etc
@param customData custom response data
@return true if success, false otherwise | [
"Sets",
"a",
"custom",
"response",
"on",
"an",
"endpoint"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/PathValueClient.java#L125-L141 |
javalite/activejdbc | javalite-common/src/main/java/org/javalite/common/Templator.java | Templator.mergeFromTemplate | public static String mergeFromTemplate(String template, Map<String, ?> values) {
for (String param : values.keySet()) {
template = template.replace("{{" + param + "}}", values.get(param) == null ? "" : values.get(param).toString());
}
return template.replaceAll("\n|\r| ", "");
} | java | public static String mergeFromTemplate(String template, Map<String, ?> values) {
for (String param : values.keySet()) {
template = template.replace("{{" + param + "}}", values.get(param) == null ? "" : values.get(param).toString());
}
return template.replaceAll("\n|\r| ", "");
} | [
"public",
"static",
"String",
"mergeFromTemplate",
"(",
"String",
"template",
",",
"Map",
"<",
"String",
",",
"?",
">",
"values",
")",
"{",
"for",
"(",
"String",
"param",
":",
"values",
".",
"keySet",
"(",
")",
")",
"{",
"template",
"=",
"template",
".... | Merges from string as template.
@param template template content, with placeholders like: {{name}}
@param values map with values to merge | [
"Merges",
"from",
"string",
"as",
"template",
"."
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Templator.java#L91-L96 |
imsweb/naaccr-xml | src/main/java/com/imsweb/naaccrxml/runtime/NaaccrStreamContext.java | NaaccrStreamContext.extractTag | public String extractTag(String tag) throws NaaccrIOException {
if (tag == null)
throw new NaaccrIOException("missing tag");
int idx = tag.indexOf(':');
if (idx != -1) {
String namespace = tag.substring(0, idx), cleanTag = tag.substring(idx + 1);
// check for the namespace only if the tag is a default one (Patient, Tumor, etc...) or if extensions are enabled
if (_configuration.getAllowedTagsForNamespacePrefix(null).contains(cleanTag) || !Boolean.TRUE.equals(_options.getIgnoreExtensions())) {
Set<String> allowedTags = _configuration.getAllowedTagsForNamespacePrefix(namespace);
if (allowedTags == null || !allowedTags.contains(cleanTag))
throw new NaaccrIOException("tag '" + cleanTag + "' is not allowed for namespace '" + namespace + "'");
}
return cleanTag;
}
else {
if (Boolean.TRUE.equals(_options.getUseStrictNamespaces()) && !_configuration.getAllowedTagsForNamespacePrefix(null).contains(tag))
throw new NaaccrIOException("tag '" + tag + "' needs to be defined within a namespace");
return tag;
}
} | java | public String extractTag(String tag) throws NaaccrIOException {
if (tag == null)
throw new NaaccrIOException("missing tag");
int idx = tag.indexOf(':');
if (idx != -1) {
String namespace = tag.substring(0, idx), cleanTag = tag.substring(idx + 1);
// check for the namespace only if the tag is a default one (Patient, Tumor, etc...) or if extensions are enabled
if (_configuration.getAllowedTagsForNamespacePrefix(null).contains(cleanTag) || !Boolean.TRUE.equals(_options.getIgnoreExtensions())) {
Set<String> allowedTags = _configuration.getAllowedTagsForNamespacePrefix(namespace);
if (allowedTags == null || !allowedTags.contains(cleanTag))
throw new NaaccrIOException("tag '" + cleanTag + "' is not allowed for namespace '" + namespace + "'");
}
return cleanTag;
}
else {
if (Boolean.TRUE.equals(_options.getUseStrictNamespaces()) && !_configuration.getAllowedTagsForNamespacePrefix(null).contains(tag))
throw new NaaccrIOException("tag '" + tag + "' needs to be defined within a namespace");
return tag;
}
} | [
"public",
"String",
"extractTag",
"(",
"String",
"tag",
")",
"throws",
"NaaccrIOException",
"{",
"if",
"(",
"tag",
"==",
"null",
")",
"throw",
"new",
"NaaccrIOException",
"(",
"\"missing tag\"",
")",
";",
"int",
"idx",
"=",
"tag",
".",
"indexOf",
"(",
"'",... | Extracts the tag from the given raw tag (which might contain a namespace).
@param tag tag without any namespace
@return the tag without any namespace
@throws NaaccrIOException if anything goes wrong | [
"Extracts",
"the",
"tag",
"from",
"the",
"given",
"raw",
"tag",
"(",
"which",
"might",
"contain",
"a",
"namespace",
")",
"."
] | train | https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/runtime/NaaccrStreamContext.java#L57-L76 |
ModeShape/modeshape | web/modeshape-web-explorer/src/main/java/org/modeshape/web/server/JcrServiceImpl.java | JcrServiceImpl.values | private String values( PropertyDefinition pd, Property p ) throws RepositoryException {
if (p == null) {
return "N/A";
}
if (pd.getRequiredType() == PropertyType.BINARY) {
return "BINARY";
}
if (!p.isMultiple()) {
return p.getString();
}
return multiValue(p);
} | java | private String values( PropertyDefinition pd, Property p ) throws RepositoryException {
if (p == null) {
return "N/A";
}
if (pd.getRequiredType() == PropertyType.BINARY) {
return "BINARY";
}
if (!p.isMultiple()) {
return p.getString();
}
return multiValue(p);
} | [
"private",
"String",
"values",
"(",
"PropertyDefinition",
"pd",
",",
"Property",
"p",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"p",
"==",
"null",
")",
"{",
"return",
"\"N/A\"",
";",
"}",
"if",
"(",
"pd",
".",
"getRequiredType",
"(",
")",
"==... | Displays property value as string
@param pd the property definition
@param p the property to display
@return property value as text string
@throws RepositoryException | [
"Displays",
"property",
"value",
"as",
"string"
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-web-explorer/src/main/java/org/modeshape/web/server/JcrServiceImpl.java#L440-L454 |
aws/aws-sdk-java | aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/SearchProductsResult.java | SearchProductsResult.setProductViewAggregations | public void setProductViewAggregations(java.util.Map<String, java.util.List<ProductViewAggregationValue>> productViewAggregations) {
this.productViewAggregations = productViewAggregations;
} | java | public void setProductViewAggregations(java.util.Map<String, java.util.List<ProductViewAggregationValue>> productViewAggregations) {
this.productViewAggregations = productViewAggregations;
} | [
"public",
"void",
"setProductViewAggregations",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"java",
".",
"util",
".",
"List",
"<",
"ProductViewAggregationValue",
">",
">",
"productViewAggregations",
")",
"{",
"this",
".",
"productViewAggregations",
... | <p>
The product view aggregations.
</p>
@param productViewAggregations
The product view aggregations. | [
"<p",
">",
"The",
"product",
"view",
"aggregations",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/SearchProductsResult.java#L137-L139 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/ellipse/SnapToEllipseEdge.java | SnapToEllipseEdge.change | protected static double change( EllipseRotated_F64 a , EllipseRotated_F64 b ) {
double total = 0;
total += Math.abs(a.center.x - b.center.x);
total += Math.abs(a.center.y - b.center.y);
total += Math.abs(a.a - b.a);
total += Math.abs(a.b - b.b);
// only care about the change of angle when it is not a circle
double weight = Math.min(4,2.0*(a.a/a.b-1.0));
total += weight*UtilAngle.distHalf(a.phi , b.phi);
return total;
} | java | protected static double change( EllipseRotated_F64 a , EllipseRotated_F64 b ) {
double total = 0;
total += Math.abs(a.center.x - b.center.x);
total += Math.abs(a.center.y - b.center.y);
total += Math.abs(a.a - b.a);
total += Math.abs(a.b - b.b);
// only care about the change of angle when it is not a circle
double weight = Math.min(4,2.0*(a.a/a.b-1.0));
total += weight*UtilAngle.distHalf(a.phi , b.phi);
return total;
} | [
"protected",
"static",
"double",
"change",
"(",
"EllipseRotated_F64",
"a",
",",
"EllipseRotated_F64",
"b",
")",
"{",
"double",
"total",
"=",
"0",
";",
"total",
"+=",
"Math",
".",
"abs",
"(",
"a",
".",
"center",
".",
"x",
"-",
"b",
".",
"center",
".",
... | Computes a numerical value for the difference in parameters between the two ellipses | [
"Computes",
"a",
"numerical",
"value",
"for",
"the",
"difference",
"in",
"parameters",
"between",
"the",
"two",
"ellipses"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/ellipse/SnapToEllipseEdge.java#L116-L129 |
hibernate/hibernate-ogm | infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/impl/InfinispanEmbeddedStoredProceduresManager.java | InfinispanEmbeddedStoredProceduresManager.callStoredProcedure | public ClosableIterator<Tuple> callStoredProcedure(EmbeddedCacheManager embeddedCacheManager, String storedProcedureName, ProcedureQueryParameters queryParameters, ClassLoaderService classLoaderService ) {
validate( queryParameters );
Cache<String, String> cache = embeddedCacheManager.getCache( STORED_PROCEDURES_CACHE_NAME, true );
String className = cache.getOrDefault( storedProcedureName, storedProcedureName );
Callable<?> callable = instantiate( storedProcedureName, className, classLoaderService );
setParams( storedProcedureName, queryParameters, callable );
Object res = execute( storedProcedureName, embeddedCacheManager, callable );
return extractResultSet( storedProcedureName, res );
} | java | public ClosableIterator<Tuple> callStoredProcedure(EmbeddedCacheManager embeddedCacheManager, String storedProcedureName, ProcedureQueryParameters queryParameters, ClassLoaderService classLoaderService ) {
validate( queryParameters );
Cache<String, String> cache = embeddedCacheManager.getCache( STORED_PROCEDURES_CACHE_NAME, true );
String className = cache.getOrDefault( storedProcedureName, storedProcedureName );
Callable<?> callable = instantiate( storedProcedureName, className, classLoaderService );
setParams( storedProcedureName, queryParameters, callable );
Object res = execute( storedProcedureName, embeddedCacheManager, callable );
return extractResultSet( storedProcedureName, res );
} | [
"public",
"ClosableIterator",
"<",
"Tuple",
">",
"callStoredProcedure",
"(",
"EmbeddedCacheManager",
"embeddedCacheManager",
",",
"String",
"storedProcedureName",
",",
"ProcedureQueryParameters",
"queryParameters",
",",
"ClassLoaderService",
"classLoaderService",
")",
"{",
"v... | Returns the result of a stored procedure executed on the backend.
@param embeddedCacheManager embedded cache manager
@param storedProcedureName name of stored procedure
@param queryParameters parameters passed for this query
@param classLoaderService the class loader service
@return a {@link ClosableIterator} with the result of the query | [
"Returns",
"the",
"result",
"of",
"a",
"stored",
"procedure",
"executed",
"on",
"the",
"backend",
"."
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/impl/InfinispanEmbeddedStoredProceduresManager.java#L51-L59 |
haraldk/TwelveMonkeys | common/common-image/src/main/java/com/twelvemonkeys/image/BufferedImageFactory.java | BufferedImageFactory.setSourceSubsampling | public void setSourceSubsampling(int pXSub, int pYSub) {
// Re-fetch everything, if subsampling changed
if (xSub != pXSub || ySub != pYSub) {
dispose();
}
if (pXSub > 1) {
xSub = pXSub;
}
if (pYSub > 1) {
ySub = pYSub;
}
} | java | public void setSourceSubsampling(int pXSub, int pYSub) {
// Re-fetch everything, if subsampling changed
if (xSub != pXSub || ySub != pYSub) {
dispose();
}
if (pXSub > 1) {
xSub = pXSub;
}
if (pYSub > 1) {
ySub = pYSub;
}
} | [
"public",
"void",
"setSourceSubsampling",
"(",
"int",
"pXSub",
",",
"int",
"pYSub",
")",
"{",
"// Re-fetch everything, if subsampling changed",
"if",
"(",
"xSub",
"!=",
"pXSub",
"||",
"ySub",
"!=",
"pYSub",
")",
"{",
"dispose",
"(",
")",
";",
"}",
"if",
"(",... | Sets the source subsampling for the new image.
@param pXSub horizontal subsampling factor
@param pYSub vertical subsampling factor | [
"Sets",
"the",
"source",
"subsampling",
"for",
"the",
"new",
"image",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/BufferedImageFactory.java#L176-L188 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java | BoxApiBookmark.getCopyRequest | public BoxRequestsBookmark.CopyBookmark getCopyRequest(String id, String parentId) {
BoxRequestsBookmark.CopyBookmark request = new BoxRequestsBookmark.CopyBookmark(id, parentId, getBookmarkCopyUrl(id), mSession);
return request;
} | java | public BoxRequestsBookmark.CopyBookmark getCopyRequest(String id, String parentId) {
BoxRequestsBookmark.CopyBookmark request = new BoxRequestsBookmark.CopyBookmark(id, parentId, getBookmarkCopyUrl(id), mSession);
return request;
} | [
"public",
"BoxRequestsBookmark",
".",
"CopyBookmark",
"getCopyRequest",
"(",
"String",
"id",
",",
"String",
"parentId",
")",
"{",
"BoxRequestsBookmark",
".",
"CopyBookmark",
"request",
"=",
"new",
"BoxRequestsBookmark",
".",
"CopyBookmark",
"(",
"id",
",",
"parentId... | Gets a request that copies a bookmark
@param id id of the bookmark to copy
@param parentId id of the parent folder to copy the bookmark into
@return request to copy a bookmark | [
"Gets",
"a",
"request",
"that",
"copies",
"a",
"bookmark"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java#L108-L111 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java | FormLayout.setHonorsVisibility | public void setHonorsVisibility(Component component, Boolean b) {
CellConstraints constraints = getConstraints0(component);
if (Objects.equals(b, constraints.honorsVisibility)) {
return;
}
constraints.honorsVisibility = b;
invalidateAndRepaint(component.getParent());
} | java | public void setHonorsVisibility(Component component, Boolean b) {
CellConstraints constraints = getConstraints0(component);
if (Objects.equals(b, constraints.honorsVisibility)) {
return;
}
constraints.honorsVisibility = b;
invalidateAndRepaint(component.getParent());
} | [
"public",
"void",
"setHonorsVisibility",
"(",
"Component",
"component",
",",
"Boolean",
"b",
")",
"{",
"CellConstraints",
"constraints",
"=",
"getConstraints0",
"(",
"component",
")",
";",
"if",
"(",
"Objects",
".",
"equals",
"(",
"b",
",",
"constraints",
".",... | Specifies whether the given component shall be taken into account for sizing and positioning.
This setting overrides the container-wide default. See {@link #setHonorsVisibility(boolean)}
for details.
@param component the component that shall get an individual setting
@param b {@code Boolean.TRUE} to override the container default and honor the visibility for
the given component, {@code Boolean.FALSE} to override the container default and ignore the
visibility for the given component, {@code null} to use the container default value as
specified by {@link #getHonorsVisibility()}.
@since 1.2 | [
"Specifies",
"whether",
"the",
"given",
"component",
"shall",
"be",
"taken",
"into",
"account",
"for",
"sizing",
"and",
"positioning",
".",
"This",
"setting",
"overrides",
"the",
"container",
"-",
"wide",
"default",
".",
"See",
"{",
"@link",
"#setHonorsVisibilit... | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java#L985-L992 |
arquillian/arquillian-core | container/impl-base/src/main/java/org/jboss/arquillian/container/impl/client/container/DeploymentExceptionHandler.java | DeploymentExceptionHandler.containsType | private boolean containsType(Throwable exception, Class<? extends Exception> expectedType) {
Throwable transformedException = transform(exception);
if (transformedException == null) {
return false;
}
if (expectedType.isAssignableFrom(transformedException.getClass())) {
return true;
}
return containsType(transformedException.getCause(), expectedType);
} | java | private boolean containsType(Throwable exception, Class<? extends Exception> expectedType) {
Throwable transformedException = transform(exception);
if (transformedException == null) {
return false;
}
if (expectedType.isAssignableFrom(transformedException.getClass())) {
return true;
}
return containsType(transformedException.getCause(), expectedType);
} | [
"private",
"boolean",
"containsType",
"(",
"Throwable",
"exception",
",",
"Class",
"<",
"?",
"extends",
"Exception",
">",
"expectedType",
")",
"{",
"Throwable",
"transformedException",
"=",
"transform",
"(",
"exception",
")",
";",
"if",
"(",
"transformedException"... | /*
public void verifyExpectedExceptionDuringUnDeploy(@Observes EventContext<UnDeployDeployment> context) throws Exception
{
DeploymentDescription deployment = context.getEvent().getDeployment();
try
{
context.proceed();
}
catch (Exception e)
{
if(deployment.getExpectedException() == null)
{
throw e;
}
}
} | [
"/",
"*",
"public",
"void",
"verifyExpectedExceptionDuringUnDeploy",
"("
] | train | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/container/impl-base/src/main/java/org/jboss/arquillian/container/impl/client/container/DeploymentExceptionHandler.java#L91-L102 |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/shiro/PersistablePropertiesRealm.java | PersistablePropertiesRealm.loadProperties | public void loadProperties(File contentDir) {
String resourceFile = null;
if(contentDir.exists() && contentDir.isDirectory()) {
File propFile = new File(contentDir, REALM_FILE_NAME);
if(propFile.exists() && propFile.canRead()) {
resourceFile = propFile.getAbsoluteFile().getAbsolutePath();
}
} else if(contentDir.exists() && contentDir.isFile() && contentDir.canRead()) {
resourceFile = contentDir.getAbsoluteFile().getAbsolutePath();
}
if(StringUtils.isNotBlank(resourceFile)) {
this.setResourcePath("file:"+resourceFile);
this.destroy();
this.init();
}
} | java | public void loadProperties(File contentDir) {
String resourceFile = null;
if(contentDir.exists() && contentDir.isDirectory()) {
File propFile = new File(contentDir, REALM_FILE_NAME);
if(propFile.exists() && propFile.canRead()) {
resourceFile = propFile.getAbsoluteFile().getAbsolutePath();
}
} else if(contentDir.exists() && contentDir.isFile() && contentDir.canRead()) {
resourceFile = contentDir.getAbsoluteFile().getAbsolutePath();
}
if(StringUtils.isNotBlank(resourceFile)) {
this.setResourcePath("file:"+resourceFile);
this.destroy();
this.init();
}
} | [
"public",
"void",
"loadProperties",
"(",
"File",
"contentDir",
")",
"{",
"String",
"resourceFile",
"=",
"null",
";",
"if",
"(",
"contentDir",
".",
"exists",
"(",
")",
"&&",
"contentDir",
".",
"isDirectory",
"(",
")",
")",
"{",
"File",
"propFile",
"=",
"n... | loads a properties file named {@link REALM_FILE_NAME} in the directory passed in. | [
"loads",
"a",
"properties",
"file",
"named",
"{"
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/shiro/PersistablePropertiesRealm.java#L88-L103 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.addProjectMember | public GitlabProjectMember addProjectMember(Integer projectId, Integer userId, GitlabAccessLevel accessLevel) throws IOException {
Query query = new Query()
.appendIf("id", projectId)
.appendIf("user_id", userId)
.appendIf("access_level", accessLevel);
String tailUrl = GitlabProject.URL + "/" + projectId + GitlabProjectMember.URL + query.toString();
return dispatch().to(tailUrl, GitlabProjectMember.class);
} | java | public GitlabProjectMember addProjectMember(Integer projectId, Integer userId, GitlabAccessLevel accessLevel) throws IOException {
Query query = new Query()
.appendIf("id", projectId)
.appendIf("user_id", userId)
.appendIf("access_level", accessLevel);
String tailUrl = GitlabProject.URL + "/" + projectId + GitlabProjectMember.URL + query.toString();
return dispatch().to(tailUrl, GitlabProjectMember.class);
} | [
"public",
"GitlabProjectMember",
"addProjectMember",
"(",
"Integer",
"projectId",
",",
"Integer",
"userId",
",",
"GitlabAccessLevel",
"accessLevel",
")",
"throws",
"IOException",
"{",
"Query",
"query",
"=",
"new",
"Query",
"(",
")",
".",
"appendIf",
"(",
"\"id\"",... | Add a project member.
@param projectId the project id
@param userId the user id
@param accessLevel the GitlabAccessLevel
@return the GitlabProjectMember
@throws IOException on gitlab api call error | [
"Add",
"a",
"project",
"member",
"."
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3041-L3048 |
Alluxio/alluxio | core/server/worker/src/main/java/alluxio/worker/block/BlockMetadataManager.java | BlockMetadataManager.resizeTempBlockMeta | public void resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long newSize)
throws InvalidWorkerStateException {
StorageDir dir = tempBlockMeta.getParentDir();
dir.resizeTempBlockMeta(tempBlockMeta, newSize);
} | java | public void resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long newSize)
throws InvalidWorkerStateException {
StorageDir dir = tempBlockMeta.getParentDir();
dir.resizeTempBlockMeta(tempBlockMeta, newSize);
} | [
"public",
"void",
"resizeTempBlockMeta",
"(",
"TempBlockMeta",
"tempBlockMeta",
",",
"long",
"newSize",
")",
"throws",
"InvalidWorkerStateException",
"{",
"StorageDir",
"dir",
"=",
"tempBlockMeta",
".",
"getParentDir",
"(",
")",
";",
"dir",
".",
"resizeTempBlockMeta",... | Modifies the size of a temp block.
@param tempBlockMeta the temp block to modify
@param newSize new size in bytes
@throws InvalidWorkerStateException when newSize is smaller than current size | [
"Modifies",
"the",
"size",
"of",
"a",
"temp",
"block",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/BlockMetadataManager.java#L459-L463 |
aalmiray/Json-lib | src/main/java/net/sf/json/JsonConfig.java | JsonConfig.registerJsonBeanProcessor | public void registerJsonBeanProcessor( Class target, JsonBeanProcessor jsonBeanProcessor ) {
if( target != null && jsonBeanProcessor != null ) {
beanProcessorMap.put( target, jsonBeanProcessor );
}
} | java | public void registerJsonBeanProcessor( Class target, JsonBeanProcessor jsonBeanProcessor ) {
if( target != null && jsonBeanProcessor != null ) {
beanProcessorMap.put( target, jsonBeanProcessor );
}
} | [
"public",
"void",
"registerJsonBeanProcessor",
"(",
"Class",
"target",
",",
"JsonBeanProcessor",
"jsonBeanProcessor",
")",
"{",
"if",
"(",
"target",
"!=",
"null",
"&&",
"jsonBeanProcessor",
"!=",
"null",
")",
"{",
"beanProcessorMap",
".",
"put",
"(",
"target",
"... | Registers a JsonBeanProcessor.<br>
[Java -> JSON]
@param target the class to use as key
@param jsonBeanProcessor the processor to register | [
"Registers",
"a",
"JsonBeanProcessor",
".",
"<br",
">",
"[",
"Java",
"-",
">",
";",
"JSON",
"]"
] | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JsonConfig.java#L786-L790 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/bayesian/ConditionalProbabilityTable.java | ConditionalProbabilityTable.query | public double query(int targetClass, int targetValue, int[] cord)
{
double sumVal = 0;
double targetVal = 0;
int realTargetIndex = catIndexToRealIndex[targetClass];
CategoricalData queryData = valid.get(targetClass);
//Now do all other target class posibilty querys
for (int i = 0; i < queryData.getNumOfCategories(); i++)
{
cord[realTargetIndex] = i;
double tmp = countArray[cordToIndex(cord)];
sumVal += tmp;
if (i == targetValue)
targetVal = tmp;
}
return targetVal/sumVal;
} | java | public double query(int targetClass, int targetValue, int[] cord)
{
double sumVal = 0;
double targetVal = 0;
int realTargetIndex = catIndexToRealIndex[targetClass];
CategoricalData queryData = valid.get(targetClass);
//Now do all other target class posibilty querys
for (int i = 0; i < queryData.getNumOfCategories(); i++)
{
cord[realTargetIndex] = i;
double tmp = countArray[cordToIndex(cord)];
sumVal += tmp;
if (i == targetValue)
targetVal = tmp;
}
return targetVal/sumVal;
} | [
"public",
"double",
"query",
"(",
"int",
"targetClass",
",",
"int",
"targetValue",
",",
"int",
"[",
"]",
"cord",
")",
"{",
"double",
"sumVal",
"=",
"0",
";",
"double",
"targetVal",
"=",
"0",
";",
"int",
"realTargetIndex",
"=",
"catIndexToRealIndex",
"[",
... | Queries the CPT for the probability of the target class occurring with the specified value given the class values of the other attributes
@param targetClass the index in the original data set of the class that we want to probability of
@param targetValue the value of the <tt>targetClass</tt> that we want to probability of occurring
@param cord the coordinate array that corresponds the the class values for the CPT, where the coordinate of the <tt>targetClass</tt> may contain any value.
@return the probability in [0, 1] of the <tt>targetClass</tt> occurring with the <tt>targetValue</tt> given the information in <tt>cord</tt>
@see #dataPointToCord(jsat.classifiers.DataPointPair, int, int[]) | [
"Queries",
"the",
"CPT",
"for",
"the",
"probability",
"of",
"the",
"target",
"class",
"occurring",
"with",
"the",
"specified",
"value",
"given",
"the",
"class",
"values",
"of",
"the",
"other",
"attributes"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/bayesian/ConditionalProbabilityTable.java#L225-L248 |
leancloud/java-sdk-all | core/src/main/java/cn/leancloud/AVQuery.java | AVQuery.whereMatchesKeyInQuery | public AVQuery<T> whereMatchesKeyInQuery(String key, String keyInQuery, AVQuery<?> query) {
Map<String, Object> inner = new HashMap<String, Object>();
inner.put("className", query.getClassName());
inner.put("where", query.conditions.compileWhereOperationMap());
if (query.conditions.getSkip() > 0) inner.put("skip", query.conditions.getSkip());
if (query.conditions.getLimit() > 0) inner.put("limit", query.conditions.getLimit());
if (!StringUtil.isEmpty(query.getOrder())) inner.put("order", query.getOrder());
Map<String, Object> queryMap = new HashMap<String, Object>();
queryMap.put("query", inner);
queryMap.put("key", keyInQuery);
return addWhereItem(key, "$select", queryMap);
} | java | public AVQuery<T> whereMatchesKeyInQuery(String key, String keyInQuery, AVQuery<?> query) {
Map<String, Object> inner = new HashMap<String, Object>();
inner.put("className", query.getClassName());
inner.put("where", query.conditions.compileWhereOperationMap());
if (query.conditions.getSkip() > 0) inner.put("skip", query.conditions.getSkip());
if (query.conditions.getLimit() > 0) inner.put("limit", query.conditions.getLimit());
if (!StringUtil.isEmpty(query.getOrder())) inner.put("order", query.getOrder());
Map<String, Object> queryMap = new HashMap<String, Object>();
queryMap.put("query", inner);
queryMap.put("key", keyInQuery);
return addWhereItem(key, "$select", queryMap);
} | [
"public",
"AVQuery",
"<",
"T",
">",
"whereMatchesKeyInQuery",
"(",
"String",
"key",
",",
"String",
"keyInQuery",
",",
"AVQuery",
"<",
"?",
">",
"query",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"inner",
"=",
"new",
"HashMap",
"<",
"String",
... | Add a constraint to the query that requires a particular key's value matches a value for a key
in the results of another AVQuery
@param key The key whose value is being checked
@param keyInQuery The key in the objects from the sub query to look in
@param query The sub query to run
@return Returns the query so you can chain this call. | [
"Add",
"a",
"constraint",
"to",
"the",
"query",
"that",
"requires",
"a",
"particular",
"key",
"s",
"value",
"matches",
"a",
"value",
"for",
"a",
"key",
"in",
"the",
"results",
"of",
"another",
"AVQuery"
] | train | https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/core/src/main/java/cn/leancloud/AVQuery.java#L737-L749 |
mockito/mockito | src/main/java/org/mockito/internal/matchers/apachecommons/EqualsBuilder.java | EqualsBuilder.reflectionEquals | public static boolean reflectionEquals(Object lhs, Object rhs) {
return reflectionEquals(lhs, rhs, false, null, null);
} | java | public static boolean reflectionEquals(Object lhs, Object rhs) {
return reflectionEquals(lhs, rhs, false, null, null);
} | [
"public",
"static",
"boolean",
"reflectionEquals",
"(",
"Object",
"lhs",
",",
"Object",
"rhs",
")",
"{",
"return",
"reflectionEquals",
"(",
"lhs",
",",
"rhs",
",",
"false",
",",
"null",
",",
"null",
")",
";",
"}"
] | <p>This method uses reflection to determine if the two <code>Object</code>s
are equal.</p>
<p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
fields. This means that it will throw a security exception if run under
a security manager, if the permissions are not set up correctly. It is also
not as efficient as testing explicitly.</p>
<p>Transient members will be not be tested, as they are likely derived
fields, and not part of the value of the Object.</p>
<p>Static fields will not be tested. Superclass fields will be included.</p>
@param lhs <code>this</code> object
@param rhs the other object
@return <code>true</code> if the two Objects have tested equals. | [
"<p",
">",
"This",
"method",
"uses",
"reflection",
"to",
"determine",
"if",
"the",
"two",
"<code",
">",
"Object<",
"/",
"code",
">",
"s",
"are",
"equal",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/internal/matchers/apachecommons/EqualsBuilder.java#L115-L117 |
google/closure-templates | java/src/com/google/template/soy/shared/internal/Sanitizers.java | Sanitizers.cleanHtml | public static SanitizedContent cleanHtml(
String value, Collection<? extends OptionalSafeTag> optionalSafeTags) {
return cleanHtml(value, null, optionalSafeTags);
} | java | public static SanitizedContent cleanHtml(
String value, Collection<? extends OptionalSafeTag> optionalSafeTags) {
return cleanHtml(value, null, optionalSafeTags);
} | [
"public",
"static",
"SanitizedContent",
"cleanHtml",
"(",
"String",
"value",
",",
"Collection",
"<",
"?",
"extends",
"OptionalSafeTag",
">",
"optionalSafeTags",
")",
"{",
"return",
"cleanHtml",
"(",
"value",
",",
"null",
",",
"optionalSafeTags",
")",
";",
"}"
] | Normalizes the input HTML while preserving "safe" tags. The content directionality is unknown.
@param optionalSafeTags to add to the basic whitelist of formatting safe tags
@return the normalized input, in the form of {@link SanitizedContent} of {@link
ContentKind#HTML} | [
"Normalizes",
"the",
"input",
"HTML",
"while",
"preserving",
"safe",
"tags",
".",
"The",
"content",
"directionality",
"is",
"unknown",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/shared/internal/Sanitizers.java#L211-L214 |
jMotif/SAX | src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java | SAXRecords.addAll | public void addAll(HashMap<Integer, char[]> records) {
for (Entry<Integer, char[]> e : records.entrySet()) {
this.add(e.getValue(), e.getKey());
}
} | java | public void addAll(HashMap<Integer, char[]> records) {
for (Entry<Integer, char[]> e : records.entrySet()) {
this.add(e.getValue(), e.getKey());
}
} | [
"public",
"void",
"addAll",
"(",
"HashMap",
"<",
"Integer",
",",
"char",
"[",
"]",
">",
"records",
")",
"{",
"for",
"(",
"Entry",
"<",
"Integer",
",",
"char",
"[",
"]",
">",
"e",
":",
"records",
".",
"entrySet",
"(",
")",
")",
"{",
"this",
".",
... | This adds all to the internal store. Used by the parallel SAX conversion engine.
@param records the data to add. | [
"This",
"adds",
"all",
"to",
"the",
"internal",
"store",
".",
"Used",
"by",
"the",
"parallel",
"SAX",
"conversion",
"engine",
"."
] | train | https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java#L149-L153 |
alkacon/opencms-core | src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java | CmsDefaultXmlContentHandler.initTemplates | protected void initTemplates(Element root, CmsXmlContentDefinition contentDefinition) {
String strEnabledByDefault = root.attributeValue(ATTR_ENABLED_BY_DEFAULT);
m_allowedTemplates.setDefaultMembership(safeParseBoolean(strEnabledByDefault, true));
List<Node> elements = root.selectNodes(APPINFO_TEMPLATE);
for (Node elem : elements) {
boolean enabled = safeParseBoolean(((Element)elem).attributeValue(ATTR_ENABLED), true);
String templateName = elem.getText().trim();
m_allowedTemplates.setContains(templateName, enabled);
}
m_allowedTemplates.freeze();
} | java | protected void initTemplates(Element root, CmsXmlContentDefinition contentDefinition) {
String strEnabledByDefault = root.attributeValue(ATTR_ENABLED_BY_DEFAULT);
m_allowedTemplates.setDefaultMembership(safeParseBoolean(strEnabledByDefault, true));
List<Node> elements = root.selectNodes(APPINFO_TEMPLATE);
for (Node elem : elements) {
boolean enabled = safeParseBoolean(((Element)elem).attributeValue(ATTR_ENABLED), true);
String templateName = elem.getText().trim();
m_allowedTemplates.setContains(templateName, enabled);
}
m_allowedTemplates.freeze();
} | [
"protected",
"void",
"initTemplates",
"(",
"Element",
"root",
",",
"CmsXmlContentDefinition",
"contentDefinition",
")",
"{",
"String",
"strEnabledByDefault",
"=",
"root",
".",
"attributeValue",
"(",
"ATTR_ENABLED_BY_DEFAULT",
")",
";",
"m_allowedTemplates",
".",
"setDef... | Initializes the forbidden template contexts.<p>
@param root the root XML element
@param contentDefinition the content definition | [
"Initializes",
"the",
"forbidden",
"template",
"contexts",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java#L3169-L3180 |
zxing/zxing | core/src/main/java/com/google/zxing/qrcode/encoder/Encoder.java | Encoder.recommendVersion | private static Version recommendVersion(ErrorCorrectionLevel ecLevel,
Mode mode,
BitArray headerBits,
BitArray dataBits) throws WriterException {
// Hard part: need to know version to know how many bits length takes. But need to know how many
// bits it takes to know version. First we take a guess at version by assuming version will be
// the minimum, 1:
int provisionalBitsNeeded = calculateBitsNeeded(mode, headerBits, dataBits, Version.getVersionForNumber(1));
Version provisionalVersion = chooseVersion(provisionalBitsNeeded, ecLevel);
// Use that guess to calculate the right version. I am still not sure this works in 100% of cases.
int bitsNeeded = calculateBitsNeeded(mode, headerBits, dataBits, provisionalVersion);
return chooseVersion(bitsNeeded, ecLevel);
} | java | private static Version recommendVersion(ErrorCorrectionLevel ecLevel,
Mode mode,
BitArray headerBits,
BitArray dataBits) throws WriterException {
// Hard part: need to know version to know how many bits length takes. But need to know how many
// bits it takes to know version. First we take a guess at version by assuming version will be
// the minimum, 1:
int provisionalBitsNeeded = calculateBitsNeeded(mode, headerBits, dataBits, Version.getVersionForNumber(1));
Version provisionalVersion = chooseVersion(provisionalBitsNeeded, ecLevel);
// Use that guess to calculate the right version. I am still not sure this works in 100% of cases.
int bitsNeeded = calculateBitsNeeded(mode, headerBits, dataBits, provisionalVersion);
return chooseVersion(bitsNeeded, ecLevel);
} | [
"private",
"static",
"Version",
"recommendVersion",
"(",
"ErrorCorrectionLevel",
"ecLevel",
",",
"Mode",
"mode",
",",
"BitArray",
"headerBits",
",",
"BitArray",
"dataBits",
")",
"throws",
"WriterException",
"{",
"// Hard part: need to know version to know how many bits length... | Decides the smallest version of QR code that will contain all of the provided data.
@throws WriterException if the data cannot fit in any version | [
"Decides",
"the",
"smallest",
"version",
"of",
"QR",
"code",
"that",
"will",
"contain",
"all",
"of",
"the",
"provided",
"data",
"."
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/encoder/Encoder.java#L173-L186 |
google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.registerTemplateTypeNamesInScope | public void registerTemplateTypeNamesInScope(Iterable<TemplateType> keys, Node scopeRoot) {
for (TemplateType key : keys) {
scopedNameTable.put(scopeRoot, key.getReferenceName(), key);
}
} | java | public void registerTemplateTypeNamesInScope(Iterable<TemplateType> keys, Node scopeRoot) {
for (TemplateType key : keys) {
scopedNameTable.put(scopeRoot, key.getReferenceName(), key);
}
} | [
"public",
"void",
"registerTemplateTypeNamesInScope",
"(",
"Iterable",
"<",
"TemplateType",
">",
"keys",
",",
"Node",
"scopeRoot",
")",
"{",
"for",
"(",
"TemplateType",
"key",
":",
"keys",
")",
"{",
"scopedNameTable",
".",
"put",
"(",
"scopeRoot",
",",
"key",
... | Registers template types on the given scope root. This takes a Node rather than a
StaticScope because at the time it is called, the scope has not yet been created. | [
"Registers",
"template",
"types",
"on",
"the",
"given",
"scope",
"root",
".",
"This",
"takes",
"a",
"Node",
"rather",
"than",
"a",
"StaticScope",
"because",
"at",
"the",
"time",
"it",
"is",
"called",
"the",
"scope",
"has",
"not",
"yet",
"been",
"created",
... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L2257-L2261 |
auth0/auth0-spring-security-api | lib/src/main/java/com/auth0/spring/security/api/JwtWebSecurityConfigurer.java | JwtWebSecurityConfigurer.forHS256 | @SuppressWarnings({"WeakerAccess", "SameParameterValue"})
public static JwtWebSecurityConfigurer forHS256(String audience, String issuer, byte[] secret) {
return new JwtWebSecurityConfigurer(audience, issuer, new JwtAuthenticationProvider(secret, issuer, audience));
} | java | @SuppressWarnings({"WeakerAccess", "SameParameterValue"})
public static JwtWebSecurityConfigurer forHS256(String audience, String issuer, byte[] secret) {
return new JwtWebSecurityConfigurer(audience, issuer, new JwtAuthenticationProvider(secret, issuer, audience));
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"WeakerAccess\"",
",",
"\"SameParameterValue\"",
"}",
")",
"public",
"static",
"JwtWebSecurityConfigurer",
"forHS256",
"(",
"String",
"audience",
",",
"String",
"issuer",
",",
"byte",
"[",
"]",
"secret",
")",
"{",
"return",
"... | Configures application authorization for JWT signed with HS256
@param audience identifier of the API and must match the {@code aud} value in the token
@param issuer of the token for this API and must match the {@code iss} value in the token
@param secret used to sign and verify tokens
@return JwtWebSecurityConfigurer for further configuration | [
"Configures",
"application",
"authorization",
"for",
"JWT",
"signed",
"with",
"HS256"
] | train | https://github.com/auth0/auth0-spring-security-api/blob/cebd4daa0125efd4da9e651cf29aa5ebdb147e2b/lib/src/main/java/com/auth0/spring/security/api/JwtWebSecurityConfigurer.java#L73-L76 |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/filter/statistic/ProfilerTimerFilter.java | ProfilerTimerFilter.sessionCreated | @Override
public void sessionCreated(NextFilter nextFilter, IoSession session)
throws Exception {
if (profileSessionCreated) {
long start = timeNow();
nextFilter.sessionCreated(session);
long end = timeNow();
sessionCreatedTimerWorker.addNewDuration(end - start);
} else {
nextFilter.sessionCreated(session);
}
} | java | @Override
public void sessionCreated(NextFilter nextFilter, IoSession session)
throws Exception {
if (profileSessionCreated) {
long start = timeNow();
nextFilter.sessionCreated(session);
long end = timeNow();
sessionCreatedTimerWorker.addNewDuration(end - start);
} else {
nextFilter.sessionCreated(session);
}
} | [
"@",
"Override",
"public",
"void",
"sessionCreated",
"(",
"NextFilter",
"nextFilter",
",",
"IoSession",
"session",
")",
"throws",
"Exception",
"{",
"if",
"(",
"profileSessionCreated",
")",
"{",
"long",
"start",
"=",
"timeNow",
"(",
")",
";",
"nextFilter",
".",... | Profile a SessionCreated event. This method will gather the following
informations :
- the method duration
- the shortest execution time
- the slowest execution time
- the average execution time
- the global number of calls
@param nextFilter The filter to call next
@param session The associated session | [
"Profile",
"a",
"SessionCreated",
"event",
".",
"This",
"method",
"will",
"gather",
"the",
"following",
"informations",
":",
"-",
"the",
"method",
"duration",
"-",
"the",
"shortest",
"execution",
"time",
"-",
"the",
"slowest",
"execution",
"time",
"-",
"the",
... | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/filter/statistic/ProfilerTimerFilter.java#L389-L400 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FormatCache.java | FormatCache.getDateInstance | F getDateInstance(final int dateStyle, final TimeZone timeZone, final Locale locale) {
return getDateTimeInstance(Integer.valueOf(dateStyle), null, timeZone, locale);
} | java | F getDateInstance(final int dateStyle, final TimeZone timeZone, final Locale locale) {
return getDateTimeInstance(Integer.valueOf(dateStyle), null, timeZone, locale);
} | [
"F",
"getDateInstance",
"(",
"final",
"int",
"dateStyle",
",",
"final",
"TimeZone",
"timeZone",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"getDateTimeInstance",
"(",
"Integer",
".",
"valueOf",
"(",
"dateStyle",
")",
",",
"null",
",",
"timeZone",
... | package protected, for access from FastDateFormat; do not make public or protected | [
"package",
"protected",
"for",
"access",
"from",
"FastDateFormat",
";",
"do",
"not",
"make",
"public",
"or",
"protected"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FormatCache.java#L131-L133 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/core/UIResults.java | UIResults.getFormatter | public StringFormatter getFormatter() {
if (formatter == null) {
ResourceBundle b = ResourceBundle.getBundle(UI_RESOURCE_BUNDLE_NAME, new UTF8Control());
formatter = new StringFormatter(b, getLocale());
}
return formatter;
} | java | public StringFormatter getFormatter() {
if (formatter == null) {
ResourceBundle b = ResourceBundle.getBundle(UI_RESOURCE_BUNDLE_NAME, new UTF8Control());
formatter = new StringFormatter(b, getLocale());
}
return formatter;
} | [
"public",
"StringFormatter",
"getFormatter",
"(",
")",
"{",
"if",
"(",
"formatter",
"==",
"null",
")",
"{",
"ResourceBundle",
"b",
"=",
"ResourceBundle",
".",
"getBundle",
"(",
"UI_RESOURCE_BUNDLE_NAME",
",",
"new",
"UTF8Control",
"(",
")",
")",
";",
"formatte... | return StringFormatter set-up for locale of request being
processed.
<p>deprecation recalled 2014-05-06.</p>
@return StringFormatter localized to user request | [
"return",
"StringFormatter",
"set",
"-",
"up",
"for",
"locale",
"of",
"request",
"being",
"processed",
".",
"<p",
">",
"deprecation",
"recalled",
"2014",
"-",
"05",
"-",
"06",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/UIResults.java#L692-L698 |
gwt-maven-plugin/gwt-maven-plugin | src/main/java/org/codehaus/mojo/gwt/shell/RunMojo.java | RunMojo.copyDirectoryStructureIfModified | private void copyDirectoryStructureIfModified(File sourceDir, File destDir)
throws IOException {
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir( sourceDir );
scanner.addDefaultExcludes();
scanner.scan();
/*
* NOTE: Make sure the destination directory is always there (even if empty) to support POM-less ITs.
*/
destDir.mkdirs();
String[] includedDirs = scanner.getIncludedDirectories();
for ( int i = 0; i < includedDirs.length; ++i ) {
File clonedDir = new File( destDir, includedDirs[i] );
clonedDir.mkdirs();
}
String[] includedFiles = scanner.getIncludedFiles();
for ( int i = 0; i < includedFiles.length; ++i ) {
File sourceFile = new File(sourceDir, includedFiles[i]);
File destFile = new File(destDir, includedFiles[i]);
FileUtils.copyFileIfModified(sourceFile, destFile);
}
} | java | private void copyDirectoryStructureIfModified(File sourceDir, File destDir)
throws IOException {
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir( sourceDir );
scanner.addDefaultExcludes();
scanner.scan();
/*
* NOTE: Make sure the destination directory is always there (even if empty) to support POM-less ITs.
*/
destDir.mkdirs();
String[] includedDirs = scanner.getIncludedDirectories();
for ( int i = 0; i < includedDirs.length; ++i ) {
File clonedDir = new File( destDir, includedDirs[i] );
clonedDir.mkdirs();
}
String[] includedFiles = scanner.getIncludedFiles();
for ( int i = 0; i < includedFiles.length; ++i ) {
File sourceFile = new File(sourceDir, includedFiles[i]);
File destFile = new File(destDir, includedFiles[i]);
FileUtils.copyFileIfModified(sourceFile, destFile);
}
} | [
"private",
"void",
"copyDirectoryStructureIfModified",
"(",
"File",
"sourceDir",
",",
"File",
"destDir",
")",
"throws",
"IOException",
"{",
"DirectoryScanner",
"scanner",
"=",
"new",
"DirectoryScanner",
"(",
")",
";",
"scanner",
".",
"setBasedir",
"(",
"sourceDir",
... | Copied a directory structure with deafault exclusions (.svn, CVS, etc)
@param sourceDir The source directory to copy, must not be <code>null</code>.
@param destDir The target directory to copy to, must not be <code>null</code>.
@throws java.io.IOException If the directory structure could not be copied. | [
"Copied",
"a",
"directory",
"structure",
"with",
"deafault",
"exclusions",
"(",
".",
"svn",
"CVS",
"etc",
")"
] | train | https://github.com/gwt-maven-plugin/gwt-maven-plugin/blob/0cdd5054b43f182cc22a8acf61ec79ac42b0dfdc/src/main/java/org/codehaus/mojo/gwt/shell/RunMojo.java#L542-L566 |
skyscreamer/JSONassert | src/main/java/org/skyscreamer/jsonassert/comparator/JSONCompareUtil.java | JSONCompareUtil.isUsableAsUniqueKey | public static boolean isUsableAsUniqueKey(String candidate, JSONArray array) throws JSONException {
Set<Object> seenValues = new HashSet<Object>();
for (int i = 0; i < array.length(); i++) {
Object item = array.get(i);
if (item instanceof JSONObject) {
JSONObject o = (JSONObject) item;
if (o.has(candidate)) {
Object value = o.get(candidate);
if (isSimpleValue(value) && !seenValues.contains(value)) {
seenValues.add(value);
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
return true;
} | java | public static boolean isUsableAsUniqueKey(String candidate, JSONArray array) throws JSONException {
Set<Object> seenValues = new HashSet<Object>();
for (int i = 0; i < array.length(); i++) {
Object item = array.get(i);
if (item instanceof JSONObject) {
JSONObject o = (JSONObject) item;
if (o.has(candidate)) {
Object value = o.get(candidate);
if (isSimpleValue(value) && !seenValues.contains(value)) {
seenValues.add(value);
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isUsableAsUniqueKey",
"(",
"String",
"candidate",
",",
"JSONArray",
"array",
")",
"throws",
"JSONException",
"{",
"Set",
"<",
"Object",
">",
"seenValues",
"=",
"new",
"HashSet",
"<",
"Object",
">",
"(",
")",
";",
"for",
"(",
... | <p>Looks to see if candidate field is a possible unique key across a array of objects.
Returns true IFF:</p>
<ol>
<li>array is an array of JSONObject
<li>candidate is a top-level field in each of of the objects in the array
<li>candidate is a simple value (not JSONObject or JSONArray)
<li>candidate is unique across all elements in the array
</ol>
@param candidate is usable as a unique key if every element in the
@param array is a JSONObject having that key, and no two values are the same.
@return true if the candidate can work as a unique id across array
@throws JSONException JSON parsing error | [
"<p",
">",
"Looks",
"to",
"see",
"if",
"candidate",
"field",
"is",
"a",
"possible",
"unique",
"key",
"across",
"a",
"array",
"of",
"objects",
".",
"Returns",
"true",
"IFF",
":",
"<",
"/",
"p",
">",
"<ol",
">",
"<li",
">",
"array",
"is",
"an",
"arra... | train | https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/comparator/JSONCompareUtil.java#L91-L112 |
kiegroup/jbpm | jbpm-flow-builder/src/main/java/org/jbpm/compiler/xml/processes/RuleFlowMigrator.java | RuleFlowMigrator.portToCurrentVersion | private static String portToCurrentVersion(String xml, String xsl) throws Exception
{
// convert it.
String version5XML = XSLTransformation.transform(xsl, xml, null);
// Add the namespace attribute to the process element as it is not added by the XSL transformation.
version5XML = version5XML.replaceAll( "<process ", PROCESS_ELEMENT_WITH_NAMESPACE );
return version5XML;
} | java | private static String portToCurrentVersion(String xml, String xsl) throws Exception
{
// convert it.
String version5XML = XSLTransformation.transform(xsl, xml, null);
// Add the namespace attribute to the process element as it is not added by the XSL transformation.
version5XML = version5XML.replaceAll( "<process ", PROCESS_ELEMENT_WITH_NAMESPACE );
return version5XML;
} | [
"private",
"static",
"String",
"portToCurrentVersion",
"(",
"String",
"xml",
",",
"String",
"xsl",
")",
"throws",
"Exception",
"{",
"// convert it.",
"String",
"version5XML",
"=",
"XSLTransformation",
".",
"transform",
"(",
"xsl",
",",
"xml",
",",
"null",
")",
... | ***********************************************************************
Utility method that applies a given xsl transform to the given xml to
transform a drools 4 ruleflow to version 5.
@param xml the ruleflow to be transformed
@param xsl the xsl transform to apply to the ruleflow xml
@return the ruleflow xml transformed from version 4 to 5 using the
given xsl transformation
@throws Exception
********************************************************************** | [
"***********************************************************************",
"Utility",
"method",
"that",
"applies",
"a",
"given",
"xsl",
"transform",
"to",
"the",
"given",
"xml",
"to",
"transform",
"a",
"drools",
"4",
"ruleflow",
"to",
"version",
"5",
"."
] | train | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-flow-builder/src/main/java/org/jbpm/compiler/xml/processes/RuleFlowMigrator.java#L142-L149 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/constraint/LinkedPE.java | LinkedPE.enrichWithCM | protected void enrichWithCM(Set<BioPAXElement> seed, Set<BioPAXElement> all)
{
Set addition = access(type == Type.TO_GENERAL ? complexAcc : memberAcc, seed, all);
if (blacklist != null) addition = blacklist.getNonUbiqueObjects(addition);
if (!addition.isEmpty())
{
all.addAll(addition);
enrichWithGenerics(addition, all);
}
} | java | protected void enrichWithCM(Set<BioPAXElement> seed, Set<BioPAXElement> all)
{
Set addition = access(type == Type.TO_GENERAL ? complexAcc : memberAcc, seed, all);
if (blacklist != null) addition = blacklist.getNonUbiqueObjects(addition);
if (!addition.isEmpty())
{
all.addAll(addition);
enrichWithGenerics(addition, all);
}
} | [
"protected",
"void",
"enrichWithCM",
"(",
"Set",
"<",
"BioPAXElement",
">",
"seed",
",",
"Set",
"<",
"BioPAXElement",
">",
"all",
")",
"{",
"Set",
"addition",
"=",
"access",
"(",
"type",
"==",
"Type",
".",
"TO_GENERAL",
"?",
"complexAcc",
":",
"memberAcc",... | Gets parent complexes or complex members recursively according to the type of the linkage.
@param seed elements to link
@param all already found links | [
"Gets",
"parent",
"complexes",
"or",
"complex",
"members",
"recursively",
"according",
"to",
"the",
"type",
"of",
"the",
"linkage",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/LinkedPE.java#L134-L145 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ConnectionMonitorsInner.java | ConnectionMonitorsInner.beginCreateOrUpdate | public ConnectionMonitorResultInner beginCreateOrUpdate(String resourceGroupName, String networkWatcherName, String connectionMonitorName, ConnectionMonitorInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters).toBlocking().single().body();
} | java | public ConnectionMonitorResultInner beginCreateOrUpdate(String resourceGroupName, String networkWatcherName, String connectionMonitorName, ConnectionMonitorInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters).toBlocking().single().body();
} | [
"public",
"ConnectionMonitorResultInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"String",
"connectionMonitorName",
",",
"ConnectionMonitorInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceRespon... | Create or update a connection monitor.
@param resourceGroupName The name of the resource group containing Network Watcher.
@param networkWatcherName The name of the Network Watcher resource.
@param connectionMonitorName The name of the connection monitor.
@param parameters Parameters that define the operation to create a connection monitor.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ConnectionMonitorResultInner object if successful. | [
"Create",
"or",
"update",
"a",
"connection",
"monitor",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ConnectionMonitorsInner.java#L204-L206 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/search/bingimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/imagesearch/implementation/BingImagesImpl.java | BingImagesImpl.detailsAsync | public Observable<ImageInsights> detailsAsync(String query, DetailsOptionalParameter detailsOptionalParameter) {
return detailsWithServiceResponseAsync(query, detailsOptionalParameter).map(new Func1<ServiceResponse<ImageInsights>, ImageInsights>() {
@Override
public ImageInsights call(ServiceResponse<ImageInsights> response) {
return response.body();
}
});
} | java | public Observable<ImageInsights> detailsAsync(String query, DetailsOptionalParameter detailsOptionalParameter) {
return detailsWithServiceResponseAsync(query, detailsOptionalParameter).map(new Func1<ServiceResponse<ImageInsights>, ImageInsights>() {
@Override
public ImageInsights call(ServiceResponse<ImageInsights> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImageInsights",
">",
"detailsAsync",
"(",
"String",
"query",
",",
"DetailsOptionalParameter",
"detailsOptionalParameter",
")",
"{",
"return",
"detailsWithServiceResponseAsync",
"(",
"query",
",",
"detailsOptionalParameter",
")",
".",
"map",
... | The Image Detail Search API lets you search on Bing and get back insights about an image, such as webpages that include the image. This section provides technical details about the query parameters and headers that you use to request insights of images and the JSON response objects that contain them. For examples that show how to make requests, see [Searching the Web for Images](https://docs.microsoft.com/azure/cognitive-services/bing-image-search/search-the-web).
@param query The user's search query term. The term cannot be empty. The term may contain [Bing Advanced Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to limit images to a specific domain, use the [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To help improve relevance of an insights query (see [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)), you should always include the user's query term. Use this parameter only with the Image Search API.Do not specify this parameter when calling the Trending Images API.
@param detailsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageInsights object | [
"The",
"Image",
"Detail",
"Search",
"API",
"lets",
"you",
"search",
"on",
"Bing",
"and",
"get",
"back",
"insights",
"about",
"an",
"image",
"such",
"as",
"webpages",
"that",
"include",
"the",
"image",
".",
"This",
"section",
"provides",
"technical",
"details... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/imagesearch/implementation/BingImagesImpl.java#L502-L509 |
googleapis/google-http-java-client | google-http-client/src/main/java/com/google/api/client/http/HttpRequestFactory.java | HttpRequestFactory.buildHeadRequest | public HttpRequest buildHeadRequest(GenericUrl url) throws IOException {
return buildRequest(HttpMethods.HEAD, url, null);
} | java | public HttpRequest buildHeadRequest(GenericUrl url) throws IOException {
return buildRequest(HttpMethods.HEAD, url, null);
} | [
"public",
"HttpRequest",
"buildHeadRequest",
"(",
"GenericUrl",
"url",
")",
"throws",
"IOException",
"{",
"return",
"buildRequest",
"(",
"HttpMethods",
".",
"HEAD",
",",
"url",
",",
"null",
")",
";",
"}"
] | Builds a {@code HEAD} request for the given URL.
@param url HTTP request URL or {@code null} for none
@return new HTTP request | [
"Builds",
"a",
"{",
"@code",
"HEAD",
"}",
"request",
"for",
"the",
"given",
"URL",
"."
] | train | https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/http/HttpRequestFactory.java#L159-L161 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/storage/ConnectionPool.java | ConnectionPool.getTableCreatingConnection | public TableCreatingConnection getTableCreatingConnection()
throws SQLException {
if (ddlConverter == null) {
return null;
} else {
Connection c = getReadWriteConnection();
return new TableCreatingConnection(c, ddlConverter);
}
} | java | public TableCreatingConnection getTableCreatingConnection()
throws SQLException {
if (ddlConverter == null) {
return null;
} else {
Connection c = getReadWriteConnection();
return new TableCreatingConnection(c, ddlConverter);
}
} | [
"public",
"TableCreatingConnection",
"getTableCreatingConnection",
"(",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"ddlConverter",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"Connection",
"c",
"=",
"getReadWriteConnection",
"(",
")",
";... | Gets a TableCreatingConnection.
<p>
</p>
This derives from the same pool, but wraps the Connection in an
appropriate TableCreatingConnection before returning it.
@return The next available Connection from the pool, wrapped as a
TableCreatingException, or null if this ConnectionPool hasn't
been configured with a DDLConverter (see constructor).
@throws SQLException
If there is any propblem in getting the SQL connection. | [
"Gets",
"a",
"TableCreatingConnection",
".",
"<p",
">",
"<",
"/",
"p",
">",
"This",
"derives",
"from",
"the",
"same",
"pool",
"but",
"wraps",
"the",
"Connection",
"in",
"an",
"appropriate",
"TableCreatingConnection",
"before",
"returning",
"it",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/storage/ConnectionPool.java#L269-L277 |
CenturyLinkCloud/mdw | mdw-common/src/com/centurylink/mdw/util/JMSServices.java | JMSServices.getQueue | public Queue getQueue(String contextUrl, String queueName) throws ServiceLocatorException {
try {
String jndiName = null;
if (contextUrl == null) {
jndiName = namingProvider.qualifyJmsQueueName(queueName);
}
else {
jndiName = queueName; // don't qualify remote queue names
}
return (Queue) namingProvider.lookup(contextUrl, jndiName, Queue.class);
}
catch (Exception ex) {
throw new ServiceLocatorException(-1, ex.getMessage(), ex);
}
} | java | public Queue getQueue(String contextUrl, String queueName) throws ServiceLocatorException {
try {
String jndiName = null;
if (contextUrl == null) {
jndiName = namingProvider.qualifyJmsQueueName(queueName);
}
else {
jndiName = queueName; // don't qualify remote queue names
}
return (Queue) namingProvider.lookup(contextUrl, jndiName, Queue.class);
}
catch (Exception ex) {
throw new ServiceLocatorException(-1, ex.getMessage(), ex);
}
} | [
"public",
"Queue",
"getQueue",
"(",
"String",
"contextUrl",
",",
"String",
"queueName",
")",
"throws",
"ServiceLocatorException",
"{",
"try",
"{",
"String",
"jndiName",
"=",
"null",
";",
"if",
"(",
"contextUrl",
"==",
"null",
")",
"{",
"jndiName",
"=",
"nami... | Looks up and returns a JMS queue.
@param queueName
remote queue name
@param contextUrl
the context url (or null for local)
@return javax.jms.Queue | [
"Looks",
"up",
"and",
"returns",
"a",
"JMS",
"queue",
"."
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/JMSServices.java#L246-L260 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jndi/src/com/ibm/ws/jndi/internal/JNDIEntry.java | JNDIEntry.activate | protected synchronized void activate(BundleContext context, Map<String, Object> props) {
String jndiName = (String) props.get("jndiName");
String originalValue = (String) props.get("value");
//Since we declare a default value of false in the metatype, if decode isn't specified, props should return false
boolean decode = (Boolean) props.get("decode");
if (jndiName == null || jndiName.isEmpty() || originalValue == null || originalValue.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Unable to register JNDIEntry with jndiName " + jndiName + " and value " + originalValue + " because both must be set");
}
return;
}
String value = originalValue;
if (decode) {
try {
value = PasswordUtil.decode(originalValue);
} catch (Exception e) {
Tr.error(tc, "jndi.decode.failed", originalValue, e);
}
}
Object parsedValue = LiteralParser.parse(value);
String valueClassName = parsedValue.getClass().getName();
final Object serviceObject = decode ? new Decode(originalValue) : parsedValue;
Dictionary<String, Object> propertiesForJndiService = new Hashtable<String, Object>();
propertiesForJndiService.put("osgi.jndi.service.name", jndiName);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Registering JNDIEntry " + valueClassName + " with value " + parsedValue + " and JNDI name " + jndiName);
}
this.serviceRegistration = context.registerService(valueClassName, serviceObject, propertiesForJndiService);
} | java | protected synchronized void activate(BundleContext context, Map<String, Object> props) {
String jndiName = (String) props.get("jndiName");
String originalValue = (String) props.get("value");
//Since we declare a default value of false in the metatype, if decode isn't specified, props should return false
boolean decode = (Boolean) props.get("decode");
if (jndiName == null || jndiName.isEmpty() || originalValue == null || originalValue.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Unable to register JNDIEntry with jndiName " + jndiName + " and value " + originalValue + " because both must be set");
}
return;
}
String value = originalValue;
if (decode) {
try {
value = PasswordUtil.decode(originalValue);
} catch (Exception e) {
Tr.error(tc, "jndi.decode.failed", originalValue, e);
}
}
Object parsedValue = LiteralParser.parse(value);
String valueClassName = parsedValue.getClass().getName();
final Object serviceObject = decode ? new Decode(originalValue) : parsedValue;
Dictionary<String, Object> propertiesForJndiService = new Hashtable<String, Object>();
propertiesForJndiService.put("osgi.jndi.service.name", jndiName);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Registering JNDIEntry " + valueClassName + " with value " + parsedValue + " and JNDI name " + jndiName);
}
this.serviceRegistration = context.registerService(valueClassName, serviceObject, propertiesForJndiService);
} | [
"protected",
"synchronized",
"void",
"activate",
"(",
"BundleContext",
"context",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
")",
"{",
"String",
"jndiName",
"=",
"(",
"String",
")",
"props",
".",
"get",
"(",
"\"jndiName\"",
")",
";",
"String",... | Registers the JNDI service for the supplied properties as long as the jndiName and value are set
@param context
@param props The properties containing values for <code>"jndiName"</code> and <code>"value"</code> | [
"Registers",
"the",
"JNDI",
"service",
"for",
"the",
"supplied",
"properties",
"as",
"long",
"as",
"the",
"jndiName",
"and",
"value",
"are",
"set"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jndi/src/com/ibm/ws/jndi/internal/JNDIEntry.java#L57-L87 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigClient.java | ConfigClient.updateSink | public final LogSink updateSink(String sinkName, LogSink sink, FieldMask updateMask) {
UpdateSinkRequest request =
UpdateSinkRequest.newBuilder()
.setSinkName(sinkName)
.setSink(sink)
.setUpdateMask(updateMask)
.build();
return updateSink(request);
} | java | public final LogSink updateSink(String sinkName, LogSink sink, FieldMask updateMask) {
UpdateSinkRequest request =
UpdateSinkRequest.newBuilder()
.setSinkName(sinkName)
.setSink(sink)
.setUpdateMask(updateMask)
.build();
return updateSink(request);
} | [
"public",
"final",
"LogSink",
"updateSink",
"(",
"String",
"sinkName",
",",
"LogSink",
"sink",
",",
"FieldMask",
"updateMask",
")",
"{",
"UpdateSinkRequest",
"request",
"=",
"UpdateSinkRequest",
".",
"newBuilder",
"(",
")",
".",
"setSinkName",
"(",
"sinkName",
"... | Updates a sink. This method replaces the following fields in the existing sink with values from
the new sink: `destination`, and `filter`. The updated sink might also have a new
`writer_identity`; see the `unique_writer_identity` field.
<p>Sample code:
<pre><code>
try (ConfigClient configClient = ConfigClient.create()) {
SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]");
LogSink sink = LogSink.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
LogSink response = configClient.updateSink(sinkName.toString(), sink, updateMask);
}
</code></pre>
@param sinkName Required. The full resource name of the sink to update, including the parent
resource and the sink identifier:
<p>"projects/[PROJECT_ID]/sinks/[SINK_ID]"
"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
"billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
"folders/[FOLDER_ID]/sinks/[SINK_ID]"
<p>Example: `"projects/my-project-id/sinks/my-sink-id"`.
@param sink Required. The updated sink, whose name is the same identifier that appears as part
of `sink_name`.
@param updateMask Optional. Field mask that specifies the fields in `sink` that need an update.
A sink field will be overwritten if, and only if, it is in the update mask. `name` and
output only fields cannot be updated.
<p>An empty updateMask is temporarily treated as using the following mask for backwards
compatibility purposes: destination,filter,includeChildren At some point in the future,
behavior will be removed and specifying an empty updateMask will be an error.
<p>For a detailed `FieldMask` definition, see
https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask
<p>Example: `updateMask=filter`.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Updates",
"a",
"sink",
".",
"This",
"method",
"replaces",
"the",
"following",
"fields",
"in",
"the",
"existing",
"sink",
"with",
"values",
"from",
"the",
"new",
"sink",
":",
"destination",
"and",
"filter",
".",
"The",
"updated",
"sink",
"might",
"also",
"... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigClient.java#L613-L622 |
Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java | MinecraftTypeHelper.applyColour | static IBlockState applyColour(IBlockState state, Colour colour)
{
for (IProperty prop : state.getProperties().keySet())
{
if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class)
{
net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)state.getValue(prop);
if (!current.getName().equalsIgnoreCase(colour.name()))
{
return state.withProperty(prop, EnumDyeColor.valueOf(colour.name()));
}
}
}
return state;
} | java | static IBlockState applyColour(IBlockState state, Colour colour)
{
for (IProperty prop : state.getProperties().keySet())
{
if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class)
{
net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)state.getValue(prop);
if (!current.getName().equalsIgnoreCase(colour.name()))
{
return state.withProperty(prop, EnumDyeColor.valueOf(colour.name()));
}
}
}
return state;
} | [
"static",
"IBlockState",
"applyColour",
"(",
"IBlockState",
"state",
",",
"Colour",
"colour",
")",
"{",
"for",
"(",
"IProperty",
"prop",
":",
"state",
".",
"getProperties",
"(",
")",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"prop",
".",
"getName",
... | Recolour the Minecraft block
@param state The block to be recoloured
@param colour The new colour
@return A new blockstate which is a recoloured version of the original | [
"Recolour",
"the",
"Minecraft",
"block"
] | train | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java#L560-L574 |
ldapchai/ldapchai | src/main/java/com/novell/ldapchai/impl/edir/NmasCrFactory.java | NmasCrFactory.readAssignedChallengeSet | public static ChallengeSet readAssignedChallengeSet( final ChaiUser theUser )
throws ChaiUnavailableException, ChaiOperationException, ChaiValidationException
{
return readAssignedChallengeSet( theUser, Locale.getDefault() );
} | java | public static ChallengeSet readAssignedChallengeSet( final ChaiUser theUser )
throws ChaiUnavailableException, ChaiOperationException, ChaiValidationException
{
return readAssignedChallengeSet( theUser, Locale.getDefault() );
} | [
"public",
"static",
"ChallengeSet",
"readAssignedChallengeSet",
"(",
"final",
"ChaiUser",
"theUser",
")",
"throws",
"ChaiUnavailableException",
",",
"ChaiOperationException",
",",
"ChaiValidationException",
"{",
"return",
"readAssignedChallengeSet",
"(",
"theUser",
",",
"Lo... | This method will first read the user's assigned password challenge set policy.
@param theUser ChaiUser to read policy for
@return A valid ChallengeSet if found, otherwise null.
@throws ChaiOperationException If there is an error during the operation
@throws ChaiUnavailableException If the directory server(s) are unavailable
@throws ChaiValidationException when there is a logical problem with the challenge set data, such as more randoms required then exist | [
"This",
"method",
"will",
"first",
"read",
"the",
"user",
"s",
"assigned",
"password",
"challenge",
"set",
"policy",
"."
] | train | https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/impl/edir/NmasCrFactory.java#L188-L192 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java | SegmentsUtil.setByte | public static void setByte(MemorySegment[] segments, int offset, byte value) {
if (inFirstSegment(segments, offset, 1)) {
segments[0].put(offset, value);
} else {
setByteMultiSegments(segments, offset, value);
}
} | java | public static void setByte(MemorySegment[] segments, int offset, byte value) {
if (inFirstSegment(segments, offset, 1)) {
segments[0].put(offset, value);
} else {
setByteMultiSegments(segments, offset, value);
}
} | [
"public",
"static",
"void",
"setByte",
"(",
"MemorySegment",
"[",
"]",
"segments",
",",
"int",
"offset",
",",
"byte",
"value",
")",
"{",
"if",
"(",
"inFirstSegment",
"(",
"segments",
",",
"offset",
",",
"1",
")",
")",
"{",
"segments",
"[",
"0",
"]",
... | set byte from segments.
@param segments target segments.
@param offset value offset. | [
"set",
"byte",
"from",
"segments",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L597-L603 |
amaembo/streamex | src/main/java/one/util/streamex/AbstractStreamEx.java | AbstractStreamEx.toListAndThen | public <R> R toListAndThen(Function<? super List<T>, R> finisher) {
if (context.fjp != null)
return context.terminate(() -> finisher.apply(toList()));
return finisher.apply(toList());
} | java | public <R> R toListAndThen(Function<? super List<T>, R> finisher) {
if (context.fjp != null)
return context.terminate(() -> finisher.apply(toList()));
return finisher.apply(toList());
} | [
"public",
"<",
"R",
">",
"R",
"toListAndThen",
"(",
"Function",
"<",
"?",
"super",
"List",
"<",
"T",
">",
",",
"R",
">",
"finisher",
")",
"{",
"if",
"(",
"context",
".",
"fjp",
"!=",
"null",
")",
"return",
"context",
".",
"terminate",
"(",
"(",
"... | Creates a {@link List} containing the elements of this stream, then
performs finishing transformation and returns its result. There are no
guarantees on the type, serializability or thread-safety of the
{@code List} created.
<p>
This is a terminal operation.
@param <R> the type of the result
@param finisher a function to be applied to the intermediate list
@return result of applying the finisher transformation to the list of the
stream elements.
@since 0.2.3
@see #toList() | [
"Creates",
"a",
"{",
"@link",
"List",
"}",
"containing",
"the",
"elements",
"of",
"this",
"stream",
"then",
"performs",
"finishing",
"transformation",
"and",
"returns",
"its",
"result",
".",
"There",
"are",
"no",
"guarantees",
"on",
"the",
"type",
"serializabi... | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L1231-L1235 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.isDirectory | public static boolean isDirectory(Path path, boolean isFollowLinks) {
if (null == path) {
return false;
}
final LinkOption[] options = isFollowLinks ? new LinkOption[0] : new LinkOption[] { LinkOption.NOFOLLOW_LINKS };
return Files.isDirectory(path, options);
} | java | public static boolean isDirectory(Path path, boolean isFollowLinks) {
if (null == path) {
return false;
}
final LinkOption[] options = isFollowLinks ? new LinkOption[0] : new LinkOption[] { LinkOption.NOFOLLOW_LINKS };
return Files.isDirectory(path, options);
} | [
"public",
"static",
"boolean",
"isDirectory",
"(",
"Path",
"path",
",",
"boolean",
"isFollowLinks",
")",
"{",
"if",
"(",
"null",
"==",
"path",
")",
"{",
"return",
"false",
";",
"}",
"final",
"LinkOption",
"[",
"]",
"options",
"=",
"isFollowLinks",
"?",
"... | 判断是否为目录,如果file为null,则返回false
@param path {@link Path}
@param isFollowLinks 是否追踪到软链对应的真实地址
@return 如果为目录true
@since 3.1.0 | [
"判断是否为目录,如果file为null,则返回false"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1257-L1263 |
hal/core | gui/src/main/java/org/jboss/as/console/mbui/behaviour/LoadResourceProcedure.java | LoadResourceProcedure.assignKeyFromAddressNode | private static void assignKeyFromAddressNode(ModelNode payload, ModelNode address) {
List<Property> props = address.asPropertyList();
Property lastToken = props.get(props.size()-1);
payload.get("entity.key").set(lastToken.getValue().asString());
} | java | private static void assignKeyFromAddressNode(ModelNode payload, ModelNode address) {
List<Property> props = address.asPropertyList();
Property lastToken = props.get(props.size()-1);
payload.get("entity.key").set(lastToken.getValue().asString());
} | [
"private",
"static",
"void",
"assignKeyFromAddressNode",
"(",
"ModelNode",
"payload",
",",
"ModelNode",
"address",
")",
"{",
"List",
"<",
"Property",
">",
"props",
"=",
"address",
".",
"asPropertyList",
"(",
")",
";",
"Property",
"lastToken",
"=",
"props",
"."... | the model representations we use internally carry along the entity keys.
these are derived from the resource address, but will be available as synthetic resource attributes.
@param payload
@param address | [
"the",
"model",
"representations",
"we",
"use",
"internally",
"carry",
"along",
"the",
"entity",
"keys",
".",
"these",
"are",
"derived",
"from",
"the",
"resource",
"address",
"but",
"will",
"be",
"available",
"as",
"synthetic",
"resource",
"attributes",
"."
] | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/mbui/behaviour/LoadResourceProcedure.java#L179-L183 |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/statistics/ConfidenceInterval.java | ConfidenceInterval.getConfidenceInterval | public double[] getConfidenceInterval(final double alpha, final Map<?, Double> metricValuesPerDimension) {
SummaryStatistics differences = new SummaryStatistics();
for (Double d : metricValuesPerDimension.values()) {
differences.addValue(d);
}
return getConfidenceInterval(alpha, (int) differences.getN() - 1, (int) differences.getN(), differences.getStandardDeviation(), differences.getMean());
} | java | public double[] getConfidenceInterval(final double alpha, final Map<?, Double> metricValuesPerDimension) {
SummaryStatistics differences = new SummaryStatistics();
for (Double d : metricValuesPerDimension.values()) {
differences.addValue(d);
}
return getConfidenceInterval(alpha, (int) differences.getN() - 1, (int) differences.getN(), differences.getStandardDeviation(), differences.getMean());
} | [
"public",
"double",
"[",
"]",
"getConfidenceInterval",
"(",
"final",
"double",
"alpha",
",",
"final",
"Map",
"<",
"?",
",",
"Double",
">",
"metricValuesPerDimension",
")",
"{",
"SummaryStatistics",
"differences",
"=",
"new",
"SummaryStatistics",
"(",
")",
";",
... | Method that takes only one metric as parameter. It is useful when
comparing more than two metrics (so that a confidence interval is
computed for each of them), as suggested in [Sakai, 2014]
@param alpha probability of incorrectly rejecting the null hypothesis (1
- confidence_level)
@param metricValuesPerDimension one value of the metric for each
dimension
@return array with the confidence interval: [mean - margin of error, mean
+ margin of error] | [
"Method",
"that",
"takes",
"only",
"one",
"metric",
"as",
"parameter",
".",
"It",
"is",
"useful",
"when",
"comparing",
"more",
"than",
"two",
"metrics",
"(",
"so",
"that",
"a",
"confidence",
"interval",
"is",
"computed",
"for",
"each",
"of",
"them",
")",
... | train | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/statistics/ConfidenceInterval.java#L169-L175 |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.approveLicense | public void approveLicense(final String licenseId, final Boolean approve, final String user, final String password) throws GrapesCommunicationException, AuthenticationException{
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.getLicensePath(licenseId));
final ClientResponse response = resource.queryParam(ServerAPI.APPROVED_PARAM, approve.toString()).post(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = "Failed to approve license " + licenseId;
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | java | public void approveLicense(final String licenseId, final Boolean approve, final String user, final String password) throws GrapesCommunicationException, AuthenticationException{
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.getLicensePath(licenseId));
final ClientResponse response = resource.queryParam(ServerAPI.APPROVED_PARAM, approve.toString()).post(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = "Failed to approve license " + licenseId;
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | [
"public",
"void",
"approveLicense",
"(",
"final",
"String",
"licenseId",
",",
"final",
"Boolean",
"approve",
",",
"final",
"String",
"user",
",",
"final",
"String",
"password",
")",
"throws",
"GrapesCommunicationException",
",",
"AuthenticationException",
"{",
"fina... | Approve or reject a license
@param licenseId
@param approve
@throws GrapesCommunicationException
@throws javax.naming.AuthenticationException | [
"Approve",
"or",
"reject",
"a",
"license"
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L737-L750 |
hypercube1024/firefly | firefly-db/src/main/java/com/firefly/db/jdbc/helper/DefaultBeanProcessor.java | DefaultBeanProcessor.createBean | private <T> T createBean(ResultSet rs, Class<T> type,
PropertyDescriptor[] props, int[] columnToProperty)
throws SQLException {
T bean = this.newInstance(type);
return populateBean(rs, bean, props, columnToProperty);
} | java | private <T> T createBean(ResultSet rs, Class<T> type,
PropertyDescriptor[] props, int[] columnToProperty)
throws SQLException {
T bean = this.newInstance(type);
return populateBean(rs, bean, props, columnToProperty);
} | [
"private",
"<",
"T",
">",
"T",
"createBean",
"(",
"ResultSet",
"rs",
",",
"Class",
"<",
"T",
">",
"type",
",",
"PropertyDescriptor",
"[",
"]",
"props",
",",
"int",
"[",
"]",
"columnToProperty",
")",
"throws",
"SQLException",
"{",
"T",
"bean",
"=",
"thi... | Creates a new object and initializes its fields from the ResultSet.
@param <T> The type of bean to create
@param rs The result set.
@param type The bean type (the return type of the object).
@param props The property descriptors.
@param columnToProperty The column indices in the result set.
@return An initialized object.
@throws SQLException if a database error occurs. | [
"Creates",
"a",
"new",
"object",
"and",
"initializes",
"its",
"fields",
"from",
"the",
"ResultSet",
"."
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-db/src/main/java/com/firefly/db/jdbc/helper/DefaultBeanProcessor.java#L93-L99 |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/NumberInRange.java | NumberInRange.isInRange | @ArgumentsChecked
@Throws(IllegalNullArgumentException.class)
public static boolean isInRange(@Nonnull final Number number, @Nonnull final BigInteger min, @Nonnull final BigInteger max) {
Check.notNull(number, "number");
Check.notNull(min, "min");
Check.notNull(max, "max");
BigInteger bigInteger = null;
if (number instanceof Byte || number instanceof Short || number instanceof Integer || number instanceof Long) {
bigInteger = BigInteger.valueOf(number.longValue());
} else if (number instanceof Float || number instanceof Double) {
bigInteger = new BigDecimal(number.doubleValue()).toBigInteger();
} else if (number instanceof BigInteger) {
bigInteger = (BigInteger) number;
} else if (number instanceof BigDecimal) {
bigInteger = ((BigDecimal) number).toBigInteger();
} else {
throw new IllegalNumberArgumentException("Return value is no known subclass of 'java.lang.Number': "
+ number.getClass().getName());
}
return max.compareTo(bigInteger) >= 0 && min.compareTo(bigInteger) <= 0;
} | java | @ArgumentsChecked
@Throws(IllegalNullArgumentException.class)
public static boolean isInRange(@Nonnull final Number number, @Nonnull final BigInteger min, @Nonnull final BigInteger max) {
Check.notNull(number, "number");
Check.notNull(min, "min");
Check.notNull(max, "max");
BigInteger bigInteger = null;
if (number instanceof Byte || number instanceof Short || number instanceof Integer || number instanceof Long) {
bigInteger = BigInteger.valueOf(number.longValue());
} else if (number instanceof Float || number instanceof Double) {
bigInteger = new BigDecimal(number.doubleValue()).toBigInteger();
} else if (number instanceof BigInteger) {
bigInteger = (BigInteger) number;
} else if (number instanceof BigDecimal) {
bigInteger = ((BigDecimal) number).toBigInteger();
} else {
throw new IllegalNumberArgumentException("Return value is no known subclass of 'java.lang.Number': "
+ number.getClass().getName());
}
return max.compareTo(bigInteger) >= 0 && min.compareTo(bigInteger) <= 0;
} | [
"@",
"ArgumentsChecked",
"@",
"Throws",
"(",
"IllegalNullArgumentException",
".",
"class",
")",
"public",
"static",
"boolean",
"isInRange",
"(",
"@",
"Nonnull",
"final",
"Number",
"number",
",",
"@",
"Nonnull",
"final",
"BigInteger",
"min",
",",
"@",
"Nonnull",
... | Test if a number is in an arbitrary range.
@param number
a number
@param min
lower boundary of the range
@param max
upper boundary of the range
@return true if the given number is within the range | [
"Test",
"if",
"a",
"number",
"is",
"in",
"an",
"arbitrary",
"range",
"."
] | train | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/NumberInRange.java#L285-L306 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGroupVertex.java | ExecutionGroupVertex.calculateConnectionID | int calculateConnectionID(int currentConnectionID, final Set<ExecutionGroupVertex> alreadyVisited) {
if (!alreadyVisited.add(this)) {
return currentConnectionID;
}
for (final ExecutionGroupEdge backwardLink : this.backwardLinks) {
backwardLink.setConnectionID(currentConnectionID);
++currentConnectionID;
currentConnectionID = backwardLink.getSourceVertex()
.calculateConnectionID(currentConnectionID, alreadyVisited);
}
return currentConnectionID;
} | java | int calculateConnectionID(int currentConnectionID, final Set<ExecutionGroupVertex> alreadyVisited) {
if (!alreadyVisited.add(this)) {
return currentConnectionID;
}
for (final ExecutionGroupEdge backwardLink : this.backwardLinks) {
backwardLink.setConnectionID(currentConnectionID);
++currentConnectionID;
currentConnectionID = backwardLink.getSourceVertex()
.calculateConnectionID(currentConnectionID, alreadyVisited);
}
return currentConnectionID;
} | [
"int",
"calculateConnectionID",
"(",
"int",
"currentConnectionID",
",",
"final",
"Set",
"<",
"ExecutionGroupVertex",
">",
"alreadyVisited",
")",
"{",
"if",
"(",
"!",
"alreadyVisited",
".",
"add",
"(",
"this",
")",
")",
"{",
"return",
"currentConnectionID",
";",
... | Recursive method to calculate the connection IDs of the {@link ExecutionGraph}.
@param currentConnectionID
the current connection ID
@param alreadyVisited
the set of already visited group vertices
@return maximum assigned connectionID | [
"Recursive",
"method",
"to",
"calculate",
"the",
"connection",
"IDs",
"of",
"the",
"{",
"@link",
"ExecutionGraph",
"}",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGroupVertex.java#L919-L936 |
geomajas/geomajas-project-graphics | graphics/src/main/java/org/geomajas/graphics/client/widget/SliderBar.java | SliderBar.startSliding | private void startSliding(boolean highlight, boolean fireEvent) {
if (highlight) {
DOM.setElementProperty(lineElement, "className", SLIDER_LINE + " "
+ SLIDER_LINE_SLIDING);
DOM.setElementProperty(knobImage.getElement(), "className", SLIDER_KNOB + " "
+ SLIDER_KNOB_SLIDING);
}
} | java | private void startSliding(boolean highlight, boolean fireEvent) {
if (highlight) {
DOM.setElementProperty(lineElement, "className", SLIDER_LINE + " "
+ SLIDER_LINE_SLIDING);
DOM.setElementProperty(knobImage.getElement(), "className", SLIDER_KNOB + " "
+ SLIDER_KNOB_SLIDING);
}
} | [
"private",
"void",
"startSliding",
"(",
"boolean",
"highlight",
",",
"boolean",
"fireEvent",
")",
"{",
"if",
"(",
"highlight",
")",
"{",
"DOM",
".",
"setElementProperty",
"(",
"lineElement",
",",
"\"className\"",
",",
"SLIDER_LINE",
"+",
"\" \"",
"+",
"SLIDER_... | Start sliding the knob.
@param highlight
true to change the style
@param fireEvent
true to fire the event | [
"Start",
"sliding",
"the",
"knob",
"."
] | train | https://github.com/geomajas/geomajas-project-graphics/blob/1104196640e0ba455b8a619e774352a8e1e319ba/graphics/src/main/java/org/geomajas/graphics/client/widget/SliderBar.java#L928-L935 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/MethodAnnotation.java | MethodAnnotation.fromVisitedMethod | public static MethodAnnotation fromVisitedMethod(PreorderVisitor visitor) {
String className = visitor.getDottedClassName();
MethodAnnotation result = new MethodAnnotation(className, visitor.getMethodName(), visitor.getMethodSig(), visitor
.getMethod().isStatic());
// Try to find the source lines for the method
SourceLineAnnotation srcLines = SourceLineAnnotation.fromVisitedMethod(visitor);
result.setSourceLines(srcLines);
return result;
} | java | public static MethodAnnotation fromVisitedMethod(PreorderVisitor visitor) {
String className = visitor.getDottedClassName();
MethodAnnotation result = new MethodAnnotation(className, visitor.getMethodName(), visitor.getMethodSig(), visitor
.getMethod().isStatic());
// Try to find the source lines for the method
SourceLineAnnotation srcLines = SourceLineAnnotation.fromVisitedMethod(visitor);
result.setSourceLines(srcLines);
return result;
} | [
"public",
"static",
"MethodAnnotation",
"fromVisitedMethod",
"(",
"PreorderVisitor",
"visitor",
")",
"{",
"String",
"className",
"=",
"visitor",
".",
"getDottedClassName",
"(",
")",
";",
"MethodAnnotation",
"result",
"=",
"new",
"MethodAnnotation",
"(",
"className",
... | Factory method to create a MethodAnnotation from the method the given
visitor is currently visiting.
@param visitor
the BetterVisitor currently visiting the method | [
"Factory",
"method",
"to",
"create",
"a",
"MethodAnnotation",
"from",
"the",
"method",
"the",
"given",
"visitor",
"is",
"currently",
"visiting",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/MethodAnnotation.java#L124-L134 |
raphw/byte-buddy | byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/ClassLoaderResolver.java | ClassLoaderResolver.doResolve | private ClassLoader doResolve(MavenCoordinate mavenCoordinate) throws MojoExecutionException, MojoFailureException {
List<URL> urls = new ArrayList<URL>();
log.info("Resolving transformer dependency: " + mavenCoordinate);
try {
DependencyNode root = repositorySystem.collectDependencies(repositorySystemSession, new CollectRequest(new Dependency(mavenCoordinate.asArtifact(), "runtime"), remoteRepositories)).getRoot();
repositorySystem.resolveDependencies(repositorySystemSession, new DependencyRequest().setRoot(root));
PreorderNodeListGenerator preorderNodeListGenerator = new PreorderNodeListGenerator();
root.accept(preorderNodeListGenerator);
for (Artifact artifact : preorderNodeListGenerator.getArtifacts(false)) {
urls.add(artifact.getFile().toURI().toURL());
}
} catch (DependencyCollectionException exception) {
throw new MojoExecutionException("Could not collect dependencies for " + mavenCoordinate, exception);
} catch (DependencyResolutionException exception) {
throw new MojoExecutionException("Could not resolve dependencies for " + mavenCoordinate, exception);
} catch (MalformedURLException exception) {
throw new MojoFailureException("Could not resolve file as URL for " + mavenCoordinate, exception);
}
return new URLClassLoader(urls.toArray(new URL[0]), ByteBuddy.class.getClassLoader());
} | java | private ClassLoader doResolve(MavenCoordinate mavenCoordinate) throws MojoExecutionException, MojoFailureException {
List<URL> urls = new ArrayList<URL>();
log.info("Resolving transformer dependency: " + mavenCoordinate);
try {
DependencyNode root = repositorySystem.collectDependencies(repositorySystemSession, new CollectRequest(new Dependency(mavenCoordinate.asArtifact(), "runtime"), remoteRepositories)).getRoot();
repositorySystem.resolveDependencies(repositorySystemSession, new DependencyRequest().setRoot(root));
PreorderNodeListGenerator preorderNodeListGenerator = new PreorderNodeListGenerator();
root.accept(preorderNodeListGenerator);
for (Artifact artifact : preorderNodeListGenerator.getArtifacts(false)) {
urls.add(artifact.getFile().toURI().toURL());
}
} catch (DependencyCollectionException exception) {
throw new MojoExecutionException("Could not collect dependencies for " + mavenCoordinate, exception);
} catch (DependencyResolutionException exception) {
throw new MojoExecutionException("Could not resolve dependencies for " + mavenCoordinate, exception);
} catch (MalformedURLException exception) {
throw new MojoFailureException("Could not resolve file as URL for " + mavenCoordinate, exception);
}
return new URLClassLoader(urls.toArray(new URL[0]), ByteBuddy.class.getClassLoader());
} | [
"private",
"ClassLoader",
"doResolve",
"(",
"MavenCoordinate",
"mavenCoordinate",
")",
"throws",
"MojoExecutionException",
",",
"MojoFailureException",
"{",
"List",
"<",
"URL",
">",
"urls",
"=",
"new",
"ArrayList",
"<",
"URL",
">",
"(",
")",
";",
"log",
".",
"... | Resolves a Maven coordinate to a class loader that can load all of the coordinates classes.
@param mavenCoordinate The Maven coordinate to resolve.
@return A class loader that references all of the class loader's dependencies and which is a child of this class's class loader.
@throws MojoExecutionException If the user configuration results in an error.
@throws MojoFailureException If the plugin application raises an error. | [
"Resolves",
"a",
"Maven",
"coordinate",
"to",
"a",
"class",
"loader",
"that",
"can",
"load",
"all",
"of",
"the",
"coordinates",
"classes",
"."
] | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/ClassLoaderResolver.java#L117-L136 |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/XMLViewer.java | XMLViewer.showXML | public static Window showXML(Document document, BaseUIComponent parent) {
Map<String, Object> args = Collections.singletonMap("document", document);
boolean modal = parent == null;
Window dialog = PopupDialog.show(XMLConstants.VIEW_DIALOG, args, modal, modal, modal, null);
if (parent != null) {
dialog.setParent(parent);
}
return dialog;
} | java | public static Window showXML(Document document, BaseUIComponent parent) {
Map<String, Object> args = Collections.singletonMap("document", document);
boolean modal = parent == null;
Window dialog = PopupDialog.show(XMLConstants.VIEW_DIALOG, args, modal, modal, modal, null);
if (parent != null) {
dialog.setParent(parent);
}
return dialog;
} | [
"public",
"static",
"Window",
"showXML",
"(",
"Document",
"document",
",",
"BaseUIComponent",
"parent",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"args",
"=",
"Collections",
".",
"singletonMap",
"(",
"\"document\"",
",",
"document",
")",
";",
"bool... | Show the dialog, loading the specified document.
@param document The XML document.
@param parent If specified, show viewer in embedded mode. Otherwise, show as modal dialog.
@return The dialog. | [
"Show",
"the",
"dialog",
"loading",
"the",
"specified",
"document",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/XMLViewer.java#L59-L69 |
operasoftware/operaprestodriver | src/com/opera/core/systems/OperaProfile.java | OperaProfile.getPreferenceFile | private static File getPreferenceFile(final File directory) {
List<File> candidates = ImmutableList.of(
new File(directory, "operaprefs.ini"),
new File(directory, "opera.ini"));
for (File candidate : candidates) {
if (candidate.exists()) {
return candidate;
}
}
return candidates.get(0);
} | java | private static File getPreferenceFile(final File directory) {
List<File> candidates = ImmutableList.of(
new File(directory, "operaprefs.ini"),
new File(directory, "opera.ini"));
for (File candidate : candidates) {
if (candidate.exists()) {
return candidate;
}
}
return candidates.get(0);
} | [
"private",
"static",
"File",
"getPreferenceFile",
"(",
"final",
"File",
"directory",
")",
"{",
"List",
"<",
"File",
">",
"candidates",
"=",
"ImmutableList",
".",
"of",
"(",
"new",
"File",
"(",
"directory",
",",
"\"operaprefs.ini\"",
")",
",",
"new",
"File",
... | Opera preference files can be named either <code>opera.ini</code> or
<code>operaprefs.ini</code> depending on the product. This method will look in the specified
directory for either of the files and return the one that exists. <code>operaprefs.ini</code>
has priority.
@param directory the directory to look for a preference file
@return a preference file | [
"Opera",
"preference",
"files",
"can",
"be",
"named",
"either",
"<code",
">",
"opera",
".",
"ini<",
"/",
"code",
">",
"or",
"<code",
">",
"operaprefs",
".",
"ini<",
"/",
"code",
">",
"depending",
"on",
"the",
"product",
".",
"This",
"method",
"will",
"... | train | https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/OperaProfile.java#L221-L233 |
vincentk/joptimizer | src/main/java/com/joptimizer/util/ColtUtils.java | ColtUtils.diagonalMatrixMult | public static final DoubleMatrix2D diagonalMatrixMult(final DoubleMatrix1D diagonalU, DoubleMatrix2D A, final DoubleMatrix1D diagonalV){
int r = A.rows();
int c = A.columns();
final DoubleMatrix2D ret;
if (A instanceof SparseDoubleMatrix2D) {
ret = DoubleFactory2D.sparse.make(r, c);
A.forEachNonZero(new IntIntDoubleFunction() {
@Override
public double apply(int i, int j, double aij) {
ret.setQuick(i, j, aij * diagonalU.getQuick(i) * diagonalV.getQuick(j));
return aij;
}
});
} else {
ret = DoubleFactory2D.dense.make(r, c);
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) {
ret.setQuick(i, j, A.getQuick(i, j) * diagonalU.getQuick(i) * diagonalV.getQuick(j));
}
}
}
return ret;
} | java | public static final DoubleMatrix2D diagonalMatrixMult(final DoubleMatrix1D diagonalU, DoubleMatrix2D A, final DoubleMatrix1D diagonalV){
int r = A.rows();
int c = A.columns();
final DoubleMatrix2D ret;
if (A instanceof SparseDoubleMatrix2D) {
ret = DoubleFactory2D.sparse.make(r, c);
A.forEachNonZero(new IntIntDoubleFunction() {
@Override
public double apply(int i, int j, double aij) {
ret.setQuick(i, j, aij * diagonalU.getQuick(i) * diagonalV.getQuick(j));
return aij;
}
});
} else {
ret = DoubleFactory2D.dense.make(r, c);
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) {
ret.setQuick(i, j, A.getQuick(i, j) * diagonalU.getQuick(i) * diagonalV.getQuick(j));
}
}
}
return ret;
} | [
"public",
"static",
"final",
"DoubleMatrix2D",
"diagonalMatrixMult",
"(",
"final",
"DoubleMatrix1D",
"diagonalU",
",",
"DoubleMatrix2D",
"A",
",",
"final",
"DoubleMatrix1D",
"diagonalV",
")",
"{",
"int",
"r",
"=",
"A",
".",
"rows",
"(",
")",
";",
"int",
"c",
... | Return diagonalU.A.diagonalV with diagonalU and diagonalV diagonal.
@param diagonalU diagonal matrix U, in the form of a vector of its diagonal elements
@param diagonalV diagonal matrix V, in the form of a vector of its diagonal elements
@return U.A.V | [
"Return",
"diagonalU",
".",
"A",
".",
"diagonalV",
"with",
"diagonalU",
"and",
"diagonalV",
"diagonal",
"."
] | train | https://github.com/vincentk/joptimizer/blob/65064c1bb0b26c7261358021e4c93d06dd43564f/src/main/java/com/joptimizer/util/ColtUtils.java#L122-L145 |
VoltDB/voltdb | src/frontend/org/voltdb/jni/ExecutionEngineJNI.java | ExecutionEngineJNI.coreLoadCatalog | @Override
protected void coreLoadCatalog(long timestamp, final byte[] catalogBytes) throws EEException {
LOG.trace("Loading Application Catalog...");
int errorCode = 0;
errorCode = nativeLoadCatalog(pointer, timestamp, catalogBytes);
checkErrorCode(errorCode);
//LOG.info("Loaded Catalog.");
} | java | @Override
protected void coreLoadCatalog(long timestamp, final byte[] catalogBytes) throws EEException {
LOG.trace("Loading Application Catalog...");
int errorCode = 0;
errorCode = nativeLoadCatalog(pointer, timestamp, catalogBytes);
checkErrorCode(errorCode);
//LOG.info("Loaded Catalog.");
} | [
"@",
"Override",
"protected",
"void",
"coreLoadCatalog",
"(",
"long",
"timestamp",
",",
"final",
"byte",
"[",
"]",
"catalogBytes",
")",
"throws",
"EEException",
"{",
"LOG",
".",
"trace",
"(",
"\"Loading Application Catalog...\"",
")",
";",
"int",
"errorCode",
"=... | Provide a serialized catalog and initialize version 0 of the engine's
catalog. | [
"Provide",
"a",
"serialized",
"catalog",
"and",
"initialize",
"version",
"0",
"of",
"the",
"engine",
"s",
"catalog",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jni/ExecutionEngineJNI.java#L335-L342 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.archiveEquals | public static boolean archiveEquals(File f1, File f2) {
try {
// Check the files byte-by-byte
if (FileUtils.contentEquals(f1, f2)) {
return true;
}
log.debug("Comparing archives '{}' and '{}'...", f1, f2);
long start = System.currentTimeMillis();
boolean result = archiveEqualsInternal(f1, f2);
long time = System.currentTimeMillis() - start;
if (time > 0) {
log.debug("Archives compared in " + time + " ms.");
}
return result;
}
catch (Exception e) {
log.debug("Could not compare '" + f1 + "' and '" + f2 + "':", e);
return false;
}
} | java | public static boolean archiveEquals(File f1, File f2) {
try {
// Check the files byte-by-byte
if (FileUtils.contentEquals(f1, f2)) {
return true;
}
log.debug("Comparing archives '{}' and '{}'...", f1, f2);
long start = System.currentTimeMillis();
boolean result = archiveEqualsInternal(f1, f2);
long time = System.currentTimeMillis() - start;
if (time > 0) {
log.debug("Archives compared in " + time + " ms.");
}
return result;
}
catch (Exception e) {
log.debug("Could not compare '" + f1 + "' and '" + f2 + "':", e);
return false;
}
} | [
"public",
"static",
"boolean",
"archiveEquals",
"(",
"File",
"f1",
",",
"File",
"f2",
")",
"{",
"try",
"{",
"// Check the files byte-by-byte",
"if",
"(",
"FileUtils",
".",
"contentEquals",
"(",
"f1",
",",
"f2",
")",
")",
"{",
"return",
"true",
";",
"}",
... | Compares two ZIP files and returns <code>true</code> if they contain same
entries.
<p>
First the two files are compared byte-by-byte. If a difference is found the
corresponding entries of both ZIP files are compared. Thus if same contents
is packed differently the two archives may still be the same.
</p>
<p>
Two archives are considered the same if
<ol>
<li>they contain same number of entries,</li>
<li>for each entry in the first archive there exists an entry with the same
in the second archive</li>
<li>for each entry in the first archive and the entry with the same name in
the second archive
<ol>
<li>both are either directories or files,</li>
<li>both have the same size,</li>
<li>both have the same CRC,</li>
<li>both have the same contents (compared byte-by-byte).</li>
</ol>
</li>
</ol>
@param f1
first ZIP file.
@param f2
second ZIP file.
@return <code>true</code> if the two ZIP files contain same entries,
<code>false</code> if a difference was found or an error occurred
during the comparison. | [
"Compares",
"two",
"ZIP",
"files",
"and",
"returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"they",
"contain",
"same",
"entries",
".",
"<p",
">",
"First",
"the",
"two",
"files",
"are",
"compared",
"byte",
"-",
"by",
"-",
"byte",
".",
"If",
"a... | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L3048-L3069 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/exception/fault/FaultException.java | FaultException.formatMessage | protected void formatMessage(String aID, Map<Object,Object> aBindValues)
{
Presenter presenter = Presenter.getPresenter(this.getClass());
message = presenter.getText(aID,aBindValues);
} | java | protected void formatMessage(String aID, Map<Object,Object> aBindValues)
{
Presenter presenter = Presenter.getPresenter(this.getClass());
message = presenter.getText(aID,aBindValues);
} | [
"protected",
"void",
"formatMessage",
"(",
"String",
"aID",
",",
"Map",
"<",
"Object",
",",
"Object",
">",
"aBindValues",
")",
"{",
"Presenter",
"presenter",
"=",
"Presenter",
".",
"getPresenter",
"(",
"this",
".",
"getClass",
"(",
")",
")",
";",
"message"... | Format the exception message using the presenter getText method
@param aID the key of the message
@param aBindValues the values to plug into the message. | [
"Format",
"the",
"exception",
"message",
"using",
"the",
"presenter",
"getText",
"method"
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/exception/fault/FaultException.java#L215-L220 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java | JDBCResultSet.updateInt | public void updateInt(int columnIndex, int x) throws SQLException {
startUpdate(columnIndex);
preparedStatement.setIntParameter(columnIndex, x);
} | java | public void updateInt(int columnIndex, int x) throws SQLException {
startUpdate(columnIndex);
preparedStatement.setIntParameter(columnIndex, x);
} | [
"public",
"void",
"updateInt",
"(",
"int",
"columnIndex",
",",
"int",
"x",
")",
"throws",
"SQLException",
"{",
"startUpdate",
"(",
"columnIndex",
")",
";",
"preparedStatement",
".",
"setIntParameter",
"(",
"columnIndex",
",",
"x",
")",
";",
"}"
] | <!-- start generic documentation -->
Updates the designated column with an <code>int</code> value.
The updater methods are used to update column values in the
current row or the insert row. The updater methods do not
update the underlying database; instead the <code>updateRow</code> or
<code>insertRow</code> methods are called to update the database.
<!-- end generic documentation -->
<!-- start release-specific documentation -->
<div class="ReleaseSpecificDocumentation">
<h3>HSQLDB-Specific Information:</h3> <p>
HSQLDB supports this feature. <p>
</div>
<!-- end release-specific documentation -->
@param columnIndex the first column is 1, the second is 2, ...
@param x the new column value
@exception SQLException if a database access error occurs,
the result set concurrency is <code>CONCUR_READ_ONLY</code>
or this method is called on a closed result set
@exception SQLFeatureNotSupportedException if the JDBC driver does not support
this method
@since JDK 1.2 (JDK 1.1.x developers: read the overview for
JDBCResultSet) | [
"<!",
"--",
"start",
"generic",
"documentation",
"--",
">",
"Updates",
"the",
"designated",
"column",
"with",
"an",
"<code",
">",
"int<",
"/",
"code",
">",
"value",
".",
"The",
"updater",
"methods",
"are",
"used",
"to",
"update",
"column",
"values",
"in",
... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java#L2749-L2752 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java | HylaFaxJob.getSenderName | public String getSenderName()
{
String value=null;
try
{
value=this.JOB.getFromUser();
}
catch(Exception exception)
{
throw new FaxException("Error while extracting job sender name.",exception);
}
return value;
} | java | public String getSenderName()
{
String value=null;
try
{
value=this.JOB.getFromUser();
}
catch(Exception exception)
{
throw new FaxException("Error while extracting job sender name.",exception);
}
return value;
} | [
"public",
"String",
"getSenderName",
"(",
")",
"{",
"String",
"value",
"=",
"null",
";",
"try",
"{",
"value",
"=",
"this",
".",
"JOB",
".",
"getFromUser",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"exception",
")",
"{",
"throw",
"new",
"FaxExcepti... | This function returns the fax job sender name.
@return The fax job sender name | [
"This",
"function",
"returns",
"the",
"fax",
"job",
"sender",
"name",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java#L225-L238 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.createInstance | public CreateInstanceResponse createInstance(CreateInstanceRequest request)
throws BceClientException {
checkNotNull(request, "request should not be null.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
if (null == request.getBilling()) {
request.setBilling(generateDefaultBilling());
}
checkStringNotEmpty(request.getImageId(), "imageId should not be empty");
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, INSTANCE_PREFIX);
internalRequest.addParameter("clientToken", request.getClientToken());
if (!Strings.isNullOrEmpty(request.getAdminPass())) {
BceCredentials credentials = config.getCredentials();
if (internalRequest.getCredentials() != null) {
credentials = internalRequest.getCredentials();
}
try {
request.setAdminPass(this.aes128WithFirst16Char(request.getAdminPass(), credentials.getSecretKey()));
} catch (GeneralSecurityException e) {
throw new BceClientException("Encryption procedure exception", e);
}
}
fillPayload(internalRequest, request);
return invokeHttpClient(internalRequest, CreateInstanceResponse.class);
} | java | public CreateInstanceResponse createInstance(CreateInstanceRequest request)
throws BceClientException {
checkNotNull(request, "request should not be null.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
if (null == request.getBilling()) {
request.setBilling(generateDefaultBilling());
}
checkStringNotEmpty(request.getImageId(), "imageId should not be empty");
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, INSTANCE_PREFIX);
internalRequest.addParameter("clientToken", request.getClientToken());
if (!Strings.isNullOrEmpty(request.getAdminPass())) {
BceCredentials credentials = config.getCredentials();
if (internalRequest.getCredentials() != null) {
credentials = internalRequest.getCredentials();
}
try {
request.setAdminPass(this.aes128WithFirst16Char(request.getAdminPass(), credentials.getSecretKey()));
} catch (GeneralSecurityException e) {
throw new BceClientException("Encryption procedure exception", e);
}
}
fillPayload(internalRequest, request);
return invokeHttpClient(internalRequest, CreateInstanceResponse.class);
} | [
"public",
"CreateInstanceResponse",
"createInstance",
"(",
"CreateInstanceRequest",
"request",
")",
"throws",
"BceClientException",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"r... | Create a bcc Instance with the specified options,
see all the supported instance in {@link com.baidubce.services.bcc.model.instance.InstanceType}
You must fill the field of clientToken,which is especially for keeping idempotent.
This is an asynchronous interface,
you can get the latest status by invoke {@link #getInstance(GetInstanceRequest)}
@param request The request containing all options for creating a bcc Instance.
@return List of instanceId newly created
@throws BceClientException | [
"Create",
"a",
"bcc",
"Instance",
"with",
"the",
"specified",
"options",
"see",
"all",
"the",
"supported",
"instance",
"in",
"{",
"@link",
"com",
".",
"baidubce",
".",
"services",
".",
"bcc",
".",
"model",
".",
"instance",
".",
"InstanceType",
"}",
"You",
... | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L272-L297 |
EMCECS/nfs-client-java | src/main/java/com/emc/ecs/nfsclient/rpc/RpcWrapper.java | RpcWrapper.callRpcChecked | public void callRpcChecked(S request, RpcResponseHandler<? extends T> responseHandler) throws IOException {
callRpcChecked(request, responseHandler, chooseIP(request.getIpKey()));
} | java | public void callRpcChecked(S request, RpcResponseHandler<? extends T> responseHandler) throws IOException {
callRpcChecked(request, responseHandler, chooseIP(request.getIpKey()));
} | [
"public",
"void",
"callRpcChecked",
"(",
"S",
"request",
",",
"RpcResponseHandler",
"<",
"?",
"extends",
"T",
">",
"responseHandler",
")",
"throws",
"IOException",
"{",
"callRpcChecked",
"(",
"request",
",",
"responseHandler",
",",
"chooseIP",
"(",
"request",
".... | Convenience wrapper for NFS RPC calls where the IP is determined by a
byte[] key. This method just determines the IP address and calls the
basic method.
@param request
The request to send.
@param responseHandler
A response handler.
@throws IOException | [
"Convenience",
"wrapper",
"for",
"NFS",
"RPC",
"calls",
"where",
"the",
"IP",
"is",
"determined",
"by",
"a",
"byte",
"[]",
"key",
".",
"This",
"method",
"just",
"determines",
"the",
"IP",
"address",
"and",
"calls",
"the",
"basic",
"method",
"."
] | train | https://github.com/EMCECS/nfs-client-java/blob/7ba25bad5052b95cd286052745327729288b2843/src/main/java/com/emc/ecs/nfsclient/rpc/RpcWrapper.java#L175-L177 |
grails/grails-gdoc-engine | src/main/java/org/radeox/macro/Preserved.java | Preserved.addSpecial | protected void addSpecial(String c, String replacement) {
specialString += c;
special.put(c, replacement);
} | java | protected void addSpecial(String c, String replacement) {
specialString += c;
special.put(c, replacement);
} | [
"protected",
"void",
"addSpecial",
"(",
"String",
"c",
",",
"String",
"replacement",
")",
"{",
"specialString",
"+=",
"c",
";",
"special",
".",
"put",
"(",
"c",
",",
"replacement",
")",
";",
"}"
] | Add a replacement for the special character c which may be a string
@param c the character to replace
@param replacement the new string | [
"Add",
"a",
"replacement",
"for",
"the",
"special",
"character",
"c",
"which",
"may",
"be",
"a",
"string"
] | train | https://github.com/grails/grails-gdoc-engine/blob/e52aa09eaa61510dc48b27603bd9ea116cd6531a/src/main/java/org/radeox/macro/Preserved.java#L53-L56 |
thymeleaf/thymeleaf-spring | thymeleaf-spring5/src/main/java/org/thymeleaf/spring5/util/SpringValueFormatter.java | SpringValueFormatter.getDisplayString | public static String getDisplayString(final Object value, final boolean htmlEscape) {
final String displayValue = ObjectUtils.getDisplayString(value);
return (htmlEscape ? HtmlUtils.htmlEscape(displayValue) : displayValue);
} | java | public static String getDisplayString(final Object value, final boolean htmlEscape) {
final String displayValue = ObjectUtils.getDisplayString(value);
return (htmlEscape ? HtmlUtils.htmlEscape(displayValue) : displayValue);
} | [
"public",
"static",
"String",
"getDisplayString",
"(",
"final",
"Object",
"value",
",",
"final",
"boolean",
"htmlEscape",
")",
"{",
"final",
"String",
"displayValue",
"=",
"ObjectUtils",
".",
"getDisplayString",
"(",
"value",
")",
";",
"return",
"(",
"htmlEscape... | /*
NOTE This code is based on org.springframework.web.servlet.tags.form.ValueFormatter as of Spring 5.0.0
Original license is Apache License 2.0, which is the same as the license for this file.
Original copyright notice is "Copyright 2002-2012 the original author or authors".
Original authors are Rob Harrop and Juergen Hoeller. | [
"/",
"*",
"NOTE",
"This",
"code",
"is",
"based",
"on",
"org",
".",
"springframework",
".",
"web",
".",
"servlet",
".",
"tags",
".",
"form",
".",
"ValueFormatter",
"as",
"of",
"Spring",
"5",
".",
"0",
".",
"0",
"Original",
"license",
"is",
"Apache",
"... | train | https://github.com/thymeleaf/thymeleaf-spring/blob/9aa15a19017a0938e57646e3deefb8a90ab78dcb/thymeleaf-spring5/src/main/java/org/thymeleaf/spring5/util/SpringValueFormatter.java#L50-L53 |
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java | DatabaseAccountsInner.beginOnlineRegionAsync | public Observable<Void> beginOnlineRegionAsync(String resourceGroupName, String accountName, String region) {
return beginOnlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginOnlineRegionAsync(String resourceGroupName, String accountName, String region) {
return beginOnlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginOnlineRegionAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"region",
")",
"{",
"return",
"beginOnlineRegionWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
... | Online the specified region for the specified Azure Cosmos DB database account.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param region Cosmos DB region, with spaces between words and each word capitalized.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Online",
"the",
"specified",
"region",
"for",
"the",
"specified",
"Azure",
"Cosmos",
"DB",
"database",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L1560-L1567 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.getBuildVariable | public GitlabBuildVariable getBuildVariable(Integer projectId, String key)
throws IOException {
String tailUrl = GitlabProject.URL + "/" +
projectId +
GitlabBuildVariable.URL + "/" +
key;
return retrieve().to(tailUrl, GitlabBuildVariable.class);
} | java | public GitlabBuildVariable getBuildVariable(Integer projectId, String key)
throws IOException {
String tailUrl = GitlabProject.URL + "/" +
projectId +
GitlabBuildVariable.URL + "/" +
key;
return retrieve().to(tailUrl, GitlabBuildVariable.class);
} | [
"public",
"GitlabBuildVariable",
"getBuildVariable",
"(",
"Integer",
"projectId",
",",
"String",
"key",
")",
"throws",
"IOException",
"{",
"String",
"tailUrl",
"=",
"GitlabProject",
".",
"URL",
"+",
"\"/\"",
"+",
"projectId",
"+",
"GitlabBuildVariable",
".",
"URL"... | Gets build variable associated with a project and key.
@param projectId The ID of the project.
@param key The key of the variable.
@return A variable.
@throws IOException on gitlab api call error | [
"Gets",
"build",
"variable",
"associated",
"with",
"a",
"project",
"and",
"key",
"."
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3645-L3652 |
infinispan/infinispan | extended-statistics/src/main/java/org/infinispan/stats/CacheStatisticManager.java | CacheStatisticManager.beginTransaction | public final void beginTransaction(GlobalTransaction globalTransaction, boolean local) {
if (local) {
//Not overriding the InitialValue method leads me to have "null" at the first invocation of get()
TransactionStatistics lts = createTransactionStatisticIfAbsent(globalTransaction, true);
if (trace) {
log.tracef("Local transaction statistic is already initialized: %s", lts);
}
} else {
TransactionStatistics rts = createTransactionStatisticIfAbsent(globalTransaction, false);
if (trace) {
log.tracef("Using the remote transaction statistic %s for transaction %s", rts, globalTransaction);
}
}
} | java | public final void beginTransaction(GlobalTransaction globalTransaction, boolean local) {
if (local) {
//Not overriding the InitialValue method leads me to have "null" at the first invocation of get()
TransactionStatistics lts = createTransactionStatisticIfAbsent(globalTransaction, true);
if (trace) {
log.tracef("Local transaction statistic is already initialized: %s", lts);
}
} else {
TransactionStatistics rts = createTransactionStatisticIfAbsent(globalTransaction, false);
if (trace) {
log.tracef("Using the remote transaction statistic %s for transaction %s", rts, globalTransaction);
}
}
} | [
"public",
"final",
"void",
"beginTransaction",
"(",
"GlobalTransaction",
"globalTransaction",
",",
"boolean",
"local",
")",
"{",
"if",
"(",
"local",
")",
"{",
"//Not overriding the InitialValue method leads me to have \"null\" at the first invocation of get()",
"TransactionStatis... | Signals the start of a transaction.
@param local {@code true} if the transaction is local. | [
"Signals",
"the",
"start",
"of",
"a",
"transaction",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/extended-statistics/src/main/java/org/infinispan/stats/CacheStatisticManager.java#L170-L183 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/hylafax/HylaFaxClientSpi.java | HylaFaxClientSpi.suspendFaxJobImpl | @Override
protected void suspendFaxJobImpl(FaxJob faxJob)
{
//get fax job
HylaFaxJob hylaFaxJob=(HylaFaxJob)faxJob;
//get client
HylaFAXClient client=this.getHylaFAXClient();
try
{
this.suspendFaxJob(hylaFaxJob,client);
}
catch(FaxException exception)
{
throw exception;
}
catch(Exception exception)
{
throw new FaxException("General error.",exception);
}
} | java | @Override
protected void suspendFaxJobImpl(FaxJob faxJob)
{
//get fax job
HylaFaxJob hylaFaxJob=(HylaFaxJob)faxJob;
//get client
HylaFAXClient client=this.getHylaFAXClient();
try
{
this.suspendFaxJob(hylaFaxJob,client);
}
catch(FaxException exception)
{
throw exception;
}
catch(Exception exception)
{
throw new FaxException("General error.",exception);
}
} | [
"@",
"Override",
"protected",
"void",
"suspendFaxJobImpl",
"(",
"FaxJob",
"faxJob",
")",
"{",
"//get fax job",
"HylaFaxJob",
"hylaFaxJob",
"=",
"(",
"HylaFaxJob",
")",
"faxJob",
";",
"//get client",
"HylaFAXClient",
"client",
"=",
"this",
".",
"getHylaFAXClient",
... | This function will suspend an existing fax job.
@param faxJob
The fax job object containing the needed information | [
"This",
"function",
"will",
"suspend",
"an",
"existing",
"fax",
"job",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/hylafax/HylaFaxClientSpi.java#L334-L355 |
deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/tools/BTools.java | BTools.getSDbl | public static String getSDbl( double Value, int DecPrec ) {
//
String Result = "";
//
if ( Double.isNaN( Value ) ) return "NaN";
//
if ( DecPrec < 0 ) DecPrec = 0;
//
String DFS = "###,###,##0";
//
if ( DecPrec > 0 ) {
int idx = 0;
DFS += ".";
while ( idx < DecPrec ) {
DFS = DFS + "0";
idx ++;
if ( idx > 100 ) break;
}
}
//
// Locale locale = new Locale("en", "UK");
//
DecimalFormatSymbols DcmFrmSmb = new DecimalFormatSymbols( Locale.getDefault());
DcmFrmSmb.setDecimalSeparator('.');
DcmFrmSmb.setGroupingSeparator(' ');
//
DecimalFormat DcmFrm;
//
DcmFrm = new DecimalFormat( DFS, DcmFrmSmb );
//
// DcmFrm.setGroupingSize( 3 );
//
Result = DcmFrm.format( Value );
//
return Result;
} | java | public static String getSDbl( double Value, int DecPrec ) {
//
String Result = "";
//
if ( Double.isNaN( Value ) ) return "NaN";
//
if ( DecPrec < 0 ) DecPrec = 0;
//
String DFS = "###,###,##0";
//
if ( DecPrec > 0 ) {
int idx = 0;
DFS += ".";
while ( idx < DecPrec ) {
DFS = DFS + "0";
idx ++;
if ( idx > 100 ) break;
}
}
//
// Locale locale = new Locale("en", "UK");
//
DecimalFormatSymbols DcmFrmSmb = new DecimalFormatSymbols( Locale.getDefault());
DcmFrmSmb.setDecimalSeparator('.');
DcmFrmSmb.setGroupingSeparator(' ');
//
DecimalFormat DcmFrm;
//
DcmFrm = new DecimalFormat( DFS, DcmFrmSmb );
//
// DcmFrm.setGroupingSize( 3 );
//
Result = DcmFrm.format( Value );
//
return Result;
} | [
"public",
"static",
"String",
"getSDbl",
"(",
"double",
"Value",
",",
"int",
"DecPrec",
")",
"{",
"//",
"String",
"Result",
"=",
"\"\"",
";",
"//",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"Value",
")",
")",
"return",
"\"NaN\"",
";",
"//",
"if",
"(",
... | <b>getSDbl</b><br>
public static String getSDbl( double Value, int DecPrec )<br>
Returns double converted to string.<br>
If Value is Double.NaN returns "NaN".<br>
If DecPrec is < 0 is DecPrec set 0.<br>
@param Value - value
@param DecPrec - decimal precision
@return double as string | [
"<b",
">",
"getSDbl<",
"/",
"b",
">",
"<br",
">",
"public",
"static",
"String",
"getSDbl",
"(",
"double",
"Value",
"int",
"DecPrec",
")",
"<br",
">",
"Returns",
"double",
"converted",
"to",
"string",
".",
"<br",
">",
"If",
"Value",
"is",
"Double",
".",... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/tools/BTools.java#L142-L177 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/rules/patterns/Match.java | Match.createState | public MatchState createState(Synthesizer synthesizer, AnalyzedTokenReadings[] tokens, int index, int next) {
MatchState state = new MatchState(this, synthesizer);
state.setToken(tokens, index, next);
return state;
} | java | public MatchState createState(Synthesizer synthesizer, AnalyzedTokenReadings[] tokens, int index, int next) {
MatchState state = new MatchState(this, synthesizer);
state.setToken(tokens, index, next);
return state;
} | [
"public",
"MatchState",
"createState",
"(",
"Synthesizer",
"synthesizer",
",",
"AnalyzedTokenReadings",
"[",
"]",
"tokens",
",",
"int",
"index",
",",
"int",
"next",
")",
"{",
"MatchState",
"state",
"=",
"new",
"MatchState",
"(",
"this",
",",
"synthesizer",
")"... | Creates a state used for actually matching a token.
@since 2.3 | [
"Creates",
"a",
"state",
"used",
"for",
"actually",
"matching",
"a",
"token",
"."
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/Match.java#L102-L106 |
lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/ParseDateExtensions.java | ParseDateExtensions.parseDate | public static Date parseDate(final String date, final List<String> patterns)
{
for (final String pattern : patterns)
{
final SimpleDateFormat formatter = new SimpleDateFormat(pattern);
try
{
return formatter.parse(date);
}
catch (final ParseException e)
{
// Do nothing...
}
}
return null;
} | java | public static Date parseDate(final String date, final List<String> patterns)
{
for (final String pattern : patterns)
{
final SimpleDateFormat formatter = new SimpleDateFormat(pattern);
try
{
return formatter.parse(date);
}
catch (final ParseException e)
{
// Do nothing...
}
}
return null;
} | [
"public",
"static",
"Date",
"parseDate",
"(",
"final",
"String",
"date",
",",
"final",
"List",
"<",
"String",
">",
"patterns",
")",
"{",
"for",
"(",
"final",
"String",
"pattern",
":",
"patterns",
")",
"{",
"final",
"SimpleDateFormat",
"formatter",
"=",
"ne... | Tries to convert the given String to a Date.
@param date
The date to convert as String.
@param patterns
The date patterns to convert the String to a date-object.
@return Gives a Date if the convertion was successfull otherwise null. | [
"Tries",
"to",
"convert",
"the",
"given",
"String",
"to",
"a",
"Date",
"."
] | train | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/ParseDateExtensions.java#L56-L71 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressPersistenceImpl.java | CommerceAddressPersistenceImpl.removeByC_C | @Override
public void removeByC_C(long classNameId, long classPK) {
for (CommerceAddress commerceAddress : findByC_C(classNameId, classPK,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceAddress);
}
} | java | @Override
public void removeByC_C(long classNameId, long classPK) {
for (CommerceAddress commerceAddress : findByC_C(classNameId, classPK,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceAddress);
}
} | [
"@",
"Override",
"public",
"void",
"removeByC_C",
"(",
"long",
"classNameId",
",",
"long",
"classPK",
")",
"{",
"for",
"(",
"CommerceAddress",
"commerceAddress",
":",
"findByC_C",
"(",
"classNameId",
",",
"classPK",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"Quer... | Removes all the commerce addresses where classNameId = ? and classPK = ? from the database.
@param classNameId the class name ID
@param classPK the class pk | [
"Removes",
"all",
"the",
"commerce",
"addresses",
"where",
"classNameId",
"=",
"?",
";",
"and",
"classPK",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressPersistenceImpl.java#L1615-L1621 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPointLight.java | GVRPointLight.setAttenuation | public void setAttenuation(float constant, float linear, float quadratic) {
setFloat("attenuation_constant", constant);
setFloat("attenuation_linear", linear);
setFloat("attenuation_quadratic", quadratic);
} | java | public void setAttenuation(float constant, float linear, float quadratic) {
setFloat("attenuation_constant", constant);
setFloat("attenuation_linear", linear);
setFloat("attenuation_quadratic", quadratic);
} | [
"public",
"void",
"setAttenuation",
"(",
"float",
"constant",
",",
"float",
"linear",
",",
"float",
"quadratic",
")",
"{",
"setFloat",
"(",
"\"attenuation_constant\"",
",",
"constant",
")",
";",
"setFloat",
"(",
"\"attenuation_linear\"",
",",
"linear",
")",
";",... | Set the three attenuation constants to control how
light falls off based on distance from the light source.
{@code 1 / (attenuation_constant + attenuation_linear * D * attenuation_quadratic * D ** 2)}
@param constant constant attenuation factor
@param linear linear attenuation factor
@param quadratic quadratic attenuation factor | [
"Set",
"the",
"three",
"attenuation",
"constants",
"to",
"control",
"how",
"light",
"falls",
"off",
"based",
"on",
"distance",
"from",
"the",
"light",
"source",
".",
"{"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPointLight.java#L253-L257 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/AbstractRegionPainter.java | AbstractRegionPainter.createGradient | protected final LinearGradientPaint createGradient(float x1, float y1, float x2, float y2, float[] midpoints, Color[] colors) {
if (x1 == x2 && y1 == y2) {
y2 += .00001f;
}
return new LinearGradientPaint(x1, y1, x2, y2, midpoints, colors);
} | java | protected final LinearGradientPaint createGradient(float x1, float y1, float x2, float y2, float[] midpoints, Color[] colors) {
if (x1 == x2 && y1 == y2) {
y2 += .00001f;
}
return new LinearGradientPaint(x1, y1, x2, y2, midpoints, colors);
} | [
"protected",
"final",
"LinearGradientPaint",
"createGradient",
"(",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"x2",
",",
"float",
"y2",
",",
"float",
"[",
"]",
"midpoints",
",",
"Color",
"[",
"]",
"colors",
")",
"{",
"if",
"(",
"x1",
"==",
"x2",... | Given parameters for creating a LinearGradientPaint, this method will
create and return a linear gradient paint. One primary purpose for this
method is to avoid creating a LinearGradientPaint where the start and end
points are equal. In such a case, the end y point is slightly increased
to avoid the overlap.
@param x1
@param y1
@param x2
@param y2
@param midpoints
@param colors
@return a valid LinearGradientPaint. This method never returns null. | [
"Given",
"parameters",
"for",
"creating",
"a",
"LinearGradientPaint",
"this",
"method",
"will",
"create",
"and",
"return",
"a",
"linear",
"gradient",
"paint",
".",
"One",
"primary",
"purpose",
"for",
"this",
"method",
"is",
"to",
"avoid",
"creating",
"a",
"Lin... | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/AbstractRegionPainter.java#L336-L342 |
phax/ph-commons | ph-jaxb/src/main/java/com/helger/jaxb/JAXBContextCache.java | JAXBContextCache.getFromCache | @Nullable
public JAXBContext getFromCache (@Nonnull final Package aPackage, @Nullable final ClassLoader aClassLoader)
{
return getFromCache (new JAXBContextCacheKey (aPackage, aClassLoader));
} | java | @Nullable
public JAXBContext getFromCache (@Nonnull final Package aPackage, @Nullable final ClassLoader aClassLoader)
{
return getFromCache (new JAXBContextCacheKey (aPackage, aClassLoader));
} | [
"@",
"Nullable",
"public",
"JAXBContext",
"getFromCache",
"(",
"@",
"Nonnull",
"final",
"Package",
"aPackage",
",",
"@",
"Nullable",
"final",
"ClassLoader",
"aClassLoader",
")",
"{",
"return",
"getFromCache",
"(",
"new",
"JAXBContextCacheKey",
"(",
"aPackage",
","... | Special overload with package and {@link ClassLoader}. In this case the
resulting value is NOT cached!
@param aPackage
Package to load. May not be <code>null</code>.
@param aClassLoader
Class loader to use. May be <code>null</code> in which case the
default class loader is used.
@return <code>null</code> if package is <code>null</code>. | [
"Special",
"overload",
"with",
"package",
"and",
"{",
"@link",
"ClassLoader",
"}",
".",
"In",
"this",
"case",
"the",
"resulting",
"value",
"is",
"NOT",
"cached!"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-jaxb/src/main/java/com/helger/jaxb/JAXBContextCache.java#L132-L136 |
google/closure-compiler | src/com/google/javascript/jscomp/PeepholeFoldConstants.java | PeepholeFoldConstants.tryFoldGetProp | private Node tryFoldGetProp(Node n, Node left, Node right) {
checkArgument(n.isGetProp());
if (left.isObjectLit()) {
return tryFoldObjectPropAccess(n, left, right);
}
if (right.isString() &&
right.getString().equals("length")) {
int knownLength = -1;
switch (left.getToken()) {
case ARRAYLIT:
if (mayHaveSideEffects(left)) {
// Nope, can't fold this, without handling the side-effects.
return n;
}
knownLength = left.getChildCount();
break;
case STRING:
knownLength = left.getString().length();
break;
default:
// Not a foldable case, forget it.
return n;
}
checkState(knownLength != -1);
Node lengthNode = IR.number(knownLength);
reportChangeToEnclosingScope(n);
n.replaceWith(lengthNode);
return lengthNode;
}
return n;
} | java | private Node tryFoldGetProp(Node n, Node left, Node right) {
checkArgument(n.isGetProp());
if (left.isObjectLit()) {
return tryFoldObjectPropAccess(n, left, right);
}
if (right.isString() &&
right.getString().equals("length")) {
int knownLength = -1;
switch (left.getToken()) {
case ARRAYLIT:
if (mayHaveSideEffects(left)) {
// Nope, can't fold this, without handling the side-effects.
return n;
}
knownLength = left.getChildCount();
break;
case STRING:
knownLength = left.getString().length();
break;
default:
// Not a foldable case, forget it.
return n;
}
checkState(knownLength != -1);
Node lengthNode = IR.number(knownLength);
reportChangeToEnclosingScope(n);
n.replaceWith(lengthNode);
return lengthNode;
}
return n;
} | [
"private",
"Node",
"tryFoldGetProp",
"(",
"Node",
"n",
",",
"Node",
"left",
",",
"Node",
"right",
")",
"{",
"checkArgument",
"(",
"n",
".",
"isGetProp",
"(",
")",
")",
";",
"if",
"(",
"left",
".",
"isObjectLit",
"(",
")",
")",
"{",
"return",
"tryFold... | Try to fold array-length. e.g [1, 2, 3].length ==> 3, [x, y].length ==> 2 | [
"Try",
"to",
"fold",
"array",
"-",
"length",
".",
"e",
".",
"g",
"[",
"1",
"2",
"3",
"]",
".",
"length",
"==",
">",
"3",
"[",
"x",
"y",
"]",
".",
"length",
"==",
">",
"2"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PeepholeFoldConstants.java#L1321-L1356 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java | UCharacter.toUpperCase | public static String toUpperCase(Locale locale, String str)
{
return toUpperCase(getCaseLocale(locale), str);
} | java | public static String toUpperCase(Locale locale, String str)
{
return toUpperCase(getCaseLocale(locale), str);
} | [
"public",
"static",
"String",
"toUpperCase",
"(",
"Locale",
"locale",
",",
"String",
"str",
")",
"{",
"return",
"toUpperCase",
"(",
"getCaseLocale",
"(",
"locale",
")",
",",
"str",
")",
";",
"}"
] | Returns the uppercase version of the argument string.
Casing is dependent on the argument locale and context-sensitive.
@param locale which string is to be converted in
@param str source string to be performed on
@return uppercase version of the argument string | [
"Returns",
"the",
"uppercase",
"version",
"of",
"the",
"argument",
"string",
".",
"Casing",
"is",
"dependent",
"on",
"the",
"argument",
"locale",
"and",
"context",
"-",
"sensitive",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java#L4409-L4412 |
apiman/apiman | manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/OrganizationResourceImpl.java | OrganizationResourceImpl.parseDate | private static DateTime parseDate(String dateStr, DateTime defaultDate, boolean floor) {
if ("now".equals(dateStr)) { //$NON-NLS-1$
return new DateTime();
}
if (dateStr.length() == 10) {
DateTime parsed = ISODateTimeFormat.date().withZone(DateTimeZone.UTC).parseDateTime(dateStr);
// If what we want is the floor, then just return it. But if we want the
// ceiling of the date, then we need to set the right params.
if (!floor) {
parsed = parsed.plusDays(1).minusMillis(1);
}
return parsed;
}
if (dateStr.length() == 20) {
return ISODateTimeFormat.dateTimeNoMillis().withZone(DateTimeZone.UTC).parseDateTime(dateStr);
}
if (dateStr.length() == 24) {
return ISODateTimeFormat.dateTime().withZone(DateTimeZone.UTC).parseDateTime(dateStr);
}
return defaultDate;
} | java | private static DateTime parseDate(String dateStr, DateTime defaultDate, boolean floor) {
if ("now".equals(dateStr)) { //$NON-NLS-1$
return new DateTime();
}
if (dateStr.length() == 10) {
DateTime parsed = ISODateTimeFormat.date().withZone(DateTimeZone.UTC).parseDateTime(dateStr);
// If what we want is the floor, then just return it. But if we want the
// ceiling of the date, then we need to set the right params.
if (!floor) {
parsed = parsed.plusDays(1).minusMillis(1);
}
return parsed;
}
if (dateStr.length() == 20) {
return ISODateTimeFormat.dateTimeNoMillis().withZone(DateTimeZone.UTC).parseDateTime(dateStr);
}
if (dateStr.length() == 24) {
return ISODateTimeFormat.dateTime().withZone(DateTimeZone.UTC).parseDateTime(dateStr);
}
return defaultDate;
} | [
"private",
"static",
"DateTime",
"parseDate",
"(",
"String",
"dateStr",
",",
"DateTime",
"defaultDate",
",",
"boolean",
"floor",
")",
"{",
"if",
"(",
"\"now\"",
".",
"equals",
"(",
"dateStr",
")",
")",
"{",
"//$NON-NLS-1$",
"return",
"new",
"DateTime",
"(",
... | Parses a query param representing a date into an actual date object. | [
"Parses",
"a",
"query",
"param",
"representing",
"a",
"date",
"into",
"an",
"actual",
"date",
"object",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/OrganizationResourceImpl.java#L3669-L3689 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.standardDeviation | public SDVariable standardDeviation(String name, SDVariable x, boolean biasCorrected, int... dimensions) {
return standardDeviation(name, x, biasCorrected, false, dimensions);
} | java | public SDVariable standardDeviation(String name, SDVariable x, boolean biasCorrected, int... dimensions) {
return standardDeviation(name, x, biasCorrected, false, dimensions);
} | [
"public",
"SDVariable",
"standardDeviation",
"(",
"String",
"name",
",",
"SDVariable",
"x",
",",
"boolean",
"biasCorrected",
",",
"int",
"...",
"dimensions",
")",
"{",
"return",
"standardDeviation",
"(",
"name",
",",
"x",
",",
"biasCorrected",
",",
"false",
",... | Stardard deviation array reduction operation, optionally along specified dimensions
@param name Output variable name
@param x Input variable
@param biasCorrected If true: divide by (N-1) (i.e., sample stdev). If false: divide by N (population stdev)
@param dimensions Dimensions to reduce over. If dimensions are not specified, full array reduction is performed
@return Output variable: reduced array of rank (input rank - num dimensions) | [
"Stardard",
"deviation",
"array",
"reduction",
"operation",
"optionally",
"along",
"specified",
"dimensions"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L2581-L2583 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/config/MethodFinder.java | MethodFinder.typesEquivalent | private static boolean typesEquivalent(Type typeToMatch, GenericArrayType type, ResolutionContext ctx) {
if (typeToMatch instanceof GenericArrayType) {
GenericArrayType aGat = (GenericArrayType) typeToMatch;
return typesEquivalent(aGat.getGenericComponentType(),
ctx.resolve(type.getGenericComponentType()),
ctx);
}
if (typeToMatch instanceof Class) {
Class<?> aClazz = (Class<?>) typeToMatch;
if (aClazz.isArray()) {
return typesEquivalent(aClazz.getComponentType(), ctx.resolve(type.getGenericComponentType()), ctx);
}
}
return false;
} | java | private static boolean typesEquivalent(Type typeToMatch, GenericArrayType type, ResolutionContext ctx) {
if (typeToMatch instanceof GenericArrayType) {
GenericArrayType aGat = (GenericArrayType) typeToMatch;
return typesEquivalent(aGat.getGenericComponentType(),
ctx.resolve(type.getGenericComponentType()),
ctx);
}
if (typeToMatch instanceof Class) {
Class<?> aClazz = (Class<?>) typeToMatch;
if (aClazz.isArray()) {
return typesEquivalent(aClazz.getComponentType(), ctx.resolve(type.getGenericComponentType()), ctx);
}
}
return false;
} | [
"private",
"static",
"boolean",
"typesEquivalent",
"(",
"Type",
"typeToMatch",
",",
"GenericArrayType",
"type",
",",
"ResolutionContext",
"ctx",
")",
"{",
"if",
"(",
"typeToMatch",
"instanceof",
"GenericArrayType",
")",
"{",
"GenericArrayType",
"aGat",
"=",
"(",
"... | Computes whether a type is equivalent to a GenericArrayType.
<p>
This method will check that {@code typeToMatch} is either a {@link GenericArrayType} or an array and then recursively compare the component types of both arguments using
{@link #typesEquivalent(Type, Type, ResolutionContext)}.
@param typeToMatch the type to match against
@param type the type to check, type variable resolution will be performed for this type
@param ctx the resolution context to use to perform type variable resolution
@return {@code true} if {@code type} is equivalent to {@code typeToMatch} after type resolution, otherwise {@code false} | [
"Computes",
"whether",
"a",
"type",
"is",
"equivalent",
"to",
"a",
"GenericArrayType",
".",
"<p",
">",
"This",
"method",
"will",
"check",
"that",
"{",
"@code",
"typeToMatch",
"}",
"is",
"either",
"a",
"{",
"@link",
"GenericArrayType",
"}",
"or",
"an",
"arr... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/config/MethodFinder.java#L235-L251 |
igniterealtime/Smack | smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java | SpoilerElement.addSpoiler | public static void addSpoiler(Message message, String lang, String hint) {
message.addExtension(new SpoilerElement(lang, hint));
} | java | public static void addSpoiler(Message message, String lang, String hint) {
message.addExtension(new SpoilerElement(lang, hint));
} | [
"public",
"static",
"void",
"addSpoiler",
"(",
"Message",
"message",
",",
"String",
"lang",
",",
"String",
"hint",
")",
"{",
"message",
".",
"addExtension",
"(",
"new",
"SpoilerElement",
"(",
"lang",
",",
"hint",
")",
")",
";",
"}"
] | Add a SpoilerElement with a hint in a certain language to a message.
@param message Message to add the Spoiler to.
@param lang language of the Spoiler hint.
@param hint hint. | [
"Add",
"a",
"SpoilerElement",
"with",
"a",
"hint",
"in",
"a",
"certain",
"language",
"to",
"a",
"message",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java#L90-L92 |
amsa-code/risky | ais/src/main/java/au/gov/amsa/ais/Util.java | Util.checkLatLong | public static void checkLatLong(double lat, double lon) {
checkArgument(lon <= 181.0, "longitude out of range " + lon);
checkArgument(lon > -180.0, "longitude out of range " + lon);
checkArgument(lat <= 91.0, "latitude out of range " + lat);
checkArgument(lat > -90.0, "latitude out of range " + lat);
} | java | public static void checkLatLong(double lat, double lon) {
checkArgument(lon <= 181.0, "longitude out of range " + lon);
checkArgument(lon > -180.0, "longitude out of range " + lon);
checkArgument(lat <= 91.0, "latitude out of range " + lat);
checkArgument(lat > -90.0, "latitude out of range " + lat);
} | [
"public",
"static",
"void",
"checkLatLong",
"(",
"double",
"lat",
",",
"double",
"lon",
")",
"{",
"checkArgument",
"(",
"lon",
"<=",
"181.0",
",",
"\"longitude out of range \"",
"+",
"lon",
")",
";",
"checkArgument",
"(",
"lon",
">",
"-",
"180.0",
",",
"\"... | Check lat lon are withing allowable range as per 1371-4.pdf. Note that
values of long=181, lat=91 have special meaning.
@param lat
@param lon | [
"Check",
"lat",
"lon",
"are",
"withing",
"allowable",
"range",
"as",
"per",
"1371",
"-",
"4",
".",
"pdf",
".",
"Note",
"that",
"values",
"of",
"long",
"=",
"181",
"lat",
"=",
"91",
"have",
"special",
"meaning",
"."
] | train | https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/ais/src/main/java/au/gov/amsa/ais/Util.java#L197-L202 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/cuDoubleComplex.java | cuDoubleComplex.cuCmul | public static cuDoubleComplex cuCmul (cuDoubleComplex x, cuDoubleComplex y)
{
cuDoubleComplex prod;
prod = cuCmplx ((cuCreal(x) * cuCreal(y)) - (cuCimag(x) * cuCimag(y)),
(cuCreal(x) * cuCimag(y)) + (cuCimag(x) * cuCreal(y)));
return prod;
} | java | public static cuDoubleComplex cuCmul (cuDoubleComplex x, cuDoubleComplex y)
{
cuDoubleComplex prod;
prod = cuCmplx ((cuCreal(x) * cuCreal(y)) - (cuCimag(x) * cuCimag(y)),
(cuCreal(x) * cuCimag(y)) + (cuCimag(x) * cuCreal(y)));
return prod;
} | [
"public",
"static",
"cuDoubleComplex",
"cuCmul",
"(",
"cuDoubleComplex",
"x",
",",
"cuDoubleComplex",
"y",
")",
"{",
"cuDoubleComplex",
"prod",
";",
"prod",
"=",
"cuCmplx",
"(",
"(",
"cuCreal",
"(",
"x",
")",
"*",
"cuCreal",
"(",
"y",
")",
")",
"-",
"(",... | Returns the product of the given complex numbers.<br />
<br />
Original comment:<br />
<br />
This implementation could suffer from intermediate overflow even though
the final result would be in range. However, various implementations do
not guard against this (presumably to avoid losing performance), so we
don't do it either to stay competitive.
@param x The first factor
@param y The second factor
@return The product of the given factors | [
"Returns",
"the",
"product",
"of",
"the",
"given",
"complex",
"numbers",
".",
"<br",
"/",
">",
"<br",
"/",
">",
"Original",
"comment",
":",
"<br",
"/",
">",
"<br",
"/",
">",
"This",
"implementation",
"could",
"suffer",
"from",
"intermediate",
"overflow",
... | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/cuDoubleComplex.java#L123-L129 |
apache/incubator-gobblin | gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/hdfs/SimpleHadoopFilesystemConfigStore.java | SimpleHadoopFilesystemConfigStore.getChildren | @Override
public Collection<ConfigKeyPath> getChildren(ConfigKeyPath configKey, String version)
throws VersionDoesNotExistException {
Preconditions.checkNotNull(configKey, "configKey cannot be null!");
Preconditions.checkArgument(!Strings.isNullOrEmpty(version), "version cannot be null or empty!");
List<ConfigKeyPath> children = new ArrayList<>();
Path datasetDir = getDatasetDirForKey(configKey, version);
try {
if (!this.fs.exists(datasetDir)) {
return children;
}
for (FileStatus fileStatus : this.fs.listStatus(datasetDir)) {
if (fileStatus.isDirectory()) {
children.add(configKey.createChild(fileStatus.getPath().getName()));
}
}
return children;
} catch (IOException e) {
throw new RuntimeException(String.format("Error while getting children for configKey: \"%s\"", configKey), e);
}
} | java | @Override
public Collection<ConfigKeyPath> getChildren(ConfigKeyPath configKey, String version)
throws VersionDoesNotExistException {
Preconditions.checkNotNull(configKey, "configKey cannot be null!");
Preconditions.checkArgument(!Strings.isNullOrEmpty(version), "version cannot be null or empty!");
List<ConfigKeyPath> children = new ArrayList<>();
Path datasetDir = getDatasetDirForKey(configKey, version);
try {
if (!this.fs.exists(datasetDir)) {
return children;
}
for (FileStatus fileStatus : this.fs.listStatus(datasetDir)) {
if (fileStatus.isDirectory()) {
children.add(configKey.createChild(fileStatus.getPath().getName()));
}
}
return children;
} catch (IOException e) {
throw new RuntimeException(String.format("Error while getting children for configKey: \"%s\"", configKey), e);
}
} | [
"@",
"Override",
"public",
"Collection",
"<",
"ConfigKeyPath",
">",
"getChildren",
"(",
"ConfigKeyPath",
"configKey",
",",
"String",
"version",
")",
"throws",
"VersionDoesNotExistException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"configKey",
",",
"\"configKe... | Retrieves all the children of the given {@link ConfigKeyPath} by doing a {@code ls} on the {@link Path} specified
by the {@link ConfigKeyPath}. If the {@link Path} described by the {@link ConfigKeyPath} does not exist, an empty
{@link Collection} is returned.
@param configKey the config key path whose children are necessary.
@param version specify the configuration version in the configuration store.
@return a {@link Collection} of {@link ConfigKeyPath} where each entry is a child of the given configKey.
@throws VersionDoesNotExistException if the version specified cannot be found in the {@link ConfigStore}. | [
"Retrieves",
"all",
"the",
"children",
"of",
"the",
"given",
"{",
"@link",
"ConfigKeyPath",
"}",
"by",
"doing",
"a",
"{",
"@code",
"ls",
"}",
"on",
"the",
"{",
"@link",
"Path",
"}",
"specified",
"by",
"the",
"{",
"@link",
"ConfigKeyPath",
"}",
".",
"If... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/hdfs/SimpleHadoopFilesystemConfigStore.java#L207-L230 |
elastic/elasticsearch-hadoop | mr/src/main/java/org/elasticsearch/hadoop/mr/security/TokenUtil.java | TokenUtil.getEsAuthToken | private static EsToken getEsAuthToken(ClusterName clusterName, User user) {
return user.getEsToken(clusterName.getName());
} | java | private static EsToken getEsAuthToken(ClusterName clusterName, User user) {
return user.getEsToken(clusterName.getName());
} | [
"private",
"static",
"EsToken",
"getEsAuthToken",
"(",
"ClusterName",
"clusterName",
",",
"User",
"user",
")",
"{",
"return",
"user",
".",
"getEsToken",
"(",
"clusterName",
".",
"getName",
"(",
")",
")",
";",
"}"
] | Get the authentication token of the user for the provided cluster name in its ES-Hadoop specific form.
@return null if the user does not have the token, otherwise the auth token for the cluster. | [
"Get",
"the",
"authentication",
"token",
"of",
"the",
"user",
"for",
"the",
"provided",
"cluster",
"name",
"in",
"its",
"ES",
"-",
"Hadoop",
"specific",
"form",
"."
] | train | https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/mr/security/TokenUtil.java#L213-L215 |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload/FineUploaderBasic.java | FineUploaderBasic.addParam | @Nonnull
public FineUploaderBasic addParam (@Nonnull @Nonempty final String sKey, @Nonnull final String sValue)
{
ValueEnforcer.notEmpty (sKey, "Key");
ValueEnforcer.notNull (sValue, "Value");
m_aRequestParams.put (sKey, sValue);
return this;
} | java | @Nonnull
public FineUploaderBasic addParam (@Nonnull @Nonempty final String sKey, @Nonnull final String sValue)
{
ValueEnforcer.notEmpty (sKey, "Key");
ValueEnforcer.notNull (sValue, "Value");
m_aRequestParams.put (sKey, sValue);
return this;
} | [
"@",
"Nonnull",
"public",
"FineUploaderBasic",
"addParam",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sKey",
",",
"@",
"Nonnull",
"final",
"String",
"sValue",
")",
"{",
"ValueEnforcer",
".",
"notEmpty",
"(",
"sKey",
",",
"\"Key\"",
")",
";",
... | These parameters are sent with the request to the endpoint specified in the
action option.
@param sKey
Parameter name
@param sValue
Parameter value
@return this | [
"These",
"parameters",
"are",
"sent",
"with",
"the",
"request",
"to",
"the",
"endpoint",
"specified",
"in",
"the",
"action",
"option",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload/FineUploaderBasic.java#L199-L207 |
alibaba/transmittable-thread-local | src/main/java/com/alibaba/ttl/TtlCallable.java | TtlCallable.get | @Nullable
public static <T> TtlCallable<T> get(@Nullable Callable<T> callable, boolean releaseTtlValueReferenceAfterCall) {
return get(callable, releaseTtlValueReferenceAfterCall, false);
} | java | @Nullable
public static <T> TtlCallable<T> get(@Nullable Callable<T> callable, boolean releaseTtlValueReferenceAfterCall) {
return get(callable, releaseTtlValueReferenceAfterCall, false);
} | [
"@",
"Nullable",
"public",
"static",
"<",
"T",
">",
"TtlCallable",
"<",
"T",
">",
"get",
"(",
"@",
"Nullable",
"Callable",
"<",
"T",
">",
"callable",
",",
"boolean",
"releaseTtlValueReferenceAfterCall",
")",
"{",
"return",
"get",
"(",
"callable",
",",
"rel... | Factory method, wrap input {@link Callable} to {@link TtlCallable}.
<p>
This method is idempotent.
@param callable input {@link Callable}
@param releaseTtlValueReferenceAfterCall release TTL value reference after run, avoid memory leak even if {@link TtlRunnable} is referred.
@return Wrapped {@link Callable} | [
"Factory",
"method",
"wrap",
"input",
"{",
"@link",
"Callable",
"}",
"to",
"{",
"@link",
"TtlCallable",
"}",
".",
"<p",
">",
"This",
"method",
"is",
"idempotent",
"."
] | train | https://github.com/alibaba/transmittable-thread-local/blob/30b4d99cdb7064b4c1797d2e40bfa07adce8e7f9/src/main/java/com/alibaba/ttl/TtlCallable.java#L107-L110 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.