repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/provisioning/UsersApi.java | UsersApi.getCurrentUser | public User getCurrentUser() throws ProvisioningApiException {
"""
Get the logged in user.
Get the [CfgPerson](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgPerson) object for the currently logged in user.
@return the current User.
@throws ProvisioningApiException if the call is unsuccessful.
"""
try {
GetUsersSuccessResponse resp = usersApi.getCurrentUser();
if (!resp.getStatus().getCode().equals(0)) {
throw new ProvisioningApiException("Error getting current user. Code: " + resp.getStatus().getCode());
}
return new User((Map<String, Object>)resp.getData().getUser());
} catch(ApiException e) {
throw new ProvisioningApiException("Error getting current user", e);
}
} | java | public User getCurrentUser() throws ProvisioningApiException {
try {
GetUsersSuccessResponse resp = usersApi.getCurrentUser();
if (!resp.getStatus().getCode().equals(0)) {
throw new ProvisioningApiException("Error getting current user. Code: " + resp.getStatus().getCode());
}
return new User((Map<String, Object>)resp.getData().getUser());
} catch(ApiException e) {
throw new ProvisioningApiException("Error getting current user", e);
}
} | [
"public",
"User",
"getCurrentUser",
"(",
")",
"throws",
"ProvisioningApiException",
"{",
"try",
"{",
"GetUsersSuccessResponse",
"resp",
"=",
"usersApi",
".",
"getCurrentUser",
"(",
")",
";",
"if",
"(",
"!",
"resp",
".",
"getStatus",
"(",
")",
".",
"getCode",
... | Get the logged in user.
Get the [CfgPerson](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgPerson) object for the currently logged in user.
@return the current User.
@throws ProvisioningApiException if the call is unsuccessful. | [
"Get",
"the",
"logged",
"in",
"user",
".",
"Get",
"the",
"[",
"CfgPerson",
"]",
"(",
"https",
":",
"//",
"docs",
".",
"genesys",
".",
"com",
"/",
"Documentation",
"/",
"PSDK",
"/",
"latest",
"/",
"ConfigLayerRef",
"/",
"CfgPerson",
")",
"object",
"for"... | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/provisioning/UsersApi.java#L169-L182 |
tomgibara/bits | src/main/java/com/tomgibara/bits/LongBitStore.java | LongBitStore.readBits | static long readBits(ReadStream reader, int count) {
"""
not does not mask off the returned long - that is responsibility of caller
"""
long bits = 0L;
for (int i = (count - 1) >> 3; i >= 0; i --) {
bits <<= 8;
bits |= reader.readByte() & 0xff;
}
return bits;
} | java | static long readBits(ReadStream reader, int count) {
long bits = 0L;
for (int i = (count - 1) >> 3; i >= 0; i --) {
bits <<= 8;
bits |= reader.readByte() & 0xff;
}
return bits;
} | [
"static",
"long",
"readBits",
"(",
"ReadStream",
"reader",
",",
"int",
"count",
")",
"{",
"long",
"bits",
"=",
"0L",
";",
"for",
"(",
"int",
"i",
"=",
"(",
"count",
"-",
"1",
")",
">>",
"3",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"bit... | not does not mask off the returned long - that is responsibility of caller | [
"not",
"does",
"not",
"mask",
"off",
"the",
"returned",
"long",
"-",
"that",
"is",
"responsibility",
"of",
"caller"
] | train | https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/LongBitStore.java#L65-L72 |
jpaoletti/java-presentation-manager | modules/jpm-core/src/main/java/jpaoletti/jpm/converter/Converter.java | Converter.getValue | protected Object getValue(Object einstance, Field field) {
"""
Getter for the value
@param einstance The entity instance
@param field The field
@return The field value on the entity instance
"""
return getNestedProperty(einstance, field.getProperty());
} | java | protected Object getValue(Object einstance, Field field) {
return getNestedProperty(einstance, field.getProperty());
} | [
"protected",
"Object",
"getValue",
"(",
"Object",
"einstance",
",",
"Field",
"field",
")",
"{",
"return",
"getNestedProperty",
"(",
"einstance",
",",
"field",
".",
"getProperty",
"(",
")",
")",
";",
"}"
] | Getter for the value
@param einstance The entity instance
@param field The field
@return The field value on the entity instance | [
"Getter",
"for",
"the",
"value"
] | train | https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/converter/Converter.java#L95-L97 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.multRows | public static void multRows(double[] values, DMatrixRMaj A) {
"""
Multiplies every element in row i by value[i].
@param values array. Not modified.
@param A Matrix. Modified.
"""
if( values.length < A.numRows ) {
throw new IllegalArgumentException("Not enough elements in values.");
}
int index = 0;
for (int row = 0; row < A.numRows; row++) {
double v = values[row];
for (int col = 0; col < A.numCols; col++, index++) {
A.data[index] *= v;
}
}
} | java | public static void multRows(double[] values, DMatrixRMaj A) {
if( values.length < A.numRows ) {
throw new IllegalArgumentException("Not enough elements in values.");
}
int index = 0;
for (int row = 0; row < A.numRows; row++) {
double v = values[row];
for (int col = 0; col < A.numCols; col++, index++) {
A.data[index] *= v;
}
}
} | [
"public",
"static",
"void",
"multRows",
"(",
"double",
"[",
"]",
"values",
",",
"DMatrixRMaj",
"A",
")",
"{",
"if",
"(",
"values",
".",
"length",
"<",
"A",
".",
"numRows",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Not enough elements in v... | Multiplies every element in row i by value[i].
@param values array. Not modified.
@param A Matrix. Modified. | [
"Multiplies",
"every",
"element",
"in",
"row",
"i",
"by",
"value",
"[",
"i",
"]",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1746-L1758 |
casmi/casmi | src/main/java/casmi/graphics/color/HSBColor.java | HSBColor.lerpColor | public static Color lerpColor(ColorSet colorSet1, ColorSet colorSet2, double amt) {
"""
Calculates a color or colors between two color at a specific increment.
@param colorSet1
interpolate from this color
@param colorSet2
interpolate to this color
@param amt
between 0.0 and 1.0
@return
The calculated color values.
"""
return lerpColor((HSBColor)HSBColor.color(colorSet1), (HSBColor)HSBColor.color(colorSet2), amt);
} | java | public static Color lerpColor(ColorSet colorSet1, ColorSet colorSet2, double amt) {
return lerpColor((HSBColor)HSBColor.color(colorSet1), (HSBColor)HSBColor.color(colorSet2), amt);
} | [
"public",
"static",
"Color",
"lerpColor",
"(",
"ColorSet",
"colorSet1",
",",
"ColorSet",
"colorSet2",
",",
"double",
"amt",
")",
"{",
"return",
"lerpColor",
"(",
"(",
"HSBColor",
")",
"HSBColor",
".",
"color",
"(",
"colorSet1",
")",
",",
"(",
"HSBColor",
"... | Calculates a color or colors between two color at a specific increment.
@param colorSet1
interpolate from this color
@param colorSet2
interpolate to this color
@param amt
between 0.0 and 1.0
@return
The calculated color values. | [
"Calculates",
"a",
"color",
"or",
"colors",
"between",
"two",
"color",
"at",
"a",
"specific",
"increment",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/color/HSBColor.java#L256-L258 |
apache/flink | flink-core/src/main/java/org/apache/flink/util/FileUtils.java | FileUtils.deletePathIfEmpty | public static boolean deletePathIfEmpty(FileSystem fileSystem, Path path) throws IOException {
"""
Deletes the path if it is empty. A path can only be empty if it is a directory which does
not contain any other directories/files.
@param fileSystem to use
@param path to be deleted if empty
@return true if the path could be deleted; otherwise false
@throws IOException if the delete operation fails
"""
final FileStatus[] fileStatuses;
try {
fileStatuses = fileSystem.listStatus(path);
}
catch (FileNotFoundException e) {
// path already deleted
return true;
}
catch (Exception e) {
// could not access directory, cannot delete
return false;
}
// if there are no more files or if we couldn't list the file status try to delete the path
if (fileStatuses == null) {
// another indicator of "file not found"
return true;
}
else if (fileStatuses.length == 0) {
// attempt to delete the path (will fail and be ignored if the path now contains
// some files (possibly added concurrently))
return fileSystem.delete(path, false);
}
else {
return false;
}
} | java | public static boolean deletePathIfEmpty(FileSystem fileSystem, Path path) throws IOException {
final FileStatus[] fileStatuses;
try {
fileStatuses = fileSystem.listStatus(path);
}
catch (FileNotFoundException e) {
// path already deleted
return true;
}
catch (Exception e) {
// could not access directory, cannot delete
return false;
}
// if there are no more files or if we couldn't list the file status try to delete the path
if (fileStatuses == null) {
// another indicator of "file not found"
return true;
}
else if (fileStatuses.length == 0) {
// attempt to delete the path (will fail and be ignored if the path now contains
// some files (possibly added concurrently))
return fileSystem.delete(path, false);
}
else {
return false;
}
} | [
"public",
"static",
"boolean",
"deletePathIfEmpty",
"(",
"FileSystem",
"fileSystem",
",",
"Path",
"path",
")",
"throws",
"IOException",
"{",
"final",
"FileStatus",
"[",
"]",
"fileStatuses",
";",
"try",
"{",
"fileStatuses",
"=",
"fileSystem",
".",
"listStatus",
"... | Deletes the path if it is empty. A path can only be empty if it is a directory which does
not contain any other directories/files.
@param fileSystem to use
@param path to be deleted if empty
@return true if the path could be deleted; otherwise false
@throws IOException if the delete operation fails | [
"Deletes",
"the",
"path",
"if",
"it",
"is",
"empty",
".",
"A",
"path",
"can",
"only",
"be",
"empty",
"if",
"it",
"is",
"a",
"directory",
"which",
"does",
"not",
"contain",
"any",
"other",
"directories",
"/",
"files",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/FileUtils.java#L399-L427 |
alkacon/opencms-core | src/org/opencms/ade/sitemap/CmsVfsSitemapService.java | CmsVfsSitemapService.createNewContainerElements | private void createNewContainerElements(CmsObject cms, CmsXmlContainerPage page, String sitePath)
throws CmsException {
"""
Creates new content elements if required by the model page.<p>
@param cms the cms context
@param page the page
@param sitePath the resource site path
@throws CmsException when unable to create the content elements
"""
CmsADEConfigData configData = OpenCms.getADEManager().lookupConfiguration(cms, cms.addSiteRoot(sitePath));
Locale contentLocale = OpenCms.getLocaleManager().getDefaultLocale(cms, CmsResource.getFolderPath(sitePath));
CmsObject cloneCms = OpenCms.initCmsObject(cms);
cloneCms.getRequestContext().setLocale(contentLocale);
CmsContainerPageBean pageBean = page.getContainerPage(cms);
boolean needsChanges = false;
List<CmsContainerBean> updatedContainers = new ArrayList<CmsContainerBean>();
for (CmsContainerBean container : pageBean.getContainers().values()) {
List<CmsContainerElementBean> updatedElements = new ArrayList<CmsContainerElementBean>();
for (CmsContainerElementBean element : container.getElements()) {
if (element.isCreateNew() && !element.isGroupContainer(cms) && !element.isInheritedContainer(cms)) {
needsChanges = true;
String typeName = OpenCms.getResourceManager().getResourceType(element.getResource()).getTypeName();
CmsResourceTypeConfig typeConfig = configData.getResourceType(typeName);
if (typeConfig == null) {
throw new IllegalArgumentException(
"Can not copy template model element '"
+ element.getResource().getRootPath()
+ "' because the resource type '"
+ typeName
+ "' is not available in this sitemap.");
}
CmsResource newResource = typeConfig.createNewElement(
cloneCms,
element.getResource(),
CmsResource.getParentFolder(cms.getRequestContext().addSiteRoot(sitePath)));
CmsContainerElementBean newBean = new CmsContainerElementBean(
newResource.getStructureId(),
element.getFormatterId(),
element.getIndividualSettings(),
false);
updatedElements.add(newBean);
} else {
updatedElements.add(element);
}
}
CmsContainerBean updatedContainer = new CmsContainerBean(
container.getName(),
container.getType(),
container.getParentInstanceId(),
container.isRootContainer(),
container.getMaxElements(),
updatedElements);
updatedContainers.add(updatedContainer);
}
if (needsChanges) {
CmsContainerPageBean updatedPage = new CmsContainerPageBean(updatedContainers);
page.writeContainerPage(cms, updatedPage);
}
} | java | private void createNewContainerElements(CmsObject cms, CmsXmlContainerPage page, String sitePath)
throws CmsException {
CmsADEConfigData configData = OpenCms.getADEManager().lookupConfiguration(cms, cms.addSiteRoot(sitePath));
Locale contentLocale = OpenCms.getLocaleManager().getDefaultLocale(cms, CmsResource.getFolderPath(sitePath));
CmsObject cloneCms = OpenCms.initCmsObject(cms);
cloneCms.getRequestContext().setLocale(contentLocale);
CmsContainerPageBean pageBean = page.getContainerPage(cms);
boolean needsChanges = false;
List<CmsContainerBean> updatedContainers = new ArrayList<CmsContainerBean>();
for (CmsContainerBean container : pageBean.getContainers().values()) {
List<CmsContainerElementBean> updatedElements = new ArrayList<CmsContainerElementBean>();
for (CmsContainerElementBean element : container.getElements()) {
if (element.isCreateNew() && !element.isGroupContainer(cms) && !element.isInheritedContainer(cms)) {
needsChanges = true;
String typeName = OpenCms.getResourceManager().getResourceType(element.getResource()).getTypeName();
CmsResourceTypeConfig typeConfig = configData.getResourceType(typeName);
if (typeConfig == null) {
throw new IllegalArgumentException(
"Can not copy template model element '"
+ element.getResource().getRootPath()
+ "' because the resource type '"
+ typeName
+ "' is not available in this sitemap.");
}
CmsResource newResource = typeConfig.createNewElement(
cloneCms,
element.getResource(),
CmsResource.getParentFolder(cms.getRequestContext().addSiteRoot(sitePath)));
CmsContainerElementBean newBean = new CmsContainerElementBean(
newResource.getStructureId(),
element.getFormatterId(),
element.getIndividualSettings(),
false);
updatedElements.add(newBean);
} else {
updatedElements.add(element);
}
}
CmsContainerBean updatedContainer = new CmsContainerBean(
container.getName(),
container.getType(),
container.getParentInstanceId(),
container.isRootContainer(),
container.getMaxElements(),
updatedElements);
updatedContainers.add(updatedContainer);
}
if (needsChanges) {
CmsContainerPageBean updatedPage = new CmsContainerPageBean(updatedContainers);
page.writeContainerPage(cms, updatedPage);
}
} | [
"private",
"void",
"createNewContainerElements",
"(",
"CmsObject",
"cms",
",",
"CmsXmlContainerPage",
"page",
",",
"String",
"sitePath",
")",
"throws",
"CmsException",
"{",
"CmsADEConfigData",
"configData",
"=",
"OpenCms",
".",
"getADEManager",
"(",
")",
".",
"looku... | Creates new content elements if required by the model page.<p>
@param cms the cms context
@param page the page
@param sitePath the resource site path
@throws CmsException when unable to create the content elements | [
"Creates",
"new",
"content",
"elements",
"if",
"required",
"by",
"the",
"model",
"page",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsVfsSitemapService.java#L1654-L1708 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/UtilFile.java | UtilFile.normalizeExtension | public static String normalizeExtension(String file, String extension) {
"""
Normalize the file extension by ensuring it has the required one.
@param file The original file name (must not be <code>null</code>).
@param extension The desired extension, will replace the other one if has (must not be <code>null</code>).
@return The normalized file with its extension.
@throws LionEngineException If invalid arguments.
"""
Check.notNull(file);
Check.notNull(extension);
final int length = file.length() + Constant.DOT.length() + extension.length();
final StringBuilder builder = new StringBuilder(length).append(removeExtension(file)).append(Constant.DOT);
if (extension.startsWith(Constant.DOT))
{
builder.append(getExtension(extension));
}
else
{
builder.append(extension);
}
return builder.toString();
} | java | public static String normalizeExtension(String file, String extension)
{
Check.notNull(file);
Check.notNull(extension);
final int length = file.length() + Constant.DOT.length() + extension.length();
final StringBuilder builder = new StringBuilder(length).append(removeExtension(file)).append(Constant.DOT);
if (extension.startsWith(Constant.DOT))
{
builder.append(getExtension(extension));
}
else
{
builder.append(extension);
}
return builder.toString();
} | [
"public",
"static",
"String",
"normalizeExtension",
"(",
"String",
"file",
",",
"String",
"extension",
")",
"{",
"Check",
".",
"notNull",
"(",
"file",
")",
";",
"Check",
".",
"notNull",
"(",
"extension",
")",
";",
"final",
"int",
"length",
"=",
"file",
"... | Normalize the file extension by ensuring it has the required one.
@param file The original file name (must not be <code>null</code>).
@param extension The desired extension, will replace the other one if has (must not be <code>null</code>).
@return The normalized file with its extension.
@throws LionEngineException If invalid arguments. | [
"Normalize",
"the",
"file",
"extension",
"by",
"ensuring",
"it",
"has",
"the",
"required",
"one",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilFile.java#L73-L89 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java | ExpressRouteCircuitsInner.updateTagsAsync | public Observable<ExpressRouteCircuitInner> updateTagsAsync(String resourceGroupName, String circuitName, Map<String, String> tags) {
"""
Updates an express route circuit tags.
@param resourceGroupName The name of the resource group.
@param circuitName The name of the circuit.
@param tags Resource tags.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return updateTagsWithServiceResponseAsync(resourceGroupName, circuitName, tags).map(new Func1<ServiceResponse<ExpressRouteCircuitInner>, ExpressRouteCircuitInner>() {
@Override
public ExpressRouteCircuitInner call(ServiceResponse<ExpressRouteCircuitInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRouteCircuitInner> updateTagsAsync(String resourceGroupName, String circuitName, Map<String, String> tags) {
return updateTagsWithServiceResponseAsync(resourceGroupName, circuitName, tags).map(new Func1<ServiceResponse<ExpressRouteCircuitInner>, ExpressRouteCircuitInner>() {
@Override
public ExpressRouteCircuitInner call(ServiceResponse<ExpressRouteCircuitInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRouteCircuitInner",
">",
"updateTagsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"circuitName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",
"updateTagsWithServiceResponseAsync",
"(",
"... | Updates an express route circuit tags.
@param resourceGroupName The name of the resource group.
@param circuitName The name of the circuit.
@param tags Resource tags.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"an",
"express",
"route",
"circuit",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java#L659-L666 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPSpecificationOptionPersistenceImpl.java | CPSpecificationOptionPersistenceImpl.findByGroupId | @Override
public List<CPSpecificationOption> findByGroupId(long groupId) {
"""
Returns all the cp specification options where groupId = ?.
@param groupId the group ID
@return the matching cp specification options
"""
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CPSpecificationOption> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPSpecificationOption",
">",
"findByGroupId",
"(",
"long",
"groupId",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"... | Returns all the cp specification options where groupId = ?.
@param groupId the group ID
@return the matching cp specification options | [
"Returns",
"all",
"the",
"cp",
"specification",
"options",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPSpecificationOptionPersistenceImpl.java#L1524-L1527 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java | DirectoryHelper.uncompressDirectory | public static void uncompressDirectory(File srcZipPath, File dstDirPath) throws IOException {
"""
Uncompress data to the destination directory.
@param srcZipPath
path to the compressed file, could be the file or the directory
@param dstDirPath
destination path
@throws IOException
if any exception occurred
"""
ZipInputStream in = new ZipInputStream(new FileInputStream(srcZipPath));
ZipEntry entry = null;
try
{
while ((entry = in.getNextEntry()) != null)
{
File dstFile = new File(dstDirPath, entry.getName());
dstFile.getParentFile().mkdirs();
if (entry.isDirectory())
{
dstFile.mkdirs();
}
else
{
OutputStream out = new FileOutputStream(dstFile);
try
{
transfer(in, out);
}
finally
{
out.close();
}
}
}
}
finally
{
if (in != null)
{
in.close();
}
}
} | java | public static void uncompressDirectory(File srcZipPath, File dstDirPath) throws IOException
{
ZipInputStream in = new ZipInputStream(new FileInputStream(srcZipPath));
ZipEntry entry = null;
try
{
while ((entry = in.getNextEntry()) != null)
{
File dstFile = new File(dstDirPath, entry.getName());
dstFile.getParentFile().mkdirs();
if (entry.isDirectory())
{
dstFile.mkdirs();
}
else
{
OutputStream out = new FileOutputStream(dstFile);
try
{
transfer(in, out);
}
finally
{
out.close();
}
}
}
}
finally
{
if (in != null)
{
in.close();
}
}
} | [
"public",
"static",
"void",
"uncompressDirectory",
"(",
"File",
"srcZipPath",
",",
"File",
"dstDirPath",
")",
"throws",
"IOException",
"{",
"ZipInputStream",
"in",
"=",
"new",
"ZipInputStream",
"(",
"new",
"FileInputStream",
"(",
"srcZipPath",
")",
")",
";",
"Zi... | Uncompress data to the destination directory.
@param srcZipPath
path to the compressed file, could be the file or the directory
@param dstDirPath
destination path
@throws IOException
if any exception occurred | [
"Uncompress",
"data",
"to",
"the",
"destination",
"directory",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java#L264-L301 |
fuzzylite/jfuzzylite | jfuzzylite/src/main/java/com/fuzzylite/factory/DefuzzifierFactory.java | DefuzzifierFactory.constructDefuzzifier | public Defuzzifier constructDefuzzifier(String key, int resolution) {
"""
Creates a Defuzzifier by executing the registered constructor
@param key is the unique name by which constructors are registered
@param resolution is the resolution of an IntegralDefuzzifier
@return a Defuzzifier by executing the registered constructor and setting
its resolution
"""
Defuzzifier result = constructObject(key);
if (result instanceof IntegralDefuzzifier) {
((IntegralDefuzzifier) result).setResolution(resolution);
}
return result;
} | java | public Defuzzifier constructDefuzzifier(String key, int resolution) {
Defuzzifier result = constructObject(key);
if (result instanceof IntegralDefuzzifier) {
((IntegralDefuzzifier) result).setResolution(resolution);
}
return result;
} | [
"public",
"Defuzzifier",
"constructDefuzzifier",
"(",
"String",
"key",
",",
"int",
"resolution",
")",
"{",
"Defuzzifier",
"result",
"=",
"constructObject",
"(",
"key",
")",
";",
"if",
"(",
"result",
"instanceof",
"IntegralDefuzzifier",
")",
"{",
"(",
"(",
"Int... | Creates a Defuzzifier by executing the registered constructor
@param key is the unique name by which constructors are registered
@param resolution is the resolution of an IntegralDefuzzifier
@return a Defuzzifier by executing the registered constructor and setting
its resolution | [
"Creates",
"a",
"Defuzzifier",
"by",
"executing",
"the",
"registered",
"constructor"
] | train | https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/factory/DefuzzifierFactory.java#L81-L87 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java | MandatoryWarningHandler.logMandatoryNote | private void logMandatoryNote(JavaFileObject file, String msg, Object... args) {
"""
Reports a mandatory note to the log. If mandatory notes are
not being enforced, treat this as an ordinary note.
"""
if (enforceMandatory)
log.mandatoryNote(file, msg, args);
else
log.note(file, msg, args);
} | java | private void logMandatoryNote(JavaFileObject file, String msg, Object... args) {
if (enforceMandatory)
log.mandatoryNote(file, msg, args);
else
log.note(file, msg, args);
} | [
"private",
"void",
"logMandatoryNote",
"(",
"JavaFileObject",
"file",
",",
"String",
"msg",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"enforceMandatory",
")",
"log",
".",
"mandatoryNote",
"(",
"file",
",",
"msg",
",",
"args",
")",
";",
"else",
"... | Reports a mandatory note to the log. If mandatory notes are
not being enforced, treat this as an ordinary note. | [
"Reports",
"a",
"mandatory",
"note",
"to",
"the",
"log",
".",
"If",
"mandatory",
"notes",
"are",
"not",
"being",
"enforced",
"treat",
"this",
"as",
"an",
"ordinary",
"note",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java#L264-L269 |
alkacon/opencms-core | src-gwt/org/opencms/ade/containerpage/client/ui/CmsContainerPageElementPanel.java | CmsContainerPageElementPanel.addListCollectorEditorButtons | private void addListCollectorEditorButtons(Element editable) {
"""
Adds the collector edit buttons.<p>
@param editable the marker element for an editable list element
"""
CmsListCollectorEditor editor = new CmsListCollectorEditor(editable, m_clientId);
add(editor, editable.getParentElement());
if (CmsDomUtil.hasDimension(editable.getParentElement())) {
editor.setParentHasDimensions(true);
editor.setPosition(CmsDomUtil.getEditablePosition(editable), getElement());
} else {
editor.setParentHasDimensions(false);
}
m_editables.put(editable, editor);
} | java | private void addListCollectorEditorButtons(Element editable) {
CmsListCollectorEditor editor = new CmsListCollectorEditor(editable, m_clientId);
add(editor, editable.getParentElement());
if (CmsDomUtil.hasDimension(editable.getParentElement())) {
editor.setParentHasDimensions(true);
editor.setPosition(CmsDomUtil.getEditablePosition(editable), getElement());
} else {
editor.setParentHasDimensions(false);
}
m_editables.put(editable, editor);
} | [
"private",
"void",
"addListCollectorEditorButtons",
"(",
"Element",
"editable",
")",
"{",
"CmsListCollectorEditor",
"editor",
"=",
"new",
"CmsListCollectorEditor",
"(",
"editable",
",",
"m_clientId",
")",
";",
"add",
"(",
"editor",
",",
"editable",
".",
"getParentEl... | Adds the collector edit buttons.<p>
@param editable the marker element for an editable list element | [
"Adds",
"the",
"collector",
"edit",
"buttons",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/ui/CmsContainerPageElementPanel.java#L1193-L1204 |
op4j/op4j | src/main/java/org/op4j/Op.java | Op.onArray | public static <T> Level0ArrayOperator<BigInteger[],BigInteger> onArray(final BigInteger[] target) {
"""
<p>
Creates an <i>operation expression</i> on the specified target object.
</p>
@param target the target object on which the expression will execute
@return an operator, ready for chaining
"""
return onArrayOf(Types.BIG_INTEGER, target);
} | java | public static <T> Level0ArrayOperator<BigInteger[],BigInteger> onArray(final BigInteger[] target) {
return onArrayOf(Types.BIG_INTEGER, target);
} | [
"public",
"static",
"<",
"T",
">",
"Level0ArrayOperator",
"<",
"BigInteger",
"[",
"]",
",",
"BigInteger",
">",
"onArray",
"(",
"final",
"BigInteger",
"[",
"]",
"target",
")",
"{",
"return",
"onArrayOf",
"(",
"Types",
".",
"BIG_INTEGER",
",",
"target",
")",... | <p>
Creates an <i>operation expression</i> on the specified target object.
</p>
@param target the target object on which the expression will execute
@return an operator, ready for chaining | [
"<p",
">",
"Creates",
"an",
"<i",
">",
"operation",
"expression<",
"/",
"i",
">",
"on",
"the",
"specified",
"target",
"object",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L780-L782 |
Abnaxos/markdown-doclet | doclet/jdk8/src/main/java/ch/raffael/mddoclet/mdtaglet/argval/PredefinedArgumentValidators.java | PredefinedArgumentValidators.anyOf | public static ArgumentValidator anyOf(String description, ArgumentValidator... argumentValidators) {
"""
# Creates a {@link ArgumentValidator} which iterates over all `argumentValidators` until the first {@link Type#VALID}
has been found.
This is of course a logical OR.
- If all are `VALID` then the result is also `VALID`.
- If at least one is `VALID`, then the entire expression is VALID.
- If all are *NOT VALID*, the result is the first invalid result, but the error message will be replaced
with `description`.
@param argumentValidators 1 or more argument validators
@param description any description
@return a AnyOf validator
"""
return new AnyOf(Arrays.asList(argumentValidators), description);
} | java | public static ArgumentValidator anyOf(String description, ArgumentValidator... argumentValidators) {
return new AnyOf(Arrays.asList(argumentValidators), description);
} | [
"public",
"static",
"ArgumentValidator",
"anyOf",
"(",
"String",
"description",
",",
"ArgumentValidator",
"...",
"argumentValidators",
")",
"{",
"return",
"new",
"AnyOf",
"(",
"Arrays",
".",
"asList",
"(",
"argumentValidators",
")",
",",
"description",
")",
";",
... | # Creates a {@link ArgumentValidator} which iterates over all `argumentValidators` until the first {@link Type#VALID}
has been found.
This is of course a logical OR.
- If all are `VALID` then the result is also `VALID`.
- If at least one is `VALID`, then the entire expression is VALID.
- If all are *NOT VALID*, the result is the first invalid result, but the error message will be replaced
with `description`.
@param argumentValidators 1 or more argument validators
@param description any description
@return a AnyOf validator | [
"#",
"Creates",
"a",
"{",
"@link",
"ArgumentValidator",
"}",
"which",
"iterates",
"over",
"all",
"argumentValidators",
"until",
"the",
"first",
"{",
"@link",
"Type#VALID",
"}",
"has",
"been",
"found",
"."
] | train | https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/mdtaglet/argval/PredefinedArgumentValidators.java#L289-L291 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java | WebSiteManagementClientImpl.validateMoveAsync | public Observable<Void> validateMoveAsync(String resourceGroupName, CsmMoveResourceEnvelope moveResourceEnvelope) {
"""
Validate whether a resource can be moved.
Validate whether a resource can be moved.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param moveResourceEnvelope Object that represents the resource to move.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful.
"""
return validateMoveWithServiceResponseAsync(resourceGroupName, moveResourceEnvelope).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> validateMoveAsync(String resourceGroupName, CsmMoveResourceEnvelope moveResourceEnvelope) {
return validateMoveWithServiceResponseAsync(resourceGroupName, moveResourceEnvelope).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"validateMoveAsync",
"(",
"String",
"resourceGroupName",
",",
"CsmMoveResourceEnvelope",
"moveResourceEnvelope",
")",
"{",
"return",
"validateMoveWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"moveResourceEnvelope",
")",
... | Validate whether a resource can be moved.
Validate whether a resource can be moved.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param moveResourceEnvelope Object that represents the resource to move.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Validate",
"whether",
"a",
"resource",
"can",
"be",
"moved",
".",
"Validate",
"whether",
"a",
"resource",
"can",
"be",
"moved",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java#L2357-L2364 |
opsgenie/opsgenieclient | sdk-swagger/src/main/java/com/ifountain/opsgenie/client/swagger/api/AlertApi.java | AlertApi.deleteAlert | public SuccessResponse deleteAlert(DeleteAlertRequest params) throws ApiException {
"""
Delete Alert
Deletes an alert using alert id, tiny id or alias
@param params.identifier Identifier of alert which could be alert id, tiny id or alert alias (required)
@param params.identifierType Type of the identifier that is provided as an in-line parameter. Possible values are 'id', 'alias' or 'tiny' (optional, default to id)
@param params.source Display name of the request source (optional)
@param params.user Display name of the request owner (optional)
@return SuccessResponse
@throws ApiException if fails to make API call
"""
String identifier = params.getIdentifier();
String identifierType = params.getIdentifierType().getValue();
String source = params.getSource();
String user = params.getUser();
Object localVarPostBody = null;
// verify the required parameter 'identifier' is set
if (identifier == null) {
throw new ApiException(400, "Missing the required parameter 'identifier' when calling deleteAlert");
}
// create path and map variables
String localVarPath = "/v2/alerts/{identifier}"
.replaceAll("\\{" + "identifier" + "\\}", apiClient.escapeString(identifier.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "identifierType", identifierType));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "source", source));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "user", user));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[]{"GenieKey"};
GenericType<SuccessResponse> localVarReturnType = new GenericType<SuccessResponse>() {
};
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | java | public SuccessResponse deleteAlert(DeleteAlertRequest params) throws ApiException {
String identifier = params.getIdentifier();
String identifierType = params.getIdentifierType().getValue();
String source = params.getSource();
String user = params.getUser();
Object localVarPostBody = null;
// verify the required parameter 'identifier' is set
if (identifier == null) {
throw new ApiException(400, "Missing the required parameter 'identifier' when calling deleteAlert");
}
// create path and map variables
String localVarPath = "/v2/alerts/{identifier}"
.replaceAll("\\{" + "identifier" + "\\}", apiClient.escapeString(identifier.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "identifierType", identifierType));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "source", source));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "user", user));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[]{"GenieKey"};
GenericType<SuccessResponse> localVarReturnType = new GenericType<SuccessResponse>() {
};
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | [
"public",
"SuccessResponse",
"deleteAlert",
"(",
"DeleteAlertRequest",
"params",
")",
"throws",
"ApiException",
"{",
"String",
"identifier",
"=",
"params",
".",
"getIdentifier",
"(",
")",
";",
"String",
"identifierType",
"=",
"params",
".",
"getIdentifierType",
"(",... | Delete Alert
Deletes an alert using alert id, tiny id or alias
@param params.identifier Identifier of alert which could be alert id, tiny id or alert alias (required)
@param params.identifierType Type of the identifier that is provided as an in-line parameter. Possible values are 'id', 'alias' or 'tiny' (optional, default to id)
@param params.source Display name of the request source (optional)
@param params.user Display name of the request owner (optional)
@return SuccessResponse
@throws ApiException if fails to make API call | [
"Delete",
"Alert",
"Deletes",
"an",
"alert",
"using",
"alert",
"id",
"tiny",
"id",
"or",
"alias"
] | train | https://github.com/opsgenie/opsgenieclient/blob/6d94efb16bbc74be189c86e9329af510ac8a048c/sdk-swagger/src/main/java/com/ifountain/opsgenie/client/swagger/api/AlertApi.java#L514-L557 |
jhy/jsoup | src/main/java/org/jsoup/select/Selector.java | Selector.selectFirst | public static Element selectFirst(String cssQuery, Element root) {
"""
Find the first element that matches the query.
@param cssQuery CSS selector
@param root root element to descend into
@return the matching element, or <b>null</b> if none.
"""
Validate.notEmpty(cssQuery);
return Collector.findFirst(QueryParser.parse(cssQuery), root);
} | java | public static Element selectFirst(String cssQuery, Element root) {
Validate.notEmpty(cssQuery);
return Collector.findFirst(QueryParser.parse(cssQuery), root);
} | [
"public",
"static",
"Element",
"selectFirst",
"(",
"String",
"cssQuery",
",",
"Element",
"root",
")",
"{",
"Validate",
".",
"notEmpty",
"(",
"cssQuery",
")",
";",
"return",
"Collector",
".",
"findFirst",
"(",
"QueryParser",
".",
"parse",
"(",
"cssQuery",
")"... | Find the first element that matches the query.
@param cssQuery CSS selector
@param root root element to descend into
@return the matching element, or <b>null</b> if none. | [
"Find",
"the",
"first",
"element",
"that",
"matches",
"the",
"query",
"."
] | train | https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/select/Selector.java#L157-L160 |
micronaut-projects/micronaut-core | inject-java/src/main/java/io/micronaut/annotation/processing/AnnotationUtils.java | AnnotationUtils.hasStereotype | protected boolean hasStereotype(Element element, Class<? extends Annotation> stereotype) {
"""
Return whether the given element is annotated with the given annotation stereotype.
@param element The element
@param stereotype The stereotype
@return True if it is
"""
return hasStereotype(element, stereotype.getName());
} | java | protected boolean hasStereotype(Element element, Class<? extends Annotation> stereotype) {
return hasStereotype(element, stereotype.getName());
} | [
"protected",
"boolean",
"hasStereotype",
"(",
"Element",
"element",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"stereotype",
")",
"{",
"return",
"hasStereotype",
"(",
"element",
",",
"stereotype",
".",
"getName",
"(",
")",
")",
";",
"}"
] | Return whether the given element is annotated with the given annotation stereotype.
@param element The element
@param stereotype The stereotype
@return True if it is | [
"Return",
"whether",
"the",
"given",
"element",
"is",
"annotated",
"with",
"the",
"given",
"annotation",
"stereotype",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject-java/src/main/java/io/micronaut/annotation/processing/AnnotationUtils.java#L140-L142 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/SecurityServletConfiguratorHelper.java | SecurityServletConfiguratorHelper.processSecurityConstraints | private void processSecurityConstraints(List<com.ibm.ws.javaee.dd.web.common.SecurityConstraint> archiveSecurityConstraints, boolean denyUncoveredHttpMethods) {
"""
Creates a list of zero or more security constraint objects that represent the
security-constraint elements in web.xml and/or web-fragment.xml files.
@param securityConstraints a list of security constraints
"""
List<SecurityConstraint> securityConstraints = new ArrayList<SecurityConstraint>();
for (com.ibm.ws.javaee.dd.web.common.SecurityConstraint archiveSecurityConstraint : archiveSecurityConstraints) {
SecurityConstraint securityConstraint = createSecurityConstraint(archiveSecurityConstraint, denyUncoveredHttpMethods);
securityConstraints.add(securityConstraint);
}
if (securityConstraintCollection == null) {
securityConstraintCollection = new SecurityConstraintCollectionImpl(securityConstraints);
} else {
securityConstraintCollection.addSecurityConstraints(securityConstraints);
}
} | java | private void processSecurityConstraints(List<com.ibm.ws.javaee.dd.web.common.SecurityConstraint> archiveSecurityConstraints, boolean denyUncoveredHttpMethods) {
List<SecurityConstraint> securityConstraints = new ArrayList<SecurityConstraint>();
for (com.ibm.ws.javaee.dd.web.common.SecurityConstraint archiveSecurityConstraint : archiveSecurityConstraints) {
SecurityConstraint securityConstraint = createSecurityConstraint(archiveSecurityConstraint, denyUncoveredHttpMethods);
securityConstraints.add(securityConstraint);
}
if (securityConstraintCollection == null) {
securityConstraintCollection = new SecurityConstraintCollectionImpl(securityConstraints);
} else {
securityConstraintCollection.addSecurityConstraints(securityConstraints);
}
} | [
"private",
"void",
"processSecurityConstraints",
"(",
"List",
"<",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"dd",
".",
"web",
".",
"common",
".",
"SecurityConstraint",
">",
"archiveSecurityConstraints",
",",
"boolean",
"denyUncoveredHttpMethods",
")",
"... | Creates a list of zero or more security constraint objects that represent the
security-constraint elements in web.xml and/or web-fragment.xml files.
@param securityConstraints a list of security constraints | [
"Creates",
"a",
"list",
"of",
"zero",
"or",
"more",
"security",
"constraint",
"objects",
"that",
"represent",
"the",
"security",
"-",
"constraint",
"elements",
"in",
"web",
".",
"xml",
"and",
"/",
"or",
"web",
"-",
"fragment",
".",
"xml",
"files",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/SecurityServletConfiguratorHelper.java#L287-L298 |
jenkinsci/jenkins | core/src/main/java/hudson/model/DependencyGraph.java | DependencyGraph.putComputationalData | public <T> void putComputationalData(Class<T> key, T value) {
"""
Adds data which is useful for the time when the dependency graph is built up.
All this data will be cleaned once the dependency graph creation has finished.
"""
this.computationalData.put(key, value);
} | java | public <T> void putComputationalData(Class<T> key, T value) {
this.computationalData.put(key, value);
} | [
"public",
"<",
"T",
">",
"void",
"putComputationalData",
"(",
"Class",
"<",
"T",
">",
"key",
",",
"T",
"value",
")",
"{",
"this",
".",
"computationalData",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Adds data which is useful for the time when the dependency graph is built up.
All this data will be cleaned once the dependency graph creation has finished. | [
"Adds",
"data",
"which",
"is",
"useful",
"for",
"the",
"time",
"when",
"the",
"dependency",
"graph",
"is",
"built",
"up",
".",
"All",
"this",
"data",
"will",
"be",
"cleaned",
"once",
"the",
"dependency",
"graph",
"creation",
"has",
"finished",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/DependencyGraph.java#L163-L165 |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java | UriUtils.encodeHost | public static String encodeHost(String host, String encoding) throws UnsupportedEncodingException {
"""
Encodes the given URI host with the given encoding.
@param host the host to be encoded
@param encoding the character encoding to encode to
@return the encoded host
@throws UnsupportedEncodingException when the given encoding parameter is not supported
"""
return HierarchicalUriComponents.encodeUriComponent(host, encoding, HierarchicalUriComponents.Type.HOST_IPV4);
} | java | public static String encodeHost(String host, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(host, encoding, HierarchicalUriComponents.Type.HOST_IPV4);
} | [
"public",
"static",
"String",
"encodeHost",
"(",
"String",
"host",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"HierarchicalUriComponents",
".",
"encodeUriComponent",
"(",
"host",
",",
"encoding",
",",
"HierarchicalUriCompone... | Encodes the given URI host with the given encoding.
@param host the host to be encoded
@param encoding the character encoding to encode to
@return the encoded host
@throws UnsupportedEncodingException when the given encoding parameter is not supported | [
"Encodes",
"the",
"given",
"URI",
"host",
"with",
"the",
"given",
"encoding",
"."
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L252-L254 |
sporniket/core | sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java | XmlStringTools.appendTextInsideTag | public static StringBuffer appendTextInsideTag(StringBuffer buffer, String text, String tag, Map<String, String> attributes) {
"""
Wrap a text inside a tag with attributes.
@param buffer
StringBuffer to fill
@param text
the text to wrap
@param tag
the tag to use
@param attributes
the attribute map
@return the buffer
"""
StringBuffer _buffer = initStringBufferIfNecessary(buffer);
Map<String, String> _attributes = (null != attributes) ? attributes : EMPTY_MAP;
return doAppendTextInsideTag(_buffer, text, tag, _attributes);
} | java | public static StringBuffer appendTextInsideTag(StringBuffer buffer, String text, String tag, Map<String, String> attributes)
{
StringBuffer _buffer = initStringBufferIfNecessary(buffer);
Map<String, String> _attributes = (null != attributes) ? attributes : EMPTY_MAP;
return doAppendTextInsideTag(_buffer, text, tag, _attributes);
} | [
"public",
"static",
"StringBuffer",
"appendTextInsideTag",
"(",
"StringBuffer",
"buffer",
",",
"String",
"text",
",",
"String",
"tag",
",",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"StringBuffer",
"_buffer",
"=",
"initStringBufferIfNecessa... | Wrap a text inside a tag with attributes.
@param buffer
StringBuffer to fill
@param text
the text to wrap
@param tag
the tag to use
@param attributes
the attribute map
@return the buffer | [
"Wrap",
"a",
"text",
"inside",
"a",
"tag",
"with",
"attributes",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java#L404-L409 |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/buffer/MutableRoaringArray.java | MutableRoaringArray.appendCopiesAfter | protected void appendCopiesAfter(PointableRoaringArray highLowContainer, short beforeStart) {
"""
Append copies of the values AFTER a specified key (may or may not be present) to end.
@param highLowContainer the other array
@param beforeStart given key is the largest key that we won't copy
"""
int startLocation = highLowContainer.getIndex(beforeStart);
if (startLocation >= 0) {
startLocation++;
} else {
startLocation = -startLocation - 1;
}
extendArray(highLowContainer.size() - startLocation);
for (int i = startLocation; i < highLowContainer.size(); ++i) {
this.keys[this.size] = highLowContainer.getKeyAtIndex(i);
this.values[this.size] = highLowContainer.getContainerAtIndex(i).clone();
this.size++;
}
} | java | protected void appendCopiesAfter(PointableRoaringArray highLowContainer, short beforeStart) {
int startLocation = highLowContainer.getIndex(beforeStart);
if (startLocation >= 0) {
startLocation++;
} else {
startLocation = -startLocation - 1;
}
extendArray(highLowContainer.size() - startLocation);
for (int i = startLocation; i < highLowContainer.size(); ++i) {
this.keys[this.size] = highLowContainer.getKeyAtIndex(i);
this.values[this.size] = highLowContainer.getContainerAtIndex(i).clone();
this.size++;
}
} | [
"protected",
"void",
"appendCopiesAfter",
"(",
"PointableRoaringArray",
"highLowContainer",
",",
"short",
"beforeStart",
")",
"{",
"int",
"startLocation",
"=",
"highLowContainer",
".",
"getIndex",
"(",
"beforeStart",
")",
";",
"if",
"(",
"startLocation",
">=",
"0",
... | Append copies of the values AFTER a specified key (may or may not be present) to end.
@param highLowContainer the other array
@param beforeStart given key is the largest key that we won't copy | [
"Append",
"copies",
"of",
"the",
"values",
"AFTER",
"a",
"specified",
"key",
"(",
"may",
"or",
"may",
"not",
"be",
"present",
")",
"to",
"end",
"."
] | train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/buffer/MutableRoaringArray.java#L143-L158 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/LocalityStats.java | LocalityStats.record | public void record(
TaskInProgress tip, String host, long inputBytes) {
"""
Asynchronous update of locality.
@param tip The task.
@param host The task tracker host.
@param inputBytes The number of bytes processed.
"""
synchronized (localityRecords) {
localityRecords.add(new Record(tip, host, inputBytes));
localityRecords.notify();
}
} | java | public void record(
TaskInProgress tip, String host, long inputBytes) {
synchronized (localityRecords) {
localityRecords.add(new Record(tip, host, inputBytes));
localityRecords.notify();
}
} | [
"public",
"void",
"record",
"(",
"TaskInProgress",
"tip",
",",
"String",
"host",
",",
"long",
"inputBytes",
")",
"{",
"synchronized",
"(",
"localityRecords",
")",
"{",
"localityRecords",
".",
"add",
"(",
"new",
"Record",
"(",
"tip",
",",
"host",
",",
"inpu... | Asynchronous update of locality.
@param tip The task.
@param host The task tracker host.
@param inputBytes The number of bytes processed. | [
"Asynchronous",
"update",
"of",
"locality",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/LocalityStats.java#L105-L111 |
javagl/CommonUI | src/main/java/de/javagl/common/ui/text/StringUtils.java | StringUtils.indexOf | static int indexOf(String source, String target,
int startIndex, boolean ignoreCase) {
"""
Returns the index of the first appearance of the given target in
the given source, starting at the given index. Returns -1 if the
target string is not found.
@param source The source string
@param target The target string
@param startIndex The start index
@param ignoreCase Whether the case should be ignored
@return The index
"""
if (ignoreCase)
{
return indexOf(source, target, startIndex, IGNORING_CASE);
}
return indexOf(source, target, startIndex,
(c0, c1) -> Integer.compare(c0, c1));
} | java | static int indexOf(String source, String target,
int startIndex, boolean ignoreCase)
{
if (ignoreCase)
{
return indexOf(source, target, startIndex, IGNORING_CASE);
}
return indexOf(source, target, startIndex,
(c0, c1) -> Integer.compare(c0, c1));
} | [
"static",
"int",
"indexOf",
"(",
"String",
"source",
",",
"String",
"target",
",",
"int",
"startIndex",
",",
"boolean",
"ignoreCase",
")",
"{",
"if",
"(",
"ignoreCase",
")",
"{",
"return",
"indexOf",
"(",
"source",
",",
"target",
",",
"startIndex",
",",
... | Returns the index of the first appearance of the given target in
the given source, starting at the given index. Returns -1 if the
target string is not found.
@param source The source string
@param target The target string
@param startIndex The start index
@param ignoreCase Whether the case should be ignored
@return The index | [
"Returns",
"the",
"index",
"of",
"the",
"first",
"appearance",
"of",
"the",
"given",
"target",
"in",
"the",
"given",
"source",
"starting",
"at",
"the",
"given",
"index",
".",
"Returns",
"-",
"1",
"if",
"the",
"target",
"string",
"is",
"not",
"found",
"."... | train | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/text/StringUtils.java#L66-L75 |
kubernetes-client/java | kubernetes/src/main/java/io/kubernetes/client/ApiClient.java | ApiClient.buildRequestBodyFormEncoding | public RequestBody buildRequestBodyFormEncoding(Map<String, Object> formParams) {
"""
Build a form-encoding request body with the given form parameters.
@param formParams Form parameters in the form of Map
@return RequestBody
"""
FormEncodingBuilder formBuilder = new FormEncodingBuilder();
for (Entry<String, Object> param : formParams.entrySet()) {
formBuilder.add(param.getKey(), parameterToString(param.getValue()));
}
return formBuilder.build();
} | java | public RequestBody buildRequestBodyFormEncoding(Map<String, Object> formParams) {
FormEncodingBuilder formBuilder = new FormEncodingBuilder();
for (Entry<String, Object> param : formParams.entrySet()) {
formBuilder.add(param.getKey(), parameterToString(param.getValue()));
}
return formBuilder.build();
} | [
"public",
"RequestBody",
"buildRequestBodyFormEncoding",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"formParams",
")",
"{",
"FormEncodingBuilder",
"formBuilder",
"=",
"new",
"FormEncodingBuilder",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"Obje... | Build a form-encoding request body with the given form parameters.
@param formParams Form parameters in the form of Map
@return RequestBody | [
"Build",
"a",
"form",
"-",
"encoding",
"request",
"body",
"with",
"the",
"given",
"form",
"parameters",
"."
] | train | https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/kubernetes/src/main/java/io/kubernetes/client/ApiClient.java#L1057-L1063 |
mbenson/therian | core/src/main/java/therian/util/Types.java | Types.getSimpleName | public static String getSimpleName(Class<?> type, String separator) {
"""
Get the simple name of a possibly nested {@link Class}.
@param type
@param separator
@return String
"""
final StringBuilder buf = new StringBuilder();
Class<?> c = type;
while (c != null) {
if (buf.length() > 0 && separator != null) {
buf.insert(0, separator);
}
buf.insert(0, c.getSimpleName());
c = c.getEnclosingClass();
}
return buf.toString();
} | java | public static String getSimpleName(Class<?> type, String separator) {
final StringBuilder buf = new StringBuilder();
Class<?> c = type;
while (c != null) {
if (buf.length() > 0 && separator != null) {
buf.insert(0, separator);
}
buf.insert(0, c.getSimpleName());
c = c.getEnclosingClass();
}
return buf.toString();
} | [
"public",
"static",
"String",
"getSimpleName",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"separator",
")",
"{",
"final",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Class",
"<",
"?",
">",
"c",
"=",
"type",
";",
"while... | Get the simple name of a possibly nested {@link Class}.
@param type
@param separator
@return String | [
"Get",
"the",
"simple",
"name",
"of",
"a",
"possibly",
"nested",
"{",
"@link",
"Class",
"}",
"."
] | train | https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/util/Types.java#L52-L63 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/AvailabilitySetsInner.java | AvailabilitySetsInner.getByResourceGroup | public AvailabilitySetInner getByResourceGroup(String resourceGroupName, String availabilitySetName) {
"""
Retrieves information about an availability set.
@param resourceGroupName The name of the resource group.
@param availabilitySetName The name of the availability set.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AvailabilitySetInner object if successful.
"""
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, availabilitySetName).toBlocking().single().body();
} | java | public AvailabilitySetInner getByResourceGroup(String resourceGroupName, String availabilitySetName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, availabilitySetName).toBlocking().single().body();
} | [
"public",
"AvailabilitySetInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"availabilitySetName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"availabilitySetName",
")",
".",
"toBlocking",
"(... | Retrieves information about an availability set.
@param resourceGroupName The name of the resource group.
@param availabilitySetName The name of the availability set.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AvailabilitySetInner object if successful. | [
"Retrieves",
"information",
"about",
"an",
"availability",
"set",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/AvailabilitySetsInner.java#L276-L278 |
steveash/jopenfst | src/main/java/com/github/steveash/jopenfst/operations/Determinize.java | Determinize.compute | public MutableFst compute(final Fst fst) {
"""
Determinizes an FSA or FST. For this algorithm, epsilon transitions are treated as regular symbols.
@param fst the fst to determinize
@return the determinized fst
"""
fst.throwIfInvalid();
// init for this run of compute
this.semiring = fst.getSemiring();
this.gallicSemiring = new GallicSemiring(this.semiring, this.gallicMode);
this.unionSemiring = makeUnionRing(semiring, gallicSemiring, mode);
this.inputFst = fst;
this.outputFst = MutableFst.emptyWithCopyOfSymbols(fst);
this.outputStateIdToTuple = HashBiMap.create();
// workQueue holds the pending work of determinizing the input fst
Deque<DetStateTuple> workQueue = new LinkedList<>();
// finalQueue holds the pending work of expanding out the final paths (handled by the FactorFst in the
// open fst implementation)
Deque<DetElement> finalQueue = new LinkedList<>();
// start the algorithm by starting with the input start state
MutableState initialOutState = outputFst.newStartState();
DetElement initialElement = new DetElement(fst.getStartState().getId(),
GallicWeight.createEmptyLabels(semiring.one()));
DetStateTuple initialTuple = new DetStateTuple(initialElement);
workQueue.addLast(initialTuple);
this.outputStateIdToTuple.put(initialOutState.getId(), initialTuple);
// process all of the input states via the work queue
while (!workQueue.isEmpty()) {
DetStateTuple entry = workQueue.removeFirst();
MutableState outStateForTuple = getOutputStateForStateTuple(entry);
Collection<DetArcWork> arcWorks = groupByInputLabel(entry);
arcWorks.forEach(this::normalizeArcWork);
for (DetArcWork arcWork : arcWorks) {
DetStateTuple targetTuple = new DetStateTuple(arcWork.pendingElements);
if (!this.outputStateIdToTuple.inverse().containsKey(targetTuple)) {
// we've never seen this tuple before so new state + enqueue the work
MutableState newOutState = outputFst.newState();
this.outputStateIdToTuple.put(newOutState.getId(), targetTuple);
newOutState.setFinalWeight(computeFinalWeight(newOutState.getId(), targetTuple, finalQueue));
workQueue.addLast(targetTuple);
}
MutableState targetOutState = getOutputStateForStateTuple(targetTuple);
// the computed divisor is a 'legal' arc meaning that it only has zero or one substring; though there
// might be multiple entries if we're in non_functional mode
UnionWeight<GallicWeight> unionWeight = arcWork.computedDivisor;
for (GallicWeight gallicWeight : unionWeight.getWeights()) {
Preconditions.checkState(gallicSemiring.isNotZero(gallicWeight), "gallic weight zero computed from group by",
gallicWeight);
int oLabel = this.outputEps;
if (!gallicWeight.getLabels().isEmpty()) {
Preconditions.checkState(gallicWeight.getLabels().size() == 1,
"cant gave gallic arc weight with more than a single symbol", gallicWeight);
oLabel = gallicWeight.getLabels().get(0);
}
outputFst.addArc(outStateForTuple, arcWork.inputLabel, oLabel, targetOutState, gallicWeight.getWeight());
}
}
}
// we might've deferred some final state work that needs to be expanded
expandDeferredFinalStates(finalQueue);
return outputFst;
} | java | public MutableFst compute(final Fst fst) {
fst.throwIfInvalid();
// init for this run of compute
this.semiring = fst.getSemiring();
this.gallicSemiring = new GallicSemiring(this.semiring, this.gallicMode);
this.unionSemiring = makeUnionRing(semiring, gallicSemiring, mode);
this.inputFst = fst;
this.outputFst = MutableFst.emptyWithCopyOfSymbols(fst);
this.outputStateIdToTuple = HashBiMap.create();
// workQueue holds the pending work of determinizing the input fst
Deque<DetStateTuple> workQueue = new LinkedList<>();
// finalQueue holds the pending work of expanding out the final paths (handled by the FactorFst in the
// open fst implementation)
Deque<DetElement> finalQueue = new LinkedList<>();
// start the algorithm by starting with the input start state
MutableState initialOutState = outputFst.newStartState();
DetElement initialElement = new DetElement(fst.getStartState().getId(),
GallicWeight.createEmptyLabels(semiring.one()));
DetStateTuple initialTuple = new DetStateTuple(initialElement);
workQueue.addLast(initialTuple);
this.outputStateIdToTuple.put(initialOutState.getId(), initialTuple);
// process all of the input states via the work queue
while (!workQueue.isEmpty()) {
DetStateTuple entry = workQueue.removeFirst();
MutableState outStateForTuple = getOutputStateForStateTuple(entry);
Collection<DetArcWork> arcWorks = groupByInputLabel(entry);
arcWorks.forEach(this::normalizeArcWork);
for (DetArcWork arcWork : arcWorks) {
DetStateTuple targetTuple = new DetStateTuple(arcWork.pendingElements);
if (!this.outputStateIdToTuple.inverse().containsKey(targetTuple)) {
// we've never seen this tuple before so new state + enqueue the work
MutableState newOutState = outputFst.newState();
this.outputStateIdToTuple.put(newOutState.getId(), targetTuple);
newOutState.setFinalWeight(computeFinalWeight(newOutState.getId(), targetTuple, finalQueue));
workQueue.addLast(targetTuple);
}
MutableState targetOutState = getOutputStateForStateTuple(targetTuple);
// the computed divisor is a 'legal' arc meaning that it only has zero or one substring; though there
// might be multiple entries if we're in non_functional mode
UnionWeight<GallicWeight> unionWeight = arcWork.computedDivisor;
for (GallicWeight gallicWeight : unionWeight.getWeights()) {
Preconditions.checkState(gallicSemiring.isNotZero(gallicWeight), "gallic weight zero computed from group by",
gallicWeight);
int oLabel = this.outputEps;
if (!gallicWeight.getLabels().isEmpty()) {
Preconditions.checkState(gallicWeight.getLabels().size() == 1,
"cant gave gallic arc weight with more than a single symbol", gallicWeight);
oLabel = gallicWeight.getLabels().get(0);
}
outputFst.addArc(outStateForTuple, arcWork.inputLabel, oLabel, targetOutState, gallicWeight.getWeight());
}
}
}
// we might've deferred some final state work that needs to be expanded
expandDeferredFinalStates(finalQueue);
return outputFst;
} | [
"public",
"MutableFst",
"compute",
"(",
"final",
"Fst",
"fst",
")",
"{",
"fst",
".",
"throwIfInvalid",
"(",
")",
";",
"// init for this run of compute",
"this",
".",
"semiring",
"=",
"fst",
".",
"getSemiring",
"(",
")",
";",
"this",
".",
"gallicSemiring",
"=... | Determinizes an FSA or FST. For this algorithm, epsilon transitions are treated as regular symbols.
@param fst the fst to determinize
@return the determinized fst | [
"Determinizes",
"an",
"FSA",
"or",
"FST",
".",
"For",
"this",
"algorithm",
"epsilon",
"transitions",
"are",
"treated",
"as",
"regular",
"symbols",
"."
] | train | https://github.com/steveash/jopenfst/blob/4c675203015c1cfad2072556cb532b6edc73261d/src/main/java/com/github/steveash/jopenfst/operations/Determinize.java#L126-L189 |
antopen/alipay-sdk-java | src/main/java/com/alipay/api/internal/util/XmlUtils.java | XmlUtils.appendElement | public static Element appendElement(Element parent, String tagName) {
"""
Appends the child element to the parent element.
@param parent the parent element
@param tagName the child element name
@return the child element added to the parent element
"""
Element child = parent.getOwnerDocument().createElement(tagName);
parent.appendChild(child);
return child;
} | java | public static Element appendElement(Element parent, String tagName) {
Element child = parent.getOwnerDocument().createElement(tagName);
parent.appendChild(child);
return child;
} | [
"public",
"static",
"Element",
"appendElement",
"(",
"Element",
"parent",
",",
"String",
"tagName",
")",
"{",
"Element",
"child",
"=",
"parent",
".",
"getOwnerDocument",
"(",
")",
".",
"createElement",
"(",
"tagName",
")",
";",
"parent",
".",
"appendChild",
... | Appends the child element to the parent element.
@param parent the parent element
@param tagName the child element name
@return the child element added to the parent element | [
"Appends",
"the",
"child",
"element",
"to",
"the",
"parent",
"element",
"."
] | train | https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/XmlUtils.java#L349-L353 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java | AppServicePlansInner.getVnetFromServerFarmAsync | public Observable<VnetInfoInner> getVnetFromServerFarmAsync(String resourceGroupName, String name, String vnetName) {
"""
Get a Virtual Network associated with an App Service plan.
Get a Virtual Network associated with an App Service plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@param vnetName Name of the Virtual Network.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VnetInfoInner object
"""
return getVnetFromServerFarmWithServiceResponseAsync(resourceGroupName, name, vnetName).map(new Func1<ServiceResponse<VnetInfoInner>, VnetInfoInner>() {
@Override
public VnetInfoInner call(ServiceResponse<VnetInfoInner> response) {
return response.body();
}
});
} | java | public Observable<VnetInfoInner> getVnetFromServerFarmAsync(String resourceGroupName, String name, String vnetName) {
return getVnetFromServerFarmWithServiceResponseAsync(resourceGroupName, name, vnetName).map(new Func1<ServiceResponse<VnetInfoInner>, VnetInfoInner>() {
@Override
public VnetInfoInner call(ServiceResponse<VnetInfoInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VnetInfoInner",
">",
"getVnetFromServerFarmAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"String",
"vnetName",
")",
"{",
"return",
"getVnetFromServerFarmWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name... | Get a Virtual Network associated with an App Service plan.
Get a Virtual Network associated with an App Service plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@param vnetName Name of the Virtual Network.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VnetInfoInner object | [
"Get",
"a",
"Virtual",
"Network",
"associated",
"with",
"an",
"App",
"Service",
"plan",
".",
"Get",
"a",
"Virtual",
"Network",
"associated",
"with",
"an",
"App",
"Service",
"plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L3104-L3111 |
optimaize/command4j | src/main/java/com/optimaize/command4j/ext/extensions/timeout/configurabletimeout/Util.java | Util.newExecutor | @NotNull
static ExecutorService newExecutor() {
"""
Creates an executor service with one thread that is removed automatically after 10 second idle time.
The pool is therefore garbage collected and shutdown automatically.
<p>This executor service can be used for situations, where a task should be executed immediately
in a separate thread and the pool is not kept around.</p>
impl notes: eike couldn't find a good place to put this class. thus for now it lives just here.
maybe in the future the same code will be used in other places too ... then it may be moved.
"""
ThreadPoolExecutor tpe = new ThreadPoolExecutor(0, 1, 10, TimeUnit.SECONDS, new SynchronousQueue<Runnable>());
tpe.allowCoreThreadTimeOut(true);
return tpe;
} | java | @NotNull
static ExecutorService newExecutor() {
ThreadPoolExecutor tpe = new ThreadPoolExecutor(0, 1, 10, TimeUnit.SECONDS, new SynchronousQueue<Runnable>());
tpe.allowCoreThreadTimeOut(true);
return tpe;
} | [
"@",
"NotNull",
"static",
"ExecutorService",
"newExecutor",
"(",
")",
"{",
"ThreadPoolExecutor",
"tpe",
"=",
"new",
"ThreadPoolExecutor",
"(",
"0",
",",
"1",
",",
"10",
",",
"TimeUnit",
".",
"SECONDS",
",",
"new",
"SynchronousQueue",
"<",
"Runnable",
">",
"(... | Creates an executor service with one thread that is removed automatically after 10 second idle time.
The pool is therefore garbage collected and shutdown automatically.
<p>This executor service can be used for situations, where a task should be executed immediately
in a separate thread and the pool is not kept around.</p>
impl notes: eike couldn't find a good place to put this class. thus for now it lives just here.
maybe in the future the same code will be used in other places too ... then it may be moved. | [
"Creates",
"an",
"executor",
"service",
"with",
"one",
"thread",
"that",
"is",
"removed",
"automatically",
"after",
"10",
"second",
"idle",
"time",
".",
"The",
"pool",
"is",
"therefore",
"garbage",
"collected",
"and",
"shutdown",
"automatically",
"."
] | train | https://github.com/optimaize/command4j/blob/6d550759a4593c7941a1e0d760b407fa88833d71/src/main/java/com/optimaize/command4j/ext/extensions/timeout/configurabletimeout/Util.java#L25-L30 |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.parseDigestHeader | protected static Collection<String> parseDigestHeader(final String digest) throws UnsupportedAlgorithmException {
"""
Parse the RFC-3230 Digest response header value. Look for a sha1 checksum and return it as a urn, if missing or
malformed an empty string is returned.
@param digest The Digest header value
@return the sha1 checksum value
@throws UnsupportedAlgorithmException if an unsupported digest is used
"""
try {
final Map<String, String> digestPairs = RFC3230_SPLITTER.split(nullToEmpty(digest));
final boolean allSupportedAlgorithms = digestPairs.keySet().stream().allMatch(
ContentDigest.DIGEST_ALGORITHM::isSupportedAlgorithm);
// If you have one or more digests that are all valid or no digests.
if (digestPairs.isEmpty() || allSupportedAlgorithms) {
return digestPairs.entrySet().stream()
.filter(entry -> ContentDigest.DIGEST_ALGORITHM.isSupportedAlgorithm(entry.getKey()))
.map(entry -> ContentDigest.asURI(entry.getKey(), entry.getValue()).toString())
.collect(Collectors.toSet());
} else {
throw new UnsupportedAlgorithmException(String.format("Unsupported Digest Algorithim: %1$s", digest));
}
} catch (final RuntimeException e) {
if (e instanceof IllegalArgumentException) {
throw new ClientErrorException("Invalid Digest header: " + digest + "\n", BAD_REQUEST);
}
throw e;
}
} | java | protected static Collection<String> parseDigestHeader(final String digest) throws UnsupportedAlgorithmException {
try {
final Map<String, String> digestPairs = RFC3230_SPLITTER.split(nullToEmpty(digest));
final boolean allSupportedAlgorithms = digestPairs.keySet().stream().allMatch(
ContentDigest.DIGEST_ALGORITHM::isSupportedAlgorithm);
// If you have one or more digests that are all valid or no digests.
if (digestPairs.isEmpty() || allSupportedAlgorithms) {
return digestPairs.entrySet().stream()
.filter(entry -> ContentDigest.DIGEST_ALGORITHM.isSupportedAlgorithm(entry.getKey()))
.map(entry -> ContentDigest.asURI(entry.getKey(), entry.getValue()).toString())
.collect(Collectors.toSet());
} else {
throw new UnsupportedAlgorithmException(String.format("Unsupported Digest Algorithim: %1$s", digest));
}
} catch (final RuntimeException e) {
if (e instanceof IllegalArgumentException) {
throw new ClientErrorException("Invalid Digest header: " + digest + "\n", BAD_REQUEST);
}
throw e;
}
} | [
"protected",
"static",
"Collection",
"<",
"String",
">",
"parseDigestHeader",
"(",
"final",
"String",
"digest",
")",
"throws",
"UnsupportedAlgorithmException",
"{",
"try",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"digestPairs",
"=",
"RFC3230_SPLITTE... | Parse the RFC-3230 Digest response header value. Look for a sha1 checksum and return it as a urn, if missing or
malformed an empty string is returned.
@param digest The Digest header value
@return the sha1 checksum value
@throws UnsupportedAlgorithmException if an unsupported digest is used | [
"Parse",
"the",
"RFC",
"-",
"3230",
"Digest",
"response",
"header",
"value",
".",
"Look",
"for",
"a",
"sha1",
"checksum",
"and",
"return",
"it",
"as",
"a",
"urn",
"if",
"missing",
"or",
"malformed",
"an",
"empty",
"string",
"is",
"returned",
"."
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L1156-L1177 |
apereo/cas | support/cas-server-support-service-registry-stream/src/main/java/org/apereo/cas/services/publisher/BaseCasRegisteredServiceStreamPublisher.java | BaseCasRegisteredServiceStreamPublisher.publishInternal | protected void publishInternal(final RegisteredService service, final ApplicationEvent event) {
"""
Publish internal.
@param service the service
@param event the event
"""
if (event instanceof CasRegisteredServiceDeletedEvent) {
handleCasRegisteredServiceDeletedEvent(service, event);
return;
}
if (event instanceof CasRegisteredServiceSavedEvent || event instanceof CasRegisteredServiceLoadedEvent) {
handleCasRegisteredServiceUpdateEvents(service, event);
return;
}
LOGGER.warn("Unsupported event [{}} for service replication", event);
} | java | protected void publishInternal(final RegisteredService service, final ApplicationEvent event) {
if (event instanceof CasRegisteredServiceDeletedEvent) {
handleCasRegisteredServiceDeletedEvent(service, event);
return;
}
if (event instanceof CasRegisteredServiceSavedEvent || event instanceof CasRegisteredServiceLoadedEvent) {
handleCasRegisteredServiceUpdateEvents(service, event);
return;
}
LOGGER.warn("Unsupported event [{}} for service replication", event);
} | [
"protected",
"void",
"publishInternal",
"(",
"final",
"RegisteredService",
"service",
",",
"final",
"ApplicationEvent",
"event",
")",
"{",
"if",
"(",
"event",
"instanceof",
"CasRegisteredServiceDeletedEvent",
")",
"{",
"handleCasRegisteredServiceDeletedEvent",
"(",
"servi... | Publish internal.
@param service the service
@param event the event | [
"Publish",
"internal",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-service-registry-stream/src/main/java/org/apereo/cas/services/publisher/BaseCasRegisteredServiceStreamPublisher.java#L44-L55 |
google/closure-compiler | src/com/google/javascript/jscomp/AstFactory.java | AstFactory.createSingleConstNameDeclaration | Node createSingleConstNameDeclaration(String variableName, Node value) {
"""
Creates a new `const` declaration statement for a single variable name.
<p>Takes the type for the variable name from the value node.
<p>e.g. `const variableName = value;`
"""
return IR.constNode(createName(variableName, value.getJSType()), value);
} | java | Node createSingleConstNameDeclaration(String variableName, Node value) {
return IR.constNode(createName(variableName, value.getJSType()), value);
} | [
"Node",
"createSingleConstNameDeclaration",
"(",
"String",
"variableName",
",",
"Node",
"value",
")",
"{",
"return",
"IR",
".",
"constNode",
"(",
"createName",
"(",
"variableName",
",",
"value",
".",
"getJSType",
"(",
")",
")",
",",
"value",
")",
";",
"}"
] | Creates a new `const` declaration statement for a single variable name.
<p>Takes the type for the variable name from the value node.
<p>e.g. `const variableName = value;` | [
"Creates",
"a",
"new",
"const",
"declaration",
"statement",
"for",
"a",
"single",
"variable",
"name",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AstFactory.java#L334-L336 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java | Hierarchy.findXField | public static XField findXField(String className, String fieldName, String fieldSig, boolean isStatic) {
"""
Look up a field with given name and signature in given class, returning
it as an {@link XField XField} object. If a field can't be found in the
immediate class, its superclass is search, and so forth.
@param className
name of the class through which the field is referenced
@param fieldName
name of the field
@param fieldSig
signature of the field
@param isStatic
true if field is static, false otherwise
@return an XField object representing the field, or null if no such field
could be found
"""
return XFactory.createXField(className, fieldName, fieldSig, isStatic);
} | java | public static XField findXField(String className, String fieldName, String fieldSig, boolean isStatic)
{
return XFactory.createXField(className, fieldName, fieldSig, isStatic);
} | [
"public",
"static",
"XField",
"findXField",
"(",
"String",
"className",
",",
"String",
"fieldName",
",",
"String",
"fieldSig",
",",
"boolean",
"isStatic",
")",
"{",
"return",
"XFactory",
".",
"createXField",
"(",
"className",
",",
"fieldName",
",",
"fieldSig",
... | Look up a field with given name and signature in given class, returning
it as an {@link XField XField} object. If a field can't be found in the
immediate class, its superclass is search, and so forth.
@param className
name of the class through which the field is referenced
@param fieldName
name of the field
@param fieldSig
signature of the field
@param isStatic
true if field is static, false otherwise
@return an XField object representing the field, or null if no such field
could be found | [
"Look",
"up",
"a",
"field",
"with",
"given",
"name",
"and",
"signature",
"in",
"given",
"class",
"returning",
"it",
"as",
"an",
"{",
"@link",
"XField",
"XField",
"}",
"object",
".",
"If",
"a",
"field",
"can",
"t",
"be",
"found",
"in",
"the",
"immediate... | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java#L923-L927 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/auth/AbstractAuthenticationStrategy.java | AbstractAuthenticationStrategy.resolveUser | private User resolveUser(RequestContext requestContext, User[] users) {
"""
Determines a common <code>User</code> corresponding to the given array of users. If all users are <code>null</code>, returns <code>null</code>.
If the users do not share the same identifier, an <code>SmvcRuntimeException</code> is thrown.
@param requestContext Request context
@param users The list of users to validate
@return The common <code>User</code> corresponding to the given array of users, or <code>null</code> if all given users are <code>null</code>
@throws SmvcRuntimeException If all given users do not share the same identifier
"""
User resolvedUser = null;
for (User user : users) {
if (user != null && resolvedUser != null && !user.getId().equals(resolvedUser.getId())) {
Messages messages = Messages.getInstance();
Locale locale = requestContext.getRequest().getLocale();
throw new SmvcRuntimeException(EdelfoiStatusCode.LOGIN_MULTIPLE_ACCOUNTS, messages.getText(locale, "exception.1023.loginMultipleAccounts"));
}
else {
resolvedUser = user == null ? resolvedUser : user;
}
}
return resolvedUser;
} | java | private User resolveUser(RequestContext requestContext, User[] users) {
User resolvedUser = null;
for (User user : users) {
if (user != null && resolvedUser != null && !user.getId().equals(resolvedUser.getId())) {
Messages messages = Messages.getInstance();
Locale locale = requestContext.getRequest().getLocale();
throw new SmvcRuntimeException(EdelfoiStatusCode.LOGIN_MULTIPLE_ACCOUNTS, messages.getText(locale, "exception.1023.loginMultipleAccounts"));
}
else {
resolvedUser = user == null ? resolvedUser : user;
}
}
return resolvedUser;
} | [
"private",
"User",
"resolveUser",
"(",
"RequestContext",
"requestContext",
",",
"User",
"[",
"]",
"users",
")",
"{",
"User",
"resolvedUser",
"=",
"null",
";",
"for",
"(",
"User",
"user",
":",
"users",
")",
"{",
"if",
"(",
"user",
"!=",
"null",
"&&",
"r... | Determines a common <code>User</code> corresponding to the given array of users. If all users are <code>null</code>, returns <code>null</code>.
If the users do not share the same identifier, an <code>SmvcRuntimeException</code> is thrown.
@param requestContext Request context
@param users The list of users to validate
@return The common <code>User</code> corresponding to the given array of users, or <code>null</code> if all given users are <code>null</code>
@throws SmvcRuntimeException If all given users do not share the same identifier | [
"Determines",
"a",
"common",
"<code",
">",
"User<",
"/",
"code",
">",
"corresponding",
"to",
"the",
"given",
"array",
"of",
"users",
".",
"If",
"all",
"users",
"are",
"<code",
">",
"null<",
"/",
"code",
">",
"returns",
"<code",
">",
"null<",
"/",
"code... | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/auth/AbstractAuthenticationStrategy.java#L170-L183 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/VisitUrl.java | VisitUrl.getVisitUrl | public static MozuUrl getVisitUrl(String responseFields, String visitId) {
"""
Get Resource Url for GetVisit
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param visitId Unique identifier of the customer visit to update.
@return String Resource Url
"""
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/visits/{visitId}?responseFields={responseFields}");
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("visitId", visitId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getVisitUrl(String responseFields, String visitId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/visits/{visitId}?responseFields={responseFields}");
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("visitId", visitId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getVisitUrl",
"(",
"String",
"responseFields",
",",
"String",
"visitId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/customer/visits/{visitId}?responseFields={responseFields}\"",
")",
";",
"formatt... | Get Resource Url for GetVisit
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param visitId Unique identifier of the customer visit to update.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetVisit"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/VisitUrl.java#L42-L48 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/ogc/OGCPolygon.java | OGCPolygon.exteriorRing | public OGCLineString exteriorRing() {
"""
Returns the exterior ring of this Polygon.
@return OGCLinearRing instance.
"""
if (polygon.isEmpty())
return new OGCLinearRing((Polygon) polygon.createInstance(), 0,
esriSR, true);
return new OGCLinearRing(polygon, 0, esriSR, true);
} | java | public OGCLineString exteriorRing() {
if (polygon.isEmpty())
return new OGCLinearRing((Polygon) polygon.createInstance(), 0,
esriSR, true);
return new OGCLinearRing(polygon, 0, esriSR, true);
} | [
"public",
"OGCLineString",
"exteriorRing",
"(",
")",
"{",
"if",
"(",
"polygon",
".",
"isEmpty",
"(",
")",
")",
"return",
"new",
"OGCLinearRing",
"(",
"(",
"Polygon",
")",
"polygon",
".",
"createInstance",
"(",
")",
",",
"0",
",",
"esriSR",
",",
"true",
... | Returns the exterior ring of this Polygon.
@return OGCLinearRing instance. | [
"Returns",
"the",
"exterior",
"ring",
"of",
"this",
"Polygon",
"."
] | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/ogc/OGCPolygon.java#L81-L86 |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java | Graph.fromTupleDataSet | public static <K, VV, EV> Graph<K, VV, EV> fromTupleDataSet(DataSet<Tuple2<K, VV>> vertices,
DataSet<Tuple3<K, K, EV>> edges, ExecutionEnvironment context) {
"""
Creates a graph from a DataSet of Tuple2 objects for vertices and
Tuple3 objects for edges.
<p>The first field of the Tuple2 vertex object will become the vertex ID
and the second field will become the vertex value.
The first field of the Tuple3 object for edges will become the source ID,
the second field will become the target ID, and the third field will become
the edge value.
@param vertices a DataSet of Tuple2 representing the vertices.
@param edges a DataSet of Tuple3 representing the edges.
@param context the flink execution environment.
@return the newly created graph.
"""
DataSet<Vertex<K, VV>> vertexDataSet = vertices
.map(new Tuple2ToVertexMap<>())
.name("Type conversion");
DataSet<Edge<K, EV>> edgeDataSet = edges
.map(new Tuple3ToEdgeMap<>())
.name("Type conversion");
return fromDataSet(vertexDataSet, edgeDataSet, context);
} | java | public static <K, VV, EV> Graph<K, VV, EV> fromTupleDataSet(DataSet<Tuple2<K, VV>> vertices,
DataSet<Tuple3<K, K, EV>> edges, ExecutionEnvironment context) {
DataSet<Vertex<K, VV>> vertexDataSet = vertices
.map(new Tuple2ToVertexMap<>())
.name("Type conversion");
DataSet<Edge<K, EV>> edgeDataSet = edges
.map(new Tuple3ToEdgeMap<>())
.name("Type conversion");
return fromDataSet(vertexDataSet, edgeDataSet, context);
} | [
"public",
"static",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"fromTupleDataSet",
"(",
"DataSet",
"<",
"Tuple2",
"<",
"K",
",",
"VV",
">",
">",
"vertices",
",",
"DataSet",
"<",
"Tuple3",
"<",
"K",
",",
"... | Creates a graph from a DataSet of Tuple2 objects for vertices and
Tuple3 objects for edges.
<p>The first field of the Tuple2 vertex object will become the vertex ID
and the second field will become the vertex value.
The first field of the Tuple3 object for edges will become the source ID,
the second field will become the target ID, and the third field will become
the edge value.
@param vertices a DataSet of Tuple2 representing the vertices.
@param edges a DataSet of Tuple3 representing the edges.
@param context the flink execution environment.
@return the newly created graph. | [
"Creates",
"a",
"graph",
"from",
"a",
"DataSet",
"of",
"Tuple2",
"objects",
"for",
"vertices",
"and",
"Tuple3",
"objects",
"for",
"edges",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L268-L280 |
dadoonet/fscrawler | framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java | FsCrawlerUtil.readJsonFile | public static String readJsonFile(Path dir, Path config, String version, String filename) throws IOException {
"""
Reads a Json file from dir/version/filename.json file.
If not found, read from ~/.fscrawler/_default/version/filename.json
@param dir Directory which might contain filename files per major version (job dir)
@param config Root dir where we can find the configuration (default to ~/.fscrawler)
@param version Elasticsearch major version number (only major digit is kept so for 2.3.4 it will be 2)
@param filename The expected filename (will be expanded to filename.json)
@return the mapping
@throws IOException If the mapping can not be read
"""
try {
return readJsonVersionedFile(dir, version, filename);
} catch (NoSuchFileException e) {
// We fall back to default mappings in config dir
return readDefaultJsonVersionedFile(config, version, filename);
}
} | java | public static String readJsonFile(Path dir, Path config, String version, String filename) throws IOException {
try {
return readJsonVersionedFile(dir, version, filename);
} catch (NoSuchFileException e) {
// We fall back to default mappings in config dir
return readDefaultJsonVersionedFile(config, version, filename);
}
} | [
"public",
"static",
"String",
"readJsonFile",
"(",
"Path",
"dir",
",",
"Path",
"config",
",",
"String",
"version",
",",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"readJsonVersionedFile",
"(",
"dir",
",",
"version",
",",
"... | Reads a Json file from dir/version/filename.json file.
If not found, read from ~/.fscrawler/_default/version/filename.json
@param dir Directory which might contain filename files per major version (job dir)
@param config Root dir where we can find the configuration (default to ~/.fscrawler)
@param version Elasticsearch major version number (only major digit is kept so for 2.3.4 it will be 2)
@param filename The expected filename (will be expanded to filename.json)
@return the mapping
@throws IOException If the mapping can not be read | [
"Reads",
"a",
"Json",
"file",
"from",
"dir",
"/",
"version",
"/",
"filename",
".",
"json",
"file",
".",
"If",
"not",
"found",
"read",
"from",
"~",
"/",
".",
"fscrawler",
"/",
"_default",
"/",
"version",
"/",
"filename",
".",
"json"
] | train | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L116-L123 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/batikutil/CloneInlineImages.java | CloneInlineImages.inlineExternal | protected Node inlineExternal(Document doc, ParsedURL urldata, Node eold) {
"""
Inline an external file (usually from temp).
@param doc Document (element factory)
@param urldata URL
@param eold Existing node
@return Replacement node, or {@code null}
"""
File in = new File(urldata.getPath());
if(!in.exists()) {
LoggingUtil.warning("Referencing non-existant file: " + urldata.toString());
return null;
}
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
os.write(SVGSyntax.DATA_PROTOCOL_PNG_PREFIX.getBytes());
Base64EncoderStream encoder = new Base64EncoderStream(os);
FileInputStream instream = new FileInputStream(in);
byte[] buf = new byte[4096];
while(true) {
int read = instream.read(buf, 0, buf.length);
if(read <= 0) {
break;
}
encoder.write(buf, 0, read);
}
instream.close();
encoder.close();
}
catch(IOException e) {
LoggingUtil.exception("Exception serializing image to png", e);
return null;
}
Element i = (Element) super.cloneNode(doc, eold);
i.setAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_ATTRIBUTE, os.toString().replaceAll("\\s*[\\r\\n]+\\s*", ""));
return i;
} | java | protected Node inlineExternal(Document doc, ParsedURL urldata, Node eold) {
File in = new File(urldata.getPath());
if(!in.exists()) {
LoggingUtil.warning("Referencing non-existant file: " + urldata.toString());
return null;
}
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
os.write(SVGSyntax.DATA_PROTOCOL_PNG_PREFIX.getBytes());
Base64EncoderStream encoder = new Base64EncoderStream(os);
FileInputStream instream = new FileInputStream(in);
byte[] buf = new byte[4096];
while(true) {
int read = instream.read(buf, 0, buf.length);
if(read <= 0) {
break;
}
encoder.write(buf, 0, read);
}
instream.close();
encoder.close();
}
catch(IOException e) {
LoggingUtil.exception("Exception serializing image to png", e);
return null;
}
Element i = (Element) super.cloneNode(doc, eold);
i.setAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_ATTRIBUTE, os.toString().replaceAll("\\s*[\\r\\n]+\\s*", ""));
return i;
} | [
"protected",
"Node",
"inlineExternal",
"(",
"Document",
"doc",
",",
"ParsedURL",
"urldata",
",",
"Node",
"eold",
")",
"{",
"File",
"in",
"=",
"new",
"File",
"(",
"urldata",
".",
"getPath",
"(",
")",
")",
";",
"if",
"(",
"!",
"in",
".",
"exists",
"(",... | Inline an external file (usually from temp).
@param doc Document (element factory)
@param urldata URL
@param eold Existing node
@return Replacement node, or {@code null} | [
"Inline",
"an",
"external",
"file",
"(",
"usually",
"from",
"temp",
")",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/batikutil/CloneInlineImages.java#L111-L141 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/context/FlushManager.java | FlushManager.onRollBack | private void onRollBack(PersistenceDelegator delegator, Map<Object, EventLog> eventCol) {
"""
On roll back.
@param delegator
the delegator
@param eventCol
the event col
"""
if (eventCol != null && !eventCol.isEmpty())
{
Collection<EventLog> events = eventCol.values();
Iterator<EventLog> iter = events.iterator();
while (iter.hasNext())
{
try
{
EventLog event = iter.next();
Node node = event.getNode();
Class clazz = node.getDataClass();
EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(delegator.getKunderaMetadata(), clazz);
Client client = delegator.getClient(metadata);
// do manual rollback, if data is processed, and running
// without transaction or with kundera's default transaction
// support!
if (node.isProcessed()
&& (!delegator.isTransactionInProgress() || MetadataUtils
.defaultTransactionSupported(metadata.getPersistenceUnit(), delegator.getKunderaMetadata())))
{
if (node.getOriginalNode() == null)
{
Object entityId = node.getEntityId();
client.remove(node.getData(), entityId);
}
else
{
client.persist(node.getOriginalNode());
}
}
// mark it null for garbage collection.
event = null;
}
catch (Exception ex)
{
log.warn("Caught exception during rollback, Caused by:", ex);
// bypass to next event
}
}
}
// mark it null for garbage collection.
eventCol = null;
} | java | private void onRollBack(PersistenceDelegator delegator, Map<Object, EventLog> eventCol)
{
if (eventCol != null && !eventCol.isEmpty())
{
Collection<EventLog> events = eventCol.values();
Iterator<EventLog> iter = events.iterator();
while (iter.hasNext())
{
try
{
EventLog event = iter.next();
Node node = event.getNode();
Class clazz = node.getDataClass();
EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(delegator.getKunderaMetadata(), clazz);
Client client = delegator.getClient(metadata);
// do manual rollback, if data is processed, and running
// without transaction or with kundera's default transaction
// support!
if (node.isProcessed()
&& (!delegator.isTransactionInProgress() || MetadataUtils
.defaultTransactionSupported(metadata.getPersistenceUnit(), delegator.getKunderaMetadata())))
{
if (node.getOriginalNode() == null)
{
Object entityId = node.getEntityId();
client.remove(node.getData(), entityId);
}
else
{
client.persist(node.getOriginalNode());
}
}
// mark it null for garbage collection.
event = null;
}
catch (Exception ex)
{
log.warn("Caught exception during rollback, Caused by:", ex);
// bypass to next event
}
}
}
// mark it null for garbage collection.
eventCol = null;
} | [
"private",
"void",
"onRollBack",
"(",
"PersistenceDelegator",
"delegator",
",",
"Map",
"<",
"Object",
",",
"EventLog",
">",
"eventCol",
")",
"{",
"if",
"(",
"eventCol",
"!=",
"null",
"&&",
"!",
"eventCol",
".",
"isEmpty",
"(",
")",
")",
"{",
"Collection",
... | On roll back.
@param delegator
the delegator
@param eventCol
the event col | [
"On",
"roll",
"back",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/context/FlushManager.java#L456-L502 |
openengsb/openengsb | components/ekb/modelregistry-tracker/src/main/java/org/openengsb/core/ekb/modelregistry/tracker/internal/ModelRegistryService.java | ModelRegistryService.loadModelsOfBundle | private Set<ModelDescription> loadModelsOfBundle(Bundle bundle) {
"""
Searches the bundle for model classes and return a set of them.
"""
Enumeration<URL> classEntries = bundle.findEntries("/", "*.class", true);
Set<ModelDescription> models = new HashSet<ModelDescription>();
if (classEntries == null) {
LOGGER.debug("Found no classes in the bundle {}", bundle);
return models;
}
while (classEntries.hasMoreElements()) {
URL classURL = classEntries.nextElement();
String classname = extractClassName(classURL);
if (isModelClass(classname, bundle)) {
models.add(new ModelDescription(classname, bundle.getVersion().toString()));
}
}
return models;
} | java | private Set<ModelDescription> loadModelsOfBundle(Bundle bundle) {
Enumeration<URL> classEntries = bundle.findEntries("/", "*.class", true);
Set<ModelDescription> models = new HashSet<ModelDescription>();
if (classEntries == null) {
LOGGER.debug("Found no classes in the bundle {}", bundle);
return models;
}
while (classEntries.hasMoreElements()) {
URL classURL = classEntries.nextElement();
String classname = extractClassName(classURL);
if (isModelClass(classname, bundle)) {
models.add(new ModelDescription(classname, bundle.getVersion().toString()));
}
}
return models;
} | [
"private",
"Set",
"<",
"ModelDescription",
">",
"loadModelsOfBundle",
"(",
"Bundle",
"bundle",
")",
"{",
"Enumeration",
"<",
"URL",
">",
"classEntries",
"=",
"bundle",
".",
"findEntries",
"(",
"\"/\"",
",",
"\"*.class\"",
",",
"true",
")",
";",
"Set",
"<",
... | Searches the bundle for model classes and return a set of them. | [
"Searches",
"the",
"bundle",
"for",
"model",
"classes",
"and",
"return",
"a",
"set",
"of",
"them",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/modelregistry-tracker/src/main/java/org/openengsb/core/ekb/modelregistry/tracker/internal/ModelRegistryService.java#L95-L110 |
Jasig/uPortal | uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/groupadmin/GroupAdministrationHelper.java | GroupAdministrationHelper.deleteGroup | public void deleteGroup(String key, IPerson deleter) {
"""
Delete a group from the group store
@param key key of the group to be deleted
@param user performing the delete operation
"""
if (!canDeleteGroup(deleter, key)) {
throw new RuntimeAuthorizationException(
deleter, IPermission.DELETE_GROUP_ACTIVITY, key);
}
log.info("Deleting group with key " + key);
// find the current version of this group entity
IEntityGroup group = GroupService.findGroup(key);
// remove this group from the membership list of any current parent
// groups
for (IEntityGroup parent : group.getParentGroups()) {
parent.removeChild(group);
parent.updateMembers();
}
// delete the group
group.delete();
} | java | public void deleteGroup(String key, IPerson deleter) {
if (!canDeleteGroup(deleter, key)) {
throw new RuntimeAuthorizationException(
deleter, IPermission.DELETE_GROUP_ACTIVITY, key);
}
log.info("Deleting group with key " + key);
// find the current version of this group entity
IEntityGroup group = GroupService.findGroup(key);
// remove this group from the membership list of any current parent
// groups
for (IEntityGroup parent : group.getParentGroups()) {
parent.removeChild(group);
parent.updateMembers();
}
// delete the group
group.delete();
} | [
"public",
"void",
"deleteGroup",
"(",
"String",
"key",
",",
"IPerson",
"deleter",
")",
"{",
"if",
"(",
"!",
"canDeleteGroup",
"(",
"deleter",
",",
"key",
")",
")",
"{",
"throw",
"new",
"RuntimeAuthorizationException",
"(",
"deleter",
",",
"IPermission",
".",... | Delete a group from the group store
@param key key of the group to be deleted
@param user performing the delete operation | [
"Delete",
"a",
"group",
"from",
"the",
"group",
"store"
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/groupadmin/GroupAdministrationHelper.java#L88-L109 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/slim/MapFixture.java | MapFixture.valueIn | public Object valueIn(String name, Map<String, Object> map) {
"""
Gets value from map.
@param name name of (possibly nested) property to get value from.
@param map map to get value from.
@return value found, if it could be found, null otherwise.
"""
return getMapHelper().getValue(map, name);
} | java | public Object valueIn(String name, Map<String, Object> map) {
return getMapHelper().getValue(map, name);
} | [
"public",
"Object",
"valueIn",
"(",
"String",
"name",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"{",
"return",
"getMapHelper",
"(",
")",
".",
"getValue",
"(",
"map",
",",
"name",
")",
";",
"}"
] | Gets value from map.
@param name name of (possibly nested) property to get value from.
@param map map to get value from.
@return value found, if it could be found, null otherwise. | [
"Gets",
"value",
"from",
"map",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/MapFixture.java#L124-L126 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/SmartTable.java | SmartTable.setWidget | public void setWidget (int row, int column, Widget widget, int colSpan, String... styles) {
"""
Sets the widget in the specified cell, with the specified style and column span.
"""
setWidget(row, column, widget);
if (colSpan > 0) {
getFlexCellFormatter().setColSpan(row, column, colSpan);
}
setStyleNames(row, column, styles);
} | java | public void setWidget (int row, int column, Widget widget, int colSpan, String... styles)
{
setWidget(row, column, widget);
if (colSpan > 0) {
getFlexCellFormatter().setColSpan(row, column, colSpan);
}
setStyleNames(row, column, styles);
} | [
"public",
"void",
"setWidget",
"(",
"int",
"row",
",",
"int",
"column",
",",
"Widget",
"widget",
",",
"int",
"colSpan",
",",
"String",
"...",
"styles",
")",
"{",
"setWidget",
"(",
"row",
",",
"column",
",",
"widget",
")",
";",
"if",
"(",
"colSpan",
"... | Sets the widget in the specified cell, with the specified style and column span. | [
"Sets",
"the",
"widget",
"in",
"the",
"specified",
"cell",
"with",
"the",
"specified",
"style",
"and",
"column",
"span",
"."
] | train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/SmartTable.java#L294-L301 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java | Symtab.enterClass | private Type enterClass(String s) {
"""
Enter a class into symbol table.
@param s The name of the class.
"""
return enterClass(java_base, names.fromString(s)).type;
} | java | private Type enterClass(String s) {
return enterClass(java_base, names.fromString(s)).type;
} | [
"private",
"Type",
"enterClass",
"(",
"String",
"s",
")",
"{",
"return",
"enterClass",
"(",
"java_base",
",",
"names",
".",
"fromString",
"(",
"s",
")",
")",
".",
"type",
";",
"}"
] | Enter a class into symbol table.
@param s The name of the class. | [
"Enter",
"a",
"class",
"into",
"symbol",
"table",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java#L273-L275 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/property/PropertyInfo.java | PropertyInfo.getConfigValueDouble | public Double getConfigValueDouble(String key, Double dflt) {
"""
This is a convenience method for returning a named configuration value that is expected to be
a double floating point number.
@param key The configuration value's key.
@param dflt Default value.
@return Configuration value as a double or default value if not found or not a valid double.
"""
try {
return Double.parseDouble(getConfigValue(key));
} catch (Exception e) {
return dflt;
}
} | java | public Double getConfigValueDouble(String key, Double dflt) {
try {
return Double.parseDouble(getConfigValue(key));
} catch (Exception e) {
return dflt;
}
} | [
"public",
"Double",
"getConfigValueDouble",
"(",
"String",
"key",
",",
"Double",
"dflt",
")",
"{",
"try",
"{",
"return",
"Double",
".",
"parseDouble",
"(",
"getConfigValue",
"(",
"key",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"retur... | This is a convenience method for returning a named configuration value that is expected to be
a double floating point number.
@param key The configuration value's key.
@param dflt Default value.
@return Configuration value as a double or default value if not found or not a valid double. | [
"This",
"is",
"a",
"convenience",
"method",
"for",
"returning",
"a",
"named",
"configuration",
"value",
"that",
"is",
"expected",
"to",
"be",
"a",
"double",
"floating",
"point",
"number",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/property/PropertyInfo.java#L325-L331 |
Activiti/Activiti | activiti-process-validation/src/main/java/org/activiti/validation/validator/impl/BpmnModelValidator.java | BpmnModelValidator.validateAtLeastOneExecutable | protected boolean validateAtLeastOneExecutable(BpmnModel bpmnModel, List<ValidationError> errors) {
"""
Returns 'true' if at least one process definition in the {@link BpmnModel} is executable.
"""
int nrOfExecutableDefinitions = 0;
for (Process process : bpmnModel.getProcesses()) {
if (process.isExecutable()) {
nrOfExecutableDefinitions++;
}
}
if (nrOfExecutableDefinitions == 0) {
addError(errors, Problems.ALL_PROCESS_DEFINITIONS_NOT_EXECUTABLE,
"All process definition are set to be non-executable (property 'isExecutable' on process). This is not allowed.");
}
return nrOfExecutableDefinitions > 0;
} | java | protected boolean validateAtLeastOneExecutable(BpmnModel bpmnModel, List<ValidationError> errors) {
int nrOfExecutableDefinitions = 0;
for (Process process : bpmnModel.getProcesses()) {
if (process.isExecutable()) {
nrOfExecutableDefinitions++;
}
}
if (nrOfExecutableDefinitions == 0) {
addError(errors, Problems.ALL_PROCESS_DEFINITIONS_NOT_EXECUTABLE,
"All process definition are set to be non-executable (property 'isExecutable' on process). This is not allowed.");
}
return nrOfExecutableDefinitions > 0;
} | [
"protected",
"boolean",
"validateAtLeastOneExecutable",
"(",
"BpmnModel",
"bpmnModel",
",",
"List",
"<",
"ValidationError",
">",
"errors",
")",
"{",
"int",
"nrOfExecutableDefinitions",
"=",
"0",
";",
"for",
"(",
"Process",
"process",
":",
"bpmnModel",
".",
"getPro... | Returns 'true' if at least one process definition in the {@link BpmnModel} is executable. | [
"Returns",
"true",
"if",
"at",
"least",
"one",
"process",
"definition",
"in",
"the",
"{"
] | train | https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-process-validation/src/main/java/org/activiti/validation/validator/impl/BpmnModelValidator.java#L74-L88 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/tenant/TenantService.java | TenantService.isValidUserAccess | private boolean isValidUserAccess(UserDefinition userDef, Permission permNeeded) {
"""
Validate user's permission vs. the given required permission.
"""
Set<Permission> permList = userDef.getPermissions();
if (permList.size() == 0 || permList.contains(Permission.ALL)) {
return true;
}
switch (permNeeded) {
case APPEND:
return permList.contains(Permission.APPEND) || permList.contains(Permission.UPDATE);
case READ:
return permList.contains(Permission.READ);
case UPDATE:
return permList.contains(Permission.UPDATE);
default:
return false;
}
} | java | private boolean isValidUserAccess(UserDefinition userDef, Permission permNeeded) {
Set<Permission> permList = userDef.getPermissions();
if (permList.size() == 0 || permList.contains(Permission.ALL)) {
return true;
}
switch (permNeeded) {
case APPEND:
return permList.contains(Permission.APPEND) || permList.contains(Permission.UPDATE);
case READ:
return permList.contains(Permission.READ);
case UPDATE:
return permList.contains(Permission.UPDATE);
default:
return false;
}
} | [
"private",
"boolean",
"isValidUserAccess",
"(",
"UserDefinition",
"userDef",
",",
"Permission",
"permNeeded",
")",
"{",
"Set",
"<",
"Permission",
">",
"permList",
"=",
"userDef",
".",
"getPermissions",
"(",
")",
";",
"if",
"(",
"permList",
".",
"size",
"(",
... | Validate user's permission vs. the given required permission. | [
"Validate",
"user",
"s",
"permission",
"vs",
".",
"the",
"given",
"required",
"permission",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/tenant/TenantService.java#L544-L559 |
infinispan/infinispan | server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheAdd.java | CacheAdd.extractIndexingProperties | private Properties extractIndexingProperties(OperationContext context, ModelNode operation, String cacheConfiguration) {
"""
Extract indexing information for the cache from the model.
@return a {@link Properties} with the indexing properties or empty if the cache is not indexed
"""
Properties properties = new Properties();
PathAddress cacheAddress = getCacheAddressFromOperation(operation);
Resource cacheConfigResource = context.readResourceFromRoot(cacheAddress.subAddress(0, 2), true)
.getChild(PathElement.pathElement(ModelKeys.CONFIGURATIONS, ModelKeys.CONFIGURATIONS_NAME))
.getChild(PathElement.pathElement(getConfigurationKey(), cacheConfiguration));
PathElement indexingPathElement = PathElement.pathElement(ModelKeys.INDEXING, ModelKeys.INDEXING_NAME);
if (cacheConfigResource == null || !cacheConfigResource.hasChild(indexingPathElement)) {
return properties;
}
Resource indexingResource = cacheConfigResource.getChild(indexingPathElement);
if (indexingResource == null) return properties;
ModelNode indexingModel = indexingResource.getModel();
boolean hasProperties = indexingModel.hasDefined(ModelKeys.INDEXING_PROPERTIES);
if (!hasProperties) return properties;
ModelNode modelNode = indexingResource.getModel().get(ModelKeys.INDEXING_PROPERTIES);
List<Property> modelProperties = modelNode.asPropertyList();
modelProperties.forEach(p -> properties.put(p.getName(), p.getValue().asString()));
return properties;
} | java | private Properties extractIndexingProperties(OperationContext context, ModelNode operation, String cacheConfiguration) {
Properties properties = new Properties();
PathAddress cacheAddress = getCacheAddressFromOperation(operation);
Resource cacheConfigResource = context.readResourceFromRoot(cacheAddress.subAddress(0, 2), true)
.getChild(PathElement.pathElement(ModelKeys.CONFIGURATIONS, ModelKeys.CONFIGURATIONS_NAME))
.getChild(PathElement.pathElement(getConfigurationKey(), cacheConfiguration));
PathElement indexingPathElement = PathElement.pathElement(ModelKeys.INDEXING, ModelKeys.INDEXING_NAME);
if (cacheConfigResource == null || !cacheConfigResource.hasChild(indexingPathElement)) {
return properties;
}
Resource indexingResource = cacheConfigResource.getChild(indexingPathElement);
if (indexingResource == null) return properties;
ModelNode indexingModel = indexingResource.getModel();
boolean hasProperties = indexingModel.hasDefined(ModelKeys.INDEXING_PROPERTIES);
if (!hasProperties) return properties;
ModelNode modelNode = indexingResource.getModel().get(ModelKeys.INDEXING_PROPERTIES);
List<Property> modelProperties = modelNode.asPropertyList();
modelProperties.forEach(p -> properties.put(p.getName(), p.getValue().asString()));
return properties;
} | [
"private",
"Properties",
"extractIndexingProperties",
"(",
"OperationContext",
"context",
",",
"ModelNode",
"operation",
",",
"String",
"cacheConfiguration",
")",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"PathAddress",
"cacheAddress",
... | Extract indexing information for the cache from the model.
@return a {@link Properties} with the indexing properties or empty if the cache is not indexed | [
"Extract",
"indexing",
"information",
"for",
"the",
"cache",
"from",
"the",
"model",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheAdd.java#L115-L140 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/PassThruTable.java | PassThruTable.doRecordChange | public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) // init this field override for other value {
"""
Called when a change is the record status is about to happen/has happened.
<p />NOTE: This is where the notification message is sent after an ADD, DELETE, or UPDATE.
@param field If the change is due to a field, pass the field.
@param iChangeType The type of change.
@param bDisplayOption If true display the fields on the screen.
@return An error code.
"""
if (this.getNextTable() != null)
return this.getNextTable().doRecordChange(field, iChangeType, bDisplayOption); // Pass it on.
return super.doRecordChange(field, iChangeType, bDisplayOption);
} | java | public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) // init this field override for other value
{
if (this.getNextTable() != null)
return this.getNextTable().doRecordChange(field, iChangeType, bDisplayOption); // Pass it on.
return super.doRecordChange(field, iChangeType, bDisplayOption);
} | [
"public",
"int",
"doRecordChange",
"(",
"FieldInfo",
"field",
",",
"int",
"iChangeType",
",",
"boolean",
"bDisplayOption",
")",
"// init this field override for other value",
"{",
"if",
"(",
"this",
".",
"getNextTable",
"(",
")",
"!=",
"null",
")",
"return",
"this... | Called when a change is the record status is about to happen/has happened.
<p />NOTE: This is where the notification message is sent after an ADD, DELETE, or UPDATE.
@param field If the change is due to a field, pass the field.
@param iChangeType The type of change.
@param bDisplayOption If true display the fields on the screen.
@return An error code. | [
"Called",
"when",
"a",
"change",
"is",
"the",
"record",
"status",
"is",
"about",
"to",
"happen",
"/",
"has",
"happened",
".",
"<p",
"/",
">",
"NOTE",
":",
"This",
"is",
"where",
"the",
"notification",
"message",
"is",
"sent",
"after",
"an",
"ADD",
"DEL... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/PassThruTable.java#L127-L132 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java | Aggregations.bigIntegerMax | public static <Key, Value> Aggregation<Key, BigInteger, BigInteger> bigIntegerMax() {
"""
Returns an aggregation to find the {@link java.math.BigInteger} maximum
of all supplied values.<br/>
This aggregation is similar to: <pre>SELECT MAX(value) FROM x</pre>
@param <Key> the input key type
@param <Value> the supplied value type
@return the maximum value over all supplied values
"""
return new AggregationAdapter(new BigIntegerMaxAggregation<Key, Value>());
} | java | public static <Key, Value> Aggregation<Key, BigInteger, BigInteger> bigIntegerMax() {
return new AggregationAdapter(new BigIntegerMaxAggregation<Key, Value>());
} | [
"public",
"static",
"<",
"Key",
",",
"Value",
">",
"Aggregation",
"<",
"Key",
",",
"BigInteger",
",",
"BigInteger",
">",
"bigIntegerMax",
"(",
")",
"{",
"return",
"new",
"AggregationAdapter",
"(",
"new",
"BigIntegerMaxAggregation",
"<",
"Key",
",",
"Value",
... | Returns an aggregation to find the {@link java.math.BigInteger} maximum
of all supplied values.<br/>
This aggregation is similar to: <pre>SELECT MAX(value) FROM x</pre>
@param <Key> the input key type
@param <Value> the supplied value type
@return the maximum value over all supplied values | [
"Returns",
"an",
"aggregation",
"to",
"find",
"the",
"{",
"@link",
"java",
".",
"math",
".",
"BigInteger",
"}",
"maximum",
"of",
"all",
"supplied",
"values",
".",
"<br",
"/",
">",
"This",
"aggregation",
"is",
"similar",
"to",
":",
"<pre",
">",
"SELECT",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java#L338-L340 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java | UrlOperations.resolveUrl | public static String resolveUrl(String baseUrl, String url) {
"""
Resolve URL, but return a minimally escaped version in case of
error
@param baseUrl the base URL against which the url should be resolved
@param url the URL, possibly relative, to make absolute.
@return url resolved against baseUrl, unless it is absolute already, and
further transformed by whatever escaping normally takes place with a
UsableURI.
In case of error, return URL.
"""
String resolvedUrl = resolveUrl(baseUrl, url, null);
if (resolvedUrl == null) {
resolvedUrl = url.replace(" ", "%20");
resolvedUrl = resolvedUrl.replace("\r", "%0D");
}
return resolvedUrl;
} | java | public static String resolveUrl(String baseUrl, String url) {
String resolvedUrl = resolveUrl(baseUrl, url, null);
if (resolvedUrl == null) {
resolvedUrl = url.replace(" ", "%20");
resolvedUrl = resolvedUrl.replace("\r", "%0D");
}
return resolvedUrl;
} | [
"public",
"static",
"String",
"resolveUrl",
"(",
"String",
"baseUrl",
",",
"String",
"url",
")",
"{",
"String",
"resolvedUrl",
"=",
"resolveUrl",
"(",
"baseUrl",
",",
"url",
",",
"null",
")",
";",
"if",
"(",
"resolvedUrl",
"==",
"null",
")",
"{",
"resolv... | Resolve URL, but return a minimally escaped version in case of
error
@param baseUrl the base URL against which the url should be resolved
@param url the URL, possibly relative, to make absolute.
@return url resolved against baseUrl, unless it is absolute already, and
further transformed by whatever escaping normally takes place with a
UsableURI.
In case of error, return URL. | [
"Resolve",
"URL",
"but",
"return",
"a",
"minimally",
"escaped",
"version",
"in",
"case",
"of",
"error"
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java#L163-L170 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/PayMchAPI.java | PayMchAPI.payRefundquery | public static RefundqueryResult payRefundquery(Refundquery refundquery,String key) {
"""
查询退款
提交退款申请后,通过调用该接口查询退款状态。退款有一定延时,用零钱支付的退款
20 分钟内到账,银行卡支付的退款3 个工作日后重新查询退款状态。
@param refundquery refundquery
@param key 商户支付密钥
@return RefundqueryResult
"""
Map<String,String> map = MapUtil.objectToMap(refundquery);
String sign = SignatureUtil.generateSign(map,refundquery.getSign_type(),key);
refundquery.setSign(sign);
String refundqueryXML = XMLConverUtil.convertToXML(refundquery);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(xmlHeader)
.setUri(baseURI()+ "/pay/refundquery")
.setEntity(new StringEntity(refundqueryXML,Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeXmlResult(httpUriRequest,RefundqueryResult.class,refundquery.getSign_type(),key);
} | java | public static RefundqueryResult payRefundquery(Refundquery refundquery,String key){
Map<String,String> map = MapUtil.objectToMap(refundquery);
String sign = SignatureUtil.generateSign(map,refundquery.getSign_type(),key);
refundquery.setSign(sign);
String refundqueryXML = XMLConverUtil.convertToXML(refundquery);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(xmlHeader)
.setUri(baseURI()+ "/pay/refundquery")
.setEntity(new StringEntity(refundqueryXML,Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeXmlResult(httpUriRequest,RefundqueryResult.class,refundquery.getSign_type(),key);
} | [
"public",
"static",
"RefundqueryResult",
"payRefundquery",
"(",
"Refundquery",
"refundquery",
",",
"String",
"key",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"MapUtil",
".",
"objectToMap",
"(",
"refundquery",
")",
";",
"String",
"sign",
... | 查询退款
提交退款申请后,通过调用该接口查询退款状态。退款有一定延时,用零钱支付的退款
20 分钟内到账,银行卡支付的退款3 个工作日后重新查询退款状态。
@param refundquery refundquery
@param key 商户支付密钥
@return RefundqueryResult | [
"查询退款"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/PayMchAPI.java#L233-L244 |
calrissian/mango | mango-core/src/main/java/org/calrissian/mango/net/MoreInetAddresses.java | MoreInetAddresses.getMappedIPv4Address | public static Inet4Address getMappedIPv4Address(Inet6Address ip) {
"""
Returns the IPv4 address embedded in an IPv4 mapped address.
@param ip {@link Inet6Address} to be examined for an embedded IPv4 address
@return {@link Inet4Address} of the embedded IPv4 address
@throws IllegalArgumentException if the argument is not a valid IPv4 mapped address
"""
if (!isMappedIPv4Address(ip))
throw new IllegalArgumentException(String.format("Address '%s' is not IPv4-mapped.", toAddrString(ip)));
return getInet4Address(copyOfRange(ip.getAddress(), 12, 16));
} | java | public static Inet4Address getMappedIPv4Address(Inet6Address ip) {
if (!isMappedIPv4Address(ip))
throw new IllegalArgumentException(String.format("Address '%s' is not IPv4-mapped.", toAddrString(ip)));
return getInet4Address(copyOfRange(ip.getAddress(), 12, 16));
} | [
"public",
"static",
"Inet4Address",
"getMappedIPv4Address",
"(",
"Inet6Address",
"ip",
")",
"{",
"if",
"(",
"!",
"isMappedIPv4Address",
"(",
"ip",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Address '%s' is not IPv4-ma... | Returns the IPv4 address embedded in an IPv4 mapped address.
@param ip {@link Inet6Address} to be examined for an embedded IPv4 address
@return {@link Inet4Address} of the embedded IPv4 address
@throws IllegalArgumentException if the argument is not a valid IPv4 mapped address | [
"Returns",
"the",
"IPv4",
"address",
"embedded",
"in",
"an",
"IPv4",
"mapped",
"address",
"."
] | train | https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-core/src/main/java/org/calrissian/mango/net/MoreInetAddresses.java#L184-L189 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.appendSeparator | public StrBuilder appendSeparator(final String standard, final String defaultIfEmpty) {
"""
Appends one of both separators to the StrBuilder.
If the builder is currently empty it will append the defaultIfEmpty-separator
Otherwise it will append the standard-separator
Appending a null separator will have no effect.
The separator is appended using {@link #append(String)}.
<p>
This method is for example useful for constructing queries
<pre>
StrBuilder whereClause = new StrBuilder();
if(searchCommand.getPriority() != null) {
whereClause.appendSeparator(" and", " where");
whereClause.append(" priority = ?")
}
if(searchCommand.getComponent() != null) {
whereClause.appendSeparator(" and", " where");
whereClause.append(" component = ?")
}
selectClause.append(whereClause)
</pre>
@param standard the separator if builder is not empty, null means no separator
@param defaultIfEmpty the separator if builder is empty, null means no separator
@return this, to enable chaining
@since 2.5
"""
final String str = isEmpty() ? defaultIfEmpty : standard;
if (str != null) {
append(str);
}
return this;
} | java | public StrBuilder appendSeparator(final String standard, final String defaultIfEmpty) {
final String str = isEmpty() ? defaultIfEmpty : standard;
if (str != null) {
append(str);
}
return this;
} | [
"public",
"StrBuilder",
"appendSeparator",
"(",
"final",
"String",
"standard",
",",
"final",
"String",
"defaultIfEmpty",
")",
"{",
"final",
"String",
"str",
"=",
"isEmpty",
"(",
")",
"?",
"defaultIfEmpty",
":",
"standard",
";",
"if",
"(",
"str",
"!=",
"null"... | Appends one of both separators to the StrBuilder.
If the builder is currently empty it will append the defaultIfEmpty-separator
Otherwise it will append the standard-separator
Appending a null separator will have no effect.
The separator is appended using {@link #append(String)}.
<p>
This method is for example useful for constructing queries
<pre>
StrBuilder whereClause = new StrBuilder();
if(searchCommand.getPriority() != null) {
whereClause.appendSeparator(" and", " where");
whereClause.append(" priority = ?")
}
if(searchCommand.getComponent() != null) {
whereClause.appendSeparator(" and", " where");
whereClause.append(" component = ?")
}
selectClause.append(whereClause)
</pre>
@param standard the separator if builder is not empty, null means no separator
@param defaultIfEmpty the separator if builder is empty, null means no separator
@return this, to enable chaining
@since 2.5 | [
"Appends",
"one",
"of",
"both",
"separators",
"to",
"the",
"StrBuilder",
".",
"If",
"the",
"builder",
"is",
"currently",
"empty",
"it",
"will",
"append",
"the",
"defaultIfEmpty",
"-",
"separator",
"Otherwise",
"it",
"will",
"append",
"the",
"standard",
"-",
... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1362-L1368 |
andygibson/datafactory | src/main/java/org/fluttercode/datafactory/impl/DataFactory.java | DataFactory.getItem | public <T> T getItem(final T[] items, final int probability, final T defaultItem) {
"""
Returns a random item from an array of items or the defaultItem depending on the probability parameter. The
probability determines the chance (in %) of returning an item from the array versus the default value.
@param <T> Array item type and the type to return
@param items Array of items to choose from
@param probability chance (in %, 100 being guaranteed) of returning an item from the array
@param defaultItem value to return if the probability test fails
@return Item from the array or the default value
"""
if (items == null) {
throw new IllegalArgumentException("Item array cannot be null");
}
if (items.length == 0) {
throw new IllegalArgumentException("Item array cannot be empty");
}
return chance(probability) ? items[random.nextInt(items.length)] : defaultItem;
} | java | public <T> T getItem(final T[] items, final int probability, final T defaultItem) {
if (items == null) {
throw new IllegalArgumentException("Item array cannot be null");
}
if (items.length == 0) {
throw new IllegalArgumentException("Item array cannot be empty");
}
return chance(probability) ? items[random.nextInt(items.length)] : defaultItem;
} | [
"public",
"<",
"T",
">",
"T",
"getItem",
"(",
"final",
"T",
"[",
"]",
"items",
",",
"final",
"int",
"probability",
",",
"final",
"T",
"defaultItem",
")",
"{",
"if",
"(",
"items",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
... | Returns a random item from an array of items or the defaultItem depending on the probability parameter. The
probability determines the chance (in %) of returning an item from the array versus the default value.
@param <T> Array item type and the type to return
@param items Array of items to choose from
@param probability chance (in %, 100 being guaranteed) of returning an item from the array
@param defaultItem value to return if the probability test fails
@return Item from the array or the default value | [
"Returns",
"a",
"random",
"item",
"from",
"an",
"array",
"of",
"items",
"or",
"the",
"defaultItem",
"depending",
"on",
"the",
"probability",
"parameter",
".",
"The",
"probability",
"determines",
"the",
"chance",
"(",
"in",
"%",
")",
"of",
"returning",
"an",
... | train | https://github.com/andygibson/datafactory/blob/f748beb93844dea2ad6174715be3b70df0448a9c/src/main/java/org/fluttercode/datafactory/impl/DataFactory.java#L182-L190 |
medallia/Word2VecJava | src/main/java/com/medallia/word2vec/util/IO.java | IO.runWithFile | public static <X> X runWithFile(InputStream stream, Function<File, X> function) throws IOException {
"""
Copy the data from the given {@link InputStream} to a temporary file and call the given
{@link Function} with it; after the function returns the file is deleted.
"""
File f = File.createTempFile("run-with-file", null);
try {
try (FileOutputStream out = new FileOutputStream(f)) {
IOUtils.copy(stream, out);
}
return function.apply(f);
} finally {
f.delete();
}
} | java | public static <X> X runWithFile(InputStream stream, Function<File, X> function) throws IOException {
File f = File.createTempFile("run-with-file", null);
try {
try (FileOutputStream out = new FileOutputStream(f)) {
IOUtils.copy(stream, out);
}
return function.apply(f);
} finally {
f.delete();
}
} | [
"public",
"static",
"<",
"X",
">",
"X",
"runWithFile",
"(",
"InputStream",
"stream",
",",
"Function",
"<",
"File",
",",
"X",
">",
"function",
")",
"throws",
"IOException",
"{",
"File",
"f",
"=",
"File",
".",
"createTempFile",
"(",
"\"run-with-file\"",
",",... | Copy the data from the given {@link InputStream} to a temporary file and call the given
{@link Function} with it; after the function returns the file is deleted. | [
"Copy",
"the",
"data",
"from",
"the",
"given",
"{"
] | train | https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/IO.java#L117-L127 |
Stratio/cassandra-lucene-index | builder/src/main/java/com/stratio/cassandra/lucene/builder/Builder.java | Builder.geoShape | public static GeoShapeCondition geoShape(String field, String shape) {
"""
Returns a new {@link GeoShapeCondition} with the specified shape.
@param field the name of the field
@param shape the shape in WKT format
@return a new geo shape condition
"""
return geoShape(field, wkt(shape));
} | java | public static GeoShapeCondition geoShape(String field, String shape) {
return geoShape(field, wkt(shape));
} | [
"public",
"static",
"GeoShapeCondition",
"geoShape",
"(",
"String",
"field",
",",
"String",
"shape",
")",
"{",
"return",
"geoShape",
"(",
"field",
",",
"wkt",
"(",
"shape",
")",
")",
";",
"}"
] | Returns a new {@link GeoShapeCondition} with the specified shape.
@param field the name of the field
@param shape the shape in WKT format
@return a new geo shape condition | [
"Returns",
"a",
"new",
"{",
"@link",
"GeoShapeCondition",
"}",
"with",
"the",
"specified",
"shape",
"."
] | train | https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/builder/src/main/java/com/stratio/cassandra/lucene/builder/Builder.java#L481-L483 |
op4j/op4j | src/main/java/org/op4j/functions/FnFunc.java | FnFunc.ifNotNullThen | public static final <T> Function<T,T> ifNotNullThen(final Type<T> targetType, final IFunction<? super T,? extends T> thenFunction) {
"""
<p>
Builds a function that will execute the specified function <tt>thenFunction</tt>
only if the target object is not null.
</p>
<p>
The built function cannot change the return type (receives <tt>T</tt> and returns <tt>T</tt>)
because the <tt>thenFunction</tt> could remain unexecuted, and so the type returned by
<tt>thenFunction</tt> must be the same as the type required as input, in order to keep
consistency.
</p>
@param targetType the target type.
@param thenFunction the function to be executed on the target object if it is not null.
@return a function that executes the "thenFunction" if the target object is not null.
"""
return ifTrueThen(targetType, FnObject.isNotNull(), thenFunction);
} | java | public static final <T> Function<T,T> ifNotNullThen(final Type<T> targetType, final IFunction<? super T,? extends T> thenFunction) {
return ifTrueThen(targetType, FnObject.isNotNull(), thenFunction);
} | [
"public",
"static",
"final",
"<",
"T",
">",
"Function",
"<",
"T",
",",
"T",
">",
"ifNotNullThen",
"(",
"final",
"Type",
"<",
"T",
">",
"targetType",
",",
"final",
"IFunction",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"T",
">",
"thenFunction",
")"... | <p>
Builds a function that will execute the specified function <tt>thenFunction</tt>
only if the target object is not null.
</p>
<p>
The built function cannot change the return type (receives <tt>T</tt> and returns <tt>T</tt>)
because the <tt>thenFunction</tt> could remain unexecuted, and so the type returned by
<tt>thenFunction</tt> must be the same as the type required as input, in order to keep
consistency.
</p>
@param targetType the target type.
@param thenFunction the function to be executed on the target object if it is not null.
@return a function that executes the "thenFunction" if the target object is not null. | [
"<p",
">",
"Builds",
"a",
"function",
"that",
"will",
"execute",
"the",
"specified",
"function",
"<tt",
">",
"thenFunction<",
"/",
"tt",
">",
"only",
"if",
"the",
"target",
"object",
"is",
"not",
"null",
".",
"<",
"/",
"p",
">",
"<p",
">",
"The",
"bu... | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnFunc.java#L221-L223 |
jbundle/jbundle | base/model/src/main/java/org/jbundle/base/model/Utility.java | Utility.getAsFormattedString | public static String getAsFormattedString(Map<String,Object> map, String strKey, Class<?> classData, Object objDefault) {
"""
Get this item from the map and convert it to the target class.
Convert this object to an formatted string.
@param map The map to pull the param from.
@param strKey The property key.
@param classData The java class to convert the data to.
@param objDefault The default value.
@return The propety value in the correct class.
"""
Object objData = map.get(strKey);
try {
return Converter.formatObjectToString(objData, classData, objDefault);
} catch (Exception ex) {
return null;
}
} | java | public static String getAsFormattedString(Map<String,Object> map, String strKey, Class<?> classData, Object objDefault)
{
Object objData = map.get(strKey);
try {
return Converter.formatObjectToString(objData, classData, objDefault);
} catch (Exception ex) {
return null;
}
} | [
"public",
"static",
"String",
"getAsFormattedString",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
",",
"String",
"strKey",
",",
"Class",
"<",
"?",
">",
"classData",
",",
"Object",
"objDefault",
")",
"{",
"Object",
"objData",
"=",
"map",
".",
"g... | Get this item from the map and convert it to the target class.
Convert this object to an formatted string.
@param map The map to pull the param from.
@param strKey The property key.
@param classData The java class to convert the data to.
@param objDefault The default value.
@return The propety value in the correct class. | [
"Get",
"this",
"item",
"from",
"the",
"map",
"and",
"convert",
"it",
"to",
"the",
"target",
"class",
".",
"Convert",
"this",
"object",
"to",
"an",
"formatted",
"string",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L479-L487 |
teatrove/teatrove | trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java | ClassFile.setVersion | public void setVersion(int major, int minor)
throws IllegalArgumentException {
"""
Sets the version to use when writing the generated ClassFile. Currently,
only version 45, 3 is supported, and is set by default.
@exception IllegalArgumentException when the version isn't supported
"""
if (major != JDK1_1_MAJOR_VERSION ||
minor != JDK1_1_MINOR_VERSION) {
throw new IllegalArgumentException("Version " + major + ", " +
minor + " is not supported");
}
mMajorVersion = major;
mMinorVersion = minor;
} | java | public void setVersion(int major, int minor)
throws IllegalArgumentException {
if (major != JDK1_1_MAJOR_VERSION ||
minor != JDK1_1_MINOR_VERSION) {
throw new IllegalArgumentException("Version " + major + ", " +
minor + " is not supported");
}
mMajorVersion = major;
mMinorVersion = minor;
} | [
"public",
"void",
"setVersion",
"(",
"int",
"major",
",",
"int",
"minor",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"major",
"!=",
"JDK1_1_MAJOR_VERSION",
"||",
"minor",
"!=",
"JDK1_1_MINOR_VERSION",
")",
"{",
"throw",
"new",
"IllegalArgumentExcep... | Sets the version to use when writing the generated ClassFile. Currently,
only version 45, 3 is supported, and is set by default.
@exception IllegalArgumentException when the version isn't supported | [
"Sets",
"the",
"version",
"to",
"use",
"when",
"writing",
"the",
"generated",
"ClassFile",
".",
"Currently",
"only",
"version",
"45",
"3",
"is",
"supported",
"and",
"is",
"set",
"by",
"default",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java#L806-L818 |
HubSpot/jinjava | src/main/java/com/hubspot/jinjava/interpret/JinjavaInterpreter.java | JinjavaInterpreter.retraceVariable | public Object retraceVariable(String variable, int lineNumber, int startPosition) {
"""
Resolve a variable from the interpreter context, returning null if not found. This method updates the template error accumulators when a variable is not found.
@param variable
name of variable in context
@param lineNumber
current line number, for error reporting
@param startPosition
current line position, for error reporting
@return resolved value for variable
"""
if (StringUtils.isBlank(variable)) {
return "";
}
Variable var = new Variable(this, variable);
String varName = var.getName();
Object obj = context.get(varName);
if (obj != null) {
if (obj instanceof DeferredValue) {
throw new DeferredValueException(variable, lineNumber, startPosition);
}
obj = var.resolve(obj);
} else if (getConfig().isFailOnUnknownTokens()) {
throw new UnknownTokenException(variable, lineNumber, startPosition);
}
return obj;
} | java | public Object retraceVariable(String variable, int lineNumber, int startPosition) {
if (StringUtils.isBlank(variable)) {
return "";
}
Variable var = new Variable(this, variable);
String varName = var.getName();
Object obj = context.get(varName);
if (obj != null) {
if (obj instanceof DeferredValue) {
throw new DeferredValueException(variable, lineNumber, startPosition);
}
obj = var.resolve(obj);
} else if (getConfig().isFailOnUnknownTokens()) {
throw new UnknownTokenException(variable, lineNumber, startPosition);
}
return obj;
} | [
"public",
"Object",
"retraceVariable",
"(",
"String",
"variable",
",",
"int",
"lineNumber",
",",
"int",
"startPosition",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"variable",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"Variable",
"var",
"=",... | Resolve a variable from the interpreter context, returning null if not found. This method updates the template error accumulators when a variable is not found.
@param variable
name of variable in context
@param lineNumber
current line number, for error reporting
@param startPosition
current line position, for error reporting
@return resolved value for variable | [
"Resolve",
"a",
"variable",
"from",
"the",
"interpreter",
"context",
"returning",
"null",
"if",
"not",
"found",
".",
"This",
"method",
"updates",
"the",
"template",
"error",
"accumulators",
"when",
"a",
"variable",
"is",
"not",
"found",
"."
] | train | https://github.com/HubSpot/jinjava/blob/ce570935630f49c666170d2330b0b9ba4eddb955/src/main/java/com/hubspot/jinjava/interpret/JinjavaInterpreter.java#L325-L341 |
cdk/cdk | descriptor/fingerprint/src/main/java/org/openscience/cdk/fingerprint/AtomPairs2DFingerprinter.java | AtomPairs2DFingerprinter.encodeHalPath | private static String encodeHalPath(int dist, IAtom a, IAtom b) {
"""
Encodes name for halogen paths
@param dist
@param a
@param b
@return
"""
return dist + "_" + (isHalogen(a) ? "X" : a.getSymbol()) + "_" +
(isHalogen(b) ? "X" : b.getSymbol());
} | java | private static String encodeHalPath(int dist, IAtom a, IAtom b) {
return dist + "_" + (isHalogen(a) ? "X" : a.getSymbol()) + "_" +
(isHalogen(b) ? "X" : b.getSymbol());
} | [
"private",
"static",
"String",
"encodeHalPath",
"(",
"int",
"dist",
",",
"IAtom",
"a",
",",
"IAtom",
"b",
")",
"{",
"return",
"dist",
"+",
"\"_\"",
"+",
"(",
"isHalogen",
"(",
"a",
")",
"?",
"\"X\"",
":",
"a",
".",
"getSymbol",
"(",
")",
")",
"+",
... | Encodes name for halogen paths
@param dist
@param a
@param b
@return | [
"Encodes",
"name",
"for",
"halogen",
"paths"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/fingerprint/src/main/java/org/openscience/cdk/fingerprint/AtomPairs2DFingerprinter.java#L125-L128 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestServerEndpoint.java | RestServerEndpoint.checkAndCreateUploadDir | private static synchronized void checkAndCreateUploadDir(final Path uploadDir, final Logger log) throws IOException {
"""
Checks whether the given directory exists and is writable. If it doesn't exist, this method
will attempt to create it.
@param uploadDir directory to check
@param log logger used for logging output
@throws IOException if the directory does not exist and cannot be created, or if the
directory isn't writable
"""
if (Files.exists(uploadDir) && Files.isWritable(uploadDir)) {
log.info("Using directory {} for file uploads.", uploadDir);
} else if (Files.isWritable(Files.createDirectories(uploadDir))) {
log.info("Created directory {} for file uploads.", uploadDir);
} else {
log.warn("Upload directory {} cannot be created or is not writable.", uploadDir);
throw new IOException(
String.format("Upload directory %s cannot be created or is not writable.",
uploadDir));
}
} | java | private static synchronized void checkAndCreateUploadDir(final Path uploadDir, final Logger log) throws IOException {
if (Files.exists(uploadDir) && Files.isWritable(uploadDir)) {
log.info("Using directory {} for file uploads.", uploadDir);
} else if (Files.isWritable(Files.createDirectories(uploadDir))) {
log.info("Created directory {} for file uploads.", uploadDir);
} else {
log.warn("Upload directory {} cannot be created or is not writable.", uploadDir);
throw new IOException(
String.format("Upload directory %s cannot be created or is not writable.",
uploadDir));
}
} | [
"private",
"static",
"synchronized",
"void",
"checkAndCreateUploadDir",
"(",
"final",
"Path",
"uploadDir",
",",
"final",
"Logger",
"log",
")",
"throws",
"IOException",
"{",
"if",
"(",
"Files",
".",
"exists",
"(",
"uploadDir",
")",
"&&",
"Files",
".",
"isWritab... | Checks whether the given directory exists and is writable. If it doesn't exist, this method
will attempt to create it.
@param uploadDir directory to check
@param log logger used for logging output
@throws IOException if the directory does not exist and cannot be created, or if the
directory isn't writable | [
"Checks",
"whether",
"the",
"given",
"directory",
"exists",
"and",
"is",
"writable",
".",
"If",
"it",
"doesn",
"t",
"exist",
"this",
"method",
"will",
"attempt",
"to",
"create",
"it",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestServerEndpoint.java#L472-L483 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/cluster/clusterinstance.java | clusterinstance.get | public static clusterinstance get(nitro_service service, Long clid) throws Exception {
"""
Use this API to fetch clusterinstance resource of given name .
"""
clusterinstance obj = new clusterinstance();
obj.set_clid(clid);
clusterinstance response = (clusterinstance) obj.get_resource(service);
return response;
} | java | public static clusterinstance get(nitro_service service, Long clid) throws Exception{
clusterinstance obj = new clusterinstance();
obj.set_clid(clid);
clusterinstance response = (clusterinstance) obj.get_resource(service);
return response;
} | [
"public",
"static",
"clusterinstance",
"get",
"(",
"nitro_service",
"service",
",",
"Long",
"clid",
")",
"throws",
"Exception",
"{",
"clusterinstance",
"obj",
"=",
"new",
"clusterinstance",
"(",
")",
";",
"obj",
".",
"set_clid",
"(",
"clid",
")",
";",
"clust... | Use this API to fetch clusterinstance resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"clusterinstance",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/cluster/clusterinstance.java#L525-L530 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java | ImageLoading.loadReuse | public static ReuseResult loadReuse(byte[] data, Bitmap dest) throws ImageLoadException {
"""
Loading bitmap with using reuse bitmap with the different size of source image.
If it is unable to load with reuse method tries to load without it.
Reuse works only for Android 4.4+
@param data image file contents
@param dest reuse bitmap
@return result of loading
@throws ImageLoadException if it is unable to load file
"""
return loadBitmapReuse(new MemorySource(data), dest);
} | java | public static ReuseResult loadReuse(byte[] data, Bitmap dest) throws ImageLoadException {
return loadBitmapReuse(new MemorySource(data), dest);
} | [
"public",
"static",
"ReuseResult",
"loadReuse",
"(",
"byte",
"[",
"]",
"data",
",",
"Bitmap",
"dest",
")",
"throws",
"ImageLoadException",
"{",
"return",
"loadBitmapReuse",
"(",
"new",
"MemorySource",
"(",
"data",
")",
",",
"dest",
")",
";",
"}"
] | Loading bitmap with using reuse bitmap with the different size of source image.
If it is unable to load with reuse method tries to load without it.
Reuse works only for Android 4.4+
@param data image file contents
@param dest reuse bitmap
@return result of loading
@throws ImageLoadException if it is unable to load file | [
"Loading",
"bitmap",
"with",
"using",
"reuse",
"bitmap",
"with",
"the",
"different",
"size",
"of",
"source",
"image",
".",
"If",
"it",
"is",
"unable",
"to",
"load",
"with",
"reuse",
"method",
"tries",
"to",
"load",
"without",
"it",
".",
"Reuse",
"works",
... | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L216-L218 |
windup/windup | reporting/api/src/main/java/org/jboss/windup/reporting/service/TechnologyTagService.java | TechnologyTagService.removeTagFromFileModel | public void removeTagFromFileModel(FileModel fileModel, String tagName) {
"""
Removes the provided tag from the provided {@link FileModel}. If a {@link TechnologyTagModel} cannot be found with the provided name, then this
operation will do nothing.
"""
Traversable<Vertex, Vertex> q = getGraphContext().getQuery(TechnologyTagModel.class)
.traverse(g -> g.has(TechnologyTagModel.NAME, tagName));
TechnologyTagModel technologyTag = super.getUnique(q.getRawTraversal());
if (technologyTag != null)
technologyTag.removeFileModel(fileModel);
} | java | public void removeTagFromFileModel(FileModel fileModel, String tagName)
{
Traversable<Vertex, Vertex> q = getGraphContext().getQuery(TechnologyTagModel.class)
.traverse(g -> g.has(TechnologyTagModel.NAME, tagName));
TechnologyTagModel technologyTag = super.getUnique(q.getRawTraversal());
if (technologyTag != null)
technologyTag.removeFileModel(fileModel);
} | [
"public",
"void",
"removeTagFromFileModel",
"(",
"FileModel",
"fileModel",
",",
"String",
"tagName",
")",
"{",
"Traversable",
"<",
"Vertex",
",",
"Vertex",
">",
"q",
"=",
"getGraphContext",
"(",
")",
".",
"getQuery",
"(",
"TechnologyTagModel",
".",
"class",
")... | Removes the provided tag from the provided {@link FileModel}. If a {@link TechnologyTagModel} cannot be found with the provided name, then this
operation will do nothing. | [
"Removes",
"the",
"provided",
"tag",
"from",
"the",
"provided",
"{"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/service/TechnologyTagService.java#L66-L74 |
joniles/mpxj | src/main/java/net/sf/mpxj/ResourceAssignment.java | ResourceAssignment.selectField | private AssignmentField selectField(AssignmentField[] fields, int index) {
"""
Maps a field index to an AssignmentField instance.
@param fields array of fields used as the basis for the mapping.
@param index required field index
@return AssignmnetField instance
"""
if (index < 1 || index > fields.length)
{
throw new IllegalArgumentException(index + " is not a valid field index");
}
return (fields[index - 1]);
} | java | private AssignmentField selectField(AssignmentField[] fields, int index)
{
if (index < 1 || index > fields.length)
{
throw new IllegalArgumentException(index + " is not a valid field index");
}
return (fields[index - 1]);
} | [
"private",
"AssignmentField",
"selectField",
"(",
"AssignmentField",
"[",
"]",
"fields",
",",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"<",
"1",
"||",
"index",
">",
"fields",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"i... | Maps a field index to an AssignmentField instance.
@param fields array of fields used as the basis for the mapping.
@param index required field index
@return AssignmnetField instance | [
"Maps",
"a",
"field",
"index",
"to",
"an",
"AssignmentField",
"instance",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L2683-L2690 |
apache/groovy | src/main/groovy/groovy/ui/GroovyMain.java | GroovyMain.processArgs | static void processArgs(String[] args, final PrintStream out, final PrintStream err) {
"""
package-level visibility for testing purposes (just usage/errors at this stage)
"""
GroovyCommand groovyCommand = new GroovyCommand();
CommandLine parser = new CommandLine(groovyCommand).setUnmatchedArgumentsAllowed(true).setStopAtUnmatched(true);
try {
List<CommandLine> result = parser.parse(args);
if (CommandLine.printHelpIfRequested(result, out, err, Help.Ansi.AUTO)) {
return;
}
// TODO: pass printstream(s) down through process
if (!groovyCommand.process(parser)) {
// If we fail, then exit with an error so scripting frameworks can catch it.
System.exit(1);
}
} catch (ParameterException ex) { // command line arguments could not be parsed
err.println(ex.getMessage());
ex.getCommandLine().usage(err);
} catch (IOException ioe) {
err.println("error: " + ioe.getMessage());
}
} | java | static void processArgs(String[] args, final PrintStream out, final PrintStream err) {
GroovyCommand groovyCommand = new GroovyCommand();
CommandLine parser = new CommandLine(groovyCommand).setUnmatchedArgumentsAllowed(true).setStopAtUnmatched(true);
try {
List<CommandLine> result = parser.parse(args);
if (CommandLine.printHelpIfRequested(result, out, err, Help.Ansi.AUTO)) {
return;
}
// TODO: pass printstream(s) down through process
if (!groovyCommand.process(parser)) {
// If we fail, then exit with an error so scripting frameworks can catch it.
System.exit(1);
}
} catch (ParameterException ex) { // command line arguments could not be parsed
err.println(ex.getMessage());
ex.getCommandLine().usage(err);
} catch (IOException ioe) {
err.println("error: " + ioe.getMessage());
}
} | [
"static",
"void",
"processArgs",
"(",
"String",
"[",
"]",
"args",
",",
"final",
"PrintStream",
"out",
",",
"final",
"PrintStream",
"err",
")",
"{",
"GroovyCommand",
"groovyCommand",
"=",
"new",
"GroovyCommand",
"(",
")",
";",
"CommandLine",
"parser",
"=",
"n... | package-level visibility for testing purposes (just usage/errors at this stage) | [
"package",
"-",
"level",
"visibility",
"for",
"testing",
"purposes",
"(",
"just",
"usage",
"/",
"errors",
"at",
"this",
"stage",
")"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/ui/GroovyMain.java#L125-L145 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/data/SparkDataValidation.java | SparkDataValidation.validateDataSets | public static ValidationResult validateDataSets(JavaSparkContext sc, String path, int[] featuresShape, int[] labelsShape) {
"""
Validate DataSet objects saved to the specified directory on HDFS by attempting to load them and checking their
contents. Assumes DataSets were saved using {@link org.nd4j.linalg.dataset.DataSet#save(OutputStream)}.<br>
This method (optionally) additionally validates the arrays using the specified shapes for the features and labels.
Note: this method will also consider all files in subdirectories (i.e., is recursive).
@param sc Spark context
@param path HDFS path of the directory containing the saved DataSet objects
@param featuresShape May be null. If non-null: feature arrays must match the specified shape, for all values with
shape > 0. For example, if featuresShape = {-1,10} then the features must be rank 2,
can have any size for the first dimension, but must have size 10 for the second dimension.
@param labelsShape As per featuresShape, but for the labels instead
@return Results of the validation
"""
return validateDataSets(sc, path, true, false, featuresShape, labelsShape);
} | java | public static ValidationResult validateDataSets(JavaSparkContext sc, String path, int[] featuresShape, int[] labelsShape) {
return validateDataSets(sc, path, true, false, featuresShape, labelsShape);
} | [
"public",
"static",
"ValidationResult",
"validateDataSets",
"(",
"JavaSparkContext",
"sc",
",",
"String",
"path",
",",
"int",
"[",
"]",
"featuresShape",
",",
"int",
"[",
"]",
"labelsShape",
")",
"{",
"return",
"validateDataSets",
"(",
"sc",
",",
"path",
",",
... | Validate DataSet objects saved to the specified directory on HDFS by attempting to load them and checking their
contents. Assumes DataSets were saved using {@link org.nd4j.linalg.dataset.DataSet#save(OutputStream)}.<br>
This method (optionally) additionally validates the arrays using the specified shapes for the features and labels.
Note: this method will also consider all files in subdirectories (i.e., is recursive).
@param sc Spark context
@param path HDFS path of the directory containing the saved DataSet objects
@param featuresShape May be null. If non-null: feature arrays must match the specified shape, for all values with
shape > 0. For example, if featuresShape = {-1,10} then the features must be rank 2,
can have any size for the first dimension, but must have size 10 for the second dimension.
@param labelsShape As per featuresShape, but for the labels instead
@return Results of the validation | [
"Validate",
"DataSet",
"objects",
"saved",
"to",
"the",
"specified",
"directory",
"on",
"HDFS",
"by",
"attempting",
"to",
"load",
"them",
"and",
"checking",
"their",
"contents",
".",
"Assumes",
"DataSets",
"were",
"saved",
"using",
"{",
"@link",
"org",
".",
... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/data/SparkDataValidation.java#L68-L70 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/runtime/JCuda.java | JCuda.cudaDeviceGetPCIBusId | public static int cudaDeviceGetPCIBusId(String pciBusId[], int len, int device) {
"""
Returns a PCI Bus Id string for the device.
<pre>
cudaError_t cudaDeviceGetPCIBusId (
char* pciBusId,
int len,
int device )
</pre>
<div>
<p>Returns a PCI Bus Id string for the
device. Returns an ASCII string identifying the device <tt>dev</tt>
in the NULL-terminated string pointed to by <tt>pciBusId</tt>. <tt>len</tt> specifies the maximum length of the string that may be
returned.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param pciBusId Returned identifier string for the device in the following format [domain]:[bus]:[device].[function] where domain, bus, device, and function are all hexadecimal values. pciBusId should be large enough to store 13 characters including the NULL-terminator.
@param len Maximum length of string to store in name
@param device Device to get identifier string for
@return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevice
@see JCuda#cudaDeviceGetByPCIBusId
"""
return checkResult(cudaDeviceGetPCIBusIdNative(pciBusId, len, device));
} | java | public static int cudaDeviceGetPCIBusId(String pciBusId[], int len, int device)
{
return checkResult(cudaDeviceGetPCIBusIdNative(pciBusId, len, device));
} | [
"public",
"static",
"int",
"cudaDeviceGetPCIBusId",
"(",
"String",
"pciBusId",
"[",
"]",
",",
"int",
"len",
",",
"int",
"device",
")",
"{",
"return",
"checkResult",
"(",
"cudaDeviceGetPCIBusIdNative",
"(",
"pciBusId",
",",
"len",
",",
"device",
")",
")",
";"... | Returns a PCI Bus Id string for the device.
<pre>
cudaError_t cudaDeviceGetPCIBusId (
char* pciBusId,
int len,
int device )
</pre>
<div>
<p>Returns a PCI Bus Id string for the
device. Returns an ASCII string identifying the device <tt>dev</tt>
in the NULL-terminated string pointed to by <tt>pciBusId</tt>. <tt>len</tt> specifies the maximum length of the string that may be
returned.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param pciBusId Returned identifier string for the device in the following format [domain]:[bus]:[device].[function] where domain, bus, device, and function are all hexadecimal values. pciBusId should be large enough to store 13 characters including the NULL-terminator.
@param len Maximum length of string to store in name
@param device Device to get identifier string for
@return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevice
@see JCuda#cudaDeviceGetByPCIBusId | [
"Returns",
"a",
"PCI",
"Bus",
"Id",
"string",
"for",
"the",
"device",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L7957-L7960 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java | CommonOps_DDF2.extractRow | public static DMatrix2 extractRow( DMatrix2x2 a , int row , DMatrix2 out ) {
"""
Extracts the row from the matrix a.
@param a Input matrix
@param row Which row is to be extracted
@param out output. Storage for the extracted row. If null then a new vector will be returned.
@return The extracted row.
"""
if( out == null) out = new DMatrix2();
switch( row ) {
case 0:
out.a1 = a.a11;
out.a2 = a.a12;
break;
case 1:
out.a1 = a.a21;
out.a2 = a.a22;
break;
default:
throw new IllegalArgumentException("Out of bounds row. row = "+row);
}
return out;
} | java | public static DMatrix2 extractRow( DMatrix2x2 a , int row , DMatrix2 out ) {
if( out == null) out = new DMatrix2();
switch( row ) {
case 0:
out.a1 = a.a11;
out.a2 = a.a12;
break;
case 1:
out.a1 = a.a21;
out.a2 = a.a22;
break;
default:
throw new IllegalArgumentException("Out of bounds row. row = "+row);
}
return out;
} | [
"public",
"static",
"DMatrix2",
"extractRow",
"(",
"DMatrix2x2",
"a",
",",
"int",
"row",
",",
"DMatrix2",
"out",
")",
"{",
"if",
"(",
"out",
"==",
"null",
")",
"out",
"=",
"new",
"DMatrix2",
"(",
")",
";",
"switch",
"(",
"row",
")",
"{",
"case",
"0... | Extracts the row from the matrix a.
@param a Input matrix
@param row Which row is to be extracted
@param out output. Storage for the extracted row. If null then a new vector will be returned.
@return The extracted row. | [
"Extracts",
"the",
"row",
"from",
"the",
"matrix",
"a",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java#L1157-L1172 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/SLINK.java | SLINK.slinkstep4 | private void slinkstep4(DBIDRef id, DBIDArrayIter it, int n, WritableDBIDDataStore pi, WritableDoubleDataStore lambda) {
"""
Fourth step: Actualize the clusters if necessary
@param id the id of the current object
@param it array iterator
@param n Last object to process at this run
@param pi Pi data store
@param lambda Lambda data store
"""
DBIDVar p_i = DBIDUtil.newVar();
// for i = 1..n
for(it.seek(0); it.getOffset() < n; it.advance()) {
double l_i = lambda.doubleValue(it);
p_i.from(pi, it); // p_i = pi(it)
double lp_i = lambda.doubleValue(p_i);
// if L(i) >= L(P(i))
if(l_i >= lp_i) {
// P(i) = n+1
pi.put(it, id);
}
}
} | java | private void slinkstep4(DBIDRef id, DBIDArrayIter it, int n, WritableDBIDDataStore pi, WritableDoubleDataStore lambda) {
DBIDVar p_i = DBIDUtil.newVar();
// for i = 1..n
for(it.seek(0); it.getOffset() < n; it.advance()) {
double l_i = lambda.doubleValue(it);
p_i.from(pi, it); // p_i = pi(it)
double lp_i = lambda.doubleValue(p_i);
// if L(i) >= L(P(i))
if(l_i >= lp_i) {
// P(i) = n+1
pi.put(it, id);
}
}
} | [
"private",
"void",
"slinkstep4",
"(",
"DBIDRef",
"id",
",",
"DBIDArrayIter",
"it",
",",
"int",
"n",
",",
"WritableDBIDDataStore",
"pi",
",",
"WritableDoubleDataStore",
"lambda",
")",
"{",
"DBIDVar",
"p_i",
"=",
"DBIDUtil",
".",
"newVar",
"(",
")",
";",
"// f... | Fourth step: Actualize the clusters if necessary
@param id the id of the current object
@param it array iterator
@param n Last object to process at this run
@param pi Pi data store
@param lambda Lambda data store | [
"Fourth",
"step",
":",
"Actualize",
"the",
"clusters",
"if",
"necessary"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/SLINK.java#L256-L270 |
JavaMoney/jsr354-api | src/main/java/javax/money/AbstractContextBuilder.java | AbstractContextBuilder.importContext | public B importContext(AbstractContext context) {
"""
Apply all attributes on the given context, hereby existing entries are preserved.
@param context the context to be applied, not null.
@return this Builder, for chaining
@see #importContext(AbstractContext, boolean)
"""
Objects.requireNonNull(context);
return importContext(context, false);
} | java | public B importContext(AbstractContext context){
Objects.requireNonNull(context);
return importContext(context, false);
} | [
"public",
"B",
"importContext",
"(",
"AbstractContext",
"context",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"context",
")",
";",
"return",
"importContext",
"(",
"context",
",",
"false",
")",
";",
"}"
] | Apply all attributes on the given context, hereby existing entries are preserved.
@param context the context to be applied, not null.
@return this Builder, for chaining
@see #importContext(AbstractContext, boolean) | [
"Apply",
"all",
"attributes",
"on",
"the",
"given",
"context",
"hereby",
"existing",
"entries",
"are",
"preserved",
"."
] | train | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/AbstractContextBuilder.java#L66-L69 |
Netflix/spectator | spectator-api/src/main/java/com/netflix/spectator/api/patterns/IntervalCounter.java | IntervalCounter.get | public static IntervalCounter get(Registry registry, Id id) {
"""
Create a new instance.
@param registry
Registry to use.
@param id
Identifier for the metric being registered.
@return
Counter instance.
"""
ConcurrentMap<Id, Object> state = registry.state();
Object c = Utils.computeIfAbsent(state, id, i -> new IntervalCounter(registry, i));
if (!(c instanceof IntervalCounter)) {
Utils.propagateTypeError(registry, id, IntervalCounter.class, c.getClass());
c = new IntervalCounter(new NoopRegistry(), id);
}
return (IntervalCounter) c;
} | java | public static IntervalCounter get(Registry registry, Id id) {
ConcurrentMap<Id, Object> state = registry.state();
Object c = Utils.computeIfAbsent(state, id, i -> new IntervalCounter(registry, i));
if (!(c instanceof IntervalCounter)) {
Utils.propagateTypeError(registry, id, IntervalCounter.class, c.getClass());
c = new IntervalCounter(new NoopRegistry(), id);
}
return (IntervalCounter) c;
} | [
"public",
"static",
"IntervalCounter",
"get",
"(",
"Registry",
"registry",
",",
"Id",
"id",
")",
"{",
"ConcurrentMap",
"<",
"Id",
",",
"Object",
">",
"state",
"=",
"registry",
".",
"state",
"(",
")",
";",
"Object",
"c",
"=",
"Utils",
".",
"computeIfAbsen... | Create a new instance.
@param registry
Registry to use.
@param id
Identifier for the metric being registered.
@return
Counter instance. | [
"Create",
"a",
"new",
"instance",
"."
] | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/patterns/IntervalCounter.java#L50-L58 |
RestComm/jss7 | m3ua/impl/src/main/java/org/restcomm/protocols/ss7/m3ua/impl/M3UAManagementImpl.java | M3UAManagementImpl.createAspFactory | public AspFactory createAspFactory(String aspName, String associationName, boolean isHeartBeatEnabled) throws Exception {
"""
Create new {@link AspFactoryImpl} without passing optional aspid
@param aspName
@param associationName
@return
@throws Exception
"""
long aspid = 0L;
boolean regenerateFlag = true;
while (regenerateFlag) {
aspid = AspFactoryImpl.generateId();
if (aspfactories.size() == 0) {
// Special case where this is first Asp added
break;
}
for (FastList.Node<AspFactory> n = aspfactories.head(), end = aspfactories.tail(); (n = n.getNext()) != end;) {
AspFactoryImpl aspFactoryImpl = (AspFactoryImpl) n.getValue();
if (aspid == aspFactoryImpl.getAspid().getAspId()) {
regenerateFlag = true;
break;
} else {
regenerateFlag = false;
}
}// for
}// while
return this.createAspFactory(aspName, associationName, aspid, isHeartBeatEnabled);
} | java | public AspFactory createAspFactory(String aspName, String associationName, boolean isHeartBeatEnabled) throws Exception {
long aspid = 0L;
boolean regenerateFlag = true;
while (regenerateFlag) {
aspid = AspFactoryImpl.generateId();
if (aspfactories.size() == 0) {
// Special case where this is first Asp added
break;
}
for (FastList.Node<AspFactory> n = aspfactories.head(), end = aspfactories.tail(); (n = n.getNext()) != end;) {
AspFactoryImpl aspFactoryImpl = (AspFactoryImpl) n.getValue();
if (aspid == aspFactoryImpl.getAspid().getAspId()) {
regenerateFlag = true;
break;
} else {
regenerateFlag = false;
}
}// for
}// while
return this.createAspFactory(aspName, associationName, aspid, isHeartBeatEnabled);
} | [
"public",
"AspFactory",
"createAspFactory",
"(",
"String",
"aspName",
",",
"String",
"associationName",
",",
"boolean",
"isHeartBeatEnabled",
")",
"throws",
"Exception",
"{",
"long",
"aspid",
"=",
"0L",
";",
"boolean",
"regenerateFlag",
"=",
"true",
";",
"while",
... | Create new {@link AspFactoryImpl} without passing optional aspid
@param aspName
@param associationName
@return
@throws Exception | [
"Create",
"new",
"{",
"@link",
"AspFactoryImpl",
"}",
"without",
"passing",
"optional",
"aspid"
] | train | https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/m3ua/impl/src/main/java/org/restcomm/protocols/ss7/m3ua/impl/M3UAManagementImpl.java#L533-L556 |
google/closure-compiler | src/com/google/javascript/jscomp/NodeUtil.java | NodeUtil.visitPreOrder | public static void visitPreOrder(Node node, Visitor visitor) {
"""
A pre-order traversal, calling Visitor.visit for each decendent.
"""
visitPreOrder(node, visitor, Predicates.alwaysTrue());
} | java | public static void visitPreOrder(Node node, Visitor visitor) {
visitPreOrder(node, visitor, Predicates.alwaysTrue());
} | [
"public",
"static",
"void",
"visitPreOrder",
"(",
"Node",
"node",
",",
"Visitor",
"visitor",
")",
"{",
"visitPreOrder",
"(",
"node",
",",
"visitor",
",",
"Predicates",
".",
"alwaysTrue",
"(",
")",
")",
";",
"}"
] | A pre-order traversal, calling Visitor.visit for each decendent. | [
"A",
"pre",
"-",
"order",
"traversal",
"calling",
"Visitor",
".",
"visit",
"for",
"each",
"decendent",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L4720-L4722 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/convert/encode/HashSHAConverter.java | HashSHAConverter.setString | public int setString(String strValue, boolean bDisplayOption, int iMoveMode) {
"""
Convert and move string to this field.
@param strString the state to set the data to.
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return The error code (or NORMAL_RETURN).
"""
if ((strValue == null) || (strValue.length() == 0))
return super.setString(strValue, bDisplayOption, iMoveMode); // Don't trip change or display
if (TEN_SPACES.equals(strValue))
return DBConstants.NORMAL_RETURN;
return super.setString(strValue, bDisplayOption, iMoveMode);
} | java | public int setString(String strValue, boolean bDisplayOption, int iMoveMode)
{
if ((strValue == null) || (strValue.length() == 0))
return super.setString(strValue, bDisplayOption, iMoveMode); // Don't trip change or display
if (TEN_SPACES.equals(strValue))
return DBConstants.NORMAL_RETURN;
return super.setString(strValue, bDisplayOption, iMoveMode);
} | [
"public",
"int",
"setString",
"(",
"String",
"strValue",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"if",
"(",
"(",
"strValue",
"==",
"null",
")",
"||",
"(",
"strValue",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"return",
... | Convert and move string to this field.
@param strString the state to set the data to.
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return The error code (or NORMAL_RETURN). | [
"Convert",
"and",
"move",
"string",
"to",
"this",
"field",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/encode/HashSHAConverter.java#L74-L81 |
kiegroup/drools | drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java | KnowledgeBuilderImpl.addPackageFromDrl | public void addPackageFromDrl(final Reader source,
final Reader dsl) throws DroolsParserException,
IOException {
"""
Load a rule package from DRL source using the supplied DSL configuration.
@param source The source of the rules.
@param dsl The source of the domain specific language configuration.
@throws DroolsParserException
@throws IOException
"""
this.resource = new ReaderResource(source, ResourceType.DSLR);
final DrlParser parser = new DrlParser(configuration.getLanguageLevel());
final PackageDescr pkg = parser.parse(source, dsl);
this.results.addAll(parser.getErrors());
if (!parser.hasErrors()) {
addPackage(pkg);
}
this.resource = null;
} | java | public void addPackageFromDrl(final Reader source,
final Reader dsl) throws DroolsParserException,
IOException {
this.resource = new ReaderResource(source, ResourceType.DSLR);
final DrlParser parser = new DrlParser(configuration.getLanguageLevel());
final PackageDescr pkg = parser.parse(source, dsl);
this.results.addAll(parser.getErrors());
if (!parser.hasErrors()) {
addPackage(pkg);
}
this.resource = null;
} | [
"public",
"void",
"addPackageFromDrl",
"(",
"final",
"Reader",
"source",
",",
"final",
"Reader",
"dsl",
")",
"throws",
"DroolsParserException",
",",
"IOException",
"{",
"this",
".",
"resource",
"=",
"new",
"ReaderResource",
"(",
"source",
",",
"ResourceType",
".... | Load a rule package from DRL source using the supplied DSL configuration.
@param source The source of the rules.
@param dsl The source of the domain specific language configuration.
@throws DroolsParserException
@throws IOException | [
"Load",
"a",
"rule",
"package",
"from",
"DRL",
"source",
"using",
"the",
"supplied",
"DSL",
"configuration",
"."
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java#L638-L650 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java | AFPChainer.calcGap | private static int calcGap(AFP afp1 , AFP afp2) {
"""
return the gaps between this and afp
requiring afp1 > afp2
( operator % in C)
"""
int g = (afp1.getP1() - afp2.getP1()) - (afp1.getP2() - afp2.getP2());
if(g < 0) g = -g;
return g;
} | java | private static int calcGap(AFP afp1 , AFP afp2)
{
int g = (afp1.getP1() - afp2.getP1()) - (afp1.getP2() - afp2.getP2());
if(g < 0) g = -g;
return g;
} | [
"private",
"static",
"int",
"calcGap",
"(",
"AFP",
"afp1",
",",
"AFP",
"afp2",
")",
"{",
"int",
"g",
"=",
"(",
"afp1",
".",
"getP1",
"(",
")",
"-",
"afp2",
".",
"getP1",
"(",
")",
")",
"-",
"(",
"afp1",
".",
"getP2",
"(",
")",
"-",
"afp2",
".... | return the gaps between this and afp
requiring afp1 > afp2
( operator % in C) | [
"return",
"the",
"gaps",
"between",
"this",
"and",
"afp",
"requiring",
"afp1",
">",
"afp2",
"(",
"operator",
"%",
"in",
"C",
")"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java#L365-L370 |
samskivert/pythagoras | src/main/java/pythagoras/d/Rectangles.java | Rectangles.closestInteriorPoint | public static Point closestInteriorPoint (IRectangle r, IPoint p) {
"""
Computes and returns the point inside the bounds of the rectangle that's closest to the
given point.
"""
return closestInteriorPoint(r, p, new Point());
} | java | public static Point closestInteriorPoint (IRectangle r, IPoint p) {
return closestInteriorPoint(r, p, new Point());
} | [
"public",
"static",
"Point",
"closestInteriorPoint",
"(",
"IRectangle",
"r",
",",
"IPoint",
"p",
")",
"{",
"return",
"closestInteriorPoint",
"(",
"r",
",",
"p",
",",
"new",
"Point",
"(",
")",
")",
";",
"}"
] | Computes and returns the point inside the bounds of the rectangle that's closest to the
given point. | [
"Computes",
"and",
"returns",
"the",
"point",
"inside",
"the",
"bounds",
"of",
"the",
"rectangle",
"that",
"s",
"closest",
"to",
"the",
"given",
"point",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Rectangles.java#L49-L51 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.getGroupBadge | public GitlabBadge getGroupBadge(Integer groupId, Integer badgeId) throws IOException {
"""
Get group badge
@param groupId The id of the group for which the badge should be retrieved
@param badgeId The id of the badge that should be retrieved
@return The badge with a given id
@throws IOException on GitLab API call error
"""
String tailUrl = GitlabGroup.URL + "/" + groupId + GitlabBadge.URL
+ "/" + badgeId;
return retrieve().to(tailUrl, GitlabBadge.class);
} | java | public GitlabBadge getGroupBadge(Integer groupId, Integer badgeId) throws IOException {
String tailUrl = GitlabGroup.URL + "/" + groupId + GitlabBadge.URL
+ "/" + badgeId;
return retrieve().to(tailUrl, GitlabBadge.class);
} | [
"public",
"GitlabBadge",
"getGroupBadge",
"(",
"Integer",
"groupId",
",",
"Integer",
"badgeId",
")",
"throws",
"IOException",
"{",
"String",
"tailUrl",
"=",
"GitlabGroup",
".",
"URL",
"+",
"\"/\"",
"+",
"groupId",
"+",
"GitlabBadge",
".",
"URL",
"+",
"\"/\"",
... | Get group badge
@param groupId The id of the group for which the badge should be retrieved
@param badgeId The id of the badge that should be retrieved
@return The badge with a given id
@throws IOException on GitLab API call error | [
"Get",
"group",
"badge"
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L2695-L2699 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/RegistriesInner.java | RegistriesInner.beginUpdateAsync | public Observable<RegistryInner> beginUpdateAsync(String resourceGroupName, String registryName, RegistryUpdateParameters registryUpdateParameters) {
"""
Updates a container registry with the specified parameters.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param registryUpdateParameters The parameters for updating a container registry.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RegistryInner object
"""
return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, registryUpdateParameters).map(new Func1<ServiceResponse<RegistryInner>, RegistryInner>() {
@Override
public RegistryInner call(ServiceResponse<RegistryInner> response) {
return response.body();
}
});
} | java | public Observable<RegistryInner> beginUpdateAsync(String resourceGroupName, String registryName, RegistryUpdateParameters registryUpdateParameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, registryUpdateParameters).map(new Func1<ServiceResponse<RegistryInner>, RegistryInner>() {
@Override
public RegistryInner call(ServiceResponse<RegistryInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RegistryInner",
">",
"beginUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"RegistryUpdateParameters",
"registryUpdateParameters",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGrou... | Updates a container registry with the specified parameters.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param registryUpdateParameters The parameters for updating a container registry.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RegistryInner object | [
"Updates",
"a",
"container",
"registry",
"with",
"the",
"specified",
"parameters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/RegistriesInner.java#L744-L751 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java | SymmetryTools.getAngle | public static double getAngle(AFPChain afpChain, Atom[] ca1, Atom[] ca2) {
"""
Returns the <em>magnitude</em> of the angle between the first and second
blocks of {@code afpChain}, measured in degrees. This is always a
positive value (unsigned).
@param afpChain
@param ca1
@param ca2
@return
"""
Matrix rotation = afpChain.getBlockRotationMatrix()[0];
return Math.acos(rotation.trace() - 1) * 180 / Math.PI;
} | java | public static double getAngle(AFPChain afpChain, Atom[] ca1, Atom[] ca2) {
Matrix rotation = afpChain.getBlockRotationMatrix()[0];
return Math.acos(rotation.trace() - 1) * 180 / Math.PI;
} | [
"public",
"static",
"double",
"getAngle",
"(",
"AFPChain",
"afpChain",
",",
"Atom",
"[",
"]",
"ca1",
",",
"Atom",
"[",
"]",
"ca2",
")",
"{",
"Matrix",
"rotation",
"=",
"afpChain",
".",
"getBlockRotationMatrix",
"(",
")",
"[",
"0",
"]",
";",
"return",
"... | Returns the <em>magnitude</em> of the angle between the first and second
blocks of {@code afpChain}, measured in degrees. This is always a
positive value (unsigned).
@param afpChain
@param ca1
@param ca2
@return | [
"Returns",
"the",
"<em",
">",
"magnitude<",
"/",
"em",
">",
"of",
"the",
"angle",
"between",
"the",
"first",
"and",
"second",
"blocks",
"of",
"{",
"@code",
"afpChain",
"}",
"measured",
"in",
"degrees",
".",
"This",
"is",
"always",
"a",
"positive",
"value... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java#L424-L427 |
youseries/urule | urule-core/src/main/java/com/bstek/urule/runtime/KnowledgeSessionFactory.java | KnowledgeSessionFactory.newBatchSession | public static BatchSession newBatchSession(KnowledgePackage knowledgePackage,int threadSize,int batchSize) {
"""
创建一个用于批处理的BatchSession对象,第二个参数来指定线程池中可用线程个数,第三个参数用来决定单个线程处理的任务数
@param knowledgePackage 创建BatchSession对象所需要的KnowledgePackage对象
@param threadSize 线程池中可用的线程个数
@param batchSize 单个线程处理的任务数
@return 返回一个新的BatchSession对象
"""
return new BatchSessionImpl(knowledgePackage,threadSize,batchSize);
} | java | public static BatchSession newBatchSession(KnowledgePackage knowledgePackage,int threadSize,int batchSize){
return new BatchSessionImpl(knowledgePackage,threadSize,batchSize);
} | [
"public",
"static",
"BatchSession",
"newBatchSession",
"(",
"KnowledgePackage",
"knowledgePackage",
",",
"int",
"threadSize",
",",
"int",
"batchSize",
")",
"{",
"return",
"new",
"BatchSessionImpl",
"(",
"knowledgePackage",
",",
"threadSize",
",",
"batchSize",
")",
"... | 创建一个用于批处理的BatchSession对象,第二个参数来指定线程池中可用线程个数,第三个参数用来决定单个线程处理的任务数
@param knowledgePackage 创建BatchSession对象所需要的KnowledgePackage对象
@param threadSize 线程池中可用的线程个数
@param batchSize 单个线程处理的任务数
@return 返回一个新的BatchSession对象 | [
"创建一个用于批处理的BatchSession对象,第二个参数来指定线程池中可用线程个数,第三个参数用来决定单个线程处理的任务数"
] | train | https://github.com/youseries/urule/blob/3fa0eb4439e97aa292e744bcbd88a9faa36661d8/urule-core/src/main/java/com/bstek/urule/runtime/KnowledgeSessionFactory.java#L92-L94 |
m-m-m/util | cli/src/main/java/net/sf/mmm/util/cli/base/AbstractCliValueContainerContainer.java | AbstractCliValueContainerContainer.setValueInternal | protected void setValueInternal(String argument, char separator, GenericType<?> propertyType) {
"""
This method parses container value as from a single argument and sets it as new object.
@param argument is the argument representing the container as string.
@param separator is the character used as separator for the container values.
@param propertyType is the {@link GenericType} of the property.
"""
if (this.valueAlreadySet) {
CliOptionDuplicateException exception = new CliOptionDuplicateException(getParameterContainer().getName());
CliStyleHandling.EXCEPTION.handle(getLogger(), exception);
}
// TODO: separator currently ignored!
Object value = getDependencies().getConverter().convertValue(argument, getParameterContainer(),
propertyType.getAssignmentClass(), propertyType);
setValueInternal(value);
this.valueAlreadySet = true;
} | java | protected void setValueInternal(String argument, char separator, GenericType<?> propertyType) {
if (this.valueAlreadySet) {
CliOptionDuplicateException exception = new CliOptionDuplicateException(getParameterContainer().getName());
CliStyleHandling.EXCEPTION.handle(getLogger(), exception);
}
// TODO: separator currently ignored!
Object value = getDependencies().getConverter().convertValue(argument, getParameterContainer(),
propertyType.getAssignmentClass(), propertyType);
setValueInternal(value);
this.valueAlreadySet = true;
} | [
"protected",
"void",
"setValueInternal",
"(",
"String",
"argument",
",",
"char",
"separator",
",",
"GenericType",
"<",
"?",
">",
"propertyType",
")",
"{",
"if",
"(",
"this",
".",
"valueAlreadySet",
")",
"{",
"CliOptionDuplicateException",
"exception",
"=",
"new"... | This method parses container value as from a single argument and sets it as new object.
@param argument is the argument representing the container as string.
@param separator is the character used as separator for the container values.
@param propertyType is the {@link GenericType} of the property. | [
"This",
"method",
"parses",
"container",
"value",
"as",
"from",
"a",
"single",
"argument",
"and",
"sets",
"it",
"as",
"new",
"object",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/cli/src/main/java/net/sf/mmm/util/cli/base/AbstractCliValueContainerContainer.java#L69-L80 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassNameRewriterUtil.java | ClassNameRewriterUtil.convertMethodAnnotation | public static MethodAnnotation convertMethodAnnotation(ClassNameRewriter classNameRewriter, MethodAnnotation annotation) {
"""
Rewrite a MethodAnnotation to update the class name, and any class names
mentioned in the method signature.
@param classNameRewriter
a ClassNameRewriter
@param annotation
a MethodAnnotation
@return the possibly-rewritten MethodAnnotation
"""
if (classNameRewriter != IdentityClassNameRewriter.instance()) {
annotation = new MethodAnnotation(classNameRewriter.rewriteClassName(annotation.getClassName()),
annotation.getMethodName(), rewriteMethodSignature(classNameRewriter, annotation.getMethodSignature()),
annotation.isStatic());
}
return annotation;
} | java | public static MethodAnnotation convertMethodAnnotation(ClassNameRewriter classNameRewriter, MethodAnnotation annotation) {
if (classNameRewriter != IdentityClassNameRewriter.instance()) {
annotation = new MethodAnnotation(classNameRewriter.rewriteClassName(annotation.getClassName()),
annotation.getMethodName(), rewriteMethodSignature(classNameRewriter, annotation.getMethodSignature()),
annotation.isStatic());
}
return annotation;
} | [
"public",
"static",
"MethodAnnotation",
"convertMethodAnnotation",
"(",
"ClassNameRewriter",
"classNameRewriter",
",",
"MethodAnnotation",
"annotation",
")",
"{",
"if",
"(",
"classNameRewriter",
"!=",
"IdentityClassNameRewriter",
".",
"instance",
"(",
")",
")",
"{",
"an... | Rewrite a MethodAnnotation to update the class name, and any class names
mentioned in the method signature.
@param classNameRewriter
a ClassNameRewriter
@param annotation
a MethodAnnotation
@return the possibly-rewritten MethodAnnotation | [
"Rewrite",
"a",
"MethodAnnotation",
"to",
"update",
"the",
"class",
"name",
"and",
"any",
"class",
"names",
"mentioned",
"in",
"the",
"method",
"signature",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassNameRewriterUtil.java#L95-L103 |
jpaoletti/java-presentation-manager | modules/jpm-core/src/main/java/jpaoletti/jpm/util/Properties.java | Properties.getBool | public boolean getBool(String name, boolean def) {
"""
Returns the property assuming its a boolean. If it isn't or if its not
defined, returns default value.
@param name Property name
@param def Default value
@return Property value or def
"""
final String s = getProperty(name);
if (s == null) {
return def;
}
try {
return s != null && s.equalsIgnoreCase("true");
} catch (Exception e) {
return def;
}
} | java | public boolean getBool(String name, boolean def) {
final String s = getProperty(name);
if (s == null) {
return def;
}
try {
return s != null && s.equalsIgnoreCase("true");
} catch (Exception e) {
return def;
}
} | [
"public",
"boolean",
"getBool",
"(",
"String",
"name",
",",
"boolean",
"def",
")",
"{",
"final",
"String",
"s",
"=",
"getProperty",
"(",
"name",
")",
";",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"def",
";",
"}",
"try",
"{",
"return",
"s",... | Returns the property assuming its a boolean. If it isn't or if its not
defined, returns default value.
@param name Property name
@param def Default value
@return Property value or def | [
"Returns",
"the",
"property",
"assuming",
"its",
"a",
"boolean",
".",
"If",
"it",
"isn",
"t",
"or",
"if",
"its",
"not",
"defined",
"returns",
"default",
"value",
"."
] | train | https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/util/Properties.java#L66-L76 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/model/beans/Application.java | Application.replaceApplicationBindings | public boolean replaceApplicationBindings( String externalExportPrefix, Set<String> applicationNames ) {
"""
Replaces application bindings for a given prefix.
@param externalExportPrefix an external export prefix (not null)
@param applicationNames a non-null set of application names
@return true if bindings were modified, false otherwise
"""
// There is a change if the set do not have the same size or if they do not contain the same
// number of element. If no binding had been registered previously, then we only check whether
// the new set contains something.
boolean changed = false;
Set<String> oldApplicationNames = this.applicationBindings.remove( externalExportPrefix );
if( oldApplicationNames == null ) {
changed = ! applicationNames.isEmpty();
} else if( oldApplicationNames.size() != applicationNames.size()) {
changed = true;
} else {
oldApplicationNames.removeAll( applicationNames );
changed = ! oldApplicationNames.isEmpty();
}
// Do not register keys when there is no binding
if( ! applicationNames.isEmpty())
this.applicationBindings.put( externalExportPrefix, applicationNames );
return changed;
} | java | public boolean replaceApplicationBindings( String externalExportPrefix, Set<String> applicationNames ) {
// There is a change if the set do not have the same size or if they do not contain the same
// number of element. If no binding had been registered previously, then we only check whether
// the new set contains something.
boolean changed = false;
Set<String> oldApplicationNames = this.applicationBindings.remove( externalExportPrefix );
if( oldApplicationNames == null ) {
changed = ! applicationNames.isEmpty();
} else if( oldApplicationNames.size() != applicationNames.size()) {
changed = true;
} else {
oldApplicationNames.removeAll( applicationNames );
changed = ! oldApplicationNames.isEmpty();
}
// Do not register keys when there is no binding
if( ! applicationNames.isEmpty())
this.applicationBindings.put( externalExportPrefix, applicationNames );
return changed;
} | [
"public",
"boolean",
"replaceApplicationBindings",
"(",
"String",
"externalExportPrefix",
",",
"Set",
"<",
"String",
">",
"applicationNames",
")",
"{",
"// There is a change if the set do not have the same size or if they do not contain the same",
"// number of element. If no binding h... | Replaces application bindings for a given prefix.
@param externalExportPrefix an external export prefix (not null)
@param applicationNames a non-null set of application names
@return true if bindings were modified, false otherwise | [
"Replaces",
"application",
"bindings",
"for",
"a",
"given",
"prefix",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/beans/Application.java#L192-L215 |
TheHolyWaffle/League-of-Legends-XMPP-Chat-Library | src/main/java/com/github/theholywaffle/lolchatapi/wrapper/FriendGroup.java | FriendGroup.getFriends | public List<Friend> getFriends() {
"""
Gets a list of all Friends in this FriendGroup.
@return list of all Friends in this group
"""
final List<Friend> friends = new ArrayList<>();
for (final RosterEntry e : get().getEntries()) {
friends.add(new Friend(api, con, e));
}
return friends;
} | java | public List<Friend> getFriends() {
final List<Friend> friends = new ArrayList<>();
for (final RosterEntry e : get().getEntries()) {
friends.add(new Friend(api, con, e));
}
return friends;
} | [
"public",
"List",
"<",
"Friend",
">",
"getFriends",
"(",
")",
"{",
"final",
"List",
"<",
"Friend",
">",
"friends",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"RosterEntry",
"e",
":",
"get",
"(",
")",
".",
"getEntries",
"(",
... | Gets a list of all Friends in this FriendGroup.
@return list of all Friends in this group | [
"Gets",
"a",
"list",
"of",
"all",
"Friends",
"in",
"this",
"FriendGroup",
"."
] | train | https://github.com/TheHolyWaffle/League-of-Legends-XMPP-Chat-Library/blob/5e4d87d0c054ff2f6510545b0e9f838338695c70/src/main/java/com/github/theholywaffle/lolchatapi/wrapper/FriendGroup.java#L92-L98 |
sculptor/sculptor | sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java | JpaHelper.findProperty | public static Method findProperty(Class<?> clazz, String name) {
"""
tries to find a property method by name
@param clazz type
@param name name of the property
@return
"""
assert clazz != null;
assert name != null;
Class<?> entityClass = clazz;
while (entityClass != null) {
Method[] methods = (entityClass.isInterface() ? entityClass.getMethods() : entityClass.getDeclaredMethods());
for (Method method : methods) {
if (method.getName().equals("get"+ StringUtils.capitalize(name)) ||
method.getName().equals("is"+ StringUtils.capitalize(name))) {
return method;
}
}
entityClass = entityClass.getSuperclass();
}
return null;
} | java | public static Method findProperty(Class<?> clazz, String name) {
assert clazz != null;
assert name != null;
Class<?> entityClass = clazz;
while (entityClass != null) {
Method[] methods = (entityClass.isInterface() ? entityClass.getMethods() : entityClass.getDeclaredMethods());
for (Method method : methods) {
if (method.getName().equals("get"+ StringUtils.capitalize(name)) ||
method.getName().equals("is"+ StringUtils.capitalize(name))) {
return method;
}
}
entityClass = entityClass.getSuperclass();
}
return null;
} | [
"public",
"static",
"Method",
"findProperty",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"name",
")",
"{",
"assert",
"clazz",
"!=",
"null",
";",
"assert",
"name",
"!=",
"null",
";",
"Class",
"<",
"?",
">",
"entityClass",
"=",
"clazz",
";",
... | tries to find a property method by name
@param clazz type
@param name name of the property
@return | [
"tries",
"to",
"find",
"a",
"property",
"method",
"by",
"name"
] | train | https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java#L135-L150 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/glove/GloveWeightLookupTable.java | GloveWeightLookupTable.iterateSample | public double iterateSample(T w1, T w2, double score) {
"""
glove iteration
@param w1 the first word
@param w2 the second word
@param score the weight learned for the particular co occurrences
"""
INDArray w1Vector = syn0.slice(w1.getIndex());
INDArray w2Vector = syn0.slice(w2.getIndex());
//prediction: input + bias
if (w1.getIndex() < 0 || w1.getIndex() >= syn0.rows())
throw new IllegalArgumentException("Illegal index for word " + w1.getLabel());
if (w2.getIndex() < 0 || w2.getIndex() >= syn0.rows())
throw new IllegalArgumentException("Illegal index for word " + w2.getLabel());
//w1 * w2 + bias
double prediction = Nd4j.getBlasWrapper().dot(w1Vector, w2Vector);
prediction += bias.getDouble(w1.getIndex()) + bias.getDouble(w2.getIndex());
double weight = Math.pow(Math.min(1.0, (score / maxCount)), xMax);
double fDiff = score > xMax ? prediction : weight * (prediction - Math.log(score));
if (Double.isNaN(fDiff))
fDiff = Nd4j.EPS_THRESHOLD;
//amount of change
double gradient = fDiff;
//note the update step here: the gradient is
//the gradient of the OPPOSITE word
//for adagrad we will use the index of the word passed in
//for the gradient calculation we will use the context vector
update(w1, w1Vector, w2Vector, gradient);
update(w2, w2Vector, w1Vector, gradient);
return fDiff;
} | java | public double iterateSample(T w1, T w2, double score) {
INDArray w1Vector = syn0.slice(w1.getIndex());
INDArray w2Vector = syn0.slice(w2.getIndex());
//prediction: input + bias
if (w1.getIndex() < 0 || w1.getIndex() >= syn0.rows())
throw new IllegalArgumentException("Illegal index for word " + w1.getLabel());
if (w2.getIndex() < 0 || w2.getIndex() >= syn0.rows())
throw new IllegalArgumentException("Illegal index for word " + w2.getLabel());
//w1 * w2 + bias
double prediction = Nd4j.getBlasWrapper().dot(w1Vector, w2Vector);
prediction += bias.getDouble(w1.getIndex()) + bias.getDouble(w2.getIndex());
double weight = Math.pow(Math.min(1.0, (score / maxCount)), xMax);
double fDiff = score > xMax ? prediction : weight * (prediction - Math.log(score));
if (Double.isNaN(fDiff))
fDiff = Nd4j.EPS_THRESHOLD;
//amount of change
double gradient = fDiff;
//note the update step here: the gradient is
//the gradient of the OPPOSITE word
//for adagrad we will use the index of the word passed in
//for the gradient calculation we will use the context vector
update(w1, w1Vector, w2Vector, gradient);
update(w2, w2Vector, w1Vector, gradient);
return fDiff;
} | [
"public",
"double",
"iterateSample",
"(",
"T",
"w1",
",",
"T",
"w2",
",",
"double",
"score",
")",
"{",
"INDArray",
"w1Vector",
"=",
"syn0",
".",
"slice",
"(",
"w1",
".",
"getIndex",
"(",
")",
")",
";",
"INDArray",
"w2Vector",
"=",
"syn0",
".",
"slice... | glove iteration
@param w1 the first word
@param w2 the second word
@param score the weight learned for the particular co occurrences | [
"glove",
"iteration"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/glove/GloveWeightLookupTable.java#L105-L137 |
groupon/robo-remote | RoboRemoteClient/src/main/com/groupon/roboremote/roboremoteclient/components/ListView.java | ListView.scrollToIndex | public static int scrollToIndex(String listRef, int itemIndex) throws Exception {
"""
Scrolls the specified item index onto the screen and returns the offset based on the current visible list
@param listRef
@param itemIndex
@return
@throws Exception
"""
int listViewIndex = getListViewIndex(listRef);
if (itemIndex >= numItemsInList(listRef))
throw new Exception("Item index is greater than number of items in the list");
// scroll to the top of this view if we already passed the index being looked for
QueryBuilder builder = new QueryBuilder();
int firstVisiblePosition = builder.map("solo", "getCurrentViews", "android.widget.ListView").call("get", listViewIndex).call("getFirstVisiblePosition").execute().getInt(0);
if (firstVisiblePosition > itemIndex)
scrollToTop();
boolean scrollDown = true;
// need to get the wanted item onto the screen
while (true) {
builder = new QueryBuilder();
firstVisiblePosition = builder.map("solo", "getCurrentViews", "android.widget.ListView").call("get", listViewIndex).call("getFirstVisiblePosition").execute().getInt(0);
builder = new QueryBuilder();
int headersViewsCount = builder.map("solo", "getCurrentViews", "android.widget.ListView").call("get", listViewIndex).call("getHeaderViewsCount").execute().getInt(0);
firstVisiblePosition = firstVisiblePosition - headersViewsCount;
builder = new QueryBuilder();
int visibleChildCount = builder.map("solo", "getCurrentViews", "android.widget.ListView").call("get", listViewIndex).call("getChildCount").execute().getInt(0);
int wantedPosition = itemIndex - firstVisiblePosition;
if (wantedPosition >= visibleChildCount) {
// check to see if we can even scroll anymore
if (! scrollDown) {
break;
}
scrollDown = Solo.scrollDownList(listViewIndex);
} else {
// return the position
return wantedPosition;
}
}
throw new Exception("Could not find item");
} | java | public static int scrollToIndex(String listRef, int itemIndex) throws Exception {
int listViewIndex = getListViewIndex(listRef);
if (itemIndex >= numItemsInList(listRef))
throw new Exception("Item index is greater than number of items in the list");
// scroll to the top of this view if we already passed the index being looked for
QueryBuilder builder = new QueryBuilder();
int firstVisiblePosition = builder.map("solo", "getCurrentViews", "android.widget.ListView").call("get", listViewIndex).call("getFirstVisiblePosition").execute().getInt(0);
if (firstVisiblePosition > itemIndex)
scrollToTop();
boolean scrollDown = true;
// need to get the wanted item onto the screen
while (true) {
builder = new QueryBuilder();
firstVisiblePosition = builder.map("solo", "getCurrentViews", "android.widget.ListView").call("get", listViewIndex).call("getFirstVisiblePosition").execute().getInt(0);
builder = new QueryBuilder();
int headersViewsCount = builder.map("solo", "getCurrentViews", "android.widget.ListView").call("get", listViewIndex).call("getHeaderViewsCount").execute().getInt(0);
firstVisiblePosition = firstVisiblePosition - headersViewsCount;
builder = new QueryBuilder();
int visibleChildCount = builder.map("solo", "getCurrentViews", "android.widget.ListView").call("get", listViewIndex).call("getChildCount").execute().getInt(0);
int wantedPosition = itemIndex - firstVisiblePosition;
if (wantedPosition >= visibleChildCount) {
// check to see if we can even scroll anymore
if (! scrollDown) {
break;
}
scrollDown = Solo.scrollDownList(listViewIndex);
} else {
// return the position
return wantedPosition;
}
}
throw new Exception("Could not find item");
} | [
"public",
"static",
"int",
"scrollToIndex",
"(",
"String",
"listRef",
",",
"int",
"itemIndex",
")",
"throws",
"Exception",
"{",
"int",
"listViewIndex",
"=",
"getListViewIndex",
"(",
"listRef",
")",
";",
"if",
"(",
"itemIndex",
">=",
"numItemsInList",
"(",
"lis... | Scrolls the specified item index onto the screen and returns the offset based on the current visible list
@param listRef
@param itemIndex
@return
@throws Exception | [
"Scrolls",
"the",
"specified",
"item",
"index",
"onto",
"the",
"screen",
"and",
"returns",
"the",
"offset",
"based",
"on",
"the",
"current",
"visible",
"list"
] | train | https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteClient/src/main/com/groupon/roboremote/roboremoteclient/components/ListView.java#L93-L135 |
groupon/odo | proxylib/src/main/java/com/groupon/odo/proxylib/EditService.java | EditService.makeAllRepeatUnlimited | public void makeAllRepeatUnlimited(int profileId, String client_uuid) {
"""
Set all repeat counts to unlimited (-1) for a client
@param profileId profile ID of the client
@param client_uuid UUID of the client
"""
PreparedStatement statement = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStatement(
"UPDATE " + Constants.DB_TABLE_REQUEST_RESPONSE +
" SET " + Constants.REQUEST_RESPONSE_REPEAT_NUMBER + " = ?" +
" WHERE " + Constants.GENERIC_PROFILE_ID + " = ?" +
" AND " + Constants.GENERIC_CLIENT_UUID + " = ?"
);
statement.setInt(1, -1);
statement.setInt(2, profileId);
statement.setString(3, client_uuid);
statement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (statement != null) {
statement.close();
}
} catch (Exception e) {
}
}
} | java | public void makeAllRepeatUnlimited(int profileId, String client_uuid) {
PreparedStatement statement = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStatement(
"UPDATE " + Constants.DB_TABLE_REQUEST_RESPONSE +
" SET " + Constants.REQUEST_RESPONSE_REPEAT_NUMBER + " = ?" +
" WHERE " + Constants.GENERIC_PROFILE_ID + " = ?" +
" AND " + Constants.GENERIC_CLIENT_UUID + " = ?"
);
statement.setInt(1, -1);
statement.setInt(2, profileId);
statement.setString(3, client_uuid);
statement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (statement != null) {
statement.close();
}
} catch (Exception e) {
}
}
} | [
"public",
"void",
"makeAllRepeatUnlimited",
"(",
"int",
"profileId",
",",
"String",
"client_uuid",
")",
"{",
"PreparedStatement",
"statement",
"=",
"null",
";",
"try",
"(",
"Connection",
"sqlConnection",
"=",
"sqlService",
".",
"getConnection",
"(",
")",
")",
"{... | Set all repeat counts to unlimited (-1) for a client
@param profileId profile ID of the client
@param client_uuid UUID of the client | [
"Set",
"all",
"repeat",
"counts",
"to",
"unlimited",
"(",
"-",
"1",
")",
"for",
"a",
"client"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/EditService.java#L76-L100 |
netty/netty | common/src/main/java/io/netty/util/internal/StringUtil.java | StringUtil.toHexStringPadded | public static <T extends Appendable> T toHexStringPadded(T dst, byte[] src, int offset, int length) {
"""
Converts the specified byte array into a hexadecimal value and appends it to the specified buffer.
"""
final int end = offset + length;
for (int i = offset; i < end; i++) {
byteToHexStringPadded(dst, src[i]);
}
return dst;
} | java | public static <T extends Appendable> T toHexStringPadded(T dst, byte[] src, int offset, int length) {
final int end = offset + length;
for (int i = offset; i < end; i++) {
byteToHexStringPadded(dst, src[i]);
}
return dst;
} | [
"public",
"static",
"<",
"T",
"extends",
"Appendable",
">",
"T",
"toHexStringPadded",
"(",
"T",
"dst",
",",
"byte",
"[",
"]",
"src",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"final",
"int",
"end",
"=",
"offset",
"+",
"length",
";",
"for"... | Converts the specified byte array into a hexadecimal value and appends it to the specified buffer. | [
"Converts",
"the",
"specified",
"byte",
"array",
"into",
"a",
"hexadecimal",
"value",
"and",
"appends",
"it",
"to",
"the",
"specified",
"buffer",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L130-L136 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.