repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/xml/AnnotationReader.java | AnnotationReader.hasAnnotation | public <A extends Annotation> boolean hasAnnotation(final Method method, final Class<A> annClass) {
"""
メソッドに付与されたアノテーションを持つか判定します。
@since 2.0
@param method 判定対象のメソッド
@param annClass アノテーションのタイプ
@return trueの場合、アノテーションを持ちます。
"""
return getAnnotation(method, annClass) != null;
} | java | public <A extends Annotation> boolean hasAnnotation(final Method method, final Class<A> annClass) {
return getAnnotation(method, annClass) != null;
} | [
"public",
"<",
"A",
"extends",
"Annotation",
">",
"boolean",
"hasAnnotation",
"(",
"final",
"Method",
"method",
",",
"final",
"Class",
"<",
"A",
">",
"annClass",
")",
"{",
"return",
"getAnnotation",
"(",
"method",
",",
"annClass",
")",
"!=",
"null",
";",
"}"
] | メソッドに付与されたアノテーションを持つか判定します。
@since 2.0
@param method 判定対象のメソッド
@param annClass アノテーションのタイプ
@return trueの場合、アノテーションを持ちます。 | [
"メソッドに付与されたアノテーションを持つか判定します。"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/xml/AnnotationReader.java#L145-L147 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.getSnapshot | public GetSnapshotResponse getSnapshot(GetSnapshotRequest request) {
"""
Getting the detail information of specified snapshot.
@param request The request containing all options for getting the detail information of specified snapshot.
@return The response with the snapshot detail information.
"""
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getSnapshotId(), "request snapshotId should no be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.GET, SNAPSHOT_PREFIX, request.getSnapshotId());
return invokeHttpClient(internalRequest, GetSnapshotResponse.class);
} | java | public GetSnapshotResponse getSnapshot(GetSnapshotRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getSnapshotId(), "request snapshotId should no be empty.");
InternalRequest internalRequest =
this.createRequest(request, HttpMethodName.GET, SNAPSHOT_PREFIX, request.getSnapshotId());
return invokeHttpClient(internalRequest, GetSnapshotResponse.class);
} | [
"public",
"GetSnapshotResponse",
"getSnapshot",
"(",
"GetSnapshotRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getSnapshotId",
"(",
")",
",",
"\"request snapshotId should no be empty.\"",
")",
";",
"InternalRequest",
"internalRequest",
"=",
"this",
".",
"createRequest",
"(",
"request",
",",
"HttpMethodName",
".",
"GET",
",",
"SNAPSHOT_PREFIX",
",",
"request",
".",
"getSnapshotId",
"(",
")",
")",
";",
"return",
"invokeHttpClient",
"(",
"internalRequest",
",",
"GetSnapshotResponse",
".",
"class",
")",
";",
"}"
] | Getting the detail information of specified snapshot.
@param request The request containing all options for getting the detail information of specified snapshot.
@return The response with the snapshot detail information. | [
"Getting",
"the",
"detail",
"information",
"of",
"specified",
"snapshot",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1456-L1462 |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/interestrate/products/components/IndexedValue.java | IndexedValue.getValue | @Override
public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException {
"""
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime.
Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time.
Cash flows prior evaluationTime are not considered.
@param evaluationTime The time on which this products value should be observed.
@param model The model used to price the product.
@return The random variable representing the value of the product discounted to evaluation time
@throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method.
"""
double evaluationTimeUnderlying = Math.max(evaluationTime, exerciseDate);
RandomVariable underlyingValues = underlying.getValue(evaluationTimeUnderlying, model);
RandomVariable indexValues = index.getValue(exerciseDate, model);
// Make index measurable w.r.t time exerciseDate
if(indexValues.getFiltrationTime() > exerciseDate && exerciseDate > evaluationTime) {
MonteCarloConditionalExpectationRegression condExpEstimator = new MonteCarloConditionalExpectationRegression(getRegressionBasisFunctions(exerciseDate, model));
// Calculate cond. expectation.
indexValues = condExpEstimator.getConditionalExpectation(indexValues);
}
// Form product
underlyingValues = underlyingValues.mult(indexValues);
// Discount to evaluation time if necessary
if(evaluationTime != evaluationTimeUnderlying) {
RandomVariable numeraireAtEval = model.getNumeraire(evaluationTime);
RandomVariable numeraire = model.getNumeraire(evaluationTimeUnderlying);
underlyingValues = underlyingValues.div(numeraire).mult(numeraireAtEval);
}
// Return values
return underlyingValues;
} | java | @Override
public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException {
double evaluationTimeUnderlying = Math.max(evaluationTime, exerciseDate);
RandomVariable underlyingValues = underlying.getValue(evaluationTimeUnderlying, model);
RandomVariable indexValues = index.getValue(exerciseDate, model);
// Make index measurable w.r.t time exerciseDate
if(indexValues.getFiltrationTime() > exerciseDate && exerciseDate > evaluationTime) {
MonteCarloConditionalExpectationRegression condExpEstimator = new MonteCarloConditionalExpectationRegression(getRegressionBasisFunctions(exerciseDate, model));
// Calculate cond. expectation.
indexValues = condExpEstimator.getConditionalExpectation(indexValues);
}
// Form product
underlyingValues = underlyingValues.mult(indexValues);
// Discount to evaluation time if necessary
if(evaluationTime != evaluationTimeUnderlying) {
RandomVariable numeraireAtEval = model.getNumeraire(evaluationTime);
RandomVariable numeraire = model.getNumeraire(evaluationTimeUnderlying);
underlyingValues = underlyingValues.div(numeraire).mult(numeraireAtEval);
}
// Return values
return underlyingValues;
} | [
"@",
"Override",
"public",
"RandomVariable",
"getValue",
"(",
"double",
"evaluationTime",
",",
"LIBORModelMonteCarloSimulationModel",
"model",
")",
"throws",
"CalculationException",
"{",
"double",
"evaluationTimeUnderlying",
"=",
"Math",
".",
"max",
"(",
"evaluationTime",
",",
"exerciseDate",
")",
";",
"RandomVariable",
"underlyingValues",
"=",
"underlying",
".",
"getValue",
"(",
"evaluationTimeUnderlying",
",",
"model",
")",
";",
"RandomVariable",
"indexValues",
"=",
"index",
".",
"getValue",
"(",
"exerciseDate",
",",
"model",
")",
";",
"// Make index measurable w.r.t time exerciseDate",
"if",
"(",
"indexValues",
".",
"getFiltrationTime",
"(",
")",
">",
"exerciseDate",
"&&",
"exerciseDate",
">",
"evaluationTime",
")",
"{",
"MonteCarloConditionalExpectationRegression",
"condExpEstimator",
"=",
"new",
"MonteCarloConditionalExpectationRegression",
"(",
"getRegressionBasisFunctions",
"(",
"exerciseDate",
",",
"model",
")",
")",
";",
"// Calculate cond. expectation.",
"indexValues",
"=",
"condExpEstimator",
".",
"getConditionalExpectation",
"(",
"indexValues",
")",
";",
"}",
"// Form product",
"underlyingValues",
"=",
"underlyingValues",
".",
"mult",
"(",
"indexValues",
")",
";",
"// Discount to evaluation time if necessary",
"if",
"(",
"evaluationTime",
"!=",
"evaluationTimeUnderlying",
")",
"{",
"RandomVariable",
"numeraireAtEval",
"=",
"model",
".",
"getNumeraire",
"(",
"evaluationTime",
")",
";",
"RandomVariable",
"numeraire",
"=",
"model",
".",
"getNumeraire",
"(",
"evaluationTimeUnderlying",
")",
";",
"underlyingValues",
"=",
"underlyingValues",
".",
"div",
"(",
"numeraire",
")",
".",
"mult",
"(",
"numeraireAtEval",
")",
";",
"}",
"// Return values",
"return",
"underlyingValues",
";",
"}"
] | This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime.
Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time.
Cash flows prior evaluationTime are not considered.
@param evaluationTime The time on which this products value should be observed.
@param model The model used to price the product.
@return The random variable representing the value of the product discounted to evaluation time
@throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method. | [
"This",
"method",
"returns",
"the",
"value",
"random",
"variable",
"of",
"the",
"product",
"within",
"the",
"specified",
"model",
"evaluated",
"at",
"a",
"given",
"evalutationTime",
".",
"Note",
":",
"For",
"a",
"lattice",
"this",
"is",
"often",
"the",
"value",
"conditional",
"to",
"evalutationTime",
"for",
"a",
"Monte",
"-",
"Carlo",
"simulation",
"this",
"is",
"the",
"(",
"sum",
"of",
")",
"value",
"discounted",
"to",
"evaluation",
"time",
".",
"Cash",
"flows",
"prior",
"evaluationTime",
"are",
"not",
"considered",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/components/IndexedValue.java#L73-L101 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java | DocEnv.makeConstructorDoc | protected void makeConstructorDoc(MethodSymbol meth, TreePath treePath) {
"""
Create the ConstructorDoc for a MethodSymbol.
Should be called only on symbols representing constructors.
"""
ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth);
if (result != null) {
if (treePath != null) result.setTreePath(treePath);
} else {
result = new ConstructorDocImpl(this, meth, treePath);
methodMap.put(meth, result);
}
} | java | protected void makeConstructorDoc(MethodSymbol meth, TreePath treePath) {
ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth);
if (result != null) {
if (treePath != null) result.setTreePath(treePath);
} else {
result = new ConstructorDocImpl(this, meth, treePath);
methodMap.put(meth, result);
}
} | [
"protected",
"void",
"makeConstructorDoc",
"(",
"MethodSymbol",
"meth",
",",
"TreePath",
"treePath",
")",
"{",
"ConstructorDocImpl",
"result",
"=",
"(",
"ConstructorDocImpl",
")",
"methodMap",
".",
"get",
"(",
"meth",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"if",
"(",
"treePath",
"!=",
"null",
")",
"result",
".",
"setTreePath",
"(",
"treePath",
")",
";",
"}",
"else",
"{",
"result",
"=",
"new",
"ConstructorDocImpl",
"(",
"this",
",",
"meth",
",",
"treePath",
")",
";",
"methodMap",
".",
"put",
"(",
"meth",
",",
"result",
")",
";",
"}",
"}"
] | Create the ConstructorDoc for a MethodSymbol.
Should be called only on symbols representing constructors. | [
"Create",
"the",
"ConstructorDoc",
"for",
"a",
"MethodSymbol",
".",
"Should",
"be",
"called",
"only",
"on",
"symbols",
"representing",
"constructors",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L688-L696 |
maestrano/maestrano-java | src/main/java/com/maestrano/Maestrano.java | Maestrano.autoConfigure | public static Map<String, Preset> autoConfigure() throws MnoConfigurationException {
"""
Method to fetch configuration from the dev-platform, using environment variable.
The following variable must be set in the environment.
<ul>
<li>MNO_DEVPL_ENV_NAME</li>
<li>MNO_DEVPL_ENV_KEY</li>
<li>MNO_DEVPL_ENV_SECRET</li>
</ul>
@throws MnoConfigurationException
"""
String host = MnoPropertiesHelper.readEnvironment("MNO_DEVPL_HOST", "https://developer.maestrano.com");
String apiPath = MnoPropertiesHelper.readEnvironment("MNO_DEVPL_API_PATH", "/api/config/v1");
String apiKey = MnoPropertiesHelper.readEnvironment("MNO_DEVPL_ENV_KEY");
String apiSecret = MnoPropertiesHelper.readEnvironment("MNO_DEVPL_ENV_SECRET");
return autoConfigure(host, apiPath, apiKey, apiSecret);
} | java | public static Map<String, Preset> autoConfigure() throws MnoConfigurationException {
String host = MnoPropertiesHelper.readEnvironment("MNO_DEVPL_HOST", "https://developer.maestrano.com");
String apiPath = MnoPropertiesHelper.readEnvironment("MNO_DEVPL_API_PATH", "/api/config/v1");
String apiKey = MnoPropertiesHelper.readEnvironment("MNO_DEVPL_ENV_KEY");
String apiSecret = MnoPropertiesHelper.readEnvironment("MNO_DEVPL_ENV_SECRET");
return autoConfigure(host, apiPath, apiKey, apiSecret);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Preset",
">",
"autoConfigure",
"(",
")",
"throws",
"MnoConfigurationException",
"{",
"String",
"host",
"=",
"MnoPropertiesHelper",
".",
"readEnvironment",
"(",
"\"MNO_DEVPL_HOST\"",
",",
"\"https://developer.maestrano.com\"",
")",
";",
"String",
"apiPath",
"=",
"MnoPropertiesHelper",
".",
"readEnvironment",
"(",
"\"MNO_DEVPL_API_PATH\"",
",",
"\"/api/config/v1\"",
")",
";",
"String",
"apiKey",
"=",
"MnoPropertiesHelper",
".",
"readEnvironment",
"(",
"\"MNO_DEVPL_ENV_KEY\"",
")",
";",
"String",
"apiSecret",
"=",
"MnoPropertiesHelper",
".",
"readEnvironment",
"(",
"\"MNO_DEVPL_ENV_SECRET\"",
")",
";",
"return",
"autoConfigure",
"(",
"host",
",",
"apiPath",
",",
"apiKey",
",",
"apiSecret",
")",
";",
"}"
] | Method to fetch configuration from the dev-platform, using environment variable.
The following variable must be set in the environment.
<ul>
<li>MNO_DEVPL_ENV_NAME</li>
<li>MNO_DEVPL_ENV_KEY</li>
<li>MNO_DEVPL_ENV_SECRET</li>
</ul>
@throws MnoConfigurationException | [
"Method",
"to",
"fetch",
"configuration",
"from",
"the",
"dev",
"-",
"platform",
"using",
"environment",
"variable",
"."
] | train | https://github.com/maestrano/maestrano-java/blob/e71c6d3172d7645529d678d1cb3ea9e0a59de314/src/main/java/com/maestrano/Maestrano.java#L93-L99 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java | AppServiceCertificateOrdersInner.retrieveCertificateActions | public List<CertificateOrderActionInner> retrieveCertificateActions(String resourceGroupName, String name) {
"""
Retrieve the list of certificate actions.
Retrieve the list of certificate actions.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the certificate order.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws DefaultErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<CertificateOrderActionInner> object if successful.
"""
return retrieveCertificateActionsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | java | public List<CertificateOrderActionInner> retrieveCertificateActions(String resourceGroupName, String name) {
return retrieveCertificateActionsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | [
"public",
"List",
"<",
"CertificateOrderActionInner",
">",
"retrieveCertificateActions",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"retrieveCertificateActionsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Retrieve the list of certificate actions.
Retrieve the list of certificate actions.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the certificate order.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws DefaultErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<CertificateOrderActionInner> object if successful. | [
"Retrieve",
"the",
"list",
"of",
"certificate",
"actions",
".",
"Retrieve",
"the",
"list",
"of",
"certificate",
"actions",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L2234-L2236 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java | AMPManager.isActionSupported | public static boolean isActionSupported(XMPPConnection connection, AMPExtension.Action action) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
"""
Check if server supports specified action.
@param connection active xmpp connection
@param action action to check
@return true if this action is supported.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException
"""
String featureName = AMPExtension.NAMESPACE + "?action=" + action.toString();
return isFeatureSupportedByServer(connection, featureName);
} | java | public static boolean isActionSupported(XMPPConnection connection, AMPExtension.Action action) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
String featureName = AMPExtension.NAMESPACE + "?action=" + action.toString();
return isFeatureSupportedByServer(connection, featureName);
} | [
"public",
"static",
"boolean",
"isActionSupported",
"(",
"XMPPConnection",
"connection",
",",
"AMPExtension",
".",
"Action",
"action",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"String",
"featureName",
"=",
"AMPExtension",
".",
"NAMESPACE",
"+",
"\"?action=\"",
"+",
"action",
".",
"toString",
"(",
")",
";",
"return",
"isFeatureSupportedByServer",
"(",
"connection",
",",
"featureName",
")",
";",
"}"
] | Check if server supports specified action.
@param connection active xmpp connection
@param action action to check
@return true if this action is supported.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Check",
"if",
"server",
"supports",
"specified",
"action",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java#L93-L96 |
inferred/FreeBuilder | src/main/java/org/inferred/freebuilder/processor/source/QualifiedName.java | QualifiedName.of | public static QualifiedName of(String packageName, String topLevelType, String... nestedTypes) {
"""
Returns a {@link QualifiedName} for a type in {@code packageName}. If {@code nestedTypes} is
empty, it is a top level type called {@code topLevelType}; otherwise, it is nested in that
type.
"""
requireNonNull(!packageName.isEmpty());
checkArgument(!topLevelType.isEmpty());
return new QualifiedName(
unshadedName(packageName), // shadowJar modifies string literals; unshade them here
ImmutableList.<String>builder().add(topLevelType).add(nestedTypes).build());
} | java | public static QualifiedName of(String packageName, String topLevelType, String... nestedTypes) {
requireNonNull(!packageName.isEmpty());
checkArgument(!topLevelType.isEmpty());
return new QualifiedName(
unshadedName(packageName), // shadowJar modifies string literals; unshade them here
ImmutableList.<String>builder().add(topLevelType).add(nestedTypes).build());
} | [
"public",
"static",
"QualifiedName",
"of",
"(",
"String",
"packageName",
",",
"String",
"topLevelType",
",",
"String",
"...",
"nestedTypes",
")",
"{",
"requireNonNull",
"(",
"!",
"packageName",
".",
"isEmpty",
"(",
")",
")",
";",
"checkArgument",
"(",
"!",
"topLevelType",
".",
"isEmpty",
"(",
")",
")",
";",
"return",
"new",
"QualifiedName",
"(",
"unshadedName",
"(",
"packageName",
")",
",",
"// shadowJar modifies string literals; unshade them here",
"ImmutableList",
".",
"<",
"String",
">",
"builder",
"(",
")",
".",
"add",
"(",
"topLevelType",
")",
".",
"add",
"(",
"nestedTypes",
")",
".",
"build",
"(",
")",
")",
";",
"}"
] | Returns a {@link QualifiedName} for a type in {@code packageName}. If {@code nestedTypes} is
empty, it is a top level type called {@code topLevelType}; otherwise, it is nested in that
type. | [
"Returns",
"a",
"{"
] | train | https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/source/QualifiedName.java#L55-L61 |
lucee/Lucee | core/src/main/java/lucee/transformer/library/tag/TagLibEntityResolver.java | TagLibEntityResolver.resolveEntity | @Override
public InputSource resolveEntity(String publicId, String systemId) {
"""
Laedt die DTD vom lokalen System.
@see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String)
"""
for (int i = 0; i < Constants.DTDS_TLD.length; i++) {
if (publicId.equals(Constants.DTDS_TLD[i])) {
return new InputSource(getClass().getResourceAsStream(LUCEE_DTD_1_0));
}
}
if (publicId.equals("-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN")) {
return new InputSource(getClass().getResourceAsStream(SUN_DTD_1_1));
}
else if (publicId.equals("-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN")) {
return new InputSource(getClass().getResourceAsStream(SUN_DTD_1_2));
}
return null;
} | java | @Override
public InputSource resolveEntity(String publicId, String systemId) {
for (int i = 0; i < Constants.DTDS_TLD.length; i++) {
if (publicId.equals(Constants.DTDS_TLD[i])) {
return new InputSource(getClass().getResourceAsStream(LUCEE_DTD_1_0));
}
}
if (publicId.equals("-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN")) {
return new InputSource(getClass().getResourceAsStream(SUN_DTD_1_1));
}
else if (publicId.equals("-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN")) {
return new InputSource(getClass().getResourceAsStream(SUN_DTD_1_2));
}
return null;
} | [
"@",
"Override",
"public",
"InputSource",
"resolveEntity",
"(",
"String",
"publicId",
",",
"String",
"systemId",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"Constants",
".",
"DTDS_TLD",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"publicId",
".",
"equals",
"(",
"Constants",
".",
"DTDS_TLD",
"[",
"i",
"]",
")",
")",
"{",
"return",
"new",
"InputSource",
"(",
"getClass",
"(",
")",
".",
"getResourceAsStream",
"(",
"LUCEE_DTD_1_0",
")",
")",
";",
"}",
"}",
"if",
"(",
"publicId",
".",
"equals",
"(",
"\"-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN\"",
")",
")",
"{",
"return",
"new",
"InputSource",
"(",
"getClass",
"(",
")",
".",
"getResourceAsStream",
"(",
"SUN_DTD_1_1",
")",
")",
";",
"}",
"else",
"if",
"(",
"publicId",
".",
"equals",
"(",
"\"-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN\"",
")",
")",
"{",
"return",
"new",
"InputSource",
"(",
"getClass",
"(",
")",
".",
"getResourceAsStream",
"(",
"SUN_DTD_1_2",
")",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Laedt die DTD vom lokalen System.
@see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) | [
"Laedt",
"die",
"DTD",
"vom",
"lokalen",
"System",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/tag/TagLibEntityResolver.java#L47-L63 |
biojava/biojava | biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DisplayAFP.java | DisplayAFP.display | public static final StructureAlignmentJmol display(AFPChain afpChain,Group[] twistedGroups, Atom[] ca1, Atom[] ca2,List<Group> hetatms1, List<Group> hetatms2 ) throws StructureException {
"""
Note: ca2, hetatoms2 and nucleotides2 should not be rotated. This will be done here...
"""
List<Atom> twistedAs = new ArrayList<Atom>();
for ( Group g: twistedGroups){
if ( g == null )
continue;
if ( g.size() < 1)
continue;
Atom a = g.getAtom(0);
twistedAs.add(a);
}
Atom[] twistedAtoms = twistedAs.toArray(new Atom[twistedAs.size()]);
twistedAtoms = StructureTools.cloneAtomArray(twistedAtoms);
Atom[] arr1 = getAtomArray(ca1, hetatms1);
Atom[] arr2 = getAtomArray(twistedAtoms, hetatms2);
//
//if ( hetatms2.size() > 0)
// System.out.println("atom after:" + hetatms2.get(0).getAtom(0));
//if ( hetatms2.size() > 0)
// System.out.println("atom after:" + hetatms2.get(0).getAtom(0));
String title = afpChain.getAlgorithmName() + " V." +afpChain.getVersion() + " : " + afpChain.getName1() + " vs. " + afpChain.getName2();
//System.out.println(artificial.toPDB());
StructureAlignmentJmol jmol = new StructureAlignmentJmol(afpChain,arr1,arr2);
//jmol.setStructure(artificial);
System.out.format("CA2[0]=(%.2f,%.2f,%.2f)%n", arr2[0].getX(), arr2[0].getY(), arr2[0].getZ());
//jmol.setTitle("Structure Alignment: " + afpChain.getName1() + " vs. " + afpChain.getName2());
jmol.setTitle(title);
return jmol;
} | java | public static final StructureAlignmentJmol display(AFPChain afpChain,Group[] twistedGroups, Atom[] ca1, Atom[] ca2,List<Group> hetatms1, List<Group> hetatms2 ) throws StructureException {
List<Atom> twistedAs = new ArrayList<Atom>();
for ( Group g: twistedGroups){
if ( g == null )
continue;
if ( g.size() < 1)
continue;
Atom a = g.getAtom(0);
twistedAs.add(a);
}
Atom[] twistedAtoms = twistedAs.toArray(new Atom[twistedAs.size()]);
twistedAtoms = StructureTools.cloneAtomArray(twistedAtoms);
Atom[] arr1 = getAtomArray(ca1, hetatms1);
Atom[] arr2 = getAtomArray(twistedAtoms, hetatms2);
//
//if ( hetatms2.size() > 0)
// System.out.println("atom after:" + hetatms2.get(0).getAtom(0));
//if ( hetatms2.size() > 0)
// System.out.println("atom after:" + hetatms2.get(0).getAtom(0));
String title = afpChain.getAlgorithmName() + " V." +afpChain.getVersion() + " : " + afpChain.getName1() + " vs. " + afpChain.getName2();
//System.out.println(artificial.toPDB());
StructureAlignmentJmol jmol = new StructureAlignmentJmol(afpChain,arr1,arr2);
//jmol.setStructure(artificial);
System.out.format("CA2[0]=(%.2f,%.2f,%.2f)%n", arr2[0].getX(), arr2[0].getY(), arr2[0].getZ());
//jmol.setTitle("Structure Alignment: " + afpChain.getName1() + " vs. " + afpChain.getName2());
jmol.setTitle(title);
return jmol;
} | [
"public",
"static",
"final",
"StructureAlignmentJmol",
"display",
"(",
"AFPChain",
"afpChain",
",",
"Group",
"[",
"]",
"twistedGroups",
",",
"Atom",
"[",
"]",
"ca1",
",",
"Atom",
"[",
"]",
"ca2",
",",
"List",
"<",
"Group",
">",
"hetatms1",
",",
"List",
"<",
"Group",
">",
"hetatms2",
")",
"throws",
"StructureException",
"{",
"List",
"<",
"Atom",
">",
"twistedAs",
"=",
"new",
"ArrayList",
"<",
"Atom",
">",
"(",
")",
";",
"for",
"(",
"Group",
"g",
":",
"twistedGroups",
")",
"{",
"if",
"(",
"g",
"==",
"null",
")",
"continue",
";",
"if",
"(",
"g",
".",
"size",
"(",
")",
"<",
"1",
")",
"continue",
";",
"Atom",
"a",
"=",
"g",
".",
"getAtom",
"(",
"0",
")",
";",
"twistedAs",
".",
"add",
"(",
"a",
")",
";",
"}",
"Atom",
"[",
"]",
"twistedAtoms",
"=",
"twistedAs",
".",
"toArray",
"(",
"new",
"Atom",
"[",
"twistedAs",
".",
"size",
"(",
")",
"]",
")",
";",
"twistedAtoms",
"=",
"StructureTools",
".",
"cloneAtomArray",
"(",
"twistedAtoms",
")",
";",
"Atom",
"[",
"]",
"arr1",
"=",
"getAtomArray",
"(",
"ca1",
",",
"hetatms1",
")",
";",
"Atom",
"[",
"]",
"arr2",
"=",
"getAtomArray",
"(",
"twistedAtoms",
",",
"hetatms2",
")",
";",
"//",
"//if ( hetatms2.size() > 0)",
"//\tSystem.out.println(\"atom after:\" + hetatms2.get(0).getAtom(0));",
"//if ( hetatms2.size() > 0)",
"//\tSystem.out.println(\"atom after:\" + hetatms2.get(0).getAtom(0));",
"String",
"title",
"=",
"afpChain",
".",
"getAlgorithmName",
"(",
")",
"+",
"\" V.\"",
"+",
"afpChain",
".",
"getVersion",
"(",
")",
"+",
"\" : \"",
"+",
"afpChain",
".",
"getName1",
"(",
")",
"+",
"\" vs. \"",
"+",
"afpChain",
".",
"getName2",
"(",
")",
";",
"//System.out.println(artificial.toPDB());",
"StructureAlignmentJmol",
"jmol",
"=",
"new",
"StructureAlignmentJmol",
"(",
"afpChain",
",",
"arr1",
",",
"arr2",
")",
";",
"//jmol.setStructure(artificial);",
"System",
".",
"out",
".",
"format",
"(",
"\"CA2[0]=(%.2f,%.2f,%.2f)%n\"",
",",
"arr2",
"[",
"0",
"]",
".",
"getX",
"(",
")",
",",
"arr2",
"[",
"0",
"]",
".",
"getY",
"(",
")",
",",
"arr2",
"[",
"0",
"]",
".",
"getZ",
"(",
")",
")",
";",
"//jmol.setTitle(\"Structure Alignment: \" + afpChain.getName1() + \" vs. \" + afpChain.getName2());",
"jmol",
".",
"setTitle",
"(",
"title",
")",
";",
"return",
"jmol",
";",
"}"
] | Note: ca2, hetatoms2 and nucleotides2 should not be rotated. This will be done here... | [
"Note",
":",
"ca2",
"hetatoms2",
"and",
"nucleotides2",
"should",
"not",
"be",
"rotated",
".",
"This",
"will",
"be",
"done",
"here",
"..."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DisplayAFP.java#L437-L477 |
phax/ph-commons | ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java | XMLEmitter.onText | public void onText (@Nullable final String sText, final boolean bEscape) {
"""
Text node.
@param sText
The contained text
@param bEscape
If <code>true</code> the text should be XML masked (the default),
<code>false</code> if not. The <code>false</code> case is especially
interesting for HTML inline JS and CSS code.
"""
if (bEscape)
_appendMasked (EXMLCharMode.TEXT, sText);
else
_append (sText);
} | java | public void onText (@Nullable final String sText, final boolean bEscape)
{
if (bEscape)
_appendMasked (EXMLCharMode.TEXT, sText);
else
_append (sText);
} | [
"public",
"void",
"onText",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"final",
"boolean",
"bEscape",
")",
"{",
"if",
"(",
"bEscape",
")",
"_appendMasked",
"(",
"EXMLCharMode",
".",
"TEXT",
",",
"sText",
")",
";",
"else",
"_append",
"(",
"sText",
")",
";",
"}"
] | Text node.
@param sText
The contained text
@param bEscape
If <code>true</code> the text should be XML masked (the default),
<code>false</code> if not. The <code>false</code> case is especially
interesting for HTML inline JS and CSS code. | [
"Text",
"node",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java#L478-L484 |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/groupschart/GroupsPieChart.java | GroupsPieChart.setChartState | public void setChartState(final List<Long> groupTargetCounts, final Long totalTargetsCount) {
"""
Updates the state of the chart
@param groupTargetCounts
list of target counts
@param totalTargetsCount
total count of targets that are represented by the pie
"""
getState().setGroupTargetCounts(groupTargetCounts);
getState().setTotalTargetCount(totalTargetsCount);
markAsDirty();
} | java | public void setChartState(final List<Long> groupTargetCounts, final Long totalTargetsCount) {
getState().setGroupTargetCounts(groupTargetCounts);
getState().setTotalTargetCount(totalTargetsCount);
markAsDirty();
} | [
"public",
"void",
"setChartState",
"(",
"final",
"List",
"<",
"Long",
">",
"groupTargetCounts",
",",
"final",
"Long",
"totalTargetsCount",
")",
"{",
"getState",
"(",
")",
".",
"setGroupTargetCounts",
"(",
"groupTargetCounts",
")",
";",
"getState",
"(",
")",
".",
"setTotalTargetCount",
"(",
"totalTargetsCount",
")",
";",
"markAsDirty",
"(",
")",
";",
"}"
] | Updates the state of the chart
@param groupTargetCounts
list of target counts
@param totalTargetsCount
total count of targets that are represented by the pie | [
"Updates",
"the",
"state",
"of",
"the",
"chart"
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/groupschart/GroupsPieChart.java#L32-L36 |
apereo/cas | core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/principal/resolvers/PersonDirectoryPrincipalResolver.java | PersonDirectoryPrincipalResolver.extractPrincipalId | protected String extractPrincipalId(final Credential credential, final Optional<Principal> currentPrincipal) {
"""
Extracts the id of the user from the provided credential. This method should be overridden by subclasses to
achieve more sophisticated strategies for producing a principal ID from a credential.
@param credential the credential provided by the user.
@param currentPrincipal the current principal
@return the username, or null if it could not be resolved.
"""
LOGGER.debug("Extracting credential id based on existing credential [{}]", credential);
val id = credential.getId();
if (currentPrincipal != null && currentPrincipal.isPresent()) {
val principal = currentPrincipal.get();
LOGGER.debug("Principal is currently resolved as [{}]", principal);
if (useCurrentPrincipalId) {
LOGGER.debug("Using the existing resolved principal id [{}]", principal.getId());
return principal.getId();
} else {
LOGGER.debug("CAS will NOT be using the identifier from the resolved principal [{}] as it's not "
+ "configured to use the currently-resolved principal id and will fall back onto using the identifier "
+ "for the credential, that is [{}], for principal resolution", principal, id);
}
} else {
LOGGER.debug("No principal is currently resolved and available. Falling back onto using the identifier "
+ " for the credential, that is [{}], for principal resolution", id);
}
LOGGER.debug("Extracted principal id [{}]", id);
return id;
} | java | protected String extractPrincipalId(final Credential credential, final Optional<Principal> currentPrincipal) {
LOGGER.debug("Extracting credential id based on existing credential [{}]", credential);
val id = credential.getId();
if (currentPrincipal != null && currentPrincipal.isPresent()) {
val principal = currentPrincipal.get();
LOGGER.debug("Principal is currently resolved as [{}]", principal);
if (useCurrentPrincipalId) {
LOGGER.debug("Using the existing resolved principal id [{}]", principal.getId());
return principal.getId();
} else {
LOGGER.debug("CAS will NOT be using the identifier from the resolved principal [{}] as it's not "
+ "configured to use the currently-resolved principal id and will fall back onto using the identifier "
+ "for the credential, that is [{}], for principal resolution", principal, id);
}
} else {
LOGGER.debug("No principal is currently resolved and available. Falling back onto using the identifier "
+ " for the credential, that is [{}], for principal resolution", id);
}
LOGGER.debug("Extracted principal id [{}]", id);
return id;
} | [
"protected",
"String",
"extractPrincipalId",
"(",
"final",
"Credential",
"credential",
",",
"final",
"Optional",
"<",
"Principal",
">",
"currentPrincipal",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Extracting credential id based on existing credential [{}]\"",
",",
"credential",
")",
";",
"val",
"id",
"=",
"credential",
".",
"getId",
"(",
")",
";",
"if",
"(",
"currentPrincipal",
"!=",
"null",
"&&",
"currentPrincipal",
".",
"isPresent",
"(",
")",
")",
"{",
"val",
"principal",
"=",
"currentPrincipal",
".",
"get",
"(",
")",
";",
"LOGGER",
".",
"debug",
"(",
"\"Principal is currently resolved as [{}]\"",
",",
"principal",
")",
";",
"if",
"(",
"useCurrentPrincipalId",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Using the existing resolved principal id [{}]\"",
",",
"principal",
".",
"getId",
"(",
")",
")",
";",
"return",
"principal",
".",
"getId",
"(",
")",
";",
"}",
"else",
"{",
"LOGGER",
".",
"debug",
"(",
"\"CAS will NOT be using the identifier from the resolved principal [{}] as it's not \"",
"+",
"\"configured to use the currently-resolved principal id and will fall back onto using the identifier \"",
"+",
"\"for the credential, that is [{}], for principal resolution\"",
",",
"principal",
",",
"id",
")",
";",
"}",
"}",
"else",
"{",
"LOGGER",
".",
"debug",
"(",
"\"No principal is currently resolved and available. Falling back onto using the identifier \"",
"+",
"\" for the credential, that is [{}], for principal resolution\"",
",",
"id",
")",
";",
"}",
"LOGGER",
".",
"debug",
"(",
"\"Extracted principal id [{}]\"",
",",
"id",
")",
";",
"return",
"id",
";",
"}"
] | Extracts the id of the user from the provided credential. This method should be overridden by subclasses to
achieve more sophisticated strategies for producing a principal ID from a credential.
@param credential the credential provided by the user.
@param currentPrincipal the current principal
@return the username, or null if it could not be resolved. | [
"Extracts",
"the",
"id",
"of",
"the",
"user",
"from",
"the",
"provided",
"credential",
".",
"This",
"method",
"should",
"be",
"overridden",
"by",
"subclasses",
"to",
"achieve",
"more",
"sophisticated",
"strategies",
"for",
"producing",
"a",
"principal",
"ID",
"from",
"a",
"credential",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/principal/resolvers/PersonDirectoryPrincipalResolver.java#L262-L282 |
hageldave/ImagingKit | ImagingKit_Core/src/main/java/hageldave/imagingkit/core/io/ImageLoader.java | ImageLoader.loadImage | public static BufferedImage loadImage(String fileName, int imageType) {
"""
Tries to load Image from file and converts it to the
desired image type if needed. <br>
See {@link BufferedImage#BufferedImage(int, int, int)} for details on
the available image types.
@param fileName path to the image file
@param imageType of the resulting BufferedImage
@return loaded Image.
@throws ImageLoaderException if no image could be loaded from the file.
@since 1.0
"""
BufferedImage img = loadImage(fileName);
if(img.getType() != imageType){
img = BufferedImageFactory.get(img, imageType);
}
return img;
} | java | public static BufferedImage loadImage(String fileName, int imageType){
BufferedImage img = loadImage(fileName);
if(img.getType() != imageType){
img = BufferedImageFactory.get(img, imageType);
}
return img;
} | [
"public",
"static",
"BufferedImage",
"loadImage",
"(",
"String",
"fileName",
",",
"int",
"imageType",
")",
"{",
"BufferedImage",
"img",
"=",
"loadImage",
"(",
"fileName",
")",
";",
"if",
"(",
"img",
".",
"getType",
"(",
")",
"!=",
"imageType",
")",
"{",
"img",
"=",
"BufferedImageFactory",
".",
"get",
"(",
"img",
",",
"imageType",
")",
";",
"}",
"return",
"img",
";",
"}"
] | Tries to load Image from file and converts it to the
desired image type if needed. <br>
See {@link BufferedImage#BufferedImage(int, int, int)} for details on
the available image types.
@param fileName path to the image file
@param imageType of the resulting BufferedImage
@return loaded Image.
@throws ImageLoaderException if no image could be loaded from the file.
@since 1.0 | [
"Tries",
"to",
"load",
"Image",
"from",
"file",
"and",
"converts",
"it",
"to",
"the",
"desired",
"image",
"type",
"if",
"needed",
".",
"<br",
">",
"See",
"{",
"@link",
"BufferedImage#BufferedImage",
"(",
"int",
"int",
"int",
")",
"}",
"for",
"details",
"on",
"the",
"available",
"image",
"types",
"."
] | train | https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/io/ImageLoader.java#L143-L149 |
phax/ph-web | ph-web/src/main/java/com/helger/web/fileupload/parse/DiskFileItem.java | DiskFileItem.getTempFile | @Nonnull
protected File getTempFile () {
"""
Creates and returns a {@link File} representing a uniquely named temporary
file in the configured repository path. The lifetime of the file is tied to
the lifetime of the <code>FileItem</code> instance; the file will be
deleted when the instance is garbage collected.
@return The {@link File} to be used for temporary storage.
"""
if (m_aTempFile == null)
{
// If you manage to get more than 100 million of ids, you'll
// start getting ids longer than 8 characters.
final String sUniqueID = StringHelper.getLeadingZero (s_aTempFileCounter.getAndIncrement (), 8);
final String sTempFileName = "upload_" + UID + "_" + sUniqueID + ".tmp";
m_aTempFile = new File (m_aTempDir, sTempFileName);
}
return m_aTempFile;
} | java | @Nonnull
protected File getTempFile ()
{
if (m_aTempFile == null)
{
// If you manage to get more than 100 million of ids, you'll
// start getting ids longer than 8 characters.
final String sUniqueID = StringHelper.getLeadingZero (s_aTempFileCounter.getAndIncrement (), 8);
final String sTempFileName = "upload_" + UID + "_" + sUniqueID + ".tmp";
m_aTempFile = new File (m_aTempDir, sTempFileName);
}
return m_aTempFile;
} | [
"@",
"Nonnull",
"protected",
"File",
"getTempFile",
"(",
")",
"{",
"if",
"(",
"m_aTempFile",
"==",
"null",
")",
"{",
"// If you manage to get more than 100 million of ids, you'll",
"// start getting ids longer than 8 characters.",
"final",
"String",
"sUniqueID",
"=",
"StringHelper",
".",
"getLeadingZero",
"(",
"s_aTempFileCounter",
".",
"getAndIncrement",
"(",
")",
",",
"8",
")",
";",
"final",
"String",
"sTempFileName",
"=",
"\"upload_\"",
"+",
"UID",
"+",
"\"_\"",
"+",
"sUniqueID",
"+",
"\".tmp\"",
";",
"m_aTempFile",
"=",
"new",
"File",
"(",
"m_aTempDir",
",",
"sTempFileName",
")",
";",
"}",
"return",
"m_aTempFile",
";",
"}"
] | Creates and returns a {@link File} representing a uniquely named temporary
file in the configured repository path. The lifetime of the file is tied to
the lifetime of the <code>FileItem</code> instance; the file will be
deleted when the instance is garbage collected.
@return The {@link File} to be used for temporary storage. | [
"Creates",
"and",
"returns",
"a",
"{",
"@link",
"File",
"}",
"representing",
"a",
"uniquely",
"named",
"temporary",
"file",
"in",
"the",
"configured",
"repository",
"path",
".",
"The",
"lifetime",
"of",
"the",
"file",
"is",
"tied",
"to",
"the",
"lifetime",
"of",
"the",
"<code",
">",
"FileItem<",
"/",
"code",
">",
"instance",
";",
"the",
"file",
"will",
"be",
"deleted",
"when",
"the",
"instance",
"is",
"garbage",
"collected",
"."
] | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-web/src/main/java/com/helger/web/fileupload/parse/DiskFileItem.java#L303-L315 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-app/src/main/java/im/actor/tour/VerticalViewPager.java | VerticalViewPager.setPageTransformer | public void setPageTransformer(boolean reverseDrawingOrder, ViewPager.PageTransformer transformer) {
"""
Set a {@link ViewPager.PageTransformer} that will be called for each attached page whenever
the scroll position is changed. This allows the application to apply custom property
transformations to each page, overriding the default sliding look and feel.
<p/>
<p><em>Note:</em> Prior to Android 3.0 the property animation APIs did not exist.
As a result, setting a PageTransformer prior to Android 3.0 (API 11) will have no effect.</p>
@param reverseDrawingOrder true if the supplied PageTransformer requires page views
to be drawn from last to first instead of first to last.
@param transformer PageTransformer that will modify each page's animation properties
"""
if (Build.VERSION.SDK_INT >= 11) {
final boolean hasTransformer = transformer != null;
final boolean needsPopulate = hasTransformer != (mPageTransformer != null);
mPageTransformer = transformer;
setChildrenDrawingOrderEnabledCompat(hasTransformer);
if (hasTransformer) {
mDrawingOrder = reverseDrawingOrder ? DRAW_ORDER_REVERSE : DRAW_ORDER_FORWARD;
} else {
mDrawingOrder = DRAW_ORDER_DEFAULT;
}
if (needsPopulate) populate();
}
} | java | public void setPageTransformer(boolean reverseDrawingOrder, ViewPager.PageTransformer transformer) {
if (Build.VERSION.SDK_INT >= 11) {
final boolean hasTransformer = transformer != null;
final boolean needsPopulate = hasTransformer != (mPageTransformer != null);
mPageTransformer = transformer;
setChildrenDrawingOrderEnabledCompat(hasTransformer);
if (hasTransformer) {
mDrawingOrder = reverseDrawingOrder ? DRAW_ORDER_REVERSE : DRAW_ORDER_FORWARD;
} else {
mDrawingOrder = DRAW_ORDER_DEFAULT;
}
if (needsPopulate) populate();
}
} | [
"public",
"void",
"setPageTransformer",
"(",
"boolean",
"reverseDrawingOrder",
",",
"ViewPager",
".",
"PageTransformer",
"transformer",
")",
"{",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
">=",
"11",
")",
"{",
"final",
"boolean",
"hasTransformer",
"=",
"transformer",
"!=",
"null",
";",
"final",
"boolean",
"needsPopulate",
"=",
"hasTransformer",
"!=",
"(",
"mPageTransformer",
"!=",
"null",
")",
";",
"mPageTransformer",
"=",
"transformer",
";",
"setChildrenDrawingOrderEnabledCompat",
"(",
"hasTransformer",
")",
";",
"if",
"(",
"hasTransformer",
")",
"{",
"mDrawingOrder",
"=",
"reverseDrawingOrder",
"?",
"DRAW_ORDER_REVERSE",
":",
"DRAW_ORDER_FORWARD",
";",
"}",
"else",
"{",
"mDrawingOrder",
"=",
"DRAW_ORDER_DEFAULT",
";",
"}",
"if",
"(",
"needsPopulate",
")",
"populate",
"(",
")",
";",
"}",
"}"
] | Set a {@link ViewPager.PageTransformer} that will be called for each attached page whenever
the scroll position is changed. This allows the application to apply custom property
transformations to each page, overriding the default sliding look and feel.
<p/>
<p><em>Note:</em> Prior to Android 3.0 the property animation APIs did not exist.
As a result, setting a PageTransformer prior to Android 3.0 (API 11) will have no effect.</p>
@param reverseDrawingOrder true if the supplied PageTransformer requires page views
to be drawn from last to first instead of first to last.
@param transformer PageTransformer that will modify each page's animation properties | [
"Set",
"a",
"{",
"@link",
"ViewPager",
".",
"PageTransformer",
"}",
"that",
"will",
"be",
"called",
"for",
"each",
"attached",
"page",
"whenever",
"the",
"scroll",
"position",
"is",
"changed",
".",
"This",
"allows",
"the",
"application",
"to",
"apply",
"custom",
"property",
"transformations",
"to",
"each",
"page",
"overriding",
"the",
"default",
"sliding",
"look",
"and",
"feel",
".",
"<p",
"/",
">",
"<p",
">",
"<em",
">",
"Note",
":",
"<",
"/",
"em",
">",
"Prior",
"to",
"Android",
"3",
".",
"0",
"the",
"property",
"animation",
"APIs",
"did",
"not",
"exist",
".",
"As",
"a",
"result",
"setting",
"a",
"PageTransformer",
"prior",
"to",
"Android",
"3",
".",
"0",
"(",
"API",
"11",
")",
"will",
"have",
"no",
"effect",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-app/src/main/java/im/actor/tour/VerticalViewPager.java#L472-L485 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/storage/BaseGraph.java | BaseGraph.initNodeRefs | void initNodeRefs(long oldCapacity, long newCapacity) {
"""
Initializes the node area with the empty edge value and default additional value.
"""
for (long pointer = oldCapacity + N_EDGE_REF; pointer < newCapacity; pointer += nodeEntryBytes) {
nodes.setInt(pointer, EdgeIterator.NO_EDGE);
}
if (extStorage.isRequireNodeField()) {
for (long pointer = oldCapacity + N_ADDITIONAL; pointer < newCapacity; pointer += nodeEntryBytes) {
nodes.setInt(pointer, extStorage.getDefaultNodeFieldValue());
}
}
} | java | void initNodeRefs(long oldCapacity, long newCapacity) {
for (long pointer = oldCapacity + N_EDGE_REF; pointer < newCapacity; pointer += nodeEntryBytes) {
nodes.setInt(pointer, EdgeIterator.NO_EDGE);
}
if (extStorage.isRequireNodeField()) {
for (long pointer = oldCapacity + N_ADDITIONAL; pointer < newCapacity; pointer += nodeEntryBytes) {
nodes.setInt(pointer, extStorage.getDefaultNodeFieldValue());
}
}
} | [
"void",
"initNodeRefs",
"(",
"long",
"oldCapacity",
",",
"long",
"newCapacity",
")",
"{",
"for",
"(",
"long",
"pointer",
"=",
"oldCapacity",
"+",
"N_EDGE_REF",
";",
"pointer",
"<",
"newCapacity",
";",
"pointer",
"+=",
"nodeEntryBytes",
")",
"{",
"nodes",
".",
"setInt",
"(",
"pointer",
",",
"EdgeIterator",
".",
"NO_EDGE",
")",
";",
"}",
"if",
"(",
"extStorage",
".",
"isRequireNodeField",
"(",
")",
")",
"{",
"for",
"(",
"long",
"pointer",
"=",
"oldCapacity",
"+",
"N_ADDITIONAL",
";",
"pointer",
"<",
"newCapacity",
";",
"pointer",
"+=",
"nodeEntryBytes",
")",
"{",
"nodes",
".",
"setInt",
"(",
"pointer",
",",
"extStorage",
".",
"getDefaultNodeFieldValue",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Initializes the node area with the empty edge value and default additional value. | [
"Initializes",
"the",
"node",
"area",
"with",
"the",
"empty",
"edge",
"value",
"and",
"default",
"additional",
"value",
"."
] | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/storage/BaseGraph.java#L258-L267 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.estimatePinhole | public static CameraPinhole estimatePinhole(Point2Transform2_F64 pixelToNorm , int width , int height ) {
"""
Given the transform from pixels to normalized image coordinates, create an approximate pinhole model
for this camera. Assumes (cx,cy) is the image center and that there is no skew.
@param pixelToNorm Pixel coordinates into normalized image coordinates
@param width Input image's width
@param height Input image's height
@return Approximate pinhole camera
"""
Point2D_F64 normA = new Point2D_F64();
Point2D_F64 normB = new Point2D_F64();
Vector3D_F64 vectorA = new Vector3D_F64();
Vector3D_F64 vectorB = new Vector3D_F64();
pixelToNorm.compute(0,height/2,normA);
pixelToNorm.compute(width,height/2,normB);
vectorA.set(normA.x,normA.y,1);
vectorB.set(normB.x,normB.y,1);
double hfov = UtilVector3D_F64.acute(vectorA,vectorB);
pixelToNorm.compute(width/2,0,normA);
pixelToNorm.compute(width/2,height,normB);
vectorA.set(normA.x,normA.y,1);
vectorB.set(normB.x,normB.y,1);
double vfov = UtilVector3D_F64.acute(vectorA,vectorB);
CameraPinhole intrinsic = new CameraPinhole();
intrinsic.width = width;
intrinsic.height = height;
intrinsic.skew = 0;
intrinsic.cx = width/2;
intrinsic.cy = height/2;
intrinsic.fx = intrinsic.cx/Math.tan(hfov/2);
intrinsic.fy = intrinsic.cy/Math.tan(vfov/2);
return intrinsic;
} | java | public static CameraPinhole estimatePinhole(Point2Transform2_F64 pixelToNorm , int width , int height ) {
Point2D_F64 normA = new Point2D_F64();
Point2D_F64 normB = new Point2D_F64();
Vector3D_F64 vectorA = new Vector3D_F64();
Vector3D_F64 vectorB = new Vector3D_F64();
pixelToNorm.compute(0,height/2,normA);
pixelToNorm.compute(width,height/2,normB);
vectorA.set(normA.x,normA.y,1);
vectorB.set(normB.x,normB.y,1);
double hfov = UtilVector3D_F64.acute(vectorA,vectorB);
pixelToNorm.compute(width/2,0,normA);
pixelToNorm.compute(width/2,height,normB);
vectorA.set(normA.x,normA.y,1);
vectorB.set(normB.x,normB.y,1);
double vfov = UtilVector3D_F64.acute(vectorA,vectorB);
CameraPinhole intrinsic = new CameraPinhole();
intrinsic.width = width;
intrinsic.height = height;
intrinsic.skew = 0;
intrinsic.cx = width/2;
intrinsic.cy = height/2;
intrinsic.fx = intrinsic.cx/Math.tan(hfov/2);
intrinsic.fy = intrinsic.cy/Math.tan(vfov/2);
return intrinsic;
} | [
"public",
"static",
"CameraPinhole",
"estimatePinhole",
"(",
"Point2Transform2_F64",
"pixelToNorm",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"Point2D_F64",
"normA",
"=",
"new",
"Point2D_F64",
"(",
")",
";",
"Point2D_F64",
"normB",
"=",
"new",
"Point2D_F64",
"(",
")",
";",
"Vector3D_F64",
"vectorA",
"=",
"new",
"Vector3D_F64",
"(",
")",
";",
"Vector3D_F64",
"vectorB",
"=",
"new",
"Vector3D_F64",
"(",
")",
";",
"pixelToNorm",
".",
"compute",
"(",
"0",
",",
"height",
"/",
"2",
",",
"normA",
")",
";",
"pixelToNorm",
".",
"compute",
"(",
"width",
",",
"height",
"/",
"2",
",",
"normB",
")",
";",
"vectorA",
".",
"set",
"(",
"normA",
".",
"x",
",",
"normA",
".",
"y",
",",
"1",
")",
";",
"vectorB",
".",
"set",
"(",
"normB",
".",
"x",
",",
"normB",
".",
"y",
",",
"1",
")",
";",
"double",
"hfov",
"=",
"UtilVector3D_F64",
".",
"acute",
"(",
"vectorA",
",",
"vectorB",
")",
";",
"pixelToNorm",
".",
"compute",
"(",
"width",
"/",
"2",
",",
"0",
",",
"normA",
")",
";",
"pixelToNorm",
".",
"compute",
"(",
"width",
"/",
"2",
",",
"height",
",",
"normB",
")",
";",
"vectorA",
".",
"set",
"(",
"normA",
".",
"x",
",",
"normA",
".",
"y",
",",
"1",
")",
";",
"vectorB",
".",
"set",
"(",
"normB",
".",
"x",
",",
"normB",
".",
"y",
",",
"1",
")",
";",
"double",
"vfov",
"=",
"UtilVector3D_F64",
".",
"acute",
"(",
"vectorA",
",",
"vectorB",
")",
";",
"CameraPinhole",
"intrinsic",
"=",
"new",
"CameraPinhole",
"(",
")",
";",
"intrinsic",
".",
"width",
"=",
"width",
";",
"intrinsic",
".",
"height",
"=",
"height",
";",
"intrinsic",
".",
"skew",
"=",
"0",
";",
"intrinsic",
".",
"cx",
"=",
"width",
"/",
"2",
";",
"intrinsic",
".",
"cy",
"=",
"height",
"/",
"2",
";",
"intrinsic",
".",
"fx",
"=",
"intrinsic",
".",
"cx",
"/",
"Math",
".",
"tan",
"(",
"hfov",
"/",
"2",
")",
";",
"intrinsic",
".",
"fy",
"=",
"intrinsic",
".",
"cy",
"/",
"Math",
".",
"tan",
"(",
"vfov",
"/",
"2",
")",
";",
"return",
"intrinsic",
";",
"}"
] | Given the transform from pixels to normalized image coordinates, create an approximate pinhole model
for this camera. Assumes (cx,cy) is the image center and that there is no skew.
@param pixelToNorm Pixel coordinates into normalized image coordinates
@param width Input image's width
@param height Input image's height
@return Approximate pinhole camera | [
"Given",
"the",
"transform",
"from",
"pixels",
"to",
"normalized",
"image",
"coordinates",
"create",
"an",
"approximate",
"pinhole",
"model",
"for",
"this",
"camera",
".",
"Assumes",
"(",
"cx",
"cy",
")",
"is",
"the",
"image",
"center",
"and",
"that",
"there",
"is",
"no",
"skew",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L325-L354 |
apereo/cas | support/cas-server-support-logging-config-splunk/src/main/java/org/apereo/cas/logging/SplunkAppender.java | SplunkAppender.build | @PluginFactory
public static SplunkAppender build(@PluginAttribute("name") final String name,
@PluginElement("AppenderRef") final AppenderRef appenderRef,
@PluginConfiguration final Configuration config) {
"""
Create appender.
@param name the name
@param appenderRef the appender ref
@param config the config
@return the appender
"""
return new SplunkAppender(name, config, appenderRef);
} | java | @PluginFactory
public static SplunkAppender build(@PluginAttribute("name") final String name,
@PluginElement("AppenderRef") final AppenderRef appenderRef,
@PluginConfiguration final Configuration config) {
return new SplunkAppender(name, config, appenderRef);
} | [
"@",
"PluginFactory",
"public",
"static",
"SplunkAppender",
"build",
"(",
"@",
"PluginAttribute",
"(",
"\"name\"",
")",
"final",
"String",
"name",
",",
"@",
"PluginElement",
"(",
"\"AppenderRef\"",
")",
"final",
"AppenderRef",
"appenderRef",
",",
"@",
"PluginConfiguration",
"final",
"Configuration",
"config",
")",
"{",
"return",
"new",
"SplunkAppender",
"(",
"name",
",",
"config",
",",
"appenderRef",
")",
";",
"}"
] | Create appender.
@param name the name
@param appenderRef the appender ref
@param config the config
@return the appender | [
"Create",
"appender",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-logging-config-splunk/src/main/java/org/apereo/cas/logging/SplunkAppender.java#L45-L50 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentSettingsInner.java | EnvironmentSettingsInner.stop | public void stop(String resourceGroupName, String labAccountName, String labName, String environmentSettingName) {
"""
Starts a template by starting all resources inside the template. This operation can take a while to complete.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param environmentSettingName The name of the environment Setting.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
"""
stopWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName).toBlocking().last().body();
} | java | public void stop(String resourceGroupName, String labAccountName, String labName, String environmentSettingName) {
stopWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName).toBlocking().last().body();
} | [
"public",
"void",
"stop",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"String",
"labName",
",",
"String",
"environmentSettingName",
")",
"{",
"stopWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"labAccountName",
",",
"labName",
",",
"environmentSettingName",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Starts a template by starting all resources inside the template. This operation can take a while to complete.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param environmentSettingName The name of the environment Setting.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Starts",
"a",
"template",
"by",
"starting",
"all",
"resources",
"inside",
"the",
"template",
".",
"This",
"operation",
"can",
"take",
"a",
"while",
"to",
"complete",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentSettingsInner.java#L1585-L1587 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.setGMTOffsetPattern | public TimeZoneFormat setGMTOffsetPattern(GMTOffsetPatternType type, String pattern) {
"""
Sets the offset pattern for the given offset type.
@param type the offset pattern.
@param pattern the pattern string.
@return this object.
@throws IllegalArgumentException when the pattern string does not have required time field letters.
@throws UnsupportedOperationException when this object is frozen.
@see #getGMTOffsetPattern(GMTOffsetPatternType)
"""
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify frozen object");
}
if (pattern == null) {
throw new NullPointerException("Null GMT offset pattern");
}
Object[] parsedItems = parseOffsetPattern(pattern, type.required());
_gmtOffsetPatterns[type.ordinal()] = pattern;
_gmtOffsetPatternItems[type.ordinal()] = parsedItems;
checkAbuttingHoursAndMinutes();
return this;
} | java | public TimeZoneFormat setGMTOffsetPattern(GMTOffsetPatternType type, String pattern) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify frozen object");
}
if (pattern == null) {
throw new NullPointerException("Null GMT offset pattern");
}
Object[] parsedItems = parseOffsetPattern(pattern, type.required());
_gmtOffsetPatterns[type.ordinal()] = pattern;
_gmtOffsetPatternItems[type.ordinal()] = parsedItems;
checkAbuttingHoursAndMinutes();
return this;
} | [
"public",
"TimeZoneFormat",
"setGMTOffsetPattern",
"(",
"GMTOffsetPatternType",
"type",
",",
"String",
"pattern",
")",
"{",
"if",
"(",
"isFrozen",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Attempt to modify frozen object\"",
")",
";",
"}",
"if",
"(",
"pattern",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Null GMT offset pattern\"",
")",
";",
"}",
"Object",
"[",
"]",
"parsedItems",
"=",
"parseOffsetPattern",
"(",
"pattern",
",",
"type",
".",
"required",
"(",
")",
")",
";",
"_gmtOffsetPatterns",
"[",
"type",
".",
"ordinal",
"(",
")",
"]",
"=",
"pattern",
";",
"_gmtOffsetPatternItems",
"[",
"type",
".",
"ordinal",
"(",
")",
"]",
"=",
"parsedItems",
";",
"checkAbuttingHoursAndMinutes",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Sets the offset pattern for the given offset type.
@param type the offset pattern.
@param pattern the pattern string.
@return this object.
@throws IllegalArgumentException when the pattern string does not have required time field letters.
@throws UnsupportedOperationException when this object is frozen.
@see #getGMTOffsetPattern(GMTOffsetPatternType) | [
"Sets",
"the",
"offset",
"pattern",
"for",
"the",
"given",
"offset",
"type",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L584-L599 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigClient.java | ConfigClient.createExclusion | public final LogExclusion createExclusion(String parent, LogExclusion exclusion) {
"""
Creates a new exclusion in a specified parent resource. Only log entries belonging to that
resource can be excluded. You can have up to 10 exclusions in a resource.
<p>Sample code:
<pre><code>
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = ProjectName.of("[PROJECT]");
LogExclusion exclusion = LogExclusion.newBuilder().build();
LogExclusion response = configClient.createExclusion(parent.toString(), exclusion);
}
</code></pre>
@param parent Required. The parent resource in which to create the exclusion:
<p>"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
"billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"
<p>Examples: `"projects/my-logging-project"`, `"organizations/123456789"`.
@param exclusion Required. The new exclusion, whose `name` parameter is an exclusion name that
is not already used in the parent resource.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
"""
CreateExclusionRequest request =
CreateExclusionRequest.newBuilder().setParent(parent).setExclusion(exclusion).build();
return createExclusion(request);
} | java | public final LogExclusion createExclusion(String parent, LogExclusion exclusion) {
CreateExclusionRequest request =
CreateExclusionRequest.newBuilder().setParent(parent).setExclusion(exclusion).build();
return createExclusion(request);
} | [
"public",
"final",
"LogExclusion",
"createExclusion",
"(",
"String",
"parent",
",",
"LogExclusion",
"exclusion",
")",
"{",
"CreateExclusionRequest",
"request",
"=",
"CreateExclusionRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
")",
".",
"setExclusion",
"(",
"exclusion",
")",
".",
"build",
"(",
")",
";",
"return",
"createExclusion",
"(",
"request",
")",
";",
"}"
] | Creates a new exclusion in a specified parent resource. Only log entries belonging to that
resource can be excluded. You can have up to 10 exclusions in a resource.
<p>Sample code:
<pre><code>
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = ProjectName.of("[PROJECT]");
LogExclusion exclusion = LogExclusion.newBuilder().build();
LogExclusion response = configClient.createExclusion(parent.toString(), exclusion);
}
</code></pre>
@param parent Required. The parent resource in which to create the exclusion:
<p>"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
"billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"
<p>Examples: `"projects/my-logging-project"`, `"organizations/123456789"`.
@param exclusion Required. The new exclusion, whose `name` parameter is an exclusion name that
is not already used in the parent resource.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"a",
"new",
"exclusion",
"in",
"a",
"specified",
"parent",
"resource",
".",
"Only",
"log",
"entries",
"belonging",
"to",
"that",
"resource",
"can",
"be",
"excluded",
".",
"You",
"can",
"have",
"up",
"to",
"10",
"exclusions",
"in",
"a",
"resource",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigClient.java#L1147-L1152 |
inferred/FreeBuilder | src/main/java/org/inferred/freebuilder/processor/Analyser.java | Analyser.tryFindBuilder | private Optional<DeclaredType> tryFindBuilder(
final QualifiedName superclass, TypeElement valueType) {
"""
Looks for a nested type in {@code valueType} called Builder, and verifies it extends the
autogenerated {@code superclass}.
<p>If the value type is generic, the builder type must match, and the returned DeclaredType
will be parameterized with the type variables from the <b>value type</b>, not the builder.
(This makes type checking massively easier.)
<p>Issues an error if the wrong type is being subclassed—a typical copy-and-paste error
when renaming an existing @FreeBuilder type, or using one as a template.
"""
TypeElement builderType = typesIn(valueType.getEnclosedElements())
.stream()
.filter(element -> element.getSimpleName().contentEquals(USER_BUILDER_NAME))
.findAny()
.orElse(null);
if (builderType == null) {
if (valueType.getKind() == INTERFACE) {
messager.printMessage(
NOTE,
"Add \"class Builder extends "
+ superclass.getSimpleName()
+ " {}\" to your interface to enable the FreeBuilder API",
valueType);
} else {
messager.printMessage(
NOTE,
"Add \"public static class Builder extends "
+ superclass.getSimpleName()
+ " {}\" to your class to enable the FreeBuilder API",
valueType);
}
return Optional.empty();
}
boolean extendsSuperclass =
new IsSubclassOfGeneratedTypeVisitor(superclass, valueType.getTypeParameters())
.visit(builderType.getSuperclass());
if (!extendsSuperclass) {
messager.printMessage(
ERROR,
"Builder extends the wrong type (should be " + superclass.getSimpleName() + ")",
builderType);
return Optional.empty();
}
if (builderType.getTypeParameters().size() != valueType.getTypeParameters().size()) {
if (builderType.getTypeParameters().isEmpty()) {
messager.printMessage(ERROR, "Builder must be generic", builderType);
} else {
messager.printMessage(ERROR, "Builder has the wrong type parameters", builderType);
}
return Optional.empty();
}
DeclaredType declaredValueType = (DeclaredType) valueType.asType();
DeclaredType declaredBuilderType = types.getDeclaredType(
builderType, declaredValueType.getTypeArguments().toArray(new TypeMirror[0]));
return Optional.of(declaredBuilderType);
} | java | private Optional<DeclaredType> tryFindBuilder(
final QualifiedName superclass, TypeElement valueType) {
TypeElement builderType = typesIn(valueType.getEnclosedElements())
.stream()
.filter(element -> element.getSimpleName().contentEquals(USER_BUILDER_NAME))
.findAny()
.orElse(null);
if (builderType == null) {
if (valueType.getKind() == INTERFACE) {
messager.printMessage(
NOTE,
"Add \"class Builder extends "
+ superclass.getSimpleName()
+ " {}\" to your interface to enable the FreeBuilder API",
valueType);
} else {
messager.printMessage(
NOTE,
"Add \"public static class Builder extends "
+ superclass.getSimpleName()
+ " {}\" to your class to enable the FreeBuilder API",
valueType);
}
return Optional.empty();
}
boolean extendsSuperclass =
new IsSubclassOfGeneratedTypeVisitor(superclass, valueType.getTypeParameters())
.visit(builderType.getSuperclass());
if (!extendsSuperclass) {
messager.printMessage(
ERROR,
"Builder extends the wrong type (should be " + superclass.getSimpleName() + ")",
builderType);
return Optional.empty();
}
if (builderType.getTypeParameters().size() != valueType.getTypeParameters().size()) {
if (builderType.getTypeParameters().isEmpty()) {
messager.printMessage(ERROR, "Builder must be generic", builderType);
} else {
messager.printMessage(ERROR, "Builder has the wrong type parameters", builderType);
}
return Optional.empty();
}
DeclaredType declaredValueType = (DeclaredType) valueType.asType();
DeclaredType declaredBuilderType = types.getDeclaredType(
builderType, declaredValueType.getTypeArguments().toArray(new TypeMirror[0]));
return Optional.of(declaredBuilderType);
} | [
"private",
"Optional",
"<",
"DeclaredType",
">",
"tryFindBuilder",
"(",
"final",
"QualifiedName",
"superclass",
",",
"TypeElement",
"valueType",
")",
"{",
"TypeElement",
"builderType",
"=",
"typesIn",
"(",
"valueType",
".",
"getEnclosedElements",
"(",
")",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"element",
"->",
"element",
".",
"getSimpleName",
"(",
")",
".",
"contentEquals",
"(",
"USER_BUILDER_NAME",
")",
")",
".",
"findAny",
"(",
")",
".",
"orElse",
"(",
"null",
")",
";",
"if",
"(",
"builderType",
"==",
"null",
")",
"{",
"if",
"(",
"valueType",
".",
"getKind",
"(",
")",
"==",
"INTERFACE",
")",
"{",
"messager",
".",
"printMessage",
"(",
"NOTE",
",",
"\"Add \\\"class Builder extends \"",
"+",
"superclass",
".",
"getSimpleName",
"(",
")",
"+",
"\" {}\\\" to your interface to enable the FreeBuilder API\"",
",",
"valueType",
")",
";",
"}",
"else",
"{",
"messager",
".",
"printMessage",
"(",
"NOTE",
",",
"\"Add \\\"public static class Builder extends \"",
"+",
"superclass",
".",
"getSimpleName",
"(",
")",
"+",
"\" {}\\\" to your class to enable the FreeBuilder API\"",
",",
"valueType",
")",
";",
"}",
"return",
"Optional",
".",
"empty",
"(",
")",
";",
"}",
"boolean",
"extendsSuperclass",
"=",
"new",
"IsSubclassOfGeneratedTypeVisitor",
"(",
"superclass",
",",
"valueType",
".",
"getTypeParameters",
"(",
")",
")",
".",
"visit",
"(",
"builderType",
".",
"getSuperclass",
"(",
")",
")",
";",
"if",
"(",
"!",
"extendsSuperclass",
")",
"{",
"messager",
".",
"printMessage",
"(",
"ERROR",
",",
"\"Builder extends the wrong type (should be \"",
"+",
"superclass",
".",
"getSimpleName",
"(",
")",
"+",
"\")\"",
",",
"builderType",
")",
";",
"return",
"Optional",
".",
"empty",
"(",
")",
";",
"}",
"if",
"(",
"builderType",
".",
"getTypeParameters",
"(",
")",
".",
"size",
"(",
")",
"!=",
"valueType",
".",
"getTypeParameters",
"(",
")",
".",
"size",
"(",
")",
")",
"{",
"if",
"(",
"builderType",
".",
"getTypeParameters",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"messager",
".",
"printMessage",
"(",
"ERROR",
",",
"\"Builder must be generic\"",
",",
"builderType",
")",
";",
"}",
"else",
"{",
"messager",
".",
"printMessage",
"(",
"ERROR",
",",
"\"Builder has the wrong type parameters\"",
",",
"builderType",
")",
";",
"}",
"return",
"Optional",
".",
"empty",
"(",
")",
";",
"}",
"DeclaredType",
"declaredValueType",
"=",
"(",
"DeclaredType",
")",
"valueType",
".",
"asType",
"(",
")",
";",
"DeclaredType",
"declaredBuilderType",
"=",
"types",
".",
"getDeclaredType",
"(",
"builderType",
",",
"declaredValueType",
".",
"getTypeArguments",
"(",
")",
".",
"toArray",
"(",
"new",
"TypeMirror",
"[",
"0",
"]",
")",
")",
";",
"return",
"Optional",
".",
"of",
"(",
"declaredBuilderType",
")",
";",
"}"
] | Looks for a nested type in {@code valueType} called Builder, and verifies it extends the
autogenerated {@code superclass}.
<p>If the value type is generic, the builder type must match, and the returned DeclaredType
will be parameterized with the type variables from the <b>value type</b>, not the builder.
(This makes type checking massively easier.)
<p>Issues an error if the wrong type is being subclassed—a typical copy-and-paste error
when renaming an existing @FreeBuilder type, or using one as a template. | [
"Looks",
"for",
"a",
"nested",
"type",
"in",
"{",
"@code",
"valueType",
"}",
"called",
"Builder",
"and",
"verifies",
"it",
"extends",
"the",
"autogenerated",
"{",
"@code",
"superclass",
"}",
"."
] | train | https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/Analyser.java#L332-L383 |
NoraUi/NoraUi | src/main/java/com/github/noraui/data/CommonDataProvider.java | CommonDataProvider.writeWarningResult | public void writeWarningResult(int line, String value) {
"""
Writes a warning result
@param line
The line number
@param value
The value
"""
logger.debug("Write Warning result => line:{} value:{}", line, value);
writeValue(resultColumnName, line, value);
} | java | public void writeWarningResult(int line, String value) {
logger.debug("Write Warning result => line:{} value:{}", line, value);
writeValue(resultColumnName, line, value);
} | [
"public",
"void",
"writeWarningResult",
"(",
"int",
"line",
",",
"String",
"value",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Write Warning result => line:{} value:{}\"",
",",
"line",
",",
"value",
")",
";",
"writeValue",
"(",
"resultColumnName",
",",
"line",
",",
"value",
")",
";",
"}"
] | Writes a warning result
@param line
The line number
@param value
The value | [
"Writes",
"a",
"warning",
"result"
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/data/CommonDataProvider.java#L167-L170 |
TheHortonMachine/hortonmachine | apps/src/main/java/org/hortonmachine/style/JFontChooser.java | JFontChooser.showDialog | public Font showDialog(Component component, String title) {
"""
Shows a modal font-chooser dialog and blocks until the
dialog is hidden. If the user presses the "OK" button, then
this method hides/disposes the dialog and returns the selected color.
If the user presses the "Cancel" button or closes the dialog without
pressing "OK", then this method hides/disposes the dialog and returns
<code>null</code>.
@param component the parent <code>Component</code> for the dialog
@param title the String containing the dialog's title
@return the selected font or <code>null</code> if the user opted out
@exception HeadlessException if GraphicsEnvironment.isHeadless()
returns true.
@see java.awt.GraphicsEnvironment#isHeadless
"""
FontTracker ok = new FontTracker(this);
JDialog dialog = createDialog(component, title, true, ok, null);
dialog.addWindowListener(new FontChooserDialog.Closer());
dialog.addComponentListener(new FontChooserDialog.DisposeOnClose());
dialog.setVisible(true); // blocks until user brings dialog down...
return ok.getFont();
} | java | public Font showDialog(Component component, String title) {
FontTracker ok = new FontTracker(this);
JDialog dialog = createDialog(component, title, true, ok, null);
dialog.addWindowListener(new FontChooserDialog.Closer());
dialog.addComponentListener(new FontChooserDialog.DisposeOnClose());
dialog.setVisible(true); // blocks until user brings dialog down...
return ok.getFont();
} | [
"public",
"Font",
"showDialog",
"(",
"Component",
"component",
",",
"String",
"title",
")",
"{",
"FontTracker",
"ok",
"=",
"new",
"FontTracker",
"(",
"this",
")",
";",
"JDialog",
"dialog",
"=",
"createDialog",
"(",
"component",
",",
"title",
",",
"true",
",",
"ok",
",",
"null",
")",
";",
"dialog",
".",
"addWindowListener",
"(",
"new",
"FontChooserDialog",
".",
"Closer",
"(",
")",
")",
";",
"dialog",
".",
"addComponentListener",
"(",
"new",
"FontChooserDialog",
".",
"DisposeOnClose",
"(",
")",
")",
";",
"dialog",
".",
"setVisible",
"(",
"true",
")",
";",
"// blocks until user brings dialog down...",
"return",
"ok",
".",
"getFont",
"(",
")",
";",
"}"
] | Shows a modal font-chooser dialog and blocks until the
dialog is hidden. If the user presses the "OK" button, then
this method hides/disposes the dialog and returns the selected color.
If the user presses the "Cancel" button or closes the dialog without
pressing "OK", then this method hides/disposes the dialog and returns
<code>null</code>.
@param component the parent <code>Component</code> for the dialog
@param title the String containing the dialog's title
@return the selected font or <code>null</code> if the user opted out
@exception HeadlessException if GraphicsEnvironment.isHeadless()
returns true.
@see java.awt.GraphicsEnvironment#isHeadless | [
"Shows",
"a",
"modal",
"font",
"-",
"chooser",
"dialog",
"and",
"blocks",
"until",
"the",
"dialog",
"is",
"hidden",
".",
"If",
"the",
"user",
"presses",
"the",
"OK",
"button",
"then",
"this",
"method",
"hides",
"/",
"disposes",
"the",
"dialog",
"and",
"returns",
"the",
"selected",
"color",
".",
"If",
"the",
"user",
"presses",
"the",
"Cancel",
"button",
"or",
"closes",
"the",
"dialog",
"without",
"pressing",
"OK",
"then",
"this",
"method",
"hides",
"/",
"disposes",
"the",
"dialog",
"and",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/org/hortonmachine/style/JFontChooser.java#L143-L153 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/snmp_user.java | snmp_user.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception {
"""
<pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre>
"""
snmp_user_responses result = (snmp_user_responses) service.get_payload_formatter().string_to_resource(snmp_user_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.snmp_user_response_array);
}
snmp_user[] result_snmp_user = new snmp_user[result.snmp_user_response_array.length];
for(int i = 0; i < result.snmp_user_response_array.length; i++)
{
result_snmp_user[i] = result.snmp_user_response_array[i].snmp_user[0];
}
return result_snmp_user;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
snmp_user_responses result = (snmp_user_responses) service.get_payload_formatter().string_to_resource(snmp_user_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.snmp_user_response_array);
}
snmp_user[] result_snmp_user = new snmp_user[result.snmp_user_response_array.length];
for(int i = 0; i < result.snmp_user_response_array.length; i++)
{
result_snmp_user[i] = result.snmp_user_response_array[i].snmp_user[0];
}
return result_snmp_user;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"snmp_user_responses",
"result",
"=",
"(",
"snmp_user_responses",
")",
"service",
".",
"get_payload_formatter",
"(",
")",
".",
"string_to_resource",
"(",
"snmp_user_responses",
".",
"class",
",",
"response",
")",
";",
"if",
"(",
"result",
".",
"errorcode",
"!=",
"0",
")",
"{",
"if",
"(",
"result",
".",
"errorcode",
"==",
"SESSION_NOT_EXISTS",
")",
"service",
".",
"clear_session",
"(",
")",
";",
"throw",
"new",
"nitro_exception",
"(",
"result",
".",
"message",
",",
"result",
".",
"errorcode",
",",
"(",
"base_response",
"[",
"]",
")",
"result",
".",
"snmp_user_response_array",
")",
";",
"}",
"snmp_user",
"[",
"]",
"result_snmp_user",
"=",
"new",
"snmp_user",
"[",
"result",
".",
"snmp_user_response_array",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"result",
".",
"snmp_user_response_array",
".",
"length",
";",
"i",
"++",
")",
"{",
"result_snmp_user",
"[",
"i",
"]",
"=",
"result",
".",
"snmp_user_response_array",
"[",
"i",
"]",
".",
"snmp_user",
"[",
"0",
"]",
";",
"}",
"return",
"result_snmp_user",
";",
"}"
] | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/snmp_user.java#L494-L511 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/ChatApi.java | ChatApi.sendMessage | public ApiSuccessResponse sendMessage(String id, AcceptData1 acceptData) throws ApiException {
"""
Send a message
Send a message to participants in the specified chat.
@param id The ID of the chat interaction. (required)
@param acceptData Request parameters. (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
"""
ApiResponse<ApiSuccessResponse> resp = sendMessageWithHttpInfo(id, acceptData);
return resp.getData();
} | java | public ApiSuccessResponse sendMessage(String id, AcceptData1 acceptData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = sendMessageWithHttpInfo(id, acceptData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"sendMessage",
"(",
"String",
"id",
",",
"AcceptData1",
"acceptData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"sendMessageWithHttpInfo",
"(",
"id",
",",
"acceptData",
")",
";",
"return",
"resp",
".",
"getData",
"(",
")",
";",
"}"
] | Send a message
Send a message to participants in the specified chat.
@param id The ID of the chat interaction. (required)
@param acceptData Request parameters. (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Send",
"a",
"message",
"Send",
"a",
"message",
"to",
"participants",
"in",
"the",
"specified",
"chat",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/ChatApi.java#L1572-L1575 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/Table.java | Table.flushAllAvailableRows | public void flushAllAvailableRows(final XMLUtil util, final Appendable appendable)
throws IOException {
"""
Open the table, flush all rows from start, but do not freeze the table
@param util a XMLUtil instance for writing XML
@param appendable where to write
@throws IOException if an I/O error occurs during the flush
"""
this.appender.flushAllAvailableRows(util, appendable);
} | java | public void flushAllAvailableRows(final XMLUtil util, final Appendable appendable)
throws IOException {
this.appender.flushAllAvailableRows(util, appendable);
} | [
"public",
"void",
"flushAllAvailableRows",
"(",
"final",
"XMLUtil",
"util",
",",
"final",
"Appendable",
"appendable",
")",
"throws",
"IOException",
"{",
"this",
".",
"appender",
".",
"flushAllAvailableRows",
"(",
"util",
",",
"appendable",
")",
";",
"}"
] | Open the table, flush all rows from start, but do not freeze the table
@param util a XMLUtil instance for writing XML
@param appendable where to write
@throws IOException if an I/O error occurs during the flush | [
"Open",
"the",
"table",
"flush",
"all",
"rows",
"from",
"start",
"but",
"do",
"not",
"freeze",
"the",
"table"
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/Table.java#L136-L139 |
structurizr/java | structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java | DocumentationTemplate.addSection | @Nonnull
public Section addSection(SoftwareSystem softwareSystem, String title, File... files) throws IOException {
"""
Adds a section relating to a {@link SoftwareSystem} from one or more files.
@param softwareSystem the {@link SoftwareSystem} the documentation content relates to
@param title the section title
@param files one or more File objects that point to the documentation content
@return a documentation {@link Section}
@throws IOException if there is an error reading the files
"""
return add(softwareSystem, title, files);
} | java | @Nonnull
public Section addSection(SoftwareSystem softwareSystem, String title, File... files) throws IOException {
return add(softwareSystem, title, files);
} | [
"@",
"Nonnull",
"public",
"Section",
"addSection",
"(",
"SoftwareSystem",
"softwareSystem",
",",
"String",
"title",
",",
"File",
"...",
"files",
")",
"throws",
"IOException",
"{",
"return",
"add",
"(",
"softwareSystem",
",",
"title",
",",
"files",
")",
";",
"}"
] | Adds a section relating to a {@link SoftwareSystem} from one or more files.
@param softwareSystem the {@link SoftwareSystem} the documentation content relates to
@param title the section title
@param files one or more File objects that point to the documentation content
@return a documentation {@link Section}
@throws IOException if there is an error reading the files | [
"Adds",
"a",
"section",
"relating",
"to",
"a",
"{",
"@link",
"SoftwareSystem",
"}",
"from",
"one",
"or",
"more",
"files",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java#L73-L76 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java | NodeSet.insertElementAt | public void insertElementAt(Node value, int at) {
"""
Inserts the specified node in this vector at the specified index.
Each component in this vector with an index greater or equal to
the specified index is shifted upward to have an index one greater
than the value it had previously.
@param value Node to insert
@param at Position where to insert
"""
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");
if (null == m_map)
{
m_map = new Node[m_blocksize];
m_mapSize = m_blocksize;
}
else if ((m_firstFree + 1) >= m_mapSize)
{
m_mapSize += m_blocksize;
Node newMap[] = new Node[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
m_map = newMap;
}
if (at <= (m_firstFree - 1))
{
System.arraycopy(m_map, at, m_map, at + 1, m_firstFree - at);
}
m_map[at] = value;
m_firstFree++;
} | java | public void insertElementAt(Node value, int at)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");
if (null == m_map)
{
m_map = new Node[m_blocksize];
m_mapSize = m_blocksize;
}
else if ((m_firstFree + 1) >= m_mapSize)
{
m_mapSize += m_blocksize;
Node newMap[] = new Node[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
m_map = newMap;
}
if (at <= (m_firstFree - 1))
{
System.arraycopy(m_map, at, m_map, at + 1, m_firstFree - at);
}
m_map[at] = value;
m_firstFree++;
} | [
"public",
"void",
"insertElementAt",
"(",
"Node",
"value",
",",
"int",
"at",
")",
"{",
"if",
"(",
"!",
"m_mutable",
")",
"throw",
"new",
"RuntimeException",
"(",
"XSLMessages",
".",
"createXPATHMessage",
"(",
"XPATHErrorResources",
".",
"ER_NODESET_NOT_MUTABLE",
",",
"null",
")",
")",
";",
"//\"This NodeSet is not mutable!\");",
"if",
"(",
"null",
"==",
"m_map",
")",
"{",
"m_map",
"=",
"new",
"Node",
"[",
"m_blocksize",
"]",
";",
"m_mapSize",
"=",
"m_blocksize",
";",
"}",
"else",
"if",
"(",
"(",
"m_firstFree",
"+",
"1",
")",
">=",
"m_mapSize",
")",
"{",
"m_mapSize",
"+=",
"m_blocksize",
";",
"Node",
"newMap",
"[",
"]",
"=",
"new",
"Node",
"[",
"m_mapSize",
"]",
";",
"System",
".",
"arraycopy",
"(",
"m_map",
",",
"0",
",",
"newMap",
",",
"0",
",",
"m_firstFree",
"+",
"1",
")",
";",
"m_map",
"=",
"newMap",
";",
"}",
"if",
"(",
"at",
"<=",
"(",
"m_firstFree",
"-",
"1",
")",
")",
"{",
"System",
".",
"arraycopy",
"(",
"m_map",
",",
"at",
",",
"m_map",
",",
"at",
"+",
"1",
",",
"m_firstFree",
"-",
"at",
")",
";",
"}",
"m_map",
"[",
"at",
"]",
"=",
"value",
";",
"m_firstFree",
"++",
";",
"}"
] | Inserts the specified node in this vector at the specified index.
Each component in this vector with an index greater or equal to
the specified index is shifted upward to have an index one greater
than the value it had previously.
@param value Node to insert
@param at Position where to insert | [
"Inserts",
"the",
"specified",
"node",
"in",
"this",
"vector",
"at",
"the",
"specified",
"index",
".",
"Each",
"component",
"in",
"this",
"vector",
"with",
"an",
"index",
"greater",
"or",
"equal",
"to",
"the",
"specified",
"index",
"is",
"shifted",
"upward",
"to",
"have",
"an",
"index",
"one",
"greater",
"than",
"the",
"value",
"it",
"had",
"previously",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java#L1102-L1131 |
willowtreeapps/Hyperion-Android | hyperion-phoenix/src/main/java/com/willowtreeapps/hyperion/phoenix/ProcessPhoenix.java | ProcessPhoenix.triggerRebirth | public static void triggerRebirth(Context context, Intent... nextIntents) {
"""
Call to restart the application process using the specified intents.
<p>
Behavior of the current process after invoking this method is undefined.
"""
Intent intent = new Intent(context, ProcessPhoenix.class);
intent.addFlags(FLAG_ACTIVITY_NEW_TASK); // In case we are called with non-Activity context.
intent.putParcelableArrayListExtra(KEY_RESTART_INTENTS, new ArrayList<>(Arrays.asList(nextIntents)));
intent.putExtra(KEY_CLEAR_CACHE, options.shouldClearCache());
intent.putExtra(KEY_CLEAR_DATA, options.shouldClearData());
context.startActivity(intent);
if (context instanceof Activity) {
((Activity) context).finish();
}
Runtime.getRuntime().exit(0); // Kill kill kill!
} | java | public static void triggerRebirth(Context context, Intent... nextIntents) {
Intent intent = new Intent(context, ProcessPhoenix.class);
intent.addFlags(FLAG_ACTIVITY_NEW_TASK); // In case we are called with non-Activity context.
intent.putParcelableArrayListExtra(KEY_RESTART_INTENTS, new ArrayList<>(Arrays.asList(nextIntents)));
intent.putExtra(KEY_CLEAR_CACHE, options.shouldClearCache());
intent.putExtra(KEY_CLEAR_DATA, options.shouldClearData());
context.startActivity(intent);
if (context instanceof Activity) {
((Activity) context).finish();
}
Runtime.getRuntime().exit(0); // Kill kill kill!
} | [
"public",
"static",
"void",
"triggerRebirth",
"(",
"Context",
"context",
",",
"Intent",
"...",
"nextIntents",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"context",
",",
"ProcessPhoenix",
".",
"class",
")",
";",
"intent",
".",
"addFlags",
"(",
"FLAG_ACTIVITY_NEW_TASK",
")",
";",
"// In case we are called with non-Activity context.",
"intent",
".",
"putParcelableArrayListExtra",
"(",
"KEY_RESTART_INTENTS",
",",
"new",
"ArrayList",
"<>",
"(",
"Arrays",
".",
"asList",
"(",
"nextIntents",
")",
")",
")",
";",
"intent",
".",
"putExtra",
"(",
"KEY_CLEAR_CACHE",
",",
"options",
".",
"shouldClearCache",
"(",
")",
")",
";",
"intent",
".",
"putExtra",
"(",
"KEY_CLEAR_DATA",
",",
"options",
".",
"shouldClearData",
"(",
")",
")",
";",
"context",
".",
"startActivity",
"(",
"intent",
")",
";",
"if",
"(",
"context",
"instanceof",
"Activity",
")",
"{",
"(",
"(",
"Activity",
")",
"context",
")",
".",
"finish",
"(",
")",
";",
"}",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"exit",
"(",
"0",
")",
";",
"// Kill kill kill!",
"}"
] | Call to restart the application process using the specified intents.
<p>
Behavior of the current process after invoking this method is undefined. | [
"Call",
"to",
"restart",
"the",
"application",
"process",
"using",
"the",
"specified",
"intents",
".",
"<p",
">",
"Behavior",
"of",
"the",
"current",
"process",
"after",
"invoking",
"this",
"method",
"is",
"undefined",
"."
] | train | https://github.com/willowtreeapps/Hyperion-Android/blob/1910f53869a53f1395ba90588a0b4db7afdec79c/hyperion-phoenix/src/main/java/com/willowtreeapps/hyperion/phoenix/ProcessPhoenix.java#L61-L72 |
LearnLib/automatalib | util/src/main/java/net/automatalib/util/automata/fsa/DFAs.java | DFAs.isPrefixClosed | public static <S, I> boolean isPrefixClosed(DFA<S, I> dfa, Alphabet<I> alphabet) {
"""
Computes whether the language of the given DFA is prefix-closed.
Assumes all states in the given {@link DFA} are reachable from the initial state.
@param dfa the DFA to check
@param alphabet the Alphabet
@param <S> the type of state
@param <I> the type of input
@return whether the DFA is prefix-closed.
"""
return dfa.getStates()
.parallelStream()
.allMatch(s -> dfa.isAccepting(s) ||
alphabet.parallelStream().noneMatch(i -> dfa.isAccepting(dfa.getSuccessors(s, i))));
} | java | public static <S, I> boolean isPrefixClosed(DFA<S, I> dfa, Alphabet<I> alphabet) {
return dfa.getStates()
.parallelStream()
.allMatch(s -> dfa.isAccepting(s) ||
alphabet.parallelStream().noneMatch(i -> dfa.isAccepting(dfa.getSuccessors(s, i))));
} | [
"public",
"static",
"<",
"S",
",",
"I",
">",
"boolean",
"isPrefixClosed",
"(",
"DFA",
"<",
"S",
",",
"I",
">",
"dfa",
",",
"Alphabet",
"<",
"I",
">",
"alphabet",
")",
"{",
"return",
"dfa",
".",
"getStates",
"(",
")",
".",
"parallelStream",
"(",
")",
".",
"allMatch",
"(",
"s",
"->",
"dfa",
".",
"isAccepting",
"(",
"s",
")",
"||",
"alphabet",
".",
"parallelStream",
"(",
")",
".",
"noneMatch",
"(",
"i",
"->",
"dfa",
".",
"isAccepting",
"(",
"dfa",
".",
"getSuccessors",
"(",
"s",
",",
"i",
")",
")",
")",
")",
";",
"}"
] | Computes whether the language of the given DFA is prefix-closed.
Assumes all states in the given {@link DFA} are reachable from the initial state.
@param dfa the DFA to check
@param alphabet the Alphabet
@param <S> the type of state
@param <I> the type of input
@return whether the DFA is prefix-closed. | [
"Computes",
"whether",
"the",
"language",
"of",
"the",
"given",
"DFA",
"is",
"prefix",
"-",
"closed",
"."
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/automata/fsa/DFAs.java#L384-L389 |
EasyinnovaSL/Tiff-Library-4J | src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java | TiffITProfile.checkRequiredTag | private boolean checkRequiredTag(IfdTags metadata, String tagName, int cardinality) {
"""
Check a required tag is present.
@param metadata the metadata
@param tagName the name of the mandatory tag
@param cardinality the mandatory cardinality
@return true, if tag is present
"""
return checkRequiredTag(metadata, tagName, cardinality, null);
} | java | private boolean checkRequiredTag(IfdTags metadata, String tagName, int cardinality) {
return checkRequiredTag(metadata, tagName, cardinality, null);
} | [
"private",
"boolean",
"checkRequiredTag",
"(",
"IfdTags",
"metadata",
",",
"String",
"tagName",
",",
"int",
"cardinality",
")",
"{",
"return",
"checkRequiredTag",
"(",
"metadata",
",",
"tagName",
",",
"cardinality",
",",
"null",
")",
";",
"}"
] | Check a required tag is present.
@param metadata the metadata
@param tagName the name of the mandatory tag
@param cardinality the mandatory cardinality
@return true, if tag is present | [
"Check",
"a",
"required",
"tag",
"is",
"present",
"."
] | train | https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java#L661-L663 |
NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java | DfuServiceInitiator.setZip | public DfuServiceInitiator setZip(@RawRes final int rawResId) {
"""
Sets the resource ID of the Distribution packet (ZIP) or the a ZIP file matching the
deprecated naming convention. The file should be in the /res/raw folder.
@param rawResId file's resource ID
@return the builder
@see #setZip(Uri)
@see #setZip(String)
"""
return init(null, null, rawResId, DfuBaseService.TYPE_AUTO, DfuBaseService.MIME_TYPE_ZIP);
} | java | public DfuServiceInitiator setZip(@RawRes final int rawResId) {
return init(null, null, rawResId, DfuBaseService.TYPE_AUTO, DfuBaseService.MIME_TYPE_ZIP);
} | [
"public",
"DfuServiceInitiator",
"setZip",
"(",
"@",
"RawRes",
"final",
"int",
"rawResId",
")",
"{",
"return",
"init",
"(",
"null",
",",
"null",
",",
"rawResId",
",",
"DfuBaseService",
".",
"TYPE_AUTO",
",",
"DfuBaseService",
".",
"MIME_TYPE_ZIP",
")",
";",
"}"
] | Sets the resource ID of the Distribution packet (ZIP) or the a ZIP file matching the
deprecated naming convention. The file should be in the /res/raw folder.
@param rawResId file's resource ID
@return the builder
@see #setZip(Uri)
@see #setZip(String) | [
"Sets",
"the",
"resource",
"ID",
"of",
"the",
"Distribution",
"packet",
"(",
"ZIP",
")",
"or",
"the",
"a",
"ZIP",
"file",
"matching",
"the",
"deprecated",
"naming",
"convention",
".",
"The",
"file",
"should",
"be",
"in",
"the",
"/",
"res",
"/",
"raw",
"folder",
"."
] | train | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java#L591-L593 |
atomix/catalyst | serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java | Serializer.readById | @SuppressWarnings("unchecked")
private <T> T readById(int id, BufferInput<?> buffer) {
"""
Reads a serializable object.
@param id The serializable type ID.
@param buffer The buffer from which to read the object.
@param <T> The object type.
@return The read object.
"""
Class<T> type = (Class<T>) registry.type(id);
if (type == null)
throw new SerializationException("cannot deserialize: unknown type");
TypeSerializer<T> serializer = getSerializer(type);
if (serializer == null)
throw new SerializationException("cannot deserialize: unknown type");
return serializer.read(type, buffer, this);
} | java | @SuppressWarnings("unchecked")
private <T> T readById(int id, BufferInput<?> buffer) {
Class<T> type = (Class<T>) registry.type(id);
if (type == null)
throw new SerializationException("cannot deserialize: unknown type");
TypeSerializer<T> serializer = getSerializer(type);
if (serializer == null)
throw new SerializationException("cannot deserialize: unknown type");
return serializer.read(type, buffer, this);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
">",
"T",
"readById",
"(",
"int",
"id",
",",
"BufferInput",
"<",
"?",
">",
"buffer",
")",
"{",
"Class",
"<",
"T",
">",
"type",
"=",
"(",
"Class",
"<",
"T",
">",
")",
"registry",
".",
"type",
"(",
"id",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"throw",
"new",
"SerializationException",
"(",
"\"cannot deserialize: unknown type\"",
")",
";",
"TypeSerializer",
"<",
"T",
">",
"serializer",
"=",
"getSerializer",
"(",
"type",
")",
";",
"if",
"(",
"serializer",
"==",
"null",
")",
"throw",
"new",
"SerializationException",
"(",
"\"cannot deserialize: unknown type\"",
")",
";",
"return",
"serializer",
".",
"read",
"(",
"type",
",",
"buffer",
",",
"this",
")",
";",
"}"
] | Reads a serializable object.
@param id The serializable type ID.
@param buffer The buffer from which to read the object.
@param <T> The object type.
@return The read object. | [
"Reads",
"a",
"serializable",
"object",
"."
] | train | https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java#L1030-L1041 |
eclipse/xtext-core | org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/splitting/AntlrCodeQualityHelper.java | AntlrCodeQualityHelper.removeDuplicateBitsets | public String removeDuplicateBitsets(String javaContent, AntlrOptions options) {
"""
Remove duplicate bitset declarations to reduce the size of the static initializer but keep the bitsets
that match the given pattern with a normalized name.
"""
if (!options.isOptimizeCodeQuality()) {
return javaContent;
}
return removeDuplicateFields(javaContent, followsetPattern, 1, 2, "\\bFOLLOW_\\w+\\b", "FOLLOW_%d", options.getKeptBitSetsPattern(), options.getKeptBitSetName());
} | java | public String removeDuplicateBitsets(String javaContent, AntlrOptions options) {
if (!options.isOptimizeCodeQuality()) {
return javaContent;
}
return removeDuplicateFields(javaContent, followsetPattern, 1, 2, "\\bFOLLOW_\\w+\\b", "FOLLOW_%d", options.getKeptBitSetsPattern(), options.getKeptBitSetName());
} | [
"public",
"String",
"removeDuplicateBitsets",
"(",
"String",
"javaContent",
",",
"AntlrOptions",
"options",
")",
"{",
"if",
"(",
"!",
"options",
".",
"isOptimizeCodeQuality",
"(",
")",
")",
"{",
"return",
"javaContent",
";",
"}",
"return",
"removeDuplicateFields",
"(",
"javaContent",
",",
"followsetPattern",
",",
"1",
",",
"2",
",",
"\"\\\\bFOLLOW_\\\\w+\\\\b\"",
",",
"\"FOLLOW_%d\"",
",",
"options",
".",
"getKeptBitSetsPattern",
"(",
")",
",",
"options",
".",
"getKeptBitSetName",
"(",
")",
")",
";",
"}"
] | Remove duplicate bitset declarations to reduce the size of the static initializer but keep the bitsets
that match the given pattern with a normalized name. | [
"Remove",
"duplicate",
"bitset",
"declarations",
"to",
"reduce",
"the",
"size",
"of",
"the",
"static",
"initializer",
"but",
"keep",
"the",
"bitsets",
"that",
"match",
"the",
"given",
"pattern",
"with",
"a",
"normalized",
"name",
"."
] | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/splitting/AntlrCodeQualityHelper.java#L67-L73 |
bwkimmel/java-util | src/main/java/ca/eandb/util/FloatArray.java | FloatArray.addAll | public boolean addAll(int index, float[] items) {
"""
Inserts values into the array at the specified index.
@param index
The index at which to insert the new values.
@param items
An array of values to insert.
@return A value indicating if the array has changed.
@throws IndexOutOfBoundsException
if <code>index < 0 || index > size()</code>.
"""
if (index < 0 || index > size) {
throw new IndexOutOfBoundsException();
}
ensureCapacity(size + items.length);
if (index < size) {
for (int i = size - 1; i >= index; i--) {
elements[i + items.length] = elements[i];
}
}
for (float e : items) {
elements[index++] = e;
}
size += items.length;
return items.length > 0;
} | java | public boolean addAll(int index, float[] items) {
if (index < 0 || index > size) {
throw new IndexOutOfBoundsException();
}
ensureCapacity(size + items.length);
if (index < size) {
for (int i = size - 1; i >= index; i--) {
elements[i + items.length] = elements[i];
}
}
for (float e : items) {
elements[index++] = e;
}
size += items.length;
return items.length > 0;
} | [
"public",
"boolean",
"addAll",
"(",
"int",
"index",
",",
"float",
"[",
"]",
"items",
")",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">",
"size",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"}",
"ensureCapacity",
"(",
"size",
"+",
"items",
".",
"length",
")",
";",
"if",
"(",
"index",
"<",
"size",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"size",
"-",
"1",
";",
"i",
">=",
"index",
";",
"i",
"--",
")",
"{",
"elements",
"[",
"i",
"+",
"items",
".",
"length",
"]",
"=",
"elements",
"[",
"i",
"]",
";",
"}",
"}",
"for",
"(",
"float",
"e",
":",
"items",
")",
"{",
"elements",
"[",
"index",
"++",
"]",
"=",
"e",
";",
"}",
"size",
"+=",
"items",
".",
"length",
";",
"return",
"items",
".",
"length",
">",
"0",
";",
"}"
] | Inserts values into the array at the specified index.
@param index
The index at which to insert the new values.
@param items
An array of values to insert.
@return A value indicating if the array has changed.
@throws IndexOutOfBoundsException
if <code>index < 0 || index > size()</code>. | [
"Inserts",
"values",
"into",
"the",
"array",
"at",
"the",
"specified",
"index",
"."
] | train | https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/FloatArray.java#L429-L444 |
ozimov/cirneco | hamcrest/guava-hamcrest-matchers/src/main/java/it/ozimov/cirneco/hamcrest/guava/collect/IsMultimapKeyWithCollectionSize.java | IsMultimapKeyWithCollectionSize.keyWithSize | public static <K> Matcher<Multimap<K, ?>> keyWithSize(final K element, final int size) {
"""
Creates a matcher for {@linkplain Multimap} matching when the examined object <code>K</code> in the key set has
<code>size</code> elements in the retained {@linkplain Collection}.
"""
return new IsMultimapKeyWithCollectionSize(element, size);
} | java | public static <K> Matcher<Multimap<K, ?>> keyWithSize(final K element, final int size) {
return new IsMultimapKeyWithCollectionSize(element, size);
} | [
"public",
"static",
"<",
"K",
">",
"Matcher",
"<",
"Multimap",
"<",
"K",
",",
"?",
">",
">",
"keyWithSize",
"(",
"final",
"K",
"element",
",",
"final",
"int",
"size",
")",
"{",
"return",
"new",
"IsMultimapKeyWithCollectionSize",
"(",
"element",
",",
"size",
")",
";",
"}"
] | Creates a matcher for {@linkplain Multimap} matching when the examined object <code>K</code> in the key set has
<code>size</code> elements in the retained {@linkplain Collection}. | [
"Creates",
"a",
"matcher",
"for",
"{"
] | train | https://github.com/ozimov/cirneco/blob/78ad782da0a2256634cfbebb2f97ed78c993b999/hamcrest/guava-hamcrest-matchers/src/main/java/it/ozimov/cirneco/hamcrest/guava/collect/IsMultimapKeyWithCollectionSize.java#L28-L30 |
tommyettinger/RegExodus | src/main/java/regexodus/CharacterClass.java | CharacterClass.printRealm | private static void printRealm(ArrayList<String> realm, String name) {
"""
/*
int[][] data=new int[CATEGORY_COUNT][BLOCK_SIZE+2];
for(int i=Character.MIN_VALUE;i<=Character.MAX_VALUE;i++){
int cat=Character.getType((char)i);
data[cat][BLOCK_SIZE]++;
int b=(i>>8)&0xff;
if(data[cat][b]==0){
data[cat][b]=1;
data[cat][BLOCK_SIZE+1]++;
}
}
for(int i=0;i<CATEGORY_COUNT;i++){
System.out.print(unicodeCategoryNames.get(new Integer(i))+": ");
System.out.println(data[i][BLOCK_SIZE]+" chars, "+data[i][BLOCK_SIZE+1]+" blocks, "+(data[i][BLOCK_SIZE]/data[i][BLOCK_SIZE+1])+" chars/block");
}
"""
System.out.println(name + ":");
for (String s : realm) {
System.out.println(" " + s);
}
} | java | private static void printRealm(ArrayList<String> realm, String name) {
System.out.println(name + ":");
for (String s : realm) {
System.out.println(" " + s);
}
} | [
"private",
"static",
"void",
"printRealm",
"(",
"ArrayList",
"<",
"String",
">",
"realm",
",",
"String",
"name",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"name",
"+",
"\":\"",
")",
";",
"for",
"(",
"String",
"s",
":",
"realm",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\" \"",
"+",
"s",
")",
";",
"}",
"}"
] | /*
int[][] data=new int[CATEGORY_COUNT][BLOCK_SIZE+2];
for(int i=Character.MIN_VALUE;i<=Character.MAX_VALUE;i++){
int cat=Character.getType((char)i);
data[cat][BLOCK_SIZE]++;
int b=(i>>8)&0xff;
if(data[cat][b]==0){
data[cat][b]=1;
data[cat][BLOCK_SIZE+1]++;
}
}
for(int i=0;i<CATEGORY_COUNT;i++){
System.out.print(unicodeCategoryNames.get(new Integer(i))+": ");
System.out.println(data[i][BLOCK_SIZE]+" chars, "+data[i][BLOCK_SIZE+1]+" blocks, "+(data[i][BLOCK_SIZE]/data[i][BLOCK_SIZE+1])+" chars/block");
} | [
"/",
"*",
"int",
"[]",
"[]",
"data",
"=",
"new",
"int",
"[",
"CATEGORY_COUNT",
"]",
"[",
"BLOCK_SIZE",
"+",
"2",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"Character",
".",
"MIN_VALUE",
";",
"i<",
"=",
"Character",
".",
"MAX_VALUE",
";",
"i",
"++",
")",
"{",
"int",
"cat",
"=",
"Character",
".",
"getType",
"((",
"char",
")",
"i",
")",
";",
"data",
"[",
"cat",
"]",
"[",
"BLOCK_SIZE",
"]",
"++",
";",
"int",
"b",
"=",
"(",
"i",
">>",
"8",
")",
"&0xff",
";",
"if",
"(",
"data",
"[",
"cat",
"]",
"[",
"b",
"]",
"==",
"0",
")",
"{",
"data",
"[",
"cat",
"]",
"[",
"b",
"]",
"=",
"1",
";",
"data",
"[",
"cat",
"]",
"[",
"BLOCK_SIZE",
"+",
"1",
"]",
"++",
";",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i<CATEGORY_COUNT",
";",
"i",
"++",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"unicodeCategoryNames",
".",
"get",
"(",
"new",
"Integer",
"(",
"i",
"))",
"+",
":",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"data",
"[",
"i",
"]",
"[",
"BLOCK_SIZE",
"]",
"+",
"chars",
"+",
"data",
"[",
"i",
"]",
"[",
"BLOCK_SIZE",
"+",
"1",
"]",
"+",
"blocks",
"+",
"(",
"data",
"[",
"i",
"]",
"[",
"BLOCK_SIZE",
"]",
"/",
"data",
"[",
"i",
"]",
"[",
"BLOCK_SIZE",
"+",
"1",
"]",
")",
"+",
"chars",
"/",
"block",
")",
";",
"}"
] | train | https://github.com/tommyettinger/RegExodus/blob/d4af9bb7c132c5f9d29f45b76121f93b2f89de16/src/main/java/regexodus/CharacterClass.java#L866-L871 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/Request.java | Request.executeStatusUpdateRequestAsync | @Deprecated
public static RequestAsyncTask executeStatusUpdateRequestAsync(Session session, String message, Callback callback) {
"""
Starts a new Request configured to post a status update to a user's feed.
<p/>
This should only be called from the UI thread.
This method is deprecated. Prefer to call Request.newStatusUpdateRequest(...).executeAsync();
@param session
the Session to use, or null; if non-null, the session must be in an opened state
@param message
the text of the status update
@param callback
a callback that will be called when the request is completed to handle success or error conditions
@return a RequestAsyncTask that is executing the request
"""
return newStatusUpdateRequest(session, message, callback).executeAsync();
} | java | @Deprecated
public static RequestAsyncTask executeStatusUpdateRequestAsync(Session session, String message, Callback callback) {
return newStatusUpdateRequest(session, message, callback).executeAsync();
} | [
"@",
"Deprecated",
"public",
"static",
"RequestAsyncTask",
"executeStatusUpdateRequestAsync",
"(",
"Session",
"session",
",",
"String",
"message",
",",
"Callback",
"callback",
")",
"{",
"return",
"newStatusUpdateRequest",
"(",
"session",
",",
"message",
",",
"callback",
")",
".",
"executeAsync",
"(",
")",
";",
"}"
] | Starts a new Request configured to post a status update to a user's feed.
<p/>
This should only be called from the UI thread.
This method is deprecated. Prefer to call Request.newStatusUpdateRequest(...).executeAsync();
@param session
the Session to use, or null; if non-null, the session must be in an opened state
@param message
the text of the status update
@param callback
a callback that will be called when the request is completed to handle success or error conditions
@return a RequestAsyncTask that is executing the request | [
"Starts",
"a",
"new",
"Request",
"configured",
"to",
"post",
"a",
"status",
"update",
"to",
"a",
"user",
"s",
"feed",
".",
"<p",
"/",
">",
"This",
"should",
"only",
"be",
"called",
"from",
"the",
"UI",
"thread",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L1244-L1247 |
op4j/op4j | src/main/java/org/op4j/Op.java | Op.onArray | public static <T> Level0ArrayOperator<Date[],Date> onArray(final Date[] target) {
"""
<p>
Creates an <i>operation expression</i> on the specified target object.
</p>
@param target the target object on which the expression will execute
@return an operator, ready for chaining
"""
return onArrayOf(Types.DATE, target);
} | java | public static <T> Level0ArrayOperator<Date[],Date> onArray(final Date[] target) {
return onArrayOf(Types.DATE, target);
} | [
"public",
"static",
"<",
"T",
">",
"Level0ArrayOperator",
"<",
"Date",
"[",
"]",
",",
"Date",
">",
"onArray",
"(",
"final",
"Date",
"[",
"]",
"target",
")",
"{",
"return",
"onArrayOf",
"(",
"Types",
".",
"DATE",
",",
"target",
")",
";",
"}"
] | <p>
Creates an <i>operation expression</i> on the specified target object.
</p>
@param target the target object on which the expression will execute
@return an operator, ready for chaining | [
"<p",
">",
"Creates",
"an",
"<i",
">",
"operation",
"expression<",
"/",
"i",
">",
"on",
"the",
"specified",
"target",
"object",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L819-L821 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/locale/LocaleFormatter.java | LocaleFormatter.getFormatted | @Nonnull
public static String getFormatted (@Nonnull final BigDecimal aValue, @Nonnull final Locale aDisplayLocale) {
"""
Format the passed value according to the rules specified by the given
locale. All calls to {@link BigDecimal#toString()} that are displayed to
the user should instead use this method. By default a maximum of 3 fraction
digits are shown.
@param aValue
The value to be formatted. May not be <code>null</code>.
@param aDisplayLocale
The locale to be used. May not be <code>null</code>.
@return The formatted string.
"""
ValueEnforcer.notNull (aValue, "Value");
ValueEnforcer.notNull (aDisplayLocale, "DisplayLocale");
return NumberFormat.getInstance (aDisplayLocale).format (aValue);
} | java | @Nonnull
public static String getFormatted (@Nonnull final BigDecimal aValue, @Nonnull final Locale aDisplayLocale)
{
ValueEnforcer.notNull (aValue, "Value");
ValueEnforcer.notNull (aDisplayLocale, "DisplayLocale");
return NumberFormat.getInstance (aDisplayLocale).format (aValue);
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getFormatted",
"(",
"@",
"Nonnull",
"final",
"BigDecimal",
"aValue",
",",
"@",
"Nonnull",
"final",
"Locale",
"aDisplayLocale",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aValue",
",",
"\"Value\"",
")",
";",
"ValueEnforcer",
".",
"notNull",
"(",
"aDisplayLocale",
",",
"\"DisplayLocale\"",
")",
";",
"return",
"NumberFormat",
".",
"getInstance",
"(",
"aDisplayLocale",
")",
".",
"format",
"(",
"aValue",
")",
";",
"}"
] | Format the passed value according to the rules specified by the given
locale. All calls to {@link BigDecimal#toString()} that are displayed to
the user should instead use this method. By default a maximum of 3 fraction
digits are shown.
@param aValue
The value to be formatted. May not be <code>null</code>.
@param aDisplayLocale
The locale to be used. May not be <code>null</code>.
@return The formatted string. | [
"Format",
"the",
"passed",
"value",
"according",
"to",
"the",
"rules",
"specified",
"by",
"the",
"given",
"locale",
".",
"All",
"calls",
"to",
"{",
"@link",
"BigDecimal#toString",
"()",
"}",
"that",
"are",
"displayed",
"to",
"the",
"user",
"should",
"instead",
"use",
"this",
"method",
".",
"By",
"default",
"a",
"maximum",
"of",
"3",
"fraction",
"digits",
"are",
"shown",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/locale/LocaleFormatter.java#L134-L141 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EntityTypesClient.java | EntityTypesClient.updateEntityType | public final EntityType updateEntityType(EntityType entityType, String languageCode) {
"""
Updates the specified entity type.
<p>Sample code:
<pre><code>
try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
EntityType entityType = EntityType.newBuilder().build();
String languageCode = "";
EntityType response = entityTypesClient.updateEntityType(entityType, languageCode);
}
</code></pre>
@param entityType Required. The entity type to update.
@param languageCode Optional. The language of entity synonyms defined in `entity_type`. If not
specified, the agent's default language is used. [Many
languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) are
supported. Note: languages must be enabled in the agent before they can be used.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
"""
UpdateEntityTypeRequest request =
UpdateEntityTypeRequest.newBuilder()
.setEntityType(entityType)
.setLanguageCode(languageCode)
.build();
return updateEntityType(request);
} | java | public final EntityType updateEntityType(EntityType entityType, String languageCode) {
UpdateEntityTypeRequest request =
UpdateEntityTypeRequest.newBuilder()
.setEntityType(entityType)
.setLanguageCode(languageCode)
.build();
return updateEntityType(request);
} | [
"public",
"final",
"EntityType",
"updateEntityType",
"(",
"EntityType",
"entityType",
",",
"String",
"languageCode",
")",
"{",
"UpdateEntityTypeRequest",
"request",
"=",
"UpdateEntityTypeRequest",
".",
"newBuilder",
"(",
")",
".",
"setEntityType",
"(",
"entityType",
")",
".",
"setLanguageCode",
"(",
"languageCode",
")",
".",
"build",
"(",
")",
";",
"return",
"updateEntityType",
"(",
"request",
")",
";",
"}"
] | Updates the specified entity type.
<p>Sample code:
<pre><code>
try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
EntityType entityType = EntityType.newBuilder().build();
String languageCode = "";
EntityType response = entityTypesClient.updateEntityType(entityType, languageCode);
}
</code></pre>
@param entityType Required. The entity type to update.
@param languageCode Optional. The language of entity synonyms defined in `entity_type`. If not
specified, the agent's default language is used. [Many
languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) are
supported. Note: languages must be enabled in the agent before they can be used.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Updates",
"the",
"specified",
"entity",
"type",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EntityTypesClient.java#L768-L776 |
jianlins/FastContext | src/main/java/edu/utah/bmi/nlp/fastcontext/uima/FastContext_General_AE.java | FastContext_General_AE.getTypeDefinitions | @Deprecated
public static HashMap<String, TypeDefinition> getTypeDefinitions(String ruleStr, boolean caseInsensitive) {
"""
Because implement a reinforced interface method (static is not reinforced), this is deprecated, just to
enable back-compatibility.
@param ruleStr Rule file path or rule content string
@param caseInsensitive whether to parse the rule in case-insensitive manner
@return Type name--Type definition map
"""
return new FastContextUIMA(ruleStr, caseInsensitive).getTypeDefinitions();
} | java | @Deprecated
public static HashMap<String, TypeDefinition> getTypeDefinitions(String ruleStr, boolean caseInsensitive) {
return new FastContextUIMA(ruleStr, caseInsensitive).getTypeDefinitions();
} | [
"@",
"Deprecated",
"public",
"static",
"HashMap",
"<",
"String",
",",
"TypeDefinition",
">",
"getTypeDefinitions",
"(",
"String",
"ruleStr",
",",
"boolean",
"caseInsensitive",
")",
"{",
"return",
"new",
"FastContextUIMA",
"(",
"ruleStr",
",",
"caseInsensitive",
")",
".",
"getTypeDefinitions",
"(",
")",
";",
"}"
] | Because implement a reinforced interface method (static is not reinforced), this is deprecated, just to
enable back-compatibility.
@param ruleStr Rule file path or rule content string
@param caseInsensitive whether to parse the rule in case-insensitive manner
@return Type name--Type definition map | [
"Because",
"implement",
"a",
"reinforced",
"interface",
"method",
"(",
"static",
"is",
"not",
"reinforced",
")",
"this",
"is",
"deprecated",
"just",
"to",
"enable",
"back",
"-",
"compatibility",
"."
] | train | https://github.com/jianlins/FastContext/blob/e3f7cfa7e6eb69bbeb49a51021d8ec5613654fc8/src/main/java/edu/utah/bmi/nlp/fastcontext/uima/FastContext_General_AE.java#L345-L348 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/Parameters.java | Parameters.setFloat | @NonNull
public Parameters setFloat(@NonNull String name, float value) {
"""
Set a float value to the query parameter referenced by the given name. A query parameter
is defined by using the Expression's parameter(String name) function.
@param name The parameter name.
@param value The float value.
@return The self object.
"""
return setValue(name, value);
} | java | @NonNull
public Parameters setFloat(@NonNull String name, float value) {
return setValue(name, value);
} | [
"@",
"NonNull",
"public",
"Parameters",
"setFloat",
"(",
"@",
"NonNull",
"String",
"name",
",",
"float",
"value",
")",
"{",
"return",
"setValue",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Set a float value to the query parameter referenced by the given name. A query parameter
is defined by using the Expression's parameter(String name) function.
@param name The parameter name.
@param value The float value.
@return The self object. | [
"Set",
"a",
"float",
"value",
"to",
"the",
"query",
"parameter",
"referenced",
"by",
"the",
"given",
"name",
".",
"A",
"query",
"parameter",
"is",
"defined",
"by",
"using",
"the",
"Expression",
"s",
"parameter",
"(",
"String",
"name",
")",
"function",
"."
] | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Parameters.java#L131-L134 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java | FileSystem.makeRelative | private static File makeRelative(File filenameToMakeRelative, File rootPath,
boolean appendCurrentDirectorySymbol) throws IOException {
"""
Make the given filename relative to the given root path.
@param filenameToMakeRelative is the name to make relative.
@param rootPath is the root path from which the relative path will be set.
@param appendCurrentDirectorySymbol indicates if "./" should be append at the
begining of the relative filename.
@return a relative filename.
@throws IOException when is is impossible to retreive canonical paths.
"""
if (filenameToMakeRelative == null || rootPath == null) {
throw new IllegalArgumentException();
}
if (!filenameToMakeRelative.isAbsolute()) {
return filenameToMakeRelative;
}
if (!rootPath.isAbsolute()) {
return filenameToMakeRelative;
}
final File root = rootPath.getCanonicalFile();
final File dir = filenameToMakeRelative.getParentFile().getCanonicalFile();
final String[] parts1 = split(dir);
final String[] parts2 = split(root);
final String relPath = makeRelative(parts1, parts2, filenameToMakeRelative.getName());
if (appendCurrentDirectorySymbol) {
return new File(CURRENT_DIRECTORY, relPath);
}
return new File(relPath);
} | java | private static File makeRelative(File filenameToMakeRelative, File rootPath,
boolean appendCurrentDirectorySymbol) throws IOException {
if (filenameToMakeRelative == null || rootPath == null) {
throw new IllegalArgumentException();
}
if (!filenameToMakeRelative.isAbsolute()) {
return filenameToMakeRelative;
}
if (!rootPath.isAbsolute()) {
return filenameToMakeRelative;
}
final File root = rootPath.getCanonicalFile();
final File dir = filenameToMakeRelative.getParentFile().getCanonicalFile();
final String[] parts1 = split(dir);
final String[] parts2 = split(root);
final String relPath = makeRelative(parts1, parts2, filenameToMakeRelative.getName());
if (appendCurrentDirectorySymbol) {
return new File(CURRENT_DIRECTORY, relPath);
}
return new File(relPath);
} | [
"private",
"static",
"File",
"makeRelative",
"(",
"File",
"filenameToMakeRelative",
",",
"File",
"rootPath",
",",
"boolean",
"appendCurrentDirectorySymbol",
")",
"throws",
"IOException",
"{",
"if",
"(",
"filenameToMakeRelative",
"==",
"null",
"||",
"rootPath",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"if",
"(",
"!",
"filenameToMakeRelative",
".",
"isAbsolute",
"(",
")",
")",
"{",
"return",
"filenameToMakeRelative",
";",
"}",
"if",
"(",
"!",
"rootPath",
".",
"isAbsolute",
"(",
")",
")",
"{",
"return",
"filenameToMakeRelative",
";",
"}",
"final",
"File",
"root",
"=",
"rootPath",
".",
"getCanonicalFile",
"(",
")",
";",
"final",
"File",
"dir",
"=",
"filenameToMakeRelative",
".",
"getParentFile",
"(",
")",
".",
"getCanonicalFile",
"(",
")",
";",
"final",
"String",
"[",
"]",
"parts1",
"=",
"split",
"(",
"dir",
")",
";",
"final",
"String",
"[",
"]",
"parts2",
"=",
"split",
"(",
"root",
")",
";",
"final",
"String",
"relPath",
"=",
"makeRelative",
"(",
"parts1",
",",
"parts2",
",",
"filenameToMakeRelative",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"appendCurrentDirectorySymbol",
")",
"{",
"return",
"new",
"File",
"(",
"CURRENT_DIRECTORY",
",",
"relPath",
")",
";",
"}",
"return",
"new",
"File",
"(",
"relPath",
")",
";",
"}"
] | Make the given filename relative to the given root path.
@param filenameToMakeRelative is the name to make relative.
@param rootPath is the root path from which the relative path will be set.
@param appendCurrentDirectorySymbol indicates if "./" should be append at the
begining of the relative filename.
@return a relative filename.
@throws IOException when is is impossible to retreive canonical paths. | [
"Make",
"the",
"given",
"filename",
"relative",
"to",
"the",
"given",
"root",
"path",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L2729-L2755 |
motown-io/motown | chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java | DomainService.deleteEvse | public void deleteEvse(Long chargingStationTypeId, Long id) {
"""
Delete an evse.
@param chargingStationTypeId charging station identifier.
@param id the id of the evse to delete.
"""
ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId);
chargingStationType.getEvses().remove(getEvseById(chargingStationType, id));
updateChargingStationType(chargingStationType.getId(), chargingStationType);
} | java | public void deleteEvse(Long chargingStationTypeId, Long id) {
ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId);
chargingStationType.getEvses().remove(getEvseById(chargingStationType, id));
updateChargingStationType(chargingStationType.getId(), chargingStationType);
} | [
"public",
"void",
"deleteEvse",
"(",
"Long",
"chargingStationTypeId",
",",
"Long",
"id",
")",
"{",
"ChargingStationType",
"chargingStationType",
"=",
"chargingStationTypeRepository",
".",
"findOne",
"(",
"chargingStationTypeId",
")",
";",
"chargingStationType",
".",
"getEvses",
"(",
")",
".",
"remove",
"(",
"getEvseById",
"(",
"chargingStationType",
",",
"id",
")",
")",
";",
"updateChargingStationType",
"(",
"chargingStationType",
".",
"getId",
"(",
")",
",",
"chargingStationType",
")",
";",
"}"
] | Delete an evse.
@param chargingStationTypeId charging station identifier.
@param id the id of the evse to delete. | [
"Delete",
"an",
"evse",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java#L304-L310 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/MBlockPos.java | MBlockPos.fromLong | public static MBlockPos fromLong(long serialized) {
"""
Create a BlockPos from a serialized long value (created by toLong)
"""
int j = (int) (serialized << 64 - X_SHIFT - NUM_X_BITS >> 64 - NUM_X_BITS);
int k = (int) (serialized << 64 - Y_SHIFT - NUM_Y_BITS >> 64 - NUM_Y_BITS);
int l = (int) (serialized << 64 - NUM_Z_BITS >> 64 - NUM_Z_BITS);
return new MBlockPos(j, k, l);
} | java | public static MBlockPos fromLong(long serialized)
{
int j = (int) (serialized << 64 - X_SHIFT - NUM_X_BITS >> 64 - NUM_X_BITS);
int k = (int) (serialized << 64 - Y_SHIFT - NUM_Y_BITS >> 64 - NUM_Y_BITS);
int l = (int) (serialized << 64 - NUM_Z_BITS >> 64 - NUM_Z_BITS);
return new MBlockPos(j, k, l);
} | [
"public",
"static",
"MBlockPos",
"fromLong",
"(",
"long",
"serialized",
")",
"{",
"int",
"j",
"=",
"(",
"int",
")",
"(",
"serialized",
"<<",
"64",
"-",
"X_SHIFT",
"-",
"NUM_X_BITS",
">>",
"64",
"-",
"NUM_X_BITS",
")",
";",
"int",
"k",
"=",
"(",
"int",
")",
"(",
"serialized",
"<<",
"64",
"-",
"Y_SHIFT",
"-",
"NUM_Y_BITS",
">>",
"64",
"-",
"NUM_Y_BITS",
")",
";",
"int",
"l",
"=",
"(",
"int",
")",
"(",
"serialized",
"<<",
"64",
"-",
"NUM_Z_BITS",
">>",
"64",
"-",
"NUM_Z_BITS",
")",
";",
"return",
"new",
"MBlockPos",
"(",
"j",
",",
"k",
",",
"l",
")",
";",
"}"
] | Create a BlockPos from a serialized long value (created by toLong) | [
"Create",
"a",
"BlockPos",
"from",
"a",
"serialized",
"long",
"value",
"(",
"created",
"by",
"toLong",
")"
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/MBlockPos.java#L303-L309 |
google/closure-templates | java/src/com/google/template/soy/jssrc/internal/JsSrcMain.java | JsSrcMain.genJsSrc | public List<String> genJsSrc(
SoyFileSetNode soyTree,
TemplateRegistry templateRegistry,
SoyJsSrcOptions jsSrcOptions,
@Nullable SoyMsgBundle msgBundle,
ErrorReporter errorReporter) {
"""
Generates JS source code given a Soy parse tree, an options object, and an optional bundle of
translated messages.
@param soyTree The Soy parse tree to generate JS source code for.
@param templateRegistry The template registry that contains all the template information.
@param jsSrcOptions The compilation options relevant to this backend.
@param msgBundle The bundle of translated messages, or null to use the messages from the Soy
source.
@param errorReporter The Soy error reporter that collects errors during code generation.
@return A list of strings where each string represents the JS source code that belongs in one
JS file. The generated JS files correspond one-to-one to the original Soy source files.
"""
// VeLogInstrumentationVisitor add html attributes for {velog} commands and also run desugaring
// pass since code generator does not understand html nodes (yet).
new VeLogInstrumentationVisitor(templateRegistry).exec(soyTree);
BidiGlobalDir bidiGlobalDir =
SoyBidiUtils.decodeBidiGlobalDirFromJsOptions(
jsSrcOptions.getBidiGlobalDir(), jsSrcOptions.getUseGoogIsRtlForBidiGlobalDir());
try (SoyScopedData.InScope inScope = apiCallScope.enter(msgBundle, bidiGlobalDir)) {
// Replace MsgNodes.
if (jsSrcOptions.shouldGenerateGoogMsgDefs()) {
Preconditions.checkState(
bidiGlobalDir != null,
"If enabling shouldGenerateGoogMsgDefs, must also set bidi global directionality.");
} else {
Preconditions.checkState(
bidiGlobalDir == null || bidiGlobalDir.isStaticValue(),
"If using bidiGlobalIsRtlCodeSnippet, must also enable shouldGenerateGoogMsgDefs.");
new InsertMsgsVisitor(msgBundle, errorReporter).insertMsgs(soyTree);
}
// Combine raw text nodes before codegen.
new CombineConsecutiveRawTextNodesPass().run(soyTree);
return createVisitor(jsSrcOptions, typeRegistry, inScope.getBidiGlobalDir(), errorReporter)
.gen(soyTree, templateRegistry, errorReporter);
}
} | java | public List<String> genJsSrc(
SoyFileSetNode soyTree,
TemplateRegistry templateRegistry,
SoyJsSrcOptions jsSrcOptions,
@Nullable SoyMsgBundle msgBundle,
ErrorReporter errorReporter) {
// VeLogInstrumentationVisitor add html attributes for {velog} commands and also run desugaring
// pass since code generator does not understand html nodes (yet).
new VeLogInstrumentationVisitor(templateRegistry).exec(soyTree);
BidiGlobalDir bidiGlobalDir =
SoyBidiUtils.decodeBidiGlobalDirFromJsOptions(
jsSrcOptions.getBidiGlobalDir(), jsSrcOptions.getUseGoogIsRtlForBidiGlobalDir());
try (SoyScopedData.InScope inScope = apiCallScope.enter(msgBundle, bidiGlobalDir)) {
// Replace MsgNodes.
if (jsSrcOptions.shouldGenerateGoogMsgDefs()) {
Preconditions.checkState(
bidiGlobalDir != null,
"If enabling shouldGenerateGoogMsgDefs, must also set bidi global directionality.");
} else {
Preconditions.checkState(
bidiGlobalDir == null || bidiGlobalDir.isStaticValue(),
"If using bidiGlobalIsRtlCodeSnippet, must also enable shouldGenerateGoogMsgDefs.");
new InsertMsgsVisitor(msgBundle, errorReporter).insertMsgs(soyTree);
}
// Combine raw text nodes before codegen.
new CombineConsecutiveRawTextNodesPass().run(soyTree);
return createVisitor(jsSrcOptions, typeRegistry, inScope.getBidiGlobalDir(), errorReporter)
.gen(soyTree, templateRegistry, errorReporter);
}
} | [
"public",
"List",
"<",
"String",
">",
"genJsSrc",
"(",
"SoyFileSetNode",
"soyTree",
",",
"TemplateRegistry",
"templateRegistry",
",",
"SoyJsSrcOptions",
"jsSrcOptions",
",",
"@",
"Nullable",
"SoyMsgBundle",
"msgBundle",
",",
"ErrorReporter",
"errorReporter",
")",
"{",
"// VeLogInstrumentationVisitor add html attributes for {velog} commands and also run desugaring",
"// pass since code generator does not understand html nodes (yet).",
"new",
"VeLogInstrumentationVisitor",
"(",
"templateRegistry",
")",
".",
"exec",
"(",
"soyTree",
")",
";",
"BidiGlobalDir",
"bidiGlobalDir",
"=",
"SoyBidiUtils",
".",
"decodeBidiGlobalDirFromJsOptions",
"(",
"jsSrcOptions",
".",
"getBidiGlobalDir",
"(",
")",
",",
"jsSrcOptions",
".",
"getUseGoogIsRtlForBidiGlobalDir",
"(",
")",
")",
";",
"try",
"(",
"SoyScopedData",
".",
"InScope",
"inScope",
"=",
"apiCallScope",
".",
"enter",
"(",
"msgBundle",
",",
"bidiGlobalDir",
")",
")",
"{",
"// Replace MsgNodes.",
"if",
"(",
"jsSrcOptions",
".",
"shouldGenerateGoogMsgDefs",
"(",
")",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"bidiGlobalDir",
"!=",
"null",
",",
"\"If enabling shouldGenerateGoogMsgDefs, must also set bidi global directionality.\"",
")",
";",
"}",
"else",
"{",
"Preconditions",
".",
"checkState",
"(",
"bidiGlobalDir",
"==",
"null",
"||",
"bidiGlobalDir",
".",
"isStaticValue",
"(",
")",
",",
"\"If using bidiGlobalIsRtlCodeSnippet, must also enable shouldGenerateGoogMsgDefs.\"",
")",
";",
"new",
"InsertMsgsVisitor",
"(",
"msgBundle",
",",
"errorReporter",
")",
".",
"insertMsgs",
"(",
"soyTree",
")",
";",
"}",
"// Combine raw text nodes before codegen.",
"new",
"CombineConsecutiveRawTextNodesPass",
"(",
")",
".",
"run",
"(",
"soyTree",
")",
";",
"return",
"createVisitor",
"(",
"jsSrcOptions",
",",
"typeRegistry",
",",
"inScope",
".",
"getBidiGlobalDir",
"(",
")",
",",
"errorReporter",
")",
".",
"gen",
"(",
"soyTree",
",",
"templateRegistry",
",",
"errorReporter",
")",
";",
"}",
"}"
] | Generates JS source code given a Soy parse tree, an options object, and an optional bundle of
translated messages.
@param soyTree The Soy parse tree to generate JS source code for.
@param templateRegistry The template registry that contains all the template information.
@param jsSrcOptions The compilation options relevant to this backend.
@param msgBundle The bundle of translated messages, or null to use the messages from the Soy
source.
@param errorReporter The Soy error reporter that collects errors during code generation.
@return A list of strings where each string represents the JS source code that belongs in one
JS file. The generated JS files correspond one-to-one to the original Soy source files. | [
"Generates",
"JS",
"source",
"code",
"given",
"a",
"Soy",
"parse",
"tree",
"an",
"options",
"object",
"and",
"an",
"optional",
"bundle",
"of",
"translated",
"messages",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/JsSrcMain.java#L67-L97 |
hypfvieh/java-utils | src/main/java/com/github/hypfvieh/util/SystemUtil.java | SystemUtil.concatFilePath | public static String concatFilePath(boolean _includeTrailingDelimiter, String..._parts) {
"""
Concats a path from all given parts, using the path delimiter for the currently used platform.
@param _includeTrailingDelimiter include delimiter after last token
@param _parts parts to concat
@return concatinated string
"""
if (_parts == null) {
return null;
}
StringBuilder allParts = new StringBuilder();
for (int i = 0; i < _parts.length; i++) {
if (_parts[i] == null) {
continue;
}
allParts.append(_parts[i]);
if (!_parts[i].endsWith(File.separator)) {
allParts.append(File.separator);
}
}
if (!_includeTrailingDelimiter && allParts.length() > 0) {
return allParts.substring(0, allParts.lastIndexOf(File.separator));
}
return allParts.toString();
} | java | public static String concatFilePath(boolean _includeTrailingDelimiter, String..._parts) {
if (_parts == null) {
return null;
}
StringBuilder allParts = new StringBuilder();
for (int i = 0; i < _parts.length; i++) {
if (_parts[i] == null) {
continue;
}
allParts.append(_parts[i]);
if (!_parts[i].endsWith(File.separator)) {
allParts.append(File.separator);
}
}
if (!_includeTrailingDelimiter && allParts.length() > 0) {
return allParts.substring(0, allParts.lastIndexOf(File.separator));
}
return allParts.toString();
} | [
"public",
"static",
"String",
"concatFilePath",
"(",
"boolean",
"_includeTrailingDelimiter",
",",
"String",
"...",
"_parts",
")",
"{",
"if",
"(",
"_parts",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"StringBuilder",
"allParts",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_parts",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"_parts",
"[",
"i",
"]",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"allParts",
".",
"append",
"(",
"_parts",
"[",
"i",
"]",
")",
";",
"if",
"(",
"!",
"_parts",
"[",
"i",
"]",
".",
"endsWith",
"(",
"File",
".",
"separator",
")",
")",
"{",
"allParts",
".",
"append",
"(",
"File",
".",
"separator",
")",
";",
"}",
"}",
"if",
"(",
"!",
"_includeTrailingDelimiter",
"&&",
"allParts",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"return",
"allParts",
".",
"substring",
"(",
"0",
",",
"allParts",
".",
"lastIndexOf",
"(",
"File",
".",
"separator",
")",
")",
";",
"}",
"return",
"allParts",
".",
"toString",
"(",
")",
";",
"}"
] | Concats a path from all given parts, using the path delimiter for the currently used platform.
@param _includeTrailingDelimiter include delimiter after last token
@param _parts parts to concat
@return concatinated string | [
"Concats",
"a",
"path",
"from",
"all",
"given",
"parts",
"using",
"the",
"path",
"delimiter",
"for",
"the",
"currently",
"used",
"platform",
"."
] | train | https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/SystemUtil.java#L129-L151 |
blinkfox/zealot | src/main/java/com/blinkfox/zealot/core/ZealotKhala.java | ZealotKhala.doBetween | private ZealotKhala doBetween(String prefix, String field, Object startValue, Object endValue, boolean match) {
"""
执行生成like模糊查询SQL片段的方法.
@param prefix 前缀
@param field 数据库字段
@param startValue 值
@param endValue 值
@param match 是否匹配
@return ZealotKhala实例的当前实例
"""
if (match) {
SqlInfoBuilder.newInstace(this.source.setPrefix(prefix)).buildBetweenSql(field, startValue, endValue);
this.source.resetPrefix();
}
return this;
} | java | private ZealotKhala doBetween(String prefix, String field, Object startValue, Object endValue, boolean match) {
if (match) {
SqlInfoBuilder.newInstace(this.source.setPrefix(prefix)).buildBetweenSql(field, startValue, endValue);
this.source.resetPrefix();
}
return this;
} | [
"private",
"ZealotKhala",
"doBetween",
"(",
"String",
"prefix",
",",
"String",
"field",
",",
"Object",
"startValue",
",",
"Object",
"endValue",
",",
"boolean",
"match",
")",
"{",
"if",
"(",
"match",
")",
"{",
"SqlInfoBuilder",
".",
"newInstace",
"(",
"this",
".",
"source",
".",
"setPrefix",
"(",
"prefix",
")",
")",
".",
"buildBetweenSql",
"(",
"field",
",",
"startValue",
",",
"endValue",
")",
";",
"this",
".",
"source",
".",
"resetPrefix",
"(",
")",
";",
"}",
"return",
"this",
";",
"}"
] | 执行生成like模糊查询SQL片段的方法.
@param prefix 前缀
@param field 数据库字段
@param startValue 值
@param endValue 值
@param match 是否匹配
@return ZealotKhala实例的当前实例 | [
"执行生成like模糊查询SQL片段的方法",
"."
] | train | https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L429-L435 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java | Strs.endAny | public static boolean endAny(String target, List<String> endWith) {
"""
Check if target string ends with any of a list of specified strings.
@param target
@param endWith
@return
"""
if (isNull(target)) {
return false;
}
return matcher(target).ends(endWith);
} | java | public static boolean endAny(String target, List<String> endWith) {
if (isNull(target)) {
return false;
}
return matcher(target).ends(endWith);
} | [
"public",
"static",
"boolean",
"endAny",
"(",
"String",
"target",
",",
"List",
"<",
"String",
">",
"endWith",
")",
"{",
"if",
"(",
"isNull",
"(",
"target",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"matcher",
"(",
"target",
")",
".",
"ends",
"(",
"endWith",
")",
";",
"}"
] | Check if target string ends with any of a list of specified strings.
@param target
@param endWith
@return | [
"Check",
"if",
"target",
"string",
"ends",
"with",
"any",
"of",
"a",
"list",
"of",
"specified",
"strings",
"."
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java#L314-L320 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.createOrUpdate | public AppServiceEnvironmentResourceInner createOrUpdate(String resourceGroupName, String name, AppServiceEnvironmentResourceInner hostingEnvironmentEnvelope) {
"""
Create or update an App Service Environment.
Create or update an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param hostingEnvironmentEnvelope Configuration details of the App Service Environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AppServiceEnvironmentResourceInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, hostingEnvironmentEnvelope).toBlocking().last().body();
} | java | public AppServiceEnvironmentResourceInner createOrUpdate(String resourceGroupName, String name, AppServiceEnvironmentResourceInner hostingEnvironmentEnvelope) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, hostingEnvironmentEnvelope).toBlocking().last().body();
} | [
"public",
"AppServiceEnvironmentResourceInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"AppServiceEnvironmentResourceInner",
"hostingEnvironmentEnvelope",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"hostingEnvironmentEnvelope",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Create or update an App Service Environment.
Create or update an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param hostingEnvironmentEnvelope Configuration details of the App Service Environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AppServiceEnvironmentResourceInner object if successful. | [
"Create",
"or",
"update",
"an",
"App",
"Service",
"Environment",
".",
"Create",
"or",
"update",
"an",
"App",
"Service",
"Environment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L686-L688 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java | MapUtils.getToleranceDistance | public static double getToleranceDistance(LatLng latLng, View view, GoogleMap map, float screenClickPercentage) {
"""
Get the allowable tolerance distance in meters from the click location on the map view and map with the screen percentage tolerance.
@param latLng click location
@param view map view
@param map map
@param screenClickPercentage screen click percentage between 0.0 and 1.0 for how close a feature
on the screen must be to be included in a click query
@return tolerance distance in meters
"""
LatLngBoundingBox latLngBoundingBox = buildClickLatLngBoundingBox(latLng, view, map, screenClickPercentage);
double longitudeDistance = SphericalUtil.computeDistanceBetween(latLngBoundingBox.getLeftCoordinate(), latLngBoundingBox.getRightCoordinate());
double latitudeDistance = SphericalUtil.computeDistanceBetween(latLngBoundingBox.getDownCoordinate(), latLngBoundingBox.getUpCoordinate());
double distance = Math.max(longitudeDistance, latitudeDistance);
return distance;
} | java | public static double getToleranceDistance(LatLng latLng, View view, GoogleMap map, float screenClickPercentage) {
LatLngBoundingBox latLngBoundingBox = buildClickLatLngBoundingBox(latLng, view, map, screenClickPercentage);
double longitudeDistance = SphericalUtil.computeDistanceBetween(latLngBoundingBox.getLeftCoordinate(), latLngBoundingBox.getRightCoordinate());
double latitudeDistance = SphericalUtil.computeDistanceBetween(latLngBoundingBox.getDownCoordinate(), latLngBoundingBox.getUpCoordinate());
double distance = Math.max(longitudeDistance, latitudeDistance);
return distance;
} | [
"public",
"static",
"double",
"getToleranceDistance",
"(",
"LatLng",
"latLng",
",",
"View",
"view",
",",
"GoogleMap",
"map",
",",
"float",
"screenClickPercentage",
")",
"{",
"LatLngBoundingBox",
"latLngBoundingBox",
"=",
"buildClickLatLngBoundingBox",
"(",
"latLng",
",",
"view",
",",
"map",
",",
"screenClickPercentage",
")",
";",
"double",
"longitudeDistance",
"=",
"SphericalUtil",
".",
"computeDistanceBetween",
"(",
"latLngBoundingBox",
".",
"getLeftCoordinate",
"(",
")",
",",
"latLngBoundingBox",
".",
"getRightCoordinate",
"(",
")",
")",
";",
"double",
"latitudeDistance",
"=",
"SphericalUtil",
".",
"computeDistanceBetween",
"(",
"latLngBoundingBox",
".",
"getDownCoordinate",
"(",
")",
",",
"latLngBoundingBox",
".",
"getUpCoordinate",
"(",
")",
")",
";",
"double",
"distance",
"=",
"Math",
".",
"max",
"(",
"longitudeDistance",
",",
"latitudeDistance",
")",
";",
"return",
"distance",
";",
"}"
] | Get the allowable tolerance distance in meters from the click location on the map view and map with the screen percentage tolerance.
@param latLng click location
@param view map view
@param map map
@param screenClickPercentage screen click percentage between 0.0 and 1.0 for how close a feature
on the screen must be to be included in a click query
@return tolerance distance in meters | [
"Get",
"the",
"allowable",
"tolerance",
"distance",
"in",
"meters",
"from",
"the",
"click",
"location",
"on",
"the",
"map",
"view",
"and",
"map",
"with",
"the",
"screen",
"percentage",
"tolerance",
"."
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java#L162-L172 |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java | AbstractDocumentQuery._whereLucene | @SuppressWarnings("ConstantConditions")
public void _whereLucene(String fieldName, String whereClause, boolean exact) {
"""
Filter the results from the index using the specified where clause.
@param fieldName Field name
@param whereClause Where clause
@param exact Use exact matcher
"""
fieldName = ensureValidFieldName(fieldName, false);
List<QueryToken> tokens = getCurrentWhereTokens();
appendOperatorIfNeeded(tokens);
negateIfNeeded(tokens, fieldName);
WhereToken.WhereOptions options = exact ? new WhereToken.WhereOptions(exact) : null;
WhereToken whereToken = WhereToken.create(WhereOperator.LUCENE, fieldName, addQueryParameter(whereClause), options);
tokens.add(whereToken);
} | java | @SuppressWarnings("ConstantConditions")
public void _whereLucene(String fieldName, String whereClause, boolean exact) {
fieldName = ensureValidFieldName(fieldName, false);
List<QueryToken> tokens = getCurrentWhereTokens();
appendOperatorIfNeeded(tokens);
negateIfNeeded(tokens, fieldName);
WhereToken.WhereOptions options = exact ? new WhereToken.WhereOptions(exact) : null;
WhereToken whereToken = WhereToken.create(WhereOperator.LUCENE, fieldName, addQueryParameter(whereClause), options);
tokens.add(whereToken);
} | [
"@",
"SuppressWarnings",
"(",
"\"ConstantConditions\"",
")",
"public",
"void",
"_whereLucene",
"(",
"String",
"fieldName",
",",
"String",
"whereClause",
",",
"boolean",
"exact",
")",
"{",
"fieldName",
"=",
"ensureValidFieldName",
"(",
"fieldName",
",",
"false",
")",
";",
"List",
"<",
"QueryToken",
">",
"tokens",
"=",
"getCurrentWhereTokens",
"(",
")",
";",
"appendOperatorIfNeeded",
"(",
"tokens",
")",
";",
"negateIfNeeded",
"(",
"tokens",
",",
"fieldName",
")",
";",
"WhereToken",
".",
"WhereOptions",
"options",
"=",
"exact",
"?",
"new",
"WhereToken",
".",
"WhereOptions",
"(",
"exact",
")",
":",
"null",
";",
"WhereToken",
"whereToken",
"=",
"WhereToken",
".",
"create",
"(",
"WhereOperator",
".",
"LUCENE",
",",
"fieldName",
",",
"addQueryParameter",
"(",
"whereClause",
")",
",",
"options",
")",
";",
"tokens",
".",
"add",
"(",
"whereToken",
")",
";",
"}"
] | Filter the results from the index using the specified where clause.
@param fieldName Field name
@param whereClause Where clause
@param exact Use exact matcher | [
"Filter",
"the",
"results",
"from",
"the",
"index",
"using",
"the",
"specified",
"where",
"clause",
"."
] | train | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java#L413-L424 |
stagemonitor/stagemonitor | stagemonitor-tracing/src/main/java/org/stagemonitor/tracing/profiler/CallStackElement.java | CallStackElement.create | public static CallStackElement create(CallStackElement parent, String signature, long startTimestamp) {
"""
This static factory method also sets the parent-child relationships.
@param parent the parent
@param startTimestamp the timestamp at the beginning of the method
"""
CallStackElement cse;
if (useObjectPooling) {
cse = objectPool.poll();
if (cse == null) {
cse = new CallStackElement();
}
} else {
cse = new CallStackElement();
}
cse.executionTime = startTimestamp;
cse.signature = signature;
if (parent != null) {
cse.parent = parent;
parent.children.add(cse);
}
return cse;
} | java | public static CallStackElement create(CallStackElement parent, String signature, long startTimestamp) {
CallStackElement cse;
if (useObjectPooling) {
cse = objectPool.poll();
if (cse == null) {
cse = new CallStackElement();
}
} else {
cse = new CallStackElement();
}
cse.executionTime = startTimestamp;
cse.signature = signature;
if (parent != null) {
cse.parent = parent;
parent.children.add(cse);
}
return cse;
} | [
"public",
"static",
"CallStackElement",
"create",
"(",
"CallStackElement",
"parent",
",",
"String",
"signature",
",",
"long",
"startTimestamp",
")",
"{",
"CallStackElement",
"cse",
";",
"if",
"(",
"useObjectPooling",
")",
"{",
"cse",
"=",
"objectPool",
".",
"poll",
"(",
")",
";",
"if",
"(",
"cse",
"==",
"null",
")",
"{",
"cse",
"=",
"new",
"CallStackElement",
"(",
")",
";",
"}",
"}",
"else",
"{",
"cse",
"=",
"new",
"CallStackElement",
"(",
")",
";",
"}",
"cse",
".",
"executionTime",
"=",
"startTimestamp",
";",
"cse",
".",
"signature",
"=",
"signature",
";",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"cse",
".",
"parent",
"=",
"parent",
";",
"parent",
".",
"children",
".",
"add",
"(",
"cse",
")",
";",
"}",
"return",
"cse",
";",
"}"
] | This static factory method also sets the parent-child relationships.
@param parent the parent
@param startTimestamp the timestamp at the beginning of the method | [
"This",
"static",
"factory",
"method",
"also",
"sets",
"the",
"parent",
"-",
"child",
"relationships",
"."
] | train | https://github.com/stagemonitor/stagemonitor/blob/7a1bf6848906f816aa465983f602ea1f1e8f2b7b/stagemonitor-tracing/src/main/java/org/stagemonitor/tracing/profiler/CallStackElement.java#L55-L73 |
hypercube1024/firefly | firefly/src/main/java/com/firefly/codec/websocket/utils/QuoteUtil.java | QuoteUtil.quoteIfNeeded | public static void quoteIfNeeded(StringBuilder buf, String str, String delim) {
"""
Append into buf the provided string, adding quotes if needed.
<p>
Quoting is determined if any of the characters in the <code>delim</code> are found in the input <code>str</code>.
@param buf the buffer to append to
@param str the string to possibly quote
@param delim the delimiter characters that will trigger automatic quoting
"""
if (str == null) {
return;
}
// check for delimiters in input string
int len = str.length();
if (len == 0) {
return;
}
int ch;
for (int i = 0; i < len; i++) {
ch = str.codePointAt(i);
if (delim.indexOf(ch) >= 0) {
// found a delimiter codepoint. we need to quote it.
quote(buf, str);
return;
}
}
// no special delimiters used, no quote needed.
buf.append(str);
} | java | public static void quoteIfNeeded(StringBuilder buf, String str, String delim) {
if (str == null) {
return;
}
// check for delimiters in input string
int len = str.length();
if (len == 0) {
return;
}
int ch;
for (int i = 0; i < len; i++) {
ch = str.codePointAt(i);
if (delim.indexOf(ch) >= 0) {
// found a delimiter codepoint. we need to quote it.
quote(buf, str);
return;
}
}
// no special delimiters used, no quote needed.
buf.append(str);
} | [
"public",
"static",
"void",
"quoteIfNeeded",
"(",
"StringBuilder",
"buf",
",",
"String",
"str",
",",
"String",
"delim",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
";",
"}",
"// check for delimiters in input string",
"int",
"len",
"=",
"str",
".",
"length",
"(",
")",
";",
"if",
"(",
"len",
"==",
"0",
")",
"{",
"return",
";",
"}",
"int",
"ch",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"ch",
"=",
"str",
".",
"codePointAt",
"(",
"i",
")",
";",
"if",
"(",
"delim",
".",
"indexOf",
"(",
"ch",
")",
">=",
"0",
")",
"{",
"// found a delimiter codepoint. we need to quote it.",
"quote",
"(",
"buf",
",",
"str",
")",
";",
"return",
";",
"}",
"}",
"// no special delimiters used, no quote needed.",
"buf",
".",
"append",
"(",
"str",
")",
";",
"}"
] | Append into buf the provided string, adding quotes if needed.
<p>
Quoting is determined if any of the characters in the <code>delim</code> are found in the input <code>str</code>.
@param buf the buffer to append to
@param str the string to possibly quote
@param delim the delimiter characters that will trigger automatic quoting | [
"Append",
"into",
"buf",
"the",
"provided",
"string",
"adding",
"quotes",
"if",
"needed",
".",
"<p",
">",
"Quoting",
"is",
"determined",
"if",
"any",
"of",
"the",
"characters",
"in",
"the",
"<code",
">",
"delim<",
"/",
"code",
">",
"are",
"found",
"in",
"the",
"input",
"<code",
">",
"str<",
"/",
"code",
">",
"."
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/websocket/utils/QuoteUtil.java#L245-L266 |
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.emitAsync | public EventBus emitAsync(Enum<?> event, Object... args) {
"""
Emit an enum event with parameters and force all listeners to be called asynchronously.
@param event
the target event
@param args
the arguments passed in
@see #emit(Enum, Object...)
"""
return _emitWithOnceBus(eventContextAsync(event, args));
} | java | public EventBus emitAsync(Enum<?> event, Object... args) {
return _emitWithOnceBus(eventContextAsync(event, args));
} | [
"public",
"EventBus",
"emitAsync",
"(",
"Enum",
"<",
"?",
">",
"event",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"_emitWithOnceBus",
"(",
"eventContextAsync",
"(",
"event",
",",
"args",
")",
")",
";",
"}"
] | Emit an enum event with parameters and force all listeners to be called asynchronously.
@param event
the target event
@param args
the arguments passed in
@see #emit(Enum, Object...) | [
"Emit",
"an",
"enum",
"event",
"with",
"parameters",
"and",
"force",
"all",
"listeners",
"to",
"be",
"called",
"asynchronously",
"."
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L1009-L1011 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/DevicesSharesApi.java | DevicesSharesApi.getAllSharesForDevice | public DeviceSharingEnvelope getAllSharesForDevice(String deviceId, Integer count, Integer offset) throws ApiException {
"""
List all shares for the given device id
List all shares for the given device id
@param deviceId Device ID. (required)
@param count Desired count of items in the result set. (optional)
@param offset Offset for pagination. (optional)
@return DeviceSharingEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
"""
ApiResponse<DeviceSharingEnvelope> resp = getAllSharesForDeviceWithHttpInfo(deviceId, count, offset);
return resp.getData();
} | java | public DeviceSharingEnvelope getAllSharesForDevice(String deviceId, Integer count, Integer offset) throws ApiException {
ApiResponse<DeviceSharingEnvelope> resp = getAllSharesForDeviceWithHttpInfo(deviceId, count, offset);
return resp.getData();
} | [
"public",
"DeviceSharingEnvelope",
"getAllSharesForDevice",
"(",
"String",
"deviceId",
",",
"Integer",
"count",
",",
"Integer",
"offset",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"DeviceSharingEnvelope",
">",
"resp",
"=",
"getAllSharesForDeviceWithHttpInfo",
"(",
"deviceId",
",",
"count",
",",
"offset",
")",
";",
"return",
"resp",
".",
"getData",
"(",
")",
";",
"}"
] | List all shares for the given device id
List all shares for the given device id
@param deviceId Device ID. (required)
@param count Desired count of items in the result set. (optional)
@param offset Offset for pagination. (optional)
@return DeviceSharingEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"List",
"all",
"shares",
"for",
"the",
"given",
"device",
"id",
"List",
"all",
"shares",
"for",
"the",
"given",
"device",
"id"
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DevicesSharesApi.java#L388-L391 |
virgo47/javasimon | core/src/main/java/org/javasimon/utils/SimonUtils.java | SimonUtils.calculateStopwatchAggregate | public static StopwatchAggregate calculateStopwatchAggregate(Simon simon, SimonFilter filter) {
"""
Aggregate statistics from all stopwatches in hierarchy that pass specified filter. Filter is applied
to all simons in the hierarchy of all types. If a simon is rejected by filter its children are not considered.
Simons are aggregated in the top-bottom fashion, i.e. parent simons are aggregated before children.
@param simon root of the hierarchy of simons for which statistics will be aggregated
@param filter filter to select subsets of simons to aggregate
@return aggregates statistics
@since 3.5
"""
StopwatchAggregate stopwatchAggregate = new StopwatchAggregate();
aggregateStopwatches(stopwatchAggregate, simon,
filter != null ? filter : SimonFilter.ACCEPT_ALL_FILTER);
return stopwatchAggregate;
} | java | public static StopwatchAggregate calculateStopwatchAggregate(Simon simon, SimonFilter filter) {
StopwatchAggregate stopwatchAggregate = new StopwatchAggregate();
aggregateStopwatches(stopwatchAggregate, simon,
filter != null ? filter : SimonFilter.ACCEPT_ALL_FILTER);
return stopwatchAggregate;
} | [
"public",
"static",
"StopwatchAggregate",
"calculateStopwatchAggregate",
"(",
"Simon",
"simon",
",",
"SimonFilter",
"filter",
")",
"{",
"StopwatchAggregate",
"stopwatchAggregate",
"=",
"new",
"StopwatchAggregate",
"(",
")",
";",
"aggregateStopwatches",
"(",
"stopwatchAggregate",
",",
"simon",
",",
"filter",
"!=",
"null",
"?",
"filter",
":",
"SimonFilter",
".",
"ACCEPT_ALL_FILTER",
")",
";",
"return",
"stopwatchAggregate",
";",
"}"
] | Aggregate statistics from all stopwatches in hierarchy that pass specified filter. Filter is applied
to all simons in the hierarchy of all types. If a simon is rejected by filter its children are not considered.
Simons are aggregated in the top-bottom fashion, i.e. parent simons are aggregated before children.
@param simon root of the hierarchy of simons for which statistics will be aggregated
@param filter filter to select subsets of simons to aggregate
@return aggregates statistics
@since 3.5 | [
"Aggregate",
"statistics",
"from",
"all",
"stopwatches",
"in",
"hierarchy",
"that",
"pass",
"specified",
"filter",
".",
"Filter",
"is",
"applied",
"to",
"all",
"simons",
"in",
"the",
"hierarchy",
"of",
"all",
"types",
".",
"If",
"a",
"simon",
"is",
"rejected",
"by",
"filter",
"its",
"children",
"are",
"not",
"considered",
".",
"Simons",
"are",
"aggregated",
"in",
"the",
"top",
"-",
"bottom",
"fashion",
"i",
".",
"e",
".",
"parent",
"simons",
"are",
"aggregated",
"before",
"children",
"."
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/SimonUtils.java#L406-L412 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/runtime/AbstractJobLauncher.java | AbstractJobLauncher.cancelJob | @Override
public void cancelJob(JobListener jobListener)
throws JobException {
"""
A default implementation of {@link JobLauncher#cancelJob(JobListener)}.
<p>
This implementation relies on two conditional variables: one for the condition that a cancellation
is requested, and the other for the condition that the cancellation is executed. Upon entrance, the
method notifies the cancellation executor started by {@link #startCancellationExecutor()} on the
first conditional variable to indicate that a cancellation has been requested so the executor is
unblocked. Then it waits on the second conditional variable for the cancellation to be executed.
</p>
<p>
The actual execution of the cancellation is handled by the cancellation executor started by the
method {@link #startCancellationExecutor()} that uses the {@link #executeCancellation()} method
to execute the cancellation.
</p>
{@inheritDoc JobLauncher#cancelJob(JobListener)}
"""
synchronized (this.cancellationRequest) {
if (this.cancellationRequested) {
// Return immediately if a cancellation has already been requested
return;
}
this.cancellationRequested = true;
// Notify the cancellation executor that a cancellation has been requested
this.cancellationRequest.notify();
}
synchronized (this.cancellationExecution) {
try {
while (!this.cancellationExecuted) {
// Wait for the cancellation to be executed
this.cancellationExecution.wait();
}
try {
LOG.info("Current job state is: " + this.jobContext.getJobState().getState());
if (this.jobContext.getJobState().getState() != JobState.RunningState.COMMITTED && (
this.jobContext.getJobCommitPolicy() == JobCommitPolicy.COMMIT_SUCCESSFUL_TASKS
|| this.jobContext.getJobCommitPolicy() == JobCommitPolicy.COMMIT_ON_PARTIAL_SUCCESS)) {
this.jobContext.finalizeJobStateBeforeCommit();
this.jobContext.commit(true);
}
this.jobContext.close();
} catch (IOException ioe) {
LOG.error("Could not close job context.", ioe);
}
notifyListeners(this.jobContext, jobListener, TimingEvent.LauncherTimings.JOB_CANCEL, new JobListenerAction() {
@Override
public void apply(JobListener jobListener, JobContext jobContext)
throws Exception {
jobListener.onJobCancellation(jobContext);
}
});
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
}
}
} | java | @Override
public void cancelJob(JobListener jobListener)
throws JobException {
synchronized (this.cancellationRequest) {
if (this.cancellationRequested) {
// Return immediately if a cancellation has already been requested
return;
}
this.cancellationRequested = true;
// Notify the cancellation executor that a cancellation has been requested
this.cancellationRequest.notify();
}
synchronized (this.cancellationExecution) {
try {
while (!this.cancellationExecuted) {
// Wait for the cancellation to be executed
this.cancellationExecution.wait();
}
try {
LOG.info("Current job state is: " + this.jobContext.getJobState().getState());
if (this.jobContext.getJobState().getState() != JobState.RunningState.COMMITTED && (
this.jobContext.getJobCommitPolicy() == JobCommitPolicy.COMMIT_SUCCESSFUL_TASKS
|| this.jobContext.getJobCommitPolicy() == JobCommitPolicy.COMMIT_ON_PARTIAL_SUCCESS)) {
this.jobContext.finalizeJobStateBeforeCommit();
this.jobContext.commit(true);
}
this.jobContext.close();
} catch (IOException ioe) {
LOG.error("Could not close job context.", ioe);
}
notifyListeners(this.jobContext, jobListener, TimingEvent.LauncherTimings.JOB_CANCEL, new JobListenerAction() {
@Override
public void apply(JobListener jobListener, JobContext jobContext)
throws Exception {
jobListener.onJobCancellation(jobContext);
}
});
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
}
}
} | [
"@",
"Override",
"public",
"void",
"cancelJob",
"(",
"JobListener",
"jobListener",
")",
"throws",
"JobException",
"{",
"synchronized",
"(",
"this",
".",
"cancellationRequest",
")",
"{",
"if",
"(",
"this",
".",
"cancellationRequested",
")",
"{",
"// Return immediately if a cancellation has already been requested",
"return",
";",
"}",
"this",
".",
"cancellationRequested",
"=",
"true",
";",
"// Notify the cancellation executor that a cancellation has been requested",
"this",
".",
"cancellationRequest",
".",
"notify",
"(",
")",
";",
"}",
"synchronized",
"(",
"this",
".",
"cancellationExecution",
")",
"{",
"try",
"{",
"while",
"(",
"!",
"this",
".",
"cancellationExecuted",
")",
"{",
"// Wait for the cancellation to be executed",
"this",
".",
"cancellationExecution",
".",
"wait",
"(",
")",
";",
"}",
"try",
"{",
"LOG",
".",
"info",
"(",
"\"Current job state is: \"",
"+",
"this",
".",
"jobContext",
".",
"getJobState",
"(",
")",
".",
"getState",
"(",
")",
")",
";",
"if",
"(",
"this",
".",
"jobContext",
".",
"getJobState",
"(",
")",
".",
"getState",
"(",
")",
"!=",
"JobState",
".",
"RunningState",
".",
"COMMITTED",
"&&",
"(",
"this",
".",
"jobContext",
".",
"getJobCommitPolicy",
"(",
")",
"==",
"JobCommitPolicy",
".",
"COMMIT_SUCCESSFUL_TASKS",
"||",
"this",
".",
"jobContext",
".",
"getJobCommitPolicy",
"(",
")",
"==",
"JobCommitPolicy",
".",
"COMMIT_ON_PARTIAL_SUCCESS",
")",
")",
"{",
"this",
".",
"jobContext",
".",
"finalizeJobStateBeforeCommit",
"(",
")",
";",
"this",
".",
"jobContext",
".",
"commit",
"(",
"true",
")",
";",
"}",
"this",
".",
"jobContext",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Could not close job context.\"",
",",
"ioe",
")",
";",
"}",
"notifyListeners",
"(",
"this",
".",
"jobContext",
",",
"jobListener",
",",
"TimingEvent",
".",
"LauncherTimings",
".",
"JOB_CANCEL",
",",
"new",
"JobListenerAction",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"apply",
"(",
"JobListener",
"jobListener",
",",
"JobContext",
"jobContext",
")",
"throws",
"Exception",
"{",
"jobListener",
".",
"onJobCancellation",
"(",
"jobContext",
")",
";",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ie",
")",
"{",
"Thread",
".",
"currentThread",
"(",
")",
".",
"interrupt",
"(",
")",
";",
"}",
"}",
"}"
] | A default implementation of {@link JobLauncher#cancelJob(JobListener)}.
<p>
This implementation relies on two conditional variables: one for the condition that a cancellation
is requested, and the other for the condition that the cancellation is executed. Upon entrance, the
method notifies the cancellation executor started by {@link #startCancellationExecutor()} on the
first conditional variable to indicate that a cancellation has been requested so the executor is
unblocked. Then it waits on the second conditional variable for the cancellation to be executed.
</p>
<p>
The actual execution of the cancellation is handled by the cancellation executor started by the
method {@link #startCancellationExecutor()} that uses the {@link #executeCancellation()} method
to execute the cancellation.
</p>
{@inheritDoc JobLauncher#cancelJob(JobListener)} | [
"A",
"default",
"implementation",
"of",
"{",
"@link",
"JobLauncher#cancelJob",
"(",
"JobListener",
")",
"}",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/AbstractJobLauncher.java#L251-L295 |
SonarSource/sonarqube | server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleIndex.java | RuleIndex.searchAll | public Iterator<Integer> searchAll(RuleQuery query) {
"""
Return all rule ids matching the search query, without pagination nor facets
"""
SearchRequestBuilder esSearch = client
.prepareSearch(TYPE_RULE)
.setScroll(TimeValue.timeValueMinutes(SCROLL_TIME_IN_MINUTES));
optimizeScrollRequest(esSearch);
QueryBuilder qb = buildQuery(query);
Map<String, QueryBuilder> filters = buildFilters(query);
BoolQueryBuilder fb = boolQuery();
for (QueryBuilder filterBuilder : filters.values()) {
fb.must(filterBuilder);
}
esSearch.setQuery(boolQuery().must(qb).filter(fb));
SearchResponse response = esSearch.get();
return scrollIds(client, response, Integer::parseInt);
} | java | public Iterator<Integer> searchAll(RuleQuery query) {
SearchRequestBuilder esSearch = client
.prepareSearch(TYPE_RULE)
.setScroll(TimeValue.timeValueMinutes(SCROLL_TIME_IN_MINUTES));
optimizeScrollRequest(esSearch);
QueryBuilder qb = buildQuery(query);
Map<String, QueryBuilder> filters = buildFilters(query);
BoolQueryBuilder fb = boolQuery();
for (QueryBuilder filterBuilder : filters.values()) {
fb.must(filterBuilder);
}
esSearch.setQuery(boolQuery().must(qb).filter(fb));
SearchResponse response = esSearch.get();
return scrollIds(client, response, Integer::parseInt);
} | [
"public",
"Iterator",
"<",
"Integer",
">",
"searchAll",
"(",
"RuleQuery",
"query",
")",
"{",
"SearchRequestBuilder",
"esSearch",
"=",
"client",
".",
"prepareSearch",
"(",
"TYPE_RULE",
")",
".",
"setScroll",
"(",
"TimeValue",
".",
"timeValueMinutes",
"(",
"SCROLL_TIME_IN_MINUTES",
")",
")",
";",
"optimizeScrollRequest",
"(",
"esSearch",
")",
";",
"QueryBuilder",
"qb",
"=",
"buildQuery",
"(",
"query",
")",
";",
"Map",
"<",
"String",
",",
"QueryBuilder",
">",
"filters",
"=",
"buildFilters",
"(",
"query",
")",
";",
"BoolQueryBuilder",
"fb",
"=",
"boolQuery",
"(",
")",
";",
"for",
"(",
"QueryBuilder",
"filterBuilder",
":",
"filters",
".",
"values",
"(",
")",
")",
"{",
"fb",
".",
"must",
"(",
"filterBuilder",
")",
";",
"}",
"esSearch",
".",
"setQuery",
"(",
"boolQuery",
"(",
")",
".",
"must",
"(",
"qb",
")",
".",
"filter",
"(",
"fb",
")",
")",
";",
"SearchResponse",
"response",
"=",
"esSearch",
".",
"get",
"(",
")",
";",
"return",
"scrollIds",
"(",
"client",
",",
"response",
",",
"Integer",
"::",
"parseInt",
")",
";",
"}"
] | Return all rule ids matching the search query, without pagination nor facets | [
"Return",
"all",
"rule",
"ids",
"matching",
"the",
"search",
"query",
"without",
"pagination",
"nor",
"facets"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleIndex.java#L172-L189 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/productinfo/ProductInfo.java | ProductInfo.getVersionFilesByProdExtension | public static Map<String, File[]> getVersionFilesByProdExtension(File installDir) {
"""
Retrieves the product extension jar bundles pointed to by the properties file in etc/extensions.
@return The array of product extension jar bundles
"""
Map<String, File[]> versionFiles = new TreeMap<String, File[]>();
Iterator<ProductExtensionInfo> productExtensions = ProductExtension.getProductExtensions().iterator();
while (productExtensions != null && productExtensions.hasNext()) {
ProductExtensionInfo prodExt = productExtensions.next();
String prodExtName = prodExt.getName();
if (0 != prodExtName.length()) {
String prodExtLocation = prodExt.getLocation();
if (prodExtLocation != null) {
String normalizedProdExtLoc = FileUtils.normalize(prodExtLocation);
if (FileUtils.pathIsAbsolute(normalizedProdExtLoc) == false) {
String parentPath = installDir.getParentFile().getAbsolutePath();
normalizedProdExtLoc = FileUtils.normalize(parentPath + "/" + prodExtLocation + "/");
}
File prodExtVersionDir = new File(normalizedProdExtLoc, VERSION_PROPERTY_DIRECTORY);
if (prodExtVersionDir.exists()) {
versionFiles.put(prodExtName, prodExtVersionDir.listFiles(versionFileFilter));
}
}
}
}
return versionFiles;
} | java | public static Map<String, File[]> getVersionFilesByProdExtension(File installDir) {
Map<String, File[]> versionFiles = new TreeMap<String, File[]>();
Iterator<ProductExtensionInfo> productExtensions = ProductExtension.getProductExtensions().iterator();
while (productExtensions != null && productExtensions.hasNext()) {
ProductExtensionInfo prodExt = productExtensions.next();
String prodExtName = prodExt.getName();
if (0 != prodExtName.length()) {
String prodExtLocation = prodExt.getLocation();
if (prodExtLocation != null) {
String normalizedProdExtLoc = FileUtils.normalize(prodExtLocation);
if (FileUtils.pathIsAbsolute(normalizedProdExtLoc) == false) {
String parentPath = installDir.getParentFile().getAbsolutePath();
normalizedProdExtLoc = FileUtils.normalize(parentPath + "/" + prodExtLocation + "/");
}
File prodExtVersionDir = new File(normalizedProdExtLoc, VERSION_PROPERTY_DIRECTORY);
if (prodExtVersionDir.exists()) {
versionFiles.put(prodExtName, prodExtVersionDir.listFiles(versionFileFilter));
}
}
}
}
return versionFiles;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"File",
"[",
"]",
">",
"getVersionFilesByProdExtension",
"(",
"File",
"installDir",
")",
"{",
"Map",
"<",
"String",
",",
"File",
"[",
"]",
">",
"versionFiles",
"=",
"new",
"TreeMap",
"<",
"String",
",",
"File",
"[",
"]",
">",
"(",
")",
";",
"Iterator",
"<",
"ProductExtensionInfo",
">",
"productExtensions",
"=",
"ProductExtension",
".",
"getProductExtensions",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"productExtensions",
"!=",
"null",
"&&",
"productExtensions",
".",
"hasNext",
"(",
")",
")",
"{",
"ProductExtensionInfo",
"prodExt",
"=",
"productExtensions",
".",
"next",
"(",
")",
";",
"String",
"prodExtName",
"=",
"prodExt",
".",
"getName",
"(",
")",
";",
"if",
"(",
"0",
"!=",
"prodExtName",
".",
"length",
"(",
")",
")",
"{",
"String",
"prodExtLocation",
"=",
"prodExt",
".",
"getLocation",
"(",
")",
";",
"if",
"(",
"prodExtLocation",
"!=",
"null",
")",
"{",
"String",
"normalizedProdExtLoc",
"=",
"FileUtils",
".",
"normalize",
"(",
"prodExtLocation",
")",
";",
"if",
"(",
"FileUtils",
".",
"pathIsAbsolute",
"(",
"normalizedProdExtLoc",
")",
"==",
"false",
")",
"{",
"String",
"parentPath",
"=",
"installDir",
".",
"getParentFile",
"(",
")",
".",
"getAbsolutePath",
"(",
")",
";",
"normalizedProdExtLoc",
"=",
"FileUtils",
".",
"normalize",
"(",
"parentPath",
"+",
"\"/\"",
"+",
"prodExtLocation",
"+",
"\"/\"",
")",
";",
"}",
"File",
"prodExtVersionDir",
"=",
"new",
"File",
"(",
"normalizedProdExtLoc",
",",
"VERSION_PROPERTY_DIRECTORY",
")",
";",
"if",
"(",
"prodExtVersionDir",
".",
"exists",
"(",
")",
")",
"{",
"versionFiles",
".",
"put",
"(",
"prodExtName",
",",
"prodExtVersionDir",
".",
"listFiles",
"(",
"versionFileFilter",
")",
")",
";",
"}",
"}",
"}",
"}",
"return",
"versionFiles",
";",
"}"
] | Retrieves the product extension jar bundles pointed to by the properties file in etc/extensions.
@return The array of product extension jar bundles | [
"Retrieves",
"the",
"product",
"extension",
"jar",
"bundles",
"pointed",
"to",
"by",
"the",
"properties",
"file",
"in",
"etc",
"/",
"extensions",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/productinfo/ProductInfo.java#L254-L280 |
qiniu/java-sdk | src/main/java/com/qiniu/storage/BucketManager.java | BucketManager.changeType | public Response changeType(String bucket, String key, StorageType type)
throws QiniuException {
"""
修改文件的类型(普通存储或低频存储)
@param bucket 空间名称
@param key 文件名称
@param type type=0 表示普通存储,type=1 表示低频存存储
@throws QiniuException
"""
String resource = encodedEntry(bucket, key);
String path = String.format("/chtype/%s/type/%d", resource, type.ordinal());
return rsPost(bucket, path, null);
} | java | public Response changeType(String bucket, String key, StorageType type)
throws QiniuException {
String resource = encodedEntry(bucket, key);
String path = String.format("/chtype/%s/type/%d", resource, type.ordinal());
return rsPost(bucket, path, null);
} | [
"public",
"Response",
"changeType",
"(",
"String",
"bucket",
",",
"String",
"key",
",",
"StorageType",
"type",
")",
"throws",
"QiniuException",
"{",
"String",
"resource",
"=",
"encodedEntry",
"(",
"bucket",
",",
"key",
")",
";",
"String",
"path",
"=",
"String",
".",
"format",
"(",
"\"/chtype/%s/type/%d\"",
",",
"resource",
",",
"type",
".",
"ordinal",
"(",
")",
")",
";",
"return",
"rsPost",
"(",
"bucket",
",",
"path",
",",
"null",
")",
";",
"}"
] | 修改文件的类型(普通存储或低频存储)
@param bucket 空间名称
@param key 文件名称
@param type type=0 表示普通存储,type=1 表示低频存存储
@throws QiniuException | [
"修改文件的类型(普通存储或低频存储)"
] | train | https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/storage/BucketManager.java#L309-L314 |
Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClient.java | ManagementClient.getSubscriptionRuntimeInfo | public SubscriptionRuntimeInfo getSubscriptionRuntimeInfo(String topicPath, String subscriptionName) throws ServiceBusException, InterruptedException {
"""
Retrieves the runtime information of a subscription in a given topic
@param topicPath - The path of the topic relative to service bus namespace.
@param subscriptionName - The name of the subscription
@return - SubscriptionRuntimeInfo containing the runtime information about the subscription.
@throws IllegalArgumentException - Thrown if path is null, empty, or not in right format or length.
@throws TimeoutException - The operation times out. The timeout period is initiated through ClientSettings.operationTimeout
@throws MessagingEntityNotFoundException - Entity with this name doesn't exist.
@throws AuthorizationFailedException - No sufficient permission to perform this operation. Please check ClientSettings.tokenProvider has correct details.
@throws ServerBusyException - The server is busy. You should wait before you retry the operation.
@throws ServiceBusException - An internal error or an unexpected exception occurred.
@throws InterruptedException if the current thread was interrupted
"""
return Utils.completeFuture(this.asyncClient.getSubscriptionRuntimeInfoAsync(topicPath, subscriptionName));
} | java | public SubscriptionRuntimeInfo getSubscriptionRuntimeInfo(String topicPath, String subscriptionName) throws ServiceBusException, InterruptedException {
return Utils.completeFuture(this.asyncClient.getSubscriptionRuntimeInfoAsync(topicPath, subscriptionName));
} | [
"public",
"SubscriptionRuntimeInfo",
"getSubscriptionRuntimeInfo",
"(",
"String",
"topicPath",
",",
"String",
"subscriptionName",
")",
"throws",
"ServiceBusException",
",",
"InterruptedException",
"{",
"return",
"Utils",
".",
"completeFuture",
"(",
"this",
".",
"asyncClient",
".",
"getSubscriptionRuntimeInfoAsync",
"(",
"topicPath",
",",
"subscriptionName",
")",
")",
";",
"}"
] | Retrieves the runtime information of a subscription in a given topic
@param topicPath - The path of the topic relative to service bus namespace.
@param subscriptionName - The name of the subscription
@return - SubscriptionRuntimeInfo containing the runtime information about the subscription.
@throws IllegalArgumentException - Thrown if path is null, empty, or not in right format or length.
@throws TimeoutException - The operation times out. The timeout period is initiated through ClientSettings.operationTimeout
@throws MessagingEntityNotFoundException - Entity with this name doesn't exist.
@throws AuthorizationFailedException - No sufficient permission to perform this operation. Please check ClientSettings.tokenProvider has correct details.
@throws ServerBusyException - The server is busy. You should wait before you retry the operation.
@throws ServiceBusException - An internal error or an unexpected exception occurred.
@throws InterruptedException if the current thread was interrupted | [
"Retrieves",
"the",
"runtime",
"information",
"of",
"a",
"subscription",
"in",
"a",
"given",
"topic"
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClient.java#L132-L134 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java | JobScheduleOperations.patchJobSchedule | public void patchJobSchedule(String jobScheduleId, Schedule schedule, JobSpecification jobSpecification, List<MetadataItem> metadata, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
"""
Updates the specified job schedule.
This method only replaces the properties specified with non-null values.
@param jobScheduleId The ID of the job schedule.
@param schedule The schedule according to which jobs will be created. If null, any existing schedule is left unchanged.
@param jobSpecification The details of the jobs to be created on this schedule. Updates affect only jobs that are started after the update has taken place. Any currently active job continues with the older specification. If null, the existing job specification is left unchanged.
@param metadata A list of name-value pairs associated with the job schedule as metadata. If null, the existing metadata are left unchanged.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
"""
JobSchedulePatchOptions options = new JobSchedulePatchOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
JobSchedulePatchParameter param = new JobSchedulePatchParameter()
.withJobSpecification(jobSpecification)
.withMetadata(metadata)
.withSchedule(schedule);
this.parentBatchClient.protocolLayer().jobSchedules().patch(jobScheduleId, param, options);
} | java | public void patchJobSchedule(String jobScheduleId, Schedule schedule, JobSpecification jobSpecification, List<MetadataItem> metadata, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobSchedulePatchOptions options = new JobSchedulePatchOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
JobSchedulePatchParameter param = new JobSchedulePatchParameter()
.withJobSpecification(jobSpecification)
.withMetadata(metadata)
.withSchedule(schedule);
this.parentBatchClient.protocolLayer().jobSchedules().patch(jobScheduleId, param, options);
} | [
"public",
"void",
"patchJobSchedule",
"(",
"String",
"jobScheduleId",
",",
"Schedule",
"schedule",
",",
"JobSpecification",
"jobSpecification",
",",
"List",
"<",
"MetadataItem",
">",
"metadata",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"JobSchedulePatchOptions",
"options",
"=",
"new",
"JobSchedulePatchOptions",
"(",
")",
";",
"BehaviorManager",
"bhMgr",
"=",
"new",
"BehaviorManager",
"(",
"this",
".",
"customBehaviors",
"(",
")",
",",
"additionalBehaviors",
")",
";",
"bhMgr",
".",
"applyRequestBehaviors",
"(",
"options",
")",
";",
"JobSchedulePatchParameter",
"param",
"=",
"new",
"JobSchedulePatchParameter",
"(",
")",
".",
"withJobSpecification",
"(",
"jobSpecification",
")",
".",
"withMetadata",
"(",
"metadata",
")",
".",
"withSchedule",
"(",
"schedule",
")",
";",
"this",
".",
"parentBatchClient",
".",
"protocolLayer",
"(",
")",
".",
"jobSchedules",
"(",
")",
".",
"patch",
"(",
"jobScheduleId",
",",
"param",
",",
"options",
")",
";",
"}"
] | Updates the specified job schedule.
This method only replaces the properties specified with non-null values.
@param jobScheduleId The ID of the job schedule.
@param schedule The schedule according to which jobs will be created. If null, any existing schedule is left unchanged.
@param jobSpecification The details of the jobs to be created on this schedule. Updates affect only jobs that are started after the update has taken place. Any currently active job continues with the older specification. If null, the existing job specification is left unchanged.
@param metadata A list of name-value pairs associated with the job schedule as metadata. If null, the existing metadata are left unchanged.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Updates",
"the",
"specified",
"job",
"schedule",
".",
"This",
"method",
"only",
"replaces",
"the",
"properties",
"specified",
"with",
"non",
"-",
"null",
"values",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java#L209-L219 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.spare_spare_serviceInfos_GET | public OvhService spare_spare_serviceInfos_GET(String spare) throws IOException {
"""
Get this object properties
REST: GET /telephony/spare/{spare}/serviceInfos
@param spare [required] The internal name of your spare
"""
String qPath = "/telephony/spare/{spare}/serviceInfos";
StringBuilder sb = path(qPath, spare);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhService.class);
} | java | public OvhService spare_spare_serviceInfos_GET(String spare) throws IOException {
String qPath = "/telephony/spare/{spare}/serviceInfos";
StringBuilder sb = path(qPath, spare);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhService.class);
} | [
"public",
"OvhService",
"spare_spare_serviceInfos_GET",
"(",
"String",
"spare",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/spare/{spare}/serviceInfos\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"spare",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhService",
".",
"class",
")",
";",
"}"
] | Get this object properties
REST: GET /telephony/spare/{spare}/serviceInfos
@param spare [required] The internal name of your spare | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L9065-L9070 |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/JADT.java | JADT.parseAndEmit | public void parseAndEmit(String srcPath, final String destDir) {
"""
Do the jADT thing given the srceFileName and destination directory
@param srcPath full name of the source directory or file
@param destDir full name of the destination directory (trailing slash is optional)
"""
final String version = new Version().getVersion();
logger.info("jADT version " + version + ".");
logger.info("Will read from source " + srcPath);
logger.info("Will write to destDir " + destDir);
final List<? extends Source> sources = sourceFactory.createSources(srcPath);
for (Source source : sources) {
final List<UserError> errors = new ArrayList<UserError>();
final ParseResult result = parser.parse(source);
for (SyntaxError error : result.errors) {
errors.add(UserError._Syntactic(error));
}
final List<SemanticError> semanticErrors = checker.check(result.doc);
for (SemanticError error : semanticErrors) {
errors.add(UserError._Semantic(error));
}
if (!errors.isEmpty()) {
throw new JADTUserErrorsException(errors);
}
emitter.emit(factoryFactory.createSinkFactory(destDir), result.doc);
}
} | java | public void parseAndEmit(String srcPath, final String destDir) {
final String version = new Version().getVersion();
logger.info("jADT version " + version + ".");
logger.info("Will read from source " + srcPath);
logger.info("Will write to destDir " + destDir);
final List<? extends Source> sources = sourceFactory.createSources(srcPath);
for (Source source : sources) {
final List<UserError> errors = new ArrayList<UserError>();
final ParseResult result = parser.parse(source);
for (SyntaxError error : result.errors) {
errors.add(UserError._Syntactic(error));
}
final List<SemanticError> semanticErrors = checker.check(result.doc);
for (SemanticError error : semanticErrors) {
errors.add(UserError._Semantic(error));
}
if (!errors.isEmpty()) {
throw new JADTUserErrorsException(errors);
}
emitter.emit(factoryFactory.createSinkFactory(destDir), result.doc);
}
} | [
"public",
"void",
"parseAndEmit",
"(",
"String",
"srcPath",
",",
"final",
"String",
"destDir",
")",
"{",
"final",
"String",
"version",
"=",
"new",
"Version",
"(",
")",
".",
"getVersion",
"(",
")",
";",
"logger",
".",
"info",
"(",
"\"jADT version \"",
"+",
"version",
"+",
"\".\"",
")",
";",
"logger",
".",
"info",
"(",
"\"Will read from source \"",
"+",
"srcPath",
")",
";",
"logger",
".",
"info",
"(",
"\"Will write to destDir \"",
"+",
"destDir",
")",
";",
"final",
"List",
"<",
"?",
"extends",
"Source",
">",
"sources",
"=",
"sourceFactory",
".",
"createSources",
"(",
"srcPath",
")",
";",
"for",
"(",
"Source",
"source",
":",
"sources",
")",
"{",
"final",
"List",
"<",
"UserError",
">",
"errors",
"=",
"new",
"ArrayList",
"<",
"UserError",
">",
"(",
")",
";",
"final",
"ParseResult",
"result",
"=",
"parser",
".",
"parse",
"(",
"source",
")",
";",
"for",
"(",
"SyntaxError",
"error",
":",
"result",
".",
"errors",
")",
"{",
"errors",
".",
"add",
"(",
"UserError",
".",
"_Syntactic",
"(",
"error",
")",
")",
";",
"}",
"final",
"List",
"<",
"SemanticError",
">",
"semanticErrors",
"=",
"checker",
".",
"check",
"(",
"result",
".",
"doc",
")",
";",
"for",
"(",
"SemanticError",
"error",
":",
"semanticErrors",
")",
"{",
"errors",
".",
"add",
"(",
"UserError",
".",
"_Semantic",
"(",
"error",
")",
")",
";",
"}",
"if",
"(",
"!",
"errors",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"JADTUserErrorsException",
"(",
"errors",
")",
";",
"}",
"emitter",
".",
"emit",
"(",
"factoryFactory",
".",
"createSinkFactory",
"(",
"destDir",
")",
",",
"result",
".",
"doc",
")",
";",
"}",
"}"
] | Do the jADT thing given the srceFileName and destination directory
@param srcPath full name of the source directory or file
@param destDir full name of the destination directory (trailing slash is optional) | [
"Do",
"the",
"jADT",
"thing",
"given",
"the",
"srceFileName",
"and",
"destination",
"directory"
] | train | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/JADT.java#L148-L171 |
UrielCh/ovh-java-sdk | ovh-java-sdk-licenseoffice/src/main/java/net/minidev/ovh/api/ApiOvhLicenseoffice.java | ApiOvhLicenseoffice.serviceName_user_activationEmail_PUT | public void serviceName_user_activationEmail_PUT(String serviceName, String activationEmail, OvhOfficeUser body) throws IOException {
"""
Alter this object properties
REST: PUT /license/office/{serviceName}/user/{activationEmail}
@param body [required] New object properties
@param serviceName [required] The unique identifier of your Office service
@param activationEmail [required] Email used to activate Microsoft Office
"""
String qPath = "/license/office/{serviceName}/user/{activationEmail}";
StringBuilder sb = path(qPath, serviceName, activationEmail);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_user_activationEmail_PUT(String serviceName, String activationEmail, OvhOfficeUser body) throws IOException {
String qPath = "/license/office/{serviceName}/user/{activationEmail}";
StringBuilder sb = path(qPath, serviceName, activationEmail);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_user_activationEmail_PUT",
"(",
"String",
"serviceName",
",",
"String",
"activationEmail",
",",
"OvhOfficeUser",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/license/office/{serviceName}/user/{activationEmail}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"activationEmail",
")",
";",
"exec",
"(",
"qPath",
",",
"\"PUT\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"body",
")",
";",
"}"
] | Alter this object properties
REST: PUT /license/office/{serviceName}/user/{activationEmail}
@param body [required] New object properties
@param serviceName [required] The unique identifier of your Office service
@param activationEmail [required] Email used to activate Microsoft Office | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-licenseoffice/src/main/java/net/minidev/ovh/api/ApiOvhLicenseoffice.java#L165-L169 |
keenlabs/KeenClient-Java | query/src/main/java/io/keen/client/java/SubAnalysis.java | SubAnalysis.constructParameterRequestArgs | @Override
Map<String, Object> constructParameterRequestArgs() {
"""
Constructs request sub-parameters for this SubAnalysis.
{@inheritDoc}
@return A jsonifiable object that should be the value for a key with the name of the label
of this SubAnalysis instance.
"""
// The label needs to be the key and this object is the value. Unfortunately that means
// whatever parent object calls this needs to know to use this label as the key.
// We could fix this by changing RequestParameter's interface to take the outer Map<> as a
// parameter, and then each RequestParameter would know whether to add a Map<> or a
// Collection<> or just add a (K, V).
Map<String, Object> subAnalysisInfo = new HashMap<String, Object>(4);
subAnalysisInfo.put(KeenQueryConstants.ANALYSIS_TYPE, this.analysisType.toString());
if (QueryType.COUNT != this.analysisType) {
subAnalysisInfo.put(KeenQueryConstants.TARGET_PROPERTY, this.targetPropertyName);
}
if (QueryType.PERCENTILE == analysisType) {
// Put the raw Double in here for JSON serialization for now
subAnalysisInfo.put(KeenQueryConstants.PERCENTILE, this.percentile.asDouble());
}
return subAnalysisInfo;
} | java | @Override
Map<String, Object> constructParameterRequestArgs() {
// The label needs to be the key and this object is the value. Unfortunately that means
// whatever parent object calls this needs to know to use this label as the key.
// We could fix this by changing RequestParameter's interface to take the outer Map<> as a
// parameter, and then each RequestParameter would know whether to add a Map<> or a
// Collection<> or just add a (K, V).
Map<String, Object> subAnalysisInfo = new HashMap<String, Object>(4);
subAnalysisInfo.put(KeenQueryConstants.ANALYSIS_TYPE, this.analysisType.toString());
if (QueryType.COUNT != this.analysisType) {
subAnalysisInfo.put(KeenQueryConstants.TARGET_PROPERTY, this.targetPropertyName);
}
if (QueryType.PERCENTILE == analysisType) {
// Put the raw Double in here for JSON serialization for now
subAnalysisInfo.put(KeenQueryConstants.PERCENTILE, this.percentile.asDouble());
}
return subAnalysisInfo;
} | [
"@",
"Override",
"Map",
"<",
"String",
",",
"Object",
">",
"constructParameterRequestArgs",
"(",
")",
"{",
"// The label needs to be the key and this object is the value. Unfortunately that means",
"// whatever parent object calls this needs to know to use this label as the key.",
"// We could fix this by changing RequestParameter's interface to take the outer Map<> as a",
"// parameter, and then each RequestParameter would know whether to add a Map<> or a",
"// Collection<> or just add a (K, V).",
"Map",
"<",
"String",
",",
"Object",
">",
"subAnalysisInfo",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
"4",
")",
";",
"subAnalysisInfo",
".",
"put",
"(",
"KeenQueryConstants",
".",
"ANALYSIS_TYPE",
",",
"this",
".",
"analysisType",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"QueryType",
".",
"COUNT",
"!=",
"this",
".",
"analysisType",
")",
"{",
"subAnalysisInfo",
".",
"put",
"(",
"KeenQueryConstants",
".",
"TARGET_PROPERTY",
",",
"this",
".",
"targetPropertyName",
")",
";",
"}",
"if",
"(",
"QueryType",
".",
"PERCENTILE",
"==",
"analysisType",
")",
"{",
"// Put the raw Double in here for JSON serialization for now",
"subAnalysisInfo",
".",
"put",
"(",
"KeenQueryConstants",
".",
"PERCENTILE",
",",
"this",
".",
"percentile",
".",
"asDouble",
"(",
")",
")",
";",
"}",
"return",
"subAnalysisInfo",
";",
"}"
] | Constructs request sub-parameters for this SubAnalysis.
{@inheritDoc}
@return A jsonifiable object that should be the value for a key with the name of the label
of this SubAnalysis instance. | [
"Constructs",
"request",
"sub",
"-",
"parameters",
"for",
"this",
"SubAnalysis",
"."
] | train | https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/query/src/main/java/io/keen/client/java/SubAnalysis.java#L103-L124 |
hibernate/hibernate-ogm | core/src/main/java/org/hibernate/ogm/datastore/document/impl/EmbeddableStateFinder.java | EmbeddableStateFinder.getOuterMostNullEmbeddableIfAny | public String getOuterMostNullEmbeddableIfAny(String column) {
"""
Should only called on a column that is being set to null.
Returns the most outer embeddable containing {@code column} that is entirely null.
Return null otherwise i.e. not embeddable.
The implementation lazily compute the embeddable state and caches it.
The idea behind the lazy computation is that only some columns will be set to null
and only in some situations.
The idea behind caching is that an embeddable contains several columns, no need to recompute its state.
"""
String[] path = column.split( "\\." );
if ( !isEmbeddableColumn( path ) ) {
return null;
}
// the cached value may be null hence the explicit key lookup
if ( columnToOuterMostNullEmbeddableCache.containsKey( column ) ) {
return columnToOuterMostNullEmbeddableCache.get( column );
}
return determineAndCacheOuterMostNullEmbeddable( column, path );
} | java | public String getOuterMostNullEmbeddableIfAny(String column) {
String[] path = column.split( "\\." );
if ( !isEmbeddableColumn( path ) ) {
return null;
}
// the cached value may be null hence the explicit key lookup
if ( columnToOuterMostNullEmbeddableCache.containsKey( column ) ) {
return columnToOuterMostNullEmbeddableCache.get( column );
}
return determineAndCacheOuterMostNullEmbeddable( column, path );
} | [
"public",
"String",
"getOuterMostNullEmbeddableIfAny",
"(",
"String",
"column",
")",
"{",
"String",
"[",
"]",
"path",
"=",
"column",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"if",
"(",
"!",
"isEmbeddableColumn",
"(",
"path",
")",
")",
"{",
"return",
"null",
";",
"}",
"// the cached value may be null hence the explicit key lookup",
"if",
"(",
"columnToOuterMostNullEmbeddableCache",
".",
"containsKey",
"(",
"column",
")",
")",
"{",
"return",
"columnToOuterMostNullEmbeddableCache",
".",
"get",
"(",
"column",
")",
";",
"}",
"return",
"determineAndCacheOuterMostNullEmbeddable",
"(",
"column",
",",
"path",
")",
";",
"}"
] | Should only called on a column that is being set to null.
Returns the most outer embeddable containing {@code column} that is entirely null.
Return null otherwise i.e. not embeddable.
The implementation lazily compute the embeddable state and caches it.
The idea behind the lazy computation is that only some columns will be set to null
and only in some situations.
The idea behind caching is that an embeddable contains several columns, no need to recompute its state. | [
"Should",
"only",
"called",
"on",
"a",
"column",
"that",
"is",
"being",
"set",
"to",
"null",
"."
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/datastore/document/impl/EmbeddableStateFinder.java#L48-L58 |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ThreadGroupTracker.java | ThreadGroupTracker.getThreadGroup | ThreadGroup getThreadGroup(String identifier, String threadFactoryName, ThreadGroup parentGroup) {
"""
Returns the thread group to use for the specified application component.
@param jeeName name of the application component
@param threadFactoryName unique identifier for the thread factory
@param parentGroup parent thread group
@return child thread group for the application component. Null if the application component isn't active.
@throws IllegalStateException if the application component is not available.
"""
ConcurrentHashMap<String, ThreadGroup> threadFactoryToThreadGroup = metadataIdentifierToThreadGroups.get(identifier);
if (threadFactoryToThreadGroup == null)
if (metadataIdentifierService.isMetaDataAvailable(identifier)) {
threadFactoryToThreadGroup = new ConcurrentHashMap<String, ThreadGroup>();
ConcurrentHashMap<String, ThreadGroup> added = metadataIdentifierToThreadGroups.putIfAbsent(identifier, threadFactoryToThreadGroup);
if (added != null)
threadFactoryToThreadGroup = added;
} else
throw new IllegalStateException(identifier.toString());
ThreadGroup group = threadFactoryToThreadGroup.get(threadFactoryName);
if (group == null)
group = AccessController.doPrivileged(new CreateThreadGroupIfAbsentAction(parentGroup, threadFactoryName, identifier, threadFactoryToThreadGroup),
serverAccessControlContext);
return group;
} | java | ThreadGroup getThreadGroup(String identifier, String threadFactoryName, ThreadGroup parentGroup) {
ConcurrentHashMap<String, ThreadGroup> threadFactoryToThreadGroup = metadataIdentifierToThreadGroups.get(identifier);
if (threadFactoryToThreadGroup == null)
if (metadataIdentifierService.isMetaDataAvailable(identifier)) {
threadFactoryToThreadGroup = new ConcurrentHashMap<String, ThreadGroup>();
ConcurrentHashMap<String, ThreadGroup> added = metadataIdentifierToThreadGroups.putIfAbsent(identifier, threadFactoryToThreadGroup);
if (added != null)
threadFactoryToThreadGroup = added;
} else
throw new IllegalStateException(identifier.toString());
ThreadGroup group = threadFactoryToThreadGroup.get(threadFactoryName);
if (group == null)
group = AccessController.doPrivileged(new CreateThreadGroupIfAbsentAction(parentGroup, threadFactoryName, identifier, threadFactoryToThreadGroup),
serverAccessControlContext);
return group;
} | [
"ThreadGroup",
"getThreadGroup",
"(",
"String",
"identifier",
",",
"String",
"threadFactoryName",
",",
"ThreadGroup",
"parentGroup",
")",
"{",
"ConcurrentHashMap",
"<",
"String",
",",
"ThreadGroup",
">",
"threadFactoryToThreadGroup",
"=",
"metadataIdentifierToThreadGroups",
".",
"get",
"(",
"identifier",
")",
";",
"if",
"(",
"threadFactoryToThreadGroup",
"==",
"null",
")",
"if",
"(",
"metadataIdentifierService",
".",
"isMetaDataAvailable",
"(",
"identifier",
")",
")",
"{",
"threadFactoryToThreadGroup",
"=",
"new",
"ConcurrentHashMap",
"<",
"String",
",",
"ThreadGroup",
">",
"(",
")",
";",
"ConcurrentHashMap",
"<",
"String",
",",
"ThreadGroup",
">",
"added",
"=",
"metadataIdentifierToThreadGroups",
".",
"putIfAbsent",
"(",
"identifier",
",",
"threadFactoryToThreadGroup",
")",
";",
"if",
"(",
"added",
"!=",
"null",
")",
"threadFactoryToThreadGroup",
"=",
"added",
";",
"}",
"else",
"throw",
"new",
"IllegalStateException",
"(",
"identifier",
".",
"toString",
"(",
")",
")",
";",
"ThreadGroup",
"group",
"=",
"threadFactoryToThreadGroup",
".",
"get",
"(",
"threadFactoryName",
")",
";",
"if",
"(",
"group",
"==",
"null",
")",
"group",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"CreateThreadGroupIfAbsentAction",
"(",
"parentGroup",
",",
"threadFactoryName",
",",
"identifier",
",",
"threadFactoryToThreadGroup",
")",
",",
"serverAccessControlContext",
")",
";",
"return",
"group",
";",
"}"
] | Returns the thread group to use for the specified application component.
@param jeeName name of the application component
@param threadFactoryName unique identifier for the thread factory
@param parentGroup parent thread group
@return child thread group for the application component. Null if the application component isn't active.
@throws IllegalStateException if the application component is not available. | [
"Returns",
"the",
"thread",
"group",
"to",
"use",
"for",
"the",
"specified",
"application",
"component",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ThreadGroupTracker.java#L107-L123 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/ManagedObject.java | ManagedObject.setState | private void setState(int[] nextState)
throws StateErrorException {
"""
Makes a state transition.
@param nextState maps the current stte to the new one.
@throws StateErrorException if the transition is invalid.
"""
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
"setState",
new Object[] { nextState,
new Integer(state),
stateNames[state] });
synchronized (stateLock) {
previousState = state; // Capture the previous state for dump.
state = nextState[state]; // Make the state change.
} // synchronized (stateLock)
if (state == stateError) {
StateErrorException stateErrorException = new StateErrorException(this, previousState, stateNames[previousState]);
ObjectManager.ffdc.processException(this, cclass, "setState", stateErrorException, "1:2016:1.34");
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"setState",
new Object[] { stateErrorException,
new Integer(state),
stateNames[state] });
throw stateErrorException;
} // if (state == stateError).
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this
, cclass
, "setState"
, "state=" + state + "(int) " + stateNames[state] + "(String)"
);
} | java | private void setState(int[] nextState)
throws StateErrorException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
"setState",
new Object[] { nextState,
new Integer(state),
stateNames[state] });
synchronized (stateLock) {
previousState = state; // Capture the previous state for dump.
state = nextState[state]; // Make the state change.
} // synchronized (stateLock)
if (state == stateError) {
StateErrorException stateErrorException = new StateErrorException(this, previousState, stateNames[previousState]);
ObjectManager.ffdc.processException(this, cclass, "setState", stateErrorException, "1:2016:1.34");
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"setState",
new Object[] { stateErrorException,
new Integer(state),
stateNames[state] });
throw stateErrorException;
} // if (state == stateError).
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this
, cclass
, "setState"
, "state=" + state + "(int) " + stateNames[state] + "(String)"
);
} | [
"private",
"void",
"setState",
"(",
"int",
"[",
"]",
"nextState",
")",
"throws",
"StateErrorException",
"{",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"setState\"",
",",
"new",
"Object",
"[",
"]",
"{",
"nextState",
",",
"new",
"Integer",
"(",
"state",
")",
",",
"stateNames",
"[",
"state",
"]",
"}",
")",
";",
"synchronized",
"(",
"stateLock",
")",
"{",
"previousState",
"=",
"state",
";",
"// Capture the previous state for dump. ",
"state",
"=",
"nextState",
"[",
"state",
"]",
";",
"// Make the state change. ",
"}",
"// synchronized (stateLock) ",
"if",
"(",
"state",
"==",
"stateError",
")",
"{",
"StateErrorException",
"stateErrorException",
"=",
"new",
"StateErrorException",
"(",
"this",
",",
"previousState",
",",
"stateNames",
"[",
"previousState",
"]",
")",
";",
"ObjectManager",
".",
"ffdc",
".",
"processException",
"(",
"this",
",",
"cclass",
",",
"\"setState\"",
",",
"stateErrorException",
",",
"\"1:2016:1.34\"",
")",
";",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"setState\"",
",",
"new",
"Object",
"[",
"]",
"{",
"stateErrorException",
",",
"new",
"Integer",
"(",
"state",
")",
",",
"stateNames",
"[",
"state",
"]",
"}",
")",
";",
"throw",
"stateErrorException",
";",
"}",
"// if (state == stateError). ",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"setState\"",
",",
"\"state=\"",
"+",
"state",
"+",
"\"(int) \"",
"+",
"stateNames",
"[",
"state",
"]",
"+",
"\"(String)\"",
")",
";",
"}"
] | Makes a state transition.
@param nextState maps the current stte to the new one.
@throws StateErrorException if the transition is invalid. | [
"Makes",
"a",
"state",
"transition",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/ManagedObject.java#L1997-L2033 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java | CPOptionPersistenceImpl.findByC_ERC | @Override
public CPOption findByC_ERC(long companyId, String externalReferenceCode)
throws NoSuchCPOptionException {
"""
Returns the cp option where companyId = ? and externalReferenceCode = ? or throws a {@link NoSuchCPOptionException} if it could not be found.
@param companyId the company ID
@param externalReferenceCode the external reference code
@return the matching cp option
@throws NoSuchCPOptionException if a matching cp option could not be found
"""
CPOption cpOption = fetchByC_ERC(companyId, externalReferenceCode);
if (cpOption == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("companyId=");
msg.append(companyId);
msg.append(", externalReferenceCode=");
msg.append(externalReferenceCode);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPOptionException(msg.toString());
}
return cpOption;
} | java | @Override
public CPOption findByC_ERC(long companyId, String externalReferenceCode)
throws NoSuchCPOptionException {
CPOption cpOption = fetchByC_ERC(companyId, externalReferenceCode);
if (cpOption == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("companyId=");
msg.append(companyId);
msg.append(", externalReferenceCode=");
msg.append(externalReferenceCode);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPOptionException(msg.toString());
}
return cpOption;
} | [
"@",
"Override",
"public",
"CPOption",
"findByC_ERC",
"(",
"long",
"companyId",
",",
"String",
"externalReferenceCode",
")",
"throws",
"NoSuchCPOptionException",
"{",
"CPOption",
"cpOption",
"=",
"fetchByC_ERC",
"(",
"companyId",
",",
"externalReferenceCode",
")",
";",
"if",
"(",
"cpOption",
"==",
"null",
")",
"{",
"StringBundler",
"msg",
"=",
"new",
"StringBundler",
"(",
"6",
")",
";",
"msg",
".",
"append",
"(",
"_NO_SUCH_ENTITY_WITH_KEY",
")",
";",
"msg",
".",
"append",
"(",
"\"companyId=\"",
")",
";",
"msg",
".",
"append",
"(",
"companyId",
")",
";",
"msg",
".",
"append",
"(",
"\", externalReferenceCode=\"",
")",
";",
"msg",
".",
"append",
"(",
"externalReferenceCode",
")",
";",
"msg",
".",
"append",
"(",
"\"}\"",
")",
";",
"if",
"(",
"_log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"_log",
".",
"debug",
"(",
"msg",
".",
"toString",
"(",
")",
")",
";",
"}",
"throw",
"new",
"NoSuchCPOptionException",
"(",
"msg",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"cpOption",
";",
"}"
] | Returns the cp option where companyId = ? and externalReferenceCode = ? or throws a {@link NoSuchCPOptionException} if it could not be found.
@param companyId the company ID
@param externalReferenceCode the external reference code
@return the matching cp option
@throws NoSuchCPOptionException if a matching cp option could not be found | [
"Returns",
"the",
"cp",
"option",
"where",
"companyId",
"=",
"?",
";",
"and",
"externalReferenceCode",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchCPOptionException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java#L2239-L2265 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java | JobScheduler.scheduleJobImmediately | public Future<?> scheduleJobImmediately(Properties jobProps, JobListener jobListener, JobLauncher jobLauncher) {
"""
Schedule a job immediately.
<p>
This method calls the Quartz scheduler to scheduler the job.
</p>
@param jobProps Job configuration properties
@param jobListener {@link JobListener} used for callback,
can be <em>null</em> if no callback is needed.
@throws JobException when there is anything wrong
with scheduling the job
"""
Callable<Void> callable = new Callable<Void>() {
@Override
public Void call() throws JobException {
try {
runJob(jobProps, jobListener, jobLauncher);
} catch (JobException je) {
LOG.error("Failed to run job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), je);
throw je;
}
return null;
}
};
final Future<?> future = this.jobExecutor.submit(callable);
return new Future() {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
if (!cancelRequested) {
return false;
}
boolean result = true;
try {
jobLauncher.cancelJob(jobListener);
} catch (JobException e) {
LOG.error("Failed to cancel job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), e);
result = false;
}
if (mayInterruptIfRunning) {
result &= future.cancel(true);
}
return result;
}
@Override
public boolean isCancelled() {
return future.isCancelled();
}
@Override
public boolean isDone() {
return future.isDone();
}
@Override
public Object get() throws InterruptedException, ExecutionException {
return future.get();
}
@Override
public Object get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
return future.get(timeout, unit);
}
};
} | java | public Future<?> scheduleJobImmediately(Properties jobProps, JobListener jobListener, JobLauncher jobLauncher) {
Callable<Void> callable = new Callable<Void>() {
@Override
public Void call() throws JobException {
try {
runJob(jobProps, jobListener, jobLauncher);
} catch (JobException je) {
LOG.error("Failed to run job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), je);
throw je;
}
return null;
}
};
final Future<?> future = this.jobExecutor.submit(callable);
return new Future() {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
if (!cancelRequested) {
return false;
}
boolean result = true;
try {
jobLauncher.cancelJob(jobListener);
} catch (JobException e) {
LOG.error("Failed to cancel job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), e);
result = false;
}
if (mayInterruptIfRunning) {
result &= future.cancel(true);
}
return result;
}
@Override
public boolean isCancelled() {
return future.isCancelled();
}
@Override
public boolean isDone() {
return future.isDone();
}
@Override
public Object get() throws InterruptedException, ExecutionException {
return future.get();
}
@Override
public Object get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
return future.get(timeout, unit);
}
};
} | [
"public",
"Future",
"<",
"?",
">",
"scheduleJobImmediately",
"(",
"Properties",
"jobProps",
",",
"JobListener",
"jobListener",
",",
"JobLauncher",
"jobLauncher",
")",
"{",
"Callable",
"<",
"Void",
">",
"callable",
"=",
"new",
"Callable",
"<",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
")",
"throws",
"JobException",
"{",
"try",
"{",
"runJob",
"(",
"jobProps",
",",
"jobListener",
",",
"jobLauncher",
")",
";",
"}",
"catch",
"(",
"JobException",
"je",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Failed to run job \"",
"+",
"jobProps",
".",
"getProperty",
"(",
"ConfigurationKeys",
".",
"JOB_NAME_KEY",
")",
",",
"je",
")",
";",
"throw",
"je",
";",
"}",
"return",
"null",
";",
"}",
"}",
";",
"final",
"Future",
"<",
"?",
">",
"future",
"=",
"this",
".",
"jobExecutor",
".",
"submit",
"(",
"callable",
")",
";",
"return",
"new",
"Future",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"cancel",
"(",
"boolean",
"mayInterruptIfRunning",
")",
"{",
"if",
"(",
"!",
"cancelRequested",
")",
"{",
"return",
"false",
";",
"}",
"boolean",
"result",
"=",
"true",
";",
"try",
"{",
"jobLauncher",
".",
"cancelJob",
"(",
"jobListener",
")",
";",
"}",
"catch",
"(",
"JobException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Failed to cancel job \"",
"+",
"jobProps",
".",
"getProperty",
"(",
"ConfigurationKeys",
".",
"JOB_NAME_KEY",
")",
",",
"e",
")",
";",
"result",
"=",
"false",
";",
"}",
"if",
"(",
"mayInterruptIfRunning",
")",
"{",
"result",
"&=",
"future",
".",
"cancel",
"(",
"true",
")",
";",
"}",
"return",
"result",
";",
"}",
"@",
"Override",
"public",
"boolean",
"isCancelled",
"(",
")",
"{",
"return",
"future",
".",
"isCancelled",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"boolean",
"isDone",
"(",
")",
"{",
"return",
"future",
".",
"isDone",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"Object",
"get",
"(",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
"{",
"return",
"future",
".",
"get",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"Object",
"get",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
",",
"TimeoutException",
"{",
"return",
"future",
".",
"get",
"(",
"timeout",
",",
"unit",
")",
";",
"}",
"}",
";",
"}"
] | Schedule a job immediately.
<p>
This method calls the Quartz scheduler to scheduler the job.
</p>
@param jobProps Job configuration properties
@param jobListener {@link JobListener} used for callback,
can be <em>null</em> if no callback is needed.
@throws JobException when there is anything wrong
with scheduling the job | [
"Schedule",
"a",
"job",
"immediately",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java#L258-L312 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_instance_bulk_POST | public ArrayList<OvhInstance> project_serviceName_instance_bulk_POST(String serviceName, String flavorId, String groupId, String imageId, Boolean monthlyBilling, String name, OvhNetworkBulkParams[] networks, Long number, String region, String sshKeyId, String userData, String volumeId) throws IOException {
"""
Create multiple instances
REST: POST /cloud/project/{serviceName}/instance/bulk
@param flavorId [required] Instance flavor id
@param groupId [required] Start instance in group
@param imageId [required] Instance image id
@param monthlyBilling [required] Active monthly billing
@param name [required] Instance name
@param networks [required] Create network interfaces
@param number [required] Number of instances you want to create
@param region [required] Instance region
@param serviceName [required] Project name
@param sshKeyId [required] SSH keypair id
@param userData [required] Configuration information or scripts to use upon launch
@param volumeId [required] Specify a volume id to boot from it
"""
String qPath = "/cloud/project/{serviceName}/instance/bulk";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "flavorId", flavorId);
addBody(o, "groupId", groupId);
addBody(o, "imageId", imageId);
addBody(o, "monthlyBilling", monthlyBilling);
addBody(o, "name", name);
addBody(o, "networks", networks);
addBody(o, "number", number);
addBody(o, "region", region);
addBody(o, "sshKeyId", sshKeyId);
addBody(o, "userData", userData);
addBody(o, "volumeId", volumeId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, t21);
} | java | public ArrayList<OvhInstance> project_serviceName_instance_bulk_POST(String serviceName, String flavorId, String groupId, String imageId, Boolean monthlyBilling, String name, OvhNetworkBulkParams[] networks, Long number, String region, String sshKeyId, String userData, String volumeId) throws IOException {
String qPath = "/cloud/project/{serviceName}/instance/bulk";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "flavorId", flavorId);
addBody(o, "groupId", groupId);
addBody(o, "imageId", imageId);
addBody(o, "monthlyBilling", monthlyBilling);
addBody(o, "name", name);
addBody(o, "networks", networks);
addBody(o, "number", number);
addBody(o, "region", region);
addBody(o, "sshKeyId", sshKeyId);
addBody(o, "userData", userData);
addBody(o, "volumeId", volumeId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, t21);
} | [
"public",
"ArrayList",
"<",
"OvhInstance",
">",
"project_serviceName_instance_bulk_POST",
"(",
"String",
"serviceName",
",",
"String",
"flavorId",
",",
"String",
"groupId",
",",
"String",
"imageId",
",",
"Boolean",
"monthlyBilling",
",",
"String",
"name",
",",
"OvhNetworkBulkParams",
"[",
"]",
"networks",
",",
"Long",
"number",
",",
"String",
"region",
",",
"String",
"sshKeyId",
",",
"String",
"userData",
",",
"String",
"volumeId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/instance/bulk\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"flavorId\"",
",",
"flavorId",
")",
";",
"addBody",
"(",
"o",
",",
"\"groupId\"",
",",
"groupId",
")",
";",
"addBody",
"(",
"o",
",",
"\"imageId\"",
",",
"imageId",
")",
";",
"addBody",
"(",
"o",
",",
"\"monthlyBilling\"",
",",
"monthlyBilling",
")",
";",
"addBody",
"(",
"o",
",",
"\"name\"",
",",
"name",
")",
";",
"addBody",
"(",
"o",
",",
"\"networks\"",
",",
"networks",
")",
";",
"addBody",
"(",
"o",
",",
"\"number\"",
",",
"number",
")",
";",
"addBody",
"(",
"o",
",",
"\"region\"",
",",
"region",
")",
";",
"addBody",
"(",
"o",
",",
"\"sshKeyId\"",
",",
"sshKeyId",
")",
";",
"addBody",
"(",
"o",
",",
"\"userData\"",
",",
"userData",
")",
";",
"addBody",
"(",
"o",
",",
"\"volumeId\"",
",",
"volumeId",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t21",
")",
";",
"}"
] | Create multiple instances
REST: POST /cloud/project/{serviceName}/instance/bulk
@param flavorId [required] Instance flavor id
@param groupId [required] Start instance in group
@param imageId [required] Instance image id
@param monthlyBilling [required] Active monthly billing
@param name [required] Instance name
@param networks [required] Create network interfaces
@param number [required] Number of instances you want to create
@param region [required] Instance region
@param serviceName [required] Project name
@param sshKeyId [required] SSH keypair id
@param userData [required] Configuration information or scripts to use upon launch
@param volumeId [required] Specify a volume id to boot from it | [
"Create",
"multiple",
"instances"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2090-L2107 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.addVariableMappingForField | public void addVariableMappingForField(DifferentialFunction function, String fieldName, String varName) {
"""
Adds a field name -> variable name mapping for a given function.<br>
This is used for model import where there is an unresolved variable at the time of calling any
{@link org.nd4j.imports.graphmapper.GraphMapper#importGraph(File)}
.
<p>
This data structure is typically accessed during {@link DifferentialFunction#resolvePropertiesFromSameDiffBeforeExecution()}
<p>
When a function attempts to resolve variables right before execution, there needs to be a way of knowing
which variable in a samediff graph should map to a function's particular field name
@param function the function to map
@param fieldName the field name for the function to map
@param varName the variable name of the array to get from samediff
"""
fieldVariableResolutionMapping.put(function.getOwnName(), fieldName, varName);
} | java | public void addVariableMappingForField(DifferentialFunction function, String fieldName, String varName) {
fieldVariableResolutionMapping.put(function.getOwnName(), fieldName, varName);
} | [
"public",
"void",
"addVariableMappingForField",
"(",
"DifferentialFunction",
"function",
",",
"String",
"fieldName",
",",
"String",
"varName",
")",
"{",
"fieldVariableResolutionMapping",
".",
"put",
"(",
"function",
".",
"getOwnName",
"(",
")",
",",
"fieldName",
",",
"varName",
")",
";",
"}"
] | Adds a field name -> variable name mapping for a given function.<br>
This is used for model import where there is an unresolved variable at the time of calling any
{@link org.nd4j.imports.graphmapper.GraphMapper#importGraph(File)}
.
<p>
This data structure is typically accessed during {@link DifferentialFunction#resolvePropertiesFromSameDiffBeforeExecution()}
<p>
When a function attempts to resolve variables right before execution, there needs to be a way of knowing
which variable in a samediff graph should map to a function's particular field name
@param function the function to map
@param fieldName the field name for the function to map
@param varName the variable name of the array to get from samediff | [
"Adds",
"a",
"field",
"name",
"-",
">",
"variable",
"name",
"mapping",
"for",
"a",
"given",
"function",
".",
"<br",
">",
"This",
"is",
"used",
"for",
"model",
"import",
"where",
"there",
"is",
"an",
"unresolved",
"variable",
"at",
"the",
"time",
"of",
"calling",
"any",
"{",
"@link",
"org",
".",
"nd4j",
".",
"imports",
".",
"graphmapper",
".",
"GraphMapper#importGraph",
"(",
"File",
")",
"}",
".",
"<p",
">",
"This",
"data",
"structure",
"is",
"typically",
"accessed",
"during",
"{",
"@link",
"DifferentialFunction#resolvePropertiesFromSameDiffBeforeExecution",
"()",
"}",
"<p",
">",
"When",
"a",
"function",
"attempts",
"to",
"resolve",
"variables",
"right",
"before",
"execution",
"there",
"needs",
"to",
"be",
"a",
"way",
"of",
"knowing",
"which",
"variable",
"in",
"a",
"samediff",
"graph",
"should",
"map",
"to",
"a",
"function",
"s",
"particular",
"field",
"name"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L1033-L1035 |
Coveros/selenified | src/main/java/com/coveros/selenified/utilities/Reporter.java | Reporter.getAction | private String getAction(String check, double waitFor) {
"""
Helper to recordStep, which takes in a check being performed, and determines if a wait is
occuring or not. If no wait, no action is recorded. If a wait was performed, that wait is
added to the check, and provided back as the action
@param check - the check being performed
@param waitFor - how long was something waited for. Provide 0 if no wait, and therefore no action
@return String: the wait being performed as the check, or nothing
"""
String action = "";
if (waitFor > 0) {
action = "Waiting up to " + waitFor + " seconds " + check;
}
return action;
} | java | private String getAction(String check, double waitFor) {
String action = "";
if (waitFor > 0) {
action = "Waiting up to " + waitFor + " seconds " + check;
}
return action;
} | [
"private",
"String",
"getAction",
"(",
"String",
"check",
",",
"double",
"waitFor",
")",
"{",
"String",
"action",
"=",
"\"\"",
";",
"if",
"(",
"waitFor",
">",
"0",
")",
"{",
"action",
"=",
"\"Waiting up to \"",
"+",
"waitFor",
"+",
"\" seconds \"",
"+",
"check",
";",
"}",
"return",
"action",
";",
"}"
] | Helper to recordStep, which takes in a check being performed, and determines if a wait is
occuring or not. If no wait, no action is recorded. If a wait was performed, that wait is
added to the check, and provided back as the action
@param check - the check being performed
@param waitFor - how long was something waited for. Provide 0 if no wait, and therefore no action
@return String: the wait being performed as the check, or nothing | [
"Helper",
"to",
"recordStep",
"which",
"takes",
"in",
"a",
"check",
"being",
"performed",
"and",
"determines",
"if",
"a",
"wait",
"is",
"occuring",
"or",
"not",
".",
"If",
"no",
"wait",
"no",
"action",
"is",
"recorded",
".",
"If",
"a",
"wait",
"was",
"performed",
"that",
"wait",
"is",
"added",
"to",
"the",
"check",
"and",
"provided",
"back",
"as",
"the",
"action"
] | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/utilities/Reporter.java#L344-L350 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToHTMLStream.java | ToHTMLStream.processAttributes | public void processAttributes(java.io.Writer writer, int nAttrs)
throws IOException,SAXException {
"""
Process the attributes, which means to write out the currently
collected attributes to the writer. The attributes are not
cleared by this method
@param writer the writer to write processed attributes to.
@param nAttrs the number of attributes in m_attributes
to be processed
@throws org.xml.sax.SAXException
"""
/*
* process the collected attributes
*/
for (int i = 0; i < nAttrs; i++)
{
processAttribute(
writer,
m_attributes.getQName(i),
m_attributes.getValue(i),
m_elemContext.m_elementDesc);
}
} | java | public void processAttributes(java.io.Writer writer, int nAttrs)
throws IOException,SAXException
{
/*
* process the collected attributes
*/
for (int i = 0; i < nAttrs; i++)
{
processAttribute(
writer,
m_attributes.getQName(i),
m_attributes.getValue(i),
m_elemContext.m_elementDesc);
}
} | [
"public",
"void",
"processAttributes",
"(",
"java",
".",
"io",
".",
"Writer",
"writer",
",",
"int",
"nAttrs",
")",
"throws",
"IOException",
",",
"SAXException",
"{",
"/* \n * process the collected attributes\n */",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nAttrs",
";",
"i",
"++",
")",
"{",
"processAttribute",
"(",
"writer",
",",
"m_attributes",
".",
"getQName",
"(",
"i",
")",
",",
"m_attributes",
".",
"getValue",
"(",
"i",
")",
",",
"m_elemContext",
".",
"m_elementDesc",
")",
";",
"}",
"}"
] | Process the attributes, which means to write out the currently
collected attributes to the writer. The attributes are not
cleared by this method
@param writer the writer to write processed attributes to.
@param nAttrs the number of attributes in m_attributes
to be processed
@throws org.xml.sax.SAXException | [
"Process",
"the",
"attributes",
"which",
"means",
"to",
"write",
"out",
"the",
"currently",
"collected",
"attributes",
"to",
"the",
"writer",
".",
"The",
"attributes",
"are",
"not",
"cleared",
"by",
"this",
"method"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToHTMLStream.java#L1767-L1781 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java | Hierarchy.visitSuperInterfaceMethods | public static JavaClassAndMethod visitSuperInterfaceMethods(JavaClassAndMethod method, JavaClassAndMethodChooser chooser)
throws ClassNotFoundException {
"""
Visit all superinterface methods which the given method implements.
@param method
the method
@param chooser
chooser which visits each superinterface method
@return the chosen method, or null if no method is chosen
@throws ClassNotFoundException
"""
return findMethod(method.getJavaClass().getAllInterfaces(), method.getMethod().getName(), method.getMethod()
.getSignature(), chooser);
} | java | public static JavaClassAndMethod visitSuperInterfaceMethods(JavaClassAndMethod method, JavaClassAndMethodChooser chooser)
throws ClassNotFoundException {
return findMethod(method.getJavaClass().getAllInterfaces(), method.getMethod().getName(), method.getMethod()
.getSignature(), chooser);
} | [
"public",
"static",
"JavaClassAndMethod",
"visitSuperInterfaceMethods",
"(",
"JavaClassAndMethod",
"method",
",",
"JavaClassAndMethodChooser",
"chooser",
")",
"throws",
"ClassNotFoundException",
"{",
"return",
"findMethod",
"(",
"method",
".",
"getJavaClass",
"(",
")",
".",
"getAllInterfaces",
"(",
")",
",",
"method",
".",
"getMethod",
"(",
")",
".",
"getName",
"(",
")",
",",
"method",
".",
"getMethod",
"(",
")",
".",
"getSignature",
"(",
")",
",",
"chooser",
")",
";",
"}"
] | Visit all superinterface methods which the given method implements.
@param method
the method
@param chooser
chooser which visits each superinterface method
@return the chosen method, or null if no method is chosen
@throws ClassNotFoundException | [
"Visit",
"all",
"superinterface",
"methods",
"which",
"the",
"given",
"method",
"implements",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java#L288-L292 |
StanKocken/EfficientAdapter | efficientadapter/src/main/java/com/skocken/efficientadapter/lib/viewholder/EfficientViewHolder.java | EfficientViewHolder.setImageUri | public void setImageUri(int viewId, @Nullable Uri uri) {
"""
Equivalent to calling ImageView.setImageUri
@param viewId The id of the view whose image should change
@param uri the Uri of an image, or {@code null} to clear the content
"""
ViewHelper.setImageUri(mCacheView, viewId, uri);
} | java | public void setImageUri(int viewId, @Nullable Uri uri) {
ViewHelper.setImageUri(mCacheView, viewId, uri);
} | [
"public",
"void",
"setImageUri",
"(",
"int",
"viewId",
",",
"@",
"Nullable",
"Uri",
"uri",
")",
"{",
"ViewHelper",
".",
"setImageUri",
"(",
"mCacheView",
",",
"viewId",
",",
"uri",
")",
";",
"}"
] | Equivalent to calling ImageView.setImageUri
@param viewId The id of the view whose image should change
@param uri the Uri of an image, or {@code null} to clear the content | [
"Equivalent",
"to",
"calling",
"ImageView",
".",
"setImageUri"
] | train | https://github.com/StanKocken/EfficientAdapter/blob/0bcc3a20182cbce9d7901e1e2a9104251637167d/efficientadapter/src/main/java/com/skocken/efficientadapter/lib/viewholder/EfficientViewHolder.java#L376-L378 |
sculptor/sculptor | sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java | JpaHelper.toSeparatedString | public static String toSeparatedString(List<?> values, String separator) {
"""
build a single String from a List of objects with a given separator
@param values
@param separator
@return
"""
return toSeparatedString(values, separator, null);
} | java | public static String toSeparatedString(List<?> values, String separator) {
return toSeparatedString(values, separator, null);
} | [
"public",
"static",
"String",
"toSeparatedString",
"(",
"List",
"<",
"?",
">",
"values",
",",
"String",
"separator",
")",
"{",
"return",
"toSeparatedString",
"(",
"values",
",",
"separator",
",",
"null",
")",
";",
"}"
] | build a single String from a List of objects with a given separator
@param values
@param separator
@return | [
"build",
"a",
"single",
"String",
"from",
"a",
"List",
"of",
"objects",
"with",
"a",
"given",
"separator"
] | train | https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java#L285-L287 |
super-csv/super-csv | super-csv-joda/src/main/java/org/supercsv/cellprocessor/joda/FmtDuration.java | FmtDuration.execute | public Object execute(final Object value, final CsvContext context) {
"""
{@inheritDoc}
@throws SuperCsvCellProcessorException
if value is null or not a Duration
"""
validateInputNotNull(value, context);
if (!(value instanceof Duration)) {
throw new SuperCsvCellProcessorException(Duration.class, value,
context, this);
}
final Duration duration = (Duration) value;
final String result = duration.toString();
return next.execute(result, context);
} | java | public Object execute(final Object value, final CsvContext context) {
validateInputNotNull(value, context);
if (!(value instanceof Duration)) {
throw new SuperCsvCellProcessorException(Duration.class, value,
context, this);
}
final Duration duration = (Duration) value;
final String result = duration.toString();
return next.execute(result, context);
} | [
"public",
"Object",
"execute",
"(",
"final",
"Object",
"value",
",",
"final",
"CsvContext",
"context",
")",
"{",
"validateInputNotNull",
"(",
"value",
",",
"context",
")",
";",
"if",
"(",
"!",
"(",
"value",
"instanceof",
"Duration",
")",
")",
"{",
"throw",
"new",
"SuperCsvCellProcessorException",
"(",
"Duration",
".",
"class",
",",
"value",
",",
"context",
",",
"this",
")",
";",
"}",
"final",
"Duration",
"duration",
"=",
"(",
"Duration",
")",
"value",
";",
"final",
"String",
"result",
"=",
"duration",
".",
"toString",
"(",
")",
";",
"return",
"next",
".",
"execute",
"(",
"result",
",",
"context",
")",
";",
"}"
] | {@inheritDoc}
@throws SuperCsvCellProcessorException
if value is null or not a Duration | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv-joda/src/main/java/org/supercsv/cellprocessor/joda/FmtDuration.java#L63-L72 |
apache/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/api/yaml/YamlOrchestrationMasterSlaveDataSourceFactory.java | YamlOrchestrationMasterSlaveDataSourceFactory.createDataSource | public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final File yamlFile) throws SQLException, IOException {
"""
Create master-slave data source.
@param dataSourceMap data source map
@param yamlFile YAML file for master-slave rule configuration without data sources
@return master-slave data source
@throws SQLException SQL exception
@throws IOException IO exception
"""
YamlOrchestrationMasterSlaveRuleConfiguration config = unmarshal(yamlFile);
return createDataSource(dataSourceMap, config.getMasterSlaveRule(), config.getProps(), config.getOrchestration());
} | java | public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final File yamlFile) throws SQLException, IOException {
YamlOrchestrationMasterSlaveRuleConfiguration config = unmarshal(yamlFile);
return createDataSource(dataSourceMap, config.getMasterSlaveRule(), config.getProps(), config.getOrchestration());
} | [
"public",
"static",
"DataSource",
"createDataSource",
"(",
"final",
"Map",
"<",
"String",
",",
"DataSource",
">",
"dataSourceMap",
",",
"final",
"File",
"yamlFile",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"YamlOrchestrationMasterSlaveRuleConfiguration",
"config",
"=",
"unmarshal",
"(",
"yamlFile",
")",
";",
"return",
"createDataSource",
"(",
"dataSourceMap",
",",
"config",
".",
"getMasterSlaveRule",
"(",
")",
",",
"config",
".",
"getProps",
"(",
")",
",",
"config",
".",
"getOrchestration",
"(",
")",
")",
";",
"}"
] | Create master-slave data source.
@param dataSourceMap data source map
@param yamlFile YAML file for master-slave rule configuration without data sources
@return master-slave data source
@throws SQLException SQL exception
@throws IOException IO exception | [
"Create",
"master",
"-",
"slave",
"data",
"source",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/api/yaml/YamlOrchestrationMasterSlaveDataSourceFactory.java#L74-L77 |
JOML-CI/JOML | src/org/joml/Matrix4x3f.java | Matrix4x3f.ortho2DLH | public Matrix4x3f ortho2DLH(float left, float right, float bottom, float top, Matrix4x3f dest) {
"""
Apply an orthographic projection transformation for a left-handed coordinate system to this matrix and store the result in <code>dest</code>.
<p>
This method is equivalent to calling {@link #orthoLH(float, float, float, float, float, float, Matrix4x3f) orthoLH()} with
<code>zNear=-1</code> and <code>zFar=+1</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix,
then the new matrix will be <code>M * O</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the
orthographic projection transformation will be applied first!
<p>
In order to set the matrix to an orthographic projection without post-multiplying it,
use {@link #setOrtho2DLH(float, float, float, float) setOrthoLH()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #orthoLH(float, float, float, float, float, float, Matrix4x3f)
@see #setOrtho2DLH(float, float, float, float)
@param left
the distance from the center to the left frustum edge
@param right
the distance from the center to the right frustum edge
@param bottom
the distance from the center to the bottom frustum edge
@param top
the distance from the center to the top frustum edge
@param dest
will hold the result
@return dest
"""
// calculate right matrix elements
float rm00 = 2.0f / (right - left);
float rm11 = 2.0f / (top - bottom);
float rm30 = -(right + left) / (right - left);
float rm31 = -(top + bottom) / (top - bottom);
// perform optimized multiplication
// compute the last column first, because other columns do not depend on it
dest.m30 = m00 * rm30 + m10 * rm31 + m30;
dest.m31 = m01 * rm30 + m11 * rm31 + m31;
dest.m32 = m02 * rm30 + m12 * rm31 + m32;
dest.m00 = m00 * rm00;
dest.m01 = m01 * rm00;
dest.m02 = m02 * rm00;
dest.m10 = m10 * rm11;
dest.m11 = m11 * rm11;
dest.m12 = m12 * rm11;
dest.m20 = m20;
dest.m21 = m21;
dest.m22 = m22;
dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION | PROPERTY_ORTHONORMAL);
return dest;
} | java | public Matrix4x3f ortho2DLH(float left, float right, float bottom, float top, Matrix4x3f dest) {
// calculate right matrix elements
float rm00 = 2.0f / (right - left);
float rm11 = 2.0f / (top - bottom);
float rm30 = -(right + left) / (right - left);
float rm31 = -(top + bottom) / (top - bottom);
// perform optimized multiplication
// compute the last column first, because other columns do not depend on it
dest.m30 = m00 * rm30 + m10 * rm31 + m30;
dest.m31 = m01 * rm30 + m11 * rm31 + m31;
dest.m32 = m02 * rm30 + m12 * rm31 + m32;
dest.m00 = m00 * rm00;
dest.m01 = m01 * rm00;
dest.m02 = m02 * rm00;
dest.m10 = m10 * rm11;
dest.m11 = m11 * rm11;
dest.m12 = m12 * rm11;
dest.m20 = m20;
dest.m21 = m21;
dest.m22 = m22;
dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION | PROPERTY_ORTHONORMAL);
return dest;
} | [
"public",
"Matrix4x3f",
"ortho2DLH",
"(",
"float",
"left",
",",
"float",
"right",
",",
"float",
"bottom",
",",
"float",
"top",
",",
"Matrix4x3f",
"dest",
")",
"{",
"// calculate right matrix elements",
"float",
"rm00",
"=",
"2.0f",
"/",
"(",
"right",
"-",
"left",
")",
";",
"float",
"rm11",
"=",
"2.0f",
"/",
"(",
"top",
"-",
"bottom",
")",
";",
"float",
"rm30",
"=",
"-",
"(",
"right",
"+",
"left",
")",
"/",
"(",
"right",
"-",
"left",
")",
";",
"float",
"rm31",
"=",
"-",
"(",
"top",
"+",
"bottom",
")",
"/",
"(",
"top",
"-",
"bottom",
")",
";",
"// perform optimized multiplication",
"// compute the last column first, because other columns do not depend on it",
"dest",
".",
"m30",
"=",
"m00",
"*",
"rm30",
"+",
"m10",
"*",
"rm31",
"+",
"m30",
";",
"dest",
".",
"m31",
"=",
"m01",
"*",
"rm30",
"+",
"m11",
"*",
"rm31",
"+",
"m31",
";",
"dest",
".",
"m32",
"=",
"m02",
"*",
"rm30",
"+",
"m12",
"*",
"rm31",
"+",
"m32",
";",
"dest",
".",
"m00",
"=",
"m00",
"*",
"rm00",
";",
"dest",
".",
"m01",
"=",
"m01",
"*",
"rm00",
";",
"dest",
".",
"m02",
"=",
"m02",
"*",
"rm00",
";",
"dest",
".",
"m10",
"=",
"m10",
"*",
"rm11",
";",
"dest",
".",
"m11",
"=",
"m11",
"*",
"rm11",
";",
"dest",
".",
"m12",
"=",
"m12",
"*",
"rm11",
";",
"dest",
".",
"m20",
"=",
"m20",
";",
"dest",
".",
"m21",
"=",
"m21",
";",
"dest",
".",
"m22",
"=",
"m22",
";",
"dest",
".",
"properties",
"=",
"properties",
"&",
"~",
"(",
"PROPERTY_IDENTITY",
"|",
"PROPERTY_TRANSLATION",
"|",
"PROPERTY_ORTHONORMAL",
")",
";",
"return",
"dest",
";",
"}"
] | Apply an orthographic projection transformation for a left-handed coordinate system to this matrix and store the result in <code>dest</code>.
<p>
This method is equivalent to calling {@link #orthoLH(float, float, float, float, float, float, Matrix4x3f) orthoLH()} with
<code>zNear=-1</code> and <code>zFar=+1</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix,
then the new matrix will be <code>M * O</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the
orthographic projection transformation will be applied first!
<p>
In order to set the matrix to an orthographic projection without post-multiplying it,
use {@link #setOrtho2DLH(float, float, float, float) setOrthoLH()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #orthoLH(float, float, float, float, float, float, Matrix4x3f)
@see #setOrtho2DLH(float, float, float, float)
@param left
the distance from the center to the left frustum edge
@param right
the distance from the center to the right frustum edge
@param bottom
the distance from the center to the bottom frustum edge
@param top
the distance from the center to the top frustum edge
@param dest
will hold the result
@return dest | [
"Apply",
"an",
"orthographic",
"projection",
"transformation",
"for",
"a",
"left",
"-",
"handed",
"coordinate",
"system",
"to",
"this",
"matrix",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"dest<",
"/",
"code",
">",
".",
"<p",
">",
"This",
"method",
"is",
"equivalent",
"to",
"calling",
"{",
"@link",
"#orthoLH",
"(",
"float",
"float",
"float",
"float",
"float",
"float",
"Matrix4x3f",
")",
"orthoLH",
"()",
"}",
"with",
"<code",
">",
"zNear",
"=",
"-",
"1<",
"/",
"code",
">",
"and",
"<code",
">",
"zFar",
"=",
"+",
"1<",
"/",
"code",
">",
".",
"<p",
">",
"If",
"<code",
">",
"M<",
"/",
"code",
">",
"is",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"and",
"<code",
">",
"O<",
"/",
"code",
">",
"the",
"orthographic",
"projection",
"matrix",
"then",
"the",
"new",
"matrix",
"will",
"be",
"<code",
">",
"M",
"*",
"O<",
"/",
"code",
">",
".",
"So",
"when",
"transforming",
"a",
"vector",
"<code",
">",
"v<",
"/",
"code",
">",
"with",
"the",
"new",
"matrix",
"by",
"using",
"<code",
">",
"M",
"*",
"O",
"*",
"v<",
"/",
"code",
">",
"the",
"orthographic",
"projection",
"transformation",
"will",
"be",
"applied",
"first!",
"<p",
">",
"In",
"order",
"to",
"set",
"the",
"matrix",
"to",
"an",
"orthographic",
"projection",
"without",
"post",
"-",
"multiplying",
"it",
"use",
"{",
"@link",
"#setOrtho2DLH",
"(",
"float",
"float",
"float",
"float",
")",
"setOrthoLH",
"()",
"}",
".",
"<p",
">",
"Reference",
":",
"<a",
"href",
"=",
"http",
":",
"//",
"www",
".",
"songho",
".",
"ca",
"/",
"opengl",
"/",
"gl_projectionmatrix",
".",
"html#ortho",
">",
"http",
":",
"//",
"www",
".",
"songho",
".",
"ca<",
"/",
"a",
">"
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L5774-L5798 |
lucee/Lucee | core/src/main/java/lucee/transformer/library/function/FunctionLibFunction.java | FunctionLibFunction.setFunctionClass | public void setFunctionClass(String value, Identification id, Attributes attrs) {
"""
Setzt die Klassendefinition als Zeichenkette, welche diese Funktion implementiert.
@param value Klassendefinition als Zeichenkette.
"""
functionCD = ClassDefinitionImpl.toClassDefinition(value, id, attrs);
} | java | public void setFunctionClass(String value, Identification id, Attributes attrs) {
functionCD = ClassDefinitionImpl.toClassDefinition(value, id, attrs);
} | [
"public",
"void",
"setFunctionClass",
"(",
"String",
"value",
",",
"Identification",
"id",
",",
"Attributes",
"attrs",
")",
"{",
"functionCD",
"=",
"ClassDefinitionImpl",
".",
"toClassDefinition",
"(",
"value",
",",
"id",
",",
"attrs",
")",
";",
"}"
] | Setzt die Klassendefinition als Zeichenkette, welche diese Funktion implementiert.
@param value Klassendefinition als Zeichenkette. | [
"Setzt",
"die",
"Klassendefinition",
"als",
"Zeichenkette",
"welche",
"diese",
"Funktion",
"implementiert",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/function/FunctionLibFunction.java#L271-L274 |
wonderpush/wonderpush-android-sdk | sdk/src/main/java/com/wonderpush/sdk/DataManager.java | DataManager.downloadAllData | static boolean downloadAllData() {
"""
Blocks until interrupted or completed.
@return {@code true} if successfully called startActivity() with a sharing intent.
"""
String data;
try {
data = export().get();
} catch (InterruptedException ex) {
Log.e(WonderPush.TAG, "Unexpected error while exporting data", ex);
return false;
} catch (ExecutionException ex) {
Log.e(WonderPush.TAG, "Unexpected error while exporting data", ex);
return false;
}
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
File folder = new File(WonderPush.getApplicationContext().getFilesDir(), "exports");
folder.mkdirs();
String fn = "wonderpush-android-dataexport-" + sdf.format(new Date()) + ".json";
File f = new File(folder, fn);
OutputStream os = new FileOutputStream(f);
os.write(data.getBytes());
os.close();
File fz = new File(folder, fn + ".zip");
ZipOutputStream osz = new ZipOutputStream(new FileOutputStream(fz));
osz.putNextEntry(new ZipEntry(fn));
osz.write(data.getBytes());
osz.closeEntry();
osz.finish();
osz.close();
Uri uri = FileProvider.getUriForFile(WonderPush.getApplicationContext(), WonderPush.getApplicationContext().getPackageName() + ".wonderpush.fileprovider", fz);
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
sendIntent.setType("application/zip");
sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
WonderPush.getApplicationContext().startActivity(Intent.createChooser(sendIntent, WonderPush.getApplicationContext().getResources().getText(R.string.wonderpush_export_data_chooser)));
return true;
} catch (Exception ex) {
Log.e(WonderPush.TAG, "Unexpected error while exporting data", ex);
return false;
}
} | java | static boolean downloadAllData() {
String data;
try {
data = export().get();
} catch (InterruptedException ex) {
Log.e(WonderPush.TAG, "Unexpected error while exporting data", ex);
return false;
} catch (ExecutionException ex) {
Log.e(WonderPush.TAG, "Unexpected error while exporting data", ex);
return false;
}
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
File folder = new File(WonderPush.getApplicationContext().getFilesDir(), "exports");
folder.mkdirs();
String fn = "wonderpush-android-dataexport-" + sdf.format(new Date()) + ".json";
File f = new File(folder, fn);
OutputStream os = new FileOutputStream(f);
os.write(data.getBytes());
os.close();
File fz = new File(folder, fn + ".zip");
ZipOutputStream osz = new ZipOutputStream(new FileOutputStream(fz));
osz.putNextEntry(new ZipEntry(fn));
osz.write(data.getBytes());
osz.closeEntry();
osz.finish();
osz.close();
Uri uri = FileProvider.getUriForFile(WonderPush.getApplicationContext(), WonderPush.getApplicationContext().getPackageName() + ".wonderpush.fileprovider", fz);
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
sendIntent.setType("application/zip");
sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
WonderPush.getApplicationContext().startActivity(Intent.createChooser(sendIntent, WonderPush.getApplicationContext().getResources().getText(R.string.wonderpush_export_data_chooser)));
return true;
} catch (Exception ex) {
Log.e(WonderPush.TAG, "Unexpected error while exporting data", ex);
return false;
}
} | [
"static",
"boolean",
"downloadAllData",
"(",
")",
"{",
"String",
"data",
";",
"try",
"{",
"data",
"=",
"export",
"(",
")",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"Log",
".",
"e",
"(",
"WonderPush",
".",
"TAG",
",",
"\"Unexpected error while exporting data\"",
",",
"ex",
")",
";",
"return",
"false",
";",
"}",
"catch",
"(",
"ExecutionException",
"ex",
")",
"{",
"Log",
".",
"e",
"(",
"WonderPush",
".",
"TAG",
",",
"\"Unexpected error while exporting data\"",
",",
"ex",
")",
";",
"return",
"false",
";",
"}",
"try",
"{",
"SimpleDateFormat",
"sdf",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\"",
",",
"Locale",
".",
"US",
")",
";",
"sdf",
".",
"setTimeZone",
"(",
"TimeZone",
".",
"getTimeZone",
"(",
"\"UTC\"",
")",
")",
";",
"File",
"folder",
"=",
"new",
"File",
"(",
"WonderPush",
".",
"getApplicationContext",
"(",
")",
".",
"getFilesDir",
"(",
")",
",",
"\"exports\"",
")",
";",
"folder",
".",
"mkdirs",
"(",
")",
";",
"String",
"fn",
"=",
"\"wonderpush-android-dataexport-\"",
"+",
"sdf",
".",
"format",
"(",
"new",
"Date",
"(",
")",
")",
"+",
"\".json\"",
";",
"File",
"f",
"=",
"new",
"File",
"(",
"folder",
",",
"fn",
")",
";",
"OutputStream",
"os",
"=",
"new",
"FileOutputStream",
"(",
"f",
")",
";",
"os",
".",
"write",
"(",
"data",
".",
"getBytes",
"(",
")",
")",
";",
"os",
".",
"close",
"(",
")",
";",
"File",
"fz",
"=",
"new",
"File",
"(",
"folder",
",",
"fn",
"+",
"\".zip\"",
")",
";",
"ZipOutputStream",
"osz",
"=",
"new",
"ZipOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"fz",
")",
")",
";",
"osz",
".",
"putNextEntry",
"(",
"new",
"ZipEntry",
"(",
"fn",
")",
")",
";",
"osz",
".",
"write",
"(",
"data",
".",
"getBytes",
"(",
")",
")",
";",
"osz",
".",
"closeEntry",
"(",
")",
";",
"osz",
".",
"finish",
"(",
")",
";",
"osz",
".",
"close",
"(",
")",
";",
"Uri",
"uri",
"=",
"FileProvider",
".",
"getUriForFile",
"(",
"WonderPush",
".",
"getApplicationContext",
"(",
")",
",",
"WonderPush",
".",
"getApplicationContext",
"(",
")",
".",
"getPackageName",
"(",
")",
"+",
"\".wonderpush.fileprovider\"",
",",
"fz",
")",
";",
"Intent",
"sendIntent",
"=",
"new",
"Intent",
"(",
")",
";",
"sendIntent",
".",
"setAction",
"(",
"Intent",
".",
"ACTION_SEND",
")",
";",
"sendIntent",
".",
"putExtra",
"(",
"Intent",
".",
"EXTRA_STREAM",
",",
"uri",
")",
";",
"sendIntent",
".",
"setType",
"(",
"\"application/zip\"",
")",
";",
"sendIntent",
".",
"addFlags",
"(",
"Intent",
".",
"FLAG_GRANT_READ_URI_PERMISSION",
")",
";",
"WonderPush",
".",
"getApplicationContext",
"(",
")",
".",
"startActivity",
"(",
"Intent",
".",
"createChooser",
"(",
"sendIntent",
",",
"WonderPush",
".",
"getApplicationContext",
"(",
")",
".",
"getResources",
"(",
")",
".",
"getText",
"(",
"R",
".",
"string",
".",
"wonderpush_export_data_chooser",
")",
")",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"Log",
".",
"e",
"(",
"WonderPush",
".",
"TAG",
",",
"\"Unexpected error while exporting data\"",
",",
"ex",
")",
";",
"return",
"false",
";",
"}",
"}"
] | Blocks until interrupted or completed.
@return {@code true} if successfully called startActivity() with a sharing intent. | [
"Blocks",
"until",
"interrupted",
"or",
"completed",
"."
] | train | https://github.com/wonderpush/wonderpush-android-sdk/blob/ba0a1568f705cdd6206639bfab1e5cf529084b59/sdk/src/main/java/com/wonderpush/sdk/DataManager.java#L191-L234 |
Coveros/selenified | src/main/java/com/coveros/selenified/utilities/Reporter.java | Reporter.replaceInFile | private void replaceInFile(String oldText, String newText) {
"""
Replaces an occurrence of a string within a file
@param oldText - the text to be replaced
@param newText - the text to be replaced with
"""
StringBuilder oldContent = new StringBuilder();
try (FileReader fr = new FileReader(file); BufferedReader reader = new BufferedReader(fr)) {
String line;
while ((line = reader.readLine()) != null) {
oldContent.append(line);
oldContent.append("\r\n");
}
} catch (IOException e) {
log.error(e);
}
// replace a word in a file
String newContent = oldContent.toString().replaceAll(oldText, newText);
try (FileWriter writer = new FileWriter(file)) {
writer.write(newContent);
} catch (IOException ioe) {
log.error(ioe);
}
} | java | private void replaceInFile(String oldText, String newText) {
StringBuilder oldContent = new StringBuilder();
try (FileReader fr = new FileReader(file); BufferedReader reader = new BufferedReader(fr)) {
String line;
while ((line = reader.readLine()) != null) {
oldContent.append(line);
oldContent.append("\r\n");
}
} catch (IOException e) {
log.error(e);
}
// replace a word in a file
String newContent = oldContent.toString().replaceAll(oldText, newText);
try (FileWriter writer = new FileWriter(file)) {
writer.write(newContent);
} catch (IOException ioe) {
log.error(ioe);
}
} | [
"private",
"void",
"replaceInFile",
"(",
"String",
"oldText",
",",
"String",
"newText",
")",
"{",
"StringBuilder",
"oldContent",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"try",
"(",
"FileReader",
"fr",
"=",
"new",
"FileReader",
"(",
"file",
")",
";",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"fr",
")",
")",
"{",
"String",
"line",
";",
"while",
"(",
"(",
"line",
"=",
"reader",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"oldContent",
".",
"append",
"(",
"line",
")",
";",
"oldContent",
".",
"append",
"(",
"\"\\r\\n\"",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"e",
")",
";",
"}",
"// replace a word in a file",
"String",
"newContent",
"=",
"oldContent",
".",
"toString",
"(",
")",
".",
"replaceAll",
"(",
"oldText",
",",
"newText",
")",
";",
"try",
"(",
"FileWriter",
"writer",
"=",
"new",
"FileWriter",
"(",
"file",
")",
")",
"{",
"writer",
".",
"write",
"(",
"newContent",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"log",
".",
"error",
"(",
"ioe",
")",
";",
"}",
"}"
] | Replaces an occurrence of a string within a file
@param oldText - the text to be replaced
@param newText - the text to be replaced with | [
"Replaces",
"an",
"occurrence",
"of",
"a",
"string",
"within",
"a",
"file"
] | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/utilities/Reporter.java#L249-L270 |
lucee/Lucee | core/src/main/java/lucee/runtime/crypt/UnixCrypt.java | UnixCrypt.matches | public final static boolean matches(String encryptedPassword, String enteredPassword) {
"""
* Check that enteredPassword encrypts to * encryptedPassword.
@param encryptedPassword The encryptedPassword. The first two characters are assumed to be the
salt. This string would be the same as one found in a Unix /etc/passwd file.
@param enteredPassword The password as entered by the user (or otherwise aquired).
@return true if the password should be considered correct.
"""
String salt = encryptedPassword.substring(0, 3);
String newCrypt = crypt(salt, enteredPassword);
return newCrypt.equals(encryptedPassword);
} | java | public final static boolean matches(String encryptedPassword, String enteredPassword) {
String salt = encryptedPassword.substring(0, 3);
String newCrypt = crypt(salt, enteredPassword);
return newCrypt.equals(encryptedPassword);
} | [
"public",
"final",
"static",
"boolean",
"matches",
"(",
"String",
"encryptedPassword",
",",
"String",
"enteredPassword",
")",
"{",
"String",
"salt",
"=",
"encryptedPassword",
".",
"substring",
"(",
"0",
",",
"3",
")",
";",
"String",
"newCrypt",
"=",
"crypt",
"(",
"salt",
",",
"enteredPassword",
")",
";",
"return",
"newCrypt",
".",
"equals",
"(",
"encryptedPassword",
")",
";",
"}"
] | * Check that enteredPassword encrypts to * encryptedPassword.
@param encryptedPassword The encryptedPassword. The first two characters are assumed to be the
salt. This string would be the same as one found in a Unix /etc/passwd file.
@param enteredPassword The password as entered by the user (or otherwise aquired).
@return true if the password should be considered correct. | [
"*",
"Check",
"that",
"enteredPassword",
"encrypts",
"to",
"*",
"encryptedPassword",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/crypt/UnixCrypt.java#L331-L335 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/tools/IDCreator.java | IDCreator.createIDsForAtomContainerSet | private static void createIDsForAtomContainerSet(IAtomContainerSet containerSet, List<String> tabuList) {
"""
Labels the Atom's and Bond's in each AtomContainer using the a1, a2, b1, b2
scheme often used in CML. It will also set id's for all AtomContainers, naming
them m1, m2, etc.
It will not the AtomContainerSet itself.
"""
if (tabuList == null) tabuList = AtomContainerSetManipulator.getAllIDs(containerSet);
if (null == containerSet.getID()) {
atomContainerSetCount = setID(ATOMCONTAINERSET_PREFIX, atomContainerSetCount, containerSet, tabuList);
}
if (policy == OBJECT_UNIQUE_POLICY) {
// start atom and bond indices within a container set always from 1
atomCount = 0;
bondCount = 0;
}
Iterator<IAtomContainer> acs = containerSet.atomContainers().iterator();
while (acs.hasNext()) {
createIDsForAtomContainer((IAtomContainer) acs.next(), tabuList);
}
} | java | private static void createIDsForAtomContainerSet(IAtomContainerSet containerSet, List<String> tabuList) {
if (tabuList == null) tabuList = AtomContainerSetManipulator.getAllIDs(containerSet);
if (null == containerSet.getID()) {
atomContainerSetCount = setID(ATOMCONTAINERSET_PREFIX, atomContainerSetCount, containerSet, tabuList);
}
if (policy == OBJECT_UNIQUE_POLICY) {
// start atom and bond indices within a container set always from 1
atomCount = 0;
bondCount = 0;
}
Iterator<IAtomContainer> acs = containerSet.atomContainers().iterator();
while (acs.hasNext()) {
createIDsForAtomContainer((IAtomContainer) acs.next(), tabuList);
}
} | [
"private",
"static",
"void",
"createIDsForAtomContainerSet",
"(",
"IAtomContainerSet",
"containerSet",
",",
"List",
"<",
"String",
">",
"tabuList",
")",
"{",
"if",
"(",
"tabuList",
"==",
"null",
")",
"tabuList",
"=",
"AtomContainerSetManipulator",
".",
"getAllIDs",
"(",
"containerSet",
")",
";",
"if",
"(",
"null",
"==",
"containerSet",
".",
"getID",
"(",
")",
")",
"{",
"atomContainerSetCount",
"=",
"setID",
"(",
"ATOMCONTAINERSET_PREFIX",
",",
"atomContainerSetCount",
",",
"containerSet",
",",
"tabuList",
")",
";",
"}",
"if",
"(",
"policy",
"==",
"OBJECT_UNIQUE_POLICY",
")",
"{",
"// start atom and bond indices within a container set always from 1",
"atomCount",
"=",
"0",
";",
"bondCount",
"=",
"0",
";",
"}",
"Iterator",
"<",
"IAtomContainer",
">",
"acs",
"=",
"containerSet",
".",
"atomContainers",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"acs",
".",
"hasNext",
"(",
")",
")",
"{",
"createIDsForAtomContainer",
"(",
"(",
"IAtomContainer",
")",
"acs",
".",
"next",
"(",
")",
",",
"tabuList",
")",
";",
"}",
"}"
] | Labels the Atom's and Bond's in each AtomContainer using the a1, a2, b1, b2
scheme often used in CML. It will also set id's for all AtomContainers, naming
them m1, m2, etc.
It will not the AtomContainerSet itself. | [
"Labels",
"the",
"Atom",
"s",
"and",
"Bond",
"s",
"in",
"each",
"AtomContainer",
"using",
"the",
"a1",
"a2",
"b1",
"b2",
"scheme",
"often",
"used",
"in",
"CML",
".",
"It",
"will",
"also",
"set",
"id",
"s",
"for",
"all",
"AtomContainers",
"naming",
"them",
"m1",
"m2",
"etc",
".",
"It",
"will",
"not",
"the",
"AtomContainerSet",
"itself",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/IDCreator.java#L232-L249 |
auth0/auth0-java | src/main/java/com/auth0/client/auth/AuthAPI.java | AuthAPI.signUp | public SignUpRequest signUp(String email, String password, String connection) {
"""
Creates a sign up request with the given credentials and database connection.
i.e.:
<pre>
{@code
AuthAPI auth = new AuthAPI("me.auth0.com", "B3c6RYhk1v9SbIJcRIOwu62gIUGsnze", "2679NfkaBn62e6w5E8zNEzjr-yWfkaBne");
try {
Map<String, String> fields = new HashMap<String, String>();
fields.put("age", "25);
fields.put("city", "Buenos Aires");
auth.signUp("me@auth0.com", "topsecret", "db-connection")
.setCustomFields(fields)
.execute();
} catch (Auth0Exception e) {
//Something happened
}
}
</pre>
@param email the desired user's email.
@param password the desired user's password.
@param connection the database connection where the user is going to be created.
@return a Request to configure and execute.
"""
Asserts.assertNotNull(email, "email");
Asserts.assertNotNull(password, "password");
Asserts.assertNotNull(connection, "connection");
String url = baseUrl
.newBuilder()
.addPathSegment(PATH_DBCONNECTIONS)
.addPathSegment("signup")
.build()
.toString();
CreateUserRequest request = new CreateUserRequest(client, url);
request.addParameter(KEY_CLIENT_ID, clientId);
request.addParameter(KEY_EMAIL, email);
request.addParameter(KEY_PASSWORD, password);
request.addParameter(KEY_CONNECTION, connection);
return request;
} | java | public SignUpRequest signUp(String email, String password, String connection) {
Asserts.assertNotNull(email, "email");
Asserts.assertNotNull(password, "password");
Asserts.assertNotNull(connection, "connection");
String url = baseUrl
.newBuilder()
.addPathSegment(PATH_DBCONNECTIONS)
.addPathSegment("signup")
.build()
.toString();
CreateUserRequest request = new CreateUserRequest(client, url);
request.addParameter(KEY_CLIENT_ID, clientId);
request.addParameter(KEY_EMAIL, email);
request.addParameter(KEY_PASSWORD, password);
request.addParameter(KEY_CONNECTION, connection);
return request;
} | [
"public",
"SignUpRequest",
"signUp",
"(",
"String",
"email",
",",
"String",
"password",
",",
"String",
"connection",
")",
"{",
"Asserts",
".",
"assertNotNull",
"(",
"email",
",",
"\"email\"",
")",
";",
"Asserts",
".",
"assertNotNull",
"(",
"password",
",",
"\"password\"",
")",
";",
"Asserts",
".",
"assertNotNull",
"(",
"connection",
",",
"\"connection\"",
")",
";",
"String",
"url",
"=",
"baseUrl",
".",
"newBuilder",
"(",
")",
".",
"addPathSegment",
"(",
"PATH_DBCONNECTIONS",
")",
".",
"addPathSegment",
"(",
"\"signup\"",
")",
".",
"build",
"(",
")",
".",
"toString",
"(",
")",
";",
"CreateUserRequest",
"request",
"=",
"new",
"CreateUserRequest",
"(",
"client",
",",
"url",
")",
";",
"request",
".",
"addParameter",
"(",
"KEY_CLIENT_ID",
",",
"clientId",
")",
";",
"request",
".",
"addParameter",
"(",
"KEY_EMAIL",
",",
"email",
")",
";",
"request",
".",
"addParameter",
"(",
"KEY_PASSWORD",
",",
"password",
")",
";",
"request",
".",
"addParameter",
"(",
"KEY_CONNECTION",
",",
"connection",
")",
";",
"return",
"request",
";",
"}"
] | Creates a sign up request with the given credentials and database connection.
i.e.:
<pre>
{@code
AuthAPI auth = new AuthAPI("me.auth0.com", "B3c6RYhk1v9SbIJcRIOwu62gIUGsnze", "2679NfkaBn62e6w5E8zNEzjr-yWfkaBne");
try {
Map<String, String> fields = new HashMap<String, String>();
fields.put("age", "25);
fields.put("city", "Buenos Aires");
auth.signUp("me@auth0.com", "topsecret", "db-connection")
.setCustomFields(fields)
.execute();
} catch (Auth0Exception e) {
//Something happened
}
}
</pre>
@param email the desired user's email.
@param password the desired user's password.
@param connection the database connection where the user is going to be created.
@return a Request to configure and execute. | [
"Creates",
"a",
"sign",
"up",
"request",
"with",
"the",
"given",
"credentials",
"and",
"database",
"connection",
".",
"i",
".",
"e",
".",
":",
"<pre",
">",
"{",
"@code",
"AuthAPI",
"auth",
"=",
"new",
"AuthAPI",
"(",
"me",
".",
"auth0",
".",
"com",
"B3c6RYhk1v9SbIJcRIOwu62gIUGsnze",
"2679NfkaBn62e6w5E8zNEzjr",
"-",
"yWfkaBne",
")",
";",
"try",
"{",
"Map<String",
"String",
">",
"fields",
"=",
"new",
"HashMap<String",
"String",
">",
"()",
";",
"fields",
".",
"put",
"(",
"age",
"25",
")",
";",
"fields",
".",
"put",
"(",
"city",
"Buenos",
"Aires",
")",
";",
"auth",
".",
"signUp",
"(",
"me@auth0",
".",
"com",
"topsecret",
"db",
"-",
"connection",
")",
".",
"setCustomFields",
"(",
"fields",
")",
".",
"execute",
"()",
";",
"}",
"catch",
"(",
"Auth0Exception",
"e",
")",
"{",
"//",
"Something",
"happened",
"}",
"}",
"<",
"/",
"pre",
">"
] | train | https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/client/auth/AuthAPI.java#L285-L302 |
undertow-io/undertow | core/src/main/java/io/undertow/util/FlexBase64.java | FlexBase64.encodeString | public static String encodeString(byte[] source, boolean wrap) {
"""
Encodes a fixed and complete byte array into a Base64 String.
<p>This method is only useful for applications which require a String and have all data to be encoded up-front.
Note that byte arrays or buffers are almost always a better storage choice. They consume half the memory and
can be reused (modified). In other words, it is almost always better to use {@link #encodeBytes},
{@link #createEncoder}, or {@link #createEncoderOutputStream} instead.
instead.
@param source the byte array to encode from
@param wrap whether or not to wrap the output at 76 chars with CRLFs
@return a new String representing the Base64 output
"""
return Encoder.encodeString(source, 0, source.length, wrap, false);
} | java | public static String encodeString(byte[] source, boolean wrap) {
return Encoder.encodeString(source, 0, source.length, wrap, false);
} | [
"public",
"static",
"String",
"encodeString",
"(",
"byte",
"[",
"]",
"source",
",",
"boolean",
"wrap",
")",
"{",
"return",
"Encoder",
".",
"encodeString",
"(",
"source",
",",
"0",
",",
"source",
".",
"length",
",",
"wrap",
",",
"false",
")",
";",
"}"
] | Encodes a fixed and complete byte array into a Base64 String.
<p>This method is only useful for applications which require a String and have all data to be encoded up-front.
Note that byte arrays or buffers are almost always a better storage choice. They consume half the memory and
can be reused (modified). In other words, it is almost always better to use {@link #encodeBytes},
{@link #createEncoder}, or {@link #createEncoderOutputStream} instead.
instead.
@param source the byte array to encode from
@param wrap whether or not to wrap the output at 76 chars with CRLFs
@return a new String representing the Base64 output | [
"Encodes",
"a",
"fixed",
"and",
"complete",
"byte",
"array",
"into",
"a",
"Base64",
"String",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/FlexBase64.java#L148-L150 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/StringUtils.java | StringUtils.indexOfIgnoreCase | public static int indexOfIgnoreCase(final String source, final String target) {
"""
Returns the index within given source string of the first occurrence of the
specified target string with ignore case sensitive.
@param source source string to be tested.
@param target target string to be tested.
@return index number if found, -1 otherwise.
"""
int targetIndex = source.indexOf(target);
if (targetIndex == INDEX_OF_NOT_FOUND) {
String sourceLowerCase = source.toLowerCase();
String targetLowerCase = target.toLowerCase();
targetIndex = sourceLowerCase.indexOf(targetLowerCase);
return targetIndex;
} else {
return targetIndex;
}
} | java | public static int indexOfIgnoreCase(final String source, final String target) {
int targetIndex = source.indexOf(target);
if (targetIndex == INDEX_OF_NOT_FOUND) {
String sourceLowerCase = source.toLowerCase();
String targetLowerCase = target.toLowerCase();
targetIndex = sourceLowerCase.indexOf(targetLowerCase);
return targetIndex;
} else {
return targetIndex;
}
} | [
"public",
"static",
"int",
"indexOfIgnoreCase",
"(",
"final",
"String",
"source",
",",
"final",
"String",
"target",
")",
"{",
"int",
"targetIndex",
"=",
"source",
".",
"indexOf",
"(",
"target",
")",
";",
"if",
"(",
"targetIndex",
"==",
"INDEX_OF_NOT_FOUND",
")",
"{",
"String",
"sourceLowerCase",
"=",
"source",
".",
"toLowerCase",
"(",
")",
";",
"String",
"targetLowerCase",
"=",
"target",
".",
"toLowerCase",
"(",
")",
";",
"targetIndex",
"=",
"sourceLowerCase",
".",
"indexOf",
"(",
"targetLowerCase",
")",
";",
"return",
"targetIndex",
";",
"}",
"else",
"{",
"return",
"targetIndex",
";",
"}",
"}"
] | Returns the index within given source string of the first occurrence of the
specified target string with ignore case sensitive.
@param source source string to be tested.
@param target target string to be tested.
@return index number if found, -1 otherwise. | [
"Returns",
"the",
"index",
"within",
"given",
"source",
"string",
"of",
"the",
"first",
"occurrence",
"of",
"the",
"specified",
"target",
"string",
"with",
"ignore",
"case",
"sensitive",
"."
] | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/StringUtils.java#L125-L136 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java | ReviewsImpl.addVideoFrameUrl | public void addVideoFrameUrl(String teamName, String reviewId, String contentType, List<VideoFrameBodyItem> videoFrameBody, AddVideoFrameUrlOptionalParameter addVideoFrameUrlOptionalParameter) {
"""
Use this method to add frames for a video review.Timescale: This parameter is a factor which is used to convert the timestamp on a frame into milliseconds. Timescale is provided in the output of the Content Moderator video media processor on the Azure Media Services platform.Timescale in the Video Moderation output is Ticks/Second.
@param teamName Your team name.
@param reviewId Id of the review.
@param contentType The content type.
@param videoFrameBody Body for add video frames API
@param addVideoFrameUrlOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws APIErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
"""
addVideoFrameUrlWithServiceResponseAsync(teamName, reviewId, contentType, videoFrameBody, addVideoFrameUrlOptionalParameter).toBlocking().single().body();
} | java | public void addVideoFrameUrl(String teamName, String reviewId, String contentType, List<VideoFrameBodyItem> videoFrameBody, AddVideoFrameUrlOptionalParameter addVideoFrameUrlOptionalParameter) {
addVideoFrameUrlWithServiceResponseAsync(teamName, reviewId, contentType, videoFrameBody, addVideoFrameUrlOptionalParameter).toBlocking().single().body();
} | [
"public",
"void",
"addVideoFrameUrl",
"(",
"String",
"teamName",
",",
"String",
"reviewId",
",",
"String",
"contentType",
",",
"List",
"<",
"VideoFrameBodyItem",
">",
"videoFrameBody",
",",
"AddVideoFrameUrlOptionalParameter",
"addVideoFrameUrlOptionalParameter",
")",
"{",
"addVideoFrameUrlWithServiceResponseAsync",
"(",
"teamName",
",",
"reviewId",
",",
"contentType",
",",
"videoFrameBody",
",",
"addVideoFrameUrlOptionalParameter",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Use this method to add frames for a video review.Timescale: This parameter is a factor which is used to convert the timestamp on a frame into milliseconds. Timescale is provided in the output of the Content Moderator video media processor on the Azure Media Services platform.Timescale in the Video Moderation output is Ticks/Second.
@param teamName Your team name.
@param reviewId Id of the review.
@param contentType The content type.
@param videoFrameBody Body for add video frames API
@param addVideoFrameUrlOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws APIErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Use",
"this",
"method",
"to",
"add",
"frames",
"for",
"a",
"video",
"review",
".",
"Timescale",
":",
"This",
"parameter",
"is",
"a",
"factor",
"which",
"is",
"used",
"to",
"convert",
"the",
"timestamp",
"on",
"a",
"frame",
"into",
"milliseconds",
".",
"Timescale",
"is",
"provided",
"in",
"the",
"output",
"of",
"the",
"Content",
"Moderator",
"video",
"media",
"processor",
"on",
"the",
"Azure",
"Media",
"Services",
"platform",
".",
"Timescale",
"in",
"the",
"Video",
"Moderation",
"output",
"is",
"Ticks",
"/",
"Second",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L2181-L2183 |
tiesebarrell/process-assertions | process-assertions-api/src/main/java/org/toxos/processassertions/api/internal/MessageLogger.java | MessageLogger.logError | public final void logError(final Logger logger, final String messageKey, final Object... objects) {
"""
Logs a message by the provided key to the provided {@link Logger} at error level after substituting the parameters in the message by the provided objects.
@param logger the logger to log to
@param messageKey the key of the message in the bundle
@param objects the substitution parameters
"""
logger.error(getMessage(messageKey, objects));
} | java | public final void logError(final Logger logger, final String messageKey, final Object... objects) {
logger.error(getMessage(messageKey, objects));
} | [
"public",
"final",
"void",
"logError",
"(",
"final",
"Logger",
"logger",
",",
"final",
"String",
"messageKey",
",",
"final",
"Object",
"...",
"objects",
")",
"{",
"logger",
".",
"error",
"(",
"getMessage",
"(",
"messageKey",
",",
"objects",
")",
")",
";",
"}"
] | Logs a message by the provided key to the provided {@link Logger} at error level after substituting the parameters in the message by the provided objects.
@param logger the logger to log to
@param messageKey the key of the message in the bundle
@param objects the substitution parameters | [
"Logs",
"a",
"message",
"by",
"the",
"provided",
"key",
"to",
"the",
"provided",
"{"
] | train | https://github.com/tiesebarrell/process-assertions/blob/932a8443982e356cdf5a230165a35c725d9306ab/process-assertions-api/src/main/java/org/toxos/processassertions/api/internal/MessageLogger.java#L68-L70 |
allengeorge/libraft | libraft-agent/src/main/java/io/libraft/agent/RaftMember.java | RaftMember.compareAndSetChannel | public boolean compareAndSetChannel(@Nullable Channel oldChannel, @Nullable Channel newChannel) {
"""
Set the {@link Channel} used to communicate with the Raft server
to {@code newChannel} <strong>only if</strong> the current channel is {@code oldChannel}.
noop otherwise.
@param oldChannel expected value of the {@code Channel}
@param newChannel a valid, <strong>connected</strong>d {@code Channel} to the Raft server.
{@code null} if no connection exists
@return true if the value was set to {@code newChannel}, false otherwise
"""
return channel.compareAndSet(oldChannel, newChannel);
} | java | public boolean compareAndSetChannel(@Nullable Channel oldChannel, @Nullable Channel newChannel) {
return channel.compareAndSet(oldChannel, newChannel);
} | [
"public",
"boolean",
"compareAndSetChannel",
"(",
"@",
"Nullable",
"Channel",
"oldChannel",
",",
"@",
"Nullable",
"Channel",
"newChannel",
")",
"{",
"return",
"channel",
".",
"compareAndSet",
"(",
"oldChannel",
",",
"newChannel",
")",
";",
"}"
] | Set the {@link Channel} used to communicate with the Raft server
to {@code newChannel} <strong>only if</strong> the current channel is {@code oldChannel}.
noop otherwise.
@param oldChannel expected value of the {@code Channel}
@param newChannel a valid, <strong>connected</strong>d {@code Channel} to the Raft server.
{@code null} if no connection exists
@return true if the value was set to {@code newChannel}, false otherwise | [
"Set",
"the",
"{",
"@link",
"Channel",
"}",
"used",
"to",
"communicate",
"with",
"the",
"Raft",
"server",
"to",
"{",
"@code",
"newChannel",
"}",
"<strong",
">",
"only",
"if<",
"/",
"strong",
">",
"the",
"current",
"channel",
"is",
"{",
"@code",
"oldChannel",
"}",
".",
"noop",
"otherwise",
"."
] | train | https://github.com/allengeorge/libraft/blob/00d68bb5e68d4020af59df3c8a9a14380108ac89/libraft-agent/src/main/java/io/libraft/agent/RaftMember.java#L114-L116 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuGLGetDevices | public static int cuGLGetDevices(int pCudaDeviceCount[], CUdevice pCudaDevices[], int cudaDeviceCount, int CUGLDeviceList_deviceList) {
"""
Gets the CUDA devices associated with the current OpenGL context.
<pre>
CUresult cuGLGetDevices (
unsigned int* pCudaDeviceCount,
CUdevice* pCudaDevices,
unsigned int cudaDeviceCount,
CUGLDeviceList deviceList )
</pre>
<div>
<p>Gets the CUDA devices associated with
the current OpenGL context. Returns in <tt>*pCudaDeviceCount</tt>
the number of CUDA-compatible devices corresponding to the current
OpenGL context. Also returns in <tt>*pCudaDevices</tt> at most
cudaDeviceCount of the CUDA-compatible devices corresponding to the
current OpenGL context. If any of the GPUs being
used by the current OpenGL context are
not CUDA capable then the call will return CUDA_ERROR_NO_DEVICE.
</p>
<p>The <tt>deviceList</tt> argument may
be any of the following:
<ul>
<li>
<p>CU_GL_DEVICE_LIST_ALL: Query
all devices used by the current OpenGL context.
</p>
</li>
<li>
<p>CU_GL_DEVICE_LIST_CURRENT_FRAME:
Query the devices used by the current OpenGL context to render the
current frame (in SLI).
</p>
</li>
<li>
<p>CU_GL_DEVICE_LIST_NEXT_FRAME:
Query the devices used by the current OpenGL context to render the next
frame (in SLI). Note that this is a prediction,
it can't be guaranteed that this
is correct in all cases.
</p>
</li>
</ul>
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param pCudaDeviceCount Returned number of CUDA devices.
@param pCudaDevices Returned CUDA devices.
@param cudaDeviceCount The size of the output device array pCudaDevices.
@param deviceList The set of devices to return.
@return CUDA_SUCCESS, CUDA_ERROR_NO_DEVICE,
CUDA_ERROR_INVALID_VALUECUDA_ERROR_INVALID_CONTEXT
"""
return checkResult(cuGLGetDevicesNative(pCudaDeviceCount, pCudaDevices, cudaDeviceCount, CUGLDeviceList_deviceList));
} | java | public static int cuGLGetDevices(int pCudaDeviceCount[], CUdevice pCudaDevices[], int cudaDeviceCount, int CUGLDeviceList_deviceList)
{
return checkResult(cuGLGetDevicesNative(pCudaDeviceCount, pCudaDevices, cudaDeviceCount, CUGLDeviceList_deviceList));
} | [
"public",
"static",
"int",
"cuGLGetDevices",
"(",
"int",
"pCudaDeviceCount",
"[",
"]",
",",
"CUdevice",
"pCudaDevices",
"[",
"]",
",",
"int",
"cudaDeviceCount",
",",
"int",
"CUGLDeviceList_deviceList",
")",
"{",
"return",
"checkResult",
"(",
"cuGLGetDevicesNative",
"(",
"pCudaDeviceCount",
",",
"pCudaDevices",
",",
"cudaDeviceCount",
",",
"CUGLDeviceList_deviceList",
")",
")",
";",
"}"
] | Gets the CUDA devices associated with the current OpenGL context.
<pre>
CUresult cuGLGetDevices (
unsigned int* pCudaDeviceCount,
CUdevice* pCudaDevices,
unsigned int cudaDeviceCount,
CUGLDeviceList deviceList )
</pre>
<div>
<p>Gets the CUDA devices associated with
the current OpenGL context. Returns in <tt>*pCudaDeviceCount</tt>
the number of CUDA-compatible devices corresponding to the current
OpenGL context. Also returns in <tt>*pCudaDevices</tt> at most
cudaDeviceCount of the CUDA-compatible devices corresponding to the
current OpenGL context. If any of the GPUs being
used by the current OpenGL context are
not CUDA capable then the call will return CUDA_ERROR_NO_DEVICE.
</p>
<p>The <tt>deviceList</tt> argument may
be any of the following:
<ul>
<li>
<p>CU_GL_DEVICE_LIST_ALL: Query
all devices used by the current OpenGL context.
</p>
</li>
<li>
<p>CU_GL_DEVICE_LIST_CURRENT_FRAME:
Query the devices used by the current OpenGL context to render the
current frame (in SLI).
</p>
</li>
<li>
<p>CU_GL_DEVICE_LIST_NEXT_FRAME:
Query the devices used by the current OpenGL context to render the next
frame (in SLI). Note that this is a prediction,
it can't be guaranteed that this
is correct in all cases.
</p>
</li>
</ul>
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param pCudaDeviceCount Returned number of CUDA devices.
@param pCudaDevices Returned CUDA devices.
@param cudaDeviceCount The size of the output device array pCudaDevices.
@param deviceList The set of devices to return.
@return CUDA_SUCCESS, CUDA_ERROR_NO_DEVICE,
CUDA_ERROR_INVALID_VALUECUDA_ERROR_INVALID_CONTEXT | [
"Gets",
"the",
"CUDA",
"devices",
"associated",
"with",
"the",
"current",
"OpenGL",
"context",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L15187-L15190 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/CmsGalleryControllerHandler.java | CmsGalleryControllerHandler.onUpdateTypes | public void onUpdateTypes(List<CmsResourceTypeBean> types, List<String> selectedTypes) {
"""
Will be triggered when the sort parameters of the types list are changed.<p>
@param types the updated types list
@param selectedTypes the list of types to select
"""
m_galleryDialog.getTypesTab().updateContent(types, selectedTypes);
} | java | public void onUpdateTypes(List<CmsResourceTypeBean> types, List<String> selectedTypes) {
m_galleryDialog.getTypesTab().updateContent(types, selectedTypes);
} | [
"public",
"void",
"onUpdateTypes",
"(",
"List",
"<",
"CmsResourceTypeBean",
">",
"types",
",",
"List",
"<",
"String",
">",
"selectedTypes",
")",
"{",
"m_galleryDialog",
".",
"getTypesTab",
"(",
")",
".",
"updateContent",
"(",
"types",
",",
"selectedTypes",
")",
";",
"}"
] | Will be triggered when the sort parameters of the types list are changed.<p>
@param types the updated types list
@param selectedTypes the list of types to select | [
"Will",
"be",
"triggered",
"when",
"the",
"sort",
"parameters",
"of",
"the",
"types",
"list",
"are",
"changed",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryControllerHandler.java#L407-L410 |
voldemort/voldemort | src/java/voldemort/store/readonly/io/jna/mman.java | mman.munmap | public static int munmap(Pointer addr, long len) throws IOException {
"""
Unmap the given region. Returns 0 on success or -1 (and sets
errno) on failure.
"""
int result = Delegate.munmap(addr, new NativeLong(len));
if(result != 0) {
if(logger.isDebugEnabled())
logger.debug(errno.strerror());
throw new IOException("munmap failed: " + errno.strerror());
}
return result;
} | java | public static int munmap(Pointer addr, long len) throws IOException {
int result = Delegate.munmap(addr, new NativeLong(len));
if(result != 0) {
if(logger.isDebugEnabled())
logger.debug(errno.strerror());
throw new IOException("munmap failed: " + errno.strerror());
}
return result;
} | [
"public",
"static",
"int",
"munmap",
"(",
"Pointer",
"addr",
",",
"long",
"len",
")",
"throws",
"IOException",
"{",
"int",
"result",
"=",
"Delegate",
".",
"munmap",
"(",
"addr",
",",
"new",
"NativeLong",
"(",
"len",
")",
")",
";",
"if",
"(",
"result",
"!=",
"0",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"logger",
".",
"debug",
"(",
"errno",
".",
"strerror",
"(",
")",
")",
";",
"throw",
"new",
"IOException",
"(",
"\"munmap failed: \"",
"+",
"errno",
".",
"strerror",
"(",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Unmap the given region. Returns 0 on success or -1 (and sets
errno) on failure. | [
"Unmap",
"the",
"given",
"region",
".",
"Returns",
"0",
"on",
"success",
"or",
"-",
"1",
"(",
"and",
"sets",
"errno",
")",
"on",
"failure",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/readonly/io/jna/mman.java#L63-L75 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionImagesInner.java | VirtualMachineExtensionImagesInner.getAsync | public Observable<VirtualMachineExtensionImageInner> getAsync(String location, String publisherName, String type, String version) {
"""
Gets a virtual machine extension image.
@param location The name of a supported Azure region.
@param publisherName the String value
@param type the String value
@param version the String value
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VirtualMachineExtensionImageInner object
"""
return getWithServiceResponseAsync(location, publisherName, type, version).map(new Func1<ServiceResponse<VirtualMachineExtensionImageInner>, VirtualMachineExtensionImageInner>() {
@Override
public VirtualMachineExtensionImageInner call(ServiceResponse<VirtualMachineExtensionImageInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualMachineExtensionImageInner> getAsync(String location, String publisherName, String type, String version) {
return getWithServiceResponseAsync(location, publisherName, type, version).map(new Func1<ServiceResponse<VirtualMachineExtensionImageInner>, VirtualMachineExtensionImageInner>() {
@Override
public VirtualMachineExtensionImageInner call(ServiceResponse<VirtualMachineExtensionImageInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualMachineExtensionImageInner",
">",
"getAsync",
"(",
"String",
"location",
",",
"String",
"publisherName",
",",
"String",
"type",
",",
"String",
"version",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"location",
",",
"publisherName",
",",
"type",
",",
"version",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"VirtualMachineExtensionImageInner",
">",
",",
"VirtualMachineExtensionImageInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"VirtualMachineExtensionImageInner",
"call",
"(",
"ServiceResponse",
"<",
"VirtualMachineExtensionImageInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets a virtual machine extension image.
@param location The name of a supported Azure region.
@param publisherName the String value
@param type the String value
@param version the String value
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VirtualMachineExtensionImageInner object | [
"Gets",
"a",
"virtual",
"machine",
"extension",
"image",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionImagesInner.java#L110-L117 |