repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
fuinorg/utils4j | src/main/java/org/fuin/utils4j/Utils4J.java | Utils4J.toDigit | private static int toDigit(final char ch, final int index) {
"""
Converts a hexadecimal character to an integer.
@param ch
A character to convert to an integer digit
@param index
The index of the character in the source
@return An integer
@author Apache Software Foundation
@see org.apache.commons.codec.binary.Hex
"""
final int digit = Character.digit(ch, 16);
if (digit == -1) {
throw new RuntimeException("Illegal hexadecimal charcter " + ch + " at index " + index);
}
return digit;
} | java | private static int toDigit(final char ch, final int index) {
final int digit = Character.digit(ch, 16);
if (digit == -1) {
throw new RuntimeException("Illegal hexadecimal charcter " + ch + " at index " + index);
}
return digit;
} | [
"private",
"static",
"int",
"toDigit",
"(",
"final",
"char",
"ch",
",",
"final",
"int",
"index",
")",
"{",
"final",
"int",
"digit",
"=",
"Character",
".",
"digit",
"(",
"ch",
",",
"16",
")",
";",
"if",
"(",
"digit",
"==",
"-",
"1",
")",
"{",
"thr... | Converts a hexadecimal character to an integer.
@param ch
A character to convert to an integer digit
@param index
The index of the character in the source
@return An integer
@author Apache Software Foundation
@see org.apache.commons.codec.binary.Hex | [
"Converts",
"a",
"hexadecimal",
"character",
"to",
"an",
"integer",
"."
] | train | https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L1227-L1233 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/filter/ChainerServlet.java | ChainerServlet.getRequiredInitParameter | String getRequiredInitParameter(String name) throws ServletException {
"""
Retrieve a required init parameter by name.
@exception javax.servlet.ServletException thrown if the required parameter is not present.
"""
String value = getInitParameter(name);
if (value == null) {
throw new ServletException(MessageFormat.format(nls.getString("Missing.required.initialization.parameter","Missing required initialization parameter: {0}"), new Object[]{name}));
}
return value;
} | java | String getRequiredInitParameter(String name) throws ServletException {
String value = getInitParameter(name);
if (value == null) {
throw new ServletException(MessageFormat.format(nls.getString("Missing.required.initialization.parameter","Missing required initialization parameter: {0}"), new Object[]{name}));
}
return value;
} | [
"String",
"getRequiredInitParameter",
"(",
"String",
"name",
")",
"throws",
"ServletException",
"{",
"String",
"value",
"=",
"getInitParameter",
"(",
"name",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"ServletException",
"(",
"Messag... | Retrieve a required init parameter by name.
@exception javax.servlet.ServletException thrown if the required parameter is not present. | [
"Retrieve",
"a",
"required",
"init",
"parameter",
"by",
"name",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/filter/ChainerServlet.java#L153-L160 |
bazaarvoice/emodb | auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/apikey/ApiKeyRealm.java | ApiKeyRealm.createAuthenticationInfo | private ApiKeyAuthenticationInfo createAuthenticationInfo(String authenticationId, ApiKey apiKey) {
"""
Simple method to build and AuthenticationInfo instance from an API key.
"""
return new ApiKeyAuthenticationInfo(authenticationId, apiKey, getName());
} | java | private ApiKeyAuthenticationInfo createAuthenticationInfo(String authenticationId, ApiKey apiKey) {
return new ApiKeyAuthenticationInfo(authenticationId, apiKey, getName());
} | [
"private",
"ApiKeyAuthenticationInfo",
"createAuthenticationInfo",
"(",
"String",
"authenticationId",
",",
"ApiKey",
"apiKey",
")",
"{",
"return",
"new",
"ApiKeyAuthenticationInfo",
"(",
"authenticationId",
",",
"apiKey",
",",
"getName",
"(",
")",
")",
";",
"}"
] | Simple method to build and AuthenticationInfo instance from an API key. | [
"Simple",
"method",
"to",
"build",
"and",
"AuthenticationInfo",
"instance",
"from",
"an",
"API",
"key",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/apikey/ApiKeyRealm.java#L225-L227 |
transloadit/java-sdk | src/main/java/com/transloadit/sdk/Transloadit.java | Transloadit.deleteTemplate | public Response deleteTemplate(String id)
throws RequestException, LocalOperationException {
"""
Deletes a template.
@param id id of the template to delete.
@return {@link Response}
@throws RequestException if request to transloadit server fails.
@throws LocalOperationException if something goes wrong while running non-http operations.
"""
Request request = new Request(this);
return new Response(request.delete("/templates/" + id, new HashMap<String, Object>()));
} | java | public Response deleteTemplate(String id)
throws RequestException, LocalOperationException {
Request request = new Request(this);
return new Response(request.delete("/templates/" + id, new HashMap<String, Object>()));
} | [
"public",
"Response",
"deleteTemplate",
"(",
"String",
"id",
")",
"throws",
"RequestException",
",",
"LocalOperationException",
"{",
"Request",
"request",
"=",
"new",
"Request",
"(",
"this",
")",
";",
"return",
"new",
"Response",
"(",
"request",
".",
"delete",
... | Deletes a template.
@param id id of the template to delete.
@return {@link Response}
@throws RequestException if request to transloadit server fails.
@throws LocalOperationException if something goes wrong while running non-http operations. | [
"Deletes",
"a",
"template",
"."
] | train | https://github.com/transloadit/java-sdk/blob/9326c540a66f77b3d907d0b2c05bff1145ca14f7/src/main/java/com/transloadit/sdk/Transloadit.java#L225-L229 |
jbundle/jbundle | base/remote/src/main/java/org/jbundle/base/remote/proxy/transport/AjaxProxyTask.java | AjaxProxyTask.setErrorReturn | public void setErrorReturn(PrintWriter out, RemoteException ex)
throws RemoteException {
"""
Sent/send this return string.
@param out The return output stream.
@param strReturn The string to return.
"""
out.println(Utility.startTag(XMLTags.STATUS_TEXT));
String strMessage = ex.getLocalizedMessage();
if (Utility.isNumeric(strMessage))
{
try {
int iErrorCode = Integer.parseInt(strMessage);
out.println(Utility.startTag(XMLTags.ERROR_CODE) + strMessage + Utility.endTag(XMLTags.ERROR_CODE));
if (this.getTask() != null)
if (this.getTask().getApplication() != null)
strMessage = this.getTask().getApplication().getSecurityErrorText(iErrorCode);
} catch (NumberFormatException ex2) {
// Ignore
}
}
out.println(Utility.startTag(XMLTags.TEXT) + strMessage + Utility.endTag(XMLTags.TEXT));
out.println(Utility.startTag(XMLTags.ERROR) + "error" + Utility.endTag(XMLTags.ERROR));
out.println(Utility.endTag(XMLTags.STATUS_TEXT));
return;
} | java | public void setErrorReturn(PrintWriter out, RemoteException ex)
throws RemoteException
{
out.println(Utility.startTag(XMLTags.STATUS_TEXT));
String strMessage = ex.getLocalizedMessage();
if (Utility.isNumeric(strMessage))
{
try {
int iErrorCode = Integer.parseInt(strMessage);
out.println(Utility.startTag(XMLTags.ERROR_CODE) + strMessage + Utility.endTag(XMLTags.ERROR_CODE));
if (this.getTask() != null)
if (this.getTask().getApplication() != null)
strMessage = this.getTask().getApplication().getSecurityErrorText(iErrorCode);
} catch (NumberFormatException ex2) {
// Ignore
}
}
out.println(Utility.startTag(XMLTags.TEXT) + strMessage + Utility.endTag(XMLTags.TEXT));
out.println(Utility.startTag(XMLTags.ERROR) + "error" + Utility.endTag(XMLTags.ERROR));
out.println(Utility.endTag(XMLTags.STATUS_TEXT));
return;
} | [
"public",
"void",
"setErrorReturn",
"(",
"PrintWriter",
"out",
",",
"RemoteException",
"ex",
")",
"throws",
"RemoteException",
"{",
"out",
".",
"println",
"(",
"Utility",
".",
"startTag",
"(",
"XMLTags",
".",
"STATUS_TEXT",
")",
")",
";",
"String",
"strMessage... | Sent/send this return string.
@param out The return output stream.
@param strReturn The string to return. | [
"Sent",
"/",
"send",
"this",
"return",
"string",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/proxy/transport/AjaxProxyTask.java#L145-L166 |
alkacon/opencms-core | src-setup/org/opencms/setup/CmsSetupDb.java | CmsSetupDb.createDatabase | public void createDatabase(String database, Map<String, String> replacer) {
"""
Calls the create database script for the given database.<p>
@param database the name of the database
@param replacer the replacements to perform in the drop script
"""
m_errorLogging = true;
executeSql(database, "create_db.sql", replacer, true);
} | java | public void createDatabase(String database, Map<String, String> replacer) {
m_errorLogging = true;
executeSql(database, "create_db.sql", replacer, true);
} | [
"public",
"void",
"createDatabase",
"(",
"String",
"database",
",",
"Map",
"<",
"String",
",",
"String",
">",
"replacer",
")",
"{",
"m_errorLogging",
"=",
"true",
";",
"executeSql",
"(",
"database",
",",
"\"create_db.sql\"",
",",
"replacer",
",",
"true",
")"... | Calls the create database script for the given database.<p>
@param database the name of the database
@param replacer the replacements to perform in the drop script | [
"Calls",
"the",
"create",
"database",
"script",
"for",
"the",
"given",
"database",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupDb.java#L200-L204 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java | CommitLogSegment.markClean | public synchronized void markClean(UUID cfId, ReplayPosition context) {
"""
Marks the ColumnFamily specified by cfId as clean for this log segment. If the
given context argument is contained in this file, it will only mark the CF as
clean if no newer writes have taken place.
@param cfId the column family ID that is now clean
@param context the optional clean offset
"""
if (!cfDirty.containsKey(cfId))
return;
if (context.segment == id)
markClean(cfId, context.position);
else if (context.segment > id)
markClean(cfId, Integer.MAX_VALUE);
} | java | public synchronized void markClean(UUID cfId, ReplayPosition context)
{
if (!cfDirty.containsKey(cfId))
return;
if (context.segment == id)
markClean(cfId, context.position);
else if (context.segment > id)
markClean(cfId, Integer.MAX_VALUE);
} | [
"public",
"synchronized",
"void",
"markClean",
"(",
"UUID",
"cfId",
",",
"ReplayPosition",
"context",
")",
"{",
"if",
"(",
"!",
"cfDirty",
".",
"containsKey",
"(",
"cfId",
")",
")",
"return",
";",
"if",
"(",
"context",
".",
"segment",
"==",
"id",
")",
... | Marks the ColumnFamily specified by cfId as clean for this log segment. If the
given context argument is contained in this file, it will only mark the CF as
clean if no newer writes have taken place.
@param cfId the column family ID that is now clean
@param context the optional clean offset | [
"Marks",
"the",
"ColumnFamily",
"specified",
"by",
"cfId",
"as",
"clean",
"for",
"this",
"log",
"segment",
".",
"If",
"the",
"given",
"context",
"argument",
"is",
"contained",
"in",
"this",
"file",
"it",
"will",
"only",
"mark",
"the",
"CF",
"as",
"clean",
... | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java#L455-L463 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/support/AuditableSupport.java | AuditableSupport.assertNotNull | private <T> T assertNotNull(T value, Supplier<String> message) {
"""
Assert the given {@link Object value} is not {@literal null}.
@param <T> {@link Class type} of the {@link Object value}.
@param value {@link Object} to evaluate.
@param message {@link Supplier} containing the message used in the {@link IllegalArgumentException}.
@return the given {@link Object value} if not {@literal null}.
@throws IllegalArgumentException with {@link Supplier message} if the {@link Object value} is {@literal null}.
@see java.util.function.Supplier
"""
Assert.notNull(value, message);
return value;
} | java | private <T> T assertNotNull(T value, Supplier<String> message) {
Assert.notNull(value, message);
return value;
} | [
"private",
"<",
"T",
">",
"T",
"assertNotNull",
"(",
"T",
"value",
",",
"Supplier",
"<",
"String",
">",
"message",
")",
"{",
"Assert",
".",
"notNull",
"(",
"value",
",",
"message",
")",
";",
"return",
"value",
";",
"}"
] | Assert the given {@link Object value} is not {@literal null}.
@param <T> {@link Class type} of the {@link Object value}.
@param value {@link Object} to evaluate.
@param message {@link Supplier} containing the message used in the {@link IllegalArgumentException}.
@return the given {@link Object value} if not {@literal null}.
@throws IllegalArgumentException with {@link Supplier message} if the {@link Object value} is {@literal null}.
@see java.util.function.Supplier | [
"Assert",
"the",
"given",
"{",
"@link",
"Object",
"value",
"}",
"is",
"not",
"{",
"@literal",
"null",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/support/AuditableSupport.java#L65-L68 |
simter/simter-jwt | src/main/java/tech/simter/jwt/JWT.java | JWT.verify | public static JWT verify(String jwt, byte[] secret) {
"""
Validate whether the JWT is valid. If valid return the decoded instance.
<p>Follow <code>rfc7519#section-7</code> to validating a JWT</p>
@param jwt jwt
@param secret signature key
@return the decoded jwt instance
@throws DecodeException if jwt is illegal.
"""
// 1. verify that the jwt contains at least one period ('.') character
if (jwt.indexOf(".") <= 0)
throw new DecodeException("Illegal jwt: no '.' character inner");
// verify and verify header, payload
String[] hps = jwt.split("\\.");
Header header = Header.decode(hps[0]);
// a unsecured JWT is not supported this time
if (header.algorithm == Algorithm.NONE && hps.length == 2)
throw new DecodeException("'none' algorithm is not support.");
// secured jwt
if (hps.length != 3)
throw new DecodeException("Illegal jwt: not [header].[payload].[signature] format");
Payload payload = Payload.decode(hps[1]);
// verify the signature
byte[] signature = SignerFactory.get(header.algorithm)
.sign((hps[0] + "." + hps[1]).getBytes(StandardCharsets.UTF_8), secret);
if (!hps[2].equals(new String(signature, StandardCharsets.UTF_8))) {
throw new DecodeException("Illegal jwt: signature not match");
} else {
return new JWT(header, payload);
}
} | java | public static JWT verify(String jwt, byte[] secret) {
// 1. verify that the jwt contains at least one period ('.') character
if (jwt.indexOf(".") <= 0)
throw new DecodeException("Illegal jwt: no '.' character inner");
// verify and verify header, payload
String[] hps = jwt.split("\\.");
Header header = Header.decode(hps[0]);
// a unsecured JWT is not supported this time
if (header.algorithm == Algorithm.NONE && hps.length == 2)
throw new DecodeException("'none' algorithm is not support.");
// secured jwt
if (hps.length != 3)
throw new DecodeException("Illegal jwt: not [header].[payload].[signature] format");
Payload payload = Payload.decode(hps[1]);
// verify the signature
byte[] signature = SignerFactory.get(header.algorithm)
.sign((hps[0] + "." + hps[1]).getBytes(StandardCharsets.UTF_8), secret);
if (!hps[2].equals(new String(signature, StandardCharsets.UTF_8))) {
throw new DecodeException("Illegal jwt: signature not match");
} else {
return new JWT(header, payload);
}
} | [
"public",
"static",
"JWT",
"verify",
"(",
"String",
"jwt",
",",
"byte",
"[",
"]",
"secret",
")",
"{",
"// 1. verify that the jwt contains at least one period ('.') character",
"if",
"(",
"jwt",
".",
"indexOf",
"(",
"\".\"",
")",
"<=",
"0",
")",
"throw",
"new",
... | Validate whether the JWT is valid. If valid return the decoded instance.
<p>Follow <code>rfc7519#section-7</code> to validating a JWT</p>
@param jwt jwt
@param secret signature key
@return the decoded jwt instance
@throws DecodeException if jwt is illegal. | [
"Validate",
"whether",
"the",
"JWT",
"is",
"valid",
".",
"If",
"valid",
"return",
"the",
"decoded",
"instance",
".",
"<p",
">",
"Follow",
"<code",
">",
"rfc7519#section",
"-",
"7<",
"/",
"code",
">",
"to",
"validating",
"a",
"JWT<",
"/",
"p",
">"
] | train | https://github.com/simter/simter-jwt/blob/fea8d520e8eeb26c2ab9f5eeb2bd3f5a6c0e4433/src/main/java/tech/simter/jwt/JWT.java#L65-L91 |
pip-services3-java/pip-services3-components-java | src/org/pipservices3/components/count/CachedCounters.java | CachedCounters.endTiming | public void endTiming(String name, float elapsed) {
"""
Ends measurement of execution elapsed time and updates specified counter.
@param name a counter name
@param elapsed execution elapsed time in milliseconds to update the counter.
@see Timing#endTiming()
"""
Counter counter = get(name, CounterType.Interval);
calculateStats(counter, elapsed);
update();
} | java | public void endTiming(String name, float elapsed) {
Counter counter = get(name, CounterType.Interval);
calculateStats(counter, elapsed);
update();
} | [
"public",
"void",
"endTiming",
"(",
"String",
"name",
",",
"float",
"elapsed",
")",
"{",
"Counter",
"counter",
"=",
"get",
"(",
"name",
",",
"CounterType",
".",
"Interval",
")",
";",
"calculateStats",
"(",
"counter",
",",
"elapsed",
")",
";",
"update",
"... | Ends measurement of execution elapsed time and updates specified counter.
@param name a counter name
@param elapsed execution elapsed time in milliseconds to update the counter.
@see Timing#endTiming() | [
"Ends",
"measurement",
"of",
"execution",
"elapsed",
"time",
"and",
"updates",
"specified",
"counter",
"."
] | train | https://github.com/pip-services3-java/pip-services3-components-java/blob/122352fbf9b208f6417376da7b8ad725bc85ee58/src/org/pipservices3/components/count/CachedCounters.java#L192-L196 |
morimekta/providence | providence-core/src/main/java/net/morimekta/providence/serializer/pretty/Tokenizer.java | Tokenizer.peek | @Nonnull
public Token peek(String message) throws IOException {
"""
Return the next token or throw an exception. Though it does not consume
that token.
@param message Message to add to exception if there are no more JSON
tokens on the stream.
@return The next token.
@throws IOException If unable to read from stream.
"""
if (!hasNext()) {
throw failure(lineNo, linePos + 1, 0, "Expected %s: Got end of file", message);
}
return unreadToken;
} | java | @Nonnull
public Token peek(String message) throws IOException {
if (!hasNext()) {
throw failure(lineNo, linePos + 1, 0, "Expected %s: Got end of file", message);
}
return unreadToken;
} | [
"@",
"Nonnull",
"public",
"Token",
"peek",
"(",
"String",
"message",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"hasNext",
"(",
")",
")",
"{",
"throw",
"failure",
"(",
"lineNo",
",",
"linePos",
"+",
"1",
",",
"0",
",",
"\"Expected %s: Got end of ... | Return the next token or throw an exception. Though it does not consume
that token.
@param message Message to add to exception if there are no more JSON
tokens on the stream.
@return The next token.
@throws IOException If unable to read from stream. | [
"Return",
"the",
"next",
"token",
"or",
"throw",
"an",
"exception",
".",
"Though",
"it",
"does",
"not",
"consume",
"that",
"token",
"."
] | train | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java/net/morimekta/providence/serializer/pretty/Tokenizer.java#L254-L260 |
neoremind/fluent-validator | fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/ResultCollectors.java | ResultCollectors.newComplexResult | static <T extends ComplexResult> T newComplexResult(Supplier<T> supplier, ValidationResult result) {
"""
{@link #toComplex()}和{@link #toComplex2()}复用的结果生成函数
@param supplier 供给模板
@param result 内部用验证结果
@param <T> 结果的泛型
@return 结果
"""
T ret = supplier.get();
if (result.isSuccess()) {
ret.setIsSuccess(true);
} else {
ret.setIsSuccess(false);
ret.setErrors(result.getErrors());
}
ret.setTimeElapsed(result.getTimeElapsed());
return ret;
} | java | static <T extends ComplexResult> T newComplexResult(Supplier<T> supplier, ValidationResult result) {
T ret = supplier.get();
if (result.isSuccess()) {
ret.setIsSuccess(true);
} else {
ret.setIsSuccess(false);
ret.setErrors(result.getErrors());
}
ret.setTimeElapsed(result.getTimeElapsed());
return ret;
} | [
"static",
"<",
"T",
"extends",
"ComplexResult",
">",
"T",
"newComplexResult",
"(",
"Supplier",
"<",
"T",
">",
"supplier",
",",
"ValidationResult",
"result",
")",
"{",
"T",
"ret",
"=",
"supplier",
".",
"get",
"(",
")",
";",
"if",
"(",
"result",
".",
"is... | {@link #toComplex()}和{@link #toComplex2()}复用的结果生成函数
@param supplier 供给模板
@param result 内部用验证结果
@param <T> 结果的泛型
@return 结果 | [
"{",
"@link",
"#toComplex",
"()",
"}",
"和",
"{",
"@link",
"#toComplex2",
"()",
"}",
"复用的结果生成函数"
] | train | https://github.com/neoremind/fluent-validator/blob/b516970591aa9468b44ba63938b98ec341fd6ead/fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/ResultCollectors.java#L81-L92 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java | LiveEventsInner.getAsync | public Observable<LiveEventInner> getAsync(String resourceGroupName, String accountName, String liveEventName) {
"""
Get Live Event.
Gets a Live Event.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param liveEventName The name of the Live Event.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the LiveEventInner object
"""
return getWithServiceResponseAsync(resourceGroupName, accountName, liveEventName).map(new Func1<ServiceResponse<LiveEventInner>, LiveEventInner>() {
@Override
public LiveEventInner call(ServiceResponse<LiveEventInner> response) {
return response.body();
}
});
} | java | public Observable<LiveEventInner> getAsync(String resourceGroupName, String accountName, String liveEventName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, liveEventName).map(new Func1<ServiceResponse<LiveEventInner>, LiveEventInner>() {
@Override
public LiveEventInner call(ServiceResponse<LiveEventInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"LiveEventInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"liveEventName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"liv... | Get Live Event.
Gets a Live Event.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param liveEventName The name of the Live Event.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the LiveEventInner object | [
"Get",
"Live",
"Event",
".",
"Gets",
"a",
"Live",
"Event",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java#L298-L305 |
reactor/reactor-netty | src/main/java/reactor/netty/tcp/ProxyProvider.java | ProxyProvider.newProxyHandler | public final ProxyHandler newProxyHandler() {
"""
Return a new eventual {@link ProxyHandler}
@return a new eventual {@link ProxyHandler}
"""
InetSocketAddress proxyAddr = this.address.get();
String username = this.username;
String password = Objects.nonNull(username) && Objects.nonNull(this.password) ?
this.password.apply(username) : null;
switch (this.type) {
case HTTP:
return Objects.nonNull(username) && Objects.nonNull(password) ?
new HttpProxyHandler(proxyAddr, username, password, this.httpHeaders.get()) :
new HttpProxyHandler(proxyAddr, this.httpHeaders.get());
case SOCKS4:
return Objects.nonNull(username) ? new Socks4ProxyHandler(proxyAddr, username) :
new Socks4ProxyHandler(proxyAddr);
case SOCKS5:
return Objects.nonNull(username) && Objects.nonNull(password) ?
new Socks5ProxyHandler(proxyAddr, username, password) :
new Socks5ProxyHandler(proxyAddr);
}
throw new IllegalArgumentException("Proxy type unsupported : " + this.type);
} | java | public final ProxyHandler newProxyHandler() {
InetSocketAddress proxyAddr = this.address.get();
String username = this.username;
String password = Objects.nonNull(username) && Objects.nonNull(this.password) ?
this.password.apply(username) : null;
switch (this.type) {
case HTTP:
return Objects.nonNull(username) && Objects.nonNull(password) ?
new HttpProxyHandler(proxyAddr, username, password, this.httpHeaders.get()) :
new HttpProxyHandler(proxyAddr, this.httpHeaders.get());
case SOCKS4:
return Objects.nonNull(username) ? new Socks4ProxyHandler(proxyAddr, username) :
new Socks4ProxyHandler(proxyAddr);
case SOCKS5:
return Objects.nonNull(username) && Objects.nonNull(password) ?
new Socks5ProxyHandler(proxyAddr, username, password) :
new Socks5ProxyHandler(proxyAddr);
}
throw new IllegalArgumentException("Proxy type unsupported : " + this.type);
} | [
"public",
"final",
"ProxyHandler",
"newProxyHandler",
"(",
")",
"{",
"InetSocketAddress",
"proxyAddr",
"=",
"this",
".",
"address",
".",
"get",
"(",
")",
";",
"String",
"username",
"=",
"this",
".",
"username",
";",
"String",
"password",
"=",
"Objects",
".",... | Return a new eventual {@link ProxyHandler}
@return a new eventual {@link ProxyHandler} | [
"Return",
"a",
"new",
"eventual",
"{",
"@link",
"ProxyHandler",
"}"
] | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/tcp/ProxyProvider.java#L145-L165 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/LocalDirAllocator.java | LocalDirAllocator.ifExists | public boolean ifExists(String pathStr,Configuration conf) {
"""
We search through all the configured dirs for the file's existence
and return true when we find
@param pathStr the requested file (this will be searched)
@param conf the Configuration object
@return true if files exist. false otherwise
@throws IOException
"""
AllocatorPerContext context = obtainContext(contextCfgItemName);
return context.ifExists(pathStr, conf);
} | java | public boolean ifExists(String pathStr,Configuration conf) {
AllocatorPerContext context = obtainContext(contextCfgItemName);
return context.ifExists(pathStr, conf);
} | [
"public",
"boolean",
"ifExists",
"(",
"String",
"pathStr",
",",
"Configuration",
"conf",
")",
"{",
"AllocatorPerContext",
"context",
"=",
"obtainContext",
"(",
"contextCfgItemName",
")",
";",
"return",
"context",
".",
"ifExists",
"(",
"pathStr",
",",
"conf",
")"... | We search through all the configured dirs for the file's existence
and return true when we find
@param pathStr the requested file (this will be searched)
@param conf the Configuration object
@return true if files exist. false otherwise
@throws IOException | [
"We",
"search",
"through",
"all",
"the",
"configured",
"dirs",
"for",
"the",
"file",
"s",
"existence",
"and",
"return",
"true",
"when",
"we",
"find"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/LocalDirAllocator.java#L176-L179 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/executor/ControllableScheduler.java | ControllableScheduler.jumpAndExecute | public void jumpAndExecute(long duration, TimeUnit timeUnit) {
"""
Jumps to a future time by a given duration. All the commands/tasks scheduled
for execution during this period will be executed. When this function returns,
the executor will be idle.
@param duration the duration
@param timeUnit the time unit of the duration
"""
long durationInMillis = TimeUnit.MILLISECONDS.convert(duration, timeUnit);
mQueue.tick(durationInMillis);
while (!schedulerIsIdle()) {
runNextPendingCommand();
}
} | java | public void jumpAndExecute(long duration, TimeUnit timeUnit) {
long durationInMillis = TimeUnit.MILLISECONDS.convert(duration, timeUnit);
mQueue.tick(durationInMillis);
while (!schedulerIsIdle()) {
runNextPendingCommand();
}
} | [
"public",
"void",
"jumpAndExecute",
"(",
"long",
"duration",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"long",
"durationInMillis",
"=",
"TimeUnit",
".",
"MILLISECONDS",
".",
"convert",
"(",
"duration",
",",
"timeUnit",
")",
";",
"mQueue",
".",
"tick",
"(",
"dur... | Jumps to a future time by a given duration. All the commands/tasks scheduled
for execution during this period will be executed. When this function returns,
the executor will be idle.
@param duration the duration
@param timeUnit the time unit of the duration | [
"Jumps",
"to",
"a",
"future",
"time",
"by",
"a",
"given",
"duration",
".",
"All",
"the",
"commands",
"/",
"tasks",
"scheduled",
"for",
"execution",
"during",
"this",
"period",
"will",
"be",
"executed",
".",
"When",
"this",
"function",
"returns",
"the",
"ex... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/executor/ControllableScheduler.java#L41-L47 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java | TermOfUsePanel.newCopyrightPanel | protected Component newCopyrightPanel(final String id,
final IModel<HeaderContentListModelBean> model) {
"""
Factory method for creating the new {@link Component} for the copyright. This method is
invoked in the constructor from the derived classes and can be overridden so users can
provide their own version of a new {@link Component} for the copyright.
@param id
the id
@param model
the model
@return the new {@link Component} for the copyright
"""
return new CopyrightPanel(id, Model.of(model.getObject()));
} | java | protected Component newCopyrightPanel(final String id,
final IModel<HeaderContentListModelBean> model)
{
return new CopyrightPanel(id, Model.of(model.getObject()));
} | [
"protected",
"Component",
"newCopyrightPanel",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"HeaderContentListModelBean",
">",
"model",
")",
"{",
"return",
"new",
"CopyrightPanel",
"(",
"id",
",",
"Model",
".",
"of",
"(",
"model",
".",
"getObject... | Factory method for creating the new {@link Component} for the copyright. This method is
invoked in the constructor from the derived classes and can be overridden so users can
provide their own version of a new {@link Component} for the copyright.
@param id
the id
@param model
the model
@return the new {@link Component} for the copyright | [
"Factory",
"method",
"for",
"creating",
"the",
"new",
"{",
"@link",
"Component",
"}",
"for",
"the",
"copyright",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
... | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java#L208-L212 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java | PageFlowUtils.addActionError | public static void addActionError( ServletRequest request, String propertyName, String messageKey ) {
"""
Add a property-related message that will be shown with the Errors and Error tags.
@param request the current ServletRequest.
@param propertyName the name of the property with which to associate this error.
@param messageKey the message-resources key for the message.
"""
InternalUtils.addActionError( propertyName, new ActionMessage( messageKey, null ), request );
} | java | public static void addActionError( ServletRequest request, String propertyName, String messageKey )
{
InternalUtils.addActionError( propertyName, new ActionMessage( messageKey, null ), request );
} | [
"public",
"static",
"void",
"addActionError",
"(",
"ServletRequest",
"request",
",",
"String",
"propertyName",
",",
"String",
"messageKey",
")",
"{",
"InternalUtils",
".",
"addActionError",
"(",
"propertyName",
",",
"new",
"ActionMessage",
"(",
"messageKey",
",",
... | Add a property-related message that will be shown with the Errors and Error tags.
@param request the current ServletRequest.
@param propertyName the name of the property with which to associate this error.
@param messageKey the message-resources key for the message. | [
"Add",
"a",
"property",
"-",
"related",
"message",
"that",
"will",
"be",
"shown",
"with",
"the",
"Errors",
"and",
"Error",
"tags",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L1040-L1043 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/WorkbinsApi.java | WorkbinsApi.getInteractionDetailsFromWorkbin | public ApiSuccessResponse getInteractionDetailsFromWorkbin(String interactionId, GetDetailsData getDetailsData) throws ApiException {
"""
Get details of an Interaction which is in a workbin
@param interactionId Id of the interaction (required)
@param getDetailsData 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 = getInteractionDetailsFromWorkbinWithHttpInfo(interactionId, getDetailsData);
return resp.getData();
} | java | public ApiSuccessResponse getInteractionDetailsFromWorkbin(String interactionId, GetDetailsData getDetailsData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = getInteractionDetailsFromWorkbinWithHttpInfo(interactionId, getDetailsData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"getInteractionDetailsFromWorkbin",
"(",
"String",
"interactionId",
",",
"GetDetailsData",
"getDetailsData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"getInteractionDetailsFromWorkbinWithHttp... | Get details of an Interaction which is in a workbin
@param interactionId Id of the interaction (required)
@param getDetailsData Request parameters. (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"details",
"of",
"an",
"Interaction",
"which",
"is",
"in",
"a",
"workbin"
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/WorkbinsApi.java#L272-L275 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java | Uris.toDirectory | public static URI toDirectory(final URI uri, final boolean strict) throws NormalizationException {
"""
Returns a URI that has been truncated to its directory.
@param uri the URI to resolve to the directory level
@param strict whether or not to do strict escaping
@return the resolved and normalized URI
@throws NormalizationException if there was a problem normalizing the URL
"""
return resolve(uri, getRawDirectory(uri, strict), strict);
} | java | public static URI toDirectory(final URI uri, final boolean strict) throws NormalizationException {
return resolve(uri, getRawDirectory(uri, strict), strict);
} | [
"public",
"static",
"URI",
"toDirectory",
"(",
"final",
"URI",
"uri",
",",
"final",
"boolean",
"strict",
")",
"throws",
"NormalizationException",
"{",
"return",
"resolve",
"(",
"uri",
",",
"getRawDirectory",
"(",
"uri",
",",
"strict",
")",
",",
"strict",
")"... | Returns a URI that has been truncated to its directory.
@param uri the URI to resolve to the directory level
@param strict whether or not to do strict escaping
@return the resolved and normalized URI
@throws NormalizationException if there was a problem normalizing the URL | [
"Returns",
"a",
"URI",
"that",
"has",
"been",
"truncated",
"to",
"its",
"directory",
"."
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java#L430-L432 |
structurizr/java | structurizr-core/src/com/structurizr/model/ModelItem.java | ModelItem.addPerspective | public Perspective addPerspective(String name, String description) {
"""
Adds a perspective to this model item.
@param name the name of the perspective (e.g. "Security", must be unique)
@param description a description of the perspective
@return a Perspective object
@throws IllegalArgumentException if perspective details are not specified, or the named perspective exists already
"""
if (StringUtils.isNullOrEmpty(name)) {
throw new IllegalArgumentException("A name must be specified.");
}
if (StringUtils.isNullOrEmpty(description)) {
throw new IllegalArgumentException("A description must be specified.");
}
if (perspectives.stream().filter(p -> p.getName().equals(name)).count() > 0) {
throw new IllegalArgumentException("A perspective named \"" + name + "\" already exists.");
}
Perspective perspective = new Perspective(name, description);
perspectives.add(perspective);
return perspective;
} | java | public Perspective addPerspective(String name, String description) {
if (StringUtils.isNullOrEmpty(name)) {
throw new IllegalArgumentException("A name must be specified.");
}
if (StringUtils.isNullOrEmpty(description)) {
throw new IllegalArgumentException("A description must be specified.");
}
if (perspectives.stream().filter(p -> p.getName().equals(name)).count() > 0) {
throw new IllegalArgumentException("A perspective named \"" + name + "\" already exists.");
}
Perspective perspective = new Perspective(name, description);
perspectives.add(perspective);
return perspective;
} | [
"public",
"Perspective",
"addPerspective",
"(",
"String",
"name",
",",
"String",
"description",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A name must be specified.\"",
... | Adds a perspective to this model item.
@param name the name of the perspective (e.g. "Security", must be unique)
@param description a description of the perspective
@return a Perspective object
@throws IllegalArgumentException if perspective details are not specified, or the named perspective exists already | [
"Adds",
"a",
"perspective",
"to",
"this",
"model",
"item",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/ModelItem.java#L156-L173 |
steveohara/j2mod | src/main/java/com/ghgande/j2mod/modbus/net/AbstractModbusListener.java | AbstractModbusListener.handleRequest | void handleRequest(AbstractModbusTransport transport, AbstractModbusListener listener) throws ModbusIOException {
"""
Reads the request, checks it is valid and that the unit ID is ok
and sends back a response
@param transport Transport to read request from
@param listener Listener that the request was received by
@throws ModbusIOException If there is an issue with the transport or transmission
"""
// Get the request from the transport. It will be processed
// using an associated process image
if (transport == null) {
throw new ModbusIOException("No transport specified");
}
ModbusRequest request = transport.readRequest(listener);
if (request == null) {
throw new ModbusIOException("Request for transport %s is invalid (null)", transport.getClass().getSimpleName());
}
ModbusResponse response;
// Test if Process image exists for this Unit ID
ProcessImage spi = getProcessImage(request.getUnitID());
if (spi == null) {
response = request.createExceptionResponse(Modbus.ILLEGAL_ADDRESS_EXCEPTION);
response.setAuxiliaryType(ModbusResponse.AuxiliaryMessageTypes.UNIT_ID_MISSMATCH);
}
else {
response = request.createResponse(this);
}
if (logger.isDebugEnabled()) {
logger.debug("Request:{}", request.getHexMessage());
if (transport instanceof ModbusRTUTransport && response.getAuxiliaryType() == AuxiliaryMessageTypes.UNIT_ID_MISSMATCH) {
logger.debug("Not sending response because it was not meant for us.");
}
else {
logger.debug("Response:{}", response.getHexMessage());
}
}
// Write the response
transport.writeResponse(response);
} | java | void handleRequest(AbstractModbusTransport transport, AbstractModbusListener listener) throws ModbusIOException {
// Get the request from the transport. It will be processed
// using an associated process image
if (transport == null) {
throw new ModbusIOException("No transport specified");
}
ModbusRequest request = transport.readRequest(listener);
if (request == null) {
throw new ModbusIOException("Request for transport %s is invalid (null)", transport.getClass().getSimpleName());
}
ModbusResponse response;
// Test if Process image exists for this Unit ID
ProcessImage spi = getProcessImage(request.getUnitID());
if (spi == null) {
response = request.createExceptionResponse(Modbus.ILLEGAL_ADDRESS_EXCEPTION);
response.setAuxiliaryType(ModbusResponse.AuxiliaryMessageTypes.UNIT_ID_MISSMATCH);
}
else {
response = request.createResponse(this);
}
if (logger.isDebugEnabled()) {
logger.debug("Request:{}", request.getHexMessage());
if (transport instanceof ModbusRTUTransport && response.getAuxiliaryType() == AuxiliaryMessageTypes.UNIT_ID_MISSMATCH) {
logger.debug("Not sending response because it was not meant for us.");
}
else {
logger.debug("Response:{}", response.getHexMessage());
}
}
// Write the response
transport.writeResponse(response);
} | [
"void",
"handleRequest",
"(",
"AbstractModbusTransport",
"transport",
",",
"AbstractModbusListener",
"listener",
")",
"throws",
"ModbusIOException",
"{",
"// Get the request from the transport. It will be processed",
"// using an associated process image",
"if",
"(",
"transport",
"... | Reads the request, checks it is valid and that the unit ID is ok
and sends back a response
@param transport Transport to read request from
@param listener Listener that the request was received by
@throws ModbusIOException If there is an issue with the transport or transmission | [
"Reads",
"the",
"request",
"checks",
"it",
"is",
"valid",
"and",
"that",
"the",
"unit",
"ID",
"is",
"ok",
"and",
"sends",
"back",
"a",
"response"
] | train | https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/net/AbstractModbusListener.java#L153-L190 |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/js/JSEventMap.java | JSEventMap.prependHandler | public void prependHandler (@Nonnull final EJSEvent eJSEvent, @Nonnull final IHasJSCode aNewHandler) {
"""
Add an additional handler for the given JS event. If an existing handler is
present, the new handler is appended at front.
@param eJSEvent
The JS event. May not be <code>null</code>.
@param aNewHandler
The new handler to be added. May not be <code>null</code>.
"""
ValueEnforcer.notNull (eJSEvent, "JSEvent");
ValueEnforcer.notNull (aNewHandler, "NewHandler");
CollectingJSCodeProvider aCode = m_aEvents.get (eJSEvent);
if (aCode == null)
{
aCode = new CollectingJSCodeProvider ();
m_aEvents.put (eJSEvent, aCode);
}
aCode.prepend (aNewHandler);
} | java | public void prependHandler (@Nonnull final EJSEvent eJSEvent, @Nonnull final IHasJSCode aNewHandler)
{
ValueEnforcer.notNull (eJSEvent, "JSEvent");
ValueEnforcer.notNull (aNewHandler, "NewHandler");
CollectingJSCodeProvider aCode = m_aEvents.get (eJSEvent);
if (aCode == null)
{
aCode = new CollectingJSCodeProvider ();
m_aEvents.put (eJSEvent, aCode);
}
aCode.prepend (aNewHandler);
} | [
"public",
"void",
"prependHandler",
"(",
"@",
"Nonnull",
"final",
"EJSEvent",
"eJSEvent",
",",
"@",
"Nonnull",
"final",
"IHasJSCode",
"aNewHandler",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"eJSEvent",
",",
"\"JSEvent\"",
")",
";",
"ValueEnforcer",
".",
... | Add an additional handler for the given JS event. If an existing handler is
present, the new handler is appended at front.
@param eJSEvent
The JS event. May not be <code>null</code>.
@param aNewHandler
The new handler to be added. May not be <code>null</code>. | [
"Add",
"an",
"additional",
"handler",
"for",
"the",
"given",
"JS",
"event",
".",
"If",
"an",
"existing",
"handler",
"is",
"present",
"the",
"new",
"handler",
"is",
"appended",
"at",
"front",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/js/JSEventMap.java#L76-L88 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.serviceName_senders_sender_PUT | public void serviceName_senders_sender_PUT(String serviceName, String sender, OvhSender body) throws IOException {
"""
Alter this object properties
REST: PUT /sms/{serviceName}/senders/{sender}
@param body [required] New object properties
@param serviceName [required] The internal name of your SMS offer
@param sender [required] The sms sender
"""
String qPath = "/sms/{serviceName}/senders/{sender}";
StringBuilder sb = path(qPath, serviceName, sender);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_senders_sender_PUT(String serviceName, String sender, OvhSender body) throws IOException {
String qPath = "/sms/{serviceName}/senders/{sender}";
StringBuilder sb = path(qPath, serviceName, sender);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_senders_sender_PUT",
"(",
"String",
"serviceName",
",",
"String",
"sender",
",",
"OvhSender",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/sms/{serviceName}/senders/{sender}\"",
";",
"StringBuilder",
"sb",
"=",
... | Alter this object properties
REST: PUT /sms/{serviceName}/senders/{sender}
@param body [required] New object properties
@param serviceName [required] The internal name of your SMS offer
@param sender [required] The sms sender | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L197-L201 |
exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/PendingChangesLog.java | PendingChangesLog.putData | public void putData(int offset, byte[] tempData) {
"""
putData.
@param offset
offset in 'data'
@param tempData
piece of binary data
"""
for (int i = 0; i < tempData.length; i++)
data[i + offset] = tempData[i];
} | java | public void putData(int offset, byte[] tempData)
{
for (int i = 0; i < tempData.length; i++)
data[i + offset] = tempData[i];
} | [
"public",
"void",
"putData",
"(",
"int",
"offset",
",",
"byte",
"[",
"]",
"tempData",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tempData",
".",
"length",
";",
"i",
"++",
")",
"data",
"[",
"i",
"+",
"offset",
"]",
"=",
"tempDat... | putData.
@param offset
offset in 'data'
@param tempData
piece of binary data | [
"putData",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/PendingChangesLog.java#L237-L241 |
jtrfp/javamod | src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java | MP3FileID3Controller.setComment | public void setComment(String comment, int type) {
"""
Add a comment to this mp3.
@param comment a comment to add to the mp3
"""
if (allow(type&ID3V1))
{
id3v1.setComment(comment);
}
if (allow(type&ID3V2))
{
id3v2.setCommentFrame("", comment);
}
} | java | public void setComment(String comment, int type)
{
if (allow(type&ID3V1))
{
id3v1.setComment(comment);
}
if (allow(type&ID3V2))
{
id3v2.setCommentFrame("", comment);
}
} | [
"public",
"void",
"setComment",
"(",
"String",
"comment",
",",
"int",
"type",
")",
"{",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V1",
")",
")",
"{",
"id3v1",
".",
"setComment",
"(",
"comment",
")",
";",
"}",
"if",
"(",
"allow",
"(",
"type",
"&",
... | Add a comment to this mp3.
@param comment a comment to add to the mp3 | [
"Add",
"a",
"comment",
"to",
"this",
"mp3",
"."
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L210-L220 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.changeLock | public void changeLock(CmsRequestContext context, CmsResource resource) throws CmsException {
"""
Changes the lock of a resource to the current user, that is "steals" the lock from another user.<p>
@param context the current request context
@param resource the resource to change the lock for
@throws CmsException if something goes wrong
@see org.opencms.file.types.I_CmsResourceType#changeLock(CmsObject, CmsSecurityManager, CmsResource)
"""
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
checkOfflineProject(dbc);
try {
m_driverManager.changeLock(dbc, resource, CmsLockType.EXCLUSIVE);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(
Messages.ERR_CHANGE_LOCK_OF_RESOURCE_2,
context.getSitePath(resource),
" - " + e.getMessage()),
e);
} finally {
dbc.clear();
}
} | java | public void changeLock(CmsRequestContext context, CmsResource resource) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
checkOfflineProject(dbc);
try {
m_driverManager.changeLock(dbc, resource, CmsLockType.EXCLUSIVE);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(
Messages.ERR_CHANGE_LOCK_OF_RESOURCE_2,
context.getSitePath(resource),
" - " + e.getMessage()),
e);
} finally {
dbc.clear();
}
} | [
"public",
"void",
"changeLock",
"(",
"CmsRequestContext",
"context",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")",
";",
"checkOfflineProject",
"(",
"dbc... | Changes the lock of a resource to the current user, that is "steals" the lock from another user.<p>
@param context the current request context
@param resource the resource to change the lock for
@throws CmsException if something goes wrong
@see org.opencms.file.types.I_CmsResourceType#changeLock(CmsObject, CmsSecurityManager, CmsResource) | [
"Changes",
"the",
"lock",
"of",
"a",
"resource",
"to",
"the",
"current",
"user",
"that",
"is",
"steals",
"the",
"lock",
"from",
"another",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L307-L324 |
apereo/cas | support/cas-server-support-shiro-authentication/src/main/java/org/apereo/cas/adaptors/generic/ShiroAuthenticationHandler.java | ShiroAuthenticationHandler.createAuthenticatedSubjectResult | protected AuthenticationHandlerExecutionResult createAuthenticatedSubjectResult(final Credential credential, final Subject currentUser) {
"""
Create authenticated subject result.
@param credential the credential
@param currentUser the current user
@return the handler result
"""
val username = currentUser.getPrincipal().toString();
return createHandlerResult(credential, this.principalFactory.createPrincipal(username));
} | java | protected AuthenticationHandlerExecutionResult createAuthenticatedSubjectResult(final Credential credential, final Subject currentUser) {
val username = currentUser.getPrincipal().toString();
return createHandlerResult(credential, this.principalFactory.createPrincipal(username));
} | [
"protected",
"AuthenticationHandlerExecutionResult",
"createAuthenticatedSubjectResult",
"(",
"final",
"Credential",
"credential",
",",
"final",
"Subject",
"currentUser",
")",
"{",
"val",
"username",
"=",
"currentUser",
".",
"getPrincipal",
"(",
")",
".",
"toString",
"(... | Create authenticated subject result.
@param credential the credential
@param currentUser the current user
@return the handler result | [
"Create",
"authenticated",
"subject",
"result",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-shiro-authentication/src/main/java/org/apereo/cas/adaptors/generic/ShiroAuthenticationHandler.java#L117-L120 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/BloomFilter.java | BloomFilter.optimalNumOfBits | public static int optimalNumOfBits(long inputEntries, double fpp) {
"""
Compute optimal bits number with given input entries and expected false positive probability.
@param inputEntries
@param fpp
@return optimal bits number
"""
int numBits = (int) (-inputEntries * Math.log(fpp) / (Math.log(2) * Math.log(2)));
return numBits;
} | java | public static int optimalNumOfBits(long inputEntries, double fpp) {
int numBits = (int) (-inputEntries * Math.log(fpp) / (Math.log(2) * Math.log(2)));
return numBits;
} | [
"public",
"static",
"int",
"optimalNumOfBits",
"(",
"long",
"inputEntries",
",",
"double",
"fpp",
")",
"{",
"int",
"numBits",
"=",
"(",
"int",
")",
"(",
"-",
"inputEntries",
"*",
"Math",
".",
"log",
"(",
"fpp",
")",
"/",
"(",
"Math",
".",
"log",
"(",... | Compute optimal bits number with given input entries and expected false positive probability.
@param inputEntries
@param fpp
@return optimal bits number | [
"Compute",
"optimal",
"bits",
"number",
"with",
"given",
"input",
"entries",
"and",
"expected",
"false",
"positive",
"probability",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/BloomFilter.java#L69-L72 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableModel.java | PathfindableModel.prepareDestination | private void prepareDestination(int dtx, int dty) {
"""
Prepare the destination, store its location, and reset states.
@param dtx The destination horizontal tile.
@param dty The destination vertical tile.
"""
pathStopped = false;
pathStoppedRequested = false;
destX = dtx;
destY = dty;
destinationReached = false;
} | java | private void prepareDestination(int dtx, int dty)
{
pathStopped = false;
pathStoppedRequested = false;
destX = dtx;
destY = dty;
destinationReached = false;
} | [
"private",
"void",
"prepareDestination",
"(",
"int",
"dtx",
",",
"int",
"dty",
")",
"{",
"pathStopped",
"=",
"false",
";",
"pathStoppedRequested",
"=",
"false",
";",
"destX",
"=",
"dtx",
";",
"destY",
"=",
"dty",
";",
"destinationReached",
"=",
"false",
";... | Prepare the destination, store its location, and reset states.
@param dtx The destination horizontal tile.
@param dty The destination vertical tile. | [
"Prepare",
"the",
"destination",
"store",
"its",
"location",
"and",
"reset",
"states",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableModel.java#L299-L306 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/zone/ZoneRulesBuilder.java | ZoneRulesBuilder.addWindowForever | public ZoneRulesBuilder addWindowForever(ZoneOffset standardOffset) {
"""
Adds a window that applies until the end of time to the builder that can be
used to filter a set of rules.
<p>
This method defines and adds a window to the zone where the standard offset is specified.
The window limits the effect of subsequent additions of transition rules
or fixed savings. If neither rules or fixed savings are added to the window
then the window will default to no savings.
<p>
This must be added after all other windows.
No more windows can be added after this one.
@param standardOffset the standard offset, not null
@return this, for chaining
@throws IllegalStateException if a forever window has already been added
"""
return addWindow(standardOffset, LocalDateTime.MAX, TimeDefinition.WALL);
} | java | public ZoneRulesBuilder addWindowForever(ZoneOffset standardOffset) {
return addWindow(standardOffset, LocalDateTime.MAX, TimeDefinition.WALL);
} | [
"public",
"ZoneRulesBuilder",
"addWindowForever",
"(",
"ZoneOffset",
"standardOffset",
")",
"{",
"return",
"addWindow",
"(",
"standardOffset",
",",
"LocalDateTime",
".",
"MAX",
",",
"TimeDefinition",
".",
"WALL",
")",
";",
"}"
] | Adds a window that applies until the end of time to the builder that can be
used to filter a set of rules.
<p>
This method defines and adds a window to the zone where the standard offset is specified.
The window limits the effect of subsequent additions of transition rules
or fixed savings. If neither rules or fixed savings are added to the window
then the window will default to no savings.
<p>
This must be added after all other windows.
No more windows can be added after this one.
@param standardOffset the standard offset, not null
@return this, for chaining
@throws IllegalStateException if a forever window has already been added | [
"Adds",
"a",
"window",
"that",
"applies",
"until",
"the",
"end",
"of",
"time",
"to",
"the",
"builder",
"that",
"can",
"be",
"used",
"to",
"filter",
"a",
"set",
"of",
"rules",
".",
"<p",
">",
"This",
"method",
"defines",
"and",
"adds",
"a",
"window",
... | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/zone/ZoneRulesBuilder.java#L148-L150 |
datasift/datasift-java | src/main/java/com/datasift/client/push/DataSiftPush.java | DataSiftPush.validate | public <T extends PushConnector> FutureData<PushValidation> validate(T connector) {
"""
/*
Check that the subscription details are correct
@return the results of the validation
"""
FutureData<PushValidation> future = new FutureData<>();
URI uri = newParams().forURL(config.newAPIEndpointURI(VALIDATE));
POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new PushValidation(), config)))
.form("output_type", connector.type().value());
for (Map.Entry<String, String> e : connector.parameters().verifyAndGet().entrySet()) {
request.form(e.getKey(), e.getValue());
}
performRequest(future, request);
return future;
} | java | public <T extends PushConnector> FutureData<PushValidation> validate(T connector) {
FutureData<PushValidation> future = new FutureData<>();
URI uri = newParams().forURL(config.newAPIEndpointURI(VALIDATE));
POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new PushValidation(), config)))
.form("output_type", connector.type().value());
for (Map.Entry<String, String> e : connector.parameters().verifyAndGet().entrySet()) {
request.form(e.getKey(), e.getValue());
}
performRequest(future, request);
return future;
} | [
"public",
"<",
"T",
"extends",
"PushConnector",
">",
"FutureData",
"<",
"PushValidation",
">",
"validate",
"(",
"T",
"connector",
")",
"{",
"FutureData",
"<",
"PushValidation",
">",
"future",
"=",
"new",
"FutureData",
"<>",
"(",
")",
";",
"URI",
"uri",
"="... | /*
Check that the subscription details are correct
@return the results of the validation | [
"/",
"*",
"Check",
"that",
"the",
"subscription",
"details",
"are",
"correct"
] | train | https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/push/DataSiftPush.java#L423-L433 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java | PredictionsImpl.predictImageAsync | public Observable<ImagePrediction> predictImageAsync(UUID projectId, byte[] imageData, PredictImageOptionalParameter predictImageOptionalParameter) {
"""
Predict an image and saves the result.
@param projectId The project id
@param imageData the InputStream value
@param predictImageOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImagePrediction object
"""
return predictImageWithServiceResponseAsync(projectId, imageData, predictImageOptionalParameter).map(new Func1<ServiceResponse<ImagePrediction>, ImagePrediction>() {
@Override
public ImagePrediction call(ServiceResponse<ImagePrediction> response) {
return response.body();
}
});
} | java | public Observable<ImagePrediction> predictImageAsync(UUID projectId, byte[] imageData, PredictImageOptionalParameter predictImageOptionalParameter) {
return predictImageWithServiceResponseAsync(projectId, imageData, predictImageOptionalParameter).map(new Func1<ServiceResponse<ImagePrediction>, ImagePrediction>() {
@Override
public ImagePrediction call(ServiceResponse<ImagePrediction> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImagePrediction",
">",
"predictImageAsync",
"(",
"UUID",
"projectId",
",",
"byte",
"[",
"]",
"imageData",
",",
"PredictImageOptionalParameter",
"predictImageOptionalParameter",
")",
"{",
"return",
"predictImageWithServiceResponseAsync",
"(",
... | Predict an image and saves the result.
@param projectId The project id
@param imageData the InputStream value
@param predictImageOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImagePrediction object | [
"Predict",
"an",
"image",
"and",
"saves",
"the",
"result",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java#L474-L481 |
GerdHolz/TOVAL | src/de/invation/code/toval/misc/FormatUtils.java | FormatUtils.getIndexedFormat | public static String getIndexedFormat(int index, String format) {
"""
Returns an indexed format by placing the specified index before the given
format.
@param index
Desired index for the given format
@param format
Format to be indexed
@return The format <code>format</code> indexed with <code>index</code>
"""
if (index < 1)
throw new IllegalArgumentException();
if (format == null)
throw new NullPointerException();
if (format.length() == 0)
throw new IllegalArgumentException();
return String.format(INDEXED_FORMAT, index, format);
} | java | public static String getIndexedFormat(int index, String format) {
if (index < 1)
throw new IllegalArgumentException();
if (format == null)
throw new NullPointerException();
if (format.length() == 0)
throw new IllegalArgumentException();
return String.format(INDEXED_FORMAT, index, format);
} | [
"public",
"static",
"String",
"getIndexedFormat",
"(",
"int",
"index",
",",
"String",
"format",
")",
"{",
"if",
"(",
"index",
"<",
"1",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"if",
"(",
"format",
"==",
"null",
")",
"throw",
"new"... | Returns an indexed format by placing the specified index before the given
format.
@param index
Desired index for the given format
@param format
Format to be indexed
@return The format <code>format</code> indexed with <code>index</code> | [
"Returns",
"an",
"indexed",
"format",
"by",
"placing",
"the",
"specified",
"index",
"before",
"the",
"given",
"format",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/FormatUtils.java#L184-L192 |
joniles/mpxj | src/main/java/net/sf/mpxj/RecurringData.java | RecurringData.getMonthlyDates | private void getMonthlyDates(Calendar calendar, int frequency, List<Date> dates) {
"""
Calculate start dates for a monthly recurrence.
@param calendar current date
@param frequency frequency
@param dates array of start dates
"""
if (m_relative)
{
getMonthlyRelativeDates(calendar, frequency, dates);
}
else
{
getMonthlyAbsoluteDates(calendar, frequency, dates);
}
} | java | private void getMonthlyDates(Calendar calendar, int frequency, List<Date> dates)
{
if (m_relative)
{
getMonthlyRelativeDates(calendar, frequency, dates);
}
else
{
getMonthlyAbsoluteDates(calendar, frequency, dates);
}
} | [
"private",
"void",
"getMonthlyDates",
"(",
"Calendar",
"calendar",
",",
"int",
"frequency",
",",
"List",
"<",
"Date",
">",
"dates",
")",
"{",
"if",
"(",
"m_relative",
")",
"{",
"getMonthlyRelativeDates",
"(",
"calendar",
",",
"frequency",
",",
"dates",
")",
... | Calculate start dates for a monthly recurrence.
@param calendar current date
@param frequency frequency
@param dates array of start dates | [
"Calculate",
"start",
"dates",
"for",
"a",
"monthly",
"recurrence",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L464-L474 |
ironjacamar/ironjacamar | common/src/main/java/org/ironjacamar/common/annotations/Annotations.java | Annotations.merge | public Connector merge(Connector connector, AnnotationRepository annotationRepository, ClassLoader classLoader)
throws Exception {
"""
Scan for annotations in the URLs specified
@param connector The connector adapter metadata
@param annotationRepository annotationRepository to use
@param classLoader The class loader used to generate the repository
@return The updated metadata
@exception Exception Thrown if an error occurs
"""
// Process annotations
if (connector == null || (connector.getVersion() == Version.V_16 || connector.getVersion() == Version.V_17))
{
boolean isMetadataComplete = false;
if (connector != null)
{
isMetadataComplete = connector.isMetadataComplete();
}
if (connector == null || !isMetadataComplete)
{
if (connector == null)
{
Connector annotationsConnector = process(annotationRepository, null, classLoader);
connector = annotationsConnector;
}
else
{
Connector annotationsConnector = process(annotationRepository,
((ResourceAdapter) connector.getResourceadapter()).getResourceadapterClass(),
classLoader);
connector = connector.merge(annotationsConnector);
}
}
}
return connector;
} | java | public Connector merge(Connector connector, AnnotationRepository annotationRepository, ClassLoader classLoader)
throws Exception
{
// Process annotations
if (connector == null || (connector.getVersion() == Version.V_16 || connector.getVersion() == Version.V_17))
{
boolean isMetadataComplete = false;
if (connector != null)
{
isMetadataComplete = connector.isMetadataComplete();
}
if (connector == null || !isMetadataComplete)
{
if (connector == null)
{
Connector annotationsConnector = process(annotationRepository, null, classLoader);
connector = annotationsConnector;
}
else
{
Connector annotationsConnector = process(annotationRepository,
((ResourceAdapter) connector.getResourceadapter()).getResourceadapterClass(),
classLoader);
connector = connector.merge(annotationsConnector);
}
}
}
return connector;
} | [
"public",
"Connector",
"merge",
"(",
"Connector",
"connector",
",",
"AnnotationRepository",
"annotationRepository",
",",
"ClassLoader",
"classLoader",
")",
"throws",
"Exception",
"{",
"// Process annotations",
"if",
"(",
"connector",
"==",
"null",
"||",
"(",
"connecto... | Scan for annotations in the URLs specified
@param connector The connector adapter metadata
@param annotationRepository annotationRepository to use
@param classLoader The class loader used to generate the repository
@return The updated metadata
@exception Exception Thrown if an error occurs | [
"Scan",
"for",
"annotations",
"in",
"the",
"URLs",
"specified"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/annotations/Annotations.java#L119-L149 |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/extensions/TaskMonitor.java | TaskMonitor.build | public static TaskMonitor build(IntVar start, IntVar duration, IntVar end) {
"""
Make a new Monitor
@param start the task start moment
@param duration the task duration
@param end the task end
@return the resulting task.
"""
return new TaskMonitor(start, duration, end);
} | java | public static TaskMonitor build(IntVar start, IntVar duration, IntVar end) {
return new TaskMonitor(start, duration, end);
} | [
"public",
"static",
"TaskMonitor",
"build",
"(",
"IntVar",
"start",
",",
"IntVar",
"duration",
",",
"IntVar",
"end",
")",
"{",
"return",
"new",
"TaskMonitor",
"(",
"start",
",",
"duration",
",",
"end",
")",
";",
"}"
] | Make a new Monitor
@param start the task start moment
@param duration the task duration
@param end the task end
@return the resulting task. | [
"Make",
"a",
"new",
"Monitor"
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/extensions/TaskMonitor.java#L65-L67 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuModuleGetSurfRef | public static int cuModuleGetSurfRef(CUsurfref pSurfRef, CUmodule hmod, String name) {
"""
Returns a handle to a surface reference.
<pre>
CUresult cuModuleGetSurfRef (
CUsurfref* pSurfRef,
CUmodule hmod,
const char* name )
</pre>
<div>
<p>Returns a handle to a surface reference.
Returns in <tt>*pSurfRef</tt> the handle of the surface reference of
name <tt>name</tt> in the module <tt>hmod</tt>. If no surface
reference of that name exists, cuModuleGetSurfRef() returns
CUDA_ERROR_NOT_FOUND.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param pSurfRef Returned surface reference
@param hmod Module to retrieve surface reference from
@param name Name of surface reference to retrieve
@return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE,
CUDA_ERROR_NOT_FOUND
@see JCudaDriver#cuModuleGetFunction
@see JCudaDriver#cuModuleGetGlobal
@see JCudaDriver#cuModuleGetTexRef
@see JCudaDriver#cuModuleLoad
@see JCudaDriver#cuModuleLoadData
@see JCudaDriver#cuModuleLoadDataEx
@see JCudaDriver#cuModuleLoadFatBinary
@see JCudaDriver#cuModuleUnload
"""
return checkResult(cuModuleGetSurfRefNative(pSurfRef, hmod, name));
} | java | public static int cuModuleGetSurfRef(CUsurfref pSurfRef, CUmodule hmod, String name)
{
return checkResult(cuModuleGetSurfRefNative(pSurfRef, hmod, name));
} | [
"public",
"static",
"int",
"cuModuleGetSurfRef",
"(",
"CUsurfref",
"pSurfRef",
",",
"CUmodule",
"hmod",
",",
"String",
"name",
")",
"{",
"return",
"checkResult",
"(",
"cuModuleGetSurfRefNative",
"(",
"pSurfRef",
",",
"hmod",
",",
"name",
")",
")",
";",
"}"
] | Returns a handle to a surface reference.
<pre>
CUresult cuModuleGetSurfRef (
CUsurfref* pSurfRef,
CUmodule hmod,
const char* name )
</pre>
<div>
<p>Returns a handle to a surface reference.
Returns in <tt>*pSurfRef</tt> the handle of the surface reference of
name <tt>name</tt> in the module <tt>hmod</tt>. If no surface
reference of that name exists, cuModuleGetSurfRef() returns
CUDA_ERROR_NOT_FOUND.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param pSurfRef Returned surface reference
@param hmod Module to retrieve surface reference from
@param name Name of surface reference to retrieve
@return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE,
CUDA_ERROR_NOT_FOUND
@see JCudaDriver#cuModuleGetFunction
@see JCudaDriver#cuModuleGetGlobal
@see JCudaDriver#cuModuleGetTexRef
@see JCudaDriver#cuModuleLoad
@see JCudaDriver#cuModuleLoadData
@see JCudaDriver#cuModuleLoadDataEx
@see JCudaDriver#cuModuleLoadFatBinary
@see JCudaDriver#cuModuleUnload | [
"Returns",
"a",
"handle",
"to",
"a",
"surface",
"reference",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L2739-L2742 |
lastaflute/lastaflute | src/main/java/org/lastaflute/web/LastaAction.java | LastaAction.doRedirect | protected HtmlResponse doRedirect(Class<?> actionType, UrlChain chain) {
"""
Do redirect the action with the more URL parts and the the parameters on GET. <br>
This method is to other redirect methods so normally you don't use directly from your action.
@param actionType The class type of action that it redirects to. (NotNull)
@param chain The chain of URL to build additional info on URL. (NotNull)
@return The HTML response for redirect containing GET parameters. (NotNull)
"""
assertArgumentNotNull("actionType", actionType);
assertArgumentNotNull("chain", chain);
return newHtmlResponseAsRedirect(toActionUrl(actionType, chain));
} | java | protected HtmlResponse doRedirect(Class<?> actionType, UrlChain chain) {
assertArgumentNotNull("actionType", actionType);
assertArgumentNotNull("chain", chain);
return newHtmlResponseAsRedirect(toActionUrl(actionType, chain));
} | [
"protected",
"HtmlResponse",
"doRedirect",
"(",
"Class",
"<",
"?",
">",
"actionType",
",",
"UrlChain",
"chain",
")",
"{",
"assertArgumentNotNull",
"(",
"\"actionType\"",
",",
"actionType",
")",
";",
"assertArgumentNotNull",
"(",
"\"chain\"",
",",
"chain",
")",
"... | Do redirect the action with the more URL parts and the the parameters on GET. <br>
This method is to other redirect methods so normally you don't use directly from your action.
@param actionType The class type of action that it redirects to. (NotNull)
@param chain The chain of URL to build additional info on URL. (NotNull)
@return The HTML response for redirect containing GET parameters. (NotNull) | [
"Do",
"redirect",
"the",
"action",
"with",
"the",
"more",
"URL",
"parts",
"and",
"the",
"the",
"parameters",
"on",
"GET",
".",
"<br",
">",
"This",
"method",
"is",
"to",
"other",
"redirect",
"methods",
"so",
"normally",
"you",
"don",
"t",
"use",
"directly... | train | https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/LastaAction.java#L347-L351 |
AltBeacon/android-beacon-library | lib/src/main/java/org/altbeacon/beacon/service/ScanJob.java | ScanJob.getPeriodicScanJobId | public static int getPeriodicScanJobId(Context context) {
"""
Returns the job id to be used to schedule this job. This may be set in the
AndroidManifest.xml or in single process applications by using #setOverrideJobId
@param context the application context
@return the job id
"""
if (sOverrideImmediateScanJobId >= 0) {
LogManager.i(TAG, "Using PeriodicScanJobId from static override: "+
sOverridePeriodicScanJobId);
return sOverridePeriodicScanJobId;
}
return getJobIdFromManifest(context, "periodicScanJobId");
} | java | public static int getPeriodicScanJobId(Context context) {
if (sOverrideImmediateScanJobId >= 0) {
LogManager.i(TAG, "Using PeriodicScanJobId from static override: "+
sOverridePeriodicScanJobId);
return sOverridePeriodicScanJobId;
}
return getJobIdFromManifest(context, "periodicScanJobId");
} | [
"public",
"static",
"int",
"getPeriodicScanJobId",
"(",
"Context",
"context",
")",
"{",
"if",
"(",
"sOverrideImmediateScanJobId",
">=",
"0",
")",
"{",
"LogManager",
".",
"i",
"(",
"TAG",
",",
"\"Using PeriodicScanJobId from static override: \"",
"+",
"sOverridePeriodi... | Returns the job id to be used to schedule this job. This may be set in the
AndroidManifest.xml or in single process applications by using #setOverrideJobId
@param context the application context
@return the job id | [
"Returns",
"the",
"job",
"id",
"to",
"be",
"used",
"to",
"schedule",
"this",
"job",
".",
"This",
"may",
"be",
"set",
"in",
"the",
"AndroidManifest",
".",
"xml",
"or",
"in",
"single",
"process",
"applications",
"by",
"using",
"#setOverrideJobId"
] | train | https://github.com/AltBeacon/android-beacon-library/blob/f7f3a323ea7415d53e7bd695ff6a01f1501d5dc3/lib/src/main/java/org/altbeacon/beacon/service/ScanJob.java#L317-L324 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java | CommonOps_ZDRM.multTransB | public static void multTransB(ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c ) {
"""
<p>
Performs the following operation:<br>
<br>
c = a * b<sup>H</sup> <br>
c<sub>ij</sub> = ∑<sub>k=1:n</sub> { a<sub>ik</sub> * b<sub>jk</sub>}
</p>
@param a The left matrix in the multiplication operation. Not modified.
@param b The right matrix in the multiplication operation. Not modified.
@param c Where the results of the operation are stored. Modified.
"""
MatrixMatrixMult_ZDRM.multTransB(a, b, c);
} | java | public static void multTransB(ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c )
{
MatrixMatrixMult_ZDRM.multTransB(a, b, c);
} | [
"public",
"static",
"void",
"multTransB",
"(",
"ZMatrixRMaj",
"a",
",",
"ZMatrixRMaj",
"b",
",",
"ZMatrixRMaj",
"c",
")",
"{",
"MatrixMatrixMult_ZDRM",
".",
"multTransB",
"(",
"a",
",",
"b",
",",
"c",
")",
";",
"}"
] | <p>
Performs the following operation:<br>
<br>
c = a * b<sup>H</sup> <br>
c<sub>ij</sub> = ∑<sub>k=1:n</sub> { a<sub>ik</sub> * b<sub>jk</sub>}
</p>
@param a The left matrix in the multiplication operation. Not modified.
@param b The right matrix in the multiplication operation. Not modified.
@param c Where the results of the operation are stored. Modified. | [
"<p",
">",
"Performs",
"the",
"following",
"operation",
":",
"<br",
">",
"<br",
">",
"c",
"=",
"a",
"*",
"b<sup",
">",
"H<",
"/",
"sup",
">",
"<br",
">",
"c<sub",
">",
"ij<",
"/",
"sub",
">",
"=",
"&sum",
";",
"<sub",
">",
"k",
"=",
"1",
":",... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java#L501-L504 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.readFile | public CmsFile readFile(String resourcename, CmsResourceFilter filter) throws CmsException {
"""
Reads a file resource (including it's binary content) from the VFS,
using the specified resource filter.<p>
In case you do not need the file content,
use <code>{@link #readResource(String, CmsResourceFilter)}</code> instead.<p>
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
"valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
will ignore the date release / date expired information of the resource.<p>
@param resourcename the name of the resource to read (full current site relative path)
@param filter the resource filter to use while reading
@return the file resource that was read
@throws CmsException if the file resource could not be read for any reason
@see #readFile(String)
@see #readFile(CmsResource)
@see #readResource(String, CmsResourceFilter)
"""
CmsResource resource = readResource(resourcename, filter);
return readFile(resource);
} | java | public CmsFile readFile(String resourcename, CmsResourceFilter filter) throws CmsException {
CmsResource resource = readResource(resourcename, filter);
return readFile(resource);
} | [
"public",
"CmsFile",
"readFile",
"(",
"String",
"resourcename",
",",
"CmsResourceFilter",
"filter",
")",
"throws",
"CmsException",
"{",
"CmsResource",
"resource",
"=",
"readResource",
"(",
"resourcename",
",",
"filter",
")",
";",
"return",
"readFile",
"(",
"resour... | Reads a file resource (including it's binary content) from the VFS,
using the specified resource filter.<p>
In case you do not need the file content,
use <code>{@link #readResource(String, CmsResourceFilter)}</code> instead.<p>
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
"valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
will ignore the date release / date expired information of the resource.<p>
@param resourcename the name of the resource to read (full current site relative path)
@param filter the resource filter to use while reading
@return the file resource that was read
@throws CmsException if the file resource could not be read for any reason
@see #readFile(String)
@see #readFile(CmsResource)
@see #readResource(String, CmsResourceFilter) | [
"Reads",
"a",
"file",
"resource",
"(",
"including",
"it",
"s",
"binary",
"content",
")",
"from",
"the",
"VFS",
"using",
"the",
"specified",
"resource",
"filter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L2560-L2564 |
CloudSlang/cs-actions | cs-rft/src/main/java/io/cloudslang/content/rft/actions/RemoteSecureCopyAction.java | RemoteSecureCopyAction.copyTo | @Action(name = "Remote Secure Copy",
outputs = {
"""
Executes a Shell command(s) on the remote machine using the SSH protocol.
@param sourceHost The hostname or ip address of the source remote machine.
@param sourcePath The path to the file that needs to be copied from the source remote machine.
@param sourcePort The port number for running the command on the source remote machine.
@param sourceUsername The username of the account on the source remote machine.
@param sourcePassword The password of the user for the source remote machine.
@param sourcePrivateKeyFile The path to the private key file (OpenSSH type) on the source machine.
@param destinationHost The hostname or ip address of the destination remote machine.
@param destinationPath The path to the location where the file will be copied on the destination remote machine.
@param destinationPort The port number for running the command on the destination remote machine.
@param destinationUsername The username of the account on the destination remote machine.
@param destinationPassword The password of the user for the destination remote machine.
@param destinationPrivateKeyFile The path to the private key file (OpenSSH type) on the destination machine.
@param knownHostsPolicy The policy used for managing known_hosts file. Valid values: allow, strict, add. Default value: strict
@param knownHostsPath The path to the known hosts file.
@param timeout Time in milliseconds to wait for the command to complete. Default value is 90000 (90 seconds)
@param proxyHost The HTTP proxy host
@param proxyPort The HTTP proxy port
@return - a map containing the output of the operation. Keys present in the map are:
<br><b>returnResult</b> - The primary output.
<br><b>returnCode</b> - the return code of the operation. 0 if the operation goes to success, -1 if the operation goes to failure.
<br><b>exception</b> - the exception message if the operation goes to failure.
"""
@Output(Constants.OutputNames.RETURN_CODE),
@Output(Constants.OutputNames.RETURN_RESULT),
@Output(Constants.OutputNames.EXCEPTION)
},
responses = {
@Response(text = Constants.ResponseNames.SUCCESS, field = Constants.OutputNames.RETURN_CODE, value = Constants.ReturnCodes.RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
@Response(text = Constants.ResponseNames.FAILURE, field = Constants.OutputNames.RETURN_CODE, value = Constants.ReturnCodes.RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
}
)
public Map<String, String> copyTo(
@Param(value = Constants.InputNames.SOURCE_HOST) String sourceHost,
@Param(value = Constants.InputNames.SOURCE_PATH, required = true) String sourcePath,
@Param(Constants.InputNames.SOURCE_PORT) String sourcePort,
@Param(Constants.InputNames.SOURCE_USERNAME) String sourceUsername,
@Param(value = Constants.InputNames.SOURCE_PASSWORD, encrypted = true) String sourcePassword,
@Param(Constants.InputNames.SOURCE_PRIVATE_KEY_FILE) String sourcePrivateKeyFile,
@Param(value = Constants.InputNames.DESTINATION_HOST) String destinationHost,
@Param(value = Constants.InputNames.DESTINATION_PATH, required = true) String destinationPath,
@Param(Constants.InputNames.DESTINATION_PORT) String destinationPort,
@Param(value = Constants.InputNames.DESTINATION_USERNAME) String destinationUsername,
@Param(value = Constants.InputNames.DESTINATION_PASSWORD, encrypted = true) String destinationPassword,
@Param(Constants.InputNames.DESTINATION_PRIVATE_KEY_FILE) String destinationPrivateKeyFile,
@Param(Constants.InputNames.KNOWN_HOSTS_POLICY) String knownHostsPolicy,
@Param(Constants.InputNames.KNOWN_HOSTS_PATH) String knownHostsPath,
@Param(Constants.InputNames.TIMEOUT) String timeout,
@Param(Constants.InputNames.PROXY_HOST) String proxyHost,
@Param(Constants.InputNames.PROXY_PORT) String proxyPort) {
RemoteSecureCopyInputs remoteSecureCopyInputs = new RemoteSecureCopyInputs(sourcePath, destinationHost, destinationPath, destinationUsername);
remoteSecureCopyInputs.setSrcHost(sourceHost);
remoteSecureCopyInputs.setSrcPort(sourcePort);
remoteSecureCopyInputs.setSrcPrivateKeyFile(sourcePrivateKeyFile);
remoteSecureCopyInputs.setSrcUsername(sourceUsername);
remoteSecureCopyInputs.setSrcPassword(sourcePassword);
remoteSecureCopyInputs.setDestPort(destinationPort);
remoteSecureCopyInputs.setDestPrivateKeyFile(destinationPrivateKeyFile);
remoteSecureCopyInputs.setDestPassword(destinationPassword);
remoteSecureCopyInputs.setKnownHostsPolicy(knownHostsPolicy);
remoteSecureCopyInputs.setKnownHostsPath(knownHostsPath);
remoteSecureCopyInputs.setTimeout(timeout);
remoteSecureCopyInputs.setProxyHost(proxyHost);
remoteSecureCopyInputs.setProxyPort(proxyPort);
return new RemoteSecureCopyService().execute(remoteSecureCopyInputs);
} | java | @Action(name = "Remote Secure Copy",
outputs = {
@Output(Constants.OutputNames.RETURN_CODE),
@Output(Constants.OutputNames.RETURN_RESULT),
@Output(Constants.OutputNames.EXCEPTION)
},
responses = {
@Response(text = Constants.ResponseNames.SUCCESS, field = Constants.OutputNames.RETURN_CODE, value = Constants.ReturnCodes.RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
@Response(text = Constants.ResponseNames.FAILURE, field = Constants.OutputNames.RETURN_CODE, value = Constants.ReturnCodes.RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
}
)
public Map<String, String> copyTo(
@Param(value = Constants.InputNames.SOURCE_HOST) String sourceHost,
@Param(value = Constants.InputNames.SOURCE_PATH, required = true) String sourcePath,
@Param(Constants.InputNames.SOURCE_PORT) String sourcePort,
@Param(Constants.InputNames.SOURCE_USERNAME) String sourceUsername,
@Param(value = Constants.InputNames.SOURCE_PASSWORD, encrypted = true) String sourcePassword,
@Param(Constants.InputNames.SOURCE_PRIVATE_KEY_FILE) String sourcePrivateKeyFile,
@Param(value = Constants.InputNames.DESTINATION_HOST) String destinationHost,
@Param(value = Constants.InputNames.DESTINATION_PATH, required = true) String destinationPath,
@Param(Constants.InputNames.DESTINATION_PORT) String destinationPort,
@Param(value = Constants.InputNames.DESTINATION_USERNAME) String destinationUsername,
@Param(value = Constants.InputNames.DESTINATION_PASSWORD, encrypted = true) String destinationPassword,
@Param(Constants.InputNames.DESTINATION_PRIVATE_KEY_FILE) String destinationPrivateKeyFile,
@Param(Constants.InputNames.KNOWN_HOSTS_POLICY) String knownHostsPolicy,
@Param(Constants.InputNames.KNOWN_HOSTS_PATH) String knownHostsPath,
@Param(Constants.InputNames.TIMEOUT) String timeout,
@Param(Constants.InputNames.PROXY_HOST) String proxyHost,
@Param(Constants.InputNames.PROXY_PORT) String proxyPort) {
RemoteSecureCopyInputs remoteSecureCopyInputs = new RemoteSecureCopyInputs(sourcePath, destinationHost, destinationPath, destinationUsername);
remoteSecureCopyInputs.setSrcHost(sourceHost);
remoteSecureCopyInputs.setSrcPort(sourcePort);
remoteSecureCopyInputs.setSrcPrivateKeyFile(sourcePrivateKeyFile);
remoteSecureCopyInputs.setSrcUsername(sourceUsername);
remoteSecureCopyInputs.setSrcPassword(sourcePassword);
remoteSecureCopyInputs.setDestPort(destinationPort);
remoteSecureCopyInputs.setDestPrivateKeyFile(destinationPrivateKeyFile);
remoteSecureCopyInputs.setDestPassword(destinationPassword);
remoteSecureCopyInputs.setKnownHostsPolicy(knownHostsPolicy);
remoteSecureCopyInputs.setKnownHostsPath(knownHostsPath);
remoteSecureCopyInputs.setTimeout(timeout);
remoteSecureCopyInputs.setProxyHost(proxyHost);
remoteSecureCopyInputs.setProxyPort(proxyPort);
return new RemoteSecureCopyService().execute(remoteSecureCopyInputs);
} | [
"@",
"Action",
"(",
"name",
"=",
"\"Remote Secure Copy\"",
",",
"outputs",
"=",
"{",
"@",
"Output",
"(",
"Constants",
".",
"OutputNames",
".",
"RETURN_CODE",
")",
",",
"@",
"Output",
"(",
"Constants",
".",
"OutputNames",
".",
"RETURN_RESULT",
")",
",",
"@"... | Executes a Shell command(s) on the remote machine using the SSH protocol.
@param sourceHost The hostname or ip address of the source remote machine.
@param sourcePath The path to the file that needs to be copied from the source remote machine.
@param sourcePort The port number for running the command on the source remote machine.
@param sourceUsername The username of the account on the source remote machine.
@param sourcePassword The password of the user for the source remote machine.
@param sourcePrivateKeyFile The path to the private key file (OpenSSH type) on the source machine.
@param destinationHost The hostname or ip address of the destination remote machine.
@param destinationPath The path to the location where the file will be copied on the destination remote machine.
@param destinationPort The port number for running the command on the destination remote machine.
@param destinationUsername The username of the account on the destination remote machine.
@param destinationPassword The password of the user for the destination remote machine.
@param destinationPrivateKeyFile The path to the private key file (OpenSSH type) on the destination machine.
@param knownHostsPolicy The policy used for managing known_hosts file. Valid values: allow, strict, add. Default value: strict
@param knownHostsPath The path to the known hosts file.
@param timeout Time in milliseconds to wait for the command to complete. Default value is 90000 (90 seconds)
@param proxyHost The HTTP proxy host
@param proxyPort The HTTP proxy port
@return - a map containing the output of the operation. Keys present in the map are:
<br><b>returnResult</b> - The primary output.
<br><b>returnCode</b> - the return code of the operation. 0 if the operation goes to success, -1 if the operation goes to failure.
<br><b>exception</b> - the exception message if the operation goes to failure. | [
"Executes",
"a",
"Shell",
"command",
"(",
"s",
")",
"on",
"the",
"remote",
"machine",
"using",
"the",
"SSH",
"protocol",
"."
] | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-rft/src/main/java/io/cloudslang/content/rft/actions/RemoteSecureCopyAction.java#L71-L118 |
phax/ph-schedule | ph-schedule/src/main/java/com/helger/schedule/quartz/trigger/JDK8TriggerBuilder.java | JDK8TriggerBuilder.withIdentity | @Nonnull
public JDK8TriggerBuilder <T> withIdentity (final String name, final String group) {
"""
Use a TriggerKey with the given name and group to identify the Trigger.
<p>
If none of the 'withIdentity' methods are set on the JDK8TriggerBuilder,
then a random, unique TriggerKey will be generated.
</p>
@param name
the name element for the Trigger's TriggerKey
@param group
the group element for the Trigger's TriggerKey
@return the updated JDK8TriggerBuilder
@see TriggerKey
@see ITrigger#getKey()
"""
m_aTriggerKey = new TriggerKey (name, group);
return this;
} | java | @Nonnull
public JDK8TriggerBuilder <T> withIdentity (final String name, final String group)
{
m_aTriggerKey = new TriggerKey (name, group);
return this;
} | [
"@",
"Nonnull",
"public",
"JDK8TriggerBuilder",
"<",
"T",
">",
"withIdentity",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"group",
")",
"{",
"m_aTriggerKey",
"=",
"new",
"TriggerKey",
"(",
"name",
",",
"group",
")",
";",
"return",
"this",
";",... | Use a TriggerKey with the given name and group to identify the Trigger.
<p>
If none of the 'withIdentity' methods are set on the JDK8TriggerBuilder,
then a random, unique TriggerKey will be generated.
</p>
@param name
the name element for the Trigger's TriggerKey
@param group
the group element for the Trigger's TriggerKey
@return the updated JDK8TriggerBuilder
@see TriggerKey
@see ITrigger#getKey() | [
"Use",
"a",
"TriggerKey",
"with",
"the",
"given",
"name",
"and",
"group",
"to",
"identify",
"the",
"Trigger",
".",
"<p",
">",
"If",
"none",
"of",
"the",
"withIdentity",
"methods",
"are",
"set",
"on",
"the",
"JDK8TriggerBuilder",
"then",
"a",
"random",
"uni... | train | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-schedule/src/main/java/com/helger/schedule/quartz/trigger/JDK8TriggerBuilder.java#L165-L170 |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/utils/InstancesDistributor.java | InstancesDistributor.distribute | public static void distribute(Object obj, String fileName, Configuration conf) throws FileNotFoundException,
IOException, URISyntaxException {
"""
Utility method for serializing an object and saving it in a way that later
can be recovered anywhere in the cluster.
<p>
The file where it has been serialized will be saved into a Hadoop
Configuration property so that you can call
{@link InstancesDistributor#loadInstance(Configuration, Class, String, boolean)}
to re-instantiate the serialized instance.
@param obj
The obj instance to serialize using Java serialization.
@param fileName
The file name where the instance will be serialized.
@param conf
The Hadoop Configuration.
@throws FileNotFoundException
@throws IOException
@throws URISyntaxException
"""
FileSystem fS = FileSystem.get(conf);
// set the temporary folder for Pangool instances to the temporary of the
// user that is running the Job
// This folder will be used across the cluster for location the instances.
// The default value can be changed by a user-provided one.
String tmpHdfsFolder = getInstancesFolder(fS, conf);
Path toHdfs = new Path(tmpHdfsFolder, fileName);
if (fS.exists(toHdfs)) { // Optionally, copy to DFS if
fS.delete(toHdfs, false);
}
ObjectOutput out = new ObjectOutputStream(fS.create(toHdfs));
out.writeObject(obj);
out.close();
DistributedCache.addCacheFile(toHdfs.toUri(), conf);
} | java | public static void distribute(Object obj, String fileName, Configuration conf) throws FileNotFoundException,
IOException, URISyntaxException {
FileSystem fS = FileSystem.get(conf);
// set the temporary folder for Pangool instances to the temporary of the
// user that is running the Job
// This folder will be used across the cluster for location the instances.
// The default value can be changed by a user-provided one.
String tmpHdfsFolder = getInstancesFolder(fS, conf);
Path toHdfs = new Path(tmpHdfsFolder, fileName);
if (fS.exists(toHdfs)) { // Optionally, copy to DFS if
fS.delete(toHdfs, false);
}
ObjectOutput out = new ObjectOutputStream(fS.create(toHdfs));
out.writeObject(obj);
out.close();
DistributedCache.addCacheFile(toHdfs.toUri(), conf);
} | [
"public",
"static",
"void",
"distribute",
"(",
"Object",
"obj",
",",
"String",
"fileName",
",",
"Configuration",
"conf",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
",",
"URISyntaxException",
"{",
"FileSystem",
"fS",
"=",
"FileSystem",
".",
"get",
... | Utility method for serializing an object and saving it in a way that later
can be recovered anywhere in the cluster.
<p>
The file where it has been serialized will be saved into a Hadoop
Configuration property so that you can call
{@link InstancesDistributor#loadInstance(Configuration, Class, String, boolean)}
to re-instantiate the serialized instance.
@param obj
The obj instance to serialize using Java serialization.
@param fileName
The file name where the instance will be serialized.
@param conf
The Hadoop Configuration.
@throws FileNotFoundException
@throws IOException
@throws URISyntaxException | [
"Utility",
"method",
"for",
"serializing",
"an",
"object",
"and",
"saving",
"it",
"in",
"a",
"way",
"that",
"later",
"can",
"be",
"recovered",
"anywhere",
"in",
"the",
"cluster",
".",
"<p",
">",
"The",
"file",
"where",
"it",
"has",
"been",
"serialized",
... | train | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/utils/InstancesDistributor.java#L78-L97 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ConnectionMonitorsInner.java | ConnectionMonitorsInner.beginQuery | public ConnectionMonitorQueryResultInner beginQuery(String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
"""
Query a snapshot of the most recent connection states.
@param resourceGroupName The name of the resource group containing Network Watcher.
@param networkWatcherName The name of the Network Watcher resource.
@param connectionMonitorName The name given to the connection monitor.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ConnectionMonitorQueryResultInner object if successful.
"""
return beginQueryWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName).toBlocking().single().body();
} | java | public ConnectionMonitorQueryResultInner beginQuery(String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
return beginQueryWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName).toBlocking().single().body();
} | [
"public",
"ConnectionMonitorQueryResultInner",
"beginQuery",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"String",
"connectionMonitorName",
")",
"{",
"return",
"beginQueryWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"networkWatcher... | Query a snapshot of the most recent connection states.
@param resourceGroupName The name of the resource group containing Network Watcher.
@param networkWatcherName The name of the Network Watcher resource.
@param connectionMonitorName The name given to the connection monitor.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ConnectionMonitorQueryResultInner object if successful. | [
"Query",
"a",
"snapshot",
"of",
"the",
"most",
"recent",
"connection",
"states",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ConnectionMonitorsInner.java#L960-L962 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPPrefixesInner.java | PublicIPPrefixesInner.beginUpdateTagsAsync | public Observable<PublicIPPrefixInner> beginUpdateTagsAsync(String resourceGroupName, String publicIpPrefixName) {
"""
Updates public IP prefix tags.
@param resourceGroupName The name of the resource group.
@param publicIpPrefixName The name of the public IP prefix.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PublicIPPrefixInner object
"""
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() {
@Override
public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) {
return response.body();
}
});
} | java | public Observable<PublicIPPrefixInner> beginUpdateTagsAsync(String resourceGroupName, String publicIpPrefixName) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() {
@Override
public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"PublicIPPrefixInner",
">",
"beginUpdateTagsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"publicIpPrefixName",
")",
"{",
"return",
"beginUpdateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"publicIpPrefixName",
")",
... | Updates public IP prefix tags.
@param resourceGroupName The name of the resource group.
@param publicIpPrefixName The name of the public IP prefix.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PublicIPPrefixInner object | [
"Updates",
"public",
"IP",
"prefix",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPPrefixesInner.java#L779-L786 |
exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryService.java | RESTRegistryService.createEntry | @POST
@Path("/ {
"""
Creates an entry in the group. In a case the group does not exist already it will be automatically
created.
@param entryStream the input stream corresponding to the content of the registry entry
@param groupName the relative path to the group
@request
{code}
"entryStream" : the input stream corresponding to the content of the registry entry
{code}
Example :
{@code
<registry xlinks:href="http://localhost:8080/portal/rest/registry/">
<GroovyScript2RestLoader xlinks:href="http://localhost:8080/portal/rest/registry/exo:services/GroovyScript2RestLoader"/>
<Audit xlinks:href="http://localhost:8080/portal/rest/registry/exo:services/Audit"/>
</registry>
}
@LevelAPI Experimental
"""groupName:.+}")
@Consumes(MediaType.APPLICATION_XML)
public Response createEntry(InputStream entryStream, @PathParam("groupName") String groupName, @Context UriInfo uriInfo)
{
SessionProvider sessionProvider = sessionProviderService.getSessionProvider(null);
try
{
RegistryEntry entry = RegistryEntry.parse(entryStream);
regService.createEntry(sessionProvider, normalizePath(groupName), entry);
URI location = uriInfo.getRequestUriBuilder().path(entry.getName()).build();
return Response.created(location).build();
}
catch (IllegalArgumentException e)
{
LOG.error("Create registry entry failed", e);
throw new WebApplicationException(e);
}
catch (IOException e)
{
LOG.error("Create registry entry failed", e);
throw new WebApplicationException(e);
}
catch (SAXException e)
{
LOG.error("Create registry entry failed", e);
throw new WebApplicationException(e);
}
catch (ParserConfigurationException e)
{
LOG.error("Create registry entry failed", e);
throw new WebApplicationException(e);
}
catch (RepositoryException e)
{
LOG.error("Create registry entry failed", e);
throw new WebApplicationException(e);
}
} | java | @POST
@Path("/{groupName:.+}")
@Consumes(MediaType.APPLICATION_XML)
public Response createEntry(InputStream entryStream, @PathParam("groupName") String groupName, @Context UriInfo uriInfo)
{
SessionProvider sessionProvider = sessionProviderService.getSessionProvider(null);
try
{
RegistryEntry entry = RegistryEntry.parse(entryStream);
regService.createEntry(sessionProvider, normalizePath(groupName), entry);
URI location = uriInfo.getRequestUriBuilder().path(entry.getName()).build();
return Response.created(location).build();
}
catch (IllegalArgumentException e)
{
LOG.error("Create registry entry failed", e);
throw new WebApplicationException(e);
}
catch (IOException e)
{
LOG.error("Create registry entry failed", e);
throw new WebApplicationException(e);
}
catch (SAXException e)
{
LOG.error("Create registry entry failed", e);
throw new WebApplicationException(e);
}
catch (ParserConfigurationException e)
{
LOG.error("Create registry entry failed", e);
throw new WebApplicationException(e);
}
catch (RepositoryException e)
{
LOG.error("Create registry entry failed", e);
throw new WebApplicationException(e);
}
} | [
"@",
"POST",
"@",
"Path",
"(",
"\"/{groupName:.+}\"",
")",
"@",
"Consumes",
"(",
"MediaType",
".",
"APPLICATION_XML",
")",
"public",
"Response",
"createEntry",
"(",
"InputStream",
"entryStream",
",",
"@",
"PathParam",
"(",
"\"groupName\"",
")",
"String",
"groupN... | Creates an entry in the group. In a case the group does not exist already it will be automatically
created.
@param entryStream the input stream corresponding to the content of the registry entry
@param groupName the relative path to the group
@request
{code}
"entryStream" : the input stream corresponding to the content of the registry entry
{code}
Example :
{@code
<registry xlinks:href="http://localhost:8080/portal/rest/registry/">
<GroovyScript2RestLoader xlinks:href="http://localhost:8080/portal/rest/registry/exo:services/GroovyScript2RestLoader"/>
<Audit xlinks:href="http://localhost:8080/portal/rest/registry/exo:services/Audit"/>
</registry>
}
@LevelAPI Experimental | [
"Creates",
"an",
"entry",
"in",
"the",
"group",
".",
"In",
"a",
"case",
"the",
"group",
"does",
"not",
"exist",
"already",
"it",
"will",
"be",
"automatically",
"created",
".",
"@param",
"entryStream",
"the",
"input",
"stream",
"corresponding",
"to",
"the",
... | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryService.java#L221-L260 |
Azure/azure-sdk-for-java | datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java | ServicesInner.beginStartAsync | public Observable<Void> beginStartAsync(String groupName, String serviceName) {
"""
Start service.
The services resource is the top-level resource that represents the Data Migration Service. This action starts the service and the service can be used for data migration.
@param groupName Name of the resource group
@param serviceName Name of the service
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful.
"""
return beginStartWithServiceResponseAsync(groupName, serviceName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginStartAsync(String groupName, String serviceName) {
return beginStartWithServiceResponseAsync(groupName, serviceName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginStartAsync",
"(",
"String",
"groupName",
",",
"String",
"serviceName",
")",
"{",
"return",
"beginStartWithServiceResponseAsync",
"(",
"groupName",
",",
"serviceName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"Ser... | Start service.
The services resource is the top-level resource that represents the Data Migration Service. This action starts the service and the service can be used for data migration.
@param groupName Name of the resource group
@param serviceName Name of the service
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Start",
"service",
".",
"The",
"services",
"resource",
"is",
"the",
"top",
"-",
"level",
"resource",
"that",
"represents",
"the",
"Data",
"Migration",
"Service",
".",
"This",
"action",
"starts",
"the",
"service",
"and",
"the",
"service",
"can",
"be",
"used"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L1128-L1135 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/runtime/JCuda.java | JCuda.cudaHostGetDevicePointer | public static int cudaHostGetDevicePointer(Pointer pDevice, Pointer pHost, int flags) {
"""
Passes back device pointer of mapped host memory allocated by cudaHostAlloc or registered by cudaHostRegister.
<pre>
cudaError_t cudaHostGetDevicePointer (
void** pDevice,
void* pHost,
unsigned int flags )
</pre>
<div>
<p>Passes back device pointer of mapped host
memory allocated by cudaHostAlloc or registered by cudaHostRegister.
Passes back
the device pointer corresponding to the
mapped, pinned host buffer allocated by cudaHostAlloc() or registered
by cudaHostRegister().
</p>
<p>cudaHostGetDevicePointer() will fail if
the cudaDeviceMapHost flag was not specified before deferred context
creation occurred, or if called on a device that does not support
mapped,
pinned memory.
</p>
<p><tt>flags</tt> provides for future
releases. For now, it must be set to 0.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param pDevice Returned device pointer for mapped memory
@param pHost Requested host pointer mapping
@param flags Flags for extensions (must be 0 for now)
@return cudaSuccess, cudaErrorInvalidValue, cudaErrorMemoryAllocation
@see JCuda#cudaSetDeviceFlags
@see JCuda#cudaHostAlloc
"""
return checkResult(cudaHostGetDevicePointerNative(pDevice, pHost, flags));
} | java | public static int cudaHostGetDevicePointer(Pointer pDevice, Pointer pHost, int flags)
{
return checkResult(cudaHostGetDevicePointerNative(pDevice, pHost, flags));
} | [
"public",
"static",
"int",
"cudaHostGetDevicePointer",
"(",
"Pointer",
"pDevice",
",",
"Pointer",
"pHost",
",",
"int",
"flags",
")",
"{",
"return",
"checkResult",
"(",
"cudaHostGetDevicePointerNative",
"(",
"pDevice",
",",
"pHost",
",",
"flags",
")",
")",
";",
... | Passes back device pointer of mapped host memory allocated by cudaHostAlloc or registered by cudaHostRegister.
<pre>
cudaError_t cudaHostGetDevicePointer (
void** pDevice,
void* pHost,
unsigned int flags )
</pre>
<div>
<p>Passes back device pointer of mapped host
memory allocated by cudaHostAlloc or registered by cudaHostRegister.
Passes back
the device pointer corresponding to the
mapped, pinned host buffer allocated by cudaHostAlloc() or registered
by cudaHostRegister().
</p>
<p>cudaHostGetDevicePointer() will fail if
the cudaDeviceMapHost flag was not specified before deferred context
creation occurred, or if called on a device that does not support
mapped,
pinned memory.
</p>
<p><tt>flags</tt> provides for future
releases. For now, it must be set to 0.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param pDevice Returned device pointer for mapped memory
@param pHost Requested host pointer mapping
@param flags Flags for extensions (must be 0 for now)
@return cudaSuccess, cudaErrorInvalidValue, cudaErrorMemoryAllocation
@see JCuda#cudaSetDeviceFlags
@see JCuda#cudaHostAlloc | [
"Passes",
"back",
"device",
"pointer",
"of",
"mapped",
"host",
"memory",
"allocated",
"by",
"cudaHostAlloc",
"or",
"registered",
"by",
"cudaHostRegister",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L3868-L3871 |
sebastiangraf/jSCSI | bundles/commons/src/main/java/org/jscsi/parser/ProtocolDataUnit.java | ProtocolDataUnit.deserializeAdditionalHeaderSegments | private final int deserializeAdditionalHeaderSegments (final ByteBuffer pdu, final int offset) throws InternetSCSIException {
"""
Deserializes a array (starting from the given offset) and store the informations to the
<code>AdditionalHeaderSegment</code> object.
@param pdu The <code>ByteBuffer</code> to read from.
@param offset The offset to start from.
@return The length of the written bytes.
@throws InternetSCSIException If any violation of the iSCSI-Standard emerge.
"""
// parsing Additional Header Segment
int off = offset;
int ahsLength = basicHeaderSegment.getTotalAHSLength();
while (ahsLength != 0) {
final AdditionalHeaderSegment tmpAHS = new AdditionalHeaderSegment();
tmpAHS.deserialize(pdu, off);
additionalHeaderSegments.add(tmpAHS);
ahsLength -= tmpAHS.getLength();
off += tmpAHS.getSpecificField().position();
}
return off - offset;
} | java | private final int deserializeAdditionalHeaderSegments (final ByteBuffer pdu, final int offset) throws InternetSCSIException {
// parsing Additional Header Segment
int off = offset;
int ahsLength = basicHeaderSegment.getTotalAHSLength();
while (ahsLength != 0) {
final AdditionalHeaderSegment tmpAHS = new AdditionalHeaderSegment();
tmpAHS.deserialize(pdu, off);
additionalHeaderSegments.add(tmpAHS);
ahsLength -= tmpAHS.getLength();
off += tmpAHS.getSpecificField().position();
}
return off - offset;
} | [
"private",
"final",
"int",
"deserializeAdditionalHeaderSegments",
"(",
"final",
"ByteBuffer",
"pdu",
",",
"final",
"int",
"offset",
")",
"throws",
"InternetSCSIException",
"{",
"// parsing Additional Header Segment",
"int",
"off",
"=",
"offset",
";",
"int",
"ahsLength",... | Deserializes a array (starting from the given offset) and store the informations to the
<code>AdditionalHeaderSegment</code> object.
@param pdu The <code>ByteBuffer</code> to read from.
@param offset The offset to start from.
@return The length of the written bytes.
@throws InternetSCSIException If any violation of the iSCSI-Standard emerge. | [
"Deserializes",
"a",
"array",
"(",
"starting",
"from",
"the",
"given",
"offset",
")",
"and",
"store",
"the",
"informations",
"to",
"the",
"<code",
">",
"AdditionalHeaderSegment<",
"/",
"code",
">",
"object",
"."
] | train | https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/commons/src/main/java/org/jscsi/parser/ProtocolDataUnit.java#L224-L240 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/flow/cdi/FlowScopeBeanHolder.java | FlowScopeBeanHolder.getContextualStorage | public ContextualStorage getContextualStorage(BeanManager beanManager, String flowClientWindowId) {
"""
This method will return the ContextualStorage or create a new one
if no one is yet assigned to the current flowClientWindowId.
@param beanManager we need the CDI {@link BeanManager} for serialisation.
@param flowClientWindowId the flowClientWindowId for the current flow.
"""
ContextualStorage contextualStorage = storageMap.get(flowClientWindowId);
if (contextualStorage == null)
{
synchronized (this)
{
contextualStorage = storageMap.get(flowClientWindowId);
if (contextualStorage == null)
{
contextualStorage = new ContextualStorage(beanManager, true, true);
storageMap.put(flowClientWindowId, contextualStorage);
}
}
}
return contextualStorage;
} | java | public ContextualStorage getContextualStorage(BeanManager beanManager, String flowClientWindowId)
{
ContextualStorage contextualStorage = storageMap.get(flowClientWindowId);
if (contextualStorage == null)
{
synchronized (this)
{
contextualStorage = storageMap.get(flowClientWindowId);
if (contextualStorage == null)
{
contextualStorage = new ContextualStorage(beanManager, true, true);
storageMap.put(flowClientWindowId, contextualStorage);
}
}
}
return contextualStorage;
} | [
"public",
"ContextualStorage",
"getContextualStorage",
"(",
"BeanManager",
"beanManager",
",",
"String",
"flowClientWindowId",
")",
"{",
"ContextualStorage",
"contextualStorage",
"=",
"storageMap",
".",
"get",
"(",
"flowClientWindowId",
")",
";",
"if",
"(",
"contextualS... | This method will return the ContextualStorage or create a new one
if no one is yet assigned to the current flowClientWindowId.
@param beanManager we need the CDI {@link BeanManager} for serialisation.
@param flowClientWindowId the flowClientWindowId for the current flow. | [
"This",
"method",
"will",
"return",
"the",
"ContextualStorage",
"or",
"create",
"a",
"new",
"one",
"if",
"no",
"one",
"is",
"yet",
"assigned",
"to",
"the",
"current",
"flowClientWindowId",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/flow/cdi/FlowScopeBeanHolder.java#L104-L121 |
spockframework/spock | spock-core/src/main/java/org/spockframework/compiler/SpecRewriter.java | SpecRewriter.moveInitializer | private void moveInitializer(Field field, Method method, int position) {
"""
/*
Moves initialization of the given field to the given position of the first block of the given method.
"""
method.getFirstBlock().getAst().add(position,
new ExpressionStatement(
new FieldInitializationExpression(field.getAst())));
field.getAst().setInitialValueExpression(null);
} | java | private void moveInitializer(Field field, Method method, int position) {
method.getFirstBlock().getAst().add(position,
new ExpressionStatement(
new FieldInitializationExpression(field.getAst())));
field.getAst().setInitialValueExpression(null);
} | [
"private",
"void",
"moveInitializer",
"(",
"Field",
"field",
",",
"Method",
"method",
",",
"int",
"position",
")",
"{",
"method",
".",
"getFirstBlock",
"(",
")",
".",
"getAst",
"(",
")",
".",
"add",
"(",
"position",
",",
"new",
"ExpressionStatement",
"(",
... | /*
Moves initialization of the given field to the given position of the first block of the given method. | [
"/",
"*",
"Moves",
"initialization",
"of",
"the",
"given",
"field",
"to",
"the",
"given",
"position",
"of",
"the",
"first",
"block",
"of",
"the",
"given",
"method",
"."
] | train | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/compiler/SpecRewriter.java#L224-L229 |
apache/groovy | subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java | NioGroovyMethods.renameTo | public static boolean renameTo(final Path self, URI newPathName) {
"""
Renames a file.
@param self a Path
@param newPathName The new target path specified as a URI object
@return <code>true</code> if and only if the renaming succeeded;
<code>false</code> otherwise
@since 2.3.0
"""
try {
Files.move(self, Paths.get(newPathName));
return true;
} catch (IOException e) {
return false;
}
} | java | public static boolean renameTo(final Path self, URI newPathName) {
try {
Files.move(self, Paths.get(newPathName));
return true;
} catch (IOException e) {
return false;
}
} | [
"public",
"static",
"boolean",
"renameTo",
"(",
"final",
"Path",
"self",
",",
"URI",
"newPathName",
")",
"{",
"try",
"{",
"Files",
".",
"move",
"(",
"self",
",",
"Paths",
".",
"get",
"(",
"newPathName",
")",
")",
";",
"return",
"true",
";",
"}",
"cat... | Renames a file.
@param self a Path
@param newPathName The new target path specified as a URI object
@return <code>true</code> if and only if the renaming succeeded;
<code>false</code> otherwise
@since 2.3.0 | [
"Renames",
"a",
"file",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L1341-L1348 |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/markdown/MarkdownHelper.java | MarkdownHelper._escape | private static int _escape (final StringBuilder out, final char ch, final int pos) {
"""
Processed the given escape sequence.
@param out
The StringBuilder to write to.
@param ch
The character.
@param pos
Current parsing position.
@return The new position.
"""
if (isEscapeChar (ch))
{
out.append (ch);
return pos + 1;
}
out.append ('\\');
return pos;
} | java | private static int _escape (final StringBuilder out, final char ch, final int pos)
{
if (isEscapeChar (ch))
{
out.append (ch);
return pos + 1;
}
out.append ('\\');
return pos;
} | [
"private",
"static",
"int",
"_escape",
"(",
"final",
"StringBuilder",
"out",
",",
"final",
"char",
"ch",
",",
"final",
"int",
"pos",
")",
"{",
"if",
"(",
"isEscapeChar",
"(",
"ch",
")",
")",
"{",
"out",
".",
"append",
"(",
"ch",
")",
";",
"return",
... | Processed the given escape sequence.
@param out
The StringBuilder to write to.
@param ch
The character.
@param pos
Current parsing position.
@return The new position. | [
"Processed",
"the",
"given",
"escape",
"sequence",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/markdown/MarkdownHelper.java#L96-L105 |
evernote/android-intent | library/src/main/java/com/evernote/android/intent/CreateNewNoteIntentBuilder.java | CreateNewNoteIntentBuilder.setTextHtml | public CreateNewNoteIntentBuilder setTextHtml(@Nullable String html, @Nullable String baseUrl) {
"""
The Evernote app will convert the HTML content to ENML. It will fetch resources and apply
supported styles. You can either send an HTML snippet or a full HTML page.
<br>
<br>
You cannot send plain text content and HTML at the same time. This method uses the {@link Intent#EXTRA_TEXT}
field and sets the type of the Intent to {@code text/html}. Previous set content with {@link #setTextPlain(String)}
is overwritten.
@param html The HTML content which is converted to ENML in the Evernote app. If {@code null}
then the current value gets removed.
@param baseUrl The base URL for resources with relative URLs within the HTML. If {@code null}
then the current value gets removed.
@return This Builder object to allow for chaining of calls to set methods.
@see Intent#EXTRA_TEXT
@see Intent#setType(String)
"""
if (TextUtils.isEmpty(html)) {
mIntent.setType(null);
} else {
mIntent.setType("text/html");
}
putString(Intent.EXTRA_TEXT, html);
return putString(EvernoteIntent.EXTRA_BASE_URL, baseUrl);
} | java | public CreateNewNoteIntentBuilder setTextHtml(@Nullable String html, @Nullable String baseUrl) {
if (TextUtils.isEmpty(html)) {
mIntent.setType(null);
} else {
mIntent.setType("text/html");
}
putString(Intent.EXTRA_TEXT, html);
return putString(EvernoteIntent.EXTRA_BASE_URL, baseUrl);
} | [
"public",
"CreateNewNoteIntentBuilder",
"setTextHtml",
"(",
"@",
"Nullable",
"String",
"html",
",",
"@",
"Nullable",
"String",
"baseUrl",
")",
"{",
"if",
"(",
"TextUtils",
".",
"isEmpty",
"(",
"html",
")",
")",
"{",
"mIntent",
".",
"setType",
"(",
"null",
... | The Evernote app will convert the HTML content to ENML. It will fetch resources and apply
supported styles. You can either send an HTML snippet or a full HTML page.
<br>
<br>
You cannot send plain text content and HTML at the same time. This method uses the {@link Intent#EXTRA_TEXT}
field and sets the type of the Intent to {@code text/html}. Previous set content with {@link #setTextPlain(String)}
is overwritten.
@param html The HTML content which is converted to ENML in the Evernote app. If {@code null}
then the current value gets removed.
@param baseUrl The base URL for resources with relative URLs within the HTML. If {@code null}
then the current value gets removed.
@return This Builder object to allow for chaining of calls to set methods.
@see Intent#EXTRA_TEXT
@see Intent#setType(String) | [
"The",
"Evernote",
"app",
"will",
"convert",
"the",
"HTML",
"content",
"to",
"ENML",
".",
"It",
"will",
"fetch",
"resources",
"and",
"apply",
"supported",
"styles",
".",
"You",
"can",
"either",
"send",
"an",
"HTML",
"snippet",
"or",
"a",
"full",
"HTML",
... | train | https://github.com/evernote/android-intent/blob/5df1bec46b0a7d27be816d62f8fd2c10bda731ea/library/src/main/java/com/evernote/android/intent/CreateNewNoteIntentBuilder.java#L215-L224 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/topography/ST_Drape.java | ST_Drape.drapeLineString | public static Geometry drapeLineString(LineString line, Geometry triangles, STRtree sTRtree) {
"""
Drape a linestring to a set of triangles
@param line
@param triangles
@param sTRtree
@return
"""
GeometryFactory factory = line.getFactory();
//Split the triangles in lines to perform all intersections
Geometry triangleLines = LinearComponentExtracter.getGeometry(triangles, true);
Geometry diffExt = lineMerge(line.difference(triangleLines), factory);
CoordinateSequenceFilter drapeFilter = new DrapeFilter(sTRtree);
diffExt.apply(drapeFilter);
return diffExt;
} | java | public static Geometry drapeLineString(LineString line, Geometry triangles, STRtree sTRtree) {
GeometryFactory factory = line.getFactory();
//Split the triangles in lines to perform all intersections
Geometry triangleLines = LinearComponentExtracter.getGeometry(triangles, true);
Geometry diffExt = lineMerge(line.difference(triangleLines), factory);
CoordinateSequenceFilter drapeFilter = new DrapeFilter(sTRtree);
diffExt.apply(drapeFilter);
return diffExt;
} | [
"public",
"static",
"Geometry",
"drapeLineString",
"(",
"LineString",
"line",
",",
"Geometry",
"triangles",
",",
"STRtree",
"sTRtree",
")",
"{",
"GeometryFactory",
"factory",
"=",
"line",
".",
"getFactory",
"(",
")",
";",
"//Split the triangles in lines to perform all... | Drape a linestring to a set of triangles
@param line
@param triangles
@param sTRtree
@return | [
"Drape",
"a",
"linestring",
"to",
"a",
"set",
"of",
"triangles"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/topography/ST_Drape.java#L150-L158 |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplace.java | CmsWorkplace.buttonBarLine | public String buttonBarLine(int leftPixel, int rightPixel, String className) {
"""
Generates a variable button bar separator line.<p>
@param leftPixel the amount of pixel left to the line
@param rightPixel the amount of pixel right to the line
@param className the css class name for the formatting
@return a variable button bar separator line
"""
StringBuffer result = new StringBuffer(512);
if (leftPixel > 0) {
result.append(buttonBarLineSpacer(leftPixel));
}
result.append("<td><span class=\"");
result.append(className);
result.append("\"></span></td>\n");
if (rightPixel > 0) {
result.append(buttonBarLineSpacer(rightPixel));
}
return result.toString();
} | java | public String buttonBarLine(int leftPixel, int rightPixel, String className) {
StringBuffer result = new StringBuffer(512);
if (leftPixel > 0) {
result.append(buttonBarLineSpacer(leftPixel));
}
result.append("<td><span class=\"");
result.append(className);
result.append("\"></span></td>\n");
if (rightPixel > 0) {
result.append(buttonBarLineSpacer(rightPixel));
}
return result.toString();
} | [
"public",
"String",
"buttonBarLine",
"(",
"int",
"leftPixel",
",",
"int",
"rightPixel",
",",
"String",
"className",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"512",
")",
";",
"if",
"(",
"leftPixel",
">",
"0",
")",
"{",
"result",
... | Generates a variable button bar separator line.<p>
@param leftPixel the amount of pixel left to the line
@param rightPixel the amount of pixel right to the line
@param className the css class name for the formatting
@return a variable button bar separator line | [
"Generates",
"a",
"variable",
"button",
"bar",
"separator",
"line",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L1350-L1363 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java | LocalQPConsumerKey.createNewFiltersAndCursors | private void createNewFiltersAndCursors(ItemStream itemStream)
throws SIResourceException, MessageStoreException {
"""
Create the filters and cursors for this Key. If XD has registered a
MessageController we'll need a cursor-filter pair for each classification.
@throws SIResourceException
@throws MessageStoreException
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createNewFiltersAndCursors", itemStream);
LockingCursor cursor = null;
// Instantiate a new array of Filters and associated cursors. If there is
// no message classification, then we'll instantiate a single filter and
// cursor pair.
if(classifyingMessages)
{
// Classifying messages for XD.
// this work should be done under the classifications readlock acquired higher
// up in the stack
JSConsumerClassifications classifications = consumerSet.getClassifications();
int numClasses = classifications.getNumberOfClasses();
consumerKeyFilter = new LocalQPConsumerKeyFilter[numClasses+1];
for(int i=0;i<numClasses+1;i++)
{
String classificationName = null;
// The zeroth filter belongs to the default classification, which has a
// null classification name
if(i > 0)
classificationName = classifications.getClassification(i);
consumerKeyFilter[i] = new LocalQPConsumerKeyFilter(this, i, classificationName);
cursor = itemStream.newLockingItemCursor(consumerKeyFilter[i], !forwardScanning);
consumerKeyFilter[i].setLockingCursor(cursor);
}
}
else
{
// No message classification
consumerKeyFilter = new LocalQPConsumerKeyFilter[1];
consumerKeyFilter[0] = new LocalQPConsumerKeyFilter(this, 0, null);
cursor = itemStream.newLockingItemCursor(consumerKeyFilter[0], !forwardScanning);
consumerKeyFilter[0].setLockingCursor(cursor);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createNewFiltersAndCursors");
} | java | private void createNewFiltersAndCursors(ItemStream itemStream)
throws SIResourceException, MessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createNewFiltersAndCursors", itemStream);
LockingCursor cursor = null;
// Instantiate a new array of Filters and associated cursors. If there is
// no message classification, then we'll instantiate a single filter and
// cursor pair.
if(classifyingMessages)
{
// Classifying messages for XD.
// this work should be done under the classifications readlock acquired higher
// up in the stack
JSConsumerClassifications classifications = consumerSet.getClassifications();
int numClasses = classifications.getNumberOfClasses();
consumerKeyFilter = new LocalQPConsumerKeyFilter[numClasses+1];
for(int i=0;i<numClasses+1;i++)
{
String classificationName = null;
// The zeroth filter belongs to the default classification, which has a
// null classification name
if(i > 0)
classificationName = classifications.getClassification(i);
consumerKeyFilter[i] = new LocalQPConsumerKeyFilter(this, i, classificationName);
cursor = itemStream.newLockingItemCursor(consumerKeyFilter[i], !forwardScanning);
consumerKeyFilter[i].setLockingCursor(cursor);
}
}
else
{
// No message classification
consumerKeyFilter = new LocalQPConsumerKeyFilter[1];
consumerKeyFilter[0] = new LocalQPConsumerKeyFilter(this, 0, null);
cursor = itemStream.newLockingItemCursor(consumerKeyFilter[0], !forwardScanning);
consumerKeyFilter[0].setLockingCursor(cursor);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createNewFiltersAndCursors");
} | [
"private",
"void",
"createNewFiltersAndCursors",
"(",
"ItemStream",
"itemStream",
")",
"throws",
"SIResourceException",
",",
"MessageStoreException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
... | Create the filters and cursors for this Key. If XD has registered a
MessageController we'll need a cursor-filter pair for each classification.
@throws SIResourceException
@throws MessageStoreException | [
"Create",
"the",
"filters",
"and",
"cursors",
"for",
"this",
"Key",
".",
"If",
"XD",
"has",
"registered",
"a",
"MessageController",
"we",
"ll",
"need",
"a",
"cursor",
"-",
"filter",
"pair",
"for",
"each",
"classification",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java#L972-L1014 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java | JSONHelpers.loadExternalJSONDocument | public static JSONObject loadExternalJSONDocument(Context context, final String file) {
"""
Load a JSON file from the application's private {@link Environment#DIRECTORY_DOCUMENTS}.
@param file Relative path to file in "Documents" directory.
@return New instance of {@link JSONObject}
"""
return loadExternalJSONFile(context, Environment.DIRECTORY_DOCUMENTS, file);
} | java | public static JSONObject loadExternalJSONDocument(Context context, final String file) {
return loadExternalJSONFile(context, Environment.DIRECTORY_DOCUMENTS, file);
} | [
"public",
"static",
"JSONObject",
"loadExternalJSONDocument",
"(",
"Context",
"context",
",",
"final",
"String",
"file",
")",
"{",
"return",
"loadExternalJSONFile",
"(",
"context",
",",
"Environment",
".",
"DIRECTORY_DOCUMENTS",
",",
"file",
")",
";",
"}"
] | Load a JSON file from the application's private {@link Environment#DIRECTORY_DOCUMENTS}.
@param file Relative path to file in "Documents" directory.
@return New instance of {@link JSONObject} | [
"Load",
"a",
"JSON",
"file",
"from",
"the",
"application",
"s",
"private",
"{",
"@link",
"Environment#DIRECTORY_DOCUMENTS",
"}",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java#L1220-L1222 |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/meta/EntityTypeDependencyResolver.java | EntityTypeDependencyResolver.expandEntityTypeDependencies | private static Set<EntityTypeNode> expandEntityTypeDependencies(EntityTypeNode entityTypeNode) {
"""
Returns whole tree dependencies of the given entity meta data.
@param entityTypeNode entity meta data node
@return dependencies of the entity meta data node
"""
if (LOG.isTraceEnabled()) {
LOG.trace(
"expandEntityTypeDependencies(EntityTypeNode entityTypeNode) --- entity: [{}], skip: [{}]",
entityTypeNode.getEntityType().getId(),
entityTypeNode.isSkip());
}
if (!entityTypeNode.isSkip()) {
// get referenced entities excluding entities of mappedBy attributes
EntityType entityType = entityTypeNode.getEntityType();
Set<EntityTypeNode> refEntityMetaSet =
stream(entityType.getOwnAllAttributes())
.filter(attribute -> isProcessableAttribute(attribute, entityType))
.flatMap(
attr -> {
EntityTypeNode nodeRef =
new EntityTypeNode(attr.getRefEntity(), entityTypeNode.getStack());
Set<EntityTypeNode> dependenciesRef = expandEntityTypeDependencies(nodeRef);
dependenciesRef.add(nodeRef);
return dependenciesRef.stream();
})
.collect(toCollection(HashSet::new));
EntityType extendsEntityMeta = entityType.getExtends();
if (extendsEntityMeta != null) {
EntityTypeNode nodeRef = new EntityTypeNode(extendsEntityMeta, entityTypeNode.getStack());
// Add extended entity to set
refEntityMetaSet.add(nodeRef);
// Add dependencies of extended entity to set
Set<EntityTypeNode> dependenciesRef = expandEntityTypeDependencies(nodeRef);
refEntityMetaSet.addAll(dependenciesRef);
}
return refEntityMetaSet;
} else {
return Sets.newHashSet();
}
} | java | private static Set<EntityTypeNode> expandEntityTypeDependencies(EntityTypeNode entityTypeNode) {
if (LOG.isTraceEnabled()) {
LOG.trace(
"expandEntityTypeDependencies(EntityTypeNode entityTypeNode) --- entity: [{}], skip: [{}]",
entityTypeNode.getEntityType().getId(),
entityTypeNode.isSkip());
}
if (!entityTypeNode.isSkip()) {
// get referenced entities excluding entities of mappedBy attributes
EntityType entityType = entityTypeNode.getEntityType();
Set<EntityTypeNode> refEntityMetaSet =
stream(entityType.getOwnAllAttributes())
.filter(attribute -> isProcessableAttribute(attribute, entityType))
.flatMap(
attr -> {
EntityTypeNode nodeRef =
new EntityTypeNode(attr.getRefEntity(), entityTypeNode.getStack());
Set<EntityTypeNode> dependenciesRef = expandEntityTypeDependencies(nodeRef);
dependenciesRef.add(nodeRef);
return dependenciesRef.stream();
})
.collect(toCollection(HashSet::new));
EntityType extendsEntityMeta = entityType.getExtends();
if (extendsEntityMeta != null) {
EntityTypeNode nodeRef = new EntityTypeNode(extendsEntityMeta, entityTypeNode.getStack());
// Add extended entity to set
refEntityMetaSet.add(nodeRef);
// Add dependencies of extended entity to set
Set<EntityTypeNode> dependenciesRef = expandEntityTypeDependencies(nodeRef);
refEntityMetaSet.addAll(dependenciesRef);
}
return refEntityMetaSet;
} else {
return Sets.newHashSet();
}
} | [
"private",
"static",
"Set",
"<",
"EntityTypeNode",
">",
"expandEntityTypeDependencies",
"(",
"EntityTypeNode",
"entityTypeNode",
")",
"{",
"if",
"(",
"LOG",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"trace",
"(",
"\"expandEntityTypeDependencies(EntityTy... | Returns whole tree dependencies of the given entity meta data.
@param entityTypeNode entity meta data node
@return dependencies of the entity meta data node | [
"Returns",
"whole",
"tree",
"dependencies",
"of",
"the",
"given",
"entity",
"meta",
"data",
"."
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/EntityTypeDependencyResolver.java#L110-L149 |
JoeKerouac/utils | src/main/java/com/joe/utils/collection/CollectionUtil.java | CollectionUtil.clear | public static <K, V> void clear(Map<K, V> map) {
"""
清空map集合
@param map 要清空的集合(可以为null)
@param <K> map中key的实际类型
@param <V> map中value的实际类型
"""
if (map != null) {
map.clear();
}
} | java | public static <K, V> void clear(Map<K, V> map) {
if (map != null) {
map.clear();
}
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"void",
"clear",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
")",
"{",
"if",
"(",
"map",
"!=",
"null",
")",
"{",
"map",
".",
"clear",
"(",
")",
";",
"}",
"}"
] | 清空map集合
@param map 要清空的集合(可以为null)
@param <K> map中key的实际类型
@param <V> map中value的实际类型 | [
"清空map集合"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/collection/CollectionUtil.java#L390-L394 |
Azure/azure-sdk-for-java | resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentsInner.java | DeploymentsInner.beginCreateOrUpdate | public DeploymentExtendedInner beginCreateOrUpdate(String resourceGroupName, String deploymentName, DeploymentProperties properties) {
"""
Deploys resources to a resource group.
You can provide the template and parameters directly in the request or link to JSON files.
@param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist.
@param deploymentName The name of the deployment.
@param properties The deployment properties.
@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 DeploymentExtendedInner object if successful.
"""
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, properties).toBlocking().single().body();
} | java | public DeploymentExtendedInner beginCreateOrUpdate(String resourceGroupName, String deploymentName, DeploymentProperties properties) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, properties).toBlocking().single().body();
} | [
"public",
"DeploymentExtendedInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"deploymentName",
",",
"DeploymentProperties",
"properties",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"deploym... | Deploys resources to a resource group.
You can provide the template and parameters directly in the request or link to JSON files.
@param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist.
@param deploymentName The name of the deployment.
@param properties The deployment properties.
@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 DeploymentExtendedInner object if successful. | [
"Deploys",
"resources",
"to",
"a",
"resource",
"group",
".",
"You",
"can",
"provide",
"the",
"template",
"and",
"parameters",
"directly",
"in",
"the",
"request",
"or",
"link",
"to",
"JSON",
"files",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentsInner.java#L459-L461 |
JOML-CI/JOML | src/org/joml/Matrix3f.java | Matrix3f.rotateTowards | public Matrix3f rotateTowards(Vector3fc direction, Vector3fc up, Matrix3f dest) {
"""
Apply a model transformation to this matrix for a right-handed coordinate system,
that aligns the local <code>+Z</code> axis with <code>direction</code>
and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookat matrix,
then the new matrix will be <code>M * L</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * L * v</code>,
the lookat transformation will be applied first!
<p>
In order to set the matrix to a rotation transformation without post-multiplying it,
use {@link #rotationTowards(Vector3fc, Vector3fc) rotationTowards()}.
<p>
This method is equivalent to calling: <code>mul(new Matrix3f().lookAlong(new Vector3f(dir).negate(), up).invert(), dest)</code>
@see #rotateTowards(float, float, float, float, float, float, Matrix3f)
@see #rotationTowards(Vector3fc, Vector3fc)
@param direction
the direction to rotate towards
@param up
the model's up vector
@param dest
will hold the result
@return dest
"""
return rotateTowards(direction.x(), direction.y(), direction.z(), up.x(), up.y(), up.z(), dest);
} | java | public Matrix3f rotateTowards(Vector3fc direction, Vector3fc up, Matrix3f dest) {
return rotateTowards(direction.x(), direction.y(), direction.z(), up.x(), up.y(), up.z(), dest);
} | [
"public",
"Matrix3f",
"rotateTowards",
"(",
"Vector3fc",
"direction",
",",
"Vector3fc",
"up",
",",
"Matrix3f",
"dest",
")",
"{",
"return",
"rotateTowards",
"(",
"direction",
".",
"x",
"(",
")",
",",
"direction",
".",
"y",
"(",
")",
",",
"direction",
".",
... | Apply a model transformation to this matrix for a right-handed coordinate system,
that aligns the local <code>+Z</code> axis with <code>direction</code>
and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookat matrix,
then the new matrix will be <code>M * L</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * L * v</code>,
the lookat transformation will be applied first!
<p>
In order to set the matrix to a rotation transformation without post-multiplying it,
use {@link #rotationTowards(Vector3fc, Vector3fc) rotationTowards()}.
<p>
This method is equivalent to calling: <code>mul(new Matrix3f().lookAlong(new Vector3f(dir).negate(), up).invert(), dest)</code>
@see #rotateTowards(float, float, float, float, float, float, Matrix3f)
@see #rotationTowards(Vector3fc, Vector3fc)
@param direction
the direction to rotate towards
@param up
the model's up vector
@param dest
will hold the result
@return dest | [
"Apply",
"a",
"model",
"transformation",
"to",
"this",
"matrix",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"that",
"aligns",
"the",
"local",
"<code",
">",
"+",
"Z<",
"/",
"code",
">",
"axis",
"with",
"<code",
">",
"direction<",
"/",
"co... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L3860-L3862 |
lestard/assertj-javafx | src/main/java/eu/lestard/assertj/javafx/api/NumberBindingAssert.java | NumberBindingAssert.hasValue | public NumberBindingAssert hasValue(Number expectedValue, Offset<Double> offset) {
"""
Verifies that the actual observable number has a value that is close to the given one by less then the given offset.
@param expectedValue the given value to compare the actual observables value to.
@param offset the given positive offset.
@return {@code this} assertion object.
@throws java.lang.NullPointerException if the given offset is <code>null</code>.
@throws java.lang.AssertionError if the actual observables value is not equal to the expected one.
"""
new ObservableNumberValueAssertions(actual).hasValue(expectedValue, offset);
return this;
} | java | public NumberBindingAssert hasValue(Number expectedValue, Offset<Double> offset){
new ObservableNumberValueAssertions(actual).hasValue(expectedValue, offset);
return this;
} | [
"public",
"NumberBindingAssert",
"hasValue",
"(",
"Number",
"expectedValue",
",",
"Offset",
"<",
"Double",
">",
"offset",
")",
"{",
"new",
"ObservableNumberValueAssertions",
"(",
"actual",
")",
".",
"hasValue",
"(",
"expectedValue",
",",
"offset",
")",
";",
"ret... | Verifies that the actual observable number has a value that is close to the given one by less then the given offset.
@param expectedValue the given value to compare the actual observables value to.
@param offset the given positive offset.
@return {@code this} assertion object.
@throws java.lang.NullPointerException if the given offset is <code>null</code>.
@throws java.lang.AssertionError if the actual observables value is not equal to the expected one. | [
"Verifies",
"that",
"the",
"actual",
"observable",
"number",
"has",
"a",
"value",
"that",
"is",
"close",
"to",
"the",
"given",
"one",
"by",
"less",
"then",
"the",
"given",
"offset",
"."
] | train | https://github.com/lestard/assertj-javafx/blob/f6b4d22e542a5501c7c1c2fae8700b0f69b956c1/src/main/java/eu/lestard/assertj/javafx/api/NumberBindingAssert.java#L44-L47 |
Tirasa/ADSDDL | src/main/java/net/tirasa/adsddl/ntsd/dacl/DACLAssertor.java | DACLAssertor.doRequiredFlagsMatch | private boolean doRequiredFlagsMatch(final List<AceFlag> aceFlags, final AceFlag requiredFlag) {
"""
Checks whether the AceFlags attribute of the ACE contains the given AceFlag of the AceAssertion. If the
{@code requiredFlag} is null, yet the {@code aceFlags} are not (or empty), or vice versa, or they do not contain
the required flag, a false result is returned.
@param aceFlags
list of AceFlags from the ACE
@param requiredFlag
AceFlag required by the AceAssertion (e.g., {@code AceFlag.CONTAINER_INHERIT_ACE})
@return true if match, false if not
"""
boolean res = true;
if (requiredFlag != null) {
// aceFlags could be null if the ACE applies to 'this object only' and has no other flags set
if (aceFlags == null || aceFlags.isEmpty() || !aceFlags.contains(requiredFlag)) {
res = false;
}
} else if (aceFlags != null && !aceFlags.isEmpty()) {
res = false;
}
LOG.debug("doRequiredFlagsMatch, result: {}", res);
return res;
} | java | private boolean doRequiredFlagsMatch(final List<AceFlag> aceFlags, final AceFlag requiredFlag) {
boolean res = true;
if (requiredFlag != null) {
// aceFlags could be null if the ACE applies to 'this object only' and has no other flags set
if (aceFlags == null || aceFlags.isEmpty() || !aceFlags.contains(requiredFlag)) {
res = false;
}
} else if (aceFlags != null && !aceFlags.isEmpty()) {
res = false;
}
LOG.debug("doRequiredFlagsMatch, result: {}", res);
return res;
} | [
"private",
"boolean",
"doRequiredFlagsMatch",
"(",
"final",
"List",
"<",
"AceFlag",
">",
"aceFlags",
",",
"final",
"AceFlag",
"requiredFlag",
")",
"{",
"boolean",
"res",
"=",
"true",
";",
"if",
"(",
"requiredFlag",
"!=",
"null",
")",
"{",
"// aceFlags could be... | Checks whether the AceFlags attribute of the ACE contains the given AceFlag of the AceAssertion. If the
{@code requiredFlag} is null, yet the {@code aceFlags} are not (or empty), or vice versa, or they do not contain
the required flag, a false result is returned.
@param aceFlags
list of AceFlags from the ACE
@param requiredFlag
AceFlag required by the AceAssertion (e.g., {@code AceFlag.CONTAINER_INHERIT_ACE})
@return true if match, false if not | [
"Checks",
"whether",
"the",
"AceFlags",
"attribute",
"of",
"the",
"ACE",
"contains",
"the",
"given",
"AceFlag",
"of",
"the",
"AceAssertion",
".",
"If",
"the",
"{",
"@code",
"requiredFlag",
"}",
"is",
"null",
"yet",
"the",
"{",
"@code",
"aceFlags",
"}",
"ar... | train | https://github.com/Tirasa/ADSDDL/blob/16dad53e1222c7faa904c64394af94ba18f6d09c/src/main/java/net/tirasa/adsddl/ntsd/dacl/DACLAssertor.java#L456-L468 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/util/UrlEncoded.java | UrlEncoded.decodeString | public static String decodeString(String encoded) {
"""
Decode String with % encoding.
This method makes the assumption that the majority of calls
will need no decoding and uses the 8859 encoding.
"""
return decodeString(encoded,0,encoded.length(),StringUtil.__ISO_8859_1);
} | java | public static String decodeString(String encoded)
{
return decodeString(encoded,0,encoded.length(),StringUtil.__ISO_8859_1);
} | [
"public",
"static",
"String",
"decodeString",
"(",
"String",
"encoded",
")",
"{",
"return",
"decodeString",
"(",
"encoded",
",",
"0",
",",
"encoded",
".",
"length",
"(",
")",
",",
"StringUtil",
".",
"__ISO_8859_1",
")",
";",
"}"
] | Decode String with % encoding.
This method makes the assumption that the majority of calls
will need no decoding and uses the 8859 encoding. | [
"Decode",
"String",
"with",
"%",
"encoding",
".",
"This",
"method",
"makes",
"the",
"assumption",
"that",
"the",
"majority",
"of",
"calls",
"will",
"need",
"no",
"decoding",
"and",
"uses",
"the",
"8859",
"encoding",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/UrlEncoded.java#L311-L314 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Spies.java | Spies.spy2nd | public static <T1, T2> BiPredicate<T1, T2> spy2nd(BiPredicate<T1, T2> predicate, Box<T2> param2) {
"""
Proxies a binary predicate spying for second parameter.
@param <T1> the predicate first parameter type
@param <T2> the predicate second parameter type
@param predicate the predicate that will be spied
@param param2 a box that will be containing the second spied parameter
@return the proxied predicate
"""
return spy(predicate, Box.<Boolean>empty(), Box.<T1>empty(), param2);
} | java | public static <T1, T2> BiPredicate<T1, T2> spy2nd(BiPredicate<T1, T2> predicate, Box<T2> param2) {
return spy(predicate, Box.<Boolean>empty(), Box.<T1>empty(), param2);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"BiPredicate",
"<",
"T1",
",",
"T2",
">",
"spy2nd",
"(",
"BiPredicate",
"<",
"T1",
",",
"T2",
">",
"predicate",
",",
"Box",
"<",
"T2",
">",
"param2",
")",
"{",
"return",
"spy",
"(",
"predicate",
",",
... | Proxies a binary predicate spying for second parameter.
@param <T1> the predicate first parameter type
@param <T2> the predicate second parameter type
@param predicate the predicate that will be spied
@param param2 a box that will be containing the second spied parameter
@return the proxied predicate | [
"Proxies",
"a",
"binary",
"predicate",
"spying",
"for",
"second",
"parameter",
"."
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Spies.java#L482-L484 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/MetricsUtil.java | MetricsUtil.getContext | public static MetricsContext getContext(String refName, String contextName) {
"""
Utility method to return the named context.
If the desired context cannot be created for any reason, the exception
is logged, and a null context is returned.
"""
MetricsContext metricsContext;
try {
metricsContext =
ContextFactory.getFactory().getContext(refName, contextName);
if (!metricsContext.isMonitoring()) {
metricsContext.startMonitoring();
}
} catch (Exception ex) {
LOG.error("Unable to create metrics context " + contextName, ex);
metricsContext = ContextFactory.getNullContext(contextName);
}
return metricsContext;
} | java | public static MetricsContext getContext(String refName, String contextName) {
MetricsContext metricsContext;
try {
metricsContext =
ContextFactory.getFactory().getContext(refName, contextName);
if (!metricsContext.isMonitoring()) {
metricsContext.startMonitoring();
}
} catch (Exception ex) {
LOG.error("Unable to create metrics context " + contextName, ex);
metricsContext = ContextFactory.getNullContext(contextName);
}
return metricsContext;
} | [
"public",
"static",
"MetricsContext",
"getContext",
"(",
"String",
"refName",
",",
"String",
"contextName",
")",
"{",
"MetricsContext",
"metricsContext",
";",
"try",
"{",
"metricsContext",
"=",
"ContextFactory",
".",
"getFactory",
"(",
")",
".",
"getContext",
"(",... | Utility method to return the named context.
If the desired context cannot be created for any reason, the exception
is logged, and a null context is returned. | [
"Utility",
"method",
"to",
"return",
"the",
"named",
"context",
".",
"If",
"the",
"desired",
"context",
"cannot",
"be",
"created",
"for",
"any",
"reason",
"the",
"exception",
"is",
"logged",
"and",
"a",
"null",
"context",
"is",
"returned",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/MetricsUtil.java#L53-L66 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbAuthentication.java | TmdbAuthentication.getSessionTokenLogin | public TokenAuthorisation getSessionTokenLogin(TokenAuthorisation token, String username, String password) throws MovieDbException {
"""
This method is used to generate a session id for user based
authentication. User must provide their username and password
A session id is required in order to use any of the write methods.
@param token Session token
@param username User's username
@param password User's password
@return
@throws MovieDbException
"""
TmdbParameters parameters = new TmdbParameters();
if (!token.getSuccess()) {
throw new MovieDbException(ApiExceptionType.AUTH_FAILURE, "Authorisation token was not successful!");
}
parameters.add(Param.TOKEN, token.getRequestToken());
parameters.add(Param.USERNAME, username);
parameters.add(Param.PASSWORD, password);
URL url = new ApiUrl(apiKey, MethodBase.AUTH).subMethod(MethodSub.TOKEN_VALIDATE).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, TokenAuthorisation.class);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get Session Token", url, ex);
}
} | java | public TokenAuthorisation getSessionTokenLogin(TokenAuthorisation token, String username, String password) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
if (!token.getSuccess()) {
throw new MovieDbException(ApiExceptionType.AUTH_FAILURE, "Authorisation token was not successful!");
}
parameters.add(Param.TOKEN, token.getRequestToken());
parameters.add(Param.USERNAME, username);
parameters.add(Param.PASSWORD, password);
URL url = new ApiUrl(apiKey, MethodBase.AUTH).subMethod(MethodSub.TOKEN_VALIDATE).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, TokenAuthorisation.class);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get Session Token", url, ex);
}
} | [
"public",
"TokenAuthorisation",
"getSessionTokenLogin",
"(",
"TokenAuthorisation",
"token",
",",
"String",
"username",
",",
"String",
"password",
")",
"throws",
"MovieDbException",
"{",
"TmdbParameters",
"parameters",
"=",
"new",
"TmdbParameters",
"(",
")",
";",
"if",... | This method is used to generate a session id for user based
authentication. User must provide their username and password
A session id is required in order to use any of the write methods.
@param token Session token
@param username User's username
@param password User's password
@return
@throws MovieDbException | [
"This",
"method",
"is",
"used",
"to",
"generate",
"a",
"session",
"id",
"for",
"user",
"based",
"authentication",
".",
"User",
"must",
"provide",
"their",
"username",
"and",
"password"
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbAuthentication.java#L120-L139 |
elki-project/elki | elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/datasource/bundle/MultipleObjectsBundle.java | MultipleObjectsBundle.makeSimple | public static <V1, V2, V3> MultipleObjectsBundle makeSimple(SimpleTypeInformation<? super V1> type1, List<? extends V1> data1, SimpleTypeInformation<? super V2> type2, List<? extends V2> data2, SimpleTypeInformation<? super V3> type3, List<? extends V3> data3) {
"""
Helper to add a single column to the bundle.
@param <V1> First Object type
@param <V2> Second Object type
@param <V3> Third Object type
@param type1 First type information
@param data1 First data column to add
@param type2 Second type information
@param data2 Second data column to add
@param type3 Third type information
@param data3 Third data column to add
"""
MultipleObjectsBundle bundle = new MultipleObjectsBundle();
bundle.appendColumn(type1, data1);
bundle.appendColumn(type2, data2);
bundle.appendColumn(type3, data3);
return bundle;
} | java | public static <V1, V2, V3> MultipleObjectsBundle makeSimple(SimpleTypeInformation<? super V1> type1, List<? extends V1> data1, SimpleTypeInformation<? super V2> type2, List<? extends V2> data2, SimpleTypeInformation<? super V3> type3, List<? extends V3> data3) {
MultipleObjectsBundle bundle = new MultipleObjectsBundle();
bundle.appendColumn(type1, data1);
bundle.appendColumn(type2, data2);
bundle.appendColumn(type3, data3);
return bundle;
} | [
"public",
"static",
"<",
"V1",
",",
"V2",
",",
"V3",
">",
"MultipleObjectsBundle",
"makeSimple",
"(",
"SimpleTypeInformation",
"<",
"?",
"super",
"V1",
">",
"type1",
",",
"List",
"<",
"?",
"extends",
"V1",
">",
"data1",
",",
"SimpleTypeInformation",
"<",
"... | Helper to add a single column to the bundle.
@param <V1> First Object type
@param <V2> Second Object type
@param <V3> Third Object type
@param type1 First type information
@param data1 First data column to add
@param type2 Second type information
@param data2 Second data column to add
@param type3 Third type information
@param data3 Third data column to add | [
"Helper",
"to",
"add",
"a",
"single",
"column",
"to",
"the",
"bundle",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/datasource/bundle/MultipleObjectsBundle.java#L210-L216 |
landawn/AbacusUtil | src/com/landawn/abacus/util/DateUtil.java | DateUtil.truncatedCompareTo | public static int truncatedCompareTo(final java.util.Date date1, final java.util.Date date2, final int field) {
"""
Copied from Apache Commons Lang under Apache License v2.
<br />
Determines how two dates compare up to no more than the specified
most significant field.
@param date1 the first date, not <code>null</code>
@param date2 the second date, not <code>null</code>
@param field the field from <code>Calendar</code>
@return a negative integer, zero, or a positive integer as the first
date is less than, equal to, or greater than the second.
@throws IllegalArgumentException if any argument is <code>null</code>
@see #truncate(Calendar, int)
@see #truncatedCompareTo(Date, Date, int)
@since 3.0
"""
return truncate(date1, field).compareTo(truncate(date2, field));
} | java | public static int truncatedCompareTo(final java.util.Date date1, final java.util.Date date2, final int field) {
return truncate(date1, field).compareTo(truncate(date2, field));
} | [
"public",
"static",
"int",
"truncatedCompareTo",
"(",
"final",
"java",
".",
"util",
".",
"Date",
"date1",
",",
"final",
"java",
".",
"util",
".",
"Date",
"date2",
",",
"final",
"int",
"field",
")",
"{",
"return",
"truncate",
"(",
"date1",
",",
"field",
... | Copied from Apache Commons Lang under Apache License v2.
<br />
Determines how two dates compare up to no more than the specified
most significant field.
@param date1 the first date, not <code>null</code>
@param date2 the second date, not <code>null</code>
@param field the field from <code>Calendar</code>
@return a negative integer, zero, or a positive integer as the first
date is less than, equal to, or greater than the second.
@throws IllegalArgumentException if any argument is <code>null</code>
@see #truncate(Calendar, int)
@see #truncatedCompareTo(Date, Date, int)
@since 3.0 | [
"Copied",
"from",
"Apache",
"Commons",
"Lang",
"under",
"Apache",
"License",
"v2",
".",
"<br",
"/",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L1602-L1604 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/ECKey.java | ECKey.toASN1 | public byte[] toASN1() {
"""
Output this ECKey as an ASN.1 encoded private key, as understood by OpenSSL or used by Bitcoin Core
in its wallet storage format.
@throws org.bitcoinj.core.ECKey.MissingPrivateKeyException if the private key is missing or encrypted.
"""
try {
byte[] privKeyBytes = getPrivKeyBytes();
ByteArrayOutputStream baos = new ByteArrayOutputStream(400);
// ASN1_SEQUENCE(EC_PRIVATEKEY) = {
// ASN1_SIMPLE(EC_PRIVATEKEY, version, LONG),
// ASN1_SIMPLE(EC_PRIVATEKEY, privateKey, ASN1_OCTET_STRING),
// ASN1_EXP_OPT(EC_PRIVATEKEY, parameters, ECPKPARAMETERS, 0),
// ASN1_EXP_OPT(EC_PRIVATEKEY, publicKey, ASN1_BIT_STRING, 1)
// } ASN1_SEQUENCE_END(EC_PRIVATEKEY)
DERSequenceGenerator seq = new DERSequenceGenerator(baos);
seq.addObject(new ASN1Integer(1)); // version
seq.addObject(new DEROctetString(privKeyBytes));
seq.addObject(new DERTaggedObject(0, CURVE_PARAMS.toASN1Primitive()));
seq.addObject(new DERTaggedObject(1, new DERBitString(getPubKey())));
seq.close();
return baos.toByteArray();
} catch (IOException e) {
throw new RuntimeException(e); // Cannot happen, writing to memory stream.
}
} | java | public byte[] toASN1() {
try {
byte[] privKeyBytes = getPrivKeyBytes();
ByteArrayOutputStream baos = new ByteArrayOutputStream(400);
// ASN1_SEQUENCE(EC_PRIVATEKEY) = {
// ASN1_SIMPLE(EC_PRIVATEKEY, version, LONG),
// ASN1_SIMPLE(EC_PRIVATEKEY, privateKey, ASN1_OCTET_STRING),
// ASN1_EXP_OPT(EC_PRIVATEKEY, parameters, ECPKPARAMETERS, 0),
// ASN1_EXP_OPT(EC_PRIVATEKEY, publicKey, ASN1_BIT_STRING, 1)
// } ASN1_SEQUENCE_END(EC_PRIVATEKEY)
DERSequenceGenerator seq = new DERSequenceGenerator(baos);
seq.addObject(new ASN1Integer(1)); // version
seq.addObject(new DEROctetString(privKeyBytes));
seq.addObject(new DERTaggedObject(0, CURVE_PARAMS.toASN1Primitive()));
seq.addObject(new DERTaggedObject(1, new DERBitString(getPubKey())));
seq.close();
return baos.toByteArray();
} catch (IOException e) {
throw new RuntimeException(e); // Cannot happen, writing to memory stream.
}
} | [
"public",
"byte",
"[",
"]",
"toASN1",
"(",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"privKeyBytes",
"=",
"getPrivKeyBytes",
"(",
")",
";",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
"400",
")",
";",
"// ASN1_SEQUENCE(EC_PRIVATEKE... | Output this ECKey as an ASN.1 encoded private key, as understood by OpenSSL or used by Bitcoin Core
in its wallet storage format.
@throws org.bitcoinj.core.ECKey.MissingPrivateKeyException if the private key is missing or encrypted. | [
"Output",
"this",
"ECKey",
"as",
"an",
"ASN",
".",
"1",
"encoded",
"private",
"key",
"as",
"understood",
"by",
"OpenSSL",
"or",
"used",
"by",
"Bitcoin",
"Core",
"in",
"its",
"wallet",
"storage",
"format",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/ECKey.java#L425-L446 |
gini/dropwizard-gelf | src/main/java/net/gini/dropwizard/gelf/filters/GelfLoggingFilter.java | GelfLoggingFilter.doFilter | @Override
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
"""
The <code>doFilter</code> method of the Filter is called by the
container each time a request/response pair is passed through the
chain due to a client request for a resource at the end of the chain.
The FilterChain passed in to this method allows the Filter to pass
on the request and response to the next entity in the chain.
<p>A typical implementation of this method would follow the following
pattern:
<ol>
<li>Examine the request
<li>Optionally wrap the request object with a custom implementation to
filter content or headers for input filtering
<li>Optionally wrap the response object with a custom implementation to
filter content or headers for output filtering
<li>
<ul>
<li><strong>Either</strong> invoke the next entity in the chain
using the FilterChain object
(<code>chain.doFilter()</code>),
<li><strong>or</strong> not pass on the request/response pair to
the next entity in the filter chain to
block the request processing
</ul>
<li>Directly set headers on the response after invocation of the
next entity in the filter chain.
</ol>
"""
// It's quite safe to assume that we only receive HTTP requests
final HttpServletRequest httpRequest = (HttpServletRequest) request;
final HttpServletResponse httpResponse = (HttpServletResponse) response;
final StringBuilder buf = new StringBuilder(256);
final Optional<String> address = Optional.ofNullable(httpRequest.getHeader(HttpHeaders.X_FORWARDED_FOR));
final String clientAddress = address.orElse(request.getRemoteAddr());
buf.append(clientAddress);
buf.append(" - ");
final String authType = httpRequest.getAuthType();
if (authType != null) {
buf.append(httpRequest.getUserPrincipal().getName());
} else {
buf.append("-");
}
buf.append(" \"");
buf.append(httpRequest.getMethod());
buf.append(' ');
buf.append(httpRequest.getRequestURI());
buf.append(' ');
buf.append(request.getProtocol());
buf.append("\" ");
final CountingHttpServletResponseWrapper responseWrapper = new CountingHttpServletResponseWrapper(httpResponse);
final Stopwatch stopwatch = Stopwatch.createUnstarted();
stopwatch.start();
try {
chain.doFilter(request, responseWrapper);
} finally {
if (request.isAsyncStarted()) {
final AsyncListener listener =
new LoggingAsyncListener(buf, stopwatch, authType, clientAddress, httpRequest,
responseWrapper);
request.getAsyncContext().addListener(listener);
} else {
logRequest(buf, stopwatch, authType, clientAddress, httpRequest, responseWrapper);
}
}
} | java | @Override
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
// It's quite safe to assume that we only receive HTTP requests
final HttpServletRequest httpRequest = (HttpServletRequest) request;
final HttpServletResponse httpResponse = (HttpServletResponse) response;
final StringBuilder buf = new StringBuilder(256);
final Optional<String> address = Optional.ofNullable(httpRequest.getHeader(HttpHeaders.X_FORWARDED_FOR));
final String clientAddress = address.orElse(request.getRemoteAddr());
buf.append(clientAddress);
buf.append(" - ");
final String authType = httpRequest.getAuthType();
if (authType != null) {
buf.append(httpRequest.getUserPrincipal().getName());
} else {
buf.append("-");
}
buf.append(" \"");
buf.append(httpRequest.getMethod());
buf.append(' ');
buf.append(httpRequest.getRequestURI());
buf.append(' ');
buf.append(request.getProtocol());
buf.append("\" ");
final CountingHttpServletResponseWrapper responseWrapper = new CountingHttpServletResponseWrapper(httpResponse);
final Stopwatch stopwatch = Stopwatch.createUnstarted();
stopwatch.start();
try {
chain.doFilter(request, responseWrapper);
} finally {
if (request.isAsyncStarted()) {
final AsyncListener listener =
new LoggingAsyncListener(buf, stopwatch, authType, clientAddress, httpRequest,
responseWrapper);
request.getAsyncContext().addListener(listener);
} else {
logRequest(buf, stopwatch, authType, clientAddress, httpRequest, responseWrapper);
}
}
} | [
"@",
"Override",
"public",
"void",
"doFilter",
"(",
"final",
"ServletRequest",
"request",
",",
"final",
"ServletResponse",
"response",
",",
"final",
"FilterChain",
"chain",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"// It's quite safe to assume that we... | The <code>doFilter</code> method of the Filter is called by the
container each time a request/response pair is passed through the
chain due to a client request for a resource at the end of the chain.
The FilterChain passed in to this method allows the Filter to pass
on the request and response to the next entity in the chain.
<p>A typical implementation of this method would follow the following
pattern:
<ol>
<li>Examine the request
<li>Optionally wrap the request object with a custom implementation to
filter content or headers for input filtering
<li>Optionally wrap the response object with a custom implementation to
filter content or headers for output filtering
<li>
<ul>
<li><strong>Either</strong> invoke the next entity in the chain
using the FilterChain object
(<code>chain.doFilter()</code>),
<li><strong>or</strong> not pass on the request/response pair to
the next entity in the filter chain to
block the request processing
</ul>
<li>Directly set headers on the response after invocation of the
next entity in the filter chain.
</ol> | [
"The",
"<code",
">",
"doFilter<",
"/",
"code",
">",
"method",
"of",
"the",
"Filter",
"is",
"called",
"by",
"the",
"container",
"each",
"time",
"a",
"request",
"/",
"response",
"pair",
"is",
"passed",
"through",
"the",
"chain",
"due",
"to",
"a",
"client",... | train | https://github.com/gini/dropwizard-gelf/blob/0182f61b3ebdf417f174f6860d6a813c10853d31/src/main/java/net/gini/dropwizard/gelf/filters/GelfLoggingFilter.java#L83-L129 |
moparisthebest/beehive | beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/AnnotationConstraintValidator.java | AnnotationConstraintValidator.parseDate | public static Date parseDate(String format, String value)
throws ParseException {
"""
Parse a date value into the specified format. Pay special attention to the case of the value
having trailing characters, ex. 12/02/2005xx which will not cause the parse of the date to fail
but should be still treated as an error for our purposes.
@param format Format string for the date.
@param value A String containing the date value to parse.
@return A Date instance if the parse was successful.
@throws ParseException If the value is not a valid date.
"""
SimpleDateFormat sdFormat = new SimpleDateFormat(format);
sdFormat.setLenient(false);
ParsePosition pp = new ParsePosition(0);
Date d = sdFormat.parse(value, pp);
/*
a date value such as: 12/01/2005x will not cause a parse error,
use the parse position to detect this case.
*/
if (d == null || pp.getIndex() < value.length())
throw new ParseException("Parsing date value, "
+ value
+ ", failed at index " + pp.getIndex(), pp.getIndex());
else return d;
} | java | public static Date parseDate(String format, String value)
throws ParseException {
SimpleDateFormat sdFormat = new SimpleDateFormat(format);
sdFormat.setLenient(false);
ParsePosition pp = new ParsePosition(0);
Date d = sdFormat.parse(value, pp);
/*
a date value such as: 12/01/2005x will not cause a parse error,
use the parse position to detect this case.
*/
if (d == null || pp.getIndex() < value.length())
throw new ParseException("Parsing date value, "
+ value
+ ", failed at index " + pp.getIndex(), pp.getIndex());
else return d;
} | [
"public",
"static",
"Date",
"parseDate",
"(",
"String",
"format",
",",
"String",
"value",
")",
"throws",
"ParseException",
"{",
"SimpleDateFormat",
"sdFormat",
"=",
"new",
"SimpleDateFormat",
"(",
"format",
")",
";",
"sdFormat",
".",
"setLenient",
"(",
"false",
... | Parse a date value into the specified format. Pay special attention to the case of the value
having trailing characters, ex. 12/02/2005xx which will not cause the parse of the date to fail
but should be still treated as an error for our purposes.
@param format Format string for the date.
@param value A String containing the date value to parse.
@return A Date instance if the parse was successful.
@throws ParseException If the value is not a valid date. | [
"Parse",
"a",
"date",
"value",
"into",
"the",
"specified",
"format",
".",
"Pay",
"special",
"attention",
"to",
"the",
"case",
"of",
"the",
"value",
"having",
"trailing",
"characters",
"ex",
".",
"12",
"/",
"02",
"/",
"2005xx",
"which",
"will",
"not",
"ca... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/AnnotationConstraintValidator.java#L402-L419 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/UtilReflection.java | UtilReflection.setAccessible | public static void setAccessible(AccessibleObject object, boolean accessible) {
"""
Set the object accessibility with an access controller.
@param object The accessible object (must not be <code>null</code>).
@param accessible <code>true</code> if accessible, <code>false</code> else.
@throws LionEngineException If invalid parameters or field not found.
"""
Check.notNull(object);
if (object.isAccessible() != accessible)
{
java.security.AccessController.doPrivileged((PrivilegedAction<Void>) () ->
{
object.setAccessible(accessible);
return null;
});
}
} | java | public static void setAccessible(AccessibleObject object, boolean accessible)
{
Check.notNull(object);
if (object.isAccessible() != accessible)
{
java.security.AccessController.doPrivileged((PrivilegedAction<Void>) () ->
{
object.setAccessible(accessible);
return null;
});
}
} | [
"public",
"static",
"void",
"setAccessible",
"(",
"AccessibleObject",
"object",
",",
"boolean",
"accessible",
")",
"{",
"Check",
".",
"notNull",
"(",
"object",
")",
";",
"if",
"(",
"object",
".",
"isAccessible",
"(",
")",
"!=",
"accessible",
")",
"{",
"jav... | Set the object accessibility with an access controller.
@param object The accessible object (must not be <code>null</code>).
@param accessible <code>true</code> if accessible, <code>false</code> else.
@throws LionEngineException If invalid parameters or field not found. | [
"Set",
"the",
"object",
"accessibility",
"with",
"an",
"access",
"controller",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilReflection.java#L281-L293 |
apache/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/StatementExecutor.java | StatementExecutor.executeQuery | public List<QueryResult> executeQuery() throws SQLException {
"""
Execute query.
@return result set list
@throws SQLException SQL exception
"""
final boolean isExceptionThrown = ExecutorExceptionHandler.isExceptionThrown();
SQLExecuteCallback<QueryResult> executeCallback = new SQLExecuteCallback<QueryResult>(getDatabaseType(), isExceptionThrown) {
@Override
protected QueryResult executeSQL(final RouteUnit routeUnit, final Statement statement, final ConnectionMode connectionMode) throws SQLException {
return getQueryResult(routeUnit, statement, connectionMode);
}
};
return executeCallback(executeCallback);
} | java | public List<QueryResult> executeQuery() throws SQLException {
final boolean isExceptionThrown = ExecutorExceptionHandler.isExceptionThrown();
SQLExecuteCallback<QueryResult> executeCallback = new SQLExecuteCallback<QueryResult>(getDatabaseType(), isExceptionThrown) {
@Override
protected QueryResult executeSQL(final RouteUnit routeUnit, final Statement statement, final ConnectionMode connectionMode) throws SQLException {
return getQueryResult(routeUnit, statement, connectionMode);
}
};
return executeCallback(executeCallback);
} | [
"public",
"List",
"<",
"QueryResult",
">",
"executeQuery",
"(",
")",
"throws",
"SQLException",
"{",
"final",
"boolean",
"isExceptionThrown",
"=",
"ExecutorExceptionHandler",
".",
"isExceptionThrown",
"(",
")",
";",
"SQLExecuteCallback",
"<",
"QueryResult",
">",
"exe... | Execute query.
@return result set list
@throws SQLException SQL exception | [
"Execute",
"query",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/StatementExecutor.java#L90-L100 |
jenkinsci/jenkins | core/src/main/java/hudson/model/AbstractProject.java | AbstractProject.scheduleBuild2 | @WithBridgeMethods(Future.class)
public QueueTaskFuture<R> scheduleBuild2(int quietPeriod, Cause c) {
"""
Schedules a build of this project, and returns a {@link Future} object
to wait for the completion of the build.
"""
return scheduleBuild2(quietPeriod, c, new Action[0]);
} | java | @WithBridgeMethods(Future.class)
public QueueTaskFuture<R> scheduleBuild2(int quietPeriod, Cause c) {
return scheduleBuild2(quietPeriod, c, new Action[0]);
} | [
"@",
"WithBridgeMethods",
"(",
"Future",
".",
"class",
")",
"public",
"QueueTaskFuture",
"<",
"R",
">",
"scheduleBuild2",
"(",
"int",
"quietPeriod",
",",
"Cause",
"c",
")",
"{",
"return",
"scheduleBuild2",
"(",
"quietPeriod",
",",
"c",
",",
"new",
"Action",
... | Schedules a build of this project, and returns a {@link Future} object
to wait for the completion of the build. | [
"Schedules",
"a",
"build",
"of",
"this",
"project",
"and",
"returns",
"a",
"{"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/AbstractProject.java#L846-L849 |
google/identity-toolkit-java-client | src/main/java/com/google/identitytoolkit/GitkitClient.java | GitkitClient.createFromJson | public static GitkitClient createFromJson(String configPath, Proxy proxy)
throws GitkitClientException, JSONException, IOException {
"""
Constructs a Gitkit client from a JSON config file
@param configPath Path to JSON configuration file
@param proxy the Proxy object to use when using Gitkit client behind a proxy
@return Gitkit client
"""
JSONObject configData =
new JSONObject(
StandardCharsets.UTF_8.decode(
ByteBuffer.wrap(Files.readAllBytes(Paths.get(configPath))))
.toString());
if (!configData.has("clientId") && !configData.has("projectId")) {
throw new GitkitClientException("Missing projectId or clientId in server configuration.");
}
return new GitkitClient.Builder()
.setProxy(proxy)
.setGoogleClientId(configData.optString("clientId", null))
.setProjectId(configData.optString("projectId", null))
.setServiceAccountEmail(configData.optString("serviceAccountEmail", null))
.setKeyStream(configData.has("serviceAccountPrivateKeyFile")
? new FileInputStream(configData.getString("serviceAccountPrivateKeyFile"))
: null)
.setWidgetUrl(configData.optString("widgetUrl", null))
.setCookieName(configData.optString("cookieName", "gtoken"))
.build();
} | java | public static GitkitClient createFromJson(String configPath, Proxy proxy)
throws GitkitClientException, JSONException, IOException {
JSONObject configData =
new JSONObject(
StandardCharsets.UTF_8.decode(
ByteBuffer.wrap(Files.readAllBytes(Paths.get(configPath))))
.toString());
if (!configData.has("clientId") && !configData.has("projectId")) {
throw new GitkitClientException("Missing projectId or clientId in server configuration.");
}
return new GitkitClient.Builder()
.setProxy(proxy)
.setGoogleClientId(configData.optString("clientId", null))
.setProjectId(configData.optString("projectId", null))
.setServiceAccountEmail(configData.optString("serviceAccountEmail", null))
.setKeyStream(configData.has("serviceAccountPrivateKeyFile")
? new FileInputStream(configData.getString("serviceAccountPrivateKeyFile"))
: null)
.setWidgetUrl(configData.optString("widgetUrl", null))
.setCookieName(configData.optString("cookieName", "gtoken"))
.build();
} | [
"public",
"static",
"GitkitClient",
"createFromJson",
"(",
"String",
"configPath",
",",
"Proxy",
"proxy",
")",
"throws",
"GitkitClientException",
",",
"JSONException",
",",
"IOException",
"{",
"JSONObject",
"configData",
"=",
"new",
"JSONObject",
"(",
"StandardCharset... | Constructs a Gitkit client from a JSON config file
@param configPath Path to JSON configuration file
@param proxy the Proxy object to use when using Gitkit client behind a proxy
@return Gitkit client | [
"Constructs",
"a",
"Gitkit",
"client",
"from",
"a",
"JSON",
"config",
"file"
] | train | https://github.com/google/identity-toolkit-java-client/blob/61dda1aabbd541ad5e431e840fd266bfca5f8a4a/src/main/java/com/google/identitytoolkit/GitkitClient.java#L131-L152 |
JOML-CI/JOML | src/org/joml/Vector3d.java | Vector3d.setComponent | public Vector3d setComponent(int component, double value) throws IllegalArgumentException {
"""
Set the value of the specified component of this vector.
@param component
the component whose value to set, within <code>[0..2]</code>
@param value
the value to set
@return this
@throws IllegalArgumentException if <code>component</code> is not within <code>[0..2]</code>
"""
switch (component) {
case 0:
x = value;
break;
case 1:
y = value;
break;
case 2:
z = value;
break;
default:
throw new IllegalArgumentException();
}
return this;
} | java | public Vector3d setComponent(int component, double value) throws IllegalArgumentException {
switch (component) {
case 0:
x = value;
break;
case 1:
y = value;
break;
case 2:
z = value;
break;
default:
throw new IllegalArgumentException();
}
return this;
} | [
"public",
"Vector3d",
"setComponent",
"(",
"int",
"component",
",",
"double",
"value",
")",
"throws",
"IllegalArgumentException",
"{",
"switch",
"(",
"component",
")",
"{",
"case",
"0",
":",
"x",
"=",
"value",
";",
"break",
";",
"case",
"1",
":",
"y",
"=... | Set the value of the specified component of this vector.
@param component
the component whose value to set, within <code>[0..2]</code>
@param value
the value to set
@return this
@throws IllegalArgumentException if <code>component</code> is not within <code>[0..2]</code> | [
"Set",
"the",
"value",
"of",
"the",
"specified",
"component",
"of",
"this",
"vector",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector3d.java#L464-L479 |
knowm/XChange | xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseAccountServiceRaw.java | CoinbaseAccountServiceRaw.getCoinbaseAccounts | public List<CoinbaseAccount> getCoinbaseAccounts() throws IOException {
"""
Authenticated resource that shows the current user accounts.
@see <a
href="https://developers.coinbase.com/api/v2#list-accounts">developers.coinbase.com/api/v2#list-accounts</a>
"""
String apiKey = exchange.getExchangeSpecification().getApiKey();
BigDecimal timestamp = coinbase.getTime(Coinbase.CB_VERSION_VALUE).getData().getEpoch();
return coinbase
.getAccounts(Coinbase.CB_VERSION_VALUE, apiKey, signatureCreator2, timestamp)
.getData();
} | java | public List<CoinbaseAccount> getCoinbaseAccounts() throws IOException {
String apiKey = exchange.getExchangeSpecification().getApiKey();
BigDecimal timestamp = coinbase.getTime(Coinbase.CB_VERSION_VALUE).getData().getEpoch();
return coinbase
.getAccounts(Coinbase.CB_VERSION_VALUE, apiKey, signatureCreator2, timestamp)
.getData();
} | [
"public",
"List",
"<",
"CoinbaseAccount",
">",
"getCoinbaseAccounts",
"(",
")",
"throws",
"IOException",
"{",
"String",
"apiKey",
"=",
"exchange",
".",
"getExchangeSpecification",
"(",
")",
".",
"getApiKey",
"(",
")",
";",
"BigDecimal",
"timestamp",
"=",
"coinba... | Authenticated resource that shows the current user accounts.
@see <a
href="https://developers.coinbase.com/api/v2#list-accounts">developers.coinbase.com/api/v2#list-accounts</a> | [
"Authenticated",
"resource",
"that",
"shows",
"the",
"current",
"user",
"accounts",
"."
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseAccountServiceRaw.java#L52-L59 |
korpling/ANNIS | annis-service/src/main/java/annis/administration/AdministrationDao.java | AdministrationDao.importCorpus | @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW,
isolation = Isolation.READ_COMMITTED)
public boolean importCorpus(String path,
String aliasName,
boolean overwrite,
boolean waitForOtherTasks) {
"""
Reads ANNIS files from several directories.
@param path Specifies the path to the corpora, which should be imported.
@param aliasName An alias name for this corpus. Can be null.
@param overwrite If set to true conflicting top level corpora are deleted.
@param waitForOtherTasks If true wait for other tasks to finish, if false
abort.
@return true if successful
"""
// check schema version first
checkDatabaseSchemaVersion();
if (!lockRepositoryMetadataTable(waitForOtherTasks))
{
log.error("Another import is currently running");
return false;
}
// explicitly unset any timeout
getJdbcTemplate().update("SET statement_timeout TO 0");
ANNISFormatVersion annisFormatVersion = getANNISFormatVersion(path);
if (annisFormatVersion == ANNISFormatVersion.V3_3)
{
return importVersion4(path, aliasName, overwrite, annisFormatVersion);
}
else if (annisFormatVersion == ANNISFormatVersion.V3_1 || annisFormatVersion
== ANNISFormatVersion.V3_2)
{
return importVersion3(path, aliasName, overwrite, annisFormatVersion);
}
log.error("Unknown ANNIS import format version");
return false;
} | java | @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW,
isolation = Isolation.READ_COMMITTED)
public boolean importCorpus(String path,
String aliasName,
boolean overwrite,
boolean waitForOtherTasks)
{
// check schema version first
checkDatabaseSchemaVersion();
if (!lockRepositoryMetadataTable(waitForOtherTasks))
{
log.error("Another import is currently running");
return false;
}
// explicitly unset any timeout
getJdbcTemplate().update("SET statement_timeout TO 0");
ANNISFormatVersion annisFormatVersion = getANNISFormatVersion(path);
if (annisFormatVersion == ANNISFormatVersion.V3_3)
{
return importVersion4(path, aliasName, overwrite, annisFormatVersion);
}
else if (annisFormatVersion == ANNISFormatVersion.V3_1 || annisFormatVersion
== ANNISFormatVersion.V3_2)
{
return importVersion3(path, aliasName, overwrite, annisFormatVersion);
}
log.error("Unknown ANNIS import format version");
return false;
} | [
"@",
"Transactional",
"(",
"readOnly",
"=",
"false",
",",
"propagation",
"=",
"Propagation",
".",
"REQUIRES_NEW",
",",
"isolation",
"=",
"Isolation",
".",
"READ_COMMITTED",
")",
"public",
"boolean",
"importCorpus",
"(",
"String",
"path",
",",
"String",
"aliasNam... | Reads ANNIS files from several directories.
@param path Specifies the path to the corpora, which should be imported.
@param aliasName An alias name for this corpus. Can be null.
@param overwrite If set to true conflicting top level corpora are deleted.
@param waitForOtherTasks If true wait for other tasks to finish, if false
abort.
@return true if successful | [
"Reads",
"ANNIS",
"files",
"from",
"several",
"directories",
"."
] | train | https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-service/src/main/java/annis/administration/AdministrationDao.java#L534-L568 |
tango-controls/JTango | server/src/main/java/org/tango/server/attribute/AttributeValue.java | AttributeValue.setValue | @Override
public void setValue(final Object value, final long time) throws DevFailed {
"""
Set Value and time. cf {@link #setValue(Object)} for details
@param value
@param time
@throws DevFailed
"""
this.setValue(value);
this.setTime(time);
} | java | @Override
public void setValue(final Object value, final long time) throws DevFailed {
this.setValue(value);
this.setTime(time);
} | [
"@",
"Override",
"public",
"void",
"setValue",
"(",
"final",
"Object",
"value",
",",
"final",
"long",
"time",
")",
"throws",
"DevFailed",
"{",
"this",
".",
"setValue",
"(",
"value",
")",
";",
"this",
".",
"setTime",
"(",
"time",
")",
";",
"}"
] | Set Value and time. cf {@link #setValue(Object)} for details
@param value
@param time
@throws DevFailed | [
"Set",
"Value",
"and",
"time",
".",
"cf",
"{",
"@link",
"#setValue",
"(",
"Object",
")",
"}",
"for",
"details"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/attribute/AttributeValue.java#L156-L160 |
wnameless/rubycollect4j | src/main/java/net/sf/rubycollect4j/RubyObject.java | RubyObject.send | public static <E> E send(Object o, String methodName, Double arg) {
"""
Executes a method of any Object by Java reflection.
@param o
an Object
@param methodName
name of the method
@param arg
a Double
@return the result of the method called
"""
return send(o, methodName, (Object) arg);
} | java | public static <E> E send(Object o, String methodName, Double arg) {
return send(o, methodName, (Object) arg);
} | [
"public",
"static",
"<",
"E",
">",
"E",
"send",
"(",
"Object",
"o",
",",
"String",
"methodName",
",",
"Double",
"arg",
")",
"{",
"return",
"send",
"(",
"o",
",",
"methodName",
",",
"(",
"Object",
")",
"arg",
")",
";",
"}"
] | Executes a method of any Object by Java reflection.
@param o
an Object
@param methodName
name of the method
@param arg
a Double
@return the result of the method called | [
"Executes",
"a",
"method",
"of",
"any",
"Object",
"by",
"Java",
"reflection",
"."
] | train | https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/RubyObject.java#L291-L293 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/io/SynchronizedIO.java | SynchronizedIO.writeFile | public void writeFile(String aFileName, String aData) throws IOException {
"""
Write string file data
@param aFileName the file name
@param aData the data to write
@throws IOException when an IO error occurs
"""
Object lock = retrieveLock(aFileName);
synchronized (lock)
{
IO.writeFile(aFileName, aData,IO.CHARSET);
}
} | java | public void writeFile(String aFileName, String aData) throws IOException
{
Object lock = retrieveLock(aFileName);
synchronized (lock)
{
IO.writeFile(aFileName, aData,IO.CHARSET);
}
} | [
"public",
"void",
"writeFile",
"(",
"String",
"aFileName",
",",
"String",
"aData",
")",
"throws",
"IOException",
"{",
"Object",
"lock",
"=",
"retrieveLock",
"(",
"aFileName",
")",
";",
"synchronized",
"(",
"lock",
")",
"{",
"IO",
".",
"writeFile",
"(",
"aF... | Write string file data
@param aFileName the file name
@param aData the data to write
@throws IOException when an IO error occurs | [
"Write",
"string",
"file",
"data"
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/io/SynchronizedIO.java#L118-L126 |
wuman/orientdb-android | client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java | OServerAdmin.replicationStop | public synchronized OServerAdmin replicationStop(final String iDatabaseName, final String iRemoteServer) throws IOException {
"""
Stops the replication between two servers.
@param iDatabaseName
database name to replicate
@param iRemoteServer
remote server alias as IP+address
@return The instance itself. Useful to execute method in chain
@throws IOException
"""
sendRequest(OChannelBinaryProtocol.REQUEST_REPLICATION, new ODocument().field("operation", "stop").field("node", iRemoteServer)
.field("db", iDatabaseName), "Stop replication");
OLogManager.instance().debug(this, "Stopped replication of database '%s' from server '%s' to '%s'", iDatabaseName,
storage.getURL(), iRemoteServer);
return this;
} | java | public synchronized OServerAdmin replicationStop(final String iDatabaseName, final String iRemoteServer) throws IOException {
sendRequest(OChannelBinaryProtocol.REQUEST_REPLICATION, new ODocument().field("operation", "stop").field("node", iRemoteServer)
.field("db", iDatabaseName), "Stop replication");
OLogManager.instance().debug(this, "Stopped replication of database '%s' from server '%s' to '%s'", iDatabaseName,
storage.getURL(), iRemoteServer);
return this;
} | [
"public",
"synchronized",
"OServerAdmin",
"replicationStop",
"(",
"final",
"String",
"iDatabaseName",
",",
"final",
"String",
"iRemoteServer",
")",
"throws",
"IOException",
"{",
"sendRequest",
"(",
"OChannelBinaryProtocol",
".",
"REQUEST_REPLICATION",
",",
"new",
"ODocu... | Stops the replication between two servers.
@param iDatabaseName
database name to replicate
@param iRemoteServer
remote server alias as IP+address
@return The instance itself. Useful to execute method in chain
@throws IOException | [
"Stops",
"the",
"replication",
"between",
"two",
"servers",
"."
] | train | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java#L377-L384 |
james-hu/jabb-core | src/main/java/net/sf/jabb/util/text/word/Dictionary.java | Dictionary.addWord | public void addWord(Word newWord, boolean makeCopy) {
"""
加入一个新词条,如果这个词条在词典中已经存在,则合并。
<p>
Add a new word, if this word already exists in the dictionary then the new definition will
be merged into existing one.
@param newWord
@param makeCopy 是否复制词条对象,而非引用
<br>Whether or not to copy the Word object, rather than to refer it.
"""
synchronized(words){
Word existingWord = words.get(newWord.getWord());
if (existingWord != null){
existingWord.setType(newWord.getTypes());
existingWord.setKeywordAttachment(newWord.getKeywordAttachment());
}else{
if (makeCopy){
newWord = new Word(newWord);
}
words.put(newWord.getWord(), newWord);
}
}
} | java | public void addWord(Word newWord, boolean makeCopy){
synchronized(words){
Word existingWord = words.get(newWord.getWord());
if (existingWord != null){
existingWord.setType(newWord.getTypes());
existingWord.setKeywordAttachment(newWord.getKeywordAttachment());
}else{
if (makeCopy){
newWord = new Word(newWord);
}
words.put(newWord.getWord(), newWord);
}
}
} | [
"public",
"void",
"addWord",
"(",
"Word",
"newWord",
",",
"boolean",
"makeCopy",
")",
"{",
"synchronized",
"(",
"words",
")",
"{",
"Word",
"existingWord",
"=",
"words",
".",
"get",
"(",
"newWord",
".",
"getWord",
"(",
")",
")",
";",
"if",
"(",
"existin... | 加入一个新词条,如果这个词条在词典中已经存在,则合并。
<p>
Add a new word, if this word already exists in the dictionary then the new definition will
be merged into existing one.
@param newWord
@param makeCopy 是否复制词条对象,而非引用
<br>Whether or not to copy the Word object, rather than to refer it. | [
"加入一个新词条,如果这个词条在词典中已经存在,则合并。",
"<p",
">",
"Add",
"a",
"new",
"word",
"if",
"this",
"word",
"already",
"exists",
"in",
"the",
"dictionary",
"then",
"the",
"new",
"definition",
"will",
"be",
"merged",
"into",
"existing",
"one",
"."
] | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/text/word/Dictionary.java#L79-L92 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/impl/config/resilience/DefaultResilienceStrategyProviderConfiguration.java | DefaultResilienceStrategyProviderConfiguration.addResilienceStrategyFor | @SuppressWarnings("rawtypes")
public DefaultResilienceStrategyProviderConfiguration addResilienceStrategyFor(String alias, Class<? extends ResilienceStrategy> clazz, Object... arguments) {
"""
Adds a {@link ResilienceStrategy} class and associated constructor arguments to be used with a cache matching
the provided alias.
<p>
The provided class must have a constructor compatible with the supplied arguments followed by either the cache's
{@code RecoveryStore}, or the cache's {@code RecoveryStore} and {@code CacheLoaderWriter}.
@param alias the cache alias
@param clazz the resilience strategy class
@param arguments the constructor arguments
@return this configuration instance
"""
getDefaults().put(alias, new DefaultResilienceStrategyConfiguration(clazz, arguments));
return this;
} | java | @SuppressWarnings("rawtypes")
public DefaultResilienceStrategyProviderConfiguration addResilienceStrategyFor(String alias, Class<? extends ResilienceStrategy> clazz, Object... arguments) {
getDefaults().put(alias, new DefaultResilienceStrategyConfiguration(clazz, arguments));
return this;
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"DefaultResilienceStrategyProviderConfiguration",
"addResilienceStrategyFor",
"(",
"String",
"alias",
",",
"Class",
"<",
"?",
"extends",
"ResilienceStrategy",
">",
"clazz",
",",
"Object",
"...",
"arguments",
"... | Adds a {@link ResilienceStrategy} class and associated constructor arguments to be used with a cache matching
the provided alias.
<p>
The provided class must have a constructor compatible with the supplied arguments followed by either the cache's
{@code RecoveryStore}, or the cache's {@code RecoveryStore} and {@code CacheLoaderWriter}.
@param alias the cache alias
@param clazz the resilience strategy class
@param arguments the constructor arguments
@return this configuration instance | [
"Adds",
"a",
"{",
"@link",
"ResilienceStrategy",
"}",
"class",
"and",
"associated",
"constructor",
"arguments",
"to",
"be",
"used",
"with",
"a",
"cache",
"matching",
"the",
"provided",
"alias",
".",
"<p",
">",
"The",
"provided",
"class",
"must",
"have",
"a",... | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/config/resilience/DefaultResilienceStrategyProviderConfiguration.java#L139-L143 |
sagiegurari/fax4j | src/main/java/org/fax4j/bridge/FaxBridgeFlowHelper.java | FaxBridgeFlowHelper.submitFaxJob | public FlowResponse submitFaxJob(T inputData,Object contextData,boolean invokeVendorPolicy) {
"""
This function invokes the submit fax job flow.<br>
As part of the flow, if requested, the vendor policy would be invoked as well.
@param inputData
The input data for the fax bridge
@param contextData
The conext data used by the vendor policy (may be same as the input data)
@param invokeVendorPolicy
True to invoke the vendor policy
@return The flow response
"""
boolean continueFlow=true;
VendorPolicy vendorPolicy=null;
if(invokeVendorPolicy)
{
//get vendor policy
vendorPolicy=this.FAX_BRIDGE.getVendorPolicy();
//invoke policy
continueFlow=vendorPolicy.invokePolicyForRequest(contextData);
}
FaxJob faxJob=null;
if(continueFlow)
{
//submit fax
faxJob=this.FAX_BRIDGE.submitFaxJob(inputData);
if(invokeVendorPolicy)
{
//invoke policy
continueFlow=vendorPolicy.invokePolicyForResponse(contextData,faxJob);
}
}
//create response
FlowResponse flowResponse=new FlowResponse(faxJob,continueFlow);
return flowResponse;
} | java | public FlowResponse submitFaxJob(T inputData,Object contextData,boolean invokeVendorPolicy)
{
boolean continueFlow=true;
VendorPolicy vendorPolicy=null;
if(invokeVendorPolicy)
{
//get vendor policy
vendorPolicy=this.FAX_BRIDGE.getVendorPolicy();
//invoke policy
continueFlow=vendorPolicy.invokePolicyForRequest(contextData);
}
FaxJob faxJob=null;
if(continueFlow)
{
//submit fax
faxJob=this.FAX_BRIDGE.submitFaxJob(inputData);
if(invokeVendorPolicy)
{
//invoke policy
continueFlow=vendorPolicy.invokePolicyForResponse(contextData,faxJob);
}
}
//create response
FlowResponse flowResponse=new FlowResponse(faxJob,continueFlow);
return flowResponse;
} | [
"public",
"FlowResponse",
"submitFaxJob",
"(",
"T",
"inputData",
",",
"Object",
"contextData",
",",
"boolean",
"invokeVendorPolicy",
")",
"{",
"boolean",
"continueFlow",
"=",
"true",
";",
"VendorPolicy",
"vendorPolicy",
"=",
"null",
";",
"if",
"(",
"invokeVendorPo... | This function invokes the submit fax job flow.<br>
As part of the flow, if requested, the vendor policy would be invoked as well.
@param inputData
The input data for the fax bridge
@param contextData
The conext data used by the vendor policy (may be same as the input data)
@param invokeVendorPolicy
True to invoke the vendor policy
@return The flow response | [
"This",
"function",
"invokes",
"the",
"submit",
"fax",
"job",
"flow",
".",
"<br",
">",
"As",
"part",
"of",
"the",
"flow",
"if",
"requested",
"the",
"vendor",
"policy",
"would",
"be",
"invoked",
"as",
"well",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/bridge/FaxBridgeFlowHelper.java#L66-L96 |
cache2k/cache2k | cache2k-spring/src/main/java/org/cache2k/extra/spring/SpringLoadingCache2kCache.java | SpringLoadingCache2kCache.get | @SuppressWarnings("unchecked")
@Override
public <T> T get(final Object key, final Callable<T> valueLoader) {
"""
<p>Ignore the {@code valueLoader} parameter in case a loader is present. This makes
sure the loader is consistently used and we make use of the cache2k features
refresh ahead and resilience. Does not wrap into {@link org.springframework.cache.Cache.ValueRetrievalException}
intentionally, since this is only needed if the callable is used.
"""
return (T) cache.get(key);
} | java | @SuppressWarnings("unchecked")
@Override
public <T> T get(final Object key, final Callable<T> valueLoader) {
return (T) cache.get(key);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"get",
"(",
"final",
"Object",
"key",
",",
"final",
"Callable",
"<",
"T",
">",
"valueLoader",
")",
"{",
"return",
"(",
"T",
")",
"cache",
".",
"get",
"... | <p>Ignore the {@code valueLoader} parameter in case a loader is present. This makes
sure the loader is consistently used and we make use of the cache2k features
refresh ahead and resilience. Does not wrap into {@link org.springframework.cache.Cache.ValueRetrievalException}
intentionally, since this is only needed if the callable is used. | [
"<p",
">",
"Ignore",
"the",
"{"
] | train | https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-spring/src/main/java/org/cache2k/extra/spring/SpringLoadingCache2kCache.java#L44-L48 |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/util/ThreadUtil.java | ThreadUtil.getThreadFactory | public static ThreadFactory getThreadFactory(String nameFormat, boolean daemon) {
"""
Get a {@link ThreadFactory} suitable for use in the current environment.
@param nameFormat to apply to threads created by the factory.
@param daemon {@code true} if the threads the factory creates are daemon threads, {@code false}
otherwise.
@return a {@link ThreadFactory}.
"""
if (PlatformInformation.isOnGAEStandard7() || PlatformInformation.isOnGAEStandard8()) {
return MoreExecutors.platformThreadFactory();
} else {
return new ThreadFactoryBuilder()
.setDaemon(daemon)
.setNameFormat(nameFormat)
.build();
}
} | java | public static ThreadFactory getThreadFactory(String nameFormat, boolean daemon) {
if (PlatformInformation.isOnGAEStandard7() || PlatformInformation.isOnGAEStandard8()) {
return MoreExecutors.platformThreadFactory();
} else {
return new ThreadFactoryBuilder()
.setDaemon(daemon)
.setNameFormat(nameFormat)
.build();
}
} | [
"public",
"static",
"ThreadFactory",
"getThreadFactory",
"(",
"String",
"nameFormat",
",",
"boolean",
"daemon",
")",
"{",
"if",
"(",
"PlatformInformation",
".",
"isOnGAEStandard7",
"(",
")",
"||",
"PlatformInformation",
".",
"isOnGAEStandard8",
"(",
")",
")",
"{",... | Get a {@link ThreadFactory} suitable for use in the current environment.
@param nameFormat to apply to threads created by the factory.
@param daemon {@code true} if the threads the factory creates are daemon threads, {@code false}
otherwise.
@return a {@link ThreadFactory}. | [
"Get",
"a",
"{"
] | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/util/ThreadUtil.java#L38-L47 |
square/okhttp | mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.java | MockResponse.throttleBody | public MockResponse throttleBody(long bytesPerPeriod, long period, TimeUnit unit) {
"""
Throttles the request reader and response writer to sleep for the given period after each
series of {@code bytesPerPeriod} bytes are transferred. Use this to simulate network behavior.
"""
this.throttleBytesPerPeriod = bytesPerPeriod;
this.throttlePeriodAmount = period;
this.throttlePeriodUnit = unit;
return this;
} | java | public MockResponse throttleBody(long bytesPerPeriod, long period, TimeUnit unit) {
this.throttleBytesPerPeriod = bytesPerPeriod;
this.throttlePeriodAmount = period;
this.throttlePeriodUnit = unit;
return this;
} | [
"public",
"MockResponse",
"throttleBody",
"(",
"long",
"bytesPerPeriod",
",",
"long",
"period",
",",
"TimeUnit",
"unit",
")",
"{",
"this",
".",
"throttleBytesPerPeriod",
"=",
"bytesPerPeriod",
";",
"this",
".",
"throttlePeriodAmount",
"=",
"period",
";",
"this",
... | Throttles the request reader and response writer to sleep for the given period after each
series of {@code bytesPerPeriod} bytes are transferred. Use this to simulate network behavior. | [
"Throttles",
"the",
"request",
"reader",
"and",
"response",
"writer",
"to",
"sleep",
"for",
"the",
"given",
"period",
"after",
"each",
"series",
"of",
"{"
] | train | https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.java#L256-L261 |
rterp/GMapsFX | GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptArray.java | JavascriptArray.indexOf | public int indexOf(Object obj) {
"""
indexOf() Search the array for an element and returns its position
"""
if (obj instanceof JavascriptObject) {
return checkInteger(invokeJavascript("indexOf", ((JavascriptObject) obj).getJSObject()), -1);
}
return checkInteger(invokeJavascript("indexOf", obj), -1);
} | java | public int indexOf(Object obj) {
if (obj instanceof JavascriptObject) {
return checkInteger(invokeJavascript("indexOf", ((JavascriptObject) obj).getJSObject()), -1);
}
return checkInteger(invokeJavascript("indexOf", obj), -1);
} | [
"public",
"int",
"indexOf",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"JavascriptObject",
")",
"{",
"return",
"checkInteger",
"(",
"invokeJavascript",
"(",
"\"indexOf\"",
",",
"(",
"(",
"JavascriptObject",
")",
"obj",
")",
".",
"getJSOb... | indexOf() Search the array for an element and returns its position | [
"indexOf",
"()",
"Search",
"the",
"array",
"for",
"an",
"element",
"and",
"returns",
"its",
"position"
] | train | https://github.com/rterp/GMapsFX/blob/4623d3f768e8ad78fc50ee32dd204d236e01059f/GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptArray.java#L53-L58 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.split | public static List<String> split(final CharSequence str, final int size) {
"""
Returns consecutive substring of the specified string, each of the same length (the final list may be smaller),
or an empty array if the specified string is null or empty.
@param str
@param size
@return
"""
if (size < 1) {
throw new IllegalArgumentException("The parameter 'size' can not be zero or less than zero");
}
if (N.isNullOrEmpty(str)) {
return new ArrayList<>();
}
return split(str, 0, str.length(), size);
} | java | public static List<String> split(final CharSequence str, final int size) {
if (size < 1) {
throw new IllegalArgumentException("The parameter 'size' can not be zero or less than zero");
}
if (N.isNullOrEmpty(str)) {
return new ArrayList<>();
}
return split(str, 0, str.length(), size);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"split",
"(",
"final",
"CharSequence",
"str",
",",
"final",
"int",
"size",
")",
"{",
"if",
"(",
"size",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The parameter 'size' can not be zero... | Returns consecutive substring of the specified string, each of the same length (the final list may be smaller),
or an empty array if the specified string is null or empty.
@param str
@param size
@return | [
"Returns",
"consecutive",
"substring",
"of",
"the",
"specified",
"string",
"each",
"of",
"the",
"same",
"length",
"(",
"the",
"final",
"list",
"may",
"be",
"smaller",
")",
"or",
"an",
"empty",
"array",
"if",
"the",
"specified",
"string",
"is",
"null",
"or"... | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L18738-L18748 |
pravega/pravega | controller/src/main/java/io/pravega/controller/store/stream/ZkOrderedStore.java | ZkOrderedStore.addEntity | CompletableFuture<Long> addEntity(String scope, String stream, String entity) {
"""
Method to add new entity to the ordered collection. Note: Same entity could be added to the collection multiple times.
Entities are added to the latest collection for the stream. If the collection has exhausted positions allowed for by rollOver limit,
a new successor collection is initiated and the entry is added to the new collection.
Any entries with positions higher than rollover values under a set are ignored and eventually purged.
@param scope scope
@param stream stream
@param entity entity to add
@return CompletableFuture which when completed returns the position where the entity is added to the set.
"""
// add persistent sequential node to the latest collection number
// if collectionNum is sealed, increment collection number and write the entity there.
return getLatestCollection(scope, stream)
.thenCompose(latestcollectionNum ->
storeHelper.createPersistentSequentialZNode(getEntitySequentialPath(scope, stream, latestcollectionNum),
entity.getBytes(Charsets.UTF_8))
.thenCompose(positionPath -> {
int position = getPositionFromPath(positionPath);
if (position > rollOverAfter) {
// if newly created position exceeds rollover limit, we need to delete that entry
// and roll over.
// 1. delete newly created path
return storeHelper.deletePath(positionPath, false)
// 2. seal latest collection
.thenCompose(v -> storeHelper.createZNodeIfNotExist(
getCollectionSealedPath(scope, stream, latestcollectionNum)))
// 3. call addEntity recursively
.thenCompose(v -> addEntity(scope, stream, entity))
// 4. delete empty sealed collection path
.thenCompose(orderedPosition ->
tryDeleteSealedCollection(scope, stream, latestcollectionNum)
.thenApply(v -> orderedPosition));
} else {
return CompletableFuture.completedFuture(Position.toLong(latestcollectionNum, position));
}
}))
.whenComplete((r, e) -> {
if (e != null) {
log.error("error encountered while trying to add entity {} for stream {}/{}", entity, scope, stream, e);
} else {
log.debug("entity {} added for stream {}/{} at position {}", entity, scope, stream, r);
}
});
} | java | CompletableFuture<Long> addEntity(String scope, String stream, String entity) {
// add persistent sequential node to the latest collection number
// if collectionNum is sealed, increment collection number and write the entity there.
return getLatestCollection(scope, stream)
.thenCompose(latestcollectionNum ->
storeHelper.createPersistentSequentialZNode(getEntitySequentialPath(scope, stream, latestcollectionNum),
entity.getBytes(Charsets.UTF_8))
.thenCompose(positionPath -> {
int position = getPositionFromPath(positionPath);
if (position > rollOverAfter) {
// if newly created position exceeds rollover limit, we need to delete that entry
// and roll over.
// 1. delete newly created path
return storeHelper.deletePath(positionPath, false)
// 2. seal latest collection
.thenCompose(v -> storeHelper.createZNodeIfNotExist(
getCollectionSealedPath(scope, stream, latestcollectionNum)))
// 3. call addEntity recursively
.thenCompose(v -> addEntity(scope, stream, entity))
// 4. delete empty sealed collection path
.thenCompose(orderedPosition ->
tryDeleteSealedCollection(scope, stream, latestcollectionNum)
.thenApply(v -> orderedPosition));
} else {
return CompletableFuture.completedFuture(Position.toLong(latestcollectionNum, position));
}
}))
.whenComplete((r, e) -> {
if (e != null) {
log.error("error encountered while trying to add entity {} for stream {}/{}", entity, scope, stream, e);
} else {
log.debug("entity {} added for stream {}/{} at position {}", entity, scope, stream, r);
}
});
} | [
"CompletableFuture",
"<",
"Long",
">",
"addEntity",
"(",
"String",
"scope",
",",
"String",
"stream",
",",
"String",
"entity",
")",
"{",
"// add persistent sequential node to the latest collection number ",
"// if collectionNum is sealed, increment collection number and write the en... | Method to add new entity to the ordered collection. Note: Same entity could be added to the collection multiple times.
Entities are added to the latest collection for the stream. If the collection has exhausted positions allowed for by rollOver limit,
a new successor collection is initiated and the entry is added to the new collection.
Any entries with positions higher than rollover values under a set are ignored and eventually purged.
@param scope scope
@param stream stream
@param entity entity to add
@return CompletableFuture which when completed returns the position where the entity is added to the set. | [
"Method",
"to",
"add",
"new",
"entity",
"to",
"the",
"ordered",
"collection",
".",
"Note",
":",
"Same",
"entity",
"could",
"be",
"added",
"to",
"the",
"collection",
"multiple",
"times",
".",
"Entities",
"are",
"added",
"to",
"the",
"latest",
"collection",
... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/store/stream/ZkOrderedStore.java#L93-L128 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/ValidateFieldHandler.java | ValidateFieldHandler.init | public void init(Record record, String fieldName, String strCompare, boolean bValidIfMatch) {
"""
Constructor.
@param record My owner (usually passed as null, and set on addListener in setOwner()).
""" // For this to work right, the booking number field needs a listener to re-select this file whenever it changes
this.fieldName = fieldName;
m_strCompare = strCompare;
m_bValidIfMatch = bValidIfMatch;
super.init(record);
} | java | public void init(Record record, String fieldName, String strCompare, boolean bValidIfMatch)
{ // For this to work right, the booking number field needs a listener to re-select this file whenever it changes
this.fieldName = fieldName;
m_strCompare = strCompare;
m_bValidIfMatch = bValidIfMatch;
super.init(record);
} | [
"public",
"void",
"init",
"(",
"Record",
"record",
",",
"String",
"fieldName",
",",
"String",
"strCompare",
",",
"boolean",
"bValidIfMatch",
")",
"{",
"// For this to work right, the booking number field needs a listener to re-select this file whenever it changes",
"this",
".",... | Constructor.
@param record My owner (usually passed as null, and set on addListener in setOwner()). | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/ValidateFieldHandler.java#L61-L67 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java | SARLOperationHelper.hasSideEffects | protected Boolean hasSideEffects(XExpression expr, ISideEffectContext context) {
"""
Determine if the given expression has a side effect.
@param expr the expression.
@param context the context.
@return {@code true} if the expression has a side effect.
"""
if (expr != null && !expr.eIsProxy()) {
return this.hasSideEffectsDispatcher.invoke(expr, context);
}
return false;
} | java | protected Boolean hasSideEffects(XExpression expr, ISideEffectContext context) {
if (expr != null && !expr.eIsProxy()) {
return this.hasSideEffectsDispatcher.invoke(expr, context);
}
return false;
} | [
"protected",
"Boolean",
"hasSideEffects",
"(",
"XExpression",
"expr",
",",
"ISideEffectContext",
"context",
")",
"{",
"if",
"(",
"expr",
"!=",
"null",
"&&",
"!",
"expr",
".",
"eIsProxy",
"(",
")",
")",
"{",
"return",
"this",
".",
"hasSideEffectsDispatcher",
... | Determine if the given expression has a side effect.
@param expr the expression.
@param context the context.
@return {@code true} if the expression has a side effect. | [
"Determine",
"if",
"the",
"given",
"expression",
"has",
"a",
"side",
"effect",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L251-L256 |
attribyte/wpdb | src/main/java/org/attribyte/wp/db/DB.java | DB.selectSite | public Site selectSite() throws SQLException {
"""
Selects the site metadata from the options table.
@return The site metadata.
@throws SQLException on database error.
"""
String baseURL = selectOption("home");
String title = selectOption("blogname");
String description = selectOption("blogdescription");
String permalinkStructure = selectOption("permalink_structure", "/?p=%postid%");
long defaultCategoryId = Long.parseLong(selectOption("default_category", "0"));
TaxonomyTerm defaultCategoryTerm = resolveTaxonomyTerm(defaultCategoryId);
if(defaultCategoryTerm == null) {
defaultCategoryTerm = new TaxonomyTerm(0L, CATEGORY_TAXONOMY, new Term(0L, "Uncategorized", "uncategorized"), "");
}
return new Site(siteId, baseURL, title, description, permalinkStructure, defaultCategoryTerm.term);
} | java | public Site selectSite() throws SQLException {
String baseURL = selectOption("home");
String title = selectOption("blogname");
String description = selectOption("blogdescription");
String permalinkStructure = selectOption("permalink_structure", "/?p=%postid%");
long defaultCategoryId = Long.parseLong(selectOption("default_category", "0"));
TaxonomyTerm defaultCategoryTerm = resolveTaxonomyTerm(defaultCategoryId);
if(defaultCategoryTerm == null) {
defaultCategoryTerm = new TaxonomyTerm(0L, CATEGORY_TAXONOMY, new Term(0L, "Uncategorized", "uncategorized"), "");
}
return new Site(siteId, baseURL, title, description, permalinkStructure, defaultCategoryTerm.term);
} | [
"public",
"Site",
"selectSite",
"(",
")",
"throws",
"SQLException",
"{",
"String",
"baseURL",
"=",
"selectOption",
"(",
"\"home\"",
")",
";",
"String",
"title",
"=",
"selectOption",
"(",
"\"blogname\"",
")",
";",
"String",
"description",
"=",
"selectOption",
"... | Selects the site metadata from the options table.
@return The site metadata.
@throws SQLException on database error. | [
"Selects",
"the",
"site",
"metadata",
"from",
"the",
"options",
"table",
"."
] | train | https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/db/DB.java#L2698-L2709 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/JivePropertiesManager.java | JivePropertiesManager.getProperty | public static Object getProperty(Stanza packet, String name) {
"""
Convenience method to get a property from a packet. Will return null if the stanza contains
not property with the given name.
@param packet
@param name
@return the property or <tt>null</tt> if none found.
"""
Object res = null;
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
if (jpe != null) {
res = jpe.getProperty(name);
}
return res;
} | java | public static Object getProperty(Stanza packet, String name) {
Object res = null;
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
if (jpe != null) {
res = jpe.getProperty(name);
}
return res;
} | [
"public",
"static",
"Object",
"getProperty",
"(",
"Stanza",
"packet",
",",
"String",
"name",
")",
"{",
"Object",
"res",
"=",
"null",
";",
"JivePropertiesExtension",
"jpe",
"=",
"(",
"JivePropertiesExtension",
")",
"packet",
".",
"getExtension",
"(",
"JivePropert... | Convenience method to get a property from a packet. Will return null if the stanza contains
not property with the given name.
@param packet
@param name
@return the property or <tt>null</tt> if none found. | [
"Convenience",
"method",
"to",
"get",
"a",
"property",
"from",
"a",
"packet",
".",
"Will",
"return",
"null",
"if",
"the",
"stanza",
"contains",
"not",
"property",
"with",
"the",
"given",
"name",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/JivePropertiesManager.java#L75-L82 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/juel/ExpressionFactoryImpl.java | ExpressionFactoryImpl.createTreeBuilder | protected TreeBuilder createTreeBuilder(Properties properties, Feature... features) {
"""
Create the factory's builder. This implementation takes the
<code>de.odysseus.el.tree.TreeBuilder</code> property as a name of a class implementing the
<code>de.odysseus.el.tree.TreeBuilder</code> interface. If the property is not set, a plain
<code>de.odysseus.el.tree.impl.Builder</code> is used. If the configured class is a subclass
of <code>de.odysseus.el.tree.impl.Builder</code> and which provides a constructor taking an
array of <code>Builder.Feature</code>, this constructor will be invoked. Otherwise, the
default constructor will be used.
"""
Class<?> clazz = load(TreeBuilder.class, properties);
if (clazz == null) {
return new Builder(features);
}
try {
if (Builder.class.isAssignableFrom(clazz)) {
Constructor<?> constructor = clazz.getConstructor(Feature[].class);
if (constructor == null) {
if (features == null || features.length == 0) {
return TreeBuilder.class.cast(clazz.newInstance());
} else {
throw new ELException("Builder " + clazz + " is missing constructor (can't pass features)");
}
} else {
return TreeBuilder.class.cast(constructor.newInstance((Object) features));
}
} else {
return TreeBuilder.class.cast(clazz.newInstance());
}
} catch (Exception e) {
throw new ELException("TreeBuilder " + clazz + " could not be instantiated", e);
}
} | java | protected TreeBuilder createTreeBuilder(Properties properties, Feature... features) {
Class<?> clazz = load(TreeBuilder.class, properties);
if (clazz == null) {
return new Builder(features);
}
try {
if (Builder.class.isAssignableFrom(clazz)) {
Constructor<?> constructor = clazz.getConstructor(Feature[].class);
if (constructor == null) {
if (features == null || features.length == 0) {
return TreeBuilder.class.cast(clazz.newInstance());
} else {
throw new ELException("Builder " + clazz + " is missing constructor (can't pass features)");
}
} else {
return TreeBuilder.class.cast(constructor.newInstance((Object) features));
}
} else {
return TreeBuilder.class.cast(clazz.newInstance());
}
} catch (Exception e) {
throw new ELException("TreeBuilder " + clazz + " could not be instantiated", e);
}
} | [
"protected",
"TreeBuilder",
"createTreeBuilder",
"(",
"Properties",
"properties",
",",
"Feature",
"...",
"features",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"load",
"(",
"TreeBuilder",
".",
"class",
",",
"properties",
")",
";",
"if",
"(",
"clazz",
... | Create the factory's builder. This implementation takes the
<code>de.odysseus.el.tree.TreeBuilder</code> property as a name of a class implementing the
<code>de.odysseus.el.tree.TreeBuilder</code> interface. If the property is not set, a plain
<code>de.odysseus.el.tree.impl.Builder</code> is used. If the configured class is a subclass
of <code>de.odysseus.el.tree.impl.Builder</code> and which provides a constructor taking an
array of <code>Builder.Feature</code>, this constructor will be invoked. Otherwise, the
default constructor will be used. | [
"Create",
"the",
"factory",
"s",
"builder",
".",
"This",
"implementation",
"takes",
"the",
"<code",
">",
"de",
".",
"odysseus",
".",
"el",
".",
"tree",
".",
"TreeBuilder<",
"/",
"code",
">",
"property",
"as",
"a",
"name",
"of",
"a",
"class",
"implementin... | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/juel/ExpressionFactoryImpl.java#L369-L392 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.