repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java | ExpressRouteCrossConnectionsInner.beginListArpTable | public ExpressRouteCircuitsArpTableListResultInner beginListArpTable(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath) {
return beginListArpTableWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, devicePath).toBlocking().single().body();
} | java | public ExpressRouteCircuitsArpTableListResultInner beginListArpTable(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath) {
return beginListArpTableWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, devicePath).toBlocking().single().body();
} | [
"public",
"ExpressRouteCircuitsArpTableListResultInner",
"beginListArpTable",
"(",
"String",
"resourceGroupName",
",",
"String",
"crossConnectionName",
",",
"String",
"peeringName",
",",
"String",
"devicePath",
")",
"{",
"return",
"beginListArpTableWithServiceResponseAsync",
"(... | Gets the currently advertised ARP table associated with the express route cross connection in a resource group.
@param resourceGroupName The name of the resource group.
@param crossConnectionName The name of the ExpressRouteCrossConnection.
@param peeringName The name of the peering.
@param devicePath The path of the device
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ExpressRouteCircuitsArpTableListResultInner object if successful. | [
"Gets",
"the",
"currently",
"advertised",
"ARP",
"table",
"associated",
"with",
"the",
"express",
"route",
"cross",
"connection",
"in",
"a",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java#L1007-L1009 |
Cornutum/tcases | tcases-io/src/main/java/org/cornutum/tcases/io/ProjectJson.java | ProjectJson.asSystemInputRef | private static URI asSystemInputRef( JsonValue json)
{
try
{
URI uri = null;
if( json != null && json.getValueType() == STRING)
{
uri = new URI( ((JsonString) json).getChars().toString());
}
return uri;
}
catch( Exception e)
{
throw new ProjectException( "Error reading input definition", e);
}
} | java | private static URI asSystemInputRef( JsonValue json)
{
try
{
URI uri = null;
if( json != null && json.getValueType() == STRING)
{
uri = new URI( ((JsonString) json).getChars().toString());
}
return uri;
}
catch( Exception e)
{
throw new ProjectException( "Error reading input definition", e);
}
} | [
"private",
"static",
"URI",
"asSystemInputRef",
"(",
"JsonValue",
"json",
")",
"{",
"try",
"{",
"URI",
"uri",
"=",
"null",
";",
"if",
"(",
"json",
"!=",
"null",
"&&",
"json",
".",
"getValueType",
"(",
")",
"==",
"STRING",
")",
"{",
"uri",
"=",
"new",... | Returns the system input definition URL represented by the given JSON value. | [
"Returns",
"the",
"system",
"input",
"definition",
"URL",
"represented",
"by",
"the",
"given",
"JSON",
"value",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/ProjectJson.java#L96-L112 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointsInner.java | RestorePointsInner.listByDatabase | public List<RestorePointInner> listByDatabase(String resourceGroupName, String serverName, String databaseName) {
return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body();
} | java | public List<RestorePointInner> listByDatabase(String resourceGroupName, String serverName, String databaseName) {
return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body();
} | [
"public",
"List",
"<",
"RestorePointInner",
">",
"listByDatabase",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
")",
"{",
"return",
"listByDatabaseWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
... | Gets a list of database restore points.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database to get available restore points.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<RestorePointInner> object if successful. | [
"Gets",
"a",
"list",
"of",
"database",
"restore",
"points",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorePointsInner.java#L72-L74 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/streaming/StreamPlan.java | StreamPlan.transferRanges | public StreamPlan transferRanges(InetAddress to, String keyspace, Collection<Range<Token>> ranges, String... columnFamilies)
{
return transferRanges(to, to, keyspace, ranges, columnFamilies);
} | java | public StreamPlan transferRanges(InetAddress to, String keyspace, Collection<Range<Token>> ranges, String... columnFamilies)
{
return transferRanges(to, to, keyspace, ranges, columnFamilies);
} | [
"public",
"StreamPlan",
"transferRanges",
"(",
"InetAddress",
"to",
",",
"String",
"keyspace",
",",
"Collection",
"<",
"Range",
"<",
"Token",
">",
">",
"ranges",
",",
"String",
"...",
"columnFamilies",
")",
"{",
"return",
"transferRanges",
"(",
"to",
",",
"t... | Add transfer task to send data of specific {@code columnFamilies} under {@code keyspace} and {@code ranges}.
@see #transferRanges(java.net.InetAddress, java.net.InetAddress, String, java.util.Collection, String...) | [
"Add",
"transfer",
"task",
"to",
"send",
"data",
"of",
"specific",
"{",
"@code",
"columnFamilies",
"}",
"under",
"{",
"@code",
"keyspace",
"}",
"and",
"{",
"@code",
"ranges",
"}",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/streaming/StreamPlan.java#L98-L101 |
shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.removeLeft | public static String removeLeft(final String value, final String prefix) {
return removeLeft(value, prefix, true);
} | java | public static String removeLeft(final String value, final String prefix) {
return removeLeft(value, prefix, true);
} | [
"public",
"static",
"String",
"removeLeft",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"prefix",
")",
"{",
"return",
"removeLeft",
"(",
"value",
",",
"prefix",
",",
"true",
")",
";",
"}"
] | Returns a new String with the prefix removed, if present. This is case sensitive.
@param value The input String
@param prefix String to remove on left
@return The String without prefix | [
"Returns",
"a",
"new",
"String",
"with",
"the",
"prefix",
"removed",
"if",
"present",
".",
"This",
"is",
"case",
"sensitive",
"."
] | train | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L725-L727 |
erlang/otp | lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java | OtpInputStream.read_pid | public OtpErlangPid read_pid() throws OtpErlangDecodeException {
String node;
int id;
int serial;
int creation;
int tag;
tag = read1skip_version();
if (tag != OtpExternal.pidTag &&
tag != OtpExternal.newPidTag) {
throw new OtpErlangDecodeException(
"Wrong tag encountered, expected " + OtpExternal.pidTag
+ " or " + OtpExternal.newPidTag
+ ", got " + tag);
}
node = read_atom();
id = read4BE();
serial = read4BE();
if (tag == OtpExternal.pidTag)
creation = read1();
else
creation = read4BE();
return new OtpErlangPid(tag, node, id, serial, creation);
} | java | public OtpErlangPid read_pid() throws OtpErlangDecodeException {
String node;
int id;
int serial;
int creation;
int tag;
tag = read1skip_version();
if (tag != OtpExternal.pidTag &&
tag != OtpExternal.newPidTag) {
throw new OtpErlangDecodeException(
"Wrong tag encountered, expected " + OtpExternal.pidTag
+ " or " + OtpExternal.newPidTag
+ ", got " + tag);
}
node = read_atom();
id = read4BE();
serial = read4BE();
if (tag == OtpExternal.pidTag)
creation = read1();
else
creation = read4BE();
return new OtpErlangPid(tag, node, id, serial, creation);
} | [
"public",
"OtpErlangPid",
"read_pid",
"(",
")",
"throws",
"OtpErlangDecodeException",
"{",
"String",
"node",
";",
"int",
"id",
";",
"int",
"serial",
";",
"int",
"creation",
";",
"int",
"tag",
";",
"tag",
"=",
"read1skip_version",
"(",
")",
";",
"if",
"(",
... | Read an Erlang PID from the stream.
@return the value of the PID.
@exception OtpErlangDecodeException
if the next term in the stream is not an Erlang PID. | [
"Read",
"an",
"Erlang",
"PID",
"from",
"the",
"stream",
"."
] | train | https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java#L948-L974 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/APIClient.java | APIClient.addApiKey | public JSONObject addApiKey(List<String> acls) throws AlgoliaException {
return addApiKey(acls, 0, 0, 0, null, RequestOptions.empty);
} | java | public JSONObject addApiKey(List<String> acls) throws AlgoliaException {
return addApiKey(acls, 0, 0, 0, null, RequestOptions.empty);
} | [
"public",
"JSONObject",
"addApiKey",
"(",
"List",
"<",
"String",
">",
"acls",
")",
"throws",
"AlgoliaException",
"{",
"return",
"addApiKey",
"(",
"acls",
",",
"0",
",",
"0",
",",
"0",
",",
"null",
",",
"RequestOptions",
".",
"empty",
")",
";",
"}"
] | Create a new api key
@param acls the list of ACL for this key. Defined by an array of strings that
can contains the following values:
- search: allow to search (https and http)
- addObject: allows to add/update an object in the index (https only)
- deleteObject : allows to delete an existing object (https only)
- deleteIndex : allows to delete index content (https only)
- settings : allows to get index settings (https only)
- editSettings : allows to change index settings (https only) | [
"Create",
"a",
"new",
"api",
"key"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/APIClient.java#L649-L651 |
landawn/AbacusUtil | src/com/landawn/abacus/util/IntList.java | IntList.reduce | public <E extends Exception> int reduce(final int identity, final Try.IntBinaryOperator<E> accumulator) throws E {
if (isEmpty()) {
return identity;
}
int result = identity;
for (int i = 0; i < size; i++) {
result = accumulator.applyAsInt(result, elementData[i]);
}
return result;
} | java | public <E extends Exception> int reduce(final int identity, final Try.IntBinaryOperator<E> accumulator) throws E {
if (isEmpty()) {
return identity;
}
int result = identity;
for (int i = 0; i < size; i++) {
result = accumulator.applyAsInt(result, elementData[i]);
}
return result;
} | [
"public",
"<",
"E",
"extends",
"Exception",
">",
"int",
"reduce",
"(",
"final",
"int",
"identity",
",",
"final",
"Try",
".",
"IntBinaryOperator",
"<",
"E",
">",
"accumulator",
")",
"throws",
"E",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"return",... | This is equivalent to:
<pre>
<code>
if (isEmpty()) {
return identity;
}
int result = identity;
for (int i = 0; i < size; i++) {
result = accumulator.applyAsInt(result, elementData[i]);
}
return result;
</code>
</pre>
@param identity
@param accumulator
@return | [
"This",
"is",
"equivalent",
"to",
":",
"<pre",
">",
"<code",
">",
"if",
"(",
"isEmpty",
"()",
")",
"{",
"return",
"identity",
";",
"}"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/IntList.java#L1187-L1199 |
samskivert/samskivert | src/main/java/com/samskivert/util/MethodFinder.java | MethodFinder.memberIsMoreSpecific | protected boolean memberIsMoreSpecific (Member first, Member second)
{
Class<?>[] firstParamTypes = _paramMap.get(first);
Class<?>[] secondParamTypes = _paramMap.get(second);
return ClassUtil.compatibleClasses(secondParamTypes, firstParamTypes);
} | java | protected boolean memberIsMoreSpecific (Member first, Member second)
{
Class<?>[] firstParamTypes = _paramMap.get(first);
Class<?>[] secondParamTypes = _paramMap.get(second);
return ClassUtil.compatibleClasses(secondParamTypes, firstParamTypes);
} | [
"protected",
"boolean",
"memberIsMoreSpecific",
"(",
"Member",
"first",
",",
"Member",
"second",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"firstParamTypes",
"=",
"_paramMap",
".",
"get",
"(",
"first",
")",
";",
"Class",
"<",
"?",
">",
"[",
"]",
"sec... | @param first a Member.
@param second a Member.
@return true if the first Member is more specific than the second, false otherwise.
Specificity is determined according to the procedure in the Java Language Specification,
section 15.12.2. | [
"@param",
"first",
"a",
"Member",
".",
"@param",
"second",
"a",
"Member",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/MethodFinder.java#L293-L298 |
leancloud/java-sdk-all | realtime/src/main/java/cn/leancloud/im/v2/AVIMConversation.java | AVIMConversation.getMemberInfo | public void getMemberInfo(final String memberId, final AVIMConversationMemberQueryCallback callback) {
QueryConditions conditions = new QueryConditions();
conditions.addWhereItem("cid", QueryOperation.EQUAL_OP, this.conversationId);
conditions.addWhereItem("peerId", QueryOperation.EQUAL_OP, memberId);
queryMemberInfo(conditions, callback);
} | java | public void getMemberInfo(final String memberId, final AVIMConversationMemberQueryCallback callback) {
QueryConditions conditions = new QueryConditions();
conditions.addWhereItem("cid", QueryOperation.EQUAL_OP, this.conversationId);
conditions.addWhereItem("peerId", QueryOperation.EQUAL_OP, memberId);
queryMemberInfo(conditions, callback);
} | [
"public",
"void",
"getMemberInfo",
"(",
"final",
"String",
"memberId",
",",
"final",
"AVIMConversationMemberQueryCallback",
"callback",
")",
"{",
"QueryConditions",
"conditions",
"=",
"new",
"QueryConditions",
"(",
")",
";",
"conditions",
".",
"addWhereItem",
"(",
"... | 获取对话内指定成员的角色信息
@param memberId 成员的 clientid
@param callback 结果回调函数 | [
"获取对话内指定成员的角色信息"
] | train | https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/realtime/src/main/java/cn/leancloud/im/v2/AVIMConversation.java#L1142-L1147 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxHttpResponse.java | BoxHttpResponse.getStringBody | public String getStringBody() throws BoxException {
if (mBodyString != null) {
return mBodyString;
}
InputStream stream = null;
try {
stream = isErrorCode(this.mResponseCode) ?
mConnection.getErrorStream() :
mConnection.getInputStream();
mBodyString = readStream(stream);
} catch (IOException e) {
throw new BoxException("Unable to get string body", e);
}
return mBodyString;
} | java | public String getStringBody() throws BoxException {
if (mBodyString != null) {
return mBodyString;
}
InputStream stream = null;
try {
stream = isErrorCode(this.mResponseCode) ?
mConnection.getErrorStream() :
mConnection.getInputStream();
mBodyString = readStream(stream);
} catch (IOException e) {
throw new BoxException("Unable to get string body", e);
}
return mBodyString;
} | [
"public",
"String",
"getStringBody",
"(",
")",
"throws",
"BoxException",
"{",
"if",
"(",
"mBodyString",
"!=",
"null",
")",
"{",
"return",
"mBodyString",
";",
"}",
"InputStream",
"stream",
"=",
"null",
";",
"try",
"{",
"stream",
"=",
"isErrorCode",
"(",
"th... | Returns a string representation of this response's body. This method is used when logging this response's body.
By default, it returns an empty string (to avoid accidentally logging binary data) unless the response contained
an error message.
@return a string representation of this response's body.
@throws BoxException thrown if there was an issue getting the body. | [
"Returns",
"a",
"string",
"representation",
"of",
"this",
"response",
"s",
"body",
".",
"This",
"method",
"is",
"used",
"when",
"logging",
"this",
"response",
"s",
"body",
".",
"By",
"default",
"it",
"returns",
"an",
"empty",
"string",
"(",
"to",
"avoid",
... | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxHttpResponse.java#L167-L182 |
azkaban/azkaban | az-core/src/main/java/azkaban/utils/PropsUtils.java | PropsUtils.toJSONString | public static String toJSONString(final Props props, final boolean localOnly) {
final Map<String, String> map = toStringMap(props, localOnly);
return JSONUtils.toJSON(map);
} | java | public static String toJSONString(final Props props, final boolean localOnly) {
final Map<String, String> map = toStringMap(props, localOnly);
return JSONUtils.toJSON(map);
} | [
"public",
"static",
"String",
"toJSONString",
"(",
"final",
"Props",
"props",
",",
"final",
"boolean",
"localOnly",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"toStringMap",
"(",
"props",
",",
"localOnly",
")",
";",
"return",
... | Convert props to json string
@param props props
@param localOnly include local prop sets only or not
@return json string format of props | [
"Convert",
"props",
"to",
"json",
"string"
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-core/src/main/java/azkaban/utils/PropsUtils.java#L356-L359 |
groupon/monsoon | history/src/main/java/com/groupon/lex/metrics/history/v1/xdr/ToXdr.java | ToXdr.simpleGroupPath_index | private int simpleGroupPath_index(dictionary_delta dict_delta, SimpleGroupPath group) {
final BiMap<SimpleGroupPath, Integer> dict = from_.getGroupDict().inverse();
final Integer resolved = dict.get(group);
if (resolved != null) return resolved;
final int allocated = allocate_index_(dict);
dict.put(group, allocated);
// Create new pdd for serialization.
path_dictionary_delta gdd = new path_dictionary_delta();
gdd.id = allocated;
gdd.value = new_path_(group.getPath());
// Append new entry to array.
dict_delta.gdd = Stream.concat(Arrays.stream(dict_delta.gdd), Stream.of(gdd))
.toArray(path_dictionary_delta[]::new);
LOG.log(Level.FINE, "dict_delta.gdd: {0} items (added {1})", new Object[]{dict_delta.gdd.length, group});
return allocated;
} | java | private int simpleGroupPath_index(dictionary_delta dict_delta, SimpleGroupPath group) {
final BiMap<SimpleGroupPath, Integer> dict = from_.getGroupDict().inverse();
final Integer resolved = dict.get(group);
if (resolved != null) return resolved;
final int allocated = allocate_index_(dict);
dict.put(group, allocated);
// Create new pdd for serialization.
path_dictionary_delta gdd = new path_dictionary_delta();
gdd.id = allocated;
gdd.value = new_path_(group.getPath());
// Append new entry to array.
dict_delta.gdd = Stream.concat(Arrays.stream(dict_delta.gdd), Stream.of(gdd))
.toArray(path_dictionary_delta[]::new);
LOG.log(Level.FINE, "dict_delta.gdd: {0} items (added {1})", new Object[]{dict_delta.gdd.length, group});
return allocated;
} | [
"private",
"int",
"simpleGroupPath_index",
"(",
"dictionary_delta",
"dict_delta",
",",
"SimpleGroupPath",
"group",
")",
"{",
"final",
"BiMap",
"<",
"SimpleGroupPath",
",",
"Integer",
">",
"dict",
"=",
"from_",
".",
"getGroupDict",
"(",
")",
".",
"inverse",
"(",
... | Lookup the index for the argument, or if it isn't present, create one. | [
"Lookup",
"the",
"index",
"for",
"the",
"argument",
"or",
"if",
"it",
"isn",
"t",
"present",
"create",
"one",
"."
] | train | https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/history/src/main/java/com/groupon/lex/metrics/history/v1/xdr/ToXdr.java#L114-L132 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java | ArgumentAttr.checkSpeculative | Type checkSpeculative(JCExpression expr, ResultInfo resultInfo) {
return checkSpeculative(expr, expr.type, resultInfo);
} | java | Type checkSpeculative(JCExpression expr, ResultInfo resultInfo) {
return checkSpeculative(expr, expr.type, resultInfo);
} | [
"Type",
"checkSpeculative",
"(",
"JCExpression",
"expr",
",",
"ResultInfo",
"resultInfo",
")",
"{",
"return",
"checkSpeculative",
"(",
"expr",
",",
"expr",
".",
"type",
",",
"resultInfo",
")",
";",
"}"
] | Checks a type in the speculative tree against a given result; the type can be either a plain
type or an argument type,in which case a more complex check is required. | [
"Checks",
"a",
"type",
"in",
"the",
"speculative",
"tree",
"against",
"a",
"given",
"result",
";",
"the",
"type",
"can",
"be",
"either",
"a",
"plain",
"type",
"or",
"an",
"argument",
"type",
"in",
"which",
"case",
"a",
"more",
"complex",
"check",
"is",
... | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java#L144-L146 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java | BytecodeUtils.isNonNull | public static SoyExpression isNonNull(final Expression expr) {
if (BytecodeUtils.isPrimitive(expr.resultType())) {
return SoyExpression.TRUE;
}
return SoyExpression.forBool(
new Expression(Type.BOOLEAN_TYPE, expr.features()) {
@Override
protected void doGen(CodeBuilder adapter) {
expr.gen(adapter);
Label isNull = new Label();
adapter.ifNull(isNull);
// non-null
adapter.pushBoolean(true);
Label end = new Label();
adapter.goTo(end);
adapter.mark(isNull);
adapter.pushBoolean(false);
adapter.mark(end);
}
});
} | java | public static SoyExpression isNonNull(final Expression expr) {
if (BytecodeUtils.isPrimitive(expr.resultType())) {
return SoyExpression.TRUE;
}
return SoyExpression.forBool(
new Expression(Type.BOOLEAN_TYPE, expr.features()) {
@Override
protected void doGen(CodeBuilder adapter) {
expr.gen(adapter);
Label isNull = new Label();
adapter.ifNull(isNull);
// non-null
adapter.pushBoolean(true);
Label end = new Label();
adapter.goTo(end);
adapter.mark(isNull);
adapter.pushBoolean(false);
adapter.mark(end);
}
});
} | [
"public",
"static",
"SoyExpression",
"isNonNull",
"(",
"final",
"Expression",
"expr",
")",
"{",
"if",
"(",
"BytecodeUtils",
".",
"isPrimitive",
"(",
"expr",
".",
"resultType",
"(",
")",
")",
")",
"{",
"return",
"SoyExpression",
".",
"TRUE",
";",
"}",
"retu... | Returns a {@link SoyExpression} that evaluates to true if the expression evaluated to a
non-null value. | [
"Returns",
"a",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java#L960-L980 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/BaseField.java | BaseField.setupDefaultView | public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties)
{
ScreenComponent screenField = null;
if (converter.getMaxLength() <= ScreenConstants.MAX_SINGLE_LINE_CHARS)
screenField = createScreenComponent(ScreenModel.EDIT_TEXT, itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
else
{
if (targetScreen instanceof GridScreenParent)
screenField = createScreenComponent(ScreenModel.EDIT_TEXT, itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
else
screenField = createScreenComponent(ScreenModel.TE_VIEW, itsLocation, targetScreen, this, iDisplayFieldDesc, properties);
}
return screenField;
} | java | public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties)
{
ScreenComponent screenField = null;
if (converter.getMaxLength() <= ScreenConstants.MAX_SINGLE_LINE_CHARS)
screenField = createScreenComponent(ScreenModel.EDIT_TEXT, itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
else
{
if (targetScreen instanceof GridScreenParent)
screenField = createScreenComponent(ScreenModel.EDIT_TEXT, itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
else
screenField = createScreenComponent(ScreenModel.TE_VIEW, itsLocation, targetScreen, this, iDisplayFieldDesc, properties);
}
return screenField;
} | [
"public",
"ScreenComponent",
"setupDefaultView",
"(",
"ScreenLoc",
"itsLocation",
",",
"ComponentParent",
"targetScreen",
",",
"Convert",
"converter",
",",
"int",
"iDisplayFieldDesc",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"ScreenComp... | Set up the default control for this field.
@param itsLocation Location of this component on screen (ie., GridBagConstraint).
@param targetScreen Where to place this component (ie., Parent screen or GridBagLayout).
@param iDisplayFieldDesc Display the label? (optional).
@return Return the component or ScreenField that is created for this field. | [
"Set",
"up",
"the",
"default",
"control",
"for",
"this",
"field",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseField.java#L1150-L1163 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java | UTF16.findOffsetFromCodePoint | public static int findOffsetFromCodePoint(char source[], int start, int limit, int offset32) {
char ch;
int result = start, count = offset32;
if (offset32 > limit - start) {
throw new ArrayIndexOutOfBoundsException(offset32);
}
while (result < limit && count > 0) {
ch = source[result];
if (isLeadSurrogate(ch) && ((result + 1) < limit)
&& isTrailSurrogate(source[result + 1])) {
result++;
}
count--;
result++;
}
if (count != 0) {
throw new ArrayIndexOutOfBoundsException(offset32);
}
return result - start;
} | java | public static int findOffsetFromCodePoint(char source[], int start, int limit, int offset32) {
char ch;
int result = start, count = offset32;
if (offset32 > limit - start) {
throw new ArrayIndexOutOfBoundsException(offset32);
}
while (result < limit && count > 0) {
ch = source[result];
if (isLeadSurrogate(ch) && ((result + 1) < limit)
&& isTrailSurrogate(source[result + 1])) {
result++;
}
count--;
result++;
}
if (count != 0) {
throw new ArrayIndexOutOfBoundsException(offset32);
}
return result - start;
} | [
"public",
"static",
"int",
"findOffsetFromCodePoint",
"(",
"char",
"source",
"[",
"]",
",",
"int",
"start",
",",
"int",
"limit",
",",
"int",
"offset32",
")",
"{",
"char",
"ch",
";",
"int",
"result",
"=",
"start",
",",
"count",
"=",
"offset32",
";",
"if... | Returns the UTF-16 offset that corresponds to a UTF-32 offset. Used for random access. See
the {@link UTF16 class description} for notes on roundtripping.
@param source The UTF-16 char array whose substring is to be analysed
@param start Offset of the substring to be analysed
@param limit Offset of the substring to be analysed
@param offset32 UTF-32 offset relative to start
@return UTF-16 offset relative to start
@exception IndexOutOfBoundsException If offset32 is out of bounds. | [
"Returns",
"the",
"UTF",
"-",
"16",
"offset",
"that",
"corresponds",
"to",
"a",
"UTF",
"-",
"32",
"offset",
".",
"Used",
"for",
"random",
"access",
".",
"See",
"the",
"{",
"@link",
"UTF16",
"class",
"description",
"}",
"for",
"notes",
"on",
"roundtrippin... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java#L793-L813 |
mgm-tp/jfunk | jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailService.java | MailService.findMessage | public MailMessage findMessage(final MailAccount mailAccount, final Predicate<MailMessage> condition,
final long timeoutSeconds, final long sleepMillis) {
return findMessage(mailAccount, condition, timeoutSeconds, sleepMillis, true);
} | java | public MailMessage findMessage(final MailAccount mailAccount, final Predicate<MailMessage> condition,
final long timeoutSeconds, final long sleepMillis) {
return findMessage(mailAccount, condition, timeoutSeconds, sleepMillis, true);
} | [
"public",
"MailMessage",
"findMessage",
"(",
"final",
"MailAccount",
"mailAccount",
",",
"final",
"Predicate",
"<",
"MailMessage",
">",
"condition",
",",
"final",
"long",
"timeoutSeconds",
",",
"final",
"long",
"sleepMillis",
")",
"{",
"return",
"findMessage",
"("... | <p>
Tries to find a message for the specified mail account applying the specified
{@code condition} until it times out using the specified {@code timeout} and and
{@code sleepMillis}.
</p>
<p>
<b>Note:</b><br />
This method uses the specified mail account independently without reservation. If, however,
the specified mail account has been reserved by any thread (including the current one), an
{@link IllegalStateException} is thrown.
</p>
@param mailAccount
the mail account
@param condition
the condition a message must meet
@param timeoutSeconds
the timeout in seconds
@param sleepMillis
the time in milliseconds to sleep between polls
@return the mail message | [
"<p",
">",
"Tries",
"to",
"find",
"a",
"message",
"for",
"the",
"specified",
"mail",
"account",
"applying",
"the",
"specified",
"{",
"@code",
"condition",
"}",
"until",
"it",
"times",
"out",
"using",
"the",
"specified",
"{",
"@code",
"timeout",
"}",
"and",... | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailService.java#L191-L194 |
Azure/azure-sdk-for-java | recoveryservices/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/v2016_06_01/implementation/VaultsInner.java | VaultsInner.createOrUpdate | public VaultInner createOrUpdate(String resourceGroupName, String vaultName, VaultInner vault) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, vault).toBlocking().single().body();
} | java | public VaultInner createOrUpdate(String resourceGroupName, String vaultName, VaultInner vault) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, vault).toBlocking().single().body();
} | [
"public",
"VaultInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"vaultName",
",",
"VaultInner",
"vault",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vaultName",
",",
"vault",
")",
".",
"toB... | Creates or updates a Recovery Services vault.
@param resourceGroupName The name of the resource group where the recovery services vault is present.
@param vaultName The name of the recovery services vault.
@param vault Recovery Services Vault to be created.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VaultInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"Recovery",
"Services",
"vault",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/v2016_06_01/implementation/VaultsInner.java#L422-L424 |
michael-rapp/AndroidPreferenceActivity | example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java | AppearancePreferenceFragment.createPreferenceFragmentButtonBarElevationChangeListener | private OnPreferenceChangeListener createPreferenceFragmentButtonBarElevationChangeListener() {
return new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
int elevation = Integer.valueOf((String) newValue);
setButtonBarElevation(elevation);
return true;
}
};
} | java | private OnPreferenceChangeListener createPreferenceFragmentButtonBarElevationChangeListener() {
return new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
int elevation = Integer.valueOf((String) newValue);
setButtonBarElevation(elevation);
return true;
}
};
} | [
"private",
"OnPreferenceChangeListener",
"createPreferenceFragmentButtonBarElevationChangeListener",
"(",
")",
"{",
"return",
"new",
"OnPreferenceChangeListener",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"onPreferenceChange",
"(",
"final",
"Preference",
"preferenc... | Creates and returns a listener, which allows to adapt the elevation of a preference
fragment's button bar, when the value of the corresponding preference has been changed.
@return The listener, which has been created, as an instance of the type {@link
OnPreferenceChangeListener} | [
"Creates",
"and",
"returns",
"a",
"listener",
"which",
"allows",
"to",
"adapt",
"the",
"elevation",
"of",
"a",
"preference",
"fragment",
"s",
"button",
"bar",
"when",
"the",
"value",
"of",
"the",
"corresponding",
"preference",
"has",
"been",
"changed",
"."
] | train | https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java#L168-L179 |
Azure/azure-sdk-for-java | iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java | IotHubResourcesInner.getStatsAsync | public Observable<RegistryStatisticsInner> getStatsAsync(String resourceGroupName, String resourceName) {
return getStatsWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<RegistryStatisticsInner>, RegistryStatisticsInner>() {
@Override
public RegistryStatisticsInner call(ServiceResponse<RegistryStatisticsInner> response) {
return response.body();
}
});
} | java | public Observable<RegistryStatisticsInner> getStatsAsync(String resourceGroupName, String resourceName) {
return getStatsWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<RegistryStatisticsInner>, RegistryStatisticsInner>() {
@Override
public RegistryStatisticsInner call(ServiceResponse<RegistryStatisticsInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RegistryStatisticsInner",
">",
"getStatsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"return",
"getStatsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
")",
".",
"map",
"(",
... | Get the statistics from an IoT hub.
Get the statistics from an IoT hub.
@param resourceGroupName The name of the resource group that contains the IoT hub.
@param resourceName The name of the IoT hub.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RegistryStatisticsInner object | [
"Get",
"the",
"statistics",
"from",
"an",
"IoT",
"hub",
".",
"Get",
"the",
"statistics",
"from",
"an",
"IoT",
"hub",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L1441-L1448 |
astrapi69/jaulp-wicket | jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/parameter/PageParametersExtensions.java | PageParametersExtensions.getParameter | public static String getParameter(final Request request, final String parameterName)
{
String parameterValue = request.getRequestParameters().getParameterValue(parameterName)
.toString();
if ((parameterValue == null) || parameterValue.isEmpty())
{
parameterValue = request.getPostParameters().getParameterValue(parameterName)
.toString();
}
if ((parameterValue == null) || parameterValue.isEmpty())
{
parameterValue = request.getQueryParameters().getParameterValue(parameterName)
.toString();
}
if ((parameterValue == null) || parameterValue.isEmpty())
{
parameterValue = request.getRequestParameters().getParameterValue(parameterName)
.toString();
}
return parameterValue;
} | java | public static String getParameter(final Request request, final String parameterName)
{
String parameterValue = request.getRequestParameters().getParameterValue(parameterName)
.toString();
if ((parameterValue == null) || parameterValue.isEmpty())
{
parameterValue = request.getPostParameters().getParameterValue(parameterName)
.toString();
}
if ((parameterValue == null) || parameterValue.isEmpty())
{
parameterValue = request.getQueryParameters().getParameterValue(parameterName)
.toString();
}
if ((parameterValue == null) || parameterValue.isEmpty())
{
parameterValue = request.getRequestParameters().getParameterValue(parameterName)
.toString();
}
return parameterValue;
} | [
"public",
"static",
"String",
"getParameter",
"(",
"final",
"Request",
"request",
",",
"final",
"String",
"parameterName",
")",
"{",
"String",
"parameterValue",
"=",
"request",
".",
"getRequestParameters",
"(",
")",
".",
"getParameterValue",
"(",
"parameterName",
... | Gets the parameter value from given parameter name. Looks in the query and post parameters.
@param request
the request
@param parameterName
the parameter name
@return the parameter value | [
"Gets",
"the",
"parameter",
"value",
"from",
"given",
"parameter",
"name",
".",
"Looks",
"in",
"the",
"query",
"and",
"post",
"parameters",
"."
] | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/parameter/PageParametersExtensions.java#L191-L211 |
threerings/nenya | core/src/main/java/com/threerings/miso/client/MisoScenePanel.java | MisoScenePanel.getFullCoords | public Point getFullCoords (int x, int y)
{
return MisoUtil.screenToFull(_metrics, x, y, new Point());
} | java | public Point getFullCoords (int x, int y)
{
return MisoUtil.screenToFull(_metrics, x, y, new Point());
} | [
"public",
"Point",
"getFullCoords",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"return",
"MisoUtil",
".",
"screenToFull",
"(",
"_metrics",
",",
"x",
",",
"y",
",",
"new",
"Point",
"(",
")",
")",
";",
"}"
] | Converts the supplied screen coordinates to full coordinates. | [
"Converts",
"the",
"supplied",
"screen",
"coordinates",
"to",
"full",
"coordinates",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L327-L330 |
CenturyLinkCloud/mdw | mdw-common/src/com/centurylink/mdw/image/Implementors.java | Implementors.getImpl | private ActivityImplementor getImpl(File file) throws IOException {
String contents = new String(Files.readAllBytes(file.toPath()));
Matcher matcher = ACTIVITY_ANNOTATION.matcher(contents);
if (matcher.find()) {
// only implClass and image are needed (other values are hardcoded)
String asset = file.getAbsolutePath().substring(assetLoc.getAbsolutePath().length() + 1).replace('/', '.');
String implClass = asset.substring(0, asset.lastIndexOf('.'));
String label = implClass.substring(implClass.lastIndexOf('.') + 1);
String category = "com.centurylink.mdw.activity.types.GeneralActivity";
String icon = "shape:activity";
// set icon if specified
String params = matcher.group(1);
Matcher iconMatcher = ICON_VALUE.matcher(params);
if (iconMatcher.find()) {
icon = iconMatcher.group(1);
}
return new ActivityImplementor(implClass, category, label, icon, "{}");
}
return null;
} | java | private ActivityImplementor getImpl(File file) throws IOException {
String contents = new String(Files.readAllBytes(file.toPath()));
Matcher matcher = ACTIVITY_ANNOTATION.matcher(contents);
if (matcher.find()) {
// only implClass and image are needed (other values are hardcoded)
String asset = file.getAbsolutePath().substring(assetLoc.getAbsolutePath().length() + 1).replace('/', '.');
String implClass = asset.substring(0, asset.lastIndexOf('.'));
String label = implClass.substring(implClass.lastIndexOf('.') + 1);
String category = "com.centurylink.mdw.activity.types.GeneralActivity";
String icon = "shape:activity";
// set icon if specified
String params = matcher.group(1);
Matcher iconMatcher = ICON_VALUE.matcher(params);
if (iconMatcher.find()) {
icon = iconMatcher.group(1);
}
return new ActivityImplementor(implClass, category, label, icon, "{}");
}
return null;
} | [
"private",
"ActivityImplementor",
"getImpl",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"String",
"contents",
"=",
"new",
"String",
"(",
"Files",
".",
"readAllBytes",
"(",
"file",
".",
"toPath",
"(",
")",
")",
")",
";",
"Matcher",
"matcher",
"... | For annotation-based implementors. Custom impl classes cannot be compiled, so this crude
parsing mechanism is used to determine image icon. Kotlin limitation: file name must be the same as impl class name. | [
"For",
"annotation",
"-",
"based",
"implementors",
".",
"Custom",
"impl",
"classes",
"cannot",
"be",
"compiled",
"so",
"this",
"crude",
"parsing",
"mechanism",
"is",
"used",
"to",
"determine",
"image",
"icon",
".",
"Kotlin",
"limitation",
":",
"file",
"name",
... | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/image/Implementors.java#L72-L92 |
JodaOrg/joda-time | src/main/java/org/joda/time/Interval.java | Interval.withPeriodBeforeEnd | public Interval withPeriodBeforeEnd(ReadablePeriod period) {
if (period == null) {
return withDurationBeforeEnd(null);
}
Chronology chrono = getChronology();
long endMillis = getEndMillis();
long startMillis = chrono.add(period, endMillis, -1);
return new Interval(startMillis, endMillis, chrono);
} | java | public Interval withPeriodBeforeEnd(ReadablePeriod period) {
if (period == null) {
return withDurationBeforeEnd(null);
}
Chronology chrono = getChronology();
long endMillis = getEndMillis();
long startMillis = chrono.add(period, endMillis, -1);
return new Interval(startMillis, endMillis, chrono);
} | [
"public",
"Interval",
"withPeriodBeforeEnd",
"(",
"ReadablePeriod",
"period",
")",
"{",
"if",
"(",
"period",
"==",
"null",
")",
"{",
"return",
"withDurationBeforeEnd",
"(",
"null",
")",
";",
"}",
"Chronology",
"chrono",
"=",
"getChronology",
"(",
")",
";",
"... | Creates a new interval with the specified period before the end instant.
@param period the period to subtract from the end to get the new start instant, null means zero
@return an interval with the end from this interval and a calculated start
@throws IllegalArgumentException if the period is negative | [
"Creates",
"a",
"new",
"interval",
"with",
"the",
"specified",
"period",
"before",
"the",
"end",
"instant",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Interval.java#L552-L560 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/LinearClassifier.java | LinearClassifier.getFeatureCount | public int getFeatureCount(double threshold, boolean useMagnitude)
{
int n = 0;
for (int feat = 0; feat < weights.length; feat++) {
for (int lab = 0; lab < weights[feat].length; lab++) {
double thisWeight = (useMagnitude)? Math.abs(weights[feat][lab]):weights[feat][lab];
if (thisWeight > threshold) {
n++;
}
}
}
return n;
} | java | public int getFeatureCount(double threshold, boolean useMagnitude)
{
int n = 0;
for (int feat = 0; feat < weights.length; feat++) {
for (int lab = 0; lab < weights[feat].length; lab++) {
double thisWeight = (useMagnitude)? Math.abs(weights[feat][lab]):weights[feat][lab];
if (thisWeight > threshold) {
n++;
}
}
}
return n;
} | [
"public",
"int",
"getFeatureCount",
"(",
"double",
"threshold",
",",
"boolean",
"useMagnitude",
")",
"{",
"int",
"n",
"=",
"0",
";",
"for",
"(",
"int",
"feat",
"=",
"0",
";",
"feat",
"<",
"weights",
".",
"length",
";",
"feat",
"++",
")",
"{",
"for",
... | Returns number of features with weight above a certain threshold
(across all labels)
@param threshold Threshold above which we will count the feature
@param useMagnitude Whether the notion of "large" should ignore
the sign of the feature weight.
@return number of features satisfying the specified conditions | [
"Returns",
"number",
"of",
"features",
"with",
"weight",
"above",
"a",
"certain",
"threshold",
"(",
"across",
"all",
"labels",
")"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/LinearClassifier.java#L370-L382 |
unbescape/unbescape | src/main/java/org/unbescape/uri/UriEscape.java | UriEscape.unescapeUriQueryParam | public static void unescapeUriQueryParam(final Reader reader, final Writer writer)
throws IOException {
unescapeUriQueryParam(reader, writer, DEFAULT_ENCODING);
} | java | public static void unescapeUriQueryParam(final Reader reader, final Writer writer)
throws IOException {
unescapeUriQueryParam(reader, writer, DEFAULT_ENCODING);
} | [
"public",
"static",
"void",
"unescapeUriQueryParam",
"(",
"final",
"Reader",
"reader",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"unescapeUriQueryParam",
"(",
"reader",
",",
"writer",
",",
"DEFAULT_ENCODING",
")",
";",
"}"
] | <p>
Perform am URI query parameter (name or value) <strong>unescape</strong> operation
on a <tt>Reader</tt> input using <tt>UTF-8</tt> as encoding, writing results to a <tt>Writer</tt>.
</p>
<p>
This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input,
even for those characters that do not need to be percent-encoded in this context (unreserved characters
can be percent-encoded even if/when this is not required, though it is not generally considered a
good practice).
</p>
<p>
This method will use <tt>UTF-8</tt> in order to determine the characters specified in the
percent-encoded byte sequences.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param reader the <tt>Reader</tt> reading the text to be unescaped.
@param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"am",
"URI",
"query",
"parameter",
"(",
"name",
"or",
"value",
")",
"<strong",
">",
"unescape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"Reader<",
"/",
"tt",
">",
"input",
"using",
"<tt",
">",
"UTF",
"-",
"8<",
... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L2262-L2265 |
FedericoPecora/meta-csp-framework | src/main/java/org/metacsp/multi/allenInterval/AllenIntervalNetworkSolver.java | AllenIntervalNetworkSolver.getAdmissibleDistanceBounds | public final Bounds getAdmissibleDistanceBounds(TimePoint tpFrom, TimePoint tpTo) {
final APSPSolver stpSolver = (APSPSolver) constraintSolvers[0];
return stpSolver.getDistanceBounds(tpFrom, tpTo);
} | java | public final Bounds getAdmissibleDistanceBounds(TimePoint tpFrom, TimePoint tpTo) {
final APSPSolver stpSolver = (APSPSolver) constraintSolvers[0];
return stpSolver.getDistanceBounds(tpFrom, tpTo);
} | [
"public",
"final",
"Bounds",
"getAdmissibleDistanceBounds",
"(",
"TimePoint",
"tpFrom",
",",
"TimePoint",
"tpTo",
")",
"{",
"final",
"APSPSolver",
"stpSolver",
"=",
"(",
"APSPSolver",
")",
"constraintSolvers",
"[",
"0",
"]",
";",
"return",
"stpSolver",
".",
"get... | Gets the minimum and maximum allowed distance between a pair of {@link TimePoint}s.
@param tpFrom the {@link TimePoint} that is considered as the "origin"/source.
@param tpTo the {@link TimePoint} that is considered as the "target".
@return Returns the bounds of the distance between the two {@link TimePoint}s
or <code>null</code> if there is no constraint between the two. | [
"Gets",
"the",
"minimum",
"and",
"maximum",
"allowed",
"distance",
"between",
"a",
"pair",
"of",
"{"
] | train | https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/multi/allenInterval/AllenIntervalNetworkSolver.java#L87-L90 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/AbstractDirector.java | AbstractDirector.fireProgressEvent | void fireProgressEvent(int state, int progress, String message, boolean allowCancel) throws InstallException {
log(Level.FINEST, message);
if (enableEvent) {
try {
eventManager.fireProgressEvent(state, progress, message);
} catch (CancelException ce) {
if (allowCancel)
throw ce;
else
log(Level.FINEST, "fireProgressEvent caught cancel exception: " + ce.getMessage());
} catch (Exception e) {
log(Level.FINEST, "fireProgressEvent caught exception: " + e.getMessage());
}
}
} | java | void fireProgressEvent(int state, int progress, String message, boolean allowCancel) throws InstallException {
log(Level.FINEST, message);
if (enableEvent) {
try {
eventManager.fireProgressEvent(state, progress, message);
} catch (CancelException ce) {
if (allowCancel)
throw ce;
else
log(Level.FINEST, "fireProgressEvent caught cancel exception: " + ce.getMessage());
} catch (Exception e) {
log(Level.FINEST, "fireProgressEvent caught exception: " + e.getMessage());
}
}
} | [
"void",
"fireProgressEvent",
"(",
"int",
"state",
",",
"int",
"progress",
",",
"String",
"message",
",",
"boolean",
"allowCancel",
")",
"throws",
"InstallException",
"{",
"log",
"(",
"Level",
".",
"FINEST",
",",
"message",
")",
";",
"if",
"(",
"enableEvent",... | Creates a Progress event message that can handle cancel exceptions.
@param state the state integer
@param progress the progress integer
@param message the message to be displayed
@param allowCancel if cancel exceptions should be handled
@throws InstallException | [
"Creates",
"a",
"Progress",
"event",
"message",
"that",
"can",
"handle",
"cancel",
"exceptions",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/AbstractDirector.java#L74-L88 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/filesystem/InstrumentedFileSystemUtils.java | InstrumentedFileSystemUtils.replaceScheme | public static URI replaceScheme(URI uri, String replace, String replacement) {
if (replace != null && replace.equals(replacement)) {
return uri;
}
try {
if (replace != null && replace.equals(uri.getScheme())) {
return new URI(replacement, uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(), uri.getQuery(), uri.getFragment());
} else {
return uri;
}
} catch (URISyntaxException use) {
throw new RuntimeException("Failed to replace scheme.");
}
} | java | public static URI replaceScheme(URI uri, String replace, String replacement) {
if (replace != null && replace.equals(replacement)) {
return uri;
}
try {
if (replace != null && replace.equals(uri.getScheme())) {
return new URI(replacement, uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(), uri.getQuery(), uri.getFragment());
} else {
return uri;
}
} catch (URISyntaxException use) {
throw new RuntimeException("Failed to replace scheme.");
}
} | [
"public",
"static",
"URI",
"replaceScheme",
"(",
"URI",
"uri",
",",
"String",
"replace",
",",
"String",
"replacement",
")",
"{",
"if",
"(",
"replace",
"!=",
"null",
"&&",
"replace",
".",
"equals",
"(",
"replacement",
")",
")",
"{",
"return",
"uri",
";",
... | Replace the scheme of the input {@link URI} if it matches the string to replace. | [
"Replace",
"the",
"scheme",
"of",
"the",
"input",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/filesystem/InstrumentedFileSystemUtils.java#L36-L49 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.replaceIgnoreCase | public static String replaceIgnoreCase(final String text, final String searchString, final String replacement, final int max) {
return replace(text, searchString, replacement, max, true);
} | java | public static String replaceIgnoreCase(final String text, final String searchString, final String replacement, final int max) {
return replace(text, searchString, replacement, max, true);
} | [
"public",
"static",
"String",
"replaceIgnoreCase",
"(",
"final",
"String",
"text",
",",
"final",
"String",
"searchString",
",",
"final",
"String",
"replacement",
",",
"final",
"int",
"max",
")",
"{",
"return",
"replace",
"(",
"text",
",",
"searchString",
",",
... | <p>Case insensitively replaces a String with another String inside a larger String,
for the first {@code max} values of the search String.</p>
<p>A {@code null} reference passed to this method is a no-op.</p>
<pre>
StringUtils.replaceIgnoreCase(null, *, *, *) = null
StringUtils.replaceIgnoreCase("", *, *, *) = ""
StringUtils.replaceIgnoreCase("any", null, *, *) = "any"
StringUtils.replaceIgnoreCase("any", *, null, *) = "any"
StringUtils.replaceIgnoreCase("any", "", *, *) = "any"
StringUtils.replaceIgnoreCase("any", *, *, 0) = "any"
StringUtils.replaceIgnoreCase("abaa", "a", null, -1) = "abaa"
StringUtils.replaceIgnoreCase("abaa", "a", "", -1) = "b"
StringUtils.replaceIgnoreCase("abaa", "a", "z", 0) = "abaa"
StringUtils.replaceIgnoreCase("abaa", "A", "z", 1) = "zbaa"
StringUtils.replaceIgnoreCase("abAa", "a", "z", 2) = "zbza"
StringUtils.replaceIgnoreCase("abAa", "a", "z", -1) = "zbzz"
</pre>
@param text text to search and replace in, may be null
@param searchString the String to search for (case insensitive), may be null
@param replacement the String to replace it with, may be null
@param max maximum number of values to replace, or {@code -1} if no maximum
@return the text with any replacements processed,
{@code null} if null String input
@since 3.5 | [
"<p",
">",
"Case",
"insensitively",
"replaces",
"a",
"String",
"with",
"another",
"String",
"inside",
"a",
"larger",
"String",
"for",
"the",
"first",
"{",
"@code",
"max",
"}",
"values",
"of",
"the",
"search",
"String",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L5568-L5570 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/HeadersImpl.java | HeadersImpl.addHeadLine | @Override
public void addHeadLine(final String type, final String aLine) {
ArrayList<String> lines = headers.get(type);
if (lines == null) {
lines = new ArrayList<>();
headers.put(type, lines);
}
lines.add(aLine);
} | java | @Override
public void addHeadLine(final String type, final String aLine) {
ArrayList<String> lines = headers.get(type);
if (lines == null) {
lines = new ArrayList<>();
headers.put(type, lines);
}
lines.add(aLine);
} | [
"@",
"Override",
"public",
"void",
"addHeadLine",
"(",
"final",
"String",
"type",
",",
"final",
"String",
"aLine",
")",
"{",
"ArrayList",
"<",
"String",
">",
"lines",
"=",
"headers",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"lines",
"==",
"null",
... | Records a "shared" line (of a specified type) for inclusion in the output.
@param type the type of line.
@param aLine the line to include. | [
"Records",
"a",
"shared",
"line",
"(",
"of",
"a",
"specified",
"type",
")",
"for",
"inclusion",
"in",
"the",
"output",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/HeadersImpl.java#L52-L62 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java | SslContextBuilder.forServer | public static SslContextBuilder forServer(InputStream keyCertChainInputStream, InputStream keyInputStream) {
return new SslContextBuilder(true).keyManager(keyCertChainInputStream, keyInputStream);
} | java | public static SslContextBuilder forServer(InputStream keyCertChainInputStream, InputStream keyInputStream) {
return new SslContextBuilder(true).keyManager(keyCertChainInputStream, keyInputStream);
} | [
"public",
"static",
"SslContextBuilder",
"forServer",
"(",
"InputStream",
"keyCertChainInputStream",
",",
"InputStream",
"keyInputStream",
")",
"{",
"return",
"new",
"SslContextBuilder",
"(",
"true",
")",
".",
"keyManager",
"(",
"keyCertChainInputStream",
",",
"keyInput... | Creates a builder for new server-side {@link SslContext}.
@param keyCertChainInputStream an input stream for an X.509 certificate chain in PEM format
@param keyInputStream an input stream for a PKCS#8 private key in PEM format
@see #keyManager(InputStream, InputStream) | [
"Creates",
"a",
"builder",
"for",
"new",
"server",
"-",
"side",
"{",
"@link",
"SslContext",
"}",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L64-L66 |
haraldk/TwelveMonkeys | common/common-image/src/main/java/com/twelvemonkeys/image/DiffusionDither.java | DiffusionDither.createCompatibleDestImage | public final BufferedImage createCompatibleDestImage(BufferedImage pSource, ColorModel pDestCM) {
if (pDestCM == null) {
return new BufferedImage(pSource.getWidth(), pSource.getHeight(),
BufferedImage.TYPE_BYTE_INDEXED,
getICM(pSource));
}
else if (pDestCM instanceof IndexColorModel) {
return new BufferedImage(pSource.getWidth(), pSource.getHeight(),
BufferedImage.TYPE_BYTE_INDEXED,
(IndexColorModel) pDestCM);
}
else {
throw new ImageFilterException("Only IndexColorModel allowed.");
}
} | java | public final BufferedImage createCompatibleDestImage(BufferedImage pSource, ColorModel pDestCM) {
if (pDestCM == null) {
return new BufferedImage(pSource.getWidth(), pSource.getHeight(),
BufferedImage.TYPE_BYTE_INDEXED,
getICM(pSource));
}
else if (pDestCM instanceof IndexColorModel) {
return new BufferedImage(pSource.getWidth(), pSource.getHeight(),
BufferedImage.TYPE_BYTE_INDEXED,
(IndexColorModel) pDestCM);
}
else {
throw new ImageFilterException("Only IndexColorModel allowed.");
}
} | [
"public",
"final",
"BufferedImage",
"createCompatibleDestImage",
"(",
"BufferedImage",
"pSource",
",",
"ColorModel",
"pDestCM",
")",
"{",
"if",
"(",
"pDestCM",
"==",
"null",
")",
"{",
"return",
"new",
"BufferedImage",
"(",
"pSource",
".",
"getWidth",
"(",
")",
... | Creates a compatible {@code BufferedImage} to dither into.
Only {@code IndexColorModel} allowed.
@return a compatible {@code BufferedImage}
@throws ImageFilterException if {@code pDestCM} is not {@code null} or
an instance of {@code IndexColorModel}. | [
"Creates",
"a",
"compatible",
"{",
"@code",
"BufferedImage",
"}",
"to",
"dither",
"into",
".",
"Only",
"{",
"@code",
"IndexColorModel",
"}",
"allowed",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/DiffusionDither.java#L114-L128 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/OpenSslKeyMaterialProvider.java | OpenSslKeyMaterialProvider.chooseKeyMaterial | OpenSslKeyMaterial chooseKeyMaterial(ByteBufAllocator allocator, String alias) throws Exception {
X509Certificate[] certificates = keyManager.getCertificateChain(alias);
if (certificates == null || certificates.length == 0) {
return null;
}
PrivateKey key = keyManager.getPrivateKey(alias);
PemEncoded encoded = PemX509Certificate.toPEM(allocator, true, certificates);
long chainBio = 0;
long pkeyBio = 0;
long chain = 0;
long pkey = 0;
try {
chainBio = toBIO(allocator, encoded.retain());
chain = SSL.parseX509Chain(chainBio);
OpenSslKeyMaterial keyMaterial;
if (key instanceof OpenSslPrivateKey) {
keyMaterial = ((OpenSslPrivateKey) key).newKeyMaterial(chain, certificates);
} else {
pkeyBio = toBIO(allocator, key);
pkey = key == null ? 0 : SSL.parsePrivateKey(pkeyBio, password);
keyMaterial = new DefaultOpenSslKeyMaterial(chain, pkey, certificates);
}
// See the chain and pkey to 0 so we will not release it as the ownership was
// transferred to OpenSslKeyMaterial.
chain = 0;
pkey = 0;
return keyMaterial;
} finally {
SSL.freeBIO(chainBio);
SSL.freeBIO(pkeyBio);
if (chain != 0) {
SSL.freeX509Chain(chain);
}
if (pkey != 0) {
SSL.freePrivateKey(pkey);
}
encoded.release();
}
} | java | OpenSslKeyMaterial chooseKeyMaterial(ByteBufAllocator allocator, String alias) throws Exception {
X509Certificate[] certificates = keyManager.getCertificateChain(alias);
if (certificates == null || certificates.length == 0) {
return null;
}
PrivateKey key = keyManager.getPrivateKey(alias);
PemEncoded encoded = PemX509Certificate.toPEM(allocator, true, certificates);
long chainBio = 0;
long pkeyBio = 0;
long chain = 0;
long pkey = 0;
try {
chainBio = toBIO(allocator, encoded.retain());
chain = SSL.parseX509Chain(chainBio);
OpenSslKeyMaterial keyMaterial;
if (key instanceof OpenSslPrivateKey) {
keyMaterial = ((OpenSslPrivateKey) key).newKeyMaterial(chain, certificates);
} else {
pkeyBio = toBIO(allocator, key);
pkey = key == null ? 0 : SSL.parsePrivateKey(pkeyBio, password);
keyMaterial = new DefaultOpenSslKeyMaterial(chain, pkey, certificates);
}
// See the chain and pkey to 0 so we will not release it as the ownership was
// transferred to OpenSslKeyMaterial.
chain = 0;
pkey = 0;
return keyMaterial;
} finally {
SSL.freeBIO(chainBio);
SSL.freeBIO(pkeyBio);
if (chain != 0) {
SSL.freeX509Chain(chain);
}
if (pkey != 0) {
SSL.freePrivateKey(pkey);
}
encoded.release();
}
} | [
"OpenSslKeyMaterial",
"chooseKeyMaterial",
"(",
"ByteBufAllocator",
"allocator",
",",
"String",
"alias",
")",
"throws",
"Exception",
"{",
"X509Certificate",
"[",
"]",
"certificates",
"=",
"keyManager",
".",
"getCertificateChain",
"(",
"alias",
")",
";",
"if",
"(",
... | Returns the {@link OpenSslKeyMaterial} or {@code null} (if none) that should be used during the handshake by
OpenSSL. | [
"Returns",
"the",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslKeyMaterialProvider.java#L105-L146 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/UtilFile.java | UtilFile.getFilesByNameRecursive | private static void getFilesByNameRecursive(Collection<File> filesList, File path, String name)
{
Optional.ofNullable(path.listFiles()).ifPresent(files -> Arrays.asList(files).forEach(content ->
{
if (content.isFile() && content.getName().equals(name))
{
filesList.add(content);
}
else if (content.isDirectory())
{
getFilesByNameRecursive(filesList, content, name);
}
}));
} | java | private static void getFilesByNameRecursive(Collection<File> filesList, File path, String name)
{
Optional.ofNullable(path.listFiles()).ifPresent(files -> Arrays.asList(files).forEach(content ->
{
if (content.isFile() && content.getName().equals(name))
{
filesList.add(content);
}
else if (content.isDirectory())
{
getFilesByNameRecursive(filesList, content, name);
}
}));
} | [
"private",
"static",
"void",
"getFilesByNameRecursive",
"(",
"Collection",
"<",
"File",
">",
"filesList",
",",
"File",
"path",
",",
"String",
"name",
")",
"{",
"Optional",
".",
"ofNullable",
"(",
"path",
".",
"listFiles",
"(",
")",
")",
".",
"ifPresent",
"... | Get all files existing in the path with the specified name.
@param filesList The files list.
@param path The path to check.
@param name The file name. | [
"Get",
"all",
"files",
"existing",
"in",
"the",
"path",
"with",
"the",
"specified",
"name",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilFile.java#L274-L287 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/flow/DenseOpticalFlowBlockPyramid.java | DenseOpticalFlowBlockPyramid.checkNeighbors | protected void checkNeighbors( int cx , int cy , ImageFlow.D flow , ImageFlow image , float score ) {
for( int i = -regionRadius; i <= regionRadius; i++ ) {
int index = image.width*(cy+i) + (cx-regionRadius);
for( int j = -regionRadius; j <= regionRadius; j++ , index++ ) {
float s = scores[ index ];
ImageFlow.D f = image.data[index];
if( s > score ) {
f.set(flow);
scores[index] = score;
} else if( s == score ) {
// Pick solution with the least motion when ambiguous
float m0 = f.x*f.x + f.y*f.y;
float m1 = flow.x*flow.x + flow.y*flow.y;
if( m1 < m0 ) {
f.set(flow);
scores[index] = score;
}
}
}
}
} | java | protected void checkNeighbors( int cx , int cy , ImageFlow.D flow , ImageFlow image , float score ) {
for( int i = -regionRadius; i <= regionRadius; i++ ) {
int index = image.width*(cy+i) + (cx-regionRadius);
for( int j = -regionRadius; j <= regionRadius; j++ , index++ ) {
float s = scores[ index ];
ImageFlow.D f = image.data[index];
if( s > score ) {
f.set(flow);
scores[index] = score;
} else if( s == score ) {
// Pick solution with the least motion when ambiguous
float m0 = f.x*f.x + f.y*f.y;
float m1 = flow.x*flow.x + flow.y*flow.y;
if( m1 < m0 ) {
f.set(flow);
scores[index] = score;
}
}
}
}
} | [
"protected",
"void",
"checkNeighbors",
"(",
"int",
"cx",
",",
"int",
"cy",
",",
"ImageFlow",
".",
"D",
"flow",
",",
"ImageFlow",
"image",
",",
"float",
"score",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"-",
"regionRadius",
";",
"i",
"<=",
"regionRadius",... | Examines every pixel inside the region centered at (cx,cy) to see if their optical flow has a worse
score the one specified in 'flow' | [
"Examines",
"every",
"pixel",
"inside",
"the",
"region",
"centered",
"at",
"(",
"cx",
"cy",
")",
"to",
"see",
"if",
"their",
"optical",
"flow",
"has",
"a",
"worse",
"score",
"the",
"one",
"specified",
"in",
"flow"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/flow/DenseOpticalFlowBlockPyramid.java#L231-L251 |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java | ImageHolder.applyToOrSetGone | public static void applyToOrSetGone(ImageHolder imageHolder, ImageView imageView, String tag) {
boolean imageSet = applyTo(imageHolder, imageView, tag);
if (imageView != null) {
if (imageSet) {
imageView.setVisibility(View.VISIBLE);
} else {
imageView.setVisibility(View.GONE);
}
}
} | java | public static void applyToOrSetGone(ImageHolder imageHolder, ImageView imageView, String tag) {
boolean imageSet = applyTo(imageHolder, imageView, tag);
if (imageView != null) {
if (imageSet) {
imageView.setVisibility(View.VISIBLE);
} else {
imageView.setVisibility(View.GONE);
}
}
} | [
"public",
"static",
"void",
"applyToOrSetGone",
"(",
"ImageHolder",
"imageHolder",
",",
"ImageView",
"imageView",
",",
"String",
"tag",
")",
"{",
"boolean",
"imageSet",
"=",
"applyTo",
"(",
"imageHolder",
",",
"imageView",
",",
"tag",
")",
";",
"if",
"(",
"i... | a small static helper to set the image from the imageHolder nullSave to the imageView and hide the view if no image was set
@param imageHolder
@param imageView
@param tag used to identify imageViews and define different placeholders | [
"a",
"small",
"static",
"helper",
"to",
"set",
"the",
"image",
"from",
"the",
"imageHolder",
"nullSave",
"to",
"the",
"imageView",
"and",
"hide",
"the",
"view",
"if",
"no",
"image",
"was",
"set"
] | train | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java#L223-L232 |
QSFT/Doradus | doradus-client/src/main/java/com/dell/doradus/client/SpiderSession.java | SpiderSession.addBatch | @Override
public BatchResult addBatch(String tableName, DBObjectBatch dbObjBatch) {
Utils.require(!Utils.isEmpty(tableName), "tableName");
Utils.require(dbObjBatch != null && dbObjBatch.getObjectCount() > 0,
"Object batch must have at least 1 object");
try {
// Send a POST request to "/{application}/{table}"
byte[] body = Utils.toBytes(dbObjBatch.toDoc().toJSON());
StringBuilder uri = new StringBuilder(Utils.isEmpty(m_restClient.getApiPrefix()) ? "" : "/" + m_restClient.getApiPrefix());
uri.append("/");
uri.append(Utils.urlEncode(m_appDef.getAppName()));
uri.append("/");
uri.append(Utils.urlEncode(tableName));
RESTResponse response =
m_restClient.sendRequest(HttpMethod.POST, uri.toString(), ContentType.APPLICATION_JSON, body);
m_logger.debug("addBatch() response: {}", response.toString());
return createBatchResult(response, dbObjBatch);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | @Override
public BatchResult addBatch(String tableName, DBObjectBatch dbObjBatch) {
Utils.require(!Utils.isEmpty(tableName), "tableName");
Utils.require(dbObjBatch != null && dbObjBatch.getObjectCount() > 0,
"Object batch must have at least 1 object");
try {
// Send a POST request to "/{application}/{table}"
byte[] body = Utils.toBytes(dbObjBatch.toDoc().toJSON());
StringBuilder uri = new StringBuilder(Utils.isEmpty(m_restClient.getApiPrefix()) ? "" : "/" + m_restClient.getApiPrefix());
uri.append("/");
uri.append(Utils.urlEncode(m_appDef.getAppName()));
uri.append("/");
uri.append(Utils.urlEncode(tableName));
RESTResponse response =
m_restClient.sendRequest(HttpMethod.POST, uri.toString(), ContentType.APPLICATION_JSON, body);
m_logger.debug("addBatch() response: {}", response.toString());
return createBatchResult(response, dbObjBatch);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"@",
"Override",
"public",
"BatchResult",
"addBatch",
"(",
"String",
"tableName",
",",
"DBObjectBatch",
"dbObjBatch",
")",
"{",
"Utils",
".",
"require",
"(",
"!",
"Utils",
".",
"isEmpty",
"(",
"tableName",
")",
",",
"\"tableName\"",
")",
";",
"Utils",
".",
... | Add the given batch of objects to the given table, which must belong to this
session's application. Objects are added if they do not currently exist or do not
have an object ID assigned. Otherwise, existing objects are updated. The result of
the update is returned as a {@link BatchResult}.
@param tableName Name of table to update.
@param dbObjBatch {@link DBObjectBatch} of objects to add or update.
@return A {@link BatchResult} object containing the results of the
update request. | [
"Add",
"the",
"given",
"batch",
"of",
"objects",
"to",
"the",
"given",
"table",
"which",
"must",
"belong",
"to",
"this",
"session",
"s",
"application",
".",
"Objects",
"are",
"added",
"if",
"they",
"do",
"not",
"currently",
"exist",
"or",
"do",
"not",
"h... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/SpiderSession.java#L67-L88 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java | CassandraSchemaManager.alterColumnType | private void alterColumnType(TableInfo tableInfo, CQLTranslator translator, ColumnInfo column) throws Exception
{
StringBuilder alterColumnTypeQuery = new StringBuilder("ALTER TABLE ");
translator.ensureCase(alterColumnTypeQuery, tableInfo.getTableName(), false);
alterColumnTypeQuery.append(" ALTER ");
translator.ensureCase(alterColumnTypeQuery, column.getColumnName(), false);
alterColumnTypeQuery.append(" TYPE "
+ translator.getCQLType(CassandraValidationClassMapper.getValidationClass(column.getType(),
isCql3Enabled(tableInfo))));
cassandra_client.execute_cql3_query(ByteBuffer.wrap(alterColumnTypeQuery.toString().getBytes()),
Compression.NONE, ConsistencyLevel.ONE);
KunderaCoreUtils.printQuery(alterColumnTypeQuery.toString(), showQuery);
} | java | private void alterColumnType(TableInfo tableInfo, CQLTranslator translator, ColumnInfo column) throws Exception
{
StringBuilder alterColumnTypeQuery = new StringBuilder("ALTER TABLE ");
translator.ensureCase(alterColumnTypeQuery, tableInfo.getTableName(), false);
alterColumnTypeQuery.append(" ALTER ");
translator.ensureCase(alterColumnTypeQuery, column.getColumnName(), false);
alterColumnTypeQuery.append(" TYPE "
+ translator.getCQLType(CassandraValidationClassMapper.getValidationClass(column.getType(),
isCql3Enabled(tableInfo))));
cassandra_client.execute_cql3_query(ByteBuffer.wrap(alterColumnTypeQuery.toString().getBytes()),
Compression.NONE, ConsistencyLevel.ONE);
KunderaCoreUtils.printQuery(alterColumnTypeQuery.toString(), showQuery);
} | [
"private",
"void",
"alterColumnType",
"(",
"TableInfo",
"tableInfo",
",",
"CQLTranslator",
"translator",
",",
"ColumnInfo",
"column",
")",
"throws",
"Exception",
"{",
"StringBuilder",
"alterColumnTypeQuery",
"=",
"new",
"StringBuilder",
"(",
"\"ALTER TABLE \"",
")",
"... | showSchema Alters column type of an existing column.
@param tableInfo
the table info
@param translator
the translator
@param column
the column
@throws Exception
the exception | [
"showSchema",
"Alters",
"column",
"type",
"of",
"an",
"existing",
"column",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L1523-L1536 |
teatrove/teatrove | teaapps/src/main/java/org/teatrove/teaapps/contexts/FileSystemContext.java | FileSystemContext.moveFile | public boolean moveFile(String srcPath, String dstPath)
throws IOException {
return moveFile(srcPath, dstPath, true);
} | java | public boolean moveFile(String srcPath, String dstPath)
throws IOException {
return moveFile(srcPath, dstPath, true);
} | [
"public",
"boolean",
"moveFile",
"(",
"String",
"srcPath",
",",
"String",
"dstPath",
")",
"throws",
"IOException",
"{",
"return",
"moveFile",
"(",
"srcPath",
",",
"dstPath",
",",
"true",
")",
";",
"}"
] | Move the file referenced by the srcPath to the dstPath. This will cause
the dstPath file to be overwritten if it already exists. If the srcPath
does not exist, or the dstPath cannot be written to, or an error occurs
during moving, then an {@link IOException} is thrown.
@param srcPath The path of the file to move
@param dstPath The path to move the file to
@return <code>true</code> if the file was properly moved,
<code>false</code> otherwise
@throws IOException if an error occurs moving the file | [
"Move",
"the",
"file",
"referenced",
"by",
"the",
"srcPath",
"to",
"the",
"dstPath",
".",
"This",
"will",
"cause",
"the",
"dstPath",
"file",
"to",
"be",
"overwritten",
"if",
"it",
"already",
"exists",
".",
"If",
"the",
"srcPath",
"does",
"not",
"exist",
... | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/FileSystemContext.java#L113-L117 |
lemire/JavaFastPFOR | src/main/java/me/lemire/integercompression/differential/Delta.java | Delta.delta | public static int delta(int[] data, int start, int length, int init) {
final int nextinit = data[start + length - 1];
for (int i = length - 1; i > 0; --i) {
data[start + i] -= data[start + i - 1];
}
data[start] -= init;
return nextinit;
} | java | public static int delta(int[] data, int start, int length, int init) {
final int nextinit = data[start + length - 1];
for (int i = length - 1; i > 0; --i) {
data[start + i] -= data[start + i - 1];
}
data[start] -= init;
return nextinit;
} | [
"public",
"static",
"int",
"delta",
"(",
"int",
"[",
"]",
"data",
",",
"int",
"start",
",",
"int",
"length",
",",
"int",
"init",
")",
"{",
"final",
"int",
"nextinit",
"=",
"data",
"[",
"start",
"+",
"length",
"-",
"1",
"]",
";",
"for",
"(",
"int"... | Apply differential coding (in-place) given an initial value.
@param data
data to be modified
@param start
starting index
@param length
number of integers to process
@param init
initial value
@return next initial vale | [
"Apply",
"differential",
"coding",
"(",
"in",
"-",
"place",
")",
"given",
"an",
"initial",
"value",
"."
] | train | https://github.com/lemire/JavaFastPFOR/blob/ffeea61ab2fdb3854da7b0a557f8d22d674477f4/src/main/java/me/lemire/integercompression/differential/Delta.java#L43-L50 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/ftp/FTPFileSystem.java | FTPFileSystem.rename | private boolean rename(FTPClient client, Path src, Path dst)
throws IOException {
Path workDir = new Path(client.printWorkingDirectory());
Path absoluteSrc = makeAbsolute(workDir, src);
Path absoluteDst = makeAbsolute(workDir, dst);
if (!exists(client, absoluteSrc)) {
throw new IOException("Source path " + src + " does not exist");
}
if (exists(client, absoluteDst)) {
throw new IOException("Destination path " + dst
+ " already exist, cannot rename!");
}
String parentSrc = absoluteSrc.getParent().toUri().toString();
String parentDst = absoluteDst.getParent().toUri().toString();
String from = src.getName();
String to = dst.getName();
if (!parentSrc.equals(parentDst)) {
throw new IOException("Cannot rename parent(source): " + parentSrc
+ ", parent(destination): " + parentDst);
}
client.changeWorkingDirectory(parentSrc);
boolean renamed = client.rename(from, to);
return renamed;
} | java | private boolean rename(FTPClient client, Path src, Path dst)
throws IOException {
Path workDir = new Path(client.printWorkingDirectory());
Path absoluteSrc = makeAbsolute(workDir, src);
Path absoluteDst = makeAbsolute(workDir, dst);
if (!exists(client, absoluteSrc)) {
throw new IOException("Source path " + src + " does not exist");
}
if (exists(client, absoluteDst)) {
throw new IOException("Destination path " + dst
+ " already exist, cannot rename!");
}
String parentSrc = absoluteSrc.getParent().toUri().toString();
String parentDst = absoluteDst.getParent().toUri().toString();
String from = src.getName();
String to = dst.getName();
if (!parentSrc.equals(parentDst)) {
throw new IOException("Cannot rename parent(source): " + parentSrc
+ ", parent(destination): " + parentDst);
}
client.changeWorkingDirectory(parentSrc);
boolean renamed = client.rename(from, to);
return renamed;
} | [
"private",
"boolean",
"rename",
"(",
"FTPClient",
"client",
",",
"Path",
"src",
",",
"Path",
"dst",
")",
"throws",
"IOException",
"{",
"Path",
"workDir",
"=",
"new",
"Path",
"(",
"client",
".",
"printWorkingDirectory",
"(",
")",
")",
";",
"Path",
"absolute... | Convenience method, so that we don't open a new connection when using this
method from within another method. Otherwise every API invocation incurs
the overhead of opening/closing a TCP connection.
@param client
@param src
@param dst
@return
@throws IOException | [
"Convenience",
"method",
"so",
"that",
"we",
"don",
"t",
"open",
"a",
"new",
"connection",
"when",
"using",
"this",
"method",
"from",
"within",
"another",
"method",
".",
"Otherwise",
"every",
"API",
"invocation",
"incurs",
"the",
"overhead",
"of",
"opening",
... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/ftp/FTPFileSystem.java#L530-L553 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/task_command_log.java | task_command_log.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
task_command_log_responses result = (task_command_log_responses) service.get_payload_formatter().string_to_resource(task_command_log_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.task_command_log_response_array);
}
task_command_log[] result_task_command_log = new task_command_log[result.task_command_log_response_array.length];
for(int i = 0; i < result.task_command_log_response_array.length; i++)
{
result_task_command_log[i] = result.task_command_log_response_array[i].task_command_log[0];
}
return result_task_command_log;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
task_command_log_responses result = (task_command_log_responses) service.get_payload_formatter().string_to_resource(task_command_log_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.task_command_log_response_array);
}
task_command_log[] result_task_command_log = new task_command_log[result.task_command_log_response_array.length];
for(int i = 0; i < result.task_command_log_response_array.length; i++)
{
result_task_command_log[i] = result.task_command_log_response_array[i].task_command_log[0];
}
return result_task_command_log;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"task_command_log_responses",
"result",
"=",
"(",
"task_command_log_responses",
")",
"service",
".",
"get_payl... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/task_command_log.java#L293-L310 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/util/buff/ByteBuffer.java | ByteBuffer.getNextField | public int getNextField(FieldInfo field, boolean bDisplayOption, int iMoveMode) // Must be to call right Get calls
{
boolean bDone = ((BaseField)field).read(m_daIn, m_bFixedLength);
if (!bDone)
return Constants.NORMAL_RETURN;
else
return Constants.ERROR_RETURN;
} | java | public int getNextField(FieldInfo field, boolean bDisplayOption, int iMoveMode) // Must be to call right Get calls
{
boolean bDone = ((BaseField)field).read(m_daIn, m_bFixedLength);
if (!bDone)
return Constants.NORMAL_RETURN;
else
return Constants.ERROR_RETURN;
} | [
"public",
"int",
"getNextField",
"(",
"FieldInfo",
"field",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"// Must be to call right Get calls",
"{",
"boolean",
"bDone",
"=",
"(",
"(",
"BaseField",
")",
"field",
")",
".",
"read",
"(",
"m_daIn",
... | Get the next field and fill it with data from this buffer.
You must override this method.
@param field The field to set.
@param bDisplayOption The display option for setting the field.
@param iMoveMove The move mode for setting the field.
@return The error code. | [
"Get",
"the",
"next",
"field",
"and",
"fill",
"it",
"with",
"data",
"from",
"this",
"buffer",
".",
"You",
"must",
"override",
"this",
"method",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/util/buff/ByteBuffer.java#L176-L183 |
podio/podio-java | src/main/java/com/podio/tag/TagAPI.java | TagAPI.createTags | public void createTags(Reference reference, String... tags) {
createTags(reference, Arrays.asList(tags));
} | java | public void createTags(Reference reference, String... tags) {
createTags(reference, Arrays.asList(tags));
} | [
"public",
"void",
"createTags",
"(",
"Reference",
"reference",
",",
"String",
"...",
"tags",
")",
"{",
"createTags",
"(",
"reference",
",",
"Arrays",
".",
"asList",
"(",
"tags",
")",
")",
";",
"}"
] | Add a new set of tags to the object. If a tag with the same text is
already present, the tag will be ignored.
@param reference
The object the tags should be added to
@param tags
The tags that should be added | [
"Add",
"a",
"new",
"set",
"of",
"tags",
"to",
"the",
"object",
".",
"If",
"a",
"tag",
"with",
"the",
"same",
"text",
"is",
"already",
"present",
"the",
"tag",
"will",
"be",
"ignored",
"."
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/tag/TagAPI.java#L53-L55 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.takeWhile | public static <T> T[] takeWhile(T[] self, @ClosureParams(FirstParam.Component.class) Closure condition) {
int num = 0;
BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition);
while (num < self.length) {
T value = self[num];
if (bcw.call(value)) {
num += 1;
} else {
break;
}
}
return take(self, num);
} | java | public static <T> T[] takeWhile(T[] self, @ClosureParams(FirstParam.Component.class) Closure condition) {
int num = 0;
BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition);
while (num < self.length) {
T value = self[num];
if (bcw.call(value)) {
num += 1;
} else {
break;
}
}
return take(self, num);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"takeWhile",
"(",
"T",
"[",
"]",
"self",
",",
"@",
"ClosureParams",
"(",
"FirstParam",
".",
"Component",
".",
"class",
")",
"Closure",
"condition",
")",
"{",
"int",
"num",
"=",
"0",
";",
"BooleanClosu... | Returns the longest prefix of this array where each element
passed to the given closure evaluates to true.
<pre class="groovyTestCase">
def nums = [ 1, 3, 2 ] as Integer[]
assert nums.takeWhile{ it {@code <} 1 } == [] as Integer[]
assert nums.takeWhile{ it {@code <} 3 } == [ 1 ] as Integer[]
assert nums.takeWhile{ it {@code <} 4 } == [ 1, 3, 2 ] as Integer[]
</pre>
@param self the original array
@param condition the closure that must evaluate to true to
continue taking elements
@return a prefix of the given array where each element passed to
the given closure evaluates to true
@since 1.8.7 | [
"Returns",
"the",
"longest",
"prefix",
"of",
"this",
"array",
"where",
"each",
"element",
"passed",
"to",
"the",
"given",
"closure",
"evaluates",
"to",
"true",
".",
"<pre",
"class",
"=",
"groovyTestCase",
">",
"def",
"nums",
"=",
"[",
"1",
"3",
"2",
"]",... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L10995-L11007 |
aws/aws-sdk-java | aws-java-sdk-fms/src/main/java/com/amazonaws/services/fms/model/PolicyComplianceDetail.java | PolicyComplianceDetail.withIssueInfoMap | public PolicyComplianceDetail withIssueInfoMap(java.util.Map<String, String> issueInfoMap) {
setIssueInfoMap(issueInfoMap);
return this;
} | java | public PolicyComplianceDetail withIssueInfoMap(java.util.Map<String, String> issueInfoMap) {
setIssueInfoMap(issueInfoMap);
return this;
} | [
"public",
"PolicyComplianceDetail",
"withIssueInfoMap",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"issueInfoMap",
")",
"{",
"setIssueInfoMap",
"(",
"issueInfoMap",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Details about problems with dependent services, such as AWS WAF or AWS Config, that are causing a resource to be
non-compliant. The details include the name of the dependent service and the error message received that
indicates the problem with the service.
</p>
@param issueInfoMap
Details about problems with dependent services, such as AWS WAF or AWS Config, that are causing a resource
to be non-compliant. The details include the name of the dependent service and the error message received
that indicates the problem with the service.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Details",
"about",
"problems",
"with",
"dependent",
"services",
"such",
"as",
"AWS",
"WAF",
"or",
"AWS",
"Config",
"that",
"are",
"causing",
"a",
"resource",
"to",
"be",
"non",
"-",
"compliant",
".",
"The",
"details",
"include",
"the",
"name",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-fms/src/main/java/com/amazonaws/services/fms/model/PolicyComplianceDetail.java#L407-L410 |
RestComm/media-core | control/mgcp/src/main/java/org/restcomm/media/core/control/mgcp/command/CreateConnectionCommand.java | CreateConnectionCommand.createLocalConnection | private MgcpConnection createLocalConnection(int callId, MgcpEndpoint endpoint) throws MgcpConnectionException {
MgcpConnection connection = endpoint.createConnection(callId, true);
connection.open(null);
return connection;
} | java | private MgcpConnection createLocalConnection(int callId, MgcpEndpoint endpoint) throws MgcpConnectionException {
MgcpConnection connection = endpoint.createConnection(callId, true);
connection.open(null);
return connection;
} | [
"private",
"MgcpConnection",
"createLocalConnection",
"(",
"int",
"callId",
",",
"MgcpEndpoint",
"endpoint",
")",
"throws",
"MgcpConnectionException",
"{",
"MgcpConnection",
"connection",
"=",
"endpoint",
".",
"createConnection",
"(",
"callId",
",",
"true",
")",
";",
... | Creates a new Local Connection.
<p>
The connection will be fully open and connected to a secondary endpoint.<br>
</p>
@param callId The the call identifies which indicates to which session the connection belongs to.
@param secondEndpoint The endpoint where the connection will be registered to.
@return The new connection
@throws MgcpException If connection could not be opened. | [
"Creates",
"a",
"new",
"Local",
"Connection",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/control/mgcp/src/main/java/org/restcomm/media/core/control/mgcp/command/CreateConnectionCommand.java#L216-L220 |
alkacon/opencms-core | src/org/opencms/importexport/CmsImportVersion2.java | CmsImportVersion2.removeFolders | private void removeFolders() throws CmsImportExportException {
try {
int size = m_folderStorage.size();
m_report.println(Messages.get().container(Messages.RPT_DELFOLDER_START_0), I_CmsReport.FORMAT_HEADLINE);
// iterate though all collected folders. Iteration must start at the end of the list,
// as folders habe to be deleted in the reverse order.
int counter = 1;
for (int j = (size - 1); j >= 0; j--) {
String resname = m_folderStorage.get(j);
resname = (resname.startsWith("/") ? "" : "/") + resname + (resname.endsWith("/") ? "" : "/");
// now check if the folder is really empty. Only delete empty folders
List<CmsResource> files = m_cms.getFilesInFolder(resname, CmsResourceFilter.IGNORE_EXPIRATION);
if (files.size() == 0) {
List<CmsResource> folders = m_cms.getSubFolders(resname, CmsResourceFilter.IGNORE_EXPIRATION);
if (folders.size() == 0) {
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_SUCCESSION_2,
String.valueOf(counter),
String.valueOf(size)),
I_CmsReport.FORMAT_NOTE);
m_report.print(Messages.get().container(Messages.RPT_DELFOLDER_0), I_CmsReport.FORMAT_NOTE);
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
resname),
I_CmsReport.FORMAT_DEFAULT);
m_cms.lockResource(resname);
m_cms.deleteResource(resname, CmsResource.DELETE_PRESERVE_SIBLINGS);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
counter++;
}
}
}
} catch (CmsException e) {
CmsMessageContainer message = Messages.get().container(
Messages.ERR_IMPORTEXPORT_ERROR_REMOVING_FOLDERS_OF_IMPORTED_BODY_FILES_0);
if (LOG.isDebugEnabled()) {
LOG.debug(message.key(), e);
}
throw new CmsImportExportException(message, e);
}
} | java | private void removeFolders() throws CmsImportExportException {
try {
int size = m_folderStorage.size();
m_report.println(Messages.get().container(Messages.RPT_DELFOLDER_START_0), I_CmsReport.FORMAT_HEADLINE);
// iterate though all collected folders. Iteration must start at the end of the list,
// as folders habe to be deleted in the reverse order.
int counter = 1;
for (int j = (size - 1); j >= 0; j--) {
String resname = m_folderStorage.get(j);
resname = (resname.startsWith("/") ? "" : "/") + resname + (resname.endsWith("/") ? "" : "/");
// now check if the folder is really empty. Only delete empty folders
List<CmsResource> files = m_cms.getFilesInFolder(resname, CmsResourceFilter.IGNORE_EXPIRATION);
if (files.size() == 0) {
List<CmsResource> folders = m_cms.getSubFolders(resname, CmsResourceFilter.IGNORE_EXPIRATION);
if (folders.size() == 0) {
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_SUCCESSION_2,
String.valueOf(counter),
String.valueOf(size)),
I_CmsReport.FORMAT_NOTE);
m_report.print(Messages.get().container(Messages.RPT_DELFOLDER_0), I_CmsReport.FORMAT_NOTE);
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
resname),
I_CmsReport.FORMAT_DEFAULT);
m_cms.lockResource(resname);
m_cms.deleteResource(resname, CmsResource.DELETE_PRESERVE_SIBLINGS);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
counter++;
}
}
}
} catch (CmsException e) {
CmsMessageContainer message = Messages.get().container(
Messages.ERR_IMPORTEXPORT_ERROR_REMOVING_FOLDERS_OF_IMPORTED_BODY_FILES_0);
if (LOG.isDebugEnabled()) {
LOG.debug(message.key(), e);
}
throw new CmsImportExportException(message, e);
}
} | [
"private",
"void",
"removeFolders",
"(",
")",
"throws",
"CmsImportExportException",
"{",
"try",
"{",
"int",
"size",
"=",
"m_folderStorage",
".",
"size",
"(",
")",
";",
"m_report",
".",
"println",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"("... | Deletes the folder structure which has been creating while importing the body files..<p>
@throws CmsImportExportException if something goes wrong | [
"Deletes",
"the",
"folder",
"structure",
"which",
"has",
"been",
"creating",
"while",
"importing",
"the",
"body",
"files",
"..",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportVersion2.java#L1122-L1172 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java | FileSessionDataStore.deleteFile | private boolean deleteFile(String filename) throws Exception {
if (filename == null) {
return false;
}
File file = new File(storeDir, filename);
return Files.deleteIfExists(file.toPath());
} | java | private boolean deleteFile(String filename) throws Exception {
if (filename == null) {
return false;
}
File file = new File(storeDir, filename);
return Files.deleteIfExists(file.toPath());
} | [
"private",
"boolean",
"deleteFile",
"(",
"String",
"filename",
")",
"throws",
"Exception",
"{",
"if",
"(",
"filename",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"File",
"file",
"=",
"new",
"File",
"(",
"storeDir",
",",
"filename",
")",
";",
... | Delete the file associated with a session
@param filename name of the file containing the session's information
@return true if file was deleted, false otherwise
@throws Exception if the file associated with the session fails to be deleted | [
"Delete",
"the",
"file",
"associated",
"with",
"a",
"session"
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java#L101-L107 |
jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/interceptor/JaxRsExceptionInterceptor.java | JaxRsExceptionInterceptor.convertException | public JaxRsResponseException convertException(final AbstractJaxRsProvider theServer, final Throwable theException) {
if (theServer.withStackTrace()) {
exceptionHandler.setReturnStackTracesForExceptionTypes(Throwable.class);
}
final JaxRsRequest requestDetails = theServer.getRequest(null, null).build();
final BaseServerResponseException convertedException = preprocessException(theException, requestDetails);
return new JaxRsResponseException(convertedException);
} | java | public JaxRsResponseException convertException(final AbstractJaxRsProvider theServer, final Throwable theException) {
if (theServer.withStackTrace()) {
exceptionHandler.setReturnStackTracesForExceptionTypes(Throwable.class);
}
final JaxRsRequest requestDetails = theServer.getRequest(null, null).build();
final BaseServerResponseException convertedException = preprocessException(theException, requestDetails);
return new JaxRsResponseException(convertedException);
} | [
"public",
"JaxRsResponseException",
"convertException",
"(",
"final",
"AbstractJaxRsProvider",
"theServer",
",",
"final",
"Throwable",
"theException",
")",
"{",
"if",
"(",
"theServer",
".",
"withStackTrace",
"(",
")",
")",
"{",
"exceptionHandler",
".",
"setReturnStack... | This method convert an exception to a JaxRsResponseException
@param theServer the provider
@param theException the exception to convert
@return JaxRsResponseException | [
"This",
"method",
"convert",
"an",
"exception",
"to",
"a",
"JaxRsResponseException"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/interceptor/JaxRsExceptionInterceptor.java#L85-L92 |
zaproxy/zaproxy | src/org/zaproxy/zap/control/AddOn.java | AddOn.dependsOn | public boolean dependsOn(Extension extension, AddOn addOn) {
String classname = extension.getClass().getCanonicalName();
for (ExtensionWithDeps extensionWithDeps : extensionsWithDeps) {
if (extensionWithDeps.getClassname().equals(classname)) {
return dependsOn(extensionWithDeps.getDependencies(), addOn);
}
}
return false;
} | java | public boolean dependsOn(Extension extension, AddOn addOn) {
String classname = extension.getClass().getCanonicalName();
for (ExtensionWithDeps extensionWithDeps : extensionsWithDeps) {
if (extensionWithDeps.getClassname().equals(classname)) {
return dependsOn(extensionWithDeps.getDependencies(), addOn);
}
}
return false;
} | [
"public",
"boolean",
"dependsOn",
"(",
"Extension",
"extension",
",",
"AddOn",
"addOn",
")",
"{",
"String",
"classname",
"=",
"extension",
".",
"getClass",
"(",
")",
".",
"getCanonicalName",
"(",
")",
";",
"for",
"(",
"ExtensionWithDeps",
"extensionWithDeps",
... | Tells whether or not the given {@code extension} has a (direct) dependency on the given {@code addOn} (including
version).
@param extension the extension that will be checked
@param addOn the add-on that will be checked in the dependencies on the extension
@return {@code true} if the extension depends on the given add-on, {@code false} otherwise.
@since 2.4.0 | [
"Tells",
"whether",
"or",
"not",
"the",
"given",
"{",
"@code",
"extension",
"}",
"has",
"a",
"(",
"direct",
")",
"dependency",
"on",
"the",
"given",
"{",
"@code",
"addOn",
"}",
"(",
"including",
"version",
")",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/control/AddOn.java#L1392-L1401 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/BindTypeContext.java | BindTypeContext.getBindMapperName | public String getBindMapperName(BindTypeContext context, TypeName typeName) {
Converter<String, String> format = CaseFormat.UPPER_CAMEL.converterTo(CaseFormat.LOWER_CAMEL);
TypeName bindMapperName=TypeUtility.mergeTypeNameWithSuffix(typeName,BindTypeBuilder.SUFFIX);
String simpleName=format.convert(TypeUtility.simpleName(bindMapperName));
if (!alreadyGeneratedMethods.contains(simpleName))
{
alreadyGeneratedMethods.add(simpleName);
if (bindMapperName.equals(beanTypeName))
{
context.builder.addField(FieldSpec.builder(bindMapperName, simpleName, modifiers)
.addJavadoc("$T", bindMapperName)
.initializer("this")
.build());
} else {
context.builder.addField(FieldSpec.builder(bindMapperName, simpleName, modifiers)
.addJavadoc("$T", bindMapperName)
.initializer("$T.mapperFor($T.class)", BinderUtils.class, typeName)
.build());
}
}
return simpleName;
} | java | public String getBindMapperName(BindTypeContext context, TypeName typeName) {
Converter<String, String> format = CaseFormat.UPPER_CAMEL.converterTo(CaseFormat.LOWER_CAMEL);
TypeName bindMapperName=TypeUtility.mergeTypeNameWithSuffix(typeName,BindTypeBuilder.SUFFIX);
String simpleName=format.convert(TypeUtility.simpleName(bindMapperName));
if (!alreadyGeneratedMethods.contains(simpleName))
{
alreadyGeneratedMethods.add(simpleName);
if (bindMapperName.equals(beanTypeName))
{
context.builder.addField(FieldSpec.builder(bindMapperName, simpleName, modifiers)
.addJavadoc("$T", bindMapperName)
.initializer("this")
.build());
} else {
context.builder.addField(FieldSpec.builder(bindMapperName, simpleName, modifiers)
.addJavadoc("$T", bindMapperName)
.initializer("$T.mapperFor($T.class)", BinderUtils.class, typeName)
.build());
}
}
return simpleName;
} | [
"public",
"String",
"getBindMapperName",
"(",
"BindTypeContext",
"context",
",",
"TypeName",
"typeName",
")",
"{",
"Converter",
"<",
"String",
",",
"String",
">",
"format",
"=",
"CaseFormat",
".",
"UPPER_CAMEL",
".",
"converterTo",
"(",
"CaseFormat",
".",
"LOWER... | Gets the bind mapper name.
@param context the context
@param typeName the type name
@return the bind mapper name | [
"Gets",
"the",
"bind",
"mapper",
"name",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/BindTypeContext.java#L70-L93 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/repository/download/RepositoryDownloadUtil.java | RepositoryDownloadUtil.isPublicAsset | public static boolean isPublicAsset(ResourceType resourceType, RepositoryResource installResource) {
if (resourceType.equals(ResourceType.FEATURE) || resourceType.equals(ResourceType.ADDON)) {
EsaResource esar = ((EsaResource) installResource);
if (esar.getVisibility().equals(Visibility.PUBLIC) || esar.getVisibility().equals(Visibility.INSTALL)) {
return true;
}
} else if (resourceType.equals(ResourceType.PRODUCTSAMPLE) || resourceType.equals(ResourceType.OPENSOURCE)) {
return true;
}
return false;
} | java | public static boolean isPublicAsset(ResourceType resourceType, RepositoryResource installResource) {
if (resourceType.equals(ResourceType.FEATURE) || resourceType.equals(ResourceType.ADDON)) {
EsaResource esar = ((EsaResource) installResource);
if (esar.getVisibility().equals(Visibility.PUBLIC) || esar.getVisibility().equals(Visibility.INSTALL)) {
return true;
}
} else if (resourceType.equals(ResourceType.PRODUCTSAMPLE) || resourceType.equals(ResourceType.OPENSOURCE)) {
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"isPublicAsset",
"(",
"ResourceType",
"resourceType",
",",
"RepositoryResource",
"installResource",
")",
"{",
"if",
"(",
"resourceType",
".",
"equals",
"(",
"ResourceType",
".",
"FEATURE",
")",
"||",
"resourceType",
".",
"equals",
"(... | Checks if Feature or Addon has visibility public or install
OR checks if the resource is a Product sample or open source to see if it is a public asset.
@param resourceType - type of repository
@param installResource - represents a resouce in a repository
@return - true if the resource is visible to the public | [
"Checks",
"if",
"Feature",
"or",
"Addon",
"has",
"visibility",
"public",
"or",
"install",
"OR",
"checks",
"if",
"the",
"resource",
"is",
"a",
"Product",
"sample",
"or",
"open",
"source",
"to",
"see",
"if",
"it",
"is",
"a",
"public",
"asset",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/repository/download/RepositoryDownloadUtil.java#L84-L95 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagResourceLoad.java | CmsJspTagResourceLoad.getResourceName | protected static String getResourceName(CmsObject cms, I_CmsResourceContainer contentContainer) {
if ((contentContainer != null) && (contentContainer.getResourceName() != null)) {
return contentContainer.getResourceName();
} else if (cms != null) {
return cms.getRequestContext().getUri();
} else {
return null;
}
} | java | protected static String getResourceName(CmsObject cms, I_CmsResourceContainer contentContainer) {
if ((contentContainer != null) && (contentContainer.getResourceName() != null)) {
return contentContainer.getResourceName();
} else if (cms != null) {
return cms.getRequestContext().getUri();
} else {
return null;
}
} | [
"protected",
"static",
"String",
"getResourceName",
"(",
"CmsObject",
"cms",
",",
"I_CmsResourceContainer",
"contentContainer",
")",
"{",
"if",
"(",
"(",
"contentContainer",
"!=",
"null",
")",
"&&",
"(",
"contentContainer",
".",
"getResourceName",
"(",
")",
"!=",
... | Returns the resource name currently processed.<p>
@param cms the current OpenCms user context
@param contentContainer the current resource container
@return the resource name currently processed | [
"Returns",
"the",
"resource",
"name",
"currently",
"processed",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagResourceLoad.java#L170-L179 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/DcosSpec.java | DcosSpec.jsonMatchesSchema | @Given("^json (.+?) matches schema (.+?)$")
public void jsonMatchesSchema(String json, String schema) throws Exception {
JSONObject jsonschema = new JSONObject(schema);
JSONObject jsondeploy = new JSONObject(json);
commonspec.matchJsonToSchema(jsonschema, jsondeploy);
} | java | @Given("^json (.+?) matches schema (.+?)$")
public void jsonMatchesSchema(String json, String schema) throws Exception {
JSONObject jsonschema = new JSONObject(schema);
JSONObject jsondeploy = new JSONObject(json);
commonspec.matchJsonToSchema(jsonschema, jsondeploy);
} | [
"@",
"Given",
"(",
"\"^json (.+?) matches schema (.+?)$\"",
")",
"public",
"void",
"jsonMatchesSchema",
"(",
"String",
"json",
",",
"String",
"schema",
")",
"throws",
"Exception",
"{",
"JSONObject",
"jsonschema",
"=",
"new",
"JSONObject",
"(",
"schema",
")",
";",
... | Check if json is validated against a schema
@param json json to be validated against schema
@param schema schema to be validated against
@throws Exception exception * | [
"Check",
"if",
"json",
"is",
"validated",
"against",
"a",
"schema"
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DcosSpec.java#L320-L326 |
attribyte/wpdb | src/main/java/org/attribyte/wp/model/ShortcodeParser.java | ShortcodeParser.parseStart | static Shortcode parseStart(final String str) throws ParseException {
String exp = str.trim();
if(exp.length() < 3) {
throw new ParseException(String.format("Invalid shortcode ('%s')", str), 0);
}
if(exp.charAt(0) != '[') {
throw new ParseException("Expecting '['", 0);
}
if(exp.charAt(exp.length() - 1) != ']') {
throw new ParseException("Expecting ']'", exp.length() - 1);
}
exp = exp.substring(1, exp.length() - 1).trim();
if(exp.length() == 0) {
throw new ParseException(String.format("Invalid shortcode ('%s')", str), 0);
}
int attrStart = exp.indexOf(' ');
if(attrStart < 0) {
return new Shortcode(validateName(exp), ImmutableMap.of());
} else {
return new Shortcode(validateName(exp.substring(0, attrStart)), parseAttributes(exp.substring(attrStart).trim()));
}
} | java | static Shortcode parseStart(final String str) throws ParseException {
String exp = str.trim();
if(exp.length() < 3) {
throw new ParseException(String.format("Invalid shortcode ('%s')", str), 0);
}
if(exp.charAt(0) != '[') {
throw new ParseException("Expecting '['", 0);
}
if(exp.charAt(exp.length() - 1) != ']') {
throw new ParseException("Expecting ']'", exp.length() - 1);
}
exp = exp.substring(1, exp.length() - 1).trim();
if(exp.length() == 0) {
throw new ParseException(String.format("Invalid shortcode ('%s')", str), 0);
}
int attrStart = exp.indexOf(' ');
if(attrStart < 0) {
return new Shortcode(validateName(exp), ImmutableMap.of());
} else {
return new Shortcode(validateName(exp.substring(0, attrStart)), parseAttributes(exp.substring(attrStart).trim()));
}
} | [
"static",
"Shortcode",
"parseStart",
"(",
"final",
"String",
"str",
")",
"throws",
"ParseException",
"{",
"String",
"exp",
"=",
"str",
".",
"trim",
"(",
")",
";",
"if",
"(",
"exp",
".",
"length",
"(",
")",
"<",
"3",
")",
"{",
"throw",
"new",
"ParseEx... | Parse '[shortcode attr0="val0" attr1="val1"]
@param str The shortcode string.
@return The shortcode.
@throws ParseException on invalid shortcode. | [
"Parse",
"[",
"shortcode",
"attr0",
"=",
"val0",
"attr1",
"=",
"val1",
"]"
] | train | https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/ShortcodeParser.java#L76-L103 |
dropbox/dropbox-sdk-java | src/main/java/com/dropbox/core/android/DbxOfficialAppConnector.java | DbxOfficialAppConnector.getLoggedinState | private static int getLoggedinState(Context context, String uid) {
Cursor cursor = context.getContentResolver().query(
LOGGED_IN_URI.buildUpon().appendPath(uid).build(), null, // projection
null, // selection clause
null, // selection args
null); // sort order
if (cursor == null) {
// DropboxApp not installed
return NO_USER;
}
cursor.moveToFirst();
return cursor.getInt(cursor.getColumnIndex("logged_in"));
} | java | private static int getLoggedinState(Context context, String uid) {
Cursor cursor = context.getContentResolver().query(
LOGGED_IN_URI.buildUpon().appendPath(uid).build(), null, // projection
null, // selection clause
null, // selection args
null); // sort order
if (cursor == null) {
// DropboxApp not installed
return NO_USER;
}
cursor.moveToFirst();
return cursor.getInt(cursor.getColumnIndex("logged_in"));
} | [
"private",
"static",
"int",
"getLoggedinState",
"(",
"Context",
"context",
",",
"String",
"uid",
")",
"{",
"Cursor",
"cursor",
"=",
"context",
".",
"getContentResolver",
"(",
")",
".",
"query",
"(",
"LOGGED_IN_URI",
".",
"buildUpon",
"(",
")",
".",
"appendPa... | Determine if user uid is logged in
@param context
@param uid
@return NO_USER if no users connected CORRECT_USER if uid connected WRONG_USER if uid not
connected | [
"Determine",
"if",
"user",
"uid",
"is",
"logged",
"in"
] | train | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/android/DbxOfficialAppConnector.java#L154-L167 |
citrusframework/citrus | modules/citrus-jms/src/main/java/com/consol/citrus/jms/endpoint/JmsSyncProducer.java | JmsSyncProducer.resolveDestination | private Destination resolveDestination(String destinationName) throws JMSException {
if (log.isDebugEnabled()) {
log.debug("Sending JMS message to destination: '" + destinationName + "'");
}
return resolveDestinationName(destinationName, session);
} | java | private Destination resolveDestination(String destinationName) throws JMSException {
if (log.isDebugEnabled()) {
log.debug("Sending JMS message to destination: '" + destinationName + "'");
}
return resolveDestinationName(destinationName, session);
} | [
"private",
"Destination",
"resolveDestination",
"(",
"String",
"destinationName",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Sending JMS message to destination: '\"",
"+",
"destinatio... | Resolve destination from given name.
@param destinationName
@return
@throws JMSException | [
"Resolve",
"destination",
"from",
"given",
"name",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/endpoint/JmsSyncProducer.java#L303-L309 |
PureSolTechnologies/parsers | parsers/src/main/java/com/puresoltechnologies/parsers/parser/packrat/PackratParser.java | PackratParser.recall | private MemoEntry recall(String production, int position, int line) throws TreeException, ParserException {
/*
* Retrieve the current memoized item for the production and the head on the
* current position.
*/
final MemoEntry m = memo.getMemo(production, position);
final Head h = heads.get(position);
/*
* "If not growing a seed parse, just return what is stored in the memo table."
*/
if (h == null) {
return m;
}
/*
* "Do not evaluate any rule that is not involved in this left recursion."
*
* If we have never been at this position (NONE) and the head rule (production)
* is not the current production and the involved rules in the heads also do not
* fit, then we are on a wrong pass here. We need to return a failure.
*/
if ((m == null) && (!h.getProduction().equals(production)) && (!h.getInvolvedSet().contains(production))) {
return MemoEntry.failed();
}
/*
* "Allow involved rules to be evaluated, but only once, during a seed-growing
* iteration."
*
* If we have been here already, we check the eval set for the containing rule
* and evaluate it necessary. If the rule is within the eval set, we need to
* parse it once.
*/
if (h.getEvalSet().contains(production)) {
h.getEvalSet().remove(production);
final MemoEntry ans = eval(production, position, line);
m.set(ans);
}
return m;
} | java | private MemoEntry recall(String production, int position, int line) throws TreeException, ParserException {
/*
* Retrieve the current memoized item for the production and the head on the
* current position.
*/
final MemoEntry m = memo.getMemo(production, position);
final Head h = heads.get(position);
/*
* "If not growing a seed parse, just return what is stored in the memo table."
*/
if (h == null) {
return m;
}
/*
* "Do not evaluate any rule that is not involved in this left recursion."
*
* If we have never been at this position (NONE) and the head rule (production)
* is not the current production and the involved rules in the heads also do not
* fit, then we are on a wrong pass here. We need to return a failure.
*/
if ((m == null) && (!h.getProduction().equals(production)) && (!h.getInvolvedSet().contains(production))) {
return MemoEntry.failed();
}
/*
* "Allow involved rules to be evaluated, but only once, during a seed-growing
* iteration."
*
* If we have been here already, we check the eval set for the containing rule
* and evaluate it necessary. If the rule is within the eval set, we need to
* parse it once.
*/
if (h.getEvalSet().contains(production)) {
h.getEvalSet().remove(production);
final MemoEntry ans = eval(production, position, line);
m.set(ans);
}
return m;
} | [
"private",
"MemoEntry",
"recall",
"(",
"String",
"production",
",",
"int",
"position",
",",
"int",
"line",
")",
"throws",
"TreeException",
",",
"ParserException",
"{",
"/*\n\t * Retrieve the current memoized item for the production and the head on the\n\t * current position.\n\t ... | This method is an extended getMemo function which also takes into account the
seed growing processes which might be underway.
@param production
is the currently processes production.
@param position
is the current parser position.
@return A new memo entry is returned containing the result of the memoization
buffer and seed growing status lookup.
@throws TreeException
@throws ParserException | [
"This",
"method",
"is",
"an",
"extended",
"getMemo",
"function",
"which",
"also",
"takes",
"into",
"account",
"the",
"seed",
"growing",
"processes",
"which",
"might",
"be",
"underway",
"."
] | train | https://github.com/PureSolTechnologies/parsers/blob/61077223b90d3768ff9445ae13036343c98b63cd/parsers/src/main/java/com/puresoltechnologies/parsers/parser/packrat/PackratParser.java#L378-L415 |
hawkular/hawkular-alerts | engine/src/main/java/org/hawkular/alerts/engine/impl/ispn/IspnActionsServiceImpl.java | IspnActionsServiceImpl.inClause | private String inClause(String field, Set<String> values) {
String separator = "";
StringBuffer sb = new StringBuffer(" and (");
for (String v : values) {
sb.append(separator);
sb.append(String.format("%s = '%s'", field, v));
separator = " or ";
}
sb.append(")");
return sb.toString();
} | java | private String inClause(String field, Set<String> values) {
String separator = "";
StringBuffer sb = new StringBuffer(" and (");
for (String v : values) {
sb.append(separator);
sb.append(String.format("%s = '%s'", field, v));
separator = " or ";
}
sb.append(")");
return sb.toString();
} | [
"private",
"String",
"inClause",
"(",
"String",
"field",
",",
"Set",
"<",
"String",
">",
"values",
")",
"{",
"String",
"separator",
"=",
"\"\"",
";",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"\" and (\"",
")",
";",
"for",
"(",
"String",
"v"... | An exploded "in" clause because the actual one seems not to work | [
"An",
"exploded",
"in",
"clause",
"because",
"the",
"actual",
"one",
"seems",
"not",
"to",
"work"
] | train | https://github.com/hawkular/hawkular-alerts/blob/b4a0c2909b38e03e72cc1828219562ee8fcbf426/engine/src/main/java/org/hawkular/alerts/engine/impl/ispn/IspnActionsServiceImpl.java#L227-L237 |
apache/incubator-zipkin | zipkin-storage/mysql-v1/src/main/java/zipkin2/storage/mysql/v1/Schema.java | Schema.maybeGet | static <T> T maybeGet(Record record, TableField<Record, T> field, T defaultValue) {
if (record.fieldsRow().indexOf(field) < 0) {
return defaultValue;
} else {
T result = record.get(field);
return result != null ? result : defaultValue;
}
} | java | static <T> T maybeGet(Record record, TableField<Record, T> field, T defaultValue) {
if (record.fieldsRow().indexOf(field) < 0) {
return defaultValue;
} else {
T result = record.get(field);
return result != null ? result : defaultValue;
}
} | [
"static",
"<",
"T",
">",
"T",
"maybeGet",
"(",
"Record",
"record",
",",
"TableField",
"<",
"Record",
",",
"T",
">",
"field",
",",
"T",
"defaultValue",
")",
"{",
"if",
"(",
"record",
".",
"fieldsRow",
"(",
")",
".",
"indexOf",
"(",
"field",
")",
"<"... | returns the default value if the column doesn't exist or the result was null | [
"returns",
"the",
"default",
"value",
"if",
"the",
"column",
"doesn",
"t",
"exist",
"or",
"the",
"result",
"was",
"null"
] | train | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-storage/mysql-v1/src/main/java/zipkin2/storage/mysql/v1/Schema.java#L157-L164 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/VoiceApi.java | VoiceApi.sendDTMF | public ApiSuccessResponse sendDTMF(String id, SendDTMFData sendDTMFData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = sendDTMFWithHttpInfo(id, sendDTMFData);
return resp.getData();
} | java | public ApiSuccessResponse sendDTMF(String id, SendDTMFData sendDTMFData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = sendDTMFWithHttpInfo(id, sendDTMFData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"sendDTMF",
"(",
"String",
"id",
",",
"SendDTMFData",
"sendDTMFData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"sendDTMFWithHttpInfo",
"(",
"id",
",",
"sendDTMFData",
")",
";",
... | Send digits as DTMF
Send DTMF digits to the specified call. You can send DTMF digits individually with multiple requests or together with multiple digits in one request.
@param id The connection ID of the call. (required)
@param sendDTMFData (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Send",
"digits",
"as",
"DTMF",
"Send",
"DTMF",
"digits",
"to",
"the",
"specified",
"call",
".",
"You",
"can",
"send",
"DTMF",
"digits",
"individually",
"with",
"multiple",
"requests",
"or",
"together",
"with",
"multiple",
"digits",
"in",
"one",
"request",
"... | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L3361-L3364 |
googlearchive/firebase-simple-login-java | src/main/java/com/firebase/simplelogin/SimpleLogin.java | SimpleLogin.loginWithFacebook | public void loginWithFacebook(final String appId, final String accessToken, final SimpleLoginAuthenticatedHandler completionHandler) {
if(appId == null || accessToken == null) {
handleInvalidInvalidToken(completionHandler);
}
else {
HashMap<String, String> data = new HashMap<String, String>();
data.put("access_token", accessToken);
loginWithToken(Constants.FIREBASE_AUTH_FACEBOOK_PATH, Provider.FACEBOOK, data, completionHandler);
}
} | java | public void loginWithFacebook(final String appId, final String accessToken, final SimpleLoginAuthenticatedHandler completionHandler) {
if(appId == null || accessToken == null) {
handleInvalidInvalidToken(completionHandler);
}
else {
HashMap<String, String> data = new HashMap<String, String>();
data.put("access_token", accessToken);
loginWithToken(Constants.FIREBASE_AUTH_FACEBOOK_PATH, Provider.FACEBOOK, data, completionHandler);
}
} | [
"public",
"void",
"loginWithFacebook",
"(",
"final",
"String",
"appId",
",",
"final",
"String",
"accessToken",
",",
"final",
"SimpleLoginAuthenticatedHandler",
"completionHandler",
")",
"{",
"if",
"(",
"appId",
"==",
"null",
"||",
"accessToken",
"==",
"null",
")",... | Login to Firebase using a Facebook token. The returned FirebaseSimpleLoginUser object will contain pertinent
Facebook data accessible with getThirdPartyUserData().
@param appId Facebook app id.
@param accessToken Access token returned by Facebook SDK.
@param completionHandler Handler for asynchronous events. | [
"Login",
"to",
"Firebase",
"using",
"a",
"Facebook",
"token",
".",
"The",
"returned",
"FirebaseSimpleLoginUser",
"object",
"will",
"contain",
"pertinent",
"Facebook",
"data",
"accessible",
"with",
"getThirdPartyUserData",
"()",
"."
] | train | https://github.com/googlearchive/firebase-simple-login-java/blob/40498ad173b5fa69c869ba0d29cec187271fda13/src/main/java/com/firebase/simplelogin/SimpleLogin.java#L659-L669 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java | ServerKeysInner.beginCreateOrUpdateAsync | public ServiceFuture<ServerKeyInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, final ServiceCallback<ServerKeyInner> serviceCallback) {
return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters), serviceCallback);
} | java | public ServiceFuture<ServerKeyInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, final ServiceCallback<ServerKeyInner> serviceCallback) {
return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"ServerKeyInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"keyName",
",",
"ServerKeyInner",
"parameters",
",",
"final",
"ServiceCallback",
"<",
"ServerKeyInner",
">"... | Creates or updates a server key.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901
@param parameters The requested server key resource state.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Creates",
"or",
"updates",
"a",
"server",
"key",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java#L421-L423 |
dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/util/SliceInput.java | SliceInput.readBytes | public void readBytes(Slice destination, int length)
{
if (length > destination.length()) {
throw new IndexOutOfBoundsException();
}
readBytes(destination, destination.length(), length);
} | java | public void readBytes(Slice destination, int length)
{
if (length > destination.length()) {
throw new IndexOutOfBoundsException();
}
readBytes(destination, destination.length(), length);
} | [
"public",
"void",
"readBytes",
"(",
"Slice",
"destination",
",",
"int",
"length",
")",
"{",
"if",
"(",
"length",
">",
"destination",
".",
"length",
"(",
")",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"}",
"readBytes",
"(",
"de... | Transfers this buffer's data to the specified destination starting at
the current {@code position} and increases the {@code position}
by the number of the transferred bytes (= {@code length}). This method
is basically same with {@link #readBytes(Slice, int, int)},
except that this method increases the {@code writerIndex} of the
destination by the number of the transferred bytes (= {@code length})
while {@link #readBytes(Slice, int, int)} does not.
@throws IndexOutOfBoundsException if {@code length} is greater than {@code this.available()} or
if {@code length} is greater than {@code destination.writableBytes} | [
"Transfers",
"this",
"buffer",
"s",
"data",
"to",
"the",
"specified",
"destination",
"starting",
"at",
"the",
"current",
"{",
"@code",
"position",
"}",
"and",
"increases",
"the",
"{",
"@code",
"position",
"}",
"by",
"the",
"number",
"of",
"the",
"transferred... | train | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/util/SliceInput.java#L298-L304 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java | InternalService.getConversations | public Observable<ComapiResult<List<Conversation>>> getConversations(final boolean isPublic) {
final String token = getToken();
if (sessionController.isCreatingSession()) {
return getTaskQueue().queueGetConversationsExt(isPublic ? Scope.PUBLIC : Scope.PARTICIPANT);
} else if (TextUtils.isEmpty(token)) {
return Observable.error(getSessionStateErrorDescription());
} else {
return doGetConversations(token, dataMgr.getSessionDAO().session().getProfileId(), isPublic ? Scope.PUBLIC : Scope.PARTICIPANT);
}
} | java | public Observable<ComapiResult<List<Conversation>>> getConversations(final boolean isPublic) {
final String token = getToken();
if (sessionController.isCreatingSession()) {
return getTaskQueue().queueGetConversationsExt(isPublic ? Scope.PUBLIC : Scope.PARTICIPANT);
} else if (TextUtils.isEmpty(token)) {
return Observable.error(getSessionStateErrorDescription());
} else {
return doGetConversations(token, dataMgr.getSessionDAO().session().getProfileId(), isPublic ? Scope.PUBLIC : Scope.PARTICIPANT);
}
} | [
"public",
"Observable",
"<",
"ComapiResult",
"<",
"List",
"<",
"Conversation",
">",
">",
">",
"getConversations",
"(",
"final",
"boolean",
"isPublic",
")",
"{",
"final",
"String",
"token",
"=",
"getToken",
"(",
")",
";",
"if",
"(",
"sessionController",
".",
... | Returns observable to get all visible conversations.
@param isPublic Has the conversation public or private access.
@return Observable to to create a conversation. | [
"Returns",
"observable",
"to",
"get",
"all",
"visible",
"conversations",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L531-L542 |
jglobus/JGlobus | io/src/main/java/org/globus/io/gass/client/internal/GASSProtocol.java | GASSProtocol.PUT | public static String PUT(String path, String host, long length, boolean append) {
String newPath = null;
if (append) {
newPath = APPEND_URI + "/" + path;
} else {
newPath = "/" + path;
}
return HTTPProtocol.createPUTHeader(newPath, host, USER_AGENT,
TYPE, length, append);
} | java | public static String PUT(String path, String host, long length, boolean append) {
String newPath = null;
if (append) {
newPath = APPEND_URI + "/" + path;
} else {
newPath = "/" + path;
}
return HTTPProtocol.createPUTHeader(newPath, host, USER_AGENT,
TYPE, length, append);
} | [
"public",
"static",
"String",
"PUT",
"(",
"String",
"path",
",",
"String",
"host",
",",
"long",
"length",
",",
"boolean",
"append",
")",
"{",
"String",
"newPath",
"=",
"null",
";",
"if",
"(",
"append",
")",
"{",
"newPath",
"=",
"APPEND_URI",
"+",
"\"/\... | This method concatenates a properly formatted header for performing
Globus Gass PUTs with the given information.
@param path the path of the remote file to put to
@param host the host of the remote file to put to
@param length the length of data which will be sent (the size of the file)
@param append append mode
@return <code>String</code> the properly formatted header to be sent to a
gass server | [
"This",
"method",
"concatenates",
"a",
"properly",
"formatted",
"header",
"for",
"performing",
"Globus",
"Gass",
"PUTs",
"with",
"the",
"given",
"information",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/io/src/main/java/org/globus/io/gass/client/internal/GASSProtocol.java#L58-L69 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowTriggersInner.java | WorkflowTriggersInner.setStateAsync | public Observable<Void> setStateAsync(String resourceGroupName, String workflowName, String triggerName, WorkflowTriggerInner source) {
return setStateWithServiceResponseAsync(resourceGroupName, workflowName, triggerName, source).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> setStateAsync(String resourceGroupName, String workflowName, String triggerName, WorkflowTriggerInner source) {
return setStateWithServiceResponseAsync(resourceGroupName, workflowName, triggerName, source).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"setStateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"workflowName",
",",
"String",
"triggerName",
",",
"WorkflowTriggerInner",
"source",
")",
"{",
"return",
"setStateWithServiceResponseAsync",
"(",
"resourceGroup... | Sets the state of a workflow trigger.
@param resourceGroupName The resource group name.
@param workflowName The workflow name.
@param triggerName The workflow trigger name.
@param source the WorkflowTriggerInner value
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Sets",
"the",
"state",
"of",
"a",
"workflow",
"trigger",
"."
] | 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/WorkflowTriggersInner.java#L760-L767 |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/RowsLogBuffer.java | RowsLogBuffer.nextValue | public final Serializable nextValue(final String columName, final int columnIndex, final int type, final int meta,
boolean isBinary) {
fNull = nullBits.get(nullBitIndex++);
if (fNull) {
value = null;
javaType = mysqlToJavaType(type, meta, isBinary);
length = 0;
return null;
} else {
// Extracting field value from packed buffer.
return fetchValue(columName, columnIndex, type, meta, isBinary);
}
} | java | public final Serializable nextValue(final String columName, final int columnIndex, final int type, final int meta,
boolean isBinary) {
fNull = nullBits.get(nullBitIndex++);
if (fNull) {
value = null;
javaType = mysqlToJavaType(type, meta, isBinary);
length = 0;
return null;
} else {
// Extracting field value from packed buffer.
return fetchValue(columName, columnIndex, type, meta, isBinary);
}
} | [
"public",
"final",
"Serializable",
"nextValue",
"(",
"final",
"String",
"columName",
",",
"final",
"int",
"columnIndex",
",",
"final",
"int",
"type",
",",
"final",
"int",
"meta",
",",
"boolean",
"isBinary",
")",
"{",
"fNull",
"=",
"nullBits",
".",
"get",
"... | Extracting next field value from packed buffer.
@see mysql-5.1.60/sql/log_event.cc -
Rows_log_event::print_verbose_one_row | [
"Extracting",
"next",
"field",
"value",
"from",
"packed",
"buffer",
"."
] | train | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/RowsLogBuffer.java#L114-L127 |
dyu/protostuff-1.0.x | protostuff-me/src/main/java/com/dyuproject/protostuff/me/ProtobufIOUtil.java | ProtobufIOUtil.writeDelimitedTo | public static int writeDelimitedTo(DataOutput out, Object message, Schema schema)
throws IOException
{
final LinkedBuffer buffer = new LinkedBuffer(LinkedBuffer.MIN_BUFFER_SIZE);
final ProtobufOutput output = new ProtobufOutput(buffer);
schema.writeTo(output, message);
final int size = output.getSize();
ProtobufOutput.writeRawVarInt32Bytes(out, size);
LinkedBuffer.writeTo(out, buffer);
//final int msgSize = LinkedBuffer.writeTo(out, buffer);
//assert size == msgSize;
return size;
} | java | public static int writeDelimitedTo(DataOutput out, Object message, Schema schema)
throws IOException
{
final LinkedBuffer buffer = new LinkedBuffer(LinkedBuffer.MIN_BUFFER_SIZE);
final ProtobufOutput output = new ProtobufOutput(buffer);
schema.writeTo(output, message);
final int size = output.getSize();
ProtobufOutput.writeRawVarInt32Bytes(out, size);
LinkedBuffer.writeTo(out, buffer);
//final int msgSize = LinkedBuffer.writeTo(out, buffer);
//assert size == msgSize;
return size;
} | [
"public",
"static",
"int",
"writeDelimitedTo",
"(",
"DataOutput",
"out",
",",
"Object",
"message",
",",
"Schema",
"schema",
")",
"throws",
"IOException",
"{",
"final",
"LinkedBuffer",
"buffer",
"=",
"new",
"LinkedBuffer",
"(",
"LinkedBuffer",
".",
"MIN_BUFFER_SIZE... | Used by the code generated messages that implement {@link java.io.Externalizable}.
Writes to the {@link DataOutput}.
@return the size of the message. | [
"Used",
"by",
"the",
"code",
"generated",
"messages",
"that",
"implement",
"{",
"@link",
"java",
".",
"io",
".",
"Externalizable",
"}",
".",
"Writes",
"to",
"the",
"{",
"@link",
"DataOutput",
"}",
"."
] | train | https://github.com/dyu/protostuff-1.0.x/blob/d7c964ec20da3fe44699d86ee95c2677ddffde96/protostuff-me/src/main/java/com/dyuproject/protostuff/me/ProtobufIOUtil.java#L261-L275 |
sonyxperiadev/gerrit-events | src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritJsonEventFactory.java | GerritJsonEventFactory.getDate | public static Date getDate(JSONObject json, String key, Date defaultValue) {
Date result = defaultValue;
if (json.containsKey(key)) {
try {
String secondsString = json.getString(key);
//In gerrit, time is written in seconds, not milliseconds.
Long milliseconds = TimeUnit.SECONDS.toMillis(Long.parseLong(secondsString));
result = new Date(milliseconds);
// CS IGNORE EmptyBlockCheck FOR NEXT 2 LINES. REASON: result is already set to defaultValue.
} catch (JSONException ex) {
} catch (NumberFormatException nfe) {
}
}
return result;
} | java | public static Date getDate(JSONObject json, String key, Date defaultValue) {
Date result = defaultValue;
if (json.containsKey(key)) {
try {
String secondsString = json.getString(key);
//In gerrit, time is written in seconds, not milliseconds.
Long milliseconds = TimeUnit.SECONDS.toMillis(Long.parseLong(secondsString));
result = new Date(milliseconds);
// CS IGNORE EmptyBlockCheck FOR NEXT 2 LINES. REASON: result is already set to defaultValue.
} catch (JSONException ex) {
} catch (NumberFormatException nfe) {
}
}
return result;
} | [
"public",
"static",
"Date",
"getDate",
"(",
"JSONObject",
"json",
",",
"String",
"key",
",",
"Date",
"defaultValue",
")",
"{",
"Date",
"result",
"=",
"defaultValue",
";",
"if",
"(",
"json",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"try",
"{",
"St... | Returns the value of a JSON property as a Date if it exists otherwise returns the defaultValue.
@param json the JSONObject to check.
@param key the key.
@param defaultValue the value to return if the key is missing.
@return the value for the key as a Date. | [
"Returns",
"the",
"value",
"of",
"a",
"JSON",
"property",
"as",
"a",
"Date",
"if",
"it",
"exists",
"otherwise",
"returns",
"the",
"defaultValue",
"."
] | train | https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritJsonEventFactory.java#L274-L288 |
lucee/Lucee | core/src/main/java/lucee/transformer/interpreter/op/OpDouble.java | OpDouble.toExprDouble | public static ExprDouble toExprDouble(Expression left, Expression right, int operation) {
return new OpDouble(left, right, operation);
} | java | public static ExprDouble toExprDouble(Expression left, Expression right, int operation) {
return new OpDouble(left, right, operation);
} | [
"public",
"static",
"ExprDouble",
"toExprDouble",
"(",
"Expression",
"left",
",",
"Expression",
"right",
",",
"int",
"operation",
")",
"{",
"return",
"new",
"OpDouble",
"(",
"left",
",",
"right",
",",
"operation",
")",
";",
"}"
] | Create a String expression from a Expression
@param left
@param right
@param operation
@return String expression
@throws TemplateException | [
"Create",
"a",
"String",
"expression",
"from",
"a",
"Expression"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/interpreter/op/OpDouble.java#L48-L50 |
kejunxia/AndroidMvc | library/poke/src/main/java/com/shipdream/lib/poke/util/ReflectUtils.java | ReflectUtils.setField | public static void setField(Object obj, Field field, Object value) {
boolean accessible = field.isAccessible();
//hack accessibility
if (!accessible) {
field.setAccessible(true);
}
try {
field.set(obj, value);
} catch (IllegalAccessException e) {
//ignore should not happen as accessibility has been updated to suit assignment
e.printStackTrace(); // $COVERAGE-IGNORE$
}
//restore accessibility
field.setAccessible(accessible);
} | java | public static void setField(Object obj, Field field, Object value) {
boolean accessible = field.isAccessible();
//hack accessibility
if (!accessible) {
field.setAccessible(true);
}
try {
field.set(obj, value);
} catch (IllegalAccessException e) {
//ignore should not happen as accessibility has been updated to suit assignment
e.printStackTrace(); // $COVERAGE-IGNORE$
}
//restore accessibility
field.setAccessible(accessible);
} | [
"public",
"static",
"void",
"setField",
"(",
"Object",
"obj",
",",
"Field",
"field",
",",
"Object",
"value",
")",
"{",
"boolean",
"accessible",
"=",
"field",
".",
"isAccessible",
"(",
")",
";",
"//hack accessibility",
"if",
"(",
"!",
"accessible",
")",
"{"... | Sets value to the field of the given object.
@param obj The object
@param field The field
@param value The value | [
"Sets",
"value",
"to",
"the",
"field",
"of",
"the",
"given",
"object",
"."
] | train | https://github.com/kejunxia/AndroidMvc/blob/c7893f0a13119d64297b9eb2988f7323b7da5bbc/library/poke/src/main/java/com/shipdream/lib/poke/util/ReflectUtils.java#L91-L105 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/code/CciConnFactoryCodeGen.java | CciConnFactoryCodeGen.writeImport | @Override
public void writeImport(Definition def, Writer out) throws IOException
{
out.write("package " + def.getRaPackage() + ";\n\n");
out.write("import javax.naming.NamingException;\n");
out.write("import javax.naming.Reference;\n\n");
out.write("import javax.resource.ResourceException;\n");
out.write("import javax.resource.cci.Connection;\n");
out.write("import javax.resource.cci.ConnectionFactory;\n");
out.write("import javax.resource.cci.ConnectionSpec;\n");
out.write("import javax.resource.cci.RecordFactory;\n");
out.write("import javax.resource.cci.ResourceAdapterMetaData;\n");
out.write("import javax.resource.spi.ConnectionManager;\n\n");
if (def.getMcfDefs().size() != 1)
out.write("import " + def.getRaPackage() + ".*;\n\n");
} | java | @Override
public void writeImport(Definition def, Writer out) throws IOException
{
out.write("package " + def.getRaPackage() + ";\n\n");
out.write("import javax.naming.NamingException;\n");
out.write("import javax.naming.Reference;\n\n");
out.write("import javax.resource.ResourceException;\n");
out.write("import javax.resource.cci.Connection;\n");
out.write("import javax.resource.cci.ConnectionFactory;\n");
out.write("import javax.resource.cci.ConnectionSpec;\n");
out.write("import javax.resource.cci.RecordFactory;\n");
out.write("import javax.resource.cci.ResourceAdapterMetaData;\n");
out.write("import javax.resource.spi.ConnectionManager;\n\n");
if (def.getMcfDefs().size() != 1)
out.write("import " + def.getRaPackage() + ".*;\n\n");
} | [
"@",
"Override",
"public",
"void",
"writeImport",
"(",
"Definition",
"def",
",",
"Writer",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"write",
"(",
"\"package \"",
"+",
"def",
".",
"getRaPackage",
"(",
")",
"+",
"\";\\n\\n\"",
")",
";",
"out",
... | Output class import
@param def definition
@param out Writer
@throws IOException ioException | [
"Output",
"class",
"import"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/CciConnFactoryCodeGen.java#L80-L95 |
facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java | OfferService.notifyNamenodeReceivedBlock | void notifyNamenodeReceivedBlock(Block block, String delHint) {
if (block==null) {
throw new IllegalArgumentException("Block is null");
}
if (delHint != null && !delHint.isEmpty()) {
block = new ReceivedBlockInfo(block, delHint);
}
synchronized (receivedAndDeletedBlockList) {
receivedAndDeletedBlockList.add(block);
pendingReceivedRequests++;
if (!shouldBackoff) {
receivedAndDeletedBlockList.notifyAll();
}
}
} | java | void notifyNamenodeReceivedBlock(Block block, String delHint) {
if (block==null) {
throw new IllegalArgumentException("Block is null");
}
if (delHint != null && !delHint.isEmpty()) {
block = new ReceivedBlockInfo(block, delHint);
}
synchronized (receivedAndDeletedBlockList) {
receivedAndDeletedBlockList.add(block);
pendingReceivedRequests++;
if (!shouldBackoff) {
receivedAndDeletedBlockList.notifyAll();
}
}
} | [
"void",
"notifyNamenodeReceivedBlock",
"(",
"Block",
"block",
",",
"String",
"delHint",
")",
"{",
"if",
"(",
"block",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Block is null\"",
")",
";",
"}",
"if",
"(",
"delHint",
"!=",
"nu... | Add a block to the pending received/deleted ACKs.
to inform the namenode that we have received a block. | [
"Add",
"a",
"block",
"to",
"the",
"pending",
"received",
"/",
"deleted",
"ACKs",
".",
"to",
"inform",
"the",
"namenode",
"that",
"we",
"have",
"received",
"a",
"block",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java#L821-L835 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java | Utils.getSuperTypeParameterMap | public static void getSuperTypeParameterMap(JvmDeclaredType type, Map<String, JvmTypeReference> mapping) {
for (final JvmTypeReference superTypeReference : type.getSuperTypes()) {
if (superTypeReference instanceof JvmParameterizedTypeReference) {
final JvmParameterizedTypeReference parameterizedTypeReference = (JvmParameterizedTypeReference) superTypeReference;
final JvmType st = superTypeReference.getType();
if (st instanceof JvmTypeParameterDeclarator) {
final JvmTypeParameterDeclarator superType = (JvmTypeParameterDeclarator) st;
int i = 0;
for (final JvmTypeParameter typeParameter : superType.getTypeParameters()) {
mapping.put(typeParameter.getIdentifier(), parameterizedTypeReference.getArguments().get(i));
++i;
}
}
}
}
} | java | public static void getSuperTypeParameterMap(JvmDeclaredType type, Map<String, JvmTypeReference> mapping) {
for (final JvmTypeReference superTypeReference : type.getSuperTypes()) {
if (superTypeReference instanceof JvmParameterizedTypeReference) {
final JvmParameterizedTypeReference parameterizedTypeReference = (JvmParameterizedTypeReference) superTypeReference;
final JvmType st = superTypeReference.getType();
if (st instanceof JvmTypeParameterDeclarator) {
final JvmTypeParameterDeclarator superType = (JvmTypeParameterDeclarator) st;
int i = 0;
for (final JvmTypeParameter typeParameter : superType.getTypeParameters()) {
mapping.put(typeParameter.getIdentifier(), parameterizedTypeReference.getArguments().get(i));
++i;
}
}
}
}
} | [
"public",
"static",
"void",
"getSuperTypeParameterMap",
"(",
"JvmDeclaredType",
"type",
",",
"Map",
"<",
"String",
",",
"JvmTypeReference",
">",
"mapping",
")",
"{",
"for",
"(",
"final",
"JvmTypeReference",
"superTypeReference",
":",
"type",
".",
"getSuperTypes",
... | Extract the mapping between the type parameters declared within the super types and the
type parameters arguments that are declared within the given type.
<p>For example, consider the following code:
<pre><code>
interface X<T> {
def a(p1 : T, p2 : U) with U
}
interface Y<T> {
}
class Z<TT> implements X<TT>, Y<TT> {
def a(p1 : TT, p2 : W) with W { }
}
</code></pre>
The mapping is:
<pre><code>
X.T => TT
Y.T => TT
</code></pre>
@param type the type to analyze.
@param mapping the map to fill with the mapping.
@since 0.7 | [
"Extract",
"the",
"mapping",
"between",
"the",
"type",
"parameters",
"declared",
"within",
"the",
"super",
"types",
"and",
"the",
"type",
"parameters",
"arguments",
"that",
"are",
"declared",
"within",
"the",
"given",
"type",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java#L1590-L1605 |
GII/broccoli | broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owl/OWLValueObject.java | OWLValueObject.buildFromClasAndObject | private static OWLValueObject buildFromClasAndObject(OWLModel model, OWLURIClass uriClass, Object object) throws NotYetImplementedException, OWLTranslationException {
// if object is a primitive data type:
if (object.getClass().isPrimitive() || object instanceof String) {
return new OWLValueObject(model, uriClass, model.createDataValue(object, uriClass.getURI()));
}
// if object uses jenabeans:
if (ObjectOWLSTranslator.isJenaBean(object)) {
try {
return new OWLValueObject(
model,
uriClass,
model.createIndividual(uriClass.getURI(), new URI(ObjectOWLSTranslator.beanToJenaResource(model, object).getURI())));
} catch (URISyntaxException ex) {
throw new OWLTranslationException("translating to Jena: ", ex);
}
}
throw new NotYetImplementedException("new " + OWLValueObject.class.toString() + " from a non-primitive object");
} | java | private static OWLValueObject buildFromClasAndObject(OWLModel model, OWLURIClass uriClass, Object object) throws NotYetImplementedException, OWLTranslationException {
// if object is a primitive data type:
if (object.getClass().isPrimitive() || object instanceof String) {
return new OWLValueObject(model, uriClass, model.createDataValue(object, uriClass.getURI()));
}
// if object uses jenabeans:
if (ObjectOWLSTranslator.isJenaBean(object)) {
try {
return new OWLValueObject(
model,
uriClass,
model.createIndividual(uriClass.getURI(), new URI(ObjectOWLSTranslator.beanToJenaResource(model, object).getURI())));
} catch (URISyntaxException ex) {
throw new OWLTranslationException("translating to Jena: ", ex);
}
}
throw new NotYetImplementedException("new " + OWLValueObject.class.toString() + " from a non-primitive object");
} | [
"private",
"static",
"OWLValueObject",
"buildFromClasAndObject",
"(",
"OWLModel",
"model",
",",
"OWLURIClass",
"uriClass",
",",
"Object",
"object",
")",
"throws",
"NotYetImplementedException",
",",
"OWLTranslationException",
"{",
"// if object is a primitive data type:",
"if"... | Builds an instance
@param model
@param uriClass
@param object
@return
@throws NotYetImplementedException
@throws OWLTranslationException | [
"Builds",
"an",
"instance"
] | train | https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owl/OWLValueObject.java#L248-L265 |
hsiafan/apk-parser | src/main/java/net/dongliu/apk/parser/AbstractApkFile.java | AbstractApkFile.getIconFile | @Deprecated
public Icon getIconFile() throws IOException {
ApkMeta apkMeta = getApkMeta();
String iconPath = apkMeta.getIcon();
if (iconPath == null) {
return null;
}
return new Icon(iconPath, Densities.DEFAULT, getFileData(iconPath));
} | java | @Deprecated
public Icon getIconFile() throws IOException {
ApkMeta apkMeta = getApkMeta();
String iconPath = apkMeta.getIcon();
if (iconPath == null) {
return null;
}
return new Icon(iconPath, Densities.DEFAULT, getFileData(iconPath));
} | [
"@",
"Deprecated",
"public",
"Icon",
"getIconFile",
"(",
")",
"throws",
"IOException",
"{",
"ApkMeta",
"apkMeta",
"=",
"getApkMeta",
"(",
")",
";",
"String",
"iconPath",
"=",
"apkMeta",
".",
"getIcon",
"(",
")",
";",
"if",
"(",
"iconPath",
"==",
"null",
... | Get the default apk icon file.
@deprecated use {@link #getAllIcons()} | [
"Get",
"the",
"default",
"apk",
"icon",
"file",
"."
] | train | https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/AbstractApkFile.java#L295-L303 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java | VirtualMachineScaleSetsInner.createOrUpdate | public VirtualMachineScaleSetInner createOrUpdate(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, parameters).toBlocking().last().body();
} | java | public VirtualMachineScaleSetInner createOrUpdate(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, parameters).toBlocking().last().body();
} | [
"public",
"VirtualMachineScaleSetInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
",",
"VirtualMachineScaleSetInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmScal... | Create or update a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set to create or update.
@param parameters The scale set object.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VirtualMachineScaleSetInner object if successful. | [
"Create",
"or",
"update",
"a",
"VM",
"scale",
"set",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L205-L207 |
berkesa/datatree-promise | src/main/java/io/datatree/Promise.java | Promise.catchError | public Promise catchError(CheckedConsumer<Throwable> action) {
return new Promise(future.handle((data, error) -> {
if (error != null) {
try {
action.accept(error);
} catch (Throwable cause) {
return cause;
}
}
return data;
}), root);
} | java | public Promise catchError(CheckedConsumer<Throwable> action) {
return new Promise(future.handle((data, error) -> {
if (error != null) {
try {
action.accept(error);
} catch (Throwable cause) {
return cause;
}
}
return data;
}), root);
} | [
"public",
"Promise",
"catchError",
"(",
"CheckedConsumer",
"<",
"Throwable",
">",
"action",
")",
"{",
"return",
"new",
"Promise",
"(",
"future",
".",
"handle",
"(",
"(",
"data",
",",
"error",
")",
"->",
"{",
"if",
"(",
"error",
"!=",
"null",
")",
"{",
... | The catchError() method returns a Promise and deals with rejected cases
only. Sample:
<pre>
Promise.resolve().then(() -> {
return 123;
<b>}).catchError(error -> {</b>
// ...do something, without a return value...
});
</pre>
@param action
error handler of the previous "next" handlers
@return output Promise | [
"The",
"catchError",
"()",
"method",
"returns",
"a",
"Promise",
"and",
"deals",
"with",
"rejected",
"cases",
"only",
".",
"Sample",
":"
] | train | https://github.com/berkesa/datatree-promise/blob/d9093bdb549f69b83b3eff5e29cd511f2014f177/src/main/java/io/datatree/Promise.java#L492-L503 |
jayantk/jklol | src/com/jayantkrish/jklol/ccg/chart/AbstractCcgChart.java | AbstractCcgChart.decodeParseFromSpan | public CcgParse decodeParseFromSpan(int spanStart, int spanEnd, int beamIndex, CcgParser parser) {
DiscreteVariable syntaxVarType = parser.getSyntaxVarType();
ChartEntry entry = getChartEntriesForSpan(spanStart, spanEnd)[beamIndex];
HeadedSyntacticCategory syntax = (HeadedSyntacticCategory) syntaxVarType.getValue(
entry.getHeadedSyntax());
if (entry.isTerminal()) {
List<String> terminals = getWords();
List<String> posTags = getPosTags();
// rightSpanStart and rightSpanEnd are used to track the trigger span
// in chart entries for terminals.
LexiconEntryInfo lexiconEntryInfo = new LexiconEntryInfo(entry.getLexiconEntry(),
entry.getLexiconTrigger(), entry.getLexiconIndex(), spanStart, spanEnd,
entry.getRightSpanStart(), entry.getRightSpanEnd());
return CcgParse.forTerminal(syntax, lexiconEntryInfo, posTags.subList(spanStart, spanEnd + 1),
parser.variableToIndexedPredicateArray(syntax.getHeadVariable(), entry.getAssignments()),
Arrays.asList(parser.longArrayToFilledDependencyArray(entry.getDependencies())),
terminals.subList(spanStart, spanEnd + 1), getChartEntryProbsForSpan(spanStart, spanEnd)[beamIndex],
entry.getRootUnaryRule(), spanStart, spanEnd);
} else {
CcgParse left = decodeParseFromSpan(entry.getLeftSpanStart(), entry.getLeftSpanEnd(),
entry.getLeftChartIndex(), parser);
CcgParse right = decodeParseFromSpan(entry.getRightSpanStart(), entry.getRightSpanEnd(),
entry.getRightChartIndex(), parser);
if (entry.getLeftUnaryRule() != null) {
left = left.addUnaryRule(entry.getLeftUnaryRule(), (HeadedSyntacticCategory)
syntaxVarType.getValue(entry.getLeftUnaryRule().getSyntax()));
}
if (entry.getRightUnaryRule() != null) {
right = right.addUnaryRule(entry.getRightUnaryRule(), (HeadedSyntacticCategory)
syntaxVarType.getValue(entry.getRightUnaryRule().getSyntax()));
}
double nodeProb = getChartEntryProbsForSpan(spanStart, spanEnd)[beamIndex] /
(left.getSubtreeProbability() * right.getSubtreeProbability());
return CcgParse.forNonterminal(syntax,
parser.variableToIndexedPredicateArray(syntax.getHeadVariable(), entry.getAssignments()),
Arrays.asList(parser.longArrayToFilledDependencyArray(entry.getDependencies())), nodeProb,
left, right, entry.getCombinator(), entry.getRootUnaryRule(), spanStart, spanEnd);
}
} | java | public CcgParse decodeParseFromSpan(int spanStart, int spanEnd, int beamIndex, CcgParser parser) {
DiscreteVariable syntaxVarType = parser.getSyntaxVarType();
ChartEntry entry = getChartEntriesForSpan(spanStart, spanEnd)[beamIndex];
HeadedSyntacticCategory syntax = (HeadedSyntacticCategory) syntaxVarType.getValue(
entry.getHeadedSyntax());
if (entry.isTerminal()) {
List<String> terminals = getWords();
List<String> posTags = getPosTags();
// rightSpanStart and rightSpanEnd are used to track the trigger span
// in chart entries for terminals.
LexiconEntryInfo lexiconEntryInfo = new LexiconEntryInfo(entry.getLexiconEntry(),
entry.getLexiconTrigger(), entry.getLexiconIndex(), spanStart, spanEnd,
entry.getRightSpanStart(), entry.getRightSpanEnd());
return CcgParse.forTerminal(syntax, lexiconEntryInfo, posTags.subList(spanStart, spanEnd + 1),
parser.variableToIndexedPredicateArray(syntax.getHeadVariable(), entry.getAssignments()),
Arrays.asList(parser.longArrayToFilledDependencyArray(entry.getDependencies())),
terminals.subList(spanStart, spanEnd + 1), getChartEntryProbsForSpan(spanStart, spanEnd)[beamIndex],
entry.getRootUnaryRule(), spanStart, spanEnd);
} else {
CcgParse left = decodeParseFromSpan(entry.getLeftSpanStart(), entry.getLeftSpanEnd(),
entry.getLeftChartIndex(), parser);
CcgParse right = decodeParseFromSpan(entry.getRightSpanStart(), entry.getRightSpanEnd(),
entry.getRightChartIndex(), parser);
if (entry.getLeftUnaryRule() != null) {
left = left.addUnaryRule(entry.getLeftUnaryRule(), (HeadedSyntacticCategory)
syntaxVarType.getValue(entry.getLeftUnaryRule().getSyntax()));
}
if (entry.getRightUnaryRule() != null) {
right = right.addUnaryRule(entry.getRightUnaryRule(), (HeadedSyntacticCategory)
syntaxVarType.getValue(entry.getRightUnaryRule().getSyntax()));
}
double nodeProb = getChartEntryProbsForSpan(spanStart, spanEnd)[beamIndex] /
(left.getSubtreeProbability() * right.getSubtreeProbability());
return CcgParse.forNonterminal(syntax,
parser.variableToIndexedPredicateArray(syntax.getHeadVariable(), entry.getAssignments()),
Arrays.asList(parser.longArrayToFilledDependencyArray(entry.getDependencies())), nodeProb,
left, right, entry.getCombinator(), entry.getRootUnaryRule(), spanStart, spanEnd);
}
} | [
"public",
"CcgParse",
"decodeParseFromSpan",
"(",
"int",
"spanStart",
",",
"int",
"spanEnd",
",",
"int",
"beamIndex",
",",
"CcgParser",
"parser",
")",
"{",
"DiscreteVariable",
"syntaxVarType",
"=",
"parser",
".",
"getSyntaxVarType",
"(",
")",
";",
"ChartEntry",
... | Decodes the CCG parse which is the {@code beamIndex}'th parse in
the beam for the given span.
@param spanStart
@param spanEnd
@param beamIndex
@param parser
@return | [
"Decodes",
"the",
"CCG",
"parse",
"which",
"is",
"the",
"{",
"@code",
"beamIndex",
"}",
"th",
"parse",
"in",
"the",
"beam",
"for",
"the",
"given",
"span",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/chart/AbstractCcgChart.java#L230-L273 |
Netflix/Nicobar | nicobar-core/src/main/java/com/netflix/nicobar/core/module/ScriptModuleLoader.java | ScriptModuleLoader.notifyModuleUpdate | protected void notifyModuleUpdate(@Nullable ScriptModule newModule, @Nullable ScriptModule oldModule) {
for (ScriptModuleListener listener : listeners) {
listener.moduleUpdated(newModule, oldModule);
}
} | java | protected void notifyModuleUpdate(@Nullable ScriptModule newModule, @Nullable ScriptModule oldModule) {
for (ScriptModuleListener listener : listeners) {
listener.moduleUpdated(newModule, oldModule);
}
} | [
"protected",
"void",
"notifyModuleUpdate",
"(",
"@",
"Nullable",
"ScriptModule",
"newModule",
",",
"@",
"Nullable",
"ScriptModule",
"oldModule",
")",
"{",
"for",
"(",
"ScriptModuleListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"moduleUpdated",
... | Convenience method to notify the listeners that there was an update to the script module
@param newModule newly loaded module
@param oldModule module that was displaced by the new module | [
"Convenience",
"method",
"to",
"notify",
"the",
"listeners",
"that",
"there",
"was",
"an",
"update",
"to",
"the",
"script",
"module"
] | train | https://github.com/Netflix/Nicobar/blob/507173dcae4a86a955afc3df222a855862fab8d7/nicobar-core/src/main/java/com/netflix/nicobar/core/module/ScriptModuleLoader.java#L489-L493 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java | JobScheduleOperations.createJobSchedule | public void createJobSchedule(String jobScheduleId, Schedule schedule, JobSpecification jobSpecification, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobScheduleAddParameter param = new JobScheduleAddParameter()
.withJobSpecification(jobSpecification)
.withSchedule(schedule)
.withId(jobScheduleId);
createJobSchedule(param, additionalBehaviors);
} | java | public void createJobSchedule(String jobScheduleId, Schedule schedule, JobSpecification jobSpecification, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobScheduleAddParameter param = new JobScheduleAddParameter()
.withJobSpecification(jobSpecification)
.withSchedule(schedule)
.withId(jobScheduleId);
createJobSchedule(param, additionalBehaviors);
} | [
"public",
"void",
"createJobSchedule",
"(",
"String",
"jobScheduleId",
",",
"Schedule",
"schedule",
",",
"JobSpecification",
"jobSpecification",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOExceptio... | Adds a job schedule to the Batch account.
@param jobScheduleId A string that uniquely identifies the job schedule within the account.
@param schedule The schedule according to which jobs will be created.
@param jobSpecification Details about the jobs to be created on this schedule.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Adds",
"a",
"job",
"schedule",
"to",
"the",
"Batch",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java#L378-L384 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/FileSpec.java | FileSpec.convertJsonToYaml | @When("^I convert the json file '(.+?)' to yaml file '(.+?)'$")
public void convertJsonToYaml(String fileToConvert, String fileName) throws Exception {
// Retrieve data
String retrievedData = commonspec.asYaml(fileToConvert);
// Create file (temporary) and set path to be accessible within test
File tempDirectory = new File(String.valueOf(System.getProperty("user.dir") + "/target/test-classes/"));
String absolutePathFile = tempDirectory.getAbsolutePath() + "/" + fileName;
commonspec.getLogger().debug("Creating file {} in 'target/test-classes'", absolutePathFile);
// Note that this Writer will delete the file if it exists
Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(absolutePathFile), "UTF-8"));
try {
out.write(retrievedData);
} catch (Exception e) {
commonspec.getLogger().error("Custom file {} hasn't been created:\n{}", absolutePathFile, e.toString());
throw new RuntimeException("Custom file {} hasn't been created");
} finally {
out.close();
}
Assertions.assertThat(new File(absolutePathFile).isFile());
} | java | @When("^I convert the json file '(.+?)' to yaml file '(.+?)'$")
public void convertJsonToYaml(String fileToConvert, String fileName) throws Exception {
// Retrieve data
String retrievedData = commonspec.asYaml(fileToConvert);
// Create file (temporary) and set path to be accessible within test
File tempDirectory = new File(String.valueOf(System.getProperty("user.dir") + "/target/test-classes/"));
String absolutePathFile = tempDirectory.getAbsolutePath() + "/" + fileName;
commonspec.getLogger().debug("Creating file {} in 'target/test-classes'", absolutePathFile);
// Note that this Writer will delete the file if it exists
Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(absolutePathFile), "UTF-8"));
try {
out.write(retrievedData);
} catch (Exception e) {
commonspec.getLogger().error("Custom file {} hasn't been created:\n{}", absolutePathFile, e.toString());
throw new RuntimeException("Custom file {} hasn't been created");
} finally {
out.close();
}
Assertions.assertThat(new File(absolutePathFile).isFile());
} | [
"@",
"When",
"(",
"\"^I convert the json file '(.+?)' to yaml file '(.+?)'$\"",
")",
"public",
"void",
"convertJsonToYaml",
"(",
"String",
"fileToConvert",
",",
"String",
"fileName",
")",
"throws",
"Exception",
"{",
"// Retrieve data",
"String",
"retrievedData",
"=",
"com... | Method to convert one json to yaml file - backup&restore functionality
<p>
File will be placed on path /target/test-classes | [
"Method",
"to",
"convert",
"one",
"json",
"to",
"yaml",
"file",
"-",
"backup&restore",
"functionality",
"<p",
">",
"File",
"will",
"be",
"placed",
"on",
"path",
"/",
"target",
"/",
"test",
"-",
"classes"
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/FileSpec.java#L206-L228 |
OpenTSDB/opentsdb | src/tsd/RpcManager.java | RpcManager.createAndInitialize | @VisibleForTesting
protected <T> T createAndInitialize(final String pluginClassName, final Class<T> pluginClass) {
final T instance = PluginLoader.loadSpecificPlugin(pluginClassName, pluginClass);
Preconditions.checkState(instance != null,
"Unable to locate %s using name '%s", pluginClass, pluginClassName);
try {
final Method initMeth = instance.getClass().getMethod("initialize", TSDB.class);
initMeth.invoke(instance, tsdb);
final Method versionMeth = instance.getClass().getMethod("version");
String version = (String) versionMeth.invoke(instance);
LOG.info("Successfully initialized plugin [{}] version: {}",
instance.getClass().getCanonicalName(),
version);
return instance;
} catch (Exception e) {
throw new RuntimeException("Failed to initialize " + instance.getClass(), e);
}
} | java | @VisibleForTesting
protected <T> T createAndInitialize(final String pluginClassName, final Class<T> pluginClass) {
final T instance = PluginLoader.loadSpecificPlugin(pluginClassName, pluginClass);
Preconditions.checkState(instance != null,
"Unable to locate %s using name '%s", pluginClass, pluginClassName);
try {
final Method initMeth = instance.getClass().getMethod("initialize", TSDB.class);
initMeth.invoke(instance, tsdb);
final Method versionMeth = instance.getClass().getMethod("version");
String version = (String) versionMeth.invoke(instance);
LOG.info("Successfully initialized plugin [{}] version: {}",
instance.getClass().getCanonicalName(),
version);
return instance;
} catch (Exception e) {
throw new RuntimeException("Failed to initialize " + instance.getClass(), e);
}
} | [
"@",
"VisibleForTesting",
"protected",
"<",
"T",
">",
"T",
"createAndInitialize",
"(",
"final",
"String",
"pluginClassName",
",",
"final",
"Class",
"<",
"T",
">",
"pluginClass",
")",
"{",
"final",
"T",
"instance",
"=",
"PluginLoader",
".",
"loadSpecificPlugin",
... | Helper method to load and initialize a given plugin class. This uses reflection
because plugins share no common interfaces. (They could though!)
@param pluginClassName the class name of the plugin to load
@param pluginClass class of the plugin
@return loaded an initialized instance of {@code pluginClass} | [
"Helper",
"method",
"to",
"load",
"and",
"initialize",
"a",
"given",
"plugin",
"class",
".",
"This",
"uses",
"reflection",
"because",
"plugins",
"share",
"no",
"common",
"interfaces",
".",
"(",
"They",
"could",
"though!",
")"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/RpcManager.java#L456-L473 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJXYBarChartBuilder.java | DJXYBarChartBuilder.addSerie | public DJXYBarChartBuilder addSerie(AbstractColumn column, StringExpression labelExpression) {
getDataset().addSerie(column, labelExpression);
return this;
} | java | public DJXYBarChartBuilder addSerie(AbstractColumn column, StringExpression labelExpression) {
getDataset().addSerie(column, labelExpression);
return this;
} | [
"public",
"DJXYBarChartBuilder",
"addSerie",
"(",
"AbstractColumn",
"column",
",",
"StringExpression",
"labelExpression",
")",
"{",
"getDataset",
"(",
")",
".",
"addSerie",
"(",
"column",
",",
"labelExpression",
")",
";",
"return",
"this",
";",
"}"
] | Adds the specified serie column to the dataset with custom label.
@param column the serie column | [
"Adds",
"the",
"specified",
"serie",
"column",
"to",
"the",
"dataset",
"with",
"custom",
"label",
"."
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJXYBarChartBuilder.java#L384-L387 |
xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java | UnitResponse.createException | public static UnitResponse createException(Throwable e, String errMsg) {
return UnitResponse.createException(e).setMessage(errMsg);
} | java | public static UnitResponse createException(Throwable e, String errMsg) {
return UnitResponse.createException(e).setMessage(errMsg);
} | [
"public",
"static",
"UnitResponse",
"createException",
"(",
"Throwable",
"e",
",",
"String",
"errMsg",
")",
"{",
"return",
"UnitResponse",
".",
"createException",
"(",
"e",
")",
".",
"setMessage",
"(",
"errMsg",
")",
";",
"}"
] | Please pass an exception object to this method, and it returns a newly created response object with error code {@link Group#CODE_EXCEPTION}
and the exception object as the data.
@param e the exception object.
@param errMsg the error message that you want to add. | [
"Please",
"pass",
"an",
"exception",
"object",
"to",
"this",
"method",
"and",
"it",
"returns",
"a",
"newly",
"created",
"response",
"object",
"with",
"error",
"code",
"{",
"@link",
"Group#CODE_EXCEPTION",
"}",
"and",
"the",
"exception",
"object",
"as",
"the",
... | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java#L128-L130 |
apache/groovy | subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java | DateTimeExtensions.downto | public static void downto(Temporal from, Temporal to, TemporalUnit unit, Closure closure) {
if (isDowntoEligible(from, to)) {
for (Temporal i = from; isDowntoEligible(i, to); i = i.minus(1, unit)) {
closure.call(i);
}
} else {
throw new GroovyRuntimeException("The argument (" + to +
") to downto() cannot be later than the value (" + from + ") it's called on.");
}
} | java | public static void downto(Temporal from, Temporal to, TemporalUnit unit, Closure closure) {
if (isDowntoEligible(from, to)) {
for (Temporal i = from; isDowntoEligible(i, to); i = i.minus(1, unit)) {
closure.call(i);
}
} else {
throw new GroovyRuntimeException("The argument (" + to +
") to downto() cannot be later than the value (" + from + ") it's called on.");
}
} | [
"public",
"static",
"void",
"downto",
"(",
"Temporal",
"from",
",",
"Temporal",
"to",
",",
"TemporalUnit",
"unit",
",",
"Closure",
"closure",
")",
"{",
"if",
"(",
"isDowntoEligible",
"(",
"from",
",",
"to",
")",
")",
"{",
"for",
"(",
"Temporal",
"i",
"... | Iterates from this to the {@code to} {@link java.time.temporal.Temporal}, inclusive, decrementing by one
{@code unit} each iteration, calling the closure once per iteration. The closure may accept a single
{@link java.time.temporal.Temporal} argument.
<p>
If the unit is too large to iterate to the second Temporal exactly, such as iterating from two LocalDateTimes
that are seconds apart using {@link java.time.temporal.ChronoUnit#DAYS} as the unit, the iteration will cease
as soon as the current value of the iteration is earlier than the second Temporal argument. The closure will
not be called with any value earlier than the {@code to} value.
@param from the starting Temporal
@param to the ending Temporal
@param unit the TemporalUnit to increment by
@param closure the zero or one-argument closure to call
@throws GroovyRuntimeException if this value is earlier than {@code to}
@throws GroovyRuntimeException if {@code to} is a different type than this
@since 2.5.0 | [
"Iterates",
"from",
"this",
"to",
"the",
"{",
"@code",
"to",
"}",
"{",
"@link",
"java",
".",
"time",
".",
"temporal",
".",
"Temporal",
"}",
"inclusive",
"decrementing",
"by",
"one",
"{",
"@code",
"unit",
"}",
"each",
"iteration",
"calling",
"the",
"closu... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java#L223-L232 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java | RunsInner.getLogSasUrl | public RunGetLogResultInner getLogSasUrl(String resourceGroupName, String registryName, String runId) {
return getLogSasUrlWithServiceResponseAsync(resourceGroupName, registryName, runId).toBlocking().single().body();
} | java | public RunGetLogResultInner getLogSasUrl(String resourceGroupName, String registryName, String runId) {
return getLogSasUrlWithServiceResponseAsync(resourceGroupName, registryName, runId).toBlocking().single().body();
} | [
"public",
"RunGetLogResultInner",
"getLogSasUrl",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"runId",
")",
"{",
"return",
"getLogSasUrlWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
",",
"runId",
")",
"."... | Gets a link to download the run logs.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param runId The run ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RunGetLogResultInner object if successful. | [
"Gets",
"a",
"link",
"to",
"download",
"the",
"run",
"logs",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java#L788-L790 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/Envelope2D.java | Envelope2D.isIntersecting | public boolean isIntersecting(double xmin_, double ymin_, double xmax_, double ymax_) {
// No need to check if empty, this will work for empty geoms too (IEEE
// math)
return ((xmin <= xmin_) ? xmax >= xmin_ : xmax_ >= xmin) && // check
// that x
// projections
// overlap
((ymin <= ymin_) ? ymax >= ymin_ : ymax_ >= ymin); // check that
// y
// projections
// overlap
} | java | public boolean isIntersecting(double xmin_, double ymin_, double xmax_, double ymax_) {
// No need to check if empty, this will work for empty geoms too (IEEE
// math)
return ((xmin <= xmin_) ? xmax >= xmin_ : xmax_ >= xmin) && // check
// that x
// projections
// overlap
((ymin <= ymin_) ? ymax >= ymin_ : ymax_ >= ymin); // check that
// y
// projections
// overlap
} | [
"public",
"boolean",
"isIntersecting",
"(",
"double",
"xmin_",
",",
"double",
"ymin_",
",",
"double",
"xmax_",
",",
"double",
"ymax_",
")",
"{",
"// No need to check if empty, this will work for empty geoms too (IEEE",
"// math)",
"return",
"(",
"(",
"xmin",
"<=",
"xm... | Checks if this envelope intersects the other.
@param xmin_
@param ymin_
@param xmax_
@param ymax_
@return True if this envelope intersects the other. | [
"Checks",
"if",
"this",
"envelope",
"intersects",
"the",
"other",
"."
] | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Envelope2D.java#L303-L314 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.recoverDeletedCertificate | public CertificateBundle recoverDeletedCertificate(String vaultBaseUrl, String certificateName) {
return recoverDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName).toBlocking().single().body();
} | java | public CertificateBundle recoverDeletedCertificate(String vaultBaseUrl, String certificateName) {
return recoverDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName).toBlocking().single().body();
} | [
"public",
"CertificateBundle",
"recoverDeletedCertificate",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
")",
"{",
"return",
"recoverDeletedCertificateWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"certificateName",
")",
".",
"toBlocking",
"(",
")... | Recovers the deleted certificate back to its current version under /certificates.
The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The operation is applicable in vaults enabled for soft-delete, and must be issued during the retention interval (available in the deleted certificate's attributes). This operation requires the certificates/recover permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the deleted certificate
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the CertificateBundle object if successful. | [
"Recovers",
"the",
"deleted",
"certificate",
"back",
"to",
"its",
"current",
"version",
"under",
"/",
"certificates",
".",
"The",
"RecoverDeletedCertificate",
"operation",
"performs",
"the",
"reversal",
"of",
"the",
"Delete",
"operation",
".",
"The",
"operation",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L8709-L8711 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.encodeRun | private static final <T extends Appendable> void encodeRun(T buffer, int value, int length) {
if (length < 4) {
for (int j=0; j<length; ++j) {
if (value == ESCAPE) {
appendInt(buffer, value);
}
appendInt(buffer, value);
}
}
else {
if (length == ESCAPE) {
if (value == ESCAPE) {
appendInt(buffer, ESCAPE);
}
appendInt(buffer, value);
--length;
}
appendInt(buffer, ESCAPE);
appendInt(buffer, length);
appendInt(buffer, value); // Don't need to escape this value
}
} | java | private static final <T extends Appendable> void encodeRun(T buffer, int value, int length) {
if (length < 4) {
for (int j=0; j<length; ++j) {
if (value == ESCAPE) {
appendInt(buffer, value);
}
appendInt(buffer, value);
}
}
else {
if (length == ESCAPE) {
if (value == ESCAPE) {
appendInt(buffer, ESCAPE);
}
appendInt(buffer, value);
--length;
}
appendInt(buffer, ESCAPE);
appendInt(buffer, length);
appendInt(buffer, value); // Don't need to escape this value
}
} | [
"private",
"static",
"final",
"<",
"T",
"extends",
"Appendable",
">",
"void",
"encodeRun",
"(",
"T",
"buffer",
",",
"int",
"value",
",",
"int",
"length",
")",
"{",
"if",
"(",
"length",
"<",
"4",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j... | Encode a run, possibly a degenerate run (of < 4 values).
@param length The length of the run; must be > 0 && <= 0xFFFF. | [
"Encode",
"a",
"run",
"possibly",
"a",
"degenerate",
"run",
"(",
"of",
"<",
"4",
"values",
")",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L366-L387 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Graphics.java | Graphics.getArea | public void getArea(int x, int y, int width, int height, ByteBuffer target)
{
if (target.capacity() < width * height * 4)
{
throw new IllegalArgumentException("Byte buffer provided to get area is not big enough");
}
predraw();
GL.glReadPixels(x, screenHeight - y - height, width, height, SGL.GL_RGBA,
SGL.GL_UNSIGNED_BYTE, target);
postdraw();
} | java | public void getArea(int x, int y, int width, int height, ByteBuffer target)
{
if (target.capacity() < width * height * 4)
{
throw new IllegalArgumentException("Byte buffer provided to get area is not big enough");
}
predraw();
GL.glReadPixels(x, screenHeight - y - height, width, height, SGL.GL_RGBA,
SGL.GL_UNSIGNED_BYTE, target);
postdraw();
} | [
"public",
"void",
"getArea",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
",",
"ByteBuffer",
"target",
")",
"{",
"if",
"(",
"target",
".",
"capacity",
"(",
")",
"<",
"width",
"*",
"height",
"*",
"4",
")",
"{",
"thr... | Get an ara of pixels as RGBA values into a buffer
@param x The x position in the context to grab from
@param y The y position in the context to grab from
@param width The width of the area to grab from
@param height The hiehgt of the area to grab from
@param target The target buffer to grab into | [
"Get",
"an",
"ara",
"of",
"pixels",
"as",
"RGBA",
"values",
"into",
"a",
"buffer"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L1564-L1575 |
alipay/sofa-rpc | core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AllConnectConnectionHolder.java | AllConnectConnectionHolder.printSuccess | protected void printSuccess(String interfaceId, ProviderInfo providerInfo, ClientTransport transport) {
if (LOGGER.isInfoEnabled(consumerConfig.getAppName())) {
LOGGER.infoWithApp(consumerConfig.getAppName(), "Connect to {} provider:{} success ! The connection is "
+ NetUtils.connectToString(transport.remoteAddress(), transport.localAddress())
, interfaceId, providerInfo);
}
} | java | protected void printSuccess(String interfaceId, ProviderInfo providerInfo, ClientTransport transport) {
if (LOGGER.isInfoEnabled(consumerConfig.getAppName())) {
LOGGER.infoWithApp(consumerConfig.getAppName(), "Connect to {} provider:{} success ! The connection is "
+ NetUtils.connectToString(transport.remoteAddress(), transport.localAddress())
, interfaceId, providerInfo);
}
} | [
"protected",
"void",
"printSuccess",
"(",
"String",
"interfaceId",
",",
"ProviderInfo",
"providerInfo",
",",
"ClientTransport",
"transport",
")",
"{",
"if",
"(",
"LOGGER",
".",
"isInfoEnabled",
"(",
"consumerConfig",
".",
"getAppName",
"(",
")",
")",
")",
"{",
... | 打印连接成功日志
@param interfaceId 接口名称
@param providerInfo 服务端
@param transport 连接 | [
"打印连接成功日志"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AllConnectConnectionHolder.java#L696-L702 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/internal/CouchDbUtil.java | CouchDbUtil.setEntity | public static void setEntity(HttpConnection connnection, String body, String contentType) {
connnection.requestProperties.put("Content-type", contentType);
connnection.setRequestBody(body);
} | java | public static void setEntity(HttpConnection connnection, String body, String contentType) {
connnection.requestProperties.put("Content-type", contentType);
connnection.setRequestBody(body);
} | [
"public",
"static",
"void",
"setEntity",
"(",
"HttpConnection",
"connnection",
",",
"String",
"body",
",",
"String",
"contentType",
")",
"{",
"connnection",
".",
"requestProperties",
".",
"put",
"(",
"\"Content-type\"",
",",
"contentType",
")",
";",
"connnection",... | Sets a JSON String as a request entity.
@param connnection The request of {@link HttpConnection}
@param body The JSON String to set. | [
"Sets",
"a",
"JSON",
"String",
"as",
"a",
"request",
"entity",
"."
] | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/internal/CouchDbUtil.java#L195-L198 |
czyzby/gdx-lml | kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/asset/Disposables.java | Disposables.disposeOf | public static void disposeOf(final ObjectMap<?, ? extends Disposable> disposables) {
if (disposables != null) {
for (final Disposable disposable : disposables.values()) {
disposeOf(disposable);
}
}
} | java | public static void disposeOf(final ObjectMap<?, ? extends Disposable> disposables) {
if (disposables != null) {
for (final Disposable disposable : disposables.values()) {
disposeOf(disposable);
}
}
} | [
"public",
"static",
"void",
"disposeOf",
"(",
"final",
"ObjectMap",
"<",
"?",
",",
"?",
"extends",
"Disposable",
">",
"disposables",
")",
"{",
"if",
"(",
"disposables",
"!=",
"null",
")",
"{",
"for",
"(",
"final",
"Disposable",
"disposable",
":",
"disposab... | Performs null checks and disposes of assets.
@param disposables its values will be disposed of (if they exist). Can be null. | [
"Performs",
"null",
"checks",
"and",
"disposes",
"of",
"assets",
"."
] | train | https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/asset/Disposables.java#L51-L57 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java | FilesImpl.listFromTaskNext | public PagedList<NodeFile> listFromTaskNext(final String nextPageLink) {
ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders> response = listFromTaskNextSinglePageAsync(nextPageLink).toBlocking().single();
return new PagedList<NodeFile>(response.body()) {
@Override
public Page<NodeFile> nextPage(String nextPageLink) {
return listFromTaskNextSinglePageAsync(nextPageLink, null).toBlocking().single().body();
}
};
} | java | public PagedList<NodeFile> listFromTaskNext(final String nextPageLink) {
ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders> response = listFromTaskNextSinglePageAsync(nextPageLink).toBlocking().single();
return new PagedList<NodeFile>(response.body()) {
@Override
public Page<NodeFile> nextPage(String nextPageLink) {
return listFromTaskNextSinglePageAsync(nextPageLink, null).toBlocking().single().body();
}
};
} | [
"public",
"PagedList",
"<",
"NodeFile",
">",
"listFromTaskNext",
"(",
"final",
"String",
"nextPageLink",
")",
"{",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"NodeFile",
">",
",",
"FileListFromTaskHeaders",
">",
"response",
"=",
"listFromTaskNextSinglePageAsync",
... | Lists the files in a task's directory on its compute node.
@param nextPageLink The NextLink from the previous successful call to List operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PagedList<NodeFile> object if successful. | [
"Lists",
"the",
"files",
"in",
"a",
"task",
"s",
"directory",
"on",
"its",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L2230-L2238 |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/SqlClosure.java | SqlClosure.sqlExecute | public static <V> V sqlExecute(final SqlVarArgsFunction<V> functional, final Object... args)
{
return new SqlClosure<V>() {
@Override
public V execute(Connection connection, Object... params) throws SQLException
{
return functional.execute(connection, params);
}
}.executeWith(args);
} | java | public static <V> V sqlExecute(final SqlVarArgsFunction<V> functional, final Object... args)
{
return new SqlClosure<V>() {
@Override
public V execute(Connection connection, Object... params) throws SQLException
{
return functional.execute(connection, params);
}
}.executeWith(args);
} | [
"public",
"static",
"<",
"V",
">",
"V",
"sqlExecute",
"(",
"final",
"SqlVarArgsFunction",
"<",
"V",
">",
"functional",
",",
"final",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"SqlClosure",
"<",
"V",
">",
"(",
")",
"{",
"@",
"Override",
"publi... | Execute a lambda {@code SqlVarArgsFunction} closure.
@param functional the lambda function
@param args arguments to pass to the lamba function
@param <V> the result type
@return the result specified by the lambda
@since 2.5 | [
"Execute",
"a",
"lambda",
"{",
"@code",
"SqlVarArgsFunction",
"}",
"closure",
"."
] | train | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosure.java#L134-L143 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.