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
|
---|---|---|---|---|---|---|---|---|---|---|
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpUtil.java | HttpUtil.downloadFile | public static long downloadFile(String url, File destFile, int timeout, StreamProgress streamProgress) {
"""
下载远程文件
@param url 请求的url
@param destFile 目标文件或目录,当为目录时,取URL中的文件名,取不到使用编码后的URL做为文件名
@param timeout 超时,单位毫秒,-1表示默认超时
@param streamProgress 进度条
@return 文件大小
@since 4.0.4
"""
if (StrUtil.isBlank(url)) {
throw new NullPointerException("[url] is null!");
}
if (null == destFile) {
throw new NullPointerException("[destFile] is null!");
}
final HttpResponse response = HttpRequest.get(url).timeout(timeout).executeAsync();
if (false == response.isOk()) {
throw new HttpException("Server response error with status code: [{}]", response.getStatus());
}
return response.writeBody(destFile, streamProgress);
} | java | public static long downloadFile(String url, File destFile, int timeout, StreamProgress streamProgress) {
if (StrUtil.isBlank(url)) {
throw new NullPointerException("[url] is null!");
}
if (null == destFile) {
throw new NullPointerException("[destFile] is null!");
}
final HttpResponse response = HttpRequest.get(url).timeout(timeout).executeAsync();
if (false == response.isOk()) {
throw new HttpException("Server response error with status code: [{}]", response.getStatus());
}
return response.writeBody(destFile, streamProgress);
} | [
"public",
"static",
"long",
"downloadFile",
"(",
"String",
"url",
",",
"File",
"destFile",
",",
"int",
"timeout",
",",
"StreamProgress",
"streamProgress",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"url",
")",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"[url] is null!\"",
")",
";",
"}",
"if",
"(",
"null",
"==",
"destFile",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"[destFile] is null!\"",
")",
";",
"}",
"final",
"HttpResponse",
"response",
"=",
"HttpRequest",
".",
"get",
"(",
"url",
")",
".",
"timeout",
"(",
"timeout",
")",
".",
"executeAsync",
"(",
")",
";",
"if",
"(",
"false",
"==",
"response",
".",
"isOk",
"(",
")",
")",
"{",
"throw",
"new",
"HttpException",
"(",
"\"Server response error with status code: [{}]\"",
",",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"return",
"response",
".",
"writeBody",
"(",
"destFile",
",",
"streamProgress",
")",
";",
"}"
]
| 下载远程文件
@param url 请求的url
@param destFile 目标文件或目录,当为目录时,取URL中的文件名,取不到使用编码后的URL做为文件名
@param timeout 超时,单位毫秒,-1表示默认超时
@param streamProgress 进度条
@return 文件大小
@since 4.0.4 | [
"下载远程文件"
]
| train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L304-L316 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java | CmsCheckableDatePanel.generateCheckBox | private CmsCheckBox generateCheckBox(Date date, boolean checkState) {
"""
Generate a new check box with the provided date and check state.
@param date date for the check box.
@param checkState the initial check state.
@return the created check box
"""
CmsCheckBox cb = new CmsCheckBox();
cb.setText(m_dateFormat.format(date));
cb.setChecked(checkState);
cb.getElement().setPropertyObject("date", date);
return cb;
} | java | private CmsCheckBox generateCheckBox(Date date, boolean checkState) {
CmsCheckBox cb = new CmsCheckBox();
cb.setText(m_dateFormat.format(date));
cb.setChecked(checkState);
cb.getElement().setPropertyObject("date", date);
return cb;
} | [
"private",
"CmsCheckBox",
"generateCheckBox",
"(",
"Date",
"date",
",",
"boolean",
"checkState",
")",
"{",
"CmsCheckBox",
"cb",
"=",
"new",
"CmsCheckBox",
"(",
")",
";",
"cb",
".",
"setText",
"(",
"m_dateFormat",
".",
"format",
"(",
"date",
")",
")",
";",
"cb",
".",
"setChecked",
"(",
"checkState",
")",
";",
"cb",
".",
"getElement",
"(",
")",
".",
"setPropertyObject",
"(",
"\"date\"",
",",
"date",
")",
";",
"return",
"cb",
";",
"}"
]
| Generate a new check box with the provided date and check state.
@param date date for the check box.
@param checkState the initial check state.
@return the created check box | [
"Generate",
"a",
"new",
"check",
"box",
"with",
"the",
"provided",
"date",
"and",
"check",
"state",
"."
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java#L308-L316 |
google/error-prone-javac | src/jdk.jshell/share/classes/jdk/jshell/TreeDependencyScanner.java | TreeDependencyScanner.visitClass | @Override
public Void visitClass(ClassTree node, Set<String> p) {
"""
-- Differentiate declaration references from body references ---
"""
scan(node.getModifiers(), p);
scan(node.getTypeParameters(), p);
scan(node.getExtendsClause(), p);
scan(node.getImplementsClause(), p);
scan(node.getMembers(), body);
return null;
} | java | @Override
public Void visitClass(ClassTree node, Set<String> p) {
scan(node.getModifiers(), p);
scan(node.getTypeParameters(), p);
scan(node.getExtendsClause(), p);
scan(node.getImplementsClause(), p);
scan(node.getMembers(), body);
return null;
} | [
"@",
"Override",
"public",
"Void",
"visitClass",
"(",
"ClassTree",
"node",
",",
"Set",
"<",
"String",
">",
"p",
")",
"{",
"scan",
"(",
"node",
".",
"getModifiers",
"(",
")",
",",
"p",
")",
";",
"scan",
"(",
"node",
".",
"getTypeParameters",
"(",
")",
",",
"p",
")",
";",
"scan",
"(",
"node",
".",
"getExtendsClause",
"(",
")",
",",
"p",
")",
";",
"scan",
"(",
"node",
".",
"getImplementsClause",
"(",
")",
",",
"p",
")",
";",
"scan",
"(",
"node",
".",
"getMembers",
"(",
")",
",",
"body",
")",
";",
"return",
"null",
";",
"}"
]
| -- Differentiate declaration references from body references --- | [
"--",
"Differentiate",
"declaration",
"references",
"from",
"body",
"references",
"---"
]
| train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/TreeDependencyScanner.java#L68-L76 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/WxopenAPI.java | WxopenAPI.templateLibraryList | public static TemplateLibraryListResult templateLibraryList(String access_token,int offset,int count) {
"""
获取小程序模板库标题列表
@since 2.8.18
@param access_token access_token
@param offset offset和count用于分页,表示从offset开始,拉取count条记录,offset从0开始,count最大为20。
@param count offset和count用于分页,表示从offset开始,拉取count条记录,offset从0开始,count最大为20。
@return result
"""
String json = String.format("{\"offset\":%d,\"count\":%d}", offset, count);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(jsonHeader)
.setUri(BASE_URI+"/cgi-bin/wxopen/template/library/list")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.setEntity(new StringEntity(json,Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest,TemplateLibraryListResult.class);
} | java | public static TemplateLibraryListResult templateLibraryList(String access_token,int offset,int count){
String json = String.format("{\"offset\":%d,\"count\":%d}", offset, count);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(jsonHeader)
.setUri(BASE_URI+"/cgi-bin/wxopen/template/library/list")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.setEntity(new StringEntity(json,Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest,TemplateLibraryListResult.class);
} | [
"public",
"static",
"TemplateLibraryListResult",
"templateLibraryList",
"(",
"String",
"access_token",
",",
"int",
"offset",
",",
"int",
"count",
")",
"{",
"String",
"json",
"=",
"String",
".",
"format",
"(",
"\"{\\\"offset\\\":%d,\\\"count\\\":%d}\"",
",",
"offset",
",",
"count",
")",
";",
"HttpUriRequest",
"httpUriRequest",
"=",
"RequestBuilder",
".",
"post",
"(",
")",
".",
"setHeader",
"(",
"jsonHeader",
")",
".",
"setUri",
"(",
"BASE_URI",
"+",
"\"/cgi-bin/wxopen/template/library/list\"",
")",
".",
"addParameter",
"(",
"PARAM_ACCESS_TOKEN",
",",
"API",
".",
"accessToken",
"(",
"access_token",
")",
")",
".",
"setEntity",
"(",
"new",
"StringEntity",
"(",
"json",
",",
"Charset",
".",
"forName",
"(",
"\"utf-8\"",
")",
")",
")",
".",
"build",
"(",
")",
";",
"return",
"LocalHttpClient",
".",
"executeJsonResult",
"(",
"httpUriRequest",
",",
"TemplateLibraryListResult",
".",
"class",
")",
";",
"}"
]
| 获取小程序模板库标题列表
@since 2.8.18
@param access_token access_token
@param offset offset和count用于分页,表示从offset开始,拉取count条记录,offset从0开始,count最大为20。
@param count offset和count用于分页,表示从offset开始,拉取count条记录,offset从0开始,count最大为20。
@return result | [
"获取小程序模板库标题列表"
]
| train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/WxopenAPI.java#L86-L95 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.nextBigInteger | public BigInteger nextBigInteger(int radix) {
"""
Scans the next token of the input as a {@link java.math.BigInteger
BigInteger}.
<p> If the next token matches the <a
href="#Integer-regex"><i>Integer</i></a> regular expression defined
above then the token is converted into a <tt>BigInteger</tt> value as if
by removing all group separators, mapping non-ASCII digits into ASCII
digits via the {@link Character#digit Character.digit}, and passing the
resulting string to the {@link
java.math.BigInteger#BigInteger(java.lang.String)
BigInteger(String, int)} constructor with the specified radix.
@param radix the radix used to interpret the token
@return the <tt>BigInteger</tt> scanned from the input
@throws InputMismatchException
if the next token does not match the <i>Integer</i>
regular expression, or is out of range
@throws NoSuchElementException if the input is exhausted
@throws IllegalStateException if this scanner is closed
"""
// Check cached result
if ((typeCache != null) && (typeCache instanceof BigInteger)
&& this.radix == radix) {
BigInteger val = (BigInteger)typeCache;
useTypeCache();
return val;
}
setRadix(radix);
clearCaches();
// Search for next int
try {
String s = next(integerPattern());
if (matcher.group(SIMPLE_GROUP_INDEX) == null)
s = processIntegerToken(s);
return new BigInteger(s, radix);
} catch (NumberFormatException nfe) {
position = matcher.start(); // don't skip bad token
throw new InputMismatchException(nfe.getMessage());
}
} | java | public BigInteger nextBigInteger(int radix) {
// Check cached result
if ((typeCache != null) && (typeCache instanceof BigInteger)
&& this.radix == radix) {
BigInteger val = (BigInteger)typeCache;
useTypeCache();
return val;
}
setRadix(radix);
clearCaches();
// Search for next int
try {
String s = next(integerPattern());
if (matcher.group(SIMPLE_GROUP_INDEX) == null)
s = processIntegerToken(s);
return new BigInteger(s, radix);
} catch (NumberFormatException nfe) {
position = matcher.start(); // don't skip bad token
throw new InputMismatchException(nfe.getMessage());
}
} | [
"public",
"BigInteger",
"nextBigInteger",
"(",
"int",
"radix",
")",
"{",
"// Check cached result",
"if",
"(",
"(",
"typeCache",
"!=",
"null",
")",
"&&",
"(",
"typeCache",
"instanceof",
"BigInteger",
")",
"&&",
"this",
".",
"radix",
"==",
"radix",
")",
"{",
"BigInteger",
"val",
"=",
"(",
"BigInteger",
")",
"typeCache",
";",
"useTypeCache",
"(",
")",
";",
"return",
"val",
";",
"}",
"setRadix",
"(",
"radix",
")",
";",
"clearCaches",
"(",
")",
";",
"// Search for next int",
"try",
"{",
"String",
"s",
"=",
"next",
"(",
"integerPattern",
"(",
")",
")",
";",
"if",
"(",
"matcher",
".",
"group",
"(",
"SIMPLE_GROUP_INDEX",
")",
"==",
"null",
")",
"s",
"=",
"processIntegerToken",
"(",
"s",
")",
";",
"return",
"new",
"BigInteger",
"(",
"s",
",",
"radix",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"nfe",
")",
"{",
"position",
"=",
"matcher",
".",
"start",
"(",
")",
";",
"// don't skip bad token",
"throw",
"new",
"InputMismatchException",
"(",
"nfe",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
]
| Scans the next token of the input as a {@link java.math.BigInteger
BigInteger}.
<p> If the next token matches the <a
href="#Integer-regex"><i>Integer</i></a> regular expression defined
above then the token is converted into a <tt>BigInteger</tt> value as if
by removing all group separators, mapping non-ASCII digits into ASCII
digits via the {@link Character#digit Character.digit}, and passing the
resulting string to the {@link
java.math.BigInteger#BigInteger(java.lang.String)
BigInteger(String, int)} constructor with the specified radix.
@param radix the radix used to interpret the token
@return the <tt>BigInteger</tt> scanned from the input
@throws InputMismatchException
if the next token does not match the <i>Integer</i>
regular expression, or is out of range
@throws NoSuchElementException if the input is exhausted
@throws IllegalStateException if this scanner is closed | [
"Scans",
"the",
"next",
"token",
"of",
"the",
"input",
"as",
"a",
"{",
"@link",
"java",
".",
"math",
".",
"BigInteger",
"BigInteger",
"}",
"."
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L2479-L2499 |
52inc/android-52Kit | library/src/main/java/com/ftinc/kit/util/CompositeTextWatcher.java | CompositeTextWatcher.enableWatcher | public void enableWatcher(TextWatcher watcher, boolean enabled) {
"""
Enable or Disable a text watcher by reference
@param watcher The {@link TextWatcher} to enable or disable
@param enabled whether or not to enable or disable
"""
int index = mWatchers.indexOfValue(watcher);
if(index >= 0){
int key = mWatchers.keyAt(index);
mEnabledKeys.put(key, enabled);
}
} | java | public void enableWatcher(TextWatcher watcher, boolean enabled){
int index = mWatchers.indexOfValue(watcher);
if(index >= 0){
int key = mWatchers.keyAt(index);
mEnabledKeys.put(key, enabled);
}
} | [
"public",
"void",
"enableWatcher",
"(",
"TextWatcher",
"watcher",
",",
"boolean",
"enabled",
")",
"{",
"int",
"index",
"=",
"mWatchers",
".",
"indexOfValue",
"(",
"watcher",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"int",
"key",
"=",
"mWatchers",
".",
"keyAt",
"(",
"index",
")",
";",
"mEnabledKeys",
".",
"put",
"(",
"key",
",",
"enabled",
")",
";",
"}",
"}"
]
| Enable or Disable a text watcher by reference
@param watcher The {@link TextWatcher} to enable or disable
@param enabled whether or not to enable or disable | [
"Enable",
"or",
"Disable",
"a",
"text",
"watcher",
"by",
"reference"
]
| train | https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/CompositeTextWatcher.java#L130-L136 |
sporniket/core | sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java | XmlStringTools.appendTextInsideTag | public static StringBuffer appendTextInsideTag(StringBuffer buffer, String text, String tag) {
"""
Wrap a text inside a tag.
@param buffer
StringBuffer to fill
@param text
the text to wrap
@param tag
the tag to use
@return the buffer
"""
return appendTextInsideTag(buffer, text, tag, EMPTY_MAP);
} | java | public static StringBuffer appendTextInsideTag(StringBuffer buffer, String text, String tag)
{
return appendTextInsideTag(buffer, text, tag, EMPTY_MAP);
} | [
"public",
"static",
"StringBuffer",
"appendTextInsideTag",
"(",
"StringBuffer",
"buffer",
",",
"String",
"text",
",",
"String",
"tag",
")",
"{",
"return",
"appendTextInsideTag",
"(",
"buffer",
",",
"text",
",",
"tag",
",",
"EMPTY_MAP",
")",
";",
"}"
]
| Wrap a text inside a tag.
@param buffer
StringBuffer to fill
@param text
the text to wrap
@param tag
the tag to use
@return the buffer | [
"Wrap",
"a",
"text",
"inside",
"a",
"tag",
"."
]
| train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java#L386-L389 |
PunchThrough/bean-sdk-android | sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java | Bean.readScratchData | public void readScratchData(ScratchBank bank, Callback<ScratchData> callback) {
"""
Request a scratch bank data value.
@param bank the {@link com.punchthrough.bean.sdk.message.ScratchBank} for which data is
being requested
@param callback the callback for the result
"""
addCallback(BeanMessageID.BT_GET_SCRATCH, callback);
Buffer buffer = new Buffer();
buffer.writeByte(intToByte(bank.getRawValue()));
sendMessage(BeanMessageID.BT_GET_SCRATCH, buffer);
} | java | public void readScratchData(ScratchBank bank, Callback<ScratchData> callback) {
addCallback(BeanMessageID.BT_GET_SCRATCH, callback);
Buffer buffer = new Buffer();
buffer.writeByte(intToByte(bank.getRawValue()));
sendMessage(BeanMessageID.BT_GET_SCRATCH, buffer);
} | [
"public",
"void",
"readScratchData",
"(",
"ScratchBank",
"bank",
",",
"Callback",
"<",
"ScratchData",
">",
"callback",
")",
"{",
"addCallback",
"(",
"BeanMessageID",
".",
"BT_GET_SCRATCH",
",",
"callback",
")",
";",
"Buffer",
"buffer",
"=",
"new",
"Buffer",
"(",
")",
";",
"buffer",
".",
"writeByte",
"(",
"intToByte",
"(",
"bank",
".",
"getRawValue",
"(",
")",
")",
")",
";",
"sendMessage",
"(",
"BeanMessageID",
".",
"BT_GET_SCRATCH",
",",
"buffer",
")",
";",
"}"
]
| Request a scratch bank data value.
@param bank the {@link com.punchthrough.bean.sdk.message.ScratchBank} for which data is
being requested
@param callback the callback for the result | [
"Request",
"a",
"scratch",
"bank",
"data",
"value",
"."
]
| train | https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L892-L897 |
apache/flink | flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/messages/MessageSerializer.java | MessageSerializer.serializeRequest | public static <REQ extends MessageBody> ByteBuf serializeRequest(
final ByteBufAllocator alloc,
final long requestId,
final REQ request) {
"""
Serializes the request sent to the
{@link org.apache.flink.queryablestate.network.AbstractServerBase}.
@param alloc The {@link ByteBufAllocator} used to allocate the buffer to serialize the message into.
@param requestId The id of the request to which the message refers to.
@param request The request to be serialized.
@return A {@link ByteBuf} containing the serialized message.
"""
Preconditions.checkNotNull(request);
return writePayload(alloc, requestId, MessageType.REQUEST, request.serialize());
} | java | public static <REQ extends MessageBody> ByteBuf serializeRequest(
final ByteBufAllocator alloc,
final long requestId,
final REQ request) {
Preconditions.checkNotNull(request);
return writePayload(alloc, requestId, MessageType.REQUEST, request.serialize());
} | [
"public",
"static",
"<",
"REQ",
"extends",
"MessageBody",
">",
"ByteBuf",
"serializeRequest",
"(",
"final",
"ByteBufAllocator",
"alloc",
",",
"final",
"long",
"requestId",
",",
"final",
"REQ",
"request",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"request",
")",
";",
"return",
"writePayload",
"(",
"alloc",
",",
"requestId",
",",
"MessageType",
".",
"REQUEST",
",",
"request",
".",
"serialize",
"(",
")",
")",
";",
"}"
]
| Serializes the request sent to the
{@link org.apache.flink.queryablestate.network.AbstractServerBase}.
@param alloc The {@link ByteBufAllocator} used to allocate the buffer to serialize the message into.
@param requestId The id of the request to which the message refers to.
@param request The request to be serialized.
@return A {@link ByteBuf} containing the serialized message. | [
"Serializes",
"the",
"request",
"sent",
"to",
"the",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"queryablestate",
".",
"network",
".",
"AbstractServerBase",
"}",
"."
]
| train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/messages/MessageSerializer.java#L91-L97 |
aws/aws-sdk-java | aws-java-sdk-cloudwatchmetrics/src/main/java/com/amazonaws/metrics/internal/cloudwatch/ServiceMetricCollectorSupport.java | ServiceMetricCollectorSupport.bytesPerSecond | double bytesPerSecond(double byteCount, double durationNano) {
"""
Returns the number of bytes per second, given the byte count and
duration in nano seconds. Duration of zero nanosecond will be treated
as 1 nanosecond.
"""
if (byteCount < 0 || durationNano < 0)
throw new IllegalArgumentException();
if (durationNano == 0) {
durationNano = 1.0; // defend against division by zero
if (log.isDebugEnabled()) {
log.debug("Set zero to one to avoid division by zero; but should never get here!");
}
}
double bytesPerSec = (byteCount / durationNano) * NANO_PER_SEC;
if (bytesPerSec == 0) {
if (log.isDebugEnabled()) {
log.debug("zero bytes per sec. Really ?");
}
}
return bytesPerSec;
} | java | double bytesPerSecond(double byteCount, double durationNano) {
if (byteCount < 0 || durationNano < 0)
throw new IllegalArgumentException();
if (durationNano == 0) {
durationNano = 1.0; // defend against division by zero
if (log.isDebugEnabled()) {
log.debug("Set zero to one to avoid division by zero; but should never get here!");
}
}
double bytesPerSec = (byteCount / durationNano) * NANO_PER_SEC;
if (bytesPerSec == 0) {
if (log.isDebugEnabled()) {
log.debug("zero bytes per sec. Really ?");
}
}
return bytesPerSec;
} | [
"double",
"bytesPerSecond",
"(",
"double",
"byteCount",
",",
"double",
"durationNano",
")",
"{",
"if",
"(",
"byteCount",
"<",
"0",
"||",
"durationNano",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"if",
"(",
"durationNano",
"==",
"0",
")",
"{",
"durationNano",
"=",
"1.0",
";",
"// defend against division by zero",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Set zero to one to avoid division by zero; but should never get here!\"",
")",
";",
"}",
"}",
"double",
"bytesPerSec",
"=",
"(",
"byteCount",
"/",
"durationNano",
")",
"*",
"NANO_PER_SEC",
";",
"if",
"(",
"bytesPerSec",
"==",
"0",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"zero bytes per sec. Really ?\"",
")",
";",
"}",
"}",
"return",
"bytesPerSec",
";",
"}"
]
| Returns the number of bytes per second, given the byte count and
duration in nano seconds. Duration of zero nanosecond will be treated
as 1 nanosecond. | [
"Returns",
"the",
"number",
"of",
"bytes",
"per",
"second",
"given",
"the",
"byte",
"count",
"and",
"duration",
"in",
"nano",
"seconds",
".",
"Duration",
"of",
"zero",
"nanosecond",
"will",
"be",
"treated",
"as",
"1",
"nanosecond",
"."
]
| train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cloudwatchmetrics/src/main/java/com/amazonaws/metrics/internal/cloudwatch/ServiceMetricCollectorSupport.java#L71-L87 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/FragmentJoiner.java | FragmentJoiner.getDensity | private double getDensity(Atom[] ca1subset, Atom[] ca2subset ) throws StructureException {
"""
this is probably useless
@param ca1subset
@param ca2subset
@return a double
@throws StructureException
"""
Atom centroid1 = Calc.getCentroid(ca1subset);
Atom centroid2 = Calc.getCentroid(ca2subset);
// get Average distance to centroid ...
double d1 = 0;
double d2 = 0;
for ( int i = 0 ; i < ca1subset.length;i++){
double dd1 = Calc.getDistance(centroid1, ca1subset[i]);
double dd2 = Calc.getDistance(centroid2, ca2subset[i]);
d1 += dd1;
d2 += dd2;
}
double avd1 = d1 / ca1subset.length;
double avd2 = d2 / ca2subset.length;
return Math.min(avd1,avd2);
} | java | private double getDensity(Atom[] ca1subset, Atom[] ca2subset ) throws StructureException{
Atom centroid1 = Calc.getCentroid(ca1subset);
Atom centroid2 = Calc.getCentroid(ca2subset);
// get Average distance to centroid ...
double d1 = 0;
double d2 = 0;
for ( int i = 0 ; i < ca1subset.length;i++){
double dd1 = Calc.getDistance(centroid1, ca1subset[i]);
double dd2 = Calc.getDistance(centroid2, ca2subset[i]);
d1 += dd1;
d2 += dd2;
}
double avd1 = d1 / ca1subset.length;
double avd2 = d2 / ca2subset.length;
return Math.min(avd1,avd2);
} | [
"private",
"double",
"getDensity",
"(",
"Atom",
"[",
"]",
"ca1subset",
",",
"Atom",
"[",
"]",
"ca2subset",
")",
"throws",
"StructureException",
"{",
"Atom",
"centroid1",
"=",
"Calc",
".",
"getCentroid",
"(",
"ca1subset",
")",
";",
"Atom",
"centroid2",
"=",
"Calc",
".",
"getCentroid",
"(",
"ca2subset",
")",
";",
"// get Average distance to centroid ...",
"double",
"d1",
"=",
"0",
";",
"double",
"d2",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ca1subset",
".",
"length",
";",
"i",
"++",
")",
"{",
"double",
"dd1",
"=",
"Calc",
".",
"getDistance",
"(",
"centroid1",
",",
"ca1subset",
"[",
"i",
"]",
")",
";",
"double",
"dd2",
"=",
"Calc",
".",
"getDistance",
"(",
"centroid2",
",",
"ca2subset",
"[",
"i",
"]",
")",
";",
"d1",
"+=",
"dd1",
";",
"d2",
"+=",
"dd2",
";",
"}",
"double",
"avd1",
"=",
"d1",
"/",
"ca1subset",
".",
"length",
";",
"double",
"avd2",
"=",
"d2",
"/",
"ca2subset",
".",
"length",
";",
"return",
"Math",
".",
"min",
"(",
"avd1",
",",
"avd2",
")",
";",
"}"
]
| this is probably useless
@param ca1subset
@param ca2subset
@return a double
@throws StructureException | [
"this",
"is",
"probably",
"useless"
]
| train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/FragmentJoiner.java#L249-L272 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/StorageAccountCredentialsInner.java | StorageAccountCredentialsInner.listByDataBoxEdgeDeviceAsync | public Observable<Page<StorageAccountCredentialInner>> listByDataBoxEdgeDeviceAsync(final String deviceName, final String resourceGroupName) {
"""
Gets all the storage account credentials in a data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<StorageAccountCredentialInner> object
"""
return listByDataBoxEdgeDeviceWithServiceResponseAsync(deviceName, resourceGroupName)
.map(new Func1<ServiceResponse<Page<StorageAccountCredentialInner>>, Page<StorageAccountCredentialInner>>() {
@Override
public Page<StorageAccountCredentialInner> call(ServiceResponse<Page<StorageAccountCredentialInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<StorageAccountCredentialInner>> listByDataBoxEdgeDeviceAsync(final String deviceName, final String resourceGroupName) {
return listByDataBoxEdgeDeviceWithServiceResponseAsync(deviceName, resourceGroupName)
.map(new Func1<ServiceResponse<Page<StorageAccountCredentialInner>>, Page<StorageAccountCredentialInner>>() {
@Override
public Page<StorageAccountCredentialInner> call(ServiceResponse<Page<StorageAccountCredentialInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"StorageAccountCredentialInner",
">",
">",
"listByDataBoxEdgeDeviceAsync",
"(",
"final",
"String",
"deviceName",
",",
"final",
"String",
"resourceGroupName",
")",
"{",
"return",
"listByDataBoxEdgeDeviceWithServiceResponseAsync",
"(",
"deviceName",
",",
"resourceGroupName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"StorageAccountCredentialInner",
">",
">",
",",
"Page",
"<",
"StorageAccountCredentialInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"StorageAccountCredentialInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"StorageAccountCredentialInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Gets all the storage account credentials in a data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<StorageAccountCredentialInner> object | [
"Gets",
"all",
"the",
"storage",
"account",
"credentials",
"in",
"a",
"data",
"box",
"edge",
"/",
"gateway",
"device",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/StorageAccountCredentialsInner.java#L143-L151 |
meltmedia/cadmium | email/src/main/java/com/meltmedia/cadmium/email/EmailUtil.java | EmailUtil.newAttachmentBodyPart | public static MimeBodyPart newAttachmentBodyPart( URL contentUrl, String contentId )
throws MessagingException {
"""
Creates a body part for an attachment that is downloaded by the user.
"""
MimeBodyPart mimeBodyPart = new MimeBodyPart();
mimeBodyPart.setDataHandler(new DataHandler(contentUrl));
if( contentId != null ) {
mimeBodyPart.setHeader("Content-ID", contentId);
}
mimeBodyPart.setDisposition(DISPOSITION_ATTACHMENT);
String fileName = fileNameForUrl(contentUrl);
if( fileName != null ) {
mimeBodyPart.setFileName(fileName);
}
return mimeBodyPart;
} | java | public static MimeBodyPart newAttachmentBodyPart( URL contentUrl, String contentId )
throws MessagingException
{
MimeBodyPart mimeBodyPart = new MimeBodyPart();
mimeBodyPart.setDataHandler(new DataHandler(contentUrl));
if( contentId != null ) {
mimeBodyPart.setHeader("Content-ID", contentId);
}
mimeBodyPart.setDisposition(DISPOSITION_ATTACHMENT);
String fileName = fileNameForUrl(contentUrl);
if( fileName != null ) {
mimeBodyPart.setFileName(fileName);
}
return mimeBodyPart;
} | [
"public",
"static",
"MimeBodyPart",
"newAttachmentBodyPart",
"(",
"URL",
"contentUrl",
",",
"String",
"contentId",
")",
"throws",
"MessagingException",
"{",
"MimeBodyPart",
"mimeBodyPart",
"=",
"new",
"MimeBodyPart",
"(",
")",
";",
"mimeBodyPart",
".",
"setDataHandler",
"(",
"new",
"DataHandler",
"(",
"contentUrl",
")",
")",
";",
"if",
"(",
"contentId",
"!=",
"null",
")",
"{",
"mimeBodyPart",
".",
"setHeader",
"(",
"\"Content-ID\"",
",",
"contentId",
")",
";",
"}",
"mimeBodyPart",
".",
"setDisposition",
"(",
"DISPOSITION_ATTACHMENT",
")",
";",
"String",
"fileName",
"=",
"fileNameForUrl",
"(",
"contentUrl",
")",
";",
"if",
"(",
"fileName",
"!=",
"null",
")",
"{",
"mimeBodyPart",
".",
"setFileName",
"(",
"fileName",
")",
";",
"}",
"return",
"mimeBodyPart",
";",
"}"
]
| Creates a body part for an attachment that is downloaded by the user. | [
"Creates",
"a",
"body",
"part",
"for",
"an",
"attachment",
"that",
"is",
"downloaded",
"by",
"the",
"user",
"."
]
| train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/email/src/main/java/com/meltmedia/cadmium/email/EmailUtil.java#L116-L130 |
zackpollard/JavaTelegramBot-API | core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java | TelegramBot.login | public static TelegramBot login(String authToken) {
"""
Use this method to get a new TelegramBot instance with the selected auth token
@param authToken The bots auth token
@return A new TelegramBot instance or null if something failed
"""
try {
HttpRequestWithBody request = Unirest.post(API_URL + "bot" + authToken + "/getMe");
HttpResponse<String> response = request.asString();
JSONObject jsonResponse = Utils.processResponse(response);
if (jsonResponse != null && Utils.checkResponseStatus(jsonResponse)) {
JSONObject result = jsonResponse.getJSONObject("result");
return new TelegramBot(authToken, result.getInt("id"), result.getString("first_name"), result.getString("username"));
}
} catch (UnirestException e) {
e.printStackTrace();
}
return null;
} | java | public static TelegramBot login(String authToken) {
try {
HttpRequestWithBody request = Unirest.post(API_URL + "bot" + authToken + "/getMe");
HttpResponse<String> response = request.asString();
JSONObject jsonResponse = Utils.processResponse(response);
if (jsonResponse != null && Utils.checkResponseStatus(jsonResponse)) {
JSONObject result = jsonResponse.getJSONObject("result");
return new TelegramBot(authToken, result.getInt("id"), result.getString("first_name"), result.getString("username"));
}
} catch (UnirestException e) {
e.printStackTrace();
}
return null;
} | [
"public",
"static",
"TelegramBot",
"login",
"(",
"String",
"authToken",
")",
"{",
"try",
"{",
"HttpRequestWithBody",
"request",
"=",
"Unirest",
".",
"post",
"(",
"API_URL",
"+",
"\"bot\"",
"+",
"authToken",
"+",
"\"/getMe\"",
")",
";",
"HttpResponse",
"<",
"String",
">",
"response",
"=",
"request",
".",
"asString",
"(",
")",
";",
"JSONObject",
"jsonResponse",
"=",
"Utils",
".",
"processResponse",
"(",
"response",
")",
";",
"if",
"(",
"jsonResponse",
"!=",
"null",
"&&",
"Utils",
".",
"checkResponseStatus",
"(",
"jsonResponse",
")",
")",
"{",
"JSONObject",
"result",
"=",
"jsonResponse",
".",
"getJSONObject",
"(",
"\"result\"",
")",
";",
"return",
"new",
"TelegramBot",
"(",
"authToken",
",",
"result",
".",
"getInt",
"(",
"\"id\"",
")",
",",
"result",
".",
"getString",
"(",
"\"first_name\"",
")",
",",
"result",
".",
"getString",
"(",
"\"username\"",
")",
")",
";",
"}",
"}",
"catch",
"(",
"UnirestException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
]
| Use this method to get a new TelegramBot instance with the selected auth token
@param authToken The bots auth token
@return A new TelegramBot instance or null if something failed | [
"Use",
"this",
"method",
"to",
"get",
"a",
"new",
"TelegramBot",
"instance",
"with",
"the",
"selected",
"auth",
"token"
]
| train | https://github.com/zackpollard/JavaTelegramBot-API/blob/9d100f351824042ca5fc0ea735d1fa376a13e81d/core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java#L90-L109 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfStamper.java | PdfStamper.setEncryption | public void setEncryption(byte userPassword[], byte ownerPassword[], int permissions, int encryptionType) throws DocumentException {
"""
Sets the encryption options for this document. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.
Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext
@throws DocumentException if the document is already open
"""
if (stamper.isAppend())
throw new DocumentException("Append mode does not support changing the encryption status.");
if (stamper.isContentWritten())
throw new DocumentException("Content was already written to the output.");
stamper.setEncryption(userPassword, ownerPassword, permissions, encryptionType);
} | java | public void setEncryption(byte userPassword[], byte ownerPassword[], int permissions, int encryptionType) throws DocumentException {
if (stamper.isAppend())
throw new DocumentException("Append mode does not support changing the encryption status.");
if (stamper.isContentWritten())
throw new DocumentException("Content was already written to the output.");
stamper.setEncryption(userPassword, ownerPassword, permissions, encryptionType);
} | [
"public",
"void",
"setEncryption",
"(",
"byte",
"userPassword",
"[",
"]",
",",
"byte",
"ownerPassword",
"[",
"]",
",",
"int",
"permissions",
",",
"int",
"encryptionType",
")",
"throws",
"DocumentException",
"{",
"if",
"(",
"stamper",
".",
"isAppend",
"(",
")",
")",
"throw",
"new",
"DocumentException",
"(",
"\"Append mode does not support changing the encryption status.\"",
")",
";",
"if",
"(",
"stamper",
".",
"isContentWritten",
"(",
")",
")",
"throw",
"new",
"DocumentException",
"(",
"\"Content was already written to the output.\"",
")",
";",
"stamper",
".",
"setEncryption",
"(",
"userPassword",
",",
"ownerPassword",
",",
"permissions",
",",
"encryptionType",
")",
";",
"}"
]
| Sets the encryption options for this document. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.
@param userPassword the user password. Can be null or empty
@param ownerPassword the owner password. Can be null or empty
@param permissions the user permissions
@param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.
Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext
@throws DocumentException if the document is already open | [
"Sets",
"the",
"encryption",
"options",
"for",
"this",
"document",
".",
"The",
"userPassword",
"and",
"the",
"ownerPassword",
"can",
"be",
"null",
"or",
"have",
"zero",
"length",
".",
"In",
"this",
"case",
"the",
"ownerPassword",
"is",
"replaced",
"by",
"a",
"random",
"string",
".",
"The",
"open",
"permissions",
"for",
"the",
"document",
"can",
"be",
"AllowPrinting",
"AllowModifyContents",
"AllowCopy",
"AllowModifyAnnotations",
"AllowFillIn",
"AllowScreenReaders",
"AllowAssembly",
"and",
"AllowDegradedPrinting",
".",
"The",
"permissions",
"can",
"be",
"combined",
"by",
"ORing",
"them",
"."
]
| train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfStamper.java#L290-L296 |
threerings/narya | core/src/main/java/com/threerings/nio/PolicyServer.java | PolicyServer.init | public void init (int socketPolicyPort) {
"""
Accepts xmlsocket requests on <code>socketPolicyPort</code> and responds any host may
connect to any port on this host.
"""
_acceptor =
new ServerSocketChannelAcceptor(null, new int[] { socketPolicyPort }, this);
// build the XML once and for all
StringBuilder policy = new StringBuilder()
.append("<?xml version=\"1.0\"?>\n")
.append("<cross-domain-policy>\n");
// if we're running on 843, serve a master policy file
if (socketPolicyPort == MASTER_PORT) {
policy.append(" <site-control permitted-cross-domain-policies=\"master-only\"/>\n");
}
policy.append(" <allow-access-from domain=\"*\" to-ports=\"*\"/>\n");
policy.append("</cross-domain-policy>\n\n");
try {
_policy = policy.toString().getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("UTF-8 encoding missing; this vm is broken", e);
}
start();
} | java | public void init (int socketPolicyPort)
{
_acceptor =
new ServerSocketChannelAcceptor(null, new int[] { socketPolicyPort }, this);
// build the XML once and for all
StringBuilder policy = new StringBuilder()
.append("<?xml version=\"1.0\"?>\n")
.append("<cross-domain-policy>\n");
// if we're running on 843, serve a master policy file
if (socketPolicyPort == MASTER_PORT) {
policy.append(" <site-control permitted-cross-domain-policies=\"master-only\"/>\n");
}
policy.append(" <allow-access-from domain=\"*\" to-ports=\"*\"/>\n");
policy.append("</cross-domain-policy>\n\n");
try {
_policy = policy.toString().getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("UTF-8 encoding missing; this vm is broken", e);
}
start();
} | [
"public",
"void",
"init",
"(",
"int",
"socketPolicyPort",
")",
"{",
"_acceptor",
"=",
"new",
"ServerSocketChannelAcceptor",
"(",
"null",
",",
"new",
"int",
"[",
"]",
"{",
"socketPolicyPort",
"}",
",",
"this",
")",
";",
"// build the XML once and for all",
"StringBuilder",
"policy",
"=",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"\"<?xml version=\\\"1.0\\\"?>\\n\"",
")",
".",
"append",
"(",
"\"<cross-domain-policy>\\n\"",
")",
";",
"// if we're running on 843, serve a master policy file",
"if",
"(",
"socketPolicyPort",
"==",
"MASTER_PORT",
")",
"{",
"policy",
".",
"append",
"(",
"\" <site-control permitted-cross-domain-policies=\\\"master-only\\\"/>\\n\"",
")",
";",
"}",
"policy",
".",
"append",
"(",
"\" <allow-access-from domain=\\\"*\\\" to-ports=\\\"*\\\"/>\\n\"",
")",
";",
"policy",
".",
"append",
"(",
"\"</cross-domain-policy>\\n\\n\"",
")",
";",
"try",
"{",
"_policy",
"=",
"policy",
".",
"toString",
"(",
")",
".",
"getBytes",
"(",
"\"UTF-8\"",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"UTF-8 encoding missing; this vm is broken\"",
",",
"e",
")",
";",
"}",
"start",
"(",
")",
";",
"}"
]
| Accepts xmlsocket requests on <code>socketPolicyPort</code> and responds any host may
connect to any port on this host. | [
"Accepts",
"xmlsocket",
"requests",
"on",
"<code",
">",
"socketPolicyPort<",
"/",
"code",
">",
"and",
"responds",
"any",
"host",
"may",
"connect",
"to",
"any",
"port",
"on",
"this",
"host",
"."
]
| train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/nio/PolicyServer.java#L80-L103 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/KeyVaultClientImpl.java | KeyVaultClientImpl.deleteKeyAsync | public Observable<KeyBundle> deleteKeyAsync(String vaultBaseUrl, String keyName) {
"""
Deletes a key of any type from storage in Azure Key Vault. The delete key operation cannot be used to remove individual versions of a key. This operation removes the cryptographic material associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. Authorization: Requires the keys/delete permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the key to delete.
@return the observable to the KeyBundle object
"""
return deleteKeyWithServiceResponseAsync(vaultBaseUrl, keyName).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() {
@Override
public KeyBundle call(ServiceResponse<KeyBundle> response) {
return response.body();
}
});
} | java | public Observable<KeyBundle> deleteKeyAsync(String vaultBaseUrl, String keyName) {
return deleteKeyWithServiceResponseAsync(vaultBaseUrl, keyName).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() {
@Override
public KeyBundle call(ServiceResponse<KeyBundle> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"KeyBundle",
">",
"deleteKeyAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"keyName",
")",
"{",
"return",
"deleteKeyWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"keyName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"KeyBundle",
">",
",",
"KeyBundle",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"KeyBundle",
"call",
"(",
"ServiceResponse",
"<",
"KeyBundle",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Deletes a key of any type from storage in Azure Key Vault. The delete key operation cannot be used to remove individual versions of a key. This operation removes the cryptographic material associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. Authorization: Requires the keys/delete permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the key to delete.
@return the observable to the KeyBundle object | [
"Deletes",
"a",
"key",
"of",
"any",
"type",
"from",
"storage",
"in",
"Azure",
"Key",
"Vault",
".",
"The",
"delete",
"key",
"operation",
"cannot",
"be",
"used",
"to",
"remove",
"individual",
"versions",
"of",
"a",
"key",
".",
"This",
"operation",
"removes",
"the",
"cryptographic",
"material",
"associated",
"with",
"the",
"key",
"which",
"means",
"the",
"key",
"is",
"not",
"usable",
"for",
"Sign",
"/",
"Verify",
"Wrap",
"/",
"Unwrap",
"or",
"Encrypt",
"/",
"Decrypt",
"operations",
".",
"Authorization",
":",
"Requires",
"the",
"keys",
"/",
"delete",
"permission",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/KeyVaultClientImpl.java#L859-L866 |
liyiorg/weixin-popular | src/main/java/weixin/popular/util/JsUtil.java | JsUtil.generateChooseWXPayJson | public static String generateChooseWXPayJson(String prepay_id,String appId,String key) {
"""
生成微信支付JSON
@since 2.8.1
@param prepay_id 预支付订单号
@param appId appId
@param key 商户支付密钥
@return json
"""
String json = PayUtil.generateMchPayJsRequestJson(prepay_id, appId, key);
json = json.replaceAll("\"timeStamp\"","\"timestamp\"")
.replaceAll(",?\"appId\":\"[^\"]*\",?","");
return json;
} | java | public static String generateChooseWXPayJson(String prepay_id,String appId,String key){
String json = PayUtil.generateMchPayJsRequestJson(prepay_id, appId, key);
json = json.replaceAll("\"timeStamp\"","\"timestamp\"")
.replaceAll(",?\"appId\":\"[^\"]*\",?","");
return json;
} | [
"public",
"static",
"String",
"generateChooseWXPayJson",
"(",
"String",
"prepay_id",
",",
"String",
"appId",
",",
"String",
"key",
")",
"{",
"String",
"json",
"=",
"PayUtil",
".",
"generateMchPayJsRequestJson",
"(",
"prepay_id",
",",
"appId",
",",
"key",
")",
";",
"json",
"=",
"json",
".",
"replaceAll",
"(",
"\"\\\"timeStamp\\\"\"",
",",
"\"\\\"timestamp\\\"\"",
")",
".",
"replaceAll",
"(",
"\",?\\\"appId\\\":\\\"[^\\\"]*\\\",?\"",
",",
"\"\"",
")",
";",
"return",
"json",
";",
"}"
]
| 生成微信支付JSON
@since 2.8.1
@param prepay_id 预支付订单号
@param appId appId
@param key 商户支付密钥
@return json | [
"生成微信支付JSON"
]
| train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/util/JsUtil.java#L180-L185 |
minio/minio-java | api/src/main/java/io/minio/MinioClient.java | MinioClient.ignoreCertCheck | @SuppressFBWarnings(value = "SIC", justification = "Should not be used in production anyways.")
public void ignoreCertCheck() throws NoSuchAlgorithmException, KeyManagementException {
"""
Ignores check on server certificate for HTTPS connection.
</p><b>Example:</b><br>
<pre>{@code minioClient.ignoreCertCheck(); }</pre>
"""
final TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[]{};
}
}
};
final SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
this.httpClient = this.httpClient.newBuilder()
.sslSocketFactory(sslSocketFactory, (X509TrustManager)trustAllCerts[0])
.hostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
})
.build();
} | java | @SuppressFBWarnings(value = "SIC", justification = "Should not be used in production anyways.")
public void ignoreCertCheck() throws NoSuchAlgorithmException, KeyManagementException {
final TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[]{};
}
}
};
final SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
this.httpClient = this.httpClient.newBuilder()
.sslSocketFactory(sslSocketFactory, (X509TrustManager)trustAllCerts[0])
.hostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
})
.build();
} | [
"@",
"SuppressFBWarnings",
"(",
"value",
"=",
"\"SIC\"",
",",
"justification",
"=",
"\"Should not be used in production anyways.\"",
")",
"public",
"void",
"ignoreCertCheck",
"(",
")",
"throws",
"NoSuchAlgorithmException",
",",
"KeyManagementException",
"{",
"final",
"TrustManager",
"[",
"]",
"trustAllCerts",
"=",
"new",
"TrustManager",
"[",
"]",
"{",
"new",
"X509TrustManager",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"checkClientTrusted",
"(",
"X509Certificate",
"[",
"]",
"chain",
",",
"String",
"authType",
")",
"throws",
"CertificateException",
"{",
"}",
"@",
"Override",
"public",
"void",
"checkServerTrusted",
"(",
"X509Certificate",
"[",
"]",
"chain",
",",
"String",
"authType",
")",
"throws",
"CertificateException",
"{",
"}",
"@",
"Override",
"public",
"X509Certificate",
"[",
"]",
"getAcceptedIssuers",
"(",
")",
"{",
"return",
"new",
"X509Certificate",
"[",
"]",
"{",
"}",
";",
"}",
"}",
"}",
";",
"final",
"SSLContext",
"sslContext",
"=",
"SSLContext",
".",
"getInstance",
"(",
"\"SSL\"",
")",
";",
"sslContext",
".",
"init",
"(",
"null",
",",
"trustAllCerts",
",",
"new",
"java",
".",
"security",
".",
"SecureRandom",
"(",
")",
")",
";",
"final",
"SSLSocketFactory",
"sslSocketFactory",
"=",
"sslContext",
".",
"getSocketFactory",
"(",
")",
";",
"this",
".",
"httpClient",
"=",
"this",
".",
"httpClient",
".",
"newBuilder",
"(",
")",
".",
"sslSocketFactory",
"(",
"sslSocketFactory",
",",
"(",
"X509TrustManager",
")",
"trustAllCerts",
"[",
"0",
"]",
")",
".",
"hostnameVerifier",
"(",
"new",
"HostnameVerifier",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"verify",
"(",
"String",
"hostname",
",",
"SSLSession",
"session",
")",
"{",
"return",
"true",
";",
"}",
"}",
")",
".",
"build",
"(",
")",
";",
"}"
]
| Ignores check on server certificate for HTTPS connection.
</p><b>Example:</b><br>
<pre>{@code minioClient.ignoreCertCheck(); }</pre> | [
"Ignores",
"check",
"on",
"server",
"certificate",
"for",
"HTTPS",
"connection",
"."
]
| train | https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L812-L843 |
CenturyLinkCloud/clc-java-sdk | sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/ServerService.java | ServerService.getPublicIp | public PublicIpMetadata getPublicIp(Server serverRef, String publicIp) {
"""
Get public IP object
@param serverRef server reference
@param publicIp existing public IP address
@return public IP response object
"""
return this.getPublicIp(idByRef(serverRef), publicIp);
} | java | public PublicIpMetadata getPublicIp(Server serverRef, String publicIp) {
return this.getPublicIp(idByRef(serverRef), publicIp);
} | [
"public",
"PublicIpMetadata",
"getPublicIp",
"(",
"Server",
"serverRef",
",",
"String",
"publicIp",
")",
"{",
"return",
"this",
".",
"getPublicIp",
"(",
"idByRef",
"(",
"serverRef",
")",
",",
"publicIp",
")",
";",
"}"
]
| Get public IP object
@param serverRef server reference
@param publicIp existing public IP address
@return public IP response object | [
"Get",
"public",
"IP",
"object"
]
| train | https://github.com/CenturyLinkCloud/clc-java-sdk/blob/c026322f077dea71b1acf9f2d665253d79d9bf85/sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/ServerService.java#L1004-L1006 |
mgledi/DRUMS | src/main/java/com/unister/semweb/drums/file/HeaderIndexFile.java | HeaderIndexFile.openChannel | protected void openChannel(boolean readHeader, boolean readIndex) throws FileLockException, IOException {
"""
opens the {@link RandomAccessFile} and the corresponding {@link FileChannel}. Optionally reads the header. and
the index
@param should
the header be read
@param should
the index be read
@throws IOException
"""
super.openChannel(readHeader);
calcIndexInformations();
if (mode == AccessMode.READ_ONLY) {
indexBuffer = channel.map(FileChannel.MapMode.READ_ONLY, INDEX_OFFSET, indexSizeInBytes);
} else {
indexBuffer = channel.map(FileChannel.MapMode.READ_WRITE, INDEX_OFFSET, indexSizeInBytes);
}
if (readIndex) {
readIndex();
}
} | java | protected void openChannel(boolean readHeader, boolean readIndex) throws FileLockException, IOException {
super.openChannel(readHeader);
calcIndexInformations();
if (mode == AccessMode.READ_ONLY) {
indexBuffer = channel.map(FileChannel.MapMode.READ_ONLY, INDEX_OFFSET, indexSizeInBytes);
} else {
indexBuffer = channel.map(FileChannel.MapMode.READ_WRITE, INDEX_OFFSET, indexSizeInBytes);
}
if (readIndex) {
readIndex();
}
} | [
"protected",
"void",
"openChannel",
"(",
"boolean",
"readHeader",
",",
"boolean",
"readIndex",
")",
"throws",
"FileLockException",
",",
"IOException",
"{",
"super",
".",
"openChannel",
"(",
"readHeader",
")",
";",
"calcIndexInformations",
"(",
")",
";",
"if",
"(",
"mode",
"==",
"AccessMode",
".",
"READ_ONLY",
")",
"{",
"indexBuffer",
"=",
"channel",
".",
"map",
"(",
"FileChannel",
".",
"MapMode",
".",
"READ_ONLY",
",",
"INDEX_OFFSET",
",",
"indexSizeInBytes",
")",
";",
"}",
"else",
"{",
"indexBuffer",
"=",
"channel",
".",
"map",
"(",
"FileChannel",
".",
"MapMode",
".",
"READ_WRITE",
",",
"INDEX_OFFSET",
",",
"indexSizeInBytes",
")",
";",
"}",
"if",
"(",
"readIndex",
")",
"{",
"readIndex",
"(",
")",
";",
"}",
"}"
]
| opens the {@link RandomAccessFile} and the corresponding {@link FileChannel}. Optionally reads the header. and
the index
@param should
the header be read
@param should
the index be read
@throws IOException | [
"opens",
"the",
"{",
"@link",
"RandomAccessFile",
"}",
"and",
"the",
"corresponding",
"{",
"@link",
"FileChannel",
"}",
".",
"Optionally",
"reads",
"the",
"header",
".",
"and",
"the",
"index"
]
| train | https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/HeaderIndexFile.java#L328-L340 |
brianwhu/xillium | core/src/main/java/org/xillium/core/util/ScriptableMilestoneEvaluation.java | ScriptableMilestoneEvaluation.evaluate | @Override
public <M extends Enum<M>> ServiceMilestone.Recommendation evaluate(Class<M> type, String name, DataBinder binder, Reifier dict, Persistence persist) {
"""
Calls the evaluations in order, returning immediately if one returns ServiceMilestone.Recommendation.COMPLETE.
"""
if (_script != null) {
try {
js.put("type", type);
js.put("name", name);
js.put("binder", binder);
js.put("dictionary", dict);
js.put("persistence", persist);
Object value = js.eval(_script);
return value != null ? Enum.valueOf(ServiceMilestone.Recommendation.class, value.toString().toUpperCase()) : ServiceMilestone.Recommendation.CONTINUE;
} catch (Throwable t) {
binder.put("_script_", _script);
throw new ServiceException(getScriptingExceptionMessage(t));
}
} else {
return ServiceMilestone.Recommendation.CONTINUE;
}
} | java | @Override
public <M extends Enum<M>> ServiceMilestone.Recommendation evaluate(Class<M> type, String name, DataBinder binder, Reifier dict, Persistence persist) {
if (_script != null) {
try {
js.put("type", type);
js.put("name", name);
js.put("binder", binder);
js.put("dictionary", dict);
js.put("persistence", persist);
Object value = js.eval(_script);
return value != null ? Enum.valueOf(ServiceMilestone.Recommendation.class, value.toString().toUpperCase()) : ServiceMilestone.Recommendation.CONTINUE;
} catch (Throwable t) {
binder.put("_script_", _script);
throw new ServiceException(getScriptingExceptionMessage(t));
}
} else {
return ServiceMilestone.Recommendation.CONTINUE;
}
} | [
"@",
"Override",
"public",
"<",
"M",
"extends",
"Enum",
"<",
"M",
">",
">",
"ServiceMilestone",
".",
"Recommendation",
"evaluate",
"(",
"Class",
"<",
"M",
">",
"type",
",",
"String",
"name",
",",
"DataBinder",
"binder",
",",
"Reifier",
"dict",
",",
"Persistence",
"persist",
")",
"{",
"if",
"(",
"_script",
"!=",
"null",
")",
"{",
"try",
"{",
"js",
".",
"put",
"(",
"\"type\"",
",",
"type",
")",
";",
"js",
".",
"put",
"(",
"\"name\"",
",",
"name",
")",
";",
"js",
".",
"put",
"(",
"\"binder\"",
",",
"binder",
")",
";",
"js",
".",
"put",
"(",
"\"dictionary\"",
",",
"dict",
")",
";",
"js",
".",
"put",
"(",
"\"persistence\"",
",",
"persist",
")",
";",
"Object",
"value",
"=",
"js",
".",
"eval",
"(",
"_script",
")",
";",
"return",
"value",
"!=",
"null",
"?",
"Enum",
".",
"valueOf",
"(",
"ServiceMilestone",
".",
"Recommendation",
".",
"class",
",",
"value",
".",
"toString",
"(",
")",
".",
"toUpperCase",
"(",
")",
")",
":",
"ServiceMilestone",
".",
"Recommendation",
".",
"CONTINUE",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"binder",
".",
"put",
"(",
"\"_script_\"",
",",
"_script",
")",
";",
"throw",
"new",
"ServiceException",
"(",
"getScriptingExceptionMessage",
"(",
"t",
")",
")",
";",
"}",
"}",
"else",
"{",
"return",
"ServiceMilestone",
".",
"Recommendation",
".",
"CONTINUE",
";",
"}",
"}"
]
| Calls the evaluations in order, returning immediately if one returns ServiceMilestone.Recommendation.COMPLETE. | [
"Calls",
"the",
"evaluations",
"in",
"order",
"returning",
"immediately",
"if",
"one",
"returns",
"ServiceMilestone",
".",
"Recommendation",
".",
"COMPLETE",
"."
]
| train | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/core/src/main/java/org/xillium/core/util/ScriptableMilestoneEvaluation.java#L42-L60 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/AbstractDb.java | AbstractDb.queryNumber | public Number queryNumber(String sql, Object... params) throws SQLException {
"""
查询单条单个字段记录,并将其转换为Number
@param sql 查询语句
@param params 参数
@return 结果对象
@throws SQLException SQL执行异常
"""
return query(sql, new NumberHandler(), params);
} | java | public Number queryNumber(String sql, Object... params) throws SQLException {
return query(sql, new NumberHandler(), params);
} | [
"public",
"Number",
"queryNumber",
"(",
"String",
"sql",
",",
"Object",
"...",
"params",
")",
"throws",
"SQLException",
"{",
"return",
"query",
"(",
"sql",
",",
"new",
"NumberHandler",
"(",
")",
",",
"params",
")",
";",
"}"
]
| 查询单条单个字段记录,并将其转换为Number
@param sql 查询语句
@param params 参数
@return 结果对象
@throws SQLException SQL执行异常 | [
"查询单条单个字段记录",
"并将其转换为Number"
]
| train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L118-L120 |
spring-projects/spring-loaded | springloaded/src/main/java/org/springsource/loaded/SpringLoaded.java | SpringLoaded.loadNewVersionOfType | public static int loadNewVersionOfType(Class<?> clazz, byte[] newbytes) {
"""
Force a reload of an existing type.
@param clazz the class to be reloaded
@param newbytes the data bytecode data to reload as the new version
@return int return code: 0 is success. 1 is unknown classloader, 2 is unknown type (possibly not yet loaded). 3
is reload event failed. 4 is exception occurred.
"""
return loadNewVersionOfType(clazz.getClassLoader(), clazz.getName(), newbytes);
} | java | public static int loadNewVersionOfType(Class<?> clazz, byte[] newbytes) {
return loadNewVersionOfType(clazz.getClassLoader(), clazz.getName(), newbytes);
} | [
"public",
"static",
"int",
"loadNewVersionOfType",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"byte",
"[",
"]",
"newbytes",
")",
"{",
"return",
"loadNewVersionOfType",
"(",
"clazz",
".",
"getClassLoader",
"(",
")",
",",
"clazz",
".",
"getName",
"(",
")",
",",
"newbytes",
")",
";",
"}"
]
| Force a reload of an existing type.
@param clazz the class to be reloaded
@param newbytes the data bytecode data to reload as the new version
@return int return code: 0 is success. 1 is unknown classloader, 2 is unknown type (possibly not yet loaded). 3
is reload event failed. 4 is exception occurred. | [
"Force",
"a",
"reload",
"of",
"an",
"existing",
"type",
"."
]
| train | https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/SpringLoaded.java#L35-L37 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/optional/Download.java | Download.toTempFile | public static void toTempFile(final HttpConfig config, final String contentType) {
"""
Downloads the content to a temporary file (*.tmp in the system temp directory) with the specified content type.
@param config the `HttpConfig` instance
@param contentType the content type
"""
try {
toFile(config, contentType, File.createTempFile("tmp", ".tmp"));
}
catch(IOException ioe) {
throw new TransportingException(ioe);
}
} | java | public static void toTempFile(final HttpConfig config, final String contentType) {
try {
toFile(config, contentType, File.createTempFile("tmp", ".tmp"));
}
catch(IOException ioe) {
throw new TransportingException(ioe);
}
} | [
"public",
"static",
"void",
"toTempFile",
"(",
"final",
"HttpConfig",
"config",
",",
"final",
"String",
"contentType",
")",
"{",
"try",
"{",
"toFile",
"(",
"config",
",",
"contentType",
",",
"File",
".",
"createTempFile",
"(",
"\"tmp\"",
",",
"\".tmp\"",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"TransportingException",
"(",
"ioe",
")",
";",
"}",
"}"
]
| Downloads the content to a temporary file (*.tmp in the system temp directory) with the specified content type.
@param config the `HttpConfig` instance
@param contentType the content type | [
"Downloads",
"the",
"content",
"to",
"a",
"temporary",
"file",
"(",
"*",
".",
"tmp",
"in",
"the",
"system",
"temp",
"directory",
")",
"with",
"the",
"specified",
"content",
"type",
"."
]
| train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/optional/Download.java#L66-L73 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveDataset.java | HiveDataset.resolveTemplate | public static String resolveTemplate(String rawString, Table table) {
"""
Resolve {@value #DATABASE_TOKEN} and {@value #TABLE_TOKEN} in <code>rawString</code> to {@link Table#getDbName()}
and {@link Table#getTableName()}
"""
if (StringUtils.isBlank(rawString)) {
return rawString;
}
return StringUtils.replaceEach(rawString, new String[] { DATABASE_TOKEN, TABLE_TOKEN }, new String[] { table.getDbName(), table.getTableName() });
} | java | public static String resolveTemplate(String rawString, Table table) {
if (StringUtils.isBlank(rawString)) {
return rawString;
}
return StringUtils.replaceEach(rawString, new String[] { DATABASE_TOKEN, TABLE_TOKEN }, new String[] { table.getDbName(), table.getTableName() });
} | [
"public",
"static",
"String",
"resolveTemplate",
"(",
"String",
"rawString",
",",
"Table",
"table",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"rawString",
")",
")",
"{",
"return",
"rawString",
";",
"}",
"return",
"StringUtils",
".",
"replaceEach",
"(",
"rawString",
",",
"new",
"String",
"[",
"]",
"{",
"DATABASE_TOKEN",
",",
"TABLE_TOKEN",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"table",
".",
"getDbName",
"(",
")",
",",
"table",
".",
"getTableName",
"(",
")",
"}",
")",
";",
"}"
]
| Resolve {@value #DATABASE_TOKEN} and {@value #TABLE_TOKEN} in <code>rawString</code> to {@link Table#getDbName()}
and {@link Table#getTableName()} | [
"Resolve",
"{"
]
| train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveDataset.java#L185-L190 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/BizwifiAPI.java | BizwifiAPI.finishpageSet | public static BaseResult finishpageSet(String accessToken, FinishPageSet finishPageSet) {
"""
连Wi-Fi小程序-连Wi-Fi完成页跳转小程序
场景介绍:
设置需要跳转的小程序,连网完成点击“完成”按钮,即可进入设置的小程序。
注:只能跳转与公众号关联的小程序。
@param accessToken accessToken
@param finishPageSet finishPageSet
@return BaseResult
"""
return finishpageSet(accessToken, JsonUtil.toJSONString(finishPageSet));
} | java | public static BaseResult finishpageSet(String accessToken, FinishPageSet finishPageSet) {
return finishpageSet(accessToken, JsonUtil.toJSONString(finishPageSet));
} | [
"public",
"static",
"BaseResult",
"finishpageSet",
"(",
"String",
"accessToken",
",",
"FinishPageSet",
"finishPageSet",
")",
"{",
"return",
"finishpageSet",
"(",
"accessToken",
",",
"JsonUtil",
".",
"toJSONString",
"(",
"finishPageSet",
")",
")",
";",
"}"
]
| 连Wi-Fi小程序-连Wi-Fi完成页跳转小程序
场景介绍:
设置需要跳转的小程序,连网完成点击“完成”按钮,即可进入设置的小程序。
注:只能跳转与公众号关联的小程序。
@param accessToken accessToken
@param finishPageSet finishPageSet
@return BaseResult | [
"连Wi",
"-",
"Fi小程序",
"-",
"连Wi",
"-",
"Fi完成页跳转小程序",
"场景介绍:",
"设置需要跳转的小程序,连网完成点击“完成”按钮,即可进入设置的小程序。",
"注:只能跳转与公众号关联的小程序。"
]
| train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/BizwifiAPI.java#L99-L101 |
apache/incubator-gobblin | gobblin-modules/google-ingestion/src/main/java/org/apache/gobblin/source/extractor/extract/google/GoogleDriveSource.java | GoogleDriveSource.getcurrentFsSnapshot | @Override
public List<String> getcurrentFsSnapshot(State state) {
"""
Provide list of files snapshot where snap shot is consist of list of file ID with modified time.
Folder ID and file ID are all optional where missing folder id represent search from root folder where
missing file ID represents all files will be included on current and subfolder.
{@inheritDoc}
@see org.apache.gobblin.source.extractor.filebased.FileBasedSource#getcurrentFsSnapshot(org.apache.gobblin.configuration.State)
"""
List<String> results = new ArrayList<>();
String folderId = state.getProp(SOURCE_FILEBASED_DATA_DIRECTORY, "");
try {
LOG.info("Running ls with folderId: " + folderId);
List<String> fileIds = this.fsHelper.ls(folderId);
for (String fileId : fileIds) {
results.add(fileId + splitPattern + this.fsHelper.getFileMTime(fileId));
}
} catch (FileBasedHelperException e) {
throw new RuntimeException("Failed to retrieve list of file IDs for folderID: " + folderId, e);
}
return results;
} | java | @Override
public List<String> getcurrentFsSnapshot(State state) {
List<String> results = new ArrayList<>();
String folderId = state.getProp(SOURCE_FILEBASED_DATA_DIRECTORY, "");
try {
LOG.info("Running ls with folderId: " + folderId);
List<String> fileIds = this.fsHelper.ls(folderId);
for (String fileId : fileIds) {
results.add(fileId + splitPattern + this.fsHelper.getFileMTime(fileId));
}
} catch (FileBasedHelperException e) {
throw new RuntimeException("Failed to retrieve list of file IDs for folderID: " + folderId, e);
}
return results;
} | [
"@",
"Override",
"public",
"List",
"<",
"String",
">",
"getcurrentFsSnapshot",
"(",
"State",
"state",
")",
"{",
"List",
"<",
"String",
">",
"results",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"String",
"folderId",
"=",
"state",
".",
"getProp",
"(",
"SOURCE_FILEBASED_DATA_DIRECTORY",
",",
"\"\"",
")",
";",
"try",
"{",
"LOG",
".",
"info",
"(",
"\"Running ls with folderId: \"",
"+",
"folderId",
")",
";",
"List",
"<",
"String",
">",
"fileIds",
"=",
"this",
".",
"fsHelper",
".",
"ls",
"(",
"folderId",
")",
";",
"for",
"(",
"String",
"fileId",
":",
"fileIds",
")",
"{",
"results",
".",
"add",
"(",
"fileId",
"+",
"splitPattern",
"+",
"this",
".",
"fsHelper",
".",
"getFileMTime",
"(",
"fileId",
")",
")",
";",
"}",
"}",
"catch",
"(",
"FileBasedHelperException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Failed to retrieve list of file IDs for folderID: \"",
"+",
"folderId",
",",
"e",
")",
";",
"}",
"return",
"results",
";",
"}"
]
| Provide list of files snapshot where snap shot is consist of list of file ID with modified time.
Folder ID and file ID are all optional where missing folder id represent search from root folder where
missing file ID represents all files will be included on current and subfolder.
{@inheritDoc}
@see org.apache.gobblin.source.extractor.filebased.FileBasedSource#getcurrentFsSnapshot(org.apache.gobblin.configuration.State) | [
"Provide",
"list",
"of",
"files",
"snapshot",
"where",
"snap",
"shot",
"is",
"consist",
"of",
"list",
"of",
"file",
"ID",
"with",
"modified",
"time",
".",
"Folder",
"ID",
"and",
"file",
"ID",
"are",
"all",
"optional",
"where",
"missing",
"folder",
"id",
"represent",
"search",
"from",
"root",
"folder",
"where",
"missing",
"file",
"ID",
"represents",
"all",
"files",
"will",
"be",
"included",
"on",
"current",
"and",
"subfolder",
"."
]
| train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/google-ingestion/src/main/java/org/apache/gobblin/source/extractor/extract/google/GoogleDriveSource.java#L104-L120 |
biojava/biojava | biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java | AlignerHelper.setScoreVector | public static Last[][] setScoreVector(int x, int gep, int[] subs, boolean storing, int[][][] scores,
int[] xyMax, int score) {
"""
Score local alignment for a given position in the query sequence for a linear gap penalty
@param x
@param gep
@param subs
@param storing
@param scores
@param xyMax
@param score
@return
"""
return setScoreVector(x, 0, 0, scores[0].length - 1, gep, subs, storing, scores, xyMax, score);
} | java | public static Last[][] setScoreVector(int x, int gep, int[] subs, boolean storing, int[][][] scores,
int[] xyMax, int score) {
return setScoreVector(x, 0, 0, scores[0].length - 1, gep, subs, storing, scores, xyMax, score);
} | [
"public",
"static",
"Last",
"[",
"]",
"[",
"]",
"setScoreVector",
"(",
"int",
"x",
",",
"int",
"gep",
",",
"int",
"[",
"]",
"subs",
",",
"boolean",
"storing",
",",
"int",
"[",
"]",
"[",
"]",
"[",
"]",
"scores",
",",
"int",
"[",
"]",
"xyMax",
",",
"int",
"score",
")",
"{",
"return",
"setScoreVector",
"(",
"x",
",",
"0",
",",
"0",
",",
"scores",
"[",
"0",
"]",
".",
"length",
"-",
"1",
",",
"gep",
",",
"subs",
",",
"storing",
",",
"scores",
",",
"xyMax",
",",
"score",
")",
";",
"}"
]
| Score local alignment for a given position in the query sequence for a linear gap penalty
@param x
@param gep
@param subs
@param storing
@param scores
@param xyMax
@param score
@return | [
"Score",
"local",
"alignment",
"for",
"a",
"given",
"position",
"in",
"the",
"query",
"sequence",
"for",
"a",
"linear",
"gap",
"penalty"
]
| train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java#L558-L561 |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.decodeUnsignedLong | public static long decodeUnsignedLong(byte[] buf, int ofs, int len) throws IllegalArgumentException {
"""
Decodes an unsigned integer from the given buffer.
@param buf
the buffer.
@param ofs
offset of the data in the buffer.
@param len
length of the data to decode.
@return The decoded value.
@throws IllegalArgumentException
when result does not fit into 63-bit unsigned integer.
"""
if (ofs < 0 || len < 0 || ofs + len < 0 || ofs + len > buf.length) {
throw new IndexOutOfBoundsException();
}
if (len > 8 || len == 8 && buf[ofs] < 0) {
throw new IllegalArgumentException("Integers of at most 63 unsigned bits supported by this implementation");
}
long t = 0;
for (int i = 0; i < len; ++i) {
t = (t << 8) | ((long) buf[ofs + i] & 0xff);
}
return t;
} | java | public static long decodeUnsignedLong(byte[] buf, int ofs, int len) throws IllegalArgumentException {
if (ofs < 0 || len < 0 || ofs + len < 0 || ofs + len > buf.length) {
throw new IndexOutOfBoundsException();
}
if (len > 8 || len == 8 && buf[ofs] < 0) {
throw new IllegalArgumentException("Integers of at most 63 unsigned bits supported by this implementation");
}
long t = 0;
for (int i = 0; i < len; ++i) {
t = (t << 8) | ((long) buf[ofs + i] & 0xff);
}
return t;
} | [
"public",
"static",
"long",
"decodeUnsignedLong",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"ofs",
",",
"int",
"len",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"ofs",
"<",
"0",
"||",
"len",
"<",
"0",
"||",
"ofs",
"+",
"len",
"<",
"0",
"||",
"ofs",
"+",
"len",
">",
"buf",
".",
"length",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"}",
"if",
"(",
"len",
">",
"8",
"||",
"len",
"==",
"8",
"&&",
"buf",
"[",
"ofs",
"]",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Integers of at most 63 unsigned bits supported by this implementation\"",
")",
";",
"}",
"long",
"t",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
"{",
"t",
"=",
"(",
"t",
"<<",
"8",
")",
"|",
"(",
"(",
"long",
")",
"buf",
"[",
"ofs",
"+",
"i",
"]",
"&",
"0xff",
")",
";",
"}",
"return",
"t",
";",
"}"
]
| Decodes an unsigned integer from the given buffer.
@param buf
the buffer.
@param ofs
offset of the data in the buffer.
@param len
length of the data to decode.
@return The decoded value.
@throws IllegalArgumentException
when result does not fit into 63-bit unsigned integer. | [
"Decodes",
"an",
"unsigned",
"integer",
"from",
"the",
"given",
"buffer",
"."
]
| train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L489-L501 |
apache/incubator-gobblin | gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/avro/MRCompactorAvroKeyDedupJobRunner.java | MRCompactorAvroKeyDedupJobRunner.getKeySchema | @VisibleForTesting
Schema getKeySchema(Job job, Schema topicSchema) throws IOException {
"""
Obtain the schema used for compaction. If compaction.dedup.key=all, it returns topicSchema.
If compaction.dedup.key=key, it returns a schema composed of all fields in topicSchema
whose doc matches "(?i).*primarykey". If there's no such field, option "all" will be used.
If compaction.dedup.key=custom, it reads the schema from compaction.avro.key.schema.loc.
If the read fails, or if the custom key schema is incompatible with topicSchema, option "key" will be used.
"""
Schema keySchema = null;
DedupKeyOption dedupKeyOption = getDedupKeyOption();
if (dedupKeyOption == DedupKeyOption.ALL) {
LOG.info("Using all attributes in the schema (except Map, Arrar and Enum fields) for compaction");
keySchema = AvroUtils.removeUncomparableFields(topicSchema).get();
} else if (dedupKeyOption == DedupKeyOption.KEY) {
LOG.info("Using key attributes in the schema for compaction");
keySchema = AvroUtils.removeUncomparableFields(getKeySchema(topicSchema)).get();
} else if (keySchemaFileSpecified()) {
Path keySchemaFile = getKeySchemaFile();
LOG.info("Using attributes specified in schema file " + keySchemaFile + " for compaction");
try {
keySchema = AvroUtils.parseSchemaFromFile(keySchemaFile, this.fs);
} catch (IOException e) {
LOG.error("Failed to parse avro schema from " + keySchemaFile
+ ", using key attributes in the schema for compaction");
keySchema = AvroUtils.removeUncomparableFields(getKeySchema(topicSchema)).get();
}
if (!isKeySchemaValid(keySchema, topicSchema)) {
LOG.warn(String.format("Key schema %s is not compatible with record schema %s.", keySchema, topicSchema)
+ "Using key attributes in the schema for compaction");
keySchema = AvroUtils.removeUncomparableFields(getKeySchema(topicSchema)).get();
}
} else {
LOG.info("Property " + COMPACTION_JOB_AVRO_KEY_SCHEMA_LOC
+ " not provided. Using key attributes in the schema for compaction");
keySchema = AvroUtils.removeUncomparableFields(getKeySchema(topicSchema)).get();
}
return keySchema;
} | java | @VisibleForTesting
Schema getKeySchema(Job job, Schema topicSchema) throws IOException {
Schema keySchema = null;
DedupKeyOption dedupKeyOption = getDedupKeyOption();
if (dedupKeyOption == DedupKeyOption.ALL) {
LOG.info("Using all attributes in the schema (except Map, Arrar and Enum fields) for compaction");
keySchema = AvroUtils.removeUncomparableFields(topicSchema).get();
} else if (dedupKeyOption == DedupKeyOption.KEY) {
LOG.info("Using key attributes in the schema for compaction");
keySchema = AvroUtils.removeUncomparableFields(getKeySchema(topicSchema)).get();
} else if (keySchemaFileSpecified()) {
Path keySchemaFile = getKeySchemaFile();
LOG.info("Using attributes specified in schema file " + keySchemaFile + " for compaction");
try {
keySchema = AvroUtils.parseSchemaFromFile(keySchemaFile, this.fs);
} catch (IOException e) {
LOG.error("Failed to parse avro schema from " + keySchemaFile
+ ", using key attributes in the schema for compaction");
keySchema = AvroUtils.removeUncomparableFields(getKeySchema(topicSchema)).get();
}
if (!isKeySchemaValid(keySchema, topicSchema)) {
LOG.warn(String.format("Key schema %s is not compatible with record schema %s.", keySchema, topicSchema)
+ "Using key attributes in the schema for compaction");
keySchema = AvroUtils.removeUncomparableFields(getKeySchema(topicSchema)).get();
}
} else {
LOG.info("Property " + COMPACTION_JOB_AVRO_KEY_SCHEMA_LOC
+ " not provided. Using key attributes in the schema for compaction");
keySchema = AvroUtils.removeUncomparableFields(getKeySchema(topicSchema)).get();
}
return keySchema;
} | [
"@",
"VisibleForTesting",
"Schema",
"getKeySchema",
"(",
"Job",
"job",
",",
"Schema",
"topicSchema",
")",
"throws",
"IOException",
"{",
"Schema",
"keySchema",
"=",
"null",
";",
"DedupKeyOption",
"dedupKeyOption",
"=",
"getDedupKeyOption",
"(",
")",
";",
"if",
"(",
"dedupKeyOption",
"==",
"DedupKeyOption",
".",
"ALL",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Using all attributes in the schema (except Map, Arrar and Enum fields) for compaction\"",
")",
";",
"keySchema",
"=",
"AvroUtils",
".",
"removeUncomparableFields",
"(",
"topicSchema",
")",
".",
"get",
"(",
")",
";",
"}",
"else",
"if",
"(",
"dedupKeyOption",
"==",
"DedupKeyOption",
".",
"KEY",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Using key attributes in the schema for compaction\"",
")",
";",
"keySchema",
"=",
"AvroUtils",
".",
"removeUncomparableFields",
"(",
"getKeySchema",
"(",
"topicSchema",
")",
")",
".",
"get",
"(",
")",
";",
"}",
"else",
"if",
"(",
"keySchemaFileSpecified",
"(",
")",
")",
"{",
"Path",
"keySchemaFile",
"=",
"getKeySchemaFile",
"(",
")",
";",
"LOG",
".",
"info",
"(",
"\"Using attributes specified in schema file \"",
"+",
"keySchemaFile",
"+",
"\" for compaction\"",
")",
";",
"try",
"{",
"keySchema",
"=",
"AvroUtils",
".",
"parseSchemaFromFile",
"(",
"keySchemaFile",
",",
"this",
".",
"fs",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Failed to parse avro schema from \"",
"+",
"keySchemaFile",
"+",
"\", using key attributes in the schema for compaction\"",
")",
";",
"keySchema",
"=",
"AvroUtils",
".",
"removeUncomparableFields",
"(",
"getKeySchema",
"(",
"topicSchema",
")",
")",
".",
"get",
"(",
")",
";",
"}",
"if",
"(",
"!",
"isKeySchemaValid",
"(",
"keySchema",
",",
"topicSchema",
")",
")",
"{",
"LOG",
".",
"warn",
"(",
"String",
".",
"format",
"(",
"\"Key schema %s is not compatible with record schema %s.\"",
",",
"keySchema",
",",
"topicSchema",
")",
"+",
"\"Using key attributes in the schema for compaction\"",
")",
";",
"keySchema",
"=",
"AvroUtils",
".",
"removeUncomparableFields",
"(",
"getKeySchema",
"(",
"topicSchema",
")",
")",
".",
"get",
"(",
")",
";",
"}",
"}",
"else",
"{",
"LOG",
".",
"info",
"(",
"\"Property \"",
"+",
"COMPACTION_JOB_AVRO_KEY_SCHEMA_LOC",
"+",
"\" not provided. Using key attributes in the schema for compaction\"",
")",
";",
"keySchema",
"=",
"AvroUtils",
".",
"removeUncomparableFields",
"(",
"getKeySchema",
"(",
"topicSchema",
")",
")",
".",
"get",
"(",
")",
";",
"}",
"return",
"keySchema",
";",
"}"
]
| Obtain the schema used for compaction. If compaction.dedup.key=all, it returns topicSchema.
If compaction.dedup.key=key, it returns a schema composed of all fields in topicSchema
whose doc matches "(?i).*primarykey". If there's no such field, option "all" will be used.
If compaction.dedup.key=custom, it reads the schema from compaction.avro.key.schema.loc.
If the read fails, or if the custom key schema is incompatible with topicSchema, option "key" will be used. | [
"Obtain",
"the",
"schema",
"used",
"for",
"compaction",
".",
"If",
"compaction",
".",
"dedup",
".",
"key",
"=",
"all",
"it",
"returns",
"topicSchema",
".",
"If",
"compaction",
".",
"dedup",
".",
"key",
"=",
"key",
"it",
"returns",
"a",
"schema",
"composed",
"of",
"all",
"fields",
"in",
"topicSchema",
"whose",
"doc",
"matches",
"(",
"?i",
")",
".",
"*",
"primarykey",
".",
"If",
"there",
"s",
"no",
"such",
"field",
"option",
"all",
"will",
"be",
"used",
".",
"If",
"compaction",
".",
"dedup",
".",
"key",
"=",
"custom",
"it",
"reads",
"the",
"schema",
"from",
"compaction",
".",
"avro",
".",
"key",
".",
"schema",
".",
"loc",
".",
"If",
"the",
"read",
"fails",
"or",
"if",
"the",
"custom",
"key",
"schema",
"is",
"incompatible",
"with",
"topicSchema",
"option",
"key",
"will",
"be",
"used",
"."
]
| train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/avro/MRCompactorAvroKeyDedupJobRunner.java#L129-L161 |
broadinstitute/barclay | src/main/java/org/broadinstitute/barclay/utils/Utils.java | Utils.getLastSpace | private static int getLastSpace(final CharSequence message, int width) {
"""
Returns the last whitespace location in string, before width characters.
@param message The message to break.
@param width The width of the line.
@return The last whitespace location.
"""
final int length = message.length();
int stopPos = width;
int currPos = 0;
int lastSpace = -1;
boolean inEscape = false;
while (currPos < stopPos && currPos < length) {
final char c = message.charAt(currPos);
if (c == ESCAPE_CHAR) {
stopPos++;
inEscape = true;
} else if (inEscape) {
stopPos++;
if (Character.isLetter(c))
inEscape = false;
} else if (Character.isWhitespace(c)) {
lastSpace = currPos;
}
currPos++;
}
return lastSpace;
} | java | private static int getLastSpace(final CharSequence message, int width) {
final int length = message.length();
int stopPos = width;
int currPos = 0;
int lastSpace = -1;
boolean inEscape = false;
while (currPos < stopPos && currPos < length) {
final char c = message.charAt(currPos);
if (c == ESCAPE_CHAR) {
stopPos++;
inEscape = true;
} else if (inEscape) {
stopPos++;
if (Character.isLetter(c))
inEscape = false;
} else if (Character.isWhitespace(c)) {
lastSpace = currPos;
}
currPos++;
}
return lastSpace;
} | [
"private",
"static",
"int",
"getLastSpace",
"(",
"final",
"CharSequence",
"message",
",",
"int",
"width",
")",
"{",
"final",
"int",
"length",
"=",
"message",
".",
"length",
"(",
")",
";",
"int",
"stopPos",
"=",
"width",
";",
"int",
"currPos",
"=",
"0",
";",
"int",
"lastSpace",
"=",
"-",
"1",
";",
"boolean",
"inEscape",
"=",
"false",
";",
"while",
"(",
"currPos",
"<",
"stopPos",
"&&",
"currPos",
"<",
"length",
")",
"{",
"final",
"char",
"c",
"=",
"message",
".",
"charAt",
"(",
"currPos",
")",
";",
"if",
"(",
"c",
"==",
"ESCAPE_CHAR",
")",
"{",
"stopPos",
"++",
";",
"inEscape",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"inEscape",
")",
"{",
"stopPos",
"++",
";",
"if",
"(",
"Character",
".",
"isLetter",
"(",
"c",
")",
")",
"inEscape",
"=",
"false",
";",
"}",
"else",
"if",
"(",
"Character",
".",
"isWhitespace",
"(",
"c",
")",
")",
"{",
"lastSpace",
"=",
"currPos",
";",
"}",
"currPos",
"++",
";",
"}",
"return",
"lastSpace",
";",
"}"
]
| Returns the last whitespace location in string, before width characters.
@param message The message to break.
@param width The width of the line.
@return The last whitespace location. | [
"Returns",
"the",
"last",
"whitespace",
"location",
"in",
"string",
"before",
"width",
"characters",
"."
]
| train | https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/utils/Utils.java#L98-L119 |
junit-team/junit4 | src/main/java/org/junit/runner/Description.java | Description.createSuiteDescription | public static Description createSuiteDescription(Class<?> testClass) {
"""
Create a <code>Description</code> named after <code>testClass</code>
@param testClass A {@link Class} containing tests
@return a <code>Description</code> of <code>testClass</code>
"""
return new Description(testClass, testClass.getName(), testClass.getAnnotations());
} | java | public static Description createSuiteDescription(Class<?> testClass) {
return new Description(testClass, testClass.getName(), testClass.getAnnotations());
} | [
"public",
"static",
"Description",
"createSuiteDescription",
"(",
"Class",
"<",
"?",
">",
"testClass",
")",
"{",
"return",
"new",
"Description",
"(",
"testClass",
",",
"testClass",
".",
"getName",
"(",
")",
",",
"testClass",
".",
"getAnnotations",
"(",
")",
")",
";",
"}"
]
| Create a <code>Description</code> named after <code>testClass</code>
@param testClass A {@link Class} containing tests
@return a <code>Description</code> of <code>testClass</code> | [
"Create",
"a",
"<code",
">",
"Description<",
"/",
"code",
">",
"named",
"after",
"<code",
">",
"testClass<",
"/",
"code",
">"
]
| train | https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runner/Description.java#L123-L125 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/collect/Iterators.java | Iterators.getOnlyElement | @CanIgnoreReturnValue // TODO(kak): Consider removing this?
@Nullable
public static <T> T getOnlyElement(Iterator<? extends T> iterator, @Nullable T defaultValue) {
"""
Returns the single element contained in {@code iterator}, or {@code
defaultValue} if the iterator is empty.
@throws IllegalArgumentException if the iterator contains multiple
elements. The state of the iterator is unspecified.
"""
return iterator.hasNext() ? getOnlyElement(iterator) : defaultValue;
} | java | @CanIgnoreReturnValue // TODO(kak): Consider removing this?
@Nullable
public static <T> T getOnlyElement(Iterator<? extends T> iterator, @Nullable T defaultValue) {
return iterator.hasNext() ? getOnlyElement(iterator) : defaultValue;
} | [
"@",
"CanIgnoreReturnValue",
"// TODO(kak): Consider removing this?",
"@",
"Nullable",
"public",
"static",
"<",
"T",
">",
"T",
"getOnlyElement",
"(",
"Iterator",
"<",
"?",
"extends",
"T",
">",
"iterator",
",",
"@",
"Nullable",
"T",
"defaultValue",
")",
"{",
"return",
"iterator",
".",
"hasNext",
"(",
")",
"?",
"getOnlyElement",
"(",
"iterator",
")",
":",
"defaultValue",
";",
"}"
]
| Returns the single element contained in {@code iterator}, or {@code
defaultValue} if the iterator is empty.
@throws IllegalArgumentException if the iterator contains multiple
elements. The state of the iterator is unspecified. | [
"Returns",
"the",
"single",
"element",
"contained",
"in",
"{",
"@code",
"iterator",
"}",
"or",
"{",
"@code",
"defaultValue",
"}",
"if",
"the",
"iterator",
"is",
"empty",
"."
]
| train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/Iterators.java#L332-L336 |
apigee/usergrid-java-sdk | src/main/java/org/usergrid/java/client/Client.java | Client.createGroup | public ApiResponse createGroup(String groupPath, String groupTitle, String groupName) {
"""
Create a group with a path, title and name
@param groupPath
@param groupTitle
@param groupName
@return
"""
Map<String, Object> data = new HashMap<String, Object>();
data.put("type", "group");
data.put("path", groupPath);
if (groupTitle != null) {
data.put("title", groupTitle);
}
if(groupName != null){
data.put("name", groupName);
}
return apiRequest(HttpMethod.POST, null, data, organizationId, applicationId, "groups");
} | java | public ApiResponse createGroup(String groupPath, String groupTitle, String groupName){
Map<String, Object> data = new HashMap<String, Object>();
data.put("type", "group");
data.put("path", groupPath);
if (groupTitle != null) {
data.put("title", groupTitle);
}
if(groupName != null){
data.put("name", groupName);
}
return apiRequest(HttpMethod.POST, null, data, organizationId, applicationId, "groups");
} | [
"public",
"ApiResponse",
"createGroup",
"(",
"String",
"groupPath",
",",
"String",
"groupTitle",
",",
"String",
"groupName",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"data",
".",
"put",
"(",
"\"type\"",
",",
"\"group\"",
")",
";",
"data",
".",
"put",
"(",
"\"path\"",
",",
"groupPath",
")",
";",
"if",
"(",
"groupTitle",
"!=",
"null",
")",
"{",
"data",
".",
"put",
"(",
"\"title\"",
",",
"groupTitle",
")",
";",
"}",
"if",
"(",
"groupName",
"!=",
"null",
")",
"{",
"data",
".",
"put",
"(",
"\"name\"",
",",
"groupName",
")",
";",
"}",
"return",
"apiRequest",
"(",
"HttpMethod",
".",
"POST",
",",
"null",
",",
"data",
",",
"organizationId",
",",
"applicationId",
",",
"\"groups\"",
")",
";",
"}"
]
| Create a group with a path, title and name
@param groupPath
@param groupTitle
@param groupName
@return | [
"Create",
"a",
"group",
"with",
"a",
"path",
"title",
"and",
"name"
]
| train | https://github.com/apigee/usergrid-java-sdk/blob/6202745f184754defff13962dfc3d830bc7d8c63/src/main/java/org/usergrid/java/client/Client.java#L912-L926 |
Azure/azure-sdk-for-java | containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java | ManagedClustersInner.resetAADProfile | public void resetAADProfile(String resourceGroupName, String resourceName, ManagedClusterAADProfile parameters) {
"""
Reset AAD Profile of a managed cluster.
Update the AAD Profile for a managed cluster.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the managed cluster resource.
@param parameters Parameters supplied to the Reset AAD Profile operation for a Managed Cluster.
@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
"""
resetAADProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().last().body();
} | java | public void resetAADProfile(String resourceGroupName, String resourceName, ManagedClusterAADProfile parameters) {
resetAADProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().last().body();
} | [
"public",
"void",
"resetAADProfile",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"ManagedClusterAADProfile",
"parameters",
")",
"{",
"resetAADProfileWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
]
| Reset AAD Profile of a managed cluster.
Update the AAD Profile for a managed cluster.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the managed cluster resource.
@param parameters Parameters supplied to the Reset AAD Profile operation for a Managed Cluster.
@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 | [
"Reset",
"AAD",
"Profile",
"of",
"a",
"managed",
"cluster",
".",
"Update",
"the",
"AAD",
"Profile",
"for",
"a",
"managed",
"cluster",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java#L1675-L1677 |
casmi/casmi | src/main/java/casmi/graphics/color/CMYKColor.java | CMYKColor.getComplementaryColor | public CMYKColor getComplementaryColor() {
"""
Returns a Color object that shows a complementary color.
@return a complementary Color object.
"""
double[] rgb = CMYKColor.getRGB(cyan, magenta, yellow, black);
double[] cmyk = CMYKColor.getCMYK(1.0 - rgb[0], 1.0 - rgb[1], 1.0 - rgb[2]);
return new CMYKColor(cmyk[0], cmyk[1], cmyk[2], cmyk[3]);
} | java | public CMYKColor getComplementaryColor() {
double[] rgb = CMYKColor.getRGB(cyan, magenta, yellow, black);
double[] cmyk = CMYKColor.getCMYK(1.0 - rgb[0], 1.0 - rgb[1], 1.0 - rgb[2]);
return new CMYKColor(cmyk[0], cmyk[1], cmyk[2], cmyk[3]);
} | [
"public",
"CMYKColor",
"getComplementaryColor",
"(",
")",
"{",
"double",
"[",
"]",
"rgb",
"=",
"CMYKColor",
".",
"getRGB",
"(",
"cyan",
",",
"magenta",
",",
"yellow",
",",
"black",
")",
";",
"double",
"[",
"]",
"cmyk",
"=",
"CMYKColor",
".",
"getCMYK",
"(",
"1.0",
"-",
"rgb",
"[",
"0",
"]",
",",
"1.0",
"-",
"rgb",
"[",
"1",
"]",
",",
"1.0",
"-",
"rgb",
"[",
"2",
"]",
")",
";",
"return",
"new",
"CMYKColor",
"(",
"cmyk",
"[",
"0",
"]",
",",
"cmyk",
"[",
"1",
"]",
",",
"cmyk",
"[",
"2",
"]",
",",
"cmyk",
"[",
"3",
"]",
")",
";",
"}"
]
| Returns a Color object that shows a complementary color.
@return a complementary Color object. | [
"Returns",
"a",
"Color",
"object",
"that",
"shows",
"a",
"complementary",
"color",
"."
]
| train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/color/CMYKColor.java#L196-L200 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java | FlowController.addValidationError | protected void addValidationError( String propertyName, String messageKey ) {
"""
Add a validation error that will be shown with the Errors and Error tags.
@deprecated Use {@link #addActionError} instead.
@param propertyName the name of the property with which to associate this error.
@param messageKey the message-resources key for the error message.
"""
PageFlowUtils.addValidationError( propertyName, messageKey, getRequest() );
} | java | protected void addValidationError( String propertyName, String messageKey )
{
PageFlowUtils.addValidationError( propertyName, messageKey, getRequest() );
} | [
"protected",
"void",
"addValidationError",
"(",
"String",
"propertyName",
",",
"String",
"messageKey",
")",
"{",
"PageFlowUtils",
".",
"addValidationError",
"(",
"propertyName",
",",
"messageKey",
",",
"getRequest",
"(",
")",
")",
";",
"}"
]
| Add a validation error that will be shown with the Errors and Error tags.
@deprecated Use {@link #addActionError} instead.
@param propertyName the name of the property with which to associate this error.
@param messageKey the message-resources key for the error message. | [
"Add",
"a",
"validation",
"error",
"that",
"will",
"be",
"shown",
"with",
"the",
"Errors",
"and",
"Error",
"tags",
".",
"@deprecated",
"Use",
"{",
"@link",
"#addActionError",
"}",
"instead",
"."
]
| train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L1508-L1511 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/stats/Counters.java | Counters.divideInPlace | public static <E> void divideInPlace(Counter<E> target, Counter<E> denominator) {
"""
Divides every non-zero count in target by the corresponding value in the
denominator Counter. Beware that this can give NaN values for zero counts
in the denominator counter!
"""
for (E key : target.keySet()) {
target.setCount(key, target.getCount(key) / denominator.getCount(key));
}
} | java | public static <E> void divideInPlace(Counter<E> target, Counter<E> denominator) {
for (E key : target.keySet()) {
target.setCount(key, target.getCount(key) / denominator.getCount(key));
}
} | [
"public",
"static",
"<",
"E",
">",
"void",
"divideInPlace",
"(",
"Counter",
"<",
"E",
">",
"target",
",",
"Counter",
"<",
"E",
">",
"denominator",
")",
"{",
"for",
"(",
"E",
"key",
":",
"target",
".",
"keySet",
"(",
")",
")",
"{",
"target",
".",
"setCount",
"(",
"key",
",",
"target",
".",
"getCount",
"(",
"key",
")",
"/",
"denominator",
".",
"getCount",
"(",
"key",
")",
")",
";",
"}",
"}"
]
| Divides every non-zero count in target by the corresponding value in the
denominator Counter. Beware that this can give NaN values for zero counts
in the denominator counter! | [
"Divides",
"every",
"non",
"-",
"zero",
"count",
"in",
"target",
"by",
"the",
"corresponding",
"value",
"in",
"the",
"denominator",
"Counter",
".",
"Beware",
"that",
"this",
"can",
"give",
"NaN",
"values",
"for",
"zero",
"counts",
"in",
"the",
"denominator",
"counter!"
]
| train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L413-L417 |
stagemonitor/stagemonitor | stagemonitor-web-servlet/src/main/java/org/stagemonitor/web/servlet/util/AntPathMatcher.java | AntPathMatcher.extractPathWithinPattern | public String extractPathWithinPattern(String pattern, String path) {
"""
Given a pattern and a full path, determine the pattern-mapped part. <p>For example: <ul>
<li>'{@code /docs/cvs/commit.html}' and '{@code /docs/cvs/commit.html} {@code ->} ''</li>
<li>'{@code /docs/*}' and '{@code /docs/cvs/commit} {@code ->} '{@code cvs/commit}'</li>
<li>'{@code /docs/cvs/*.html}' and '{@code /docs/cvs/commit.html} {@code ->} '{@code commit.html}'</li>
<li>'{@code /docs/**}' and '{@code /docs/cvs/commit} {@code ->} '{@code cvs/commit}'</li>
<li>'{@code /docs/**\/*.html}' and '{@code /docs/cvs/commit.html} {@code ->} '{@code cvs/commit.html}'</li>
<li>'{@code /*.html}' and '{@code /docs/cvs/commit.html} {@code ->} '{@code docs/cvs/commit.html}'</li>
<li>'{@code *.html}' and '{@code /docs/cvs/commit.html} {@code ->} '{@code /docs/cvs/commit.html}'</li>
<li>'{@code *}' and '{@code /docs/cvs/commit.html} {@code ->} '{@code /docs/cvs/commit.html}'</li> </ul>
<p>Assumes that {@link #match} returns {@code true} for '{@code pattern}' and '{@code path}', but
does <strong>not</strong> enforce this.
"""
String[] patternParts = StringUtils.tokenizeToStringArray(pattern, this.pathSeparator, this.trimTokens, true);
String[] pathParts = StringUtils.tokenizeToStringArray(path, this.pathSeparator, this.trimTokens, true);
StringBuilder builder = new StringBuilder();
boolean pathStarted = false;
for (int segment = 0; segment < patternParts.length; segment++) {
String patternPart = patternParts[segment];
if (patternPart.indexOf('*') > -1 || patternPart.indexOf('?') > -1) {
for (; segment < pathParts.length; segment++) {
if (pathStarted || (segment == 0 && !pattern.startsWith(this.pathSeparator))) {
builder.append(this.pathSeparator);
}
builder.append(pathParts[segment]);
pathStarted = true;
}
}
}
return builder.toString();
} | java | public String extractPathWithinPattern(String pattern, String path) {
String[] patternParts = StringUtils.tokenizeToStringArray(pattern, this.pathSeparator, this.trimTokens, true);
String[] pathParts = StringUtils.tokenizeToStringArray(path, this.pathSeparator, this.trimTokens, true);
StringBuilder builder = new StringBuilder();
boolean pathStarted = false;
for (int segment = 0; segment < patternParts.length; segment++) {
String patternPart = patternParts[segment];
if (patternPart.indexOf('*') > -1 || patternPart.indexOf('?') > -1) {
for (; segment < pathParts.length; segment++) {
if (pathStarted || (segment == 0 && !pattern.startsWith(this.pathSeparator))) {
builder.append(this.pathSeparator);
}
builder.append(pathParts[segment]);
pathStarted = true;
}
}
}
return builder.toString();
} | [
"public",
"String",
"extractPathWithinPattern",
"(",
"String",
"pattern",
",",
"String",
"path",
")",
"{",
"String",
"[",
"]",
"patternParts",
"=",
"StringUtils",
".",
"tokenizeToStringArray",
"(",
"pattern",
",",
"this",
".",
"pathSeparator",
",",
"this",
".",
"trimTokens",
",",
"true",
")",
";",
"String",
"[",
"]",
"pathParts",
"=",
"StringUtils",
".",
"tokenizeToStringArray",
"(",
"path",
",",
"this",
".",
"pathSeparator",
",",
"this",
".",
"trimTokens",
",",
"true",
")",
";",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"pathStarted",
"=",
"false",
";",
"for",
"(",
"int",
"segment",
"=",
"0",
";",
"segment",
"<",
"patternParts",
".",
"length",
";",
"segment",
"++",
")",
"{",
"String",
"patternPart",
"=",
"patternParts",
"[",
"segment",
"]",
";",
"if",
"(",
"patternPart",
".",
"indexOf",
"(",
"'",
"'",
")",
">",
"-",
"1",
"||",
"patternPart",
".",
"indexOf",
"(",
"'",
"'",
")",
">",
"-",
"1",
")",
"{",
"for",
"(",
";",
"segment",
"<",
"pathParts",
".",
"length",
";",
"segment",
"++",
")",
"{",
"if",
"(",
"pathStarted",
"||",
"(",
"segment",
"==",
"0",
"&&",
"!",
"pattern",
".",
"startsWith",
"(",
"this",
".",
"pathSeparator",
")",
")",
")",
"{",
"builder",
".",
"append",
"(",
"this",
".",
"pathSeparator",
")",
";",
"}",
"builder",
".",
"append",
"(",
"pathParts",
"[",
"segment",
"]",
")",
";",
"pathStarted",
"=",
"true",
";",
"}",
"}",
"}",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
]
| Given a pattern and a full path, determine the pattern-mapped part. <p>For example: <ul>
<li>'{@code /docs/cvs/commit.html}' and '{@code /docs/cvs/commit.html} {@code ->} ''</li>
<li>'{@code /docs/*}' and '{@code /docs/cvs/commit} {@code ->} '{@code cvs/commit}'</li>
<li>'{@code /docs/cvs/*.html}' and '{@code /docs/cvs/commit.html} {@code ->} '{@code commit.html}'</li>
<li>'{@code /docs/**}' and '{@code /docs/cvs/commit} {@code ->} '{@code cvs/commit}'</li>
<li>'{@code /docs/**\/*.html}' and '{@code /docs/cvs/commit.html} {@code ->} '{@code cvs/commit.html}'</li>
<li>'{@code /*.html}' and '{@code /docs/cvs/commit.html} {@code ->} '{@code docs/cvs/commit.html}'</li>
<li>'{@code *.html}' and '{@code /docs/cvs/commit.html} {@code ->} '{@code /docs/cvs/commit.html}'</li>
<li>'{@code *}' and '{@code /docs/cvs/commit.html} {@code ->} '{@code /docs/cvs/commit.html}'</li> </ul>
<p>Assumes that {@link #match} returns {@code true} for '{@code pattern}' and '{@code path}', but
does <strong>not</strong> enforce this. | [
"Given",
"a",
"pattern",
"and",
"a",
"full",
"path",
"determine",
"the",
"pattern",
"-",
"mapped",
"part",
".",
"<p",
">",
"For",
"example",
":",
"<ul",
">",
"<li",
">",
"{"
]
| train | https://github.com/stagemonitor/stagemonitor/blob/7a1bf6848906f816aa465983f602ea1f1e8f2b7b/stagemonitor-web-servlet/src/main/java/org/stagemonitor/web/servlet/util/AntPathMatcher.java#L468-L488 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/ST_AsGeoJSON.java | ST_AsGeoJSON.toGeojsonLineString | public static void toGeojsonLineString(LineString lineString, StringBuilder sb) {
"""
Coordinates of LineString are an array of positions.
Syntax:
{ "type": "LineString", "coordinates": [ [100.0, 0.0], [101.0, 1.0] ] }
@param lineString
@param sb
"""
sb.append("{\"type\":\"LineString\",\"coordinates\":");
toGeojsonCoordinates(lineString.getCoordinates(), sb);
sb.append("}");
} | java | public static void toGeojsonLineString(LineString lineString, StringBuilder sb) {
sb.append("{\"type\":\"LineString\",\"coordinates\":");
toGeojsonCoordinates(lineString.getCoordinates(), sb);
sb.append("}");
} | [
"public",
"static",
"void",
"toGeojsonLineString",
"(",
"LineString",
"lineString",
",",
"StringBuilder",
"sb",
")",
"{",
"sb",
".",
"append",
"(",
"\"{\\\"type\\\":\\\"LineString\\\",\\\"coordinates\\\":\"",
")",
";",
"toGeojsonCoordinates",
"(",
"lineString",
".",
"getCoordinates",
"(",
")",
",",
"sb",
")",
";",
"sb",
".",
"append",
"(",
"\"}\"",
")",
";",
"}"
]
| Coordinates of LineString are an array of positions.
Syntax:
{ "type": "LineString", "coordinates": [ [100.0, 0.0], [101.0, 1.0] ] }
@param lineString
@param sb | [
"Coordinates",
"of",
"LineString",
"are",
"an",
"array",
"of",
"positions",
"."
]
| train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/ST_AsGeoJSON.java#L142-L146 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/GeomFactory2dfx.java | GeomFactory2dfx.newPoint | @SuppressWarnings("static-method")
public Point2dfx newPoint(DoubleProperty x, DoubleProperty y) {
"""
Create a point with properties.
@param x the x property.
@param y the y property.
@return the vector.
"""
return new Point2dfx(x, y);
} | java | @SuppressWarnings("static-method")
public Point2dfx newPoint(DoubleProperty x, DoubleProperty y) {
return new Point2dfx(x, y);
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"public",
"Point2dfx",
"newPoint",
"(",
"DoubleProperty",
"x",
",",
"DoubleProperty",
"y",
")",
"{",
"return",
"new",
"Point2dfx",
"(",
"x",
",",
"y",
")",
";",
"}"
]
| Create a point with properties.
@param x the x property.
@param y the y property.
@return the vector. | [
"Create",
"a",
"point",
"with",
"properties",
"."
]
| train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/GeomFactory2dfx.java#L115-L118 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java | ICUService.getKey | public Object getKey(Key key, String[] actualReturn) {
"""
<p>Given a key, return a service object, and, if actualReturn
is not null, the descriptor with which it was found in the
first element of actualReturn. If no service object matches
this key, return null, and leave actualReturn unchanged.</p>
<p>This queries the cache using the key's descriptor, and if no
object in the cache matches it, tries the key on each
registered factory, in order. If none generates a service
object for the key, repeats the process with each fallback of
the key, until either one returns a service object, or the key
has no fallback.</p>
<p>If key is null, just returns null.</p>
"""
return getKey(key, actualReturn, null);
} | java | public Object getKey(Key key, String[] actualReturn) {
return getKey(key, actualReturn, null);
} | [
"public",
"Object",
"getKey",
"(",
"Key",
"key",
",",
"String",
"[",
"]",
"actualReturn",
")",
"{",
"return",
"getKey",
"(",
"key",
",",
"actualReturn",
",",
"null",
")",
";",
"}"
]
| <p>Given a key, return a service object, and, if actualReturn
is not null, the descriptor with which it was found in the
first element of actualReturn. If no service object matches
this key, return null, and leave actualReturn unchanged.</p>
<p>This queries the cache using the key's descriptor, and if no
object in the cache matches it, tries the key on each
registered factory, in order. If none generates a service
object for the key, repeats the process with each fallback of
the key, until either one returns a service object, or the key
has no fallback.</p>
<p>If key is null, just returns null.</p> | [
"<p",
">",
"Given",
"a",
"key",
"return",
"a",
"service",
"object",
"and",
"if",
"actualReturn",
"is",
"not",
"null",
"the",
"descriptor",
"with",
"which",
"it",
"was",
"found",
"in",
"the",
"first",
"element",
"of",
"actualReturn",
".",
"If",
"no",
"service",
"object",
"matches",
"this",
"key",
"return",
"null",
"and",
"leave",
"actualReturn",
"unchanged",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java#L388-L390 |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java | GraphPath.removeBeforeLast | @Override
public boolean removeBeforeLast(ST obj, PT pt) {
"""
Remove the path's elements before the
specified one which is starting
at the specified point. The specified element will
not be removed.
<p>This function removes until the <i>last occurence</i>
of the given object.
@param obj is the segment to remove
@param pt is the point on which the segment was connected
as its first point.
@return <code>true</code> on success, otherwise <code>false</code>
"""
return removeUntil(lastIndexOf(obj, pt), false);
} | java | @Override
public boolean removeBeforeLast(ST obj, PT pt) {
return removeUntil(lastIndexOf(obj, pt), false);
} | [
"@",
"Override",
"public",
"boolean",
"removeBeforeLast",
"(",
"ST",
"obj",
",",
"PT",
"pt",
")",
"{",
"return",
"removeUntil",
"(",
"lastIndexOf",
"(",
"obj",
",",
"pt",
")",
",",
"false",
")",
";",
"}"
]
| Remove the path's elements before the
specified one which is starting
at the specified point. The specified element will
not be removed.
<p>This function removes until the <i>last occurence</i>
of the given object.
@param obj is the segment to remove
@param pt is the point on which the segment was connected
as its first point.
@return <code>true</code> on success, otherwise <code>false</code> | [
"Remove",
"the",
"path",
"s",
"elements",
"before",
"the",
"specified",
"one",
"which",
"is",
"starting",
"at",
"the",
"specified",
"point",
".",
"The",
"specified",
"element",
"will",
"not",
"be",
"removed",
"."
]
| train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L691-L694 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Completable.java | Completable.concatWith | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Completable concatWith(CompletableSource other) {
"""
Concatenates this Completable with another Completable.
<p>
<img width="640" height="317" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Completable.concatWith.png" alt="">
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code concatWith} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param other the other Completable, not null
@return the new Completable which subscribes to this and then the other Completable
@throws NullPointerException if other is null
@see #andThen(MaybeSource)
@see #andThen(ObservableSource)
@see #andThen(SingleSource)
@see #andThen(Publisher)
"""
ObjectHelper.requireNonNull(other, "other is null");
return concatArray(this, other);
} | java | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Completable concatWith(CompletableSource other) {
ObjectHelper.requireNonNull(other, "other is null");
return concatArray(this, other);
} | [
"@",
"CheckReturnValue",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"Completable",
"concatWith",
"(",
"CompletableSource",
"other",
")",
"{",
"ObjectHelper",
".",
"requireNonNull",
"(",
"other",
",",
"\"other is null\"",
")",
";",
"return",
"concatArray",
"(",
"this",
",",
"other",
")",
";",
"}"
]
| Concatenates this Completable with another Completable.
<p>
<img width="640" height="317" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Completable.concatWith.png" alt="">
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code concatWith} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param other the other Completable, not null
@return the new Completable which subscribes to this and then the other Completable
@throws NullPointerException if other is null
@see #andThen(MaybeSource)
@see #andThen(ObservableSource)
@see #andThen(SingleSource)
@see #andThen(Publisher) | [
"Concatenates",
"this",
"Completable",
"with",
"another",
"Completable",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"317",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
"/",
"ReactiveX",
"/",
"RxJava",
"/",
"images",
"/",
"rx",
"-",
"operators",
"/",
"Completable",
".",
"concatWith",
".",
"png",
"alt",
"=",
">",
"<dl",
">",
"<dt",
">",
"<b",
">",
"Scheduler",
":",
"<",
"/",
"b",
">",
"<",
"/",
"dt",
">",
"<dd",
">",
"{"
]
| train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Completable.java#L1320-L1325 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java | ExpressRouteCircuitsInner.beginListArpTableAsync | public Observable<ExpressRouteCircuitsArpTableListResultInner> beginListArpTableAsync(String resourceGroupName, String circuitName, String peeringName, String devicePath) {
"""
Gets the currently advertised ARP table associated with the express route circuit in a resource group.
@param resourceGroupName The name of the resource group.
@param circuitName The name of the express route circuit.
@param peeringName The name of the peering.
@param devicePath The path of the device.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRouteCircuitsArpTableListResultInner object
"""
return beginListArpTableWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, devicePath).map(new Func1<ServiceResponse<ExpressRouteCircuitsArpTableListResultInner>, ExpressRouteCircuitsArpTableListResultInner>() {
@Override
public ExpressRouteCircuitsArpTableListResultInner call(ServiceResponse<ExpressRouteCircuitsArpTableListResultInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRouteCircuitsArpTableListResultInner> beginListArpTableAsync(String resourceGroupName, String circuitName, String peeringName, String devicePath) {
return beginListArpTableWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, devicePath).map(new Func1<ServiceResponse<ExpressRouteCircuitsArpTableListResultInner>, ExpressRouteCircuitsArpTableListResultInner>() {
@Override
public ExpressRouteCircuitsArpTableListResultInner call(ServiceResponse<ExpressRouteCircuitsArpTableListResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRouteCircuitsArpTableListResultInner",
">",
"beginListArpTableAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"circuitName",
",",
"String",
"peeringName",
",",
"String",
"devicePath",
")",
"{",
"return",
"beginListArpTableWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"circuitName",
",",
"peeringName",
",",
"devicePath",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ExpressRouteCircuitsArpTableListResultInner",
">",
",",
"ExpressRouteCircuitsArpTableListResultInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ExpressRouteCircuitsArpTableListResultInner",
"call",
"(",
"ServiceResponse",
"<",
"ExpressRouteCircuitsArpTableListResultInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Gets the currently advertised ARP table associated with the express route circuit in a resource group.
@param resourceGroupName The name of the resource group.
@param circuitName The name of the express route circuit.
@param peeringName The name of the peering.
@param devicePath The path of the device.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRouteCircuitsArpTableListResultInner object | [
"Gets",
"the",
"currently",
"advertised",
"ARP",
"table",
"associated",
"with",
"the",
"express",
"route",
"circuit",
"in",
"a",
"resource",
"group",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java#L988-L995 |
xfcjscn/sudoor-server-lib | src/main/java/net/gplatform/sudoor/server/cors/StringManager.java | StringManager.getManager | public static final synchronized StringManager getManager(
String packageName, Locale locale) {
"""
Get the StringManager for a particular package and Locale. If a manager
for a package/Locale combination already exists, it will be reused, else
a new StringManager will be created and returned.
@param packageName The package name
@param locale The Locale
"""
Map<Locale,StringManager> map = managers.get(packageName);
if (map == null) {
/*
* Don't want the HashMap to be expanded beyond LOCALE_CACHE_SIZE.
* Expansion occurs when size() exceeds capacity. Therefore keep
* size at or below capacity.
* removeEldestEntry() executes after insertion therefore the test
* for removal needs to use one less than the maximum desired size
*
*/
map = new LinkedHashMap<Locale,StringManager>(LOCALE_CACHE_SIZE, 1, true) {
private static final long serialVersionUID = 1L;
@Override
protected boolean removeEldestEntry(
Map.Entry<Locale,StringManager> eldest) {
if (size() > (LOCALE_CACHE_SIZE - 1)) {
return true;
}
return false;
}
};
managers.put(packageName, map);
}
StringManager mgr = map.get(locale);
if (mgr == null) {
mgr = new StringManager(packageName, locale);
map.put(locale, mgr);
}
return mgr;
} | java | public static final synchronized StringManager getManager(
String packageName, Locale locale) {
Map<Locale,StringManager> map = managers.get(packageName);
if (map == null) {
/*
* Don't want the HashMap to be expanded beyond LOCALE_CACHE_SIZE.
* Expansion occurs when size() exceeds capacity. Therefore keep
* size at or below capacity.
* removeEldestEntry() executes after insertion therefore the test
* for removal needs to use one less than the maximum desired size
*
*/
map = new LinkedHashMap<Locale,StringManager>(LOCALE_CACHE_SIZE, 1, true) {
private static final long serialVersionUID = 1L;
@Override
protected boolean removeEldestEntry(
Map.Entry<Locale,StringManager> eldest) {
if (size() > (LOCALE_CACHE_SIZE - 1)) {
return true;
}
return false;
}
};
managers.put(packageName, map);
}
StringManager mgr = map.get(locale);
if (mgr == null) {
mgr = new StringManager(packageName, locale);
map.put(locale, mgr);
}
return mgr;
} | [
"public",
"static",
"final",
"synchronized",
"StringManager",
"getManager",
"(",
"String",
"packageName",
",",
"Locale",
"locale",
")",
"{",
"Map",
"<",
"Locale",
",",
"StringManager",
">",
"map",
"=",
"managers",
".",
"get",
"(",
"packageName",
")",
";",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"/*\r\n * Don't want the HashMap to be expanded beyond LOCALE_CACHE_SIZE.\r\n * Expansion occurs when size() exceeds capacity. Therefore keep\r\n * size at or below capacity.\r\n * removeEldestEntry() executes after insertion therefore the test\r\n * for removal needs to use one less than the maximum desired size\r\n *\r\n */",
"map",
"=",
"new",
"LinkedHashMap",
"<",
"Locale",
",",
"StringManager",
">",
"(",
"LOCALE_CACHE_SIZE",
",",
"1",
",",
"true",
")",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"@",
"Override",
"protected",
"boolean",
"removeEldestEntry",
"(",
"Map",
".",
"Entry",
"<",
"Locale",
",",
"StringManager",
">",
"eldest",
")",
"{",
"if",
"(",
"size",
"(",
")",
">",
"(",
"LOCALE_CACHE_SIZE",
"-",
"1",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"}",
";",
"managers",
".",
"put",
"(",
"packageName",
",",
"map",
")",
";",
"}",
"StringManager",
"mgr",
"=",
"map",
".",
"get",
"(",
"locale",
")",
";",
"if",
"(",
"mgr",
"==",
"null",
")",
"{",
"mgr",
"=",
"new",
"StringManager",
"(",
"packageName",
",",
"locale",
")",
";",
"map",
".",
"put",
"(",
"locale",
",",
"mgr",
")",
";",
"}",
"return",
"mgr",
";",
"}"
]
| Get the StringManager for a particular package and Locale. If a manager
for a package/Locale combination already exists, it will be reused, else
a new StringManager will be created and returned.
@param packageName The package name
@param locale The Locale | [
"Get",
"the",
"StringManager",
"for",
"a",
"particular",
"package",
"and",
"Locale",
".",
"If",
"a",
"manager",
"for",
"a",
"package",
"/",
"Locale",
"combination",
"already",
"exists",
"it",
"will",
"be",
"reused",
"else",
"a",
"new",
"StringManager",
"will",
"be",
"created",
"and",
"returned",
"."
]
| train | https://github.com/xfcjscn/sudoor-server-lib/blob/37dc1996eaa9cad25c82abd1de315ba565e32097/src/main/java/net/gplatform/sudoor/server/cors/StringManager.java#L222-L255 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/utils/KunderaCoreUtils.java | KunderaCoreUtils.getJPAColumnName | public static String getJPAColumnName(String field, EntityMetadata entityMetadata, MetamodelImpl metaModel) {
"""
Gets the JPA column name.
@param field
the field
@param entityMetadata
the entity metadata
@param metaModel
the meta model
@return the JPA column name
"""
if (field.indexOf('.') > 0)
{
return ((AbstractAttribute) metaModel.entity(entityMetadata.getEntityClazz()).getAttribute(
field.substring(field.indexOf('.') + 1,
field.indexOf(')') > 0 ? field.indexOf(')') : field.length()))).getJPAColumnName();
}
else
{
return ((AbstractAttribute) entityMetadata.getIdAttribute()).getJPAColumnName();
}
} | java | public static String getJPAColumnName(String field, EntityMetadata entityMetadata, MetamodelImpl metaModel)
{
if (field.indexOf('.') > 0)
{
return ((AbstractAttribute) metaModel.entity(entityMetadata.getEntityClazz()).getAttribute(
field.substring(field.indexOf('.') + 1,
field.indexOf(')') > 0 ? field.indexOf(')') : field.length()))).getJPAColumnName();
}
else
{
return ((AbstractAttribute) entityMetadata.getIdAttribute()).getJPAColumnName();
}
} | [
"public",
"static",
"String",
"getJPAColumnName",
"(",
"String",
"field",
",",
"EntityMetadata",
"entityMetadata",
",",
"MetamodelImpl",
"metaModel",
")",
"{",
"if",
"(",
"field",
".",
"indexOf",
"(",
"'",
"'",
")",
">",
"0",
")",
"{",
"return",
"(",
"(",
"AbstractAttribute",
")",
"metaModel",
".",
"entity",
"(",
"entityMetadata",
".",
"getEntityClazz",
"(",
")",
")",
".",
"getAttribute",
"(",
"field",
".",
"substring",
"(",
"field",
".",
"indexOf",
"(",
"'",
"'",
")",
"+",
"1",
",",
"field",
".",
"indexOf",
"(",
"'",
"'",
")",
">",
"0",
"?",
"field",
".",
"indexOf",
"(",
"'",
"'",
")",
":",
"field",
".",
"length",
"(",
")",
")",
")",
")",
".",
"getJPAColumnName",
"(",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"AbstractAttribute",
")",
"entityMetadata",
".",
"getIdAttribute",
"(",
")",
")",
".",
"getJPAColumnName",
"(",
")",
";",
"}",
"}"
]
| Gets the JPA column name.
@param field
the field
@param entityMetadata
the entity metadata
@param metaModel
the meta model
@return the JPA column name | [
"Gets",
"the",
"JPA",
"column",
"name",
"."
]
| train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/utils/KunderaCoreUtils.java#L704-L716 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildStepsInner.java | BuildStepsInner.listAsync | public Observable<Page<BuildStepInner>> listAsync(final String resourceGroupName, final String registryName, final String buildTaskName) {
"""
List all the build steps for a given build task.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param buildTaskName The name of the container registry build task.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<BuildStepInner> object
"""
return listWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName)
.map(new Func1<ServiceResponse<Page<BuildStepInner>>, Page<BuildStepInner>>() {
@Override
public Page<BuildStepInner> call(ServiceResponse<Page<BuildStepInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<BuildStepInner>> listAsync(final String resourceGroupName, final String registryName, final String buildTaskName) {
return listWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName)
.map(new Func1<ServiceResponse<Page<BuildStepInner>>, Page<BuildStepInner>>() {
@Override
public Page<BuildStepInner> call(ServiceResponse<Page<BuildStepInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"BuildStepInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"registryName",
",",
"final",
"String",
"buildTaskName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
",",
"buildTaskName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"BuildStepInner",
">",
">",
",",
"Page",
"<",
"BuildStepInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"BuildStepInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"BuildStepInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| List all the build steps for a given build task.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param buildTaskName The name of the container registry build task.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<BuildStepInner> object | [
"List",
"all",
"the",
"build",
"steps",
"for",
"a",
"given",
"build",
"task",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildStepsInner.java#L166-L174 |
beihaifeiwu/dolphin | dolphin-common/src/main/java/com/freetmp/common/type/ResolvableType.java | ResolvableType.forMethodParameter | public static ResolvableType forMethodParameter(Method method, int parameterIndex) {
"""
Return a {@link ResolvableType} for the specified {@link Method} parameter.
@param method the source method (must not be {@code null})
@param parameterIndex the parameter index
@return a {@link ResolvableType} for the specified method parameter
@see #forMethodParameter(Method, int, Class)
@see #forMethodParameter(MethodParameter)
"""
Assert.notNull(method, "Method must not be null");
return forMethodParameter(new MethodParameter(method, parameterIndex));
} | java | public static ResolvableType forMethodParameter(Method method, int parameterIndex) {
Assert.notNull(method, "Method must not be null");
return forMethodParameter(new MethodParameter(method, parameterIndex));
} | [
"public",
"static",
"ResolvableType",
"forMethodParameter",
"(",
"Method",
"method",
",",
"int",
"parameterIndex",
")",
"{",
"Assert",
".",
"notNull",
"(",
"method",
",",
"\"Method must not be null\"",
")",
";",
"return",
"forMethodParameter",
"(",
"new",
"MethodParameter",
"(",
"method",
",",
"parameterIndex",
")",
")",
";",
"}"
]
| Return a {@link ResolvableType} for the specified {@link Method} parameter.
@param method the source method (must not be {@code null})
@param parameterIndex the parameter index
@return a {@link ResolvableType} for the specified method parameter
@see #forMethodParameter(Method, int, Class)
@see #forMethodParameter(MethodParameter) | [
"Return",
"a",
"{"
]
| train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/type/ResolvableType.java#L1058-L1061 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java | ComputerVisionImpl.recognizeTextInStreamAsync | public Observable<Void> recognizeTextInStreamAsync(byte[] image, TextRecognitionMode mode) {
"""
Recognize Text operation. When you use the Recognize Text interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get Recognize Text Operation Result operation.
@param image An image stream.
@param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed'
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful.
"""
return recognizeTextInStreamWithServiceResponseAsync(image, mode).map(new Func1<ServiceResponseWithHeaders<Void, RecognizeTextInStreamHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, RecognizeTextInStreamHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> recognizeTextInStreamAsync(byte[] image, TextRecognitionMode mode) {
return recognizeTextInStreamWithServiceResponseAsync(image, mode).map(new Func1<ServiceResponseWithHeaders<Void, RecognizeTextInStreamHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, RecognizeTextInStreamHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"recognizeTextInStreamAsync",
"(",
"byte",
"[",
"]",
"image",
",",
"TextRecognitionMode",
"mode",
")",
"{",
"return",
"recognizeTextInStreamWithServiceResponseAsync",
"(",
"image",
",",
"mode",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponseWithHeaders",
"<",
"Void",
",",
"RecognizeTextInStreamHeaders",
">",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
"ServiceResponseWithHeaders",
"<",
"Void",
",",
"RecognizeTextInStreamHeaders",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Recognize Text operation. When you use the Recognize Text interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get Recognize Text Operation Result operation.
@param image An image stream.
@param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed'
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Recognize",
"Text",
"operation",
".",
"When",
"you",
"use",
"the",
"Recognize",
"Text",
"interface",
"the",
"response",
"contains",
"a",
"field",
"called",
"Operation",
"-",
"Location",
".",
"The",
"Operation",
"-",
"Location",
"field",
"contains",
"the",
"URL",
"that",
"you",
"must",
"use",
"for",
"your",
"Get",
"Recognize",
"Text",
"Operation",
"Result",
"operation",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L195-L202 |
op4j/op4j | src/main/java/org/op4j/functions/FnNumber.java | FnNumber.toBigDecimal | public static final Function<Number,BigDecimal> toBigDecimal(final int scale, final RoundingMode roundingMode) {
"""
<p>
It converts the input into a {@link BigDecimal} using the given scale and {@link RoundingMode}
</p>
@param scale the scale to be used
@param roundingMode the {@link RoundingMode} to round the input with
@return the {@link BigDecimal}
"""
return new ToBigDecimal(scale, roundingMode);
} | java | public static final Function<Number,BigDecimal> toBigDecimal(final int scale, final RoundingMode roundingMode) {
return new ToBigDecimal(scale, roundingMode);
} | [
"public",
"static",
"final",
"Function",
"<",
"Number",
",",
"BigDecimal",
">",
"toBigDecimal",
"(",
"final",
"int",
"scale",
",",
"final",
"RoundingMode",
"roundingMode",
")",
"{",
"return",
"new",
"ToBigDecimal",
"(",
"scale",
",",
"roundingMode",
")",
";",
"}"
]
| <p>
It converts the input into a {@link BigDecimal} using the given scale and {@link RoundingMode}
</p>
@param scale the scale to be used
@param roundingMode the {@link RoundingMode} to round the input with
@return the {@link BigDecimal} | [
"<p",
">",
"It",
"converts",
"the",
"input",
"into",
"a",
"{",
"@link",
"BigDecimal",
"}",
"using",
"the",
"given",
"scale",
"and",
"{",
"@link",
"RoundingMode",
"}",
"<",
"/",
"p",
">"
]
| train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnNumber.java#L85-L87 |
vznet/mongo-jackson-mapper | src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java | JacksonDBCollection.createIndex | public void createIndex(DBObject keys, DBObject options) throws MongoException {
"""
Forces creation of an index on a set of fields, if one does not already exist.
@param keys The keys to index
@param options The options
@throws MongoException If an error occurred
"""
dbCollection.createIndex(keys, options);
} | java | public void createIndex(DBObject keys, DBObject options) throws MongoException {
dbCollection.createIndex(keys, options);
} | [
"public",
"void",
"createIndex",
"(",
"DBObject",
"keys",
",",
"DBObject",
"options",
")",
"throws",
"MongoException",
"{",
"dbCollection",
".",
"createIndex",
"(",
"keys",
",",
"options",
")",
";",
"}"
]
| Forces creation of an index on a set of fields, if one does not already exist.
@param keys The keys to index
@param options The options
@throws MongoException If an error occurred | [
"Forces",
"creation",
"of",
"an",
"index",
"on",
"a",
"set",
"of",
"fields",
"if",
"one",
"does",
"not",
"already",
"exist",
"."
]
| train | https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java#L680-L682 |
windup/windup | config/api/src/main/java/org/jboss/windup/config/operation/Iteration.java | Iteration.getCurrentPayload | @SuppressWarnings("unchecked")
public static <FRAMETYPE extends WindupVertexFrame> FRAMETYPE getCurrentPayload(Variables stack, String name)
throws IllegalStateException, IllegalArgumentException {
"""
Get the {@link Iteration} payload with the given name.
@throws IllegalArgumentException if the given variable refers to a non-payload.
"""
Map<String, Iterable<? extends WindupVertexFrame>> vars = stack.peek();
Iterable<? extends WindupVertexFrame> existingValue = vars.get(name);
if (!(existingValue == null || existingValue instanceof IterationPayload))
{
throw new IllegalArgumentException("Variable \"" + name
+ "\" is not an " + Iteration.class.getSimpleName() + " variable.");
}
Object object = stack.findSingletonVariable(name);
return (FRAMETYPE) object;
} | java | @SuppressWarnings("unchecked")
public static <FRAMETYPE extends WindupVertexFrame> FRAMETYPE getCurrentPayload(Variables stack, String name)
throws IllegalStateException, IllegalArgumentException
{
Map<String, Iterable<? extends WindupVertexFrame>> vars = stack.peek();
Iterable<? extends WindupVertexFrame> existingValue = vars.get(name);
if (!(existingValue == null || existingValue instanceof IterationPayload))
{
throw new IllegalArgumentException("Variable \"" + name
+ "\" is not an " + Iteration.class.getSimpleName() + " variable.");
}
Object object = stack.findSingletonVariable(name);
return (FRAMETYPE) object;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"FRAMETYPE",
"extends",
"WindupVertexFrame",
">",
"FRAMETYPE",
"getCurrentPayload",
"(",
"Variables",
"stack",
",",
"String",
"name",
")",
"throws",
"IllegalStateException",
",",
"IllegalArgumentException",
"{",
"Map",
"<",
"String",
",",
"Iterable",
"<",
"?",
"extends",
"WindupVertexFrame",
">",
">",
"vars",
"=",
"stack",
".",
"peek",
"(",
")",
";",
"Iterable",
"<",
"?",
"extends",
"WindupVertexFrame",
">",
"existingValue",
"=",
"vars",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"!",
"(",
"existingValue",
"==",
"null",
"||",
"existingValue",
"instanceof",
"IterationPayload",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Variable \\\"\"",
"+",
"name",
"+",
"\"\\\" is not an \"",
"+",
"Iteration",
".",
"class",
".",
"getSimpleName",
"(",
")",
"+",
"\" variable.\"",
")",
";",
"}",
"Object",
"object",
"=",
"stack",
".",
"findSingletonVariable",
"(",
"name",
")",
";",
"return",
"(",
"FRAMETYPE",
")",
"object",
";",
"}"
]
| Get the {@link Iteration} payload with the given name.
@throws IllegalArgumentException if the given variable refers to a non-payload. | [
"Get",
"the",
"{",
"@link",
"Iteration",
"}",
"payload",
"with",
"the",
"given",
"name",
"."
]
| train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/operation/Iteration.java#L416-L431 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/PartnersInner.java | PartnersInner.listContentCallbackUrlAsync | public Observable<WorkflowTriggerCallbackUrlInner> listContentCallbackUrlAsync(String resourceGroupName, String integrationAccountName, String partnerName, GetCallbackUrlParameters listContentCallbackUrl) {
"""
Get the content callback url.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@param partnerName The integration account partner name.
@param listContentCallbackUrl the GetCallbackUrlParameters value
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkflowTriggerCallbackUrlInner object
"""
return listContentCallbackUrlWithServiceResponseAsync(resourceGroupName, integrationAccountName, partnerName, listContentCallbackUrl).map(new Func1<ServiceResponse<WorkflowTriggerCallbackUrlInner>, WorkflowTriggerCallbackUrlInner>() {
@Override
public WorkflowTriggerCallbackUrlInner call(ServiceResponse<WorkflowTriggerCallbackUrlInner> response) {
return response.body();
}
});
} | java | public Observable<WorkflowTriggerCallbackUrlInner> listContentCallbackUrlAsync(String resourceGroupName, String integrationAccountName, String partnerName, GetCallbackUrlParameters listContentCallbackUrl) {
return listContentCallbackUrlWithServiceResponseAsync(resourceGroupName, integrationAccountName, partnerName, listContentCallbackUrl).map(new Func1<ServiceResponse<WorkflowTriggerCallbackUrlInner>, WorkflowTriggerCallbackUrlInner>() {
@Override
public WorkflowTriggerCallbackUrlInner call(ServiceResponse<WorkflowTriggerCallbackUrlInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"WorkflowTriggerCallbackUrlInner",
">",
"listContentCallbackUrlAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"integrationAccountName",
",",
"String",
"partnerName",
",",
"GetCallbackUrlParameters",
"listContentCallbackUrl",
")",
"{",
"return",
"listContentCallbackUrlWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"integrationAccountName",
",",
"partnerName",
",",
"listContentCallbackUrl",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"WorkflowTriggerCallbackUrlInner",
">",
",",
"WorkflowTriggerCallbackUrlInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"WorkflowTriggerCallbackUrlInner",
"call",
"(",
"ServiceResponse",
"<",
"WorkflowTriggerCallbackUrlInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Get the content callback url.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@param partnerName The integration account partner name.
@param listContentCallbackUrl the GetCallbackUrlParameters value
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkflowTriggerCallbackUrlInner object | [
"Get",
"the",
"content",
"callback",
"url",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/PartnersInner.java#L672-L679 |
calimero-project/calimero-core | src/tuwien/auto/calimero/dptxlator/TranslatorTypes.java | TranslatorTypes.createTranslator | public static DPTXlator createTranslator(final DPT dpt, final byte... data) throws KNXException {
"""
Creates a DPT translator for the given datapoint type.
<p>
The translation behavior of a DPT translator instance is uniquely defined by the supplied datapoint type.
<p>
If translator creation according {@link #createTranslator(int, String)} fails, all available main types are
enumerated to find an appropriate translator.
@param dpt datapoint type selecting a particular kind of value translation
@param data (optional) KNX datapoint data to set in the created translator for translation
@return the new {@link DPTXlator} object
@throws KNXException if no matching DPT translator is available or creation failed
"""
final DPTXlator t = createTranslator(dpt);
if (data.length > 0)
t.setData(data);
return t;
} | java | public static DPTXlator createTranslator(final DPT dpt, final byte... data) throws KNXException {
final DPTXlator t = createTranslator(dpt);
if (data.length > 0)
t.setData(data);
return t;
} | [
"public",
"static",
"DPTXlator",
"createTranslator",
"(",
"final",
"DPT",
"dpt",
",",
"final",
"byte",
"...",
"data",
")",
"throws",
"KNXException",
"{",
"final",
"DPTXlator",
"t",
"=",
"createTranslator",
"(",
"dpt",
")",
";",
"if",
"(",
"data",
".",
"length",
">",
"0",
")",
"t",
".",
"setData",
"(",
"data",
")",
";",
"return",
"t",
";",
"}"
]
| Creates a DPT translator for the given datapoint type.
<p>
The translation behavior of a DPT translator instance is uniquely defined by the supplied datapoint type.
<p>
If translator creation according {@link #createTranslator(int, String)} fails, all available main types are
enumerated to find an appropriate translator.
@param dpt datapoint type selecting a particular kind of value translation
@param data (optional) KNX datapoint data to set in the created translator for translation
@return the new {@link DPTXlator} object
@throws KNXException if no matching DPT translator is available or creation failed | [
"Creates",
"a",
"DPT",
"translator",
"for",
"the",
"given",
"datapoint",
"type",
".",
"<p",
">",
"The",
"translation",
"behavior",
"of",
"a",
"DPT",
"translator",
"instance",
"is",
"uniquely",
"defined",
"by",
"the",
"supplied",
"datapoint",
"type",
".",
"<p",
">",
"If",
"translator",
"creation",
"according",
"{",
"@link",
"#createTranslator",
"(",
"int",
"String",
")",
"}",
"fails",
"all",
"available",
"main",
"types",
"are",
"enumerated",
"to",
"find",
"an",
"appropriate",
"translator",
"."
]
| train | https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/dptxlator/TranslatorTypes.java#L618-L623 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Channel.java | Channel.unregisterBlockListener | public boolean unregisterBlockListener(String handle) throws InvalidArgumentException {
"""
Unregister a block listener.
@param handle of Block listener to remove.
@return false if not found.
@throws InvalidArgumentException if the channel is shutdown or invalid arguments.
"""
if (shutdown) {
throw new InvalidArgumentException(format("Channel %s has been shutdown.", name));
}
checkHandle(BLOCK_LISTENER_TAG, handle);
logger.trace(format("Unregister BlockListener with handle %s.", handle));
LinkedHashMap<String, BL> lblockListeners = blockListeners;
if (lblockListeners == null) {
return false;
}
synchronized (lblockListeners) {
return null != lblockListeners.remove(handle);
}
} | java | public boolean unregisterBlockListener(String handle) throws InvalidArgumentException {
if (shutdown) {
throw new InvalidArgumentException(format("Channel %s has been shutdown.", name));
}
checkHandle(BLOCK_LISTENER_TAG, handle);
logger.trace(format("Unregister BlockListener with handle %s.", handle));
LinkedHashMap<String, BL> lblockListeners = blockListeners;
if (lblockListeners == null) {
return false;
}
synchronized (lblockListeners) {
return null != lblockListeners.remove(handle);
}
} | [
"public",
"boolean",
"unregisterBlockListener",
"(",
"String",
"handle",
")",
"throws",
"InvalidArgumentException",
"{",
"if",
"(",
"shutdown",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"format",
"(",
"\"Channel %s has been shutdown.\"",
",",
"name",
")",
")",
";",
"}",
"checkHandle",
"(",
"BLOCK_LISTENER_TAG",
",",
"handle",
")",
";",
"logger",
".",
"trace",
"(",
"format",
"(",
"\"Unregister BlockListener with handle %s.\"",
",",
"handle",
")",
")",
";",
"LinkedHashMap",
"<",
"String",
",",
"BL",
">",
"lblockListeners",
"=",
"blockListeners",
";",
"if",
"(",
"lblockListeners",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"synchronized",
"(",
"lblockListeners",
")",
"{",
"return",
"null",
"!=",
"lblockListeners",
".",
"remove",
"(",
"handle",
")",
";",
"}",
"}"
]
| Unregister a block listener.
@param handle of Block listener to remove.
@return false if not found.
@throws InvalidArgumentException if the channel is shutdown or invalid arguments. | [
"Unregister",
"a",
"block",
"listener",
"."
]
| train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L5576-L5595 |
HalBuilder/halbuilder-guava | src/main/java/com/theoryinpractise/halbuilder/guava/Representations.java | Representations.withLink | public static void withLink(Representation representation, String rel, String href, Optional<Predicate<ReadableRepresentation>> predicate, Optional<String> name, Optional<String> title, Optional<String> hreflang, Optional<String> profile) {
"""
Add a link to this resource
@param rel
@param href The target href for the link, relative to the href of this resource.
"""
if (predicate.or(Predicates.<ReadableRepresentation>alwaysTrue()).apply(representation)) {
representation.withLink(rel, href, name.orNull(), title.orNull(), hreflang.orNull(), profile.orNull());
}
} | java | public static void withLink(Representation representation, String rel, String href, Optional<Predicate<ReadableRepresentation>> predicate, Optional<String> name, Optional<String> title, Optional<String> hreflang, Optional<String> profile) {
if (predicate.or(Predicates.<ReadableRepresentation>alwaysTrue()).apply(representation)) {
representation.withLink(rel, href, name.orNull(), title.orNull(), hreflang.orNull(), profile.orNull());
}
} | [
"public",
"static",
"void",
"withLink",
"(",
"Representation",
"representation",
",",
"String",
"rel",
",",
"String",
"href",
",",
"Optional",
"<",
"Predicate",
"<",
"ReadableRepresentation",
">",
">",
"predicate",
",",
"Optional",
"<",
"String",
">",
"name",
",",
"Optional",
"<",
"String",
">",
"title",
",",
"Optional",
"<",
"String",
">",
"hreflang",
",",
"Optional",
"<",
"String",
">",
"profile",
")",
"{",
"if",
"(",
"predicate",
".",
"or",
"(",
"Predicates",
".",
"<",
"ReadableRepresentation",
">",
"alwaysTrue",
"(",
")",
")",
".",
"apply",
"(",
"representation",
")",
")",
"{",
"representation",
".",
"withLink",
"(",
"rel",
",",
"href",
",",
"name",
".",
"orNull",
"(",
")",
",",
"title",
".",
"orNull",
"(",
")",
",",
"hreflang",
".",
"orNull",
"(",
")",
",",
"profile",
".",
"orNull",
"(",
")",
")",
";",
"}",
"}"
]
| Add a link to this resource
@param rel
@param href The target href for the link, relative to the href of this resource. | [
"Add",
"a",
"link",
"to",
"this",
"resource"
]
| train | https://github.com/HalBuilder/halbuilder-guava/blob/648cb1ae6c4b4cebd82364a8d72d9801bd3db771/src/main/java/com/theoryinpractise/halbuilder/guava/Representations.java#L49-L53 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WebUtilities.java | WebUtilities.getClosestOfClass | public static <T> T getClosestOfClass(final Class<T> clazz, final WComponent comp) {
"""
Attempts to find the nearest component (may be the component itself) that is assignable to the given class.
@param clazz the class to look for
@param comp the component to start at.
@return the component or matching ancestor, if found, otherwise null.
@param <T> the class to find
"""
if (comp == null) {
return null;
}
if (clazz.isInstance(comp)) {
return (T) comp;
}
return getAncestorOfClass(clazz, comp);
} | java | public static <T> T getClosestOfClass(final Class<T> clazz, final WComponent comp) {
if (comp == null) {
return null;
}
if (clazz.isInstance(comp)) {
return (T) comp;
}
return getAncestorOfClass(clazz, comp);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getClosestOfClass",
"(",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"WComponent",
"comp",
")",
"{",
"if",
"(",
"comp",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"clazz",
".",
"isInstance",
"(",
"comp",
")",
")",
"{",
"return",
"(",
"T",
")",
"comp",
";",
"}",
"return",
"getAncestorOfClass",
"(",
"clazz",
",",
"comp",
")",
";",
"}"
]
| Attempts to find the nearest component (may be the component itself) that is assignable to the given class.
@param clazz the class to look for
@param comp the component to start at.
@return the component or matching ancestor, if found, otherwise null.
@param <T> the class to find | [
"Attempts",
"to",
"find",
"the",
"nearest",
"component",
"(",
"may",
"be",
"the",
"component",
"itself",
")",
"that",
"is",
"assignable",
"to",
"the",
"given",
"class",
"."
]
| train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WebUtilities.java#L250-L260 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/convert/encode/EncoderConverter.java | EncoderConverter.setString | public int setString(String strValue, boolean bDisplayOption, int iMoveMode) {
"""
Convert and move string to this field.
@param strString the state to set the data to.
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return The error code (or NORMAL_RETURN).
"""
try {
strValue = this.encodeString(strValue);
} catch (Exception ex) {
Task task = ((BaseField)this.getField()).getRecord().getRecordOwner().getTask();
return task.setLastError(ex.getMessage());
}
return super.setString(strValue, bDisplayOption, iMoveMode);
} | java | public int setString(String strValue, boolean bDisplayOption, int iMoveMode)
{
try {
strValue = this.encodeString(strValue);
} catch (Exception ex) {
Task task = ((BaseField)this.getField()).getRecord().getRecordOwner().getTask();
return task.setLastError(ex.getMessage());
}
return super.setString(strValue, bDisplayOption, iMoveMode);
} | [
"public",
"int",
"setString",
"(",
"String",
"strValue",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"try",
"{",
"strValue",
"=",
"this",
".",
"encodeString",
"(",
"strValue",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"Task",
"task",
"=",
"(",
"(",
"BaseField",
")",
"this",
".",
"getField",
"(",
")",
")",
".",
"getRecord",
"(",
")",
".",
"getRecordOwner",
"(",
")",
".",
"getTask",
"(",
")",
";",
"return",
"task",
".",
"setLastError",
"(",
"ex",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"return",
"super",
".",
"setString",
"(",
"strValue",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"}"
]
| Convert and move string to this field.
@param strString the state to set the data to.
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return The error code (or NORMAL_RETURN). | [
"Convert",
"and",
"move",
"string",
"to",
"this",
"field",
"."
]
| train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/encode/EncoderConverter.java#L100-L109 |
cdk/cdk | tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAromaticTypeMapping.java | MmffAromaticTypeMapping.getAlphaAromaticType | private String getAlphaAromaticType(String symb, boolean imidazolium, boolean anion) {
"""
Convenience method to obtain the aromatic type of a symbolic (SYMB) type in the alpha
position of a 5-member ring. This method delegates to {@link #getAromaticType(java.util.Map,
char, String, boolean, boolean)} setup for alpha atoms.
@param symb symbolic atom type
@param imidazolium imidazolium flag (IM naming from MMFFAROM.PAR)
@param anion anion flag (AN naming from MMFFAROM.PAR)
@return the aromatic type
"""
return getAromaticType(alphaTypes, 'A', symb, imidazolium, anion);
} | java | private String getAlphaAromaticType(String symb, boolean imidazolium, boolean anion) {
return getAromaticType(alphaTypes, 'A', symb, imidazolium, anion);
} | [
"private",
"String",
"getAlphaAromaticType",
"(",
"String",
"symb",
",",
"boolean",
"imidazolium",
",",
"boolean",
"anion",
")",
"{",
"return",
"getAromaticType",
"(",
"alphaTypes",
",",
"'",
"'",
",",
"symb",
",",
"imidazolium",
",",
"anion",
")",
";",
"}"
]
| Convenience method to obtain the aromatic type of a symbolic (SYMB) type in the alpha
position of a 5-member ring. This method delegates to {@link #getAromaticType(java.util.Map,
char, String, boolean, boolean)} setup for alpha atoms.
@param symb symbolic atom type
@param imidazolium imidazolium flag (IM naming from MMFFAROM.PAR)
@param anion anion flag (AN naming from MMFFAROM.PAR)
@return the aromatic type | [
"Convenience",
"method",
"to",
"obtain",
"the",
"aromatic",
"type",
"of",
"a",
"symbolic",
"(",
"SYMB",
")",
"type",
"in",
"the",
"alpha",
"position",
"of",
"a",
"5",
"-",
"member",
"ring",
".",
"This",
"method",
"delegates",
"to",
"{",
"@link",
"#getAromaticType",
"(",
"java",
".",
"util",
".",
"Map",
"char",
"String",
"boolean",
"boolean",
")",
"}",
"setup",
"for",
"alpha",
"atoms",
"."
]
| train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAromaticTypeMapping.java#L272-L274 |
datacleaner/AnalyzerBeans | env/cluster/src/main/java/org/eobjects/analyzer/cluster/http/SlaveServletHelper.java | SlaveServletHelper.handleRequest | public void handleRequest(final HttpServletRequest request, final HttpServletResponse response, final AnalysisListener ... analysisListeners) throws IOException {
"""
Completely handles a HTTP request and response. This method is
functionally equivalent of calling these methods in sequence:
{@link #readJob(HttpServletRequest)}
{@link #runJob(AnalysisJob, String, AnalysisListener...)
{@link #serializeResult(AnalysisResultFuture, String)}
{@link #sendResponse(HttpServletResponse, Serializable)}
@param request
@param response
@param analysisListeners
@throws IOException
"""
final String jobId = request.getParameter(HttpClusterManager.HTTP_PARAM_SLAVE_JOB_ID);
final String action = request.getParameter(HttpClusterManager.HTTP_PARAM_ACTION);
if (HttpClusterManager.ACTION_CANCEL.equals(action)) {
logger.info("Handling 'cancel' request: {}", jobId);
cancelJob(jobId);
return;
}
if (HttpClusterManager.ACTION_RUN.equals(action)) {
logger.info("Handling 'run' request: {}", jobId);
final AnalysisJob job;
try {
job = readJob(request);
} catch (IOException e) {
logger.error("Failed to read job definition from HTTP request", e);
throw e;
}
final Serializable resultObject;
try {
final AnalysisResultFuture resultFuture = runJob(job, jobId, analysisListeners);
resultObject = serializeResult(resultFuture, jobId);
} catch (RuntimeException e) {
logger.error("Unexpected error occurred while running slave job", e);
throw e;
}
try {
sendResponse(response, resultObject);
} catch (IOException e) {
logger.error("Failed to send job result through HTTP response", e);
throw e;
}
return;
}
logger.warn("Unspecified action request: {}", jobId);
} | java | public void handleRequest(final HttpServletRequest request, final HttpServletResponse response, final AnalysisListener ... analysisListeners) throws IOException {
final String jobId = request.getParameter(HttpClusterManager.HTTP_PARAM_SLAVE_JOB_ID);
final String action = request.getParameter(HttpClusterManager.HTTP_PARAM_ACTION);
if (HttpClusterManager.ACTION_CANCEL.equals(action)) {
logger.info("Handling 'cancel' request: {}", jobId);
cancelJob(jobId);
return;
}
if (HttpClusterManager.ACTION_RUN.equals(action)) {
logger.info("Handling 'run' request: {}", jobId);
final AnalysisJob job;
try {
job = readJob(request);
} catch (IOException e) {
logger.error("Failed to read job definition from HTTP request", e);
throw e;
}
final Serializable resultObject;
try {
final AnalysisResultFuture resultFuture = runJob(job, jobId, analysisListeners);
resultObject = serializeResult(resultFuture, jobId);
} catch (RuntimeException e) {
logger.error("Unexpected error occurred while running slave job", e);
throw e;
}
try {
sendResponse(response, resultObject);
} catch (IOException e) {
logger.error("Failed to send job result through HTTP response", e);
throw e;
}
return;
}
logger.warn("Unspecified action request: {}", jobId);
} | [
"public",
"void",
"handleRequest",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
",",
"final",
"AnalysisListener",
"...",
"analysisListeners",
")",
"throws",
"IOException",
"{",
"final",
"String",
"jobId",
"=",
"request",
".",
"getParameter",
"(",
"HttpClusterManager",
".",
"HTTP_PARAM_SLAVE_JOB_ID",
")",
";",
"final",
"String",
"action",
"=",
"request",
".",
"getParameter",
"(",
"HttpClusterManager",
".",
"HTTP_PARAM_ACTION",
")",
";",
"if",
"(",
"HttpClusterManager",
".",
"ACTION_CANCEL",
".",
"equals",
"(",
"action",
")",
")",
"{",
"logger",
".",
"info",
"(",
"\"Handling 'cancel' request: {}\"",
",",
"jobId",
")",
";",
"cancelJob",
"(",
"jobId",
")",
";",
"return",
";",
"}",
"if",
"(",
"HttpClusterManager",
".",
"ACTION_RUN",
".",
"equals",
"(",
"action",
")",
")",
"{",
"logger",
".",
"info",
"(",
"\"Handling 'run' request: {}\"",
",",
"jobId",
")",
";",
"final",
"AnalysisJob",
"job",
";",
"try",
"{",
"job",
"=",
"readJob",
"(",
"request",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"Failed to read job definition from HTTP request\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"final",
"Serializable",
"resultObject",
";",
"try",
"{",
"final",
"AnalysisResultFuture",
"resultFuture",
"=",
"runJob",
"(",
"job",
",",
"jobId",
",",
"analysisListeners",
")",
";",
"resultObject",
"=",
"serializeResult",
"(",
"resultFuture",
",",
"jobId",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"Unexpected error occurred while running slave job\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"try",
"{",
"sendResponse",
"(",
"response",
",",
"resultObject",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"Failed to send job result through HTTP response\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"return",
";",
"}",
"logger",
".",
"warn",
"(",
"\"Unspecified action request: {}\"",
",",
"jobId",
")",
";",
"}"
]
| Completely handles a HTTP request and response. This method is
functionally equivalent of calling these methods in sequence:
{@link #readJob(HttpServletRequest)}
{@link #runJob(AnalysisJob, String, AnalysisListener...)
{@link #serializeResult(AnalysisResultFuture, String)}
{@link #sendResponse(HttpServletResponse, Serializable)}
@param request
@param response
@param analysisListeners
@throws IOException | [
"Completely",
"handles",
"a",
"HTTP",
"request",
"and",
"response",
".",
"This",
"method",
"is",
"functionally",
"equivalent",
"of",
"calling",
"these",
"methods",
"in",
"sequence",
":"
]
| train | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/env/cluster/src/main/java/org/eobjects/analyzer/cluster/http/SlaveServletHelper.java#L163-L204 |
algolia/instantsearch-android | core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java | Searcher.loadMore | @NonNull
public Searcher loadMore() {
"""
Loads more results with the same query.
<p>
Note that this method won't do anything if {@link Searcher#hasMoreHits} returns false.
@return this {@link Searcher} for chaining.
"""
if (!hasMoreHits()) {
return this;
}
query.setPage(++lastRequestPage);
final int currentRequestId = ++lastRequestId;
EventBus.getDefault().post(new SearchEvent(this, query, currentRequestId));
pendingRequests.put(currentRequestId, triggerSearch(new CompletionHandler() {
@Override
public void requestCompleted(@NonNull JSONObject content, @Nullable AlgoliaException error) {
pendingRequests.remove(currentRequestId);
if (error != null) {
postError(error, currentRequestId);
} else {
if (currentRequestId <= lastResponseId) {
return; // Hits are for an older query, let's ignore them
}
if (hasHits(content)) {
updateListeners(content, true);
updateFacetStats(content);
lastResponsePage = lastRequestPage;
checkIfLastPage(content);
} else {
endReached = true;
}
EventBus.getDefault().post(new ResultEvent(Searcher.this, content, query, currentRequestId));
}
}
}));
return this;
} | java | @NonNull
public Searcher loadMore() {
if (!hasMoreHits()) {
return this;
}
query.setPage(++lastRequestPage);
final int currentRequestId = ++lastRequestId;
EventBus.getDefault().post(new SearchEvent(this, query, currentRequestId));
pendingRequests.put(currentRequestId, triggerSearch(new CompletionHandler() {
@Override
public void requestCompleted(@NonNull JSONObject content, @Nullable AlgoliaException error) {
pendingRequests.remove(currentRequestId);
if (error != null) {
postError(error, currentRequestId);
} else {
if (currentRequestId <= lastResponseId) {
return; // Hits are for an older query, let's ignore them
}
if (hasHits(content)) {
updateListeners(content, true);
updateFacetStats(content);
lastResponsePage = lastRequestPage;
checkIfLastPage(content);
} else {
endReached = true;
}
EventBus.getDefault().post(new ResultEvent(Searcher.this, content, query, currentRequestId));
}
}
}));
return this;
} | [
"@",
"NonNull",
"public",
"Searcher",
"loadMore",
"(",
")",
"{",
"if",
"(",
"!",
"hasMoreHits",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"query",
".",
"setPage",
"(",
"++",
"lastRequestPage",
")",
";",
"final",
"int",
"currentRequestId",
"=",
"++",
"lastRequestId",
";",
"EventBus",
".",
"getDefault",
"(",
")",
".",
"post",
"(",
"new",
"SearchEvent",
"(",
"this",
",",
"query",
",",
"currentRequestId",
")",
")",
";",
"pendingRequests",
".",
"put",
"(",
"currentRequestId",
",",
"triggerSearch",
"(",
"new",
"CompletionHandler",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"requestCompleted",
"(",
"@",
"NonNull",
"JSONObject",
"content",
",",
"@",
"Nullable",
"AlgoliaException",
"error",
")",
"{",
"pendingRequests",
".",
"remove",
"(",
"currentRequestId",
")",
";",
"if",
"(",
"error",
"!=",
"null",
")",
"{",
"postError",
"(",
"error",
",",
"currentRequestId",
")",
";",
"}",
"else",
"{",
"if",
"(",
"currentRequestId",
"<=",
"lastResponseId",
")",
"{",
"return",
";",
"// Hits are for an older query, let's ignore them",
"}",
"if",
"(",
"hasHits",
"(",
"content",
")",
")",
"{",
"updateListeners",
"(",
"content",
",",
"true",
")",
";",
"updateFacetStats",
"(",
"content",
")",
";",
"lastResponsePage",
"=",
"lastRequestPage",
";",
"checkIfLastPage",
"(",
"content",
")",
";",
"}",
"else",
"{",
"endReached",
"=",
"true",
";",
"}",
"EventBus",
".",
"getDefault",
"(",
")",
".",
"post",
"(",
"new",
"ResultEvent",
"(",
"Searcher",
".",
"this",
",",
"content",
",",
"query",
",",
"currentRequestId",
")",
")",
";",
"}",
"}",
"}",
")",
")",
";",
"return",
"this",
";",
"}"
]
| Loads more results with the same query.
<p>
Note that this method won't do anything if {@link Searcher#hasMoreHits} returns false.
@return this {@link Searcher} for chaining. | [
"Loads",
"more",
"results",
"with",
"the",
"same",
"query",
".",
"<p",
">",
"Note",
"that",
"this",
"method",
"won",
"t",
"do",
"anything",
"if",
"{",
"@link",
"Searcher#hasMoreHits",
"}",
"returns",
"false",
"."
]
| train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java#L404-L437 |
flow/caustic | api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java | MeshGenerator.generateCone | public static void generateCone(TFloatList positions, TFloatList normals, TIntList indices, float radius, float height) {
"""
Generates a conical solid mesh. The center is at the middle of the cone.
@param positions Where to save the position information
@param normals Where to save the normal information, can be null to ignore the attribute
@param indices Where to save the indices
@param radius The radius of the base
@param height The height (distance from the base to the apex)
"""
// 0,0,0 will be halfway up the cone in the middle
final float halfHeight = height / 2;
// The positions at the bottom rim of the cone
final List<Vector3f> rim = new ArrayList<>();
for (int angle = 0; angle < 360; angle += 15) {
final double angleRads = Math.toRadians(angle);
rim.add(new Vector3f(
radius * TrigMath.cos(angleRads),
-halfHeight,
radius * -TrigMath.sin(angleRads)));
}
// Apex of the cone
final Vector3f top = new Vector3f(0, halfHeight, 0);
// The normal for the triangle of the bottom face
final Vector3f bottomNormal = new Vector3f(0, -1, 0);
// Add the bottom face center vertex
addVector(positions, new Vector3f(0, -halfHeight, 0));// 0
addVector(normals, bottomNormal);
// The square of the radius of the cone on the xy plane
final float radiusSquared = radius * radius / 4;
// Add all the faces section by section, turning around the y axis
final int rimSize = rim.size();
for (int i = 0; i < rimSize; i++) {
// Get the bottom vertex position and the side normal
final Vector3f b = rim.get(i);
final Vector3f bn = new Vector3f(b.getX() / radiusSquared, halfHeight - b.getY(), b.getZ() / radiusSquared).normalize();
// Average the current and next normal to get the top normal
final int nextI = i == rimSize - 1 ? 0 : i + 1;
final Vector3f nextB = rim.get(nextI);
final Vector3f nextBN = new Vector3f(nextB.getX() / radiusSquared, halfHeight - nextB.getY(), nextB.getZ() / radiusSquared).normalize();
final Vector3f tn = bn.add(nextBN).normalize();
// Top side vertex
addVector(positions, top);// index
addVector(normals, tn);
// Bottom side vertex
addVector(positions, b);// index + 1
addVector(normals, bn);
// Bottom face vertex
addVector(positions, b);// index + 2
addVector(normals, bottomNormal);
// Get the current index for our vertices
final int currentIndex = i * 3 + 1;
// Get the index for the next iteration, wrapping around at the end
final int nextIndex = nextI * 3 + 1;
// Add the 2 triangles (1 side, 1 bottom)
addAll(indices, currentIndex, currentIndex + 1, nextIndex + 1);
addAll(indices, currentIndex + 2, 0, nextIndex + 2);
}
} | java | public static void generateCone(TFloatList positions, TFloatList normals, TIntList indices, float radius, float height) {
// 0,0,0 will be halfway up the cone in the middle
final float halfHeight = height / 2;
// The positions at the bottom rim of the cone
final List<Vector3f> rim = new ArrayList<>();
for (int angle = 0; angle < 360; angle += 15) {
final double angleRads = Math.toRadians(angle);
rim.add(new Vector3f(
radius * TrigMath.cos(angleRads),
-halfHeight,
radius * -TrigMath.sin(angleRads)));
}
// Apex of the cone
final Vector3f top = new Vector3f(0, halfHeight, 0);
// The normal for the triangle of the bottom face
final Vector3f bottomNormal = new Vector3f(0, -1, 0);
// Add the bottom face center vertex
addVector(positions, new Vector3f(0, -halfHeight, 0));// 0
addVector(normals, bottomNormal);
// The square of the radius of the cone on the xy plane
final float radiusSquared = radius * radius / 4;
// Add all the faces section by section, turning around the y axis
final int rimSize = rim.size();
for (int i = 0; i < rimSize; i++) {
// Get the bottom vertex position and the side normal
final Vector3f b = rim.get(i);
final Vector3f bn = new Vector3f(b.getX() / radiusSquared, halfHeight - b.getY(), b.getZ() / radiusSquared).normalize();
// Average the current and next normal to get the top normal
final int nextI = i == rimSize - 1 ? 0 : i + 1;
final Vector3f nextB = rim.get(nextI);
final Vector3f nextBN = new Vector3f(nextB.getX() / radiusSquared, halfHeight - nextB.getY(), nextB.getZ() / radiusSquared).normalize();
final Vector3f tn = bn.add(nextBN).normalize();
// Top side vertex
addVector(positions, top);// index
addVector(normals, tn);
// Bottom side vertex
addVector(positions, b);// index + 1
addVector(normals, bn);
// Bottom face vertex
addVector(positions, b);// index + 2
addVector(normals, bottomNormal);
// Get the current index for our vertices
final int currentIndex = i * 3 + 1;
// Get the index for the next iteration, wrapping around at the end
final int nextIndex = nextI * 3 + 1;
// Add the 2 triangles (1 side, 1 bottom)
addAll(indices, currentIndex, currentIndex + 1, nextIndex + 1);
addAll(indices, currentIndex + 2, 0, nextIndex + 2);
}
} | [
"public",
"static",
"void",
"generateCone",
"(",
"TFloatList",
"positions",
",",
"TFloatList",
"normals",
",",
"TIntList",
"indices",
",",
"float",
"radius",
",",
"float",
"height",
")",
"{",
"// 0,0,0 will be halfway up the cone in the middle",
"final",
"float",
"halfHeight",
"=",
"height",
"/",
"2",
";",
"// The positions at the bottom rim of the cone",
"final",
"List",
"<",
"Vector3f",
">",
"rim",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"angle",
"=",
"0",
";",
"angle",
"<",
"360",
";",
"angle",
"+=",
"15",
")",
"{",
"final",
"double",
"angleRads",
"=",
"Math",
".",
"toRadians",
"(",
"angle",
")",
";",
"rim",
".",
"add",
"(",
"new",
"Vector3f",
"(",
"radius",
"*",
"TrigMath",
".",
"cos",
"(",
"angleRads",
")",
",",
"-",
"halfHeight",
",",
"radius",
"*",
"-",
"TrigMath",
".",
"sin",
"(",
"angleRads",
")",
")",
")",
";",
"}",
"// Apex of the cone",
"final",
"Vector3f",
"top",
"=",
"new",
"Vector3f",
"(",
"0",
",",
"halfHeight",
",",
"0",
")",
";",
"// The normal for the triangle of the bottom face",
"final",
"Vector3f",
"bottomNormal",
"=",
"new",
"Vector3f",
"(",
"0",
",",
"-",
"1",
",",
"0",
")",
";",
"// Add the bottom face center vertex",
"addVector",
"(",
"positions",
",",
"new",
"Vector3f",
"(",
"0",
",",
"-",
"halfHeight",
",",
"0",
")",
")",
";",
"// 0",
"addVector",
"(",
"normals",
",",
"bottomNormal",
")",
";",
"// The square of the radius of the cone on the xy plane",
"final",
"float",
"radiusSquared",
"=",
"radius",
"*",
"radius",
"/",
"4",
";",
"// Add all the faces section by section, turning around the y axis",
"final",
"int",
"rimSize",
"=",
"rim",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rimSize",
";",
"i",
"++",
")",
"{",
"// Get the bottom vertex position and the side normal",
"final",
"Vector3f",
"b",
"=",
"rim",
".",
"get",
"(",
"i",
")",
";",
"final",
"Vector3f",
"bn",
"=",
"new",
"Vector3f",
"(",
"b",
".",
"getX",
"(",
")",
"/",
"radiusSquared",
",",
"halfHeight",
"-",
"b",
".",
"getY",
"(",
")",
",",
"b",
".",
"getZ",
"(",
")",
"/",
"radiusSquared",
")",
".",
"normalize",
"(",
")",
";",
"// Average the current and next normal to get the top normal",
"final",
"int",
"nextI",
"=",
"i",
"==",
"rimSize",
"-",
"1",
"?",
"0",
":",
"i",
"+",
"1",
";",
"final",
"Vector3f",
"nextB",
"=",
"rim",
".",
"get",
"(",
"nextI",
")",
";",
"final",
"Vector3f",
"nextBN",
"=",
"new",
"Vector3f",
"(",
"nextB",
".",
"getX",
"(",
")",
"/",
"radiusSquared",
",",
"halfHeight",
"-",
"nextB",
".",
"getY",
"(",
")",
",",
"nextB",
".",
"getZ",
"(",
")",
"/",
"radiusSquared",
")",
".",
"normalize",
"(",
")",
";",
"final",
"Vector3f",
"tn",
"=",
"bn",
".",
"add",
"(",
"nextBN",
")",
".",
"normalize",
"(",
")",
";",
"// Top side vertex",
"addVector",
"(",
"positions",
",",
"top",
")",
";",
"// index",
"addVector",
"(",
"normals",
",",
"tn",
")",
";",
"// Bottom side vertex",
"addVector",
"(",
"positions",
",",
"b",
")",
";",
"// index + 1",
"addVector",
"(",
"normals",
",",
"bn",
")",
";",
"// Bottom face vertex",
"addVector",
"(",
"positions",
",",
"b",
")",
";",
"// index + 2",
"addVector",
"(",
"normals",
",",
"bottomNormal",
")",
";",
"// Get the current index for our vertices",
"final",
"int",
"currentIndex",
"=",
"i",
"*",
"3",
"+",
"1",
";",
"// Get the index for the next iteration, wrapping around at the end",
"final",
"int",
"nextIndex",
"=",
"nextI",
"*",
"3",
"+",
"1",
";",
"// Add the 2 triangles (1 side, 1 bottom)",
"addAll",
"(",
"indices",
",",
"currentIndex",
",",
"currentIndex",
"+",
"1",
",",
"nextIndex",
"+",
"1",
")",
";",
"addAll",
"(",
"indices",
",",
"currentIndex",
"+",
"2",
",",
"0",
",",
"nextIndex",
"+",
"2",
")",
";",
"}",
"}"
]
| Generates a conical solid mesh. The center is at the middle of the cone.
@param positions Where to save the position information
@param normals Where to save the normal information, can be null to ignore the attribute
@param indices Where to save the indices
@param radius The radius of the base
@param height The height (distance from the base to the apex) | [
"Generates",
"a",
"conical",
"solid",
"mesh",
".",
"The",
"center",
"is",
"at",
"the",
"middle",
"of",
"the",
"cone",
"."
]
| train | https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java#L1025-L1074 |
alkacon/opencms-core | src-modules/org/opencms/workplace/commons/CmsSecure.java | CmsSecure.getPropertyInheritanceInfo | public String getPropertyInheritanceInfo(String propName) throws CmsException {
"""
Returns the information from which the property is inherited.<p>
@param propName the name of the property
@return a String containing the information from which the property is inherited and inherited value
@throws CmsException if the reading of the Property fails
"""
String folderName = CmsResource.getParentFolder(getParamResource());
String folderPropVal = null;
while (CmsStringUtil.isNotEmpty(folderName)) {
CmsProperty prop = getCms().readPropertyObject(folderName, propName, false);
folderPropVal = prop.getValue();
if (CmsStringUtil.isNotEmpty(folderPropVal)) {
break;
}
folderName = CmsResource.getParentFolder(folderName);
}
if (CmsStringUtil.isNotEmpty(folderPropVal)) {
return key(Messages.GUI_SECURE_INHERIT_FROM_2, new Object[] {folderPropVal, folderName});
} else {
return key(Messages.GUI_SECURE_NOT_SET_0);
}
} | java | public String getPropertyInheritanceInfo(String propName) throws CmsException {
String folderName = CmsResource.getParentFolder(getParamResource());
String folderPropVal = null;
while (CmsStringUtil.isNotEmpty(folderName)) {
CmsProperty prop = getCms().readPropertyObject(folderName, propName, false);
folderPropVal = prop.getValue();
if (CmsStringUtil.isNotEmpty(folderPropVal)) {
break;
}
folderName = CmsResource.getParentFolder(folderName);
}
if (CmsStringUtil.isNotEmpty(folderPropVal)) {
return key(Messages.GUI_SECURE_INHERIT_FROM_2, new Object[] {folderPropVal, folderName});
} else {
return key(Messages.GUI_SECURE_NOT_SET_0);
}
} | [
"public",
"String",
"getPropertyInheritanceInfo",
"(",
"String",
"propName",
")",
"throws",
"CmsException",
"{",
"String",
"folderName",
"=",
"CmsResource",
".",
"getParentFolder",
"(",
"getParamResource",
"(",
")",
")",
";",
"String",
"folderPropVal",
"=",
"null",
";",
"while",
"(",
"CmsStringUtil",
".",
"isNotEmpty",
"(",
"folderName",
")",
")",
"{",
"CmsProperty",
"prop",
"=",
"getCms",
"(",
")",
".",
"readPropertyObject",
"(",
"folderName",
",",
"propName",
",",
"false",
")",
";",
"folderPropVal",
"=",
"prop",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"CmsStringUtil",
".",
"isNotEmpty",
"(",
"folderPropVal",
")",
")",
"{",
"break",
";",
"}",
"folderName",
"=",
"CmsResource",
".",
"getParentFolder",
"(",
"folderName",
")",
";",
"}",
"if",
"(",
"CmsStringUtil",
".",
"isNotEmpty",
"(",
"folderPropVal",
")",
")",
"{",
"return",
"key",
"(",
"Messages",
".",
"GUI_SECURE_INHERIT_FROM_2",
",",
"new",
"Object",
"[",
"]",
"{",
"folderPropVal",
",",
"folderName",
"}",
")",
";",
"}",
"else",
"{",
"return",
"key",
"(",
"Messages",
".",
"GUI_SECURE_NOT_SET_0",
")",
";",
"}",
"}"
]
| Returns the information from which the property is inherited.<p>
@param propName the name of the property
@return a String containing the information from which the property is inherited and inherited value
@throws CmsException if the reading of the Property fails | [
"Returns",
"the",
"information",
"from",
"which",
"the",
"property",
"is",
"inherited",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsSecure.java#L217-L235 |
dnsjava/dnsjava | org/xbill/DNS/Record.java | Record.fromString | public static Record
fromString(Name name, int type, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException {
"""
Builds a new Record from its textual representation
@param name The owner name of the record.
@param type The record's type.
@param dclass The record's class.
@param ttl The record's time to live.
@param st A tokenizer containing the textual representation of the rdata.
@param origin The default origin to be appended to relative domain names.
@return The new record
@throws IOException The text format was invalid.
"""
Record rec;
if (!name.isAbsolute())
throw new RelativeNameException(name);
Type.check(type);
DClass.check(dclass);
TTL.check(ttl);
Tokenizer.Token t = st.get();
if (t.type == Tokenizer.IDENTIFIER && t.value.equals("\\#")) {
int length = st.getUInt16();
byte [] data = st.getHex();
if (data == null) {
data = new byte[0];
}
if (length != data.length)
throw st.exception("invalid unknown RR encoding: " +
"length mismatch");
DNSInput in = new DNSInput(data);
return newRecord(name, type, dclass, ttl, length, in);
}
st.unget();
rec = getEmptyRecord(name, type, dclass, ttl, true);
rec.rdataFromString(st, origin);
t = st.get();
if (t.type != Tokenizer.EOL && t.type != Tokenizer.EOF) {
throw st.exception("unexpected tokens at end of record");
}
return rec;
} | java | public static Record
fromString(Name name, int type, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
Record rec;
if (!name.isAbsolute())
throw new RelativeNameException(name);
Type.check(type);
DClass.check(dclass);
TTL.check(ttl);
Tokenizer.Token t = st.get();
if (t.type == Tokenizer.IDENTIFIER && t.value.equals("\\#")) {
int length = st.getUInt16();
byte [] data = st.getHex();
if (data == null) {
data = new byte[0];
}
if (length != data.length)
throw st.exception("invalid unknown RR encoding: " +
"length mismatch");
DNSInput in = new DNSInput(data);
return newRecord(name, type, dclass, ttl, length, in);
}
st.unget();
rec = getEmptyRecord(name, type, dclass, ttl, true);
rec.rdataFromString(st, origin);
t = st.get();
if (t.type != Tokenizer.EOL && t.type != Tokenizer.EOF) {
throw st.exception("unexpected tokens at end of record");
}
return rec;
} | [
"public",
"static",
"Record",
"fromString",
"(",
"Name",
"name",
",",
"int",
"type",
",",
"int",
"dclass",
",",
"long",
"ttl",
",",
"Tokenizer",
"st",
",",
"Name",
"origin",
")",
"throws",
"IOException",
"{",
"Record",
"rec",
";",
"if",
"(",
"!",
"name",
".",
"isAbsolute",
"(",
")",
")",
"throw",
"new",
"RelativeNameException",
"(",
"name",
")",
";",
"Type",
".",
"check",
"(",
"type",
")",
";",
"DClass",
".",
"check",
"(",
"dclass",
")",
";",
"TTL",
".",
"check",
"(",
"ttl",
")",
";",
"Tokenizer",
".",
"Token",
"t",
"=",
"st",
".",
"get",
"(",
")",
";",
"if",
"(",
"t",
".",
"type",
"==",
"Tokenizer",
".",
"IDENTIFIER",
"&&",
"t",
".",
"value",
".",
"equals",
"(",
"\"\\\\#\"",
")",
")",
"{",
"int",
"length",
"=",
"st",
".",
"getUInt16",
"(",
")",
";",
"byte",
"[",
"]",
"data",
"=",
"st",
".",
"getHex",
"(",
")",
";",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"data",
"=",
"new",
"byte",
"[",
"0",
"]",
";",
"}",
"if",
"(",
"length",
"!=",
"data",
".",
"length",
")",
"throw",
"st",
".",
"exception",
"(",
"\"invalid unknown RR encoding: \"",
"+",
"\"length mismatch\"",
")",
";",
"DNSInput",
"in",
"=",
"new",
"DNSInput",
"(",
"data",
")",
";",
"return",
"newRecord",
"(",
"name",
",",
"type",
",",
"dclass",
",",
"ttl",
",",
"length",
",",
"in",
")",
";",
"}",
"st",
".",
"unget",
"(",
")",
";",
"rec",
"=",
"getEmptyRecord",
"(",
"name",
",",
"type",
",",
"dclass",
",",
"ttl",
",",
"true",
")",
";",
"rec",
".",
"rdataFromString",
"(",
"st",
",",
"origin",
")",
";",
"t",
"=",
"st",
".",
"get",
"(",
")",
";",
"if",
"(",
"t",
".",
"type",
"!=",
"Tokenizer",
".",
"EOL",
"&&",
"t",
".",
"type",
"!=",
"Tokenizer",
".",
"EOF",
")",
"{",
"throw",
"st",
".",
"exception",
"(",
"\"unexpected tokens at end of record\"",
")",
";",
"}",
"return",
"rec",
";",
"}"
]
| Builds a new Record from its textual representation
@param name The owner name of the record.
@param type The record's type.
@param dclass The record's class.
@param ttl The record's time to live.
@param st A tokenizer containing the textual representation of the rdata.
@param origin The default origin to be appended to relative domain names.
@return The new record
@throws IOException The text format was invalid. | [
"Builds",
"a",
"new",
"Record",
"from",
"its",
"textual",
"representation"
]
| train | https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Record.java#L445-L478 |
xmlet/HtmlFlow | src/main/java/htmlflow/HtmlView.java | HtmlView.addPartial | public final <U> void addPartial(HtmlView<U> partial, U model) {
"""
Adds a partial view to this view.
@param partial inner view.
@param model the domain object bound to the partial view.
@param <U> the type of the domain model of the partial view.
"""
getVisitor().closeBeginTag();
partial.getVisitor().depth = getVisitor().depth;
if (this.getVisitor().isWriting())
getVisitor().write(partial.render(model));
} | java | public final <U> void addPartial(HtmlView<U> partial, U model) {
getVisitor().closeBeginTag();
partial.getVisitor().depth = getVisitor().depth;
if (this.getVisitor().isWriting())
getVisitor().write(partial.render(model));
} | [
"public",
"final",
"<",
"U",
">",
"void",
"addPartial",
"(",
"HtmlView",
"<",
"U",
">",
"partial",
",",
"U",
"model",
")",
"{",
"getVisitor",
"(",
")",
".",
"closeBeginTag",
"(",
")",
";",
"partial",
".",
"getVisitor",
"(",
")",
".",
"depth",
"=",
"getVisitor",
"(",
")",
".",
"depth",
";",
"if",
"(",
"this",
".",
"getVisitor",
"(",
")",
".",
"isWriting",
"(",
")",
")",
"getVisitor",
"(",
")",
".",
"write",
"(",
"partial",
".",
"render",
"(",
"model",
")",
")",
";",
"}"
]
| Adds a partial view to this view.
@param partial inner view.
@param model the domain object bound to the partial view.
@param <U> the type of the domain model of the partial view. | [
"Adds",
"a",
"partial",
"view",
"to",
"this",
"view",
"."
]
| train | https://github.com/xmlet/HtmlFlow/blob/5318be5765b0850496645d7c11bdf2848c094b17/src/main/java/htmlflow/HtmlView.java#L170-L175 |
anotheria/moskito | moskito-integration/moskito-sql/src/main/java/net/anotheria/moskito/sql/callingAspect/ConnectionCallAspect.java | ConnectionCallAspect.addTrace | private void addTrace(String statement, final boolean isSuccess, final long duration) {
"""
Perform additional profiling - for Journey stuff.
@param statement prepared statement
@param isSuccess is success
"""
TracedCall aRunningTrace = RunningTraceContainer.getCurrentlyTracedCall();
CurrentlyTracedCall currentTrace = aRunningTrace.callTraced() ? (CurrentlyTracedCall) aRunningTrace : null;
if (currentTrace != null) {
TraceStep currentStep = currentTrace.startStep((isSuccess ? EMPTY : SQL_QUERY_FAILED) + "SQL : (' " + statement + "')", producer, statement);
if (!isSuccess)
currentStep.setAborted();
currentStep.setDuration(duration);
currentTrace.endStep();
}
} | java | private void addTrace(String statement, final boolean isSuccess, final long duration) {
TracedCall aRunningTrace = RunningTraceContainer.getCurrentlyTracedCall();
CurrentlyTracedCall currentTrace = aRunningTrace.callTraced() ? (CurrentlyTracedCall) aRunningTrace : null;
if (currentTrace != null) {
TraceStep currentStep = currentTrace.startStep((isSuccess ? EMPTY : SQL_QUERY_FAILED) + "SQL : (' " + statement + "')", producer, statement);
if (!isSuccess)
currentStep.setAborted();
currentStep.setDuration(duration);
currentTrace.endStep();
}
} | [
"private",
"void",
"addTrace",
"(",
"String",
"statement",
",",
"final",
"boolean",
"isSuccess",
",",
"final",
"long",
"duration",
")",
"{",
"TracedCall",
"aRunningTrace",
"=",
"RunningTraceContainer",
".",
"getCurrentlyTracedCall",
"(",
")",
";",
"CurrentlyTracedCall",
"currentTrace",
"=",
"aRunningTrace",
".",
"callTraced",
"(",
")",
"?",
"(",
"CurrentlyTracedCall",
")",
"aRunningTrace",
":",
"null",
";",
"if",
"(",
"currentTrace",
"!=",
"null",
")",
"{",
"TraceStep",
"currentStep",
"=",
"currentTrace",
".",
"startStep",
"(",
"(",
"isSuccess",
"?",
"EMPTY",
":",
"SQL_QUERY_FAILED",
")",
"+",
"\"SQL : (' \"",
"+",
"statement",
"+",
"\"')\"",
",",
"producer",
",",
"statement",
")",
";",
"if",
"(",
"!",
"isSuccess",
")",
"currentStep",
".",
"setAborted",
"(",
")",
";",
"currentStep",
".",
"setDuration",
"(",
"duration",
")",
";",
"currentTrace",
".",
"endStep",
"(",
")",
";",
"}",
"}"
]
| Perform additional profiling - for Journey stuff.
@param statement prepared statement
@param isSuccess is success | [
"Perform",
"additional",
"profiling",
"-",
"for",
"Journey",
"stuff",
"."
]
| train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-integration/moskito-sql/src/main/java/net/anotheria/moskito/sql/callingAspect/ConnectionCallAspect.java#L166-L177 |
wisdom-framework/wisdom | core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java | ConfigurationImpl.getBooleanOrDie | @Override
public Boolean getBooleanOrDie(String key) {
"""
The "die" method forces this key to be set. Otherwise a runtime exception
will be thrown.
@param key the key
@return the boolean or a IllegalArgumentException will be thrown.
"""
Boolean value = getBoolean(key);
if (value == null) {
throw new IllegalArgumentException(String.format(ERROR_KEYNOTFOUND, key));
} else {
return value;
}
} | java | @Override
public Boolean getBooleanOrDie(String key) {
Boolean value = getBoolean(key);
if (value == null) {
throw new IllegalArgumentException(String.format(ERROR_KEYNOTFOUND, key));
} else {
return value;
}
} | [
"@",
"Override",
"public",
"Boolean",
"getBooleanOrDie",
"(",
"String",
"key",
")",
"{",
"Boolean",
"value",
"=",
"getBoolean",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"ERROR_KEYNOTFOUND",
",",
"key",
")",
")",
";",
"}",
"else",
"{",
"return",
"value",
";",
"}",
"}"
]
| The "die" method forces this key to be set. Otherwise a runtime exception
will be thrown.
@param key the key
@return the boolean or a IllegalArgumentException will be thrown. | [
"The",
"die",
"method",
"forces",
"this",
"key",
"to",
"be",
"set",
".",
"Otherwise",
"a",
"runtime",
"exception",
"will",
"be",
"thrown",
"."
]
| train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java#L276-L284 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaauser_tmsessionpolicy_binding.java | aaauser_tmsessionpolicy_binding.count_filtered | public static long count_filtered(nitro_service service, String username, String filter) throws Exception {
"""
Use this API to count the filtered set of aaauser_tmsessionpolicy_binding resources.
filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
"""
aaauser_tmsessionpolicy_binding obj = new aaauser_tmsessionpolicy_binding();
obj.set_username(username);
options option = new options();
option.set_count(true);
option.set_filter(filter);
aaauser_tmsessionpolicy_binding[] response = (aaauser_tmsessionpolicy_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | java | public static long count_filtered(nitro_service service, String username, String filter) throws Exception{
aaauser_tmsessionpolicy_binding obj = new aaauser_tmsessionpolicy_binding();
obj.set_username(username);
options option = new options();
option.set_count(true);
option.set_filter(filter);
aaauser_tmsessionpolicy_binding[] response = (aaauser_tmsessionpolicy_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | [
"public",
"static",
"long",
"count_filtered",
"(",
"nitro_service",
"service",
",",
"String",
"username",
",",
"String",
"filter",
")",
"throws",
"Exception",
"{",
"aaauser_tmsessionpolicy_binding",
"obj",
"=",
"new",
"aaauser_tmsessionpolicy_binding",
"(",
")",
";",
"obj",
".",
"set_username",
"(",
"username",
")",
";",
"options",
"option",
"=",
"new",
"options",
"(",
")",
";",
"option",
".",
"set_count",
"(",
"true",
")",
";",
"option",
".",
"set_filter",
"(",
"filter",
")",
";",
"aaauser_tmsessionpolicy_binding",
"[",
"]",
"response",
"=",
"(",
"aaauser_tmsessionpolicy_binding",
"[",
"]",
")",
"obj",
".",
"getfiltered",
"(",
"service",
",",
"option",
")",
";",
"if",
"(",
"response",
"!=",
"null",
")",
"{",
"return",
"response",
"[",
"0",
"]",
".",
"__count",
";",
"}",
"return",
"0",
";",
"}"
]
| Use this API to count the filtered set of aaauser_tmsessionpolicy_binding resources.
filter string should be in JSON format.eg: "port:80,servicetype:HTTP". | [
"Use",
"this",
"API",
"to",
"count",
"the",
"filtered",
"set",
"of",
"aaauser_tmsessionpolicy_binding",
"resources",
".",
"filter",
"string",
"should",
"be",
"in",
"JSON",
"format",
".",
"eg",
":",
"port",
":",
"80",
"servicetype",
":",
"HTTP",
"."
]
| train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaauser_tmsessionpolicy_binding.java#L292-L303 |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/audit/AuditServiceImpl.java | AuditServiceImpl.getAttributeSmart | private String getAttributeSmart(Element element, String attr) {
"""
Get attribute value.
@param element The element to get attribute value
@param attr The attribute name
@return Value of attribute if present and null in other case
"""
return element.hasAttribute(attr) ? element.getAttribute(attr) : null;
} | java | private String getAttributeSmart(Element element, String attr)
{
return element.hasAttribute(attr) ? element.getAttribute(attr) : null;
} | [
"private",
"String",
"getAttributeSmart",
"(",
"Element",
"element",
",",
"String",
"attr",
")",
"{",
"return",
"element",
".",
"hasAttribute",
"(",
"attr",
")",
"?",
"element",
".",
"getAttribute",
"(",
"attr",
")",
":",
"null",
";",
"}"
]
| Get attribute value.
@param element The element to get attribute value
@param attr The attribute name
@return Value of attribute if present and null in other case | [
"Get",
"attribute",
"value",
"."
]
| train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/audit/AuditServiceImpl.java#L822-L825 |
alibaba/jstorm | jstorm-core/src/main/java/backtype/storm/topology/TopologyBuilder.java | TopologyBuilder.setBolt | public BoltDeclarer setBolt(String id, IWindowedBolt bolt, Number parallelism_hint) throws IllegalArgumentException {
"""
Define a new bolt in this topology. This defines a windowed bolt, intended
for windowing operations. The {@link IWindowedBolt#execute(TupleWindow)} method
is triggered for each window interval with the list of current events in the window.
@param id the id of this component. This id is referenced by other components that want to consume this bolt's outputs.
@param bolt the windowed bolt
@param parallelism_hint the number of tasks that should be assigned to execute this bolt. Each task will run on a thread in a process somwehere around the cluster.
@return use the returned object to declare the inputs to this component
@throws IllegalArgumentException if {@code parallelism_hint} is not positive
"""
return setBolt(id, new backtype.storm.topology.WindowedBoltExecutor(bolt), parallelism_hint);
} | java | public BoltDeclarer setBolt(String id, IWindowedBolt bolt, Number parallelism_hint) throws IllegalArgumentException {
return setBolt(id, new backtype.storm.topology.WindowedBoltExecutor(bolt), parallelism_hint);
} | [
"public",
"BoltDeclarer",
"setBolt",
"(",
"String",
"id",
",",
"IWindowedBolt",
"bolt",
",",
"Number",
"parallelism_hint",
")",
"throws",
"IllegalArgumentException",
"{",
"return",
"setBolt",
"(",
"id",
",",
"new",
"backtype",
".",
"storm",
".",
"topology",
".",
"WindowedBoltExecutor",
"(",
"bolt",
")",
",",
"parallelism_hint",
")",
";",
"}"
]
| Define a new bolt in this topology. This defines a windowed bolt, intended
for windowing operations. The {@link IWindowedBolt#execute(TupleWindow)} method
is triggered for each window interval with the list of current events in the window.
@param id the id of this component. This id is referenced by other components that want to consume this bolt's outputs.
@param bolt the windowed bolt
@param parallelism_hint the number of tasks that should be assigned to execute this bolt. Each task will run on a thread in a process somwehere around the cluster.
@return use the returned object to declare the inputs to this component
@throws IllegalArgumentException if {@code parallelism_hint} is not positive | [
"Define",
"a",
"new",
"bolt",
"in",
"this",
"topology",
".",
"This",
"defines",
"a",
"windowed",
"bolt",
"intended",
"for",
"windowing",
"operations",
".",
"The",
"{",
"@link",
"IWindowedBolt#execute",
"(",
"TupleWindow",
")",
"}",
"method",
"is",
"triggered",
"for",
"each",
"window",
"interval",
"with",
"the",
"list",
"of",
"current",
"events",
"in",
"the",
"window",
"."
]
| train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/topology/TopologyBuilder.java#L235-L237 |
elki-project/elki | elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/Itemset.java | Itemset.appendTo | public final StringBuilder appendTo(StringBuilder buf, VectorFieldTypeInformation<BitVector> meta) {
"""
Append items and support to a string buffer.
@param buf Buffer
@param meta Relation metadata (for labels)
@return String buffer for chaining.
"""
appendItemsTo(buf, meta);
return buf.append(": ").append(support);
} | java | public final StringBuilder appendTo(StringBuilder buf, VectorFieldTypeInformation<BitVector> meta) {
appendItemsTo(buf, meta);
return buf.append(": ").append(support);
} | [
"public",
"final",
"StringBuilder",
"appendTo",
"(",
"StringBuilder",
"buf",
",",
"VectorFieldTypeInformation",
"<",
"BitVector",
">",
"meta",
")",
"{",
"appendItemsTo",
"(",
"buf",
",",
"meta",
")",
";",
"return",
"buf",
".",
"append",
"(",
"\": \"",
")",
".",
"append",
"(",
"support",
")",
";",
"}"
]
| Append items and support to a string buffer.
@param buf Buffer
@param meta Relation metadata (for labels)
@return String buffer for chaining. | [
"Append",
"items",
"and",
"support",
"to",
"a",
"string",
"buffer",
"."
]
| train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/Itemset.java#L223-L226 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/media/MediaClient.java | MediaClient.createPreset | public CreatePresetResponse createPreset(CreatePresetRequest request) {
"""
Create a preset which help to convert media files on be played in a wide range of devices.
@param request The request object containing all options for deleting presets.
"""
checkNotNull(request, "The parameter request should NOT be null.");
InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, PRESET);
return invokeHttpClient(internalRequest, CreatePresetResponse.class);
} | java | public CreatePresetResponse createPreset(CreatePresetRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, PRESET);
return invokeHttpClient(internalRequest, CreatePresetResponse.class);
} | [
"public",
"CreatePresetResponse",
"createPreset",
"(",
"CreatePresetRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"InternalRequest",
"internalRequest",
"=",
"createRequest",
"(",
"HttpMethodName",
".",
"POST",
",",
"request",
",",
"PRESET",
")",
";",
"return",
"invokeHttpClient",
"(",
"internalRequest",
",",
"CreatePresetResponse",
".",
"class",
")",
";",
"}"
]
| Create a preset which help to convert media files on be played in a wide range of devices.
@param request The request object containing all options for deleting presets. | [
"Create",
"a",
"preset",
"which",
"help",
"to",
"convert",
"media",
"files",
"on",
"be",
"played",
"in",
"a",
"wide",
"range",
"of",
"devices",
"."
]
| train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L907-L913 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Solo.java | Solo.waitForFragmentByTag | public boolean waitForFragmentByTag(String tag, int timeout) {
"""
Waits for a Fragment matching the specified tag.
@param tag the name of the tag
@param timeout the amount of time in milliseconds to wait
@return {@code true} if fragment appears and {@code false} if it does not appear before the timeout
"""
if(config.commandLogging){
Log.d(config.commandLoggingTag, "waitForFragmentByTag(\""+tag+"\", "+timeout+")");
}
return waiter.waitForFragment(tag, 0, timeout);
} | java | public boolean waitForFragmentByTag(String tag, int timeout){
if(config.commandLogging){
Log.d(config.commandLoggingTag, "waitForFragmentByTag(\""+tag+"\", "+timeout+")");
}
return waiter.waitForFragment(tag, 0, timeout);
} | [
"public",
"boolean",
"waitForFragmentByTag",
"(",
"String",
"tag",
",",
"int",
"timeout",
")",
"{",
"if",
"(",
"config",
".",
"commandLogging",
")",
"{",
"Log",
".",
"d",
"(",
"config",
".",
"commandLoggingTag",
",",
"\"waitForFragmentByTag(\\\"\"",
"+",
"tag",
"+",
"\"\\\", \"",
"+",
"timeout",
"+",
"\")\"",
")",
";",
"}",
"return",
"waiter",
".",
"waitForFragment",
"(",
"tag",
",",
"0",
",",
"timeout",
")",
";",
"}"
]
| Waits for a Fragment matching the specified tag.
@param tag the name of the tag
@param timeout the amount of time in milliseconds to wait
@return {@code true} if fragment appears and {@code false} if it does not appear before the timeout | [
"Waits",
"for",
"a",
"Fragment",
"matching",
"the",
"specified",
"tag",
"."
]
| train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L3678-L3684 |
jqm4gwt/jqm4gwt | library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMRadioset.java | JQMRadioset.addRadio | public JQMRadio addRadio(String value, String text) {
"""
Adds a new radio button to this radioset using the given value and text.
Returns a JQMRadio instance which can be used to change the value and
label of the radio button.
@param value
the value to associate with this radio option. This will be
the value returned by methods that query the selected value.
@param text
the label to show for this radio option.
@return a JQMRadio instance to adjust the added radio button
"""
JQMRadio radio = new JQMRadio(value, text);
addRadio(radio);
return radio;
} | java | public JQMRadio addRadio(String value, String text) {
JQMRadio radio = new JQMRadio(value, text);
addRadio(radio);
return radio;
} | [
"public",
"JQMRadio",
"addRadio",
"(",
"String",
"value",
",",
"String",
"text",
")",
"{",
"JQMRadio",
"radio",
"=",
"new",
"JQMRadio",
"(",
"value",
",",
"text",
")",
";",
"addRadio",
"(",
"radio",
")",
";",
"return",
"radio",
";",
"}"
]
| Adds a new radio button to this radioset using the given value and text.
Returns a JQMRadio instance which can be used to change the value and
label of the radio button.
@param value
the value to associate with this radio option. This will be
the value returned by methods that query the selected value.
@param text
the label to show for this radio option.
@return a JQMRadio instance to adjust the added radio button | [
"Adds",
"a",
"new",
"radio",
"button",
"to",
"this",
"radioset",
"using",
"the",
"given",
"value",
"and",
"text",
".",
"Returns",
"a",
"JQMRadio",
"instance",
"which",
"can",
"be",
"used",
"to",
"change",
"the",
"value",
"and",
"label",
"of",
"the",
"radio",
"button",
"."
]
| train | https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMRadioset.java#L218-L222 |
alkacon/opencms-core | src/org/opencms/staticexport/A_CmsStaticExportHandler.java | A_CmsStaticExportHandler.purgeFiles | private void purgeFiles(List<File> files, String vfsName, Set<String> scrubbedFiles) {
"""
Purges a list of files from the rfs.<p>
@param files the list of files to purge
@param vfsName the vfs name of the originally file to purge
@param scrubbedFiles the list which stores all the scrubbed files
"""
for (File file : files) {
purgeFile(file.getAbsolutePath(), vfsName);
String rfsName = CmsFileUtil.normalizePath(
OpenCms.getStaticExportManager().getRfsPrefix(vfsName)
+ "/"
+ file.getAbsolutePath().substring(
OpenCms.getStaticExportManager().getExportPath(vfsName).length()));
rfsName = CmsStringUtil.substitute(rfsName, new String(new char[] {File.separatorChar}), "/");
scrubbedFiles.add(rfsName);
}
} | java | private void purgeFiles(List<File> files, String vfsName, Set<String> scrubbedFiles) {
for (File file : files) {
purgeFile(file.getAbsolutePath(), vfsName);
String rfsName = CmsFileUtil.normalizePath(
OpenCms.getStaticExportManager().getRfsPrefix(vfsName)
+ "/"
+ file.getAbsolutePath().substring(
OpenCms.getStaticExportManager().getExportPath(vfsName).length()));
rfsName = CmsStringUtil.substitute(rfsName, new String(new char[] {File.separatorChar}), "/");
scrubbedFiles.add(rfsName);
}
} | [
"private",
"void",
"purgeFiles",
"(",
"List",
"<",
"File",
">",
"files",
",",
"String",
"vfsName",
",",
"Set",
"<",
"String",
">",
"scrubbedFiles",
")",
"{",
"for",
"(",
"File",
"file",
":",
"files",
")",
"{",
"purgeFile",
"(",
"file",
".",
"getAbsolutePath",
"(",
")",
",",
"vfsName",
")",
";",
"String",
"rfsName",
"=",
"CmsFileUtil",
".",
"normalizePath",
"(",
"OpenCms",
".",
"getStaticExportManager",
"(",
")",
".",
"getRfsPrefix",
"(",
"vfsName",
")",
"+",
"\"/\"",
"+",
"file",
".",
"getAbsolutePath",
"(",
")",
".",
"substring",
"(",
"OpenCms",
".",
"getStaticExportManager",
"(",
")",
".",
"getExportPath",
"(",
"vfsName",
")",
".",
"length",
"(",
")",
")",
")",
";",
"rfsName",
"=",
"CmsStringUtil",
".",
"substitute",
"(",
"rfsName",
",",
"new",
"String",
"(",
"new",
"char",
"[",
"]",
"{",
"File",
".",
"separatorChar",
"}",
")",
",",
"\"/\"",
")",
";",
"scrubbedFiles",
".",
"add",
"(",
"rfsName",
")",
";",
"}",
"}"
]
| Purges a list of files from the rfs.<p>
@param files the list of files to purge
@param vfsName the vfs name of the originally file to purge
@param scrubbedFiles the list which stores all the scrubbed files | [
"Purges",
"a",
"list",
"of",
"files",
"from",
"the",
"rfs",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/A_CmsStaticExportHandler.java#L680-L692 |
twotoasters/JazzyListView | library-recyclerview/src/main/java/com/twotoasters/jazzylistview/recyclerview/JazzyRecyclerViewScrollListener.java | JazzyRecyclerViewScrollListener.notifyAdditionalOnScrollStateChangedListener | private void notifyAdditionalOnScrollStateChangedListener(RecyclerView recyclerView, int newState) {
"""
Notifies the OnScrollListener of an onScrollStateChanged event, since JazzyListView is the primary listener for onScrollStateChanged events.
"""
if (mAdditionalOnScrollListener != null) {
mAdditionalOnScrollListener.onScrollStateChanged(recyclerView, newState);
}
} | java | private void notifyAdditionalOnScrollStateChangedListener(RecyclerView recyclerView, int newState) {
if (mAdditionalOnScrollListener != null) {
mAdditionalOnScrollListener.onScrollStateChanged(recyclerView, newState);
}
} | [
"private",
"void",
"notifyAdditionalOnScrollStateChangedListener",
"(",
"RecyclerView",
"recyclerView",
",",
"int",
"newState",
")",
"{",
"if",
"(",
"mAdditionalOnScrollListener",
"!=",
"null",
")",
"{",
"mAdditionalOnScrollListener",
".",
"onScrollStateChanged",
"(",
"recyclerView",
",",
"newState",
")",
";",
"}",
"}"
]
| Notifies the OnScrollListener of an onScrollStateChanged event, since JazzyListView is the primary listener for onScrollStateChanged events. | [
"Notifies",
"the",
"OnScrollListener",
"of",
"an",
"onScrollStateChanged",
"event",
"since",
"JazzyListView",
"is",
"the",
"primary",
"listener",
"for",
"onScrollStateChanged",
"events",
"."
]
| train | https://github.com/twotoasters/JazzyListView/blob/4a69239f90374a71e7d4073448ca049bd074f7fe/library-recyclerview/src/main/java/com/twotoasters/jazzylistview/recyclerview/JazzyRecyclerViewScrollListener.java#L116-L120 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_volume_volumeId_GET | public OvhVolume project_serviceName_volume_volumeId_GET(String serviceName, String volumeId) throws IOException {
"""
Get volume details
REST: GET /cloud/project/{serviceName}/volume/{volumeId}
@param serviceName [required] Project id
@param volumeId [required] Volume id
"""
String qPath = "/cloud/project/{serviceName}/volume/{volumeId}";
StringBuilder sb = path(qPath, serviceName, volumeId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhVolume.class);
} | java | public OvhVolume project_serviceName_volume_volumeId_GET(String serviceName, String volumeId) throws IOException {
String qPath = "/cloud/project/{serviceName}/volume/{volumeId}";
StringBuilder sb = path(qPath, serviceName, volumeId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhVolume.class);
} | [
"public",
"OvhVolume",
"project_serviceName_volume_volumeId_GET",
"(",
"String",
"serviceName",
",",
"String",
"volumeId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/volume/{volumeId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"volumeId",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhVolume",
".",
"class",
")",
";",
"}"
]
| Get volume details
REST: GET /cloud/project/{serviceName}/volume/{volumeId}
@param serviceName [required] Project id
@param volumeId [required] Volume id | [
"Get",
"volume",
"details"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1119-L1124 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/ImplementationImpl.java | ImplementationImpl.newDArray | public DArray newDArray() {
"""
Create a new <code>DArray</code> object.
@return The new <code>DArray</code> object.
@see DArray
"""
if ((getCurrentDatabase() == null))
{
throw new DatabaseClosedException("Database is NULL, cannot create a DArray with a null database.");
}
return (DArray) DArrayFactory.singleton.createCollectionOrMap(getCurrentPBKey());
} | java | public DArray newDArray()
{
if ((getCurrentDatabase() == null))
{
throw new DatabaseClosedException("Database is NULL, cannot create a DArray with a null database.");
}
return (DArray) DArrayFactory.singleton.createCollectionOrMap(getCurrentPBKey());
} | [
"public",
"DArray",
"newDArray",
"(",
")",
"{",
"if",
"(",
"(",
"getCurrentDatabase",
"(",
")",
"==",
"null",
")",
")",
"{",
"throw",
"new",
"DatabaseClosedException",
"(",
"\"Database is NULL, cannot create a DArray with a null database.\"",
")",
";",
"}",
"return",
"(",
"DArray",
")",
"DArrayFactory",
".",
"singleton",
".",
"createCollectionOrMap",
"(",
"getCurrentPBKey",
"(",
")",
")",
";",
"}"
]
| Create a new <code>DArray</code> object.
@return The new <code>DArray</code> object.
@see DArray | [
"Create",
"a",
"new",
"<code",
">",
"DArray<",
"/",
"code",
">",
"object",
"."
]
| train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ImplementationImpl.java#L253-L260 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/DateUtils.java | DateUtils.subHours | public static long subHours(final Date date1, final Date date2) {
"""
Get how many hours between two date.
@param date1 date to be tested.
@param date2 date to be tested.
@return how many hours between two date.
"""
return subTime(date1, date2, DatePeriod.HOUR);
} | java | public static long subHours(final Date date1, final Date date2) {
return subTime(date1, date2, DatePeriod.HOUR);
} | [
"public",
"static",
"long",
"subHours",
"(",
"final",
"Date",
"date1",
",",
"final",
"Date",
"date2",
")",
"{",
"return",
"subTime",
"(",
"date1",
",",
"date2",
",",
"DatePeriod",
".",
"HOUR",
")",
";",
"}"
]
| Get how many hours between two date.
@param date1 date to be tested.
@param date2 date to be tested.
@return how many hours between two date. | [
"Get",
"how",
"many",
"hours",
"between",
"two",
"date",
"."
]
| train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L435-L438 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/InternalOutputStream.java | InternalOutputStream.writeUncommitted | public void writeUncommitted(SIMPMessage m)
throws SIResourceException {
"""
This method uses a Value message to write an Uncommitted tick
into the stream.
It is called at preCommit time.
@param m The value message to write to the stream
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "writeUncommitted", new Object[] { m });
TickRange tr = null;
JsMessage jsMsg = m.getMessage();
long stamp = jsMsg.getGuaranteedValueValueTick();
long starts = jsMsg.getGuaranteedValueStartTick();
long ends = jsMsg.getGuaranteedValueEndTick();
long completedPrefix;
tr = TickRange.newUncommittedTick(stamp);
tr.startstamp = starts;
tr.endstamp = ends;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "writeUncommitted at: " + stamp + " with Silence from: " + starts + " to " + ends + " on Stream " + streamID);
}
synchronized (this)
{
// write into stream
oststream.writeCombinedRange(tr);
completedPrefix = oststream.getCompletedPrefix();
sendSilence(starts, completedPrefix);
// SIB0105
// If this is the first uncommitted messages to be added to the stream, start off the
// blocked message health state timer. This will check back in the future to see if the
// message successfully sent.
if (blockedStreamAlarm == null)
{
blockedStreamAlarm = new BlockedStreamAlarm(this, getCompletedPrefix());
am.create(GDConfig.BLOCKED_STREAM_HEALTH_CHECK_INTERVAL, blockedStreamAlarm);
}
} // end synchronized
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeUncommitted");
} | java | public void writeUncommitted(SIMPMessage m)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "writeUncommitted", new Object[] { m });
TickRange tr = null;
JsMessage jsMsg = m.getMessage();
long stamp = jsMsg.getGuaranteedValueValueTick();
long starts = jsMsg.getGuaranteedValueStartTick();
long ends = jsMsg.getGuaranteedValueEndTick();
long completedPrefix;
tr = TickRange.newUncommittedTick(stamp);
tr.startstamp = starts;
tr.endstamp = ends;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "writeUncommitted at: " + stamp + " with Silence from: " + starts + " to " + ends + " on Stream " + streamID);
}
synchronized (this)
{
// write into stream
oststream.writeCombinedRange(tr);
completedPrefix = oststream.getCompletedPrefix();
sendSilence(starts, completedPrefix);
// SIB0105
// If this is the first uncommitted messages to be added to the stream, start off the
// blocked message health state timer. This will check back in the future to see if the
// message successfully sent.
if (blockedStreamAlarm == null)
{
blockedStreamAlarm = new BlockedStreamAlarm(this, getCompletedPrefix());
am.create(GDConfig.BLOCKED_STREAM_HEALTH_CHECK_INTERVAL, blockedStreamAlarm);
}
} // end synchronized
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeUncommitted");
} | [
"public",
"void",
"writeUncommitted",
"(",
"SIMPMessage",
"m",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"writeUncommitted\"",
",",
"new",
"Object",
"[",
"]",
"{",
"m",
"}",
")",
";",
"TickRange",
"tr",
"=",
"null",
";",
"JsMessage",
"jsMsg",
"=",
"m",
".",
"getMessage",
"(",
")",
";",
"long",
"stamp",
"=",
"jsMsg",
".",
"getGuaranteedValueValueTick",
"(",
")",
";",
"long",
"starts",
"=",
"jsMsg",
".",
"getGuaranteedValueStartTick",
"(",
")",
";",
"long",
"ends",
"=",
"jsMsg",
".",
"getGuaranteedValueEndTick",
"(",
")",
";",
"long",
"completedPrefix",
";",
"tr",
"=",
"TickRange",
".",
"newUncommittedTick",
"(",
"stamp",
")",
";",
"tr",
".",
"startstamp",
"=",
"starts",
";",
"tr",
".",
"endstamp",
"=",
"ends",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"writeUncommitted at: \"",
"+",
"stamp",
"+",
"\" with Silence from: \"",
"+",
"starts",
"+",
"\" to \"",
"+",
"ends",
"+",
"\" on Stream \"",
"+",
"streamID",
")",
";",
"}",
"synchronized",
"(",
"this",
")",
"{",
"// write into stream",
"oststream",
".",
"writeCombinedRange",
"(",
"tr",
")",
";",
"completedPrefix",
"=",
"oststream",
".",
"getCompletedPrefix",
"(",
")",
";",
"sendSilence",
"(",
"starts",
",",
"completedPrefix",
")",
";",
"// SIB0105",
"// If this is the first uncommitted messages to be added to the stream, start off the ",
"// blocked message health state timer. This will check back in the future to see if the",
"// message successfully sent.",
"if",
"(",
"blockedStreamAlarm",
"==",
"null",
")",
"{",
"blockedStreamAlarm",
"=",
"new",
"BlockedStreamAlarm",
"(",
"this",
",",
"getCompletedPrefix",
"(",
")",
")",
";",
"am",
".",
"create",
"(",
"GDConfig",
".",
"BLOCKED_STREAM_HEALTH_CHECK_INTERVAL",
",",
"blockedStreamAlarm",
")",
";",
"}",
"}",
"// end synchronized",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"writeUncommitted\"",
")",
";",
"}"
]
| This method uses a Value message to write an Uncommitted tick
into the stream.
It is called at preCommit time.
@param m The value message to write to the stream | [
"This",
"method",
"uses",
"a",
"Value",
"message",
"to",
"write",
"an",
"Uncommitted",
"tick",
"into",
"the",
"stream",
".",
"It",
"is",
"called",
"at",
"preCommit",
"time",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/InternalOutputStream.java#L533-L581 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java | HashCodeBuilder.reflectionHashCode | @GwtIncompatible("incompatible method")
public static int reflectionHashCode(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber, final Object object) {
"""
<p>
Uses reflection to build a valid hash code from the fields of {@code object}.
</p>
<p>
It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
also not as efficient as testing explicitly.
</p>
<p>
Transient members will be not be used, as they are likely derived fields, and not part of the value of the
<code>Object</code>.
</p>
<p>
Static fields will not be tested. Superclass fields will be included.
</p>
<p>
Two randomly chosen, non-zero, odd numbers must be passed in. Ideally these should be different for each class,
however this is not vital. Prime numbers are preferred, especially for the multiplier.
</p>
@param initialNonZeroOddNumber
a non-zero, odd number used as the initial value. This will be the returned
value if no fields are found to include in the hash code
@param multiplierNonZeroOddNumber
a non-zero, odd number used as the multiplier
@param object
the Object to create a <code>hashCode</code> for
@return int hash code
@throws IllegalArgumentException
if the Object is <code>null</code>
@throws IllegalArgumentException
if the number is zero or even
@see HashCodeExclude
"""
return reflectionHashCode(initialNonZeroOddNumber, multiplierNonZeroOddNumber, object, false, null);
} | java | @GwtIncompatible("incompatible method")
public static int reflectionHashCode(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber, final Object object) {
return reflectionHashCode(initialNonZeroOddNumber, multiplierNonZeroOddNumber, object, false, null);
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"int",
"reflectionHashCode",
"(",
"final",
"int",
"initialNonZeroOddNumber",
",",
"final",
"int",
"multiplierNonZeroOddNumber",
",",
"final",
"Object",
"object",
")",
"{",
"return",
"reflectionHashCode",
"(",
"initialNonZeroOddNumber",
",",
"multiplierNonZeroOddNumber",
",",
"object",
",",
"false",
",",
"null",
")",
";",
"}"
]
| <p>
Uses reflection to build a valid hash code from the fields of {@code object}.
</p>
<p>
It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
also not as efficient as testing explicitly.
</p>
<p>
Transient members will be not be used, as they are likely derived fields, and not part of the value of the
<code>Object</code>.
</p>
<p>
Static fields will not be tested. Superclass fields will be included.
</p>
<p>
Two randomly chosen, non-zero, odd numbers must be passed in. Ideally these should be different for each class,
however this is not vital. Prime numbers are preferred, especially for the multiplier.
</p>
@param initialNonZeroOddNumber
a non-zero, odd number used as the initial value. This will be the returned
value if no fields are found to include in the hash code
@param multiplierNonZeroOddNumber
a non-zero, odd number used as the multiplier
@param object
the Object to create a <code>hashCode</code> for
@return int hash code
@throws IllegalArgumentException
if the Object is <code>null</code>
@throws IllegalArgumentException
if the number is zero or even
@see HashCodeExclude | [
"<p",
">",
"Uses",
"reflection",
"to",
"build",
"a",
"valid",
"hash",
"code",
"from",
"the",
"fields",
"of",
"{",
"@code",
"object",
"}",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java#L260-L263 |
apache/incubator-atlas | repository/src/main/java/org/apache/atlas/gremlin/GremlinExpressionFactory.java | GremlinExpressionFactory.generateLoopEmitExpression | protected GroovyExpression generateLoopEmitExpression(GraphPersistenceStrategies s, IDataType dataType) {
"""
Generates the emit expression used in loop expressions.
@param s
@param dataType
@return
"""
return typeTestExpression(s, dataType.getName(), getCurrentObjectExpression());
} | java | protected GroovyExpression generateLoopEmitExpression(GraphPersistenceStrategies s, IDataType dataType) {
return typeTestExpression(s, dataType.getName(), getCurrentObjectExpression());
} | [
"protected",
"GroovyExpression",
"generateLoopEmitExpression",
"(",
"GraphPersistenceStrategies",
"s",
",",
"IDataType",
"dataType",
")",
"{",
"return",
"typeTestExpression",
"(",
"s",
",",
"dataType",
".",
"getName",
"(",
")",
",",
"getCurrentObjectExpression",
"(",
")",
")",
";",
"}"
]
| Generates the emit expression used in loop expressions.
@param s
@param dataType
@return | [
"Generates",
"the",
"emit",
"expression",
"used",
"in",
"loop",
"expressions",
"."
]
| train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/gremlin/GremlinExpressionFactory.java#L441-L443 |
apereo/cas | support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java | LdapUtils.executeSearchOperation | public static Response<SearchResult> executeSearchOperation(final ConnectionFactory connectionFactory,
final String baseDn,
final SearchFilter filter) throws LdapException {
"""
Execute search operation response.
@param connectionFactory the connection factory
@param baseDn the base dn
@param filter the filter
@return the response
@throws LdapException the ldap exception
"""
return executeSearchOperation(connectionFactory, baseDn, filter, ReturnAttributes.ALL_USER.value(), ReturnAttributes.ALL_USER.value());
} | java | public static Response<SearchResult> executeSearchOperation(final ConnectionFactory connectionFactory,
final String baseDn,
final SearchFilter filter) throws LdapException {
return executeSearchOperation(connectionFactory, baseDn, filter, ReturnAttributes.ALL_USER.value(), ReturnAttributes.ALL_USER.value());
} | [
"public",
"static",
"Response",
"<",
"SearchResult",
">",
"executeSearchOperation",
"(",
"final",
"ConnectionFactory",
"connectionFactory",
",",
"final",
"String",
"baseDn",
",",
"final",
"SearchFilter",
"filter",
")",
"throws",
"LdapException",
"{",
"return",
"executeSearchOperation",
"(",
"connectionFactory",
",",
"baseDn",
",",
"filter",
",",
"ReturnAttributes",
".",
"ALL_USER",
".",
"value",
"(",
")",
",",
"ReturnAttributes",
".",
"ALL_USER",
".",
"value",
"(",
")",
")",
";",
"}"
]
| Execute search operation response.
@param connectionFactory the connection factory
@param baseDn the base dn
@param filter the filter
@return the response
@throws LdapException the ldap exception | [
"Execute",
"search",
"operation",
"response",
"."
]
| train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java#L268-L272 |
jpaoletti/java-presentation-manager | modules/jpm-core/src/main/java/jpaoletti/jpm/util/Utils.java | Utils.padleft | public static String padleft(String s, int len, char c) {
"""
Pad to the left
@param s string
@param len desired len
@param c padding char
@return padded string
"""
s = s.trim();
if (s.length() > len) {
return s;
}
final StringBuilder sb = new StringBuilder(len);
int fill = len - s.length();
while (fill-- > 0) {
sb.append(c);
}
sb.append(s);
return sb.toString();
} | java | public static String padleft(String s, int len, char c) {
s = s.trim();
if (s.length() > len) {
return s;
}
final StringBuilder sb = new StringBuilder(len);
int fill = len - s.length();
while (fill-- > 0) {
sb.append(c);
}
sb.append(s);
return sb.toString();
} | [
"public",
"static",
"String",
"padleft",
"(",
"String",
"s",
",",
"int",
"len",
",",
"char",
"c",
")",
"{",
"s",
"=",
"s",
".",
"trim",
"(",
")",
";",
"if",
"(",
"s",
".",
"length",
"(",
")",
">",
"len",
")",
"{",
"return",
"s",
";",
"}",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"len",
")",
";",
"int",
"fill",
"=",
"len",
"-",
"s",
".",
"length",
"(",
")",
";",
"while",
"(",
"fill",
"--",
">",
"0",
")",
"{",
"sb",
".",
"append",
"(",
"c",
")",
";",
"}",
"sb",
".",
"append",
"(",
"s",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
]
| Pad to the left
@param s string
@param len desired len
@param c padding char
@return padded string | [
"Pad",
"to",
"the",
"left"
]
| train | https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/util/Utils.java#L17-L29 |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/common/TenantDefinition.java | TenantDefinition.optionValueToUNode | @SuppressWarnings("unchecked")
private UNode optionValueToUNode(String optName, Object optValue) {
"""
Return a UNode that represents the given option's serialized value.
"""
if (!(optValue instanceof Map)) {
if (optValue == null) {
optValue = "";
}
return UNode.createValueNode(optName, optValue.toString(), "option");
}
UNode optNode = UNode.createMapNode(optName, "option");
Map<String, Object> suboptMap = (Map<String,Object>)optValue;
for (String suboptName : suboptMap.keySet()) {
optNode.addChildNode(optionValueToUNode(suboptName, suboptMap.get(suboptName)));
}
return optNode;
} | java | @SuppressWarnings("unchecked")
private UNode optionValueToUNode(String optName, Object optValue) {
if (!(optValue instanceof Map)) {
if (optValue == null) {
optValue = "";
}
return UNode.createValueNode(optName, optValue.toString(), "option");
}
UNode optNode = UNode.createMapNode(optName, "option");
Map<String, Object> suboptMap = (Map<String,Object>)optValue;
for (String suboptName : suboptMap.keySet()) {
optNode.addChildNode(optionValueToUNode(suboptName, suboptMap.get(suboptName)));
}
return optNode;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"UNode",
"optionValueToUNode",
"(",
"String",
"optName",
",",
"Object",
"optValue",
")",
"{",
"if",
"(",
"!",
"(",
"optValue",
"instanceof",
"Map",
")",
")",
"{",
"if",
"(",
"optValue",
"==",
"null",
")",
"{",
"optValue",
"=",
"\"\"",
";",
"}",
"return",
"UNode",
".",
"createValueNode",
"(",
"optName",
",",
"optValue",
".",
"toString",
"(",
")",
",",
"\"option\"",
")",
";",
"}",
"UNode",
"optNode",
"=",
"UNode",
".",
"createMapNode",
"(",
"optName",
",",
"\"option\"",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"suboptMap",
"=",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"optValue",
";",
"for",
"(",
"String",
"suboptName",
":",
"suboptMap",
".",
"keySet",
"(",
")",
")",
"{",
"optNode",
".",
"addChildNode",
"(",
"optionValueToUNode",
"(",
"suboptName",
",",
"suboptMap",
".",
"get",
"(",
"suboptName",
")",
")",
")",
";",
"}",
"return",
"optNode",
";",
"}"
]
| Return a UNode that represents the given option's serialized value. | [
"Return",
"a",
"UNode",
"that",
"represents",
"the",
"given",
"option",
"s",
"serialized",
"value",
"."
]
| train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/TenantDefinition.java#L198-L212 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/convert/FirstMLastConverter.java | FirstMLastConverter.setString | public int setString(String strSource, boolean bDisplayOption, int iMoveMode) // init this field override for other value {
"""
Convert and move string to this field.
Split the part of this string into the target fields.
Override this method to convert the String to the actual Physical Data Type.
@param bState the state to set the data to.
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return The error code (or NORMAL_RETURN).
"""
int iErrorReturn = FirstMLastConverter.nameToParts(strSource, bDisplayOption, iMoveMode, m_recThis, m_iNamePrefix, m_iNameFirst, m_iNameMiddle, m_iNameSur, m_iNameSuffix, m_iNameTitle);
if (iErrorReturn == DBConstants.NORMAL_RETURN)
if (this.getNextConverter() != null)
iErrorReturn = super.setString(strSource, bDisplayOption, iMoveMode);
return iErrorReturn;
} | java | public int setString(String strSource, boolean bDisplayOption, int iMoveMode) // init this field override for other value
{
int iErrorReturn = FirstMLastConverter.nameToParts(strSource, bDisplayOption, iMoveMode, m_recThis, m_iNamePrefix, m_iNameFirst, m_iNameMiddle, m_iNameSur, m_iNameSuffix, m_iNameTitle);
if (iErrorReturn == DBConstants.NORMAL_RETURN)
if (this.getNextConverter() != null)
iErrorReturn = super.setString(strSource, bDisplayOption, iMoveMode);
return iErrorReturn;
} | [
"public",
"int",
"setString",
"(",
"String",
"strSource",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"// init this field override for other value",
"{",
"int",
"iErrorReturn",
"=",
"FirstMLastConverter",
".",
"nameToParts",
"(",
"strSource",
",",
"bDisplayOption",
",",
"iMoveMode",
",",
"m_recThis",
",",
"m_iNamePrefix",
",",
"m_iNameFirst",
",",
"m_iNameMiddle",
",",
"m_iNameSur",
",",
"m_iNameSuffix",
",",
"m_iNameTitle",
")",
";",
"if",
"(",
"iErrorReturn",
"==",
"DBConstants",
".",
"NORMAL_RETURN",
")",
"if",
"(",
"this",
".",
"getNextConverter",
"(",
")",
"!=",
"null",
")",
"iErrorReturn",
"=",
"super",
".",
"setString",
"(",
"strSource",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"return",
"iErrorReturn",
";",
"}"
]
| Convert and move string to this field.
Split the part of this string into the target fields.
Override this method to convert the String to the actual Physical Data Type.
@param bState the state to set the data to.
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return The error code (or NORMAL_RETURN). | [
"Convert",
"and",
"move",
"string",
"to",
"this",
"field",
".",
"Split",
"the",
"part",
"of",
"this",
"string",
"into",
"the",
"target",
"fields",
".",
"Override",
"this",
"method",
"to",
"convert",
"the",
"String",
"to",
"the",
"actual",
"Physical",
"Data",
"Type",
"."
]
| train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/FirstMLastConverter.java#L270-L277 |
jdereg/java-util | src/main/java/com/cedarsoftware/util/EncryptionUtilities.java | EncryptionUtilities.createAesCipher | public static Cipher createAesCipher(Key key, int mode) throws Exception {
"""
Creates a Cipher from the passed in key, using the passed in mode.
@param key SecretKeySpec
@param mode Cipher.ENCRYPT_MODE or Cipher.DECRYPT_MODE
@return Cipher instance created with the passed in key and mode.
"""
// Use password key as seed for IV (must be 16 bytes)
MessageDigest d = getMD5Digest();
d.update(key.getEncoded());
byte[] iv = d.digest();
AlgorithmParameterSpec paramSpec = new IvParameterSpec(iv);
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); // CBC faster than CFB8/NoPadding (but file length changes)
cipher.init(mode, key, paramSpec);
return cipher;
} | java | public static Cipher createAesCipher(Key key, int mode) throws Exception
{
// Use password key as seed for IV (must be 16 bytes)
MessageDigest d = getMD5Digest();
d.update(key.getEncoded());
byte[] iv = d.digest();
AlgorithmParameterSpec paramSpec = new IvParameterSpec(iv);
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); // CBC faster than CFB8/NoPadding (but file length changes)
cipher.init(mode, key, paramSpec);
return cipher;
} | [
"public",
"static",
"Cipher",
"createAesCipher",
"(",
"Key",
"key",
",",
"int",
"mode",
")",
"throws",
"Exception",
"{",
"// Use password key as seed for IV (must be 16 bytes)",
"MessageDigest",
"d",
"=",
"getMD5Digest",
"(",
")",
";",
"d",
".",
"update",
"(",
"key",
".",
"getEncoded",
"(",
")",
")",
";",
"byte",
"[",
"]",
"iv",
"=",
"d",
".",
"digest",
"(",
")",
";",
"AlgorithmParameterSpec",
"paramSpec",
"=",
"new",
"IvParameterSpec",
"(",
"iv",
")",
";",
"Cipher",
"cipher",
"=",
"Cipher",
".",
"getInstance",
"(",
"\"AES/CBC/PKCS5Padding\"",
")",
";",
"// CBC faster than CFB8/NoPadding (but file length changes)",
"cipher",
".",
"init",
"(",
"mode",
",",
"key",
",",
"paramSpec",
")",
";",
"return",
"cipher",
";",
"}"
]
| Creates a Cipher from the passed in key, using the passed in mode.
@param key SecretKeySpec
@param mode Cipher.ENCRYPT_MODE or Cipher.DECRYPT_MODE
@return Cipher instance created with the passed in key and mode. | [
"Creates",
"a",
"Cipher",
"from",
"the",
"passed",
"in",
"key",
"using",
"the",
"passed",
"in",
"mode",
"."
]
| train | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/EncryptionUtilities.java#L179-L190 |
milaboratory/milib | src/main/java/com/milaboratory/core/motif/BitapPattern.java | BitapPattern.substitutionAndIndelMatcherFirst | public BitapMatcher substitutionAndIndelMatcherFirst(int maxNumberOfErrors, final Sequence sequence) {
"""
Returns a BitapMatcher preforming a fuzzy search in a whole {@code sequence}. Search allows no more than {@code
maxNumberOfErrors} number of substitutions/insertions/deletions. Matcher will return positions of first matched
letter in the motif in descending order.
@param maxNumberOfErrors maximal number of allowed substitutions/insertions/deletions
@param sequence target sequence
@return matcher which will return positions of first matched letter in the motif in descending order
"""
return substitutionAndIndelMatcherFirst(maxNumberOfErrors, sequence, 0, sequence.size());
} | java | public BitapMatcher substitutionAndIndelMatcherFirst(int maxNumberOfErrors, final Sequence sequence) {
return substitutionAndIndelMatcherFirst(maxNumberOfErrors, sequence, 0, sequence.size());
} | [
"public",
"BitapMatcher",
"substitutionAndIndelMatcherFirst",
"(",
"int",
"maxNumberOfErrors",
",",
"final",
"Sequence",
"sequence",
")",
"{",
"return",
"substitutionAndIndelMatcherFirst",
"(",
"maxNumberOfErrors",
",",
"sequence",
",",
"0",
",",
"sequence",
".",
"size",
"(",
")",
")",
";",
"}"
]
| Returns a BitapMatcher preforming a fuzzy search in a whole {@code sequence}. Search allows no more than {@code
maxNumberOfErrors} number of substitutions/insertions/deletions. Matcher will return positions of first matched
letter in the motif in descending order.
@param maxNumberOfErrors maximal number of allowed substitutions/insertions/deletions
@param sequence target sequence
@return matcher which will return positions of first matched letter in the motif in descending order | [
"Returns",
"a",
"BitapMatcher",
"preforming",
"a",
"fuzzy",
"search",
"in",
"a",
"whole",
"{",
"@code",
"sequence",
"}",
".",
"Search",
"allows",
"no",
"more",
"than",
"{",
"@code",
"maxNumberOfErrors",
"}",
"number",
"of",
"substitutions",
"/",
"insertions",
"/",
"deletions",
".",
"Matcher",
"will",
"return",
"positions",
"of",
"first",
"matched",
"letter",
"in",
"the",
"motif",
"in",
"descending",
"order",
"."
]
| train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/motif/BitapPattern.java#L256-L258 |
wcm-io/wcm-io-handler | url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java | SuffixParser.getPage | public @Nullable Page getPage(@NotNull Predicate<Page> filter) {
"""
Parse the suffix as page paths, return the first page from the suffix (relativ to the current page) that matches the given filter.
@param filter a filter that selects only the page you're interested in.
@return the page or null if no such page was selected by suffix
"""
return getPage(filter, (Page)null);
} | java | public @Nullable Page getPage(@NotNull Predicate<Page> filter) {
return getPage(filter, (Page)null);
} | [
"public",
"@",
"Nullable",
"Page",
"getPage",
"(",
"@",
"NotNull",
"Predicate",
"<",
"Page",
">",
"filter",
")",
"{",
"return",
"getPage",
"(",
"filter",
",",
"(",
"Page",
")",
"null",
")",
";",
"}"
]
| Parse the suffix as page paths, return the first page from the suffix (relativ to the current page) that matches the given filter.
@param filter a filter that selects only the page you're interested in.
@return the page or null if no such page was selected by suffix | [
"Parse",
"the",
"suffix",
"as",
"page",
"paths",
"return",
"the",
"first",
"page",
"from",
"the",
"suffix",
"(",
"relativ",
"to",
"the",
"current",
"page",
")",
"that",
"matches",
"the",
"given",
"filter",
"."
]
| train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java#L302-L304 |
code4everything/util | src/main/java/com/zhazhapan/util/RandomUtils.java | RandomUtils.getRandomTextIgnoreRange | public static String getRandomTextIgnoreRange(int floor, int ceil, int length, int[]... ranges) {
"""
获取自定义忽略多个区间的随机字符串
@param floor ascii下限
@param ceil ascii上限
@param length 长度
@param ranges 忽略区间(包含下限和上限长度为2的一维数组),可以有多个忽略区间
@return 字符串
"""
StringBuilder builder = new StringBuilder();
for (int i = 0; i < length; i++) {
builder.append((char) getRandomIntegerIgnoreRange(floor, ceil, ranges));
}
return builder.toString();
} | java | public static String getRandomTextIgnoreRange(int floor, int ceil, int length, int[]... ranges) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < length; i++) {
builder.append((char) getRandomIntegerIgnoreRange(floor, ceil, ranges));
}
return builder.toString();
} | [
"public",
"static",
"String",
"getRandomTextIgnoreRange",
"(",
"int",
"floor",
",",
"int",
"ceil",
",",
"int",
"length",
",",
"int",
"[",
"]",
"...",
"ranges",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"builder",
".",
"append",
"(",
"(",
"char",
")",
"getRandomIntegerIgnoreRange",
"(",
"floor",
",",
"ceil",
",",
"ranges",
")",
")",
";",
"}",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
]
| 获取自定义忽略多个区间的随机字符串
@param floor ascii下限
@param ceil ascii上限
@param length 长度
@param ranges 忽略区间(包含下限和上限长度为2的一维数组),可以有多个忽略区间
@return 字符串 | [
"获取自定义忽略多个区间的随机字符串"
]
| train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/RandomUtils.java#L116-L122 |
haifengl/smile | core/src/main/java/smile/classification/NeuralNetwork.java | NeuralNetwork.getOutput | private void getOutput(double[] y) {
"""
Returns the output vector into the given array.
@param y the output vector.
"""
if (y.length != outputLayer.units) {
throw new IllegalArgumentException(String.format("Invalid output vector size: %d, expected: %d", y.length, outputLayer.units));
}
System.arraycopy(outputLayer.output, 0, y, 0, outputLayer.units);
} | java | private void getOutput(double[] y) {
if (y.length != outputLayer.units) {
throw new IllegalArgumentException(String.format("Invalid output vector size: %d, expected: %d", y.length, outputLayer.units));
}
System.arraycopy(outputLayer.output, 0, y, 0, outputLayer.units);
} | [
"private",
"void",
"getOutput",
"(",
"double",
"[",
"]",
"y",
")",
"{",
"if",
"(",
"y",
".",
"length",
"!=",
"outputLayer",
".",
"units",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Invalid output vector size: %d, expected: %d\"",
",",
"y",
".",
"length",
",",
"outputLayer",
".",
"units",
")",
")",
";",
"}",
"System",
".",
"arraycopy",
"(",
"outputLayer",
".",
"output",
",",
"0",
",",
"y",
",",
"0",
",",
"outputLayer",
".",
"units",
")",
";",
"}"
]
| Returns the output vector into the given array.
@param y the output vector. | [
"Returns",
"the",
"output",
"vector",
"into",
"the",
"given",
"array",
"."
]
| train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/NeuralNetwork.java#L608-L613 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/internal/config/InternalConfig.java | InternalConfig.getSignerConfig | public SignerConfig getSignerConfig(String serviceName, String regionName) {
"""
Returns the signer configuration for the specified service name and an optional region name.
@param serviceName
must not be null
@param regionName
similar to the region name in <code>Regions</code>; can be null.
@return the signer
"""
if (serviceName == null)
throw new IllegalArgumentException();
SignerConfig signerConfig = null;
if (regionName != null) {
// Service+Region signer config has the highest precedence
String key = serviceName + SERVICE_REGION_DELIMITOR + regionName;
signerConfig = serviceRegionSigners.get(key);
if (signerConfig != null) {
return signerConfig;
}
// Region signer config has the 2nd highest precedence
signerConfig = regionSigners.get(regionName);
if (signerConfig != null) {
return signerConfig;
}
}
// Service signer config has the 3rd highest precedence
signerConfig = serviceSigners.get(serviceName);
// Fall back to the default
return signerConfig == null ? defaultSignerConfig : signerConfig;
} | java | public SignerConfig getSignerConfig(String serviceName, String regionName) {
if (serviceName == null)
throw new IllegalArgumentException();
SignerConfig signerConfig = null;
if (regionName != null) {
// Service+Region signer config has the highest precedence
String key = serviceName + SERVICE_REGION_DELIMITOR + regionName;
signerConfig = serviceRegionSigners.get(key);
if (signerConfig != null) {
return signerConfig;
}
// Region signer config has the 2nd highest precedence
signerConfig = regionSigners.get(regionName);
if (signerConfig != null) {
return signerConfig;
}
}
// Service signer config has the 3rd highest precedence
signerConfig = serviceSigners.get(serviceName);
// Fall back to the default
return signerConfig == null ? defaultSignerConfig : signerConfig;
} | [
"public",
"SignerConfig",
"getSignerConfig",
"(",
"String",
"serviceName",
",",
"String",
"regionName",
")",
"{",
"if",
"(",
"serviceName",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"SignerConfig",
"signerConfig",
"=",
"null",
";",
"if",
"(",
"regionName",
"!=",
"null",
")",
"{",
"// Service+Region signer config has the highest precedence",
"String",
"key",
"=",
"serviceName",
"+",
"SERVICE_REGION_DELIMITOR",
"+",
"regionName",
";",
"signerConfig",
"=",
"serviceRegionSigners",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"signerConfig",
"!=",
"null",
")",
"{",
"return",
"signerConfig",
";",
"}",
"// Region signer config has the 2nd highest precedence",
"signerConfig",
"=",
"regionSigners",
".",
"get",
"(",
"regionName",
")",
";",
"if",
"(",
"signerConfig",
"!=",
"null",
")",
"{",
"return",
"signerConfig",
";",
"}",
"}",
"// Service signer config has the 3rd highest precedence",
"signerConfig",
"=",
"serviceSigners",
".",
"get",
"(",
"serviceName",
")",
";",
"// Fall back to the default",
"return",
"signerConfig",
"==",
"null",
"?",
"defaultSignerConfig",
":",
"signerConfig",
";",
"}"
]
| Returns the signer configuration for the specified service name and an optional region name.
@param serviceName
must not be null
@param regionName
similar to the region name in <code>Regions</code>; can be null.
@return the signer | [
"Returns",
"the",
"signer",
"configuration",
"for",
"the",
"specified",
"service",
"name",
"and",
"an",
"optional",
"region",
"name",
"."
]
| train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/internal/config/InternalConfig.java#L206-L227 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/AsciiArtUtils.java | AsciiArtUtils.printAsciiArtWarning | @SneakyThrows
public static void printAsciiArtWarning(final Logger out, final String asciiArt, final String additional) {
"""
Print ascii art.
@param out the out
@param asciiArt the ascii art
@param additional the additional
"""
out.warn(ANSI_CYAN);
out.warn("\n\n".concat(FigletFont.convertOneLine(asciiArt)).concat(additional));
out.warn(ANSI_RESET);
} | java | @SneakyThrows
public static void printAsciiArtWarning(final Logger out, final String asciiArt, final String additional) {
out.warn(ANSI_CYAN);
out.warn("\n\n".concat(FigletFont.convertOneLine(asciiArt)).concat(additional));
out.warn(ANSI_RESET);
} | [
"@",
"SneakyThrows",
"public",
"static",
"void",
"printAsciiArtWarning",
"(",
"final",
"Logger",
"out",
",",
"final",
"String",
"asciiArt",
",",
"final",
"String",
"additional",
")",
"{",
"out",
".",
"warn",
"(",
"ANSI_CYAN",
")",
";",
"out",
".",
"warn",
"(",
"\"\\n\\n\"",
".",
"concat",
"(",
"FigletFont",
".",
"convertOneLine",
"(",
"asciiArt",
")",
")",
".",
"concat",
"(",
"additional",
")",
")",
";",
"out",
".",
"warn",
"(",
"ANSI_RESET",
")",
";",
"}"
]
| Print ascii art.
@param out the out
@param asciiArt the ascii art
@param additional the additional | [
"Print",
"ascii",
"art",
"."
]
| train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/AsciiArtUtils.java#L58-L63 |
katjahahn/PortEx | src/main/java/com/github/katjahahn/parser/sections/PESection.java | PESection.loadSectionBytes | private void loadSectionBytes() throws IOException {
"""
Loads the section bytes from the file using offset and size.
@throws IOException
if file can not be read
@throws IllegalStateException
if section is too large to fit into a byte array. This
happens if the size is larger than int can hold.
"""
Preconditions.checkState(size == (int) size,
"section is too large to dump into byte array");
try (RandomAccessFile raf = new RandomAccessFile(file, "r")) {
raf.seek(offset);
byte[] bytes = new byte[(int) size];
raf.read(bytes);
sectionbytes = Optional.of(bytes);
}
} | java | private void loadSectionBytes() throws IOException {
Preconditions.checkState(size == (int) size,
"section is too large to dump into byte array");
try (RandomAccessFile raf = new RandomAccessFile(file, "r")) {
raf.seek(offset);
byte[] bytes = new byte[(int) size];
raf.read(bytes);
sectionbytes = Optional.of(bytes);
}
} | [
"private",
"void",
"loadSectionBytes",
"(",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkState",
"(",
"size",
"==",
"(",
"int",
")",
"size",
",",
"\"section is too large to dump into byte array\"",
")",
";",
"try",
"(",
"RandomAccessFile",
"raf",
"=",
"new",
"RandomAccessFile",
"(",
"file",
",",
"\"r\"",
")",
")",
"{",
"raf",
".",
"seek",
"(",
"offset",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"(",
"int",
")",
"size",
"]",
";",
"raf",
".",
"read",
"(",
"bytes",
")",
";",
"sectionbytes",
"=",
"Optional",
".",
"of",
"(",
"bytes",
")",
";",
"}",
"}"
]
| Loads the section bytes from the file using offset and size.
@throws IOException
if file can not be read
@throws IllegalStateException
if section is too large to fit into a byte array. This
happens if the size is larger than int can hold. | [
"Loads",
"the",
"section",
"bytes",
"from",
"the",
"file",
"using",
"offset",
"and",
"size",
"."
]
| train | https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/PESection.java#L145-L154 |
czyzby/gdx-lml | kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/reflection/Reflection.java | Reflection.newInstance | public static <Type> Type newInstance(final Class<Type> ofClass) {
"""
Allows to gracefully create a new instance of class, without having to try-catch exceptions.
@param ofClass instance of this class will be constructed using reflection.
@return a new instance of passed class.
@throws GdxRuntimeException when unable to create a new instance.
@param <Type> type of constructed value.
"""
try {
return ClassReflection.newInstance(ofClass);
} catch (final Throwable exception) {
throw new GdxRuntimeException("Unable to create a new instance of class: " + ofClass, exception);
}
} | java | public static <Type> Type newInstance(final Class<Type> ofClass) {
try {
return ClassReflection.newInstance(ofClass);
} catch (final Throwable exception) {
throw new GdxRuntimeException("Unable to create a new instance of class: " + ofClass, exception);
}
} | [
"public",
"static",
"<",
"Type",
">",
"Type",
"newInstance",
"(",
"final",
"Class",
"<",
"Type",
">",
"ofClass",
")",
"{",
"try",
"{",
"return",
"ClassReflection",
".",
"newInstance",
"(",
"ofClass",
")",
";",
"}",
"catch",
"(",
"final",
"Throwable",
"exception",
")",
"{",
"throw",
"new",
"GdxRuntimeException",
"(",
"\"Unable to create a new instance of class: \"",
"+",
"ofClass",
",",
"exception",
")",
";",
"}",
"}"
]
| Allows to gracefully create a new instance of class, without having to try-catch exceptions.
@param ofClass instance of this class will be constructed using reflection.
@return a new instance of passed class.
@throws GdxRuntimeException when unable to create a new instance.
@param <Type> type of constructed value. | [
"Allows",
"to",
"gracefully",
"create",
"a",
"new",
"instance",
"of",
"class",
"without",
"having",
"to",
"try",
"-",
"catch",
"exceptions",
"."
]
| train | https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/reflection/Reflection.java#L29-L35 |
DDTH/ddth-queue | ddth-queue-core/src/main/java/com/github/ddth/pubsub/impl/universal/UniversalIdStrMessage.java | UniversalIdStrMessage.newInstance | public static UniversalIdStrMessage newInstance(String id, byte[] content) {
"""
Create a new {@link UniversalIdStrMessage} object with specified id and
content.
@param id
@param content
@return
"""
UniversalIdStrMessage msg = newInstance(content);
msg.setId(id);
return msg;
} | java | public static UniversalIdStrMessage newInstance(String id, byte[] content) {
UniversalIdStrMessage msg = newInstance(content);
msg.setId(id);
return msg;
} | [
"public",
"static",
"UniversalIdStrMessage",
"newInstance",
"(",
"String",
"id",
",",
"byte",
"[",
"]",
"content",
")",
"{",
"UniversalIdStrMessage",
"msg",
"=",
"newInstance",
"(",
"content",
")",
";",
"msg",
".",
"setId",
"(",
"id",
")",
";",
"return",
"msg",
";",
"}"
]
| Create a new {@link UniversalIdStrMessage} object with specified id and
content.
@param id
@param content
@return | [
"Create",
"a",
"new",
"{",
"@link",
"UniversalIdStrMessage",
"}",
"object",
"with",
"specified",
"id",
"and",
"content",
"."
]
| train | https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/pubsub/impl/universal/UniversalIdStrMessage.java#L76-L80 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/row/RowRenderer.java | RowRenderer.encodeBegin | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
"""
This methods generates the HTML code of the current b:row.
<code>encodeBegin</code> generates the start of the component. After the,
the JSF framework calls <code>encodeChildren()</code> to generate the
HTML code between the beginning and the end of the component. For
instance, in the case of a panel component the content of the panel is
generated by <code>encodeChildren()</code>. After that,
<code>encodeEnd()</code> is called to generate the rest of the HTML code.
@param context
the FacesContext.
@param component
the current b:row.
@throws IOException
thrown if something goes wrong when writing the HTML code.
"""
if (!component.isRendered()) {
return;
}
Row row = (Row) component;
ResponseWriter rw = context.getResponseWriter();
String clientId = row.getClientId();
rw.startElement("div", row);
Tooltip.generateTooltip(context, row, rw);
String dir = row.getDir();
if (null != dir)
rw.writeAttribute("dir", dir, "dir");
String s = "row";
String sclass = row.getStyleClass();
if (sclass != null) {
s += " " + sclass;
}
rw.writeAttribute("id", clientId, "id");
String style = row.getStyle();
if (style != null) {
rw.writeAttribute("style", style, "style");
}
rw.writeAttribute("class", s, "class");
Tooltip.activateTooltips(context, row);
beginDisabledFieldset(row, rw);
} | java | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
Row row = (Row) component;
ResponseWriter rw = context.getResponseWriter();
String clientId = row.getClientId();
rw.startElement("div", row);
Tooltip.generateTooltip(context, row, rw);
String dir = row.getDir();
if (null != dir)
rw.writeAttribute("dir", dir, "dir");
String s = "row";
String sclass = row.getStyleClass();
if (sclass != null) {
s += " " + sclass;
}
rw.writeAttribute("id", clientId, "id");
String style = row.getStyle();
if (style != null) {
rw.writeAttribute("style", style, "style");
}
rw.writeAttribute("class", s, "class");
Tooltip.activateTooltips(context, row);
beginDisabledFieldset(row, rw);
} | [
"@",
"Override",
"public",
"void",
"encodeBegin",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"Row",
"row",
"=",
"(",
"Row",
")",
"component",
";",
"ResponseWriter",
"rw",
"=",
"context",
".",
"getResponseWriter",
"(",
")",
";",
"String",
"clientId",
"=",
"row",
".",
"getClientId",
"(",
")",
";",
"rw",
".",
"startElement",
"(",
"\"div\"",
",",
"row",
")",
";",
"Tooltip",
".",
"generateTooltip",
"(",
"context",
",",
"row",
",",
"rw",
")",
";",
"String",
"dir",
"=",
"row",
".",
"getDir",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"dir",
")",
"rw",
".",
"writeAttribute",
"(",
"\"dir\"",
",",
"dir",
",",
"\"dir\"",
")",
";",
"String",
"s",
"=",
"\"row\"",
";",
"String",
"sclass",
"=",
"row",
".",
"getStyleClass",
"(",
")",
";",
"if",
"(",
"sclass",
"!=",
"null",
")",
"{",
"s",
"+=",
"\" \"",
"+",
"sclass",
";",
"}",
"rw",
".",
"writeAttribute",
"(",
"\"id\"",
",",
"clientId",
",",
"\"id\"",
")",
";",
"String",
"style",
"=",
"row",
".",
"getStyle",
"(",
")",
";",
"if",
"(",
"style",
"!=",
"null",
")",
"{",
"rw",
".",
"writeAttribute",
"(",
"\"style\"",
",",
"style",
",",
"\"style\"",
")",
";",
"}",
"rw",
".",
"writeAttribute",
"(",
"\"class\"",
",",
"s",
",",
"\"class\"",
")",
";",
"Tooltip",
".",
"activateTooltips",
"(",
"context",
",",
"row",
")",
";",
"beginDisabledFieldset",
"(",
"row",
",",
"rw",
")",
";",
"}"
]
| This methods generates the HTML code of the current b:row.
<code>encodeBegin</code> generates the start of the component. After the,
the JSF framework calls <code>encodeChildren()</code> to generate the
HTML code between the beginning and the end of the component. For
instance, in the case of a panel component the content of the panel is
generated by <code>encodeChildren()</code>. After that,
<code>encodeEnd()</code> is called to generate the rest of the HTML code.
@param context
the FacesContext.
@param component
the current b:row.
@throws IOException
thrown if something goes wrong when writing the HTML code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"row",
".",
"<code",
">",
"encodeBegin<",
"/",
"code",
">",
"generates",
"the",
"start",
"of",
"the",
"component",
".",
"After",
"the",
"the",
"JSF",
"framework",
"calls",
"<code",
">",
"encodeChildren",
"()",
"<",
"/",
"code",
">",
"to",
"generate",
"the",
"HTML",
"code",
"between",
"the",
"beginning",
"and",
"the",
"end",
"of",
"the",
"component",
".",
"For",
"instance",
"in",
"the",
"case",
"of",
"a",
"panel",
"component",
"the",
"content",
"of",
"the",
"panel",
"is",
"generated",
"by",
"<code",
">",
"encodeChildren",
"()",
"<",
"/",
"code",
">",
".",
"After",
"that",
"<code",
">",
"encodeEnd",
"()",
"<",
"/",
"code",
">",
"is",
"called",
"to",
"generate",
"the",
"rest",
"of",
"the",
"HTML",
"code",
"."
]
| train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/row/RowRenderer.java#L52-L80 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/PipelineApi.java | PipelineApi.deletePipelineScheduleVariable | public void deletePipelineScheduleVariable(Object projectIdOrPath, Integer pipelineScheduleId, String key) throws GitLabApiException {
"""
Deletes a pipeline schedule variable.
<pre><code>DELETE /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables/:key</code></pre>
@param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
@param pipelineScheduleId the pipeline schedule ID
@param key the key of an existing pipeline schedule variable
@throws GitLabApiException if any exception occurs
"""
Response.Status expectedStatus = (isApiVersion(GitLabApi.ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT);
delete(expectedStatus, null, "projects", getProjectIdOrPath(projectIdOrPath),
"pipeline_schedules", pipelineScheduleId, "variables", key);
} | java | public void deletePipelineScheduleVariable(Object projectIdOrPath, Integer pipelineScheduleId, String key) throws GitLabApiException {
Response.Status expectedStatus = (isApiVersion(GitLabApi.ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT);
delete(expectedStatus, null, "projects", getProjectIdOrPath(projectIdOrPath),
"pipeline_schedules", pipelineScheduleId, "variables", key);
} | [
"public",
"void",
"deletePipelineScheduleVariable",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"pipelineScheduleId",
",",
"String",
"key",
")",
"throws",
"GitLabApiException",
"{",
"Response",
".",
"Status",
"expectedStatus",
"=",
"(",
"isApiVersion",
"(",
"GitLabApi",
".",
"ApiVersion",
".",
"V3",
")",
"?",
"Response",
".",
"Status",
".",
"OK",
":",
"Response",
".",
"Status",
".",
"NO_CONTENT",
")",
";",
"delete",
"(",
"expectedStatus",
",",
"null",
",",
"\"projects\"",
",",
"getProjectIdOrPath",
"(",
"projectIdOrPath",
")",
",",
"\"pipeline_schedules\"",
",",
"pipelineScheduleId",
",",
"\"variables\"",
",",
"key",
")",
";",
"}"
]
| Deletes a pipeline schedule variable.
<pre><code>DELETE /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables/:key</code></pre>
@param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
@param pipelineScheduleId the pipeline schedule ID
@param key the key of an existing pipeline schedule variable
@throws GitLabApiException if any exception occurs | [
"Deletes",
"a",
"pipeline",
"schedule",
"variable",
"."
]
| train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/PipelineApi.java#L515-L519 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.