repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
netarchivesuite/heritrix3-wrapper | src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java | Heritrix3Wrapper.copyJob | public JobResult copyJob(String srcJobname, String dstJobName, boolean bAsProfile) {
HttpPost postRequest = new HttpPost(baseUrl + "job/" + srcJobname);
List<NameValuePair> nvp = new LinkedList<NameValuePair>();
nvp.add(new BasicNameValuePair("copyTo", dstJobName));
if (bAsProfile) {
nvp.add(new BasicNameValuePair("asProfile", "on"));
}
StringEntity postEntity = null;
try {
postEntity = new UrlEncodedFormEntity(nvp);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
postEntity.setContentType("application/x-www-form-urlencoded");
postRequest.addHeader("Accept", "application/xml");
postRequest.setEntity(postEntity);
return jobResult(postRequest);
} | java | public JobResult copyJob(String srcJobname, String dstJobName, boolean bAsProfile) {
HttpPost postRequest = new HttpPost(baseUrl + "job/" + srcJobname);
List<NameValuePair> nvp = new LinkedList<NameValuePair>();
nvp.add(new BasicNameValuePair("copyTo", dstJobName));
if (bAsProfile) {
nvp.add(new BasicNameValuePair("asProfile", "on"));
}
StringEntity postEntity = null;
try {
postEntity = new UrlEncodedFormEntity(nvp);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
postEntity.setContentType("application/x-www-form-urlencoded");
postRequest.addHeader("Accept", "application/xml");
postRequest.setEntity(postEntity);
return jobResult(postRequest);
} | [
"public",
"JobResult",
"copyJob",
"(",
"String",
"srcJobname",
",",
"String",
"dstJobName",
",",
"boolean",
"bAsProfile",
")",
"{",
"HttpPost",
"postRequest",
"=",
"new",
"HttpPost",
"(",
"baseUrl",
"+",
"\"job/\"",
"+",
"srcJobname",
")",
";",
"List",
"<",
... | Copy a job.
@param srcJobname source job name
@param dstJobName destination job name
@param bAsProfile define if the job should be copied as a profile or not
@return job state of new job | [
"Copy",
"a",
"job",
"."
] | train | https://github.com/netarchivesuite/heritrix3-wrapper/blob/e53ec5736cbac0bdd3925b5331737dc905871629/src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java#L503-L520 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/sequences/FactoredSequenceListener.java | FactoredSequenceListener.updateSequenceElement | public void updateSequenceElement(int[] sequence, int pos, int oldVal) {
if(models != null){
for(int i = 0; i < models.length; i++)
models[i].updateSequenceElement(sequence, pos, oldVal);
return;
}
model1.updateSequenceElement(sequence, pos, 0);
model2.updateSequenceElement(sequence, pos, 0);
} | java | public void updateSequenceElement(int[] sequence, int pos, int oldVal) {
if(models != null){
for(int i = 0; i < models.length; i++)
models[i].updateSequenceElement(sequence, pos, oldVal);
return;
}
model1.updateSequenceElement(sequence, pos, 0);
model2.updateSequenceElement(sequence, pos, 0);
} | [
"public",
"void",
"updateSequenceElement",
"(",
"int",
"[",
"]",
"sequence",
",",
"int",
"pos",
",",
"int",
"oldVal",
")",
"{",
"if",
"(",
"models",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"models",
".",
"length",
... | Informs this sequence model that the value of the element at position pos has changed.
This allows this sequence model to update its internal model if desired. | [
"Informs",
"this",
"sequence",
"model",
"that",
"the",
"value",
"of",
"the",
"element",
"at",
"position",
"pos",
"has",
"changed",
".",
"This",
"allows",
"this",
"sequence",
"model",
"to",
"update",
"its",
"internal",
"model",
"if",
"desired",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/sequences/FactoredSequenceListener.java#L18-L26 |
scaleset/scaleset-geo | src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java | GoogleMapsTileMath.tileTopLeft | public Coordinate tileTopLeft(int tx, int ty, int zoomLevel) {
int px = tx * tileSize;
int py = ty * tileSize;
Coordinate result = pixelsToMeters(px, py, zoomLevel);
return result;
} | java | public Coordinate tileTopLeft(int tx, int ty, int zoomLevel) {
int px = tx * tileSize;
int py = ty * tileSize;
Coordinate result = pixelsToMeters(px, py, zoomLevel);
return result;
} | [
"public",
"Coordinate",
"tileTopLeft",
"(",
"int",
"tx",
",",
"int",
"ty",
",",
"int",
"zoomLevel",
")",
"{",
"int",
"px",
"=",
"tx",
"*",
"tileSize",
";",
"int",
"py",
"=",
"ty",
"*",
"tileSize",
";",
"Coordinate",
"result",
"=",
"pixelsToMeters",
"("... | Returns the top-left corner of the specific tile coordinate
@param tx The tile x coordinate
@param ty The tile y coordinate
@param zoomLevel The tile zoom level
@return The EPSG:3857 coordinate of the top-left corner | [
"Returns",
"the",
"top",
"-",
"left",
"corner",
"of",
"the",
"specific",
"tile",
"coordinate"
] | train | https://github.com/scaleset/scaleset-geo/blob/5cff2349668037dc287928a6c1a1f67c76d96b02/src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java#L316-L321 |
hortonworks/dstream | dstream-tez/src/main/java/io/dstream/tez/utils/HadoopUtils.java | HadoopUtils.provisionResourceToFs | public static Path provisionResourceToFs(File localResource, FileSystem fs, String applicationName) throws Exception {
String destinationFilePath = applicationName + "/" + localResource.getName();
Path provisionedPath = new Path(fs.getHomeDirectory(), destinationFilePath);
provisioinResourceToFs(fs, new Path(localResource.getAbsolutePath()), provisionedPath);
return provisionedPath;
} | java | public static Path provisionResourceToFs(File localResource, FileSystem fs, String applicationName) throws Exception {
String destinationFilePath = applicationName + "/" + localResource.getName();
Path provisionedPath = new Path(fs.getHomeDirectory(), destinationFilePath);
provisioinResourceToFs(fs, new Path(localResource.getAbsolutePath()), provisionedPath);
return provisionedPath;
} | [
"public",
"static",
"Path",
"provisionResourceToFs",
"(",
"File",
"localResource",
",",
"FileSystem",
"fs",
",",
"String",
"applicationName",
")",
"throws",
"Exception",
"{",
"String",
"destinationFilePath",
"=",
"applicationName",
"+",
"\"/\"",
"+",
"localResource",
... | Provisions resource represented as {@link File} to the {@link FileSystem} for a given application
@param localResource
@param fs
@param applicationName
@return | [
"Provisions",
"resource",
"represented",
"as",
"{",
"@link",
"File",
"}",
"to",
"the",
"{",
"@link",
"FileSystem",
"}",
"for",
"a",
"given",
"application"
] | train | https://github.com/hortonworks/dstream/blob/3a106c0f14725b028fe7fe2dbc660406d9a5f142/dstream-tez/src/main/java/io/dstream/tez/utils/HadoopUtils.java#L84-L89 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WImageRenderer.java | WImageRenderer.renderTagOpen | protected static void renderTagOpen(final WImage imageComponent, final XmlStringBuilder xml) {
// Check for alternative text on the image
String alternativeText = imageComponent.getAlternativeText();
if (alternativeText == null) {
alternativeText = "";
} else {
alternativeText = I18nUtilities.format(null, alternativeText);
}
xml.appendTagOpen("img");
xml.appendAttribute("id", imageComponent.getId());
xml.appendOptionalAttribute("class", imageComponent.getHtmlClass());
xml.appendOptionalAttribute("track", imageComponent.isTracking(), "true");
xml.appendUrlAttribute("src", imageComponent.getTargetUrl());
xml.appendAttribute("alt", alternativeText);
xml.appendOptionalAttribute("hidden", imageComponent.isHidden(), "hidden");
// Check for size information on the image
Dimension size = imageComponent.getSize();
if (size != null) {
if (size.getHeight() >= 0) {
xml.appendAttribute("height", size.height);
}
if (size.getWidth() >= 0) {
xml.appendAttribute("width", size.width);
}
}
} | java | protected static void renderTagOpen(final WImage imageComponent, final XmlStringBuilder xml) {
// Check for alternative text on the image
String alternativeText = imageComponent.getAlternativeText();
if (alternativeText == null) {
alternativeText = "";
} else {
alternativeText = I18nUtilities.format(null, alternativeText);
}
xml.appendTagOpen("img");
xml.appendAttribute("id", imageComponent.getId());
xml.appendOptionalAttribute("class", imageComponent.getHtmlClass());
xml.appendOptionalAttribute("track", imageComponent.isTracking(), "true");
xml.appendUrlAttribute("src", imageComponent.getTargetUrl());
xml.appendAttribute("alt", alternativeText);
xml.appendOptionalAttribute("hidden", imageComponent.isHidden(), "hidden");
// Check for size information on the image
Dimension size = imageComponent.getSize();
if (size != null) {
if (size.getHeight() >= 0) {
xml.appendAttribute("height", size.height);
}
if (size.getWidth() >= 0) {
xml.appendAttribute("width", size.width);
}
}
} | [
"protected",
"static",
"void",
"renderTagOpen",
"(",
"final",
"WImage",
"imageComponent",
",",
"final",
"XmlStringBuilder",
"xml",
")",
"{",
"// Check for alternative text on the image",
"String",
"alternativeText",
"=",
"imageComponent",
".",
"getAlternativeText",
"(",
"... | Builds the "open tag" part of the XML, that is the tagname and attributes.
E.g. <ui:image src="example.png" alt="some alt txt"
The caller may then append any additional attributes and then close the XML tag.
@param imageComponent The WImage to render.
@param xml The buffer to render the XML into. | [
"Builds",
"the",
"open",
"tag",
"part",
"of",
"the",
"XML",
"that",
"is",
"the",
"tagname",
"and",
"attributes",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WImageRenderer.java#L28-L57 |
bazaarvoice/emodb | web/src/main/java/com/bazaarvoice/emodb/web/scanner/ScanUploader.java | ScanUploader.createPlan | private ScanPlan createPlan(String scanId, ScanOptions options) {
ScanPlan plan = new ScanPlan(scanId, options);
for (String placement : options.getPlacements()) {
String cluster = _dataTools.getPlacementCluster(placement);
ScanRangeSplits scanRangeSplits = _dataTools.getScanRangeSplits(placement, options.getRangeScanSplitSize(), Optional.<ScanRange>absent());
if (!options.isScanByAZ()) {
// Optionally we can reduce load across the ring by limiting scans AZ at a time. However, the caller
// has requested to scan all token ranges as quickly as possible, so collapse all token ranges into a
// single group.
scanRangeSplits = scanRangeSplits.combineGroups();
}
for (ScanRangeSplits.SplitGroup splitGroup : scanRangeSplits.getSplitGroups()) {
// Start a new batch, indicating the subsequent token ranges can be scanned in parallel
plan.startNewBatchForCluster(cluster);
// Add the scan ranges associated with each token range in the split group to the batch
for (ScanRangeSplits.TokenRange tokenRange : splitGroup.getTokenRanges()) {
plan.addTokenRangeToCurrentBatchForCluster(cluster, placement, tokenRange.getScanRanges());
}
}
}
return plan;
} | java | private ScanPlan createPlan(String scanId, ScanOptions options) {
ScanPlan plan = new ScanPlan(scanId, options);
for (String placement : options.getPlacements()) {
String cluster = _dataTools.getPlacementCluster(placement);
ScanRangeSplits scanRangeSplits = _dataTools.getScanRangeSplits(placement, options.getRangeScanSplitSize(), Optional.<ScanRange>absent());
if (!options.isScanByAZ()) {
// Optionally we can reduce load across the ring by limiting scans AZ at a time. However, the caller
// has requested to scan all token ranges as quickly as possible, so collapse all token ranges into a
// single group.
scanRangeSplits = scanRangeSplits.combineGroups();
}
for (ScanRangeSplits.SplitGroup splitGroup : scanRangeSplits.getSplitGroups()) {
// Start a new batch, indicating the subsequent token ranges can be scanned in parallel
plan.startNewBatchForCluster(cluster);
// Add the scan ranges associated with each token range in the split group to the batch
for (ScanRangeSplits.TokenRange tokenRange : splitGroup.getTokenRanges()) {
plan.addTokenRangeToCurrentBatchForCluster(cluster, placement, tokenRange.getScanRanges());
}
}
}
return plan;
} | [
"private",
"ScanPlan",
"createPlan",
"(",
"String",
"scanId",
",",
"ScanOptions",
"options",
")",
"{",
"ScanPlan",
"plan",
"=",
"new",
"ScanPlan",
"(",
"scanId",
",",
"options",
")",
";",
"for",
"(",
"String",
"placement",
":",
"options",
".",
"getPlacements... | Returns a ScanPlan based on the Cassandra rings and token ranges. | [
"Returns",
"a",
"ScanPlan",
"based",
"on",
"the",
"Cassandra",
"rings",
"and",
"token",
"ranges",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/scanner/ScanUploader.java#L134-L159 |
btrplace/scheduler | api/src/main/java/org/btrplace/model/view/network/Routing.java | Routing.getMaxBW | public int getMaxBW(Node n1, Node n2) {
int max = Integer.MAX_VALUE;
for (Link inf : getPath(n1, n2)) {
if (inf.getCapacity() < max) {
max = inf.getCapacity();
}
Switch sw = inf.getSwitch();
if (sw.getCapacity() >= 0 && sw.getCapacity() < max) {
//The >= 0 stays for historical reasons
max = sw.getCapacity();
}
}
return max;
} | java | public int getMaxBW(Node n1, Node n2) {
int max = Integer.MAX_VALUE;
for (Link inf : getPath(n1, n2)) {
if (inf.getCapacity() < max) {
max = inf.getCapacity();
}
Switch sw = inf.getSwitch();
if (sw.getCapacity() >= 0 && sw.getCapacity() < max) {
//The >= 0 stays for historical reasons
max = sw.getCapacity();
}
}
return max;
} | [
"public",
"int",
"getMaxBW",
"(",
"Node",
"n1",
",",
"Node",
"n2",
")",
"{",
"int",
"max",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"for",
"(",
"Link",
"inf",
":",
"getPath",
"(",
"n1",
",",
"n2",
")",
")",
"{",
"if",
"(",
"inf",
".",
"getCapacity"... | Get the maximal bandwidth available between two nodes.
@param n1 the source node
@param n2 the destination node
@return the bandwidth | [
"Get",
"the",
"maximal",
"bandwidth",
"available",
"between",
"two",
"nodes",
"."
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/view/network/Routing.java#L89-L103 |
heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.getSlugInfo | public Slug getSlugInfo(String appName, String slugId) {
return connection.execute(new SlugInfo(appName, slugId), apiKey);
} | java | public Slug getSlugInfo(String appName, String slugId) {
return connection.execute(new SlugInfo(appName, slugId), apiKey);
} | [
"public",
"Slug",
"getSlugInfo",
"(",
"String",
"appName",
",",
"String",
"slugId",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"SlugInfo",
"(",
"appName",
",",
"slugId",
")",
",",
"apiKey",
")",
";",
"}"
] | Gets the slug info for an existing slug
@param appName See {@link #listApps} for a list of apps that can be used.
@param slugId the unique identifier of the slug | [
"Gets",
"the",
"slug",
"info",
"for",
"an",
"existing",
"slug"
] | train | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L423-L425 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_changeOrg_POST | public OvhIpTask ip_changeOrg_POST(String ip, String organisation) throws IOException {
String qPath = "/ip/{ip}/changeOrg";
StringBuilder sb = path(qPath, ip);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "organisation", organisation);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhIpTask.class);
} | java | public OvhIpTask ip_changeOrg_POST(String ip, String organisation) throws IOException {
String qPath = "/ip/{ip}/changeOrg";
StringBuilder sb = path(qPath, ip);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "organisation", organisation);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhIpTask.class);
} | [
"public",
"OvhIpTask",
"ip_changeOrg_POST",
"(",
"String",
"ip",
",",
"String",
"organisation",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/changeOrg\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"ip",
")",
";",
"Ha... | Change organisation of this IP
REST: POST /ip/{ip}/changeOrg
@param organisation [required] Your organisation id (RIPE_XXXX) to add on block informations
@param ip [required] | [
"Change",
"organisation",
"of",
"this",
"IP"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L811-L818 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.getImageRegionProposalsAsync | public Observable<ImageRegionProposal> getImageRegionProposalsAsync(UUID projectId, UUID imageId) {
return getImageRegionProposalsWithServiceResponseAsync(projectId, imageId).map(new Func1<ServiceResponse<ImageRegionProposal>, ImageRegionProposal>() {
@Override
public ImageRegionProposal call(ServiceResponse<ImageRegionProposal> response) {
return response.body();
}
});
} | java | public Observable<ImageRegionProposal> getImageRegionProposalsAsync(UUID projectId, UUID imageId) {
return getImageRegionProposalsWithServiceResponseAsync(projectId, imageId).map(new Func1<ServiceResponse<ImageRegionProposal>, ImageRegionProposal>() {
@Override
public ImageRegionProposal call(ServiceResponse<ImageRegionProposal> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImageRegionProposal",
">",
"getImageRegionProposalsAsync",
"(",
"UUID",
"projectId",
",",
"UUID",
"imageId",
")",
"{",
"return",
"getImageRegionProposalsWithServiceResponseAsync",
"(",
"projectId",
",",
"imageId",
")",
".",
"map",
"(",
"n... | Get region proposals for an image. Returns empty array if no proposals are found.
This API will get region proposals for an image along with confidences for the region. It returns an empty array if no proposals are found.
@param projectId The project id
@param imageId The image id
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageRegionProposal object | [
"Get",
"region",
"proposals",
"for",
"an",
"image",
".",
"Returns",
"empty",
"array",
"if",
"no",
"proposals",
"are",
"found",
".",
"This",
"API",
"will",
"get",
"region",
"proposals",
"for",
"an",
"image",
"along",
"with",
"confidences",
"for",
"the",
"re... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L3199-L3206 |
Swagger2Markup/swagger2markup | src/main/java/io/github/swagger2markup/internal/component/PathOperationComponent.java | PathOperationComponent.buildOperationTitle | private void buildOperationTitle(MarkupDocBuilder markupDocBuilder, String title, String anchor) {
if (config.getPathsGroupedBy() == GroupBy.AS_IS) {
markupDocBuilder.sectionTitleWithAnchorLevel2(title, anchor);
} else {
markupDocBuilder.sectionTitleWithAnchorLevel3(title, anchor);
}
} | java | private void buildOperationTitle(MarkupDocBuilder markupDocBuilder, String title, String anchor) {
if (config.getPathsGroupedBy() == GroupBy.AS_IS) {
markupDocBuilder.sectionTitleWithAnchorLevel2(title, anchor);
} else {
markupDocBuilder.sectionTitleWithAnchorLevel3(title, anchor);
}
} | [
"private",
"void",
"buildOperationTitle",
"(",
"MarkupDocBuilder",
"markupDocBuilder",
",",
"String",
"title",
",",
"String",
"anchor",
")",
"{",
"if",
"(",
"config",
".",
"getPathsGroupedBy",
"(",
")",
"==",
"GroupBy",
".",
"AS_IS",
")",
"{",
"markupDocBuilder"... | Adds a operation title to the document.
@param title the operation title
@param anchor optional anchor (null => auto-generate from title) | [
"Adds",
"a",
"operation",
"title",
"to",
"the",
"document",
"."
] | train | https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/component/PathOperationComponent.java#L148-L154 |
fcrepo3/fcrepo | fcrepo-common/src/main/java/org/fcrepo/utilities/xml/XercesXmlSerializers.java | XercesXmlSerializers.writeConsoleNoDocType | public static void writeConsoleNoDocType(Document ele, Writer out)
throws IOException {
XMLSerializer serializer =
new XMLSerializer(out, CONSOLE_NO_DOCTYPE);
serializer.serialize(ele);
} | java | public static void writeConsoleNoDocType(Document ele, Writer out)
throws IOException {
XMLSerializer serializer =
new XMLSerializer(out, CONSOLE_NO_DOCTYPE);
serializer.serialize(ele);
} | [
"public",
"static",
"void",
"writeConsoleNoDocType",
"(",
"Document",
"ele",
",",
"Writer",
"out",
")",
"throws",
"IOException",
"{",
"XMLSerializer",
"serializer",
"=",
"new",
"XMLSerializer",
"(",
"out",
",",
"CONSOLE_NO_DOCTYPE",
")",
";",
"serializer",
".",
... | method: "XML"
charset: "UTF-8"
indenting: TRUE
indent-width: 2
line-width: 80
preserve-space: FALSE
omit-XML-declaration: FALSE
omit-DOCTYPE: TRUE
@param ele
@param out
@throws IOException | [
"method",
":",
"XML",
"charset",
":",
"UTF",
"-",
"8",
"indenting",
":",
"TRUE",
"indent",
"-",
"width",
":",
"2",
"line",
"-",
"width",
":",
"80",
"preserve",
"-",
"space",
":",
"FALSE",
"omit",
"-",
"XML",
"-",
"declaration",
":",
"FALSE",
"omit",
... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/utilities/xml/XercesXmlSerializers.java#L52-L57 |
seedstack/i18n-addon | core/src/main/java/org/seedstack/i18n/internal/domain/model/key/Key.java | Key.addTranslation | public Translation addTranslation(String locale, String value, boolean isApproximate) {
LocaleCodeSpecification.assertCode(locale);
if (isBlank(value)) {
throw new IllegalArgumentException("The translation can't be blank");
}
Translation translation = createOrUpdateTranslation(locale, value, isApproximate);
checkOutdatedStatus();
return translation;
} | java | public Translation addTranslation(String locale, String value, boolean isApproximate) {
LocaleCodeSpecification.assertCode(locale);
if (isBlank(value)) {
throw new IllegalArgumentException("The translation can't be blank");
}
Translation translation = createOrUpdateTranslation(locale, value, isApproximate);
checkOutdatedStatus();
return translation;
} | [
"public",
"Translation",
"addTranslation",
"(",
"String",
"locale",
",",
"String",
"value",
",",
"boolean",
"isApproximate",
")",
"{",
"LocaleCodeSpecification",
".",
"assertCode",
"(",
"locale",
")",
";",
"if",
"(",
"isBlank",
"(",
"value",
")",
")",
"{",
"... | Saves or updates the translation for the specified locale.
If the key was outdated, checks if the key is still outdated.
@param locale specified the translation locale
@param value translation value
@param isApproximate true if the translation is not exact.
@return the new translation
@throws java.lang.IllegalArgumentException if the locale is null or empty
or contains other characters than letters and "-". | [
"Saves",
"or",
"updates",
"the",
"translation",
"for",
"the",
"specified",
"locale",
".",
"If",
"the",
"key",
"was",
"outdated",
"checks",
"if",
"the",
"key",
"is",
"still",
"outdated",
"."
] | train | https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/core/src/main/java/org/seedstack/i18n/internal/domain/model/key/Key.java#L85-L93 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/core/encoding/ConvertNV21.java | ConvertNV21.nv21ToInterleaved | public static InterleavedF32 nv21ToInterleaved( byte[] data , int width , int height ,
InterleavedF32 output ) {
if( output == null ) {
output = new InterleavedF32(width,height,3);
} else {
output.reshape(width, height, 3);
}
if(BoofConcurrency.USE_CONCURRENT ) {
ImplConvertNV21_MT.nv21ToInterleaved_F32(data, output);
} else {
ImplConvertNV21.nv21ToInterleaved_F32(data, output);
}
return output;
} | java | public static InterleavedF32 nv21ToInterleaved( byte[] data , int width , int height ,
InterleavedF32 output ) {
if( output == null ) {
output = new InterleavedF32(width,height,3);
} else {
output.reshape(width, height, 3);
}
if(BoofConcurrency.USE_CONCURRENT ) {
ImplConvertNV21_MT.nv21ToInterleaved_F32(data, output);
} else {
ImplConvertNV21.nv21ToInterleaved_F32(data, output);
}
return output;
} | [
"public",
"static",
"InterleavedF32",
"nv21ToInterleaved",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"width",
",",
"int",
"height",
",",
"InterleavedF32",
"output",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"output",
"=",
"new",
"InterleavedF... | Converts an NV21 image into a {@link InterleavedF32} RGB image.
@param data Input: NV21 image data
@param width Input: NV21 image width
@param height Input: NV21 image height
@param output Output: Optional storage for output image. Can be null. | [
"Converts",
"an",
"NV21",
"image",
"into",
"a",
"{",
"@link",
"InterleavedF32",
"}",
"RGB",
"image",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/core/encoding/ConvertNV21.java#L305-L320 |
nominanuda/zen-project | zen-webservice/src/main/java/com/nominanuda/web/http/HttpCoreHelper.java | HttpCoreHelper.createClient | public HttpClient createClient(int maxConnPerRoute, int connTimeoutMillis, int soTimeoutMillis, @Nullable String proxyHostAnPort) {
Registry<ConnectionSocketFactory> defaultRegistry = RegistryBuilder
.<ConnectionSocketFactory> create()
.register("http", PlainConnectionSocketFactory.getSocketFactory())
.register("https", SSLConnectionSocketFactory.getSocketFactory())
.build();
PoolingHttpClientConnectionManager connMgr = new PoolingHttpClientConnectionManager(defaultRegistry);
connMgr.setDefaultMaxPerRoute(maxConnPerRoute);
RequestConfig rCfg = RequestConfig.custom()
.setConnectTimeout(connTimeoutMillis)
.setSocketTimeout(soTimeoutMillis)
.build();
HttpClientBuilder hcb = HttpClientBuilder.create()
.setConnectionManager(connMgr)
.setDefaultRequestConfig(rCfg);
if (proxyHostAnPort == null) {
// do something?
} else if("jvm".equalsIgnoreCase(proxyHostAnPort)) {
SystemDefaultRoutePlanner rp = new SystemDefaultRoutePlanner(ProxySelector.getDefault());
hcb.setRoutePlanner(rp);
} else {
String[] hostAndPort = proxyHostAnPort.split(":");
Check.illegalargument.assertTrue(hostAndPort.length < 3, "wrong hostAndPort:"+proxyHostAnPort);
String host = hostAndPort[0];
int port = 80;
if (hostAndPort.length > 1) {
port = Integer.valueOf(hostAndPort[1]);
}
HttpHost proxy = new HttpHost(host, port);
hcb.setProxy(proxy);
}
HttpClient httpClient = hcb.build();
return httpClient;
} | java | public HttpClient createClient(int maxConnPerRoute, int connTimeoutMillis, int soTimeoutMillis, @Nullable String proxyHostAnPort) {
Registry<ConnectionSocketFactory> defaultRegistry = RegistryBuilder
.<ConnectionSocketFactory> create()
.register("http", PlainConnectionSocketFactory.getSocketFactory())
.register("https", SSLConnectionSocketFactory.getSocketFactory())
.build();
PoolingHttpClientConnectionManager connMgr = new PoolingHttpClientConnectionManager(defaultRegistry);
connMgr.setDefaultMaxPerRoute(maxConnPerRoute);
RequestConfig rCfg = RequestConfig.custom()
.setConnectTimeout(connTimeoutMillis)
.setSocketTimeout(soTimeoutMillis)
.build();
HttpClientBuilder hcb = HttpClientBuilder.create()
.setConnectionManager(connMgr)
.setDefaultRequestConfig(rCfg);
if (proxyHostAnPort == null) {
// do something?
} else if("jvm".equalsIgnoreCase(proxyHostAnPort)) {
SystemDefaultRoutePlanner rp = new SystemDefaultRoutePlanner(ProxySelector.getDefault());
hcb.setRoutePlanner(rp);
} else {
String[] hostAndPort = proxyHostAnPort.split(":");
Check.illegalargument.assertTrue(hostAndPort.length < 3, "wrong hostAndPort:"+proxyHostAnPort);
String host = hostAndPort[0];
int port = 80;
if (hostAndPort.length > 1) {
port = Integer.valueOf(hostAndPort[1]);
}
HttpHost proxy = new HttpHost(host, port);
hcb.setProxy(proxy);
}
HttpClient httpClient = hcb.build();
return httpClient;
} | [
"public",
"HttpClient",
"createClient",
"(",
"int",
"maxConnPerRoute",
",",
"int",
"connTimeoutMillis",
",",
"int",
"soTimeoutMillis",
",",
"@",
"Nullable",
"String",
"proxyHostAnPort",
")",
"{",
"Registry",
"<",
"ConnectionSocketFactory",
">",
"defaultRegistry",
"=",... | if proxyHostAnPort value is jvm the normal jvm settings apply | [
"if",
"proxyHostAnPort",
"value",
"is",
"jvm",
"the",
"normal",
"jvm",
"settings",
"apply"
] | train | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-webservice/src/main/java/com/nominanuda/web/http/HttpCoreHelper.java#L535-L568 |
real-logic/simple-binary-encoding | sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/GolangOutputManager.java | GolangOutputManager.createOutput | public Writer createOutput(final String name) throws IOException
{
final File targetFile = new File(outputDir, name + ".go");
return Files.newBufferedWriter(targetFile.toPath(), StandardCharsets.UTF_8);
} | java | public Writer createOutput(final String name) throws IOException
{
final File targetFile = new File(outputDir, name + ".go");
return Files.newBufferedWriter(targetFile.toPath(), StandardCharsets.UTF_8);
} | [
"public",
"Writer",
"createOutput",
"(",
"final",
"String",
"name",
")",
"throws",
"IOException",
"{",
"final",
"File",
"targetFile",
"=",
"new",
"File",
"(",
"outputDir",
",",
"name",
"+",
"\".go\"",
")",
";",
"return",
"Files",
".",
"newBufferedWriter",
"(... | Create a new output which will be a golang source file in the given package.
<p>
The {@link java.io.Writer} should be closed once the caller has finished with it. The Writer is
buffer for efficient IO operations.
@param name the name of the golang class.
@return a {@link java.io.Writer} to which the source code should be written.
@throws IOException if an issue occurs when creating the file. | [
"Create",
"a",
"new",
"output",
"which",
"will",
"be",
"a",
"golang",
"source",
"file",
"in",
"the",
"given",
"package",
".",
"<p",
">",
"The",
"{",
"@link",
"java",
".",
"io",
".",
"Writer",
"}",
"should",
"be",
"closed",
"once",
"the",
"caller",
"h... | train | https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/GolangOutputManager.java#L66-L71 |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java | ComplexMath_F64.divide | public static void divide(ComplexPolar_F64 a, ComplexPolar_F64 b, ComplexPolar_F64 result)
{
result.r = a.r/b.r;
result.theta = a.theta - b.theta;
} | java | public static void divide(ComplexPolar_F64 a, ComplexPolar_F64 b, ComplexPolar_F64 result)
{
result.r = a.r/b.r;
result.theta = a.theta - b.theta;
} | [
"public",
"static",
"void",
"divide",
"(",
"ComplexPolar_F64",
"a",
",",
"ComplexPolar_F64",
"b",
",",
"ComplexPolar_F64",
"result",
")",
"{",
"result",
".",
"r",
"=",
"a",
".",
"r",
"/",
"b",
".",
"r",
";",
"result",
".",
"theta",
"=",
"a",
".",
"th... | Division in polar notation.
@param a Complex number in polar notation. Not modified.
@param b Complex number in polar notation. Not modified.
@param result Storage for output. | [
"Division",
"in",
"polar",
"notation",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java#L146-L150 |
heinrichreimer/material-drawer | library/src/main/java/com/heinrichreimersoftware/materialdrawer/structure/DrawerItem.java | DrawerItem.setImage | public DrawerItem setImage(Drawable image, int imageMode) {
mImage = image;
setImageMode(imageMode);
notifyDataChanged();
return this;
} | java | public DrawerItem setImage(Drawable image, int imageMode) {
mImage = image;
setImageMode(imageMode);
notifyDataChanged();
return this;
} | [
"public",
"DrawerItem",
"setImage",
"(",
"Drawable",
"image",
",",
"int",
"imageMode",
")",
"{",
"mImage",
"=",
"image",
";",
"setImageMode",
"(",
"imageMode",
")",
";",
"notifyDataChanged",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Sets an image with a given image mode to the drawer item
@param image Image to set
@param imageMode Image mode to set | [
"Sets",
"an",
"image",
"with",
"a",
"given",
"image",
"mode",
"to",
"the",
"drawer",
"item"
] | train | https://github.com/heinrichreimer/material-drawer/blob/7c2406812d73f710ef8bb73d4a0f4bbef3b275ce/library/src/main/java/com/heinrichreimersoftware/materialdrawer/structure/DrawerItem.java#L170-L175 |
apache/groovy | src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java | StaticTypeCheckingVisitor.adjustWithTraits | private static ClassNode adjustWithTraits(final MethodNode directMethodCallCandidate, final ClassNode receiver, final ClassNode[] args, final ClassNode returnType) {
if (directMethodCallCandidate instanceof ExtensionMethodNode) {
ExtensionMethodNode emn = (ExtensionMethodNode) directMethodCallCandidate;
if ("withTraits".equals(emn.getName()) && "DefaultGroovyMethods".equals(emn.getExtensionMethodNode().getDeclaringClass().getNameWithoutPackage())) {
List<ClassNode> nodes = new LinkedList<ClassNode>();
Collections.addAll(nodes, receiver.getInterfaces());
for (ClassNode arg : args) {
if (isClassClassNodeWrappingConcreteType(arg)) {
nodes.add(arg.getGenericsTypes()[0].getType());
} else {
nodes.add(arg);
}
}
return new LowestUpperBoundClassNode(returnType.getName() + "Composed", OBJECT_TYPE, nodes.toArray(ClassNode.EMPTY_ARRAY));
}
}
return returnType;
} | java | private static ClassNode adjustWithTraits(final MethodNode directMethodCallCandidate, final ClassNode receiver, final ClassNode[] args, final ClassNode returnType) {
if (directMethodCallCandidate instanceof ExtensionMethodNode) {
ExtensionMethodNode emn = (ExtensionMethodNode) directMethodCallCandidate;
if ("withTraits".equals(emn.getName()) && "DefaultGroovyMethods".equals(emn.getExtensionMethodNode().getDeclaringClass().getNameWithoutPackage())) {
List<ClassNode> nodes = new LinkedList<ClassNode>();
Collections.addAll(nodes, receiver.getInterfaces());
for (ClassNode arg : args) {
if (isClassClassNodeWrappingConcreteType(arg)) {
nodes.add(arg.getGenericsTypes()[0].getType());
} else {
nodes.add(arg);
}
}
return new LowestUpperBoundClassNode(returnType.getName() + "Composed", OBJECT_TYPE, nodes.toArray(ClassNode.EMPTY_ARRAY));
}
}
return returnType;
} | [
"private",
"static",
"ClassNode",
"adjustWithTraits",
"(",
"final",
"MethodNode",
"directMethodCallCandidate",
",",
"final",
"ClassNode",
"receiver",
",",
"final",
"ClassNode",
"[",
"]",
"args",
",",
"final",
"ClassNode",
"returnType",
")",
"{",
"if",
"(",
"direct... | A special method handling the "withTrait" call for which the type checker knows more than
what the type signature is able to tell. If "withTrait" is detected, then a new class node
is created representing the list of trait interfaces.
@param directMethodCallCandidate a method selected by the type checker
@param receiver the receiver of the method call
@param args the arguments of the method call
@param returnType the original return type, as inferred by the type checker
@return fixed return type if the selected method is {@link org.codehaus.groovy.runtime.DefaultGroovyMethods#withTraits(Object, Class[]) withTraits} | [
"A",
"special",
"method",
"handling",
"the",
"withTrait",
"call",
"for",
"which",
"the",
"type",
"checker",
"knows",
"more",
"than",
"what",
"the",
"type",
"signature",
"is",
"able",
"to",
"tell",
".",
"If",
"withTrait",
"is",
"detected",
"then",
"a",
"new... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java#L3757-L3774 |
real-logic/simple-binary-encoding | sbe-tool/src/main/java/uk/co/real_logic/sbe/SbeTool.java | SbeTool.validateAgainstSchema | public static void validateAgainstSchema(final String sbeSchemaFilename, final String xsdFilename)
throws Exception
{
final ParserOptions.Builder optionsBuilder = ParserOptions.builder()
.xsdFilename(System.getProperty(VALIDATION_XSD))
.xIncludeAware(Boolean.parseBoolean(System.getProperty(XINCLUDE_AWARE)))
.stopOnError(Boolean.parseBoolean(System.getProperty(VALIDATION_STOP_ON_ERROR)))
.warningsFatal(Boolean.parseBoolean(System.getProperty(VALIDATION_WARNINGS_FATAL)))
.suppressOutput(Boolean.parseBoolean(System.getProperty(VALIDATION_SUPPRESS_OUTPUT)));
final Path path = Paths.get(sbeSchemaFilename);
try (InputStream in = new BufferedInputStream(Files.newInputStream(path)))
{
final InputSource inputSource = new InputSource(in);
if (path.toAbsolutePath().getParent() != null)
{
inputSource.setSystemId(path.toUri().toString());
}
XmlSchemaParser.validate(xsdFilename, inputSource, optionsBuilder.build());
}
} | java | public static void validateAgainstSchema(final String sbeSchemaFilename, final String xsdFilename)
throws Exception
{
final ParserOptions.Builder optionsBuilder = ParserOptions.builder()
.xsdFilename(System.getProperty(VALIDATION_XSD))
.xIncludeAware(Boolean.parseBoolean(System.getProperty(XINCLUDE_AWARE)))
.stopOnError(Boolean.parseBoolean(System.getProperty(VALIDATION_STOP_ON_ERROR)))
.warningsFatal(Boolean.parseBoolean(System.getProperty(VALIDATION_WARNINGS_FATAL)))
.suppressOutput(Boolean.parseBoolean(System.getProperty(VALIDATION_SUPPRESS_OUTPUT)));
final Path path = Paths.get(sbeSchemaFilename);
try (InputStream in = new BufferedInputStream(Files.newInputStream(path)))
{
final InputSource inputSource = new InputSource(in);
if (path.toAbsolutePath().getParent() != null)
{
inputSource.setSystemId(path.toUri().toString());
}
XmlSchemaParser.validate(xsdFilename, inputSource, optionsBuilder.build());
}
} | [
"public",
"static",
"void",
"validateAgainstSchema",
"(",
"final",
"String",
"sbeSchemaFilename",
",",
"final",
"String",
"xsdFilename",
")",
"throws",
"Exception",
"{",
"final",
"ParserOptions",
".",
"Builder",
"optionsBuilder",
"=",
"ParserOptions",
".",
"builder",
... | Validate the SBE Schema against the XSD.
@param sbeSchemaFilename to be validated.
@param xsdFilename XSD against which to validate.
@throws Exception if an error occurs while validating. | [
"Validate",
"the",
"SBE",
"Schema",
"against",
"the",
"XSD",
"."
] | train | https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/SbeTool.java#L251-L272 |
JM-Lab/utils-elasticsearch | src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchSearchAndCount.java | JMElasticsearchSearchAndCount.getSearchRequestBuilder | public SearchRequestBuilder getSearchRequestBuilder(boolean isSetExplain,
String[] indices, String[] types) {
return getSearchRequestBuilder(isSetExplain, indices, types, null);
} | java | public SearchRequestBuilder getSearchRequestBuilder(boolean isSetExplain,
String[] indices, String[] types) {
return getSearchRequestBuilder(isSetExplain, indices, types, null);
} | [
"public",
"SearchRequestBuilder",
"getSearchRequestBuilder",
"(",
"boolean",
"isSetExplain",
",",
"String",
"[",
"]",
"indices",
",",
"String",
"[",
"]",
"types",
")",
"{",
"return",
"getSearchRequestBuilder",
"(",
"isSetExplain",
",",
"indices",
",",
"types",
","... | Gets search request builder.
@param isSetExplain the is set explain
@param indices the indices
@param types the types
@return the search request builder | [
"Gets",
"search",
"request",
"builder",
"."
] | train | https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchSearchAndCount.java#L247-L250 |
assertthat/selenium-shutterbug | src/main/java/com/assertthat/selenium_shutterbug/core/Shutterbug.java | Shutterbug.shootPage | public static PageSnapshot shootPage(WebDriver driver, ScrollStrategy scroll, int scrollTimeout) {
return shootPage(driver,scroll,scrollTimeout,false);
} | java | public static PageSnapshot shootPage(WebDriver driver, ScrollStrategy scroll, int scrollTimeout) {
return shootPage(driver,scroll,scrollTimeout,false);
} | [
"public",
"static",
"PageSnapshot",
"shootPage",
"(",
"WebDriver",
"driver",
",",
"ScrollStrategy",
"scroll",
",",
"int",
"scrollTimeout",
")",
"{",
"return",
"shootPage",
"(",
"driver",
",",
"scroll",
",",
"scrollTimeout",
",",
"false",
")",
";",
"}"
] | To be used when screen shooting the page
and need to scroll while making screen shots, either vertically or
horizontally or both directions (Chrome).
@param driver WebDriver instance
@param scroll ScrollStrategy How you need to scroll
@param scrollTimeout Timeout to wait after scrolling and before taking screen shot
@return PageSnapshot instance | [
"To",
"be",
"used",
"when",
"screen",
"shooting",
"the",
"page",
"and",
"need",
"to",
"scroll",
"while",
"making",
"screen",
"shots",
"either",
"vertically",
"or",
"horizontally",
"or",
"both",
"directions",
"(",
"Chrome",
")",
"."
] | train | https://github.com/assertthat/selenium-shutterbug/blob/770d9b92423200d262c9ab70e40405921d81e262/src/main/java/com/assertthat/selenium_shutterbug/core/Shutterbug.java#L71-L73 |
EsotericSoftware/jsonbeans | src/com/esotericsoftware/jsonbeans/Json.java | Json.writeValue | public void writeValue (String name, Object value) {
try {
writer.name(name);
} catch (IOException ex) {
throw new JsonException(ex);
}
if (value == null)
writeValue(value, null, null);
else
writeValue(value, value.getClass(), null);
} | java | public void writeValue (String name, Object value) {
try {
writer.name(name);
} catch (IOException ex) {
throw new JsonException(ex);
}
if (value == null)
writeValue(value, null, null);
else
writeValue(value, value.getClass(), null);
} | [
"public",
"void",
"writeValue",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"try",
"{",
"writer",
".",
"name",
"(",
"name",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"JsonException",
"(",
"ex",
")",
";",... | Writes the value as a field on the current JSON object, without writing the actual class.
@param value May be null.
@see #writeValue(String, Object, Class, Class) | [
"Writes",
"the",
"value",
"as",
"a",
"field",
"on",
"the",
"current",
"JSON",
"object",
"without",
"writing",
"the",
"actual",
"class",
"."
] | train | https://github.com/EsotericSoftware/jsonbeans/blob/ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f/src/com/esotericsoftware/jsonbeans/Json.java#L381-L391 |
samskivert/samskivert | src/main/java/com/samskivert/util/MethodFinder.java | MethodFinder.findMethod | public Method findMethod (String methodName, Object[] args)
throws NoSuchMethodException
{
return findMethod(methodName, ClassUtil.getParameterTypesFrom(args));
} | java | public Method findMethod (String methodName, Object[] args)
throws NoSuchMethodException
{
return findMethod(methodName, ClassUtil.getParameterTypesFrom(args));
} | [
"public",
"Method",
"findMethod",
"(",
"String",
"methodName",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"NoSuchMethodException",
"{",
"return",
"findMethod",
"(",
"methodName",
",",
"ClassUtil",
".",
"getParameterTypesFrom",
"(",
"args",
")",
")",
";",
... | Like {@link #findMethod(String,Class[])} except that it takes the actual arguments that will
be passed to the found method and creates the array of class objects for you using {@link
ClassUtil#getParameterTypesFrom}. | [
"Like",
"{"
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/MethodFinder.java#L134-L138 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/AwardEmojiApi.java | AwardEmojiApi.getSnippetAwardEmoji | public AwardEmoji getSnippetAwardEmoji(Object projectIdOrPath, Integer snippetId, Integer awardId) throws GitLabApiException {
Response response = get(Response.Status.OK, getPageQueryParams(1, getDefaultPerPage()),
"projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId, "award_emoji", awardId);
return (response.readEntity(AwardEmoji.class));
} | java | public AwardEmoji getSnippetAwardEmoji(Object projectIdOrPath, Integer snippetId, Integer awardId) throws GitLabApiException {
Response response = get(Response.Status.OK, getPageQueryParams(1, getDefaultPerPage()),
"projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId, "award_emoji", awardId);
return (response.readEntity(AwardEmoji.class));
} | [
"public",
"AwardEmoji",
"getSnippetAwardEmoji",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"snippetId",
",",
"Integer",
"awardId",
")",
"throws",
"GitLabApiException",
"{",
"Response",
"response",
"=",
"get",
"(",
"Response",
".",
"Status",
".",
"OK",
",",
... | Get the specified award emoji for the specified snippet.
<pre><code>GitLab Endpoint: GET /projects/:id/snippets/:snippet_id/award_emoji/:award_id</code></pre>
@param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
@param snippetId the snippet ID to get the award emoji for
@param awardId the ID of the award emoji to get
@return an AwardEmoji instance for the specified award emoji
@throws GitLabApiException if any exception occurs | [
"Get",
"the",
"specified",
"award",
"emoji",
"for",
"the",
"specified",
"snippet",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/AwardEmojiApi.java#L132-L136 |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/AbstractTileFactory.java | AbstractTileFactory.getService | protected synchronized ExecutorService getService()
{
if (service == null)
{
// System.out.println("creating an executor service with a threadpool of size " + threadPoolSize);
service = Executors.newFixedThreadPool(threadPoolSize, new ThreadFactory()
{
private int count = 0;
@Override
public Thread newThread(Runnable r)
{
Thread t = new Thread(r, "tile-pool-" + count++);
t.setPriority(Thread.MIN_PRIORITY);
t.setDaemon(true);
return t;
}
});
}
return service;
} | java | protected synchronized ExecutorService getService()
{
if (service == null)
{
// System.out.println("creating an executor service with a threadpool of size " + threadPoolSize);
service = Executors.newFixedThreadPool(threadPoolSize, new ThreadFactory()
{
private int count = 0;
@Override
public Thread newThread(Runnable r)
{
Thread t = new Thread(r, "tile-pool-" + count++);
t.setPriority(Thread.MIN_PRIORITY);
t.setDaemon(true);
return t;
}
});
}
return service;
} | [
"protected",
"synchronized",
"ExecutorService",
"getService",
"(",
")",
"{",
"if",
"(",
"service",
"==",
"null",
")",
"{",
"// System.out.println(\"creating an executor service with a threadpool of size \" + threadPoolSize);",
"service",
"=",
"Executors",
".",
"newFixedThreadPo... | Subclasses may override this method to provide their own executor services. This method will be called each time
a tile needs to be loaded. Implementations should cache the ExecutorService when possible.
@return ExecutorService to load tiles with | [
"Subclasses",
"may",
"override",
"this",
"method",
"to",
"provide",
"their",
"own",
"executor",
"services",
".",
"This",
"method",
"will",
"be",
"called",
"each",
"time",
"a",
"tile",
"needs",
"to",
"be",
"loaded",
".",
"Implementations",
"should",
"cache",
... | train | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/AbstractTileFactory.java#L196-L216 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDynacache.java | HTODDynacache.delCacheEntry | public void delCacheEntry(ValueSet deleteList, int cause, int source, boolean fromDepIdTemplateInvalidation, boolean fireEvent) {
if (deleteList != null && deleteList.size() > 0) {
this.invalidationBuffer.add(deleteList, HTODInvalidationBuffer.EXPLICIT_BUFFER, cause, source, fromDepIdTemplateInvalidation, fireEvent,
HTODInvalidationBuffer.CHECK_FULL);
}
} | java | public void delCacheEntry(ValueSet deleteList, int cause, int source, boolean fromDepIdTemplateInvalidation, boolean fireEvent) {
if (deleteList != null && deleteList.size() > 0) {
this.invalidationBuffer.add(deleteList, HTODInvalidationBuffer.EXPLICIT_BUFFER, cause, source, fromDepIdTemplateInvalidation, fireEvent,
HTODInvalidationBuffer.CHECK_FULL);
}
} | [
"public",
"void",
"delCacheEntry",
"(",
"ValueSet",
"deleteList",
",",
"int",
"cause",
",",
"int",
"source",
",",
"boolean",
"fromDepIdTemplateInvalidation",
",",
"boolean",
"fireEvent",
")",
"{",
"if",
"(",
"deleteList",
"!=",
"null",
"&&",
"deleteList",
".",
... | ***********************************************************************
delCacheEntry()
Delete cacheEntry from the disk. This also remove dependencies for all dataIds and templates
to the cacheEntry
*********************************************************************** | [
"***********************************************************************",
"delCacheEntry",
"()",
"Delete",
"cacheEntry",
"from",
"the",
"disk",
".",
"This",
"also",
"remove",
"dependencies",
"for",
"all",
"dataIds",
"and",
"templates",
"to",
"the",
"cacheEntry",
"*********... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDynacache.java#L678-L683 |
sporniket/core | sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java | XmlStringTools.getTextInsideTag | public static String getTextInsideTag(String text, String tag, Map<String, String> attributes)
{
StringBuffer _buffer = new StringBuffer();
Map<String, String> _attributes = (null != attributes) ? attributes : EMPTY_MAP;
return doAppendTextInsideTag(_buffer, text, tag, _attributes).toString();
} | java | public static String getTextInsideTag(String text, String tag, Map<String, String> attributes)
{
StringBuffer _buffer = new StringBuffer();
Map<String, String> _attributes = (null != attributes) ? attributes : EMPTY_MAP;
return doAppendTextInsideTag(_buffer, text, tag, _attributes).toString();
} | [
"public",
"static",
"String",
"getTextInsideTag",
"(",
"String",
"text",
",",
"String",
"tag",
",",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"StringBuffer",
"_buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"Map",
"<",
"String"... | Wrap a text inside a tag with attributes.
@param text
the text to wrap
@param tag
the tag to use
@param attributes
the attribute map
@return the xml code | [
"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#L625-L630 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java | SeaGlassSynthPainterImpl.paintArrowButtonBackground | public void paintArrowButtonBackground(SynthContext context, Graphics g, int x, int y, int w, int h) {
if (context.getComponent().getComponentOrientation().isLeftToRight()) {
paintBackground(context, g, x, y, w, h, null);
} else {
AffineTransform transform = new AffineTransform();
transform.translate(x, y);
transform.scale(-1, 1);
transform.translate(-w, 0);
paintBackground(context, g, 0, 0, w, h, transform);
}
} | java | public void paintArrowButtonBackground(SynthContext context, Graphics g, int x, int y, int w, int h) {
if (context.getComponent().getComponentOrientation().isLeftToRight()) {
paintBackground(context, g, x, y, w, h, null);
} else {
AffineTransform transform = new AffineTransform();
transform.translate(x, y);
transform.scale(-1, 1);
transform.translate(-w, 0);
paintBackground(context, g, 0, 0, w, h, transform);
}
} | [
"public",
"void",
"paintArrowButtonBackground",
"(",
"SynthContext",
"context",
",",
"Graphics",
"g",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"w",
",",
"int",
"h",
")",
"{",
"if",
"(",
"context",
".",
"getComponent",
"(",
")",
".",
"getComponentOri... | Paints the background of an arrow button. Arrow buttons are created by
some components, such as <code>JScrollBar</code>.
@param context SynthContext identifying the <code>JComponent</code> and
<code>Region</code> to paint to
@param g <code>Graphics</code> to paint to
@param x X coordinate of the area to paint to
@param y Y coordinate of the area to paint to
@param w Width of the area to paint to
@param h Height of the area to paint to | [
"Paints",
"the",
"background",
"of",
"an",
"arrow",
"button",
".",
"Arrow",
"buttons",
"are",
"created",
"by",
"some",
"components",
"such",
"as",
"<code",
">",
"JScrollBar<",
"/",
"code",
">",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L332-L343 |
btrplace/scheduler | json/src/main/java/org/btrplace/json/model/constraint/ConstraintsConverter.java | ConstraintsConverter.fromJSON | public Constraint fromJSON(Model mo, JSONObject in) throws JSONConverterException {
checkKeys(in, "id");
Object id = in.get("id");
ConstraintConverter<? extends Constraint> c = json2java.get(id.toString());
if (c == null) {
throw new JSONConverterException("No converter available for a constraint having id '" + id + "'");
}
return c.fromJSON(mo, in);
} | java | public Constraint fromJSON(Model mo, JSONObject in) throws JSONConverterException {
checkKeys(in, "id");
Object id = in.get("id");
ConstraintConverter<? extends Constraint> c = json2java.get(id.toString());
if (c == null) {
throw new JSONConverterException("No converter available for a constraint having id '" + id + "'");
}
return c.fromJSON(mo, in);
} | [
"public",
"Constraint",
"fromJSON",
"(",
"Model",
"mo",
",",
"JSONObject",
"in",
")",
"throws",
"JSONConverterException",
"{",
"checkKeys",
"(",
"in",
",",
"\"id\"",
")",
";",
"Object",
"id",
"=",
"in",
".",
"get",
"(",
"\"id\"",
")",
";",
"ConstraintConve... | Convert a json-encoded constraint.
@param mo the model to rely on
@param in the constraint to decode
@return the resulting constraint
@throws JSONConverterException if the conversion failed | [
"Convert",
"a",
"json",
"-",
"encoded",
"constraint",
"."
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/model/constraint/ConstraintsConverter.java#L140-L148 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java | MatrixFeatures_DDRM.isSymmetric | public static boolean isSymmetric(DMatrixRMaj m , double tol ) {
if( m.numCols != m.numRows )
return false;
double max = CommonOps_DDRM.elementMaxAbs(m);
for( int i = 0; i < m.numRows; i++ ) {
for( int j = 0; j < i; j++ ) {
double a = m.get(i,j)/max;
double b = m.get(j,i)/max;
double diff = Math.abs(a-b);
if( !(diff <= tol) ) {
return false;
}
}
}
return true;
} | java | public static boolean isSymmetric(DMatrixRMaj m , double tol ) {
if( m.numCols != m.numRows )
return false;
double max = CommonOps_DDRM.elementMaxAbs(m);
for( int i = 0; i < m.numRows; i++ ) {
for( int j = 0; j < i; j++ ) {
double a = m.get(i,j)/max;
double b = m.get(j,i)/max;
double diff = Math.abs(a-b);
if( !(diff <= tol) ) {
return false;
}
}
}
return true;
} | [
"public",
"static",
"boolean",
"isSymmetric",
"(",
"DMatrixRMaj",
"m",
",",
"double",
"tol",
")",
"{",
"if",
"(",
"m",
".",
"numCols",
"!=",
"m",
".",
"numRows",
")",
"return",
"false",
";",
"double",
"max",
"=",
"CommonOps_DDRM",
".",
"elementMaxAbs",
"... | <p>
Returns true if the matrix is symmetric within the tolerance. Only square matrices can be
symmetric.
</p>
<p>
A matrix is symmetric if:<br>
|a<sub>ij</sub> - a<sub>ji</sub>| ≤ tol
</p>
@param m A matrix. Not modified.
@param tol Tolerance for how similar two elements need to be.
@return true if it is symmetric and false if it is not. | [
"<p",
">",
"Returns",
"true",
"if",
"the",
"matrix",
"is",
"symmetric",
"within",
"the",
"tolerance",
".",
"Only",
"square",
"matrices",
"can",
"be",
"symmetric",
".",
"<",
"/",
"p",
">",
"<p",
">",
"A",
"matrix",
"is",
"symmetric",
"if",
":",
"<br",
... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java#L190-L209 |
WiQuery/wiquery | wiquery-core/src/main/java/org/odlabs/wiquery/core/options/Options.java | Options.putDouble | public Options putDouble(String key, IModel<Double> value)
{
putOption(key, new DoubleOption(value));
return this;
} | java | public Options putDouble(String key, IModel<Double> value)
{
putOption(key, new DoubleOption(value));
return this;
} | [
"public",
"Options",
"putDouble",
"(",
"String",
"key",
",",
"IModel",
"<",
"Double",
">",
"value",
")",
"{",
"putOption",
"(",
"key",
",",
"new",
"DoubleOption",
"(",
"value",
")",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Puts an IModel <Double> value for the given option name.
</p>
@param key
the option name.
@param value
the float value. | [
"<p",
">",
"Puts",
"an",
"IModel",
"<",
";",
"Double>",
";",
"value",
"for",
"the",
"given",
"option",
"name",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-core/src/main/java/org/odlabs/wiquery/core/options/Options.java#L387-L391 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.resolveConstructor | public static <T> Constructor<T> resolveConstructor(Class<T> type, Class<?>[] parameterTypes, Object... arguments) {
try {
return getConstructor(type, parameterTypes);
}
catch (ConstructorNotFoundException cause) {
Constructor<T> constructor = findConstructor(type, arguments);
Assert.notNull(constructor, new ConstructorNotFoundException(String.format(
"Failed to resolve constructor with signature [%1$s] on class type [%2$s]",
getMethodSignature(getSimpleName(type), parameterTypes, Void.class), getName(type)), cause.getCause()));
return constructor;
}
} | java | public static <T> Constructor<T> resolveConstructor(Class<T> type, Class<?>[] parameterTypes, Object... arguments) {
try {
return getConstructor(type, parameterTypes);
}
catch (ConstructorNotFoundException cause) {
Constructor<T> constructor = findConstructor(type, arguments);
Assert.notNull(constructor, new ConstructorNotFoundException(String.format(
"Failed to resolve constructor with signature [%1$s] on class type [%2$s]",
getMethodSignature(getSimpleName(type), parameterTypes, Void.class), getName(type)), cause.getCause()));
return constructor;
}
} | [
"public",
"static",
"<",
"T",
">",
"Constructor",
"<",
"T",
">",
"resolveConstructor",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
",",
"Object",
"...",
"arguments",
")",
"{",
"try",
"{",
"return",
"g... | Attempts to resolve the constructor from the given class type based on the constructor's exact signature,
otherwise finds a constructor who's signature parameter types satisfy the array of Object arguments.
@param <T> the generic class type from which to resolve the constructor.
@param type the Class type from which to resolve the constructor.
@param parameterTypes an array of Class types indicating the desired constructor's signature.
@param arguments an array of Object arguments used to match the constructor's signature.
@return a Constructor from the given class type who's signature either matches the parameter types
or satisfies the array of arguments.
@see #getConstructor(Class, Class[])
@see #findConstructor(Class, Object...)
@see java.lang.Class
@see java.lang.reflect.Constructor | [
"Attempts",
"to",
"resolve",
"the",
"constructor",
"from",
"the",
"given",
"class",
"type",
"based",
"on",
"the",
"constructor",
"s",
"exact",
"signature",
"otherwise",
"finds",
"a",
"constructor",
"who",
"s",
"signature",
"parameter",
"types",
"satisfy",
"the",... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L267-L282 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/Force.java | Force.setDirection | public void setDirection(double fh, double fv)
{
fhLast = fh;
fvLast = fv;
this.fh = fh;
this.fv = fv;
fixForce();
} | java | public void setDirection(double fh, double fv)
{
fhLast = fh;
fvLast = fv;
this.fh = fh;
this.fv = fv;
fixForce();
} | [
"public",
"void",
"setDirection",
"(",
"double",
"fh",
",",
"double",
"fv",
")",
"{",
"fhLast",
"=",
"fh",
";",
"fvLast",
"=",
"fv",
";",
"this",
".",
"fh",
"=",
"fh",
";",
"this",
".",
"fv",
"=",
"fv",
";",
"fixForce",
"(",
")",
";",
"}"
] | Set directions.
@param fh The horizontal direction.
@param fv The vertical direction. | [
"Set",
"directions",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/Force.java#L231-L238 |
googleapis/api-client-staging | generated/java/gapic-google-longrunning-v1/src/main/java/com/google/longrunning/OperationsClient.java | OperationsClient.listOperations | public final ListOperationsPagedResponse listOperations(String name, String filter) {
ListOperationsRequest request =
ListOperationsRequest.newBuilder().setName(name).setFilter(filter).build();
return listOperations(request);
} | java | public final ListOperationsPagedResponse listOperations(String name, String filter) {
ListOperationsRequest request =
ListOperationsRequest.newBuilder().setName(name).setFilter(filter).build();
return listOperations(request);
} | [
"public",
"final",
"ListOperationsPagedResponse",
"listOperations",
"(",
"String",
"name",
",",
"String",
"filter",
")",
"{",
"ListOperationsRequest",
"request",
"=",
"ListOperationsRequest",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"name",
")",
".",
"set... | Lists operations that match the specified filter in the request. If the server doesn't support
this method, it returns `UNIMPLEMENTED`.
<p>NOTE: the `name` binding below allows API services to override the binding to use different
resource name schemes, such as `users/*/operations`.
<p>Sample code:
<pre><code>
try (OperationsClient operationsClient = OperationsClient.create()) {
String name = "";
String filter = "";
for (Operation element : operationsClient.listOperations(name, filter).iterateAll()) {
// doThingsWith(element);
}
}
</code></pre>
@param name The name of the operation collection.
@param filter The standard list filter.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Lists",
"operations",
"that",
"match",
"the",
"specified",
"filter",
"in",
"the",
"request",
".",
"If",
"the",
"server",
"doesn",
"t",
"support",
"this",
"method",
"it",
"returns",
"UNIMPLEMENTED",
"."
] | train | https://github.com/googleapis/api-client-staging/blob/126aee68401977b5dc2b1b4be48decd0e9759db7/generated/java/gapic-google-longrunning-v1/src/main/java/com/google/longrunning/OperationsClient.java#L253-L257 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.getAt | @SuppressWarnings("unchecked")
public static List<Byte> getAt(byte[] array, Collection indices) {
return primitiveArrayGet(array, indices);
} | java | @SuppressWarnings("unchecked")
public static List<Byte> getAt(byte[] array, Collection indices) {
return primitiveArrayGet(array, indices);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Byte",
">",
"getAt",
"(",
"byte",
"[",
"]",
"array",
",",
"Collection",
"indices",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"indices",
")",
";",
"}"
] | Support the subscript operator with a collection for a byte array
@param array a byte array
@param indices a collection of indices for the items to retrieve
@return list of the bytes at the given indices
@since 1.0 | [
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"collection",
"for",
"a",
"byte",
"array"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13938-L13941 |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.assignUsersToPrivilege | public Boolean assignUsersToPrivilege(String id, List<Long> userIds) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
cleanError();
prepareToken();
OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient();
OAuthClient oAuthClient = new OAuthClient(httpClient);
URIBuilder url = new URIBuilder(settings.getURL(Constants.ASSIGN_USERS_TO_PRIVILEGE_URL, id));
OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString())
.buildHeaderMessage();
Map<String, String> headers = getAuthorizedHeader();
bearerRequest.setHeaders(headers);
Map<String, Object> params = new HashMap<String, Object>();
params.put("users", userIds);
String body = JSONUtils.buildJSON(params);
bearerRequest.setBody(body);
Boolean added = false;
OneloginOAuth2JSONResourceResponse oAuth2Response = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuth2JSONResourceResponse.class);
if (oAuth2Response.getResponseCode() == 201) {
added = true;
} else {
error = oAuth2Response.getError();
errorDescription = oAuth2Response.getErrorDescription();
}
return added;
} | java | public Boolean assignUsersToPrivilege(String id, List<Long> userIds) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
cleanError();
prepareToken();
OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient();
OAuthClient oAuthClient = new OAuthClient(httpClient);
URIBuilder url = new URIBuilder(settings.getURL(Constants.ASSIGN_USERS_TO_PRIVILEGE_URL, id));
OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString())
.buildHeaderMessage();
Map<String, String> headers = getAuthorizedHeader();
bearerRequest.setHeaders(headers);
Map<String, Object> params = new HashMap<String, Object>();
params.put("users", userIds);
String body = JSONUtils.buildJSON(params);
bearerRequest.setBody(body);
Boolean added = false;
OneloginOAuth2JSONResourceResponse oAuth2Response = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuth2JSONResourceResponse.class);
if (oAuth2Response.getResponseCode() == 201) {
added = true;
} else {
error = oAuth2Response.getError();
errorDescription = oAuth2Response.getErrorDescription();
}
return added;
} | [
"public",
"Boolean",
"assignUsersToPrivilege",
"(",
"String",
"id",
",",
"List",
"<",
"Long",
">",
"userIds",
")",
"throws",
"OAuthSystemException",
",",
"OAuthProblemException",
",",
"URISyntaxException",
"{",
"cleanError",
"(",
")",
";",
"prepareToken",
"(",
")"... | Assign one or more users to a privilege.
@param id
Id of the privilege
@param userIds
The ids of the users to be assigned.
@return true if success
@throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
@throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
@throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/privileges/assign-users">Assign Users documentation</a> | [
"Assign",
"one",
"or",
"more",
"users",
"to",
"a",
"privilege",
"."
] | train | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L3792-L3822 |
ksclarke/freelib-utils | src/main/java/info/freelibrary/util/I18nObject.java | I18nObject.getI18n | protected String getI18n(final String aMessageKey, final Object... aObjArray) {
final String[] strings = new String[aObjArray.length];
for (int index = 0; index < aObjArray.length; index++) {
if (aObjArray[index] instanceof File) {
strings[index] = ((File) aObjArray[index]).getAbsolutePath();
} else {
strings[index] = aObjArray[index].toString();
}
}
return StringUtils.normalizeWS(myBundle.get(aMessageKey, strings));
} | java | protected String getI18n(final String aMessageKey, final Object... aObjArray) {
final String[] strings = new String[aObjArray.length];
for (int index = 0; index < aObjArray.length; index++) {
if (aObjArray[index] instanceof File) {
strings[index] = ((File) aObjArray[index]).getAbsolutePath();
} else {
strings[index] = aObjArray[index].toString();
}
}
return StringUtils.normalizeWS(myBundle.get(aMessageKey, strings));
} | [
"protected",
"String",
"getI18n",
"(",
"final",
"String",
"aMessageKey",
",",
"final",
"Object",
"...",
"aObjArray",
")",
"{",
"final",
"String",
"[",
"]",
"strings",
"=",
"new",
"String",
"[",
"aObjArray",
".",
"length",
"]",
";",
"for",
"(",
"int",
"in... | Gets the internationalized value for the supplied message key, using an object array as additional information.
@param aMessageKey A message key
@param aObjArray Additional details for the message
@return The internationalized message | [
"Gets",
"the",
"internationalized",
"value",
"for",
"the",
"supplied",
"message",
"key",
"using",
"an",
"object",
"array",
"as",
"additional",
"information",
"."
] | train | https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/I18nObject.java#L140-L152 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/utils/ByteBufferUtil.java | ByteBufferUtil.compareSubArrays | public static int compareSubArrays(ByteBuffer bytes1, int offset1, ByteBuffer bytes2, int offset2, int length)
{
if (bytes1 == null)
return bytes2 == null ? 0 : -1;
if (bytes2 == null) return 1;
assert bytes1.limit() >= offset1 + length : "The first byte array isn't long enough for the specified offset and length.";
assert bytes2.limit() >= offset2 + length : "The second byte array isn't long enough for the specified offset and length.";
for (int i = 0; i < length; i++)
{
byte byte1 = bytes1.get(offset1 + i);
byte byte2 = bytes2.get(offset2 + i);
if (byte1 == byte2)
continue;
// compare non-equal bytes as unsigned
return (byte1 & 0xFF) < (byte2 & 0xFF) ? -1 : 1;
}
return 0;
} | java | public static int compareSubArrays(ByteBuffer bytes1, int offset1, ByteBuffer bytes2, int offset2, int length)
{
if (bytes1 == null)
return bytes2 == null ? 0 : -1;
if (bytes2 == null) return 1;
assert bytes1.limit() >= offset1 + length : "The first byte array isn't long enough for the specified offset and length.";
assert bytes2.limit() >= offset2 + length : "The second byte array isn't long enough for the specified offset and length.";
for (int i = 0; i < length; i++)
{
byte byte1 = bytes1.get(offset1 + i);
byte byte2 = bytes2.get(offset2 + i);
if (byte1 == byte2)
continue;
// compare non-equal bytes as unsigned
return (byte1 & 0xFF) < (byte2 & 0xFF) ? -1 : 1;
}
return 0;
} | [
"public",
"static",
"int",
"compareSubArrays",
"(",
"ByteBuffer",
"bytes1",
",",
"int",
"offset1",
",",
"ByteBuffer",
"bytes2",
",",
"int",
"offset2",
",",
"int",
"length",
")",
"{",
"if",
"(",
"bytes1",
"==",
"null",
")",
"return",
"bytes2",
"==",
"null",... | Compare two ByteBuffer at specified offsets for length.
Compares the non equal bytes as unsigned.
@param bytes1 First byte buffer to compare.
@param offset1 Position to start the comparison at in the first array.
@param bytes2 Second byte buffer to compare.
@param offset2 Position to start the comparison at in the second array.
@param length How many bytes to compare?
@return -1 if byte1 is less than byte2, 1 if byte2 is less than byte1 or 0 if equal. | [
"Compare",
"two",
"ByteBuffer",
"at",
"specified",
"offsets",
"for",
"length",
".",
"Compares",
"the",
"non",
"equal",
"bytes",
"as",
"unsigned",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/ByteBufferUtil.java#L472-L490 |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getShardSatatus | @Deprecated
public Future<ShardStatus> getShardSatatus(Shard shard) {
return new DummyFuture<>(handler.getShardStatus(shard));
} | java | @Deprecated
public Future<ShardStatus> getShardSatatus(Shard shard) {
return new DummyFuture<>(handler.getShardStatus(shard));
} | [
"@",
"Deprecated",
"public",
"Future",
"<",
"ShardStatus",
">",
"getShardSatatus",
"(",
"Shard",
"shard",
")",
"{",
"return",
"new",
"DummyFuture",
"<>",
"(",
"handler",
".",
"getShardStatus",
"(",
"shard",
")",
")",
";",
"}"
] | <p>
Retrieves detailed information about the specified shard.
</p><br>
This method does not count towards your rate limit.
@param shard The target region
@return A list of shard infomation.
@deprecated Use #getShardStatus instead.
@see <a href="https://developer.riotgames.com/api/methods#!/835/2938">Official API Documentation</a> | [
"<p",
">",
"Retrieves",
"detailed",
"information",
"about",
"the",
"specified",
"shard",
".",
"<",
"/",
"p",
">",
"<br",
">",
"This",
"method",
"does",
"not",
"count",
"towards",
"your",
"rate",
"limit",
"."
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L938-L941 |
VoltDB/voltdb | third_party/java/src/org/apache/commons_voltpatches/cli/HelpFormatter.java | HelpFormatter.printWrapped | public void printWrapped(PrintWriter pw, int width, String text)
{
printWrapped(pw, width, 0, text);
} | java | public void printWrapped(PrintWriter pw, int width, String text)
{
printWrapped(pw, width, 0, text);
} | [
"public",
"void",
"printWrapped",
"(",
"PrintWriter",
"pw",
",",
"int",
"width",
",",
"String",
"text",
")",
"{",
"printWrapped",
"(",
"pw",
",",
"width",
",",
"0",
",",
"text",
")",
";",
"}"
] | Print the specified text to the specified PrintWriter.
@param pw The printWriter to write the help to
@param width The number of characters to display per line
@param text The text to be written to the PrintWriter | [
"Print",
"the",
"specified",
"text",
"to",
"the",
"specified",
"PrintWriter",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/HelpFormatter.java#L754-L757 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveDataset.java | HiveDataset.parseLogicalDbAndTable | @VisibleForTesting
protected static DbAndTable parseLogicalDbAndTable(String datasetNamePattern, DbAndTable dbAndTable,
String logicalDbToken, String logicalTableToken) {
Preconditions.checkArgument(StringUtils.isNotBlank(datasetNamePattern), "Dataset name pattern must not be empty.");
List<String> datasetNameSplit = Lists.newArrayList(SPLIT_ON_DOT.split(datasetNamePattern));
Preconditions.checkArgument(datasetNameSplit.size() == 2, "Dataset name pattern must of the format: "
+ "dbPrefix_$LOGICAL_DB_dbPostfix.tablePrefix_$LOGICAL_TABLE_tablePostfix (prefix / postfix are optional)");
String dbNamePattern = datasetNameSplit.get(0);
String tableNamePattern = datasetNameSplit.get(1);
String logicalDb = extractTokenValueFromEntity(dbAndTable.getDb(), dbNamePattern, logicalDbToken);
String logicalTable = extractTokenValueFromEntity(dbAndTable.getTable(), tableNamePattern, logicalTableToken);
return new DbAndTable(logicalDb, logicalTable);
} | java | @VisibleForTesting
protected static DbAndTable parseLogicalDbAndTable(String datasetNamePattern, DbAndTable dbAndTable,
String logicalDbToken, String logicalTableToken) {
Preconditions.checkArgument(StringUtils.isNotBlank(datasetNamePattern), "Dataset name pattern must not be empty.");
List<String> datasetNameSplit = Lists.newArrayList(SPLIT_ON_DOT.split(datasetNamePattern));
Preconditions.checkArgument(datasetNameSplit.size() == 2, "Dataset name pattern must of the format: "
+ "dbPrefix_$LOGICAL_DB_dbPostfix.tablePrefix_$LOGICAL_TABLE_tablePostfix (prefix / postfix are optional)");
String dbNamePattern = datasetNameSplit.get(0);
String tableNamePattern = datasetNameSplit.get(1);
String logicalDb = extractTokenValueFromEntity(dbAndTable.getDb(), dbNamePattern, logicalDbToken);
String logicalTable = extractTokenValueFromEntity(dbAndTable.getTable(), tableNamePattern, logicalTableToken);
return new DbAndTable(logicalDb, logicalTable);
} | [
"@",
"VisibleForTesting",
"protected",
"static",
"DbAndTable",
"parseLogicalDbAndTable",
"(",
"String",
"datasetNamePattern",
",",
"DbAndTable",
"dbAndTable",
",",
"String",
"logicalDbToken",
",",
"String",
"logicalTableToken",
")",
"{",
"Preconditions",
".",
"checkArgume... | *
Parse logical Database and Table name from a given DbAndTable object.
Eg.
Dataset Name Pattern : prod_$LOGICAL_DB_linkedin.prod_$LOGICAL_TABLE_linkedin
Source DB and Table : prod_dbName_linkedin.prod_tableName_linkedin
Logical DB Token : $LOGICAL_DB
Logical Table Token : $LOGICAL_TABLE
Parsed Logical DB and Table : dbName.tableName
@param datasetNamePattern Dataset name pattern.
@param dbAndTable Source DB and Table.
@param logicalDbToken Logical DB token.
@param logicalTableToken Logical Table token.
@return Parsed logical DB and Table. | [
"*",
"Parse",
"logical",
"Database",
"and",
"Table",
"name",
"from",
"a",
"given",
"DbAndTable",
"object",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveDataset.java#L208-L224 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Channel.java | Channel.queryByChaincode | public Collection<ProposalResponse> queryByChaincode(QueryByChaincodeRequest queryByChaincodeRequest, Collection<Peer> peers) throws InvalidArgumentException, ProposalException {
return sendProposal(queryByChaincodeRequest, peers);
} | java | public Collection<ProposalResponse> queryByChaincode(QueryByChaincodeRequest queryByChaincodeRequest, Collection<Peer> peers) throws InvalidArgumentException, ProposalException {
return sendProposal(queryByChaincodeRequest, peers);
} | [
"public",
"Collection",
"<",
"ProposalResponse",
">",
"queryByChaincode",
"(",
"QueryByChaincodeRequest",
"queryByChaincodeRequest",
",",
"Collection",
"<",
"Peer",
">",
"peers",
")",
"throws",
"InvalidArgumentException",
",",
"ProposalException",
"{",
"return",
"sendProp... | Send Query proposal
@param queryByChaincodeRequest
@param peers
@return responses from peers.
@throws InvalidArgumentException
@throws ProposalException | [
"Send",
"Query",
"proposal"
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L4382-L4384 |
mikepenz/MaterialDrawer | library/src/main/java/com/mikepenz/materialdrawer/Drawer.java | Drawer.addStickyFooterItemAtPosition | public void addStickyFooterItemAtPosition(@NonNull IDrawerItem drawerItem, int position) {
if (mDrawerBuilder.mStickyDrawerItems == null) {
mDrawerBuilder.mStickyDrawerItems = new ArrayList<>();
}
mDrawerBuilder.mStickyDrawerItems.add(position, drawerItem);
DrawerUtils.rebuildStickyFooterView(mDrawerBuilder);
} | java | public void addStickyFooterItemAtPosition(@NonNull IDrawerItem drawerItem, int position) {
if (mDrawerBuilder.mStickyDrawerItems == null) {
mDrawerBuilder.mStickyDrawerItems = new ArrayList<>();
}
mDrawerBuilder.mStickyDrawerItems.add(position, drawerItem);
DrawerUtils.rebuildStickyFooterView(mDrawerBuilder);
} | [
"public",
"void",
"addStickyFooterItemAtPosition",
"(",
"@",
"NonNull",
"IDrawerItem",
"drawerItem",
",",
"int",
"position",
")",
"{",
"if",
"(",
"mDrawerBuilder",
".",
"mStickyDrawerItems",
"==",
"null",
")",
"{",
"mDrawerBuilder",
".",
"mStickyDrawerItems",
"=",
... | Add a footerDrawerItem at a specific position
@param drawerItem
@param position | [
"Add",
"a",
"footerDrawerItem",
"at",
"a",
"specific",
"position"
] | train | https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/Drawer.java#L874-L881 |
rometools/rome | rome-modules/src/main/java/com/rometools/modules/mediarss/io/MediaModuleGenerator.java | MediaModuleGenerator.generateSubTitles | private void generateSubTitles(final Metadata m, final Element e) {
for (final SubTitle subTitle : m.getSubTitles()) {
final Element subTitleElement = new Element("subTitle", NS);
addNotNullAttribute(subTitleElement, "type", subTitle.getType());
addNotNullAttribute(subTitleElement, "lang", subTitle.getLang());
addNotNullAttribute(subTitleElement, "href", subTitle.getHref());
if (subTitleElement.hasAttributes()) {
e.addContent(subTitleElement);
}
}
} | java | private void generateSubTitles(final Metadata m, final Element e) {
for (final SubTitle subTitle : m.getSubTitles()) {
final Element subTitleElement = new Element("subTitle", NS);
addNotNullAttribute(subTitleElement, "type", subTitle.getType());
addNotNullAttribute(subTitleElement, "lang", subTitle.getLang());
addNotNullAttribute(subTitleElement, "href", subTitle.getHref());
if (subTitleElement.hasAttributes()) {
e.addContent(subTitleElement);
}
}
} | [
"private",
"void",
"generateSubTitles",
"(",
"final",
"Metadata",
"m",
",",
"final",
"Element",
"e",
")",
"{",
"for",
"(",
"final",
"SubTitle",
"subTitle",
":",
"m",
".",
"getSubTitles",
"(",
")",
")",
"{",
"final",
"Element",
"subTitleElement",
"=",
"new"... | Generation of subTitle tags.
@param m source
@param e element to attach new element to | [
"Generation",
"of",
"subTitle",
"tags",
"."
] | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-modules/src/main/java/com/rometools/modules/mediarss/io/MediaModuleGenerator.java#L431-L441 |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java | JanusConfig.getSystemPropertyAsInteger | public static int getSystemPropertyAsInteger(String name, int defaultValue) {
final String value = getSystemProperty(name, null);
if (value != null) {
try {
return Integer.parseInt(value);
} catch (Throwable exception) {
//
}
}
return defaultValue;
} | java | public static int getSystemPropertyAsInteger(String name, int defaultValue) {
final String value = getSystemProperty(name, null);
if (value != null) {
try {
return Integer.parseInt(value);
} catch (Throwable exception) {
//
}
}
return defaultValue;
} | [
"public",
"static",
"int",
"getSystemPropertyAsInteger",
"(",
"String",
"name",
",",
"int",
"defaultValue",
")",
"{",
"final",
"String",
"value",
"=",
"getSystemProperty",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"try... | Replies the value of the integer system property.
@param name
- name of the property.
@param defaultValue
- value to reply if the these is no property found
@return the value, or defaultValue. | [
"Replies",
"the",
"value",
"of",
"the",
"integer",
"system",
"property",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java#L385-L395 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java | CPFriendlyURLEntryPersistenceImpl.removeByG_C_C | @Override
public void removeByG_C_C(long groupId, long classNameId, long classPK) {
for (CPFriendlyURLEntry cpFriendlyURLEntry : findByG_C_C(groupId,
classNameId, classPK, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpFriendlyURLEntry);
}
} | java | @Override
public void removeByG_C_C(long groupId, long classNameId, long classPK) {
for (CPFriendlyURLEntry cpFriendlyURLEntry : findByG_C_C(groupId,
classNameId, classPK, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpFriendlyURLEntry);
}
} | [
"@",
"Override",
"public",
"void",
"removeByG_C_C",
"(",
"long",
"groupId",
",",
"long",
"classNameId",
",",
"long",
"classPK",
")",
"{",
"for",
"(",
"CPFriendlyURLEntry",
"cpFriendlyURLEntry",
":",
"findByG_C_C",
"(",
"groupId",
",",
"classNameId",
",",
"classP... | Removes all the cp friendly url entries where groupId = ? and classNameId = ? and classPK = ? from the database.
@param groupId the group ID
@param classNameId the class name ID
@param classPK the class pk | [
"Removes",
"all",
"the",
"cp",
"friendly",
"url",
"entries",
"where",
"groupId",
"=",
"?",
";",
"and",
"classNameId",
"=",
"?",
";",
"and",
"classPK",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java#L2555-L2561 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java | ServerBuilder.accessLogWriter | public ServerBuilder accessLogWriter(AccessLogWriter accessLogWriter, boolean shutdownOnStop) {
this.accessLogWriter = requireNonNull(accessLogWriter, "accessLogWriter");
shutdownAccessLogWriterOnStop = shutdownOnStop;
return this;
} | java | public ServerBuilder accessLogWriter(AccessLogWriter accessLogWriter, boolean shutdownOnStop) {
this.accessLogWriter = requireNonNull(accessLogWriter, "accessLogWriter");
shutdownAccessLogWriterOnStop = shutdownOnStop;
return this;
} | [
"public",
"ServerBuilder",
"accessLogWriter",
"(",
"AccessLogWriter",
"accessLogWriter",
",",
"boolean",
"shutdownOnStop",
")",
"{",
"this",
".",
"accessLogWriter",
"=",
"requireNonNull",
"(",
"accessLogWriter",
",",
"\"accessLogWriter\"",
")",
";",
"shutdownAccessLogWrit... | Sets an access log writer of this {@link Server}. {@link AccessLogWriter#disabled()} is used by default.
@param shutdownOnStop whether to shut down the {@link AccessLogWriter} when the {@link Server} stops | [
"Sets",
"an",
"access",
"log",
"writer",
"of",
"this",
"{",
"@link",
"Server",
"}",
".",
"{",
"@link",
"AccessLogWriter#disabled",
"()",
"}",
"is",
"used",
"by",
"default",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java#L705-L709 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java | JDBC4DatabaseMetaData.getFunctionColumns | @Override
public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | java | @Override
public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | [
"@",
"Override",
"public",
"ResultSet",
"getFunctionColumns",
"(",
"String",
"catalog",
",",
"String",
"schemaPattern",
",",
"String",
"functionNamePattern",
",",
"String",
"columnNamePattern",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"throw... | Retrieves a description of the given catalog's system or user function parameters and return type. | [
"Retrieves",
"a",
"description",
"of",
"the",
"given",
"catalog",
"s",
"system",
"or",
"user",
"function",
"parameters",
"and",
"return",
"type",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L362-L367 |
emilsjolander/android-FlipView | library/src/se/emilsjolander/flipview/Recycler.java | Recycler.addScrapView | @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
void addScrapView(View scrap, int position, int viewType) {
// create a new Scrap
Scrap item = new Scrap(scrap, true);
if (viewTypeCount == 1) {
currentScraps.put(position, item);
} else {
scraps[viewType].put(position, item);
}
if (Build.VERSION.SDK_INT >= 14) {
scrap.setAccessibilityDelegate(null);
}
} | java | @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
void addScrapView(View scrap, int position, int viewType) {
// create a new Scrap
Scrap item = new Scrap(scrap, true);
if (viewTypeCount == 1) {
currentScraps.put(position, item);
} else {
scraps[viewType].put(position, item);
}
if (Build.VERSION.SDK_INT >= 14) {
scrap.setAccessibilityDelegate(null);
}
} | [
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"ICE_CREAM_SANDWICH",
")",
"void",
"addScrapView",
"(",
"View",
"scrap",
",",
"int",
"position",
",",
"int",
"viewType",
")",
"{",
"// create a new Scrap",
"Scrap",
"item",
"=",
"new",
"Scrap",
"(",
... | Put a view into the ScrapViews list. These views are unordered.
@param scrap
The view to add | [
"Put",
"a",
"view",
"into",
"the",
"ScrapViews",
"list",
".",
"These",
"views",
"are",
"unordered",
"."
] | train | https://github.com/emilsjolander/android-FlipView/blob/7dc0dbd37339dc9691934b60a1c2763b5ed29ffe/library/src/se/emilsjolander/flipview/Recycler.java#L61-L74 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMTablesFactory.java | OSMTablesFactory.createWayTable | public static PreparedStatement createWayTable(Connection connection, String wayTableName, boolean isH2) throws SQLException {
try (Statement stmt = connection.createStatement()) {
StringBuilder sb = new StringBuilder("CREATE TABLE ");
sb.append(wayTableName);
sb.append("(ID_WAY BIGINT PRIMARY KEY, USER_NAME VARCHAR, UID BIGINT, VISIBLE BOOLEAN, VERSION INTEGER, CHANGESET INTEGER, LAST_UPDATE TIMESTAMP, NAME VARCHAR);");
stmt.execute(sb.toString());
}
return connection.prepareStatement("INSERT INTO " + wayTableName + " VALUES (?,?,?,?,?,?,?,?);");
} | java | public static PreparedStatement createWayTable(Connection connection, String wayTableName, boolean isH2) throws SQLException {
try (Statement stmt = connection.createStatement()) {
StringBuilder sb = new StringBuilder("CREATE TABLE ");
sb.append(wayTableName);
sb.append("(ID_WAY BIGINT PRIMARY KEY, USER_NAME VARCHAR, UID BIGINT, VISIBLE BOOLEAN, VERSION INTEGER, CHANGESET INTEGER, LAST_UPDATE TIMESTAMP, NAME VARCHAR);");
stmt.execute(sb.toString());
}
return connection.prepareStatement("INSERT INTO " + wayTableName + " VALUES (?,?,?,?,?,?,?,?);");
} | [
"public",
"static",
"PreparedStatement",
"createWayTable",
"(",
"Connection",
"connection",
",",
"String",
"wayTableName",
",",
"boolean",
"isH2",
")",
"throws",
"SQLException",
"{",
"try",
"(",
"Statement",
"stmt",
"=",
"connection",
".",
"createStatement",
"(",
... | Create the ways table that will be used to import OSM ways
Example :
<way id="26659127" user="Masch" uid="55988" visible="true" version="5"
changeset="4142606" timestamp="2010-03-16T11:47:08Z">
@param connection
@param wayTableName
@return
@throws SQLException | [
"Create",
"the",
"ways",
"table",
"that",
"will",
"be",
"used",
"to",
"import",
"OSM",
"ways",
"Example",
":",
"<way",
"id",
"=",
"26659127",
"user",
"=",
"Masch",
"uid",
"=",
"55988",
"visible",
"=",
"true",
"version",
"=",
"5",
"changeset",
"=",
"414... | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMTablesFactory.java#L162-L170 |
lecousin/java-framework-core | net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeLong.java | RedBlackTreeLong.searchNearestHigher | public Node<T> searchNearestHigher(long value, boolean acceptEquals) {
if (root == null) return null;
return searchNearestHigher(root, value, acceptEquals);
} | java | public Node<T> searchNearestHigher(long value, boolean acceptEquals) {
if (root == null) return null;
return searchNearestHigher(root, value, acceptEquals);
} | [
"public",
"Node",
"<",
"T",
">",
"searchNearestHigher",
"(",
"long",
"value",
",",
"boolean",
"acceptEquals",
")",
"{",
"if",
"(",
"root",
"==",
"null",
")",
"return",
"null",
";",
"return",
"searchNearestHigher",
"(",
"root",
",",
"value",
",",
"acceptEqu... | Returns the node containing the lowest value strictly higher than the given one. | [
"Returns",
"the",
"node",
"containing",
"the",
"lowest",
"value",
"strictly",
"higher",
"than",
"the",
"given",
"one",
"."
] | train | https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeLong.java#L310-L313 |
kazocsaba/matrix | src/main/java/hu/kazocsaba/math/matrix/MatrixFactory.java | MatrixFactory.createMatrix | public static Matrix createMatrix(int rowCount, int colCount) {
if (rowCount<=0 || colCount<=0) throw new IllegalArgumentException();
if (colCount==1)
return createVector(rowCount);
else if (rowCount==2 && colCount==2)
return createMatrix2();
else if (rowCount==3 && colCount==3)
return createMatrix3();
else
return new MatrixImpl(rowCount, colCount);
} | java | public static Matrix createMatrix(int rowCount, int colCount) {
if (rowCount<=0 || colCount<=0) throw new IllegalArgumentException();
if (colCount==1)
return createVector(rowCount);
else if (rowCount==2 && colCount==2)
return createMatrix2();
else if (rowCount==3 && colCount==3)
return createMatrix3();
else
return new MatrixImpl(rowCount, colCount);
} | [
"public",
"static",
"Matrix",
"createMatrix",
"(",
"int",
"rowCount",
",",
"int",
"colCount",
")",
"{",
"if",
"(",
"rowCount",
"<=",
"0",
"||",
"colCount",
"<=",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"if",
"(",
"colCount",
... | Creates a new matrix with all elements initialized to 0.
@param rowCount the number of rows
@param colCount the number of columns
@return a new matrix of the specified size
@throws IllegalArgumentException if either argument is non-positive | [
"Creates",
"a",
"new",
"matrix",
"with",
"all",
"elements",
"initialized",
"to",
"0",
"."
] | train | https://github.com/kazocsaba/matrix/blob/018570db945fe616b25606fe605fa6e0c180ab5b/src/main/java/hu/kazocsaba/math/matrix/MatrixFactory.java#L89-L99 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java | DynamicJasperHelper.generateJasperReport | public static JasperReport generateJasperReport(DynamicReport dr, LayoutManager layoutManager, Map generatedParams) throws JRException {
log.info("generating JasperReport (DynamicReport dr, LayoutManager layoutManager, Map generatedParams)");
return generateJasperReport(dr, layoutManager, generatedParams, "r");
} | java | public static JasperReport generateJasperReport(DynamicReport dr, LayoutManager layoutManager, Map generatedParams) throws JRException {
log.info("generating JasperReport (DynamicReport dr, LayoutManager layoutManager, Map generatedParams)");
return generateJasperReport(dr, layoutManager, generatedParams, "r");
} | [
"public",
"static",
"JasperReport",
"generateJasperReport",
"(",
"DynamicReport",
"dr",
",",
"LayoutManager",
"layoutManager",
",",
"Map",
"generatedParams",
")",
"throws",
"JRException",
"{",
"log",
".",
"info",
"(",
"\"generating JasperReport (DynamicReport dr, LayoutMana... | Compiles the report and applies the layout. <b>generatedParams</b> MUST NOT BE NULL
All the key objects from the generatedParams map that are String, will be registered as parameters of the report.
@param dr
@param layoutManager
@param generatedParams
@return
@throws JRException | [
"Compiles",
"the",
"report",
"and",
"applies",
"the",
"layout",
".",
"<b",
">",
"generatedParams<",
"/",
"b",
">",
"MUST",
"NOT",
"BE",
"NULL",
"All",
"the",
"key",
"objects",
"from",
"the",
"generatedParams",
"map",
"that",
"are",
"String",
"will",
"be",
... | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java#L504-L507 |
leadware/jpersistence-tools | jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/RestrictionsContainer.java | RestrictionsContainer.addLike | public RestrictionsContainer addLike(String property, String value) {
// Ajout de la restriction
restrictions.add(new Like(property, value));
// On retourne le conteneur
return this;
} | java | public RestrictionsContainer addLike(String property, String value) {
// Ajout de la restriction
restrictions.add(new Like(property, value));
// On retourne le conteneur
return this;
} | [
"public",
"RestrictionsContainer",
"addLike",
"(",
"String",
"property",
",",
"String",
"value",
")",
"{",
"// Ajout de la restriction\r",
"restrictions",
".",
"add",
"(",
"new",
"Like",
"(",
"property",
",",
"value",
")",
")",
";",
"// On retourne le conteneur\r",
... | Methode d'ajout de la restriction Like
@param property Nom de la Propriete
@param value Valeur de la propriete
@return Conteneur | [
"Methode",
"d",
"ajout",
"de",
"la",
"restriction",
"Like"
] | train | https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/RestrictionsContainer.java#L168-L175 |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.fileCopy | public final void fileCopy(File in, File out) throws IOException {
assert in != null;
assert out != null;
getLog().debug("Copying file: " + in.toString() + " into " + out.toString()); //$NON-NLS-1$ //$NON-NLS-2$
try (FileInputStream fis = new FileInputStream(in)) {
try (FileChannel inChannel = fis.getChannel()) {
try (FileOutputStream fos = new FileOutputStream(out)) {
try (FileChannel outChannel = fos.getChannel()) {
inChannel.transferTo(0, inChannel.size(), outChannel);
}
}
}
} finally {
getBuildContext().refresh(out);
}
} | java | public final void fileCopy(File in, File out) throws IOException {
assert in != null;
assert out != null;
getLog().debug("Copying file: " + in.toString() + " into " + out.toString()); //$NON-NLS-1$ //$NON-NLS-2$
try (FileInputStream fis = new FileInputStream(in)) {
try (FileChannel inChannel = fis.getChannel()) {
try (FileOutputStream fos = new FileOutputStream(out)) {
try (FileChannel outChannel = fos.getChannel()) {
inChannel.transferTo(0, inChannel.size(), outChannel);
}
}
}
} finally {
getBuildContext().refresh(out);
}
} | [
"public",
"final",
"void",
"fileCopy",
"(",
"File",
"in",
",",
"File",
"out",
")",
"throws",
"IOException",
"{",
"assert",
"in",
"!=",
"null",
";",
"assert",
"out",
"!=",
"null",
";",
"getLog",
"(",
")",
".",
"debug",
"(",
"\"Copying file: \"",
"+",
"i... | Copy a file.
@param in input file.
@param out output file.
@throws IOException on error. | [
"Copy",
"a",
"file",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L332-L347 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/ext/ExtensionLoaderFactory.java | ExtensionLoaderFactory.getExtensionLoader | public static <T> ExtensionLoader<T> getExtensionLoader(Class<T> clazz) {
return getExtensionLoader(clazz, null);
} | java | public static <T> ExtensionLoader<T> getExtensionLoader(Class<T> clazz) {
return getExtensionLoader(clazz, null);
} | [
"public",
"static",
"<",
"T",
">",
"ExtensionLoader",
"<",
"T",
">",
"getExtensionLoader",
"(",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"getExtensionLoader",
"(",
"clazz",
",",
"null",
")",
";",
"}"
] | Get extension loader by extensible class without listener
@param clazz Extensible class
@param <T> Class
@return ExtensionLoader of this class | [
"Get",
"extension",
"loader",
"by",
"extensible",
"class",
"without",
"listener"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/ext/ExtensionLoaderFactory.java#L65-L67 |
alkacon/opencms-core | src/org/opencms/search/solr/CmsSolrIndex.java | CmsSolrIndex.isDebug | private boolean isDebug(CmsObject cms, CmsSolrQuery query) {
String[] debugSecretValues = query.remove(REQUEST_PARAM_DEBUG_SECRET);
String debugSecret = (debugSecretValues == null) || (debugSecretValues.length < 1)
? null
: debugSecretValues[0];
if ((null != debugSecret) && !debugSecret.trim().isEmpty() && (null != m_handlerDebugSecretFile)) {
try {
CmsFile secretFile = cms.readFile(m_handlerDebugSecretFile);
String secret = new String(secretFile.getContents(), CmsFileUtil.getEncoding(cms, secretFile));
return secret.trim().equals(debugSecret.trim());
} catch (Exception e) {
LOG.info(
"Failed to read secret file for index \""
+ getName()
+ "\" at path \""
+ m_handlerDebugSecretFile
+ "\".");
}
}
return false;
} | java | private boolean isDebug(CmsObject cms, CmsSolrQuery query) {
String[] debugSecretValues = query.remove(REQUEST_PARAM_DEBUG_SECRET);
String debugSecret = (debugSecretValues == null) || (debugSecretValues.length < 1)
? null
: debugSecretValues[0];
if ((null != debugSecret) && !debugSecret.trim().isEmpty() && (null != m_handlerDebugSecretFile)) {
try {
CmsFile secretFile = cms.readFile(m_handlerDebugSecretFile);
String secret = new String(secretFile.getContents(), CmsFileUtil.getEncoding(cms, secretFile));
return secret.trim().equals(debugSecret.trim());
} catch (Exception e) {
LOG.info(
"Failed to read secret file for index \""
+ getName()
+ "\" at path \""
+ m_handlerDebugSecretFile
+ "\".");
}
}
return false;
} | [
"private",
"boolean",
"isDebug",
"(",
"CmsObject",
"cms",
",",
"CmsSolrQuery",
"query",
")",
"{",
"String",
"[",
"]",
"debugSecretValues",
"=",
"query",
".",
"remove",
"(",
"REQUEST_PARAM_DEBUG_SECRET",
")",
";",
"String",
"debugSecret",
"=",
"(",
"debugSecretVa... | Checks if the query should be executed using the debug mode where the security restrictions do not apply.
@param cms the current context.
@param query the query to execute.
@return a flag, indicating, if the query should be performed in debug mode. | [
"Checks",
"if",
"the",
"query",
"should",
"be",
"executed",
"using",
"the",
"debug",
"mode",
"where",
"the",
"security",
"restrictions",
"do",
"not",
"apply",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrIndex.java#L1595-L1616 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/rest/DescribeRepositoryResource.java | DescribeRepositoryResource.describe | @Path("/")
@GET
public Response describe(@QueryParam("xml")
@DefaultValue("false")
boolean xml)
throws ServletException, IOException {
Context context = getContext();
try {
return describeRepository(context, xml);
} catch (Exception ae) {
return handleException(ae, false);
}
} | java | @Path("/")
@GET
public Response describe(@QueryParam("xml")
@DefaultValue("false")
boolean xml)
throws ServletException, IOException {
Context context = getContext();
try {
return describeRepository(context, xml);
} catch (Exception ae) {
return handleException(ae, false);
}
} | [
"@",
"Path",
"(",
"\"/\"",
")",
"@",
"GET",
"public",
"Response",
"describe",
"(",
"@",
"QueryParam",
"(",
"\"xml\"",
")",
"@",
"DefaultValue",
"(",
"\"false\"",
")",
"boolean",
"xml",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"Context",
... | <p>
Process Fedora Access Request. Parse and validate the servlet input
parameters and then execute the specified request.
</p>
@param xml
whether the request is for xml or html.
@throws ServletException
If an error occurs that effects the servlet's basic operation.
@throws IOException
If an error occurs with an input or output operation. | [
"<p",
">",
"Process",
"Fedora",
"Access",
"Request",
".",
"Parse",
"and",
"validate",
"the",
"servlet",
"input",
"parameters",
"and",
"then",
"execute",
"the",
"specified",
"request",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/rest/DescribeRepositoryResource.java#L99-L113 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/AbstractDefinitionDeployer.java | AbstractDefinitionDeployer.getDiagramResourceForDefinition | protected String getDiagramResourceForDefinition(DeploymentEntity deployment, String resourceName, DefinitionEntity definition, Map<String, ResourceEntity> resources) {
for (String diagramSuffix: getDiagramSuffixes()) {
String definitionDiagramResource = getDefinitionDiagramResourceName(resourceName, definition, diagramSuffix);
String diagramForFileResource = getGeneralDiagramResourceName(resourceName, definition, diagramSuffix);
if (resources.containsKey(definitionDiagramResource)) {
return definitionDiagramResource;
} else if (resources.containsKey(diagramForFileResource)) {
return diagramForFileResource;
}
}
// no matching diagram found
return null;
} | java | protected String getDiagramResourceForDefinition(DeploymentEntity deployment, String resourceName, DefinitionEntity definition, Map<String, ResourceEntity> resources) {
for (String diagramSuffix: getDiagramSuffixes()) {
String definitionDiagramResource = getDefinitionDiagramResourceName(resourceName, definition, diagramSuffix);
String diagramForFileResource = getGeneralDiagramResourceName(resourceName, definition, diagramSuffix);
if (resources.containsKey(definitionDiagramResource)) {
return definitionDiagramResource;
} else if (resources.containsKey(diagramForFileResource)) {
return diagramForFileResource;
}
}
// no matching diagram found
return null;
} | [
"protected",
"String",
"getDiagramResourceForDefinition",
"(",
"DeploymentEntity",
"deployment",
",",
"String",
"resourceName",
",",
"DefinitionEntity",
"definition",
",",
"Map",
"<",
"String",
",",
"ResourceEntity",
">",
"resources",
")",
"{",
"for",
"(",
"String",
... | Returns the default name of the image resource for a certain definition.
It will first look for an image resource which matches the definition
specifically, before resorting to an image resource which matches the file
containing the definition.
Example: if the deployment contains a BPMN 2.0 xml resource called
'abc.bpmn20.xml' containing only one process with key 'myProcess', then
this method will look for an image resources called 'abc.myProcess.png'
(or .jpg, or .gif, etc.) or 'abc.png' if the previous one wasn't found.
Example 2: if the deployment contains a BPMN 2.0 xml resource called
'abc.bpmn20.xml' containing three processes (with keys a, b and c),
then this method will first look for an image resource called 'abc.a.png'
before looking for 'abc.png' (likewise for b and c).
Note that if abc.a.png, abc.b.png and abc.c.png don't exist, all
processes will have the same image: abc.png.
@return null if no matching image resource is found. | [
"Returns",
"the",
"default",
"name",
"of",
"the",
"image",
"resource",
"for",
"a",
"certain",
"definition",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/AbstractDefinitionDeployer.java#L144-L156 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/FilenameUtils.java | FilenameUtils.generateSafetyUniqueFile | public static File generateSafetyUniqueFile(File file) throws IOException {
String path = file.getCanonicalPath();
String ext = getExtension(path);
char separator = '_';
String name1 = Long.toString(System.currentTimeMillis());
Random rnd = new Random();
String name2 = Integer.toString(rnd.nextInt(9999));
String fullName;
if (ext != null && !ext.isEmpty()) {
fullName = name1 + separator + name2 + separator + ext;
} else {
fullName = name1 + separator + name2;
}
File file2 = new File(getFullPath(path), fullName);
return getUniqueFile(file2, separator);
} | java | public static File generateSafetyUniqueFile(File file) throws IOException {
String path = file.getCanonicalPath();
String ext = getExtension(path);
char separator = '_';
String name1 = Long.toString(System.currentTimeMillis());
Random rnd = new Random();
String name2 = Integer.toString(rnd.nextInt(9999));
String fullName;
if (ext != null && !ext.isEmpty()) {
fullName = name1 + separator + name2 + separator + ext;
} else {
fullName = name1 + separator + name2;
}
File file2 = new File(getFullPath(path), fullName);
return getUniqueFile(file2, separator);
} | [
"public",
"static",
"File",
"generateSafetyUniqueFile",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"String",
"path",
"=",
"file",
".",
"getCanonicalPath",
"(",
")",
";",
"String",
"ext",
"=",
"getExtension",
"(",
"path",
")",
";",
"char",
"separ... | Creates and returns a safe file name on the system without duplication in the specified directory.
If a duplicate file name exists, it is returned by appending a number after the file name.
File extensions are separated by '_' character.
<pre>
ex) 1111111111_txt
</pre>
@param file the file to seek
@return an unique file
@throws IOException if failed to obtain an unique file | [
"Creates",
"and",
"returns",
"a",
"safe",
"file",
"name",
"on",
"the",
"system",
"without",
"duplication",
"in",
"the",
"specified",
"directory",
".",
"If",
"a",
"duplicate",
"file",
"name",
"exists",
"it",
"is",
"returned",
"by",
"appending",
"a",
"number",... | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/FilenameUtils.java#L344-L364 |
AgNO3/jcifs-ng | src/main/java/jcifs/smb/NtlmUtil.java | NtlmUtil.E | static void E ( byte[] key, byte[] data, byte[] e ) throws ShortBufferException {
byte[] key7 = new byte[7];
byte[] e8 = new byte[8];
for ( int i = 0; i < key.length / 7; i++ ) {
System.arraycopy(key, i * 7, key7, 0, 7);
Cipher des = Crypto.getDES(key7);
des.update(data, 0, data.length, e8);
System.arraycopy(e8, 0, e, i * 8, 8);
}
} | java | static void E ( byte[] key, byte[] data, byte[] e ) throws ShortBufferException {
byte[] key7 = new byte[7];
byte[] e8 = new byte[8];
for ( int i = 0; i < key.length / 7; i++ ) {
System.arraycopy(key, i * 7, key7, 0, 7);
Cipher des = Crypto.getDES(key7);
des.update(data, 0, data.length, e8);
System.arraycopy(e8, 0, e, i * 8, 8);
}
} | [
"static",
"void",
"E",
"(",
"byte",
"[",
"]",
"key",
",",
"byte",
"[",
"]",
"data",
",",
"byte",
"[",
"]",
"e",
")",
"throws",
"ShortBufferException",
"{",
"byte",
"[",
"]",
"key7",
"=",
"new",
"byte",
"[",
"7",
"]",
";",
"byte",
"[",
"]",
"e8"... | /*
Accepts key multiple of 7
Returns enc multiple of 8
Multiple is the same like: 21 byte key gives 24 byte result | [
"/",
"*",
"Accepts",
"key",
"multiple",
"of",
"7",
"Returns",
"enc",
"multiple",
"of",
"8",
"Multiple",
"is",
"the",
"same",
"like",
":",
"21",
"byte",
"key",
"gives",
"24",
"byte",
"result"
] | train | https://github.com/AgNO3/jcifs-ng/blob/0311107a077ea372527ae74839eec8042197332f/src/main/java/jcifs/smb/NtlmUtil.java#L245-L255 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/BindDataSourceSubProcessor.java | BindDataSourceSubProcessor.createSQLEntityFromDao | private boolean createSQLEntityFromDao(final SQLiteDatabaseSchema schema, TypeElement dataSource, String daoName) {
TypeElement daoElement = globalDaoElements.get(daoName);
if (daoElement == null) {
String msg = String.format("Data source %s references a DAO %s without @%s annotation",
dataSource.toString(), daoName, BindDao.class.getSimpleName());
throw (new InvalidNameException(msg));
}
String entityClassName = AnnotationUtility.extractAsClassName(daoElement, BindDao.class,
AnnotationAttributeType.VALUE);
// if there is no entity, exit now
if (!StringUtils.hasText(entityClassName)) {
return false;
}
final SQLiteEntity currentEntity = createSQLEntity(schema, daoElement, entityClassName);
if (!schema.contains(currentEntity.getName())) {
schema.addEntity(currentEntity);
}
return true;
} | java | private boolean createSQLEntityFromDao(final SQLiteDatabaseSchema schema, TypeElement dataSource, String daoName) {
TypeElement daoElement = globalDaoElements.get(daoName);
if (daoElement == null) {
String msg = String.format("Data source %s references a DAO %s without @%s annotation",
dataSource.toString(), daoName, BindDao.class.getSimpleName());
throw (new InvalidNameException(msg));
}
String entityClassName = AnnotationUtility.extractAsClassName(daoElement, BindDao.class,
AnnotationAttributeType.VALUE);
// if there is no entity, exit now
if (!StringUtils.hasText(entityClassName)) {
return false;
}
final SQLiteEntity currentEntity = createSQLEntity(schema, daoElement, entityClassName);
if (!schema.contains(currentEntity.getName())) {
schema.addEntity(currentEntity);
}
return true;
} | [
"private",
"boolean",
"createSQLEntityFromDao",
"(",
"final",
"SQLiteDatabaseSchema",
"schema",
",",
"TypeElement",
"dataSource",
",",
"String",
"daoName",
")",
"{",
"TypeElement",
"daoElement",
"=",
"globalDaoElements",
".",
"get",
"(",
"daoName",
")",
";",
"if",
... | <p>
Create bean's definition for each dao definition contained in dataSource
</p>
.
@param schema
the schema
@param dataSource
the data source
@param daoName
the dao name
@return true, if successful | [
"<p",
">",
"Create",
"bean",
"s",
"definition",
"for",
"each",
"dao",
"definition",
"contained",
"in",
"dataSource",
"<",
"/",
"p",
">",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/BindDataSourceSubProcessor.java#L725-L749 |
liferay/com-liferay-commerce | commerce-tax-engine-fixed-service/src/main/java/com/liferay/commerce/tax/engine/fixed/service/persistence/impl/CommerceTaxFixedRateAddressRelPersistenceImpl.java | CommerceTaxFixedRateAddressRelPersistenceImpl.findAll | @Override
public List<CommerceTaxFixedRateAddressRel> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceTaxFixedRateAddressRel> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceTaxFixedRateAddressRel",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the commerce tax fixed rate address rels.
@return the commerce tax fixed rate address rels | [
"Returns",
"all",
"the",
"commerce",
"tax",
"fixed",
"rate",
"address",
"rels",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-tax-engine-fixed-service/src/main/java/com/liferay/commerce/tax/engine/fixed/service/persistence/impl/CommerceTaxFixedRateAddressRelPersistenceImpl.java#L1721-L1724 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeParseContext.java | DateTimeParseContext.toResolved | TemporalAccessor toResolved(ResolverStyle resolverStyle, Set<TemporalField> resolverFields) {
Parsed parsed = currentParsed();
parsed.chrono = getEffectiveChronology();
parsed.zone = (parsed.zone != null ? parsed.zone : formatter.getZone());
return parsed.resolve(resolverStyle, resolverFields);
} | java | TemporalAccessor toResolved(ResolverStyle resolverStyle, Set<TemporalField> resolverFields) {
Parsed parsed = currentParsed();
parsed.chrono = getEffectiveChronology();
parsed.zone = (parsed.zone != null ? parsed.zone : formatter.getZone());
return parsed.resolve(resolverStyle, resolverFields);
} | [
"TemporalAccessor",
"toResolved",
"(",
"ResolverStyle",
"resolverStyle",
",",
"Set",
"<",
"TemporalField",
">",
"resolverFields",
")",
"{",
"Parsed",
"parsed",
"=",
"currentParsed",
"(",
")",
";",
"parsed",
".",
"chrono",
"=",
"getEffectiveChronology",
"(",
")",
... | Gets the resolved result of the parse.
@return the result of the parse, not null | [
"Gets",
"the",
"resolved",
"result",
"of",
"the",
"parse",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeParseContext.java#L327-L332 |
alkacon/opencms-core | src/org/opencms/webdav/CmsWebdavServlet.java | CmsWebdavServlet.checkChildLocks | private void checkChildLocks(HttpServletRequest req, String path, Hashtable<String, Integer> errorList) {
List<I_CmsRepositoryItem> list = null;
try {
list = m_session.list(path);
} catch (CmsException e) {
if (LOG.isErrorEnabled()) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_LIST_ITEMS_ERROR_1, path), e);
}
errorList.put(path, new Integer(CmsWebdavStatus.SC_INTERNAL_SERVER_ERROR));
return;
}
Iterator<I_CmsRepositoryItem> iter = list.iterator();
while (iter.hasNext()) {
I_CmsRepositoryItem element = iter.next();
if (isLocked(element.getName())) {
errorList.put(element.getName(), new Integer(CmsWebdavStatus.SC_LOCKED));
} else {
if (element.isCollection()) {
checkChildLocks(req, element.getName(), errorList);
}
}
}
} | java | private void checkChildLocks(HttpServletRequest req, String path, Hashtable<String, Integer> errorList) {
List<I_CmsRepositoryItem> list = null;
try {
list = m_session.list(path);
} catch (CmsException e) {
if (LOG.isErrorEnabled()) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_LIST_ITEMS_ERROR_1, path), e);
}
errorList.put(path, new Integer(CmsWebdavStatus.SC_INTERNAL_SERVER_ERROR));
return;
}
Iterator<I_CmsRepositoryItem> iter = list.iterator();
while (iter.hasNext()) {
I_CmsRepositoryItem element = iter.next();
if (isLocked(element.getName())) {
errorList.put(element.getName(), new Integer(CmsWebdavStatus.SC_LOCKED));
} else {
if (element.isCollection()) {
checkChildLocks(req, element.getName(), errorList);
}
}
}
} | [
"private",
"void",
"checkChildLocks",
"(",
"HttpServletRequest",
"req",
",",
"String",
"path",
",",
"Hashtable",
"<",
"String",
",",
"Integer",
">",
"errorList",
")",
"{",
"List",
"<",
"I_CmsRepositoryItem",
">",
"list",
"=",
"null",
";",
"try",
"{",
"list",... | Checks if the items in the path or in a subpath are locked.<p>
@param req the servlet request we are processing
@param path the path to check the items for locks
@param errorList the error list where to put the found errors | [
"Checks",
"if",
"the",
"items",
"in",
"the",
"path",
"or",
"in",
"a",
"subpath",
"are",
"locked",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/webdav/CmsWebdavServlet.java#L2939-L2964 |
io7m/jaffirm | com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Invariants.java | Invariants.checkInvariantI | public static int checkInvariantI(
final int value,
final boolean condition,
final IntFunction<String> describer)
{
return innerCheckInvariantI(value, condition, describer);
} | java | public static int checkInvariantI(
final int value,
final boolean condition,
final IntFunction<String> describer)
{
return innerCheckInvariantI(value, condition, describer);
} | [
"public",
"static",
"int",
"checkInvariantI",
"(",
"final",
"int",
"value",
",",
"final",
"boolean",
"condition",
",",
"final",
"IntFunction",
"<",
"String",
">",
"describer",
")",
"{",
"return",
"innerCheckInvariantI",
"(",
"value",
",",
"condition",
",",
"de... | An {@code int} specialized version of {@link #checkInvariant(Object,
boolean, Function)}.
@param value The value
@param condition The predicate
@param describer The describer for the predicate
@return value
@throws InvariantViolationException If the predicate is false | [
"An",
"{",
"@code",
"int",
"}",
"specialized",
"version",
"of",
"{",
"@link",
"#checkInvariant",
"(",
"Object",
"boolean",
"Function",
")",
"}",
"."
] | train | https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Invariants.java#L409-L415 |
leancloud/java-sdk-all | android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/pay/PaySignUtil.java | PaySignUtil.getNoSign | private static String getNoSign(Map<String, Object> params, boolean includeEmptyParam) {
//对参数按照key做升序排序,对map的所有value进行处理,转化成string类型
//拼接成key=value&key=value&....格式的字符串
StringBuilder content = new StringBuilder();
// 按照key做排序
List<String> keys = new ArrayList<String>(params.keySet());
Collections.sort(keys);
String value = null;
Object object = null;
boolean isFirstParm = true;
for (int i = 0; i < keys.size(); i++) {
String key = (String) keys.get(i);
object = params.get(key);
if (object == null) {
value = "";
}else if (object instanceof String) {
value = (String) object;
} else {
value = String.valueOf(object);
}
if (includeEmptyParam || !TextUtils.isEmpty(value)) {
content.append((isFirstParm ? "" : "&") + key + "=" + value);
isFirstParm = false;
} else {
continue;
}
}
//待签名的字符串
return content.toString();
} | java | private static String getNoSign(Map<String, Object> params, boolean includeEmptyParam) {
//对参数按照key做升序排序,对map的所有value进行处理,转化成string类型
//拼接成key=value&key=value&....格式的字符串
StringBuilder content = new StringBuilder();
// 按照key做排序
List<String> keys = new ArrayList<String>(params.keySet());
Collections.sort(keys);
String value = null;
Object object = null;
boolean isFirstParm = true;
for (int i = 0; i < keys.size(); i++) {
String key = (String) keys.get(i);
object = params.get(key);
if (object == null) {
value = "";
}else if (object instanceof String) {
value = (String) object;
} else {
value = String.valueOf(object);
}
if (includeEmptyParam || !TextUtils.isEmpty(value)) {
content.append((isFirstParm ? "" : "&") + key + "=" + value);
isFirstParm = false;
} else {
continue;
}
}
//待签名的字符串
return content.toString();
} | [
"private",
"static",
"String",
"getNoSign",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
",",
"boolean",
"includeEmptyParam",
")",
"{",
"//对参数按照key做升序排序,对map的所有value进行处理,转化成string类型\r",
"//拼接成key=value&key=value&....格式的字符串\r",
"StringBuilder",
"content",
"=",
... | 根据参数map获取待签名字符串
@param params 待签名参数map
@param includeEmptyParam 是否包含值为空的参数:
与 HMS-SDK 支付能力交互的签名或验签,需要为false(不包含空参数)
由华为支付服务器回调给开发者的服务器的支付结果验签,需要为true(包含空参数)
@return 待签名字符串 | [
"根据参数map获取待签名字符串"
] | train | https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/pay/PaySignUtil.java#L331-L365 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/link/FeatureTileTableCoreLinker.java | FeatureTileTableCoreLinker.deleteLink | public boolean deleteLink(String featureTable, String tileTable) {
boolean deleted = false;
try {
if (featureTileLinkDao.isTableExists()) {
FeatureTileLinkKey id = new FeatureTileLinkKey(featureTable,
tileTable);
deleted = featureTileLinkDao.deleteById(id) > 0;
}
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to delete feature tile link for GeoPackage: "
+ geoPackage.getName() + ", Feature Table: "
+ featureTable + ", Tile Table: " + tileTable, e);
}
return deleted;
} | java | public boolean deleteLink(String featureTable, String tileTable) {
boolean deleted = false;
try {
if (featureTileLinkDao.isTableExists()) {
FeatureTileLinkKey id = new FeatureTileLinkKey(featureTable,
tileTable);
deleted = featureTileLinkDao.deleteById(id) > 0;
}
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to delete feature tile link for GeoPackage: "
+ geoPackage.getName() + ", Feature Table: "
+ featureTable + ", Tile Table: " + tileTable, e);
}
return deleted;
} | [
"public",
"boolean",
"deleteLink",
"(",
"String",
"featureTable",
",",
"String",
"tileTable",
")",
"{",
"boolean",
"deleted",
"=",
"false",
";",
"try",
"{",
"if",
"(",
"featureTileLinkDao",
".",
"isTableExists",
"(",
")",
")",
"{",
"FeatureTileLinkKey",
"id",
... | Delete the feature tile table link
@param featureTable
feature table
@param tileTable
tile table
@return true if deleted | [
"Delete",
"the",
"feature",
"tile",
"table",
"link"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/link/FeatureTileTableCoreLinker.java#L205-L223 |
cdk/cdk | tool/group/src/main/java/org/openscience/cdk/group/Partition.java | Partition.inSameCell | public boolean inSameCell(int elementI, int elementJ) {
for (int cellIndex = 0; cellIndex < size(); cellIndex++) {
SortedSet<Integer> cell = getCell(cellIndex);
if (cell.contains(elementI) && cell.contains(elementJ)) {
return true;
}
}
return false;
} | java | public boolean inSameCell(int elementI, int elementJ) {
for (int cellIndex = 0; cellIndex < size(); cellIndex++) {
SortedSet<Integer> cell = getCell(cellIndex);
if (cell.contains(elementI) && cell.contains(elementJ)) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"inSameCell",
"(",
"int",
"elementI",
",",
"int",
"elementJ",
")",
"{",
"for",
"(",
"int",
"cellIndex",
"=",
"0",
";",
"cellIndex",
"<",
"size",
"(",
")",
";",
"cellIndex",
"++",
")",
"{",
"SortedSet",
"<",
"Integer",
">",
"cell",
... | Check that two elements are in the same cell of the partition.
@param elementI an element in the partition
@param elementJ an element in the partition
@return true if both elements are in the same cell | [
"Check",
"that",
"two",
"elements",
"are",
"in",
"the",
"same",
"cell",
"of",
"the",
"partition",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/group/src/main/java/org/openscience/cdk/group/Partition.java#L407-L415 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutUtil.java | LayoutUtil.copyAttributes | public static void copyAttributes(Element source, Map<String, String> dest) {
NamedNodeMap attributes = source.getAttributes();
if (attributes != null) {
for (int i = 0; i < attributes.getLength(); i++) {
Node attribute = attributes.item(i);
dest.put(attribute.getNodeName(), attribute.getNodeValue());
}
}
} | java | public static void copyAttributes(Element source, Map<String, String> dest) {
NamedNodeMap attributes = source.getAttributes();
if (attributes != null) {
for (int i = 0; i < attributes.getLength(); i++) {
Node attribute = attributes.item(i);
dest.put(attribute.getNodeName(), attribute.getNodeValue());
}
}
} | [
"public",
"static",
"void",
"copyAttributes",
"(",
"Element",
"source",
",",
"Map",
"<",
"String",
",",
"String",
">",
"dest",
")",
"{",
"NamedNodeMap",
"attributes",
"=",
"source",
".",
"getAttributes",
"(",
")",
";",
"if",
"(",
"attributes",
"!=",
"null"... | Copy attributes from a DOM node to a map.
@param source DOM node.
@param dest Destination map. | [
"Copy",
"attributes",
"from",
"a",
"DOM",
"node",
"to",
"a",
"map",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutUtil.java#L147-L156 |
google/closure-compiler | src/com/google/javascript/jscomp/NodeUtil.java | NodeUtil.newName | static Node newName(AbstractCompiler compiler, String name, Node srcref) {
return newName(compiler, name).srcref(srcref);
} | java | static Node newName(AbstractCompiler compiler, String name, Node srcref) {
return newName(compiler, name).srcref(srcref);
} | [
"static",
"Node",
"newName",
"(",
"AbstractCompiler",
"compiler",
",",
"String",
"name",
",",
"Node",
"srcref",
")",
"{",
"return",
"newName",
"(",
"compiler",
",",
"name",
")",
".",
"srcref",
"(",
"srcref",
")",
";",
"}"
] | Creates a new node representing an *existing* name, copying over the source
location information from the basis node.
@param name The name for the new NAME node.
@param srcref The node that represents the name as currently found in
the AST.
@return The node created. | [
"Creates",
"a",
"new",
"node",
"representing",
"an",
"*",
"existing",
"*",
"name",
"copying",
"over",
"the",
"source",
"location",
"information",
"from",
"the",
"basis",
"node",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L4144-L4146 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java | TransliteratorParser.syntaxError | static final void syntaxError(String msg, String rule, int start) {
int end = ruleEnd(rule, start, rule.length());
throw new IllegalIcuArgumentException(msg + " in \"" +
Utility.escape(rule.substring(start, end)) + '"');
} | java | static final void syntaxError(String msg, String rule, int start) {
int end = ruleEnd(rule, start, rule.length());
throw new IllegalIcuArgumentException(msg + " in \"" +
Utility.escape(rule.substring(start, end)) + '"');
} | [
"static",
"final",
"void",
"syntaxError",
"(",
"String",
"msg",
",",
"String",
"rule",
",",
"int",
"start",
")",
"{",
"int",
"end",
"=",
"ruleEnd",
"(",
"rule",
",",
"start",
",",
"rule",
".",
"length",
"(",
")",
")",
";",
"throw",
"new",
"IllegalIcu... | Throw an exception indicating a syntax error. Search the rule string
for the probable end of the rule. Of course, if the error is that
the end of rule marker is missing, then the rule end will not be found.
In any case the rule start will be correctly reported.
@param msg error description
@param rule pattern string
@param start position of first character of current rule | [
"Throw",
"an",
"exception",
"indicating",
"a",
"syntax",
"error",
".",
"Search",
"the",
"rule",
"string",
"for",
"the",
"probable",
"end",
"of",
"the",
"rule",
".",
"Of",
"course",
"if",
"the",
"error",
"is",
"that",
"the",
"end",
"of",
"rule",
"marker",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java#L1435-L1439 |
thinkaurelius/faunus | src/main/java/com/thinkaurelius/faunus/FaunusPipeline.java | FaunusPipeline.linkIn | public FaunusPipeline linkIn(final String label, final String step, final String mergeWeightKey) {
return this.link(IN, label, step, mergeWeightKey);
} | java | public FaunusPipeline linkIn(final String label, final String step, final String mergeWeightKey) {
return this.link(IN, label, step, mergeWeightKey);
} | [
"public",
"FaunusPipeline",
"linkIn",
"(",
"final",
"String",
"label",
",",
"final",
"String",
"step",
",",
"final",
"String",
"mergeWeightKey",
")",
"{",
"return",
"this",
".",
"link",
"(",
"IN",
",",
"label",
",",
"step",
",",
"mergeWeightKey",
")",
";",... | Have the elements for the named step previous project an edge to the current vertex with provided label.
If a merge weight key is provided, then count the number of duplicate edges between the same two vertices and add a weight.
No weight key is specified by "_" and then all duplicates are merged, but no weight is added to the resultant edge.
@param step the name of the step where the source vertices were
@param label the label of the edge to project
@param mergeWeightKey the property key to use for weight
@return the extended FaunusPipeline | [
"Have",
"the",
"elements",
"for",
"the",
"named",
"step",
"previous",
"project",
"an",
"edge",
"to",
"the",
"current",
"vertex",
"with",
"provided",
"label",
".",
"If",
"a",
"merge",
"weight",
"key",
"is",
"provided",
"then",
"count",
"the",
"number",
"of"... | train | https://github.com/thinkaurelius/faunus/blob/1eb8494eeb3fe3b84a98d810d304ba01d55b0d6e/src/main/java/com/thinkaurelius/faunus/FaunusPipeline.java#L831-L833 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/operator/TableFinishOperator.java | TableFinishOperator.isStatisticsPosition | private static boolean isStatisticsPosition(Page page, int position)
{
return page.getBlock(ROW_COUNT_CHANNEL).isNull(position) && page.getBlock(FRAGMENT_CHANNEL).isNull(position);
} | java | private static boolean isStatisticsPosition(Page page, int position)
{
return page.getBlock(ROW_COUNT_CHANNEL).isNull(position) && page.getBlock(FRAGMENT_CHANNEL).isNull(position);
} | [
"private",
"static",
"boolean",
"isStatisticsPosition",
"(",
"Page",
"page",
",",
"int",
"position",
")",
"{",
"return",
"page",
".",
"getBlock",
"(",
"ROW_COUNT_CHANNEL",
")",
".",
"isNull",
"(",
"position",
")",
"&&",
"page",
".",
"getBlock",
"(",
"FRAGMEN... | Both the statistics and the row_count + fragments are transferred over the same communication
link between the TableWriterOperator and the TableFinishOperator. Thus the multiplexing is needed.
<p>
The transferred page layout looks like:
<p>
[[row_count_channel], [fragment_channel], [statistic_channel_1] ... [statistic_channel_N]]
<p>
[row_count_channel] - contains number of rows processed by a TableWriterOperator instance
[fragment_channel] - contains arbitrary binary data provided by the ConnectorPageSink#finish for
the further post processing on the coordinator
<p>
[statistic_channel_1] ... [statistic_channel_N] - contain pre-aggregated statistics computed by the
statistics aggregation operator within the
TableWriterOperator
<p>
Since the final aggregation operator in the TableFinishOperator doesn't know what to do with the
first two channels, those must be pruned. For the convenience we never set both, the
[row_count_channel] + [fragment_channel] and the [statistic_channel_1] ... [statistic_channel_N].
<p>
If this is a row that holds statistics - the [row_count_channel] + [fragment_channel] will be NULL.
<p>
It this is a row that holds the row count or the fragment - all the statistics channels will be set
to NULL.
<p>
Since neither [row_count_channel] or [fragment_channel] cannot hold the NULL value naturally, by
checking isNull on these two channels we can determine if this is a row that contains statistics. | [
"Both",
"the",
"statistics",
"and",
"the",
"row_count",
"+",
"fragments",
"are",
"transferred",
"over",
"the",
"same",
"communication",
"link",
"between",
"the",
"TableWriterOperator",
"and",
"the",
"TableFinishOperator",
".",
"Thus",
"the",
"multiplexing",
"is",
... | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/TableFinishOperator.java#L263-L266 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.createImageRegionsWithServiceResponseAsync | public Observable<ServiceResponse<ImageRegionCreateSummary>> createImageRegionsWithServiceResponseAsync(UUID projectId, CreateImageRegionsOptionalParameter createImageRegionsOptionalParameter) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
final List<ImageRegionCreateEntry> regions = createImageRegionsOptionalParameter != null ? createImageRegionsOptionalParameter.regions() : null;
return createImageRegionsWithServiceResponseAsync(projectId, regions);
} | java | public Observable<ServiceResponse<ImageRegionCreateSummary>> createImageRegionsWithServiceResponseAsync(UUID projectId, CreateImageRegionsOptionalParameter createImageRegionsOptionalParameter) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
final List<ImageRegionCreateEntry> regions = createImageRegionsOptionalParameter != null ? createImageRegionsOptionalParameter.regions() : null;
return createImageRegionsWithServiceResponseAsync(projectId, regions);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"ImageRegionCreateSummary",
">",
">",
"createImageRegionsWithServiceResponseAsync",
"(",
"UUID",
"projectId",
",",
"CreateImageRegionsOptionalParameter",
"createImageRegionsOptionalParameter",
")",
"{",
"if",
"(",
"projectId"... | Create a set of image regions.
This API accepts a batch of image regions, and optionally tags, to update existing images with region information.
There is a limit of 64 entries in the batch.
@param projectId The project id
@param createImageRegionsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageRegionCreateSummary object | [
"Create",
"a",
"set",
"of",
"image",
"regions",
".",
"This",
"API",
"accepts",
"a",
"batch",
"of",
"image",
"regions",
"and",
"optionally",
"tags",
"to",
"update",
"existing",
"images",
"with",
"region",
"information",
".",
"There",
"is",
"a",
"limit",
"of... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L3393-L3403 |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/VertexCentricConfiguration.java | VertexCentricConfiguration.addBroadcastSet | public void addBroadcastSet(String name, DataSet<?> data) {
this.bcVars.add(new Tuple2<>(name, data));
} | java | public void addBroadcastSet(String name, DataSet<?> data) {
this.bcVars.add(new Tuple2<>(name, data));
} | [
"public",
"void",
"addBroadcastSet",
"(",
"String",
"name",
",",
"DataSet",
"<",
"?",
">",
"data",
")",
"{",
"this",
".",
"bcVars",
".",
"add",
"(",
"new",
"Tuple2",
"<>",
"(",
"name",
",",
"data",
")",
")",
";",
"}"
] | Adds a data set as a broadcast set to the compute function.
@param name The name under which the broadcast data set is available in the compute function.
@param data The data set to be broadcast. | [
"Adds",
"a",
"data",
"set",
"as",
"a",
"broadcast",
"set",
"to",
"the",
"compute",
"function",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/VertexCentricConfiguration.java#L50-L52 |
lightblue-platform/lightblue-client | core/src/main/java/com/redhat/lightblue/client/request/DataBulkRequest.java | DataBulkRequest.insertBefore | public DataBulkRequest insertBefore(CRUDRequest request, CRUDRequest before) {
this.requests.add(requests.indexOf(before), request);
return this;
} | java | public DataBulkRequest insertBefore(CRUDRequest request, CRUDRequest before) {
this.requests.add(requests.indexOf(before), request);
return this;
} | [
"public",
"DataBulkRequest",
"insertBefore",
"(",
"CRUDRequest",
"request",
",",
"CRUDRequest",
"before",
")",
"{",
"this",
".",
"requests",
".",
"add",
"(",
"requests",
".",
"indexOf",
"(",
"before",
")",
",",
"request",
")",
";",
"return",
"this",
";",
"... | Inserts a request before another specified request. This guarantees that
the first request parameter will be executed, sequentially, before the
second request parameter. It does not guarantee consecutive execution.
@param request
@param before
@return | [
"Inserts",
"a",
"request",
"before",
"another",
"specified",
"request",
".",
"This",
"guarantees",
"that",
"the",
"first",
"request",
"parameter",
"will",
"be",
"executed",
"sequentially",
"before",
"the",
"second",
"request",
"parameter",
".",
"It",
"does",
"no... | train | https://github.com/lightblue-platform/lightblue-client/blob/03790aff34e90d3889f60fd6c603c21a21dc1a40/core/src/main/java/com/redhat/lightblue/client/request/DataBulkRequest.java#L85-L88 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/util/ReflectionUtils.java | ReflectionUtils.findMethod | public static Method findMethod(Method methodToFind, Class<?> cls) {
if (cls == null) {
return null;
}
String methodToSearch = methodToFind.getName();
Class<?>[] soughtForParameterType = methodToFind.getParameterTypes();
Type[] soughtForGenericParameterType = methodToFind.getGenericParameterTypes();
for (Method method : cls.getMethods()) {
if (method.getName().equals(methodToSearch) && method.getReturnType().isAssignableFrom(methodToFind.getReturnType())) {
Class<?>[] srcParameterTypes = method.getParameterTypes();
Type[] srcGenericParameterTypes = method.getGenericParameterTypes();
if (soughtForParameterType.length == srcParameterTypes.length &&
soughtForGenericParameterType.length == srcGenericParameterTypes.length) {
if (hasIdenticalParameters(srcParameterTypes, soughtForParameterType, srcGenericParameterTypes, soughtForGenericParameterType)) {
return method;
}
}
}
}
return null;
} | java | public static Method findMethod(Method methodToFind, Class<?> cls) {
if (cls == null) {
return null;
}
String methodToSearch = methodToFind.getName();
Class<?>[] soughtForParameterType = methodToFind.getParameterTypes();
Type[] soughtForGenericParameterType = methodToFind.getGenericParameterTypes();
for (Method method : cls.getMethods()) {
if (method.getName().equals(methodToSearch) && method.getReturnType().isAssignableFrom(methodToFind.getReturnType())) {
Class<?>[] srcParameterTypes = method.getParameterTypes();
Type[] srcGenericParameterTypes = method.getGenericParameterTypes();
if (soughtForParameterType.length == srcParameterTypes.length &&
soughtForGenericParameterType.length == srcGenericParameterTypes.length) {
if (hasIdenticalParameters(srcParameterTypes, soughtForParameterType, srcGenericParameterTypes, soughtForGenericParameterType)) {
return method;
}
}
}
}
return null;
} | [
"public",
"static",
"Method",
"findMethod",
"(",
"Method",
"methodToFind",
",",
"Class",
"<",
"?",
">",
"cls",
")",
"{",
"if",
"(",
"cls",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"methodToSearch",
"=",
"methodToFind",
".",
"getName"... | Searches the method methodToFind in given class cls. If the method is found returns it, else return null.
@param methodToFind is the method to search
@param cls is the class or interface where to search
@return method if it is found | [
"Searches",
"the",
"method",
"methodToFind",
"in",
"given",
"class",
"cls",
".",
"If",
"the",
"method",
"is",
"found",
"returns",
"it",
"else",
"return",
"null",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/util/ReflectionUtils.java#L128-L148 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java | SeleniumHelper.findElement | public T findElement(SearchContext context, By by) {
return FirstElementBy.getWebElement(by, context);
} | java | public T findElement(SearchContext context, By by) {
return FirstElementBy.getWebElement(by, context);
} | [
"public",
"T",
"findElement",
"(",
"SearchContext",
"context",
",",
"By",
"by",
")",
"{",
"return",
"FirstElementBy",
".",
"getWebElement",
"(",
"by",
",",
"context",
")",
";",
"}"
] | Finds element matching the By supplied.
@param context context to find element in.
@param by criteria.
@return element if found, null if none could be found. | [
"Finds",
"element",
"matching",
"the",
"By",
"supplied",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L957-L959 |
XDean/Java-EX | src/main/java/xdean/jex/util/collection/MapUtil.java | MapUtil.getOrPutDefault | @Deprecated
public static <K, V> V getOrPutDefault(Map<K, V> map, K key, Supplier<V> defaultGetter) {
return map.computeIfAbsent(key, k -> defaultGetter.get());
} | java | @Deprecated
public static <K, V> V getOrPutDefault(Map<K, V> map, K key, Supplier<V> defaultGetter) {
return map.computeIfAbsent(key, k -> defaultGetter.get());
} | [
"@",
"Deprecated",
"public",
"static",
"<",
"K",
",",
"V",
">",
"V",
"getOrPutDefault",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"K",
"key",
",",
"Supplier",
"<",
"V",
">",
"defaultGetter",
")",
"{",
"return",
"map",
".",
"computeIfAbsent",
... | Get the value of the key. If absent, put the default value.
@param map
@param key
@param defaultGetter
@return | [
"Get",
"the",
"value",
"of",
"the",
"key",
".",
"If",
"absent",
"put",
"the",
"default",
"value",
"."
] | train | https://github.com/XDean/Java-EX/blob/9208ba71c5b2af9f9bd979d01fab2ff5e433b3e7/src/main/java/xdean/jex/util/collection/MapUtil.java#L27-L30 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ClassUtility.java | ClassUtility.findGenericClass | public static Class<?> findGenericClass(final Class<?> mainClass, final Class<?> assignableClass) {
return findGenericClass(mainClass, new Class<?>[] { assignableClass });
} | java | public static Class<?> findGenericClass(final Class<?> mainClass, final Class<?> assignableClass) {
return findGenericClass(mainClass, new Class<?>[] { assignableClass });
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"findGenericClass",
"(",
"final",
"Class",
"<",
"?",
">",
"mainClass",
",",
"final",
"Class",
"<",
"?",
">",
"assignableClass",
")",
"{",
"return",
"findGenericClass",
"(",
"mainClass",
",",
"new",
"Class",
"<",
... | Return the generic class for the given parent class and index.
@param mainClass the parent class
@param assignableClass the parent type of the generic to build
@return the class of the generic type according to the index provided or null if not found | [
"Return",
"the",
"generic",
"class",
"for",
"the",
"given",
"parent",
"class",
"and",
"index",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ClassUtility.java#L202-L204 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.getTriangleCentroid | public static Coordinate getTriangleCentroid( Coordinate A, Coordinate B, Coordinate C ) {
double cx = (A.x + B.x + C.x) / 3.0;
double cy = (A.y + B.y + C.y) / 3.0;
double cz = (A.z + B.z + C.z) / 3.0;
return new Coordinate(cx, cy, cz);
} | java | public static Coordinate getTriangleCentroid( Coordinate A, Coordinate B, Coordinate C ) {
double cx = (A.x + B.x + C.x) / 3.0;
double cy = (A.y + B.y + C.y) / 3.0;
double cz = (A.z + B.z + C.z) / 3.0;
return new Coordinate(cx, cy, cz);
} | [
"public",
"static",
"Coordinate",
"getTriangleCentroid",
"(",
"Coordinate",
"A",
",",
"Coordinate",
"B",
",",
"Coordinate",
"C",
")",
"{",
"double",
"cx",
"=",
"(",
"A",
".",
"x",
"+",
"B",
".",
"x",
"+",
"C",
".",
"x",
")",
"/",
"3.0",
";",
"doubl... | Get the 3d centroid {@link Coordinate} of a triangle.
@param A coordinate 1.
@param B coordinate 2.
@param C coordinate 3.
@return the centroid coordinate. | [
"Get",
"the",
"3d",
"centroid",
"{",
"@link",
"Coordinate",
"}",
"of",
"a",
"triangle",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L891-L896 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.itemData | private ItemData itemData(QPath parentPath, ResultSet item, int itemClass, AccessControlList parentACL)
throws RepositoryException, SQLException, IOException
{
String cid = item.getString(COLUMN_ID);
String cname = item.getString(COLUMN_NAME);
int cversion = item.getInt(COLUMN_VERSION);
String cpid = item.getString(COLUMN_PARENTID);
// if parent ID is empty string - it's a root node
// cpid = cpid.equals(Constants.ROOT_PARENT_UUID) ? null : cpid;
try
{
if (itemClass == I_CLASS_NODE)
{
int cindex = item.getInt(COLUMN_INDEX);
int cnordernumb = item.getInt(COLUMN_NORDERNUM);
return loadNodeRecord(parentPath, cname, cid, cpid, cindex, cversion, cnordernumb, parentACL);
}
int cptype = item.getInt(COLUMN_PTYPE);
boolean cpmultivalued = item.getBoolean(COLUMN_PMULTIVALUED);
return loadPropertyRecord(parentPath, cname, cid, cpid, cversion, cptype, cpmultivalued);
}
catch (InvalidItemStateException e)
{
throw new InvalidItemStateException("FATAL: Can't build item path for name " + cname + " id: "
+ getIdentifier(cid) + ". " + e);
}
} | java | private ItemData itemData(QPath parentPath, ResultSet item, int itemClass, AccessControlList parentACL)
throws RepositoryException, SQLException, IOException
{
String cid = item.getString(COLUMN_ID);
String cname = item.getString(COLUMN_NAME);
int cversion = item.getInt(COLUMN_VERSION);
String cpid = item.getString(COLUMN_PARENTID);
// if parent ID is empty string - it's a root node
// cpid = cpid.equals(Constants.ROOT_PARENT_UUID) ? null : cpid;
try
{
if (itemClass == I_CLASS_NODE)
{
int cindex = item.getInt(COLUMN_INDEX);
int cnordernumb = item.getInt(COLUMN_NORDERNUM);
return loadNodeRecord(parentPath, cname, cid, cpid, cindex, cversion, cnordernumb, parentACL);
}
int cptype = item.getInt(COLUMN_PTYPE);
boolean cpmultivalued = item.getBoolean(COLUMN_PMULTIVALUED);
return loadPropertyRecord(parentPath, cname, cid, cpid, cversion, cptype, cpmultivalued);
}
catch (InvalidItemStateException e)
{
throw new InvalidItemStateException("FATAL: Can't build item path for name " + cname + " id: "
+ getIdentifier(cid) + ". " + e);
}
} | [
"private",
"ItemData",
"itemData",
"(",
"QPath",
"parentPath",
",",
"ResultSet",
"item",
",",
"int",
"itemClass",
",",
"AccessControlList",
"parentACL",
")",
"throws",
"RepositoryException",
",",
"SQLException",
",",
"IOException",
"{",
"String",
"cid",
"=",
"item... | Build ItemData.
@param parentPath
- parent path
@param item
database - ResultSet with Item record(s)
@param itemClass
- Item type (Node or Property)
@param parentACL
- parent ACL
@return ItemData instance
@throws RepositoryException
Repository error
@throws SQLException
database error
@throws IOException
I/O error | [
"Build",
"ItemData",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L1984-L2013 |
mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnCreateViewHolderListenerImpl.java | OnCreateViewHolderListenerImpl.onPreCreateViewHolder | @Override
public RecyclerView.ViewHolder onPreCreateViewHolder(FastAdapter<Item> fastAdapter, ViewGroup parent, int viewType) {
return fastAdapter.getTypeInstance(viewType).getViewHolder(parent);
} | java | @Override
public RecyclerView.ViewHolder onPreCreateViewHolder(FastAdapter<Item> fastAdapter, ViewGroup parent, int viewType) {
return fastAdapter.getTypeInstance(viewType).getViewHolder(parent);
} | [
"@",
"Override",
"public",
"RecyclerView",
".",
"ViewHolder",
"onPreCreateViewHolder",
"(",
"FastAdapter",
"<",
"Item",
">",
"fastAdapter",
",",
"ViewGroup",
"parent",
",",
"int",
"viewType",
")",
"{",
"return",
"fastAdapter",
".",
"getTypeInstance",
"(",
"viewTyp... | is called inside the onCreateViewHolder method and creates the viewHolder based on the provided viewTyp
@param parent the parent which will host the View
@param viewType the type of the ViewHolder we want to create
@return the generated ViewHolder based on the given viewType | [
"is",
"called",
"inside",
"the",
"onCreateViewHolder",
"method",
"and",
"creates",
"the",
"viewHolder",
"based",
"on",
"the",
"provided",
"viewTyp"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnCreateViewHolderListenerImpl.java#L21-L24 |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/OutputUtil.java | OutputUtil.appendList | public static <T> StringBuilder appendList(StringBuilder sb, List<T> list, String delimiter) {
boolean firstRun = true;
for(T elem: list) {
if(!firstRun)
sb.append(delimiter);
else
firstRun = false;
sb.append(elem.toString());
}
return sb;
} | java | public static <T> StringBuilder appendList(StringBuilder sb, List<T> list, String delimiter) {
boolean firstRun = true;
for(T elem: list) {
if(!firstRun)
sb.append(delimiter);
else
firstRun = false;
sb.append(elem.toString());
}
return sb;
} | [
"public",
"static",
"<",
"T",
">",
"StringBuilder",
"appendList",
"(",
"StringBuilder",
"sb",
",",
"List",
"<",
"T",
">",
"list",
",",
"String",
"delimiter",
")",
"{",
"boolean",
"firstRun",
"=",
"true",
";",
"for",
"(",
"T",
"elem",
":",
"list",
")",
... | Appends all elements of <code>list</code> to buffer, separated by delimiter
@param <T> Type of elements stored in <code>list</code>
@param sb StringBuilder to be modified
@param list List of elements
@param delimiter Delimiter to separate elements
@return Modified <code>sb</code> to allow chaining | [
"Appends",
"all",
"elements",
"of",
"<code",
">",
"list<",
"/",
"code",
">",
"to",
"buffer",
"separated",
"by",
"delimiter"
] | train | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/OutputUtil.java#L109-L124 |
Alluxio/alluxio | core/server/common/src/main/java/alluxio/ProcessUtils.java | ProcessUtils.fatalError | public static void fatalError(Logger logger, Throwable t, String format, Object... args) {
String message = String.format("Fatal error: " + format, args);
if (t != null) {
message += "\n" + ExceptionUtils.getStackTrace(t);
}
if (ServerConfiguration.getBoolean(PropertyKey.TEST_MODE)) {
throw new RuntimeException(message);
}
logger.error(message);
System.exit(-1);
} | java | public static void fatalError(Logger logger, Throwable t, String format, Object... args) {
String message = String.format("Fatal error: " + format, args);
if (t != null) {
message += "\n" + ExceptionUtils.getStackTrace(t);
}
if (ServerConfiguration.getBoolean(PropertyKey.TEST_MODE)) {
throw new RuntimeException(message);
}
logger.error(message);
System.exit(-1);
} | [
"public",
"static",
"void",
"fatalError",
"(",
"Logger",
"logger",
",",
"Throwable",
"t",
",",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"Fatal error: \"",
"+",
"format",
",",
"arg... | Logs a fatal error and then exits the system.
@param logger the logger to log to
@param t the throwable causing the fatal error
@param format the error message format string
@param args args for the format string | [
"Logs",
"a",
"fatal",
"error",
"and",
"then",
"exits",
"the",
"system",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/ProcessUtils.java#L69-L79 |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/RestClient.java | RestClient.updateAttachment | @Override
public Attachment updateAttachment(String assetId, AttachmentSummary summary) throws IOException, BadVersionException, RequestFailureException {
// First find the attachment to update
Asset ass = getAsset(assetId);
List<Attachment> attachments = ass.getAttachments();
if (attachments != null) {
for (Attachment attachment : attachments) {
if (attachment.getName().equals(summary.getName())) {
this.deleteAttachment(assetId, attachment.get_id());
break;
}
}
}
return this.addAttachment(assetId, summary);
} | java | @Override
public Attachment updateAttachment(String assetId, AttachmentSummary summary) throws IOException, BadVersionException, RequestFailureException {
// First find the attachment to update
Asset ass = getAsset(assetId);
List<Attachment> attachments = ass.getAttachments();
if (attachments != null) {
for (Attachment attachment : attachments) {
if (attachment.getName().equals(summary.getName())) {
this.deleteAttachment(assetId, attachment.get_id());
break;
}
}
}
return this.addAttachment(assetId, summary);
} | [
"@",
"Override",
"public",
"Attachment",
"updateAttachment",
"(",
"String",
"assetId",
",",
"AttachmentSummary",
"summary",
")",
"throws",
"IOException",
",",
"BadVersionException",
",",
"RequestFailureException",
"{",
"// First find the attachment to update",
"Asset",
"ass... | This method will update an existing attachment on an asset. Note that
Massive currently doesn't support update attachment so this will do a
delete and an add.
@param assetId
The ID of the asset that the attachment is attached to
@param name
The name of the attachment to update
@param file
The file to attach
@param attach
Attachment metadata
@return
@throws IOException
@throws RequestFailureException | [
"This",
"method",
"will",
"update",
"an",
"existing",
"attachment",
"on",
"an",
"asset",
".",
"Note",
"that",
"Massive",
"currently",
"doesn",
"t",
"support",
"update",
"attachment",
"so",
"this",
"will",
"do",
"a",
"delete",
"and",
"an",
"add",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/RestClient.java#L774-L789 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagEditable.java | CmsJspTagEditable.setDirectEditProvider | protected static void setDirectEditProvider(PageContext context, I_CmsDirectEditProvider provider) {
// set the direct edit provider as attribute to the request
context.getRequest().setAttribute(I_CmsDirectEditProvider.ATTRIBUTE_DIRECT_EDIT_PROVIDER, provider);
} | java | protected static void setDirectEditProvider(PageContext context, I_CmsDirectEditProvider provider) {
// set the direct edit provider as attribute to the request
context.getRequest().setAttribute(I_CmsDirectEditProvider.ATTRIBUTE_DIRECT_EDIT_PROVIDER, provider);
} | [
"protected",
"static",
"void",
"setDirectEditProvider",
"(",
"PageContext",
"context",
",",
"I_CmsDirectEditProvider",
"provider",
")",
"{",
"// set the direct edit provider as attribute to the request",
"context",
".",
"getRequest",
"(",
")",
".",
"setAttribute",
"(",
"I_C... | Sets the current initialized instance of the direct edit provider.<p>
@param context the current JSP page context
@param provider the current initialized instance of the direct edit provider to set | [
"Sets",
"the",
"current",
"initialized",
"instance",
"of",
"the",
"direct",
"edit",
"provider",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagEditable.java#L343-L347 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/SubscriptionsApi.java | SubscriptionsApi.validateSubscription | public SubscriptionEnvelope validateSubscription(String subId, ValidationCallbackInfo validationCallbackRequest) throws ApiException {
ApiResponse<SubscriptionEnvelope> resp = validateSubscriptionWithHttpInfo(subId, validationCallbackRequest);
return resp.getData();
} | java | public SubscriptionEnvelope validateSubscription(String subId, ValidationCallbackInfo validationCallbackRequest) throws ApiException {
ApiResponse<SubscriptionEnvelope> resp = validateSubscriptionWithHttpInfo(subId, validationCallbackRequest);
return resp.getData();
} | [
"public",
"SubscriptionEnvelope",
"validateSubscription",
"(",
"String",
"subId",
",",
"ValidationCallbackInfo",
"validationCallbackRequest",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"SubscriptionEnvelope",
">",
"resp",
"=",
"validateSubscriptionWithHttpInfo",
... | Validate Subscription
Validate Subscription
@param subId Subscription ID. (required)
@param validationCallbackRequest Subscription validation callback request (required)
@return SubscriptionEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Validate",
"Subscription",
"Validate",
"Subscription"
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/SubscriptionsApi.java#L749-L752 |
jbundle/jbundle | thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageReceiver.java | RemoteMessageReceiver.removeMessageFilter | public boolean removeMessageFilter(MessageFilter messageFilter, boolean bFreeFilter)
{
boolean bSuccess = false;
try {
if (((BaseMessageFilter)messageFilter).getRemoteFilterID() == null)
bSuccess = true; // No remote filter to remove
else
bSuccess = m_receiveQueue.removeRemoteMessageFilter((BaseMessageFilter)messageFilter, bFreeFilter);
} catch (RemoteException ex) {
ex.printStackTrace();
}
if (!bSuccess)
Util.getLogger().warning("Remote listener not removed"); // Never
return super.removeMessageFilter(messageFilter, bFreeFilter);
} | java | public boolean removeMessageFilter(MessageFilter messageFilter, boolean bFreeFilter)
{
boolean bSuccess = false;
try {
if (((BaseMessageFilter)messageFilter).getRemoteFilterID() == null)
bSuccess = true; // No remote filter to remove
else
bSuccess = m_receiveQueue.removeRemoteMessageFilter((BaseMessageFilter)messageFilter, bFreeFilter);
} catch (RemoteException ex) {
ex.printStackTrace();
}
if (!bSuccess)
Util.getLogger().warning("Remote listener not removed"); // Never
return super.removeMessageFilter(messageFilter, bFreeFilter);
} | [
"public",
"boolean",
"removeMessageFilter",
"(",
"MessageFilter",
"messageFilter",
",",
"boolean",
"bFreeFilter",
")",
"{",
"boolean",
"bSuccess",
"=",
"false",
";",
"try",
"{",
"if",
"(",
"(",
"(",
"BaseMessageFilter",
")",
"messageFilter",
")",
".",
"getRemote... | Remove this message filter from this queue.
Also remove the remote message filter.
@param messageFilter The message filter to remove.
@param bFreeFilter If true, free this filter.
@return True if successful. | [
"Remove",
"this",
"message",
"filter",
"from",
"this",
"queue",
".",
"Also",
"remove",
"the",
"remote",
"message",
"filter",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageReceiver.java#L130-L144 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPoliciesInner.java | ServerConnectionPoliciesInner.createOrUpdateAsync | public Observable<ServerConnectionPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, ServerConnectionType connectionType) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, connectionType).map(new Func1<ServiceResponse<ServerConnectionPolicyInner>, ServerConnectionPolicyInner>() {
@Override
public ServerConnectionPolicyInner call(ServiceResponse<ServerConnectionPolicyInner> response) {
return response.body();
}
});
} | java | public Observable<ServerConnectionPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, ServerConnectionType connectionType) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, connectionType).map(new Func1<ServiceResponse<ServerConnectionPolicyInner>, ServerConnectionPolicyInner>() {
@Override
public ServerConnectionPolicyInner call(ServiceResponse<ServerConnectionPolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServerConnectionPolicyInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"ServerConnectionType",
"connectionType",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resource... | Creates or updates the server's connection policy.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param connectionType The server connection type. Possible values include: 'Default', 'Proxy', 'Redirect'
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServerConnectionPolicyInner object | [
"Creates",
"or",
"updates",
"the",
"server",
"s",
"connection",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerConnectionPoliciesInner.java#L105-L112 |
alkacon/opencms-core | src/org/opencms/ui/CmsUserIconHelper.java | CmsUserIconHelper.getBigIconPath | public String getBigIconPath(CmsObject cms, CmsUser user) {
return getIconPath(cms, user, IconSize.Big);
} | java | public String getBigIconPath(CmsObject cms, CmsUser user) {
return getIconPath(cms, user, IconSize.Big);
} | [
"public",
"String",
"getBigIconPath",
"(",
"CmsObject",
"cms",
",",
"CmsUser",
"user",
")",
"{",
"return",
"getIconPath",
"(",
"cms",
",",
"user",
",",
"IconSize",
".",
"Big",
")",
";",
"}"
] | Returns the big ident-icon path for the given user.<p>
@param cms the cms context
@param user the user
@return the icon path | [
"Returns",
"the",
"big",
"ident",
"-",
"icon",
"path",
"for",
"the",
"given",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsUserIconHelper.java#L218-L221 |
flow/commons | src/main/java/com/flowpowered/commons/map/impl/TTripleInt21ObjectHashMap.java | TTripleInt21ObjectHashMap.containsKey | @Override
public boolean containsKey(int x, int y, int z) {
long key = Int21TripleHashed.key(x, y, z);
return map.containsKey(key);
} | java | @Override
public boolean containsKey(int x, int y, int z) {
long key = Int21TripleHashed.key(x, y, z);
return map.containsKey(key);
} | [
"@",
"Override",
"public",
"boolean",
"containsKey",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"z",
")",
"{",
"long",
"key",
"=",
"Int21TripleHashed",
".",
"key",
"(",
"x",
",",
"y",
",",
"z",
")",
";",
"return",
"map",
".",
"containsKey",
"(",... | Returns true if this map contains a mapping for the specified key. More formally, returns <code>true</code> if and only if this map contains a mapping for a key <code>k</code> such that
<code>key.equals(k)</code>. (There can be at most one such mapping.)
@param x an <code>int</code> value
@param y an <code>int</code> value
@param z an <code>int</code> value
@return <code>true</code> if this map contains a mapping for the specified <code>key(x, y, z)</code>. | [
"Returns",
"true",
"if",
"this",
"map",
"contains",
"a",
"mapping",
"for",
"the",
"specified",
"key",
".",
"More",
"formally",
"returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"and",
"only",
"if",
"this",
"map",
"contains",
"a",
"mapping",
"for"... | train | https://github.com/flow/commons/blob/0690efdac06fd728fcd7e9cf10f2b1319379c45b/src/main/java/com/flowpowered/commons/map/impl/TTripleInt21ObjectHashMap.java#L120-L124 |
cdapio/tigon | tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java | Bytes.padHead | public static byte [] padHead(final byte [] a, final int length) {
byte [] padding = new byte[length];
for (int i = 0; i < length; i++) {
padding[i] = 0;
}
return add(padding, a);
} | java | public static byte [] padHead(final byte [] a, final int length) {
byte [] padding = new byte[length];
for (int i = 0; i < length; i++) {
padding[i] = 0;
}
return add(padding, a);
} | [
"public",
"static",
"byte",
"[",
"]",
"padHead",
"(",
"final",
"byte",
"[",
"]",
"a",
",",
"final",
"int",
"length",
")",
"{",
"byte",
"[",
"]",
"padding",
"=",
"new",
"byte",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",... | Return a byte array with value in <code>a</code> plus <code>length</code> prepended 0 bytes.
@param a array
@param length new array size
@return Value in <code>a</code> plus <code>length</code> prepended 0 bytes | [
"Return",
"a",
"byte",
"array",
"with",
"value",
"in",
"<code",
">",
"a<",
"/",
"code",
">",
"plus",
"<code",
">",
"length<",
"/",
"code",
">",
"prepended",
"0",
"bytes",
"."
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java#L1064-L1070 |
michael-rapp/AndroidMaterialValidation | library/src/main/java/de/mrapp/android/validation/Validators.java | Validators.phoneNumber | public static Validator<CharSequence> phoneNumber(@NonNull final Context context) {
return new PhoneNumberValidator(context, R.string.default_error_message);
} | java | public static Validator<CharSequence> phoneNumber(@NonNull final Context context) {
return new PhoneNumberValidator(context, R.string.default_error_message);
} | [
"public",
"static",
"Validator",
"<",
"CharSequence",
">",
"phoneNumber",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
")",
"{",
"return",
"new",
"PhoneNumberValidator",
"(",
"context",
",",
"R",
".",
"string",
".",
"default_error_message",
")",
";",
"}... | Creates and returns a validator, which allows to validate texts to ensure, that they
represent valid phone numbers. Phone numbers, which are only consisting of numbers are
allowed as well as international phone numbers, e.g. +49 1624812382. Empty texts are also
accepted.
@param context
The context, which should be used to retrieve the error message, as an instance of
the class {@link Context}. The context may not be null
@return The validator, which has been created, as an instance of the type {@link Validator} | [
"Creates",
"and",
"returns",
"a",
"validator",
"which",
"allows",
"to",
"validate",
"texts",
"to",
"ensure",
"that",
"they",
"represent",
"valid",
"phone",
"numbers",
".",
"Phone",
"numbers",
"which",
"are",
"only",
"consisting",
"of",
"numbers",
"are",
"allow... | train | https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L1153-L1155 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java | SecondaryIndexManager.deleteFromIndexes | public void deleteFromIndexes(DecoratedKey key, List<Cell> indexedColumnsInRow, OpOrder.Group opGroup)
{
// Update entire row only once per row level index
Set<Class<? extends SecondaryIndex>> cleanedRowLevelIndexes = null;
for (Cell cell : indexedColumnsInRow)
{
for (SecondaryIndex index : indexFor(cell.name()))
{
if (index instanceof PerRowSecondaryIndex)
{
if (cleanedRowLevelIndexes == null)
cleanedRowLevelIndexes = new HashSet<>();
if (cleanedRowLevelIndexes.add(index.getClass()))
((PerRowSecondaryIndex) index).delete(key, opGroup);
}
else
{
((PerColumnSecondaryIndex) index).deleteForCleanup(key.getKey(), cell, opGroup);
}
}
}
} | java | public void deleteFromIndexes(DecoratedKey key, List<Cell> indexedColumnsInRow, OpOrder.Group opGroup)
{
// Update entire row only once per row level index
Set<Class<? extends SecondaryIndex>> cleanedRowLevelIndexes = null;
for (Cell cell : indexedColumnsInRow)
{
for (SecondaryIndex index : indexFor(cell.name()))
{
if (index instanceof PerRowSecondaryIndex)
{
if (cleanedRowLevelIndexes == null)
cleanedRowLevelIndexes = new HashSet<>();
if (cleanedRowLevelIndexes.add(index.getClass()))
((PerRowSecondaryIndex) index).delete(key, opGroup);
}
else
{
((PerColumnSecondaryIndex) index).deleteForCleanup(key.getKey(), cell, opGroup);
}
}
}
} | [
"public",
"void",
"deleteFromIndexes",
"(",
"DecoratedKey",
"key",
",",
"List",
"<",
"Cell",
">",
"indexedColumnsInRow",
",",
"OpOrder",
".",
"Group",
"opGroup",
")",
"{",
"// Update entire row only once per row level index",
"Set",
"<",
"Class",
"<",
"?",
"extends"... | Delete all columns from all indexes for this row. For when cleanup rips a row out entirely.
@param key the row key
@param indexedColumnsInRow all column names in row | [
"Delete",
"all",
"columns",
"from",
"all",
"indexes",
"for",
"this",
"row",
".",
"For",
"when",
"cleanup",
"rips",
"a",
"row",
"out",
"entirely",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java#L473-L495 |
wildfly/wildfly-core | controller-client/src/main/java/org/jboss/as/controller/client/helpers/Operations.java | Operations.createUndefineAttributeOperation | public static ModelNode createUndefineAttributeOperation(final ModelNode address, final String attributeName) {
final ModelNode op = createOperation(UNDEFINE_ATTRIBUTE_OPERATION, address);
op.get(NAME).set(attributeName);
return op;
} | java | public static ModelNode createUndefineAttributeOperation(final ModelNode address, final String attributeName) {
final ModelNode op = createOperation(UNDEFINE_ATTRIBUTE_OPERATION, address);
op.get(NAME).set(attributeName);
return op;
} | [
"public",
"static",
"ModelNode",
"createUndefineAttributeOperation",
"(",
"final",
"ModelNode",
"address",
",",
"final",
"String",
"attributeName",
")",
"{",
"final",
"ModelNode",
"op",
"=",
"createOperation",
"(",
"UNDEFINE_ATTRIBUTE_OPERATION",
",",
"address",
")",
... | Creates an operation to undefine an attribute value represented by the {@code attributeName} parameter.
@param address the address to create the write attribute for
@param attributeName the name attribute to undefine
@return the operation | [
"Creates",
"an",
"operation",
"to",
"undefine",
"an",
"attribute",
"value",
"represented",
"by",
"the",
"{",
"@code",
"attributeName",
"}",
"parameter",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller-client/src/main/java/org/jboss/as/controller/client/helpers/Operations.java#L259-L263 |
cdk/cdk | storage/smiles/src/main/java/org/openscience/cdk/smiles/CxSmilesParser.java | CxSmilesParser.processFragmentGrouping | private static boolean processFragmentGrouping(final CharIter iter, final CxSmilesState state) {
if (state.fragGroups == null)
state.fragGroups = new ArrayList<>();
List<Integer> dest = new ArrayList<>();
while (iter.hasNext()) {
dest.clear();
if (!processIntList(iter, DOT_SEPARATOR, dest))
return false;
iter.nextIf(COMMA_SEPARATOR);
if (dest.isEmpty())
return true;
state.fragGroups.add(new ArrayList<>(dest));
}
return false;
} | java | private static boolean processFragmentGrouping(final CharIter iter, final CxSmilesState state) {
if (state.fragGroups == null)
state.fragGroups = new ArrayList<>();
List<Integer> dest = new ArrayList<>();
while (iter.hasNext()) {
dest.clear();
if (!processIntList(iter, DOT_SEPARATOR, dest))
return false;
iter.nextIf(COMMA_SEPARATOR);
if (dest.isEmpty())
return true;
state.fragGroups.add(new ArrayList<>(dest));
}
return false;
} | [
"private",
"static",
"boolean",
"processFragmentGrouping",
"(",
"final",
"CharIter",
"iter",
",",
"final",
"CxSmilesState",
"state",
")",
"{",
"if",
"(",
"state",
".",
"fragGroups",
"==",
"null",
")",
"state",
".",
"fragGroups",
"=",
"new",
"ArrayList",
"<>",
... | Fragment grouping defines disconnected components that should be considered part of a single molecule (i.e.
Salts). Examples include NaH, AlCl3, Cs2CO3, HATU, etc.
@param iter input characters, iterator is progressed by this method
@param state output CXSMILES state
@return parse was a success (or not) | [
"Fragment",
"grouping",
"defines",
"disconnected",
"components",
"that",
"should",
"be",
"considered",
"part",
"of",
"a",
"single",
"molecule",
"(",
"i",
".",
"e",
".",
"Salts",
")",
".",
"Examples",
"include",
"NaH",
"AlCl3",
"Cs2CO3",
"HATU",
"etc",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/smiles/src/main/java/org/openscience/cdk/smiles/CxSmilesParser.java#L189-L203 |
simbiose/Encryption | Encryption/main/se/simbio/encryption/Encryption.java | Encryption.getSecretKey | private SecretKey getSecretKey(char[] key) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeySpecException {
SecretKeyFactory factory = SecretKeyFactory.getInstance(mBuilder.getSecretKeyType());
KeySpec spec = new PBEKeySpec(key, mBuilder.getSalt().getBytes(mBuilder.getCharsetName()), mBuilder.getIterationCount(), mBuilder.getKeyLength());
SecretKey tmp = factory.generateSecret(spec);
return new SecretKeySpec(tmp.getEncoded(), mBuilder.getKeyAlgorithm());
} | java | private SecretKey getSecretKey(char[] key) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeySpecException {
SecretKeyFactory factory = SecretKeyFactory.getInstance(mBuilder.getSecretKeyType());
KeySpec spec = new PBEKeySpec(key, mBuilder.getSalt().getBytes(mBuilder.getCharsetName()), mBuilder.getIterationCount(), mBuilder.getKeyLength());
SecretKey tmp = factory.generateSecret(spec);
return new SecretKeySpec(tmp.getEncoded(), mBuilder.getKeyAlgorithm());
} | [
"private",
"SecretKey",
"getSecretKey",
"(",
"char",
"[",
"]",
"key",
")",
"throws",
"NoSuchAlgorithmException",
",",
"UnsupportedEncodingException",
",",
"InvalidKeySpecException",
"{",
"SecretKeyFactory",
"factory",
"=",
"SecretKeyFactory",
".",
"getInstance",
"(",
"m... | creates a 128bit salted aes key
@param key encoded input key
@return aes 128 bit salted key
@throws NoSuchAlgorithmException if no installed provider that can provide the requested
by the Builder secret key type
@throws UnsupportedEncodingException if the Builder charset name is not supported
@throws InvalidKeySpecException if the specified key specification cannot be used to
generate a secret key
@throws NullPointerException if the specified Builder secret key type is {@code null} | [
"creates",
"a",
"128bit",
"salted",
"aes",
"key"
] | train | https://github.com/simbiose/Encryption/blob/a344761a10add131cbe9962f895b416e5217d0e9/Encryption/main/se/simbio/encryption/Encryption.java#L241-L246 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.