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
|
---|---|---|---|---|---|---|---|---|---|---|
logic-ng/LogicNG
|
src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java
|
MiniSatStyleSolver.pickBranchLit
|
protected int pickBranchLit() {
"""
Picks the next branching literal.
@return the literal or -1 if there are no unassigned literals left
"""
int next = -1;
while (next == -1 || this.vars.get(next).assignment() != Tristate.UNDEF || !this.vars.get(next).decision())
if (this.orderHeap.empty())
return -1;
else
next = this.orderHeap.removeMin();
return mkLit(next, this.vars.get(next).polarity());
}
|
java
|
protected int pickBranchLit() {
int next = -1;
while (next == -1 || this.vars.get(next).assignment() != Tristate.UNDEF || !this.vars.get(next).decision())
if (this.orderHeap.empty())
return -1;
else
next = this.orderHeap.removeMin();
return mkLit(next, this.vars.get(next).polarity());
}
|
[
"protected",
"int",
"pickBranchLit",
"(",
")",
"{",
"int",
"next",
"=",
"-",
"1",
";",
"while",
"(",
"next",
"==",
"-",
"1",
"||",
"this",
".",
"vars",
".",
"get",
"(",
"next",
")",
".",
"assignment",
"(",
")",
"!=",
"Tristate",
".",
"UNDEF",
"||",
"!",
"this",
".",
"vars",
".",
"get",
"(",
"next",
")",
".",
"decision",
"(",
")",
")",
"if",
"(",
"this",
".",
"orderHeap",
".",
"empty",
"(",
")",
")",
"return",
"-",
"1",
";",
"else",
"next",
"=",
"this",
".",
"orderHeap",
".",
"removeMin",
"(",
")",
";",
"return",
"mkLit",
"(",
"next",
",",
"this",
".",
"vars",
".",
"get",
"(",
"next",
")",
".",
"polarity",
"(",
")",
")",
";",
"}"
] |
Picks the next branching literal.
@return the literal or -1 if there are no unassigned literals left
|
[
"Picks",
"the",
"next",
"branching",
"literal",
"."
] |
train
|
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java#L452-L460
|
EdwardRaff/JSAT
|
JSAT/src/jsat/io/CSV.java
|
CSV.readR
|
public static RegressionDataSet readR(int numeric_target_column, Path path, char delimiter, int lines_to_skip, char comment, Set<Integer> cat_cols) throws IOException {
"""
Reads in a CSV dataset as a regression dataset.
@param numeric_target_column the column index (starting from zero) of the
feature that will be the target regression value
@param path the CSV file to read
@param delimiter the delimiter to separate columns, usually a comma
@param lines_to_skip the number of lines to skip when reading in the CSV
(used to skip header information)
@param comment the character used to indicate the start of a comment.
Once this character is reached, anything at and after the character will
be ignored.
@param cat_cols a set of the indices to treat as categorical features.
@return the regression dataset from the given CSV file
@throws IOException
"""
BufferedReader br = Files.newBufferedReader(path, Charset.defaultCharset());
RegressionDataSet ret = readR(numeric_target_column, br, delimiter, lines_to_skip, comment, cat_cols);
br.close();
return ret;
}
|
java
|
public static RegressionDataSet readR(int numeric_target_column, Path path, char delimiter, int lines_to_skip, char comment, Set<Integer> cat_cols) throws IOException
{
BufferedReader br = Files.newBufferedReader(path, Charset.defaultCharset());
RegressionDataSet ret = readR(numeric_target_column, br, delimiter, lines_to_skip, comment, cat_cols);
br.close();
return ret;
}
|
[
"public",
"static",
"RegressionDataSet",
"readR",
"(",
"int",
"numeric_target_column",
",",
"Path",
"path",
",",
"char",
"delimiter",
",",
"int",
"lines_to_skip",
",",
"char",
"comment",
",",
"Set",
"<",
"Integer",
">",
"cat_cols",
")",
"throws",
"IOException",
"{",
"BufferedReader",
"br",
"=",
"Files",
".",
"newBufferedReader",
"(",
"path",
",",
"Charset",
".",
"defaultCharset",
"(",
")",
")",
";",
"RegressionDataSet",
"ret",
"=",
"readR",
"(",
"numeric_target_column",
",",
"br",
",",
"delimiter",
",",
"lines_to_skip",
",",
"comment",
",",
"cat_cols",
")",
";",
"br",
".",
"close",
"(",
")",
";",
"return",
"ret",
";",
"}"
] |
Reads in a CSV dataset as a regression dataset.
@param numeric_target_column the column index (starting from zero) of the
feature that will be the target regression value
@param path the CSV file to read
@param delimiter the delimiter to separate columns, usually a comma
@param lines_to_skip the number of lines to skip when reading in the CSV
(used to skip header information)
@param comment the character used to indicate the start of a comment.
Once this character is reached, anything at and after the character will
be ignored.
@param cat_cols a set of the indices to treat as categorical features.
@return the regression dataset from the given CSV file
@throws IOException
|
[
"Reads",
"in",
"a",
"CSV",
"dataset",
"as",
"a",
"regression",
"dataset",
"."
] |
train
|
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/io/CSV.java#L112-L118
|
Azure/azure-sdk-for-java
|
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/RoutesInner.java
|
RoutesInner.listAsync
|
public Observable<Page<RouteInner>> listAsync(final String resourceGroupName, final String routeTableName) {
"""
Gets all routes in a route table.
@param resourceGroupName The name of the resource group.
@param routeTableName The name of the route table.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<RouteInner> object
"""
return listWithServiceResponseAsync(resourceGroupName, routeTableName)
.map(new Func1<ServiceResponse<Page<RouteInner>>, Page<RouteInner>>() {
@Override
public Page<RouteInner> call(ServiceResponse<Page<RouteInner>> response) {
return response.body();
}
});
}
|
java
|
public Observable<Page<RouteInner>> listAsync(final String resourceGroupName, final String routeTableName) {
return listWithServiceResponseAsync(resourceGroupName, routeTableName)
.map(new Func1<ServiceResponse<Page<RouteInner>>, Page<RouteInner>>() {
@Override
public Page<RouteInner> call(ServiceResponse<Page<RouteInner>> response) {
return response.body();
}
});
}
|
[
"public",
"Observable",
"<",
"Page",
"<",
"RouteInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"routeTableName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"routeTableName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"RouteInner",
">",
">",
",",
"Page",
"<",
"RouteInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"RouteInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"RouteInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Gets all routes in a route table.
@param resourceGroupName The name of the resource group.
@param routeTableName The name of the route table.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<RouteInner> object
|
[
"Gets",
"all",
"routes",
"in",
"a",
"route",
"table",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/RoutesInner.java#L581-L589
|
Azure/azure-sdk-for-java
|
recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/BackupResourceStorageConfigsInner.java
|
BackupResourceStorageConfigsInner.updateAsync
|
public Observable<Void> updateAsync(String vaultName, String resourceGroupName, BackupResourceConfigResourceInner parameters) {
"""
Updates vault storage model type.
@param vaultName The name of the recovery services vault.
@param resourceGroupName The name of the resource group where the recovery services vault is present.
@param parameters Vault storage config request
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful.
"""
return updateWithServiceResponseAsync(vaultName, resourceGroupName, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
}
|
java
|
public Observable<Void> updateAsync(String vaultName, String resourceGroupName, BackupResourceConfigResourceInner parameters) {
return updateWithServiceResponseAsync(vaultName, resourceGroupName, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
}
|
[
"public",
"Observable",
"<",
"Void",
">",
"updateAsync",
"(",
"String",
"vaultName",
",",
"String",
"resourceGroupName",
",",
"BackupResourceConfigResourceInner",
"parameters",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"vaultName",
",",
"resourceGroupName",
",",
"parameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Void",
">",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
"ServiceResponse",
"<",
"Void",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Updates vault storage model type.
@param vaultName The name of the recovery services vault.
@param resourceGroupName The name of the resource group where the recovery services vault is present.
@param parameters Vault storage config request
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful.
|
[
"Updates",
"vault",
"storage",
"model",
"type",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/BackupResourceStorageConfigsInner.java#L188-L195
|
alkacon/opencms-core
|
src/org/opencms/relations/CmsLink.java
|
CmsLink.updateLink
|
public void updateLink(String target, String anchor, String query) {
"""
Updates the uri of this link with a new target, anchor and query.<p>
If anchor and/or query are <code>null</code>, this features are not used.<p>
Note that you can <b>not</b> update the "internal" or "type" values of the link,
so the new link must be of same type (A, IMG) and also remain either an internal or external link.<p>
Also updates the structure of the underlying XML page document this link belongs to.<p>
@param target the target (destination) of this link
@param anchor the anchor or null if undefined
@param query the query or null if undefined
"""
// set the components
m_target = target;
m_anchor = anchor;
setQuery(query);
// create the uri from the components
setUri();
// update the xml
CmsLinkUpdateUtil.updateXml(this, m_element, true);
}
|
java
|
public void updateLink(String target, String anchor, String query) {
// set the components
m_target = target;
m_anchor = anchor;
setQuery(query);
// create the uri from the components
setUri();
// update the xml
CmsLinkUpdateUtil.updateXml(this, m_element, true);
}
|
[
"public",
"void",
"updateLink",
"(",
"String",
"target",
",",
"String",
"anchor",
",",
"String",
"query",
")",
"{",
"// set the components",
"m_target",
"=",
"target",
";",
"m_anchor",
"=",
"anchor",
";",
"setQuery",
"(",
"query",
")",
";",
"// create the uri from the components",
"setUri",
"(",
")",
";",
"// update the xml",
"CmsLinkUpdateUtil",
".",
"updateXml",
"(",
"this",
",",
"m_element",
",",
"true",
")",
";",
"}"
] |
Updates the uri of this link with a new target, anchor and query.<p>
If anchor and/or query are <code>null</code>, this features are not used.<p>
Note that you can <b>not</b> update the "internal" or "type" values of the link,
so the new link must be of same type (A, IMG) and also remain either an internal or external link.<p>
Also updates the structure of the underlying XML page document this link belongs to.<p>
@param target the target (destination) of this link
@param anchor the anchor or null if undefined
@param query the query or null if undefined
|
[
"Updates",
"the",
"uri",
"of",
"this",
"link",
"with",
"a",
"new",
"target",
"anchor",
"and",
"query",
".",
"<p",
">"
] |
train
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsLink.java#L661-L673
|
pgjdbc/pgjdbc
|
pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java
|
EscapedFunctions2.sqlquarter
|
public static void sqlquarter(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
"""
quarter translation
@param buf The buffer to append into
@param parsedArgs arguments
@throws SQLException if something wrong happens
"""
singleArgumentFunctionCall(buf, "extract(quarter from ", "quarter", parsedArgs);
}
|
java
|
public static void sqlquarter(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
singleArgumentFunctionCall(buf, "extract(quarter from ", "quarter", parsedArgs);
}
|
[
"public",
"static",
"void",
"sqlquarter",
"(",
"StringBuilder",
"buf",
",",
"List",
"<",
"?",
"extends",
"CharSequence",
">",
"parsedArgs",
")",
"throws",
"SQLException",
"{",
"singleArgumentFunctionCall",
"(",
"buf",
",",
"\"extract(quarter from \"",
",",
"\"quarter\"",
",",
"parsedArgs",
")",
";",
"}"
] |
quarter translation
@param buf The buffer to append into
@param parsedArgs arguments
@throws SQLException if something wrong happens
|
[
"quarter",
"translation"
] |
train
|
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java#L453-L455
|
Azure/azure-sdk-for-java
|
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ConnectionsInner.java
|
ConnectionsInner.deleteAsync
|
public Observable<ConnectionInner> deleteAsync(String resourceGroupName, String automationAccountName, String connectionName) {
"""
Delete the connection.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param connectionName The name of connection.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ConnectionInner object
"""
return deleteWithServiceResponseAsync(resourceGroupName, automationAccountName, connectionName).map(new Func1<ServiceResponse<ConnectionInner>, ConnectionInner>() {
@Override
public ConnectionInner call(ServiceResponse<ConnectionInner> response) {
return response.body();
}
});
}
|
java
|
public Observable<ConnectionInner> deleteAsync(String resourceGroupName, String automationAccountName, String connectionName) {
return deleteWithServiceResponseAsync(resourceGroupName, automationAccountName, connectionName).map(new Func1<ServiceResponse<ConnectionInner>, ConnectionInner>() {
@Override
public ConnectionInner call(ServiceResponse<ConnectionInner> response) {
return response.body();
}
});
}
|
[
"public",
"Observable",
"<",
"ConnectionInner",
">",
"deleteAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"connectionName",
")",
"{",
"return",
"deleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccountName",
",",
"connectionName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ConnectionInner",
">",
",",
"ConnectionInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ConnectionInner",
"call",
"(",
"ServiceResponse",
"<",
"ConnectionInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Delete the connection.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param connectionName The name of connection.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ConnectionInner object
|
[
"Delete",
"the",
"connection",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ConnectionsInner.java#L131-L138
|
aspectran/aspectran
|
core/src/main/java/com/aspectran/core/activity/response/dispatch/DispatchResponse.java
|
DispatchResponse.fetchAttributes
|
public static void fetchAttributes(RequestAdapter requestAdapter, ProcessResult processResult) {
"""
Stores an attribute in request.
@param requestAdapter the request adapter
@param processResult the process result
"""
if (processResult != null) {
for (ContentResult contentResult : processResult) {
for (ActionResult actionResult : contentResult) {
Object actionResultValue = actionResult.getResultValue();
if (actionResultValue instanceof ProcessResult) {
fetchAttributes(requestAdapter, (ProcessResult)actionResultValue);
} else {
String actionId = actionResult.getActionId();
if (actionId != null) {
requestAdapter.setAttribute(actionId, actionResultValue);
}
}
}
}
}
}
|
java
|
public static void fetchAttributes(RequestAdapter requestAdapter, ProcessResult processResult) {
if (processResult != null) {
for (ContentResult contentResult : processResult) {
for (ActionResult actionResult : contentResult) {
Object actionResultValue = actionResult.getResultValue();
if (actionResultValue instanceof ProcessResult) {
fetchAttributes(requestAdapter, (ProcessResult)actionResultValue);
} else {
String actionId = actionResult.getActionId();
if (actionId != null) {
requestAdapter.setAttribute(actionId, actionResultValue);
}
}
}
}
}
}
|
[
"public",
"static",
"void",
"fetchAttributes",
"(",
"RequestAdapter",
"requestAdapter",
",",
"ProcessResult",
"processResult",
")",
"{",
"if",
"(",
"processResult",
"!=",
"null",
")",
"{",
"for",
"(",
"ContentResult",
"contentResult",
":",
"processResult",
")",
"{",
"for",
"(",
"ActionResult",
"actionResult",
":",
"contentResult",
")",
"{",
"Object",
"actionResultValue",
"=",
"actionResult",
".",
"getResultValue",
"(",
")",
";",
"if",
"(",
"actionResultValue",
"instanceof",
"ProcessResult",
")",
"{",
"fetchAttributes",
"(",
"requestAdapter",
",",
"(",
"ProcessResult",
")",
"actionResultValue",
")",
";",
"}",
"else",
"{",
"String",
"actionId",
"=",
"actionResult",
".",
"getActionId",
"(",
")",
";",
"if",
"(",
"actionId",
"!=",
"null",
")",
"{",
"requestAdapter",
".",
"setAttribute",
"(",
"actionId",
",",
"actionResultValue",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}"
] |
Stores an attribute in request.
@param requestAdapter the request adapter
@param processResult the process result
|
[
"Stores",
"an",
"attribute",
"in",
"request",
"."
] |
train
|
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/response/dispatch/DispatchResponse.java#L176-L192
|
TheHortonMachine/hortonmachine
|
gears/src/main/java/org/hortonmachine/gears/libs/modules/FlowNode.java
|
FlowNode.goDownstream
|
public FlowNode goDownstream() {
"""
Get the next downstream node.
@return the next downstream node or <code>null</code> if the end has been reached.
"""
if (isValid) {
Direction direction = Direction.forFlow(flow);
if (direction != null) {
FlowNode nextNode = new FlowNode(gridIter, cols, rows, col + direction.col, row + direction.row);
if (nextNode.isValid) {
return nextNode;
}
}
}
return null;
}
|
java
|
public FlowNode goDownstream() {
if (isValid) {
Direction direction = Direction.forFlow(flow);
if (direction != null) {
FlowNode nextNode = new FlowNode(gridIter, cols, rows, col + direction.col, row + direction.row);
if (nextNode.isValid) {
return nextNode;
}
}
}
return null;
}
|
[
"public",
"FlowNode",
"goDownstream",
"(",
")",
"{",
"if",
"(",
"isValid",
")",
"{",
"Direction",
"direction",
"=",
"Direction",
".",
"forFlow",
"(",
"flow",
")",
";",
"if",
"(",
"direction",
"!=",
"null",
")",
"{",
"FlowNode",
"nextNode",
"=",
"new",
"FlowNode",
"(",
"gridIter",
",",
"cols",
",",
"rows",
",",
"col",
"+",
"direction",
".",
"col",
",",
"row",
"+",
"direction",
".",
"row",
")",
";",
"if",
"(",
"nextNode",
".",
"isValid",
")",
"{",
"return",
"nextNode",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] |
Get the next downstream node.
@return the next downstream node or <code>null</code> if the end has been reached.
|
[
"Get",
"the",
"next",
"downstream",
"node",
"."
] |
train
|
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/libs/modules/FlowNode.java#L233-L244
|
acromusashi/acromusashi-stream
|
src/main/java/acromusashi/stream/client/DrpcRequestClient.java
|
DrpcRequestClient.sendRequest
|
public void sendRequest(String host, int port, int timeout, String func, String funcArg) {
"""
DRPCリクエストを送信する。
@param host DRPCServerホスト
@param port DRPCServerポート
@param timeout DRPCタイムアウト(ミリ秒単位)
@param func DRPC実行機能(function)
@param funcArg DRPC実行引数
"""
DRPCClient client = null;
try
{
client = createClient(host, port, timeout);
}
catch (Exception ex)
{
logger.error("DRPCClient connect failed.", ex);
return;
}
String result = null;
try
{
result = client.execute(func, funcArg);
logger.info("DRPCRequest result is " + result);
}
catch (Exception ex)
{
logger.error("DRPCRequest failed.", ex);
}
finally
{
client.close();
}
}
|
java
|
public void sendRequest(String host, int port, int timeout, String func, String funcArg)
{
DRPCClient client = null;
try
{
client = createClient(host, port, timeout);
}
catch (Exception ex)
{
logger.error("DRPCClient connect failed.", ex);
return;
}
String result = null;
try
{
result = client.execute(func, funcArg);
logger.info("DRPCRequest result is " + result);
}
catch (Exception ex)
{
logger.error("DRPCRequest failed.", ex);
}
finally
{
client.close();
}
}
|
[
"public",
"void",
"sendRequest",
"(",
"String",
"host",
",",
"int",
"port",
",",
"int",
"timeout",
",",
"String",
"func",
",",
"String",
"funcArg",
")",
"{",
"DRPCClient",
"client",
"=",
"null",
";",
"try",
"{",
"client",
"=",
"createClient",
"(",
"host",
",",
"port",
",",
"timeout",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"logger",
".",
"error",
"(",
"\"DRPCClient connect failed.\"",
",",
"ex",
")",
";",
"return",
";",
"}",
"String",
"result",
"=",
"null",
";",
"try",
"{",
"result",
"=",
"client",
".",
"execute",
"(",
"func",
",",
"funcArg",
")",
";",
"logger",
".",
"info",
"(",
"\"DRPCRequest result is \"",
"+",
"result",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"logger",
".",
"error",
"(",
"\"DRPCRequest failed.\"",
",",
"ex",
")",
";",
"}",
"finally",
"{",
"client",
".",
"close",
"(",
")",
";",
"}",
"}"
] |
DRPCリクエストを送信する。
@param host DRPCServerホスト
@param port DRPCServerポート
@param timeout DRPCタイムアウト(ミリ秒単位)
@param func DRPC実行機能(function)
@param funcArg DRPC実行引数
|
[
"DRPCリクエストを送信する。"
] |
train
|
https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/client/DrpcRequestClient.java#L129-L158
|
Azure/azure-sdk-for-java
|
datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/DataLakeStoreAccountsInner.java
|
DataLakeStoreAccountsInner.listByAccountWithServiceResponseAsync
|
public Observable<ServiceResponse<Page<DataLakeStoreAccountInformationInner>>> listByAccountWithServiceResponseAsync(final String resourceGroupName, final String accountName) {
"""
Gets the first page of Data Lake Store accounts linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Analytics account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DataLakeStoreAccountInformationInner> object
"""
return listByAccountSinglePageAsync(resourceGroupName, accountName)
.concatMap(new Func1<ServiceResponse<Page<DataLakeStoreAccountInformationInner>>, Observable<ServiceResponse<Page<DataLakeStoreAccountInformationInner>>>>() {
@Override
public Observable<ServiceResponse<Page<DataLakeStoreAccountInformationInner>>> call(ServiceResponse<Page<DataLakeStoreAccountInformationInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByAccountNextWithServiceResponseAsync(nextPageLink));
}
});
}
|
java
|
public Observable<ServiceResponse<Page<DataLakeStoreAccountInformationInner>>> listByAccountWithServiceResponseAsync(final String resourceGroupName, final String accountName) {
return listByAccountSinglePageAsync(resourceGroupName, accountName)
.concatMap(new Func1<ServiceResponse<Page<DataLakeStoreAccountInformationInner>>, Observable<ServiceResponse<Page<DataLakeStoreAccountInformationInner>>>>() {
@Override
public Observable<ServiceResponse<Page<DataLakeStoreAccountInformationInner>>> call(ServiceResponse<Page<DataLakeStoreAccountInformationInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByAccountNextWithServiceResponseAsync(nextPageLink));
}
});
}
|
[
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"DataLakeStoreAccountInformationInner",
">",
">",
">",
"listByAccountWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"accountName",
")",
"{",
"return",
"listByAccountSinglePageAsync",
"(",
"resourceGroupName",
",",
"accountName",
")",
".",
"concatMap",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"DataLakeStoreAccountInformationInner",
">",
">",
",",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"DataLakeStoreAccountInformationInner",
">",
">",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"DataLakeStoreAccountInformationInner",
">",
">",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"DataLakeStoreAccountInformationInner",
">",
">",
"page",
")",
"{",
"String",
"nextPageLink",
"=",
"page",
".",
"body",
"(",
")",
".",
"nextPageLink",
"(",
")",
";",
"if",
"(",
"nextPageLink",
"==",
"null",
")",
"{",
"return",
"Observable",
".",
"just",
"(",
"page",
")",
";",
"}",
"return",
"Observable",
".",
"just",
"(",
"page",
")",
".",
"concatWith",
"(",
"listByAccountNextWithServiceResponseAsync",
"(",
"nextPageLink",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Gets the first page of Data Lake Store accounts linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Analytics account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DataLakeStoreAccountInformationInner> object
|
[
"Gets",
"the",
"first",
"page",
"of",
"Data",
"Lake",
"Store",
"accounts",
"linked",
"to",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
".",
"The",
"response",
"includes",
"a",
"link",
"to",
"the",
"next",
"page",
"if",
"any",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/DataLakeStoreAccountsInner.java#L154-L166
|
Alluxio/alluxio
|
minicluster/src/main/java/alluxio/multi/process/MultiProcessCluster.java
|
MultiProcessCluster.updateDeployMode
|
public synchronized void updateDeployMode(DeployMode mode) {
"""
Updates the cluster's deploy mode.
@param mode the mode to set
"""
mDeployMode = mode;
if (mDeployMode == DeployMode.EMBEDDED) {
// Ensure that the journal properties are set correctly.
for (int i = 0; i < mMasters.size(); i++) {
Master master = mMasters.get(i);
MasterNetAddress address = mMasterAddresses.get(i);
master.updateConf(PropertyKey.MASTER_EMBEDDED_JOURNAL_PORT,
Integer.toString(address.getEmbeddedJournalPort()));
File journalDir = new File(mWorkDir, "journal" + i);
journalDir.mkdirs();
master.updateConf(PropertyKey.MASTER_JOURNAL_FOLDER, journalDir.getAbsolutePath());
}
}
}
|
java
|
public synchronized void updateDeployMode(DeployMode mode) {
mDeployMode = mode;
if (mDeployMode == DeployMode.EMBEDDED) {
// Ensure that the journal properties are set correctly.
for (int i = 0; i < mMasters.size(); i++) {
Master master = mMasters.get(i);
MasterNetAddress address = mMasterAddresses.get(i);
master.updateConf(PropertyKey.MASTER_EMBEDDED_JOURNAL_PORT,
Integer.toString(address.getEmbeddedJournalPort()));
File journalDir = new File(mWorkDir, "journal" + i);
journalDir.mkdirs();
master.updateConf(PropertyKey.MASTER_JOURNAL_FOLDER, journalDir.getAbsolutePath());
}
}
}
|
[
"public",
"synchronized",
"void",
"updateDeployMode",
"(",
"DeployMode",
"mode",
")",
"{",
"mDeployMode",
"=",
"mode",
";",
"if",
"(",
"mDeployMode",
"==",
"DeployMode",
".",
"EMBEDDED",
")",
"{",
"// Ensure that the journal properties are set correctly.",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"mMasters",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Master",
"master",
"=",
"mMasters",
".",
"get",
"(",
"i",
")",
";",
"MasterNetAddress",
"address",
"=",
"mMasterAddresses",
".",
"get",
"(",
"i",
")",
";",
"master",
".",
"updateConf",
"(",
"PropertyKey",
".",
"MASTER_EMBEDDED_JOURNAL_PORT",
",",
"Integer",
".",
"toString",
"(",
"address",
".",
"getEmbeddedJournalPort",
"(",
")",
")",
")",
";",
"File",
"journalDir",
"=",
"new",
"File",
"(",
"mWorkDir",
",",
"\"journal\"",
"+",
"i",
")",
";",
"journalDir",
".",
"mkdirs",
"(",
")",
";",
"master",
".",
"updateConf",
"(",
"PropertyKey",
".",
"MASTER_JOURNAL_FOLDER",
",",
"journalDir",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"}",
"}"
] |
Updates the cluster's deploy mode.
@param mode the mode to set
|
[
"Updates",
"the",
"cluster",
"s",
"deploy",
"mode",
"."
] |
train
|
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/minicluster/src/main/java/alluxio/multi/process/MultiProcessCluster.java#L487-L502
|
biojava/biojava
|
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/SuperPositionQCP.java
|
SuperPositionQCP.calcRmsd
|
private void calcRmsd(Point3d[] x, Point3d[] y) {
"""
Calculates the RMSD value for superposition of y onto x. This requires
the coordinates to be precentered.
@param x
3d points of reference coordinate set
@param y
3d points of coordinate set for superposition
"""
if (centered) {
innerProduct(y, x);
} else {
// translate to origin
xref = CalcPoint.clonePoint3dArray(x);
xtrans = CalcPoint.centroid(xref);
logger.debug("x centroid: " + xtrans);
xtrans.negate();
CalcPoint.translate(new Vector3d(xtrans), xref);
yref = CalcPoint.clonePoint3dArray(y);
ytrans = CalcPoint.centroid(yref);
logger.debug("y centroid: " + ytrans);
ytrans.negate();
CalcPoint.translate(new Vector3d(ytrans), yref);
innerProduct(yref, xref);
}
calcRmsd(wsum);
}
|
java
|
private void calcRmsd(Point3d[] x, Point3d[] y) {
if (centered) {
innerProduct(y, x);
} else {
// translate to origin
xref = CalcPoint.clonePoint3dArray(x);
xtrans = CalcPoint.centroid(xref);
logger.debug("x centroid: " + xtrans);
xtrans.negate();
CalcPoint.translate(new Vector3d(xtrans), xref);
yref = CalcPoint.clonePoint3dArray(y);
ytrans = CalcPoint.centroid(yref);
logger.debug("y centroid: " + ytrans);
ytrans.negate();
CalcPoint.translate(new Vector3d(ytrans), yref);
innerProduct(yref, xref);
}
calcRmsd(wsum);
}
|
[
"private",
"void",
"calcRmsd",
"(",
"Point3d",
"[",
"]",
"x",
",",
"Point3d",
"[",
"]",
"y",
")",
"{",
"if",
"(",
"centered",
")",
"{",
"innerProduct",
"(",
"y",
",",
"x",
")",
";",
"}",
"else",
"{",
"// translate to origin",
"xref",
"=",
"CalcPoint",
".",
"clonePoint3dArray",
"(",
"x",
")",
";",
"xtrans",
"=",
"CalcPoint",
".",
"centroid",
"(",
"xref",
")",
";",
"logger",
".",
"debug",
"(",
"\"x centroid: \"",
"+",
"xtrans",
")",
";",
"xtrans",
".",
"negate",
"(",
")",
";",
"CalcPoint",
".",
"translate",
"(",
"new",
"Vector3d",
"(",
"xtrans",
")",
",",
"xref",
")",
";",
"yref",
"=",
"CalcPoint",
".",
"clonePoint3dArray",
"(",
"y",
")",
";",
"ytrans",
"=",
"CalcPoint",
".",
"centroid",
"(",
"yref",
")",
";",
"logger",
".",
"debug",
"(",
"\"y centroid: \"",
"+",
"ytrans",
")",
";",
"ytrans",
".",
"negate",
"(",
")",
";",
"CalcPoint",
".",
"translate",
"(",
"new",
"Vector3d",
"(",
"ytrans",
")",
",",
"yref",
")",
";",
"innerProduct",
"(",
"yref",
",",
"xref",
")",
";",
"}",
"calcRmsd",
"(",
"wsum",
")",
";",
"}"
] |
Calculates the RMSD value for superposition of y onto x. This requires
the coordinates to be precentered.
@param x
3d points of reference coordinate set
@param y
3d points of coordinate set for superposition
|
[
"Calculates",
"the",
"RMSD",
"value",
"for",
"superposition",
"of",
"y",
"onto",
"x",
".",
"This",
"requires",
"the",
"coordinates",
"to",
"be",
"precentered",
"."
] |
train
|
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/SuperPositionQCP.java#L257-L276
|
tropo/tropo-webapi-java
|
src/main/java/com/voxeo/tropo/Key.java
|
Key.SAY_OF_MESSAGE
|
public static Key SAY_OF_MESSAGE(com.voxeo.tropo.actions.MessageAction.Say... says) {
"""
<p>
This determines what is played or sent to the caller. This can be a single
object or an array of objects.
</p>
"""
return createKey("say", says);
}
|
java
|
public static Key SAY_OF_MESSAGE(com.voxeo.tropo.actions.MessageAction.Say... says) {
return createKey("say", says);
}
|
[
"public",
"static",
"Key",
"SAY_OF_MESSAGE",
"(",
"com",
".",
"voxeo",
".",
"tropo",
".",
"actions",
".",
"MessageAction",
".",
"Say",
"...",
"says",
")",
"{",
"return",
"createKey",
"(",
"\"say\"",
",",
"says",
")",
";",
"}"
] |
<p>
This determines what is played or sent to the caller. This can be a single
object or an array of objects.
</p>
|
[
"<p",
">",
"This",
"determines",
"what",
"is",
"played",
"or",
"sent",
"to",
"the",
"caller",
".",
"This",
"can",
"be",
"a",
"single",
"object",
"or",
"an",
"array",
"of",
"objects",
".",
"<",
"/",
"p",
">"
] |
train
|
https://github.com/tropo/tropo-webapi-java/blob/96af1fa292c1d4b6321d85a559d9718d33eec7e0/src/main/java/com/voxeo/tropo/Key.java#L767-L770
|
OpenTSDB/opentsdb
|
src/tools/ConfigArgP.java
|
ConfigArgP.getConfigurationItem
|
public ConfigurationItem getConfigurationItem(final String key) {
"""
Returns the {@link ConfigurationItem} with the passed key
@param key The key of the item to fetch
@return The matching ConfigurationItem or null if one was not found
"""
if(key==null || key.trim().isEmpty()) throw new IllegalArgumentException("The passed key was null or empty");
return getConfigurationItemByKey(configItemsByKey, key);
}
|
java
|
public ConfigurationItem getConfigurationItem(final String key) {
if(key==null || key.trim().isEmpty()) throw new IllegalArgumentException("The passed key was null or empty");
return getConfigurationItemByKey(configItemsByKey, key);
}
|
[
"public",
"ConfigurationItem",
"getConfigurationItem",
"(",
"final",
"String",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"null",
"||",
"key",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The passed key was null or empty\"",
")",
";",
"return",
"getConfigurationItemByKey",
"(",
"configItemsByKey",
",",
"key",
")",
";",
"}"
] |
Returns the {@link ConfigurationItem} with the passed key
@param key The key of the item to fetch
@return The matching ConfigurationItem or null if one was not found
|
[
"Returns",
"the",
"{"
] |
train
|
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ConfigArgP.java#L372-L375
|
threerings/nenya
|
core/src/main/java/com/threerings/chat/ComicChatOverlay.java
|
ComicChatOverlay.getBubbleSize
|
protected Rectangle getBubbleSize (int type, Dimension d) {
"""
Calculate the size of the chat bubble based on the dimensions of the label and the type of
chat. It will be turned into a shape later, but we manipulate it for a while as just a
rectangle (which are easier to move about and do intersection tests with, and besides the
Shape interface has no way to translate).
"""
switch (ChatLogic.modeOf(type)) {
case ChatLogic.SHOUT:
case ChatLogic.THINK:
case ChatLogic.EMOTE:
// extra room for these two monsters
return new Rectangle(d.width + (PAD * 4), d.height + (PAD * 4));
default:
return new Rectangle(d.width + (PAD * 2), d.height + (PAD * 2));
}
}
|
java
|
protected Rectangle getBubbleSize (int type, Dimension d)
{
switch (ChatLogic.modeOf(type)) {
case ChatLogic.SHOUT:
case ChatLogic.THINK:
case ChatLogic.EMOTE:
// extra room for these two monsters
return new Rectangle(d.width + (PAD * 4), d.height + (PAD * 4));
default:
return new Rectangle(d.width + (PAD * 2), d.height + (PAD * 2));
}
}
|
[
"protected",
"Rectangle",
"getBubbleSize",
"(",
"int",
"type",
",",
"Dimension",
"d",
")",
"{",
"switch",
"(",
"ChatLogic",
".",
"modeOf",
"(",
"type",
")",
")",
"{",
"case",
"ChatLogic",
".",
"SHOUT",
":",
"case",
"ChatLogic",
".",
"THINK",
":",
"case",
"ChatLogic",
".",
"EMOTE",
":",
"// extra room for these two monsters",
"return",
"new",
"Rectangle",
"(",
"d",
".",
"width",
"+",
"(",
"PAD",
"*",
"4",
")",
",",
"d",
".",
"height",
"+",
"(",
"PAD",
"*",
"4",
")",
")",
";",
"default",
":",
"return",
"new",
"Rectangle",
"(",
"d",
".",
"width",
"+",
"(",
"PAD",
"*",
"2",
")",
",",
"d",
".",
"height",
"+",
"(",
"PAD",
"*",
"2",
")",
")",
";",
"}",
"}"
] |
Calculate the size of the chat bubble based on the dimensions of the label and the type of
chat. It will be turned into a shape later, but we manipulate it for a while as just a
rectangle (which are easier to move about and do intersection tests with, and besides the
Shape interface has no way to translate).
|
[
"Calculate",
"the",
"size",
"of",
"the",
"chat",
"bubble",
"based",
"on",
"the",
"dimensions",
"of",
"the",
"label",
"and",
"the",
"type",
"of",
"chat",
".",
"It",
"will",
"be",
"turned",
"into",
"a",
"shape",
"later",
"but",
"we",
"manipulate",
"it",
"for",
"a",
"while",
"as",
"just",
"a",
"rectangle",
"(",
"which",
"are",
"easier",
"to",
"move",
"about",
"and",
"do",
"intersection",
"tests",
"with",
"and",
"besides",
"the",
"Shape",
"interface",
"has",
"no",
"way",
"to",
"translate",
")",
"."
] |
train
|
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/ComicChatOverlay.java#L368-L380
|
lessthanoptimal/BoofCV
|
main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/DerivativeIntegralImage.java
|
DerivativeIntegralImage.kernelHaarY
|
public static IntegralKernel kernelHaarY( int r , IntegralKernel ret) {
"""
Creates a kernel for the Haar wavelet "centered" around the target pixel.
@param r Radius of the box. width is 2*r
@return Kernel for a Haar y-axis wavelet.
"""
if( ret == null )
ret = new IntegralKernel(2);
ret.blocks[0].set(-r,-r,r,0);
ret.blocks[1].set(-r,0,r,r);
ret.scales[0] = -1;
ret.scales[1] = 1;
return ret;
}
|
java
|
public static IntegralKernel kernelHaarY( int r , IntegralKernel ret) {
if( ret == null )
ret = new IntegralKernel(2);
ret.blocks[0].set(-r,-r,r,0);
ret.blocks[1].set(-r,0,r,r);
ret.scales[0] = -1;
ret.scales[1] = 1;
return ret;
}
|
[
"public",
"static",
"IntegralKernel",
"kernelHaarY",
"(",
"int",
"r",
",",
"IntegralKernel",
"ret",
")",
"{",
"if",
"(",
"ret",
"==",
"null",
")",
"ret",
"=",
"new",
"IntegralKernel",
"(",
"2",
")",
";",
"ret",
".",
"blocks",
"[",
"0",
"]",
".",
"set",
"(",
"-",
"r",
",",
"-",
"r",
",",
"r",
",",
"0",
")",
";",
"ret",
".",
"blocks",
"[",
"1",
"]",
".",
"set",
"(",
"-",
"r",
",",
"0",
",",
"r",
",",
"r",
")",
";",
"ret",
".",
"scales",
"[",
"0",
"]",
"=",
"-",
"1",
";",
"ret",
".",
"scales",
"[",
"1",
"]",
"=",
"1",
";",
"return",
"ret",
";",
"}"
] |
Creates a kernel for the Haar wavelet "centered" around the target pixel.
@param r Radius of the box. width is 2*r
@return Kernel for a Haar y-axis wavelet.
|
[
"Creates",
"a",
"kernel",
"for",
"the",
"Haar",
"wavelet",
"centered",
"around",
"the",
"target",
"pixel",
"."
] |
train
|
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/DerivativeIntegralImage.java#L90-L100
|
aws/aws-sdk-java
|
aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/model/TaskDefinition.java
|
TaskDefinition.getContainerDefinitions
|
public java.util.List<ContainerDefinition> getContainerDefinitions() {
"""
<p>
A list of container definitions in JSON format that describe the different containers that make up your task. For
more information about container definition parameters and defaults, see <a
href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_defintions.html">Amazon ECS Task
Definitions</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
</p>
@return A list of container definitions in JSON format that describe the different containers that make up your
task. For more information about container definition parameters and defaults, see <a
href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_defintions.html">Amazon ECS Task
Definitions</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
"""
if (containerDefinitions == null) {
containerDefinitions = new com.amazonaws.internal.SdkInternalList<ContainerDefinition>();
}
return containerDefinitions;
}
|
java
|
public java.util.List<ContainerDefinition> getContainerDefinitions() {
if (containerDefinitions == null) {
containerDefinitions = new com.amazonaws.internal.SdkInternalList<ContainerDefinition>();
}
return containerDefinitions;
}
|
[
"public",
"java",
".",
"util",
".",
"List",
"<",
"ContainerDefinition",
">",
"getContainerDefinitions",
"(",
")",
"{",
"if",
"(",
"containerDefinitions",
"==",
"null",
")",
"{",
"containerDefinitions",
"=",
"new",
"com",
".",
"amazonaws",
".",
"internal",
".",
"SdkInternalList",
"<",
"ContainerDefinition",
">",
"(",
")",
";",
"}",
"return",
"containerDefinitions",
";",
"}"
] |
<p>
A list of container definitions in JSON format that describe the different containers that make up your task. For
more information about container definition parameters and defaults, see <a
href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_defintions.html">Amazon ECS Task
Definitions</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
</p>
@return A list of container definitions in JSON format that describe the different containers that make up your
task. For more information about container definition parameters and defaults, see <a
href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_defintions.html">Amazon ECS Task
Definitions</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
|
[
"<p",
">",
"A",
"list",
"of",
"container",
"definitions",
"in",
"JSON",
"format",
"that",
"describe",
"the",
"different",
"containers",
"that",
"make",
"up",
"your",
"task",
".",
"For",
"more",
"information",
"about",
"container",
"definition",
"parameters",
"and",
"defaults",
"see",
"<a",
"href",
"=",
"https",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"AmazonECS",
"/",
"latest",
"/",
"developerguide",
"/",
"task_defintions",
".",
"html",
">",
"Amazon",
"ECS",
"Task",
"Definitions<",
"/",
"a",
">",
"in",
"the",
"<i",
">",
"Amazon",
"Elastic",
"Container",
"Service",
"Developer",
"Guide<",
"/",
"i",
">",
".",
"<",
"/",
"p",
">"
] |
train
|
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/model/TaskDefinition.java#L387-L392
|
wisdom-framework/wisdom
|
core/router/src/main/java/org/wisdom/router/RequestRouter.java
|
RequestRouter.getReverseRouteFor
|
@Override
public String getReverseRouteFor(String className, String method, Map<String, Object> params) {
"""
Gets the URL that would invoke the given action method.
@param className the controller class
@param method the controller method
@param params map of parameter name - value
@return the computed URL, {@literal null} if no route matches the given action method
"""
for (Route route : copy()) {
if (route.getControllerClass().getName().equals(className)
&& route.getControllerMethod().getName().equals(method)) {
return computeUrlForRoute(route, params);
}
}
return null;
}
|
java
|
@Override
public String getReverseRouteFor(String className, String method, Map<String, Object> params) {
for (Route route : copy()) {
if (route.getControllerClass().getName().equals(className)
&& route.getControllerMethod().getName().equals(method)) {
return computeUrlForRoute(route, params);
}
}
return null;
}
|
[
"@",
"Override",
"public",
"String",
"getReverseRouteFor",
"(",
"String",
"className",
",",
"String",
"method",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
")",
"{",
"for",
"(",
"Route",
"route",
":",
"copy",
"(",
")",
")",
"{",
"if",
"(",
"route",
".",
"getControllerClass",
"(",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"className",
")",
"&&",
"route",
".",
"getControllerMethod",
"(",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"method",
")",
")",
"{",
"return",
"computeUrlForRoute",
"(",
"route",
",",
"params",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Gets the URL that would invoke the given action method.
@param className the controller class
@param method the controller method
@param params map of parameter name - value
@return the computed URL, {@literal null} if no route matches the given action method
|
[
"Gets",
"the",
"URL",
"that",
"would",
"invoke",
"the",
"given",
"action",
"method",
"."
] |
train
|
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/router/src/main/java/org/wisdom/router/RequestRouter.java#L304-L313
|
haifengl/smile
|
graph/src/main/java/smile/graph/AdjacencyList.java
|
AdjacencyList.bfs
|
private void bfs(int v, int[] cc, int id) {
"""
Breadth-first search connected components of graph.
@param v the start vertex.
@param cc the array to store the connected component id of vertices.
@param id the current component id.
"""
cc[v] = id;
Queue<Integer> queue = new LinkedList<>();
queue.offer(v);
while (!queue.isEmpty()) {
int t = queue.poll();
for (Edge edge : graph[t]) {
int i = edge.v2;
if (!digraph && i == t) {
i = edge.v1;
}
if (cc[i] == -1) {
queue.offer(i);
cc[i] = id;
}
}
}
}
|
java
|
private void bfs(int v, int[] cc, int id) {
cc[v] = id;
Queue<Integer> queue = new LinkedList<>();
queue.offer(v);
while (!queue.isEmpty()) {
int t = queue.poll();
for (Edge edge : graph[t]) {
int i = edge.v2;
if (!digraph && i == t) {
i = edge.v1;
}
if (cc[i] == -1) {
queue.offer(i);
cc[i] = id;
}
}
}
}
|
[
"private",
"void",
"bfs",
"(",
"int",
"v",
",",
"int",
"[",
"]",
"cc",
",",
"int",
"id",
")",
"{",
"cc",
"[",
"v",
"]",
"=",
"id",
";",
"Queue",
"<",
"Integer",
">",
"queue",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"queue",
".",
"offer",
"(",
"v",
")",
";",
"while",
"(",
"!",
"queue",
".",
"isEmpty",
"(",
")",
")",
"{",
"int",
"t",
"=",
"queue",
".",
"poll",
"(",
")",
";",
"for",
"(",
"Edge",
"edge",
":",
"graph",
"[",
"t",
"]",
")",
"{",
"int",
"i",
"=",
"edge",
".",
"v2",
";",
"if",
"(",
"!",
"digraph",
"&&",
"i",
"==",
"t",
")",
"{",
"i",
"=",
"edge",
".",
"v1",
";",
"}",
"if",
"(",
"cc",
"[",
"i",
"]",
"==",
"-",
"1",
")",
"{",
"queue",
".",
"offer",
"(",
"i",
")",
";",
"cc",
"[",
"i",
"]",
"=",
"id",
";",
"}",
"}",
"}",
"}"
] |
Breadth-first search connected components of graph.
@param v the start vertex.
@param cc the array to store the connected component id of vertices.
@param id the current component id.
|
[
"Breadth",
"-",
"first",
"search",
"connected",
"components",
"of",
"graph",
"."
] |
train
|
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/graph/src/main/java/smile/graph/AdjacencyList.java#L474-L492
|
igniterealtime/Smack
|
smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java
|
PrivacyListManager.createPrivacyList
|
public void createPrivacyList(String listName, List<PrivacyItem> privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
"""
The client has created a new list. It send the new one to the server.
@param listName the list that has changed its content.
@param privacyItems a List with every privacy item in the list.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException
"""
updatePrivacyList(listName, privacyItems);
}
|
java
|
public void createPrivacyList(String listName, List<PrivacyItem> privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
updatePrivacyList(listName, privacyItems);
}
|
[
"public",
"void",
"createPrivacyList",
"(",
"String",
"listName",
",",
"List",
"<",
"PrivacyItem",
">",
"privacyItems",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"updatePrivacyList",
"(",
"listName",
",",
"privacyItems",
")",
";",
"}"
] |
The client has created a new list. It send the new one to the server.
@param listName the list that has changed its content.
@param privacyItems a List with every privacy item in the list.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException
|
[
"The",
"client",
"has",
"created",
"a",
"new",
"list",
".",
"It",
"send",
"the",
"new",
"one",
"to",
"the",
"server",
"."
] |
train
|
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java#L506-L508
|
JOML-CI/JOML
|
src/org/joml/Matrix3x2d.java
|
Matrix3x2d.translateLocal
|
public Matrix3x2d translateLocal(Vector2dc offset, Matrix3x2d dest) {
"""
Pre-multiply a translation to this matrix by translating by the given number of
units in x and y and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>T</code> the translation
matrix, then the new matrix will be <code>T * M</code>. So when
transforming a vector <code>v</code> with the new matrix by using
<code>T * M * v</code>, the translation will be applied last!
<p>
In order to set the matrix to a translation transformation without pre-multiplying
it, use {@link #translation(Vector2dc)}.
@see #translation(Vector2dc)
@param offset
the number of units in x and y by which to translate
@param dest
will hold the result
@return dest
"""
return translateLocal(offset.x(), offset.y(), dest);
}
|
java
|
public Matrix3x2d translateLocal(Vector2dc offset, Matrix3x2d dest) {
return translateLocal(offset.x(), offset.y(), dest);
}
|
[
"public",
"Matrix3x2d",
"translateLocal",
"(",
"Vector2dc",
"offset",
",",
"Matrix3x2d",
"dest",
")",
"{",
"return",
"translateLocal",
"(",
"offset",
".",
"x",
"(",
")",
",",
"offset",
".",
"y",
"(",
")",
",",
"dest",
")",
";",
"}"
] |
Pre-multiply a translation to this matrix by translating by the given number of
units in x and y and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>T</code> the translation
matrix, then the new matrix will be <code>T * M</code>. So when
transforming a vector <code>v</code> with the new matrix by using
<code>T * M * v</code>, the translation will be applied last!
<p>
In order to set the matrix to a translation transformation without pre-multiplying
it, use {@link #translation(Vector2dc)}.
@see #translation(Vector2dc)
@param offset
the number of units in x and y by which to translate
@param dest
will hold the result
@return dest
|
[
"Pre",
"-",
"multiply",
"a",
"translation",
"to",
"this",
"matrix",
"by",
"translating",
"by",
"the",
"given",
"number",
"of",
"units",
"in",
"x",
"and",
"y",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"dest<",
"/",
"code",
">",
".",
"<p",
">",
"If",
"<code",
">",
"M<",
"/",
"code",
">",
"is",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"and",
"<code",
">",
"T<",
"/",
"code",
">",
"the",
"translation",
"matrix",
"then",
"the",
"new",
"matrix",
"will",
"be",
"<code",
">",
"T",
"*",
"M<",
"/",
"code",
">",
".",
"So",
"when",
"transforming",
"a",
"vector",
"<code",
">",
"v<",
"/",
"code",
">",
"with",
"the",
"new",
"matrix",
"by",
"using",
"<code",
">",
"T",
"*",
"M",
"*",
"v<",
"/",
"code",
">",
"the",
"translation",
"will",
"be",
"applied",
"last!",
"<p",
">",
"In",
"order",
"to",
"set",
"the",
"matrix",
"to",
"a",
"translation",
"transformation",
"without",
"pre",
"-",
"multiplying",
"it",
"use",
"{",
"@link",
"#translation",
"(",
"Vector2dc",
")",
"}",
"."
] |
train
|
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2d.java#L660-L662
|
Samsung/GearVRf
|
GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRRigidBody.java
|
GVRRigidBody.setGravity
|
public void setGravity(float x, float y, float z) {
"""
Sets a particular acceleration vector [X, Y, Z] on this {@linkplain GVRRigidBody rigid body}
@param x factor on the 'X' axis.
@param y factor on the 'Y' axis.
@param z factor on the 'Z' axis.
"""
Native3DRigidBody.setGravity(getNative(), x, y, z);
}
|
java
|
public void setGravity(float x, float y, float z) {
Native3DRigidBody.setGravity(getNative(), x, y, z);
}
|
[
"public",
"void",
"setGravity",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"Native3DRigidBody",
".",
"setGravity",
"(",
"getNative",
"(",
")",
",",
"x",
",",
"y",
",",
"z",
")",
";",
"}"
] |
Sets a particular acceleration vector [X, Y, Z] on this {@linkplain GVRRigidBody rigid body}
@param x factor on the 'X' axis.
@param y factor on the 'Y' axis.
@param z factor on the 'Z' axis.
|
[
"Sets",
"a",
"particular",
"acceleration",
"vector",
"[",
"X",
"Y",
"Z",
"]",
"on",
"this",
"{",
"@linkplain",
"GVRRigidBody",
"rigid",
"body",
"}"
] |
train
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRRigidBody.java#L287-L289
|
elki-project/elki
|
elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/AbstractRStarTree.java
|
AbstractRStarTree.overflowTreatment
|
private N overflowTreatment(N node, IndexTreePath<E> path) {
"""
Treatment of overflow in the specified node: if the node is not the root
node and this is the first call of overflowTreatment in the given level
during insertion the specified node will be reinserted, otherwise the node
will be split.
@param node the node where an overflow occurred
@param path the path to the specified node
@return the newly created split node in case of split, null in case of
reinsertion
"""
if(settings.getOverflowTreatment().handleOverflow(this, node, path)) {
return null;
}
return split(node);
}
|
java
|
private N overflowTreatment(N node, IndexTreePath<E> path) {
if(settings.getOverflowTreatment().handleOverflow(this, node, path)) {
return null;
}
return split(node);
}
|
[
"private",
"N",
"overflowTreatment",
"(",
"N",
"node",
",",
"IndexTreePath",
"<",
"E",
">",
"path",
")",
"{",
"if",
"(",
"settings",
".",
"getOverflowTreatment",
"(",
")",
".",
"handleOverflow",
"(",
"this",
",",
"node",
",",
"path",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"split",
"(",
"node",
")",
";",
"}"
] |
Treatment of overflow in the specified node: if the node is not the root
node and this is the first call of overflowTreatment in the given level
during insertion the specified node will be reinserted, otherwise the node
will be split.
@param node the node where an overflow occurred
@param path the path to the specified node
@return the newly created split node in case of split, null in case of
reinsertion
|
[
"Treatment",
"of",
"overflow",
"in",
"the",
"specified",
"node",
":",
"if",
"the",
"node",
"is",
"not",
"the",
"root",
"node",
"and",
"this",
"is",
"the",
"first",
"call",
"of",
"overflowTreatment",
"in",
"the",
"given",
"level",
"during",
"insertion",
"the",
"specified",
"node",
"will",
"be",
"reinserted",
"otherwise",
"the",
"node",
"will",
"be",
"split",
"."
] |
train
|
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/AbstractRStarTree.java#L557-L562
|
raydac/java-comment-preprocessor
|
jcp/src/main/java/com/igormaznitsa/jcp/expression/Expression.java
|
Expression.evalExpression
|
@Nonnull
public static Value evalExpression(@Nonnull final String expression, @Nonnull final PreprocessorContext context) {
"""
Evaluate expression
@param expression the expression as a String, must not be null
@param context a preprocessor context to be used for expression operations
@return the result as a Value object, it can't be null
"""
try {
final ExpressionTree tree = ExpressionParser.getInstance().parse(expression, context);
return evalTree(tree, context);
} catch (IOException unexpected) {
throw context.makeException("[Expression]Wrong expression format detected [" + expression + ']', unexpected);
}
}
|
java
|
@Nonnull
public static Value evalExpression(@Nonnull final String expression, @Nonnull final PreprocessorContext context) {
try {
final ExpressionTree tree = ExpressionParser.getInstance().parse(expression, context);
return evalTree(tree, context);
} catch (IOException unexpected) {
throw context.makeException("[Expression]Wrong expression format detected [" + expression + ']', unexpected);
}
}
|
[
"@",
"Nonnull",
"public",
"static",
"Value",
"evalExpression",
"(",
"@",
"Nonnull",
"final",
"String",
"expression",
",",
"@",
"Nonnull",
"final",
"PreprocessorContext",
"context",
")",
"{",
"try",
"{",
"final",
"ExpressionTree",
"tree",
"=",
"ExpressionParser",
".",
"getInstance",
"(",
")",
".",
"parse",
"(",
"expression",
",",
"context",
")",
";",
"return",
"evalTree",
"(",
"tree",
",",
"context",
")",
";",
"}",
"catch",
"(",
"IOException",
"unexpected",
")",
"{",
"throw",
"context",
".",
"makeException",
"(",
"\"[Expression]Wrong expression format detected [\"",
"+",
"expression",
"+",
"'",
"'",
",",
"unexpected",
")",
";",
"}",
"}"
] |
Evaluate expression
@param expression the expression as a String, must not be null
@param context a preprocessor context to be used for expression operations
@return the result as a Value object, it can't be null
|
[
"Evaluate",
"expression"
] |
train
|
https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/jcp/expression/Expression.java#L82-L90
|
soarcn/COCOQuery
|
query/src/main/java/com/cocosw/query/AbstractViewQuery.java
|
AbstractViewQuery.imeAction
|
public T imeAction(int lable, final View associateView) {
"""
Change the custom IME action associated with the text view. click the lable will trigger the associateView's onClick method
@param lable
@param associateView
"""
if (view instanceof EditText) {
((EditText)view).setImeActionLabel(context.getString(lable),view.getId());
((EditText)view).setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
if (id == view.getId() || id == EditorInfo.IME_NULL) {
associateView.performClick();
return true;
}
return false;
}
});
}
return self();
}
|
java
|
public T imeAction(int lable, final View associateView) {
if (view instanceof EditText) {
((EditText)view).setImeActionLabel(context.getString(lable),view.getId());
((EditText)view).setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
if (id == view.getId() || id == EditorInfo.IME_NULL) {
associateView.performClick();
return true;
}
return false;
}
});
}
return self();
}
|
[
"public",
"T",
"imeAction",
"(",
"int",
"lable",
",",
"final",
"View",
"associateView",
")",
"{",
"if",
"(",
"view",
"instanceof",
"EditText",
")",
"{",
"(",
"(",
"EditText",
")",
"view",
")",
".",
"setImeActionLabel",
"(",
"context",
".",
"getString",
"(",
"lable",
")",
",",
"view",
".",
"getId",
"(",
")",
")",
";",
"(",
"(",
"EditText",
")",
"view",
")",
".",
"setOnEditorActionListener",
"(",
"new",
"TextView",
".",
"OnEditorActionListener",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"onEditorAction",
"(",
"TextView",
"textView",
",",
"int",
"id",
",",
"KeyEvent",
"keyEvent",
")",
"{",
"if",
"(",
"id",
"==",
"view",
".",
"getId",
"(",
")",
"||",
"id",
"==",
"EditorInfo",
".",
"IME_NULL",
")",
"{",
"associateView",
".",
"performClick",
"(",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"}",
")",
";",
"}",
"return",
"self",
"(",
")",
";",
"}"
] |
Change the custom IME action associated with the text view. click the lable will trigger the associateView's onClick method
@param lable
@param associateView
|
[
"Change",
"the",
"custom",
"IME",
"action",
"associated",
"with",
"the",
"text",
"view",
".",
"click",
"the",
"lable",
"will",
"trigger",
"the",
"associateView",
"s",
"onClick",
"method"
] |
train
|
https://github.com/soarcn/COCOQuery/blob/712eac37ab65ef3dbdf55dbfae28750edfc36608/query/src/main/java/com/cocosw/query/AbstractViewQuery.java#L173-L188
|
Azure/azure-sdk-for-java
|
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
|
ModelsImpl.addHierarchicalEntityAsync
|
public Observable<UUID> addHierarchicalEntityAsync(UUID appId, String versionId, HierarchicalEntityModel hierarchicalModelCreateObject) {
"""
Adds a hierarchical entity extractor to the application version.
@param appId The application ID.
@param versionId The version ID.
@param hierarchicalModelCreateObject A model containing the name and children of the new entity extractor.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UUID object
"""
return addHierarchicalEntityWithServiceResponseAsync(appId, versionId, hierarchicalModelCreateObject).map(new Func1<ServiceResponse<UUID>, UUID>() {
@Override
public UUID call(ServiceResponse<UUID> response) {
return response.body();
}
});
}
|
java
|
public Observable<UUID> addHierarchicalEntityAsync(UUID appId, String versionId, HierarchicalEntityModel hierarchicalModelCreateObject) {
return addHierarchicalEntityWithServiceResponseAsync(appId, versionId, hierarchicalModelCreateObject).map(new Func1<ServiceResponse<UUID>, UUID>() {
@Override
public UUID call(ServiceResponse<UUID> response) {
return response.body();
}
});
}
|
[
"public",
"Observable",
"<",
"UUID",
">",
"addHierarchicalEntityAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"HierarchicalEntityModel",
"hierarchicalModelCreateObject",
")",
"{",
"return",
"addHierarchicalEntityWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"hierarchicalModelCreateObject",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"UUID",
">",
",",
"UUID",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"UUID",
"call",
"(",
"ServiceResponse",
"<",
"UUID",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Adds a hierarchical entity extractor to the application version.
@param appId The application ID.
@param versionId The version ID.
@param hierarchicalModelCreateObject A model containing the name and children of the new entity extractor.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UUID object
|
[
"Adds",
"a",
"hierarchical",
"entity",
"extractor",
"to",
"the",
"application",
"version",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L1307-L1314
|
phax/ph-web
|
ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponseDefaultSettings.java
|
UnifiedResponseDefaultSettings.setReferrerPolicy
|
public static void setReferrerPolicy (@Nullable final EHttpReferrerPolicy eReferrerPolicy) {
"""
Set the default referrer policy to use. See
https://scotthelme.co.uk/a-new-security-header-referrer-policy/
@param eReferrerPolicy
Policy to use. May be <code>null</code>.
"""
if (eReferrerPolicy == null)
removeResponseHeaders (CHttpHeader.REFERRER_POLICY);
else
setResponseHeader (CHttpHeader.REFERRER_POLICY, eReferrerPolicy.getValue ());
}
|
java
|
public static void setReferrerPolicy (@Nullable final EHttpReferrerPolicy eReferrerPolicy)
{
if (eReferrerPolicy == null)
removeResponseHeaders (CHttpHeader.REFERRER_POLICY);
else
setResponseHeader (CHttpHeader.REFERRER_POLICY, eReferrerPolicy.getValue ());
}
|
[
"public",
"static",
"void",
"setReferrerPolicy",
"(",
"@",
"Nullable",
"final",
"EHttpReferrerPolicy",
"eReferrerPolicy",
")",
"{",
"if",
"(",
"eReferrerPolicy",
"==",
"null",
")",
"removeResponseHeaders",
"(",
"CHttpHeader",
".",
"REFERRER_POLICY",
")",
";",
"else",
"setResponseHeader",
"(",
"CHttpHeader",
".",
"REFERRER_POLICY",
",",
"eReferrerPolicy",
".",
"getValue",
"(",
")",
")",
";",
"}"
] |
Set the default referrer policy to use. See
https://scotthelme.co.uk/a-new-security-header-referrer-policy/
@param eReferrerPolicy
Policy to use. May be <code>null</code>.
|
[
"Set",
"the",
"default",
"referrer",
"policy",
"to",
"use",
".",
"See",
"https",
":",
"//",
"scotthelme",
".",
"co",
".",
"uk",
"/",
"a",
"-",
"new",
"-",
"security",
"-",
"header",
"-",
"referrer",
"-",
"policy",
"/"
] |
train
|
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponseDefaultSettings.java#L200-L206
|
brianwhu/xillium
|
data/src/main/java/org/xillium/data/persistence/ParametricQuery.java
|
ParametricQuery.executeSelect
|
public <T> T executeSelect(Connection conn, DataObject object, ResultSetWorker<T> worker) throws Exception {
"""
Executes the SELECT statement, passing the result set to the ResultSetWorker for processing.
The ResultSetWorker must close the result set before returning.
"""
PreparedStatement statement = conn.prepareStatement(_sql);
try {
load(statement, object);
return worker.process(statement.executeQuery());
} finally {
statement.close();
}
}
|
java
|
public <T> T executeSelect(Connection conn, DataObject object, ResultSetWorker<T> worker) throws Exception {
PreparedStatement statement = conn.prepareStatement(_sql);
try {
load(statement, object);
return worker.process(statement.executeQuery());
} finally {
statement.close();
}
}
|
[
"public",
"<",
"T",
">",
"T",
"executeSelect",
"(",
"Connection",
"conn",
",",
"DataObject",
"object",
",",
"ResultSetWorker",
"<",
"T",
">",
"worker",
")",
"throws",
"Exception",
"{",
"PreparedStatement",
"statement",
"=",
"conn",
".",
"prepareStatement",
"(",
"_sql",
")",
";",
"try",
"{",
"load",
"(",
"statement",
",",
"object",
")",
";",
"return",
"worker",
".",
"process",
"(",
"statement",
".",
"executeQuery",
"(",
")",
")",
";",
"}",
"finally",
"{",
"statement",
".",
"close",
"(",
")",
";",
"}",
"}"
] |
Executes the SELECT statement, passing the result set to the ResultSetWorker for processing.
The ResultSetWorker must close the result set before returning.
|
[
"Executes",
"the",
"SELECT",
"statement",
"passing",
"the",
"result",
"set",
"to",
"the",
"ResultSetWorker",
"for",
"processing",
"."
] |
train
|
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/data/src/main/java/org/xillium/data/persistence/ParametricQuery.java#L42-L50
|
mebigfatguy/fb-contrib
|
src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
|
SignatureUtils.getNumParameters
|
public static int getNumParameters(String methodSignature) {
"""
returns the number of parameters in this method signature
@param methodSignature
the method signature to parse
@return the number of parameters
"""
int start = methodSignature.indexOf('(') + 1;
int limit = methodSignature.lastIndexOf(')');
if ((limit - start) == 0) {
return 0;
}
int numParms = 0;
for (int i = start; i < limit; i++) {
if (!methodSignature.startsWith(Values.SIG_ARRAY_PREFIX, i)) {
if (methodSignature.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX, i)) {
i = methodSignature.indexOf(Values.SIG_QUALIFIED_CLASS_SUFFIX_CHAR, i + 1);
} else if (isWonkyEclipseSignature(methodSignature, i)) {
continue;
}
numParms++;
}
}
return numParms;
}
|
java
|
public static int getNumParameters(String methodSignature) {
int start = methodSignature.indexOf('(') + 1;
int limit = methodSignature.lastIndexOf(')');
if ((limit - start) == 0) {
return 0;
}
int numParms = 0;
for (int i = start; i < limit; i++) {
if (!methodSignature.startsWith(Values.SIG_ARRAY_PREFIX, i)) {
if (methodSignature.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX, i)) {
i = methodSignature.indexOf(Values.SIG_QUALIFIED_CLASS_SUFFIX_CHAR, i + 1);
} else if (isWonkyEclipseSignature(methodSignature, i)) {
continue;
}
numParms++;
}
}
return numParms;
}
|
[
"public",
"static",
"int",
"getNumParameters",
"(",
"String",
"methodSignature",
")",
"{",
"int",
"start",
"=",
"methodSignature",
".",
"indexOf",
"(",
"'",
"'",
")",
"+",
"1",
";",
"int",
"limit",
"=",
"methodSignature",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"(",
"limit",
"-",
"start",
")",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"int",
"numParms",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"limit",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"methodSignature",
".",
"startsWith",
"(",
"Values",
".",
"SIG_ARRAY_PREFIX",
",",
"i",
")",
")",
"{",
"if",
"(",
"methodSignature",
".",
"startsWith",
"(",
"Values",
".",
"SIG_QUALIFIED_CLASS_PREFIX",
",",
"i",
")",
")",
"{",
"i",
"=",
"methodSignature",
".",
"indexOf",
"(",
"Values",
".",
"SIG_QUALIFIED_CLASS_SUFFIX_CHAR",
",",
"i",
"+",
"1",
")",
";",
"}",
"else",
"if",
"(",
"isWonkyEclipseSignature",
"(",
"methodSignature",
",",
"i",
")",
")",
"{",
"continue",
";",
"}",
"numParms",
"++",
";",
"}",
"}",
"return",
"numParms",
";",
"}"
] |
returns the number of parameters in this method signature
@param methodSignature
the method signature to parse
@return the number of parameters
|
[
"returns",
"the",
"number",
"of",
"parameters",
"in",
"this",
"method",
"signature"
] |
train
|
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java#L273-L294
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/landf/ScreenUtil.java
|
ScreenUtil.setFont
|
public static void setFont(Font font, PropertyOwner propertyOwner, Map<String,Object> properties) {
"""
Encode and set the font info.
(Utility method).
Font is saved in three properties (font.fontname, font.size, font.style).
@param The registered font.
"""
if (font != null)
{
ScreenUtil.setProperty(ScreenUtil.FONT_SIZE, Integer.toString(font.getSize()), propertyOwner, properties);
ScreenUtil.setProperty(ScreenUtil.FONT_STYLE, Integer.toString(font.getStyle()), propertyOwner, properties);
ScreenUtil.setProperty(ScreenUtil.FONT_NAME, font.getName(), propertyOwner, properties);
}
else
{
ScreenUtil.setProperty(ScreenUtil.FONT_SIZE, null, propertyOwner, properties);
ScreenUtil.setProperty(ScreenUtil.FONT_STYLE, null, propertyOwner, properties);
ScreenUtil.setProperty(ScreenUtil.FONT_NAME, null, propertyOwner, properties);
}
}
|
java
|
public static void setFont(Font font, PropertyOwner propertyOwner, Map<String,Object> properties)
{
if (font != null)
{
ScreenUtil.setProperty(ScreenUtil.FONT_SIZE, Integer.toString(font.getSize()), propertyOwner, properties);
ScreenUtil.setProperty(ScreenUtil.FONT_STYLE, Integer.toString(font.getStyle()), propertyOwner, properties);
ScreenUtil.setProperty(ScreenUtil.FONT_NAME, font.getName(), propertyOwner, properties);
}
else
{
ScreenUtil.setProperty(ScreenUtil.FONT_SIZE, null, propertyOwner, properties);
ScreenUtil.setProperty(ScreenUtil.FONT_STYLE, null, propertyOwner, properties);
ScreenUtil.setProperty(ScreenUtil.FONT_NAME, null, propertyOwner, properties);
}
}
|
[
"public",
"static",
"void",
"setFont",
"(",
"Font",
"font",
",",
"PropertyOwner",
"propertyOwner",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"if",
"(",
"font",
"!=",
"null",
")",
"{",
"ScreenUtil",
".",
"setProperty",
"(",
"ScreenUtil",
".",
"FONT_SIZE",
",",
"Integer",
".",
"toString",
"(",
"font",
".",
"getSize",
"(",
")",
")",
",",
"propertyOwner",
",",
"properties",
")",
";",
"ScreenUtil",
".",
"setProperty",
"(",
"ScreenUtil",
".",
"FONT_STYLE",
",",
"Integer",
".",
"toString",
"(",
"font",
".",
"getStyle",
"(",
")",
")",
",",
"propertyOwner",
",",
"properties",
")",
";",
"ScreenUtil",
".",
"setProperty",
"(",
"ScreenUtil",
".",
"FONT_NAME",
",",
"font",
".",
"getName",
"(",
")",
",",
"propertyOwner",
",",
"properties",
")",
";",
"}",
"else",
"{",
"ScreenUtil",
".",
"setProperty",
"(",
"ScreenUtil",
".",
"FONT_SIZE",
",",
"null",
",",
"propertyOwner",
",",
"properties",
")",
";",
"ScreenUtil",
".",
"setProperty",
"(",
"ScreenUtil",
".",
"FONT_STYLE",
",",
"null",
",",
"propertyOwner",
",",
"properties",
")",
";",
"ScreenUtil",
".",
"setProperty",
"(",
"ScreenUtil",
".",
"FONT_NAME",
",",
"null",
",",
"propertyOwner",
",",
"properties",
")",
";",
"}",
"}"
] |
Encode and set the font info.
(Utility method).
Font is saved in three properties (font.fontname, font.size, font.style).
@param The registered font.
|
[
"Encode",
"and",
"set",
"the",
"font",
"info",
".",
"(",
"Utility",
"method",
")",
".",
"Font",
"is",
"saved",
"in",
"three",
"properties",
"(",
"font",
".",
"fontname",
"font",
".",
"size",
"font",
".",
"style",
")",
"."
] |
train
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/landf/ScreenUtil.java#L167-L181
|
OrienteerBAP/wicket-orientdb
|
wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaUtils.java
|
OSchemaUtils.probeOClass
|
public static OClass probeOClass(Iterable<ODocument> it, int probeLimit) {
"""
Check first several items to resolve common {@link OClass}
@param it {@link Iterable} over {@link ODocument}s
@param probeLimit limit over iterable
@return common {@link OClass} or null
"""
return probeOClass(it.iterator(), probeLimit);
}
|
java
|
public static OClass probeOClass(Iterable<ODocument> it, int probeLimit) {
return probeOClass(it.iterator(), probeLimit);
}
|
[
"public",
"static",
"OClass",
"probeOClass",
"(",
"Iterable",
"<",
"ODocument",
">",
"it",
",",
"int",
"probeLimit",
")",
"{",
"return",
"probeOClass",
"(",
"it",
".",
"iterator",
"(",
")",
",",
"probeLimit",
")",
";",
"}"
] |
Check first several items to resolve common {@link OClass}
@param it {@link Iterable} over {@link ODocument}s
@param probeLimit limit over iterable
@return common {@link OClass} or null
|
[
"Check",
"first",
"several",
"items",
"to",
"resolve",
"common",
"{"
] |
train
|
https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaUtils.java#L29-L31
|
wildfly/wildfly-core
|
request-controller/src/main/java/org/wildfly/extension/requestcontroller/ControlPoint.java
|
ControlPoint.queueTask
|
public void queueTask(Runnable task, Executor taskExecutor, long timeout, Runnable timeoutTask, boolean rejectOnSuspend) {
"""
Queues a task to run when the request controller allows it. There are two use cases for this:
<ol>
<li>This allows for requests to be queued instead of dropped when the request limit has been hit</li>
<li>Timed jobs that are supposed to execute while the container is suspended can be queued to execute
when it resumes</li>
</ol>
<p>
Note that the task will be run within the context of a {@link #beginRequest()} call, if the task
is executed there is no need to invoke on the control point again.
</p>
@param task The task to run
@param timeout The timeout in milliseconds, if this is larger than zero the task will be timed out after
this much time has elapsed
@param timeoutTask The task that is run on timeout
@param rejectOnSuspend If the task should be rejected if the container is suspended, if this happens the timeout task is invoked immediately
"""
controller.queueTask(this, task, taskExecutor, timeout, timeoutTask, rejectOnSuspend, false);
}
|
java
|
public void queueTask(Runnable task, Executor taskExecutor, long timeout, Runnable timeoutTask, boolean rejectOnSuspend) {
controller.queueTask(this, task, taskExecutor, timeout, timeoutTask, rejectOnSuspend, false);
}
|
[
"public",
"void",
"queueTask",
"(",
"Runnable",
"task",
",",
"Executor",
"taskExecutor",
",",
"long",
"timeout",
",",
"Runnable",
"timeoutTask",
",",
"boolean",
"rejectOnSuspend",
")",
"{",
"controller",
".",
"queueTask",
"(",
"this",
",",
"task",
",",
"taskExecutor",
",",
"timeout",
",",
"timeoutTask",
",",
"rejectOnSuspend",
",",
"false",
")",
";",
"}"
] |
Queues a task to run when the request controller allows it. There are two use cases for this:
<ol>
<li>This allows for requests to be queued instead of dropped when the request limit has been hit</li>
<li>Timed jobs that are supposed to execute while the container is suspended can be queued to execute
when it resumes</li>
</ol>
<p>
Note that the task will be run within the context of a {@link #beginRequest()} call, if the task
is executed there is no need to invoke on the control point again.
</p>
@param task The task to run
@param timeout The timeout in milliseconds, if this is larger than zero the task will be timed out after
this much time has elapsed
@param timeoutTask The task that is run on timeout
@param rejectOnSuspend If the task should be rejected if the container is suspended, if this happens the timeout task is invoked immediately
|
[
"Queues",
"a",
"task",
"to",
"run",
"when",
"the",
"request",
"controller",
"allows",
"it",
".",
"There",
"are",
"two",
"use",
"cases",
"for",
"this",
":",
"<ol",
">",
"<li",
">",
"This",
"allows",
"for",
"requests",
"to",
"be",
"queued",
"instead",
"of",
"dropped",
"when",
"the",
"request",
"limit",
"has",
"been",
"hit<",
"/",
"li",
">",
"<li",
">",
"Timed",
"jobs",
"that",
"are",
"supposed",
"to",
"execute",
"while",
"the",
"container",
"is",
"suspended",
"can",
"be",
"queued",
"to",
"execute",
"when",
"it",
"resumes<",
"/",
"li",
">",
"<",
"/",
"ol",
">",
"<p",
">",
"Note",
"that",
"the",
"task",
"will",
"be",
"run",
"within",
"the",
"context",
"of",
"a",
"{",
"@link",
"#beginRequest",
"()",
"}",
"call",
"if",
"the",
"task",
"is",
"executed",
"there",
"is",
"no",
"need",
"to",
"invoke",
"on",
"the",
"control",
"point",
"again",
".",
"<",
"/",
"p",
">"
] |
train
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/request-controller/src/main/java/org/wildfly/extension/requestcontroller/ControlPoint.java#L211-L213
|
couchbase/couchbase-lite-java-core
|
src/main/java/com/couchbase/lite/View.java
|
View.setMapReduce
|
@InterfaceAudience.Public
public boolean setMapReduce(Mapper mapBlock, Reducer reduceBlock, String version) {
"""
Defines a view's functions.
<p/>
The view's definition is given as a class that conforms to the Mapper or
Reducer interface (or null to delete the view). The body of the block
should call the 'emit' object (passed in as a paramter) for every key/value pair
it wants to write to the view.
<p/>
Since the function itself is obviously not stored in the database (only a unique
string idenfitying it), you must re-define the view on every launch of the app!
If the database needs to rebuild the view but the function hasn't been defined yet,
it will fail and the view will be empty, causing weird problems later on.
<p/>
It is very important that this block be a law-abiding map function! As in other
languages, it must be a "pure" function, with no side effects, that always emits
the same values given the same input document. That means that it should not access
or change any external state; be careful, since callbacks make that so easy that you
might do it inadvertently! The callback may be called on any thread, or on
multiple threads simultaneously. This won't be a problem if the code is "pure" as
described above, since it will as a consequence also be thread-safe.
"""
assert (mapBlock != null);
assert (version != null);
boolean changed = (this.version == null || !this.version.equals(version));
this.mapBlock = mapBlock;
this.reduceBlock = reduceBlock;
this.version = version;
viewStore.setVersion(version); // for SQLite
return changed;
}
|
java
|
@InterfaceAudience.Public
public boolean setMapReduce(Mapper mapBlock, Reducer reduceBlock, String version) {
assert (mapBlock != null);
assert (version != null);
boolean changed = (this.version == null || !this.version.equals(version));
this.mapBlock = mapBlock;
this.reduceBlock = reduceBlock;
this.version = version;
viewStore.setVersion(version); // for SQLite
return changed;
}
|
[
"@",
"InterfaceAudience",
".",
"Public",
"public",
"boolean",
"setMapReduce",
"(",
"Mapper",
"mapBlock",
",",
"Reducer",
"reduceBlock",
",",
"String",
"version",
")",
"{",
"assert",
"(",
"mapBlock",
"!=",
"null",
")",
";",
"assert",
"(",
"version",
"!=",
"null",
")",
";",
"boolean",
"changed",
"=",
"(",
"this",
".",
"version",
"==",
"null",
"||",
"!",
"this",
".",
"version",
".",
"equals",
"(",
"version",
")",
")",
";",
"this",
".",
"mapBlock",
"=",
"mapBlock",
";",
"this",
".",
"reduceBlock",
"=",
"reduceBlock",
";",
"this",
".",
"version",
"=",
"version",
";",
"viewStore",
".",
"setVersion",
"(",
"version",
")",
";",
"// for SQLite",
"return",
"changed",
";",
"}"
] |
Defines a view's functions.
<p/>
The view's definition is given as a class that conforms to the Mapper or
Reducer interface (or null to delete the view). The body of the block
should call the 'emit' object (passed in as a paramter) for every key/value pair
it wants to write to the view.
<p/>
Since the function itself is obviously not stored in the database (only a unique
string idenfitying it), you must re-define the view on every launch of the app!
If the database needs to rebuild the view but the function hasn't been defined yet,
it will fail and the view will be empty, causing weird problems later on.
<p/>
It is very important that this block be a law-abiding map function! As in other
languages, it must be a "pure" function, with no side effects, that always emits
the same values given the same input document. That means that it should not access
or change any external state; be careful, since callbacks make that so easy that you
might do it inadvertently! The callback may be called on any thread, or on
multiple threads simultaneously. This won't be a problem if the code is "pure" as
described above, since it will as a consequence also be thread-safe.
|
[
"Defines",
"a",
"view",
"s",
"functions",
".",
"<p",
"/",
">",
"The",
"view",
"s",
"definition",
"is",
"given",
"as",
"a",
"class",
"that",
"conforms",
"to",
"the",
"Mapper",
"or",
"Reducer",
"interface",
"(",
"or",
"null",
"to",
"delete",
"the",
"view",
")",
".",
"The",
"body",
"of",
"the",
"block",
"should",
"call",
"the",
"emit",
"object",
"(",
"passed",
"in",
"as",
"a",
"paramter",
")",
"for",
"every",
"key",
"/",
"value",
"pair",
"it",
"wants",
"to",
"write",
"to",
"the",
"view",
".",
"<p",
"/",
">",
"Since",
"the",
"function",
"itself",
"is",
"obviously",
"not",
"stored",
"in",
"the",
"database",
"(",
"only",
"a",
"unique",
"string",
"idenfitying",
"it",
")",
"you",
"must",
"re",
"-",
"define",
"the",
"view",
"on",
"every",
"launch",
"of",
"the",
"app!",
"If",
"the",
"database",
"needs",
"to",
"rebuild",
"the",
"view",
"but",
"the",
"function",
"hasn",
"t",
"been",
"defined",
"yet",
"it",
"will",
"fail",
"and",
"the",
"view",
"will",
"be",
"empty",
"causing",
"weird",
"problems",
"later",
"on",
".",
"<p",
"/",
">",
"It",
"is",
"very",
"important",
"that",
"this",
"block",
"be",
"a",
"law",
"-",
"abiding",
"map",
"function!",
"As",
"in",
"other",
"languages",
"it",
"must",
"be",
"a",
"pure",
"function",
"with",
"no",
"side",
"effects",
"that",
"always",
"emits",
"the",
"same",
"values",
"given",
"the",
"same",
"input",
"document",
".",
"That",
"means",
"that",
"it",
"should",
"not",
"access",
"or",
"change",
"any",
"external",
"state",
";",
"be",
"careful",
"since",
"callbacks",
"make",
"that",
"so",
"easy",
"that",
"you",
"might",
"do",
"it",
"inadvertently!",
"The",
"callback",
"may",
"be",
"called",
"on",
"any",
"thread",
"or",
"on",
"multiple",
"threads",
"simultaneously",
".",
"This",
"won",
"t",
"be",
"a",
"problem",
"if",
"the",
"code",
"is",
"pure",
"as",
"described",
"above",
"since",
"it",
"will",
"as",
"a",
"consequence",
"also",
"be",
"thread",
"-",
"safe",
"."
] |
train
|
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/View.java#L150-L160
|
kuali/ojb-1.0.4
|
src/java/org/apache/ojb/broker/query/SearchFilter.java
|
SearchFilter.compareFilter
|
public void compareFilter(String ElementName, String value, int oper) throws DBException {
"""
Change the search filter to one that compares an element name to a value.
The old search filter is deleted.
@param ElementName is the name of the element to be tested
@param value is the value to be compared against
@param oper is the binary comparison operator to be used
@exception DBException
"""
// Delete the old search filter
m_filter = null;
// If this is not a binary operator, throw an exception
if ((oper & BINARY_OPER_MASK) == 0)
{
throw new DBException();
// Create a SearchBaseLeafComparison node and store it as the filter
}
m_filter = new SearchBaseLeafComparison(ElementName, oper, value);
}
|
java
|
public void compareFilter(String ElementName, String value, int oper) throws DBException
{
// Delete the old search filter
m_filter = null;
// If this is not a binary operator, throw an exception
if ((oper & BINARY_OPER_MASK) == 0)
{
throw new DBException();
// Create a SearchBaseLeafComparison node and store it as the filter
}
m_filter = new SearchBaseLeafComparison(ElementName, oper, value);
}
|
[
"public",
"void",
"compareFilter",
"(",
"String",
"ElementName",
",",
"String",
"value",
",",
"int",
"oper",
")",
"throws",
"DBException",
"{",
"// Delete the old search filter\r",
"m_filter",
"=",
"null",
";",
"// If this is not a binary operator, throw an exception\r",
"if",
"(",
"(",
"oper",
"&",
"BINARY_OPER_MASK",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"DBException",
"(",
")",
";",
"// Create a SearchBaseLeafComparison node and store it as the filter\r",
"}",
"m_filter",
"=",
"new",
"SearchBaseLeafComparison",
"(",
"ElementName",
",",
"oper",
",",
"value",
")",
";",
"}"
] |
Change the search filter to one that compares an element name to a value.
The old search filter is deleted.
@param ElementName is the name of the element to be tested
@param value is the value to be compared against
@param oper is the binary comparison operator to be used
@exception DBException
|
[
"Change",
"the",
"search",
"filter",
"to",
"one",
"that",
"compares",
"an",
"element",
"name",
"to",
"a",
"value",
".",
"The",
"old",
"search",
"filter",
"is",
"deleted",
"."
] |
train
|
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/SearchFilter.java#L196-L207
|
zaproxy/zaproxy
|
src/org/zaproxy/zap/model/Context.java
|
Context.fillNodesInContext
|
private void fillNodesInContext(SiteNode rootNode, List<SiteNode> nodesList) {
"""
Fills a given list with nodes in scope, searching recursively.
@param rootNode the root node
@param nodesList the nodes list
"""
@SuppressWarnings("unchecked")
Enumeration<TreeNode> en = rootNode.children();
while (en.hasMoreElements()) {
SiteNode sn = (SiteNode) en.nextElement();
if (isInContext(sn)) {
nodesList.add(sn);
}
fillNodesInContext(sn, nodesList);
}
}
|
java
|
private void fillNodesInContext(SiteNode rootNode, List<SiteNode> nodesList) {
@SuppressWarnings("unchecked")
Enumeration<TreeNode> en = rootNode.children();
while (en.hasMoreElements()) {
SiteNode sn = (SiteNode) en.nextElement();
if (isInContext(sn)) {
nodesList.add(sn);
}
fillNodesInContext(sn, nodesList);
}
}
|
[
"private",
"void",
"fillNodesInContext",
"(",
"SiteNode",
"rootNode",
",",
"List",
"<",
"SiteNode",
">",
"nodesList",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Enumeration",
"<",
"TreeNode",
">",
"en",
"=",
"rootNode",
".",
"children",
"(",
")",
";",
"while",
"(",
"en",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"SiteNode",
"sn",
"=",
"(",
"SiteNode",
")",
"en",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"isInContext",
"(",
"sn",
")",
")",
"{",
"nodesList",
".",
"add",
"(",
"sn",
")",
";",
"}",
"fillNodesInContext",
"(",
"sn",
",",
"nodesList",
")",
";",
"}",
"}"
] |
Fills a given list with nodes in scope, searching recursively.
@param rootNode the root node
@param nodesList the nodes list
|
[
"Fills",
"a",
"given",
"list",
"with",
"nodes",
"in",
"scope",
"searching",
"recursively",
"."
] |
train
|
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/model/Context.java#L289-L299
|
akberc/ceylon-maven-plugin
|
src/main/java/com/dgwave/car/repo/CeylonRepoLayout.java
|
CeylonRepoLayout.toUri
|
private URI toUri(final String path) {
"""
Converts from String to URI.
@param path The string to convert
@return URI if there was no exception
"""
try {
return new URI(null, null, path, null);
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
}
|
java
|
private URI toUri(final String path) {
try {
return new URI(null, null, path, null);
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
}
|
[
"private",
"URI",
"toUri",
"(",
"final",
"String",
"path",
")",
"{",
"try",
"{",
"return",
"new",
"URI",
"(",
"null",
",",
"null",
",",
"path",
",",
"null",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"e",
")",
";",
"}",
"}"
] |
Converts from String to URI.
@param path The string to convert
@return URI if there was no exception
|
[
"Converts",
"from",
"String",
"to",
"URI",
"."
] |
train
|
https://github.com/akberc/ceylon-maven-plugin/blob/b7f6c4a2b24f2fa237350c9e715f4193e83415ef/src/main/java/com/dgwave/car/repo/CeylonRepoLayout.java#L84-L90
|
deeplearning4j/deeplearning4j
|
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/NetworkUtils.java
|
NetworkUtils.setLearningRate
|
public static void setLearningRate(ComputationGraph net, String layerName, double newLr) {
"""
Set the learning rate for a single layer in the network to the specified value. Note that if any learning rate
schedules are currently present, these will be removed in favor of the new (fixed) learning rate.<br>
<br>
<b>Note</b>: <i>This method not free from a performance point of view</i>: a proper learning rate schedule
should be used in preference to calling this method at every iteration. Note also that
{@link #setLearningRate(ComputationGraph, double)} should also be used in preference, when all layers need to be set to a new LR
@param layerName Name of the layer to set the LR for
@param newLr New learning rate for a single layers
"""
setLearningRate(net, layerName, newLr, null, true);
}
|
java
|
public static void setLearningRate(ComputationGraph net, String layerName, double newLr) {
setLearningRate(net, layerName, newLr, null, true);
}
|
[
"public",
"static",
"void",
"setLearningRate",
"(",
"ComputationGraph",
"net",
",",
"String",
"layerName",
",",
"double",
"newLr",
")",
"{",
"setLearningRate",
"(",
"net",
",",
"layerName",
",",
"newLr",
",",
"null",
",",
"true",
")",
";",
"}"
] |
Set the learning rate for a single layer in the network to the specified value. Note that if any learning rate
schedules are currently present, these will be removed in favor of the new (fixed) learning rate.<br>
<br>
<b>Note</b>: <i>This method not free from a performance point of view</i>: a proper learning rate schedule
should be used in preference to calling this method at every iteration. Note also that
{@link #setLearningRate(ComputationGraph, double)} should also be used in preference, when all layers need to be set to a new LR
@param layerName Name of the layer to set the LR for
@param newLr New learning rate for a single layers
|
[
"Set",
"the",
"learning",
"rate",
"for",
"a",
"single",
"layer",
"in",
"the",
"network",
"to",
"the",
"specified",
"value",
".",
"Note",
"that",
"if",
"any",
"learning",
"rate",
"schedules",
"are",
"currently",
"present",
"these",
"will",
"be",
"removed",
"in",
"favor",
"of",
"the",
"new",
"(",
"fixed",
")",
"learning",
"rate",
".",
"<br",
">",
"<br",
">",
"<b",
">",
"Note<",
"/",
"b",
">",
":",
"<i",
">",
"This",
"method",
"not",
"free",
"from",
"a",
"performance",
"point",
"of",
"view<",
"/",
"i",
">",
":",
"a",
"proper",
"learning",
"rate",
"schedule",
"should",
"be",
"used",
"in",
"preference",
"to",
"calling",
"this",
"method",
"at",
"every",
"iteration",
".",
"Note",
"also",
"that",
"{",
"@link",
"#setLearningRate",
"(",
"ComputationGraph",
"double",
")",
"}",
"should",
"also",
"be",
"used",
"in",
"preference",
"when",
"all",
"layers",
"need",
"to",
"be",
"set",
"to",
"a",
"new",
"LR"
] |
train
|
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/NetworkUtils.java#L298-L300
|
Azure/azure-sdk-for-java
|
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java
|
WorkflowsInner.listSwagger
|
public Object listSwagger(String resourceGroupName, String workflowName) {
"""
Gets an OpenAPI definition for the workflow.
@param resourceGroupName The resource group name.
@param workflowName The workflow name.
@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 Object object if successful.
"""
return listSwaggerWithServiceResponseAsync(resourceGroupName, workflowName).toBlocking().single().body();
}
|
java
|
public Object listSwagger(String resourceGroupName, String workflowName) {
return listSwaggerWithServiceResponseAsync(resourceGroupName, workflowName).toBlocking().single().body();
}
|
[
"public",
"Object",
"listSwagger",
"(",
"String",
"resourceGroupName",
",",
"String",
"workflowName",
")",
"{",
"return",
"listSwaggerWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"workflowName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] |
Gets an OpenAPI definition for the workflow.
@param resourceGroupName The resource group name.
@param workflowName The workflow name.
@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 Object object if successful.
|
[
"Gets",
"an",
"OpenAPI",
"definition",
"for",
"the",
"workflow",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java#L1406-L1408
|
roboconf/roboconf-platform
|
miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java
|
CompletionUtils.resolveStringDescription
|
public static String resolveStringDescription( String variableName, String defaultValue ) {
"""
Resolves the description to show for an exported variable.
@param variableName a non-null variable name
@param defaultValue the default value (can be null)
@return a description (can be null)
"""
String result = null;
if( Constants.SPECIFIC_VARIABLE_IP.equalsIgnoreCase( variableName )
|| variableName.toLowerCase().endsWith( "." + Constants.SPECIFIC_VARIABLE_IP ))
result = SET_BY_ROBOCONF;
else if( ! Utils.isEmptyOrWhitespaces( defaultValue ))
result = DEFAULT_VALUE + defaultValue;
return result;
}
|
java
|
public static String resolveStringDescription( String variableName, String defaultValue ) {
String result = null;
if( Constants.SPECIFIC_VARIABLE_IP.equalsIgnoreCase( variableName )
|| variableName.toLowerCase().endsWith( "." + Constants.SPECIFIC_VARIABLE_IP ))
result = SET_BY_ROBOCONF;
else if( ! Utils.isEmptyOrWhitespaces( defaultValue ))
result = DEFAULT_VALUE + defaultValue;
return result;
}
|
[
"public",
"static",
"String",
"resolveStringDescription",
"(",
"String",
"variableName",
",",
"String",
"defaultValue",
")",
"{",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"Constants",
".",
"SPECIFIC_VARIABLE_IP",
".",
"equalsIgnoreCase",
"(",
"variableName",
")",
"||",
"variableName",
".",
"toLowerCase",
"(",
")",
".",
"endsWith",
"(",
"\".\"",
"+",
"Constants",
".",
"SPECIFIC_VARIABLE_IP",
")",
")",
"result",
"=",
"SET_BY_ROBOCONF",
";",
"else",
"if",
"(",
"!",
"Utils",
".",
"isEmptyOrWhitespaces",
"(",
"defaultValue",
")",
")",
"result",
"=",
"DEFAULT_VALUE",
"+",
"defaultValue",
";",
"return",
"result",
";",
"}"
] |
Resolves the description to show for an exported variable.
@param variableName a non-null variable name
@param defaultValue the default value (can be null)
@return a description (can be null)
|
[
"Resolves",
"the",
"description",
"to",
"show",
"for",
"an",
"exported",
"variable",
"."
] |
train
|
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java#L263-L273
|
Azure/azure-sdk-for-java
|
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java
|
VirtualNetworksInner.createOrUpdate
|
public VirtualNetworkInner createOrUpdate(String resourceGroupName, String virtualNetworkName, VirtualNetworkInner parameters) {
"""
Creates or updates a virtual network in the specified resource group.
@param resourceGroupName The name of the resource group.
@param virtualNetworkName The name of the virtual network.
@param parameters Parameters supplied to the create or update virtual network operation
@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 VirtualNetworkInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, parameters).toBlocking().last().body();
}
|
java
|
public VirtualNetworkInner createOrUpdate(String resourceGroupName, String virtualNetworkName, VirtualNetworkInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, parameters).toBlocking().last().body();
}
|
[
"public",
"VirtualNetworkInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkName",
",",
"VirtualNetworkInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetworkName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] |
Creates or updates a virtual network in the specified resource group.
@param resourceGroupName The name of the resource group.
@param virtualNetworkName The name of the virtual network.
@param parameters Parameters supplied to the create or update virtual network operation
@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 VirtualNetworkInner object if successful.
|
[
"Creates",
"or",
"updates",
"a",
"virtual",
"network",
"in",
"the",
"specified",
"resource",
"group",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java#L456-L458
|
GeoLatte/geolatte-common
|
src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java
|
AbstractJsonDeserializer.getBooleanParam
|
protected Boolean getBooleanParam(String paramName, String errorMessage, Map<String, Object> mapToUse) throws IOException {
"""
Convenience method for subclasses.
@param paramName the name of the parameter
@param errorMessage the errormessage to add to the exception if the param does not exist.
@param mapToUse The map to use as inputsource for parameters. Should not be null.
@return a stringparameter with given name. If it does not exist and the errormessage is provided,
an IOException is thrown with that message. if the errormessage is not provided, null is returned.
@throws IOException Exception if the paramname does not exist and an errormessage is provided.
"""
Boolean result = getTypedParam(paramName, errorMessage, Boolean.class, mapToUse);
if (result == null) {
String s = getTypedParam(paramName, errorMessage, String.class, mapToUse);
if (s != null) {
return Boolean.parseBoolean(s);
}
}
return result;
}
|
java
|
protected Boolean getBooleanParam(String paramName, String errorMessage, Map<String, Object> mapToUse) throws IOException {
Boolean result = getTypedParam(paramName, errorMessage, Boolean.class, mapToUse);
if (result == null) {
String s = getTypedParam(paramName, errorMessage, String.class, mapToUse);
if (s != null) {
return Boolean.parseBoolean(s);
}
}
return result;
}
|
[
"protected",
"Boolean",
"getBooleanParam",
"(",
"String",
"paramName",
",",
"String",
"errorMessage",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"mapToUse",
")",
"throws",
"IOException",
"{",
"Boolean",
"result",
"=",
"getTypedParam",
"(",
"paramName",
",",
"errorMessage",
",",
"Boolean",
".",
"class",
",",
"mapToUse",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"String",
"s",
"=",
"getTypedParam",
"(",
"paramName",
",",
"errorMessage",
",",
"String",
".",
"class",
",",
"mapToUse",
")",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"return",
"Boolean",
".",
"parseBoolean",
"(",
"s",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Convenience method for subclasses.
@param paramName the name of the parameter
@param errorMessage the errormessage to add to the exception if the param does not exist.
@param mapToUse The map to use as inputsource for parameters. Should not be null.
@return a stringparameter with given name. If it does not exist and the errormessage is provided,
an IOException is thrown with that message. if the errormessage is not provided, null is returned.
@throws IOException Exception if the paramname does not exist and an errormessage is provided.
|
[
"Convenience",
"method",
"for",
"subclasses",
"."
] |
train
|
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java#L238-L247
|
zamrokk/fabric-sdk-java
|
src/main/java/org/hyperledger/fabric/sdk/Member.java
|
Member.getNextTCert
|
public TCert getNextTCert(List<String> attrs) {
"""
Get the next available transaction certificate with the appropriate attributes.
"""
if (!isEnrolled()) {
throw new RuntimeException(String.format("user '%s' is not enrolled", this.getName()));
}
String key = getAttrsKey(attrs);
logger.debug(String.format("Member.getNextTCert: key=%s", key));
TCertGetter tcertGetter = this.tcertGetterMap.get(key);
if (tcertGetter == null) {
logger.debug(String.format("Member.getNextTCert: key=%s, creating new getter", key));
tcertGetter = new TCertGetter(this, attrs, key);
this.tcertGetterMap.put(key, tcertGetter);
}
return tcertGetter.getNextTCert();
}
|
java
|
public TCert getNextTCert(List<String> attrs) {
if (!isEnrolled()) {
throw new RuntimeException(String.format("user '%s' is not enrolled", this.getName()));
}
String key = getAttrsKey(attrs);
logger.debug(String.format("Member.getNextTCert: key=%s", key));
TCertGetter tcertGetter = this.tcertGetterMap.get(key);
if (tcertGetter == null) {
logger.debug(String.format("Member.getNextTCert: key=%s, creating new getter", key));
tcertGetter = new TCertGetter(this, attrs, key);
this.tcertGetterMap.put(key, tcertGetter);
}
return tcertGetter.getNextTCert();
}
|
[
"public",
"TCert",
"getNextTCert",
"(",
"List",
"<",
"String",
">",
"attrs",
")",
"{",
"if",
"(",
"!",
"isEnrolled",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"String",
".",
"format",
"(",
"\"user '%s' is not enrolled\"",
",",
"this",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"String",
"key",
"=",
"getAttrsKey",
"(",
"attrs",
")",
";",
"logger",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"Member.getNextTCert: key=%s\"",
",",
"key",
")",
")",
";",
"TCertGetter",
"tcertGetter",
"=",
"this",
".",
"tcertGetterMap",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"tcertGetter",
"==",
"null",
")",
"{",
"logger",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"Member.getNextTCert: key=%s, creating new getter\"",
",",
"key",
")",
")",
";",
"tcertGetter",
"=",
"new",
"TCertGetter",
"(",
"this",
",",
"attrs",
",",
"key",
")",
";",
"this",
".",
"tcertGetterMap",
".",
"put",
"(",
"key",
",",
"tcertGetter",
")",
";",
"}",
"return",
"tcertGetter",
".",
"getNextTCert",
"(",
")",
";",
"}"
] |
Get the next available transaction certificate with the appropriate attributes.
|
[
"Get",
"the",
"next",
"available",
"transaction",
"certificate",
"with",
"the",
"appropriate",
"attributes",
"."
] |
train
|
https://github.com/zamrokk/fabric-sdk-java/blob/d4993ca602f72d412cd682e1b92e805e48b27afa/src/main/java/org/hyperledger/fabric/sdk/Member.java#L308-L322
|
intendia-oss/rxjava-gwt
|
src/main/modified/io/reactivex/super/io/reactivex/Single.java
|
Single.onErrorResumeNext
|
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Single<T> onErrorResumeNext(
final Function<? super Throwable, ? extends SingleSource<? extends T>> resumeFunctionInCaseOfError) {
"""
Instructs a Single to pass control to another Single rather than invoking
{@link SingleObserver#onError(Throwable)} if it encounters an error.
<p>
<img width="640" height="451" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.onErrorResumeNext.f.png" alt="">
<p>
By default, when a Single encounters an error that prevents it from emitting the expected item to
its {@link SingleObserver}, the Single invokes its SingleObserver's {@code onError} method, and then quits
without invoking any more of its SingleObserver's methods. The {@code onErrorResumeNext} method changes this
behavior. If you pass a function that will return another Single ({@code resumeFunctionInCaseOfError}) to a Single's
{@code onErrorResumeNext} method, if the original Single encounters an error, instead of invoking its
SingleObserver's {@code onError} method, it will instead relinquish control to {@code resumeSingleInCaseOfError} which
will invoke the SingleObserver's {@link SingleObserver#onSuccess onSuccess} method if it is able to do so. In such a case,
because no Single necessarily invokes {@code onError}, the SingleObserver may never know that an error
happened.
<p>
You can use this to prevent errors from propagating or to supply fallback data should errors be
encountered.
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code onErrorResumeNext} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param resumeFunctionInCaseOfError a function that returns a Single that will take control if source Single encounters an error.
@return the original Single, with appropriately modified behavior.
@see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
@since .20
"""
ObjectHelper.requireNonNull(resumeFunctionInCaseOfError, "resumeFunctionInCaseOfError is null");
return RxJavaPlugins.onAssembly(new SingleResumeNext<T>(this, resumeFunctionInCaseOfError));
}
|
java
|
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Single<T> onErrorResumeNext(
final Function<? super Throwable, ? extends SingleSource<? extends T>> resumeFunctionInCaseOfError) {
ObjectHelper.requireNonNull(resumeFunctionInCaseOfError, "resumeFunctionInCaseOfError is null");
return RxJavaPlugins.onAssembly(new SingleResumeNext<T>(this, resumeFunctionInCaseOfError));
}
|
[
"@",
"CheckReturnValue",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"Single",
"<",
"T",
">",
"onErrorResumeNext",
"(",
"final",
"Function",
"<",
"?",
"super",
"Throwable",
",",
"?",
"extends",
"SingleSource",
"<",
"?",
"extends",
"T",
">",
">",
"resumeFunctionInCaseOfError",
")",
"{",
"ObjectHelper",
".",
"requireNonNull",
"(",
"resumeFunctionInCaseOfError",
",",
"\"resumeFunctionInCaseOfError is null\"",
")",
";",
"return",
"RxJavaPlugins",
".",
"onAssembly",
"(",
"new",
"SingleResumeNext",
"<",
"T",
">",
"(",
"this",
",",
"resumeFunctionInCaseOfError",
")",
")",
";",
"}"
] |
Instructs a Single to pass control to another Single rather than invoking
{@link SingleObserver#onError(Throwable)} if it encounters an error.
<p>
<img width="640" height="451" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.onErrorResumeNext.f.png" alt="">
<p>
By default, when a Single encounters an error that prevents it from emitting the expected item to
its {@link SingleObserver}, the Single invokes its SingleObserver's {@code onError} method, and then quits
without invoking any more of its SingleObserver's methods. The {@code onErrorResumeNext} method changes this
behavior. If you pass a function that will return another Single ({@code resumeFunctionInCaseOfError}) to a Single's
{@code onErrorResumeNext} method, if the original Single encounters an error, instead of invoking its
SingleObserver's {@code onError} method, it will instead relinquish control to {@code resumeSingleInCaseOfError} which
will invoke the SingleObserver's {@link SingleObserver#onSuccess onSuccess} method if it is able to do so. In such a case,
because no Single necessarily invokes {@code onError}, the SingleObserver may never know that an error
happened.
<p>
You can use this to prevent errors from propagating or to supply fallback data should errors be
encountered.
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code onErrorResumeNext} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param resumeFunctionInCaseOfError a function that returns a Single that will take control if source Single encounters an error.
@return the original Single, with appropriately modified behavior.
@see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
@since .20
|
[
"Instructs",
"a",
"Single",
"to",
"pass",
"control",
"to",
"another",
"Single",
"rather",
"than",
"invoking",
"{",
"@link",
"SingleObserver#onError",
"(",
"Throwable",
")",
"}",
"if",
"it",
"encounters",
"an",
"error",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"451",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
"/",
"ReactiveX",
"/",
"RxJava",
"/",
"images",
"/",
"rx",
"-",
"operators",
"/",
"Single",
".",
"onErrorResumeNext",
".",
"f",
".",
"png",
"alt",
"=",
">",
"<p",
">",
"By",
"default",
"when",
"a",
"Single",
"encounters",
"an",
"error",
"that",
"prevents",
"it",
"from",
"emitting",
"the",
"expected",
"item",
"to",
"its",
"{",
"@link",
"SingleObserver",
"}",
"the",
"Single",
"invokes",
"its",
"SingleObserver",
"s",
"{",
"@code",
"onError",
"}",
"method",
"and",
"then",
"quits",
"without",
"invoking",
"any",
"more",
"of",
"its",
"SingleObserver",
"s",
"methods",
".",
"The",
"{",
"@code",
"onErrorResumeNext",
"}",
"method",
"changes",
"this",
"behavior",
".",
"If",
"you",
"pass",
"a",
"function",
"that",
"will",
"return",
"another",
"Single",
"(",
"{",
"@code",
"resumeFunctionInCaseOfError",
"}",
")",
"to",
"a",
"Single",
"s",
"{",
"@code",
"onErrorResumeNext",
"}",
"method",
"if",
"the",
"original",
"Single",
"encounters",
"an",
"error",
"instead",
"of",
"invoking",
"its",
"SingleObserver",
"s",
"{",
"@code",
"onError",
"}",
"method",
"it",
"will",
"instead",
"relinquish",
"control",
"to",
"{",
"@code",
"resumeSingleInCaseOfError",
"}",
"which",
"will",
"invoke",
"the",
"SingleObserver",
"s",
"{",
"@link",
"SingleObserver#onSuccess",
"onSuccess",
"}",
"method",
"if",
"it",
"is",
"able",
"to",
"do",
"so",
".",
"In",
"such",
"a",
"case",
"because",
"no",
"Single",
"necessarily",
"invokes",
"{",
"@code",
"onError",
"}",
"the",
"SingleObserver",
"may",
"never",
"know",
"that",
"an",
"error",
"happened",
".",
"<p",
">",
"You",
"can",
"use",
"this",
"to",
"prevent",
"errors",
"from",
"propagating",
"or",
"to",
"supply",
"fallback",
"data",
"should",
"errors",
"be",
"encountered",
".",
"<dl",
">",
"<dt",
">",
"<b",
">",
"Scheduler",
":",
"<",
"/",
"b",
">",
"<",
"/",
"dt",
">",
"<dd",
">",
"{",
"@code",
"onErrorResumeNext",
"}",
"does",
"not",
"operate",
"by",
"default",
"on",
"a",
"particular",
"{",
"@link",
"Scheduler",
"}",
".",
"<",
"/",
"dd",
">",
"<",
"/",
"dl",
">"
] |
train
|
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Single.java#L3078-L3084
|
knowm/XChange
|
xchange-btcturk/src/main/java/org/knowm/xchange/btcturk/BTCTurkAdapters.java
|
BTCTurkAdapters.adaptTrades
|
public static Trades adaptTrades(List<BTCTurkTrades> btcTurkTrades, CurrencyPair currencyPair) {
"""
Adapts a BTCTurkTrade[] to a Trades Object
@param btcTurkTrades The BTCTurk trades
@param currencyPair (e.g. BTC/TRY)
@return The XChange Trades
"""
List<Trade> trades = new ArrayList<>();
BigDecimal lastTradeId = new BigDecimal("0");
for (BTCTurkTrades btcTurkTrade : btcTurkTrades) {
if (btcTurkTrade.getTid().compareTo(lastTradeId) > 0) {
lastTradeId = btcTurkTrade.getTid();
}
trades.add(adaptTrade(btcTurkTrade, currencyPair));
}
return new Trades(trades, lastTradeId.longValue(), Trades.TradeSortType.SortByID);
}
|
java
|
public static Trades adaptTrades(List<BTCTurkTrades> btcTurkTrades, CurrencyPair currencyPair) {
List<Trade> trades = new ArrayList<>();
BigDecimal lastTradeId = new BigDecimal("0");
for (BTCTurkTrades btcTurkTrade : btcTurkTrades) {
if (btcTurkTrade.getTid().compareTo(lastTradeId) > 0) {
lastTradeId = btcTurkTrade.getTid();
}
trades.add(adaptTrade(btcTurkTrade, currencyPair));
}
return new Trades(trades, lastTradeId.longValue(), Trades.TradeSortType.SortByID);
}
|
[
"public",
"static",
"Trades",
"adaptTrades",
"(",
"List",
"<",
"BTCTurkTrades",
">",
"btcTurkTrades",
",",
"CurrencyPair",
"currencyPair",
")",
"{",
"List",
"<",
"Trade",
">",
"trades",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"BigDecimal",
"lastTradeId",
"=",
"new",
"BigDecimal",
"(",
"\"0\"",
")",
";",
"for",
"(",
"BTCTurkTrades",
"btcTurkTrade",
":",
"btcTurkTrades",
")",
"{",
"if",
"(",
"btcTurkTrade",
".",
"getTid",
"(",
")",
".",
"compareTo",
"(",
"lastTradeId",
")",
">",
"0",
")",
"{",
"lastTradeId",
"=",
"btcTurkTrade",
".",
"getTid",
"(",
")",
";",
"}",
"trades",
".",
"add",
"(",
"adaptTrade",
"(",
"btcTurkTrade",
",",
"currencyPair",
")",
")",
";",
"}",
"return",
"new",
"Trades",
"(",
"trades",
",",
"lastTradeId",
".",
"longValue",
"(",
")",
",",
"Trades",
".",
"TradeSortType",
".",
"SortByID",
")",
";",
"}"
] |
Adapts a BTCTurkTrade[] to a Trades Object
@param btcTurkTrades The BTCTurk trades
@param currencyPair (e.g. BTC/TRY)
@return The XChange Trades
|
[
"Adapts",
"a",
"BTCTurkTrade",
"[]",
"to",
"a",
"Trades",
"Object"
] |
train
|
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-btcturk/src/main/java/org/knowm/xchange/btcturk/BTCTurkAdapters.java#L84-L94
|
alkacon/opencms-core
|
src/org/opencms/db/CmsDriverManager.java
|
CmsDriverManager.createUser
|
public CmsUser createUser(
CmsDbContext dbc,
String name,
String password,
String description,
Map<String, Object> additionalInfos)
throws CmsException, CmsIllegalArgumentException {
"""
Creates a new user.<p>
@param dbc the current database context
@param name the name for the new user
@param password the password for the new user
@param description the description for the new user
@param additionalInfos the additional infos for the user
@return the created user
@see CmsObject#createUser(String, String, String, Map)
@throws CmsException if something goes wrong
@throws CmsIllegalArgumentException if the name for the user is not valid
"""
// no space before or after the name
name = name.trim();
// check the user name
String userName = CmsOrganizationalUnit.getSimpleName(name);
OpenCms.getValidationHandler().checkUserName(userName);
if (CmsStringUtil.isEmptyOrWhitespaceOnly(userName)) {
throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_BAD_USER_1, userName));
}
// check the ou
CmsOrganizationalUnit ou = readOrganizationalUnit(dbc, CmsOrganizationalUnit.getParentFqn(name));
// check the password
validatePassword(password);
Map<String, Object> info = new HashMap<String, Object>();
if (additionalInfos != null) {
info.putAll(additionalInfos);
}
if (description != null) {
info.put(CmsUserSettings.ADDITIONAL_INFO_DESCRIPTION, description);
}
int flags = 0;
if (ou.hasFlagWebuser()) {
flags += I_CmsPrincipal.FLAG_USER_WEBUSER;
}
CmsUser user = getUserDriver(dbc).createUser(
dbc,
new CmsUUID(),
name,
OpenCms.getPasswordHandler().digest(password),
" ",
" ",
" ",
0,
I_CmsPrincipal.FLAG_ENABLED + flags,
0,
info);
if (!dbc.getProjectId().isNullUUID()) {
// user modified event is not needed
return user;
}
// fire user modified event
Map<String, Object> eventData = new HashMap<String, Object>();
eventData.put(I_CmsEventListener.KEY_USER_ID, user.getId().toString());
eventData.put(I_CmsEventListener.KEY_USER_ACTION, I_CmsEventListener.VALUE_USER_MODIFIED_ACTION_CREATE_USER);
OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_USER_MODIFIED, eventData));
return user;
}
|
java
|
public CmsUser createUser(
CmsDbContext dbc,
String name,
String password,
String description,
Map<String, Object> additionalInfos)
throws CmsException, CmsIllegalArgumentException {
// no space before or after the name
name = name.trim();
// check the user name
String userName = CmsOrganizationalUnit.getSimpleName(name);
OpenCms.getValidationHandler().checkUserName(userName);
if (CmsStringUtil.isEmptyOrWhitespaceOnly(userName)) {
throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_BAD_USER_1, userName));
}
// check the ou
CmsOrganizationalUnit ou = readOrganizationalUnit(dbc, CmsOrganizationalUnit.getParentFqn(name));
// check the password
validatePassword(password);
Map<String, Object> info = new HashMap<String, Object>();
if (additionalInfos != null) {
info.putAll(additionalInfos);
}
if (description != null) {
info.put(CmsUserSettings.ADDITIONAL_INFO_DESCRIPTION, description);
}
int flags = 0;
if (ou.hasFlagWebuser()) {
flags += I_CmsPrincipal.FLAG_USER_WEBUSER;
}
CmsUser user = getUserDriver(dbc).createUser(
dbc,
new CmsUUID(),
name,
OpenCms.getPasswordHandler().digest(password),
" ",
" ",
" ",
0,
I_CmsPrincipal.FLAG_ENABLED + flags,
0,
info);
if (!dbc.getProjectId().isNullUUID()) {
// user modified event is not needed
return user;
}
// fire user modified event
Map<String, Object> eventData = new HashMap<String, Object>();
eventData.put(I_CmsEventListener.KEY_USER_ID, user.getId().toString());
eventData.put(I_CmsEventListener.KEY_USER_ACTION, I_CmsEventListener.VALUE_USER_MODIFIED_ACTION_CREATE_USER);
OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_USER_MODIFIED, eventData));
return user;
}
|
[
"public",
"CmsUser",
"createUser",
"(",
"CmsDbContext",
"dbc",
",",
"String",
"name",
",",
"String",
"password",
",",
"String",
"description",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"additionalInfos",
")",
"throws",
"CmsException",
",",
"CmsIllegalArgumentException",
"{",
"// no space before or after the name",
"name",
"=",
"name",
".",
"trim",
"(",
")",
";",
"// check the user name",
"String",
"userName",
"=",
"CmsOrganizationalUnit",
".",
"getSimpleName",
"(",
"name",
")",
";",
"OpenCms",
".",
"getValidationHandler",
"(",
")",
".",
"checkUserName",
"(",
"userName",
")",
";",
"if",
"(",
"CmsStringUtil",
".",
"isEmptyOrWhitespaceOnly",
"(",
"userName",
")",
")",
"{",
"throw",
"new",
"CmsIllegalArgumentException",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"ERR_BAD_USER_1",
",",
"userName",
")",
")",
";",
"}",
"// check the ou",
"CmsOrganizationalUnit",
"ou",
"=",
"readOrganizationalUnit",
"(",
"dbc",
",",
"CmsOrganizationalUnit",
".",
"getParentFqn",
"(",
"name",
")",
")",
";",
"// check the password",
"validatePassword",
"(",
"password",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"info",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"if",
"(",
"additionalInfos",
"!=",
"null",
")",
"{",
"info",
".",
"putAll",
"(",
"additionalInfos",
")",
";",
"}",
"if",
"(",
"description",
"!=",
"null",
")",
"{",
"info",
".",
"put",
"(",
"CmsUserSettings",
".",
"ADDITIONAL_INFO_DESCRIPTION",
",",
"description",
")",
";",
"}",
"int",
"flags",
"=",
"0",
";",
"if",
"(",
"ou",
".",
"hasFlagWebuser",
"(",
")",
")",
"{",
"flags",
"+=",
"I_CmsPrincipal",
".",
"FLAG_USER_WEBUSER",
";",
"}",
"CmsUser",
"user",
"=",
"getUserDriver",
"(",
"dbc",
")",
".",
"createUser",
"(",
"dbc",
",",
"new",
"CmsUUID",
"(",
")",
",",
"name",
",",
"OpenCms",
".",
"getPasswordHandler",
"(",
")",
".",
"digest",
"(",
"password",
")",
",",
"\" \"",
",",
"\" \"",
",",
"\" \"",
",",
"0",
",",
"I_CmsPrincipal",
".",
"FLAG_ENABLED",
"+",
"flags",
",",
"0",
",",
"info",
")",
";",
"if",
"(",
"!",
"dbc",
".",
"getProjectId",
"(",
")",
".",
"isNullUUID",
"(",
")",
")",
"{",
"// user modified event is not needed",
"return",
"user",
";",
"}",
"// fire user modified event",
"Map",
"<",
"String",
",",
"Object",
">",
"eventData",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"eventData",
".",
"put",
"(",
"I_CmsEventListener",
".",
"KEY_USER_ID",
",",
"user",
".",
"getId",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"eventData",
".",
"put",
"(",
"I_CmsEventListener",
".",
"KEY_USER_ACTION",
",",
"I_CmsEventListener",
".",
"VALUE_USER_MODIFIED_ACTION_CREATE_USER",
")",
";",
"OpenCms",
".",
"fireCmsEvent",
"(",
"new",
"CmsEvent",
"(",
"I_CmsEventListener",
".",
"EVENT_USER_MODIFIED",
",",
"eventData",
")",
")",
";",
"return",
"user",
";",
"}"
] |
Creates a new user.<p>
@param dbc the current database context
@param name the name for the new user
@param password the password for the new user
@param description the description for the new user
@param additionalInfos the additional infos for the user
@return the created user
@see CmsObject#createUser(String, String, String, Map)
@throws CmsException if something goes wrong
@throws CmsIllegalArgumentException if the name for the user is not valid
|
[
"Creates",
"a",
"new",
"user",
".",
"<p",
">"
] |
train
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L2167-L2222
|
attribyte/wpdb
|
src/main/java/org/attribyte/wp/db/DB.java
|
DB.appendPostTypes
|
private StringBuilder appendPostTypes(final EnumSet<Post.Type> types, final StringBuilder sql) {
"""
Appends post type constraint.
@param types The types.
@param sql The buffer to append to.
@return The input buffer.
"""
int typesCount = types != null ? types.size() : 0;
switch(typesCount) {
case 0:
break;
case 1:
sql.append(" AND post_type=").append(String.format("'%s'", types.iterator().next().toString()));
break;
default:
sql.append(" AND post_type IN (");
sql.append(inJoiner.join(types.stream().map(t -> String.format("'%s'", t.toString())).collect(Collectors.toSet())));
sql.append(")");
break;
}
return sql;
}
|
java
|
private StringBuilder appendPostTypes(final EnumSet<Post.Type> types, final StringBuilder sql) {
int typesCount = types != null ? types.size() : 0;
switch(typesCount) {
case 0:
break;
case 1:
sql.append(" AND post_type=").append(String.format("'%s'", types.iterator().next().toString()));
break;
default:
sql.append(" AND post_type IN (");
sql.append(inJoiner.join(types.stream().map(t -> String.format("'%s'", t.toString())).collect(Collectors.toSet())));
sql.append(")");
break;
}
return sql;
}
|
[
"private",
"StringBuilder",
"appendPostTypes",
"(",
"final",
"EnumSet",
"<",
"Post",
".",
"Type",
">",
"types",
",",
"final",
"StringBuilder",
"sql",
")",
"{",
"int",
"typesCount",
"=",
"types",
"!=",
"null",
"?",
"types",
".",
"size",
"(",
")",
":",
"0",
";",
"switch",
"(",
"typesCount",
")",
"{",
"case",
"0",
":",
"break",
";",
"case",
"1",
":",
"sql",
".",
"append",
"(",
"\" AND post_type=\"",
")",
".",
"append",
"(",
"String",
".",
"format",
"(",
"\"'%s'\"",
",",
"types",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
".",
"toString",
"(",
")",
")",
")",
";",
"break",
";",
"default",
":",
"sql",
".",
"append",
"(",
"\" AND post_type IN (\"",
")",
";",
"sql",
".",
"append",
"(",
"inJoiner",
".",
"join",
"(",
"types",
".",
"stream",
"(",
")",
".",
"map",
"(",
"t",
"->",
"String",
".",
"format",
"(",
"\"'%s'\"",
",",
"t",
".",
"toString",
"(",
")",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"toSet",
"(",
")",
")",
")",
")",
";",
"sql",
".",
"append",
"(",
"\")\"",
")",
";",
"break",
";",
"}",
"return",
"sql",
";",
"}"
] |
Appends post type constraint.
@param types The types.
@param sql The buffer to append to.
@return The input buffer.
|
[
"Appends",
"post",
"type",
"constraint",
"."
] |
train
|
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/db/DB.java#L1198-L1214
|
cdk/cdk
|
base/valencycheck/src/main/java/org/openscience/cdk/tools/AtomTypeAwareSaturationChecker.java
|
AtomTypeAwareSaturationChecker.getAtomBondordersum
|
private double getAtomBondordersum(IAtom atom, IAtomContainer mol) throws CDKException {
"""
This method is used if, by some reason, the bond order sum is not set
for an atom.
@param atom The atom in question
@param mol The molecule that the atom belongs to
@return The bond order sum
@throws CDKException
"""
double sum = 0;
for (IBond bond : mol.bonds())
if (bond.contains(atom)) sum += BondManipulator.destroyBondOrder(bond.getOrder());
return sum;
}
|
java
|
private double getAtomBondordersum(IAtom atom, IAtomContainer mol) throws CDKException {
double sum = 0;
for (IBond bond : mol.bonds())
if (bond.contains(atom)) sum += BondManipulator.destroyBondOrder(bond.getOrder());
return sum;
}
|
[
"private",
"double",
"getAtomBondordersum",
"(",
"IAtom",
"atom",
",",
"IAtomContainer",
"mol",
")",
"throws",
"CDKException",
"{",
"double",
"sum",
"=",
"0",
";",
"for",
"(",
"IBond",
"bond",
":",
"mol",
".",
"bonds",
"(",
")",
")",
"if",
"(",
"bond",
".",
"contains",
"(",
"atom",
")",
")",
"sum",
"+=",
"BondManipulator",
".",
"destroyBondOrder",
"(",
"bond",
".",
"getOrder",
"(",
")",
")",
";",
"return",
"sum",
";",
"}"
] |
This method is used if, by some reason, the bond order sum is not set
for an atom.
@param atom The atom in question
@param mol The molecule that the atom belongs to
@return The bond order sum
@throws CDKException
|
[
"This",
"method",
"is",
"used",
"if",
"by",
"some",
"reason",
"the",
"bond",
"order",
"sum",
"is",
"not",
"set",
"for",
"an",
"atom",
"."
] |
train
|
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/valencycheck/src/main/java/org/openscience/cdk/tools/AtomTypeAwareSaturationChecker.java#L262-L269
|
attribyte/wpdb
|
src/main/java/org/attribyte/wp/db/DB.java
|
DB.setPostMeta
|
public void setPostMeta(final long postId, final List<Meta> postMeta) throws SQLException {
"""
Sets metadata for a post.
<p>
Clears existing metadata.
</p>
@param postId The post id.
@param postMeta The metadata.
@throws SQLException on database error.
"""
clearPostMeta(postId);
if(postMeta == null || postMeta.size() == 0) {
return;
}
Connection conn = null;
PreparedStatement stmt = null;
Timer.Context ctx = metrics.setPostMetaTimer.time();
try {
conn = connectionSupplier.getConnection();
stmt = conn.prepareStatement(insertPostMetaSQL);
for(Meta meta : postMeta) {
stmt.setLong(1, postId);
stmt.setString(2, meta.key);
stmt.setString(3, meta.value);
stmt.executeUpdate();
}
} finally {
ctx.stop();
SQLUtil.closeQuietly(conn, stmt);
}
}
|
java
|
public void setPostMeta(final long postId, final List<Meta> postMeta) throws SQLException {
clearPostMeta(postId);
if(postMeta == null || postMeta.size() == 0) {
return;
}
Connection conn = null;
PreparedStatement stmt = null;
Timer.Context ctx = metrics.setPostMetaTimer.time();
try {
conn = connectionSupplier.getConnection();
stmt = conn.prepareStatement(insertPostMetaSQL);
for(Meta meta : postMeta) {
stmt.setLong(1, postId);
stmt.setString(2, meta.key);
stmt.setString(3, meta.value);
stmt.executeUpdate();
}
} finally {
ctx.stop();
SQLUtil.closeQuietly(conn, stmt);
}
}
|
[
"public",
"void",
"setPostMeta",
"(",
"final",
"long",
"postId",
",",
"final",
"List",
"<",
"Meta",
">",
"postMeta",
")",
"throws",
"SQLException",
"{",
"clearPostMeta",
"(",
"postId",
")",
";",
"if",
"(",
"postMeta",
"==",
"null",
"||",
"postMeta",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"Connection",
"conn",
"=",
"null",
";",
"PreparedStatement",
"stmt",
"=",
"null",
";",
"Timer",
".",
"Context",
"ctx",
"=",
"metrics",
".",
"setPostMetaTimer",
".",
"time",
"(",
")",
";",
"try",
"{",
"conn",
"=",
"connectionSupplier",
".",
"getConnection",
"(",
")",
";",
"stmt",
"=",
"conn",
".",
"prepareStatement",
"(",
"insertPostMetaSQL",
")",
";",
"for",
"(",
"Meta",
"meta",
":",
"postMeta",
")",
"{",
"stmt",
".",
"setLong",
"(",
"1",
",",
"postId",
")",
";",
"stmt",
".",
"setString",
"(",
"2",
",",
"meta",
".",
"key",
")",
";",
"stmt",
".",
"setString",
"(",
"3",
",",
"meta",
".",
"value",
")",
";",
"stmt",
".",
"executeUpdate",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"ctx",
".",
"stop",
"(",
")",
";",
"SQLUtil",
".",
"closeQuietly",
"(",
"conn",
",",
"stmt",
")",
";",
"}",
"}"
] |
Sets metadata for a post.
<p>
Clears existing metadata.
</p>
@param postId The post id.
@param postMeta The metadata.
@throws SQLException on database error.
|
[
"Sets",
"metadata",
"for",
"a",
"post",
".",
"<p",
">",
"Clears",
"existing",
"metadata",
".",
"<",
"/",
"p",
">"
] |
train
|
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/db/DB.java#L1994-L2017
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/io/FileSupport.java
|
FileSupport.getFileFromDirectoryInClassPath
|
public static File getFileFromDirectoryInClassPath(String fileName, String classPath) {
"""
Locates a file in the classpath.
@param fileName
@param classPath
@return the found file or null if the file can not be located
"""
Collection<String> paths = StringSupport.split(classPath, ";:", false);
for(String singlePath : paths) {
File dir = new File(singlePath);
if (dir.isDirectory()) {
File file = new File(singlePath + '/' + fileName);
if (file.exists()) {
return file;
}
}
}
return null;
}
|
java
|
public static File getFileFromDirectoryInClassPath(String fileName, String classPath) {
Collection<String> paths = StringSupport.split(classPath, ";:", false);
for(String singlePath : paths) {
File dir = new File(singlePath);
if (dir.isDirectory()) {
File file = new File(singlePath + '/' + fileName);
if (file.exists()) {
return file;
}
}
}
return null;
}
|
[
"public",
"static",
"File",
"getFileFromDirectoryInClassPath",
"(",
"String",
"fileName",
",",
"String",
"classPath",
")",
"{",
"Collection",
"<",
"String",
">",
"paths",
"=",
"StringSupport",
".",
"split",
"(",
"classPath",
",",
"\";:\"",
",",
"false",
")",
";",
"for",
"(",
"String",
"singlePath",
":",
"paths",
")",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"singlePath",
")",
";",
"if",
"(",
"dir",
".",
"isDirectory",
"(",
")",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"singlePath",
"+",
"'",
"'",
"+",
"fileName",
")",
";",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"{",
"return",
"file",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] |
Locates a file in the classpath.
@param fileName
@param classPath
@return the found file or null if the file can not be located
|
[
"Locates",
"a",
"file",
"in",
"the",
"classpath",
"."
] |
train
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L221-L235
|
apereo/person-directory
|
person-directory-impl/src/main/java/org/apereo/services/persondir/support/CachingPersonAttributeDaoImpl.java
|
CachingPersonAttributeDaoImpl.setUserInfoCache
|
@JsonIgnore
public void setUserInfoCache(final Map<Serializable, Set<IPersonAttributes>> userInfoCache) {
"""
The Map to use for caching results. Only get, put and remove are used so the Map may be backed by a real caching
implementation.
@param userInfoCache The userInfoCache to set.
"""
if (userInfoCache == null) {
throw new IllegalArgumentException("userInfoCache may not be null");
}
this.userInfoCache = userInfoCache;
}
|
java
|
@JsonIgnore
public void setUserInfoCache(final Map<Serializable, Set<IPersonAttributes>> userInfoCache) {
if (userInfoCache == null) {
throw new IllegalArgumentException("userInfoCache may not be null");
}
this.userInfoCache = userInfoCache;
}
|
[
"@",
"JsonIgnore",
"public",
"void",
"setUserInfoCache",
"(",
"final",
"Map",
"<",
"Serializable",
",",
"Set",
"<",
"IPersonAttributes",
">",
">",
"userInfoCache",
")",
"{",
"if",
"(",
"userInfoCache",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"userInfoCache may not be null\"",
")",
";",
"}",
"this",
".",
"userInfoCache",
"=",
"userInfoCache",
";",
"}"
] |
The Map to use for caching results. Only get, put and remove are used so the Map may be backed by a real caching
implementation.
@param userInfoCache The userInfoCache to set.
|
[
"The",
"Map",
"to",
"use",
"for",
"caching",
"results",
".",
"Only",
"get",
"put",
"and",
"remove",
"are",
"used",
"so",
"the",
"Map",
"may",
"be",
"backed",
"by",
"a",
"real",
"caching",
"implementation",
"."
] |
train
|
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/CachingPersonAttributeDaoImpl.java#L210-L217
|
Netflix/conductor
|
core/src/main/java/com/netflix/conductor/service/WorkflowServiceImpl.java
|
WorkflowServiceImpl.getExecutionStatus
|
@Service
public Workflow getExecutionStatus(String workflowId, boolean includeTasks) {
"""
Gets the workflow by workflow Id.
@param workflowId Id of the workflow.
@param includeTasks Includes tasks associated with workflow.
@return an instance of {@link Workflow}
"""
Workflow workflow = executionService.getExecutionStatus(workflowId, includeTasks);
if (workflow == null) {
throw new ApplicationException(ApplicationException.Code.NOT_FOUND,
String.format("Workflow with Id: %s not found.", workflowId));
}
return workflow;
}
|
java
|
@Service
public Workflow getExecutionStatus(String workflowId, boolean includeTasks) {
Workflow workflow = executionService.getExecutionStatus(workflowId, includeTasks);
if (workflow == null) {
throw new ApplicationException(ApplicationException.Code.NOT_FOUND,
String.format("Workflow with Id: %s not found.", workflowId));
}
return workflow;
}
|
[
"@",
"Service",
"public",
"Workflow",
"getExecutionStatus",
"(",
"String",
"workflowId",
",",
"boolean",
"includeTasks",
")",
"{",
"Workflow",
"workflow",
"=",
"executionService",
".",
"getExecutionStatus",
"(",
"workflowId",
",",
"includeTasks",
")",
";",
"if",
"(",
"workflow",
"==",
"null",
")",
"{",
"throw",
"new",
"ApplicationException",
"(",
"ApplicationException",
".",
"Code",
".",
"NOT_FOUND",
",",
"String",
".",
"format",
"(",
"\"Workflow with Id: %s not found.\"",
",",
"workflowId",
")",
")",
";",
"}",
"return",
"workflow",
";",
"}"
] |
Gets the workflow by workflow Id.
@param workflowId Id of the workflow.
@param includeTasks Includes tasks associated with workflow.
@return an instance of {@link Workflow}
|
[
"Gets",
"the",
"workflow",
"by",
"workflow",
"Id",
"."
] |
train
|
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/core/src/main/java/com/netflix/conductor/service/WorkflowServiceImpl.java#L189-L197
|
sarl/sarl
|
docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java
|
Utils.findFirst
|
public static <T extends AnnotationDesc> T findFirst(T[] original, Predicate<T> filter) {
"""
Find the first element into the given array.
@param <T> the type of the elements to filter.
@param original the original array.
@param filter the filtering action.
@return the first element.
"""
for (final T element : original) {
if (filter.test(element)) {
return element;
}
}
return null;
}
|
java
|
public static <T extends AnnotationDesc> T findFirst(T[] original, Predicate<T> filter) {
for (final T element : original) {
if (filter.test(element)) {
return element;
}
}
return null;
}
|
[
"public",
"static",
"<",
"T",
"extends",
"AnnotationDesc",
">",
"T",
"findFirst",
"(",
"T",
"[",
"]",
"original",
",",
"Predicate",
"<",
"T",
">",
"filter",
")",
"{",
"for",
"(",
"final",
"T",
"element",
":",
"original",
")",
"{",
"if",
"(",
"filter",
".",
"test",
"(",
"element",
")",
")",
"{",
"return",
"element",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Find the first element into the given array.
@param <T> the type of the elements to filter.
@param original the original array.
@param filter the filtering action.
@return the first element.
|
[
"Find",
"the",
"first",
"element",
"into",
"the",
"given",
"array",
"."
] |
train
|
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java#L188-L195
|
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java
|
MemberSummaryBuilder.buildFieldsSummary
|
public void buildFieldsSummary(XMLNode node, Content memberSummaryTree) {
"""
Build the summary for the fields.
@param node the XML element that specifies which components to document
@param memberSummaryTree the content tree to which the documentation will be added
"""
MemberSummaryWriter writer =
memberSummaryWriters.get(VisibleMemberMap.Kind.FIELDS);
VisibleMemberMap visibleMemberMap =
getVisibleMemberMap(VisibleMemberMap.Kind.FIELDS);
addSummary(writer, visibleMemberMap, true, memberSummaryTree);
}
|
java
|
public void buildFieldsSummary(XMLNode node, Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters.get(VisibleMemberMap.Kind.FIELDS);
VisibleMemberMap visibleMemberMap =
getVisibleMemberMap(VisibleMemberMap.Kind.FIELDS);
addSummary(writer, visibleMemberMap, true, memberSummaryTree);
}
|
[
"public",
"void",
"buildFieldsSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"memberSummaryTree",
")",
"{",
"MemberSummaryWriter",
"writer",
"=",
"memberSummaryWriters",
".",
"get",
"(",
"VisibleMemberMap",
".",
"Kind",
".",
"FIELDS",
")",
";",
"VisibleMemberMap",
"visibleMemberMap",
"=",
"getVisibleMemberMap",
"(",
"VisibleMemberMap",
".",
"Kind",
".",
"FIELDS",
")",
";",
"addSummary",
"(",
"writer",
",",
"visibleMemberMap",
",",
"true",
",",
"memberSummaryTree",
")",
";",
"}"
] |
Build the summary for the fields.
@param node the XML element that specifies which components to document
@param memberSummaryTree the content tree to which the documentation will be added
|
[
"Build",
"the",
"summary",
"for",
"the",
"fields",
"."
] |
train
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java#L265-L271
|
lucee/Lucee
|
core/src/main/java/lucee/commons/io/IOUtil.java
|
IOUtil.getWriter
|
public static Writer getWriter(OutputStream os, Charset charset) throws IOException {
"""
returns a Reader for the given InputStream
@param is
@param charset
@return Reader
@throws IOException
"""
if (charset == null) charset = SystemUtil.getCharset();
return new BufferedWriter(new OutputStreamWriter(os, charset));
}
|
java
|
public static Writer getWriter(OutputStream os, Charset charset) throws IOException {
if (charset == null) charset = SystemUtil.getCharset();
return new BufferedWriter(new OutputStreamWriter(os, charset));
}
|
[
"public",
"static",
"Writer",
"getWriter",
"(",
"OutputStream",
"os",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"if",
"(",
"charset",
"==",
"null",
")",
"charset",
"=",
"SystemUtil",
".",
"getCharset",
"(",
")",
";",
"return",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"os",
",",
"charset",
")",
")",
";",
"}"
] |
returns a Reader for the given InputStream
@param is
@param charset
@return Reader
@throws IOException
|
[
"returns",
"a",
"Reader",
"for",
"the",
"given",
"InputStream"
] |
train
|
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/IOUtil.java#L1224-L1227
|
Harium/keel
|
src/main/java/com/harium/keel/catalano/math/distance/Distance.java
|
Distance.Manhattan
|
public static double Manhattan(double[] p, double[] q) {
"""
Gets the Manhattan distance between two points.
@param p A point in space.
@param q A point in space.
@return The Manhattan distance between x and y.
"""
double sum = 0;
for (int i = 0; i < p.length; i++) {
sum += Math.abs(p[i] - q[i]);
}
return sum;
}
|
java
|
public static double Manhattan(double[] p, double[] q) {
double sum = 0;
for (int i = 0; i < p.length; i++) {
sum += Math.abs(p[i] - q[i]);
}
return sum;
}
|
[
"public",
"static",
"double",
"Manhattan",
"(",
"double",
"[",
"]",
"p",
",",
"double",
"[",
"]",
"q",
")",
"{",
"double",
"sum",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"p",
".",
"length",
";",
"i",
"++",
")",
"{",
"sum",
"+=",
"Math",
".",
"abs",
"(",
"p",
"[",
"i",
"]",
"-",
"q",
"[",
"i",
"]",
")",
";",
"}",
"return",
"sum",
";",
"}"
] |
Gets the Manhattan distance between two points.
@param p A point in space.
@param q A point in space.
@return The Manhattan distance between x and y.
|
[
"Gets",
"the",
"Manhattan",
"distance",
"between",
"two",
"points",
"."
] |
train
|
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L686-L692
|
aboutsip/pkts
|
pkts-buffers/src/main/java/io/pkts/buffer/BoundedInputStreamBuffer.java
|
BoundedInputStreamBuffer.internalReadBytes
|
private int internalReadBytes(final int length) throws IOException {
"""
Ensure that <code>length</code> more bytes are available in the internal
buffer. Read more bytes from the underlying stream if needed. This
method is blocking in case we don't have enough bytes to read.
@param length the amount of bytes we wishes to read
@return the actual number of bytes read.
@throws IOException
"""
if (length > localCapacity) {
throw new IllegalArgumentException("Length is larger than buffer. Request=" + length + ", capacity=" + localCapacity);
}
// check if we already have enough bytes available for reading
// and if so, just return the length the user is asking for
if (checkReadableBytesSafe(length)) {
return length;
}
return readFromStream(length - getReadableBytes());
}
|
java
|
private int internalReadBytes(final int length) throws IOException {
if (length > localCapacity) {
throw new IllegalArgumentException("Length is larger than buffer. Request=" + length + ", capacity=" + localCapacity);
}
// check if we already have enough bytes available for reading
// and if so, just return the length the user is asking for
if (checkReadableBytesSafe(length)) {
return length;
}
return readFromStream(length - getReadableBytes());
}
|
[
"private",
"int",
"internalReadBytes",
"(",
"final",
"int",
"length",
")",
"throws",
"IOException",
"{",
"if",
"(",
"length",
">",
"localCapacity",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Length is larger than buffer. Request=\"",
"+",
"length",
"+",
"\", capacity=\"",
"+",
"localCapacity",
")",
";",
"}",
"// check if we already have enough bytes available for reading",
"// and if so, just return the length the user is asking for",
"if",
"(",
"checkReadableBytesSafe",
"(",
"length",
")",
")",
"{",
"return",
"length",
";",
"}",
"return",
"readFromStream",
"(",
"length",
"-",
"getReadableBytes",
"(",
")",
")",
";",
"}"
] |
Ensure that <code>length</code> more bytes are available in the internal
buffer. Read more bytes from the underlying stream if needed. This
method is blocking in case we don't have enough bytes to read.
@param length the amount of bytes we wishes to read
@return the actual number of bytes read.
@throws IOException
|
[
"Ensure",
"that",
"<code",
">",
"length<",
"/",
"code",
">",
"more",
"bytes",
"are",
"available",
"in",
"the",
"internal",
"buffer",
".",
"Read",
"more",
"bytes",
"from",
"the",
"underlying",
"stream",
"if",
"needed",
".",
"This",
"method",
"is",
"blocking",
"in",
"case",
"we",
"don",
"t",
"have",
"enough",
"bytes",
"to",
"read",
"."
] |
train
|
https://github.com/aboutsip/pkts/blob/0f06bb0dac76c812187829f580a8d476ca99a1a1/pkts-buffers/src/main/java/io/pkts/buffer/BoundedInputStreamBuffer.java#L168-L182
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/view/ScreenFieldViewAdapter.java
|
ScreenFieldViewAdapter.getFirstToUpper
|
public static char getFirstToUpper(String string, char chDefault) {
"""
Return the first char of this string converted to upper case.
@param The string to get the first char to upper.
@param chDefault If the string is empty, return this.
@return The first char in the string converted to upper.
"""
if ((string != null) && (string.length() > 0))
chDefault = Character.toUpperCase(string.charAt(0));
return chDefault;
}
|
java
|
public static char getFirstToUpper(String string, char chDefault)
{
if ((string != null) && (string.length() > 0))
chDefault = Character.toUpperCase(string.charAt(0));
return chDefault;
}
|
[
"public",
"static",
"char",
"getFirstToUpper",
"(",
"String",
"string",
",",
"char",
"chDefault",
")",
"{",
"if",
"(",
"(",
"string",
"!=",
"null",
")",
"&&",
"(",
"string",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"chDefault",
"=",
"Character",
".",
"toUpperCase",
"(",
"string",
".",
"charAt",
"(",
"0",
")",
")",
";",
"return",
"chDefault",
";",
"}"
] |
Return the first char of this string converted to upper case.
@param The string to get the first char to upper.
@param chDefault If the string is empty, return this.
@return The first char in the string converted to upper.
|
[
"Return",
"the",
"first",
"char",
"of",
"this",
"string",
"converted",
"to",
"upper",
"case",
"."
] |
train
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/view/ScreenFieldViewAdapter.java#L698-L703
|
google/j2objc
|
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/reflect/Proxy.java
|
Proxy.newProxyInstance
|
@CallerSensitive
public static Object newProxyInstance(ClassLoader loader,
Class<?>[] interfaces,
InvocationHandler h)
throws IllegalArgumentException {
"""
Returns an instance of a proxy class for the specified interfaces
that dispatches method invocations to the specified invocation
handler. This method is equivalent to:
<pre>
Proxy.getProxyClass(loader, interfaces).
getConstructor(new Class[] { InvocationHandler.class }).
newInstance(new Object[] { handler });
</pre>
<p>{@code Proxy.newProxyInstance} throws
{@code IllegalArgumentException} for the same reasons that
{@code Proxy.getProxyClass} does.
@param loader the class loader to define the proxy class
@param interfaces the list of interfaces for the proxy class
to implement
@param h the invocation handler to dispatch method invocations to
@return a proxy instance with the specified invocation handler of a
proxy class that is defined by the specified class loader
and that implements the specified interfaces
@throws IllegalArgumentException if any of the restrictions on the
parameters that may be passed to {@code getProxyClass}
are violated
@throws NullPointerException if the {@code interfaces} array
argument or any of its elements are {@code null}, or
if the invocation handler, {@code h}, is
{@code null}
"""
if (h == null) {
throw new NullPointerException();
}
/*
* Look up or generate the designated proxy class.
*/
Class<?> cl = getProxyClass0(loader, interfaces);
/*
* Invoke its constructor with the designated invocation handler.
*/
try {
final Constructor<?> cons = cl.getConstructor(constructorParams);
return newInstance(cons, h);
} catch (NoSuchMethodException e) {
throw new InternalError(e.toString());
}
}
|
java
|
@CallerSensitive
public static Object newProxyInstance(ClassLoader loader,
Class<?>[] interfaces,
InvocationHandler h)
throws IllegalArgumentException
{
if (h == null) {
throw new NullPointerException();
}
/*
* Look up or generate the designated proxy class.
*/
Class<?> cl = getProxyClass0(loader, interfaces);
/*
* Invoke its constructor with the designated invocation handler.
*/
try {
final Constructor<?> cons = cl.getConstructor(constructorParams);
return newInstance(cons, h);
} catch (NoSuchMethodException e) {
throw new InternalError(e.toString());
}
}
|
[
"@",
"CallerSensitive",
"public",
"static",
"Object",
"newProxyInstance",
"(",
"ClassLoader",
"loader",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"interfaces",
",",
"InvocationHandler",
"h",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"h",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"/*\n * Look up or generate the designated proxy class.\n */",
"Class",
"<",
"?",
">",
"cl",
"=",
"getProxyClass0",
"(",
"loader",
",",
"interfaces",
")",
";",
"/*\n * Invoke its constructor with the designated invocation handler.\n */",
"try",
"{",
"final",
"Constructor",
"<",
"?",
">",
"cons",
"=",
"cl",
".",
"getConstructor",
"(",
"constructorParams",
")",
";",
"return",
"newInstance",
"(",
"cons",
",",
"h",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")",
"{",
"throw",
"new",
"InternalError",
"(",
"e",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
] |
Returns an instance of a proxy class for the specified interfaces
that dispatches method invocations to the specified invocation
handler. This method is equivalent to:
<pre>
Proxy.getProxyClass(loader, interfaces).
getConstructor(new Class[] { InvocationHandler.class }).
newInstance(new Object[] { handler });
</pre>
<p>{@code Proxy.newProxyInstance} throws
{@code IllegalArgumentException} for the same reasons that
{@code Proxy.getProxyClass} does.
@param loader the class loader to define the proxy class
@param interfaces the list of interfaces for the proxy class
to implement
@param h the invocation handler to dispatch method invocations to
@return a proxy instance with the specified invocation handler of a
proxy class that is defined by the specified class loader
and that implements the specified interfaces
@throws IllegalArgumentException if any of the restrictions on the
parameters that may be passed to {@code getProxyClass}
are violated
@throws NullPointerException if the {@code interfaces} array
argument or any of its elements are {@code null}, or
if the invocation handler, {@code h}, is
{@code null}
|
[
"Returns",
"an",
"instance",
"of",
"a",
"proxy",
"class",
"for",
"the",
"specified",
"interfaces",
"that",
"dispatches",
"method",
"invocations",
"to",
"the",
"specified",
"invocation",
"handler",
".",
"This",
"method",
"is",
"equivalent",
"to",
":",
"<pre",
">",
"Proxy",
".",
"getProxyClass",
"(",
"loader",
"interfaces",
")",
".",
"getConstructor",
"(",
"new",
"Class",
"[]",
"{",
"InvocationHandler",
".",
"class",
"}",
")",
".",
"newInstance",
"(",
"new",
"Object",
"[]",
"{",
"handler",
"}",
")",
";",
"<",
"/",
"pre",
">"
] |
train
|
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/reflect/Proxy.java#L761-L785
|
biojava/biojava
|
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/AFPChainCoordManager.java
|
AFPChainCoordManager.getPanelPos
|
public Point getPanelPos(int aligSeq, int i) {
"""
get the position of the sequence position on the Panel
@param aligSeq 0 or 1 for which of the two sequences to ask for.
@param i sequence position
@return the point on a panel for a sequence position
"""
Point p = new Point();
// get line
// we do integer division since we ignore remainders
int lineNr = i / DEFAULT_LINE_LENGTH;
// but we want to have the reminder for the line position.
int linePos = i % DEFAULT_LINE_LENGTH;
int x = linePos * DEFAULT_CHAR_SIZE + DEFAULT_X_SPACE + DEFAULT_LEGEND_SIZE;
int y = lineNr * DEFAULT_Y_STEP + DEFAULT_Y_SPACE;
y += DEFAULT_LINE_SEPARATION * aligSeq;
p.setLocation(x, y);
return p;
}
|
java
|
public Point getPanelPos(int aligSeq, int i) {
Point p = new Point();
// get line
// we do integer division since we ignore remainders
int lineNr = i / DEFAULT_LINE_LENGTH;
// but we want to have the reminder for the line position.
int linePos = i % DEFAULT_LINE_LENGTH;
int x = linePos * DEFAULT_CHAR_SIZE + DEFAULT_X_SPACE + DEFAULT_LEGEND_SIZE;
int y = lineNr * DEFAULT_Y_STEP + DEFAULT_Y_SPACE;
y += DEFAULT_LINE_SEPARATION * aligSeq;
p.setLocation(x, y);
return p;
}
|
[
"public",
"Point",
"getPanelPos",
"(",
"int",
"aligSeq",
",",
"int",
"i",
")",
"{",
"Point",
"p",
"=",
"new",
"Point",
"(",
")",
";",
"// get line",
"// we do integer division since we ignore remainders",
"int",
"lineNr",
"=",
"i",
"/",
"DEFAULT_LINE_LENGTH",
";",
"// but we want to have the reminder for the line position.",
"int",
"linePos",
"=",
"i",
"%",
"DEFAULT_LINE_LENGTH",
";",
"int",
"x",
"=",
"linePos",
"*",
"DEFAULT_CHAR_SIZE",
"+",
"DEFAULT_X_SPACE",
"+",
"DEFAULT_LEGEND_SIZE",
";",
"int",
"y",
"=",
"lineNr",
"*",
"DEFAULT_Y_STEP",
"+",
"DEFAULT_Y_SPACE",
";",
"y",
"+=",
"DEFAULT_LINE_SEPARATION",
"*",
"aligSeq",
";",
"p",
".",
"setLocation",
"(",
"x",
",",
"y",
")",
";",
"return",
"p",
";",
"}"
] |
get the position of the sequence position on the Panel
@param aligSeq 0 or 1 for which of the two sequences to ask for.
@param i sequence position
@return the point on a panel for a sequence position
|
[
"get",
"the",
"position",
"of",
"the",
"sequence",
"position",
"on",
"the",
"Panel"
] |
train
|
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/AFPChainCoordManager.java#L127-L146
|
JOML-CI/JOML
|
src/org/joml/Matrix3x2d.java
|
Matrix3x2d.scaleAround
|
public Matrix3x2d scaleAround(double sx, double sy, double ox, double oy, Matrix3x2d dest) {
"""
Apply scaling to <code>this</code> matrix by scaling the base axes by the given sx and
sy factors while using <code>(ox, oy)</code> as the scaling origin, and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix,
then the new matrix will be <code>M * S</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * S * v</code>
, the scaling will be applied first!
<p>
This method is equivalent to calling: <code>translate(ox, oy, dest).scale(sx, sy).translate(-ox, -oy)</code>
@param sx
the scaling factor of the x component
@param sy
the scaling factor of the y component
@param ox
the x coordinate of the scaling origin
@param oy
the y coordinate of the scaling origin
@param dest
will hold the result
@return dest
"""
double nm20 = m00 * ox + m10 * oy + m20;
double nm21 = m01 * ox + m11 * oy + m21;
dest.m00 = m00 * sx;
dest.m01 = m01 * sx;
dest.m10 = m10 * sy;
dest.m11 = m11 * sy;
dest.m20 = -m00 * ox - m10 * oy + nm20;
dest.m21 = -m01 * ox - m11 * oy + nm21;
return dest;
}
|
java
|
public Matrix3x2d scaleAround(double sx, double sy, double ox, double oy, Matrix3x2d dest) {
double nm20 = m00 * ox + m10 * oy + m20;
double nm21 = m01 * ox + m11 * oy + m21;
dest.m00 = m00 * sx;
dest.m01 = m01 * sx;
dest.m10 = m10 * sy;
dest.m11 = m11 * sy;
dest.m20 = -m00 * ox - m10 * oy + nm20;
dest.m21 = -m01 * ox - m11 * oy + nm21;
return dest;
}
|
[
"public",
"Matrix3x2d",
"scaleAround",
"(",
"double",
"sx",
",",
"double",
"sy",
",",
"double",
"ox",
",",
"double",
"oy",
",",
"Matrix3x2d",
"dest",
")",
"{",
"double",
"nm20",
"=",
"m00",
"*",
"ox",
"+",
"m10",
"*",
"oy",
"+",
"m20",
";",
"double",
"nm21",
"=",
"m01",
"*",
"ox",
"+",
"m11",
"*",
"oy",
"+",
"m21",
";",
"dest",
".",
"m00",
"=",
"m00",
"*",
"sx",
";",
"dest",
".",
"m01",
"=",
"m01",
"*",
"sx",
";",
"dest",
".",
"m10",
"=",
"m10",
"*",
"sy",
";",
"dest",
".",
"m11",
"=",
"m11",
"*",
"sy",
";",
"dest",
".",
"m20",
"=",
"-",
"m00",
"*",
"ox",
"-",
"m10",
"*",
"oy",
"+",
"nm20",
";",
"dest",
".",
"m21",
"=",
"-",
"m01",
"*",
"ox",
"-",
"m11",
"*",
"oy",
"+",
"nm21",
";",
"return",
"dest",
";",
"}"
] |
Apply scaling to <code>this</code> matrix by scaling the base axes by the given sx and
sy factors while using <code>(ox, oy)</code> as the scaling origin, and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix,
then the new matrix will be <code>M * S</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * S * v</code>
, the scaling will be applied first!
<p>
This method is equivalent to calling: <code>translate(ox, oy, dest).scale(sx, sy).translate(-ox, -oy)</code>
@param sx
the scaling factor of the x component
@param sy
the scaling factor of the y component
@param ox
the x coordinate of the scaling origin
@param oy
the y coordinate of the scaling origin
@param dest
will hold the result
@return dest
|
[
"Apply",
"scaling",
"to",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"by",
"scaling",
"the",
"base",
"axes",
"by",
"the",
"given",
"sx",
"and",
"sy",
"factors",
"while",
"using",
"<code",
">",
"(",
"ox",
"oy",
")",
"<",
"/",
"code",
">",
"as",
"the",
"scaling",
"origin",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"dest<",
"/",
"code",
">",
".",
"<p",
">",
"If",
"<code",
">",
"M<",
"/",
"code",
">",
"is",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"and",
"<code",
">",
"S<",
"/",
"code",
">",
"the",
"scaling",
"matrix",
"then",
"the",
"new",
"matrix",
"will",
"be",
"<code",
">",
"M",
"*",
"S<",
"/",
"code",
">",
".",
"So",
"when",
"transforming",
"a",
"vector",
"<code",
">",
"v<",
"/",
"code",
">",
"with",
"the",
"new",
"matrix",
"by",
"using",
"<code",
">",
"M",
"*",
"S",
"*",
"v<",
"/",
"code",
">",
"the",
"scaling",
"will",
"be",
"applied",
"first!",
"<p",
">",
"This",
"method",
"is",
"equivalent",
"to",
"calling",
":",
"<code",
">",
"translate",
"(",
"ox",
"oy",
"dest",
")",
".",
"scale",
"(",
"sx",
"sy",
")",
".",
"translate",
"(",
"-",
"ox",
"-",
"oy",
")",
"<",
"/",
"code",
">"
] |
train
|
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2d.java#L1431-L1441
|
mkotsur/restito
|
src/main/java/com/xebialabs/restito/semantics/Action.java
|
Action.stringContent
|
public static Action stringContent(final String content, final Charset charset) {
"""
Writes string content into response. The passed charset is used:
- To encoded the string into bytes;
- As character set of the response.
The latter will result in a <pre>charset=XXX</pre> part of <pre>Content-Type</pre> header
if and only if the header has been set in some way (e.g. by using {@link #contentType(String)} action.
See `integration.CharsetAndEncodingTest` for more details.
"""
return composite(charset(charset), bytesContent(content.getBytes(charset)));
}
|
java
|
public static Action stringContent(final String content, final Charset charset) {
return composite(charset(charset), bytesContent(content.getBytes(charset)));
}
|
[
"public",
"static",
"Action",
"stringContent",
"(",
"final",
"String",
"content",
",",
"final",
"Charset",
"charset",
")",
"{",
"return",
"composite",
"(",
"charset",
"(",
"charset",
")",
",",
"bytesContent",
"(",
"content",
".",
"getBytes",
"(",
"charset",
")",
")",
")",
";",
"}"
] |
Writes string content into response. The passed charset is used:
- To encoded the string into bytes;
- As character set of the response.
The latter will result in a <pre>charset=XXX</pre> part of <pre>Content-Type</pre> header
if and only if the header has been set in some way (e.g. by using {@link #contentType(String)} action.
See `integration.CharsetAndEncodingTest` for more details.
|
[
"Writes",
"string",
"content",
"into",
"response",
".",
"The",
"passed",
"charset",
"is",
"used",
":",
"-",
"To",
"encoded",
"the",
"string",
"into",
"bytes",
";",
"-",
"As",
"character",
"set",
"of",
"the",
"response",
".",
"The",
"latter",
"will",
"result",
"in",
"a",
"<pre",
">",
"charset",
"=",
"XXX<",
"/",
"pre",
">",
"part",
"of",
"<pre",
">",
"Content",
"-",
"Type<",
"/",
"pre",
">",
"header",
"if",
"and",
"only",
"if",
"the",
"header",
"has",
"been",
"set",
"in",
"some",
"way",
"(",
"e",
".",
"g",
".",
"by",
"using",
"{",
"@link",
"#contentType",
"(",
"String",
")",
"}",
"action",
"."
] |
train
|
https://github.com/mkotsur/restito/blob/b999293616ca84fdea1ffe929e92a5db29c7e415/src/main/java/com/xebialabs/restito/semantics/Action.java#L171-L173
|
google/error-prone-javac
|
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
|
SerializedFormBuilder.buildMethodSubHeader
|
public void buildMethodSubHeader(XMLNode node, Content methodsContentTree) {
"""
Build the method sub header.
@param node the XML element that specifies which components to document
@param methodsContentTree content tree to which the documentation will be added
"""
methodWriter.addMemberHeader((ExecutableElement)currentMember, methodsContentTree);
}
|
java
|
public void buildMethodSubHeader(XMLNode node, Content methodsContentTree) {
methodWriter.addMemberHeader((ExecutableElement)currentMember, methodsContentTree);
}
|
[
"public",
"void",
"buildMethodSubHeader",
"(",
"XMLNode",
"node",
",",
"Content",
"methodsContentTree",
")",
"{",
"methodWriter",
".",
"addMemberHeader",
"(",
"(",
"ExecutableElement",
")",
"currentMember",
",",
"methodsContentTree",
")",
";",
"}"
] |
Build the method sub header.
@param node the XML element that specifies which components to document
@param methodsContentTree content tree to which the documentation will be added
|
[
"Build",
"the",
"method",
"sub",
"header",
"."
] |
train
|
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L322-L324
|
carewebframework/carewebframework-core
|
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java
|
EventSubscriptions.hasSubscribers
|
public boolean hasSubscribers(String eventName, boolean exact) {
"""
Returns true If the event has subscribers.
@param eventName Name of the event.
@param exact If false, will iterate through parent events until a subscriber is found. If
true, only the exact event is considered.
@return True if a subscriber was found.
"""
while (!StringUtils.isEmpty(eventName)) {
if (hasSubscribers(eventName)) {
return true;
} else if (exact) {
return false;
} else {
eventName = stripLevel(eventName);
}
}
return false;
}
|
java
|
public boolean hasSubscribers(String eventName, boolean exact) {
while (!StringUtils.isEmpty(eventName)) {
if (hasSubscribers(eventName)) {
return true;
} else if (exact) {
return false;
} else {
eventName = stripLevel(eventName);
}
}
return false;
}
|
[
"public",
"boolean",
"hasSubscribers",
"(",
"String",
"eventName",
",",
"boolean",
"exact",
")",
"{",
"while",
"(",
"!",
"StringUtils",
".",
"isEmpty",
"(",
"eventName",
")",
")",
"{",
"if",
"(",
"hasSubscribers",
"(",
"eventName",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"exact",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"eventName",
"=",
"stripLevel",
"(",
"eventName",
")",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Returns true If the event has subscribers.
@param eventName Name of the event.
@param exact If false, will iterate through parent events until a subscriber is found. If
true, only the exact event is considered.
@return True if a subscriber was found.
|
[
"Returns",
"true",
"If",
"the",
"event",
"has",
"subscribers",
"."
] |
train
|
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java#L103-L115
|
hawkular/hawkular-apm
|
client/agent-opentracing/src/main/java/org/hawkular/apm/agent/opentracing/OpenTracingManager.java
|
OpenTracingManager.setVariable
|
public void setVariable(String name, Object value) {
"""
This method retrieves a variable associated with the
current trace.
@return The variable value, or null if not found
"""
TraceState ts = traceState.get();
if (ts != null) {
if (log.isLoggable(Level.FINEST)) {
log.finest("Set variable '" + name + "' value = " + value);
}
ts.getVariables().put(name, value);
} else if (log.isLoggable(Level.FINEST)) {
log.finest("Set variable '" + name + "' value = " + value + "' requested, but no trace state");
}
}
|
java
|
public void setVariable(String name, Object value) {
TraceState ts = traceState.get();
if (ts != null) {
if (log.isLoggable(Level.FINEST)) {
log.finest("Set variable '" + name + "' value = " + value);
}
ts.getVariables().put(name, value);
} else if (log.isLoggable(Level.FINEST)) {
log.finest("Set variable '" + name + "' value = " + value + "' requested, but no trace state");
}
}
|
[
"public",
"void",
"setVariable",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"TraceState",
"ts",
"=",
"traceState",
".",
"get",
"(",
")",
";",
"if",
"(",
"ts",
"!=",
"null",
")",
"{",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINEST",
")",
")",
"{",
"log",
".",
"finest",
"(",
"\"Set variable '\"",
"+",
"name",
"+",
"\"' value = \"",
"+",
"value",
")",
";",
"}",
"ts",
".",
"getVariables",
"(",
")",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"}",
"else",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINEST",
")",
")",
"{",
"log",
".",
"finest",
"(",
"\"Set variable '\"",
"+",
"name",
"+",
"\"' value = \"",
"+",
"value",
"+",
"\"' requested, but no trace state\"",
")",
";",
"}",
"}"
] |
This method retrieves a variable associated with the
current trace.
@return The variable value, or null if not found
|
[
"This",
"method",
"retrieves",
"a",
"variable",
"associated",
"with",
"the",
"current",
"trace",
"."
] |
train
|
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/agent-opentracing/src/main/java/org/hawkular/apm/agent/opentracing/OpenTracingManager.java#L506-L517
|
AltBeacon/android-beacon-library
|
lib/src/main/java/org/altbeacon/beacon/BeaconManager.java
|
BeaconManager.logDebug
|
@Deprecated
public static void logDebug(String tag, String message) {
"""
Convenience method for logging debug by the library
@param tag
@param message
@deprecated This will be removed in a later release. Use
{@link org.altbeacon.beacon.logging.LogManager#d(String, String, Object...)} instead.
"""
LogManager.d(tag, message);
}
|
java
|
@Deprecated
public static void logDebug(String tag, String message) {
LogManager.d(tag, message);
}
|
[
"@",
"Deprecated",
"public",
"static",
"void",
"logDebug",
"(",
"String",
"tag",
",",
"String",
"message",
")",
"{",
"LogManager",
".",
"d",
"(",
"tag",
",",
"message",
")",
";",
"}"
] |
Convenience method for logging debug by the library
@param tag
@param message
@deprecated This will be removed in a later release. Use
{@link org.altbeacon.beacon.logging.LogManager#d(String, String, Object...)} instead.
|
[
"Convenience",
"method",
"for",
"logging",
"debug",
"by",
"the",
"library"
] |
train
|
https://github.com/AltBeacon/android-beacon-library/blob/f7f3a323ea7415d53e7bd695ff6a01f1501d5dc3/lib/src/main/java/org/altbeacon/beacon/BeaconManager.java#L1123-L1126
|
spring-projects/spring-data-solr
|
src/main/java/org/springframework/data/solr/core/query/SpellcheckOptions.java
|
SpellcheckOptions.collateParam
|
public SpellcheckOptions collateParam(String param, Object value) {
"""
This parameter prefix can be used to specify any additional parameters that you wish to the Spellchecker to use
when internally validating collation queries.
@param param
@param value
@return
"""
return potentiallySetCollate().createNewAndAppend(SpellingParams.SPELLCHECK_COLLATE_PARAM_OVERRIDE + param, value);
}
|
java
|
public SpellcheckOptions collateParam(String param, Object value) {
return potentiallySetCollate().createNewAndAppend(SpellingParams.SPELLCHECK_COLLATE_PARAM_OVERRIDE + param, value);
}
|
[
"public",
"SpellcheckOptions",
"collateParam",
"(",
"String",
"param",
",",
"Object",
"value",
")",
"{",
"return",
"potentiallySetCollate",
"(",
")",
".",
"createNewAndAppend",
"(",
"SpellingParams",
".",
"SPELLCHECK_COLLATE_PARAM_OVERRIDE",
"+",
"param",
",",
"value",
")",
";",
"}"
] |
This parameter prefix can be used to specify any additional parameters that you wish to the Spellchecker to use
when internally validating collation queries.
@param param
@param value
@return
|
[
"This",
"parameter",
"prefix",
"can",
"be",
"used",
"to",
"specify",
"any",
"additional",
"parameters",
"that",
"you",
"wish",
"to",
"the",
"Spellchecker",
"to",
"use",
"when",
"internally",
"validating",
"collation",
"queries",
"."
] |
train
|
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/SpellcheckOptions.java#L232-L234
|
finmath/finmath-lib
|
src/main/java6/net/finmath/montecarlo/interestrate/modelplugins/AbstractLIBORCovarianceModel.java
|
AbstractLIBORCovarianceModel.getFactorLoading
|
public RandomVariableInterface[] getFactorLoading(double time, double component, RandomVariableInterface[] realizationAtTimeIndex) {
"""
Return the factor loading for a given time and a given component.
The factor loading is the vector <i>f<sub>i</sub></i> such that the scalar product <br>
<i>f<sub>j</sub>f<sub>k</sub> = f<sub>j,1</sub>f<sub>k,1</sub> + ... + f<sub>j,m</sub>f<sub>k,m</sub></i> <br>
is the instantaneous covariance of the component <i>j</i> and <i>k</i>.
With respect to simulation time <i>t</i>, this method uses a piece wise constant interpolation, i.e.,
it calculates <i>t_<sub>i</sub></i> such that <i>t_<sub>i</sub></i> is the largest point in <code>getTimeDiscretization</code>
such that <i>t_<sub>i</sub> ≤ t </i>.
The component here, it given via a double <i>T</i> which may be associated with the LIBOR fixing date.
With respect to component time <i>T</i>, this method uses a piece wise constant interpolation, i.e.,
it calculates <i>T_<sub>j</sub></i> such that <i>T_<sub>j</sub></i> is the largest point in <code>getTimeDiscretization</code>
such that <i>T_<sub>j</sub> ≤ T </i>.
@param time The time <i>t</i> at which factor loading is requested.
@param component The component time (as a double associated with the fixing of the forward rate) <i>T<sub>i</sub></i>.
@param realizationAtTimeIndex The realization of the stochastic process (may be used to implement local volatility/covariance/correlation models).
@return The factor loading <i>f<sub>i</sub>(t)</i>.
"""
int componentIndex = liborPeriodDiscretization.getTimeIndex(component);
if(componentIndex < 0) {
componentIndex = -componentIndex - 2;
}
return getFactorLoading(time, componentIndex, realizationAtTimeIndex);
}
|
java
|
public RandomVariableInterface[] getFactorLoading(double time, double component, RandomVariableInterface[] realizationAtTimeIndex) {
int componentIndex = liborPeriodDiscretization.getTimeIndex(component);
if(componentIndex < 0) {
componentIndex = -componentIndex - 2;
}
return getFactorLoading(time, componentIndex, realizationAtTimeIndex);
}
|
[
"public",
"RandomVariableInterface",
"[",
"]",
"getFactorLoading",
"(",
"double",
"time",
",",
"double",
"component",
",",
"RandomVariableInterface",
"[",
"]",
"realizationAtTimeIndex",
")",
"{",
"int",
"componentIndex",
"=",
"liborPeriodDiscretization",
".",
"getTimeIndex",
"(",
"component",
")",
";",
"if",
"(",
"componentIndex",
"<",
"0",
")",
"{",
"componentIndex",
"=",
"-",
"componentIndex",
"-",
"2",
";",
"}",
"return",
"getFactorLoading",
"(",
"time",
",",
"componentIndex",
",",
"realizationAtTimeIndex",
")",
";",
"}"
] |
Return the factor loading for a given time and a given component.
The factor loading is the vector <i>f<sub>i</sub></i> such that the scalar product <br>
<i>f<sub>j</sub>f<sub>k</sub> = f<sub>j,1</sub>f<sub>k,1</sub> + ... + f<sub>j,m</sub>f<sub>k,m</sub></i> <br>
is the instantaneous covariance of the component <i>j</i> and <i>k</i>.
With respect to simulation time <i>t</i>, this method uses a piece wise constant interpolation, i.e.,
it calculates <i>t_<sub>i</sub></i> such that <i>t_<sub>i</sub></i> is the largest point in <code>getTimeDiscretization</code>
such that <i>t_<sub>i</sub> ≤ t </i>.
The component here, it given via a double <i>T</i> which may be associated with the LIBOR fixing date.
With respect to component time <i>T</i>, this method uses a piece wise constant interpolation, i.e.,
it calculates <i>T_<sub>j</sub></i> such that <i>T_<sub>j</sub></i> is the largest point in <code>getTimeDiscretization</code>
such that <i>T_<sub>j</sub> ≤ T </i>.
@param time The time <i>t</i> at which factor loading is requested.
@param component The component time (as a double associated with the fixing of the forward rate) <i>T<sub>i</sub></i>.
@param realizationAtTimeIndex The realization of the stochastic process (may be used to implement local volatility/covariance/correlation models).
@return The factor loading <i>f<sub>i</sub>(t)</i>.
|
[
"Return",
"the",
"factor",
"loading",
"for",
"a",
"given",
"time",
"and",
"a",
"given",
"component",
"."
] |
train
|
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/interestrate/modelplugins/AbstractLIBORCovarianceModel.java#L63-L69
|
likethecolor/Alchemy-API
|
src/main/java/com/likethecolor/alchemy/api/parser/json/ImageParser.java
|
ImageParser.isValidImage
|
private boolean isValidImage(final String imageKeyword, final Double score) {
"""
Return true if at least one of the values is not null/empty.
@param imageKeyword the image keyword
@param score the score
@return true if at least one of the values is not null/empty
"""
return !StringUtils.isBlank(imageKeyword)
|| score != null;
}
|
java
|
private boolean isValidImage(final String imageKeyword, final Double score) {
return !StringUtils.isBlank(imageKeyword)
|| score != null;
}
|
[
"private",
"boolean",
"isValidImage",
"(",
"final",
"String",
"imageKeyword",
",",
"final",
"Double",
"score",
")",
"{",
"return",
"!",
"StringUtils",
".",
"isBlank",
"(",
"imageKeyword",
")",
"||",
"score",
"!=",
"null",
";",
"}"
] |
Return true if at least one of the values is not null/empty.
@param imageKeyword the image keyword
@param score the score
@return true if at least one of the values is not null/empty
|
[
"Return",
"true",
"if",
"at",
"least",
"one",
"of",
"the",
"values",
"is",
"not",
"null",
"/",
"empty",
"."
] |
train
|
https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/ImageParser.java#L82-L85
|
knowm/XChange
|
xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/service/CoinbaseAccountServiceRaw.java
|
CoinbaseAccountServiceRaw.getCoinbaseSubscriptions
|
public CoinbaseSubscriptions getCoinbaseSubscriptions(Integer page, final Integer limit)
throws IOException {
"""
Authenticated resource that lets you (as a merchant) list all the subscriptions customers have
made with you. This call returns {@code CoinbaseSubscription} objects where you are the
merchant.
@param page Optional parameter to request a desired page of results. Will return page 1 if the
supplied page is null or less than 1.
@param limit Optional parameter to limit the maximum number of results to return. Will return
up to 25 results by default if null or less than 1.
@return
@throws IOException
@see <a
href="https://coinbase.com/api/doc/1.0/subscribers/index.html">coinbase.com/api/doc/1.0/subscribers/index.html</a>
"""
final CoinbaseSubscriptions subscriptions =
coinbase.getsSubscriptions(
page,
limit,
exchange.getExchangeSpecification().getApiKey(),
signatureCreator,
exchange.getNonceFactory());
return subscriptions;
}
|
java
|
public CoinbaseSubscriptions getCoinbaseSubscriptions(Integer page, final Integer limit)
throws IOException {
final CoinbaseSubscriptions subscriptions =
coinbase.getsSubscriptions(
page,
limit,
exchange.getExchangeSpecification().getApiKey(),
signatureCreator,
exchange.getNonceFactory());
return subscriptions;
}
|
[
"public",
"CoinbaseSubscriptions",
"getCoinbaseSubscriptions",
"(",
"Integer",
"page",
",",
"final",
"Integer",
"limit",
")",
"throws",
"IOException",
"{",
"final",
"CoinbaseSubscriptions",
"subscriptions",
"=",
"coinbase",
".",
"getsSubscriptions",
"(",
"page",
",",
"limit",
",",
"exchange",
".",
"getExchangeSpecification",
"(",
")",
".",
"getApiKey",
"(",
")",
",",
"signatureCreator",
",",
"exchange",
".",
"getNonceFactory",
"(",
")",
")",
";",
"return",
"subscriptions",
";",
"}"
] |
Authenticated resource that lets you (as a merchant) list all the subscriptions customers have
made with you. This call returns {@code CoinbaseSubscription} objects where you are the
merchant.
@param page Optional parameter to request a desired page of results. Will return page 1 if the
supplied page is null or less than 1.
@param limit Optional parameter to limit the maximum number of results to return. Will return
up to 25 results by default if null or less than 1.
@return
@throws IOException
@see <a
href="https://coinbase.com/api/doc/1.0/subscribers/index.html">coinbase.com/api/doc/1.0/subscribers/index.html</a>
|
[
"Authenticated",
"resource",
"that",
"lets",
"you",
"(",
"as",
"a",
"merchant",
")",
"list",
"all",
"the",
"subscriptions",
"customers",
"have",
"made",
"with",
"you",
".",
"This",
"call",
"returns",
"{",
"@code",
"CoinbaseSubscription",
"}",
"objects",
"where",
"you",
"are",
"the",
"merchant",
"."
] |
train
|
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/service/CoinbaseAccountServiceRaw.java#L686-L697
|
micronaut-projects/micronaut-core
|
core/src/main/java/io/micronaut/core/annotation/AnnotationValueBuilder.java
|
AnnotationValueBuilder.values
|
public AnnotationValueBuilder<T> values(@Nullable Enum<?>... enumObjs) {
"""
Sets the value member to the given enum objects.
@param enumObjs The enum[]
@return This builder
"""
return member(AnnotationMetadata.VALUE_MEMBER, enumObjs);
}
|
java
|
public AnnotationValueBuilder<T> values(@Nullable Enum<?>... enumObjs) {
return member(AnnotationMetadata.VALUE_MEMBER, enumObjs);
}
|
[
"public",
"AnnotationValueBuilder",
"<",
"T",
">",
"values",
"(",
"@",
"Nullable",
"Enum",
"<",
"?",
">",
"...",
"enumObjs",
")",
"{",
"return",
"member",
"(",
"AnnotationMetadata",
".",
"VALUE_MEMBER",
",",
"enumObjs",
")",
";",
"}"
] |
Sets the value member to the given enum objects.
@param enumObjs The enum[]
@return This builder
|
[
"Sets",
"the",
"value",
"member",
"to",
"the",
"given",
"enum",
"objects",
"."
] |
train
|
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/annotation/AnnotationValueBuilder.java#L149-L151
|
goldmansachs/gs-collections
|
collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java
|
StringIterate.reverseForEachCodePoint
|
public static void reverseForEachCodePoint(String string, CodePointProcedure procedure) {
"""
For each int code point in the {@code string} in reverse order, execute the {@link CodePointProcedure}.
@since 7.0
"""
for (int i = StringIterate.lastIndex(string); i >= 0; )
{
int codePoint = string.codePointAt(i);
procedure.value(codePoint);
if (i == 0)
{
i--;
}
else
{
i -= StringIterate.numberOfChars(string, i);
}
}
}
|
java
|
public static void reverseForEachCodePoint(String string, CodePointProcedure procedure)
{
for (int i = StringIterate.lastIndex(string); i >= 0; )
{
int codePoint = string.codePointAt(i);
procedure.value(codePoint);
if (i == 0)
{
i--;
}
else
{
i -= StringIterate.numberOfChars(string, i);
}
}
}
|
[
"public",
"static",
"void",
"reverseForEachCodePoint",
"(",
"String",
"string",
",",
"CodePointProcedure",
"procedure",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"StringIterate",
".",
"lastIndex",
"(",
"string",
")",
";",
"i",
">=",
"0",
";",
")",
"{",
"int",
"codePoint",
"=",
"string",
".",
"codePointAt",
"(",
"i",
")",
";",
"procedure",
".",
"value",
"(",
"codePoint",
")",
";",
"if",
"(",
"i",
"==",
"0",
")",
"{",
"i",
"--",
";",
"}",
"else",
"{",
"i",
"-=",
"StringIterate",
".",
"numberOfChars",
"(",
"string",
",",
"i",
")",
";",
"}",
"}",
"}"
] |
For each int code point in the {@code string} in reverse order, execute the {@link CodePointProcedure}.
@since 7.0
|
[
"For",
"each",
"int",
"code",
"point",
"in",
"the",
"{",
"@code",
"string",
"}",
"in",
"reverse",
"order",
"execute",
"the",
"{",
"@link",
"CodePointProcedure",
"}",
"."
] |
train
|
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L436-L451
|
mikepenz/Crossfader
|
library/src/main/java/com/mikepenz/crossfader/view/CrossFadeSlidingPaneLayout.java
|
CrossFadeSlidingPaneLayout.enableDisableView
|
private void enableDisableView(View view, boolean enabled) {
"""
helper method to disable a view and all its subviews
@param view
@param enabled
"""
view.setEnabled(enabled);
view.setFocusable(enabled);
if (view instanceof ViewGroup) {
ViewGroup group = (ViewGroup) view;
for (int idx = 0; idx < group.getChildCount(); idx++) {
enableDisableView(group.getChildAt(idx), enabled);
}
}
}
|
java
|
private void enableDisableView(View view, boolean enabled) {
view.setEnabled(enabled);
view.setFocusable(enabled);
if (view instanceof ViewGroup) {
ViewGroup group = (ViewGroup) view;
for (int idx = 0; idx < group.getChildCount(); idx++) {
enableDisableView(group.getChildAt(idx), enabled);
}
}
}
|
[
"private",
"void",
"enableDisableView",
"(",
"View",
"view",
",",
"boolean",
"enabled",
")",
"{",
"view",
".",
"setEnabled",
"(",
"enabled",
")",
";",
"view",
".",
"setFocusable",
"(",
"enabled",
")",
";",
"if",
"(",
"view",
"instanceof",
"ViewGroup",
")",
"{",
"ViewGroup",
"group",
"=",
"(",
"ViewGroup",
")",
"view",
";",
"for",
"(",
"int",
"idx",
"=",
"0",
";",
"idx",
"<",
"group",
".",
"getChildCount",
"(",
")",
";",
"idx",
"++",
")",
"{",
"enableDisableView",
"(",
"group",
".",
"getChildAt",
"(",
"idx",
")",
",",
"enabled",
")",
";",
"}",
"}",
"}"
] |
helper method to disable a view and all its subviews
@param view
@param enabled
|
[
"helper",
"method",
"to",
"disable",
"a",
"view",
"and",
"all",
"its",
"subviews"
] |
train
|
https://github.com/mikepenz/Crossfader/blob/b2e1ee461bc3bcdd897d83f0fad950663bdc73b4/library/src/main/java/com/mikepenz/crossfader/view/CrossFadeSlidingPaneLayout.java#L152-L162
|
aws/aws-sdk-java
|
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/model/transform/XmlResponsesSaxParser.java
|
XmlResponsesSaxParser.parseXmlInputStream
|
protected void parseXmlInputStream(DefaultHandler handler, InputStream inputStream)
throws IOException {
"""
Parses an XML document from an input stream using a document handler.
@param handler
the handler for the XML document
@param inputStream
an input stream containing the XML document to parse
@throws IOException
on error reading from the input stream (ie connection reset)
@throws SdkClientException
on error with malformed XML, etc
"""
try {
if (log.isDebugEnabled()) {
log.debug("Parsing XML response document with handler: " + handler.getClass());
}
BufferedReader breader = new BufferedReader(new InputStreamReader(inputStream,
Constants.DEFAULT_ENCODING));
xr.setContentHandler(handler);
xr.setErrorHandler(handler);
xr.parse(new InputSource(breader));
} catch (IOException e) {
throw e;
} catch (Throwable t) {
try {
inputStream.close();
} catch (IOException e) {
if (log.isErrorEnabled()) {
log.error("Unable to close response InputStream up after XML parse failure", e);
}
}
throw new SdkClientException("Failed to parse XML document with handler "
+ handler.getClass(), t);
}
}
|
java
|
protected void parseXmlInputStream(DefaultHandler handler, InputStream inputStream)
throws IOException {
try {
if (log.isDebugEnabled()) {
log.debug("Parsing XML response document with handler: " + handler.getClass());
}
BufferedReader breader = new BufferedReader(new InputStreamReader(inputStream,
Constants.DEFAULT_ENCODING));
xr.setContentHandler(handler);
xr.setErrorHandler(handler);
xr.parse(new InputSource(breader));
} catch (IOException e) {
throw e;
} catch (Throwable t) {
try {
inputStream.close();
} catch (IOException e) {
if (log.isErrorEnabled()) {
log.error("Unable to close response InputStream up after XML parse failure", e);
}
}
throw new SdkClientException("Failed to parse XML document with handler "
+ handler.getClass(), t);
}
}
|
[
"protected",
"void",
"parseXmlInputStream",
"(",
"DefaultHandler",
"handler",
",",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"try",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Parsing XML response document with handler: \"",
"+",
"handler",
".",
"getClass",
"(",
")",
")",
";",
"}",
"BufferedReader",
"breader",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"inputStream",
",",
"Constants",
".",
"DEFAULT_ENCODING",
")",
")",
";",
"xr",
".",
"setContentHandler",
"(",
"handler",
")",
";",
"xr",
".",
"setErrorHandler",
"(",
"handler",
")",
";",
"xr",
".",
"parse",
"(",
"new",
"InputSource",
"(",
"breader",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"try",
"{",
"inputStream",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"if",
"(",
"log",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"log",
".",
"error",
"(",
"\"Unable to close response InputStream up after XML parse failure\"",
",",
"e",
")",
";",
"}",
"}",
"throw",
"new",
"SdkClientException",
"(",
"\"Failed to parse XML document with handler \"",
"+",
"handler",
".",
"getClass",
"(",
")",
",",
"t",
")",
";",
"}",
"}"
] |
Parses an XML document from an input stream using a document handler.
@param handler
the handler for the XML document
@param inputStream
an input stream containing the XML document to parse
@throws IOException
on error reading from the input stream (ie connection reset)
@throws SdkClientException
on error with malformed XML, etc
|
[
"Parses",
"an",
"XML",
"document",
"from",
"an",
"input",
"stream",
"using",
"a",
"document",
"handler",
"."
] |
train
|
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/model/transform/XmlResponsesSaxParser.java#L140-L168
|
UrielCh/ovh-java-sdk
|
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
|
ApiOvhDbaaslogs.serviceName_input_inputId_GET
|
public OvhInput serviceName_input_inputId_GET(String serviceName, String inputId) throws IOException {
"""
Returns details of specified input
REST: GET /dbaas/logs/{serviceName}/input/{inputId}
@param serviceName [required] Service name
@param inputId [required] Input ID
"""
String qPath = "/dbaas/logs/{serviceName}/input/{inputId}";
StringBuilder sb = path(qPath, serviceName, inputId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhInput.class);
}
|
java
|
public OvhInput serviceName_input_inputId_GET(String serviceName, String inputId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/input/{inputId}";
StringBuilder sb = path(qPath, serviceName, inputId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhInput.class);
}
|
[
"public",
"OvhInput",
"serviceName_input_inputId_GET",
"(",
"String",
"serviceName",
",",
"String",
"inputId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dbaas/logs/{serviceName}/input/{inputId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"inputId",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhInput",
".",
"class",
")",
";",
"}"
] |
Returns details of specified input
REST: GET /dbaas/logs/{serviceName}/input/{inputId}
@param serviceName [required] Service name
@param inputId [required] Input ID
|
[
"Returns",
"details",
"of",
"specified",
"input"
] |
train
|
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L396-L401
|
Stratio/bdt
|
src/main/java/com/stratio/qa/specs/DcosSpec.java
|
DcosSpec.destroyService
|
@Given("^I destroy service '(.+?)' in cluster '(.+?)'")
public void destroyService(String service, String cluster) throws Exception {
"""
Destroy specified service
@param service name of the service to be destroyed
@param cluster URI of the cluster
@throws Exception exception *
"""
String endPoint = "/service/deploy-api/deploy/uninstall?app=" + service;
Future response;
this.commonspec.setRestProtocol("https://");
this.commonspec.setRestHost(cluster);
this.commonspec.setRestPort(":443");
response = this.commonspec.generateRequest("DELETE", true, null, null, endPoint, null, "json");
this.commonspec.setResponse("DELETE", (Response) response.get());
assertThat(this.commonspec.getResponse().getStatusCode()).as("It hasn't been possible to destroy service: " + service).isIn(Arrays.asList(200, 202));
}
|
java
|
@Given("^I destroy service '(.+?)' in cluster '(.+?)'")
public void destroyService(String service, String cluster) throws Exception {
String endPoint = "/service/deploy-api/deploy/uninstall?app=" + service;
Future response;
this.commonspec.setRestProtocol("https://");
this.commonspec.setRestHost(cluster);
this.commonspec.setRestPort(":443");
response = this.commonspec.generateRequest("DELETE", true, null, null, endPoint, null, "json");
this.commonspec.setResponse("DELETE", (Response) response.get());
assertThat(this.commonspec.getResponse().getStatusCode()).as("It hasn't been possible to destroy service: " + service).isIn(Arrays.asList(200, 202));
}
|
[
"@",
"Given",
"(",
"\"^I destroy service '(.+?)' in cluster '(.+?)'\"",
")",
"public",
"void",
"destroyService",
"(",
"String",
"service",
",",
"String",
"cluster",
")",
"throws",
"Exception",
"{",
"String",
"endPoint",
"=",
"\"/service/deploy-api/deploy/uninstall?app=\"",
"+",
"service",
";",
"Future",
"response",
";",
"this",
".",
"commonspec",
".",
"setRestProtocol",
"(",
"\"https://\"",
")",
";",
"this",
".",
"commonspec",
".",
"setRestHost",
"(",
"cluster",
")",
";",
"this",
".",
"commonspec",
".",
"setRestPort",
"(",
"\":443\"",
")",
";",
"response",
"=",
"this",
".",
"commonspec",
".",
"generateRequest",
"(",
"\"DELETE\"",
",",
"true",
",",
"null",
",",
"null",
",",
"endPoint",
",",
"null",
",",
"\"json\"",
")",
";",
"this",
".",
"commonspec",
".",
"setResponse",
"(",
"\"DELETE\"",
",",
"(",
"Response",
")",
"response",
".",
"get",
"(",
")",
")",
";",
"assertThat",
"(",
"this",
".",
"commonspec",
".",
"getResponse",
"(",
")",
".",
"getStatusCode",
"(",
")",
")",
".",
"as",
"(",
"\"It hasn't been possible to destroy service: \"",
"+",
"service",
")",
".",
"isIn",
"(",
"Arrays",
".",
"asList",
"(",
"200",
",",
"202",
")",
")",
";",
"}"
] |
Destroy specified service
@param service name of the service to be destroyed
@param cluster URI of the cluster
@throws Exception exception *
|
[
"Destroy",
"specified",
"service"
] |
train
|
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DcosSpec.java#L365-L378
|
kuali/ojb-1.0.4
|
src/ejb/org/apache/ojb/ejb/pb/RollbackBean.java
|
RollbackBean.rollbackOtherBeanUsing_2
|
public void rollbackOtherBeanUsing_2(ArticleVO article, List persons) {
"""
First store a list of persons then we
store the article using a failure store
method in ArticleManager.
@ejb:interface-method
"""
log.info("rollbackOtherBeanUsing_2 method was called");
ArticleManagerPBLocal am = getArticleManager();
PersonManagerPBLocal pm = getPersonManager();
pm.storePersons(persons);
am.failureStore(article);
}
|
java
|
public void rollbackOtherBeanUsing_2(ArticleVO article, List persons)
{
log.info("rollbackOtherBeanUsing_2 method was called");
ArticleManagerPBLocal am = getArticleManager();
PersonManagerPBLocal pm = getPersonManager();
pm.storePersons(persons);
am.failureStore(article);
}
|
[
"public",
"void",
"rollbackOtherBeanUsing_2",
"(",
"ArticleVO",
"article",
",",
"List",
"persons",
")",
"{",
"log",
".",
"info",
"(",
"\"rollbackOtherBeanUsing_2 method was called\"",
")",
";",
"ArticleManagerPBLocal",
"am",
"=",
"getArticleManager",
"(",
")",
";",
"PersonManagerPBLocal",
"pm",
"=",
"getPersonManager",
"(",
")",
";",
"pm",
".",
"storePersons",
"(",
"persons",
")",
";",
"am",
".",
"failureStore",
"(",
"article",
")",
";",
"}"
] |
First store a list of persons then we
store the article using a failure store
method in ArticleManager.
@ejb:interface-method
|
[
"First",
"store",
"a",
"list",
"of",
"persons",
"then",
"we",
"store",
"the",
"article",
"using",
"a",
"failure",
"store",
"method",
"in",
"ArticleManager",
"."
] |
train
|
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/ejb/org/apache/ojb/ejb/pb/RollbackBean.java#L117-L124
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/query/impl/Indexes.java
|
Indexes.markPartitionAsIndexed
|
public static void markPartitionAsIndexed(int partitionId, InternalIndex[] indexes) {
"""
Marks the given partition as indexed by the given indexes.
@param partitionId the ID of the partition to mark as indexed.
@param indexes the indexes by which the given partition is indexed.
"""
for (InternalIndex index : indexes) {
index.markPartitionAsIndexed(partitionId);
}
}
|
java
|
public static void markPartitionAsIndexed(int partitionId, InternalIndex[] indexes) {
for (InternalIndex index : indexes) {
index.markPartitionAsIndexed(partitionId);
}
}
|
[
"public",
"static",
"void",
"markPartitionAsIndexed",
"(",
"int",
"partitionId",
",",
"InternalIndex",
"[",
"]",
"indexes",
")",
"{",
"for",
"(",
"InternalIndex",
"index",
":",
"indexes",
")",
"{",
"index",
".",
"markPartitionAsIndexed",
"(",
"partitionId",
")",
";",
"}",
"}"
] |
Marks the given partition as indexed by the given indexes.
@param partitionId the ID of the partition to mark as indexed.
@param indexes the indexes by which the given partition is indexed.
|
[
"Marks",
"the",
"given",
"partition",
"as",
"indexed",
"by",
"the",
"given",
"indexes",
"."
] |
train
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/impl/Indexes.java#L81-L85
|
jMetal/jMetal
|
jmetal-algorithm/src/main/java/org/uma/jmetal/algorithm/multiobjective/moead/MOEADD.java
|
MOEADD.checkDominance
|
public int checkDominance(S a, S b) {
"""
check the dominance relationship between a and b: 1 -> a dominates b, -1 -> b dominates a 0 ->
non-dominated with each other
"""
int flag1 = 0;
int flag2 = 0;
for (int i = 0; i < problem.getNumberOfObjectives(); i++) {
if (a.getObjective(i) < b.getObjective(i)) {
flag1 = 1;
} else {
if (a.getObjective(i) > b.getObjective(i)) {
flag2 = 1;
}
}
}
if (flag1 == 1 && flag2 == 0) {
return 1;
} else {
if (flag1 == 0 && flag2 == 1) {
return -1;
} else {
return 0;
}
}
}
|
java
|
public int checkDominance(S a, S b) {
int flag1 = 0;
int flag2 = 0;
for (int i = 0; i < problem.getNumberOfObjectives(); i++) {
if (a.getObjective(i) < b.getObjective(i)) {
flag1 = 1;
} else {
if (a.getObjective(i) > b.getObjective(i)) {
flag2 = 1;
}
}
}
if (flag1 == 1 && flag2 == 0) {
return 1;
} else {
if (flag1 == 0 && flag2 == 1) {
return -1;
} else {
return 0;
}
}
}
|
[
"public",
"int",
"checkDominance",
"(",
"S",
"a",
",",
"S",
"b",
")",
"{",
"int",
"flag1",
"=",
"0",
";",
"int",
"flag2",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"problem",
".",
"getNumberOfObjectives",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"a",
".",
"getObjective",
"(",
"i",
")",
"<",
"b",
".",
"getObjective",
"(",
"i",
")",
")",
"{",
"flag1",
"=",
"1",
";",
"}",
"else",
"{",
"if",
"(",
"a",
".",
"getObjective",
"(",
"i",
")",
">",
"b",
".",
"getObjective",
"(",
"i",
")",
")",
"{",
"flag2",
"=",
"1",
";",
"}",
"}",
"}",
"if",
"(",
"flag1",
"==",
"1",
"&&",
"flag2",
"==",
"0",
")",
"{",
"return",
"1",
";",
"}",
"else",
"{",
"if",
"(",
"flag1",
"==",
"0",
"&&",
"flag2",
"==",
"1",
")",
"{",
"return",
"-",
"1",
";",
"}",
"else",
"{",
"return",
"0",
";",
"}",
"}",
"}"
] |
check the dominance relationship between a and b: 1 -> a dominates b, -1 -> b dominates a 0 ->
non-dominated with each other
|
[
"check",
"the",
"dominance",
"relationship",
"between",
"a",
"and",
"b",
":",
"1",
"-",
">",
"a",
"dominates",
"b",
"-",
"1",
"-",
">",
"b",
"dominates",
"a",
"0",
"-",
">",
"non",
"-",
"dominated",
"with",
"each",
"other"
] |
train
|
https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-algorithm/src/main/java/org/uma/jmetal/algorithm/multiobjective/moead/MOEADD.java#L1273-L1296
|
xhsun/gw2wrapper
|
src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java
|
SynchronousRequest.getAllLegendID
|
public List<String> getAllLegendID() throws GuildWars2Exception {
"""
For more info on legends API go <a href="https://wiki.guildwars2.com/wiki/API:2/legends">here</a><br/>
Get all legend id(s)
@return list of legend info
@throws GuildWars2Exception see {@link ErrorCode} for detail
@see Legend legend info
"""
try {
Response<List<String>> response = gw2API.getAllLegendIDs().execute();
if (!response.isSuccessful()) throwError(response.code(), response.errorBody());
return response.body();
} catch (IOException e) {
throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage());
}
}
|
java
|
public List<String> getAllLegendID() throws GuildWars2Exception {
try {
Response<List<String>> response = gw2API.getAllLegendIDs().execute();
if (!response.isSuccessful()) throwError(response.code(), response.errorBody());
return response.body();
} catch (IOException e) {
throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage());
}
}
|
[
"public",
"List",
"<",
"String",
">",
"getAllLegendID",
"(",
")",
"throws",
"GuildWars2Exception",
"{",
"try",
"{",
"Response",
"<",
"List",
"<",
"String",
">>",
"response",
"=",
"gw2API",
".",
"getAllLegendIDs",
"(",
")",
".",
"execute",
"(",
")",
";",
"if",
"(",
"!",
"response",
".",
"isSuccessful",
"(",
")",
")",
"throwError",
"(",
"response",
".",
"code",
"(",
")",
",",
"response",
".",
"errorBody",
"(",
")",
")",
";",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"GuildWars2Exception",
"(",
"ErrorCode",
".",
"Network",
",",
"\"Network Error: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] |
For more info on legends API go <a href="https://wiki.guildwars2.com/wiki/API:2/legends">here</a><br/>
Get all legend id(s)
@return list of legend info
@throws GuildWars2Exception see {@link ErrorCode} for detail
@see Legend legend info
|
[
"For",
"more",
"info",
"on",
"legends",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"legends",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Get",
"all",
"legend",
"id",
"(",
"s",
")"
] |
train
|
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java#L2332-L2340
|
OpenLiberty/open-liberty
|
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/JFapByteBuffer.java
|
JFapByteBuffer.getDumpBytes
|
private static String getDumpBytes(WsByteBuffer buffer, int bytesToDump, boolean rewind) {
"""
Returns a dump of the specified number of bytes of the specified buffer.
@param buffer
@param bytesToDump
@return Returns a String containing a dump of the buffer.
"""
// Save the current position
int pos = buffer.position();
if (rewind)
{
buffer.rewind();
}
byte[] data = null;
int start;
int count = bytesToDump;
if (count > buffer.remaining() || count == ENTIRE_BUFFER) count = buffer.remaining();
if (buffer.hasArray())
{
data = buffer.array();
start = buffer.arrayOffset() + buffer.position();
}
else
{
data = new byte[count];
buffer.get(data);
start = 0;
}
String strData = "Dumping "+count+" bytes of buffer data:\r\n";
if (count > 0) strData += SibTr.formatBytes(data, start, count);
// Return the position to where it should be
if (rewind) buffer.position(pos);
return strData;
}
|
java
|
private static String getDumpBytes(WsByteBuffer buffer, int bytesToDump, boolean rewind)
{
// Save the current position
int pos = buffer.position();
if (rewind)
{
buffer.rewind();
}
byte[] data = null;
int start;
int count = bytesToDump;
if (count > buffer.remaining() || count == ENTIRE_BUFFER) count = buffer.remaining();
if (buffer.hasArray())
{
data = buffer.array();
start = buffer.arrayOffset() + buffer.position();
}
else
{
data = new byte[count];
buffer.get(data);
start = 0;
}
String strData = "Dumping "+count+" bytes of buffer data:\r\n";
if (count > 0) strData += SibTr.formatBytes(data, start, count);
// Return the position to where it should be
if (rewind) buffer.position(pos);
return strData;
}
|
[
"private",
"static",
"String",
"getDumpBytes",
"(",
"WsByteBuffer",
"buffer",
",",
"int",
"bytesToDump",
",",
"boolean",
"rewind",
")",
"{",
"// Save the current position",
"int",
"pos",
"=",
"buffer",
".",
"position",
"(",
")",
";",
"if",
"(",
"rewind",
")",
"{",
"buffer",
".",
"rewind",
"(",
")",
";",
"}",
"byte",
"[",
"]",
"data",
"=",
"null",
";",
"int",
"start",
";",
"int",
"count",
"=",
"bytesToDump",
";",
"if",
"(",
"count",
">",
"buffer",
".",
"remaining",
"(",
")",
"||",
"count",
"==",
"ENTIRE_BUFFER",
")",
"count",
"=",
"buffer",
".",
"remaining",
"(",
")",
";",
"if",
"(",
"buffer",
".",
"hasArray",
"(",
")",
")",
"{",
"data",
"=",
"buffer",
".",
"array",
"(",
")",
";",
"start",
"=",
"buffer",
".",
"arrayOffset",
"(",
")",
"+",
"buffer",
".",
"position",
"(",
")",
";",
"}",
"else",
"{",
"data",
"=",
"new",
"byte",
"[",
"count",
"]",
";",
"buffer",
".",
"get",
"(",
"data",
")",
";",
"start",
"=",
"0",
";",
"}",
"String",
"strData",
"=",
"\"Dumping \"",
"+",
"count",
"+",
"\" bytes of buffer data:\\r\\n\"",
";",
"if",
"(",
"count",
">",
"0",
")",
"strData",
"+=",
"SibTr",
".",
"formatBytes",
"(",
"data",
",",
"start",
",",
"count",
")",
";",
"// Return the position to where it should be",
"if",
"(",
"rewind",
")",
"buffer",
".",
"position",
"(",
"pos",
")",
";",
"return",
"strData",
";",
"}"
] |
Returns a dump of the specified number of bytes of the specified buffer.
@param buffer
@param bytesToDump
@return Returns a String containing a dump of the buffer.
|
[
"Returns",
"a",
"dump",
"of",
"the",
"specified",
"number",
"of",
"bytes",
"of",
"the",
"specified",
"buffer",
"."
] |
train
|
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/JFapByteBuffer.java#L830-L863
|
Azure/azure-sdk-for-java
|
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java
|
ExpressRouteCrossConnectionsInner.beginListRoutesTableSummaryAsync
|
public Observable<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> beginListRoutesTableSummaryAsync(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath) {
"""
Gets the route table summary associated with the express route cross connection in a resource group.
@param resourceGroupName The name of the resource group.
@param crossConnectionName The name of the ExpressRouteCrossConnection.
@param peeringName The name of the peering.
@param devicePath The path of the device.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner object
"""
return beginListRoutesTableSummaryWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, devicePath).map(new Func1<ServiceResponse<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner>, ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner>() {
@Override
public ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner call(ServiceResponse<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> response) {
return response.body();
}
});
}
|
java
|
public Observable<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> beginListRoutesTableSummaryAsync(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath) {
return beginListRoutesTableSummaryWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, devicePath).map(new Func1<ServiceResponse<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner>, ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner>() {
@Override
public ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner call(ServiceResponse<ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner> response) {
return response.body();
}
});
}
|
[
"public",
"Observable",
"<",
"ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner",
">",
"beginListRoutesTableSummaryAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"crossConnectionName",
",",
"String",
"peeringName",
",",
"String",
"devicePath",
")",
"{",
"return",
"beginListRoutesTableSummaryWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"crossConnectionName",
",",
"peeringName",
",",
"devicePath",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner",
">",
",",
"ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner",
"call",
"(",
"ServiceResponse",
"<",
"ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Gets the route table summary associated with the express route cross connection in a resource group.
@param resourceGroupName The name of the resource group.
@param crossConnectionName The name of the ExpressRouteCrossConnection.
@param peeringName The name of the peering.
@param devicePath The path of the device.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner object
|
[
"Gets",
"the",
"route",
"table",
"summary",
"associated",
"with",
"the",
"express",
"route",
"cross",
"connection",
"in",
"a",
"resource",
"group",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java#L1216-L1223
|
UrielCh/ovh-java-sdk
|
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
|
ApiOvhEmailexchange.organizationName_service_exchangeService_domain_domainName_disclaimer_PUT
|
public void organizationName_service_exchangeService_domain_domainName_disclaimer_PUT(String organizationName, String exchangeService, String domainName, OvhDisclaimer body) throws IOException {
"""
Alter this object properties
REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimer
@param body [required] New object properties
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param domainName [required] Domain name
"""
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimer";
StringBuilder sb = path(qPath, organizationName, exchangeService, domainName);
exec(qPath, "PUT", sb.toString(), body);
}
|
java
|
public void organizationName_service_exchangeService_domain_domainName_disclaimer_PUT(String organizationName, String exchangeService, String domainName, OvhDisclaimer body) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimer";
StringBuilder sb = path(qPath, organizationName, exchangeService, domainName);
exec(qPath, "PUT", sb.toString(), body);
}
|
[
"public",
"void",
"organizationName_service_exchangeService_domain_domainName_disclaimer_PUT",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"domainName",
",",
"OvhDisclaimer",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimer\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"organizationName",
",",
"exchangeService",
",",
"domainName",
")",
";",
"exec",
"(",
"qPath",
",",
"\"PUT\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"body",
")",
";",
"}"
] |
Alter this object properties
REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimer
@param body [required] New object properties
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param domainName [required] Domain name
|
[
"Alter",
"this",
"object",
"properties"
] |
train
|
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L545-L549
|
xwiki/xwiki-commons
|
xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/version/internal/DefaultVersion.java
|
DefaultVersion.comparePadding
|
private static int comparePadding(List<Element> elements, int index, Boolean number) {
"""
Compare the end of the version with 0.
@param elements the elements to compare to 0
@param index the index where to start comparing with 0
@param number indicate of the previous element is a number
@return the comparison result
"""
int rel = 0;
for (Iterator<Element> it = elements.listIterator(index); it.hasNext();) {
Element element = it.next();
if (number != null && number.booleanValue() != element.isNumber()) {
break;
}
rel = element.compareTo(null);
if (rel != 0) {
break;
}
}
return rel;
}
|
java
|
private static int comparePadding(List<Element> elements, int index, Boolean number)
{
int rel = 0;
for (Iterator<Element> it = elements.listIterator(index); it.hasNext();) {
Element element = it.next();
if (number != null && number.booleanValue() != element.isNumber()) {
break;
}
rel = element.compareTo(null);
if (rel != 0) {
break;
}
}
return rel;
}
|
[
"private",
"static",
"int",
"comparePadding",
"(",
"List",
"<",
"Element",
">",
"elements",
",",
"int",
"index",
",",
"Boolean",
"number",
")",
"{",
"int",
"rel",
"=",
"0",
";",
"for",
"(",
"Iterator",
"<",
"Element",
">",
"it",
"=",
"elements",
".",
"listIterator",
"(",
"index",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Element",
"element",
"=",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"number",
"!=",
"null",
"&&",
"number",
".",
"booleanValue",
"(",
")",
"!=",
"element",
".",
"isNumber",
"(",
")",
")",
"{",
"break",
";",
"}",
"rel",
"=",
"element",
".",
"compareTo",
"(",
"null",
")",
";",
"if",
"(",
"rel",
"!=",
"0",
")",
"{",
"break",
";",
"}",
"}",
"return",
"rel",
";",
"}"
] |
Compare the end of the version with 0.
@param elements the elements to compare to 0
@param index the index where to start comparing with 0
@param number indicate of the previous element is a number
@return the comparison result
|
[
"Compare",
"the",
"end",
"of",
"the",
"version",
"with",
"0",
"."
] |
train
|
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/version/internal/DefaultVersion.java#L616-L633
|
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.checkNameAvailabilityAsync
|
public Observable<NameAvailabilityResponseInner> checkNameAvailabilityAsync(String location, NameAvailabilityRequest parameters) {
"""
Check name validity and availability.
This method checks whether a proposed top-level resource name is valid and available.
@param location The Azure region of the operation
@param parameters Requested name to validate
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the NameAvailabilityResponseInner object
"""
return checkNameAvailabilityWithServiceResponseAsync(location, parameters).map(new Func1<ServiceResponse<NameAvailabilityResponseInner>, NameAvailabilityResponseInner>() {
@Override
public NameAvailabilityResponseInner call(ServiceResponse<NameAvailabilityResponseInner> response) {
return response.body();
}
});
}
|
java
|
public Observable<NameAvailabilityResponseInner> checkNameAvailabilityAsync(String location, NameAvailabilityRequest parameters) {
return checkNameAvailabilityWithServiceResponseAsync(location, parameters).map(new Func1<ServiceResponse<NameAvailabilityResponseInner>, NameAvailabilityResponseInner>() {
@Override
public NameAvailabilityResponseInner call(ServiceResponse<NameAvailabilityResponseInner> response) {
return response.body();
}
});
}
|
[
"public",
"Observable",
"<",
"NameAvailabilityResponseInner",
">",
"checkNameAvailabilityAsync",
"(",
"String",
"location",
",",
"NameAvailabilityRequest",
"parameters",
")",
"{",
"return",
"checkNameAvailabilityWithServiceResponseAsync",
"(",
"location",
",",
"parameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"NameAvailabilityResponseInner",
">",
",",
"NameAvailabilityResponseInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"NameAvailabilityResponseInner",
"call",
"(",
"ServiceResponse",
"<",
"NameAvailabilityResponseInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Check name validity and availability.
This method checks whether a proposed top-level resource name is valid and available.
@param location The Azure region of the operation
@param parameters Requested name to validate
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the NameAvailabilityResponseInner object
|
[
"Check",
"name",
"validity",
"and",
"availability",
".",
"This",
"method",
"checks",
"whether",
"a",
"proposed",
"top",
"-",
"level",
"resource",
"name",
"is",
"valid",
"and",
"available",
"."
] |
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#L1839-L1846
|
OpenLiberty/open-liberty
|
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLUtils.java
|
SSLUtils.resetBuffersAfterJSSE
|
public static void resetBuffersAfterJSSE(WsByteBuffer[] buffers, int[] limitInfo) {
"""
This method is called after a call is made to adjustBuffersForJSSE followed by a
call to wrap or unwrap in the JSSE. It restores the saved limit in the buffer
that was modified. A few extra checks are done here to prevent any problems during
odd code paths in the future.
@param buffers array of buffers containing the buffer whose limit should be reset.
@param limitInfo array of 2. The first entry is the index of the buffer whose limit
will be restored in the array. The second entry is the actual limit to be restored.
"""
// Handle case where not changes were made in recent call to adjustBuffersForJSSE
if (limitInfo == null) {
return;
}
int bufferIndex = limitInfo[0];
int bufferLimit = limitInfo[1];
// Ensure buffer index is within array bounds.
if (buffers.length > bufferIndex) {
WsByteBuffer buffer = buffers[bufferIndex];
// Ensure the buffer is not null and the limit won't be set beyond the capacity
if ((buffer != null) && (buffer.capacity() >= bufferLimit)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "resetBuffersAfterJSSE: buffer [" + bufferIndex
+ "] from " + buffer.limit() + " to " + bufferLimit);
}
// Make the adjustment.
buffer.limit(bufferLimit);
}
}
}
|
java
|
public static void resetBuffersAfterJSSE(WsByteBuffer[] buffers, int[] limitInfo) {
// Handle case where not changes were made in recent call to adjustBuffersForJSSE
if (limitInfo == null) {
return;
}
int bufferIndex = limitInfo[0];
int bufferLimit = limitInfo[1];
// Ensure buffer index is within array bounds.
if (buffers.length > bufferIndex) {
WsByteBuffer buffer = buffers[bufferIndex];
// Ensure the buffer is not null and the limit won't be set beyond the capacity
if ((buffer != null) && (buffer.capacity() >= bufferLimit)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "resetBuffersAfterJSSE: buffer [" + bufferIndex
+ "] from " + buffer.limit() + " to " + bufferLimit);
}
// Make the adjustment.
buffer.limit(bufferLimit);
}
}
}
|
[
"public",
"static",
"void",
"resetBuffersAfterJSSE",
"(",
"WsByteBuffer",
"[",
"]",
"buffers",
",",
"int",
"[",
"]",
"limitInfo",
")",
"{",
"// Handle case where not changes were made in recent call to adjustBuffersForJSSE",
"if",
"(",
"limitInfo",
"==",
"null",
")",
"{",
"return",
";",
"}",
"int",
"bufferIndex",
"=",
"limitInfo",
"[",
"0",
"]",
";",
"int",
"bufferLimit",
"=",
"limitInfo",
"[",
"1",
"]",
";",
"// Ensure buffer index is within array bounds.",
"if",
"(",
"buffers",
".",
"length",
">",
"bufferIndex",
")",
"{",
"WsByteBuffer",
"buffer",
"=",
"buffers",
"[",
"bufferIndex",
"]",
";",
"// Ensure the buffer is not null and the limit won't be set beyond the capacity",
"if",
"(",
"(",
"buffer",
"!=",
"null",
")",
"&&",
"(",
"buffer",
".",
"capacity",
"(",
")",
">=",
"bufferLimit",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"resetBuffersAfterJSSE: buffer [\"",
"+",
"bufferIndex",
"+",
"\"] from \"",
"+",
"buffer",
".",
"limit",
"(",
")",
"+",
"\" to \"",
"+",
"bufferLimit",
")",
";",
"}",
"// Make the adjustment.",
"buffer",
".",
"limit",
"(",
"bufferLimit",
")",
";",
"}",
"}",
"}"
] |
This method is called after a call is made to adjustBuffersForJSSE followed by a
call to wrap or unwrap in the JSSE. It restores the saved limit in the buffer
that was modified. A few extra checks are done here to prevent any problems during
odd code paths in the future.
@param buffers array of buffers containing the buffer whose limit should be reset.
@param limitInfo array of 2. The first entry is the index of the buffer whose limit
will be restored in the array. The second entry is the actual limit to be restored.
|
[
"This",
"method",
"is",
"called",
"after",
"a",
"call",
"is",
"made",
"to",
"adjustBuffersForJSSE",
"followed",
"by",
"a",
"call",
"to",
"wrap",
"or",
"unwrap",
"in",
"the",
"JSSE",
".",
"It",
"restores",
"the",
"saved",
"limit",
"in",
"the",
"buffer",
"that",
"was",
"modified",
".",
"A",
"few",
"extra",
"checks",
"are",
"done",
"here",
"to",
"prevent",
"any",
"problems",
"during",
"odd",
"code",
"paths",
"in",
"the",
"future",
"."
] |
train
|
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLUtils.java#L1341-L1362
|
netty/netty
|
common/src/main/java/io/netty/util/NetUtil.java
|
NetUtil.sysctlGetInt
|
private static Integer sysctlGetInt(String sysctlKey) throws IOException {
"""
This will execute <a href ="https://www.freebsd.org/cgi/man.cgi?sysctl(8)">sysctl</a> with the {@code sysctlKey}
which is expected to return the numeric value for for {@code sysctlKey}.
@param sysctlKey The key which the return value corresponds to.
@return The <a href ="https://www.freebsd.org/cgi/man.cgi?sysctl(8)">sysctl</a> value for {@code sysctlKey}.
"""
Process process = new ProcessBuilder("sysctl", sysctlKey).start();
try {
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
try {
String line = br.readLine();
if (line.startsWith(sysctlKey)) {
for (int i = line.length() - 1; i > sysctlKey.length(); --i) {
if (!Character.isDigit(line.charAt(i))) {
return Integer.valueOf(line.substring(i + 1, line.length()));
}
}
}
return null;
} finally {
br.close();
}
} finally {
if (process != null) {
process.destroy();
}
}
}
|
java
|
private static Integer sysctlGetInt(String sysctlKey) throws IOException {
Process process = new ProcessBuilder("sysctl", sysctlKey).start();
try {
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
try {
String line = br.readLine();
if (line.startsWith(sysctlKey)) {
for (int i = line.length() - 1; i > sysctlKey.length(); --i) {
if (!Character.isDigit(line.charAt(i))) {
return Integer.valueOf(line.substring(i + 1, line.length()));
}
}
}
return null;
} finally {
br.close();
}
} finally {
if (process != null) {
process.destroy();
}
}
}
|
[
"private",
"static",
"Integer",
"sysctlGetInt",
"(",
"String",
"sysctlKey",
")",
"throws",
"IOException",
"{",
"Process",
"process",
"=",
"new",
"ProcessBuilder",
"(",
"\"sysctl\"",
",",
"sysctlKey",
")",
".",
"start",
"(",
")",
";",
"try",
"{",
"InputStream",
"is",
"=",
"process",
".",
"getInputStream",
"(",
")",
";",
"InputStreamReader",
"isr",
"=",
"new",
"InputStreamReader",
"(",
"is",
")",
";",
"BufferedReader",
"br",
"=",
"new",
"BufferedReader",
"(",
"isr",
")",
";",
"try",
"{",
"String",
"line",
"=",
"br",
".",
"readLine",
"(",
")",
";",
"if",
"(",
"line",
".",
"startsWith",
"(",
"sysctlKey",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"line",
".",
"length",
"(",
")",
"-",
"1",
";",
"i",
">",
"sysctlKey",
".",
"length",
"(",
")",
";",
"--",
"i",
")",
"{",
"if",
"(",
"!",
"Character",
".",
"isDigit",
"(",
"line",
".",
"charAt",
"(",
"i",
")",
")",
")",
"{",
"return",
"Integer",
".",
"valueOf",
"(",
"line",
".",
"substring",
"(",
"i",
"+",
"1",
",",
"line",
".",
"length",
"(",
")",
")",
")",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"finally",
"{",
"br",
".",
"close",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"process",
"!=",
"null",
")",
"{",
"process",
".",
"destroy",
"(",
")",
";",
"}",
"}",
"}"
] |
This will execute <a href ="https://www.freebsd.org/cgi/man.cgi?sysctl(8)">sysctl</a> with the {@code sysctlKey}
which is expected to return the numeric value for for {@code sysctlKey}.
@param sysctlKey The key which the return value corresponds to.
@return The <a href ="https://www.freebsd.org/cgi/man.cgi?sysctl(8)">sysctl</a> value for {@code sysctlKey}.
|
[
"This",
"will",
"execute",
"<a",
"href",
"=",
"https",
":",
"//",
"www",
".",
"freebsd",
".",
"org",
"/",
"cgi",
"/",
"man",
".",
"cgi?sysctl",
"(",
"8",
")",
">",
"sysctl<",
"/",
"a",
">",
"with",
"the",
"{"
] |
train
|
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/NetUtil.java#L315-L339
|
OpenLiberty/open-liberty
|
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/priority/Tree.java
|
Tree.makeExclusiveDependency
|
public synchronized boolean makeExclusiveDependency(int depStreamID, int exclusiveParentStreamID) {
"""
Helper method to find the nodes given the stream IDs, and then call the method that does the real work.
@param depStreamID
@param exclusiveParentStreamID
@return the Node that was changed, null if the node or the parent node could not be found
"""
Node depNode = root.findNode(depStreamID);
Node exclusiveParentNode = root.findNode(exclusiveParentStreamID);
return makeExclusiveDependency(depNode, exclusiveParentNode);
}
|
java
|
public synchronized boolean makeExclusiveDependency(int depStreamID, int exclusiveParentStreamID) {
Node depNode = root.findNode(depStreamID);
Node exclusiveParentNode = root.findNode(exclusiveParentStreamID);
return makeExclusiveDependency(depNode, exclusiveParentNode);
}
|
[
"public",
"synchronized",
"boolean",
"makeExclusiveDependency",
"(",
"int",
"depStreamID",
",",
"int",
"exclusiveParentStreamID",
")",
"{",
"Node",
"depNode",
"=",
"root",
".",
"findNode",
"(",
"depStreamID",
")",
";",
"Node",
"exclusiveParentNode",
"=",
"root",
".",
"findNode",
"(",
"exclusiveParentStreamID",
")",
";",
"return",
"makeExclusiveDependency",
"(",
"depNode",
",",
"exclusiveParentNode",
")",
";",
"}"
] |
Helper method to find the nodes given the stream IDs, and then call the method that does the real work.
@param depStreamID
@param exclusiveParentStreamID
@return the Node that was changed, null if the node or the parent node could not be found
|
[
"Helper",
"method",
"to",
"find",
"the",
"nodes",
"given",
"the",
"stream",
"IDs",
"and",
"then",
"call",
"the",
"method",
"that",
"does",
"the",
"real",
"work",
"."
] |
train
|
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/priority/Tree.java#L271-L277
|
Impetus/Kundera
|
src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/query/RDBMSEntityReader.java
|
RDBMSEntityReader.isStringProperty
|
private boolean isStringProperty(EntityType entityType, Attribute attribute) {
"""
Checks if is string property.
@param m
the m
@param fieldName
the field name
@return true, if is string property
"""
String discriminatorColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn();
if (attribute.getName().equals(discriminatorColumn))
{
return true;
}
return attribute != null ? ((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(String.class)
|| ((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(Character.class)
|| ((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(char.class)
|| ((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(Date.class)
|| ((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(java.util.Date.class) : false;
}
|
java
|
private boolean isStringProperty(EntityType entityType, Attribute attribute)
{
String discriminatorColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn();
if (attribute.getName().equals(discriminatorColumn))
{
return true;
}
return attribute != null ? ((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(String.class)
|| ((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(Character.class)
|| ((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(char.class)
|| ((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(Date.class)
|| ((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(java.util.Date.class) : false;
}
|
[
"private",
"boolean",
"isStringProperty",
"(",
"EntityType",
"entityType",
",",
"Attribute",
"attribute",
")",
"{",
"String",
"discriminatorColumn",
"=",
"(",
"(",
"AbstractManagedType",
")",
"entityType",
")",
".",
"getDiscriminatorColumn",
"(",
")",
";",
"if",
"(",
"attribute",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"discriminatorColumn",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"attribute",
"!=",
"null",
"?",
"(",
"(",
"AbstractAttribute",
")",
"attribute",
")",
".",
"getBindableJavaType",
"(",
")",
".",
"isAssignableFrom",
"(",
"String",
".",
"class",
")",
"||",
"(",
"(",
"AbstractAttribute",
")",
"attribute",
")",
".",
"getBindableJavaType",
"(",
")",
".",
"isAssignableFrom",
"(",
"Character",
".",
"class",
")",
"||",
"(",
"(",
"AbstractAttribute",
")",
"attribute",
")",
".",
"getBindableJavaType",
"(",
")",
".",
"isAssignableFrom",
"(",
"char",
".",
"class",
")",
"||",
"(",
"(",
"AbstractAttribute",
")",
"attribute",
")",
".",
"getBindableJavaType",
"(",
")",
".",
"isAssignableFrom",
"(",
"Date",
".",
"class",
")",
"||",
"(",
"(",
"AbstractAttribute",
")",
"attribute",
")",
".",
"getBindableJavaType",
"(",
")",
".",
"isAssignableFrom",
"(",
"java",
".",
"util",
".",
"Date",
".",
"class",
")",
":",
"false",
";",
"}"
] |
Checks if is string property.
@param m
the m
@param fieldName
the field name
@return true, if is string property
|
[
"Checks",
"if",
"is",
"string",
"property",
"."
] |
train
|
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/query/RDBMSEntityReader.java#L605-L619
|
vanilladb/vanillacore
|
src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java
|
LockTable.sLock
|
void sLock(Object obj, long txNum) {
"""
Grants an slock on the specified item. If any conflict lock exists when
the method is called, then the calling thread will be placed on a wait
list until the lock is released. If the thread remains on the wait list
for a certain amount of time, then an exception is thrown.
@param obj
a lockable item
@param txNum
a transaction number
"""
Object anchor = getAnchor(obj);
txWaitMap.put(txNum, anchor);
synchronized (anchor) {
Lockers lks = prepareLockers(obj);
if (hasSLock(lks, txNum))
return;
try {
long timestamp = System.currentTimeMillis();
while (!sLockable(lks, txNum) && !waitingTooLong(timestamp)) {
avoidDeadlock(lks, txNum, S_LOCK);
lks.requestSet.add(txNum);
anchor.wait(MAX_TIME);
lks.requestSet.remove(txNum);
}
if (!sLockable(lks, txNum))
throw new LockAbortException();
lks.sLockers.add(txNum);
getObjectSet(txNum).add(obj);
} catch (InterruptedException e) {
throw new LockAbortException("abort tx." + txNum + " by interrupted");
}
}
txWaitMap.remove(txNum);
}
|
java
|
void sLock(Object obj, long txNum) {
Object anchor = getAnchor(obj);
txWaitMap.put(txNum, anchor);
synchronized (anchor) {
Lockers lks = prepareLockers(obj);
if (hasSLock(lks, txNum))
return;
try {
long timestamp = System.currentTimeMillis();
while (!sLockable(lks, txNum) && !waitingTooLong(timestamp)) {
avoidDeadlock(lks, txNum, S_LOCK);
lks.requestSet.add(txNum);
anchor.wait(MAX_TIME);
lks.requestSet.remove(txNum);
}
if (!sLockable(lks, txNum))
throw new LockAbortException();
lks.sLockers.add(txNum);
getObjectSet(txNum).add(obj);
} catch (InterruptedException e) {
throw new LockAbortException("abort tx." + txNum + " by interrupted");
}
}
txWaitMap.remove(txNum);
}
|
[
"void",
"sLock",
"(",
"Object",
"obj",
",",
"long",
"txNum",
")",
"{",
"Object",
"anchor",
"=",
"getAnchor",
"(",
"obj",
")",
";",
"txWaitMap",
".",
"put",
"(",
"txNum",
",",
"anchor",
")",
";",
"synchronized",
"(",
"anchor",
")",
"{",
"Lockers",
"lks",
"=",
"prepareLockers",
"(",
"obj",
")",
";",
"if",
"(",
"hasSLock",
"(",
"lks",
",",
"txNum",
")",
")",
"return",
";",
"try",
"{",
"long",
"timestamp",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"while",
"(",
"!",
"sLockable",
"(",
"lks",
",",
"txNum",
")",
"&&",
"!",
"waitingTooLong",
"(",
"timestamp",
")",
")",
"{",
"avoidDeadlock",
"(",
"lks",
",",
"txNum",
",",
"S_LOCK",
")",
";",
"lks",
".",
"requestSet",
".",
"add",
"(",
"txNum",
")",
";",
"anchor",
".",
"wait",
"(",
"MAX_TIME",
")",
";",
"lks",
".",
"requestSet",
".",
"remove",
"(",
"txNum",
")",
";",
"}",
"if",
"(",
"!",
"sLockable",
"(",
"lks",
",",
"txNum",
")",
")",
"throw",
"new",
"LockAbortException",
"(",
")",
";",
"lks",
".",
"sLockers",
".",
"add",
"(",
"txNum",
")",
";",
"getObjectSet",
"(",
"txNum",
")",
".",
"add",
"(",
"obj",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"throw",
"new",
"LockAbortException",
"(",
"\"abort tx.\"",
"+",
"txNum",
"+",
"\" by interrupted\"",
")",
";",
"}",
"}",
"txWaitMap",
".",
"remove",
"(",
"txNum",
")",
";",
"}"
] |
Grants an slock on the specified item. If any conflict lock exists when
the method is called, then the calling thread will be placed on a wait
list until the lock is released. If the thread remains on the wait list
for a certain amount of time, then an exception is thrown.
@param obj
a lockable item
@param txNum
a transaction number
|
[
"Grants",
"an",
"slock",
"on",
"the",
"specified",
"item",
".",
"If",
"any",
"conflict",
"lock",
"exists",
"when",
"the",
"method",
"is",
"called",
"then",
"the",
"calling",
"thread",
"will",
"be",
"placed",
"on",
"a",
"wait",
"list",
"until",
"the",
"lock",
"is",
"released",
".",
"If",
"the",
"thread",
"remains",
"on",
"the",
"wait",
"list",
"for",
"a",
"certain",
"amount",
"of",
"time",
"then",
"an",
"exception",
"is",
"thrown",
"."
] |
train
|
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java#L186-L213
|
thelinmichael/spotify-web-api-java
|
src/main/java/com/wrapper/spotify/SpotifyApi.java
|
SpotifyApi.getArtistsTopTracks
|
public GetArtistsTopTracksRequest.Builder getArtistsTopTracks(String id, CountryCode country) {
"""
Get the top tracks of an artist in a specific country.
@param id The Spotify ID of the artist.
@param country The ISO 3166-1 alpha-2 country code of the specific country.
@return A {@link GetArtistsTopTracksRequest.Builder}.
@see <a href="https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids">Spotify: URLs & IDs</a>
@see <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">Wikipedia: ISO 3166-1 alpha-2 country codes </a>
"""
return new GetArtistsTopTracksRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.id(id)
.country(country);
}
|
java
|
public GetArtistsTopTracksRequest.Builder getArtistsTopTracks(String id, CountryCode country) {
return new GetArtistsTopTracksRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.id(id)
.country(country);
}
|
[
"public",
"GetArtistsTopTracksRequest",
".",
"Builder",
"getArtistsTopTracks",
"(",
"String",
"id",
",",
"CountryCode",
"country",
")",
"{",
"return",
"new",
"GetArtistsTopTracksRequest",
".",
"Builder",
"(",
"accessToken",
")",
".",
"setDefaults",
"(",
"httpManager",
",",
"scheme",
",",
"host",
",",
"port",
")",
".",
"id",
"(",
"id",
")",
".",
"country",
"(",
"country",
")",
";",
"}"
] |
Get the top tracks of an artist in a specific country.
@param id The Spotify ID of the artist.
@param country The ISO 3166-1 alpha-2 country code of the specific country.
@return A {@link GetArtistsTopTracksRequest.Builder}.
@see <a href="https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids">Spotify: URLs & IDs</a>
@see <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">Wikipedia: ISO 3166-1 alpha-2 country codes </a>
|
[
"Get",
"the",
"top",
"tracks",
"of",
"an",
"artist",
"in",
"a",
"specific",
"country",
"."
] |
train
|
https://github.com/thelinmichael/spotify-web-api-java/blob/c06b8512344c0310d0c1df362fa267879021da2e/src/main/java/com/wrapper/spotify/SpotifyApi.java#L495-L500
|
apache/reef
|
lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java
|
HDInsightInstance.killApplication
|
public void killApplication(final String applicationId) throws IOException {
"""
Issues a YARN kill command to the application.
@param applicationId
"""
final String url = this.getApplicationURL(applicationId) + "/state";
final HttpPut put = preparePut(url);
put.setEntity(new StringEntity(APPLICATION_KILL_MESSAGE, ContentType.APPLICATION_JSON));
this.httpClient.execute(put, this.httpClientContext);
}
|
java
|
public void killApplication(final String applicationId) throws IOException {
final String url = this.getApplicationURL(applicationId) + "/state";
final HttpPut put = preparePut(url);
put.setEntity(new StringEntity(APPLICATION_KILL_MESSAGE, ContentType.APPLICATION_JSON));
this.httpClient.execute(put, this.httpClientContext);
}
|
[
"public",
"void",
"killApplication",
"(",
"final",
"String",
"applicationId",
")",
"throws",
"IOException",
"{",
"final",
"String",
"url",
"=",
"this",
".",
"getApplicationURL",
"(",
"applicationId",
")",
"+",
"\"/state\"",
";",
"final",
"HttpPut",
"put",
"=",
"preparePut",
"(",
"url",
")",
";",
"put",
".",
"setEntity",
"(",
"new",
"StringEntity",
"(",
"APPLICATION_KILL_MESSAGE",
",",
"ContentType",
".",
"APPLICATION_JSON",
")",
")",
";",
"this",
".",
"httpClient",
".",
"execute",
"(",
"put",
",",
"this",
".",
"httpClientContext",
")",
";",
"}"
] |
Issues a YARN kill command to the application.
@param applicationId
|
[
"Issues",
"a",
"YARN",
"kill",
"command",
"to",
"the",
"application",
"."
] |
train
|
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java#L131-L136
|
Tristan971/EasyFXML
|
easyfxml/src/main/java/moe/tristan/easyfxml/util/Clipping.java
|
Clipping.getCircleClip
|
private static Circle getCircleClip(final double radius, final double centerX, final double centerY) {
"""
Builds a clip-ready {@link Circle} with a specific radius and specific center position.
@param radius The radius of this circle.
@param centerX The horizontal position for this circle's center
@param centerY The vertical position for this circle's center
@return A circle with the given radius and center position
"""
final Circle clip = new Circle(radius);
clip.setCenterX(centerX);
clip.setCenterY(centerY);
return clip;
}
|
java
|
private static Circle getCircleClip(final double radius, final double centerX, final double centerY) {
final Circle clip = new Circle(radius);
clip.setCenterX(centerX);
clip.setCenterY(centerY);
return clip;
}
|
[
"private",
"static",
"Circle",
"getCircleClip",
"(",
"final",
"double",
"radius",
",",
"final",
"double",
"centerX",
",",
"final",
"double",
"centerY",
")",
"{",
"final",
"Circle",
"clip",
"=",
"new",
"Circle",
"(",
"radius",
")",
";",
"clip",
".",
"setCenterX",
"(",
"centerX",
")",
";",
"clip",
".",
"setCenterY",
"(",
"centerY",
")",
";",
"return",
"clip",
";",
"}"
] |
Builds a clip-ready {@link Circle} with a specific radius and specific center position.
@param radius The radius of this circle.
@param centerX The horizontal position for this circle's center
@param centerY The vertical position for this circle's center
@return A circle with the given radius and center position
|
[
"Builds",
"a",
"clip",
"-",
"ready",
"{",
"@link",
"Circle",
"}",
"with",
"a",
"specific",
"radius",
"and",
"specific",
"center",
"position",
"."
] |
train
|
https://github.com/Tristan971/EasyFXML/blob/f82cad1d54e62903ca5e4a250279ad315b028aef/easyfxml/src/main/java/moe/tristan/easyfxml/util/Clipping.java#L58-L63
|
advantageous/boon
|
reflekt/src/main/java/io/advantageous/boon/core/Str.java
|
Str.sputl
|
public static CharBuf sputl(CharBuf buf, Object... messages) {
"""
Writes to a char buf. A char buf is like a StringBuilder.
@param buf char buf
@param messages messages
@return charbuf
"""
for (Object message : messages) {
if (message == null) {
buf.add("<NULL>");
} else if (message.getClass().isArray()) {
buf.add(toListOrSingletonList(message).toString());
} else {
buf.add(message.toString());
}
buf.add('\n');
}
buf.add('\n');
return buf;
}
|
java
|
public static CharBuf sputl(CharBuf buf, Object... messages) {
for (Object message : messages) {
if (message == null) {
buf.add("<NULL>");
} else if (message.getClass().isArray()) {
buf.add(toListOrSingletonList(message).toString());
} else {
buf.add(message.toString());
}
buf.add('\n');
}
buf.add('\n');
return buf;
}
|
[
"public",
"static",
"CharBuf",
"sputl",
"(",
"CharBuf",
"buf",
",",
"Object",
"...",
"messages",
")",
"{",
"for",
"(",
"Object",
"message",
":",
"messages",
")",
"{",
"if",
"(",
"message",
"==",
"null",
")",
"{",
"buf",
".",
"add",
"(",
"\"<NULL>\"",
")",
";",
"}",
"else",
"if",
"(",
"message",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"buf",
".",
"add",
"(",
"toListOrSingletonList",
"(",
"message",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"{",
"buf",
".",
"add",
"(",
"message",
".",
"toString",
"(",
")",
")",
";",
"}",
"buf",
".",
"add",
"(",
"'",
"'",
")",
";",
"}",
"buf",
".",
"add",
"(",
"'",
"'",
")",
";",
"return",
"buf",
";",
"}"
] |
Writes to a char buf. A char buf is like a StringBuilder.
@param buf char buf
@param messages messages
@return charbuf
|
[
"Writes",
"to",
"a",
"char",
"buf",
".",
"A",
"char",
"buf",
"is",
"like",
"a",
"StringBuilder",
"."
] |
train
|
https://github.com/advantageous/boon/blob/12712d376761aa3b33223a9f1716720ddb67cb5e/reflekt/src/main/java/io/advantageous/boon/core/Str.java#L940-L957
|
VoltDB/voltdb
|
src/frontend/org/voltdb/iv2/MpScheduler.java
|
MpScheduler.safeAddToDuplicateCounterMap
|
void safeAddToDuplicateCounterMap(long dpKey, DuplicateCounter counter) {
"""
Just using "put" on the dup counter map is unsafe.
It won't detect the case where keys collide from two different transactions.
"""
DuplicateCounter existingDC = m_duplicateCounters.get(dpKey);
if (existingDC != null) {
// this is a collision and is bad
existingDC.logWithCollidingDuplicateCounters(counter);
VoltDB.crashGlobalVoltDB("DUPLICATE COUNTER MISMATCH: two duplicate counter keys collided.", true, null);
}
else {
m_duplicateCounters.put(dpKey, counter);
}
}
|
java
|
void safeAddToDuplicateCounterMap(long dpKey, DuplicateCounter counter) {
DuplicateCounter existingDC = m_duplicateCounters.get(dpKey);
if (existingDC != null) {
// this is a collision and is bad
existingDC.logWithCollidingDuplicateCounters(counter);
VoltDB.crashGlobalVoltDB("DUPLICATE COUNTER MISMATCH: two duplicate counter keys collided.", true, null);
}
else {
m_duplicateCounters.put(dpKey, counter);
}
}
|
[
"void",
"safeAddToDuplicateCounterMap",
"(",
"long",
"dpKey",
",",
"DuplicateCounter",
"counter",
")",
"{",
"DuplicateCounter",
"existingDC",
"=",
"m_duplicateCounters",
".",
"get",
"(",
"dpKey",
")",
";",
"if",
"(",
"existingDC",
"!=",
"null",
")",
"{",
"// this is a collision and is bad",
"existingDC",
".",
"logWithCollidingDuplicateCounters",
"(",
"counter",
")",
";",
"VoltDB",
".",
"crashGlobalVoltDB",
"(",
"\"DUPLICATE COUNTER MISMATCH: two duplicate counter keys collided.\"",
",",
"true",
",",
"null",
")",
";",
"}",
"else",
"{",
"m_duplicateCounters",
".",
"put",
"(",
"dpKey",
",",
"counter",
")",
";",
"}",
"}"
] |
Just using "put" on the dup counter map is unsafe.
It won't detect the case where keys collide from two different transactions.
|
[
"Just",
"using",
"put",
"on",
"the",
"dup",
"counter",
"map",
"is",
"unsafe",
".",
"It",
"won",
"t",
"detect",
"the",
"case",
"where",
"keys",
"collide",
"from",
"two",
"different",
"transactions",
"."
] |
train
|
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/MpScheduler.java#L641-L651
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/DefaultCommandManager.java
|
DefaultCommandManager.createCommandGroup
|
@Override
public CommandGroup createCommandGroup(String groupId, Object[] members, CommandConfigurer configurer) {
"""
Create a command group which holds all the given members.
@param groupId the id to configure the group.
@param members members to add to the group.
@param configurer the configurer to use.
@return a {@link CommandGroup} which contains all the members.
"""
return createCommandGroup(groupId, members, false, configurer);
}
|
java
|
@Override
public CommandGroup createCommandGroup(String groupId, Object[] members, CommandConfigurer configurer) {
return createCommandGroup(groupId, members, false, configurer);
}
|
[
"@",
"Override",
"public",
"CommandGroup",
"createCommandGroup",
"(",
"String",
"groupId",
",",
"Object",
"[",
"]",
"members",
",",
"CommandConfigurer",
"configurer",
")",
"{",
"return",
"createCommandGroup",
"(",
"groupId",
",",
"members",
",",
"false",
",",
"configurer",
")",
";",
"}"
] |
Create a command group which holds all the given members.
@param groupId the id to configure the group.
@param members members to add to the group.
@param configurer the configurer to use.
@return a {@link CommandGroup} which contains all the members.
|
[
"Create",
"a",
"command",
"group",
"which",
"holds",
"all",
"the",
"given",
"members",
"."
] |
train
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/DefaultCommandManager.java#L317-L320
|
albfernandez/itext2
|
src/main/java/com/lowagie/text/pdf/PdfContentByte.java
|
PdfContentByte.setLineDash
|
public void setLineDash(float unitsOn, float phase) {
"""
Changes the value of the <VAR>line dash pattern</VAR>.
<P>
The line dash pattern controls the pattern of dashes and gaps used to stroke paths.
It is specified by an <I>array</I> and a <I>phase</I>. The array specifies the length
of the alternating dashes and gaps. The phase specifies the distance into the dash
pattern to start the dash.<BR>
@param phase the value of the phase
@param unitsOn the number of units that must be 'on' (equals the number of units that must be 'off').
"""
content.append("[").append(unitsOn).append("] ").append(phase).append(" d").append_i(separator);
}
|
java
|
public void setLineDash(float unitsOn, float phase) {
content.append("[").append(unitsOn).append("] ").append(phase).append(" d").append_i(separator);
}
|
[
"public",
"void",
"setLineDash",
"(",
"float",
"unitsOn",
",",
"float",
"phase",
")",
"{",
"content",
".",
"append",
"(",
"\"[\"",
")",
".",
"append",
"(",
"unitsOn",
")",
".",
"append",
"(",
"\"] \"",
")",
".",
"append",
"(",
"phase",
")",
".",
"append",
"(",
"\" d\"",
")",
".",
"append_i",
"(",
"separator",
")",
";",
"}"
] |
Changes the value of the <VAR>line dash pattern</VAR>.
<P>
The line dash pattern controls the pattern of dashes and gaps used to stroke paths.
It is specified by an <I>array</I> and a <I>phase</I>. The array specifies the length
of the alternating dashes and gaps. The phase specifies the distance into the dash
pattern to start the dash.<BR>
@param phase the value of the phase
@param unitsOn the number of units that must be 'on' (equals the number of units that must be 'off').
|
[
"Changes",
"the",
"value",
"of",
"the",
"<VAR",
">",
"line",
"dash",
"pattern<",
"/",
"VAR",
">",
".",
"<P",
">",
"The",
"line",
"dash",
"pattern",
"controls",
"the",
"pattern",
"of",
"dashes",
"and",
"gaps",
"used",
"to",
"stroke",
"paths",
".",
"It",
"is",
"specified",
"by",
"an",
"<I",
">",
"array<",
"/",
"I",
">",
"and",
"a",
"<I",
">",
"phase<",
"/",
"I",
">",
".",
"The",
"array",
"specifies",
"the",
"length",
"of",
"the",
"alternating",
"dashes",
"and",
"gaps",
".",
"The",
"phase",
"specifies",
"the",
"distance",
"into",
"the",
"dash",
"pattern",
"to",
"start",
"the",
"dash",
".",
"<BR",
">"
] |
train
|
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L382-L384
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java
|
Properties.set
|
public <T> void set(PropertyListKey<T> property, List<T> value) {
"""
Associates the specified list with the specified property key. If the properties previously contained a mapping for the property key, the old
value is replaced by the specified list.
@param <T>
the type of elements in the list
@param property
the property key with which the specified list is to be associated
@param value
the list to be associated with the specified property key
"""
properties.put(property.getName(), value);
}
|
java
|
public <T> void set(PropertyListKey<T> property, List<T> value) {
properties.put(property.getName(), value);
}
|
[
"public",
"<",
"T",
">",
"void",
"set",
"(",
"PropertyListKey",
"<",
"T",
">",
"property",
",",
"List",
"<",
"T",
">",
"value",
")",
"{",
"properties",
".",
"put",
"(",
"property",
".",
"getName",
"(",
")",
",",
"value",
")",
";",
"}"
] |
Associates the specified list with the specified property key. If the properties previously contained a mapping for the property key, the old
value is replaced by the specified list.
@param <T>
the type of elements in the list
@param property
the property key with which the specified list is to be associated
@param value
the list to be associated with the specified property key
|
[
"Associates",
"the",
"specified",
"list",
"with",
"the",
"specified",
"property",
"key",
".",
"If",
"the",
"properties",
"previously",
"contained",
"a",
"mapping",
"for",
"the",
"property",
"key",
"the",
"old",
"value",
"is",
"replaced",
"by",
"the",
"specified",
"list",
"."
] |
train
|
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java#L127-L129
|
gmessner/gitlab4j-api
|
src/main/java/org/gitlab4j/api/GitLabApi.java
|
GitLabApi.oauth2Login
|
public static GitLabApi oauth2Login(ApiVersion apiVersion, String url, String username, CharSequence password,
String secretToken, Map<String, Object> clientConfigProperties, boolean ignoreCertificateErrors) throws GitLabApiException {
"""
<p>Logs into GitLab using OAuth2 with the provided {@code username} and {@code password},
and creates a new {@code GitLabApi} instance using returned access token.</p>
@param url GitLab URL
@param apiVersion the ApiVersion specifying which version of the API to use
@param username user name for which private token should be obtained
@param password password for a given {@code username}
@param secretToken use this token to validate received payloads
@param clientConfigProperties Map instance with additional properties for the Jersey client connection
@param ignoreCertificateErrors if true will set up the Jersey system ignore SSL certificate errors
@return new {@code GitLabApi} instance configured for a user-specific token
@throws GitLabApiException GitLabApiException if any exception occurs during execution
"""
if (username == null || username.trim().length() == 0) {
throw new IllegalArgumentException("both username and email cannot be empty or null");
}
GitLabApi gitLabApi = new GitLabApi(ApiVersion.OAUTH2_CLIENT, url, (String)null);
if (ignoreCertificateErrors) {
gitLabApi.setIgnoreCertificateErrors(true);
}
class Oauth2Api extends AbstractApi {
Oauth2Api(GitLabApi gitlabApi) {
super(gitlabApi);
}
}
try (Oauth2LoginStreamingOutput stream = new Oauth2LoginStreamingOutput(username, password)) {
Response response = new Oauth2Api(gitLabApi).post(Response.Status.OK, stream, MediaType.APPLICATION_JSON, "oauth", "token");
OauthTokenResponse oauthToken = response.readEntity(OauthTokenResponse.class);
gitLabApi = new GitLabApi(apiVersion, url, TokenType.OAUTH2_ACCESS, oauthToken.getAccessToken(), secretToken, clientConfigProperties);
if (ignoreCertificateErrors) {
gitLabApi.setIgnoreCertificateErrors(true);
}
return (gitLabApi);
}
}
|
java
|
public static GitLabApi oauth2Login(ApiVersion apiVersion, String url, String username, CharSequence password,
String secretToken, Map<String, Object> clientConfigProperties, boolean ignoreCertificateErrors) throws GitLabApiException {
if (username == null || username.trim().length() == 0) {
throw new IllegalArgumentException("both username and email cannot be empty or null");
}
GitLabApi gitLabApi = new GitLabApi(ApiVersion.OAUTH2_CLIENT, url, (String)null);
if (ignoreCertificateErrors) {
gitLabApi.setIgnoreCertificateErrors(true);
}
class Oauth2Api extends AbstractApi {
Oauth2Api(GitLabApi gitlabApi) {
super(gitlabApi);
}
}
try (Oauth2LoginStreamingOutput stream = new Oauth2LoginStreamingOutput(username, password)) {
Response response = new Oauth2Api(gitLabApi).post(Response.Status.OK, stream, MediaType.APPLICATION_JSON, "oauth", "token");
OauthTokenResponse oauthToken = response.readEntity(OauthTokenResponse.class);
gitLabApi = new GitLabApi(apiVersion, url, TokenType.OAUTH2_ACCESS, oauthToken.getAccessToken(), secretToken, clientConfigProperties);
if (ignoreCertificateErrors) {
gitLabApi.setIgnoreCertificateErrors(true);
}
return (gitLabApi);
}
}
|
[
"public",
"static",
"GitLabApi",
"oauth2Login",
"(",
"ApiVersion",
"apiVersion",
",",
"String",
"url",
",",
"String",
"username",
",",
"CharSequence",
"password",
",",
"String",
"secretToken",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"clientConfigProperties",
",",
"boolean",
"ignoreCertificateErrors",
")",
"throws",
"GitLabApiException",
"{",
"if",
"(",
"username",
"==",
"null",
"||",
"username",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"both username and email cannot be empty or null\"",
")",
";",
"}",
"GitLabApi",
"gitLabApi",
"=",
"new",
"GitLabApi",
"(",
"ApiVersion",
".",
"OAUTH2_CLIENT",
",",
"url",
",",
"(",
"String",
")",
"null",
")",
";",
"if",
"(",
"ignoreCertificateErrors",
")",
"{",
"gitLabApi",
".",
"setIgnoreCertificateErrors",
"(",
"true",
")",
";",
"}",
"class",
"Oauth2Api",
"extends",
"AbstractApi",
"{",
"Oauth2Api",
"(",
"GitLabApi",
"gitlabApi",
")",
"{",
"super",
"(",
"gitlabApi",
")",
";",
"}",
"}",
"try",
"(",
"Oauth2LoginStreamingOutput",
"stream",
"=",
"new",
"Oauth2LoginStreamingOutput",
"(",
"username",
",",
"password",
")",
")",
"{",
"Response",
"response",
"=",
"new",
"Oauth2Api",
"(",
"gitLabApi",
")",
".",
"post",
"(",
"Response",
".",
"Status",
".",
"OK",
",",
"stream",
",",
"MediaType",
".",
"APPLICATION_JSON",
",",
"\"oauth\"",
",",
"\"token\"",
")",
";",
"OauthTokenResponse",
"oauthToken",
"=",
"response",
".",
"readEntity",
"(",
"OauthTokenResponse",
".",
"class",
")",
";",
"gitLabApi",
"=",
"new",
"GitLabApi",
"(",
"apiVersion",
",",
"url",
",",
"TokenType",
".",
"OAUTH2_ACCESS",
",",
"oauthToken",
".",
"getAccessToken",
"(",
")",
",",
"secretToken",
",",
"clientConfigProperties",
")",
";",
"if",
"(",
"ignoreCertificateErrors",
")",
"{",
"gitLabApi",
".",
"setIgnoreCertificateErrors",
"(",
"true",
")",
";",
"}",
"return",
"(",
"gitLabApi",
")",
";",
"}",
"}"
] |
<p>Logs into GitLab using OAuth2 with the provided {@code username} and {@code password},
and creates a new {@code GitLabApi} instance using returned access token.</p>
@param url GitLab URL
@param apiVersion the ApiVersion specifying which version of the API to use
@param username user name for which private token should be obtained
@param password password for a given {@code username}
@param secretToken use this token to validate received payloads
@param clientConfigProperties Map instance with additional properties for the Jersey client connection
@param ignoreCertificateErrors if true will set up the Jersey system ignore SSL certificate errors
@return new {@code GitLabApi} instance configured for a user-specific token
@throws GitLabApiException GitLabApiException if any exception occurs during execution
|
[
"<p",
">",
"Logs",
"into",
"GitLab",
"using",
"OAuth2",
"with",
"the",
"provided",
"{",
"@code",
"username",
"}",
"and",
"{",
"@code",
"password",
"}",
"and",
"creates",
"a",
"new",
"{",
"@code",
"GitLabApi",
"}",
"instance",
"using",
"returned",
"access",
"token",
".",
"<",
"/",
"p",
">"
] |
train
|
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GitLabApi.java#L260-L289
|
opencb/biodata
|
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/VariantNormalizer.java
|
VariantNormalizer.requireLeftAlignment
|
static boolean requireLeftAlignment(String reference, String alternate, VariantKeyFields keyFields) {
"""
Only requires left alignment if after trimming reference or alternate are empty and before trimming either
reference or alternate is empty or the bases from each of them are equal.
This excludes from left alignment all non pure indels: non blocked substitutions, MNVs, etc.
@param reference
@param alternate
@param keyFields
@return
"""
return (keyFields.getReference().isEmpty() || keyFields.getAlternate().isEmpty())
&& requireLeftAlignment(reference, alternate);
}
|
java
|
static boolean requireLeftAlignment(String reference, String alternate, VariantKeyFields keyFields) {
return (keyFields.getReference().isEmpty() || keyFields.getAlternate().isEmpty())
&& requireLeftAlignment(reference, alternate);
}
|
[
"static",
"boolean",
"requireLeftAlignment",
"(",
"String",
"reference",
",",
"String",
"alternate",
",",
"VariantKeyFields",
"keyFields",
")",
"{",
"return",
"(",
"keyFields",
".",
"getReference",
"(",
")",
".",
"isEmpty",
"(",
")",
"||",
"keyFields",
".",
"getAlternate",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"&&",
"requireLeftAlignment",
"(",
"reference",
",",
"alternate",
")",
";",
"}"
] |
Only requires left alignment if after trimming reference or alternate are empty and before trimming either
reference or alternate is empty or the bases from each of them are equal.
This excludes from left alignment all non pure indels: non blocked substitutions, MNVs, etc.
@param reference
@param alternate
@param keyFields
@return
|
[
"Only",
"requires",
"left",
"alignment",
"if",
"after",
"trimming",
"reference",
"or",
"alternate",
"are",
"empty",
"and",
"before",
"trimming",
"either",
"reference",
"or",
"alternate",
"is",
"empty",
"or",
"the",
"bases",
"from",
"each",
"of",
"them",
"are",
"equal",
".",
"This",
"excludes",
"from",
"left",
"alignment",
"all",
"non",
"pure",
"indels",
":",
"non",
"blocked",
"substitutions",
"MNVs",
"etc",
"."
] |
train
|
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/VariantNormalizer.java#L755-L758
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.