repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | dns/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/dns/v2017_10_01/implementation/ZonesInner.java | ZonesInner.createOrUpdateAsync | public Observable<ZoneInner> createOrUpdateAsync(String resourceGroupName, String zoneName, ZoneInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, zoneName, parameters).map(new Func1<ServiceResponse<ZoneInner>, ZoneInner>() {
@Override
public ZoneInner call(ServiceResponse<ZoneInner> response) {
return response.body();
}
});
} | java | public Observable<ZoneInner> createOrUpdateAsync(String resourceGroupName, String zoneName, ZoneInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, zoneName, parameters).map(new Func1<ServiceResponse<ZoneInner>, ZoneInner>() {
@Override
public ZoneInner call(ServiceResponse<ZoneInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ZoneInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"zoneName",
",",
"ZoneInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"zoneName",
... | Creates or updates a DNS zone. Does not modify DNS records within the zone.
@param resourceGroupName The name of the resource group.
@param zoneName The name of the DNS zone (without a terminating dot).
@param parameters Parameters supplied to the CreateOrUpdate operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ZoneInner object | [
"Creates",
"or",
"updates",
"a",
"DNS",
"zone",
".",
"Does",
"not",
"modify",
"DNS",
"records",
"within",
"the",
"zone",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/dns/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/dns/v2017_10_01/implementation/ZonesInner.java#L146-L153 |
GerdHolz/TOVAL | src/de/invation/code/toval/misc/FormatUtils.java | FormatUtils.getTrimmedFormat | public static String getTrimmedFormat(String format, int length) {
return String.format('%' + String.format(TRIM_BASE_FORMAT, length), format.substring(1));
} | java | public static String getTrimmedFormat(String format, int length) {
return String.format('%' + String.format(TRIM_BASE_FORMAT, length), format.substring(1));
} | [
"public",
"static",
"String",
"getTrimmedFormat",
"(",
"String",
"format",
",",
"int",
"length",
")",
"{",
"return",
"String",
".",
"format",
"(",
"'",
"'",
"+",
"String",
".",
"format",
"(",
"TRIM_BASE_FORMAT",
",",
"length",
")",
",",
"format",
".",
"s... | Extends a given format by additional constraints for trimmed
(length-limited) outputs.<br>
It assumes that the given String is a valid format.
@param format
Format to extend
@param length
Desired fixed output length for formatted output
@return Extended version of <code>format</code> by trim-constraints | [
"Extends",
"a",
"given",
"format",
"by",
"additional",
"constraints",
"for",
"trimmed",
"(",
"length",
"-",
"limited",
")",
"outputs",
".",
"<br",
">",
"It",
"assumes",
"that",
"the",
"given",
"String",
"is",
"a",
"valid",
"format",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/FormatUtils.java#L205-L207 |
nats-io/java-nats | src/main/java/io/nats/client/NKey.java | NKey.createAccount | public static NKey createAccount(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.ACCOUNT, random);
} | java | public static NKey createAccount(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.ACCOUNT, random);
} | [
"public",
"static",
"NKey",
"createAccount",
"(",
"SecureRandom",
"random",
")",
"throws",
"IOException",
",",
"NoSuchProviderException",
",",
"NoSuchAlgorithmException",
"{",
"return",
"createPair",
"(",
"Type",
".",
"ACCOUNT",
",",
"random",
")",
";",
"}"
] | Create an Account NKey from the provided random number generator.
If no random is provided, SecureRandom.getInstance("SHA1PRNG", "SUN") will be used to creat eone.
The new NKey contains the private seed, which should be saved in a secure location.
@param random A secure random provider
@return the new Nkey
@throws IOException if the seed cannot be encoded to a string
@throws NoSuchProviderException if the default secure random cannot be created
@throws NoSuchAlgorithmException if the default secure random cannot be created | [
"Create",
"an",
"Account",
"NKey",
"from",
"the",
"provided",
"random",
"number",
"generator",
"."
] | train | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NKey.java#L479-L482 |
google/closure-compiler | src/com/google/javascript/jscomp/ClosureRewriteModule.java | ClosureRewriteModule.maybeUpdateExportDeclaration | private void maybeUpdateExportDeclaration(NodeTraversal t, Node n) {
if (!currentScript.isModule
|| !n.getString().equals("exports")
|| !isAssignTarget(n)) {
return;
}
Node assignNode = n.getParent();
if (!currentScript.declareLegacyNamespace
&& currentScript.defaultExportLocalName != null) {
assignNode.getParent().detach();
return;
}
// Rewrite "exports = ..." as "var module$exports$foo$Bar = ..."
Node rhs = assignNode.getLastChild();
Node jsdocNode;
if (currentScript.declareLegacyNamespace) {
Node legacyQname = NodeUtil.newQName(compiler, currentScript.legacyNamespace).srcrefTree(n);
assignNode.replaceChild(n, legacyQname);
jsdocNode = assignNode;
} else {
rhs.detach();
Node exprResultNode = assignNode.getParent();
Node binaryNamespaceName = IR.name(currentScript.getBinaryNamespace());
binaryNamespaceName.setOriginalName(currentScript.legacyNamespace);
Node exportsObjectCreationNode = IR.var(binaryNamespaceName, rhs);
exportsObjectCreationNode.useSourceInfoIfMissingFromForTree(exprResultNode);
exportsObjectCreationNode.putBooleanProp(Node.IS_NAMESPACE, true);
exprResultNode.replaceWith(exportsObjectCreationNode);
jsdocNode = exportsObjectCreationNode;
currentScript.hasCreatedExportObject = true;
}
markConstAndCopyJsDoc(assignNode, jsdocNode);
compiler.reportChangeToEnclosingScope(jsdocNode);
maybeUpdateExportObjectLiteral(t, rhs);
return;
} | java | private void maybeUpdateExportDeclaration(NodeTraversal t, Node n) {
if (!currentScript.isModule
|| !n.getString().equals("exports")
|| !isAssignTarget(n)) {
return;
}
Node assignNode = n.getParent();
if (!currentScript.declareLegacyNamespace
&& currentScript.defaultExportLocalName != null) {
assignNode.getParent().detach();
return;
}
// Rewrite "exports = ..." as "var module$exports$foo$Bar = ..."
Node rhs = assignNode.getLastChild();
Node jsdocNode;
if (currentScript.declareLegacyNamespace) {
Node legacyQname = NodeUtil.newQName(compiler, currentScript.legacyNamespace).srcrefTree(n);
assignNode.replaceChild(n, legacyQname);
jsdocNode = assignNode;
} else {
rhs.detach();
Node exprResultNode = assignNode.getParent();
Node binaryNamespaceName = IR.name(currentScript.getBinaryNamespace());
binaryNamespaceName.setOriginalName(currentScript.legacyNamespace);
Node exportsObjectCreationNode = IR.var(binaryNamespaceName, rhs);
exportsObjectCreationNode.useSourceInfoIfMissingFromForTree(exprResultNode);
exportsObjectCreationNode.putBooleanProp(Node.IS_NAMESPACE, true);
exprResultNode.replaceWith(exportsObjectCreationNode);
jsdocNode = exportsObjectCreationNode;
currentScript.hasCreatedExportObject = true;
}
markConstAndCopyJsDoc(assignNode, jsdocNode);
compiler.reportChangeToEnclosingScope(jsdocNode);
maybeUpdateExportObjectLiteral(t, rhs);
return;
} | [
"private",
"void",
"maybeUpdateExportDeclaration",
"(",
"NodeTraversal",
"t",
",",
"Node",
"n",
")",
"{",
"if",
"(",
"!",
"currentScript",
".",
"isModule",
"||",
"!",
"n",
".",
"getString",
"(",
")",
".",
"equals",
"(",
"\"exports\"",
")",
"||",
"!",
"is... | In module "foo.Bar", rewrite "exports = Bar" to "var module$exports$foo$Bar = Bar". | [
"In",
"module",
"foo",
".",
"Bar",
"rewrite",
"exports",
"=",
"Bar",
"to",
"var",
"module$exports$foo$Bar",
"=",
"Bar",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ClosureRewriteModule.java#L1387-L1425 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java | NetworkInterfacesInner.listVirtualMachineScaleSetVMNetworkInterfacesAsync | public Observable<Page<NetworkInterfaceInner>> listVirtualMachineScaleSetVMNetworkInterfacesAsync(final String resourceGroupName, final String virtualMachineScaleSetName, final String virtualmachineIndex) {
return listVirtualMachineScaleSetVMNetworkInterfacesWithServiceResponseAsync(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex)
.map(new Func1<ServiceResponse<Page<NetworkInterfaceInner>>, Page<NetworkInterfaceInner>>() {
@Override
public Page<NetworkInterfaceInner> call(ServiceResponse<Page<NetworkInterfaceInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<NetworkInterfaceInner>> listVirtualMachineScaleSetVMNetworkInterfacesAsync(final String resourceGroupName, final String virtualMachineScaleSetName, final String virtualmachineIndex) {
return listVirtualMachineScaleSetVMNetworkInterfacesWithServiceResponseAsync(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex)
.map(new Func1<ServiceResponse<Page<NetworkInterfaceInner>>, Page<NetworkInterfaceInner>>() {
@Override
public Page<NetworkInterfaceInner> call(ServiceResponse<Page<NetworkInterfaceInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"NetworkInterfaceInner",
">",
">",
"listVirtualMachineScaleSetVMNetworkInterfacesAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"virtualMachineScaleSetName",
",",
"final",
"String",
"virtualmachineIndex",... | Gets information about all network interfaces in a virtual machine in a virtual machine scale set.
@param resourceGroupName The name of the resource group.
@param virtualMachineScaleSetName The name of the virtual machine scale set.
@param virtualmachineIndex The virtual machine index.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<NetworkInterfaceInner> object | [
"Gets",
"information",
"about",
"all",
"network",
"interfaces",
"in",
"a",
"virtual",
"machine",
"in",
"a",
"virtual",
"machine",
"scale",
"set",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L1538-L1546 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_UpdateZ.java | ST_UpdateZ.updateZ | public static Geometry updateZ(Geometry geometry, double z, int updateCondition) throws SQLException {
if(geometry == null){
return null;
}
if (updateCondition == 1 || updateCondition == 2 || updateCondition == 3) {
Geometry outPut = geometry.copy();
outPut.apply(new UpdateZCoordinateSequenceFilter(z, updateCondition));
return outPut;
} else {
throw new SQLException("Available values are 1, 2 or 3.\n"
+ "Please read the description of the function to use it.");
}
} | java | public static Geometry updateZ(Geometry geometry, double z, int updateCondition) throws SQLException {
if(geometry == null){
return null;
}
if (updateCondition == 1 || updateCondition == 2 || updateCondition == 3) {
Geometry outPut = geometry.copy();
outPut.apply(new UpdateZCoordinateSequenceFilter(z, updateCondition));
return outPut;
} else {
throw new SQLException("Available values are 1, 2 or 3.\n"
+ "Please read the description of the function to use it.");
}
} | [
"public",
"static",
"Geometry",
"updateZ",
"(",
"Geometry",
"geometry",
",",
"double",
"z",
",",
"int",
"updateCondition",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"geometry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"updateCond... | Replace the z value depending on the condition.
@param geometry
@param z
@param updateCondition set if the NaN value must be updated or not
@return
@throws java.sql.SQLException | [
"Replace",
"the",
"z",
"value",
"depending",
"on",
"the",
"condition",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_UpdateZ.java#L74-L86 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java | DateFunctions.dateAddMillis | public static Expression dateAddMillis(Expression expression, int n, DatePart part) {
return x("DATE_ADD_MILLIS(" + expression.toString() + ", " + n + ", \"" + part + "\")");
} | java | public static Expression dateAddMillis(Expression expression, int n, DatePart part) {
return x("DATE_ADD_MILLIS(" + expression.toString() + ", " + n + ", \"" + part + "\")");
} | [
"public",
"static",
"Expression",
"dateAddMillis",
"(",
"Expression",
"expression",
",",
"int",
"n",
",",
"DatePart",
"part",
")",
"{",
"return",
"x",
"(",
"\"DATE_ADD_MILLIS(\"",
"+",
"expression",
".",
"toString",
"(",
")",
"+",
"\", \"",
"+",
"n",
"+",
... | Returned expression performs Date arithmetic, and returns result of computation.
n and part are used to define an interval or duration, which is then added (or subtracted) to the UNIX timestamp,
returning the result. | [
"Returned",
"expression",
"performs",
"Date",
"arithmetic",
"and",
"returns",
"result",
"of",
"computation",
".",
"n",
"and",
"part",
"are",
"used",
"to",
"define",
"an",
"interval",
"or",
"duration",
"which",
"is",
"then",
"added",
"(",
"or",
"subtracted",
... | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L73-L75 |
RestComm/jasn | asn-impl/src/main/java/org/mobicents/protocols/asn/AsnInputStream.java | AsnInputStream.readSequenceStreamData | public AsnInputStream readSequenceStreamData(int length) throws AsnException, IOException {
if (length == Tag.Indefinite_Length) {
return this.readSequenceIndefinite();
} else {
int startPos = this.pos;
this.advance(length);
return new AsnInputStream(this, startPos, length);
}
} | java | public AsnInputStream readSequenceStreamData(int length) throws AsnException, IOException {
if (length == Tag.Indefinite_Length) {
return this.readSequenceIndefinite();
} else {
int startPos = this.pos;
this.advance(length);
return new AsnInputStream(this, startPos, length);
}
} | [
"public",
"AsnInputStream",
"readSequenceStreamData",
"(",
"int",
"length",
")",
"throws",
"AsnException",
",",
"IOException",
"{",
"if",
"(",
"length",
"==",
"Tag",
".",
"Indefinite_Length",
")",
"{",
"return",
"this",
".",
"readSequenceIndefinite",
"(",
")",
"... | This method can be invoked after the sequence tag and length has been
read. Returns the AsnInputStream that contains the sequence data. The origin
stream advances to the begin of the next record
@param length
The sequence length
@return
@throws AsnException
@throws IOException | [
"This",
"method",
"can",
"be",
"invoked",
"after",
"the",
"sequence",
"tag",
"and",
"length",
"has",
"been",
"read",
".",
"Returns",
"the",
"AsnInputStream",
"that",
"contains",
"the",
"sequence",
"data",
".",
"The",
"origin",
"stream",
"advances",
"to",
"th... | train | https://github.com/RestComm/jasn/blob/3b2ec7709ba27f888114eaf47e2cd51ed8042e65/asn-impl/src/main/java/org/mobicents/protocols/asn/AsnInputStream.java#L367-L376 |
JOML-CI/JOML | src/org/joml/Vector3i.java | Vector3i.distanceSquared | public static long distanceSquared(int x1, int y1, int z1, int x2, int y2, int z2) {
int dx = x1 - x2;
int dy = y1 - y2;
int dz = z1 - z2;
return dx * dx + dy * dy + dz * dz;
} | java | public static long distanceSquared(int x1, int y1, int z1, int x2, int y2, int z2) {
int dx = x1 - x2;
int dy = y1 - y2;
int dz = z1 - z2;
return dx * dx + dy * dy + dz * dz;
} | [
"public",
"static",
"long",
"distanceSquared",
"(",
"int",
"x1",
",",
"int",
"y1",
",",
"int",
"z1",
",",
"int",
"x2",
",",
"int",
"y2",
",",
"int",
"z2",
")",
"{",
"int",
"dx",
"=",
"x1",
"-",
"x2",
";",
"int",
"dy",
"=",
"y1",
"-",
"y2",
";... | Return the squared distance between <code>(x1, y1, z1)</code> and <code>(x2, y2, z2)</code>.
@param x1
the x component of the first vector
@param y1
the y component of the first vector
@param z1
the z component of the first vector
@param x2
the x component of the second vector
@param y2
the y component of the second vector
@param z2
the z component of the second vector
@return the euclidean distance squared | [
"Return",
"the",
"squared",
"distance",
"between",
"<code",
">",
"(",
"x1",
"y1",
"z1",
")",
"<",
"/",
"code",
">",
"and",
"<code",
">",
"(",
"x2",
"y2",
"z2",
")",
"<",
"/",
"code",
">",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector3i.java#L762-L767 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Notification.java | Notification.setActiveForTriggerAndMetric | public void setActiveForTriggerAndMetric(Trigger trigger, Metric metric, boolean active) {
String key = _hashTriggerAndMetric(trigger, metric);
this.activeStatusByTriggerAndMetric.put(key, active);
} | java | public void setActiveForTriggerAndMetric(Trigger trigger, Metric metric, boolean active) {
String key = _hashTriggerAndMetric(trigger, metric);
this.activeStatusByTriggerAndMetric.put(key, active);
} | [
"public",
"void",
"setActiveForTriggerAndMetric",
"(",
"Trigger",
"trigger",
",",
"Metric",
"metric",
",",
"boolean",
"active",
")",
"{",
"String",
"key",
"=",
"_hashTriggerAndMetric",
"(",
"trigger",
",",
"metric",
")",
";",
"this",
".",
"activeStatusByTriggerAnd... | When a notification is sent out when a metric violates the trigger threshold, set this notification active for that trigger,metric combination
@param trigger The Trigger that caused this notification
@param metric The metric that caused this notification
@param active Whether to set the notification to active | [
"When",
"a",
"notification",
"is",
"sent",
"out",
"when",
"a",
"metric",
"violates",
"the",
"trigger",
"threshold",
"set",
"this",
"notification",
"active",
"for",
"that",
"trigger",
"metric",
"combination"
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Notification.java#L612-L615 |
alkacon/opencms-core | src-gwt/org/opencms/ui/client/CmsBreadCrumbConnector.java | CmsBreadCrumbConnector.appendBreadCrumbEntry | private void appendBreadCrumbEntry(StringBuffer buffer, String target, String label) {
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(target)) {
buffer.append("<a href=\"#!").append(target).append(
"\" title=\"" + CmsDomUtil.escapeXml(label) + "\"><span>").append(label).append("</span></a>");
} else {
buffer.append(
"<span class=\"o-tools-breadcrumb-active\" title=\""
+ CmsDomUtil.escapeXml(label)
+ "\"><span>").append(label).append("</span></span>");
}
} | java | private void appendBreadCrumbEntry(StringBuffer buffer, String target, String label) {
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(target)) {
buffer.append("<a href=\"#!").append(target).append(
"\" title=\"" + CmsDomUtil.escapeXml(label) + "\"><span>").append(label).append("</span></a>");
} else {
buffer.append(
"<span class=\"o-tools-breadcrumb-active\" title=\""
+ CmsDomUtil.escapeXml(label)
+ "\"><span>").append(label).append("</span></span>");
}
} | [
"private",
"void",
"appendBreadCrumbEntry",
"(",
"StringBuffer",
"buffer",
",",
"String",
"target",
",",
"String",
"label",
")",
"{",
"if",
"(",
"CmsStringUtil",
".",
"isNotEmptyOrWhitespaceOnly",
"(",
"target",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"\"... | Appends a bread crumb entry.<p>
@param buffer the string buffer to append to
@param target the target state
@param label the entry label | [
"Appends",
"a",
"bread",
"crumb",
"entry",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ui/client/CmsBreadCrumbConnector.java#L198-L209 |
paypal/SeLion | dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/JsonDataProviderImpl.java | JsonDataProviderImpl.getAllData | @Override
public Object[][] getAllData() {
logger.entering(resource);
Class<?> arrayType;
Object[][] dataToBeReturned = null;
JsonReader reader = new JsonReader(getReader(resource));
try {
// The type specified must be converted to array type for the parser
// to deal with array of JSON objects
arrayType = Array.newInstance(resource.getCls(), 0).getClass();
logger.log(Level.FINE, "The Json Data is mapped as", arrayType);
dataToBeReturned = mapJsonData(reader, arrayType);
} catch (Exception e) {
throw new DataProviderException("Error while parsing Json Data", e);
} finally {
IOUtils.closeQuietly(reader);
}
logger.exiting((Object[]) dataToBeReturned);
return dataToBeReturned;
} | java | @Override
public Object[][] getAllData() {
logger.entering(resource);
Class<?> arrayType;
Object[][] dataToBeReturned = null;
JsonReader reader = new JsonReader(getReader(resource));
try {
// The type specified must be converted to array type for the parser
// to deal with array of JSON objects
arrayType = Array.newInstance(resource.getCls(), 0).getClass();
logger.log(Level.FINE, "The Json Data is mapped as", arrayType);
dataToBeReturned = mapJsonData(reader, arrayType);
} catch (Exception e) {
throw new DataProviderException("Error while parsing Json Data", e);
} finally {
IOUtils.closeQuietly(reader);
}
logger.exiting((Object[]) dataToBeReturned);
return dataToBeReturned;
} | [
"@",
"Override",
"public",
"Object",
"[",
"]",
"[",
"]",
"getAllData",
"(",
")",
"{",
"logger",
".",
"entering",
"(",
"resource",
")",
";",
"Class",
"<",
"?",
">",
"arrayType",
";",
"Object",
"[",
"]",
"[",
"]",
"dataToBeReturned",
"=",
"null",
";",
... | Parses the JSON file as a 2D Object array for TestNg dataprovider usage.<br>
<pre>
<i>Array Of Objects mapped to a user defined type:</i>
[
{
"name":"Optimus Prime",
"password":123456,
"accountNumber":999999999,
"amount":50000,
"areaCode":[{ "areaCode" :"area1"},
{ "areaCode" :"area2"}],
"bank":{
"name" : "Bank1",
"type" : "Savings",
"address" : {
"street":"1234 Some St"
}
},
"phoneNumber":"1111111111",
"preintTest":10
},
{
"name":"Megatron",
"password":123456,
"accountNumber":999999999,
"amount":80000,
"areaCode":[{ "areaCode" :"area3"},
{ "areaCode" :"area4"}],
"bank":{
"name" : "Bank2",
"type" : "Current",
"address" : {
"street":"1234 any St"
}
},
"phoneNumber":"1111111111",
"preintTest":100
}
]
<i>Test Method Signature</i>
{@code public void readJsonArray(TestData testData)}
</pre> | [
"Parses",
"the",
"JSON",
"file",
"as",
"a",
"2D",
"Object",
"array",
"for",
"TestNg",
"dataprovider",
"usage",
".",
"<br",
">"
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/JsonDataProviderImpl.java#L105-L124 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/HBCIDialog.java | HBCIDialog.doDialogInit | private HBCIMsgStatus doDialogInit() {
HBCIMsgStatus msgStatus = new HBCIMsgStatus();
try {
log.debug(HBCIUtils.getLocMsg("STATUS_DIALOG_INIT"));
passport.getCallback().status(HBCICallback.STATUS_DIALOG_INIT, null);
Message message = MessageFactory.createDialogInit("DialogInit", null, passport);
msgStatus = kernel.rawDoIt(message, HBCIKernel.SIGNIT, HBCIKernel.CRYPTIT);
passport.postInitResponseHook(msgStatus);
HashMap<String, String> result = msgStatus.getData();
if (msgStatus.isOK()) {
HBCIInstitute inst = new HBCIInstitute(kernel, passport);
inst.updateBPD(result);
inst.extractKeys(result);
HBCIUser user = new HBCIUser(kernel, passport);
user.updateUPD(result);
msgnum = 2;
dialogid = result.get("MsgHead.dialogid");
log.debug("dialog-id set to " + dialogid);
HBCIInstMessage msg;
for (int i = 0; true; i++) {
try {
String header = HBCIUtils.withCounter("KIMsg", i);
msg = new HBCIInstMessage(result, header);
} catch (Exception e) {
break;
}
passport.getCallback().callback(
HBCICallback.HAVE_INST_MSG,
msg.toString(),
HBCICallback.TYPE_NONE,
new StringBuilder());
}
}
passport.getCallback().status(HBCICallback.STATUS_DIALOG_INIT_DONE, new Object[]{msgStatus, dialogid});
} catch (Exception e) {
msgStatus.addException(e);
}
return msgStatus;
} | java | private HBCIMsgStatus doDialogInit() {
HBCIMsgStatus msgStatus = new HBCIMsgStatus();
try {
log.debug(HBCIUtils.getLocMsg("STATUS_DIALOG_INIT"));
passport.getCallback().status(HBCICallback.STATUS_DIALOG_INIT, null);
Message message = MessageFactory.createDialogInit("DialogInit", null, passport);
msgStatus = kernel.rawDoIt(message, HBCIKernel.SIGNIT, HBCIKernel.CRYPTIT);
passport.postInitResponseHook(msgStatus);
HashMap<String, String> result = msgStatus.getData();
if (msgStatus.isOK()) {
HBCIInstitute inst = new HBCIInstitute(kernel, passport);
inst.updateBPD(result);
inst.extractKeys(result);
HBCIUser user = new HBCIUser(kernel, passport);
user.updateUPD(result);
msgnum = 2;
dialogid = result.get("MsgHead.dialogid");
log.debug("dialog-id set to " + dialogid);
HBCIInstMessage msg;
for (int i = 0; true; i++) {
try {
String header = HBCIUtils.withCounter("KIMsg", i);
msg = new HBCIInstMessage(result, header);
} catch (Exception e) {
break;
}
passport.getCallback().callback(
HBCICallback.HAVE_INST_MSG,
msg.toString(),
HBCICallback.TYPE_NONE,
new StringBuilder());
}
}
passport.getCallback().status(HBCICallback.STATUS_DIALOG_INIT_DONE, new Object[]{msgStatus, dialogid});
} catch (Exception e) {
msgStatus.addException(e);
}
return msgStatus;
} | [
"private",
"HBCIMsgStatus",
"doDialogInit",
"(",
")",
"{",
"HBCIMsgStatus",
"msgStatus",
"=",
"new",
"HBCIMsgStatus",
"(",
")",
";",
"try",
"{",
"log",
".",
"debug",
"(",
"HBCIUtils",
".",
"getLocMsg",
"(",
"\"STATUS_DIALOG_INIT\"",
")",
")",
";",
"passport",
... | Processing the DialogInit stage and updating institute and user data from the server
(mid-level API).
<p>
This method processes the dialog initialization stage of an HBCIDialog. It creates
a new rawMsg in the kernel and processes it. The return values will be
passed to appropriate methods in the @c institute and @c user objects to
update their internal state with the data received from the institute. | [
"Processing",
"the",
"DialogInit",
"stage",
"and",
"updating",
"institute",
"and",
"user",
"data",
"from",
"the",
"server",
"(",
"mid",
"-",
"level",
"API",
")",
".",
"<p",
">",
"This",
"method",
"processes",
"the",
"dialog",
"initialization",
"stage",
"of",... | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/HBCIDialog.java#L98-L145 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/parallel/ArrayProcedureFJTaskRunner.java | ArrayProcedureFJTaskRunner.createAndExecuteTasks | private void createAndExecuteTasks(Executor executor, ProcedureFactory<BT> procedureFactory, T[] array)
{
this.procedures = new ArrayProcedureFJTask[this.taskCount];
int sectionSize = array.length / this.taskCount;
int size = this.taskCount;
for (int index = 0; index < size; index++)
{
ArrayProcedureFJTask<T, BT> procedureFJTask = new ArrayProcedureFJTask<T, BT>(this, procedureFactory, array, index,
sectionSize, index == this.taskCount - 1);
this.procedures[index] = procedureFJTask;
executor.execute(procedureFJTask);
}
} | java | private void createAndExecuteTasks(Executor executor, ProcedureFactory<BT> procedureFactory, T[] array)
{
this.procedures = new ArrayProcedureFJTask[this.taskCount];
int sectionSize = array.length / this.taskCount;
int size = this.taskCount;
for (int index = 0; index < size; index++)
{
ArrayProcedureFJTask<T, BT> procedureFJTask = new ArrayProcedureFJTask<T, BT>(this, procedureFactory, array, index,
sectionSize, index == this.taskCount - 1);
this.procedures[index] = procedureFJTask;
executor.execute(procedureFJTask);
}
} | [
"private",
"void",
"createAndExecuteTasks",
"(",
"Executor",
"executor",
",",
"ProcedureFactory",
"<",
"BT",
">",
"procedureFactory",
",",
"T",
"[",
"]",
"array",
")",
"{",
"this",
".",
"procedures",
"=",
"new",
"ArrayProcedureFJTask",
"[",
"this",
".",
"taskC... | Creates an array of ProcedureFJTasks wrapping Procedures created by the specified ProcedureFactory. | [
"Creates",
"an",
"array",
"of",
"ProcedureFJTasks",
"wrapping",
"Procedures",
"created",
"by",
"the",
"specified",
"ProcedureFactory",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/parallel/ArrayProcedureFJTaskRunner.java#L57-L69 |
knowm/XChange | xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseMarketDataServiceRaw.java | CoinbaseMarketDataServiceRaw.getCoinbaseExchangeRates | public Map<String, BigDecimal> getCoinbaseExchangeRates() throws IOException {
return coinbase.getCurrencyExchangeRates(Coinbase.CB_VERSION_VALUE).getData().getRates();
} | java | public Map<String, BigDecimal> getCoinbaseExchangeRates() throws IOException {
return coinbase.getCurrencyExchangeRates(Coinbase.CB_VERSION_VALUE).getData().getRates();
} | [
"public",
"Map",
"<",
"String",
",",
"BigDecimal",
">",
"getCoinbaseExchangeRates",
"(",
")",
"throws",
"IOException",
"{",
"return",
"coinbase",
".",
"getCurrencyExchangeRates",
"(",
"Coinbase",
".",
"CB_VERSION_VALUE",
")",
".",
"getData",
"(",
")",
".",
"getR... | Unauthenticated resource that returns BTC to fiat (and vice versus) exchange rates in various
currencies.
@return Map of lower case directional currency pairs, i.e. btc_to_xxx and xxx_to_btc, to
exchange rates.
@throws IOException
@see <a
href="https://developers.coinbase.com/api/v2#exchange-rates">developers.coinbase.com/api/v2#exchange-rates</a> | [
"Unauthenticated",
"resource",
"that",
"returns",
"BTC",
"to",
"fiat",
"(",
"and",
"vice",
"versus",
")",
"exchange",
"rates",
"in",
"various",
"currencies",
"."
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseMarketDataServiceRaw.java#L30-L33 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/CheckedExceptionsFactory.java | CheckedExceptionsFactory.newIOException | public static IOException newIOException(Throwable cause, String message, Object... args) {
return new IOException(format(message, args), cause);
} | java | public static IOException newIOException(Throwable cause, String message, Object... args) {
return new IOException(format(message, args), cause);
} | [
"public",
"static",
"IOException",
"newIOException",
"(",
"Throwable",
"cause",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"IOException",
"(",
"format",
"(",
"message",
",",
"args",
")",
",",
"cause",
")",
";",
"}"
] | Constructs and initializes a new {@link IOException} with the given {@link Throwable cause}
and {@link String message} formatted with the given {@link Object[] arguments}.
@param cause {@link Throwable} identified as the reason this {@link IOException} was thrown.
@param message {@link String} describing the {@link IOException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link IOException} with the given {@link Throwable cause} and {@link String message}.
@see java.io.IOException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"IOException",
"}",
"with",
"the",
"given",
"{",
"@link",
"Throwable",
"cause",
"}",
"and",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"Object",
"... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/CheckedExceptionsFactory.java#L89-L91 |
cdapio/tephra | tephra-core/src/main/java/co/cask/tephra/persist/TransactionEdit.java | TransactionEdit.createCommitting | public static TransactionEdit createCommitting(long writePointer, Set<ChangeId> changes) {
return new TransactionEdit(writePointer, 0L, State.COMMITTING, 0L, changes, 0L, false, null, null, 0L, 0L, null);
} | java | public static TransactionEdit createCommitting(long writePointer, Set<ChangeId> changes) {
return new TransactionEdit(writePointer, 0L, State.COMMITTING, 0L, changes, 0L, false, null, null, 0L, 0L, null);
} | [
"public",
"static",
"TransactionEdit",
"createCommitting",
"(",
"long",
"writePointer",
",",
"Set",
"<",
"ChangeId",
">",
"changes",
")",
"{",
"return",
"new",
"TransactionEdit",
"(",
"writePointer",
",",
"0L",
",",
"State",
".",
"COMMITTING",
",",
"0L",
",",
... | Creates a new instance in the {@link State#COMMITTING} state. | [
"Creates",
"a",
"new",
"instance",
"in",
"the",
"{"
] | train | https://github.com/cdapio/tephra/blob/082c56c15c6ece15002631ff6f89206a00d8915c/tephra-core/src/main/java/co/cask/tephra/persist/TransactionEdit.java#L240-L242 |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java | HawkbitCommonUtil.getStatusLabelDetailsInString | public static String getStatusLabelDetailsInString(final String value, final String style, final String id) {
final StringBuilder val = new StringBuilder();
if (!StringUtils.isEmpty(value)) {
val.append("value:").append(value).append(",");
}
if (!StringUtils.isEmpty(style)) {
val.append("style:").append(style).append(",");
}
return val.append("id:").append(id).toString();
} | java | public static String getStatusLabelDetailsInString(final String value, final String style, final String id) {
final StringBuilder val = new StringBuilder();
if (!StringUtils.isEmpty(value)) {
val.append("value:").append(value).append(",");
}
if (!StringUtils.isEmpty(style)) {
val.append("style:").append(style).append(",");
}
return val.append("id:").append(id).toString();
} | [
"public",
"static",
"String",
"getStatusLabelDetailsInString",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"style",
",",
"final",
"String",
"id",
")",
"{",
"final",
"StringBuilder",
"val",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"... | Returns a formatted string as needed by label custom render .This string
holds the properties of a status label.
@param value
label value
@param style
label style
@param id
label id
@return formatted string | [
"Returns",
"a",
"formatted",
"string",
"as",
"needed",
"by",
"label",
"custom",
"render",
".",
"This",
"string",
"holds",
"the",
"properties",
"of",
"a",
"status",
"label",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java#L496-L505 |
SonarSource/sonarqube | sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/MetadataGenerator.java | MetadataGenerator.setMetadata | public void setMetadata(String moduleKeyWithBranch, final DefaultInputFile inputFile, Charset defaultEncoding) {
CharsetDetector charsetDetector = new CharsetDetector(inputFile.path(), defaultEncoding);
try {
Charset charset;
if (charsetDetector.run()) {
charset = charsetDetector.charset();
} else {
LOG.debug("Failed to detect a valid charset for file '{}'. Using default charset.", inputFile);
charset = defaultEncoding;
}
InputStream is = charsetDetector.inputStream();
inputFile.setCharset(charset);
Metadata metadata = fileMetadata.readMetadata(is, charset, inputFile.absolutePath(), exclusionsScanner.createCharHandlerFor(inputFile));
inputFile.setMetadata(metadata);
inputFile.setStatus(statusDetection.status(moduleKeyWithBranch, inputFile, metadata.hash()));
LOG.debug("'{}' generated metadata{} with charset '{}'", inputFile, inputFile.type() == Type.TEST ? " as test " : "", charset);
} catch (Exception e) {
throw new IllegalStateException(e);
}
} | java | public void setMetadata(String moduleKeyWithBranch, final DefaultInputFile inputFile, Charset defaultEncoding) {
CharsetDetector charsetDetector = new CharsetDetector(inputFile.path(), defaultEncoding);
try {
Charset charset;
if (charsetDetector.run()) {
charset = charsetDetector.charset();
} else {
LOG.debug("Failed to detect a valid charset for file '{}'. Using default charset.", inputFile);
charset = defaultEncoding;
}
InputStream is = charsetDetector.inputStream();
inputFile.setCharset(charset);
Metadata metadata = fileMetadata.readMetadata(is, charset, inputFile.absolutePath(), exclusionsScanner.createCharHandlerFor(inputFile));
inputFile.setMetadata(metadata);
inputFile.setStatus(statusDetection.status(moduleKeyWithBranch, inputFile, metadata.hash()));
LOG.debug("'{}' generated metadata{} with charset '{}'", inputFile, inputFile.type() == Type.TEST ? " as test " : "", charset);
} catch (Exception e) {
throw new IllegalStateException(e);
}
} | [
"public",
"void",
"setMetadata",
"(",
"String",
"moduleKeyWithBranch",
",",
"final",
"DefaultInputFile",
"inputFile",
",",
"Charset",
"defaultEncoding",
")",
"{",
"CharsetDetector",
"charsetDetector",
"=",
"new",
"CharsetDetector",
"(",
"inputFile",
".",
"path",
"(",
... | Sets all metadata in the file, including charset and status.
It is an expensive computation, reading the entire file. | [
"Sets",
"all",
"metadata",
"in",
"the",
"file",
"including",
"charset",
"and",
"status",
".",
"It",
"is",
"an",
"expensive",
"computation",
"reading",
"the",
"entire",
"file",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/MetadataGenerator.java#L55-L74 |
TheHortonMachine/hortonmachine | dbs/src/main/java/jsqlite/Database.java | Database.create_function | public void create_function( String name, int nargs, Function f ) {
synchronized (this) {
_create_function(name, nargs, f);
}
} | java | public void create_function( String name, int nargs, Function f ) {
synchronized (this) {
_create_function(name, nargs, f);
}
} | [
"public",
"void",
"create_function",
"(",
"String",
"name",
",",
"int",
"nargs",
",",
"Function",
"f",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"_create_function",
"(",
"name",
",",
"nargs",
",",
"f",
")",
";",
"}",
"}"
] | Create regular function.
@param name the name of the new function
@param nargs number of arguments to function
@param f interface of function | [
"Create",
"regular",
"function",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/jsqlite/Database.java#L453-L457 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/config/NamedEventManager.java | NamedEventManager.addNamedEvent | public void addNamedEvent (String shortName, Class<? extends ComponentSystemEvent> cls)
{
String key = shortName;
Collection<Class<? extends ComponentSystemEvent>> eventList;
// Per the spec, if the short name is missing, generate one.
if (shortName == null)
{
key = getFixedName (cls);
}
eventList = events.get (key);
if (eventList == null)
{
// First event registered to this short name.
eventList = new LinkedList<Class<? extends ComponentSystemEvent>>();
events.put (key, eventList);
}
eventList.add (cls);
} | java | public void addNamedEvent (String shortName, Class<? extends ComponentSystemEvent> cls)
{
String key = shortName;
Collection<Class<? extends ComponentSystemEvent>> eventList;
// Per the spec, if the short name is missing, generate one.
if (shortName == null)
{
key = getFixedName (cls);
}
eventList = events.get (key);
if (eventList == null)
{
// First event registered to this short name.
eventList = new LinkedList<Class<? extends ComponentSystemEvent>>();
events.put (key, eventList);
}
eventList.add (cls);
} | [
"public",
"void",
"addNamedEvent",
"(",
"String",
"shortName",
",",
"Class",
"<",
"?",
"extends",
"ComponentSystemEvent",
">",
"cls",
")",
"{",
"String",
"key",
"=",
"shortName",
";",
"Collection",
"<",
"Class",
"<",
"?",
"extends",
"ComponentSystemEvent",
">"... | Registers a named event.
@param shortName a String containing the short name for the event, from the @NamedEvent.shortName()
attribute.
@param cls the event class to register. | [
"Registers",
"a",
"named",
"event",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/config/NamedEventManager.java#L69-L93 |
samskivert/pythagoras | src/main/java/pythagoras/f/Arc.java | Arc.setAngles | public void setAngles (float x1, float y1, float x2, float y2) {
float cx = centerX();
float cy = centerY();
float a1 = normAngle(-FloatMath.toDegrees(FloatMath.atan2(y1 - cy, x1 - cx)));
float a2 = normAngle(-FloatMath.toDegrees(FloatMath.atan2(y2 - cy, x2 - cx)));
a2 -= a1;
if (a2 <= 0f) {
a2 += 360f;
}
setAngleStart(a1);
setAngleExtent(a2);
} | java | public void setAngles (float x1, float y1, float x2, float y2) {
float cx = centerX();
float cy = centerY();
float a1 = normAngle(-FloatMath.toDegrees(FloatMath.atan2(y1 - cy, x1 - cx)));
float a2 = normAngle(-FloatMath.toDegrees(FloatMath.atan2(y2 - cy, x2 - cx)));
a2 -= a1;
if (a2 <= 0f) {
a2 += 360f;
}
setAngleStart(a1);
setAngleExtent(a2);
} | [
"public",
"void",
"setAngles",
"(",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"x2",
",",
"float",
"y2",
")",
"{",
"float",
"cx",
"=",
"centerX",
"(",
")",
";",
"float",
"cy",
"=",
"centerY",
"(",
")",
";",
"float",
"a1",
"=",
"normAngle",
... | Sets the starting angle and angular extent of this arc using two sets of coordinates. The
first set of coordinates is used to determine the angle of the starting point relative to
the arc's center. The second set of coordinates is used to determine the angle of the end
point relative to the arc's center. The arc will always be non-empty and extend
counterclockwise from the first point around to the second point. | [
"Sets",
"the",
"starting",
"angle",
"and",
"angular",
"extent",
"of",
"this",
"arc",
"using",
"two",
"sets",
"of",
"coordinates",
".",
"The",
"first",
"set",
"of",
"coordinates",
"is",
"used",
"to",
"determine",
"the",
"angle",
"of",
"the",
"starting",
"po... | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Arc.java#L212-L223 |
Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/meta/InodeLockList.java | InodeLockList.lockEdge | public void lockEdge(String childName, LockMode mode) {
Preconditions.checkState(endsInInode());
Preconditions.checkState(mLockMode == LockMode.READ);
lockEdgeInternal(childName, mode);
mLockMode = mode;
} | java | public void lockEdge(String childName, LockMode mode) {
Preconditions.checkState(endsInInode());
Preconditions.checkState(mLockMode == LockMode.READ);
lockEdgeInternal(childName, mode);
mLockMode = mode;
} | [
"public",
"void",
"lockEdge",
"(",
"String",
"childName",
",",
"LockMode",
"mode",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"endsInInode",
"(",
")",
")",
";",
"Preconditions",
".",
"checkState",
"(",
"mLockMode",
"==",
"LockMode",
".",
"READ",
")",... | Locks an edge leading out of the last inode in the list.
For example, if the lock list is [a, a->b, b], lockEdge(c) will add b->c to the list, resulting
in [a, a->b, b, b->c].
@param childName the child to lock
@param mode the mode to lock in | [
"Locks",
"an",
"edge",
"leading",
"out",
"of",
"the",
"last",
"inode",
"in",
"the",
"list",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeLockList.java#L110-L116 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/VoiceApi.java | VoiceApi.redirectCall | public void redirectCall(
String connId,
String destination,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsidredirectData redirectData = new VoicecallsidredirectData();
redirectData.setDestination(destination);
redirectData.setReasons(Util.toKVList(reasons));
redirectData.setExtensions(Util.toKVList(extensions));
RedirectData data = new RedirectData();
data.data(redirectData);
ApiSuccessResponse response = this.voiceApi.redirect(connId, data);
throwIfNotOk("redirectCall", response);
} catch (ApiException e) {
throw new WorkspaceApiException("redirectCall failed.", e);
}
} | java | public void redirectCall(
String connId,
String destination,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsidredirectData redirectData = new VoicecallsidredirectData();
redirectData.setDestination(destination);
redirectData.setReasons(Util.toKVList(reasons));
redirectData.setExtensions(Util.toKVList(extensions));
RedirectData data = new RedirectData();
data.data(redirectData);
ApiSuccessResponse response = this.voiceApi.redirect(connId, data);
throwIfNotOk("redirectCall", response);
} catch (ApiException e) {
throw new WorkspaceApiException("redirectCall failed.", e);
}
} | [
"public",
"void",
"redirectCall",
"(",
"String",
"connId",
",",
"String",
"destination",
",",
"KeyValueCollection",
"reasons",
",",
"KeyValueCollection",
"extensions",
")",
"throws",
"WorkspaceApiException",
"{",
"try",
"{",
"VoicecallsidredirectData",
"redirectData",
"... | Redirect a call to the specified destination
@param connId The connection ID of the call to redirect.
@param destination The number where Workspace should redirect the call.
@param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional)
@param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional) | [
"Redirect",
"a",
"call",
"to",
"the",
"specified",
"destination"
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L1215-L1234 |
BlueBrain/bluima | modules/bluima_utils/src/main/java/ch/epfl/bbp/uima/annotationviewer/BlueAnnotationViewGenerator.java | BlueAnnotationViewGenerator.processDocument | public void processDocument(File aInlineXmlDoc) throws TransformerException {
// Generate document view HTML from Inline XML
Transformer docHtmlTransformer = mTFactory
.newTransformer(new StreamSource(new File(mOutputDir,
"docFrame.xsl")));
docHtmlTransformer.transform(
new StreamSource(aInlineXmlDoc),
new StreamResult(new File(mOutputDir, "docView.html")
.getAbsolutePath()));
// NOTE: getAbsolutePath() seems to be necessary on Java 1.5
} | java | public void processDocument(File aInlineXmlDoc) throws TransformerException {
// Generate document view HTML from Inline XML
Transformer docHtmlTransformer = mTFactory
.newTransformer(new StreamSource(new File(mOutputDir,
"docFrame.xsl")));
docHtmlTransformer.transform(
new StreamSource(aInlineXmlDoc),
new StreamResult(new File(mOutputDir, "docView.html")
.getAbsolutePath()));
// NOTE: getAbsolutePath() seems to be necessary on Java 1.5
} | [
"public",
"void",
"processDocument",
"(",
"File",
"aInlineXmlDoc",
")",
"throws",
"TransformerException",
"{",
"// Generate document view HTML from Inline XML",
"Transformer",
"docHtmlTransformer",
"=",
"mTFactory",
".",
"newTransformer",
"(",
"new",
"StreamSource",
"(",
"n... | Processes an annotated document using the docFrame.xsl stylsheet
generated by a previous call to {@link processStyleMap(File)}. Generates
a file named docView.html, which represents the HTML view of the
annotated document.
@param aInlineXmlDoc
path to annotated document to be processed | [
"Processes",
"an",
"annotated",
"document",
"using",
"the",
"docFrame",
".",
"xsl",
"stylsheet",
"generated",
"by",
"a",
"previous",
"call",
"to",
"{",
"@link",
"processStyleMap",
"(",
"File",
")",
"}",
".",
"Generates",
"a",
"file",
"named",
"docView",
".",... | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_utils/src/main/java/ch/epfl/bbp/uima/annotationviewer/BlueAnnotationViewGenerator.java#L219-L230 |
zaproxy/zaproxy | src/org/parosproxy/paros/db/DbUtils.java | DbUtils.getColumnType | public static int getColumnType(final Connection connection, final String tableName, final String columnName) throws SQLException {
int columnType = -1;
ResultSet rs = null;
try {
rs = connection.getMetaData().getColumns(null, null, tableName, columnName);
if (rs.next()) {
columnType = rs.getInt("SQL_DATA_TYPE");
}
} finally {
try {
if (rs != null) {
rs.close();
}
} catch (SQLException e) {
if (logger.isDebugEnabled()) {
logger.debug(e.getMessage(), e);
}
}
}
return columnType;
} | java | public static int getColumnType(final Connection connection, final String tableName, final String columnName) throws SQLException {
int columnType = -1;
ResultSet rs = null;
try {
rs = connection.getMetaData().getColumns(null, null, tableName, columnName);
if (rs.next()) {
columnType = rs.getInt("SQL_DATA_TYPE");
}
} finally {
try {
if (rs != null) {
rs.close();
}
} catch (SQLException e) {
if (logger.isDebugEnabled()) {
logger.debug(e.getMessage(), e);
}
}
}
return columnType;
} | [
"public",
"static",
"int",
"getColumnType",
"(",
"final",
"Connection",
"connection",
",",
"final",
"String",
"tableName",
",",
"final",
"String",
"columnName",
")",
"throws",
"SQLException",
"{",
"int",
"columnType",
"=",
"-",
"1",
";",
"ResultSet",
"rs",
"="... | Gets the type of the given column {@code columnName} of the table
{@code tableName}.
@param connection
the connection to the database
@param tableName
the name of the table that has the column
@param columnName
the name of the column that will be used to get the type
@return the type of the column, or -1 if the column doesn't exist.
@throws SQLException
if an error occurred while checking the type of the column | [
"Gets",
"the",
"type",
"of",
"the",
"given",
"column",
"{",
"@code",
"columnName",
"}",
"of",
"the",
"table",
"{",
"@code",
"tableName",
"}",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/db/DbUtils.java#L169-L191 |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/client/AtsdPropertyExtractor.java | AtsdPropertyExtractor.getAsString | public String getAsString(final String name, final String defaultValue) {
return AtsdUtil.getPropertyStringValue(fullName(name), clientProperties, defaultValue);
} | java | public String getAsString(final String name, final String defaultValue) {
return AtsdUtil.getPropertyStringValue(fullName(name), clientProperties, defaultValue);
} | [
"public",
"String",
"getAsString",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"defaultValue",
")",
"{",
"return",
"AtsdUtil",
".",
"getPropertyStringValue",
"(",
"fullName",
"(",
"name",
")",
",",
"clientProperties",
",",
"defaultValue",
")",
";",
... | Get property by name as {@link String} value
@param name name of property without the prefix.
@param defaultValue default value for case when the property is not set.
@return property's value. | [
"Get",
"property",
"by",
"name",
"as",
"{",
"@link",
"String",
"}",
"value"
] | train | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/AtsdPropertyExtractor.java#L60-L62 |
sriharshachilakapati/WebGL4J | webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java | WebGL10.glBindAttribLocation | public static void glBindAttribLocation(int programID, int index, String name)
{
checkContextCompatibility();
nglBindAttribLocation(WebGLObjectMap.get().toProgram(programID), index, name);
} | java | public static void glBindAttribLocation(int programID, int index, String name)
{
checkContextCompatibility();
nglBindAttribLocation(WebGLObjectMap.get().toProgram(programID), index, name);
} | [
"public",
"static",
"void",
"glBindAttribLocation",
"(",
"int",
"programID",
",",
"int",
"index",
",",
"String",
"name",
")",
"{",
"checkContextCompatibility",
"(",
")",
";",
"nglBindAttribLocation",
"(",
"WebGLObjectMap",
".",
"get",
"(",
")",
".",
"toProgram",... | <p>{@code glBindAttribLocation} is used to associate a user-defined attribute variable in the program object
specified by {@code programID} with a generic vertex attribute index. The name of the user-defined attribute
variable is string in {@code name}. The generic vertex attribute index to be bound to this variable is specified
by {@code index}. When {@code program} is made part of current state, values provided via the generic vertex
attribute index will modify the value of the user-defined attribute variable specified by name.</p>
<p>{@link #GL_INVALID_VALUE} is generated if index is greater than or equal to {@link
#GL_MAX_VERTEX_ATTRIBS}.</p>
<p>{@link #GL_INVALID_OPERATION} is generated if name starts with the reserved prefix "gl_".</p>
<p>{@link #GL_INVALID_VALUE} is generated if program is not a value generated by OpenGL.</p>
<p>{@link #GL_INVALID_OPERATION} is generated if program is not a program object.</p>
@param programID Specifies the handle of the program object in which the association is to be made.
@param index Specifies the index of the generic vertex attribute to be bound.
@param name Specifies a string containing the name of the vertex shader attribute variable to which {@code
index} is to be bound. | [
"<p",
">",
"{",
"@code",
"glBindAttribLocation",
"}",
"is",
"used",
"to",
"associate",
"a",
"user",
"-",
"defined",
"attribute",
"variable",
"in",
"the",
"program",
"object",
"specified",
"by",
"{",
"@code",
"programID",
"}",
"with",
"a",
"generic",
"vertex"... | train | https://github.com/sriharshachilakapati/WebGL4J/blob/7daa425300b08b338b50cef2935289849c92d415/webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java#L555-L559 |
alkacon/opencms-core | src/org/opencms/xml/containerpage/CmsFormatterConfiguration.java | CmsFormatterConfiguration.getDetailFormatter | public I_CmsFormatterBean getDetailFormatter(String types, int containerWidth) {
// detail formatters must still match the type or width
Predicate<I_CmsFormatterBean> checkValidDetailFormatter = Predicates.and(
new MatchesTypeOrWidth(types, containerWidth),
new IsDetail());
Optional<I_CmsFormatterBean> result = Iterables.tryFind(m_allFormatters, checkValidDetailFormatter);
return result.orNull();
} | java | public I_CmsFormatterBean getDetailFormatter(String types, int containerWidth) {
// detail formatters must still match the type or width
Predicate<I_CmsFormatterBean> checkValidDetailFormatter = Predicates.and(
new MatchesTypeOrWidth(types, containerWidth),
new IsDetail());
Optional<I_CmsFormatterBean> result = Iterables.tryFind(m_allFormatters, checkValidDetailFormatter);
return result.orNull();
} | [
"public",
"I_CmsFormatterBean",
"getDetailFormatter",
"(",
"String",
"types",
",",
"int",
"containerWidth",
")",
"{",
"// detail formatters must still match the type or width",
"Predicate",
"<",
"I_CmsFormatterBean",
">",
"checkValidDetailFormatter",
"=",
"Predicates",
".",
"... | Gets the detail formatter to use for the given type and container width.<p>
@param types the container types (comma separated)
@param containerWidth the container width
@return the detail formatter to use | [
"Gets",
"the",
"detail",
"formatter",
"to",
"use",
"for",
"the",
"given",
"type",
"and",
"container",
"width",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsFormatterConfiguration.java#L330-L338 |
geomajas/geomajas-project-client-gwt2 | common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java | StyleUtil.createStroke | public static StrokeInfo createStroke(String color, int width, float opacity, String dashArray) {
StrokeInfo strokeInfo = new StrokeInfo();
if (color != null) {
strokeInfo.getCssParameterList().add(createCssParameter("stroke", color));
}
strokeInfo.getCssParameterList().add(createCssParameter("stroke-width", width));
if (dashArray != null) {
strokeInfo.getCssParameterList().add(createCssParameter("stroke-dasharray", dashArray));
}
strokeInfo.getCssParameterList().add(createCssParameter("stroke-opacity", opacity));
return strokeInfo;
} | java | public static StrokeInfo createStroke(String color, int width, float opacity, String dashArray) {
StrokeInfo strokeInfo = new StrokeInfo();
if (color != null) {
strokeInfo.getCssParameterList().add(createCssParameter("stroke", color));
}
strokeInfo.getCssParameterList().add(createCssParameter("stroke-width", width));
if (dashArray != null) {
strokeInfo.getCssParameterList().add(createCssParameter("stroke-dasharray", dashArray));
}
strokeInfo.getCssParameterList().add(createCssParameter("stroke-opacity", opacity));
return strokeInfo;
} | [
"public",
"static",
"StrokeInfo",
"createStroke",
"(",
"String",
"color",
",",
"int",
"width",
",",
"float",
"opacity",
",",
"String",
"dashArray",
")",
"{",
"StrokeInfo",
"strokeInfo",
"=",
"new",
"StrokeInfo",
"(",
")",
";",
"if",
"(",
"color",
"!=",
"nu... | Creates a stroke with the specified CSS parameters.
@param color the color
@param width the width
@param opacity the opacity
@param dashArray the dash array
@return the stroke | [
"Creates",
"a",
"stroke",
"with",
"the",
"specified",
"CSS",
"parameters",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java#L198-L209 |
mozilla/rhino | src/org/mozilla/javascript/ScriptableObject.java | ScriptableObject.isGetterOrSetter | protected boolean isGetterOrSetter(String name, int index, boolean setter) {
Slot slot = slotMap.query(name, index);
if (slot instanceof GetterSlot) {
if (setter && ((GetterSlot)slot).setter != null) return true;
if (!setter && ((GetterSlot)slot).getter != null) return true;
}
return false;
} | java | protected boolean isGetterOrSetter(String name, int index, boolean setter) {
Slot slot = slotMap.query(name, index);
if (slot instanceof GetterSlot) {
if (setter && ((GetterSlot)slot).setter != null) return true;
if (!setter && ((GetterSlot)slot).getter != null) return true;
}
return false;
} | [
"protected",
"boolean",
"isGetterOrSetter",
"(",
"String",
"name",
",",
"int",
"index",
",",
"boolean",
"setter",
")",
"{",
"Slot",
"slot",
"=",
"slotMap",
".",
"query",
"(",
"name",
",",
"index",
")",
";",
"if",
"(",
"slot",
"instanceof",
"GetterSlot",
... | Returns whether a property is a getter or a setter
@param name property name
@param index property index
@param setter true to check for a setter, false for a getter
@return whether the property is a getter or a setter | [
"Returns",
"whether",
"a",
"property",
"is",
"a",
"getter",
"or",
"a",
"setter"
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L886-L893 |
h2oai/h2o-3 | h2o-core/src/main/java/water/parser/ParserProvider.java | ParserProvider.guessInitSetup | public ParseSetup guessInitSetup(ByteVec v, byte[] bits, ParseSetup userSetup) {
return guessSetup(v, bits, userSetup._separator, userSetup._number_columns, userSetup._single_quotes,
userSetup._check_header, userSetup._column_names, userSetup._column_types, userSetup._domains, userSetup._na_strings);
} | java | public ParseSetup guessInitSetup(ByteVec v, byte[] bits, ParseSetup userSetup) {
return guessSetup(v, bits, userSetup._separator, userSetup._number_columns, userSetup._single_quotes,
userSetup._check_header, userSetup._column_names, userSetup._column_types, userSetup._domains, userSetup._na_strings);
} | [
"public",
"ParseSetup",
"guessInitSetup",
"(",
"ByteVec",
"v",
",",
"byte",
"[",
"]",
"bits",
",",
"ParseSetup",
"userSetup",
")",
"{",
"return",
"guessSetup",
"(",
"v",
",",
"bits",
",",
"userSetup",
".",
"_separator",
",",
"userSetup",
".",
"_number_column... | Constructs initial ParseSetup from a given user setup
Any exception thrown by this method will signal that this ParserProvider doesn't support
the input data.
Parsers of data formats that provide metadata (eg. a binary file formats like Parquet) should use the
file metadata to identify the parse type and possibly other properties of the ParseSetup
that can be determined just from the metadata itself. The goal should be perform the least amount of operations
to correctly determine the ParseType (any exception means - format is not supported!).
Note: Some file formats like CSV don't provide any metadata. In that case this method can return the final
ParseSetup.
@param v optional ByteVec
@param bits first bytes of the file
@param userSetup user specified setup
@return null if this Provider cannot provide a parser for this file, otherwise an instance of ParseSetup
with correct setting of ParseSetup._parse_type | [
"Constructs",
"initial",
"ParseSetup",
"from",
"a",
"given",
"user",
"setup"
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/parser/ParserProvider.java#L63-L66 |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandler.java | RTMPHandler.invokeCall | private boolean invokeCall(RTMPConnection conn, IServiceCall call, Object service) {
final IScope scope = conn.getScope();
final IContext context = scope.getContext();
if (log.isTraceEnabled()) {
log.trace("Scope: {} context: {} service: {}", scope, context, service);
}
return context.getServiceInvoker().invoke(call, service);
} | java | private boolean invokeCall(RTMPConnection conn, IServiceCall call, Object service) {
final IScope scope = conn.getScope();
final IContext context = scope.getContext();
if (log.isTraceEnabled()) {
log.trace("Scope: {} context: {} service: {}", scope, context, service);
}
return context.getServiceInvoker().invoke(call, service);
} | [
"private",
"boolean",
"invokeCall",
"(",
"RTMPConnection",
"conn",
",",
"IServiceCall",
"call",
",",
"Object",
"service",
")",
"{",
"final",
"IScope",
"scope",
"=",
"conn",
".",
"getScope",
"(",
")",
";",
"final",
"IContext",
"context",
"=",
"scope",
".",
... | Remoting call invocation handler.
@param conn
RTMP connection
@param call
Service call
@param service
Server-side service object
@return true if the call was performed, otherwise false | [
"Remoting",
"call",
"invocation",
"handler",
"."
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandler.java#L208-L215 |
alkacon/opencms-core | src/org/opencms/importexport/CmsImportHelper.java | CmsImportHelper.getFileBytes | public byte[] getFileBytes(String filename) throws CmsImportExportException {
try {
// is this a zip-file?
if (getZipFile() != null) {
ZipEntry entry = getZipEntry(filename);
InputStream stream = getZipFile().getInputStream(entry);
int size = new Long(entry.getSize()).intValue();
return CmsFileUtil.readFully(stream, size);
} else {
// no - use directory
File file = getFile(filename);
return CmsFileUtil.readFile(file);
}
} catch (FileNotFoundException fnfe) {
CmsMessageContainer msg = Messages.get().container(Messages.ERR_IMPORTEXPORT_FILE_NOT_FOUND_1, filename);
if (LOG.isErrorEnabled()) {
LOG.error(msg.key(), fnfe);
}
throw new CmsImportExportException(msg, fnfe);
} catch (IOException ioe) {
CmsMessageContainer msg = Messages.get().container(
Messages.ERR_IMPORTEXPORT_ERROR_READING_FILE_1,
filename);
if (LOG.isErrorEnabled()) {
LOG.error(msg.key(), ioe);
}
throw new CmsImportExportException(msg, ioe);
}
} | java | public byte[] getFileBytes(String filename) throws CmsImportExportException {
try {
// is this a zip-file?
if (getZipFile() != null) {
ZipEntry entry = getZipEntry(filename);
InputStream stream = getZipFile().getInputStream(entry);
int size = new Long(entry.getSize()).intValue();
return CmsFileUtil.readFully(stream, size);
} else {
// no - use directory
File file = getFile(filename);
return CmsFileUtil.readFile(file);
}
} catch (FileNotFoundException fnfe) {
CmsMessageContainer msg = Messages.get().container(Messages.ERR_IMPORTEXPORT_FILE_NOT_FOUND_1, filename);
if (LOG.isErrorEnabled()) {
LOG.error(msg.key(), fnfe);
}
throw new CmsImportExportException(msg, fnfe);
} catch (IOException ioe) {
CmsMessageContainer msg = Messages.get().container(
Messages.ERR_IMPORTEXPORT_ERROR_READING_FILE_1,
filename);
if (LOG.isErrorEnabled()) {
LOG.error(msg.key(), ioe);
}
throw new CmsImportExportException(msg, ioe);
}
} | [
"public",
"byte",
"[",
"]",
"getFileBytes",
"(",
"String",
"filename",
")",
"throws",
"CmsImportExportException",
"{",
"try",
"{",
"// is this a zip-file?",
"if",
"(",
"getZipFile",
"(",
")",
"!=",
"null",
")",
"{",
"ZipEntry",
"entry",
"=",
"getZipEntry",
"("... | Returns a byte array containing the content of the file.<p>
@param filename the name of the file to read, relative to the folder or zip file
@return a byte array containing the content of the file
@throws CmsImportExportException if something goes wrong | [
"Returns",
"a",
"byte",
"array",
"containing",
"the",
"content",
"of",
"the",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportHelper.java#L139-L169 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/pipeline/declarative/utils/DeclarativePipelineUtils.java | DeclarativePipelineUtils.writeBuildDataFile | public static void writeBuildDataFile(FilePath ws, String buildNumber, BuildDataFile buildDataFile, Log logger) throws Exception {
createAndGetTempDir(ws).act(new CreateBuildDataFileCallable(buildNumber, buildDataFile, logger));
} | java | public static void writeBuildDataFile(FilePath ws, String buildNumber, BuildDataFile buildDataFile, Log logger) throws Exception {
createAndGetTempDir(ws).act(new CreateBuildDataFileCallable(buildNumber, buildDataFile, logger));
} | [
"public",
"static",
"void",
"writeBuildDataFile",
"(",
"FilePath",
"ws",
",",
"String",
"buildNumber",
",",
"BuildDataFile",
"buildDataFile",
",",
"Log",
"logger",
")",
"throws",
"Exception",
"{",
"createAndGetTempDir",
"(",
"ws",
")",
".",
"act",
"(",
"new",
... | Create pipeline build data in @tmp/artifactory-pipeline-cache/build-number directory.
Used to transfer data between different steps in declarative pipelines.
@param ws - The agent workspace.
@param buildNumber - The build number.
@param buildDataFile - The build data file to save.
@throws Exception - In case of no write permissions. | [
"Create",
"pipeline",
"build",
"data",
"in",
"@tmp",
"/",
"artifactory",
"-",
"pipeline",
"-",
"cache",
"/",
"build",
"-",
"number",
"directory",
".",
"Used",
"to",
"transfer",
"data",
"between",
"different",
"steps",
"in",
"declarative",
"pipelines",
"."
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/declarative/utils/DeclarativePipelineUtils.java#L40-L42 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchURIHelper.java | CouchURIHelper.attachmentUri | public URI attachmentUri(String documentId, String attachmentId) {
String base_uri = String.format(
"%s/%s/%s",
this.rootUriString,
this.encodeId(documentId),
this.encodeId(attachmentId)
);
return uriFor(base_uri);
} | java | public URI attachmentUri(String documentId, String attachmentId) {
String base_uri = String.format(
"%s/%s/%s",
this.rootUriString,
this.encodeId(documentId),
this.encodeId(attachmentId)
);
return uriFor(base_uri);
} | [
"public",
"URI",
"attachmentUri",
"(",
"String",
"documentId",
",",
"String",
"attachmentId",
")",
"{",
"String",
"base_uri",
"=",
"String",
".",
"format",
"(",
"\"%s/%s/%s\"",
",",
"this",
".",
"rootUriString",
",",
"this",
".",
"encodeId",
"(",
"documentId",... | Returns URI for Attachment having {@code attachmentId} for {@code documentId}. | [
"Returns",
"URI",
"for",
"Attachment",
"having",
"{"
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchURIHelper.java#L127-L135 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ColumnSRID.java | ColumnSRID.fetchConstraint | public static String fetchConstraint(Connection connection, String catalogName, String schemaName, String tableName) throws SQLException {
// Merge column constraint and table constraint
PreparedStatement pst = SFSUtilities.prepareInformationSchemaStatement(connection, catalogName, schemaName,
tableName, "INFORMATION_SCHEMA.CONSTRAINTS", "", "TABLE_CATALOG", "TABLE_SCHEMA","TABLE_NAME");
try (ResultSet rsConstraint = pst.executeQuery()) {
StringBuilder constraint = new StringBuilder();
while (rsConstraint.next()) {
String tableConstr = rsConstraint.getString("CHECK_EXPRESSION");
if(tableConstr != null) {
constraint.append(tableConstr);
}
}
return constraint.toString();
} finally {
pst.close();
}
} | java | public static String fetchConstraint(Connection connection, String catalogName, String schemaName, String tableName) throws SQLException {
// Merge column constraint and table constraint
PreparedStatement pst = SFSUtilities.prepareInformationSchemaStatement(connection, catalogName, schemaName,
tableName, "INFORMATION_SCHEMA.CONSTRAINTS", "", "TABLE_CATALOG", "TABLE_SCHEMA","TABLE_NAME");
try (ResultSet rsConstraint = pst.executeQuery()) {
StringBuilder constraint = new StringBuilder();
while (rsConstraint.next()) {
String tableConstr = rsConstraint.getString("CHECK_EXPRESSION");
if(tableConstr != null) {
constraint.append(tableConstr);
}
}
return constraint.toString();
} finally {
pst.close();
}
} | [
"public",
"static",
"String",
"fetchConstraint",
"(",
"Connection",
"connection",
",",
"String",
"catalogName",
",",
"String",
"schemaName",
",",
"String",
"tableName",
")",
"throws",
"SQLException",
"{",
"// Merge column constraint and table constraint",
"PreparedStatement... | Read table constraints from database metadata.
@param connection Active connection
@param catalogName Catalog name or empty string
@param schemaName Schema name or empty string
@param tableName table name
@return Found table constraints
@throws SQLException | [
"Read",
"table",
"constraints",
"from",
"database",
"metadata",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ColumnSRID.java#L82-L98 |
kubernetes-client/java | kubernetes/src/main/java/io/kubernetes/client/apis/CustomObjectsApi.java | CustomObjectsApi.listNamespacedCustomObjectAsync | public com.squareup.okhttp.Call listNamespacedCustomObjectAsync(String group, String version, String namespace, String plural, String pretty, String labelSelector, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ApiCallback<Object> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = listNamespacedCustomObjectValidateBeforeCall(group, version, namespace, plural, pretty, labelSelector, resourceVersion, timeoutSeconds, watch, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<Object>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | java | public com.squareup.okhttp.Call listNamespacedCustomObjectAsync(String group, String version, String namespace, String plural, String pretty, String labelSelector, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ApiCallback<Object> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = listNamespacedCustomObjectValidateBeforeCall(group, version, namespace, plural, pretty, labelSelector, resourceVersion, timeoutSeconds, watch, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<Object>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | [
"public",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"listNamespacedCustomObjectAsync",
"(",
"String",
"group",
",",
"String",
"version",
",",
"String",
"namespace",
",",
"String",
"plural",
",",
"String",
"pretty",
",",
"String",
"labelSelector",
",",
... | (asynchronously)
list or watch namespace scoped custom objects
@param group The custom resource's group name (required)
@param version The custom resource's version (required)
@param namespace The custom resource's namespace (required)
@param plural The custom resource's plural name. For TPRs this would be lowercase plural kind. (required)
@param pretty If 'true', then the output is pretty printed. (optional)
@param labelSelector A selector to restrict the list of returned objects by their labels. Defaults to everything. (optional)
@param resourceVersion When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. (optional)
@param timeoutSeconds Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. (optional)
@param watch Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. (optional)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object | [
"(",
"asynchronously",
")",
"list",
"or",
"watch",
"namespace",
"scoped",
"custom",
"objects"
] | train | https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/kubernetes/src/main/java/io/kubernetes/client/apis/CustomObjectsApi.java#L2079-L2104 |
apereo/cas | support/cas-server-support-aws/src/main/java/org/apereo/cas/aws/ChainingAWSCredentialsProvider.java | ChainingAWSCredentialsProvider.getInstance | public static AWSCredentialsProvider getInstance(final String credentialAccessKey, final String credentialSecretKey,
final Resource credentialPropertiesFile,
final String profilePath, final String profileName) {
LOGGER.debug("Attempting to locate AWS credentials...");
val chain = new ArrayList<AWSCredentialsProvider>();
chain.add(new InstanceProfileCredentialsProvider(false));
if (credentialPropertiesFile != null) {
try {
val f = credentialPropertiesFile.getFile();
chain.add(new PropertiesFileCredentialsProvider(f.getCanonicalPath()));
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
}
if (StringUtils.isNotBlank(profilePath) && StringUtils.isNotBlank(profileName)) {
addProviderToChain(nothing -> {
chain.add(new ProfileCredentialsProvider(profilePath, profileName));
return null;
});
}
addProviderToChain(nothing -> {
chain.add(new SystemPropertiesCredentialsProvider());
return null;
});
addProviderToChain(nothing -> {
chain.add(new EnvironmentVariableCredentialsProvider());
return null;
});
addProviderToChain(nothing -> {
chain.add(new ClasspathPropertiesFileCredentialsProvider("awscredentials.properties"));
return null;
});
if (StringUtils.isNotBlank(credentialAccessKey) && StringUtils.isNotBlank(credentialSecretKey)) {
addProviderToChain(nothing -> {
val credentials = new BasicAWSCredentials(credentialAccessKey, credentialSecretKey);
chain.add(new AWSStaticCredentialsProvider(credentials));
return null;
});
}
LOGGER.debug("AWS chained credential providers are configured as [{}]", chain);
return new ChainingAWSCredentialsProvider(chain);
} | java | public static AWSCredentialsProvider getInstance(final String credentialAccessKey, final String credentialSecretKey,
final Resource credentialPropertiesFile,
final String profilePath, final String profileName) {
LOGGER.debug("Attempting to locate AWS credentials...");
val chain = new ArrayList<AWSCredentialsProvider>();
chain.add(new InstanceProfileCredentialsProvider(false));
if (credentialPropertiesFile != null) {
try {
val f = credentialPropertiesFile.getFile();
chain.add(new PropertiesFileCredentialsProvider(f.getCanonicalPath()));
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
}
if (StringUtils.isNotBlank(profilePath) && StringUtils.isNotBlank(profileName)) {
addProviderToChain(nothing -> {
chain.add(new ProfileCredentialsProvider(profilePath, profileName));
return null;
});
}
addProviderToChain(nothing -> {
chain.add(new SystemPropertiesCredentialsProvider());
return null;
});
addProviderToChain(nothing -> {
chain.add(new EnvironmentVariableCredentialsProvider());
return null;
});
addProviderToChain(nothing -> {
chain.add(new ClasspathPropertiesFileCredentialsProvider("awscredentials.properties"));
return null;
});
if (StringUtils.isNotBlank(credentialAccessKey) && StringUtils.isNotBlank(credentialSecretKey)) {
addProviderToChain(nothing -> {
val credentials = new BasicAWSCredentials(credentialAccessKey, credentialSecretKey);
chain.add(new AWSStaticCredentialsProvider(credentials));
return null;
});
}
LOGGER.debug("AWS chained credential providers are configured as [{}]", chain);
return new ChainingAWSCredentialsProvider(chain);
} | [
"public",
"static",
"AWSCredentialsProvider",
"getInstance",
"(",
"final",
"String",
"credentialAccessKey",
",",
"final",
"String",
"credentialSecretKey",
",",
"final",
"Resource",
"credentialPropertiesFile",
",",
"final",
"String",
"profilePath",
",",
"final",
"String",
... | Gets instance.
@param credentialAccessKey the credential access key
@param credentialSecretKey the credential secret key
@param credentialPropertiesFile the credential properties file
@param profilePath the profile path
@param profileName the profile name
@return the instance | [
"Gets",
"instance",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-aws/src/main/java/org/apereo/cas/aws/ChainingAWSCredentialsProvider.java#L80-L128 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_tcp_route_routeId_rule_ruleId_PUT | public void serviceName_tcp_route_routeId_rule_ruleId_PUT(String serviceName, Long routeId, Long ruleId, OvhRouteRule body) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/tcp/route/{routeId}/rule/{ruleId}";
StringBuilder sb = path(qPath, serviceName, routeId, ruleId);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_tcp_route_routeId_rule_ruleId_PUT(String serviceName, Long routeId, Long ruleId, OvhRouteRule body) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/tcp/route/{routeId}/rule/{ruleId}";
StringBuilder sb = path(qPath, serviceName, routeId, ruleId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_tcp_route_routeId_rule_ruleId_PUT",
"(",
"String",
"serviceName",
",",
"Long",
"routeId",
",",
"Long",
"ruleId",
",",
"OvhRouteRule",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/tcp/ro... | Alter this object properties
REST: PUT /ipLoadbalancing/{serviceName}/tcp/route/{routeId}/rule/{ruleId}
@param body [required] New object properties
@param serviceName [required] The internal name of your IP load balancing
@param routeId [required] Id of your route
@param ruleId [required] Id of your rule | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1405-L1409 |
phax/ph-commons | ph-charset/src/main/java/com/helger/charset/utf7/UTF7StyleCharsetEncoder.java | UTF7StyleCharsetEncoder.encodeLoop | @Override
protected CoderResult encodeLoop (final CharBuffer in, final ByteBuffer out)
{
while (in.hasRemaining ())
{
if (out.remaining () < 4)
return CoderResult.OVERFLOW;
final char ch = in.get ();
if (m_aCharset.canEncodeDirectly (ch))
{
_unshift (out, ch);
out.put ((byte) ch);
}
else
if (!m_bBase64mode && ch == m_nShift)
{
out.put (m_nShift);
out.put (m_nUnshift);
}
else
_encodeBase64 (ch, out);
}
return CoderResult.UNDERFLOW;
} | java | @Override
protected CoderResult encodeLoop (final CharBuffer in, final ByteBuffer out)
{
while (in.hasRemaining ())
{
if (out.remaining () < 4)
return CoderResult.OVERFLOW;
final char ch = in.get ();
if (m_aCharset.canEncodeDirectly (ch))
{
_unshift (out, ch);
out.put ((byte) ch);
}
else
if (!m_bBase64mode && ch == m_nShift)
{
out.put (m_nShift);
out.put (m_nUnshift);
}
else
_encodeBase64 (ch, out);
}
return CoderResult.UNDERFLOW;
} | [
"@",
"Override",
"protected",
"CoderResult",
"encodeLoop",
"(",
"final",
"CharBuffer",
"in",
",",
"final",
"ByteBuffer",
"out",
")",
"{",
"while",
"(",
"in",
".",
"hasRemaining",
"(",
")",
")",
"{",
"if",
"(",
"out",
".",
"remaining",
"(",
")",
"<",
"4... | {@inheritDoc}
<p>
Note that this method might return <code>CoderResult.OVERFLOW</code>, even
though there is sufficient space available in the output buffer. This is
done to force the broken implementation of
{@link java.nio.charset.CharsetEncoder#encode(CharBuffer)} to call flush
(the buggy method is <code>final</code>, thus cannot be overridden).
</p>
<p>
However, String.getBytes() fails if CoderResult.OVERFLOW is returned, since
this assumes it always allocates sufficient bytes (maxBytesPerChar *
nr_of_chars). Thus, as an extra check, the size of the input buffer is
compared against the size of the output buffer. A static variable is used
to indicate if a broken java version is used.
</p>
<p>
It is not possible to directly write the last few bytes, since more bytes
might be waiting to be encoded then those available in the input buffer.
</p>
@see <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6221056">
JDK bug 6221056</a>
@param in
The input character buffer
@param out
The output byte buffer
@return A coder-result object describing the reason for termination | [
"{",
"@inheritDoc",
"}",
"<p",
">",
"Note",
"that",
"this",
"method",
"might",
"return",
"<code",
">",
"CoderResult",
".",
"OVERFLOW<",
"/",
"code",
">",
"even",
"though",
"there",
"is",
"sufficient",
"space",
"available",
"in",
"the",
"output",
"buffer",
... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-charset/src/main/java/com/helger/charset/utf7/UTF7StyleCharsetEncoder.java#L137-L161 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TileGroupsConfig.java | TileGroupsConfig.exportGroup | private static void exportGroup(Xml nodeGroups, TileGroup group)
{
final Xml nodeGroup = nodeGroups.createChild(NODE_GROUP);
nodeGroup.writeString(ATT_GROUP_NAME, group.getName());
nodeGroup.writeString(ATT_GROUP_TYPE, group.getType().name());
for (final TileRef tileRef : group.getTiles())
{
final Xml nodeTileRef = TileConfig.exports(tileRef);
nodeGroup.add(nodeTileRef);
}
} | java | private static void exportGroup(Xml nodeGroups, TileGroup group)
{
final Xml nodeGroup = nodeGroups.createChild(NODE_GROUP);
nodeGroup.writeString(ATT_GROUP_NAME, group.getName());
nodeGroup.writeString(ATT_GROUP_TYPE, group.getType().name());
for (final TileRef tileRef : group.getTiles())
{
final Xml nodeTileRef = TileConfig.exports(tileRef);
nodeGroup.add(nodeTileRef);
}
} | [
"private",
"static",
"void",
"exportGroup",
"(",
"Xml",
"nodeGroups",
",",
"TileGroup",
"group",
")",
"{",
"final",
"Xml",
"nodeGroup",
"=",
"nodeGroups",
".",
"createChild",
"(",
"NODE_GROUP",
")",
";",
"nodeGroup",
".",
"writeString",
"(",
"ATT_GROUP_NAME",
... | Export the group data as a node.
@param nodeGroups The root node (must not be <code>null</code>).
@param group The group to export (must not be <code>null</code>). | [
"Export",
"the",
"group",
"data",
"as",
"a",
"node",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TileGroupsConfig.java#L129-L140 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java | HttpBuilder.deleteAsync | public CompletableFuture<Object> deleteAsync(@DelegatesTo(HttpConfig.class) final Closure closure) {
return CompletableFuture.supplyAsync(() -> delete(closure), getExecutor());
} | java | public CompletableFuture<Object> deleteAsync(@DelegatesTo(HttpConfig.class) final Closure closure) {
return CompletableFuture.supplyAsync(() -> delete(closure), getExecutor());
} | [
"public",
"CompletableFuture",
"<",
"Object",
">",
"deleteAsync",
"(",
"@",
"DelegatesTo",
"(",
"HttpConfig",
".",
"class",
")",
"final",
"Closure",
"closure",
")",
"{",
"return",
"CompletableFuture",
".",
"supplyAsync",
"(",
"(",
")",
"->",
"delete",
"(",
"... | Executes an asynchronous DELETE request on the configured URI (an asynchronous alias to the `delete(Closure)` method), with additional configuration
provided by the configuration closure.
[source,groovy]
----
def http = HttpBuilder.configure {
request.uri = 'http://localhost:10101'
}
def result = http.deleteAsync(){
request.uri.path = '/something'
}
----
The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface.
@param closure the additional configuration closure (delegated to {@link HttpConfig})
@return the {@link CompletableFuture} containing the future result data | [
"Executes",
"an",
"asynchronous",
"DELETE",
"request",
"on",
"the",
"configured",
"URI",
"(",
"an",
"asynchronous",
"alias",
"to",
"the",
"delete",
"(",
"Closure",
")",
"method",
")",
"with",
"additional",
"configuration",
"provided",
"by",
"the",
"configuration... | train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L1193-L1195 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java | QrCodeUtil.generate | public static BufferedImage generate(String content, QrConfig config) {
return generate(content, BarcodeFormat.QR_CODE, config);
} | java | public static BufferedImage generate(String content, QrConfig config) {
return generate(content, BarcodeFormat.QR_CODE, config);
} | [
"public",
"static",
"BufferedImage",
"generate",
"(",
"String",
"content",
",",
"QrConfig",
"config",
")",
"{",
"return",
"generate",
"(",
"content",
",",
"BarcodeFormat",
".",
"QR_CODE",
",",
"config",
")",
";",
"}"
] | 生成二维码图片
@param content 文本内容
@param config 二维码配置,包括长、宽、边距、颜色等
@return 二维码图片(黑白)
@since 4.1.2 | [
"生成二维码图片"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L158-L160 |
Netflix/suro | suro-core/src/main/java/com/netflix/suro/SuroPlugin.java | SuroPlugin.addSinkType | public <T extends Sink> void addSinkType(String typeName, Class<T> sinkClass) {
LOG.info("Adding sinkType: " + typeName + " -> " + sinkClass.getCanonicalName());
Multibinder<TypeHolder> bindings
= Multibinder.newSetBinder(binder(), TypeHolder.class);
bindings.addBinding().toInstance(new TypeHolder(typeName, sinkClass));
} | java | public <T extends Sink> void addSinkType(String typeName, Class<T> sinkClass) {
LOG.info("Adding sinkType: " + typeName + " -> " + sinkClass.getCanonicalName());
Multibinder<TypeHolder> bindings
= Multibinder.newSetBinder(binder(), TypeHolder.class);
bindings.addBinding().toInstance(new TypeHolder(typeName, sinkClass));
} | [
"public",
"<",
"T",
"extends",
"Sink",
">",
"void",
"addSinkType",
"(",
"String",
"typeName",
",",
"Class",
"<",
"T",
">",
"sinkClass",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Adding sinkType: \"",
"+",
"typeName",
"+",
"\" -> \"",
"+",
"sinkClass",
".",
"... | Add a sink implementation to Suro. typeName is the expected value of the
'type' field of a JSON configuration.
@param typeName
@param sinkClass | [
"Add",
"a",
"sink",
"implementation",
"to",
"Suro",
".",
"typeName",
"is",
"the",
"expected",
"value",
"of",
"the",
"type",
"field",
"of",
"a",
"JSON",
"configuration",
"."
] | train | https://github.com/Netflix/suro/blob/e73d1a2e5b0492e41feb5a57d9e2a2e741a38453/suro-core/src/main/java/com/netflix/suro/SuroPlugin.java#L31-L37 |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/util/DateUtilities.java | DateUtilities.setCalendarData | public static void setCalendarData(Calendar calendar, Locale locale)
{
int[] array = (int[])localeData.get(locale);
if(array == null)
{
Calendar c = Calendar.getInstance(locale);
array = new int[2];
array[0] = c.getFirstDayOfWeek();
array[1] = c.getMinimalDaysInFirstWeek();
localeData.putIfAbsent(locale, array);
}
calendar.setFirstDayOfWeek(array[0]);
calendar.setMinimalDaysInFirstWeek(array[1]);
} | java | public static void setCalendarData(Calendar calendar, Locale locale)
{
int[] array = (int[])localeData.get(locale);
if(array == null)
{
Calendar c = Calendar.getInstance(locale);
array = new int[2];
array[0] = c.getFirstDayOfWeek();
array[1] = c.getMinimalDaysInFirstWeek();
localeData.putIfAbsent(locale, array);
}
calendar.setFirstDayOfWeek(array[0]);
calendar.setMinimalDaysInFirstWeek(array[1]);
} | [
"public",
"static",
"void",
"setCalendarData",
"(",
"Calendar",
"calendar",
",",
"Locale",
"locale",
")",
"{",
"int",
"[",
"]",
"array",
"=",
"(",
"int",
"[",
"]",
")",
"localeData",
".",
"get",
"(",
"locale",
")",
";",
"if",
"(",
"array",
"==",
"nul... | Set the attributes of the given calendar from the given locale.
@param calendar The calendar to set the date settings on
@param locale The locale to use for the date settings | [
"Set",
"the",
"attributes",
"of",
"the",
"given",
"calendar",
"from",
"the",
"given",
"locale",
"."
] | train | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/DateUtilities.java#L333-L346 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AlternativeAlignment.java | AlternativeAlignment.apairs_from_seed | public void apairs_from_seed(int l,int i, int j){
aligpath = new IndexPair[l];
idx1 = new int[l];
idx2 = new int[l];
for (int x = 0 ; x < l ; x++) {
idx1[x]=i+x;
idx2[x]=j+x;
aligpath[x] = new IndexPair((short)(i+x),(short)(j+x));
}
} | java | public void apairs_from_seed(int l,int i, int j){
aligpath = new IndexPair[l];
idx1 = new int[l];
idx2 = new int[l];
for (int x = 0 ; x < l ; x++) {
idx1[x]=i+x;
idx2[x]=j+x;
aligpath[x] = new IndexPair((short)(i+x),(short)(j+x));
}
} | [
"public",
"void",
"apairs_from_seed",
"(",
"int",
"l",
",",
"int",
"i",
",",
"int",
"j",
")",
"{",
"aligpath",
"=",
"new",
"IndexPair",
"[",
"l",
"]",
";",
"idx1",
"=",
"new",
"int",
"[",
"l",
"]",
";",
"idx2",
"=",
"new",
"int",
"[",
"l",
"]",... | Set apairs according to a seed position.
@param l
@param i
@param j | [
"Set",
"apairs",
"according",
"to",
"a",
"seed",
"position",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AlternativeAlignment.java#L242-L251 |
phax/ph-commons | ph-xml/src/main/java/com/helger/xml/serialize/write/XMLCharHelper.java | XMLCharHelper.isInvalidXMLAttributeValueChar | public static boolean isInvalidXMLAttributeValueChar (@Nonnull final EXMLSerializeVersion eXMLVersion, final int c)
{
switch (eXMLVersion)
{
case XML_10:
return INVALID_VALUE_CHAR_XML10.get (c);
case XML_11:
return INVALID_ATTR_VALUE_CHAR_XML11.get (c);
case HTML:
return INVALID_CHAR_HTML.get (c);
default:
throw new IllegalArgumentException ("Unsupported XML version " + eXMLVersion + "!");
}
} | java | public static boolean isInvalidXMLAttributeValueChar (@Nonnull final EXMLSerializeVersion eXMLVersion, final int c)
{
switch (eXMLVersion)
{
case XML_10:
return INVALID_VALUE_CHAR_XML10.get (c);
case XML_11:
return INVALID_ATTR_VALUE_CHAR_XML11.get (c);
case HTML:
return INVALID_CHAR_HTML.get (c);
default:
throw new IllegalArgumentException ("Unsupported XML version " + eXMLVersion + "!");
}
} | [
"public",
"static",
"boolean",
"isInvalidXMLAttributeValueChar",
"(",
"@",
"Nonnull",
"final",
"EXMLSerializeVersion",
"eXMLVersion",
",",
"final",
"int",
"c",
")",
"{",
"switch",
"(",
"eXMLVersion",
")",
"{",
"case",
"XML_10",
":",
"return",
"INVALID_VALUE_CHAR_XML... | Check if the passed character is invalid for a attribute value node.
@param eXMLVersion
XML version to be used. May not be <code>null</code>.
@param c
char to check
@return <code>true</code> if the char is invalid | [
"Check",
"if",
"the",
"passed",
"character",
"is",
"invalid",
"for",
"a",
"attribute",
"value",
"node",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLCharHelper.java#L956-L969 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/NNChain.java | NNChain.findUnlinked | public static int findUnlinked(int pos, int end, DBIDArrayIter ix, PointerHierarchyRepresentationBuilder builder) {
while(pos < end) {
if(!builder.isLinked(ix.seek(pos))) {
return pos;
}
++pos;
}
return -1;
} | java | public static int findUnlinked(int pos, int end, DBIDArrayIter ix, PointerHierarchyRepresentationBuilder builder) {
while(pos < end) {
if(!builder.isLinked(ix.seek(pos))) {
return pos;
}
++pos;
}
return -1;
} | [
"public",
"static",
"int",
"findUnlinked",
"(",
"int",
"pos",
",",
"int",
"end",
",",
"DBIDArrayIter",
"ix",
",",
"PointerHierarchyRepresentationBuilder",
"builder",
")",
"{",
"while",
"(",
"pos",
"<",
"end",
")",
"{",
"if",
"(",
"!",
"builder",
".",
"isLi... | Find an unlinked object.
@param pos Starting position
@param end End position
@param ix Iterator to translate into DBIDs
@param builder Linkage information
@return Position | [
"Find",
"an",
"unlinked",
"object",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/NNChain.java#L199-L207 |
couchbase/java-dcp-client | src/main/java/com/couchbase/client/dcp/util/PatchedNettySnappyDecoder.java | PatchedNettySnappyDecoder.decodeLiteral | static int decodeLiteral(byte tag, ByteBuf in, ByteBuf out) {
in.markReaderIndex();
int length;
switch (tag >> 2 & 0x3F) {
case 60:
if (!in.isReadable()) {
return NOT_ENOUGH_INPUT;
}
length = in.readUnsignedByte();
break;
case 61:
if (in.readableBytes() < 2) {
return NOT_ENOUGH_INPUT;
}
length = readSwappedUnsignedShort(in);
break;
case 62:
if (in.readableBytes() < 3) {
return NOT_ENOUGH_INPUT;
}
length = ByteBufUtil.swapMedium(in.readUnsignedMedium());
break;
case 63:
if (in.readableBytes() < 4) {
return NOT_ENOUGH_INPUT;
}
// This should arguably be an unsigned int, but we're unlikely to encounter literals longer than
// Integer.MAX_VALUE in the wild.
length = ByteBufUtil.swapInt(in.readInt());
break;
default:
length = tag >> 2 & 0x3F;
}
length += 1;
if (in.readableBytes() < length) {
in.resetReaderIndex();
return NOT_ENOUGH_INPUT;
}
out.writeBytes(in, length);
return length;
} | java | static int decodeLiteral(byte tag, ByteBuf in, ByteBuf out) {
in.markReaderIndex();
int length;
switch (tag >> 2 & 0x3F) {
case 60:
if (!in.isReadable()) {
return NOT_ENOUGH_INPUT;
}
length = in.readUnsignedByte();
break;
case 61:
if (in.readableBytes() < 2) {
return NOT_ENOUGH_INPUT;
}
length = readSwappedUnsignedShort(in);
break;
case 62:
if (in.readableBytes() < 3) {
return NOT_ENOUGH_INPUT;
}
length = ByteBufUtil.swapMedium(in.readUnsignedMedium());
break;
case 63:
if (in.readableBytes() < 4) {
return NOT_ENOUGH_INPUT;
}
// This should arguably be an unsigned int, but we're unlikely to encounter literals longer than
// Integer.MAX_VALUE in the wild.
length = ByteBufUtil.swapInt(in.readInt());
break;
default:
length = tag >> 2 & 0x3F;
}
length += 1;
if (in.readableBytes() < length) {
in.resetReaderIndex();
return NOT_ENOUGH_INPUT;
}
out.writeBytes(in, length);
return length;
} | [
"static",
"int",
"decodeLiteral",
"(",
"byte",
"tag",
",",
"ByteBuf",
"in",
",",
"ByteBuf",
"out",
")",
"{",
"in",
".",
"markReaderIndex",
"(",
")",
";",
"int",
"length",
";",
"switch",
"(",
"tag",
">>",
"2",
"&",
"0x3F",
")",
"{",
"case",
"60",
":... | Reads a literal from the input buffer directly to the output buffer.
A "literal" is an uncompressed segment of data stored directly in the
byte stream.
@param tag The tag that identified this segment as a literal is also
used to encode part of the length of the data
@param in The input buffer to read the literal from
@param out The output buffer to write the literal to
@return The number of bytes appended to the output buffer, or -1 to indicate "try again later" | [
"Reads",
"a",
"literal",
"from",
"the",
"input",
"buffer",
"directly",
"to",
"the",
"output",
"buffer",
".",
"A",
"literal",
"is",
"an",
"uncompressed",
"segment",
"of",
"data",
"stored",
"directly",
"in",
"the",
"byte",
"stream",
"."
] | train | https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/util/PatchedNettySnappyDecoder.java#L195-L237 |
googlemaps/google-maps-services-java | src/main/java/com/google/maps/PlacesApi.java | PlacesApi.placeDetails | public static PlaceDetailsRequest placeDetails(GeoApiContext context, String placeId) {
PlaceDetailsRequest request = new PlaceDetailsRequest(context);
request.placeId(placeId);
return request;
} | java | public static PlaceDetailsRequest placeDetails(GeoApiContext context, String placeId) {
PlaceDetailsRequest request = new PlaceDetailsRequest(context);
request.placeId(placeId);
return request;
} | [
"public",
"static",
"PlaceDetailsRequest",
"placeDetails",
"(",
"GeoApiContext",
"context",
",",
"String",
"placeId",
")",
"{",
"PlaceDetailsRequest",
"request",
"=",
"new",
"PlaceDetailsRequest",
"(",
"context",
")",
";",
"request",
".",
"placeId",
"(",
"placeId",
... | Requests the details of a Place.
<p>We are only enabling looking up Places by placeId as the older Place identifier, reference,
is deprecated. Please see the <a
href="https://web.archive.org/web/20170521070241/https://developers.google.com/places/web-service/details#deprecation">
deprecation warning</a>.
@param context The context on which to make Geo API requests.
@param placeId The PlaceID to request details on.
@return Returns a PlaceDetailsRequest that you can configure and execute. | [
"Requests",
"the",
"details",
"of",
"a",
"Place",
"."
] | train | https://github.com/googlemaps/google-maps-services-java/blob/23d20d1930f80e310d856d2da51d72ee0db4476b/src/main/java/com/google/maps/PlacesApi.java#L124-L128 |
Samsung/GearVRf | GVRf/Extensions/3DCursor/IODevices/gearwear/PhoneSide/gearwearlibrary/src/main/java/com/samsung/mpl/gearwearlibrary/EventManager.java | EventManager.registerReceiver | public static void registerReceiver(Context context, BroadcastReceiver receiver) {
context.registerReceiver(receiver, new IntentFilter(ACTION_ACCESSORY_EVENT));
} | java | public static void registerReceiver(Context context, BroadcastReceiver receiver) {
context.registerReceiver(receiver, new IntentFilter(ACTION_ACCESSORY_EVENT));
} | [
"public",
"static",
"void",
"registerReceiver",
"(",
"Context",
"context",
",",
"BroadcastReceiver",
"receiver",
")",
"{",
"context",
".",
"registerReceiver",
"(",
"receiver",
",",
"new",
"IntentFilter",
"(",
"ACTION_ACCESSORY_EVENT",
")",
")",
";",
"}"
] | Register a receiver so it can receive input events.
<p>
You <b>must unregister the receiver</b> once you are done receiving events, otherwise a
memory leak will occur. If you wish to register the same receiver multiple times, be sure
to unregister it first.
@param context context in which to register for events
@param receiver receiver to register for events | [
"Register",
"a",
"receiver",
"so",
"it",
"can",
"receive",
"input",
"events",
".",
"<p",
">",
"You",
"<b",
">",
"must",
"unregister",
"the",
"receiver<",
"/",
"b",
">",
"once",
"you",
"are",
"done",
"receiving",
"events",
"otherwise",
"a",
"memory",
"lea... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/IODevices/gearwear/PhoneSide/gearwearlibrary/src/main/java/com/samsung/mpl/gearwearlibrary/EventManager.java#L48-L50 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.notEmpty | public static Object[] notEmpty(Object[] array, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (ArrayUtil.isEmpty(array)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return array;
} | java | public static Object[] notEmpty(Object[] array, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (ArrayUtil.isEmpty(array)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return array;
} | [
"public",
"static",
"Object",
"[",
"]",
"notEmpty",
"(",
"Object",
"[",
"]",
"array",
",",
"String",
"errorMsgTemplate",
",",
"Object",
"...",
"params",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"ArrayUtil",
".",
"isEmpty",
"(",
"array",
")"... | 断言给定数组是否包含元素,数组必须不为 {@code null} 且至少包含一个元素
<pre class="code">
Assert.notEmpty(array, "The array must have elements");
</pre>
@param array 被检查的数组
@param errorMsgTemplate 异常时的消息模板
@param params 参数列表
@return 被检查的数组
@throws IllegalArgumentException if the object array is {@code null} or has no elements | [
"断言给定数组是否包含元素,数组必须不为",
"{",
"@code",
"null",
"}",
"且至少包含一个元素"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L278-L283 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java | GISTreeSetUtil.createNode | private static <P extends GISPrimitive, N extends AbstractGISTreeSetNode<P, N>>
N createNode(N parent, IcosepQuadTreeZone region, GISTreeSetNodeFactory<P, N> builder) {
Rectangle2d area = parent.getAreaBounds();
if (region == IcosepQuadTreeZone.ICOSEP) {
return builder.newNode(
IcosepQuadTreeZone.ICOSEP,
area.getMinX(),
area.getMinY(),
area.getWidth(),
area.getHeight());
}
if (parent.getZone() == IcosepQuadTreeZone.ICOSEP) {
area = computeIcosepSubarea(region, area);
return builder.newNode(
region,
area.getMinX(),
area.getMinY(),
area.getWidth(),
area.getHeight());
}
final Point2d childCutPlane = computeCutPoint(region, parent);
assert childCutPlane != null;
final double w = area.getWidth() / 4.;
final double h = area.getHeight() / 4.;
return builder.newNode(region,
childCutPlane.getX() - w, childCutPlane.getY() - h, 2. * w, 2. * h);
} | java | private static <P extends GISPrimitive, N extends AbstractGISTreeSetNode<P, N>>
N createNode(N parent, IcosepQuadTreeZone region, GISTreeSetNodeFactory<P, N> builder) {
Rectangle2d area = parent.getAreaBounds();
if (region == IcosepQuadTreeZone.ICOSEP) {
return builder.newNode(
IcosepQuadTreeZone.ICOSEP,
area.getMinX(),
area.getMinY(),
area.getWidth(),
area.getHeight());
}
if (parent.getZone() == IcosepQuadTreeZone.ICOSEP) {
area = computeIcosepSubarea(region, area);
return builder.newNode(
region,
area.getMinX(),
area.getMinY(),
area.getWidth(),
area.getHeight());
}
final Point2d childCutPlane = computeCutPoint(region, parent);
assert childCutPlane != null;
final double w = area.getWidth() / 4.;
final double h = area.getHeight() / 4.;
return builder.newNode(region,
childCutPlane.getX() - w, childCutPlane.getY() - h, 2. * w, 2. * h);
} | [
"private",
"static",
"<",
"P",
"extends",
"GISPrimitive",
",",
"N",
"extends",
"AbstractGISTreeSetNode",
"<",
"P",
",",
"N",
">",
">",
"N",
"createNode",
"(",
"N",
"parent",
",",
"IcosepQuadTreeZone",
"region",
",",
"GISTreeSetNodeFactory",
"<",
"P",
",",
"N... | Create a child node that supports the specified region.
@param <P> is the type of the primitives.
@param parent is the node in which the new node will be inserted.
@param region is the region that must be covered by the new node.
@param element is the element to initially put inside the node.
@param builder permits to create nodes.
@return a new node that is covering the given region. | [
"Create",
"a",
"child",
"node",
"that",
"supports",
"the",
"specified",
"region",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java#L435-L465 |
glyptodon/guacamole-client | extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java | ModeledUser.isActive | private boolean isActive(Calendar activeStart, Calendar inactiveStart) {
// If end occurs before start, convert to equivalent case where start
// start is before end
if (inactiveStart != null && activeStart != null && inactiveStart.before(activeStart))
return !isActive(inactiveStart, activeStart);
// Get current time
Calendar current = Calendar.getInstance();
// State is active iff the current time is between the start and end
return !(activeStart != null && current.before(activeStart))
&& !(inactiveStart != null && current.after(inactiveStart));
} | java | private boolean isActive(Calendar activeStart, Calendar inactiveStart) {
// If end occurs before start, convert to equivalent case where start
// start is before end
if (inactiveStart != null && activeStart != null && inactiveStart.before(activeStart))
return !isActive(inactiveStart, activeStart);
// Get current time
Calendar current = Calendar.getInstance();
// State is active iff the current time is between the start and end
return !(activeStart != null && current.before(activeStart))
&& !(inactiveStart != null && current.after(inactiveStart));
} | [
"private",
"boolean",
"isActive",
"(",
"Calendar",
"activeStart",
",",
"Calendar",
"inactiveStart",
")",
"{",
"// If end occurs before start, convert to equivalent case where start",
"// start is before end",
"if",
"(",
"inactiveStart",
"!=",
"null",
"&&",
"activeStart",
"!="... | Given a time when a particular state changes from inactive to active,
and a time when a particular state changes from active to inactive,
determines whether that state is currently active.
@param activeStart
The time at which the state changes from inactive to active.
@param inactiveStart
The time at which the state changes from active to inactive.
@return
true if the state is currently active, false otherwise. | [
"Given",
"a",
"time",
"when",
"a",
"particular",
"state",
"changes",
"from",
"inactive",
"to",
"active",
"and",
"a",
"time",
"when",
"a",
"particular",
"state",
"changes",
"from",
"active",
"to",
"inactive",
"determines",
"whether",
"that",
"state",
"is",
"c... | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java#L676-L690 |
xetorthio/jedis | src/main/java/redis/clients/jedis/BinaryJedis.java | BinaryJedis.zrem | @Override
public Long zrem(final byte[] key, final byte[]... members) {
checkIsInMultiOrPipeline();
client.zrem(key, members);
return client.getIntegerReply();
} | java | @Override
public Long zrem(final byte[] key, final byte[]... members) {
checkIsInMultiOrPipeline();
client.zrem(key, members);
return client.getIntegerReply();
} | [
"@",
"Override",
"public",
"Long",
"zrem",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"byte",
"[",
"]",
"...",
"members",
")",
"{",
"checkIsInMultiOrPipeline",
"(",
")",
";",
"client",
".",
"zrem",
"(",
"key",
",",
"members",
")",
";",
"ret... | Remove the specified member from the sorted set value stored at key. If member was not a member
of the set no operation is performed. If key does not not hold a set value an error is
returned.
<p>
Time complexity O(log(N)) with N being the number of elements in the sorted set
@param key
@param members
@return Integer reply, specifically: 1 if the new element was removed 0 if the new element was
not a member of the set | [
"Remove",
"the",
"specified",
"member",
"from",
"the",
"sorted",
"set",
"value",
"stored",
"at",
"key",
".",
"If",
"member",
"was",
"not",
"a",
"member",
"of",
"the",
"set",
"no",
"operation",
"is",
"performed",
".",
"If",
"key",
"does",
"not",
"not",
... | train | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L1705-L1710 |
mapsforge/mapsforge | mapsforge-map/src/main/java/org/mapsforge/map/util/LayerUtil.java | LayerUtil.getLowerRight | public static Tile getLowerRight(BoundingBox boundingBox, byte zoomLevel, int tileSize) {
int tileRight = MercatorProjection.longitudeToTileX(boundingBox.maxLongitude, zoomLevel);
int tileBottom = MercatorProjection.latitudeToTileY(boundingBox.minLatitude, zoomLevel);
return new Tile(tileRight, tileBottom, zoomLevel, tileSize);
} | java | public static Tile getLowerRight(BoundingBox boundingBox, byte zoomLevel, int tileSize) {
int tileRight = MercatorProjection.longitudeToTileX(boundingBox.maxLongitude, zoomLevel);
int tileBottom = MercatorProjection.latitudeToTileY(boundingBox.minLatitude, zoomLevel);
return new Tile(tileRight, tileBottom, zoomLevel, tileSize);
} | [
"public",
"static",
"Tile",
"getLowerRight",
"(",
"BoundingBox",
"boundingBox",
",",
"byte",
"zoomLevel",
",",
"int",
"tileSize",
")",
"{",
"int",
"tileRight",
"=",
"MercatorProjection",
".",
"longitudeToTileX",
"(",
"boundingBox",
".",
"maxLongitude",
",",
"zoomL... | Lower right tile for an area.
@param boundingBox the area boundingBox
@param zoomLevel the zoom level.
@param tileSize the tile size.
@return the tile at the lower right of the bbox. | [
"Lower",
"right",
"tile",
"for",
"an",
"area",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/util/LayerUtil.java#L78-L82 |
jfinal/jfinal | src/main/java/com/jfinal/plugin/redis/Cache.java | Cache.zrangeByScore | @SuppressWarnings("rawtypes")
public Set zrangeByScore(Object key, double min, double max) {
Jedis jedis = getJedis();
try {
Set<byte[]> data = jedis.zrangeByScore(keyToBytes(key), min, max);
Set<Object> result = new LinkedHashSet<Object>(); // 有序集合必须 LinkedHashSet
valueSetFromBytesSet(data, result);
return result;
}
finally {close(jedis);}
} | java | @SuppressWarnings("rawtypes")
public Set zrangeByScore(Object key, double min, double max) {
Jedis jedis = getJedis();
try {
Set<byte[]> data = jedis.zrangeByScore(keyToBytes(key), min, max);
Set<Object> result = new LinkedHashSet<Object>(); // 有序集合必须 LinkedHashSet
valueSetFromBytesSet(data, result);
return result;
}
finally {close(jedis);}
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"Set",
"zrangeByScore",
"(",
"Object",
"key",
",",
"double",
"min",
",",
"double",
"max",
")",
"{",
"Jedis",
"jedis",
"=",
"getJedis",
"(",
")",
";",
"try",
"{",
"Set",
"<",
"byte",
"[",
"]",... | 返回有序集 key 中,所有 score 值介于 min 和 max 之间(包括等于 min 或 max )的成员。
有序集成员按 score 值递增(从小到大)次序排列。 | [
"返回有序集",
"key",
"中,所有",
"score",
"值介于",
"min",
"和",
"max",
"之间",
"(",
"包括等于",
"min",
"或",
"max",
")",
"的成员。",
"有序集成员按",
"score",
"值递增",
"(",
"从小到大",
")",
"次序排列。"
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/redis/Cache.java#L1089-L1099 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/RepositoryFileApi.java | RepositoryFileApi.createFile | public RepositoryFile createFile(Object projectIdOrPath, RepositoryFile file, String branchName, String commitMessage) throws GitLabApiException {
Form formData = createForm(file, branchName, commitMessage);
Response response;
if (isApiVersion(ApiVersion.V3)) {
response = post(Response.Status.CREATED, formData,
"projects", getProjectIdOrPath(projectIdOrPath), "repository", "files");
} else {
response = post(Response.Status.CREATED, formData,
"projects", getProjectIdOrPath(projectIdOrPath), "repository", "files", urlEncode(file.getFilePath()));
}
return (response.readEntity(RepositoryFile.class));
} | java | public RepositoryFile createFile(Object projectIdOrPath, RepositoryFile file, String branchName, String commitMessage) throws GitLabApiException {
Form formData = createForm(file, branchName, commitMessage);
Response response;
if (isApiVersion(ApiVersion.V3)) {
response = post(Response.Status.CREATED, formData,
"projects", getProjectIdOrPath(projectIdOrPath), "repository", "files");
} else {
response = post(Response.Status.CREATED, formData,
"projects", getProjectIdOrPath(projectIdOrPath), "repository", "files", urlEncode(file.getFilePath()));
}
return (response.readEntity(RepositoryFile.class));
} | [
"public",
"RepositoryFile",
"createFile",
"(",
"Object",
"projectIdOrPath",
",",
"RepositoryFile",
"file",
",",
"String",
"branchName",
",",
"String",
"commitMessage",
")",
"throws",
"GitLabApiException",
"{",
"Form",
"formData",
"=",
"createForm",
"(",
"file",
",",... | Create new file in repository
<pre><code>GitLab Endpoint: POST /projects/:id/repository/files</code></pre>
file_path (required) - Full path to new file. Ex. lib/class.rb
branch_name (required) - The name of branch
encoding (optional) - 'text' or 'base64'. Text is default.
content (required) - File content
commit_message (required) - Commit message
@param projectIdOrPath the id, path of the project, or a Project instance holding the project ID or path
@param file a ReposityoryFile instance with info for the file to create
@param branchName the name of branch
@param commitMessage the commit message
@return a RepositoryFile instance with the created file info
@throws GitLabApiException if any exception occurs | [
"Create",
"new",
"file",
"in",
"repository"
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RepositoryFileApi.java#L206-L219 |
alkacon/opencms-core | src-modules/org/opencms/workplace/CmsReport.java | CmsReport.dialogButtonsContinue | public String dialogButtonsContinue(String okAttrs, String cancelAttrs, String detailsAttrs) {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(detailsAttrs)) {
detailsAttrs = "";
} else {
detailsAttrs += " ";
}
return dialogButtons(
new int[] {BUTTON_OK, BUTTON_CANCEL, BUTTON_DETAILS},
new String[] {okAttrs, cancelAttrs, detailsAttrs + "onclick=\"switchOutputFormat();\""});
} | java | public String dialogButtonsContinue(String okAttrs, String cancelAttrs, String detailsAttrs) {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(detailsAttrs)) {
detailsAttrs = "";
} else {
detailsAttrs += " ";
}
return dialogButtons(
new int[] {BUTTON_OK, BUTTON_CANCEL, BUTTON_DETAILS},
new String[] {okAttrs, cancelAttrs, detailsAttrs + "onclick=\"switchOutputFormat();\""});
} | [
"public",
"String",
"dialogButtonsContinue",
"(",
"String",
"okAttrs",
",",
"String",
"cancelAttrs",
",",
"String",
"detailsAttrs",
")",
"{",
"if",
"(",
"CmsStringUtil",
".",
"isEmptyOrWhitespaceOnly",
"(",
"detailsAttrs",
")",
")",
"{",
"detailsAttrs",
"=",
"\"\"... | Builds a button row with an "Ok", a "Cancel" and a "Details" button.<p>
This row is displayed when the first report is running.<p>
@param okAttrs optional attributes for the ok button
@param cancelAttrs optional attributes for the cancel button
@param detailsAttrs optional attributes for the details button
@return the button row | [
"Builds",
"a",
"button",
"row",
"with",
"an",
"Ok",
"a",
"Cancel",
"and",
"a",
"Details",
"button",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/CmsReport.java#L262-L272 |
alkacon/opencms-core | src/org/opencms/search/CmsSearchManager.java | CmsSearchManager.updateIndexOffline | protected void updateIndexOffline(I_CmsReport report, List<CmsPublishedResource> resourcesToIndex) {
CmsObject cms = m_adminCms;
try {
// copy the administration context for the indexing
cms = OpenCms.initCmsObject(m_adminCms);
// set site root and project for this index
cms.getRequestContext().setSiteRoot("/");
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
Iterator<I_CmsSearchIndex> j = m_offlineIndexes.iterator();
while (j.hasNext()) {
I_CmsSearchIndex index = j.next();
if (index.getSources() != null) {
try {
// switch to the index project
cms.getRequestContext().setCurrentProject(cms.readProject(index.getProject()));
updateIndexIncremental(cms, index, report, resourcesToIndex);
} catch (CmsException e) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_UPDATE_INDEX_FAILED_1, index.getName()), e);
}
}
}
} | java | protected void updateIndexOffline(I_CmsReport report, List<CmsPublishedResource> resourcesToIndex) {
CmsObject cms = m_adminCms;
try {
// copy the administration context for the indexing
cms = OpenCms.initCmsObject(m_adminCms);
// set site root and project for this index
cms.getRequestContext().setSiteRoot("/");
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
Iterator<I_CmsSearchIndex> j = m_offlineIndexes.iterator();
while (j.hasNext()) {
I_CmsSearchIndex index = j.next();
if (index.getSources() != null) {
try {
// switch to the index project
cms.getRequestContext().setCurrentProject(cms.readProject(index.getProject()));
updateIndexIncremental(cms, index, report, resourcesToIndex);
} catch (CmsException e) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_UPDATE_INDEX_FAILED_1, index.getName()), e);
}
}
}
} | [
"protected",
"void",
"updateIndexOffline",
"(",
"I_CmsReport",
"report",
",",
"List",
"<",
"CmsPublishedResource",
">",
"resourcesToIndex",
")",
"{",
"CmsObject",
"cms",
"=",
"m_adminCms",
";",
"try",
"{",
"// copy the administration context for the indexing",
"cms",
"=... | Updates the offline search indexes for the given list of resources.<p>
@param report the report to write the index information to
@param resourcesToIndex the list of {@link CmsPublishedResource} objects to index | [
"Updates",
"the",
"offline",
"search",
"indexes",
"for",
"the",
"given",
"list",
"of",
"resources",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchManager.java#L3070-L3095 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java | CmsDomUtil.showOverlay | public static void showOverlay(Element element, boolean show) {
if (show) {
element.removeClassName(I_CmsLayoutBundle.INSTANCE.generalCss().hideOverlay());
} else {
element.addClassName(I_CmsLayoutBundle.INSTANCE.generalCss().hideOverlay());
}
} | java | public static void showOverlay(Element element, boolean show) {
if (show) {
element.removeClassName(I_CmsLayoutBundle.INSTANCE.generalCss().hideOverlay());
} else {
element.addClassName(I_CmsLayoutBundle.INSTANCE.generalCss().hideOverlay());
}
} | [
"public",
"static",
"void",
"showOverlay",
"(",
"Element",
"element",
",",
"boolean",
"show",
")",
"{",
"if",
"(",
"show",
")",
"{",
"element",
".",
"removeClassName",
"(",
"I_CmsLayoutBundle",
".",
"INSTANCE",
".",
"generalCss",
"(",
")",
".",
"hideOverlay"... | Sets a CSS class to show or hide a given overlay. Will not add an overlay to the element.<p>
@param element the parent element of the overlay
@param show <code>true</code> to show the overlay | [
"Sets",
"a",
"CSS",
"class",
"to",
"show",
"or",
"hide",
"a",
"given",
"overlay",
".",
"Will",
"not",
"add",
"an",
"overlay",
"to",
"the",
"element",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java#L2056-L2063 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/util/xml/ObjectTreeParser.java | ObjectTreeParser.findField | private Field findField(Class clazz, String name) {
Field[] fields = clazz.getDeclaredFields();
for (int i=0;i<fields.length;i++) {
if (fields[i].getName().equalsIgnoreCase(name)) {
if (fields[i].getType().isPrimitive()) {
return fields[i];
}
if (fields[i].getType() == String.class) {
return fields[i];
}
}
}
return null;
} | java | private Field findField(Class clazz, String name) {
Field[] fields = clazz.getDeclaredFields();
for (int i=0;i<fields.length;i++) {
if (fields[i].getName().equalsIgnoreCase(name)) {
if (fields[i].getType().isPrimitive()) {
return fields[i];
}
if (fields[i].getType() == String.class) {
return fields[i];
}
}
}
return null;
} | [
"private",
"Field",
"findField",
"(",
"Class",
"clazz",
",",
"String",
"name",
")",
"{",
"Field",
"[",
"]",
"fields",
"=",
"clazz",
".",
"getDeclaredFields",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"fields",
".",
"length",
"... | Find a field in a class by it's name. Note that this method is
only needed because the general reflection method is case
sensitive
@param clazz The clazz to search
@param name The name of the field to search for
@return The field or null if none could be located | [
"Find",
"a",
"field",
"in",
"a",
"class",
"by",
"it",
"s",
"name",
".",
"Note",
"that",
"this",
"method",
"is",
"only",
"needed",
"because",
"the",
"general",
"reflection",
"method",
"is",
"case",
"sensitive"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/xml/ObjectTreeParser.java#L354-L368 |
derari/cthul | objects/src/main/java/org/cthul/objects/Boxing.java | Boxing.deepBoxAs | public static <T> T deepBoxAs(Object src, Class<T> type) {
return (T) deepBox(type, src);
} | java | public static <T> T deepBoxAs(Object src, Class<T> type) {
return (T) deepBox(type, src);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"deepBoxAs",
"(",
"Object",
"src",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"(",
"T",
")",
"deepBox",
"(",
"type",
",",
"src",
")",
";",
"}"
] | Returns any multidimensional array into an array of boxed values.
@param <T>
@param src source array
@param type target type
@return multidimensional array | [
"Returns",
"any",
"multidimensional",
"array",
"into",
"an",
"array",
"of",
"boxed",
"values",
"."
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/Boxing.java#L745-L747 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.addExceptionRange | private void addExceptionRange(ProjectCalendarException exception, Date start, Date finish)
{
if (start != null && finish != null)
{
exception.addRange(new DateRange(start, finish));
}
} | java | private void addExceptionRange(ProjectCalendarException exception, Date start, Date finish)
{
if (start != null && finish != null)
{
exception.addRange(new DateRange(start, finish));
}
} | [
"private",
"void",
"addExceptionRange",
"(",
"ProjectCalendarException",
"exception",
",",
"Date",
"start",
",",
"Date",
"finish",
")",
"{",
"if",
"(",
"start",
"!=",
"null",
"&&",
"finish",
"!=",
"null",
")",
"{",
"exception",
".",
"addRange",
"(",
"new",
... | Add a range to an exception, ensure that we don't try to add null ranges.
@param exception target exception
@param start exception start
@param finish exception finish | [
"Add",
"a",
"range",
"to",
"an",
"exception",
"ensure",
"that",
"we",
"don",
"t",
"try",
"to",
"add",
"null",
"ranges",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L702-L708 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WCheckBoxRenderer.java | WCheckBoxRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WCheckBox checkBox = (WCheckBox) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = checkBox.isReadOnly();
xml.appendTagOpen(TAG_NAME);
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", checkBox.isHidden(), "true");
xml.appendOptionalAttribute("selected", checkBox.isSelected(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true");
xml.appendEnd();
return;
}
WComponent submitControl = checkBox.getDefaultSubmitButton();
String submitControlId = submitControl == null ? null : submitControl.getId();
WComponentGroup<WCheckBox> group = checkBox.getGroup();
String groupName = group == null ? null : group.getId();
xml.appendOptionalAttribute("groupName", groupName);
xml.appendOptionalAttribute("disabled", checkBox.isDisabled(), "true");
xml.appendOptionalAttribute("required", checkBox.isMandatory(), "true");
xml.appendOptionalAttribute("submitOnChange", checkBox.isSubmitOnChange(), "true");
xml.appendOptionalAttribute("toolTip", checkBox.getToolTip());
xml.appendOptionalAttribute("accessibleText", checkBox.getAccessibleText());
xml.appendOptionalAttribute("buttonId", submitControlId);
List<Diagnostic> diags = checkBox.getDiagnostics(Diagnostic.ERROR);
if (diags == null || diags.isEmpty()) {
xml.appendEnd();
return;
}
xml.appendClose();
DiagnosticRenderUtil.renderDiagnostics(checkBox, renderContext);
xml.appendEndTag(TAG_NAME);
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WCheckBox checkBox = (WCheckBox) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = checkBox.isReadOnly();
xml.appendTagOpen(TAG_NAME);
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", checkBox.isHidden(), "true");
xml.appendOptionalAttribute("selected", checkBox.isSelected(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true");
xml.appendEnd();
return;
}
WComponent submitControl = checkBox.getDefaultSubmitButton();
String submitControlId = submitControl == null ? null : submitControl.getId();
WComponentGroup<WCheckBox> group = checkBox.getGroup();
String groupName = group == null ? null : group.getId();
xml.appendOptionalAttribute("groupName", groupName);
xml.appendOptionalAttribute("disabled", checkBox.isDisabled(), "true");
xml.appendOptionalAttribute("required", checkBox.isMandatory(), "true");
xml.appendOptionalAttribute("submitOnChange", checkBox.isSubmitOnChange(), "true");
xml.appendOptionalAttribute("toolTip", checkBox.getToolTip());
xml.appendOptionalAttribute("accessibleText", checkBox.getAccessibleText());
xml.appendOptionalAttribute("buttonId", submitControlId);
List<Diagnostic> diags = checkBox.getDiagnostics(Diagnostic.ERROR);
if (diags == null || diags.isEmpty()) {
xml.appendEnd();
return;
}
xml.appendClose();
DiagnosticRenderUtil.renderDiagnostics(checkBox, renderContext);
xml.appendEndTag(TAG_NAME);
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WCheckBox",
"checkBox",
"=",
"(",
"WCheckBox",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderCo... | Paints the given WCheckBox.
@param component the WCheckBox to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WCheckBox",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WCheckBoxRenderer.java#L30-L68 |
alkacon/opencms-core | src/org/opencms/search/galleries/CmsGallerySearch.java | CmsGallerySearch.searchById | public static CmsGallerySearchResult searchById(CmsObject cms, CmsUUID structureId, Locale locale)
throws CmsException {
CmsGallerySearch gallerySearch = new CmsGallerySearch();
gallerySearch.init(cms);
gallerySearch.setIndexForProject(cms);
return gallerySearch.searchById(structureId, locale);
} | java | public static CmsGallerySearchResult searchById(CmsObject cms, CmsUUID structureId, Locale locale)
throws CmsException {
CmsGallerySearch gallerySearch = new CmsGallerySearch();
gallerySearch.init(cms);
gallerySearch.setIndexForProject(cms);
return gallerySearch.searchById(structureId, locale);
} | [
"public",
"static",
"CmsGallerySearchResult",
"searchById",
"(",
"CmsObject",
"cms",
",",
"CmsUUID",
"structureId",
",",
"Locale",
"locale",
")",
"throws",
"CmsException",
"{",
"CmsGallerySearch",
"gallerySearch",
"=",
"new",
"CmsGallerySearch",
"(",
")",
";",
"gall... | Searches by structure id.<p>
@param cms the OpenCms context to use for the search
@param structureId the structure id of the document to search for
@param locale the locale for which the search result should be returned
@return the search result
@throws CmsException if something goes wrong | [
"Searches",
"by",
"structure",
"id",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/galleries/CmsGallerySearch.java#L72-L79 |
aws/aws-sdk-java | aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/CampaignResponse.java | CampaignResponse.withTags | public CampaignResponse withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public CampaignResponse withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"CampaignResponse",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | The Tags for the campaign.
@param tags
The Tags for the campaign.
@return Returns a reference to this object so that method calls can be chained together. | [
"The",
"Tags",
"for",
"the",
"campaign",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/CampaignResponse.java#L780-L783 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java | Configuration.getResource | public Content getResource(String key, Object o1, Object o2) {
return getResource(key, o1, o2, null);
} | java | public Content getResource(String key, Object o1, Object o2) {
return getResource(key, o1, o2, null);
} | [
"public",
"Content",
"getResource",
"(",
"String",
"key",
",",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"return",
"getResource",
"(",
"key",
",",
"o1",
",",
"o2",
",",
"null",
")",
";",
"}"
] | Get the configuration string as a content.
@param key the key to look for in the configuration file
@param o string or content argument added to configuration text
@return a content tree for the text | [
"Get",
"the",
"configuration",
"string",
"as",
"a",
"content",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java#L789-L791 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java | MemberSummaryBuilder.buildMethodsSummary | public void buildMethodsSummary(XMLNode node, Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters[VisibleMemberMap.METHODS];
VisibleMemberMap visibleMemberMap =
visibleMemberMaps[VisibleMemberMap.METHODS];
addSummary(writer, visibleMemberMap, true, memberSummaryTree);
} | java | public void buildMethodsSummary(XMLNode node, Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters[VisibleMemberMap.METHODS];
VisibleMemberMap visibleMemberMap =
visibleMemberMaps[VisibleMemberMap.METHODS];
addSummary(writer, visibleMemberMap, true, memberSummaryTree);
} | [
"public",
"void",
"buildMethodsSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"memberSummaryTree",
")",
"{",
"MemberSummaryWriter",
"writer",
"=",
"memberSummaryWriters",
"[",
"VisibleMemberMap",
".",
"METHODS",
"]",
";",
"VisibleMemberMap",
"visibleMemberMap",
"=",
... | Build the method summary.
@param node the XML element that specifies which components to document
@param memberSummaryTree the content tree to which the documentation will be added | [
"Build",
"the",
"method",
"summary",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java#L303-L309 |
michael-rapp/AndroidMaterialPreferences | library/src/main/java/de/mrapp/android/preference/view/SeekBar.java | SeekBar.setSeekBarColor | public final void setSeekBarColor(@ColorInt final int color) {
this.seekBarColor = color;
ColorFilter colorFilter = new PorterDuffColorFilter(color, Mode.SRC_IN);
getProgressDrawable().setColorFilter(colorFilter);
getThumbDrawable().setColorFilter(colorFilter);
} | java | public final void setSeekBarColor(@ColorInt final int color) {
this.seekBarColor = color;
ColorFilter colorFilter = new PorterDuffColorFilter(color, Mode.SRC_IN);
getProgressDrawable().setColorFilter(colorFilter);
getThumbDrawable().setColorFilter(colorFilter);
} | [
"public",
"final",
"void",
"setSeekBarColor",
"(",
"@",
"ColorInt",
"final",
"int",
"color",
")",
"{",
"this",
".",
"seekBarColor",
"=",
"color",
";",
"ColorFilter",
"colorFilter",
"=",
"new",
"PorterDuffColorFilter",
"(",
"color",
",",
"Mode",
".",
"SRC_IN",
... | Sets the color of the seek bar.
@param color
The color, which should be set as an {@link Integer} value | [
"Sets",
"the",
"color",
"of",
"the",
"seek",
"bar",
"."
] | train | https://github.com/michael-rapp/AndroidMaterialPreferences/blob/73a7e449458313bd041fc8d6038e290506b68eb1/library/src/main/java/de/mrapp/android/preference/view/SeekBar.java#L123-L128 |
atomix/catalyst | common/src/main/java/io/atomix/catalyst/util/PropertiesReader.java | PropertiesReader.loadProperties | private static Properties loadProperties(String propertiesFile) {
Properties properties = new Properties();
try (InputStream is = new FileInputStream(propertiesFile)) {
properties.load(is);
} catch (IOException e) {
throw new RuntimeException("failed to load properties", e);
}
return properties;
} | java | private static Properties loadProperties(String propertiesFile) {
Properties properties = new Properties();
try (InputStream is = new FileInputStream(propertiesFile)) {
properties.load(is);
} catch (IOException e) {
throw new RuntimeException("failed to load properties", e);
}
return properties;
} | [
"private",
"static",
"Properties",
"loadProperties",
"(",
"String",
"propertiesFile",
")",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"try",
"(",
"InputStream",
"is",
"=",
"new",
"FileInputStream",
"(",
"propertiesFile",
")",
")",
... | Loads properties from a properties file on the local filesystem. | [
"Loads",
"properties",
"from",
"a",
"properties",
"file",
"on",
"the",
"local",
"filesystem",
"."
] | train | https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/common/src/main/java/io/atomix/catalyst/util/PropertiesReader.java#L60-L68 |
ocelotds/ocelot | ocelot-processor/src/main/java/org/ocelotds/processors/OcelotProcessor.java | OcelotProcessor.writeCoreInDirectory | void writeCoreInDirectory(String dir, String fwk) {
if (dir != null) { // if developper specify a directory for get js we write them too inside jsdir
fws.copyResourceToDir(ProcessorConstants.SEPARATORCHAR + "js", getFilename("core", fwk), dir);
}
} | java | void writeCoreInDirectory(String dir, String fwk) {
if (dir != null) { // if developper specify a directory for get js we write them too inside jsdir
fws.copyResourceToDir(ProcessorConstants.SEPARATORCHAR + "js", getFilename("core", fwk), dir);
}
} | [
"void",
"writeCoreInDirectory",
"(",
"String",
"dir",
",",
"String",
"fwk",
")",
"{",
"if",
"(",
"dir",
"!=",
"null",
")",
"{",
"// if developper specify a directory for get js we write them too inside jsdir \r",
"fws",
".",
"copyResourceToDir",
"(",
"ProcessorConstants",... | Write core in user directory (use jsdir option) select the core for framework define by the user by jsfwk option | [
"Write",
"core",
"in",
"user",
"directory",
"(",
"use",
"jsdir",
"option",
")",
"select",
"the",
"core",
"for",
"framework",
"define",
"by",
"the",
"user",
"by",
"jsfwk",
"option"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/OcelotProcessor.java#L275-L279 |
elki-project/elki | elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/minkowski/LPIntegerNormDistanceFunction.java | LPIntegerNormDistanceFunction.preDistanceMBR | private double preDistanceMBR(SpatialComparable mbr1, SpatialComparable mbr2, final int start, final int end) {
double agg = 0.;
for(int d = start; d < end; d++) {
double delta = mbr2.getMin(d) - mbr1.getMax(d);
delta = delta >= 0 ? delta : mbr1.getMin(d) - mbr2.getMax(d);
if(delta > 0.) {
agg += MathUtil.powi(delta, intp);
}
}
return agg;
} | java | private double preDistanceMBR(SpatialComparable mbr1, SpatialComparable mbr2, final int start, final int end) {
double agg = 0.;
for(int d = start; d < end; d++) {
double delta = mbr2.getMin(d) - mbr1.getMax(d);
delta = delta >= 0 ? delta : mbr1.getMin(d) - mbr2.getMax(d);
if(delta > 0.) {
agg += MathUtil.powi(delta, intp);
}
}
return agg;
} | [
"private",
"double",
"preDistanceMBR",
"(",
"SpatialComparable",
"mbr1",
",",
"SpatialComparable",
"mbr2",
",",
"final",
"int",
"start",
",",
"final",
"int",
"end",
")",
"{",
"double",
"agg",
"=",
"0.",
";",
"for",
"(",
"int",
"d",
"=",
"start",
";",
"d"... | Compute unscaled distance in a range of dimensions.
@param mbr1 First MBR
@param mbr2 Second MBR
@param start First dimension
@param end Exclusive last dimension
@return Aggregated values. | [
"Compute",
"unscaled",
"distance",
"in",
"a",
"range",
"of",
"dimensions",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/minkowski/LPIntegerNormDistanceFunction.java#L115-L125 |
jamesagnew/hapi-fhir | hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/Meta.java | Meta.getTag | public Coding getTag(String theSystem, String theCode) {
for (Coding next : getTag()) {
if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) {
return next;
}
}
return null;
} | java | public Coding getTag(String theSystem, String theCode) {
for (Coding next : getTag()) {
if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) {
return next;
}
}
return null;
} | [
"public",
"Coding",
"getTag",
"(",
"String",
"theSystem",
",",
"String",
"theCode",
")",
"{",
"for",
"(",
"Coding",
"next",
":",
"getTag",
"(",
")",
")",
"{",
"if",
"(",
"ca",
".",
"uhn",
".",
"fhir",
".",
"util",
".",
"ObjectUtil",
".",
"equals",
... | Returns the first tag (if any) that has the given system and code, or returns
<code>null</code> if none | [
"Returns",
"the",
"first",
"tag",
"(",
"if",
"any",
")",
"that",
"has",
"the",
"given",
"system",
"and",
"code",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"none"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/Meta.java#L433-L440 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/validate/Schema.java | Schema.validateAndThrowException | public void validateAndThrowException(String correlationId, Object value, boolean strict)
throws ValidationException {
List<ValidationResult> results = validate(value);
ValidationException.throwExceptionIfNeeded(correlationId, results, strict);
} | java | public void validateAndThrowException(String correlationId, Object value, boolean strict)
throws ValidationException {
List<ValidationResult> results = validate(value);
ValidationException.throwExceptionIfNeeded(correlationId, results, strict);
} | [
"public",
"void",
"validateAndThrowException",
"(",
"String",
"correlationId",
",",
"Object",
"value",
",",
"boolean",
"strict",
")",
"throws",
"ValidationException",
"{",
"List",
"<",
"ValidationResult",
">",
"results",
"=",
"validate",
"(",
"value",
")",
";",
... | Validates the given value and returns a ValidationException if errors were
found.
@param correlationId (optional) transaction id to trace execution through
call chain.
@param value a value to be validated.
@param strict true to treat warnings as errors.
@throws ValidationException when errors occured in validation | [
"Validates",
"the",
"given",
"value",
"and",
"returns",
"a",
"ValidationException",
"if",
"errors",
"were",
"found",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/validate/Schema.java#L215-L219 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/core/ServerParams.java | ServerParams.getModuleParamBoolean | public boolean getModuleParamBoolean(String moduleName, String paramName) {
Map<String, Object> moduleParams = getModuleParams(moduleName);
if (moduleParams == null || !moduleParams.containsKey(paramName)) {
return false;
}
Object value = moduleParams.get(paramName);
try {
return Boolean.parseBoolean(value.toString());
} catch (Exception e) {
throw new RuntimeException("Configuration parameter '" + moduleName + "." +
paramName + "' must be a Boolean: " + value);
}
} | java | public boolean getModuleParamBoolean(String moduleName, String paramName) {
Map<String, Object> moduleParams = getModuleParams(moduleName);
if (moduleParams == null || !moduleParams.containsKey(paramName)) {
return false;
}
Object value = moduleParams.get(paramName);
try {
return Boolean.parseBoolean(value.toString());
} catch (Exception e) {
throw new RuntimeException("Configuration parameter '" + moduleName + "." +
paramName + "' must be a Boolean: " + value);
}
} | [
"public",
"boolean",
"getModuleParamBoolean",
"(",
"String",
"moduleName",
",",
"String",
"paramName",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"moduleParams",
"=",
"getModuleParams",
"(",
"moduleName",
")",
";",
"if",
"(",
"moduleParams",
"==",
"nu... | Get the boolean value of the given parameter name belonging to the given module
name. If no such module/parameter name is known, false is returned. If the given
value is not a String, a RuntimeException is thrown. Boolean.parseBoolean() is
used to parse the value, which will return false if the String value is anything
other than "true" (case-insensitive).
@param moduleName Name of module to get parameter for.
@param paramName Name of parameter to get value of.
@return True if the module and parameter exist with the value "true"
(case-insensitive), otherwise false. | [
"Get",
"the",
"boolean",
"value",
"of",
"the",
"given",
"parameter",
"name",
"belonging",
"to",
"the",
"given",
"module",
"name",
".",
"If",
"no",
"such",
"module",
"/",
"parameter",
"name",
"is",
"known",
"false",
"is",
"returned",
".",
"If",
"the",
"gi... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/core/ServerParams.java#L359-L371 |
alipay/sofa-rpc | extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/client/aft/ProviderInfoWeightManager.java | ProviderInfoWeightManager.recoverWeight | public static boolean recoverWeight(ProviderInfo providerInfo, int weight) {
providerInfo.setStatus(ProviderStatus.RECOVERING);
providerInfo.setWeight(weight);
return true;
} | java | public static boolean recoverWeight(ProviderInfo providerInfo, int weight) {
providerInfo.setStatus(ProviderStatus.RECOVERING);
providerInfo.setWeight(weight);
return true;
} | [
"public",
"static",
"boolean",
"recoverWeight",
"(",
"ProviderInfo",
"providerInfo",
",",
"int",
"weight",
")",
"{",
"providerInfo",
".",
"setStatus",
"(",
"ProviderStatus",
".",
"RECOVERING",
")",
";",
"providerInfo",
".",
"setWeight",
"(",
"weight",
")",
";",
... | Recover weight of provider info
@param providerInfo ProviderInfo
@param weight recovered weight
@return is recover success | [
"Recover",
"weight",
"of",
"provider",
"info"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/client/aft/ProviderInfoWeightManager.java#L36-L40 |
headius/invokebinder | src/main/java/com/headius/invokebinder/Binder.java | Binder.getStatic | public MethodHandle getStatic(MethodHandles.Lookup lookup, Class<?> target, String name) throws NoSuchFieldException, IllegalAccessException {
return invoke(lookup.findStaticGetter(target, name, type().returnType()));
} | java | public MethodHandle getStatic(MethodHandles.Lookup lookup, Class<?> target, String name) throws NoSuchFieldException, IllegalAccessException {
return invoke(lookup.findStaticGetter(target, name, type().returnType()));
} | [
"public",
"MethodHandle",
"getStatic",
"(",
"MethodHandles",
".",
"Lookup",
"lookup",
",",
"Class",
"<",
"?",
">",
"target",
",",
"String",
"name",
")",
"throws",
"NoSuchFieldException",
",",
"IllegalAccessException",
"{",
"return",
"invoke",
"(",
"lookup",
".",... | Apply the chain of transforms and bind them to a static field retrieval specified
using the end signature plus the given class and name. The field must
match the end signature's return value and the end signature must take
no arguments.
If the final handle's type does not exactly match the initial type for
this Binder, an additional cast will be attempted.
@param lookup the MethodHandles.Lookup to use to look up the field
@param target the class in which the field is defined
@param name the field's name
@return the full handle chain, bound to the given field access
@throws java.lang.NoSuchFieldException if the field does not exist
@throws java.lang.IllegalAccessException if the field is not accessible or cannot be modified | [
"Apply",
"the",
"chain",
"of",
"transforms",
"and",
"bind",
"them",
"to",
"a",
"static",
"field",
"retrieval",
"specified",
"using",
"the",
"end",
"signature",
"plus",
"the",
"given",
"class",
"and",
"name",
".",
"The",
"field",
"must",
"match",
"the",
"en... | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L1431-L1433 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelReader.java | ExcelReader.read | public <T> List<T> read(int headerRowIndex, int startRowIndex, Class<T> beanType) {
return read(headerRowIndex, startRowIndex, Integer.MAX_VALUE, beanType);
} | java | public <T> List<T> read(int headerRowIndex, int startRowIndex, Class<T> beanType) {
return read(headerRowIndex, startRowIndex, Integer.MAX_VALUE, beanType);
} | [
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"read",
"(",
"int",
"headerRowIndex",
",",
"int",
"startRowIndex",
",",
"Class",
"<",
"T",
">",
"beanType",
")",
"{",
"return",
"read",
"(",
"headerRowIndex",
",",
"startRowIndex",
",",
"Integer",
".",
"M... | 读取Excel为Bean的列表
@param <T> Bean类型
@param headerRowIndex 标题所在行,如果标题行在读取的内容行中间,这行做为数据将忽略,,从0开始计数
@param startRowIndex 起始行(包含,从0开始计数)
@param beanType 每行对应Bean的类型
@return Map的列表
@since 4.0.1 | [
"读取Excel为Bean的列表"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelReader.java#L334-L336 |
dita-ot/dita-ot | src/main/java/org/dita/dost/writer/AbstractChunkTopicParser.java | AbstractChunkTopicParser.writeStartElement | void writeStartElement(final Writer output, final String name, final Attributes atts) throws SAXException {
try {
output.write(LESS_THAN);
output.write(name);
for (int i = 0; i < atts.getLength(); i++) {
output.write(STRING_BLANK);
output.write(atts.getQName(i));
output.write(EQUAL);
output.write(QUOTATION);
output.write(escapeXML(atts.getValue(i)));
output.write(QUOTATION);
}
output.write(GREATER_THAN);
} catch (IOException e) {
throw new SAXException(e);
}
} | java | void writeStartElement(final Writer output, final String name, final Attributes atts) throws SAXException {
try {
output.write(LESS_THAN);
output.write(name);
for (int i = 0; i < atts.getLength(); i++) {
output.write(STRING_BLANK);
output.write(atts.getQName(i));
output.write(EQUAL);
output.write(QUOTATION);
output.write(escapeXML(atts.getValue(i)));
output.write(QUOTATION);
}
output.write(GREATER_THAN);
} catch (IOException e) {
throw new SAXException(e);
}
} | [
"void",
"writeStartElement",
"(",
"final",
"Writer",
"output",
",",
"final",
"String",
"name",
",",
"final",
"Attributes",
"atts",
")",
"throws",
"SAXException",
"{",
"try",
"{",
"output",
".",
"write",
"(",
"LESS_THAN",
")",
";",
"output",
".",
"write",
"... | Convenience method to write an end element.
@param name element name | [
"Convenience",
"method",
"to",
"write",
"an",
"end",
"element",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/writer/AbstractChunkTopicParser.java#L456-L472 |
alkacon/opencms-core | src/org/opencms/ui/components/CmsToolBar.java | CmsToolBar.createDropDown | public static Component createDropDown(String buttonHtml, Component content, String title) {
PopupView pv = new PopupView(buttonHtml, content);
pv.setDescription(title);
pv.addStyleName(OpenCmsTheme.NAVIGATOR_DROPDOWN);
pv.setHideOnMouseOut(false);
return pv;
} | java | public static Component createDropDown(String buttonHtml, Component content, String title) {
PopupView pv = new PopupView(buttonHtml, content);
pv.setDescription(title);
pv.addStyleName(OpenCmsTheme.NAVIGATOR_DROPDOWN);
pv.setHideOnMouseOut(false);
return pv;
} | [
"public",
"static",
"Component",
"createDropDown",
"(",
"String",
"buttonHtml",
",",
"Component",
"content",
",",
"String",
"title",
")",
"{",
"PopupView",
"pv",
"=",
"new",
"PopupView",
"(",
"buttonHtml",
",",
"content",
")",
";",
"pv",
".",
"setDescription",... | Creates a drop down menu.<p>
@param buttonHtml the button HTML
@param content the drop down content
@param title the button title
@return the component | [
"Creates",
"a",
"drop",
"down",
"menu",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsToolBar.java#L280-L287 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java | JobsImpl.getAllLifetimeStatisticsAsync | public Observable<JobStatistics> getAllLifetimeStatisticsAsync(JobGetAllLifetimeStatisticsOptions jobGetAllLifetimeStatisticsOptions) {
return getAllLifetimeStatisticsWithServiceResponseAsync(jobGetAllLifetimeStatisticsOptions).map(new Func1<ServiceResponseWithHeaders<JobStatistics, JobGetAllLifetimeStatisticsHeaders>, JobStatistics>() {
@Override
public JobStatistics call(ServiceResponseWithHeaders<JobStatistics, JobGetAllLifetimeStatisticsHeaders> response) {
return response.body();
}
});
} | java | public Observable<JobStatistics> getAllLifetimeStatisticsAsync(JobGetAllLifetimeStatisticsOptions jobGetAllLifetimeStatisticsOptions) {
return getAllLifetimeStatisticsWithServiceResponseAsync(jobGetAllLifetimeStatisticsOptions).map(new Func1<ServiceResponseWithHeaders<JobStatistics, JobGetAllLifetimeStatisticsHeaders>, JobStatistics>() {
@Override
public JobStatistics call(ServiceResponseWithHeaders<JobStatistics, JobGetAllLifetimeStatisticsHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"JobStatistics",
">",
"getAllLifetimeStatisticsAsync",
"(",
"JobGetAllLifetimeStatisticsOptions",
"jobGetAllLifetimeStatisticsOptions",
")",
"{",
"return",
"getAllLifetimeStatisticsWithServiceResponseAsync",
"(",
"jobGetAllLifetimeStatisticsOptions",
")",
... | Gets lifetime summary statistics for all of the jobs in the specified account.
Statistics are aggregated across all jobs that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes.
@param jobGetAllLifetimeStatisticsOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the JobStatistics object | [
"Gets",
"lifetime",
"summary",
"statistics",
"for",
"all",
"of",
"the",
"jobs",
"in",
"the",
"specified",
"account",
".",
"Statistics",
"are",
"aggregated",
"across",
"all",
"jobs",
"that",
"have",
"ever",
"existed",
"in",
"the",
"account",
"from",
"account",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L287-L294 |
algolia/instantsearch-android | core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java | Searcher.getNumericRefinement | @SuppressWarnings({"WeakerAccess", "unused"}) // For library users
@Nullable
public NumericRefinement getNumericRefinement(@NonNull String attribute, int operator) {
NumericRefinement.checkOperatorIsValid(operator);
final SparseArray<NumericRefinement> attributeRefinements = numericRefinements.get(attribute);
return attributeRefinements == null ? null : attributeRefinements.get(operator);
} | java | @SuppressWarnings({"WeakerAccess", "unused"}) // For library users
@Nullable
public NumericRefinement getNumericRefinement(@NonNull String attribute, int operator) {
NumericRefinement.checkOperatorIsValid(operator);
final SparseArray<NumericRefinement> attributeRefinements = numericRefinements.get(attribute);
return attributeRefinements == null ? null : attributeRefinements.get(operator);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"WeakerAccess\"",
",",
"\"unused\"",
"}",
")",
"// For library users",
"@",
"Nullable",
"public",
"NumericRefinement",
"getNumericRefinement",
"(",
"@",
"NonNull",
"String",
"attribute",
",",
"int",
"operator",
")",
"{",
"Numeric... | Gets the current numeric refinement for an attribute and an operator.
@param attribute the attribute to refine on.
@param operator one of the {@link NumericRefinement#OPERATOR_EQ operators} defined in {@link NumericRefinement}.
@return a {@link NumericRefinement} describing the current refinement for these parameters, or {@code null} if there is none. | [
"Gets",
"the",
"current",
"numeric",
"refinement",
"for",
"an",
"attribute",
"and",
"an",
"operator",
"."
] | train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java#L685-L691 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Parallelogram2dfx.java | Parallelogram2dfx.secondAxisProperty | public UnitVectorProperty secondAxisProperty() {
if (this.saxis == null) {
this.saxis = new UnitVectorProperty(this, MathFXAttributeNames.SECOND_AXIS, getGeomFactory());
}
return this.saxis;
} | java | public UnitVectorProperty secondAxisProperty() {
if (this.saxis == null) {
this.saxis = new UnitVectorProperty(this, MathFXAttributeNames.SECOND_AXIS, getGeomFactory());
}
return this.saxis;
} | [
"public",
"UnitVectorProperty",
"secondAxisProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"saxis",
"==",
"null",
")",
"{",
"this",
".",
"saxis",
"=",
"new",
"UnitVectorProperty",
"(",
"this",
",",
"MathFXAttributeNames",
".",
"SECOND_AXIS",
",",
"getGeomFac... | Replies the property for the second axis.
@return the property. | [
"Replies",
"the",
"property",
"for",
"the",
"second",
"axis",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Parallelogram2dfx.java#L280-L285 |
alibaba/canal | client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaOffsetCanalConnector.java | KafkaOffsetCanalConnector.getListWithoutAck | public List<KafkaMessage> getListWithoutAck(Long timeout, TimeUnit unit, long offset) throws CanalClientException {
waitClientRunning();
if (!running) {
return Lists.newArrayList();
}
if (offset > -1) {
TopicPartition tp = new TopicPartition(topic, partition == null ? 0 : partition);
kafkaConsumer.seek(tp, offset);
}
ConsumerRecords<String, Message> records = kafkaConsumer.poll(unit.toMillis(timeout));
if (!records.isEmpty()) {
List<KafkaMessage> messages = new ArrayList<>();
for (ConsumerRecord<String, Message> record : records) {
KafkaMessage message = new KafkaMessage(record.value(), record.offset());
messages.add(message);
}
return messages;
}
return Lists.newArrayList();
} | java | public List<KafkaMessage> getListWithoutAck(Long timeout, TimeUnit unit, long offset) throws CanalClientException {
waitClientRunning();
if (!running) {
return Lists.newArrayList();
}
if (offset > -1) {
TopicPartition tp = new TopicPartition(topic, partition == null ? 0 : partition);
kafkaConsumer.seek(tp, offset);
}
ConsumerRecords<String, Message> records = kafkaConsumer.poll(unit.toMillis(timeout));
if (!records.isEmpty()) {
List<KafkaMessage> messages = new ArrayList<>();
for (ConsumerRecord<String, Message> record : records) {
KafkaMessage message = new KafkaMessage(record.value(), record.offset());
messages.add(message);
}
return messages;
}
return Lists.newArrayList();
} | [
"public",
"List",
"<",
"KafkaMessage",
">",
"getListWithoutAck",
"(",
"Long",
"timeout",
",",
"TimeUnit",
"unit",
",",
"long",
"offset",
")",
"throws",
"CanalClientException",
"{",
"waitClientRunning",
"(",
")",
";",
"if",
"(",
"!",
"running",
")",
"{",
"ret... | 获取Kafka消息,不确认
@param timeout
@param unit
@param offset 消息偏移地址(-1为不偏移)
@return
@throws CanalClientException | [
"获取Kafka消息,不确认"
] | train | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaOffsetCanalConnector.java#L43-L65 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/modules/v/smoothing/OmsLineSmootherMcMaster.java | OmsLineSmootherMcMaster.defaultSmoothShapefile | public static void defaultSmoothShapefile( String shapePath, String outPath ) throws Exception {
PrintStreamProgressMonitor pm = new PrintStreamProgressMonitor(System.out, System.err);
SimpleFeatureCollection initialFC = OmsShapefileFeatureReader.readShapefile(shapePath);
OmsLineSmootherMcMaster smoother = new OmsLineSmootherMcMaster();
smoother.pm = pm;
smoother.pLimit = 10;
smoother.inVector = initialFC;
smoother.pLookahead = 13;
// smoother.pSlide = 1;
smoother.pDensify = 0.2;
smoother.pSimplify = 0.01;
smoother.process();
SimpleFeatureCollection smoothedFeatures = smoother.outVector;
OmsShapefileFeatureWriter.writeShapefile(outPath, smoothedFeatures, pm);
} | java | public static void defaultSmoothShapefile( String shapePath, String outPath ) throws Exception {
PrintStreamProgressMonitor pm = new PrintStreamProgressMonitor(System.out, System.err);
SimpleFeatureCollection initialFC = OmsShapefileFeatureReader.readShapefile(shapePath);
OmsLineSmootherMcMaster smoother = new OmsLineSmootherMcMaster();
smoother.pm = pm;
smoother.pLimit = 10;
smoother.inVector = initialFC;
smoother.pLookahead = 13;
// smoother.pSlide = 1;
smoother.pDensify = 0.2;
smoother.pSimplify = 0.01;
smoother.process();
SimpleFeatureCollection smoothedFeatures = smoother.outVector;
OmsShapefileFeatureWriter.writeShapefile(outPath, smoothedFeatures, pm);
} | [
"public",
"static",
"void",
"defaultSmoothShapefile",
"(",
"String",
"shapePath",
",",
"String",
"outPath",
")",
"throws",
"Exception",
"{",
"PrintStreamProgressMonitor",
"pm",
"=",
"new",
"PrintStreamProgressMonitor",
"(",
"System",
".",
"out",
",",
"System",
".",
... | An utility method to use the module with default values and shapefiles.
<p>
This will use the windowed average and a density of 0.2, simplification threshold of 0.1
and a lookahead of 13, as well as a length filter of 10.
</p>
@param shapePath the input file.
@param outPath the output smoothed path.
@throws Exception | [
"An",
"utility",
"method",
"to",
"use",
"the",
"module",
"with",
"default",
"values",
"and",
"shapefiles",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/modules/v/smoothing/OmsLineSmootherMcMaster.java#L245-L262 |
reactor/reactor-netty | src/main/java/reactor/netty/ByteBufFlux.java | ByteBufFlux.fromPath | public static ByteBufFlux fromPath(Path path, ByteBufAllocator allocator) {
return fromPath(path, MAX_CHUNK_SIZE, allocator);
} | java | public static ByteBufFlux fromPath(Path path, ByteBufAllocator allocator) {
return fromPath(path, MAX_CHUNK_SIZE, allocator);
} | [
"public",
"static",
"ByteBufFlux",
"fromPath",
"(",
"Path",
"path",
",",
"ByteBufAllocator",
"allocator",
")",
"{",
"return",
"fromPath",
"(",
"path",
",",
"MAX_CHUNK_SIZE",
",",
"allocator",
")",
";",
"}"
] | Open a {@link java.nio.channels.FileChannel} from a path and stream
{@link ByteBuf} chunks with a default maximum size of 500K into the returned
{@link ByteBufFlux}, using the provided {@link ByteBufAllocator}.
@param path the path to the resource to stream
@param allocator the channel {@link ByteBufAllocator}
@return a {@link ByteBufFlux} | [
"Open",
"a",
"{",
"@link",
"java",
".",
"nio",
".",
"channels",
".",
"FileChannel",
"}",
"from",
"a",
"path",
"and",
"stream",
"{",
"@link",
"ByteBuf",
"}",
"chunks",
"with",
"a",
"default",
"maximum",
"size",
"of",
"500K",
"into",
"the",
"returned",
"... | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/ByteBufFlux.java#L133-L135 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/PrepareRequestInterceptor.java | PrepareRequestInterceptor.prepareQBOPremierUri | private <T extends IEntity> String prepareQBOPremierUri(String entityName, Context context,
Map<String, String> requestParameters) throws FMSException {
StringBuilder uri = new StringBuilder();
// constructs request URI
uri.append(Config.getProperty("BASE_URL_QBO_OLB")).append("/").append(context.getRealmID()).append("/").append(entityName);
// adding the entity id in the URI, which is required for READ operation
addEntityID(requestParameters, uri);
addEntitySelector(requestParameters, uri);
// adds the built request param
uri.append("?").append(buildRequestParams(requestParameters));
// adds the generated request id as a parameter
uri.append("requestid").append("=").append(context.getRequestID()).append("&");
//set RequestId to null once appended, so the next random num can be generated
context.setRequestID(null);
if(context.getMinorVersion() !=null)
{
uri.append("minorversion").append("=").append(context.getMinorVersion()).append("&");
}
return uri.toString();
} | java | private <T extends IEntity> String prepareQBOPremierUri(String entityName, Context context,
Map<String, String> requestParameters) throws FMSException {
StringBuilder uri = new StringBuilder();
// constructs request URI
uri.append(Config.getProperty("BASE_URL_QBO_OLB")).append("/").append(context.getRealmID()).append("/").append(entityName);
// adding the entity id in the URI, which is required for READ operation
addEntityID(requestParameters, uri);
addEntitySelector(requestParameters, uri);
// adds the built request param
uri.append("?").append(buildRequestParams(requestParameters));
// adds the generated request id as a parameter
uri.append("requestid").append("=").append(context.getRequestID()).append("&");
//set RequestId to null once appended, so the next random num can be generated
context.setRequestID(null);
if(context.getMinorVersion() !=null)
{
uri.append("minorversion").append("=").append(context.getMinorVersion()).append("&");
}
return uri.toString();
} | [
"private",
"<",
"T",
"extends",
"IEntity",
">",
"String",
"prepareQBOPremierUri",
"(",
"String",
"entityName",
",",
"Context",
"context",
",",
"Map",
"<",
"String",
",",
"String",
">",
"requestParameters",
")",
"throws",
"FMSException",
"{",
"StringBuilder",
"ur... | Method to construct the OLB QBO URI
@param entityName
the entity name
@param context
the context
@param requestParameters
the request params
@return the QBO URI
@throws FMSException
the FMSException | [
"Method",
"to",
"construct",
"the",
"OLB",
"QBO",
"URI"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/PrepareRequestInterceptor.java#L373-L398 |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCARespondingGatewayAuditor.java | XCARespondingGatewayAuditor.auditCrossGatewayRetrieveEvent | public void auditCrossGatewayRetrieveEvent(
RFC3881EventOutcomeCodes eventOutcome,
String initiatingGatewayUserId, String initiatingGatewayIpAddress,
String respondingGatewayEndpointUri,
String initiatingGatewayUserName,
String[] documentUniqueIds, String[] repositoryUniqueIds, String homeCommunityIds[],
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
ExportEvent exportEvent = new ExportEvent(true, eventOutcome, new IHETransactionEventTypeCodes.CrossGatewayRetrieve(), purposesOfUse);
exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
exportEvent.addSourceActiveParticipant(respondingGatewayEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(respondingGatewayEndpointUri, false), false);
if(!EventUtils.isEmptyOrNull(initiatingGatewayUserName)) {
exportEvent.addHumanRequestorActiveParticipant(initiatingGatewayUserName, null, initiatingGatewayUserName, userRoles);
}
exportEvent.addDestinationActiveParticipant(initiatingGatewayUserId, null, null, initiatingGatewayIpAddress, true);
//exportEvent.addPatientParticipantObject(patientId);
if (!EventUtils.isEmptyOrNull(documentUniqueIds)) {
for (int i=0; i<documentUniqueIds.length; i++) {
exportEvent.addDocumentParticipantObject(documentUniqueIds[i], repositoryUniqueIds[i], homeCommunityIds[i]);
}
}
audit(exportEvent);
} | java | public void auditCrossGatewayRetrieveEvent(
RFC3881EventOutcomeCodes eventOutcome,
String initiatingGatewayUserId, String initiatingGatewayIpAddress,
String respondingGatewayEndpointUri,
String initiatingGatewayUserName,
String[] documentUniqueIds, String[] repositoryUniqueIds, String homeCommunityIds[],
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
ExportEvent exportEvent = new ExportEvent(true, eventOutcome, new IHETransactionEventTypeCodes.CrossGatewayRetrieve(), purposesOfUse);
exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
exportEvent.addSourceActiveParticipant(respondingGatewayEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(respondingGatewayEndpointUri, false), false);
if(!EventUtils.isEmptyOrNull(initiatingGatewayUserName)) {
exportEvent.addHumanRequestorActiveParticipant(initiatingGatewayUserName, null, initiatingGatewayUserName, userRoles);
}
exportEvent.addDestinationActiveParticipant(initiatingGatewayUserId, null, null, initiatingGatewayIpAddress, true);
//exportEvent.addPatientParticipantObject(patientId);
if (!EventUtils.isEmptyOrNull(documentUniqueIds)) {
for (int i=0; i<documentUniqueIds.length; i++) {
exportEvent.addDocumentParticipantObject(documentUniqueIds[i], repositoryUniqueIds[i], homeCommunityIds[i]);
}
}
audit(exportEvent);
} | [
"public",
"void",
"auditCrossGatewayRetrieveEvent",
"(",
"RFC3881EventOutcomeCodes",
"eventOutcome",
",",
"String",
"initiatingGatewayUserId",
",",
"String",
"initiatingGatewayIpAddress",
",",
"String",
"respondingGatewayEndpointUri",
",",
"String",
"initiatingGatewayUserName",
"... | Audits an ITI-39 Cross Gateway Retrieve event for XCA Responding Gateway actors.
@param eventOutcome The event outcome indicator
@param initiatingGatewayUserId The Active Participant UserID for the document consumer (if using WS-Addressing)
@param initiatingGatewayUserName The Active Participant UserName for the document consumer (if using WS-Security / XUA)
@param initiatingGatewayIpAddress The IP address of the document consumer that initiated the transaction
@param respondingGatewayEndpointUri The Web service endpoint URI for this document repository
@param documentUniqueIds The list of Document Entry UniqueId(s) for the document(s) retrieved
@param repositoryUniqueIds The list of XDS.b Repository Unique Ids involved in this transaction (aligned with Document Unique Ids array)
@param homeCommunityIds The list of home community ids used in the transaction
@param purposesOfUse purpose of use codes (may be taken from XUA token)
@param userRoles roles of the human user (may be taken from XUA token) | [
"Audits",
"an",
"ITI",
"-",
"39",
"Cross",
"Gateway",
"Retrieve",
"event",
"for",
"XCA",
"Responding",
"Gateway",
"actors",
"."
] | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCARespondingGatewayAuditor.java#L103-L131 |
GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java | FileInfo.convertToDirectoryPath | public static URI convertToDirectoryPath(PathCodec pathCodec, URI path) {
StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, true);
if (resourceId.isStorageObject()) {
if (!objectHasDirectoryPath(resourceId.getObjectName())) {
resourceId = convertToDirectoryPath(resourceId);
path = pathCodec.getPath(
resourceId.getBucketName(), resourceId.getObjectName(), false /* allow empty name */);
}
}
return path;
} | java | public static URI convertToDirectoryPath(PathCodec pathCodec, URI path) {
StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, true);
if (resourceId.isStorageObject()) {
if (!objectHasDirectoryPath(resourceId.getObjectName())) {
resourceId = convertToDirectoryPath(resourceId);
path = pathCodec.getPath(
resourceId.getBucketName(), resourceId.getObjectName(), false /* allow empty name */);
}
}
return path;
} | [
"public",
"static",
"URI",
"convertToDirectoryPath",
"(",
"PathCodec",
"pathCodec",
",",
"URI",
"path",
")",
"{",
"StorageResourceId",
"resourceId",
"=",
"pathCodec",
".",
"validatePathAndGetId",
"(",
"path",
",",
"true",
")",
";",
"if",
"(",
"resourceId",
".",
... | Converts the given path to look like a directory path.
If the path already looks like a directory path then
this call is a no-op.
@param path Path to convert.
@return Directory path for the given path. | [
"Converts",
"the",
"given",
"path",
"to",
"look",
"like",
"a",
"directory",
"path",
".",
"If",
"the",
"path",
"already",
"looks",
"like",
"a",
"directory",
"path",
"then",
"this",
"call",
"is",
"a",
"no",
"-",
"op",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java#L301-L312 |
arnaudroger/SimpleFlatMapper | sfm-map/src/main/java/org/simpleflatmapper/map/mapper/MapperBuilder.java | MapperBuilder.addMapper | @SuppressWarnings("unchecked")
public final B addMapper(FieldMapper<ROW, T> mapper) {
setRowMapperBuilder.addMapper(mapper);
return (B) this;
} | java | @SuppressWarnings("unchecked")
public final B addMapper(FieldMapper<ROW, T> mapper) {
setRowMapperBuilder.addMapper(mapper);
return (B) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"final",
"B",
"addMapper",
"(",
"FieldMapper",
"<",
"ROW",
",",
"T",
">",
"mapper",
")",
"{",
"setRowMapperBuilder",
".",
"addMapper",
"(",
"mapper",
")",
";",
"return",
"(",
"B",
")",
"this",
... | append a FieldMapper to the mapping list.
@param mapper the field jdbcMapper
@return the current builder | [
"append",
"a",
"FieldMapper",
"to",
"the",
"mapping",
"list",
"."
] | train | https://github.com/arnaudroger/SimpleFlatMapper/blob/93435438c18f26c87963d5e0f3ebf0f264dcd8c2/sfm-map/src/main/java/org/simpleflatmapper/map/mapper/MapperBuilder.java#L133-L137 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/CFFFontSubset.java | CFFFontSubset.CountRange | int CountRange(int NumofGlyphs,int Type){
int num=0;
@SuppressWarnings("unused")
char Sid;
int i=1,nLeft;
while (i<NumofGlyphs){
num++;
Sid = getCard16();
if (Type==1)
nLeft = getCard8();
else
nLeft = getCard16();
i += nLeft+1;
}
return num;
} | java | int CountRange(int NumofGlyphs,int Type){
int num=0;
@SuppressWarnings("unused")
char Sid;
int i=1,nLeft;
while (i<NumofGlyphs){
num++;
Sid = getCard16();
if (Type==1)
nLeft = getCard8();
else
nLeft = getCard16();
i += nLeft+1;
}
return num;
} | [
"int",
"CountRange",
"(",
"int",
"NumofGlyphs",
",",
"int",
"Type",
")",
"{",
"int",
"num",
"=",
"0",
";",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"char",
"Sid",
";",
"int",
"i",
"=",
"1",
",",
"nLeft",
";",
"while",
"(",
"i",
"<",
"NumofG... | Function calculates the number of ranges in the Charset
@param NumofGlyphs The number of glyphs in the font
@param Type The format of the Charset
@return The number of ranges in the Charset data structure | [
"Function",
"calculates",
"the",
"number",
"of",
"ranges",
"in",
"the",
"Charset"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/CFFFontSubset.java#L243-L258 |
jboss/jboss-el-api_spec | src/main/java/javax/el/ELContext.java | ELContext.putContext | public void putContext(Class key, Object contextObject) {
if((key == null) || (contextObject == null)) {
throw new NullPointerException();
}
map.put(key, contextObject);
} | java | public void putContext(Class key, Object contextObject) {
if((key == null) || (contextObject == null)) {
throw new NullPointerException();
}
map.put(key, contextObject);
} | [
"public",
"void",
"putContext",
"(",
"Class",
"key",
",",
"Object",
"contextObject",
")",
"{",
"if",
"(",
"(",
"key",
"==",
"null",
")",
"||",
"(",
"contextObject",
"==",
"null",
")",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}"... | Associates a context object with this <code>ELContext</code>.
<p>The <code>ELContext</code> maintains a collection of context objects
relevant to the evaluation of an expression. These context objects
are used by <code>ELResolver</code>s. This method is used to
add a context object to that collection.</p>
<p>By convention, the <code>contextObject</code> will be of the
type specified by the <code>key</code>. However, this is not
required and the key is used strictly as a unique identifier.</p>
@param key The key used by an @{link ELResolver} to identify this
context object.
@param contextObject The context object to add to the collection.
@throws NullPointerException if key is null or contextObject is null. | [
"Associates",
"a",
"context",
"object",
"with",
"this",
"<code",
">",
"ELContext<",
"/",
"code",
">",
"."
] | train | https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/ELContext.java#L194-L199 |
xdcrafts/flower | flower-tools/src/main/java/com/github/xdcrafts/flower/tools/ListApi.java | ListApi.getMap | public static <A, B> Optional<Map<A, B>> getMap(final List list, final Integer... path) {
return get(list, Map.class, path).map(m -> (Map<A, B>) m);
} | java | public static <A, B> Optional<Map<A, B>> getMap(final List list, final Integer... path) {
return get(list, Map.class, path).map(m -> (Map<A, B>) m);
} | [
"public",
"static",
"<",
"A",
",",
"B",
">",
"Optional",
"<",
"Map",
"<",
"A",
",",
"B",
">",
">",
"getMap",
"(",
"final",
"List",
"list",
",",
"final",
"Integer",
"...",
"path",
")",
"{",
"return",
"get",
"(",
"list",
",",
"Map",
".",
"class",
... | Get map value by path.
@param <A> map key type
@param <B> map value type
@param list subject
@param path nodes to walk in map
@return value | [
"Get",
"map",
"value",
"by",
"path",
"."
] | train | https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/ListApi.java#L172-L174 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRootElements.java | CollationRootElements.getSecondaryAfter | int getSecondaryAfter(int index, int s) {
long secTer;
int secLimit;
if(index == 0) {
// primary = 0
assert(s != 0);
index = (int)elements[IX_FIRST_SECONDARY_INDEX];
secTer = elements[index];
// Gap at the end of the secondary CE range.
secLimit = 0x10000;
} else {
assert(index >= (int)elements[IX_FIRST_PRIMARY_INDEX]);
secTer = getFirstSecTerForPrimary(index + 1);
// If this is an explicit sec/ter unit, then it will be read once more.
// Gap for secondaries of primary CEs.
secLimit = getSecondaryBoundary();
}
for(;;) {
int sec = (int)(secTer >> 16);
if(sec > s) { return sec; }
secTer = elements[++index];
if((secTer & SEC_TER_DELTA_FLAG) == 0) { return secLimit; }
}
} | java | int getSecondaryAfter(int index, int s) {
long secTer;
int secLimit;
if(index == 0) {
// primary = 0
assert(s != 0);
index = (int)elements[IX_FIRST_SECONDARY_INDEX];
secTer = elements[index];
// Gap at the end of the secondary CE range.
secLimit = 0x10000;
} else {
assert(index >= (int)elements[IX_FIRST_PRIMARY_INDEX]);
secTer = getFirstSecTerForPrimary(index + 1);
// If this is an explicit sec/ter unit, then it will be read once more.
// Gap for secondaries of primary CEs.
secLimit = getSecondaryBoundary();
}
for(;;) {
int sec = (int)(secTer >> 16);
if(sec > s) { return sec; }
secTer = elements[++index];
if((secTer & SEC_TER_DELTA_FLAG) == 0) { return secLimit; }
}
} | [
"int",
"getSecondaryAfter",
"(",
"int",
"index",
",",
"int",
"s",
")",
"{",
"long",
"secTer",
";",
"int",
"secLimit",
";",
"if",
"(",
"index",
"==",
"0",
")",
"{",
"// primary = 0",
"assert",
"(",
"s",
"!=",
"0",
")",
";",
"index",
"=",
"(",
"int",... | Returns the secondary weight after [p, s] where index=findPrimary(p)
except use index=0 for p=0.
<p>Must return a weight for every root [p, s] as well as for every weight
returned by getSecondaryBefore(). If p!=0 then s can be BEFORE_WEIGHT16.
<p>Exception: [0, 0] is handled by the CollationBuilder:
Both its lower and upper boundaries are special. | [
"Returns",
"the",
"secondary",
"weight",
"after",
"[",
"p",
"s",
"]",
"where",
"index",
"=",
"findPrimary",
"(",
"p",
")",
"except",
"use",
"index",
"=",
"0",
"for",
"p",
"=",
"0",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRootElements.java#L353-L376 |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.setStrings | public void setStrings(String name, String... values) {
set(name, StringUtils.arrayToString(values));
} | java | public void setStrings(String name, String... values) {
set(name, StringUtils.arrayToString(values));
} | [
"public",
"void",
"setStrings",
"(",
"String",
"name",
",",
"String",
"...",
"values",
")",
"{",
"set",
"(",
"name",
",",
"StringUtils",
".",
"arrayToString",
"(",
"values",
")",
")",
";",
"}"
] | Set the array of string values for the <code>name</code> property as
as comma delimited values.
@param name property name.
@param values The values | [
"Set",
"the",
"array",
"of",
"string",
"values",
"for",
"the",
"<code",
">",
"name<",
"/",
"code",
">",
"property",
"as",
"as",
"comma",
"delimited",
"values",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L2142-L2144 |
Azure/azure-sdk-for-java | iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java | IotHubResourcesInner.createOrUpdate | public IotHubDescriptionInner createOrUpdate(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, String ifMatch) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch).toBlocking().last().body();
} | java | public IotHubDescriptionInner createOrUpdate(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, String ifMatch) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch).toBlocking().last().body();
} | [
"public",
"IotHubDescriptionInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"IotHubDescriptionInner",
"iotHubDescription",
",",
"String",
"ifMatch",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceG... | Create or update the metadata of an IoT hub.
Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub.
@param resourceGroupName The name of the resource group that contains the IoT hub.
@param resourceName The name of the IoT hub.
@param iotHubDescription The IoT hub metadata and security metadata.
@param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorDetailsException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the IotHubDescriptionInner object if successful. | [
"Create",
"or",
"update",
"the",
"metadata",
"of",
"an",
"IoT",
"hub",
".",
"Create",
"or",
"update",
"the",
"metadata",
"of",
"an",
"Iot",
"hub",
".",
"The",
"usual",
"pattern",
"to",
"modify",
"a",
"property",
"is",
"to",
"retrieve",
"the",
"IoT",
"h... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L400-L402 |
phax/ph-masterdata | ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java | CurrencyHelper.setMinimumFractionDigits | public static void setMinimumFractionDigits (@Nullable final ECurrency eCurrency, @Nonnegative final int nDecimals)
{
getSettings (eCurrency).setMinimumFractionDigits (nDecimals);
} | java | public static void setMinimumFractionDigits (@Nullable final ECurrency eCurrency, @Nonnegative final int nDecimals)
{
getSettings (eCurrency).setMinimumFractionDigits (nDecimals);
} | [
"public",
"static",
"void",
"setMinimumFractionDigits",
"(",
"@",
"Nullable",
"final",
"ECurrency",
"eCurrency",
",",
"@",
"Nonnegative",
"final",
"int",
"nDecimals",
")",
"{",
"getSettings",
"(",
"eCurrency",
")",
".",
"setMinimumFractionDigits",
"(",
"nDecimals",
... | Set the minimum fraction digits to be used for formatting. Applies to the
currency-formatting and the value-formatting.
@param eCurrency
The currency it is about. If <code>null</code> is provided
{@link #DEFAULT_CURRENCY} is used instead.
@param nDecimals
The new minimum fraction digits. May not be negative. | [
"Set",
"the",
"minimum",
"fraction",
"digits",
"to",
"be",
"used",
"for",
"formatting",
".",
"Applies",
"to",
"the",
"currency",
"-",
"formatting",
"and",
"the",
"value",
"-",
"formatting",
"."
] | train | https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java#L378-L381 |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java | ActionUtil.addAction | public static ActionListener addAction(BaseComponent component, IAction action, String eventName) {
ActionListener listener;
if (action == null) {
listener = removeAction(component, eventName);
} else {
listener = getListener(component, eventName);
if (listener == null) {
listener = new ActionListener(component, action, eventName);
} else {
listener.setAction(action);
}
}
return listener;
} | java | public static ActionListener addAction(BaseComponent component, IAction action, String eventName) {
ActionListener listener;
if (action == null) {
listener = removeAction(component, eventName);
} else {
listener = getListener(component, eventName);
if (listener == null) {
listener = new ActionListener(component, action, eventName);
} else {
listener.setAction(action);
}
}
return listener;
} | [
"public",
"static",
"ActionListener",
"addAction",
"(",
"BaseComponent",
"component",
",",
"IAction",
"action",
",",
"String",
"eventName",
")",
"{",
"ActionListener",
"listener",
";",
"if",
"(",
"action",
"==",
"null",
")",
"{",
"listener",
"=",
"removeAction",... | Adds/removes an action to/from a component.
@param component Component to be associated with the action.
@param action Action to invoke when listener event is triggered. If null, dissociates the
event listener from the component.
@param eventName The name of the event that will trigger the action.
@return The newly created or just removed action listener. | [
"Adds",
"/",
"removes",
"an",
"action",
"to",
"/",
"from",
"a",
"component",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java#L111-L127 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.