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 |
|---|---|---|---|---|---|---|---|---|---|---|
codeprimate-software/cp-elements | src/main/java/org/cp/elements/net/NetworkUtils.java | NetworkUtils.availablePort | public static int availablePort() {
"""
Gets an available network port used by a network service on which to listen for client {@link Socket} connections.
@return in integer value indicating an available network port.
"""
ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket(0);
return serverSocket.getLocalPort();
}
catch (IOException cause) {
throw new NoAvailablePortException("No port available", cause);
}
finally {
close(serverSocket);
}
} | java | public static int availablePort() {
ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket(0);
return serverSocket.getLocalPort();
}
catch (IOException cause) {
throw new NoAvailablePortException("No port available", cause);
}
finally {
close(serverSocket);
}
} | [
"public",
"static",
"int",
"availablePort",
"(",
")",
"{",
"ServerSocket",
"serverSocket",
"=",
"null",
";",
"try",
"{",
"serverSocket",
"=",
"new",
"ServerSocket",
"(",
"0",
")",
";",
"return",
"serverSocket",
".",
"getLocalPort",
"(",
")",
";",
"}",
"cat... | Gets an available network port used by a network service on which to listen for client {@link Socket} connections.
@return in integer value indicating an available network port. | [
"Gets",
"an",
"available",
"network",
"port",
"used",
"by",
"a",
"network",
"service",
"on",
"which",
"to",
"listen",
"for",
"client",
"{",
"@link",
"Socket",
"}",
"connections",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/net/NetworkUtils.java#L49-L62 |
ACRA/acra | acra-core/src/main/java/org/acra/collector/SharedPreferencesCollector.java | SharedPreferencesCollector.filteredKey | private boolean filteredKey(@NonNull CoreConfiguration config, @NonNull String key) {
"""
Checks if the key matches one of the patterns provided by the developer
to exclude some preferences from reports.
@param key the name of the preference to be checked
@return true if the key has to be excluded from reports.
"""
for (String regex : config.excludeMatchingSharedPreferencesKeys()) {
if (key.matches(regex)) {
return true;
}
}
return false;
} | java | private boolean filteredKey(@NonNull CoreConfiguration config, @NonNull String key) {
for (String regex : config.excludeMatchingSharedPreferencesKeys()) {
if (key.matches(regex)) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"filteredKey",
"(",
"@",
"NonNull",
"CoreConfiguration",
"config",
",",
"@",
"NonNull",
"String",
"key",
")",
"{",
"for",
"(",
"String",
"regex",
":",
"config",
".",
"excludeMatchingSharedPreferencesKeys",
"(",
")",
")",
"{",
"if",
"(",
... | Checks if the key matches one of the patterns provided by the developer
to exclude some preferences from reports.
@param key the name of the preference to be checked
@return true if the key has to be excluded from reports. | [
"Checks",
"if",
"the",
"key",
"matches",
"one",
"of",
"the",
"patterns",
"provided",
"by",
"the",
"developer",
"to",
"exclude",
"some",
"preferences",
"from",
"reports",
"."
] | train | https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/acra-core/src/main/java/org/acra/collector/SharedPreferencesCollector.java#L117-L124 |
actorapp/actor-platform | actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java | Messenger.sendMessage | @ObjectiveCName("sendMessageWithPeer:withText:withMarkdownText:")
public void sendMessage(@NotNull Peer peer, @NotNull String text, @Nullable String markDownText) {
"""
Send Markdown Message
@param peer destination peer
@param text message text
@param markDownText message markdown text
"""
sendMessage(peer, text, markDownText, null, false);
} | java | @ObjectiveCName("sendMessageWithPeer:withText:withMarkdownText:")
public void sendMessage(@NotNull Peer peer, @NotNull String text, @Nullable String markDownText) {
sendMessage(peer, text, markDownText, null, false);
} | [
"@",
"ObjectiveCName",
"(",
"\"sendMessageWithPeer:withText:withMarkdownText:\"",
")",
"public",
"void",
"sendMessage",
"(",
"@",
"NotNull",
"Peer",
"peer",
",",
"@",
"NotNull",
"String",
"text",
",",
"@",
"Nullable",
"String",
"markDownText",
")",
"{",
"sendMessage... | Send Markdown Message
@param peer destination peer
@param text message text
@param markDownText message markdown text | [
"Send",
"Markdown",
"Message"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L794-L797 |
alkacon/opencms-core | src/org/opencms/ui/components/extensions/CmsGwtDialogExtension.java | CmsGwtDialogExtension.showPreview | public void showPreview(CmsUUID id, Integer version, OfflineOnline offlineOnline) {
"""
Shows the prewview dialog for a given resource and version.<p>
@param id the structure id of the resource
@param version the version
@param offlineOnline indicates whether we want the offlne or online version
"""
getRpcProxy(I_CmsGwtDialogClientRpc.class).showPreview("" + id, version + ":" + offlineOnline);
} | java | public void showPreview(CmsUUID id, Integer version, OfflineOnline offlineOnline) {
getRpcProxy(I_CmsGwtDialogClientRpc.class).showPreview("" + id, version + ":" + offlineOnline);
} | [
"public",
"void",
"showPreview",
"(",
"CmsUUID",
"id",
",",
"Integer",
"version",
",",
"OfflineOnline",
"offlineOnline",
")",
"{",
"getRpcProxy",
"(",
"I_CmsGwtDialogClientRpc",
".",
"class",
")",
".",
"showPreview",
"(",
"\"\"",
"+",
"id",
",",
"version",
"+"... | Shows the prewview dialog for a given resource and version.<p>
@param id the structure id of the resource
@param version the version
@param offlineOnline indicates whether we want the offlne or online version | [
"Shows",
"the",
"prewview",
"dialog",
"for",
"a",
"given",
"resource",
"and",
"version",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/extensions/CmsGwtDialogExtension.java#L262-L265 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/NotEquals.java | NotEquals.operate | public XObject operate(XObject left, XObject right)
throws javax.xml.transform.TransformerException {
"""
Apply the operation to two operands, and return the result.
@param left non-null reference to the evaluated left operand.
@param right non-null reference to the evaluated right operand.
@return non-null reference to the XObject that represents the result of the operation.
@throws javax.xml.transform.TransformerException
"""
return (left.notEquals(right)) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
} | java | public XObject operate(XObject left, XObject right)
throws javax.xml.transform.TransformerException
{
return (left.notEquals(right)) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
} | [
"public",
"XObject",
"operate",
"(",
"XObject",
"left",
",",
"XObject",
"right",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"return",
"(",
"left",
".",
"notEquals",
"(",
"right",
")",
")",
"?",
"XBoolean",
".",
... | Apply the operation to two operands, and return the result.
@param left non-null reference to the evaluated left operand.
@param right non-null reference to the evaluated right operand.
@return non-null reference to the XObject that represents the result of the operation.
@throws javax.xml.transform.TransformerException | [
"Apply",
"the",
"operation",
"to",
"two",
"operands",
"and",
"return",
"the",
"result",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/NotEquals.java#L44-L48 |
alipay/sofa-rpc | extension-impl/remoting-http/src/main/java/com/alipay/sofa/rpc/server/http/HttpServerHandler.java | HttpServerHandler.handleHttp1Request | public void handleHttp1Request(SofaRequest request, ChannelHandlerContext ctx, boolean keepAlive) {
"""
Handle request from HTTP/1.1
@param request SofaRequest
@param ctx ChannelHandlerContext
@param keepAlive keepAlive
"""
Http1ServerTask task = new Http1ServerTask(this, request, ctx, keepAlive);
processingCount.incrementAndGet();
try {
task.run();
} catch (RejectedExecutionException e) {
processingCount.decrementAndGet();
throw e;
}
} | java | public void handleHttp1Request(SofaRequest request, ChannelHandlerContext ctx, boolean keepAlive) {
Http1ServerTask task = new Http1ServerTask(this, request, ctx, keepAlive);
processingCount.incrementAndGet();
try {
task.run();
} catch (RejectedExecutionException e) {
processingCount.decrementAndGet();
throw e;
}
} | [
"public",
"void",
"handleHttp1Request",
"(",
"SofaRequest",
"request",
",",
"ChannelHandlerContext",
"ctx",
",",
"boolean",
"keepAlive",
")",
"{",
"Http1ServerTask",
"task",
"=",
"new",
"Http1ServerTask",
"(",
"this",
",",
"request",
",",
"ctx",
",",
"keepAlive",
... | Handle request from HTTP/1.1
@param request SofaRequest
@param ctx ChannelHandlerContext
@param keepAlive keepAlive | [
"Handle",
"request",
"from",
"HTTP",
"/",
"1",
".",
"1"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-http/src/main/java/com/alipay/sofa/rpc/server/http/HttpServerHandler.java#L81-L92 |
groovy/groovy-core | src/main/org/codehaus/groovy/transform/ImmutableASTTransformation.java | ImmutableASTTransformation.checkImmutable | @SuppressWarnings("Unchecked")
public static Object checkImmutable(String className, String fieldName, Object field) {
"""
This method exists to be binary compatible with 1.7 - 1.8.6 compiled code.
"""
if (field == null || field instanceof Enum || inImmutableList(field.getClass().getName())) return field;
if (field instanceof Collection) return DefaultGroovyMethods.asImmutable((Collection) field);
if (field.getClass().getAnnotation(MY_CLASS) != null) return field;
final String typeName = field.getClass().getName();
throw new RuntimeException(createErrorMessage(className, fieldName, typeName, "constructing"));
} | java | @SuppressWarnings("Unchecked")
public static Object checkImmutable(String className, String fieldName, Object field) {
if (field == null || field instanceof Enum || inImmutableList(field.getClass().getName())) return field;
if (field instanceof Collection) return DefaultGroovyMethods.asImmutable((Collection) field);
if (field.getClass().getAnnotation(MY_CLASS) != null) return field;
final String typeName = field.getClass().getName();
throw new RuntimeException(createErrorMessage(className, fieldName, typeName, "constructing"));
} | [
"@",
"SuppressWarnings",
"(",
"\"Unchecked\"",
")",
"public",
"static",
"Object",
"checkImmutable",
"(",
"String",
"className",
",",
"String",
"fieldName",
",",
"Object",
"field",
")",
"{",
"if",
"(",
"field",
"==",
"null",
"||",
"field",
"instanceof",
"Enum",... | This method exists to be binary compatible with 1.7 - 1.8.6 compiled code. | [
"This",
"method",
"exists",
"to",
"be",
"binary",
"compatible",
"with",
"1",
".",
"7",
"-",
"1",
".",
"8",
".",
"6",
"compiled",
"code",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/ImmutableASTTransformation.java#L725-L732 |
apptik/JustJson | json-core/src/main/java/io/apptik/json/JsonObject.java | JsonObject.optBoolean | public Boolean optBoolean(String name, Boolean fallback) {
"""
Returns the value mapped by {@code name} if it exists and is a boolean
or {@code fallback} otherwise.
"""
return optBoolean(name, fallback, true);
} | java | public Boolean optBoolean(String name, Boolean fallback) {
return optBoolean(name, fallback, true);
} | [
"public",
"Boolean",
"optBoolean",
"(",
"String",
"name",
",",
"Boolean",
"fallback",
")",
"{",
"return",
"optBoolean",
"(",
"name",
",",
"fallback",
",",
"true",
")",
";",
"}"
] | Returns the value mapped by {@code name} if it exists and is a boolean
or {@code fallback} otherwise. | [
"Returns",
"the",
"value",
"mapped",
"by",
"{"
] | train | https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-core/src/main/java/io/apptik/json/JsonObject.java#L395-L397 |
EdwardRaff/JSAT | JSAT/src/jsat/utils/concurrent/AtomicDoubleArray.java | AtomicDoubleArray.getAndAdd | public double getAndAdd(int i, double delta) {
"""
Atomically adds the given value to the element at index {@code i}.
@param i the index
@param delta the value to add
@return the previous value
"""
while(true)
{
double orig = get(i);
double newVal = orig + delta;
if(compareAndSet(i, orig, newVal))
return orig;
}
} | java | public double getAndAdd(int i, double delta)
{
while(true)
{
double orig = get(i);
double newVal = orig + delta;
if(compareAndSet(i, orig, newVal))
return orig;
}
} | [
"public",
"double",
"getAndAdd",
"(",
"int",
"i",
",",
"double",
"delta",
")",
"{",
"while",
"(",
"true",
")",
"{",
"double",
"orig",
"=",
"get",
"(",
"i",
")",
";",
"double",
"newVal",
"=",
"orig",
"+",
"delta",
";",
"if",
"(",
"compareAndSet",
"(... | Atomically adds the given value to the element at index {@code i}.
@param i the index
@param delta the value to add
@return the previous value | [
"Atomically",
"adds",
"the",
"given",
"value",
"to",
"the",
"element",
"at",
"index",
"{",
"@code",
"i",
"}",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/concurrent/AtomicDoubleArray.java#L76-L85 |
Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java | AipImageSearch.sameHqAddUrl | public JSONObject sameHqAddUrl(String url, HashMap<String, String> options) {
"""
相同图检索—入库接口
**该接口实现单张图片入库,入库时需要同步提交图片及可关联至本地图库的摘要信息(具体变量为brief,具体可传入图片在本地标记id、图片url、图片名称等);同时可提交分类维度信息(具体变量为tags,最多可传入2个tag),方便对图库中的图片进行管理、分类检索。****注:重复添加完全相同的图片会返回错误。**
@param url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效
@param options - 可选参数对象,key: value都为string类型
options - options列表:
brief 检索时原样带回,最长256B。
tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索
@return JSONObject
"""
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options);
}
request.setUri(ImageSearchConsts.SAME_HQ_ADD);
postOperation(request);
return requestServer(request);
} | java | public JSONObject sameHqAddUrl(String url, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options);
}
request.setUri(ImageSearchConsts.SAME_HQ_ADD);
postOperation(request);
return requestServer(request);
} | [
"public",
"JSONObject",
"sameHqAddUrl",
"(",
"String",
"url",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"options",
")",
"{",
"AipRequest",
"request",
"=",
"new",
"AipRequest",
"(",
")",
";",
"preOperation",
"(",
"request",
")",
";",
"request",
"."... | 相同图检索—入库接口
**该接口实现单张图片入库,入库时需要同步提交图片及可关联至本地图库的摘要信息(具体变量为brief,具体可传入图片在本地标记id、图片url、图片名称等);同时可提交分类维度信息(具体变量为tags,最多可传入2个tag),方便对图库中的图片进行管理、分类检索。****注:重复添加完全相同的图片会返回错误。**
@param url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效
@param options - 可选参数对象,key: value都为string类型
options - options列表:
brief 检索时原样带回,最长256B。
tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索
@return JSONObject | [
"相同图检索—入库接口",
"**",
"该接口实现单张图片入库,入库时需要同步提交图片及可关联至本地图库的摘要信息(具体变量为brief,具体可传入图片在本地标记id、图片url、图片名称等);同时可提交分类维度信息(具体变量为tags,最多可传入2个tag),方便对图库中的图片进行管理、分类检索。",
"****",
"注:重复添加完全相同的图片会返回错误。",
"**"
] | train | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java#L89-L100 |
skyscreamer/JSONassert | src/main/java/org/skyscreamer/jsonassert/JSONAssert.java | JSONAssert.assertEquals | public static void assertEquals(String expectedStr, String actualStr, JSONCompareMode compareMode)
throws JSONException {
"""
Asserts that the JSONArray provided matches the expected string. If it isn't it throws an
{@link AssertionError}.
@param expectedStr Expected JSON string
@param actualStr String to compare
@param compareMode Specifies which comparison mode to use
@throws JSONException JSON parsing error
"""
assertEquals("", expectedStr, actualStr, compareMode);
} | java | public static void assertEquals(String expectedStr, String actualStr, JSONCompareMode compareMode)
throws JSONException {
assertEquals("", expectedStr, actualStr, compareMode);
} | [
"public",
"static",
"void",
"assertEquals",
"(",
"String",
"expectedStr",
",",
"String",
"actualStr",
",",
"JSONCompareMode",
"compareMode",
")",
"throws",
"JSONException",
"{",
"assertEquals",
"(",
"\"\"",
",",
"expectedStr",
",",
"actualStr",
",",
"compareMode",
... | Asserts that the JSONArray provided matches the expected string. If it isn't it throws an
{@link AssertionError}.
@param expectedStr Expected JSON string
@param actualStr String to compare
@param compareMode Specifies which comparison mode to use
@throws JSONException JSON parsing error | [
"Asserts",
"that",
"the",
"JSONArray",
"provided",
"matches",
"the",
"expected",
"string",
".",
"If",
"it",
"isn",
"t",
"it",
"throws",
"an",
"{",
"@link",
"AssertionError",
"}",
"."
] | train | https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONAssert.java#L392-L395 |
Waikato/moa | moa/src/main/java/moa/classifiers/rules/AbstractAMRules.java | AbstractAMRules.isAnomaly | private boolean isAnomaly(Instance instance, Rule rule) {
"""
Method to verify if the instance is an anomaly.
@param instance
@param rule
@return
"""
//AMRUles is equipped with anomaly detection. If on, compute the anomaly value.
boolean isAnomaly = false;
if (this.noAnomalyDetectionOption.isSet() == false){
if (rule.getInstancesSeen() >= this.anomalyNumInstThresholdOption.getValue()) {
isAnomaly = rule.isAnomaly(instance,
this.univariateAnomalyprobabilityThresholdOption.getValue(),
this.multivariateAnomalyProbabilityThresholdOption.getValue(),
this.anomalyNumInstThresholdOption.getValue());
}
}
return isAnomaly;
} | java | private boolean isAnomaly(Instance instance, Rule rule) {
//AMRUles is equipped with anomaly detection. If on, compute the anomaly value.
boolean isAnomaly = false;
if (this.noAnomalyDetectionOption.isSet() == false){
if (rule.getInstancesSeen() >= this.anomalyNumInstThresholdOption.getValue()) {
isAnomaly = rule.isAnomaly(instance,
this.univariateAnomalyprobabilityThresholdOption.getValue(),
this.multivariateAnomalyProbabilityThresholdOption.getValue(),
this.anomalyNumInstThresholdOption.getValue());
}
}
return isAnomaly;
} | [
"private",
"boolean",
"isAnomaly",
"(",
"Instance",
"instance",
",",
"Rule",
"rule",
")",
"{",
"//AMRUles is equipped with anomaly detection. If on, compute the anomaly value. \t\t\t",
"boolean",
"isAnomaly",
"=",
"false",
";",
"if",
"(",
"this",
".",
"noAnomalyDetectionOpt... | Method to verify if the instance is an anomaly.
@param instance
@param rule
@return | [
"Method",
"to",
"verify",
"if",
"the",
"instance",
"is",
"an",
"anomaly",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/AbstractAMRules.java#L266-L278 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscNodeConfigurationsInner.java | DscNodeConfigurationsInner.get | public DscNodeConfigurationInner get(String resourceGroupName, String automationAccountName, String nodeConfigurationName) {
"""
Retrieve the Dsc node configurations by node configuration.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param nodeConfigurationName The Dsc node configuration name.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DscNodeConfigurationInner object if successful.
"""
return getWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeConfigurationName).toBlocking().single().body();
} | java | public DscNodeConfigurationInner get(String resourceGroupName, String automationAccountName, String nodeConfigurationName) {
return getWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeConfigurationName).toBlocking().single().body();
} | [
"public",
"DscNodeConfigurationInner",
"get",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"nodeConfigurationName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccountName",
",",
... | Retrieve the Dsc node configurations by node configuration.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param nodeConfigurationName The Dsc node configuration name.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DscNodeConfigurationInner object if successful. | [
"Retrieve",
"the",
"Dsc",
"node",
"configurations",
"by",
"node",
"configuration",
"."
] | 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/DscNodeConfigurationsInner.java#L188-L190 |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/io/DataIO.java | DataIO.columnExist | public static boolean columnExist(CSTable table, String name) {
"""
Check if a column exist in table.
@param table the table to check
@param name the name of the column
@return
"""
for (int i = 1; i <= table.getColumnCount(); i++) {
if (table.getColumnName(i).startsWith(name)) {
return true;
}
}
return false;
} | java | public static boolean columnExist(CSTable table, String name) {
for (int i = 1; i <= table.getColumnCount(); i++) {
if (table.getColumnName(i).startsWith(name)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"columnExist",
"(",
"CSTable",
"table",
",",
"String",
"name",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<=",
"table",
".",
"getColumnCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"table",
".",
... | Check if a column exist in table.
@param table the table to check
@param name the name of the column
@return | [
"Check",
"if",
"a",
"column",
"exist",
"in",
"table",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/io/DataIO.java#L1237-L1244 |
hdecarne/java-default | src/main/java/de/carne/util/SystemProperties.java | SystemProperties.booleanValue | public static boolean booleanValue(String key, boolean defaultValue) {
"""
Gets a {@code boolean} system property value.
@param key the property key to retrieve.
@param defaultValue the default value to return in case the property is not defined.
@return the property value or the submitted default value if the property is not defined.
"""
String value = System.getProperty(key);
boolean booleanValue = defaultValue;
if (value != null) {
booleanValue = Boolean.parseBoolean(value);
}
return booleanValue;
} | java | public static boolean booleanValue(String key, boolean defaultValue) {
String value = System.getProperty(key);
boolean booleanValue = defaultValue;
if (value != null) {
booleanValue = Boolean.parseBoolean(value);
}
return booleanValue;
} | [
"public",
"static",
"boolean",
"booleanValue",
"(",
"String",
"key",
",",
"boolean",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"System",
".",
"getProperty",
"(",
"key",
")",
";",
"boolean",
"booleanValue",
"=",
"defaultValue",
";",
"if",
"(",
"value"... | Gets a {@code boolean} system property value.
@param key the property key to retrieve.
@param defaultValue the default value to return in case the property is not defined.
@return the property value or the submitted default value if the property is not defined. | [
"Gets",
"a",
"{",
"@code",
"boolean",
"}",
"system",
"property",
"value",
"."
] | train | https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/util/SystemProperties.java#L85-L93 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/core/ServerParams.java | ServerParams.updateMap | @SuppressWarnings("unchecked")
private void updateMap(Map<String, Object> parentMap, String paramName, Object paramValue) {
"""
Replace or add the given parameter name and value to the given map.
"""
Object currentValue = parentMap.get(paramName);
if (currentValue == null || !(currentValue instanceof Map)) {
if (paramValue instanceof Map) {
parentMap.put(paramName, paramValue);
} else {
parentMap.put(paramName, paramValue.toString());
}
} else {
Utils.require(paramValue instanceof Map,
"Parameter '%s' must be a map: %s", paramName, paramValue.toString());
Map<String, Object> currentMap = (Map<String, Object>)currentValue;
Map<String, Object> updateMap = (Map<String, Object>)paramValue;
for (String subParam : updateMap.keySet()) {
updateMap(currentMap, subParam, updateMap.get(subParam));
}
}
} | java | @SuppressWarnings("unchecked")
private void updateMap(Map<String, Object> parentMap, String paramName, Object paramValue) {
Object currentValue = parentMap.get(paramName);
if (currentValue == null || !(currentValue instanceof Map)) {
if (paramValue instanceof Map) {
parentMap.put(paramName, paramValue);
} else {
parentMap.put(paramName, paramValue.toString());
}
} else {
Utils.require(paramValue instanceof Map,
"Parameter '%s' must be a map: %s", paramName, paramValue.toString());
Map<String, Object> currentMap = (Map<String, Object>)currentValue;
Map<String, Object> updateMap = (Map<String, Object>)paramValue;
for (String subParam : updateMap.keySet()) {
updateMap(currentMap, subParam, updateMap.get(subParam));
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"updateMap",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"parentMap",
",",
"String",
"paramName",
",",
"Object",
"paramValue",
")",
"{",
"Object",
"currentValue",
"=",
"parentMap",
".",
... | Replace or add the given parameter name and value to the given map. | [
"Replace",
"or",
"add",
"the",
"given",
"parameter",
"name",
"and",
"value",
"to",
"the",
"given",
"map",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/core/ServerParams.java#L501-L519 |
graphql-java/graphql-java | src/main/java/graphql/language/NodeTraverser.java | NodeTraverser.depthFirst | public Object depthFirst(NodeVisitor nodeVisitor, Node root) {
"""
depthFirst traversal with a enter/leave phase.
@param nodeVisitor the visitor of the nodes
@param root the root node
@return the accumulation result of this traversal
"""
return depthFirst(nodeVisitor, Collections.singleton(root));
} | java | public Object depthFirst(NodeVisitor nodeVisitor, Node root) {
return depthFirst(nodeVisitor, Collections.singleton(root));
} | [
"public",
"Object",
"depthFirst",
"(",
"NodeVisitor",
"nodeVisitor",
",",
"Node",
"root",
")",
"{",
"return",
"depthFirst",
"(",
"nodeVisitor",
",",
"Collections",
".",
"singleton",
"(",
"root",
")",
")",
";",
"}"
] | depthFirst traversal with a enter/leave phase.
@param nodeVisitor the visitor of the nodes
@param root the root node
@return the accumulation result of this traversal | [
"depthFirst",
"traversal",
"with",
"a",
"enter",
"/",
"leave",
"phase",
"."
] | train | https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/language/NodeTraverser.java#L52-L54 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.setSymbolAndCode | private static DecimalFormatSymbols setSymbolAndCode(DecimalFormat numberFormat, String symbol, String code) {
"""
Set the currency symbol and international code of the underlying {@link
java.text.NumberFormat} object to the values of the last two arguments, respectively.
This method is invoked in the process of parsing, not formatting.
Only invoke this from code synchronized on value of the first argument, and don't
forget to put the symbols back otherwise equals(), hashCode() and immutability will
break.
"""
checkState(Thread.holdsLock(numberFormat));
DecimalFormatSymbols fs = numberFormat.getDecimalFormatSymbols();
DecimalFormatSymbols ante = (DecimalFormatSymbols)fs.clone();
fs.setInternationalCurrencySymbol(code);
fs.setCurrencySymbol(symbol);
numberFormat.setDecimalFormatSymbols(fs);
return ante;
} | java | private static DecimalFormatSymbols setSymbolAndCode(DecimalFormat numberFormat, String symbol, String code) {
checkState(Thread.holdsLock(numberFormat));
DecimalFormatSymbols fs = numberFormat.getDecimalFormatSymbols();
DecimalFormatSymbols ante = (DecimalFormatSymbols)fs.clone();
fs.setInternationalCurrencySymbol(code);
fs.setCurrencySymbol(symbol);
numberFormat.setDecimalFormatSymbols(fs);
return ante;
} | [
"private",
"static",
"DecimalFormatSymbols",
"setSymbolAndCode",
"(",
"DecimalFormat",
"numberFormat",
",",
"String",
"symbol",
",",
"String",
"code",
")",
"{",
"checkState",
"(",
"Thread",
".",
"holdsLock",
"(",
"numberFormat",
")",
")",
";",
"DecimalFormatSymbols"... | Set the currency symbol and international code of the underlying {@link
java.text.NumberFormat} object to the values of the last two arguments, respectively.
This method is invoked in the process of parsing, not formatting.
Only invoke this from code synchronized on value of the first argument, and don't
forget to put the symbols back otherwise equals(), hashCode() and immutability will
break. | [
"Set",
"the",
"currency",
"symbol",
"and",
"international",
"code",
"of",
"the",
"underlying",
"{",
"@link",
"java",
".",
"text",
".",
"NumberFormat",
"}",
"object",
"to",
"the",
"values",
"of",
"the",
"last",
"two",
"arguments",
"respectively",
".",
"This",... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L1364-L1372 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java | CommerceOrderItemPersistenceImpl.fetchByC_ERC | @Override
public CommerceOrderItem fetchByC_ERC(long companyId,
String externalReferenceCode) {
"""
Returns the commerce order item where companyId = ? and externalReferenceCode = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param companyId the company ID
@param externalReferenceCode the external reference code
@return the matching commerce order item, or <code>null</code> if a matching commerce order item could not be found
"""
return fetchByC_ERC(companyId, externalReferenceCode, true);
} | java | @Override
public CommerceOrderItem fetchByC_ERC(long companyId,
String externalReferenceCode) {
return fetchByC_ERC(companyId, externalReferenceCode, true);
} | [
"@",
"Override",
"public",
"CommerceOrderItem",
"fetchByC_ERC",
"(",
"long",
"companyId",
",",
"String",
"externalReferenceCode",
")",
"{",
"return",
"fetchByC_ERC",
"(",
"companyId",
",",
"externalReferenceCode",
",",
"true",
")",
";",
"}"
] | Returns the commerce order item where companyId = ? and externalReferenceCode = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param companyId the company ID
@param externalReferenceCode the external reference code
@return the matching commerce order item, or <code>null</code> if a matching commerce order item could not be found | [
"Returns",
"the",
"commerce",
"order",
"item",
"where",
"companyId",
"=",
"?",
";",
"and",
"externalReferenceCode",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"th... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java#L2804-L2808 |
groupon/odo | proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java | PathOverrideService.updatePathOrder | public void updatePathOrder(int profileId, int[] pathOrder) {
"""
Updates the path_order column in the table, loops though the pathOrder array, and changes the value to the loop
index+1 for the specified pathId
@param profileId ID of profile
@param pathOrder array containing new order of paths
"""
for (int i = 0; i < pathOrder.length; i++) {
EditService.updatePathTable(Constants.PATH_PROFILE_PATH_ORDER, (i + 1), pathOrder[i]);
}
} | java | public void updatePathOrder(int profileId, int[] pathOrder) {
for (int i = 0; i < pathOrder.length; i++) {
EditService.updatePathTable(Constants.PATH_PROFILE_PATH_ORDER, (i + 1), pathOrder[i]);
}
} | [
"public",
"void",
"updatePathOrder",
"(",
"int",
"profileId",
",",
"int",
"[",
"]",
"pathOrder",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pathOrder",
".",
"length",
";",
"i",
"++",
")",
"{",
"EditService",
".",
"updatePathTable",
"... | Updates the path_order column in the table, loops though the pathOrder array, and changes the value to the loop
index+1 for the specified pathId
@param profileId ID of profile
@param pathOrder array containing new order of paths | [
"Updates",
"the",
"path_order",
"column",
"in",
"the",
"table",
"loops",
"though",
"the",
"pathOrder",
"array",
"and",
"changes",
"the",
"value",
"to",
"the",
"loop",
"index",
"+",
"1",
"for",
"the",
"specified",
"pathId"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java#L902-L906 |
wkgcass/Style | src/main/java/net/cassite/style/IfBlock.java | IfBlock.ElseIf | @SuppressWarnings("unchecked")
public IfBlock<T, INIT> ElseIf(RFunc0<INIT> init, VFunc1<INIT> body) {
"""
define an ElseIf block.<br>
@param init lambda expression returns an object or boolean value,
init==null || init.equals(false) will be considered
<b>false</b> in traditional if expression. in other
cases, considered true
@param body takes in INIT value, and return null if init is
considered true
@return if body
"""
return ElseIf(init, (def<T>) $(body));
} | java | @SuppressWarnings("unchecked")
public IfBlock<T, INIT> ElseIf(RFunc0<INIT> init, VFunc1<INIT> body) {
return ElseIf(init, (def<T>) $(body));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"IfBlock",
"<",
"T",
",",
"INIT",
">",
"ElseIf",
"(",
"RFunc0",
"<",
"INIT",
">",
"init",
",",
"VFunc1",
"<",
"INIT",
">",
"body",
")",
"{",
"return",
"ElseIf",
"(",
"init",
",",
"(",
"def... | define an ElseIf block.<br>
@param init lambda expression returns an object or boolean value,
init==null || init.equals(false) will be considered
<b>false</b> in traditional if expression. in other
cases, considered true
@param body takes in INIT value, and return null if init is
considered true
@return if body | [
"define",
"an",
"ElseIf",
"block",
".",
"<br",
">"
] | train | https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/IfBlock.java#L192-L195 |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/buffer/MutableRoaringArray.java | MutableRoaringArray.appendCopiesUntil | protected void appendCopiesUntil(PointableRoaringArray highLowContainer, short stoppingKey) {
"""
Append copies of the values from another array, from the start
@param highLowContainer the other array
@param stoppingKey any equal or larger key in other array will terminate copying
"""
final int stopKey = toIntUnsigned(stoppingKey);
MappeableContainerPointer cp = highLowContainer.getContainerPointer();
while (cp.hasContainer()) {
if (toIntUnsigned(cp.key()) >= stopKey) {
break;
}
extendArray(1);
this.keys[this.size] = cp.key();
this.values[this.size] = cp.getContainer().clone();
this.size++;
cp.advance();
}
} | java | protected void appendCopiesUntil(PointableRoaringArray highLowContainer, short stoppingKey) {
final int stopKey = toIntUnsigned(stoppingKey);
MappeableContainerPointer cp = highLowContainer.getContainerPointer();
while (cp.hasContainer()) {
if (toIntUnsigned(cp.key()) >= stopKey) {
break;
}
extendArray(1);
this.keys[this.size] = cp.key();
this.values[this.size] = cp.getContainer().clone();
this.size++;
cp.advance();
}
} | [
"protected",
"void",
"appendCopiesUntil",
"(",
"PointableRoaringArray",
"highLowContainer",
",",
"short",
"stoppingKey",
")",
"{",
"final",
"int",
"stopKey",
"=",
"toIntUnsigned",
"(",
"stoppingKey",
")",
";",
"MappeableContainerPointer",
"cp",
"=",
"highLowContainer",
... | Append copies of the values from another array, from the start
@param highLowContainer the other array
@param stoppingKey any equal or larger key in other array will terminate copying | [
"Append",
"copies",
"of",
"the",
"values",
"from",
"another",
"array",
"from",
"the",
"start"
] | train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/buffer/MutableRoaringArray.java#L166-L179 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.datacenter_availabilities_GET | public ArrayList<OvhDatacenterAvailability> datacenter_availabilities_GET(String datacenters, Boolean excludeDatacenters, String memory, String planCode, String server, String storage) throws IOException {
"""
List the availability of dedicated server
REST: GET /dedicated/server/datacenter/availabilities
@param planCode [required] The plan code in which the hardware is involved
@param server [required] The name of the base hardware
@param memory [required] The name of the memory hardware part
@param storage [required] The name of the storage hardware part
@param datacenters [required] The names of datacenters separated by commas
@param excludeDatacenters [required] If true, all datacenters are returned except those listed in datacenters parameter
API beta
"""
String qPath = "/dedicated/server/datacenter/availabilities";
StringBuilder sb = path(qPath);
query(sb, "datacenters", datacenters);
query(sb, "excludeDatacenters", excludeDatacenters);
query(sb, "memory", memory);
query(sb, "planCode", planCode);
query(sb, "server", server);
query(sb, "storage", storage);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t15);
} | java | public ArrayList<OvhDatacenterAvailability> datacenter_availabilities_GET(String datacenters, Boolean excludeDatacenters, String memory, String planCode, String server, String storage) throws IOException {
String qPath = "/dedicated/server/datacenter/availabilities";
StringBuilder sb = path(qPath);
query(sb, "datacenters", datacenters);
query(sb, "excludeDatacenters", excludeDatacenters);
query(sb, "memory", memory);
query(sb, "planCode", planCode);
query(sb, "server", server);
query(sb, "storage", storage);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t15);
} | [
"public",
"ArrayList",
"<",
"OvhDatacenterAvailability",
">",
"datacenter_availabilities_GET",
"(",
"String",
"datacenters",
",",
"Boolean",
"excludeDatacenters",
",",
"String",
"memory",
",",
"String",
"planCode",
",",
"String",
"server",
",",
"String",
"storage",
")... | List the availability of dedicated server
REST: GET /dedicated/server/datacenter/availabilities
@param planCode [required] The plan code in which the hardware is involved
@param server [required] The name of the base hardware
@param memory [required] The name of the memory hardware part
@param storage [required] The name of the storage hardware part
@param datacenters [required] The names of datacenters separated by commas
@param excludeDatacenters [required] If true, all datacenters are returned except those listed in datacenters parameter
API beta | [
"List",
"the",
"availability",
"of",
"dedicated",
"server"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L2341-L2352 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.bucketSort | public static <T> void bucketSort(final T[] a, final int fromIndex, final int toIndex, final Comparator<? super T> cmp) {
"""
Note: All the objects with same value will be replaced with first element with the same value.
@param a
@param fromIndex
@param toIndex
@param cmp
"""
Array.bucketSort(a, fromIndex, toIndex, cmp);
} | java | public static <T> void bucketSort(final T[] a, final int fromIndex, final int toIndex, final Comparator<? super T> cmp) {
Array.bucketSort(a, fromIndex, toIndex, cmp);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"bucketSort",
"(",
"final",
"T",
"[",
"]",
"a",
",",
"final",
"int",
"fromIndex",
",",
"final",
"int",
"toIndex",
",",
"final",
"Comparator",
"<",
"?",
"super",
"T",
">",
"cmp",
")",
"{",
"Array",
".",
"bu... | Note: All the objects with same value will be replaced with first element with the same value.
@param a
@param fromIndex
@param toIndex
@param cmp | [
"Note",
":",
"All",
"the",
"objects",
"with",
"same",
"value",
"will",
"be",
"replaced",
"with",
"first",
"element",
"with",
"the",
"same",
"value",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L12024-L12026 |
loadcoder/chart-extensions | src/main/java/com/loadcoder/load/jfreechartfixes/XYLineAndShapeRendererExtention.java | XYLineAndShapeRendererExtention.drawFirstPassShape | @Override
protected void drawFirstPassShape(Graphics2D g2, int pass, int series, int item, Shape shape) {
"""
/*
Overriding this class since the color of the series needs to be set with getLinePaint
which makes it possible to set the color for the series in the series instance
"""
g2.setStroke(getItemStroke(series, item));
g2.setPaint(getLinePaint(series)); // this line is different from the original
g2.draw(shape);
} | java | @Override
protected void drawFirstPassShape(Graphics2D g2, int pass, int series, int item, Shape shape) {
g2.setStroke(getItemStroke(series, item));
g2.setPaint(getLinePaint(series)); // this line is different from the original
g2.draw(shape);
} | [
"@",
"Override",
"protected",
"void",
"drawFirstPassShape",
"(",
"Graphics2D",
"g2",
",",
"int",
"pass",
",",
"int",
"series",
",",
"int",
"item",
",",
"Shape",
"shape",
")",
"{",
"g2",
".",
"setStroke",
"(",
"getItemStroke",
"(",
"series",
",",
"item",
... | /*
Overriding this class since the color of the series needs to be set with getLinePaint
which makes it possible to set the color for the series in the series instance | [
"/",
"*",
"Overriding",
"this",
"class",
"since",
"the",
"color",
"of",
"the",
"series",
"needs",
"to",
"be",
"set",
"with",
"getLinePaint",
"which",
"makes",
"it",
"possible",
"to",
"set",
"the",
"color",
"for",
"the",
"series",
"in",
"the",
"series",
"... | train | https://github.com/loadcoder/chart-extensions/blob/ded73ad337d18072b3fd4b1b4e3b7a581567d76d/src/main/java/com/loadcoder/load/jfreechartfixes/XYLineAndShapeRendererExtention.java#L120-L125 |
dadoonet/fscrawler | framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java | FsCrawlerUtil.copyResourceFile | public static void copyResourceFile(String source, Path target) throws IOException {
"""
Copy a single resource file from the classpath or from a JAR.
@param target The target
@throws IOException If copying does not work
"""
InputStream resource = FsCrawlerUtil.class.getResourceAsStream(source);
FileUtils.copyInputStreamToFile(resource, target.toFile());
} | java | public static void copyResourceFile(String source, Path target) throws IOException {
InputStream resource = FsCrawlerUtil.class.getResourceAsStream(source);
FileUtils.copyInputStreamToFile(resource, target.toFile());
} | [
"public",
"static",
"void",
"copyResourceFile",
"(",
"String",
"source",
",",
"Path",
"target",
")",
"throws",
"IOException",
"{",
"InputStream",
"resource",
"=",
"FsCrawlerUtil",
".",
"class",
".",
"getResourceAsStream",
"(",
"source",
")",
";",
"FileUtils",
".... | Copy a single resource file from the classpath or from a JAR.
@param target The target
@throws IOException If copying does not work | [
"Copy",
"a",
"single",
"resource",
"file",
"from",
"the",
"classpath",
"or",
"from",
"a",
"JAR",
"."
] | train | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L460-L463 |
lucee/Lucee | core/src/main/java/lucee/runtime/jsr223/AbstractScriptEngine.java | AbstractScriptEngine.put | public void put(String key, Object value) {
"""
Sets the specified value with the specified key in the <code>ENGINE_SCOPE</code>
<code>Bindings</code> of the protected <code>context</code> field.
@param key The specified key.
@param value The specified value.
@throws NullPointerException if key is null.
@throws IllegalArgumentException if key is empty.
"""
Bindings nn = getBindings(ScriptContext.ENGINE_SCOPE);
if (nn != null) {
nn.put(key, value);
}
} | java | public void put(String key, Object value) {
Bindings nn = getBindings(ScriptContext.ENGINE_SCOPE);
if (nn != null) {
nn.put(key, value);
}
} | [
"public",
"void",
"put",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"Bindings",
"nn",
"=",
"getBindings",
"(",
"ScriptContext",
".",
"ENGINE_SCOPE",
")",
";",
"if",
"(",
"nn",
"!=",
"null",
")",
"{",
"nn",
".",
"put",
"(",
"key",
",",
... | Sets the specified value with the specified key in the <code>ENGINE_SCOPE</code>
<code>Bindings</code> of the protected <code>context</code> field.
@param key The specified key.
@param value The specified value.
@throws NullPointerException if key is null.
@throws IllegalArgumentException if key is empty. | [
"Sets",
"the",
"specified",
"value",
"with",
"the",
"specified",
"key",
"in",
"the",
"<code",
">",
"ENGINE_SCOPE<",
"/",
"code",
">",
"<code",
">",
"Bindings<",
"/",
"code",
">",
"of",
"the",
"protected",
"<code",
">",
"context<",
"/",
"code",
">",
"fiel... | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/jsr223/AbstractScriptEngine.java#L139-L146 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/RowReaderDefaultImpl.java | RowReaderDefaultImpl.buildOrRefreshObject | protected Object buildOrRefreshObject(Map row, ClassDescriptor targetClassDescriptor, Object targetObject) {
"""
Creates an object instance according to clb, and fills its fileds width data provided by row.
@param row A {@link Map} contain the Object/Row mapping for the object.
@param targetClassDescriptor If the "ojbConcreteClass" feature was used, the target
{@link org.apache.ojb.broker.metadata.ClassDescriptor} could differ from the descriptor
this class was associated - see {@link #selectClassDescriptor}.
@param targetObject If 'null' a new object instance is build, else fields of object will
be refreshed.
@throws PersistenceBrokerException if there ewas an error creating the new object
"""
Object result = targetObject;
FieldDescriptor fmd;
FieldDescriptor[] fields = targetClassDescriptor.getFieldDescriptor(true);
if(targetObject == null)
{
// 1. create new object instance if needed
result = ClassHelper.buildNewObjectInstance(targetClassDescriptor);
}
// 2. fill all scalar attributes of the new object
for (int i = 0; i < fields.length; i++)
{
fmd = fields[i];
fmd.getPersistentField().set(result, row.get(fmd.getColumnName()));
}
if(targetObject == null)
{
// 3. for new build objects, invoke the initialization method for the class if one is provided
Method initializationMethod = targetClassDescriptor.getInitializationMethod();
if (initializationMethod != null)
{
try
{
initializationMethod.invoke(result, NO_ARGS);
}
catch (Exception ex)
{
throw new PersistenceBrokerException("Unable to invoke initialization method:" + initializationMethod.getName() + " for class:" + m_cld.getClassOfObject(), ex);
}
}
}
return result;
} | java | protected Object buildOrRefreshObject(Map row, ClassDescriptor targetClassDescriptor, Object targetObject)
{
Object result = targetObject;
FieldDescriptor fmd;
FieldDescriptor[] fields = targetClassDescriptor.getFieldDescriptor(true);
if(targetObject == null)
{
// 1. create new object instance if needed
result = ClassHelper.buildNewObjectInstance(targetClassDescriptor);
}
// 2. fill all scalar attributes of the new object
for (int i = 0; i < fields.length; i++)
{
fmd = fields[i];
fmd.getPersistentField().set(result, row.get(fmd.getColumnName()));
}
if(targetObject == null)
{
// 3. for new build objects, invoke the initialization method for the class if one is provided
Method initializationMethod = targetClassDescriptor.getInitializationMethod();
if (initializationMethod != null)
{
try
{
initializationMethod.invoke(result, NO_ARGS);
}
catch (Exception ex)
{
throw new PersistenceBrokerException("Unable to invoke initialization method:" + initializationMethod.getName() + " for class:" + m_cld.getClassOfObject(), ex);
}
}
}
return result;
} | [
"protected",
"Object",
"buildOrRefreshObject",
"(",
"Map",
"row",
",",
"ClassDescriptor",
"targetClassDescriptor",
",",
"Object",
"targetObject",
")",
"{",
"Object",
"result",
"=",
"targetObject",
";",
"FieldDescriptor",
"fmd",
";",
"FieldDescriptor",
"[",
"]",
"fie... | Creates an object instance according to clb, and fills its fileds width data provided by row.
@param row A {@link Map} contain the Object/Row mapping for the object.
@param targetClassDescriptor If the "ojbConcreteClass" feature was used, the target
{@link org.apache.ojb.broker.metadata.ClassDescriptor} could differ from the descriptor
this class was associated - see {@link #selectClassDescriptor}.
@param targetObject If 'null' a new object instance is build, else fields of object will
be refreshed.
@throws PersistenceBrokerException if there ewas an error creating the new object | [
"Creates",
"an",
"object",
"instance",
"according",
"to",
"clb",
"and",
"fills",
"its",
"fileds",
"width",
"data",
"provided",
"by",
"row",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/RowReaderDefaultImpl.java#L108-L144 |
igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java | RTPBridge.getRTPBridge | @SuppressWarnings("deprecation")
public static RTPBridge getRTPBridge(XMPPConnection connection, String sessionID) throws NotConnectedException, InterruptedException {
"""
Get a new RTPBridge Candidate from the server.
If a error occurs or the server don't support RTPBridge Service, null is returned.
@param connection
@param sessionID
@return the new RTPBridge
@throws NotConnectedException
@throws InterruptedException
"""
if (!connection.isConnected()) {
return null;
}
RTPBridge rtpPacket = new RTPBridge(sessionID);
rtpPacket.setTo(RTPBridge.NAME + "." + connection.getXMPPServiceDomain());
StanzaCollector collector = connection.createStanzaCollectorAndSend(rtpPacket);
RTPBridge response = collector.nextResult();
// Cancel the collector.
collector.cancel();
return response;
} | java | @SuppressWarnings("deprecation")
public static RTPBridge getRTPBridge(XMPPConnection connection, String sessionID) throws NotConnectedException, InterruptedException {
if (!connection.isConnected()) {
return null;
}
RTPBridge rtpPacket = new RTPBridge(sessionID);
rtpPacket.setTo(RTPBridge.NAME + "." + connection.getXMPPServiceDomain());
StanzaCollector collector = connection.createStanzaCollectorAndSend(rtpPacket);
RTPBridge response = collector.nextResult();
// Cancel the collector.
collector.cancel();
return response;
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"static",
"RTPBridge",
"getRTPBridge",
"(",
"XMPPConnection",
"connection",
",",
"String",
"sessionID",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
"{",
"if",
"(",
"!",
"connectio... | Get a new RTPBridge Candidate from the server.
If a error occurs or the server don't support RTPBridge Service, null is returned.
@param connection
@param sessionID
@return the new RTPBridge
@throws NotConnectedException
@throws InterruptedException | [
"Get",
"a",
"new",
"RTPBridge",
"Candidate",
"from",
"the",
"server",
".",
"If",
"a",
"error",
"occurs",
"or",
"the",
"server",
"don",
"t",
"support",
"RTPBridge",
"Service",
"null",
"is",
"returned",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java#L399-L417 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/stax/WstxOutputFactory.java | WstxOutputFactory.createSW | protected XMLStreamWriter2 createSW(String enc, WriterConfig cfg, XmlWriter xw) {
"""
Called by {@link #createSW(OutputStream, Writer, String, boolean)} after all of the nessesary configuration
logic is complete.
"""
if (cfg.willSupportNamespaces()) {
if (cfg.automaticNamespacesEnabled()) {
return new RepairingNsStreamWriter(xw, enc, cfg);
}
return new SimpleNsStreamWriter(xw, enc, cfg);
}
return new NonNsStreamWriter(xw, enc, cfg);
} | java | protected XMLStreamWriter2 createSW(String enc, WriterConfig cfg, XmlWriter xw) {
if (cfg.willSupportNamespaces()) {
if (cfg.automaticNamespacesEnabled()) {
return new RepairingNsStreamWriter(xw, enc, cfg);
}
return new SimpleNsStreamWriter(xw, enc, cfg);
}
return new NonNsStreamWriter(xw, enc, cfg);
} | [
"protected",
"XMLStreamWriter2",
"createSW",
"(",
"String",
"enc",
",",
"WriterConfig",
"cfg",
",",
"XmlWriter",
"xw",
")",
"{",
"if",
"(",
"cfg",
".",
"willSupportNamespaces",
"(",
")",
")",
"{",
"if",
"(",
"cfg",
".",
"automaticNamespacesEnabled",
"(",
")"... | Called by {@link #createSW(OutputStream, Writer, String, boolean)} after all of the nessesary configuration
logic is complete. | [
"Called",
"by",
"{"
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/stax/WstxOutputFactory.java#L309-L317 |
passwordmaker/java-passwordmaker-lib | src/main/java/org/daveware/passwordmaker/Database.java | Database.findNearestRelative | public Account findNearestRelative(Account account) {
"""
Finds the nearest relative of this node.
<p>
The nearest relative is either the next sibling, previous sibling, or parent in the case
where it is an only child. If it is not found to be a member of this tree, null is returned.
If you pass in the root node, null is returned.
@param account The account to find the nearest relative of.
@return See description.
"""
// If it's root, there are no siblings
if (account.isRoot())
return null;
// If it has no parent, it's not in this tree
Account parent = findParent(account);
if (parent == null)
return null;
// It's an only child, return the parent
if (parent.getChildren().size() == 1)
return parent;
// If it doesn't have an index, it's also not in this tree (should not be possible, assume parent)
int index = parent.getChildren().indexOf(account);
if (index == -1)
return parent;
// If it's the last node, use the previous node
if (index == parent.getChildren().size() - 1)
return parent.getChildren().get(index - 1);
// Otherwise use the next node
return parent.getChildren().get(index + 1);
} | java | public Account findNearestRelative(Account account) {
// If it's root, there are no siblings
if (account.isRoot())
return null;
// If it has no parent, it's not in this tree
Account parent = findParent(account);
if (parent == null)
return null;
// It's an only child, return the parent
if (parent.getChildren().size() == 1)
return parent;
// If it doesn't have an index, it's also not in this tree (should not be possible, assume parent)
int index = parent.getChildren().indexOf(account);
if (index == -1)
return parent;
// If it's the last node, use the previous node
if (index == parent.getChildren().size() - 1)
return parent.getChildren().get(index - 1);
// Otherwise use the next node
return parent.getChildren().get(index + 1);
} | [
"public",
"Account",
"findNearestRelative",
"(",
"Account",
"account",
")",
"{",
"// If it's root, there are no siblings",
"if",
"(",
"account",
".",
"isRoot",
"(",
")",
")",
"return",
"null",
";",
"// If it has no parent, it's not in this tree",
"Account",
"parent",
"=... | Finds the nearest relative of this node.
<p>
The nearest relative is either the next sibling, previous sibling, or parent in the case
where it is an only child. If it is not found to be a member of this tree, null is returned.
If you pass in the root node, null is returned.
@param account The account to find the nearest relative of.
@return See description. | [
"Finds",
"the",
"nearest",
"relative",
"of",
"this",
"node",
".",
"<p",
">",
"The",
"nearest",
"relative",
"is",
"either",
"the",
"next",
"sibling",
"previous",
"sibling",
"or",
"parent",
"in",
"the",
"case",
"where",
"it",
"is",
"an",
"only",
"child",
"... | train | https://github.com/passwordmaker/java-passwordmaker-lib/blob/18c22fca7dd9a47f08161425b85a5bd257afbb2b/src/main/java/org/daveware/passwordmaker/Database.java#L471-L496 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/ReportResourcesImpl.java | ReportResourcesImpl.getReport | public Report getReport(long reportId, EnumSet<ReportInclusion> includes, Integer pageSize, Integer page) throws SmartsheetException {
"""
Get a report.
It mirrors to the following Smartsheet REST API method: GET /reports/{id}
Exceptions:
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ResourceNotFoundException : if the resource can not be found
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param reportId the folder id
@param includes the optional objects to include in response
@param pageSize Number of rows per page
@param page page number to return
@return the report (note that if there is no such resource, this method will throw ResourceNotFoundException
rather than returning null)
@throws SmartsheetException the smartsheet exception
"""
return this.getReport(reportId, includes, pageSize, page, null);
} | java | public Report getReport(long reportId, EnumSet<ReportInclusion> includes, Integer pageSize, Integer page) throws SmartsheetException{
return this.getReport(reportId, includes, pageSize, page, null);
} | [
"public",
"Report",
"getReport",
"(",
"long",
"reportId",
",",
"EnumSet",
"<",
"ReportInclusion",
">",
"includes",
",",
"Integer",
"pageSize",
",",
"Integer",
"page",
")",
"throws",
"SmartsheetException",
"{",
"return",
"this",
".",
"getReport",
"(",
"reportId",... | Get a report.
It mirrors to the following Smartsheet REST API method: GET /reports/{id}
Exceptions:
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ResourceNotFoundException : if the resource can not be found
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param reportId the folder id
@param includes the optional objects to include in response
@param pageSize Number of rows per page
@param page page number to return
@return the report (note that if there is no such resource, this method will throw ResourceNotFoundException
rather than returning null)
@throws SmartsheetException the smartsheet exception | [
"Get",
"a",
"report",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/ReportResourcesImpl.java#L97-L99 |
google/gwtmockito | gwtmockito/src/main/java/com/google/gwtmockito/GwtMockito.java | GwtMockito.useProviderForType | public static void useProviderForType(Class<?> type, FakeProvider<?> provider) {
"""
Specifies that the given provider should be used to GWT.create instances of
the given type and its subclasses. If multiple providers could produce a
given class (for example, if a provide is registered for a type and its
supertype), the provider for the more specific type is chosen. An exception
is thrown if this type is ambiguous. Note that if you just want to return a
Mockito mock from GWT.create, it's probably easier to use {@link GwtMock}
instead.
"""
if (bridge == null) {
throw new IllegalStateException("Must call initMocks() before calling useProviderForType()");
}
if (bridge.registeredMocks.containsKey(type)) {
throw new IllegalArgumentException(
"Can't use a provider for a type that already has a @GwtMock declared");
}
bridge.registeredProviders.put(type, provider);
} | java | public static void useProviderForType(Class<?> type, FakeProvider<?> provider) {
if (bridge == null) {
throw new IllegalStateException("Must call initMocks() before calling useProviderForType()");
}
if (bridge.registeredMocks.containsKey(type)) {
throw new IllegalArgumentException(
"Can't use a provider for a type that already has a @GwtMock declared");
}
bridge.registeredProviders.put(type, provider);
} | [
"public",
"static",
"void",
"useProviderForType",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"FakeProvider",
"<",
"?",
">",
"provider",
")",
"{",
"if",
"(",
"bridge",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Must call initMocks... | Specifies that the given provider should be used to GWT.create instances of
the given type and its subclasses. If multiple providers could produce a
given class (for example, if a provide is registered for a type and its
supertype), the provider for the more specific type is chosen. An exception
is thrown if this type is ambiguous. Note that if you just want to return a
Mockito mock from GWT.create, it's probably easier to use {@link GwtMock}
instead. | [
"Specifies",
"that",
"the",
"given",
"provider",
"should",
"be",
"used",
"to",
"GWT",
".",
"create",
"instances",
"of",
"the",
"given",
"type",
"and",
"its",
"subclasses",
".",
"If",
"multiple",
"providers",
"could",
"produce",
"a",
"given",
"class",
"(",
... | train | https://github.com/google/gwtmockito/blob/e886a9b9d290169b5f83582dd89b7545c5f198a2/gwtmockito/src/main/java/com/google/gwtmockito/GwtMockito.java#L162-L171 |
phax/ph-oton | ph-oton-bootstrap3/src/main/java/com/helger/photon/bootstrap3/ext/BootstrapSystemMessage.java | BootstrapSystemMessage.setDefaultFormatter | public static void setDefaultFormatter (@Nonnull final BiConsumer <String, BootstrapSystemMessage> aFormatter) {
"""
Set the default text formatter to be used. This can e.g. be used to easily
visualize Markdown syntax in the system message.
@param aFormatter
The formatter callback. May not be <code>null</code>.
"""
ValueEnforcer.notNull (aFormatter, "Formatter");
s_aRWLock.writeLocked ( () -> s_aFormatter = aFormatter);
} | java | public static void setDefaultFormatter (@Nonnull final BiConsumer <String, BootstrapSystemMessage> aFormatter)
{
ValueEnforcer.notNull (aFormatter, "Formatter");
s_aRWLock.writeLocked ( () -> s_aFormatter = aFormatter);
} | [
"public",
"static",
"void",
"setDefaultFormatter",
"(",
"@",
"Nonnull",
"final",
"BiConsumer",
"<",
"String",
",",
"BootstrapSystemMessage",
">",
"aFormatter",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aFormatter",
",",
"\"Formatter\"",
")",
";",
"s_aRWLock... | Set the default text formatter to be used. This can e.g. be used to easily
visualize Markdown syntax in the system message.
@param aFormatter
The formatter callback. May not be <code>null</code>. | [
"Set",
"the",
"default",
"text",
"formatter",
"to",
"be",
"used",
".",
"This",
"can",
"e",
".",
"g",
".",
"be",
"used",
"to",
"easily",
"visualize",
"Markdown",
"syntax",
"in",
"the",
"system",
"message",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-bootstrap3/src/main/java/com/helger/photon/bootstrap3/ext/BootstrapSystemMessage.java#L65-L69 |
JavaMoney/jsr354-api | src/main/java/javax/money/Monetary.java | Monetary.getRounding | public static MonetaryRounding getRounding(RoundingQuery roundingQuery) {
"""
Access a {@link MonetaryRounding} using a possibly complex query.
@param roundingQuery The {@link javax.money.RoundingQuery} that may contains arbitrary parameters to be
evaluated.
@return the corresponding {@link javax.money.MonetaryRounding}, never {@code null}.
@throws IllegalArgumentException if no such rounding is registered using a
{@link javax.money.spi.RoundingProviderSpi} instance.
"""
return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow(
() -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available."))
.getRounding(roundingQuery);
} | java | public static MonetaryRounding getRounding(RoundingQuery roundingQuery) {
return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow(
() -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available."))
.getRounding(roundingQuery);
} | [
"public",
"static",
"MonetaryRounding",
"getRounding",
"(",
"RoundingQuery",
"roundingQuery",
")",
"{",
"return",
"Optional",
".",
"ofNullable",
"(",
"monetaryRoundingsSingletonSpi",
"(",
")",
")",
".",
"orElseThrow",
"(",
"(",
")",
"->",
"new",
"MonetaryException",... | Access a {@link MonetaryRounding} using a possibly complex query.
@param roundingQuery The {@link javax.money.RoundingQuery} that may contains arbitrary parameters to be
evaluated.
@return the corresponding {@link javax.money.MonetaryRounding}, never {@code null}.
@throws IllegalArgumentException if no such rounding is registered using a
{@link javax.money.spi.RoundingProviderSpi} instance. | [
"Access",
"a",
"{",
"@link",
"MonetaryRounding",
"}",
"using",
"a",
"possibly",
"complex",
"query",
"."
] | train | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L186-L190 |
mapbox/mapbox-navigation-android | libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuverView.java | ManeuverView.setManeuverTypeAndModifier | public void setManeuverTypeAndModifier(@NonNull String maneuverType, @Nullable String maneuverModifier) {
"""
Updates the maneuver type and modifier which determine how this view will
render itself.
<p>
If determined the provided maneuver type and modifier will render a new image,
the view will invalidate and redraw itself with the new data.
@param maneuverType to determine the maneuver icon to render
@param maneuverModifier to determine the maneuver icon to render
"""
if (isNewTypeOrModifier(maneuverType, maneuverModifier)) {
this.maneuverType = maneuverType;
this.maneuverModifier = maneuverModifier;
if (checkManeuverTypeWithNullModifier(maneuverType)) {
return;
}
maneuverType = checkManeuverModifier(maneuverType, maneuverModifier);
maneuverTypeAndModifier = new Pair<>(maneuverType, maneuverModifier);
invalidate();
}
} | java | public void setManeuverTypeAndModifier(@NonNull String maneuverType, @Nullable String maneuverModifier) {
if (isNewTypeOrModifier(maneuverType, maneuverModifier)) {
this.maneuverType = maneuverType;
this.maneuverModifier = maneuverModifier;
if (checkManeuverTypeWithNullModifier(maneuverType)) {
return;
}
maneuverType = checkManeuverModifier(maneuverType, maneuverModifier);
maneuverTypeAndModifier = new Pair<>(maneuverType, maneuverModifier);
invalidate();
}
} | [
"public",
"void",
"setManeuverTypeAndModifier",
"(",
"@",
"NonNull",
"String",
"maneuverType",
",",
"@",
"Nullable",
"String",
"maneuverModifier",
")",
"{",
"if",
"(",
"isNewTypeOrModifier",
"(",
"maneuverType",
",",
"maneuverModifier",
")",
")",
"{",
"this",
".",... | Updates the maneuver type and modifier which determine how this view will
render itself.
<p>
If determined the provided maneuver type and modifier will render a new image,
the view will invalidate and redraw itself with the new data.
@param maneuverType to determine the maneuver icon to render
@param maneuverModifier to determine the maneuver icon to render | [
"Updates",
"the",
"maneuver",
"type",
"and",
"modifier",
"which",
"determine",
"how",
"this",
"view",
"will",
"render",
"itself",
".",
"<p",
">",
"If",
"determined",
"the",
"provided",
"maneuver",
"type",
"and",
"modifier",
"will",
"render",
"a",
"new",
"ima... | train | https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuverView.java#L142-L153 |
lucee/Lucee | core/src/main/java/lucee/runtime/converter/WDDXConverter.java | WDDXConverter._serializeArray | private String _serializeArray(Array array, Set<Object> done) throws ConverterException {
"""
serialize a Array
@param array Array to serialize
@param done
@return serialized array
@throws ConverterException
"""
return _serializeList(array.toList(), done);
} | java | private String _serializeArray(Array array, Set<Object> done) throws ConverterException {
return _serializeList(array.toList(), done);
} | [
"private",
"String",
"_serializeArray",
"(",
"Array",
"array",
",",
"Set",
"<",
"Object",
">",
"done",
")",
"throws",
"ConverterException",
"{",
"return",
"_serializeList",
"(",
"array",
".",
"toList",
"(",
")",
",",
"done",
")",
";",
"}"
] | serialize a Array
@param array Array to serialize
@param done
@return serialized array
@throws ConverterException | [
"serialize",
"a",
"Array"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/WDDXConverter.java#L177-L179 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/core/Config.java | Config.getString | public String getString(Key key, String defaultValue) {
"""
Retrieves a configuration value with the given key constant (e.g. Key.APPLICATION_NAME)
@param key The key of the configuration value (e.g. application.name)
@param defaultValue The default value to return of no key is found
@return The configured value as String or the passed defautlValue if the key is not configured
"""
return getString(key.toString(), defaultValue);
} | java | public String getString(Key key, String defaultValue) {
return getString(key.toString(), defaultValue);
} | [
"public",
"String",
"getString",
"(",
"Key",
"key",
",",
"String",
"defaultValue",
")",
"{",
"return",
"getString",
"(",
"key",
".",
"toString",
"(",
")",
",",
"defaultValue",
")",
";",
"}"
] | Retrieves a configuration value with the given key constant (e.g. Key.APPLICATION_NAME)
@param key The key of the configuration value (e.g. application.name)
@param defaultValue The default value to return of no key is found
@return The configured value as String or the passed defautlValue if the key is not configured | [
"Retrieves",
"a",
"configuration",
"value",
"with",
"the",
"given",
"key",
"constant",
"(",
"e",
".",
"g",
".",
"Key",
".",
"APPLICATION_NAME",
")"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/core/Config.java#L278-L280 |
seam/faces | impl/src/main/java/org/jboss/seam/faces/security/SecurityPhaseListener.java | SecurityPhaseListener.getRestrictAtViewMethod | public Method getRestrictAtViewMethod(Annotation annotation) {
"""
Utility method to extract the "restrictAtPhase" method from an annotation
@param annotation
@return restrictAtViewMethod if found, null otherwise
"""
Method restrictAtViewMethod;
try {
restrictAtViewMethod = annotation.annotationType().getDeclaredMethod("restrictAtPhase");
} catch (NoSuchMethodException ex) {
restrictAtViewMethod = null;
} catch (SecurityException ex) {
throw new IllegalArgumentException("restrictAtView method must be accessible", ex);
}
return restrictAtViewMethod;
} | java | public Method getRestrictAtViewMethod(Annotation annotation) {
Method restrictAtViewMethod;
try {
restrictAtViewMethod = annotation.annotationType().getDeclaredMethod("restrictAtPhase");
} catch (NoSuchMethodException ex) {
restrictAtViewMethod = null;
} catch (SecurityException ex) {
throw new IllegalArgumentException("restrictAtView method must be accessible", ex);
}
return restrictAtViewMethod;
} | [
"public",
"Method",
"getRestrictAtViewMethod",
"(",
"Annotation",
"annotation",
")",
"{",
"Method",
"restrictAtViewMethod",
";",
"try",
"{",
"restrictAtViewMethod",
"=",
"annotation",
".",
"annotationType",
"(",
")",
".",
"getDeclaredMethod",
"(",
"\"restrictAtPhase\"",... | Utility method to extract the "restrictAtPhase" method from an annotation
@param annotation
@return restrictAtViewMethod if found, null otherwise | [
"Utility",
"method",
"to",
"extract",
"the",
"restrictAtPhase",
"method",
"from",
"an",
"annotation"
] | train | https://github.com/seam/faces/blob/2fdedbc7070318c2c58bfffb8a26f1ea1d0ee1e3/impl/src/main/java/org/jboss/seam/faces/security/SecurityPhaseListener.java#L237-L247 |
andygibson/datafactory | src/main/java/org/fluttercode/datafactory/impl/DataFactory.java | DataFactory.getRandomWord | public String getRandomWord(final int length, final boolean exactLength) {
"""
Returns a valid word with a length of up to <code>length</code> characters. If the <code>exactLength</code>
parameter is set, then the word will be exactly <code>length</code> characters in length.
@param length maximum length of the returned string
@param exactLength indicates if the word should have a length of <code>length</code>
@return a string with a length that matches the specified parameters.
"""
if (exactLength) {
return getRandomWord(length, length);
}
return getRandomWord(0, length);
} | java | public String getRandomWord(final int length, final boolean exactLength) {
if (exactLength) {
return getRandomWord(length, length);
}
return getRandomWord(0, length);
} | [
"public",
"String",
"getRandomWord",
"(",
"final",
"int",
"length",
",",
"final",
"boolean",
"exactLength",
")",
"{",
"if",
"(",
"exactLength",
")",
"{",
"return",
"getRandomWord",
"(",
"length",
",",
"length",
")",
";",
"}",
"return",
"getRandomWord",
"(",
... | Returns a valid word with a length of up to <code>length</code> characters. If the <code>exactLength</code>
parameter is set, then the word will be exactly <code>length</code> characters in length.
@param length maximum length of the returned string
@param exactLength indicates if the word should have a length of <code>length</code>
@return a string with a length that matches the specified parameters. | [
"Returns",
"a",
"valid",
"word",
"with",
"a",
"length",
"of",
"up",
"to",
"<code",
">",
"length<",
"/",
"code",
">",
"characters",
".",
"If",
"the",
"<code",
">",
"exactLength<",
"/",
"code",
">",
"parameter",
"is",
"set",
"then",
"the",
"word",
"will"... | train | https://github.com/andygibson/datafactory/blob/f748beb93844dea2ad6174715be3b70df0448a9c/src/main/java/org/fluttercode/datafactory/impl/DataFactory.java#L506-L511 |
overturetool/overture | core/pog/src/main/java/org/overture/pog/visitors/PogParamDefinitionVisitor.java | PogParamDefinitionVisitor.collectOpCtxt | protected void collectOpCtxt(AExplicitOperationDefinition node,
IPOContextStack question, Boolean precond) throws AnalysisException {
"""
Operation processing is identical in extension except for context generation. So, a quick trick here.
@param node
@param question
@param precond
@throws AnalysisException
"""
question.push(new POOperationDefinitionContext(node, precond, node.getState()));
} | java | protected void collectOpCtxt(AExplicitOperationDefinition node,
IPOContextStack question, Boolean precond) throws AnalysisException
{
question.push(new POOperationDefinitionContext(node, precond, node.getState()));
} | [
"protected",
"void",
"collectOpCtxt",
"(",
"AExplicitOperationDefinition",
"node",
",",
"IPOContextStack",
"question",
",",
"Boolean",
"precond",
")",
"throws",
"AnalysisException",
"{",
"question",
".",
"push",
"(",
"new",
"POOperationDefinitionContext",
"(",
"node",
... | Operation processing is identical in extension except for context generation. So, a quick trick here.
@param node
@param question
@param precond
@throws AnalysisException | [
"Operation",
"processing",
"is",
"identical",
"in",
"extension",
"except",
"for",
"context",
"generation",
".",
"So",
"a",
"quick",
"trick",
"here",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/pog/src/main/java/org/overture/pog/visitors/PogParamDefinitionVisitor.java#L562-L566 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.listLocatedBlockStatus | public RemoteIterator<LocatedBlockFileStatus> listLocatedBlockStatus(
final Path f,
final PathFilter filter)
throws FileNotFoundException, IOException {
"""
Listing a directory
The returned results include its blocks and locations if it is a file
The results are filtered by the given path filter
@param f a path
@param filter a path filter
@return an iterator that traverses statuses of the files/directories
in the given path
@throws FileNotFoundException if <code>f</code> does not exist
@throws IOException if any I/O error occurred
"""
return new RemoteIterator<LocatedBlockFileStatus>() {
private final FileStatus[] stats;
private int i = 0;
{ // initializer
stats = listStatus(f, filter);
if (stats == null) {
throw new FileNotFoundException( "File " + f + " does not exist.");
}
}
@Override
public boolean hasNext() {
return i<stats.length;
}
@Override
public LocatedBlockFileStatus next() throws IOException {
if (!hasNext()) {
throw new NoSuchElementException("No more entry in " + f);
}
FileStatus result = stats[i++];
BlockAndLocation[] locs = null;
if (!result.isDir()) {
String[] name = { "localhost:50010" };
String[] host = { "localhost" };
// create a dummy blockandlocation
locs = new BlockAndLocation[] {
new BlockAndLocation(0L, 0L, name, host,
new String[0], 0, result.getLen(), false) };
}
return new LocatedBlockFileStatus(result, locs, false);
}
};
} | java | public RemoteIterator<LocatedBlockFileStatus> listLocatedBlockStatus(
final Path f,
final PathFilter filter)
throws FileNotFoundException, IOException {
return new RemoteIterator<LocatedBlockFileStatus>() {
private final FileStatus[] stats;
private int i = 0;
{ // initializer
stats = listStatus(f, filter);
if (stats == null) {
throw new FileNotFoundException( "File " + f + " does not exist.");
}
}
@Override
public boolean hasNext() {
return i<stats.length;
}
@Override
public LocatedBlockFileStatus next() throws IOException {
if (!hasNext()) {
throw new NoSuchElementException("No more entry in " + f);
}
FileStatus result = stats[i++];
BlockAndLocation[] locs = null;
if (!result.isDir()) {
String[] name = { "localhost:50010" };
String[] host = { "localhost" };
// create a dummy blockandlocation
locs = new BlockAndLocation[] {
new BlockAndLocation(0L, 0L, name, host,
new String[0], 0, result.getLen(), false) };
}
return new LocatedBlockFileStatus(result, locs, false);
}
};
} | [
"public",
"RemoteIterator",
"<",
"LocatedBlockFileStatus",
">",
"listLocatedBlockStatus",
"(",
"final",
"Path",
"f",
",",
"final",
"PathFilter",
"filter",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"return",
"new",
"RemoteIterator",
"<",
"Located... | Listing a directory
The returned results include its blocks and locations if it is a file
The results are filtered by the given path filter
@param f a path
@param filter a path filter
@return an iterator that traverses statuses of the files/directories
in the given path
@throws FileNotFoundException if <code>f</code> does not exist
@throws IOException if any I/O error occurred | [
"Listing",
"a",
"directory",
"The",
"returned",
"results",
"include",
"its",
"blocks",
"and",
"locations",
"if",
"it",
"is",
"a",
"file",
"The",
"results",
"are",
"filtered",
"by",
"the",
"given",
"path",
"filter"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1123-L1162 |
CloudSlang/cs-actions | cs-amazon/src/main/java/io/cloudslang/content/amazon/services/helpers/AwsSignatureHelper.java | AwsSignatureHelper.getAmazonCredentialScope | public String getAmazonCredentialScope(String dateStamp, String awsRegion, String awsService) {
"""
Crates the amazon AWS credential scope (is represented by a slash-separated string of dimensions).
@param dateStamp Request date stamp. (Format: "yyyyMMdd")
@param awsRegion AWS region to which the request is sent.
@param awsService AWS service to which the request is sent.
@return A string representing the AWS credential scope.
"""
return dateStamp + SCOPE_SEPARATOR + awsRegion + SCOPE_SEPARATOR + awsService + SCOPE_SEPARATOR + AWS_REQUEST_VERSION;
} | java | public String getAmazonCredentialScope(String dateStamp, String awsRegion, String awsService) {
return dateStamp + SCOPE_SEPARATOR + awsRegion + SCOPE_SEPARATOR + awsService + SCOPE_SEPARATOR + AWS_REQUEST_VERSION;
} | [
"public",
"String",
"getAmazonCredentialScope",
"(",
"String",
"dateStamp",
",",
"String",
"awsRegion",
",",
"String",
"awsService",
")",
"{",
"return",
"dateStamp",
"+",
"SCOPE_SEPARATOR",
"+",
"awsRegion",
"+",
"SCOPE_SEPARATOR",
"+",
"awsService",
"+",
"SCOPE_SEP... | Crates the amazon AWS credential scope (is represented by a slash-separated string of dimensions).
@param dateStamp Request date stamp. (Format: "yyyyMMdd")
@param awsRegion AWS region to which the request is sent.
@param awsService AWS service to which the request is sent.
@return A string representing the AWS credential scope. | [
"Crates",
"the",
"amazon",
"AWS",
"credential",
"scope",
"(",
"is",
"represented",
"by",
"a",
"slash",
"-",
"separated",
"string",
"of",
"dimensions",
")",
"."
] | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-amazon/src/main/java/io/cloudslang/content/amazon/services/helpers/AwsSignatureHelper.java#L146-L148 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.lookAlong | public Matrix4d lookAlong(double dirX, double dirY, double dirZ,
double upX, double upY, double upZ) {
"""
Apply a rotation transformation to this matrix to make <code>-z</code> point along <code>dir</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookalong rotation matrix,
then the new matrix will be <code>M * L</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * L * v</code>, the
lookalong rotation transformation will be applied first!
<p>
This is equivalent to calling
{@link #lookAt(double, double, double, double, double, double, double, double, double) lookAt()}
with <code>eye = (0, 0, 0)</code> and <code>center = dir</code>.
<p>
In order to set the matrix to a lookalong transformation without post-multiplying it,
use {@link #setLookAlong(double, double, double, double, double, double) setLookAlong()}
@see #lookAt(double, double, double, double, double, double, double, double, double)
@see #setLookAlong(double, double, double, double, double, double)
@param dirX
the x-coordinate of the direction to look along
@param dirY
the y-coordinate of the direction to look along
@param dirZ
the z-coordinate of the direction to look along
@param upX
the x-coordinate of the up vector
@param upY
the y-coordinate of the up vector
@param upZ
the z-coordinate of the up vector
@return this
"""
return lookAlong(dirX, dirY, dirZ, upX, upY, upZ, this);
} | java | public Matrix4d lookAlong(double dirX, double dirY, double dirZ,
double upX, double upY, double upZ) {
return lookAlong(dirX, dirY, dirZ, upX, upY, upZ, this);
} | [
"public",
"Matrix4d",
"lookAlong",
"(",
"double",
"dirX",
",",
"double",
"dirY",
",",
"double",
"dirZ",
",",
"double",
"upX",
",",
"double",
"upY",
",",
"double",
"upZ",
")",
"{",
"return",
"lookAlong",
"(",
"dirX",
",",
"dirY",
",",
"dirZ",
",",
"upX"... | Apply a rotation transformation to this matrix to make <code>-z</code> point along <code>dir</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookalong rotation matrix,
then the new matrix will be <code>M * L</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * L * v</code>, the
lookalong rotation transformation will be applied first!
<p>
This is equivalent to calling
{@link #lookAt(double, double, double, double, double, double, double, double, double) lookAt()}
with <code>eye = (0, 0, 0)</code> and <code>center = dir</code>.
<p>
In order to set the matrix to a lookalong transformation without post-multiplying it,
use {@link #setLookAlong(double, double, double, double, double, double) setLookAlong()}
@see #lookAt(double, double, double, double, double, double, double, double, double)
@see #setLookAlong(double, double, double, double, double, double)
@param dirX
the x-coordinate of the direction to look along
@param dirY
the y-coordinate of the direction to look along
@param dirZ
the z-coordinate of the direction to look along
@param upX
the x-coordinate of the up vector
@param upY
the y-coordinate of the up vector
@param upZ
the z-coordinate of the up vector
@return this | [
"Apply",
"a",
"rotation",
"transformation",
"to",
"this",
"matrix",
"to",
"make",
"<code",
">",
"-",
"z<",
"/",
"code",
">",
"point",
"along",
"<code",
">",
"dir<",
"/",
"code",
">",
".",
"<p",
">",
"If",
"<code",
">",
"M<",
"/",
"code",
">",
"is",... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L10992-L10995 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/SourceTreeManager.java | SourceTreeManager.getSourceTree | public int getSourceTree(
String base, String urlString, SourceLocator locator, XPathContext xctxt)
throws TransformerException {
"""
Get the source tree from the a base URL and a URL string.
@param base The base URI to use if the urlString is relative.
@param urlString An absolute or relative URL string.
@param locator The location of the caller, for diagnostic purposes.
@return should be a non-null reference to the node identified by the
base and urlString.
@throws TransformerException If the URL can not resolve to a node.
"""
// System.out.println("getSourceTree");
try
{
Source source = this.resolveURI(base, urlString, locator);
// System.out.println("getSourceTree - base: "+base+", urlString: "+urlString+", source: "+source.getSystemId());
return getSourceTree(source, locator, xctxt);
}
catch (IOException ioe)
{
throw new TransformerException(ioe.getMessage(), locator, ioe);
}
/* catch (TransformerException te)
{
throw new TransformerException(te.getMessage(), locator, te);
}*/
} | java | public int getSourceTree(
String base, String urlString, SourceLocator locator, XPathContext xctxt)
throws TransformerException
{
// System.out.println("getSourceTree");
try
{
Source source = this.resolveURI(base, urlString, locator);
// System.out.println("getSourceTree - base: "+base+", urlString: "+urlString+", source: "+source.getSystemId());
return getSourceTree(source, locator, xctxt);
}
catch (IOException ioe)
{
throw new TransformerException(ioe.getMessage(), locator, ioe);
}
/* catch (TransformerException te)
{
throw new TransformerException(te.getMessage(), locator, te);
}*/
} | [
"public",
"int",
"getSourceTree",
"(",
"String",
"base",
",",
"String",
"urlString",
",",
"SourceLocator",
"locator",
",",
"XPathContext",
"xctxt",
")",
"throws",
"TransformerException",
"{",
"// System.out.println(\"getSourceTree\");",
"try",
"{",
"Source",
"source",
... | Get the source tree from the a base URL and a URL string.
@param base The base URI to use if the urlString is relative.
@param urlString An absolute or relative URL string.
@param locator The location of the caller, for diagnostic purposes.
@return should be a non-null reference to the node identified by the
base and urlString.
@throws TransformerException If the URL can not resolve to a node. | [
"Get",
"the",
"source",
"tree",
"from",
"the",
"a",
"base",
"URL",
"and",
"a",
"URL",
"string",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/SourceTreeManager.java#L237-L259 |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java | RepositoryApplicationConfiguration.autoAssignScheduler | @Bean
@ConditionalOnMissingBean
// don't active the auto assign scheduler in test, otherwise it is hard to
// test
@Profile("!test")
@ConditionalOnProperty(prefix = "hawkbit.autoassign.scheduler", name = "enabled", matchIfMissing = true)
AutoAssignScheduler autoAssignScheduler(final TenantAware tenantAware, final SystemManagement systemManagement,
final SystemSecurityContext systemSecurityContext, final AutoAssignChecker autoAssignChecker,
final LockRegistry lockRegistry) {
"""
{@link AutoAssignScheduler} bean.
Note: does not activate in test profile, otherwise it is hard to test the
auto assign functionality.
@param tenantAware
to run as specific tenant
@param systemManagement
to find all tenants
@param systemSecurityContext
to run as system
@param autoAssignChecker
to run a check as tenant
@param lockRegistry
to lock the tenant for auto assignment
@return a new {@link AutoAssignChecker}
"""
return new AutoAssignScheduler(systemManagement, systemSecurityContext, autoAssignChecker, lockRegistry);
} | java | @Bean
@ConditionalOnMissingBean
// don't active the auto assign scheduler in test, otherwise it is hard to
// test
@Profile("!test")
@ConditionalOnProperty(prefix = "hawkbit.autoassign.scheduler", name = "enabled", matchIfMissing = true)
AutoAssignScheduler autoAssignScheduler(final TenantAware tenantAware, final SystemManagement systemManagement,
final SystemSecurityContext systemSecurityContext, final AutoAssignChecker autoAssignChecker,
final LockRegistry lockRegistry) {
return new AutoAssignScheduler(systemManagement, systemSecurityContext, autoAssignChecker, lockRegistry);
} | [
"@",
"Bean",
"@",
"ConditionalOnMissingBean",
"// don't active the auto assign scheduler in test, otherwise it is hard to",
"// test",
"@",
"Profile",
"(",
"\"!test\"",
")",
"@",
"ConditionalOnProperty",
"(",
"prefix",
"=",
"\"hawkbit.autoassign.scheduler\"",
",",
"name",
"=",
... | {@link AutoAssignScheduler} bean.
Note: does not activate in test profile, otherwise it is hard to test the
auto assign functionality.
@param tenantAware
to run as specific tenant
@param systemManagement
to find all tenants
@param systemSecurityContext
to run as system
@param autoAssignChecker
to run a check as tenant
@param lockRegistry
to lock the tenant for auto assignment
@return a new {@link AutoAssignChecker} | [
"{",
"@link",
"AutoAssignScheduler",
"}",
"bean",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java#L783-L793 |
apereo/cas | support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/util/OAuth20Utils.java | OAuth20Utils.isAuthorizedResponseTypeForService | public static boolean isAuthorizedResponseTypeForService(final J2EContext context, final OAuthRegisteredService registeredService) {
"""
Is authorized response type for service?
@param context the context
@param registeredService the registered service
@return the boolean
"""
val responseType = context.getRequestParameter(OAuth20Constants.RESPONSE_TYPE);
if (registeredService.getSupportedResponseTypes() != null && !registeredService.getSupportedResponseTypes().isEmpty()) {
LOGGER.debug("Checking response type [{}] against supported response types [{}]", responseType, registeredService.getSupportedResponseTypes());
return registeredService.getSupportedResponseTypes().stream().anyMatch(s -> s.equalsIgnoreCase(responseType));
}
LOGGER.warn("Registered service [{}] does not define any authorized/supported response types. "
+ "It is STRONGLY recommended that you authorize and assign response types to the service definition. "
+ "While just a warning for now, this behavior will be enforced by CAS in future versions.", registeredService.getName());
return true;
} | java | public static boolean isAuthorizedResponseTypeForService(final J2EContext context, final OAuthRegisteredService registeredService) {
val responseType = context.getRequestParameter(OAuth20Constants.RESPONSE_TYPE);
if (registeredService.getSupportedResponseTypes() != null && !registeredService.getSupportedResponseTypes().isEmpty()) {
LOGGER.debug("Checking response type [{}] against supported response types [{}]", responseType, registeredService.getSupportedResponseTypes());
return registeredService.getSupportedResponseTypes().stream().anyMatch(s -> s.equalsIgnoreCase(responseType));
}
LOGGER.warn("Registered service [{}] does not define any authorized/supported response types. "
+ "It is STRONGLY recommended that you authorize and assign response types to the service definition. "
+ "While just a warning for now, this behavior will be enforced by CAS in future versions.", registeredService.getName());
return true;
} | [
"public",
"static",
"boolean",
"isAuthorizedResponseTypeForService",
"(",
"final",
"J2EContext",
"context",
",",
"final",
"OAuthRegisteredService",
"registeredService",
")",
"{",
"val",
"responseType",
"=",
"context",
".",
"getRequestParameter",
"(",
"OAuth20Constants",
"... | Is authorized response type for service?
@param context the context
@param registeredService the registered service
@return the boolean | [
"Is",
"authorized",
"response",
"type",
"for",
"service?"
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/util/OAuth20Utils.java#L272-L283 |
enioka/jqm | jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/Helpers.java | Helpers.setSingleParam | static void setSingleParam(String key, String value, DbConn cnx) {
"""
Checks if a parameter exists. If it exists, it is updated. If it doesn't, it is created. Only works for parameters which key is
unique. Will create a transaction on the given entity manager.
"""
QueryResult r = cnx.runUpdate("globalprm_update_value_by_key", value, key);
if (r.nbUpdated == 0)
{
cnx.runUpdate("globalprm_insert", key, value);
}
cnx.commit();
} | java | static void setSingleParam(String key, String value, DbConn cnx)
{
QueryResult r = cnx.runUpdate("globalprm_update_value_by_key", value, key);
if (r.nbUpdated == 0)
{
cnx.runUpdate("globalprm_insert", key, value);
}
cnx.commit();
} | [
"static",
"void",
"setSingleParam",
"(",
"String",
"key",
",",
"String",
"value",
",",
"DbConn",
"cnx",
")",
"{",
"QueryResult",
"r",
"=",
"cnx",
".",
"runUpdate",
"(",
"\"globalprm_update_value_by_key\"",
",",
"value",
",",
"key",
")",
";",
"if",
"(",
"r"... | Checks if a parameter exists. If it exists, it is updated. If it doesn't, it is created. Only works for parameters which key is
unique. Will create a transaction on the given entity manager. | [
"Checks",
"if",
"a",
"parameter",
"exists",
".",
"If",
"it",
"exists",
"it",
"is",
"updated",
".",
"If",
"it",
"doesn",
"t",
"it",
"is",
"created",
".",
"Only",
"works",
"for",
"parameters",
"which",
"key",
"is",
"unique",
".",
"Will",
"create",
"a",
... | train | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/Helpers.java#L240-L248 |
groupon/odo | browsermob-proxy/src/main/java/com/groupon/odo/bmp/KeyStoreManager.java | KeyStoreManager.persist | public synchronized void persist() throws KeyStoreException, NoSuchAlgorithmException, CertificateException {
"""
Writes the keystore and certificate/keypair mappings to disk.
@throws KeyStoreException
@throws NoSuchAlgorithmException
@throws CertificateException
"""
try
{
FileOutputStream kso = new FileOutputStream(new File(root, _caPrivateKeystore));
_ks.store(kso, _keystorepass);
kso.flush();
kso.close();
persistCertMap();
persistSubjectMap();
persistKeyPairMap();
persistPublicKeyMap();
}
catch(IOException ioe)
{
ioe.printStackTrace();
}
} | java | public synchronized void persist() throws KeyStoreException, NoSuchAlgorithmException, CertificateException {
try
{
FileOutputStream kso = new FileOutputStream(new File(root, _caPrivateKeystore));
_ks.store(kso, _keystorepass);
kso.flush();
kso.close();
persistCertMap();
persistSubjectMap();
persistKeyPairMap();
persistPublicKeyMap();
}
catch(IOException ioe)
{
ioe.printStackTrace();
}
} | [
"public",
"synchronized",
"void",
"persist",
"(",
")",
"throws",
"KeyStoreException",
",",
"NoSuchAlgorithmException",
",",
"CertificateException",
"{",
"try",
"{",
"FileOutputStream",
"kso",
"=",
"new",
"FileOutputStream",
"(",
"new",
"File",
"(",
"root",
",",
"_... | Writes the keystore and certificate/keypair mappings to disk.
@throws KeyStoreException
@throws NoSuchAlgorithmException
@throws CertificateException | [
"Writes",
"the",
"keystore",
"and",
"certificate",
"/",
"keypair",
"mappings",
"to",
"disk",
"."
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/browsermob-proxy/src/main/java/com/groupon/odo/bmp/KeyStoreManager.java#L570-L586 |
geomajas/geomajas-project-client-gwt2 | plugin/corewidget/example-jar/src/main/java/org/geomajas/gwt2/plugin/corewidget/example/client/sample/feature/tooltip/ToolTip.java | ToolTip.addContentAndShow | public void addContentAndShow(List<Label> content, int left, int top, boolean showCloseButton) {
"""
Add content to the tooltip and show it with the given parameters.
@param content a list of Labels
@param left the left position of the tooltip
@param top the top position of the tooltip
"""
// Add a closeButton when showCloseButton is true.
if (showCloseButton) {
Label closeButtonLabel = new Label(" X ");
closeButtonLabel.addStyleName(ToolTipResource.INSTANCE.css().toolTipCloseButton());
contentPanel.add(closeButtonLabel);
closeButtonLabel.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
hide();
}
});
}
// Add the content to the panel.
for (Label l : content) {
l.addStyleName(ToolTipResource.INSTANCE.css().toolTipLine());
contentPanel.add(l);
}
// Finally set position of the tooltip and show it.
toolTip.setPopupPosition(left, top);
toolTip.show();
} | java | public void addContentAndShow(List<Label> content, int left, int top, boolean showCloseButton) {
// Add a closeButton when showCloseButton is true.
if (showCloseButton) {
Label closeButtonLabel = new Label(" X ");
closeButtonLabel.addStyleName(ToolTipResource.INSTANCE.css().toolTipCloseButton());
contentPanel.add(closeButtonLabel);
closeButtonLabel.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
hide();
}
});
}
// Add the content to the panel.
for (Label l : content) {
l.addStyleName(ToolTipResource.INSTANCE.css().toolTipLine());
contentPanel.add(l);
}
// Finally set position of the tooltip and show it.
toolTip.setPopupPosition(left, top);
toolTip.show();
} | [
"public",
"void",
"addContentAndShow",
"(",
"List",
"<",
"Label",
">",
"content",
",",
"int",
"left",
",",
"int",
"top",
",",
"boolean",
"showCloseButton",
")",
"{",
"// Add a closeButton when showCloseButton is true.",
"if",
"(",
"showCloseButton",
")",
"{",
"Lab... | Add content to the tooltip and show it with the given parameters.
@param content a list of Labels
@param left the left position of the tooltip
@param top the top position of the tooltip | [
"Add",
"content",
"to",
"the",
"tooltip",
"and",
"show",
"it",
"with",
"the",
"given",
"parameters",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/corewidget/example-jar/src/main/java/org/geomajas/gwt2/plugin/corewidget/example/client/sample/feature/tooltip/ToolTip.java#L78-L104 |
geomajas/geomajas-project-server | common-servlet/src/main/java/org/geomajas/servlet/CacheFilter.java | CacheFilter.shouldCache | public boolean shouldCache(String requestUri) {
"""
Should the URI be cached?
@param requestUri request URI
@return true when caching is needed
"""
String uri = requestUri.toLowerCase();
return checkContains(uri, cacheIdentifiers) || checkSuffixes(uri, cacheSuffixes);
} | java | public boolean shouldCache(String requestUri) {
String uri = requestUri.toLowerCase();
return checkContains(uri, cacheIdentifiers) || checkSuffixes(uri, cacheSuffixes);
} | [
"public",
"boolean",
"shouldCache",
"(",
"String",
"requestUri",
")",
"{",
"String",
"uri",
"=",
"requestUri",
".",
"toLowerCase",
"(",
")",
";",
"return",
"checkContains",
"(",
"uri",
",",
"cacheIdentifiers",
")",
"||",
"checkSuffixes",
"(",
"uri",
",",
"ca... | Should the URI be cached?
@param requestUri request URI
@return true when caching is needed | [
"Should",
"the",
"URI",
"be",
"cached?"
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/common-servlet/src/main/java/org/geomajas/servlet/CacheFilter.java#L211-L214 |
Impetus/Kundera | src/kundera-mongo/src/main/java/com/impetus/client/mongodb/DefaultMongoDBDataHandler.java | DefaultMongoDBDataHandler.createGFSInputFile | private GridFSInputFile createGFSInputFile(GridFS gfs, Object entity, Field f) {
"""
Creates the GFS Input file.
@param gfs
the gfs
@param entity
the entity
@param f
the f
@return the grid fs input file
"""
Object obj = PropertyAccessorHelper.getObject(entity, f);
GridFSInputFile gridFSInputFile = null;
if (f.getType().isAssignableFrom(byte[].class))
gridFSInputFile = gfs.createFile((byte[]) obj);
else if (f.getType().isAssignableFrom(File.class))
{
try
{
gridFSInputFile = gfs.createFile((File) obj);
}
catch (IOException e)
{
log.error("Error while creating GridFS file for \"" + f.getName() + "\". Caused by: ", e);
throw new KunderaException("Error while creating GridFS file for \"" + f.getName() + "\". Caused by: ",
e);
}
}
else
new UnsupportedOperationException(f.getType().getSimpleName() + " is unsupported Lob object");
return gridFSInputFile;
} | java | private GridFSInputFile createGFSInputFile(GridFS gfs, Object entity, Field f)
{
Object obj = PropertyAccessorHelper.getObject(entity, f);
GridFSInputFile gridFSInputFile = null;
if (f.getType().isAssignableFrom(byte[].class))
gridFSInputFile = gfs.createFile((byte[]) obj);
else if (f.getType().isAssignableFrom(File.class))
{
try
{
gridFSInputFile = gfs.createFile((File) obj);
}
catch (IOException e)
{
log.error("Error while creating GridFS file for \"" + f.getName() + "\". Caused by: ", e);
throw new KunderaException("Error while creating GridFS file for \"" + f.getName() + "\". Caused by: ",
e);
}
}
else
new UnsupportedOperationException(f.getType().getSimpleName() + " is unsupported Lob object");
return gridFSInputFile;
} | [
"private",
"GridFSInputFile",
"createGFSInputFile",
"(",
"GridFS",
"gfs",
",",
"Object",
"entity",
",",
"Field",
"f",
")",
"{",
"Object",
"obj",
"=",
"PropertyAccessorHelper",
".",
"getObject",
"(",
"entity",
",",
"f",
")",
";",
"GridFSInputFile",
"gridFSInputFi... | Creates the GFS Input file.
@param gfs
the gfs
@param entity
the entity
@param f
the f
@return the grid fs input file | [
"Creates",
"the",
"GFS",
"Input",
"file",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/DefaultMongoDBDataHandler.java#L416-L438 |
evernote/evernote-sdk-android | library/src/main/java/com/evernote/client/android/EvernoteUtil.java | EvernoteUtil.createGetBootstrapProfileNameIntent | public static Intent createGetBootstrapProfileNameIntent(Context context, EvernoteSession evernoteSession) {
"""
Returns an Intent to query the bootstrap profile name from the main Evernote app. This is useful
if you want to use the main app to authenticate the user and he is already signed in.
@param context The {@link Context} starting the {@link Intent}.
@param evernoteSession The current session.
@return An Intent to query the bootstrap profile name. Returns {@code null}, if the main app
is not installed, not up to date or you do not want to use the main app to authenticate the
user.
"""
if (evernoteSession.isForceAuthenticationInThirdPartyApp()) {
// we don't want to use the main app, return null
return null;
}
EvernoteUtil.EvernoteInstallStatus installStatus = EvernoteUtil.getEvernoteInstallStatus(context, EvernoteUtil.ACTION_GET_BOOTSTRAP_PROFILE_NAME);
if (!EvernoteUtil.EvernoteInstallStatus.INSTALLED.equals(installStatus)) {
return null;
}
return new Intent(EvernoteUtil.ACTION_GET_BOOTSTRAP_PROFILE_NAME).setPackage(PACKAGE_NAME);
} | java | public static Intent createGetBootstrapProfileNameIntent(Context context, EvernoteSession evernoteSession) {
if (evernoteSession.isForceAuthenticationInThirdPartyApp()) {
// we don't want to use the main app, return null
return null;
}
EvernoteUtil.EvernoteInstallStatus installStatus = EvernoteUtil.getEvernoteInstallStatus(context, EvernoteUtil.ACTION_GET_BOOTSTRAP_PROFILE_NAME);
if (!EvernoteUtil.EvernoteInstallStatus.INSTALLED.equals(installStatus)) {
return null;
}
return new Intent(EvernoteUtil.ACTION_GET_BOOTSTRAP_PROFILE_NAME).setPackage(PACKAGE_NAME);
} | [
"public",
"static",
"Intent",
"createGetBootstrapProfileNameIntent",
"(",
"Context",
"context",
",",
"EvernoteSession",
"evernoteSession",
")",
"{",
"if",
"(",
"evernoteSession",
".",
"isForceAuthenticationInThirdPartyApp",
"(",
")",
")",
"{",
"// we don't want to use the m... | Returns an Intent to query the bootstrap profile name from the main Evernote app. This is useful
if you want to use the main app to authenticate the user and he is already signed in.
@param context The {@link Context} starting the {@link Intent}.
@param evernoteSession The current session.
@return An Intent to query the bootstrap profile name. Returns {@code null}, if the main app
is not installed, not up to date or you do not want to use the main app to authenticate the
user. | [
"Returns",
"an",
"Intent",
"to",
"query",
"the",
"bootstrap",
"profile",
"name",
"from",
"the",
"main",
"Evernote",
"app",
".",
"This",
"is",
"useful",
"if",
"you",
"want",
"to",
"use",
"the",
"main",
"app",
"to",
"authenticate",
"the",
"user",
"and",
"h... | train | https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/EvernoteUtil.java#L338-L350 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ExportConfigurationsInner.java | ExportConfigurationsInner.updateAsync | public Observable<ApplicationInsightsComponentExportConfigurationInner> updateAsync(String resourceGroupName, String resourceName, String exportId, ApplicationInsightsComponentExportRequest exportProperties) {
"""
Update the Continuous Export configuration for this export id.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param exportId The Continuous Export configuration ID. This is unique within a Application Insights component.
@param exportProperties Properties that need to be specified to update the Continuous Export configuration.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationInsightsComponentExportConfigurationInner object
"""
return updateWithServiceResponseAsync(resourceGroupName, resourceName, exportId, exportProperties).map(new Func1<ServiceResponse<ApplicationInsightsComponentExportConfigurationInner>, ApplicationInsightsComponentExportConfigurationInner>() {
@Override
public ApplicationInsightsComponentExportConfigurationInner call(ServiceResponse<ApplicationInsightsComponentExportConfigurationInner> response) {
return response.body();
}
});
} | java | public Observable<ApplicationInsightsComponentExportConfigurationInner> updateAsync(String resourceGroupName, String resourceName, String exportId, ApplicationInsightsComponentExportRequest exportProperties) {
return updateWithServiceResponseAsync(resourceGroupName, resourceName, exportId, exportProperties).map(new Func1<ServiceResponse<ApplicationInsightsComponentExportConfigurationInner>, ApplicationInsightsComponentExportConfigurationInner>() {
@Override
public ApplicationInsightsComponentExportConfigurationInner call(ServiceResponse<ApplicationInsightsComponentExportConfigurationInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ApplicationInsightsComponentExportConfigurationInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"String",
"exportId",
",",
"ApplicationInsightsComponentExportRequest",
"exportProperties",
")",
"{",... | Update the Continuous Export configuration for this export id.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param exportId The Continuous Export configuration ID. This is unique within a Application Insights component.
@param exportProperties Properties that need to be specified to update the Continuous Export configuration.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationInsightsComponentExportConfigurationInner object | [
"Update",
"the",
"Continuous",
"Export",
"configuration",
"for",
"this",
"export",
"id",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ExportConfigurationsInner.java#L490-L497 |
mojohaus/flatten-maven-plugin | src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java | FlattenMojo.writeStringToFile | protected void writeStringToFile( String data, File file, String encoding )
throws MojoExecutionException {
"""
Writes the given <code>data</code> to the given <code>file</code> using the specified <code>encoding</code>.
@param data is the {@link String} to write.
@param file is the {@link File} to write to.
@param encoding is the encoding to use for writing the file.
@throws MojoExecutionException if anything goes wrong.
"""
OutputStream outStream = null;
Writer writer = null;
try
{
outStream = new FileOutputStream( file );
writer = new OutputStreamWriter( outStream, encoding );
writer.write( data );
}
catch ( IOException e )
{
throw new MojoExecutionException( "Failed to write to " + file, e );
}
finally
{
// resource-handling not perfectly solved but we do not want to require java 1.7
// and this is not a server application.
IOUtil.close( writer );
IOUtil.close( outStream );
}
} | java | protected void writeStringToFile( String data, File file, String encoding )
throws MojoExecutionException
{
OutputStream outStream = null;
Writer writer = null;
try
{
outStream = new FileOutputStream( file );
writer = new OutputStreamWriter( outStream, encoding );
writer.write( data );
}
catch ( IOException e )
{
throw new MojoExecutionException( "Failed to write to " + file, e );
}
finally
{
// resource-handling not perfectly solved but we do not want to require java 1.7
// and this is not a server application.
IOUtil.close( writer );
IOUtil.close( outStream );
}
} | [
"protected",
"void",
"writeStringToFile",
"(",
"String",
"data",
",",
"File",
"file",
",",
"String",
"encoding",
")",
"throws",
"MojoExecutionException",
"{",
"OutputStream",
"outStream",
"=",
"null",
";",
"Writer",
"writer",
"=",
"null",
";",
"try",
"{",
"out... | Writes the given <code>data</code> to the given <code>file</code> using the specified <code>encoding</code>.
@param data is the {@link String} to write.
@param file is the {@link File} to write to.
@param encoding is the encoding to use for writing the file.
@throws MojoExecutionException if anything goes wrong. | [
"Writes",
"the",
"given",
"<code",
">",
"data<",
"/",
"code",
">",
"to",
"the",
"given",
"<code",
">",
"file<",
"/",
"code",
">",
"using",
"the",
"specified",
"<code",
">",
"encoding<",
"/",
"code",
">",
"."
] | train | https://github.com/mojohaus/flatten-maven-plugin/blob/df25d03a4d6c06c4de5cfd9f52dfbe72e823e403/src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java#L433-L456 |
opengeospatial/teamengine | teamengine-spi/src/main/java/com/occamlab/te/spi/util/HtmlReport.java | HtmlReport.addDir | private static void addDir(File dirObj, ZipOutputStream out)
throws IOException {
"""
Add directory to zip file
@param dirObj
@param out
@throws IOException
"""
File[] dirList = dirObj.listFiles();
byte[] tmpBuf = new byte[1024];
for (int i = 0; i < dirList.length; i++) {
if (dirList[i].isDirectory()) {
addDir(dirList[i], out);
continue;
}
FileInputStream in = new FileInputStream(
dirList[i].getAbsolutePath());
System.out.println(" Adding: " + dirList[i].getAbsolutePath());
out.putNextEntry(new ZipEntry(dirList[i].getAbsolutePath()));
// Transfer from the file to the ZIP file
int len;
while ((len = in.read(tmpBuf)) > 0) {
out.write(tmpBuf, 0, len);
}
// Complete the entry
out.closeEntry();
in.close();
}
} | java | private static void addDir(File dirObj, ZipOutputStream out)
throws IOException {
File[] dirList = dirObj.listFiles();
byte[] tmpBuf = new byte[1024];
for (int i = 0; i < dirList.length; i++) {
if (dirList[i].isDirectory()) {
addDir(dirList[i], out);
continue;
}
FileInputStream in = new FileInputStream(
dirList[i].getAbsolutePath());
System.out.println(" Adding: " + dirList[i].getAbsolutePath());
out.putNextEntry(new ZipEntry(dirList[i].getAbsolutePath()));
// Transfer from the file to the ZIP file
int len;
while ((len = in.read(tmpBuf)) > 0) {
out.write(tmpBuf, 0, len);
}
// Complete the entry
out.closeEntry();
in.close();
}
} | [
"private",
"static",
"void",
"addDir",
"(",
"File",
"dirObj",
",",
"ZipOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"File",
"[",
"]",
"dirList",
"=",
"dirObj",
".",
"listFiles",
"(",
")",
";",
"byte",
"[",
"]",
"tmpBuf",
"=",
"new",
"byte",
... | Add directory to zip file
@param dirObj
@param out
@throws IOException | [
"Add",
"directory",
"to",
"zip",
"file"
] | train | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-spi/src/main/java/com/occamlab/te/spi/util/HtmlReport.java#L149-L176 |
mbeiter/util | db/src/main/java/org/beiter/michael/db/DataSourceFactory.java | DataSourceFactory.getDataSource | public static DataSource getDataSource(final String jndiName)
throws FactoryException {
"""
Return a DataSource instance for a JNDI managed JDBC data source.
@param jndiName The JNDI connection name
@return a JDBC data source
@throws FactoryException When no date source can be retrieved from JNDI
@throws NullPointerException When {@code jndiName} is null
@throws IllegalArgumentException When {@code jndiName} is empty
"""
Validate.notBlank(jndiName, "The validated character sequence 'jndiName' is null or empty");
// no need for defensive copies of Strings
try {
// the initial context is created from the provided JNDI settings
final Context context = new InitialContext();
// retrieve a data source object, close the context as it is no longer needed, and return the data source
final Object namedObject = context.lookup(jndiName);
if (DataSource.class.isInstance(namedObject)) {
final DataSource dataSource = (DataSource) context.lookup(jndiName);
context.close();
return dataSource;
} else {
final String error = "The JNDI name '" + jndiName + "' does not reference a SQL DataSource."
+ " This is a configuration issue.";
LOG.warn(error);
throw new FactoryException(error);
}
} catch (NamingException e) {
final String error = "Error retrieving JDBC date source from JNDI: " + jndiName;
LOG.warn(error);
throw new FactoryException(error, e);
}
} | java | public static DataSource getDataSource(final String jndiName)
throws FactoryException {
Validate.notBlank(jndiName, "The validated character sequence 'jndiName' is null or empty");
// no need for defensive copies of Strings
try {
// the initial context is created from the provided JNDI settings
final Context context = new InitialContext();
// retrieve a data source object, close the context as it is no longer needed, and return the data source
final Object namedObject = context.lookup(jndiName);
if (DataSource.class.isInstance(namedObject)) {
final DataSource dataSource = (DataSource) context.lookup(jndiName);
context.close();
return dataSource;
} else {
final String error = "The JNDI name '" + jndiName + "' does not reference a SQL DataSource."
+ " This is a configuration issue.";
LOG.warn(error);
throw new FactoryException(error);
}
} catch (NamingException e) {
final String error = "Error retrieving JDBC date source from JNDI: " + jndiName;
LOG.warn(error);
throw new FactoryException(error, e);
}
} | [
"public",
"static",
"DataSource",
"getDataSource",
"(",
"final",
"String",
"jndiName",
")",
"throws",
"FactoryException",
"{",
"Validate",
".",
"notBlank",
"(",
"jndiName",
",",
"\"The validated character sequence 'jndiName' is null or empty\"",
")",
";",
"// no need for de... | Return a DataSource instance for a JNDI managed JDBC data source.
@param jndiName The JNDI connection name
@return a JDBC data source
@throws FactoryException When no date source can be retrieved from JNDI
@throws NullPointerException When {@code jndiName} is null
@throws IllegalArgumentException When {@code jndiName} is empty | [
"Return",
"a",
"DataSource",
"instance",
"for",
"a",
"JNDI",
"managed",
"JDBC",
"data",
"source",
"."
] | train | https://github.com/mbeiter/util/blob/490fcebecb936e00c2f2ce2096b679b2fd10865e/db/src/main/java/org/beiter/michael/db/DataSourceFactory.java#L89-L118 |
aoindustries/aocode-public | src/main/java/com/aoindustries/md5/MD5.java | MD5.Update | final public void Update (String s) {
"""
Update buffer with given string.
@param s String to be update to hash (is used as
s.getBytes())
"""
byte[] chars=s.getBytes();
// Changed on 2004-04-10 due to getBytes(int,int,char[],byte) being deprecated
//byte chars[];
//chars = new byte[s.length()];
//s.getBytes(0, s.length(), chars, 0);
Update(chars, chars.length);
} | java | final public void Update (String s) {
byte[] chars=s.getBytes();
// Changed on 2004-04-10 due to getBytes(int,int,char[],byte) being deprecated
//byte chars[];
//chars = new byte[s.length()];
//s.getBytes(0, s.length(), chars, 0);
Update(chars, chars.length);
} | [
"final",
"public",
"void",
"Update",
"(",
"String",
"s",
")",
"{",
"byte",
"[",
"]",
"chars",
"=",
"s",
".",
"getBytes",
"(",
")",
";",
"// Changed on 2004-04-10 due to getBytes(int,int,char[],byte) being deprecated",
"//byte\tchars[];",
"//chars = new byte[s.length()];",... | Update buffer with given string.
@param s String to be update to hash (is used as
s.getBytes()) | [
"Update",
"buffer",
"with",
"given",
"string",
"."
] | train | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/md5/MD5.java#L382-L390 |
jamesagnew/hapi-fhir | hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java | AuditingInterceptor.addAuditableResource | public void addAuditableResource(String resourceType, Class<? extends IResourceAuditor<? extends IResource>> auditableResource) {
"""
Add a type of auditable resource and its auditor to this AuditingInterceptor's resource map
@param resourceType
the type of resource to be audited (Patient, Encounter, etc)
@param auditableResource
an implementation of IResourceAuditor that can audit resources of the given type
"""
if (myAuditableResources == null)
myAuditableResources = new HashMap<String, Class<? extends IResourceAuditor<? extends IResource>>>();
myAuditableResources.put(resourceType, auditableResource);
} | java | public void addAuditableResource(String resourceType, Class<? extends IResourceAuditor<? extends IResource>> auditableResource) {
if (myAuditableResources == null)
myAuditableResources = new HashMap<String, Class<? extends IResourceAuditor<? extends IResource>>>();
myAuditableResources.put(resourceType, auditableResource);
} | [
"public",
"void",
"addAuditableResource",
"(",
"String",
"resourceType",
",",
"Class",
"<",
"?",
"extends",
"IResourceAuditor",
"<",
"?",
"extends",
"IResource",
">",
">",
"auditableResource",
")",
"{",
"if",
"(",
"myAuditableResources",
"==",
"null",
")",
"myAu... | Add a type of auditable resource and its auditor to this AuditingInterceptor's resource map
@param resourceType
the type of resource to be audited (Patient, Encounter, etc)
@param auditableResource
an implementation of IResourceAuditor that can audit resources of the given type | [
"Add",
"a",
"type",
"of",
"auditable",
"resource",
"and",
"its",
"auditor",
"to",
"this",
"AuditingInterceptor",
"s",
"resource",
"map"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java#L549-L553 |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileWriter.java | DBaseFileWriter.writeDBFNumber | private void writeDBFNumber(double number, int numberLength, int decimalLength) throws IOException {
"""
Write a number inside the current <var>stream</var>.
<p>A number is composed of the characters <code>[-.0123456789]</code>.
The number is written to have its decimal point matching the given
position. It was filled by space characters (0x20) at the left, and
by <code>0</code> at the right.
@param number is the number to output
@param numberLength is the length, in digits, of the number to output.
@param decimalLength is the position of the decimal point, <code>0</code>
means right-most position, ie. no decimal part.
@throws IOException in case of error.
"""
final StringBuilder buffer = new StringBuilder("{0,number,#"); //$NON-NLS-1$
if (decimalLength > 0) {
buffer.append("."); //$NON-NLS-1$
for (int i = 0; i < decimalLength; ++i) {
buffer.append("#"); //$NON-NLS-1$
}
}
buffer.append("}"); //$NON-NLS-1$
final MessageFormat format = new MessageFormat(buffer.toString(), java.util.Locale.ROOT);
String formattedNumber = format.format(new Object[] {Double.valueOf(number)});
buffer.setLength(0);
buffer.append(formattedNumber);
while (buffer.length() < numberLength) {
buffer.insert(0, " "); //$NON-NLS-1$
}
formattedNumber = buffer.toString();
// Write the number with the original ASCII code page
final Charset encodingCharset = Charset.forName("IBM437"); //$NON-NLS-1$
if (encodingCharset == null) {
throw new IOException(Locale.getString("UNKNOWN_CHARSET")); //$NON-NLS-1$
}
final byte[] bytes = formattedNumber.getBytes(encodingCharset);
if (bytes != null) {
this.stream.write(bytes);
}
} | java | private void writeDBFNumber(double number, int numberLength, int decimalLength) throws IOException {
final StringBuilder buffer = new StringBuilder("{0,number,#"); //$NON-NLS-1$
if (decimalLength > 0) {
buffer.append("."); //$NON-NLS-1$
for (int i = 0; i < decimalLength; ++i) {
buffer.append("#"); //$NON-NLS-1$
}
}
buffer.append("}"); //$NON-NLS-1$
final MessageFormat format = new MessageFormat(buffer.toString(), java.util.Locale.ROOT);
String formattedNumber = format.format(new Object[] {Double.valueOf(number)});
buffer.setLength(0);
buffer.append(formattedNumber);
while (buffer.length() < numberLength) {
buffer.insert(0, " "); //$NON-NLS-1$
}
formattedNumber = buffer.toString();
// Write the number with the original ASCII code page
final Charset encodingCharset = Charset.forName("IBM437"); //$NON-NLS-1$
if (encodingCharset == null) {
throw new IOException(Locale.getString("UNKNOWN_CHARSET")); //$NON-NLS-1$
}
final byte[] bytes = formattedNumber.getBytes(encodingCharset);
if (bytes != null) {
this.stream.write(bytes);
}
} | [
"private",
"void",
"writeDBFNumber",
"(",
"double",
"number",
",",
"int",
"numberLength",
",",
"int",
"decimalLength",
")",
"throws",
"IOException",
"{",
"final",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
"\"{0,number,#\"",
")",
";",
"//$NON-NLS... | Write a number inside the current <var>stream</var>.
<p>A number is composed of the characters <code>[-.0123456789]</code>.
The number is written to have its decimal point matching the given
position. It was filled by space characters (0x20) at the left, and
by <code>0</code> at the right.
@param number is the number to output
@param numberLength is the length, in digits, of the number to output.
@param decimalLength is the position of the decimal point, <code>0</code>
means right-most position, ie. no decimal part.
@throws IOException in case of error. | [
"Write",
"a",
"number",
"inside",
"the",
"current",
"<var",
">",
"stream<",
"/",
"var",
">",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileWriter.java#L220-L249 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/preview/CmsPreviewUtil.java | CmsPreviewUtil.setLink | public static void setLink(String path, String title, String target) {
"""
Sets the resource link within the rich text editor (FCKEditor, CKEditor, ...).<p>
@param path the link path
@param title the link title
@param target the link target attribute
"""
nativeSetLink(path, CmsStringUtil.escapeHtml(title), target);
} | java | public static void setLink(String path, String title, String target) {
nativeSetLink(path, CmsStringUtil.escapeHtml(title), target);
} | [
"public",
"static",
"void",
"setLink",
"(",
"String",
"path",
",",
"String",
"title",
",",
"String",
"target",
")",
"{",
"nativeSetLink",
"(",
"path",
",",
"CmsStringUtil",
".",
"escapeHtml",
"(",
"title",
")",
",",
"target",
")",
";",
"}"
] | Sets the resource link within the rich text editor (FCKEditor, CKEditor, ...).<p>
@param path the link path
@param title the link title
@param target the link target attribute | [
"Sets",
"the",
"resource",
"link",
"within",
"the",
"rich",
"text",
"editor",
"(",
"FCKEditor",
"CKEditor",
"...",
")",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/CmsPreviewUtil.java#L255-L258 |
RestComm/jss7 | m3ua/impl/src/main/java/org/restcomm/protocols/ss7/m3ua/impl/M3UAManagementImpl.java | M3UAManagementImpl.startAsp | public void startAsp(String aspName) throws Exception {
"""
This method should be called by management to start the ASP
@param aspName The name of the ASP to be started
@throws Exception
"""
AspFactoryImpl aspFactoryImpl = this.getAspFactory(aspName);
if (aspFactoryImpl == null) {
throw new Exception(String.format(M3UAOAMMessages.NO_ASP_FOUND, aspName));
}
if (aspFactoryImpl.getStatus()) {
throw new Exception(String.format(M3UAOAMMessages.ASP_ALREADY_STARTED, aspName));
}
if (aspFactoryImpl.aspList.size() == 0) {
throw new Exception(String.format(M3UAOAMMessages.ASP_NOT_ASSIGNED_TO_AS, aspName));
}
aspFactoryImpl.start();
this.store();
for (FastList.Node<M3UAManagementEventListener> n = this.managementEventListeners.head(), end = this.managementEventListeners
.tail(); (n = n.getNext()) != end;) {
M3UAManagementEventListener m3uaManagementEventListener = n.getValue();
try {
m3uaManagementEventListener.onAspFactoryStarted(aspFactoryImpl);
} catch (Throwable ee) {
logger.error("Exception while invoking onAspFactoryStarted", ee);
}
}
} | java | public void startAsp(String aspName) throws Exception {
AspFactoryImpl aspFactoryImpl = this.getAspFactory(aspName);
if (aspFactoryImpl == null) {
throw new Exception(String.format(M3UAOAMMessages.NO_ASP_FOUND, aspName));
}
if (aspFactoryImpl.getStatus()) {
throw new Exception(String.format(M3UAOAMMessages.ASP_ALREADY_STARTED, aspName));
}
if (aspFactoryImpl.aspList.size() == 0) {
throw new Exception(String.format(M3UAOAMMessages.ASP_NOT_ASSIGNED_TO_AS, aspName));
}
aspFactoryImpl.start();
this.store();
for (FastList.Node<M3UAManagementEventListener> n = this.managementEventListeners.head(), end = this.managementEventListeners
.tail(); (n = n.getNext()) != end;) {
M3UAManagementEventListener m3uaManagementEventListener = n.getValue();
try {
m3uaManagementEventListener.onAspFactoryStarted(aspFactoryImpl);
} catch (Throwable ee) {
logger.error("Exception while invoking onAspFactoryStarted", ee);
}
}
} | [
"public",
"void",
"startAsp",
"(",
"String",
"aspName",
")",
"throws",
"Exception",
"{",
"AspFactoryImpl",
"aspFactoryImpl",
"=",
"this",
".",
"getAspFactory",
"(",
"aspName",
")",
";",
"if",
"(",
"aspFactoryImpl",
"==",
"null",
")",
"{",
"throw",
"new",
"Ex... | This method should be called by management to start the ASP
@param aspName The name of the ASP to be started
@throws Exception | [
"This",
"method",
"should",
"be",
"called",
"by",
"management",
"to",
"start",
"the",
"ASP"
] | train | https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/m3ua/impl/src/main/java/org/restcomm/protocols/ss7/m3ua/impl/M3UAManagementImpl.java#L777-L805 |
milaboratory/milib | src/main/java/com/milaboratory/core/alignment/BandedLinearAligner.java | BandedLinearAligner.alignSemiLocalLeft | public static Alignment<NucleotideSequence> alignSemiLocalLeft(LinearGapAlignmentScoring scoring, NucleotideSequence seq1, NucleotideSequence seq2,
int offset1, int length1, int offset2, int length2,
int width, int stopPenalty) {
"""
Alignment which identifies what is the highly similar part of the both sequences.
<p/>
<p>Alignment is done in the way that beginning of second sequences is aligned to beginning of first
sequence.</p>
<p/>
<p>Alignment terminates when score in banded alignment matrix reaches {@code stopPenalty} value.</p>
<p/>
<p>In other words, only left part of second sequence is to be aligned</p>
@param scoring scoring system
@param seq1 first sequence
@param seq2 second sequence
@param offset1 offset in first sequence
@param length1 length of first sequence's part to be aligned
@param offset2 offset in second sequence
@param length2 length of second sequence's part to be aligned@param width
@param stopPenalty alignment score value in banded alignment matrix at which alignment terminates
@return object which contains positions at which alignment terminated and array of mutations
"""
try {
int minLength = Math.min(length1, length2) + width + 1;
length1 = Math.min(length1, minLength);
length2 = Math.min(length2, minLength);
MutationsBuilder<NucleotideSequence> mutations = new MutationsBuilder<>(NucleotideSequence.ALPHABET);
BandedSemiLocalResult result = alignSemiLocalLeft0(scoring, seq1, seq2,
offset1, length1, offset2, length2, width, stopPenalty, mutations, AlignmentCache.get());
return new Alignment<>(seq1, mutations.createAndDestroy(),
new Range(offset1, result.sequence1Stop + 1), new Range(offset2, result.sequence2Stop + 1),
result.score);
} finally {
AlignmentCache.release();
}
} | java | public static Alignment<NucleotideSequence> alignSemiLocalLeft(LinearGapAlignmentScoring scoring, NucleotideSequence seq1, NucleotideSequence seq2,
int offset1, int length1, int offset2, int length2,
int width, int stopPenalty) {
try {
int minLength = Math.min(length1, length2) + width + 1;
length1 = Math.min(length1, minLength);
length2 = Math.min(length2, minLength);
MutationsBuilder<NucleotideSequence> mutations = new MutationsBuilder<>(NucleotideSequence.ALPHABET);
BandedSemiLocalResult result = alignSemiLocalLeft0(scoring, seq1, seq2,
offset1, length1, offset2, length2, width, stopPenalty, mutations, AlignmentCache.get());
return new Alignment<>(seq1, mutations.createAndDestroy(),
new Range(offset1, result.sequence1Stop + 1), new Range(offset2, result.sequence2Stop + 1),
result.score);
} finally {
AlignmentCache.release();
}
} | [
"public",
"static",
"Alignment",
"<",
"NucleotideSequence",
">",
"alignSemiLocalLeft",
"(",
"LinearGapAlignmentScoring",
"scoring",
",",
"NucleotideSequence",
"seq1",
",",
"NucleotideSequence",
"seq2",
",",
"int",
"offset1",
",",
"int",
"length1",
",",
"int",
"offset2... | Alignment which identifies what is the highly similar part of the both sequences.
<p/>
<p>Alignment is done in the way that beginning of second sequences is aligned to beginning of first
sequence.</p>
<p/>
<p>Alignment terminates when score in banded alignment matrix reaches {@code stopPenalty} value.</p>
<p/>
<p>In other words, only left part of second sequence is to be aligned</p>
@param scoring scoring system
@param seq1 first sequence
@param seq2 second sequence
@param offset1 offset in first sequence
@param length1 length of first sequence's part to be aligned
@param offset2 offset in second sequence
@param length2 length of second sequence's part to be aligned@param width
@param stopPenalty alignment score value in banded alignment matrix at which alignment terminates
@return object which contains positions at which alignment terminated and array of mutations | [
"Alignment",
"which",
"identifies",
"what",
"is",
"the",
"highly",
"similar",
"part",
"of",
"the",
"both",
"sequences",
".",
"<p",
"/",
">",
"<p",
">",
"Alignment",
"is",
"done",
"in",
"the",
"way",
"that",
"beginning",
"of",
"second",
"sequences",
"is",
... | train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/alignment/BandedLinearAligner.java#L665-L681 |
redlink-gmbh/redlink-java-sdk | src/main/java/io/redlink/sdk/impl/analysis/model/RDFStructureParser.java | RDFStructureParser.parseDocumentSentiment | public Double parseDocumentSentiment() throws EnhancementParserException {
"""
Returns the Sentiment for the processed document or <code>null</code> if
no Sentiment analysis component is configured for the analysis.
@return the Document Sentiment or <code>null</code> if not available
@throws EnhancementParserException
"""
RepositoryConnection conn = null;
try {
conn = repository.getConnection();
conn.begin();
String documentSentimentQuery = "PREFIX fise: <http://fise.iks-project.eu/ontology/> \n"
+ "PREFIX dct: <http://purl.org/dc/terms/> \n"
+ "SELECT ?docSent { \n"
+ " ?annotation a fise:TextAnnotation . \n"
+ " ?annotation dct:type fise:DocumentSentiment . \n"
+ " ?annotation fise:sentiment ?docSent \n"
+ "}";
TupleQueryResult documentSentimentAnnotationsResults = conn.prepareTupleQuery(
QueryLanguage.SPARQL, documentSentimentQuery).evaluate();
final Double docSentiment;
if(documentSentimentAnnotationsResults.hasNext()) {
BindingSet result = documentSentimentAnnotationsResults.next();
docSentiment = Double.parseDouble(result.getBinding("docSent").getValue().stringValue());
} else {
docSentiment = null;
}
documentSentimentAnnotationsResults.close();
conn.commit();
return docSentiment;
} catch (QueryEvaluationException | MalformedQueryException e) {
throw new EnhancementParserException("Error parsing text annotations", e);
} catch (RepositoryException e) {
throw new EnhancementParserException("Error querying the RDF Model obtained as Service Response", e);
} finally {
if(conn != null){
try {
conn.close();
} catch (RepositoryException e) {/*ignore*/}
}
}
} | java | public Double parseDocumentSentiment() throws EnhancementParserException {
RepositoryConnection conn = null;
try {
conn = repository.getConnection();
conn.begin();
String documentSentimentQuery = "PREFIX fise: <http://fise.iks-project.eu/ontology/> \n"
+ "PREFIX dct: <http://purl.org/dc/terms/> \n"
+ "SELECT ?docSent { \n"
+ " ?annotation a fise:TextAnnotation . \n"
+ " ?annotation dct:type fise:DocumentSentiment . \n"
+ " ?annotation fise:sentiment ?docSent \n"
+ "}";
TupleQueryResult documentSentimentAnnotationsResults = conn.prepareTupleQuery(
QueryLanguage.SPARQL, documentSentimentQuery).evaluate();
final Double docSentiment;
if(documentSentimentAnnotationsResults.hasNext()) {
BindingSet result = documentSentimentAnnotationsResults.next();
docSentiment = Double.parseDouble(result.getBinding("docSent").getValue().stringValue());
} else {
docSentiment = null;
}
documentSentimentAnnotationsResults.close();
conn.commit();
return docSentiment;
} catch (QueryEvaluationException | MalformedQueryException e) {
throw new EnhancementParserException("Error parsing text annotations", e);
} catch (RepositoryException e) {
throw new EnhancementParserException("Error querying the RDF Model obtained as Service Response", e);
} finally {
if(conn != null){
try {
conn.close();
} catch (RepositoryException e) {/*ignore*/}
}
}
} | [
"public",
"Double",
"parseDocumentSentiment",
"(",
")",
"throws",
"EnhancementParserException",
"{",
"RepositoryConnection",
"conn",
"=",
"null",
";",
"try",
"{",
"conn",
"=",
"repository",
".",
"getConnection",
"(",
")",
";",
"conn",
".",
"begin",
"(",
")",
"... | Returns the Sentiment for the processed document or <code>null</code> if
no Sentiment analysis component is configured for the analysis.
@return the Document Sentiment or <code>null</code> if not available
@throws EnhancementParserException | [
"Returns",
"the",
"Sentiment",
"for",
"the",
"processed",
"document",
"or",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"no",
"Sentiment",
"analysis",
"component",
"is",
"configured",
"for",
"the",
"analysis",
"."
] | train | https://github.com/redlink-gmbh/redlink-java-sdk/blob/c412ff11bd80da52ade09f2483ab29cdbff5a28a/src/main/java/io/redlink/sdk/impl/analysis/model/RDFStructureParser.java#L878-L914 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java | DoublesSketch.downSample | public DoublesSketch downSample(final DoublesSketch srcSketch, final int smallerK,
final WritableMemory dstMem) {
"""
From an source sketch, create a new sketch that must have a smaller value of K.
The original sketch is not modified.
@param srcSketch the sourcing sketch
@param smallerK the new sketch's value of K that must be smaller than this value of K.
It is required that this.getK() = smallerK * 2^(nonnegative integer).
@param dstMem the destination Memory. It must not overlap the Memory of this sketch.
If null, a heap sketch will be returned, otherwise it will be off-heap.
@return the new sketch.
"""
return downSampleInternal(srcSketch, smallerK, dstMem);
} | java | public DoublesSketch downSample(final DoublesSketch srcSketch, final int smallerK,
final WritableMemory dstMem) {
return downSampleInternal(srcSketch, smallerK, dstMem);
} | [
"public",
"DoublesSketch",
"downSample",
"(",
"final",
"DoublesSketch",
"srcSketch",
",",
"final",
"int",
"smallerK",
",",
"final",
"WritableMemory",
"dstMem",
")",
"{",
"return",
"downSampleInternal",
"(",
"srcSketch",
",",
"smallerK",
",",
"dstMem",
")",
";",
... | From an source sketch, create a new sketch that must have a smaller value of K.
The original sketch is not modified.
@param srcSketch the sourcing sketch
@param smallerK the new sketch's value of K that must be smaller than this value of K.
It is required that this.getK() = smallerK * 2^(nonnegative integer).
@param dstMem the destination Memory. It must not overlap the Memory of this sketch.
If null, a heap sketch will be returned, otherwise it will be off-heap.
@return the new sketch. | [
"From",
"an",
"source",
"sketch",
"create",
"a",
"new",
"sketch",
"that",
"must",
"have",
"a",
"smaller",
"value",
"of",
"K",
".",
"The",
"original",
"sketch",
"is",
"not",
"modified",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java#L601-L604 |
atomix/catalyst | serializer/src/main/java/io/atomix/catalyst/serializer/SerializerRegistry.java | SerializerRegistry.registerAbstract | public SerializerRegistry registerAbstract(Class<?> abstractType, TypeSerializerFactory factory) {
"""
Registers the given class as an abstract serializer for the given abstract type.
@param abstractType The abstract type for which to register the serializer.
@param factory The serializer factory.
@return The serializer registry.
"""
return registerAbstract(abstractType, calculateTypeId(abstractType), factory);
} | java | public SerializerRegistry registerAbstract(Class<?> abstractType, TypeSerializerFactory factory) {
return registerAbstract(abstractType, calculateTypeId(abstractType), factory);
} | [
"public",
"SerializerRegistry",
"registerAbstract",
"(",
"Class",
"<",
"?",
">",
"abstractType",
",",
"TypeSerializerFactory",
"factory",
")",
"{",
"return",
"registerAbstract",
"(",
"abstractType",
",",
"calculateTypeId",
"(",
"abstractType",
")",
",",
"factory",
"... | Registers the given class as an abstract serializer for the given abstract type.
@param abstractType The abstract type for which to register the serializer.
@param factory The serializer factory.
@return The serializer registry. | [
"Registers",
"the",
"given",
"class",
"as",
"an",
"abstract",
"serializer",
"for",
"the",
"given",
"abstract",
"type",
"."
] | train | https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/serializer/src/main/java/io/atomix/catalyst/serializer/SerializerRegistry.java#L219-L221 |
JDBDT/jdbdt | src/main/java/org/jdbdt/DBSetup.java | DBSetup.deleteAll | static int deleteAll(CallInfo callInfo, Table table, String where, Object... args) {
"""
Delete all data based on a WHERE clause.
@param callInfo Call info.
@param table Table.
@param where <code>WHERE</code> clause.
@param args Optional arguments for <code>WHERE</code> clause.
@return The number of deleted rows.
"""
final DB db = table.getDB();
return db.access(callInfo, () -> {
table.setDirtyStatus(true);
String sql =
DELETE_FROM_ + table.getName() +
WHERE_ + where;
db.logSetup(callInfo, sql);
try (WrappedStatement ws = db.compile(sql)) {
PreparedStatement deleteStmt = ws.getStatement();
if (args != null && args.length > 0) {
for (int i=0; i < args.length; i++) {
deleteStmt.setObject(i + 1, args[i]);
}
}
return deleteStmt.executeUpdate();
}
});
} | java | static int deleteAll(CallInfo callInfo, Table table, String where, Object... args) {
final DB db = table.getDB();
return db.access(callInfo, () -> {
table.setDirtyStatus(true);
String sql =
DELETE_FROM_ + table.getName() +
WHERE_ + where;
db.logSetup(callInfo, sql);
try (WrappedStatement ws = db.compile(sql)) {
PreparedStatement deleteStmt = ws.getStatement();
if (args != null && args.length > 0) {
for (int i=0; i < args.length; i++) {
deleteStmt.setObject(i + 1, args[i]);
}
}
return deleteStmt.executeUpdate();
}
});
} | [
"static",
"int",
"deleteAll",
"(",
"CallInfo",
"callInfo",
",",
"Table",
"table",
",",
"String",
"where",
",",
"Object",
"...",
"args",
")",
"{",
"final",
"DB",
"db",
"=",
"table",
".",
"getDB",
"(",
")",
";",
"return",
"db",
".",
"access",
"(",
"cal... | Delete all data based on a WHERE clause.
@param callInfo Call info.
@param table Table.
@param where <code>WHERE</code> clause.
@param args Optional arguments for <code>WHERE</code> clause.
@return The number of deleted rows. | [
"Delete",
"all",
"data",
"based",
"on",
"a",
"WHERE",
"clause",
"."
] | train | https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/DBSetup.java#L342-L361 |
Jasig/uPortal | uPortal-persondir/src/main/java/org/apereo/portal/RDBMUserIdentityStore.java | RDBMUserIdentityStore.getPortalUID | @Override
public int getPortalUID(IPerson person, boolean createPortalData)
throws AuthorizationException {
"""
Get the portal user ID for this person object.
@param person The {@link IPerson} for whom a UID is requested
@param createPortalData indicating whether to try to create all uPortal data for this user
from template prototype
@return uPortalUID number or -1 if unable to create user.
@throws AuthorizationException if createPortalData is false and no user is found or if a sql
error is encountered
"""
int uid;
String username = (String) person.getAttribute(IPerson.USERNAME);
// only synchronize a non-guest request.
if (PersonFactory.getGuestUsernames().contains(username)) {
uid = __getPortalUID(person, createPortalData);
} else {
synchronized (getLock(person)) {
uid = __getPortalUID(person, createPortalData);
}
}
return uid;
} | java | @Override
public int getPortalUID(IPerson person, boolean createPortalData)
throws AuthorizationException {
int uid;
String username = (String) person.getAttribute(IPerson.USERNAME);
// only synchronize a non-guest request.
if (PersonFactory.getGuestUsernames().contains(username)) {
uid = __getPortalUID(person, createPortalData);
} else {
synchronized (getLock(person)) {
uid = __getPortalUID(person, createPortalData);
}
}
return uid;
} | [
"@",
"Override",
"public",
"int",
"getPortalUID",
"(",
"IPerson",
"person",
",",
"boolean",
"createPortalData",
")",
"throws",
"AuthorizationException",
"{",
"int",
"uid",
";",
"String",
"username",
"=",
"(",
"String",
")",
"person",
".",
"getAttribute",
"(",
... | Get the portal user ID for this person object.
@param person The {@link IPerson} for whom a UID is requested
@param createPortalData indicating whether to try to create all uPortal data for this user
from template prototype
@return uPortalUID number or -1 if unable to create user.
@throws AuthorizationException if createPortalData is false and no user is found or if a sql
error is encountered | [
"Get",
"the",
"portal",
"user",
"ID",
"for",
"this",
"person",
"object",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-persondir/src/main/java/org/apereo/portal/RDBMUserIdentityStore.java#L268-L283 |
alkacon/opencms-core | src/org/opencms/xml/containerpage/CmsFormatterConfiguration.java | CmsFormatterConfiguration.getDisplayFormatters | public List<I_CmsFormatterBean> getDisplayFormatters() {
"""
Returns the available display formatters.<p>
@return the display formatters
"""
if (m_displayFormatters == null) {
List<I_CmsFormatterBean> formatters = new ArrayList<I_CmsFormatterBean>(
Collections2.filter(m_allFormatters, new IsDisplay()));
if (formatters.size() > 1) {
Collections.sort(formatters, new Comparator<I_CmsFormatterBean>() {
public int compare(I_CmsFormatterBean o1, I_CmsFormatterBean o2) {
return o1.getRank() == o2.getRank() ? 0 : (o1.getRank() < o2.getRank() ? -1 : 1);
}
});
}
m_displayFormatters = Collections.unmodifiableList(formatters);
}
return m_displayFormatters;
} | java | public List<I_CmsFormatterBean> getDisplayFormatters() {
if (m_displayFormatters == null) {
List<I_CmsFormatterBean> formatters = new ArrayList<I_CmsFormatterBean>(
Collections2.filter(m_allFormatters, new IsDisplay()));
if (formatters.size() > 1) {
Collections.sort(formatters, new Comparator<I_CmsFormatterBean>() {
public int compare(I_CmsFormatterBean o1, I_CmsFormatterBean o2) {
return o1.getRank() == o2.getRank() ? 0 : (o1.getRank() < o2.getRank() ? -1 : 1);
}
});
}
m_displayFormatters = Collections.unmodifiableList(formatters);
}
return m_displayFormatters;
} | [
"public",
"List",
"<",
"I_CmsFormatterBean",
">",
"getDisplayFormatters",
"(",
")",
"{",
"if",
"(",
"m_displayFormatters",
"==",
"null",
")",
"{",
"List",
"<",
"I_CmsFormatterBean",
">",
"formatters",
"=",
"new",
"ArrayList",
"<",
"I_CmsFormatterBean",
">",
"(",... | Returns the available display formatters.<p>
@return the display formatters | [
"Returns",
"the",
"available",
"display",
"formatters",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsFormatterConfiguration.java#L369-L386 |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java | Http2ConnectionHandler.closeStreamRemote | @Override
public void closeStreamRemote(Http2Stream stream, ChannelFuture future) {
"""
Closes the remote side of the given stream. If this causes the stream to be closed, adds a
hook to close the channel after the given future completes.
@param stream the stream to be half closed.
@param future If closing, the future after which to close the channel.
"""
switch (stream.state()) {
case HALF_CLOSED_REMOTE:
case OPEN:
stream.closeRemoteSide();
break;
default:
closeStream(stream, future);
break;
}
} | java | @Override
public void closeStreamRemote(Http2Stream stream, ChannelFuture future) {
switch (stream.state()) {
case HALF_CLOSED_REMOTE:
case OPEN:
stream.closeRemoteSide();
break;
default:
closeStream(stream, future);
break;
}
} | [
"@",
"Override",
"public",
"void",
"closeStreamRemote",
"(",
"Http2Stream",
"stream",
",",
"ChannelFuture",
"future",
")",
"{",
"switch",
"(",
"stream",
".",
"state",
"(",
")",
")",
"{",
"case",
"HALF_CLOSED_REMOTE",
":",
"case",
"OPEN",
":",
"stream",
".",
... | Closes the remote side of the given stream. If this causes the stream to be closed, adds a
hook to close the channel after the given future completes.
@param stream the stream to be half closed.
@param future If closing, the future after which to close the channel. | [
"Closes",
"the",
"remote",
"side",
"of",
"the",
"given",
"stream",
".",
"If",
"this",
"causes",
"the",
"stream",
"to",
"be",
"closed",
"adds",
"a",
"hook",
"to",
"close",
"the",
"channel",
"after",
"the",
"given",
"future",
"completes",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L590-L601 |
mikepenz/MaterialDrawer | library/src/main/java/com/mikepenz/materialdrawer/DrawerUtils.java | DrawerUtils.getDrawerItem | public static IDrawerItem getDrawerItem(List<IDrawerItem> drawerItems, long identifier) {
"""
gets the drawerItem with the specific identifier from a drawerItem list
@param drawerItems
@param identifier
@return
"""
if (identifier != -1) {
for (IDrawerItem drawerItem : drawerItems) {
if (drawerItem.getIdentifier() == identifier) {
return drawerItem;
}
}
}
return null;
} | java | public static IDrawerItem getDrawerItem(List<IDrawerItem> drawerItems, long identifier) {
if (identifier != -1) {
for (IDrawerItem drawerItem : drawerItems) {
if (drawerItem.getIdentifier() == identifier) {
return drawerItem;
}
}
}
return null;
} | [
"public",
"static",
"IDrawerItem",
"getDrawerItem",
"(",
"List",
"<",
"IDrawerItem",
">",
"drawerItems",
",",
"long",
"identifier",
")",
"{",
"if",
"(",
"identifier",
"!=",
"-",
"1",
")",
"{",
"for",
"(",
"IDrawerItem",
"drawerItem",
":",
"drawerItems",
")",... | gets the drawerItem with the specific identifier from a drawerItem list
@param drawerItems
@param identifier
@return | [
"gets",
"the",
"drawerItem",
"with",
"the",
"specific",
"identifier",
"from",
"a",
"drawerItem",
"list"
] | train | https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/DrawerUtils.java#L125-L134 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.getAnnotations | private List<Content> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak) {
"""
Return the string representations of the annotation types for
the given doc.
@param indent the number of extra spaces to indent the annotations.
@param descList the array of {@link AnnotationDesc}.
@param linkBreak if true, add new line between each member value.
@return an array of strings representing the annotations being
documented.
"""
return getAnnotations(indent, descList, linkBreak, true);
} | java | private List<Content> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak) {
return getAnnotations(indent, descList, linkBreak, true);
} | [
"private",
"List",
"<",
"Content",
">",
"getAnnotations",
"(",
"int",
"indent",
",",
"AnnotationDesc",
"[",
"]",
"descList",
",",
"boolean",
"linkBreak",
")",
"{",
"return",
"getAnnotations",
"(",
"indent",
",",
"descList",
",",
"linkBreak",
",",
"true",
")"... | Return the string representations of the annotation types for
the given doc.
@param indent the number of extra spaces to indent the annotations.
@param descList the array of {@link AnnotationDesc}.
@param linkBreak if true, add new line between each member value.
@return an array of strings representing the annotations being
documented. | [
"Return",
"the",
"string",
"representations",
"of",
"the",
"annotation",
"types",
"for",
"the",
"given",
"doc",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1927-L1929 |
motown-io/motown | ocpi/ocpi-identification-authorization-plugin/src/main/java/io/motown/ocpi/service/AuthorizationService.java | AuthorizationService.updateLastSynchronizationDate | private void updateLastSynchronizationDate(Date syncDate, Integer subscriptionId) {
"""
Updates the last sync date for the passed subscription.
@param syncDate date of the last sync
@param subscriptionId the subscription that should be updated
"""
TokenSyncDate tokenSyncDate = ocpiRepository.getTokenSyncDate(subscriptionId);
if (tokenSyncDate == null) {
tokenSyncDate = new TokenSyncDate();
tokenSyncDate.setSubscriptionId(subscriptionId);
}
tokenSyncDate.setSyncDate(syncDate);
ocpiRepository.insertOrUpdate(tokenSyncDate);
} | java | private void updateLastSynchronizationDate(Date syncDate, Integer subscriptionId) {
TokenSyncDate tokenSyncDate = ocpiRepository.getTokenSyncDate(subscriptionId);
if (tokenSyncDate == null) {
tokenSyncDate = new TokenSyncDate();
tokenSyncDate.setSubscriptionId(subscriptionId);
}
tokenSyncDate.setSyncDate(syncDate);
ocpiRepository.insertOrUpdate(tokenSyncDate);
} | [
"private",
"void",
"updateLastSynchronizationDate",
"(",
"Date",
"syncDate",
",",
"Integer",
"subscriptionId",
")",
"{",
"TokenSyncDate",
"tokenSyncDate",
"=",
"ocpiRepository",
".",
"getTokenSyncDate",
"(",
"subscriptionId",
")",
";",
"if",
"(",
"tokenSyncDate",
"=="... | Updates the last sync date for the passed subscription.
@param syncDate date of the last sync
@param subscriptionId the subscription that should be updated | [
"Updates",
"the",
"last",
"sync",
"date",
"for",
"the",
"passed",
"subscription",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/ocpi/ocpi-identification-authorization-plugin/src/main/java/io/motown/ocpi/service/AuthorizationService.java#L109-L119 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java | PyGenerator._generate | protected void _generate(SarlInterface interf, IExtraLanguageGeneratorContext context) {
"""
Generate the given object.
@param interf the interface.
@param context the context.
"""
final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(interf);
final PyAppendable appendable = createAppendable(jvmType, context);
if (generateTypeDeclaration(
this.qualifiedNameProvider.getFullyQualifiedName(interf).toString(),
interf.getName(), true, interf.getExtends(),
getTypeBuilder().getDocumentation(interf),
true,
interf.getMembers(), appendable, context, null)) {
final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(interf);
writeFile(name, appendable, context);
}
} | java | protected void _generate(SarlInterface interf, IExtraLanguageGeneratorContext context) {
final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(interf);
final PyAppendable appendable = createAppendable(jvmType, context);
if (generateTypeDeclaration(
this.qualifiedNameProvider.getFullyQualifiedName(interf).toString(),
interf.getName(), true, interf.getExtends(),
getTypeBuilder().getDocumentation(interf),
true,
interf.getMembers(), appendable, context, null)) {
final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(interf);
writeFile(name, appendable, context);
}
} | [
"protected",
"void",
"_generate",
"(",
"SarlInterface",
"interf",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"final",
"JvmDeclaredType",
"jvmType",
"=",
"getJvmModelAssociations",
"(",
")",
".",
"getInferredType",
"(",
"interf",
")",
";",
"final",
"... | Generate the given object.
@param interf the interface.
@param context the context. | [
"Generate",
"the",
"given",
"object",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L692-L704 |
ralscha/wampspring | src/main/java/ch/rasc/wampspring/config/WampSession.java | WampSession.setAttribute | public void setAttribute(String name, Object value) {
"""
Set the value with the given name replacing an existing value (if any).
@param name the name of the attribute
@param value the value for the attribute
"""
this.webSocketSession.getAttributes().put(name, value);
} | java | public void setAttribute(String name, Object value) {
this.webSocketSession.getAttributes().put(name, value);
} | [
"public",
"void",
"setAttribute",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"this",
".",
"webSocketSession",
".",
"getAttributes",
"(",
")",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Set the value with the given name replacing an existing value (if any).
@param name the name of the attribute
@param value the value for the attribute | [
"Set",
"the",
"value",
"with",
"the",
"given",
"name",
"replacing",
"an",
"existing",
"value",
"(",
"if",
"any",
")",
"."
] | train | https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/config/WampSession.java#L76-L78 |
structr/structr | structr-ui/src/main/java/org/structr/web/common/FileHelper.java | FileHelper.getFileByAbsolutePath | public static AbstractFile getFileByAbsolutePath(final SecurityContext securityContext, final String absolutePath) {
"""
Find a file by its absolute ancestor path.
File may not be hidden or deleted.
@param securityContext
@param absolutePath
@return file
"""
try {
return StructrApp.getInstance(securityContext).nodeQuery(AbstractFile.class).and(StructrApp.key(AbstractFile.class, "path"), absolutePath).getFirst();
} catch (FrameworkException ex) {
ex.printStackTrace();
logger.warn("File not found: {}", absolutePath);
}
return null;
} | java | public static AbstractFile getFileByAbsolutePath(final SecurityContext securityContext, final String absolutePath) {
try {
return StructrApp.getInstance(securityContext).nodeQuery(AbstractFile.class).and(StructrApp.key(AbstractFile.class, "path"), absolutePath).getFirst();
} catch (FrameworkException ex) {
ex.printStackTrace();
logger.warn("File not found: {}", absolutePath);
}
return null;
} | [
"public",
"static",
"AbstractFile",
"getFileByAbsolutePath",
"(",
"final",
"SecurityContext",
"securityContext",
",",
"final",
"String",
"absolutePath",
")",
"{",
"try",
"{",
"return",
"StructrApp",
".",
"getInstance",
"(",
"securityContext",
")",
".",
"nodeQuery",
... | Find a file by its absolute ancestor path.
File may not be hidden or deleted.
@param securityContext
@param absolutePath
@return file | [
"Find",
"a",
"file",
"by",
"its",
"absolute",
"ancestor",
"path",
"."
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/common/FileHelper.java#L635-L647 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/CopyLastHandler.java | CopyLastHandler.moveSourceToDest | public int moveSourceToDest(boolean bDisplayOption, int iMoveMode) {
"""
Do the physical move operation.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay).
"""
String string = this.getSourceField().getString(); // Get this string
int i = string.lastIndexOf(' ');
if (i != -1)
string = string.substring(i+1);
return m_fldDest.setData(string, bDisplayOption, iMoveMode);
} | java | public int moveSourceToDest(boolean bDisplayOption, int iMoveMode)
{
String string = this.getSourceField().getString(); // Get this string
int i = string.lastIndexOf(' ');
if (i != -1)
string = string.substring(i+1);
return m_fldDest.setData(string, bDisplayOption, iMoveMode);
} | [
"public",
"int",
"moveSourceToDest",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"String",
"string",
"=",
"this",
".",
"getSourceField",
"(",
")",
".",
"getString",
"(",
")",
";",
"// Get this string",
"int",
"i",
"=",
"string",
".",... | Do the physical move operation.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay). | [
"Do",
"the",
"physical",
"move",
"operation",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/CopyLastHandler.java#L80-L87 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/persist/LockFile.java | LockFile.openRAF | private final void openRAF()
throws LockFile.UnexpectedFileNotFoundException,
LockFile.FileSecurityException {
"""
Opens (constructs) this object's {@link #raf RandomAccessFile}. <p>
@throws UnexpectedFileNotFoundException if a
<tt>FileNotFoundException</tt> is thrown in reponse to
constructing the <tt>RandomAccessFile</tt> object.
@throws FileSecurityException if a required system property value cannot
be accessed, or if a Java security manager exists and its
<tt>{@link java.lang.SecurityManager#checkRead}</tt> method
denies read access to the file; or if its <tt>{@link
java.lang.SecurityManager#checkWrite(java.lang.String)}</tt>
method denies write access to the file
"""
try {
raf = new RandomAccessFile(file, "rw");
} catch (SecurityException ex) {
throw new FileSecurityException(this, "openRAF", ex);
} catch (FileNotFoundException ex) {
throw new UnexpectedFileNotFoundException(this, "openRAF", ex);
}
} | java | private final void openRAF()
throws LockFile.UnexpectedFileNotFoundException,
LockFile.FileSecurityException {
try {
raf = new RandomAccessFile(file, "rw");
} catch (SecurityException ex) {
throw new FileSecurityException(this, "openRAF", ex);
} catch (FileNotFoundException ex) {
throw new UnexpectedFileNotFoundException(this, "openRAF", ex);
}
} | [
"private",
"final",
"void",
"openRAF",
"(",
")",
"throws",
"LockFile",
".",
"UnexpectedFileNotFoundException",
",",
"LockFile",
".",
"FileSecurityException",
"{",
"try",
"{",
"raf",
"=",
"new",
"RandomAccessFile",
"(",
"file",
",",
"\"rw\"",
")",
";",
"}",
"ca... | Opens (constructs) this object's {@link #raf RandomAccessFile}. <p>
@throws UnexpectedFileNotFoundException if a
<tt>FileNotFoundException</tt> is thrown in reponse to
constructing the <tt>RandomAccessFile</tt> object.
@throws FileSecurityException if a required system property value cannot
be accessed, or if a Java security manager exists and its
<tt>{@link java.lang.SecurityManager#checkRead}</tt> method
denies read access to the file; or if its <tt>{@link
java.lang.SecurityManager#checkWrite(java.lang.String)}</tt>
method denies write access to the file | [
"Opens",
"(",
"constructs",
")",
"this",
"object",
"s",
"{",
"@link",
"#raf",
"RandomAccessFile",
"}",
".",
"<p",
">"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/persist/LockFile.java#L1049-L1060 |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java | AppClassLoader.findResources | @Override
@Trivial
public CompositeEnumeration<URL> findResources(String name) throws IOException {
"""
Search order:
1. This classloader.
2. The common library classloaders.
Note: For finding directories in jar: scheme URLs we need to add a / to the end of the name passed
and strip the / from the resulting URL. We also need to handle duplicates.
We need to use a resourceMap with string keys as hashcode and equals of URL are expensive.
"""
Object token = ThreadIdentityManager.runAsServer();
try {
CompositeEnumeration<URL> enumerations = new CompositeEnumeration<URL>(super.findResources(name));
return findResourcesCommonLibraryClassLoaders(name, enumerations);
} finally {
ThreadIdentityManager.reset(token);
}
} | java | @Override
@Trivial
public CompositeEnumeration<URL> findResources(String name) throws IOException {
Object token = ThreadIdentityManager.runAsServer();
try {
CompositeEnumeration<URL> enumerations = new CompositeEnumeration<URL>(super.findResources(name));
return findResourcesCommonLibraryClassLoaders(name, enumerations);
} finally {
ThreadIdentityManager.reset(token);
}
} | [
"@",
"Override",
"@",
"Trivial",
"public",
"CompositeEnumeration",
"<",
"URL",
">",
"findResources",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"Object",
"token",
"=",
"ThreadIdentityManager",
".",
"runAsServer",
"(",
")",
";",
"try",
"{",
"Comp... | Search order:
1. This classloader.
2. The common library classloaders.
Note: For finding directories in jar: scheme URLs we need to add a / to the end of the name passed
and strip the / from the resulting URL. We also need to handle duplicates.
We need to use a resourceMap with string keys as hashcode and equals of URL are expensive. | [
"Search",
"order",
":",
"1",
".",
"This",
"classloader",
".",
"2",
".",
"The",
"common",
"library",
"classloaders",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java#L199-L209 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java | RecommendedElasticPoolsInner.listMetrics | public List<RecommendedElasticPoolMetricInner> listMetrics(String resourceGroupName, String serverName, String recommendedElasticPoolName) {
"""
Returns recommented elastic pool metrics.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved.
@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 List<RecommendedElasticPoolMetricInner> object if successful.
"""
return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).toBlocking().single().body();
} | java | public List<RecommendedElasticPoolMetricInner> listMetrics(String resourceGroupName, String serverName, String recommendedElasticPoolName) {
return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).toBlocking().single().body();
} | [
"public",
"List",
"<",
"RecommendedElasticPoolMetricInner",
">",
"listMetrics",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"recommendedElasticPoolName",
")",
"{",
"return",
"listMetricsWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Returns recommented elastic pool metrics.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved.
@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 List<RecommendedElasticPoolMetricInner> object if successful. | [
"Returns",
"recommented",
"elastic",
"pool",
"metrics",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java#L264-L266 |
bmwcarit/joynr | java/messaging/messaging-common/src/main/java/io/joynr/messaging/util/Utilities.java | Utilities.getSessionEncodedUrl | public static String getSessionEncodedUrl(String url, String sessionIdName, String sessionId) {
"""
Returns a url with the session encoded into the URL
@param url the URL to encode
@param sessionIdName the name of the session ID, e.g. jsessionid
@param sessionId the session ID
@return URL with the session encoded into the URL
"""
return url + getSessionIdSubstring(sessionIdName) + sessionId;
} | java | public static String getSessionEncodedUrl(String url, String sessionIdName, String sessionId) {
return url + getSessionIdSubstring(sessionIdName) + sessionId;
} | [
"public",
"static",
"String",
"getSessionEncodedUrl",
"(",
"String",
"url",
",",
"String",
"sessionIdName",
",",
"String",
"sessionId",
")",
"{",
"return",
"url",
"+",
"getSessionIdSubstring",
"(",
"sessionIdName",
")",
"+",
"sessionId",
";",
"}"
] | Returns a url with the session encoded into the URL
@param url the URL to encode
@param sessionIdName the name of the session ID, e.g. jsessionid
@param sessionId the session ID
@return URL with the session encoded into the URL | [
"Returns",
"a",
"url",
"with",
"the",
"session",
"encoded",
"into",
"the",
"URL"
] | train | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/messaging-common/src/main/java/io/joynr/messaging/util/Utilities.java#L181-L183 |
wcm-io-caravan/caravan-hal | docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/GenerateHalDocsJsonMojo.java | GenerateHalDocsJsonMojo.getStaticFieldValue | @SuppressWarnings("unchecked")
private <T> T getStaticFieldValue(JavaClass javaClazz, JavaField javaField, ClassLoader compileClassLoader, Class<T> fieldType) {
"""
Get constant field value.
@param javaClazz QDox class
@param javaField QDox field
@param compileClassLoader Classloader for compile dependencies
@param fieldType Field type
@return Value
"""
try {
Class<?> clazz = compileClassLoader.loadClass(javaClazz.getFullyQualifiedName());
Field field = clazz.getField(javaField.getName());
return (T)field.get(fieldType);
}
catch (ClassNotFoundException | NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) {
throw new RuntimeException("Unable to get contanst value of field '" + javaClazz.getName() + "#" + javaField.getName() + ":\n" + ex.getMessage(), ex);
}
} | java | @SuppressWarnings("unchecked")
private <T> T getStaticFieldValue(JavaClass javaClazz, JavaField javaField, ClassLoader compileClassLoader, Class<T> fieldType) {
try {
Class<?> clazz = compileClassLoader.loadClass(javaClazz.getFullyQualifiedName());
Field field = clazz.getField(javaField.getName());
return (T)field.get(fieldType);
}
catch (ClassNotFoundException | NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) {
throw new RuntimeException("Unable to get contanst value of field '" + javaClazz.getName() + "#" + javaField.getName() + ":\n" + ex.getMessage(), ex);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
">",
"T",
"getStaticFieldValue",
"(",
"JavaClass",
"javaClazz",
",",
"JavaField",
"javaField",
",",
"ClassLoader",
"compileClassLoader",
",",
"Class",
"<",
"T",
">",
"fieldType",
")",
"{",
... | Get constant field value.
@param javaClazz QDox class
@param javaField QDox field
@param compileClassLoader Classloader for compile dependencies
@param fieldType Field type
@return Value | [
"Get",
"constant",
"field",
"value",
"."
] | train | https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/GenerateHalDocsJsonMojo.java#L329-L339 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java | FSDirectory.addBlock | Block addBlock(String path, INode[] inodes, Block block) throws IOException {
"""
Add a block to the file. Returns a reference to the added block.
"""
waitForReady();
writeLock();
try {
INodeFile fileNode = (INodeFile) inodes[inodes.length-1];
INode.enforceRegularStorageINode(fileNode,
"addBlock only works for regular file, not " + path);
// check quota limits and updated space consumed
updateCount(inodes, inodes.length-1, 0,
fileNode.getPreferredBlockSize()*fileNode.getReplication(), true);
// associate the new list of blocks with this file
BlockInfo blockInfo =
getFSNamesystem().blocksMap.addINode(block, fileNode,
fileNode.getReplication());
fileNode.getStorage().addBlock(blockInfo);
if (NameNode.stateChangeLog.isDebugEnabled()) {
NameNode.stateChangeLog.debug("DIR* FSDirectory.addFile: "
+ path + " with " + block
+ " block is added to the in-memory "
+ "file system");
}
} finally {
writeUnlock();
}
return block;
} | java | Block addBlock(String path, INode[] inodes, Block block) throws IOException {
waitForReady();
writeLock();
try {
INodeFile fileNode = (INodeFile) inodes[inodes.length-1];
INode.enforceRegularStorageINode(fileNode,
"addBlock only works for regular file, not " + path);
// check quota limits and updated space consumed
updateCount(inodes, inodes.length-1, 0,
fileNode.getPreferredBlockSize()*fileNode.getReplication(), true);
// associate the new list of blocks with this file
BlockInfo blockInfo =
getFSNamesystem().blocksMap.addINode(block, fileNode,
fileNode.getReplication());
fileNode.getStorage().addBlock(blockInfo);
if (NameNode.stateChangeLog.isDebugEnabled()) {
NameNode.stateChangeLog.debug("DIR* FSDirectory.addFile: "
+ path + " with " + block
+ " block is added to the in-memory "
+ "file system");
}
} finally {
writeUnlock();
}
return block;
} | [
"Block",
"addBlock",
"(",
"String",
"path",
",",
"INode",
"[",
"]",
"inodes",
",",
"Block",
"block",
")",
"throws",
"IOException",
"{",
"waitForReady",
"(",
")",
";",
"writeLock",
"(",
")",
";",
"try",
"{",
"INodeFile",
"fileNode",
"=",
"(",
"INodeFile",... | Add a block to the file. Returns a reference to the added block. | [
"Add",
"a",
"block",
"to",
"the",
"file",
".",
"Returns",
"a",
"reference",
"to",
"the",
"added",
"block",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L444-L473 |
grails/grails-core | grails-core/src/main/groovy/grails/util/AbstractTypeConvertingMap.java | AbstractTypeConvertingMap.getDate | public Date getDate(String name, String format) {
"""
Obtains a date from the parameter using the given format
@param name The name
@param format The format
@return The date or null
"""
Object value = get(name);
if (value instanceof Date) {
return (Date)value;
}
if (value != null) {
try {
return new SimpleDateFormat(format).parse(value.toString());
} catch (ParseException e) {
// ignore
}
}
return null;
} | java | public Date getDate(String name, String format) {
Object value = get(name);
if (value instanceof Date) {
return (Date)value;
}
if (value != null) {
try {
return new SimpleDateFormat(format).parse(value.toString());
} catch (ParseException e) {
// ignore
}
}
return null;
} | [
"public",
"Date",
"getDate",
"(",
"String",
"name",
",",
"String",
"format",
")",
"{",
"Object",
"value",
"=",
"get",
"(",
"name",
")",
";",
"if",
"(",
"value",
"instanceof",
"Date",
")",
"{",
"return",
"(",
"Date",
")",
"value",
";",
"}",
"if",
"(... | Obtains a date from the parameter using the given format
@param name The name
@param format The format
@return The date or null | [
"Obtains",
"a",
"date",
"from",
"the",
"parameter",
"using",
"the",
"given",
"format"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/AbstractTypeConvertingMap.java#L365-L379 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/view/ApptentiveNestedScrollView.java | ApptentiveNestedScrollView.smoothScrollBy | public final void smoothScrollBy(int dx, int dy) {
"""
Like {@link View#scrollBy}, but scroll smoothly instead of immediately.
@param dx the number of pixels to scroll by on the X axis
@param dy the number of pixels to scroll by on the Y axis
"""
if (getChildCount() == 0) {
// Nothing to do.
return;
}
long duration = AnimationUtils.currentAnimationTimeMillis() - mLastScroll;
if (duration > ANIMATED_SCROLL_GAP) {
final int height = getHeight() - getPaddingBottom() - getPaddingTop();
final int bottom = getChildAt(0).getHeight();
final int maxY = Math.max(0, bottom - height);
final int scrollY = getScrollY();
dy = Math.max(0, Math.min(scrollY + dy, maxY)) - scrollY;
mScroller.startScroll(getScrollX(), scrollY, 0, dy);
ViewCompat.postInvalidateOnAnimation(this);
} else {
if (!mScroller.isFinished()) {
mScroller.abortAnimation();
}
scrollBy(dx, dy);
}
mLastScroll = AnimationUtils.currentAnimationTimeMillis();
} | java | public final void smoothScrollBy(int dx, int dy) {
if (getChildCount() == 0) {
// Nothing to do.
return;
}
long duration = AnimationUtils.currentAnimationTimeMillis() - mLastScroll;
if (duration > ANIMATED_SCROLL_GAP) {
final int height = getHeight() - getPaddingBottom() - getPaddingTop();
final int bottom = getChildAt(0).getHeight();
final int maxY = Math.max(0, bottom - height);
final int scrollY = getScrollY();
dy = Math.max(0, Math.min(scrollY + dy, maxY)) - scrollY;
mScroller.startScroll(getScrollX(), scrollY, 0, dy);
ViewCompat.postInvalidateOnAnimation(this);
} else {
if (!mScroller.isFinished()) {
mScroller.abortAnimation();
}
scrollBy(dx, dy);
}
mLastScroll = AnimationUtils.currentAnimationTimeMillis();
} | [
"public",
"final",
"void",
"smoothScrollBy",
"(",
"int",
"dx",
",",
"int",
"dy",
")",
"{",
"if",
"(",
"getChildCount",
"(",
")",
"==",
"0",
")",
"{",
"// Nothing to do.",
"return",
";",
"}",
"long",
"duration",
"=",
"AnimationUtils",
".",
"currentAnimation... | Like {@link View#scrollBy}, but scroll smoothly instead of immediately.
@param dx the number of pixels to scroll by on the X axis
@param dy the number of pixels to scroll by on the Y axis | [
"Like",
"{",
"@link",
"View#scrollBy",
"}",
"but",
"scroll",
"smoothly",
"instead",
"of",
"immediately",
"."
] | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/view/ApptentiveNestedScrollView.java#L1303-L1325 |
biojava/biojava | biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaWriterHelper.java | FastaWriterHelper.writeNucleotideSequence | public static void writeNucleotideSequence(OutputStream outputStream, Collection<DNASequence> dnaSequences) throws Exception {
"""
Write a collection of NucleotideSequences to a file
@param outputStream
@param dnaSequences
@throws Exception
"""
FastaWriter<DNASequence, NucleotideCompound> fastaWriter = new FastaWriter<DNASequence, NucleotideCompound>(
outputStream, dnaSequences,
new GenericFastaHeaderFormat<DNASequence, NucleotideCompound>());
fastaWriter.process();
} | java | public static void writeNucleotideSequence(OutputStream outputStream, Collection<DNASequence> dnaSequences) throws Exception {
FastaWriter<DNASequence, NucleotideCompound> fastaWriter = new FastaWriter<DNASequence, NucleotideCompound>(
outputStream, dnaSequences,
new GenericFastaHeaderFormat<DNASequence, NucleotideCompound>());
fastaWriter.process();
} | [
"public",
"static",
"void",
"writeNucleotideSequence",
"(",
"OutputStream",
"outputStream",
",",
"Collection",
"<",
"DNASequence",
">",
"dnaSequences",
")",
"throws",
"Exception",
"{",
"FastaWriter",
"<",
"DNASequence",
",",
"NucleotideCompound",
">",
"fastaWriter",
"... | Write a collection of NucleotideSequences to a file
@param outputStream
@param dnaSequences
@throws Exception | [
"Write",
"a",
"collection",
"of",
"NucleotideSequences",
"to",
"a",
"file"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaWriterHelper.java#L134-L140 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java | IPAddressSection.isNetworkSection | protected boolean isNetworkSection(int networkPrefixLength, boolean withPrefixLength) {
"""
this method is basically checking whether we can return "this" for getNetworkSection
"""
int segmentCount = getSegmentCount();
if(segmentCount == 0) {
return true;
}
int bitsPerSegment = getBitsPerSegment();
int prefixedSegmentIndex = getNetworkSegmentIndex(networkPrefixLength, getBytesPerSegment(), bitsPerSegment);
if(prefixedSegmentIndex + 1 < segmentCount) {
return false; //not the right number of segments
}
//the segment count matches, now compare the prefixed segment
int segPrefLength = getPrefixedSegmentPrefixLength(bitsPerSegment, networkPrefixLength, prefixedSegmentIndex);
return !getSegment(segmentCount - 1).isNetworkChangedByPrefix(segPrefLength, withPrefixLength);
} | java | protected boolean isNetworkSection(int networkPrefixLength, boolean withPrefixLength) {
int segmentCount = getSegmentCount();
if(segmentCount == 0) {
return true;
}
int bitsPerSegment = getBitsPerSegment();
int prefixedSegmentIndex = getNetworkSegmentIndex(networkPrefixLength, getBytesPerSegment(), bitsPerSegment);
if(prefixedSegmentIndex + 1 < segmentCount) {
return false; //not the right number of segments
}
//the segment count matches, now compare the prefixed segment
int segPrefLength = getPrefixedSegmentPrefixLength(bitsPerSegment, networkPrefixLength, prefixedSegmentIndex);
return !getSegment(segmentCount - 1).isNetworkChangedByPrefix(segPrefLength, withPrefixLength);
} | [
"protected",
"boolean",
"isNetworkSection",
"(",
"int",
"networkPrefixLength",
",",
"boolean",
"withPrefixLength",
")",
"{",
"int",
"segmentCount",
"=",
"getSegmentCount",
"(",
")",
";",
"if",
"(",
"segmentCount",
"==",
"0",
")",
"{",
"return",
"true",
";",
"}... | this method is basically checking whether we can return "this" for getNetworkSection | [
"this",
"method",
"is",
"basically",
"checking",
"whether",
"we",
"can",
"return",
"this",
"for",
"getNetworkSection"
] | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java#L258-L271 |
wisdom-framework/wisdom | core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java | CryptoServiceSingleton.decryptAES | @Override
public String decryptAES(String value, String privateKey) {
"""
Decrypt a String with the standard AES encryption (using the ECB mode). Private key must have a length of 16
bytes.
@param value An hexadecimal encrypted string
@param privateKey The key used to encrypt
@return The decrypted String
"""
try {
byte[] raw = privateKey.getBytes(UTF_8);
SecretKeySpec skeySpec = new SecretKeySpec(raw, AES_ECB_ALGORITHM);
Cipher cipher = Cipher.getInstance(AES_ECB_ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, skeySpec);
return new String(cipher.doFinal(decodeHex(value)), Charsets.UTF_8);
} catch (NoSuchAlgorithmException | NoSuchPaddingException |
InvalidKeyException | BadPaddingException | IllegalBlockSizeException e) {
throw new IllegalStateException(e);
}
} | java | @Override
public String decryptAES(String value, String privateKey) {
try {
byte[] raw = privateKey.getBytes(UTF_8);
SecretKeySpec skeySpec = new SecretKeySpec(raw, AES_ECB_ALGORITHM);
Cipher cipher = Cipher.getInstance(AES_ECB_ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, skeySpec);
return new String(cipher.doFinal(decodeHex(value)), Charsets.UTF_8);
} catch (NoSuchAlgorithmException | NoSuchPaddingException |
InvalidKeyException | BadPaddingException | IllegalBlockSizeException e) {
throw new IllegalStateException(e);
}
} | [
"@",
"Override",
"public",
"String",
"decryptAES",
"(",
"String",
"value",
",",
"String",
"privateKey",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"raw",
"=",
"privateKey",
".",
"getBytes",
"(",
"UTF_8",
")",
";",
"SecretKeySpec",
"skeySpec",
"=",
"new",
"S... | Decrypt a String with the standard AES encryption (using the ECB mode). Private key must have a length of 16
bytes.
@param value An hexadecimal encrypted string
@param privateKey The key used to encrypt
@return The decrypted String | [
"Decrypt",
"a",
"String",
"with",
"the",
"standard",
"AES",
"encryption",
"(",
"using",
"the",
"ECB",
"mode",
")",
".",
"Private",
"key",
"must",
"have",
"a",
"length",
"of",
"16",
"bytes",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java#L320-L332 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.setSymbolAndCode | private static DecimalFormatSymbols setSymbolAndCode(DecimalFormat numberFormat, String sign) {
"""
Set both the currency symbol and international code of the underlying {@link
java.text.NumberFormat} object to the value of the given {@link String}.
This method is invoked in the process of parsing, not formatting.
Only invoke this from code synchronized on the value of the first argument, and don't
forget to put the symbols back otherwise equals(), hashCode() and immutability will
break.
"""
return setSymbolAndCode(numberFormat, sign, sign);
} | java | private static DecimalFormatSymbols setSymbolAndCode(DecimalFormat numberFormat, String sign) {
return setSymbolAndCode(numberFormat, sign, sign);
} | [
"private",
"static",
"DecimalFormatSymbols",
"setSymbolAndCode",
"(",
"DecimalFormat",
"numberFormat",
",",
"String",
"sign",
")",
"{",
"return",
"setSymbolAndCode",
"(",
"numberFormat",
",",
"sign",
",",
"sign",
")",
";",
"}"
] | Set both the currency symbol and international code of the underlying {@link
java.text.NumberFormat} object to the value of the given {@link String}.
This method is invoked in the process of parsing, not formatting.
Only invoke this from code synchronized on the value of the first argument, and don't
forget to put the symbols back otherwise equals(), hashCode() and immutability will
break. | [
"Set",
"both",
"the",
"currency",
"symbol",
"and",
"international",
"code",
"of",
"the",
"underlying",
"{",
"@link",
"java",
".",
"text",
".",
"NumberFormat",
"}",
"object",
"to",
"the",
"value",
"of",
"the",
"given",
"{",
"@link",
"String",
"}",
".",
"T... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L1353-L1355 |
lucee/Lucee | core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java | XMLConfigAdmin.hasRHExtensions | public static RHExtension hasRHExtensions(ConfigImpl config, ExtensionDefintion ed) throws PageException, SAXException, IOException {
"""
returns the version if the extension is available
@param config
@param id
@return
@throws PageException
@throws IOException
@throws SAXException
"""
XMLConfigAdmin admin = new XMLConfigAdmin(config, null);
return admin._hasRHExtensions(config, ed);
} | java | public static RHExtension hasRHExtensions(ConfigImpl config, ExtensionDefintion ed) throws PageException, SAXException, IOException {
XMLConfigAdmin admin = new XMLConfigAdmin(config, null);
return admin._hasRHExtensions(config, ed);
} | [
"public",
"static",
"RHExtension",
"hasRHExtensions",
"(",
"ConfigImpl",
"config",
",",
"ExtensionDefintion",
"ed",
")",
"throws",
"PageException",
",",
"SAXException",
",",
"IOException",
"{",
"XMLConfigAdmin",
"admin",
"=",
"new",
"XMLConfigAdmin",
"(",
"config",
... | returns the version if the extension is available
@param config
@param id
@return
@throws PageException
@throws IOException
@throws SAXException | [
"returns",
"the",
"version",
"if",
"the",
"extension",
"is",
"available"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java#L6277-L6280 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java | JavaScriptUtils.getUnencodedJavaScriptHtmlCookieString | public String getUnencodedJavaScriptHtmlCookieString(String name, String value, Map<String, String> cookieProperties) {
"""
Creates and returns a JavaScript line that sets a cookie with the specified name, value, and cookie properties. For
example, a cookie name of "test", value of "123", and properties "HttpOnly" and "path=/" would return
{@code document.cookie="test=123; HttpOnly; path=/;";}. Note: The specified properties will be HTML-encoded but the cookie
name and value will not.
"""
return createJavaScriptHtmlCookieString(name, value, cookieProperties, false);
} | java | public String getUnencodedJavaScriptHtmlCookieString(String name, String value, Map<String, String> cookieProperties) {
return createJavaScriptHtmlCookieString(name, value, cookieProperties, false);
} | [
"public",
"String",
"getUnencodedJavaScriptHtmlCookieString",
"(",
"String",
"name",
",",
"String",
"value",
",",
"Map",
"<",
"String",
",",
"String",
">",
"cookieProperties",
")",
"{",
"return",
"createJavaScriptHtmlCookieString",
"(",
"name",
",",
"value",
",",
... | Creates and returns a JavaScript line that sets a cookie with the specified name, value, and cookie properties. For
example, a cookie name of "test", value of "123", and properties "HttpOnly" and "path=/" would return
{@code document.cookie="test=123; HttpOnly; path=/;";}. Note: The specified properties will be HTML-encoded but the cookie
name and value will not. | [
"Creates",
"and",
"returns",
"a",
"JavaScript",
"line",
"that",
"sets",
"a",
"cookie",
"with",
"the",
"specified",
"name",
"value",
"and",
"cookie",
"properties",
".",
"For",
"example",
"a",
"cookie",
"name",
"of",
"test",
"value",
"of",
"123",
"and",
"pro... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java#L67-L69 |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/interceptor/LoggingClientInterceptor.java | LoggingClientInterceptor.getRequestContent | private String getRequestContent(HttpRequest request, String body) {
"""
Builds request content string from request and body.
@param request
@param body
@return
"""
StringBuilder builder = new StringBuilder();
builder.append(request.getMethod());
builder.append(" ");
builder.append(request.getURI());
builder.append(NEWLINE);
appendHeaders(request.getHeaders(), builder);
builder.append(NEWLINE);
builder.append(body);
return builder.toString();
} | java | private String getRequestContent(HttpRequest request, String body) {
StringBuilder builder = new StringBuilder();
builder.append(request.getMethod());
builder.append(" ");
builder.append(request.getURI());
builder.append(NEWLINE);
appendHeaders(request.getHeaders(), builder);
builder.append(NEWLINE);
builder.append(body);
return builder.toString();
} | [
"private",
"String",
"getRequestContent",
"(",
"HttpRequest",
"request",
",",
"String",
"body",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"request",
".",
"getMethod",
"(",
")",
")",
";",
... | Builds request content string from request and body.
@param request
@param body
@return | [
"Builds",
"request",
"content",
"string",
"from",
"request",
"and",
"body",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/interceptor/LoggingClientInterceptor.java#L99-L113 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java | ST_GeometryShadow.computeShadow | public static Geometry computeShadow(Geometry geometry, double azimuth, double altitude, double height, boolean doUnion) {
"""
Compute the shadow footprint based on
@param geometry input geometry
@param azimuth of the sun in radians
@param altitude of the sun in radians
@param height of the geometry
@param doUnion unified or not the polygon shadows
@return
"""
if (geometry == null) {
return null;
}
if (height <= 0) {
throw new IllegalArgumentException("The height of the geometry must be greater than 0.");
}
//Compute the shadow offset
double[] shadowOffSet = shadowOffset(azimuth, altitude, height);
if (geometry instanceof Polygon) {
return shadowPolygon((Polygon) geometry, shadowOffSet, geometry.getFactory(), doUnion);
} else if (geometry instanceof LineString) {
return shadowLine((LineString) geometry, shadowOffSet, geometry.getFactory(), doUnion);
} else if (geometry instanceof Point) {
return shadowPoint((Point) geometry, shadowOffSet, geometry.getFactory());
} else {
throw new IllegalArgumentException("The shadow function supports only single geometry POINT, LINE or POLYGON.");
}
} | java | public static Geometry computeShadow(Geometry geometry, double azimuth, double altitude, double height, boolean doUnion) {
if (geometry == null) {
return null;
}
if (height <= 0) {
throw new IllegalArgumentException("The height of the geometry must be greater than 0.");
}
//Compute the shadow offset
double[] shadowOffSet = shadowOffset(azimuth, altitude, height);
if (geometry instanceof Polygon) {
return shadowPolygon((Polygon) geometry, shadowOffSet, geometry.getFactory(), doUnion);
} else if (geometry instanceof LineString) {
return shadowLine((LineString) geometry, shadowOffSet, geometry.getFactory(), doUnion);
} else if (geometry instanceof Point) {
return shadowPoint((Point) geometry, shadowOffSet, geometry.getFactory());
} else {
throw new IllegalArgumentException("The shadow function supports only single geometry POINT, LINE or POLYGON.");
}
} | [
"public",
"static",
"Geometry",
"computeShadow",
"(",
"Geometry",
"geometry",
",",
"double",
"azimuth",
",",
"double",
"altitude",
",",
"double",
"height",
",",
"boolean",
"doUnion",
")",
"{",
"if",
"(",
"geometry",
"==",
"null",
")",
"{",
"return",
"null",
... | Compute the shadow footprint based on
@param geometry input geometry
@param azimuth of the sun in radians
@param altitude of the sun in radians
@param height of the geometry
@param doUnion unified or not the polygon shadows
@return | [
"Compute",
"the",
"shadow",
"footprint",
"based",
"on"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java#L105-L123 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/parser/lexparser/AbstractTreebankParserParams.java | AbstractTreebankParserParams.parsevalObjectify | public static Collection<Constituent> parsevalObjectify(Tree t, TreeTransformer collinizer, boolean labelConstituents) {
"""
Takes a Tree and a collinizer and returns a Collection of {@link Constituent}s for
PARSEVAL evaluation. Some notes on this particular parseval:
<ul>
<li> It is character-based, which allows it to be used on segmentation/parsing combination evaluation.
<li> whether it gives you labeled or unlabeled bracketings depends on the value of the <code>labelConstituents</code>
parameter
</ul>
(Note that I haven't checked this rigorously yet with the PARSEVAL definition
-- Roger.)
"""
Collection<Constituent> spans = new ArrayList<Constituent>();
Tree t1 = collinizer.transformTree(t);
if (t1 == null) {
return spans;
}
for (Tree node : t1) {
if (node.isLeaf() || node.isPreTerminal() || (node != t1 && node.parent(t1) == null)) {
continue;
}
int leftEdge = t1.leftCharEdge(node);
int rightEdge = t1.rightCharEdge(node);
if(labelConstituents)
spans.add(new LabeledConstituent(leftEdge, rightEdge, node.label()));
else
spans.add(new SimpleConstituent(leftEdge, rightEdge));
}
return spans;
} | java | public static Collection<Constituent> parsevalObjectify(Tree t, TreeTransformer collinizer, boolean labelConstituents) {
Collection<Constituent> spans = new ArrayList<Constituent>();
Tree t1 = collinizer.transformTree(t);
if (t1 == null) {
return spans;
}
for (Tree node : t1) {
if (node.isLeaf() || node.isPreTerminal() || (node != t1 && node.parent(t1) == null)) {
continue;
}
int leftEdge = t1.leftCharEdge(node);
int rightEdge = t1.rightCharEdge(node);
if(labelConstituents)
spans.add(new LabeledConstituent(leftEdge, rightEdge, node.label()));
else
spans.add(new SimpleConstituent(leftEdge, rightEdge));
}
return spans;
} | [
"public",
"static",
"Collection",
"<",
"Constituent",
">",
"parsevalObjectify",
"(",
"Tree",
"t",
",",
"TreeTransformer",
"collinizer",
",",
"boolean",
"labelConstituents",
")",
"{",
"Collection",
"<",
"Constituent",
">",
"spans",
"=",
"new",
"ArrayList",
"<",
"... | Takes a Tree and a collinizer and returns a Collection of {@link Constituent}s for
PARSEVAL evaluation. Some notes on this particular parseval:
<ul>
<li> It is character-based, which allows it to be used on segmentation/parsing combination evaluation.
<li> whether it gives you labeled or unlabeled bracketings depends on the value of the <code>labelConstituents</code>
parameter
</ul>
(Note that I haven't checked this rigorously yet with the PARSEVAL definition
-- Roger.) | [
"Takes",
"a",
"Tree",
"and",
"a",
"collinizer",
"and",
"returns",
"a",
"Collection",
"of",
"{",
"@link",
"Constituent",
"}",
"s",
"for",
"PARSEVAL",
"evaluation",
".",
"Some",
"notes",
"on",
"this",
"particular",
"parseval",
":",
"<ul",
">",
"<li",
">",
... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/AbstractTreebankParserParams.java#L320-L338 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.retractMessage | public ResponseWrapper retractMessage(String username, long msgId)
throws APIConnectionException, APIRequestException {
"""
retract message
消息撤回
@param username 用户名
@param msgId message id
@return No Content, Error Code:
855001 out of retract message time, the effective time is within 3 minutes after sending message
855003 the retract message is not exist
855004 the message had been retracted
@throws APIConnectionException connect exception
@throws APIRequestException request exception
"""
return _messageClient.retractMessage(username, msgId);
} | java | public ResponseWrapper retractMessage(String username, long msgId)
throws APIConnectionException, APIRequestException {
return _messageClient.retractMessage(username, msgId);
} | [
"public",
"ResponseWrapper",
"retractMessage",
"(",
"String",
"username",
",",
"long",
"msgId",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"_messageClient",
".",
"retractMessage",
"(",
"username",
",",
"msgId",
")",
";",
"}"
... | retract message
消息撤回
@param username 用户名
@param msgId message id
@return No Content, Error Code:
855001 out of retract message time, the effective time is within 3 minutes after sending message
855003 the retract message is not exist
855004 the message had been retracted
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"retract",
"message",
"消息撤回"
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L551-L554 |
Waikato/moa | moa/src/main/java/moa/clusterers/kmeanspm/Metric.java | Metric.distanceWithDivisionSquared | public static double distanceWithDivisionSquared(double[] pointA, double dA) {
"""
Calculates the squared Euclidean length of a point divided by a scalar.
@param pointA
point
@param dA
scalar
@return the squared Euclidean length
"""
double distance = 0.0;
for (int i = 0; i < pointA.length; i++) {
double d = pointA[i] / dA;
distance += d * d;
}
return distance;
} | java | public static double distanceWithDivisionSquared(double[] pointA, double dA) {
double distance = 0.0;
for (int i = 0; i < pointA.length; i++) {
double d = pointA[i] / dA;
distance += d * d;
}
return distance;
} | [
"public",
"static",
"double",
"distanceWithDivisionSquared",
"(",
"double",
"[",
"]",
"pointA",
",",
"double",
"dA",
")",
"{",
"double",
"distance",
"=",
"0.0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pointA",
".",
"length",
";",
"i",
... | Calculates the squared Euclidean length of a point divided by a scalar.
@param pointA
point
@param dA
scalar
@return the squared Euclidean length | [
"Calculates",
"the",
"squared",
"Euclidean",
"length",
"of",
"a",
"point",
"divided",
"by",
"a",
"scalar",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/Metric.java#L134-L141 |
baratine/baratine | framework/src/main/java/com/caucho/v5/json/ser/JsonSerializerBase.java | JsonSerializerBase.writeTop | @Override
public void writeTop(JsonWriterImpl out, T value) {
"""
/*
@Override
public void write(JsonWriter out,
String fieldName,
T value)
{
throw new UnsupportedOperationException(getClass().getName());
}
"""
out.writeStartArray();
write(out, value);
out.writeEndArray();
} | java | @Override
public void writeTop(JsonWriterImpl out, T value)
{
out.writeStartArray();
write(out, value);
out.writeEndArray();
} | [
"@",
"Override",
"public",
"void",
"writeTop",
"(",
"JsonWriterImpl",
"out",
",",
"T",
"value",
")",
"{",
"out",
".",
"writeStartArray",
"(",
")",
";",
"write",
"(",
"out",
",",
"value",
")",
";",
"out",
".",
"writeEndArray",
"(",
")",
";",
"}"
] | /*
@Override
public void write(JsonWriter out,
String fieldName,
T value)
{
throw new UnsupportedOperationException(getClass().getName());
} | [
"/",
"*"
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/json/ser/JsonSerializerBase.java#L42-L48 |
geomajas/geomajas-project-server | plugin/layer-hibernate/hibernate/src/main/java/org/geomajas/layer/hibernate/HsqlGeometryUserType.java | HsqlGeometryUserType.conv2DBGeometry | public Object conv2DBGeometry(Geometry jtsGeom, Connection connection) {
"""
Converts a JTS <code>Geometry</code> to a native geometry object.
@param jtsGeom
JTS Geometry to convert
@param connection
the current database connection
@return native database geometry object corresponding to jtsGeom.
"""
int srid = jtsGeom.getSRID();
WKTWriter writer = new WKTWriter();
String wkt = writer.write(jtsGeom);
return srid + "|" + wkt;
} | java | public Object conv2DBGeometry(Geometry jtsGeom, Connection connection) {
int srid = jtsGeom.getSRID();
WKTWriter writer = new WKTWriter();
String wkt = writer.write(jtsGeom);
return srid + "|" + wkt;
} | [
"public",
"Object",
"conv2DBGeometry",
"(",
"Geometry",
"jtsGeom",
",",
"Connection",
"connection",
")",
"{",
"int",
"srid",
"=",
"jtsGeom",
".",
"getSRID",
"(",
")",
";",
"WKTWriter",
"writer",
"=",
"new",
"WKTWriter",
"(",
")",
";",
"String",
"wkt",
"=",... | Converts a JTS <code>Geometry</code> to a native geometry object.
@param jtsGeom
JTS Geometry to convert
@param connection
the current database connection
@return native database geometry object corresponding to jtsGeom. | [
"Converts",
"a",
"JTS",
"<code",
">",
"Geometry<",
"/",
"code",
">",
"to",
"a",
"native",
"geometry",
"object",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/layer-hibernate/hibernate/src/main/java/org/geomajas/layer/hibernate/HsqlGeometryUserType.java#L71-L76 |
wcm-io/wcm-io-sling | commons/src/main/java/io/wcm/sling/commons/resource/ResourceType.java | ResourceType.makeRelative | @Deprecated
public static @NotNull String makeRelative(@NotNull String resourceType) {
"""
Makes the given resource type relative by stripping off an /apps/ or /libs/ prefix.
In case the given resource type does not start with any of these prefixes it is returned unmodified.
This method does not take the real configured search paths into account, but in case of AEM usually only /apps/ and
/libs/ are used.
@param resourceType The resource type to make relative.
@return Relative resource type
@deprecated Please use {@link #makeRelative(String, ResourceResolver)} instead.
"""
if (StringUtils.startsWith(resourceType, APPS_PREFIX)) {
return resourceType.substring(APPS_PREFIX.length());
}
else if (StringUtils.startsWith(resourceType, LIBS_PREFIX)) {
return resourceType.substring(LIBS_PREFIX.length());
}
return resourceType;
} | java | @Deprecated
public static @NotNull String makeRelative(@NotNull String resourceType) {
if (StringUtils.startsWith(resourceType, APPS_PREFIX)) {
return resourceType.substring(APPS_PREFIX.length());
}
else if (StringUtils.startsWith(resourceType, LIBS_PREFIX)) {
return resourceType.substring(LIBS_PREFIX.length());
}
return resourceType;
} | [
"@",
"Deprecated",
"public",
"static",
"@",
"NotNull",
"String",
"makeRelative",
"(",
"@",
"NotNull",
"String",
"resourceType",
")",
"{",
"if",
"(",
"StringUtils",
".",
"startsWith",
"(",
"resourceType",
",",
"APPS_PREFIX",
")",
")",
"{",
"return",
"resourceTy... | Makes the given resource type relative by stripping off an /apps/ or /libs/ prefix.
In case the given resource type does not start with any of these prefixes it is returned unmodified.
This method does not take the real configured search paths into account, but in case of AEM usually only /apps/ and
/libs/ are used.
@param resourceType The resource type to make relative.
@return Relative resource type
@deprecated Please use {@link #makeRelative(String, ResourceResolver)} instead. | [
"Makes",
"the",
"given",
"resource",
"type",
"relative",
"by",
"stripping",
"off",
"an",
"/",
"apps",
"/",
"or",
"/",
"libs",
"/",
"prefix",
".",
"In",
"case",
"the",
"given",
"resource",
"type",
"does",
"not",
"start",
"with",
"any",
"of",
"these",
"p... | train | https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/resource/ResourceType.java#L118-L127 |
stephanenicolas/toothpick | toothpick-runtime/src/main/java/toothpick/ScopeImpl.java | ScopeImpl.installBoundProvider | private <T> InternalProviderImpl<? extends T> installBoundProvider(Class<T> clazz, String bindingName,
InternalProviderImpl<? extends T> internalProvider, boolean isTestProvider) {
"""
Install the provider of the class {@code clazz} and name {@code bindingName}
in the current scope.
@param clazz the class for which to install the scoped provider.
@param bindingName the name, possibly {@code null}, for which to install the scoped provider.
@param internalProvider the internal provider to install.
@param isTestProvider whether or not is a test provider, installed through a Test Module that should override
existing providers for the same class-bindingname.
@param <T> the type of {@code clazz}.
"""
return installInternalProvider(clazz, bindingName, internalProvider, true, isTestProvider);
} | java | private <T> InternalProviderImpl<? extends T> installBoundProvider(Class<T> clazz, String bindingName,
InternalProviderImpl<? extends T> internalProvider, boolean isTestProvider) {
return installInternalProvider(clazz, bindingName, internalProvider, true, isTestProvider);
} | [
"private",
"<",
"T",
">",
"InternalProviderImpl",
"<",
"?",
"extends",
"T",
">",
"installBoundProvider",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"bindingName",
",",
"InternalProviderImpl",
"<",
"?",
"extends",
"T",
">",
"internalProvider",
",",
... | Install the provider of the class {@code clazz} and name {@code bindingName}
in the current scope.
@param clazz the class for which to install the scoped provider.
@param bindingName the name, possibly {@code null}, for which to install the scoped provider.
@param internalProvider the internal provider to install.
@param isTestProvider whether or not is a test provider, installed through a Test Module that should override
existing providers for the same class-bindingname.
@param <T> the type of {@code clazz}. | [
"Install",
"the",
"provider",
"of",
"the",
"class",
"{",
"@code",
"clazz",
"}",
"and",
"name",
"{",
"@code",
"bindingName",
"}",
"in",
"the",
"current",
"scope",
"."
] | train | https://github.com/stephanenicolas/toothpick/blob/54476ca9a5fa48809c15a46e43e38db9ed7e1a75/toothpick-runtime/src/main/java/toothpick/ScopeImpl.java#L445-L448 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.