repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
listlengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
listlengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/JcrSession.java | JcrSession.getNonSystemNodeByIdentifier | public AbstractJcrNode getNonSystemNodeByIdentifier( String id ) throws ItemNotFoundException, RepositoryException {
"""
A variant of the standard {@link #getNodeByIdentifier(String)} method that does <i>not</i> find nodes within the system
area. This is often needed by the {@link JcrVersionManager} functionality.
@param id the string identifier
@return the node; never null
@throws ItemNotFoundException if a node cannot be found in the non-system content of the repository
@throws RepositoryException if there is another problem
@see #getNodeByIdentifier(String)
"""
checkLive();
if (NodeKey.isValidFormat(id)) {
// Try the identifier as a node key ...
try {
NodeKey key = new NodeKey(id);
return node(key, null);
} catch (ItemNotFoundException e) {
// continue ...
}
}
// Try as node key identifier ...
NodeKey key = this.rootNode.key.withId(id);
return node(key, null);
} | java | public AbstractJcrNode getNonSystemNodeByIdentifier( String id ) throws ItemNotFoundException, RepositoryException {
checkLive();
if (NodeKey.isValidFormat(id)) {
// Try the identifier as a node key ...
try {
NodeKey key = new NodeKey(id);
return node(key, null);
} catch (ItemNotFoundException e) {
// continue ...
}
}
// Try as node key identifier ...
NodeKey key = this.rootNode.key.withId(id);
return node(key, null);
} | [
"public",
"AbstractJcrNode",
"getNonSystemNodeByIdentifier",
"(",
"String",
"id",
")",
"throws",
"ItemNotFoundException",
",",
"RepositoryException",
"{",
"checkLive",
"(",
")",
";",
"if",
"(",
"NodeKey",
".",
"isValidFormat",
"(",
"id",
")",
")",
"{",
"// Try the identifier as a node key ...",
"try",
"{",
"NodeKey",
"key",
"=",
"new",
"NodeKey",
"(",
"id",
")",
";",
"return",
"node",
"(",
"key",
",",
"null",
")",
";",
"}",
"catch",
"(",
"ItemNotFoundException",
"e",
")",
"{",
"// continue ...",
"}",
"}",
"// Try as node key identifier ...",
"NodeKey",
"key",
"=",
"this",
".",
"rootNode",
".",
"key",
".",
"withId",
"(",
"id",
")",
";",
"return",
"node",
"(",
"key",
",",
"null",
")",
";",
"}"
]
| A variant of the standard {@link #getNodeByIdentifier(String)} method that does <i>not</i> find nodes within the system
area. This is often needed by the {@link JcrVersionManager} functionality.
@param id the string identifier
@return the node; never null
@throws ItemNotFoundException if a node cannot be found in the non-system content of the repository
@throws RepositoryException if there is another problem
@see #getNodeByIdentifier(String) | [
"A",
"variant",
"of",
"the",
"standard",
"{",
"@link",
"#getNodeByIdentifier",
"(",
"String",
")",
"}",
"method",
"that",
"does",
"<i",
">",
"not<",
"/",
"i",
">",
"find",
"nodes",
"within",
"the",
"system",
"area",
".",
"This",
"is",
"often",
"needed",
"by",
"the",
"{",
"@link",
"JcrVersionManager",
"}",
"functionality",
"."
]
| train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/JcrSession.java#L842-L856 |
apache/groovy | src/main/java/org/codehaus/groovy/ast/tools/ParameterUtils.java | ParameterUtils.parametersCompatible | public static boolean parametersCompatible(Parameter[] source, Parameter[] target) {
"""
check whether parameters type are compatible
each parameter should match the following condition:
{@code targetParameter.getType().getTypeClass().isAssignableFrom(sourceParameter.getType().getTypeClass())}
@param source source parameters
@param target target parameters
@return the check result
@since 3.0.0
"""
return parametersMatch(source, target,
t -> ClassHelper.getWrapper(t.getV2()).getTypeClass()
.isAssignableFrom(ClassHelper.getWrapper(t.getV1()).getTypeClass())
);
} | java | public static boolean parametersCompatible(Parameter[] source, Parameter[] target) {
return parametersMatch(source, target,
t -> ClassHelper.getWrapper(t.getV2()).getTypeClass()
.isAssignableFrom(ClassHelper.getWrapper(t.getV1()).getTypeClass())
);
} | [
"public",
"static",
"boolean",
"parametersCompatible",
"(",
"Parameter",
"[",
"]",
"source",
",",
"Parameter",
"[",
"]",
"target",
")",
"{",
"return",
"parametersMatch",
"(",
"source",
",",
"target",
",",
"t",
"->",
"ClassHelper",
".",
"getWrapper",
"(",
"t",
".",
"getV2",
"(",
")",
")",
".",
"getTypeClass",
"(",
")",
".",
"isAssignableFrom",
"(",
"ClassHelper",
".",
"getWrapper",
"(",
"t",
".",
"getV1",
"(",
")",
")",
".",
"getTypeClass",
"(",
")",
")",
")",
";",
"}"
]
| check whether parameters type are compatible
each parameter should match the following condition:
{@code targetParameter.getType().getTypeClass().isAssignableFrom(sourceParameter.getType().getTypeClass())}
@param source source parameters
@param target target parameters
@return the check result
@since 3.0.0 | [
"check",
"whether",
"parameters",
"type",
"are",
"compatible"
]
| train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/ast/tools/ParameterUtils.java#L51-L56 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java | SlotPoolImpl.failAllocation | @Override
public Optional<ResourceID> failAllocation(final AllocationID allocationID, final Exception cause) {
"""
Fail the specified allocation and release the corresponding slot if we have one.
This may triggered by JobManager when some slot allocation failed with rpcTimeout.
Or this could be triggered by TaskManager, when it finds out something went wrong with the slot,
and decided to take it back.
@param allocationID Represents the allocation which should be failed
@param cause The cause of the failure
@return Optional task executor if it has no more slots registered
"""
componentMainThreadExecutor.assertRunningInMainThread();
final PendingRequest pendingRequest = pendingRequests.removeKeyB(allocationID);
if (pendingRequest != null) {
// request was still pending
failPendingRequest(pendingRequest, cause);
return Optional.empty();
}
else {
return tryFailingAllocatedSlot(allocationID, cause);
}
// TODO: add some unit tests when the previous two are ready, the allocation may failed at any phase
} | java | @Override
public Optional<ResourceID> failAllocation(final AllocationID allocationID, final Exception cause) {
componentMainThreadExecutor.assertRunningInMainThread();
final PendingRequest pendingRequest = pendingRequests.removeKeyB(allocationID);
if (pendingRequest != null) {
// request was still pending
failPendingRequest(pendingRequest, cause);
return Optional.empty();
}
else {
return tryFailingAllocatedSlot(allocationID, cause);
}
// TODO: add some unit tests when the previous two are ready, the allocation may failed at any phase
} | [
"@",
"Override",
"public",
"Optional",
"<",
"ResourceID",
">",
"failAllocation",
"(",
"final",
"AllocationID",
"allocationID",
",",
"final",
"Exception",
"cause",
")",
"{",
"componentMainThreadExecutor",
".",
"assertRunningInMainThread",
"(",
")",
";",
"final",
"PendingRequest",
"pendingRequest",
"=",
"pendingRequests",
".",
"removeKeyB",
"(",
"allocationID",
")",
";",
"if",
"(",
"pendingRequest",
"!=",
"null",
")",
"{",
"// request was still pending",
"failPendingRequest",
"(",
"pendingRequest",
",",
"cause",
")",
";",
"return",
"Optional",
".",
"empty",
"(",
")",
";",
"}",
"else",
"{",
"return",
"tryFailingAllocatedSlot",
"(",
"allocationID",
",",
"cause",
")",
";",
"}",
"// TODO: add some unit tests when the previous two are ready, the allocation may failed at any phase",
"}"
]
| Fail the specified allocation and release the corresponding slot if we have one.
This may triggered by JobManager when some slot allocation failed with rpcTimeout.
Or this could be triggered by TaskManager, when it finds out something went wrong with the slot,
and decided to take it back.
@param allocationID Represents the allocation which should be failed
@param cause The cause of the failure
@return Optional task executor if it has no more slots registered | [
"Fail",
"the",
"specified",
"allocation",
"and",
"release",
"the",
"corresponding",
"slot",
"if",
"we",
"have",
"one",
".",
"This",
"may",
"triggered",
"by",
"JobManager",
"when",
"some",
"slot",
"allocation",
"failed",
"with",
"rpcTimeout",
".",
"Or",
"this",
"could",
"be",
"triggered",
"by",
"TaskManager",
"when",
"it",
"finds",
"out",
"something",
"went",
"wrong",
"with",
"the",
"slot",
"and",
"decided",
"to",
"take",
"it",
"back",
"."
]
| train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java#L635-L651 |
berkesa/datatree | src/main/java/io/datatree/Tree.java | Tree.putSet | public Tree putSet(String path, boolean putIfAbsent) {
"""
Associates the specified Set container with the specified path. If the
structure previously contained a mapping for the path, the old value is
replaced. Set similar to List, but contains no duplicate elements. Sample
code:<br>
<br>
Tree node = new Tree();<br>
<br>
Tree set1 = node.putSet("a.b.c");<br>
set1.add(1).add(2).add(3);<br>
<br>
Tree set2 = node.putSet("a.b.c", true);<br>
set2.add(4).add(5).add(6);<br>
<br>
The "set2" contains 1, 2, 3, 4, 5 and 6.
@param path
path with which the specified Set is to be associated
@param putIfAbsent
if true and the specified key is not already associated with a
value associates it with the given value and returns the new
Set, else returns the previous Set
@return Tree of the new Set
"""
return putObjectInternal(path, new LinkedHashSet<Object>(), putIfAbsent);
} | java | public Tree putSet(String path, boolean putIfAbsent) {
return putObjectInternal(path, new LinkedHashSet<Object>(), putIfAbsent);
} | [
"public",
"Tree",
"putSet",
"(",
"String",
"path",
",",
"boolean",
"putIfAbsent",
")",
"{",
"return",
"putObjectInternal",
"(",
"path",
",",
"new",
"LinkedHashSet",
"<",
"Object",
">",
"(",
")",
",",
"putIfAbsent",
")",
";",
"}"
]
| Associates the specified Set container with the specified path. If the
structure previously contained a mapping for the path, the old value is
replaced. Set similar to List, but contains no duplicate elements. Sample
code:<br>
<br>
Tree node = new Tree();<br>
<br>
Tree set1 = node.putSet("a.b.c");<br>
set1.add(1).add(2).add(3);<br>
<br>
Tree set2 = node.putSet("a.b.c", true);<br>
set2.add(4).add(5).add(6);<br>
<br>
The "set2" contains 1, 2, 3, 4, 5 and 6.
@param path
path with which the specified Set is to be associated
@param putIfAbsent
if true and the specified key is not already associated with a
value associates it with the given value and returns the new
Set, else returns the previous Set
@return Tree of the new Set | [
"Associates",
"the",
"specified",
"Set",
"container",
"with",
"the",
"specified",
"path",
".",
"If",
"the",
"structure",
"previously",
"contained",
"a",
"mapping",
"for",
"the",
"path",
"the",
"old",
"value",
"is",
"replaced",
".",
"Set",
"similar",
"to",
"List",
"but",
"contains",
"no",
"duplicate",
"elements",
".",
"Sample",
"code",
":",
"<br",
">",
"<br",
">",
"Tree",
"node",
"=",
"new",
"Tree",
"()",
";",
"<br",
">",
"<br",
">",
"Tree",
"set1",
"=",
"node",
".",
"putSet",
"(",
"a",
".",
"b",
".",
"c",
")",
";",
"<br",
">",
"set1",
".",
"add",
"(",
"1",
")",
".",
"add",
"(",
"2",
")",
".",
"add",
"(",
"3",
")",
";",
"<br",
">",
"<br",
">",
"Tree",
"set2",
"=",
"node",
".",
"putSet",
"(",
"a",
".",
"b",
".",
"c",
"true",
")",
";",
"<br",
">",
"set2",
".",
"add",
"(",
"4",
")",
".",
"add",
"(",
"5",
")",
".",
"add",
"(",
"6",
")",
";",
"<br",
">",
"<br",
">",
"The",
"set2",
"contains",
"1",
"2",
"3",
"4",
"5",
"and",
"6",
"."
]
| train | https://github.com/berkesa/datatree/blob/79aea9b45c7b46ab28af0a09310bc01c421c6b3a/src/main/java/io/datatree/Tree.java#L2126-L2128 |
prestodb/presto | presto-orc/src/main/java/com/facebook/presto/orc/writer/DictionaryBuilder.java | DictionaryBuilder.getHashPositionOfElement | private long getHashPositionOfElement(Block block, int position) {
"""
Get slot position of element at {@code position} of {@code block}
"""
checkArgument(!block.isNull(position), "position is null");
int length = block.getSliceLength(position);
long hashPosition = getMaskedHash(block.hash(position, 0, length));
while (true) {
int blockPosition = blockPositionByHash.get(hashPosition);
if (blockPosition == EMPTY_SLOT) {
// Doesn't have this element
return hashPosition;
}
else if (elementBlock.getSliceLength(blockPosition) == length && block.equals(position, 0, elementBlock, blockPosition, 0, length)) {
// Already has this element
return hashPosition;
}
hashPosition = getMaskedHash(hashPosition + 1);
}
} | java | private long getHashPositionOfElement(Block block, int position)
{
checkArgument(!block.isNull(position), "position is null");
int length = block.getSliceLength(position);
long hashPosition = getMaskedHash(block.hash(position, 0, length));
while (true) {
int blockPosition = blockPositionByHash.get(hashPosition);
if (blockPosition == EMPTY_SLOT) {
// Doesn't have this element
return hashPosition;
}
else if (elementBlock.getSliceLength(blockPosition) == length && block.equals(position, 0, elementBlock, blockPosition, 0, length)) {
// Already has this element
return hashPosition;
}
hashPosition = getMaskedHash(hashPosition + 1);
}
} | [
"private",
"long",
"getHashPositionOfElement",
"(",
"Block",
"block",
",",
"int",
"position",
")",
"{",
"checkArgument",
"(",
"!",
"block",
".",
"isNull",
"(",
"position",
")",
",",
"\"position is null\"",
")",
";",
"int",
"length",
"=",
"block",
".",
"getSliceLength",
"(",
"position",
")",
";",
"long",
"hashPosition",
"=",
"getMaskedHash",
"(",
"block",
".",
"hash",
"(",
"position",
",",
"0",
",",
"length",
")",
")",
";",
"while",
"(",
"true",
")",
"{",
"int",
"blockPosition",
"=",
"blockPositionByHash",
".",
"get",
"(",
"hashPosition",
")",
";",
"if",
"(",
"blockPosition",
"==",
"EMPTY_SLOT",
")",
"{",
"// Doesn't have this element",
"return",
"hashPosition",
";",
"}",
"else",
"if",
"(",
"elementBlock",
".",
"getSliceLength",
"(",
"blockPosition",
")",
"==",
"length",
"&&",
"block",
".",
"equals",
"(",
"position",
",",
"0",
",",
"elementBlock",
",",
"blockPosition",
",",
"0",
",",
"length",
")",
")",
"{",
"// Already has this element",
"return",
"hashPosition",
";",
"}",
"hashPosition",
"=",
"getMaskedHash",
"(",
"hashPosition",
"+",
"1",
")",
";",
"}",
"}"
]
| Get slot position of element at {@code position} of {@code block} | [
"Get",
"slot",
"position",
"of",
"element",
"at",
"{"
]
| train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/writer/DictionaryBuilder.java#L140-L158 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/OrdersInner.java | OrdersInner.createOrUpdateAsync | public Observable<OrderInner> createOrUpdateAsync(String deviceName, String resourceGroupName, OrderInner order) {
"""
Creates or updates an order.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@param order The order to be created or updated.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return createOrUpdateWithServiceResponseAsync(deviceName, resourceGroupName, order).map(new Func1<ServiceResponse<OrderInner>, OrderInner>() {
@Override
public OrderInner call(ServiceResponse<OrderInner> response) {
return response.body();
}
});
} | java | public Observable<OrderInner> createOrUpdateAsync(String deviceName, String resourceGroupName, OrderInner order) {
return createOrUpdateWithServiceResponseAsync(deviceName, resourceGroupName, order).map(new Func1<ServiceResponse<OrderInner>, OrderInner>() {
@Override
public OrderInner call(ServiceResponse<OrderInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OrderInner",
">",
"createOrUpdateAsync",
"(",
"String",
"deviceName",
",",
"String",
"resourceGroupName",
",",
"OrderInner",
"order",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"deviceName",
",",
"resourceGroupName",
",",
"order",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"OrderInner",
">",
",",
"OrderInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"OrderInner",
"call",
"(",
"ServiceResponse",
"<",
"OrderInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Creates or updates an order.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@param order The order to be created or updated.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"an",
"order",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/OrdersInner.java#L342-L349 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.setIntHeader | @Deprecated
public static void setIntHeader(HttpMessage message, String name, Iterable<Integer> values) {
"""
@deprecated Use {@link #set(CharSequence, Iterable)} instead.
@see #setIntHeader(HttpMessage, CharSequence, Iterable)
"""
message.headers().set(name, values);
} | java | @Deprecated
public static void setIntHeader(HttpMessage message, String name, Iterable<Integer> values) {
message.headers().set(name, values);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"setIntHeader",
"(",
"HttpMessage",
"message",
",",
"String",
"name",
",",
"Iterable",
"<",
"Integer",
">",
"values",
")",
"{",
"message",
".",
"headers",
"(",
")",
".",
"set",
"(",
"name",
",",
"values",
")",
";",
"}"
]
| @deprecated Use {@link #set(CharSequence, Iterable)} instead.
@see #setIntHeader(HttpMessage, CharSequence, Iterable) | [
"@deprecated",
"Use",
"{",
"@link",
"#set",
"(",
"CharSequence",
"Iterable",
")",
"}",
"instead",
"."
]
| train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L785-L788 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/builder/ExpressionBuilder.java | ExpressionBuilder.lessThanOrEquals | public ExpressionBuilder lessThanOrEquals(final SubordinateTrigger trigger, final Object compare) {
"""
Appends a less than or equals test to the condition.
@param trigger the trigger field.
@param compare the value to use in the compare.
@return this ExpressionBuilder.
"""
BooleanExpression exp = new CompareExpression(CompareType.LESS_THAN_OR_EQUAL, trigger,
compare);
appendExpression(exp);
return this;
} | java | public ExpressionBuilder lessThanOrEquals(final SubordinateTrigger trigger, final Object compare) {
BooleanExpression exp = new CompareExpression(CompareType.LESS_THAN_OR_EQUAL, trigger,
compare);
appendExpression(exp);
return this;
} | [
"public",
"ExpressionBuilder",
"lessThanOrEquals",
"(",
"final",
"SubordinateTrigger",
"trigger",
",",
"final",
"Object",
"compare",
")",
"{",
"BooleanExpression",
"exp",
"=",
"new",
"CompareExpression",
"(",
"CompareType",
".",
"LESS_THAN_OR_EQUAL",
",",
"trigger",
",",
"compare",
")",
";",
"appendExpression",
"(",
"exp",
")",
";",
"return",
"this",
";",
"}"
]
| Appends a less than or equals test to the condition.
@param trigger the trigger field.
@param compare the value to use in the compare.
@return this ExpressionBuilder. | [
"Appends",
"a",
"less",
"than",
"or",
"equals",
"test",
"to",
"the",
"condition",
"."
]
| train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/builder/ExpressionBuilder.java#L105-L111 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/db/SystemKeyspace.java | SystemKeyspace.clearSSTableReadMeter | public static void clearSSTableReadMeter(String keyspace, String table, int generation) {
"""
Clears persisted read rates from system.sstable_activity for SSTables that have been deleted.
"""
String cql = "DELETE FROM system.%s WHERE keyspace_name=? AND columnfamily_name=? and generation=?";
executeInternal(String.format(cql, SSTABLE_ACTIVITY_CF), keyspace, table, generation);
} | java | public static void clearSSTableReadMeter(String keyspace, String table, int generation)
{
String cql = "DELETE FROM system.%s WHERE keyspace_name=? AND columnfamily_name=? and generation=?";
executeInternal(String.format(cql, SSTABLE_ACTIVITY_CF), keyspace, table, generation);
} | [
"public",
"static",
"void",
"clearSSTableReadMeter",
"(",
"String",
"keyspace",
",",
"String",
"table",
",",
"int",
"generation",
")",
"{",
"String",
"cql",
"=",
"\"DELETE FROM system.%s WHERE keyspace_name=? AND columnfamily_name=? and generation=?\"",
";",
"executeInternal",
"(",
"String",
".",
"format",
"(",
"cql",
",",
"SSTABLE_ACTIVITY_CF",
")",
",",
"keyspace",
",",
"table",
",",
"generation",
")",
";",
"}"
]
| Clears persisted read rates from system.sstable_activity for SSTables that have been deleted. | [
"Clears",
"persisted",
"read",
"rates",
"from",
"system",
".",
"sstable_activity",
"for",
"SSTables",
"that",
"have",
"been",
"deleted",
"."
]
| train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/SystemKeyspace.java#L941-L945 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java | Types.makeExtendsWildcard | private WildcardType makeExtendsWildcard(Type bound, TypeVar formal) {
"""
Create a wildcard with the given upper (extends) bound; create
an unbounded wildcard if bound is Object.
@param bound the upper bound
@param formal the formal type parameter that will be
substituted by the wildcard
"""
if (bound == syms.objectType) {
return new WildcardType(syms.objectType,
BoundKind.UNBOUND,
syms.boundClass,
formal);
} else {
return new WildcardType(bound,
BoundKind.EXTENDS,
syms.boundClass,
formal);
}
} | java | private WildcardType makeExtendsWildcard(Type bound, TypeVar formal) {
if (bound == syms.objectType) {
return new WildcardType(syms.objectType,
BoundKind.UNBOUND,
syms.boundClass,
formal);
} else {
return new WildcardType(bound,
BoundKind.EXTENDS,
syms.boundClass,
formal);
}
} | [
"private",
"WildcardType",
"makeExtendsWildcard",
"(",
"Type",
"bound",
",",
"TypeVar",
"formal",
")",
"{",
"if",
"(",
"bound",
"==",
"syms",
".",
"objectType",
")",
"{",
"return",
"new",
"WildcardType",
"(",
"syms",
".",
"objectType",
",",
"BoundKind",
".",
"UNBOUND",
",",
"syms",
".",
"boundClass",
",",
"formal",
")",
";",
"}",
"else",
"{",
"return",
"new",
"WildcardType",
"(",
"bound",
",",
"BoundKind",
".",
"EXTENDS",
",",
"syms",
".",
"boundClass",
",",
"formal",
")",
";",
"}",
"}"
]
| Create a wildcard with the given upper (extends) bound; create
an unbounded wildcard if bound is Object.
@param bound the upper bound
@param formal the formal type parameter that will be
substituted by the wildcard | [
"Create",
"a",
"wildcard",
"with",
"the",
"given",
"upper",
"(",
"extends",
")",
"bound",
";",
"create",
"an",
"unbounded",
"wildcard",
"if",
"bound",
"is",
"Object",
"."
]
| train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L4536-L4548 |
ButterFaces/ButterFaces | components/src/main/java/org/butterfaces/component/partrenderer/ReadonlyPartRenderer.java | ReadonlyPartRenderer.getReadonlyDisplayValue | private String getReadonlyDisplayValue(final Object value, final UIInput component, final Converter converter) {
"""
Should return value string for the readonly view mode. Can be overridden
for custom components.
"""
if (value == null || "".equals(value)) {
return "-";
} else if (converter != null) {
final String asString = converter.getAsString(FacesContext.getCurrentInstance(), component, value);
return asString == null ? "-" : asString;
}
return String.valueOf(value);
} | java | private String getReadonlyDisplayValue(final Object value, final UIInput component, final Converter converter) {
if (value == null || "".equals(value)) {
return "-";
} else if (converter != null) {
final String asString = converter.getAsString(FacesContext.getCurrentInstance(), component, value);
return asString == null ? "-" : asString;
}
return String.valueOf(value);
} | [
"private",
"String",
"getReadonlyDisplayValue",
"(",
"final",
"Object",
"value",
",",
"final",
"UIInput",
"component",
",",
"final",
"Converter",
"converter",
")",
"{",
"if",
"(",
"value",
"==",
"null",
"||",
"\"\"",
".",
"equals",
"(",
"value",
")",
")",
"{",
"return",
"\"-\"",
";",
"}",
"else",
"if",
"(",
"converter",
"!=",
"null",
")",
"{",
"final",
"String",
"asString",
"=",
"converter",
".",
"getAsString",
"(",
"FacesContext",
".",
"getCurrentInstance",
"(",
")",
",",
"component",
",",
"value",
")",
";",
"return",
"asString",
"==",
"null",
"?",
"\"-\"",
":",
"asString",
";",
"}",
"return",
"String",
".",
"valueOf",
"(",
"value",
")",
";",
"}"
]
| Should return value string for the readonly view mode. Can be overridden
for custom components. | [
"Should",
"return",
"value",
"string",
"for",
"the",
"readonly",
"view",
"mode",
".",
"Can",
"be",
"overridden",
"for",
"custom",
"components",
"."
]
| train | https://github.com/ButterFaces/ButterFaces/blob/e8c2bb340c89dcdbac409fcfc7a2a0e07f2462fc/components/src/main/java/org/butterfaces/component/partrenderer/ReadonlyPartRenderer.java#L54-L63 |
esigate/esigate | esigate-core/src/main/java/org/esigate/http/HttpResponseUtils.java | HttpResponseUtils.getFirstHeader | public static String getFirstHeader(String headerName, HttpResponse httpResponse) {
"""
Get the value of the first header matching "headerName".
@param headerName
@param httpResponse
@return value of the first header or null if it doesn't exist.
"""
Header header = httpResponse.getFirstHeader(headerName);
if (header != null) {
return header.getValue();
}
return null;
} | java | public static String getFirstHeader(String headerName, HttpResponse httpResponse) {
Header header = httpResponse.getFirstHeader(headerName);
if (header != null) {
return header.getValue();
}
return null;
} | [
"public",
"static",
"String",
"getFirstHeader",
"(",
"String",
"headerName",
",",
"HttpResponse",
"httpResponse",
")",
"{",
"Header",
"header",
"=",
"httpResponse",
".",
"getFirstHeader",
"(",
"headerName",
")",
";",
"if",
"(",
"header",
"!=",
"null",
")",
"{",
"return",
"header",
".",
"getValue",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
]
| Get the value of the first header matching "headerName".
@param headerName
@param httpResponse
@return value of the first header or null if it doesn't exist. | [
"Get",
"the",
"value",
"of",
"the",
"first",
"header",
"matching",
"headerName",
"."
]
| train | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/HttpResponseUtils.java#L82-L88 |
google/closure-compiler | src/com/google/javascript/jscomp/JsMessageVisitor.java | JsMessageVisitor.maybeInitMetaDataFromJsDocOrHelpVar | private void maybeInitMetaDataFromJsDocOrHelpVar(
Builder builder, Node varNode, @Nullable Node parentOfVarNode)
throws MalformedException {
"""
Initializes the meta data in a JsMessage by examining the nodes just before
and after a message VAR node.
@param builder the message builder whose meta data will be initialized
@param varNode the message VAR node
@param parentOfVarNode {@code varNode}'s parent node
"""
// First check description in @desc
if (maybeInitMetaDataFromJsDoc(builder, varNode)) {
return;
}
// Check the preceding node for meta data
if ((parentOfVarNode != null)
&& maybeInitMetaDataFromHelpVar(builder, varNode.getPrevious())) {
return;
}
// Check the subsequent node for meta data
maybeInitMetaDataFromHelpVar(builder, varNode.getNext());
} | java | private void maybeInitMetaDataFromJsDocOrHelpVar(
Builder builder, Node varNode, @Nullable Node parentOfVarNode)
throws MalformedException {
// First check description in @desc
if (maybeInitMetaDataFromJsDoc(builder, varNode)) {
return;
}
// Check the preceding node for meta data
if ((parentOfVarNode != null)
&& maybeInitMetaDataFromHelpVar(builder, varNode.getPrevious())) {
return;
}
// Check the subsequent node for meta data
maybeInitMetaDataFromHelpVar(builder, varNode.getNext());
} | [
"private",
"void",
"maybeInitMetaDataFromJsDocOrHelpVar",
"(",
"Builder",
"builder",
",",
"Node",
"varNode",
",",
"@",
"Nullable",
"Node",
"parentOfVarNode",
")",
"throws",
"MalformedException",
"{",
"// First check description in @desc",
"if",
"(",
"maybeInitMetaDataFromJsDoc",
"(",
"builder",
",",
"varNode",
")",
")",
"{",
"return",
";",
"}",
"// Check the preceding node for meta data",
"if",
"(",
"(",
"parentOfVarNode",
"!=",
"null",
")",
"&&",
"maybeInitMetaDataFromHelpVar",
"(",
"builder",
",",
"varNode",
".",
"getPrevious",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"// Check the subsequent node for meta data",
"maybeInitMetaDataFromHelpVar",
"(",
"builder",
",",
"varNode",
".",
"getNext",
"(",
")",
")",
";",
"}"
]
| Initializes the meta data in a JsMessage by examining the nodes just before
and after a message VAR node.
@param builder the message builder whose meta data will be initialized
@param varNode the message VAR node
@param parentOfVarNode {@code varNode}'s parent node | [
"Initializes",
"the",
"meta",
"data",
"in",
"a",
"JsMessage",
"by",
"examining",
"the",
"nodes",
"just",
"before",
"and",
"after",
"a",
"message",
"VAR",
"node",
"."
]
| train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JsMessageVisitor.java#L494-L511 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/task/RegularPactTask.java | RegularPactTask.constructLogString | public static String constructLogString(String message, String taskName, AbstractInvokable parent) {
"""
Utility function that composes a string for logging purposes. The string includes the given message,
the given name of the task and the index in its subtask group as well as the number of instances
that exist in its subtask group.
@param message The main message for the log.
@param taskName The name of the task.
@param parent The nephele task that contains the code producing the message.
@return The string for logging.
"""
return message + ": " + taskName + " (" + (parent.getEnvironment().getIndexInSubtaskGroup() + 1) +
'/' + parent.getEnvironment().getCurrentNumberOfSubtasks() + ')';
} | java | public static String constructLogString(String message, String taskName, AbstractInvokable parent) {
return message + ": " + taskName + " (" + (parent.getEnvironment().getIndexInSubtaskGroup() + 1) +
'/' + parent.getEnvironment().getCurrentNumberOfSubtasks() + ')';
} | [
"public",
"static",
"String",
"constructLogString",
"(",
"String",
"message",
",",
"String",
"taskName",
",",
"AbstractInvokable",
"parent",
")",
"{",
"return",
"message",
"+",
"\": \"",
"+",
"taskName",
"+",
"\" (\"",
"+",
"(",
"parent",
".",
"getEnvironment",
"(",
")",
".",
"getIndexInSubtaskGroup",
"(",
")",
"+",
"1",
")",
"+",
"'",
"'",
"+",
"parent",
".",
"getEnvironment",
"(",
")",
".",
"getCurrentNumberOfSubtasks",
"(",
")",
"+",
"'",
"'",
";",
"}"
]
| Utility function that composes a string for logging purposes. The string includes the given message,
the given name of the task and the index in its subtask group as well as the number of instances
that exist in its subtask group.
@param message The main message for the log.
@param taskName The name of the task.
@param parent The nephele task that contains the code producing the message.
@return The string for logging. | [
"Utility",
"function",
"that",
"composes",
"a",
"string",
"for",
"logging",
"purposes",
".",
"The",
"string",
"includes",
"the",
"given",
"message",
"the",
"given",
"name",
"of",
"the",
"task",
"and",
"the",
"index",
"in",
"its",
"subtask",
"group",
"as",
"well",
"as",
"the",
"number",
"of",
"instances",
"that",
"exist",
"in",
"its",
"subtask",
"group",
"."
]
| train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/task/RegularPactTask.java#L1179-L1182 |
marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.prepareUpdate | @Override
public MarkLogicUpdateQuery prepareUpdate(String queryString,String baseURI) throws RepositoryException, MalformedQueryException {
"""
overload for prepareUpdate
@param queryString
@param baseURI
@return MarkLogicUpdateQuery
@throws RepositoryException
@throws MalformedQueryException
"""
return prepareUpdate(QueryLanguage.SPARQL, queryString, baseURI);
} | java | @Override
public MarkLogicUpdateQuery prepareUpdate(String queryString,String baseURI) throws RepositoryException, MalformedQueryException {
return prepareUpdate(QueryLanguage.SPARQL, queryString, baseURI);
} | [
"@",
"Override",
"public",
"MarkLogicUpdateQuery",
"prepareUpdate",
"(",
"String",
"queryString",
",",
"String",
"baseURI",
")",
"throws",
"RepositoryException",
",",
"MalformedQueryException",
"{",
"return",
"prepareUpdate",
"(",
"QueryLanguage",
".",
"SPARQL",
",",
"queryString",
",",
"baseURI",
")",
";",
"}"
]
| overload for prepareUpdate
@param queryString
@param baseURI
@return MarkLogicUpdateQuery
@throws RepositoryException
@throws MalformedQueryException | [
"overload",
"for",
"prepareUpdate"
]
| train | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L416-L419 |
overturetool/overture | core/interpreter/src/main/java/org/overture/interpreter/utilities/type/AllValuesCollector.java | AllValuesCollector.generateNumbers | protected ValueList generateNumbers(int min, int max, Context ctxt)
throws ValueException {
"""
Generator method for numeric type bindings.
@param min
the minimum number
@param max
the maximum number
@param ctxt
current context
@return the newly generated list of values between min and max, including.
@throws ValueException
"""
ValueList list = new ValueList();
for (int i = min; i < max + 1; i++)
{
list.add(NumericValue.valueOf(i, ctxt));
}
return list;
} | java | protected ValueList generateNumbers(int min, int max, Context ctxt)
throws ValueException
{
ValueList list = new ValueList();
for (int i = min; i < max + 1; i++)
{
list.add(NumericValue.valueOf(i, ctxt));
}
return list;
} | [
"protected",
"ValueList",
"generateNumbers",
"(",
"int",
"min",
",",
"int",
"max",
",",
"Context",
"ctxt",
")",
"throws",
"ValueException",
"{",
"ValueList",
"list",
"=",
"new",
"ValueList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"min",
";",
"i",
"<",
"max",
"+",
"1",
";",
"i",
"++",
")",
"{",
"list",
".",
"add",
"(",
"NumericValue",
".",
"valueOf",
"(",
"i",
",",
"ctxt",
")",
")",
";",
"}",
"return",
"list",
";",
"}"
]
| Generator method for numeric type bindings.
@param min
the minimum number
@param max
the maximum number
@param ctxt
current context
@return the newly generated list of values between min and max, including.
@throws ValueException | [
"Generator",
"method",
"for",
"numeric",
"type",
"bindings",
"."
]
| train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/utilities/type/AllValuesCollector.java#L118-L128 |
duracloud/duracloud | chunk/src/main/java/org/duracloud/chunk/FileChunker.java | FileChunker.addContentFrom | protected void addContentFrom(File baseDir, String destSpaceId) {
"""
This method loops the arg baseDir and pushes the found content to the
arg destSpace.
@param baseDir of content to push to DataStore
@param destSpaceId of content destination
"""
Collection<File> files = listFiles(baseDir,
options.getFileFilter(),
options.getDirFilter());
for (File file : files) {
try {
doAddContent(baseDir, destSpaceId, file);
} catch (Exception e) {
StringBuilder sb = new StringBuilder("Error: ");
sb.append("Unable to addContentFrom [");
sb.append(baseDir);
sb.append(", ");
sb.append(destSpaceId);
sb.append("] : ");
sb.append(e.getMessage());
sb.append("\n");
sb.append(ExceptionUtil.getStackTraceAsString(e));
log.error(sb.toString());
}
}
} | java | protected void addContentFrom(File baseDir, String destSpaceId) {
Collection<File> files = listFiles(baseDir,
options.getFileFilter(),
options.getDirFilter());
for (File file : files) {
try {
doAddContent(baseDir, destSpaceId, file);
} catch (Exception e) {
StringBuilder sb = new StringBuilder("Error: ");
sb.append("Unable to addContentFrom [");
sb.append(baseDir);
sb.append(", ");
sb.append(destSpaceId);
sb.append("] : ");
sb.append(e.getMessage());
sb.append("\n");
sb.append(ExceptionUtil.getStackTraceAsString(e));
log.error(sb.toString());
}
}
} | [
"protected",
"void",
"addContentFrom",
"(",
"File",
"baseDir",
",",
"String",
"destSpaceId",
")",
"{",
"Collection",
"<",
"File",
">",
"files",
"=",
"listFiles",
"(",
"baseDir",
",",
"options",
".",
"getFileFilter",
"(",
")",
",",
"options",
".",
"getDirFilter",
"(",
")",
")",
";",
"for",
"(",
"File",
"file",
":",
"files",
")",
"{",
"try",
"{",
"doAddContent",
"(",
"baseDir",
",",
"destSpaceId",
",",
"file",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"\"Error: \"",
")",
";",
"sb",
".",
"append",
"(",
"\"Unable to addContentFrom [\"",
")",
";",
"sb",
".",
"append",
"(",
"baseDir",
")",
";",
"sb",
".",
"append",
"(",
"\", \"",
")",
";",
"sb",
".",
"append",
"(",
"destSpaceId",
")",
";",
"sb",
".",
"append",
"(",
"\"] : \"",
")",
";",
"sb",
".",
"append",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"sb",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"sb",
".",
"append",
"(",
"ExceptionUtil",
".",
"getStackTraceAsString",
"(",
"e",
")",
")",
";",
"log",
".",
"error",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}"
]
| This method loops the arg baseDir and pushes the found content to the
arg destSpace.
@param baseDir of content to push to DataStore
@param destSpaceId of content destination | [
"This",
"method",
"loops",
"the",
"arg",
"baseDir",
"and",
"pushes",
"the",
"found",
"content",
"to",
"the",
"arg",
"destSpace",
"."
]
| train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/chunk/src/main/java/org/duracloud/chunk/FileChunker.java#L167-L189 |
mfornos/humanize | humanize-slim/src/main/java/humanize/Humanize.java | Humanize.decamelize | public static String decamelize(final String words, final String replacement) {
"""
<p>
Converts a camel case string into a human-readable name.
</p>
<p>
Example assuming SPACE as replacement:
</p>
<table border="0" cellspacing="0" cellpadding="3" width="100%">
<tr>
<th class="colFirst">Input</th>
<th class="colLast">Output</th>
</tr>
<tr>
<td>"MyClass"</td>
<td>"My Class"</td>
</tr>
<tr>
<td>"GL11Version"</td>
<td>"GL 11 Version"</td>
</tr>
<tr>
<td>"AString"</td>
<td>"A String"</td>
</tr>
<tr>
<td>"SimpleXMLParser"</td>
<td>"Simple XML Parser"</td>
</tr>
</table>
@param words
String to be converted
@param replacement
String to be interpolated
@return words converted to human-readable name
"""
return SPLIT_CAMEL.matcher(words).replaceAll(replacement);
} | java | public static String decamelize(final String words, final String replacement)
{
return SPLIT_CAMEL.matcher(words).replaceAll(replacement);
} | [
"public",
"static",
"String",
"decamelize",
"(",
"final",
"String",
"words",
",",
"final",
"String",
"replacement",
")",
"{",
"return",
"SPLIT_CAMEL",
".",
"matcher",
"(",
"words",
")",
".",
"replaceAll",
"(",
"replacement",
")",
";",
"}"
]
| <p>
Converts a camel case string into a human-readable name.
</p>
<p>
Example assuming SPACE as replacement:
</p>
<table border="0" cellspacing="0" cellpadding="3" width="100%">
<tr>
<th class="colFirst">Input</th>
<th class="colLast">Output</th>
</tr>
<tr>
<td>"MyClass"</td>
<td>"My Class"</td>
</tr>
<tr>
<td>"GL11Version"</td>
<td>"GL 11 Version"</td>
</tr>
<tr>
<td>"AString"</td>
<td>"A String"</td>
</tr>
<tr>
<td>"SimpleXMLParser"</td>
<td>"Simple XML Parser"</td>
</tr>
</table>
@param words
String to be converted
@param replacement
String to be interpolated
@return words converted to human-readable name | [
"<p",
">",
"Converts",
"a",
"camel",
"case",
"string",
"into",
"a",
"human",
"-",
"readable",
"name",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L659-L662 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfContentByte.java | PdfContentByte.moveText | public void moveText(float x, float y) {
"""
Moves to the start of the next line, offset from the start of the current line.
@param x x-coordinate of the new current point
@param y y-coordinate of the new current point
"""
state.xTLM += x;
state.yTLM += y;
content.append(x).append(' ').append(y).append(" Td").append_i(separator);
} | java | public void moveText(float x, float y) {
state.xTLM += x;
state.yTLM += y;
content.append(x).append(' ').append(y).append(" Td").append_i(separator);
} | [
"public",
"void",
"moveText",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"state",
".",
"xTLM",
"+=",
"x",
";",
"state",
".",
"yTLM",
"+=",
"y",
";",
"content",
".",
"append",
"(",
"x",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"y",
")",
".",
"append",
"(",
"\" Td\"",
")",
".",
"append_i",
"(",
"separator",
")",
";",
"}"
]
| Moves to the start of the next line, offset from the start of the current line.
@param x x-coordinate of the new current point
@param y y-coordinate of the new current point | [
"Moves",
"to",
"the",
"start",
"of",
"the",
"next",
"line",
"offset",
"from",
"the",
"start",
"of",
"the",
"current",
"line",
"."
]
| train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L1558-L1562 |
Omertron/api-rottentomatoes | src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java | RottenTomatoesApi.getMoviesReviews | public List<Review> getMoviesReviews(int movieId, String reviewType, String country) throws RottenTomatoesException {
"""
Retrieves the reviews for a movie
@param movieId
@param reviewType
@param country
@return
@throws RottenTomatoesException
"""
return getMoviesReviews(movieId, reviewType, DEFAULT_PAGE_LIMIT, DEFAULT_PAGE, country);
} | java | public List<Review> getMoviesReviews(int movieId, String reviewType, String country) throws RottenTomatoesException {
return getMoviesReviews(movieId, reviewType, DEFAULT_PAGE_LIMIT, DEFAULT_PAGE, country);
} | [
"public",
"List",
"<",
"Review",
">",
"getMoviesReviews",
"(",
"int",
"movieId",
",",
"String",
"reviewType",
",",
"String",
"country",
")",
"throws",
"RottenTomatoesException",
"{",
"return",
"getMoviesReviews",
"(",
"movieId",
",",
"reviewType",
",",
"DEFAULT_PAGE_LIMIT",
",",
"DEFAULT_PAGE",
",",
"country",
")",
";",
"}"
]
| Retrieves the reviews for a movie
@param movieId
@param reviewType
@param country
@return
@throws RottenTomatoesException | [
"Retrieves",
"the",
"reviews",
"for",
"a",
"movie"
]
| train | https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L590-L592 |
kiegroup/droolsjbpm-integration | kie-server-parent/kie-server-controller/kie-server-controller-client/src/main/java/org/kie/server/controller/client/KieServerControllerClientFactory.java | KieServerControllerClientFactory.newRestClient | public static KieServerControllerClient newRestClient(final String controllerUrl,
final String login,
final String password,
final MarshallingFormat format) {
"""
Creates a new Kie Controller Client using REST based service
@param controllerUrl the URL to the server (e.g.: "http://localhost:8080/kie-server-controller/rest/controller")
@param login user login
@param password user password
@param format marshaling format
@return client instance
"""
return new RestKieServerControllerClient(controllerUrl,
login,
password,
format);
} | java | public static KieServerControllerClient newRestClient(final String controllerUrl,
final String login,
final String password,
final MarshallingFormat format) {
return new RestKieServerControllerClient(controllerUrl,
login,
password,
format);
} | [
"public",
"static",
"KieServerControllerClient",
"newRestClient",
"(",
"final",
"String",
"controllerUrl",
",",
"final",
"String",
"login",
",",
"final",
"String",
"password",
",",
"final",
"MarshallingFormat",
"format",
")",
"{",
"return",
"new",
"RestKieServerControllerClient",
"(",
"controllerUrl",
",",
"login",
",",
"password",
",",
"format",
")",
";",
"}"
]
| Creates a new Kie Controller Client using REST based service
@param controllerUrl the URL to the server (e.g.: "http://localhost:8080/kie-server-controller/rest/controller")
@param login user login
@param password user password
@param format marshaling format
@return client instance | [
"Creates",
"a",
"new",
"Kie",
"Controller",
"Client",
"using",
"REST",
"based",
"service"
]
| train | https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-server-parent/kie-server-controller/kie-server-controller-client/src/main/java/org/kie/server/controller/client/KieServerControllerClientFactory.java#L54-L62 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/xml/schema/WsdlXsdSchema.java | WsdlXsdSchema.getWsdlDefinition | private Definition getWsdlDefinition(Resource wsdl) {
"""
Reads WSDL definition from resource.
@param wsdl
@return
@throws IOException
@throws WSDLException
"""
try {
Definition definition;
if (wsdl.getURI().toString().startsWith("jar:")) {
// Locate WSDL imports in Jar files
definition = WSDLFactory.newInstance().newWSDLReader().readWSDL(new JarWSDLLocator(wsdl));
} else {
definition = WSDLFactory.newInstance().newWSDLReader().readWSDL(wsdl.getURI().getPath(), new InputSource(wsdl.getInputStream()));
}
return definition;
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to read wsdl file resource", e);
} catch (WSDLException e) {
throw new CitrusRuntimeException("Failed to wsdl schema instance", e);
}
} | java | private Definition getWsdlDefinition(Resource wsdl) {
try {
Definition definition;
if (wsdl.getURI().toString().startsWith("jar:")) {
// Locate WSDL imports in Jar files
definition = WSDLFactory.newInstance().newWSDLReader().readWSDL(new JarWSDLLocator(wsdl));
} else {
definition = WSDLFactory.newInstance().newWSDLReader().readWSDL(wsdl.getURI().getPath(), new InputSource(wsdl.getInputStream()));
}
return definition;
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to read wsdl file resource", e);
} catch (WSDLException e) {
throw new CitrusRuntimeException("Failed to wsdl schema instance", e);
}
} | [
"private",
"Definition",
"getWsdlDefinition",
"(",
"Resource",
"wsdl",
")",
"{",
"try",
"{",
"Definition",
"definition",
";",
"if",
"(",
"wsdl",
".",
"getURI",
"(",
")",
".",
"toString",
"(",
")",
".",
"startsWith",
"(",
"\"jar:\"",
")",
")",
"{",
"// Locate WSDL imports in Jar files",
"definition",
"=",
"WSDLFactory",
".",
"newInstance",
"(",
")",
".",
"newWSDLReader",
"(",
")",
".",
"readWSDL",
"(",
"new",
"JarWSDLLocator",
"(",
"wsdl",
")",
")",
";",
"}",
"else",
"{",
"definition",
"=",
"WSDLFactory",
".",
"newInstance",
"(",
")",
".",
"newWSDLReader",
"(",
")",
".",
"readWSDL",
"(",
"wsdl",
".",
"getURI",
"(",
")",
".",
"getPath",
"(",
")",
",",
"new",
"InputSource",
"(",
"wsdl",
".",
"getInputStream",
"(",
")",
")",
")",
";",
"}",
"return",
"definition",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"CitrusRuntimeException",
"(",
"\"Failed to read wsdl file resource\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"WSDLException",
"e",
")",
"{",
"throw",
"new",
"CitrusRuntimeException",
"(",
"\"Failed to wsdl schema instance\"",
",",
"e",
")",
";",
"}",
"}"
]
| Reads WSDL definition from resource.
@param wsdl
@return
@throws IOException
@throws WSDLException | [
"Reads",
"WSDL",
"definition",
"from",
"resource",
"."
]
| train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/xml/schema/WsdlXsdSchema.java#L185-L201 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.delegatedAccount_email_responder_DELETE | public OvhTaskSpecialAccount delegatedAccount_email_responder_DELETE(String email) throws IOException {
"""
Delete an existing responder in server
REST: DELETE /email/domain/delegatedAccount/{email}/responder
@param email [required] Email
"""
String qPath = "/email/domain/delegatedAccount/{email}/responder";
StringBuilder sb = path(qPath, email);
String resp = exec(qPath, "DELETE", sb.toString(), null);
return convertTo(resp, OvhTaskSpecialAccount.class);
} | java | public OvhTaskSpecialAccount delegatedAccount_email_responder_DELETE(String email) throws IOException {
String qPath = "/email/domain/delegatedAccount/{email}/responder";
StringBuilder sb = path(qPath, email);
String resp = exec(qPath, "DELETE", sb.toString(), null);
return convertTo(resp, OvhTaskSpecialAccount.class);
} | [
"public",
"OvhTaskSpecialAccount",
"delegatedAccount_email_responder_DELETE",
"(",
"String",
"email",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/delegatedAccount/{email}/responder\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"email",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"DELETE\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhTaskSpecialAccount",
".",
"class",
")",
";",
"}"
]
| Delete an existing responder in server
REST: DELETE /email/domain/delegatedAccount/{email}/responder
@param email [required] Email | [
"Delete",
"an",
"existing",
"responder",
"in",
"server"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L347-L352 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java | ConstructorBuilder.buildConstructorDoc | public void buildConstructorDoc(XMLNode node, Content memberDetailsTree) throws DocletException {
"""
Build the constructor documentation.
@param node the XML element that specifies which components to document
@param memberDetailsTree the content tree to which the documentation will be added
@throws DocletException is there is a problem while building the documentation
"""
if (writer == null) {
return;
}
if (hasMembersToDocument()) {
Content constructorDetailsTree = writer.getConstructorDetailsTreeHeader(typeElement,
memberDetailsTree);
Element lastElement = constructors.get(constructors.size() - 1);
for (Element contructor : constructors) {
currentConstructor = (ExecutableElement)contructor;
Content constructorDocTree = writer.getConstructorDocTreeHeader(currentConstructor, constructorDetailsTree);
buildChildren(node, constructorDocTree);
constructorDetailsTree.addContent(writer.getConstructorDoc(constructorDocTree,
currentConstructor == lastElement));
}
memberDetailsTree.addContent(
writer.getConstructorDetails(constructorDetailsTree));
}
} | java | public void buildConstructorDoc(XMLNode node, Content memberDetailsTree) throws DocletException {
if (writer == null) {
return;
}
if (hasMembersToDocument()) {
Content constructorDetailsTree = writer.getConstructorDetailsTreeHeader(typeElement,
memberDetailsTree);
Element lastElement = constructors.get(constructors.size() - 1);
for (Element contructor : constructors) {
currentConstructor = (ExecutableElement)contructor;
Content constructorDocTree = writer.getConstructorDocTreeHeader(currentConstructor, constructorDetailsTree);
buildChildren(node, constructorDocTree);
constructorDetailsTree.addContent(writer.getConstructorDoc(constructorDocTree,
currentConstructor == lastElement));
}
memberDetailsTree.addContent(
writer.getConstructorDetails(constructorDetailsTree));
}
} | [
"public",
"void",
"buildConstructorDoc",
"(",
"XMLNode",
"node",
",",
"Content",
"memberDetailsTree",
")",
"throws",
"DocletException",
"{",
"if",
"(",
"writer",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"hasMembersToDocument",
"(",
")",
")",
"{",
"Content",
"constructorDetailsTree",
"=",
"writer",
".",
"getConstructorDetailsTreeHeader",
"(",
"typeElement",
",",
"memberDetailsTree",
")",
";",
"Element",
"lastElement",
"=",
"constructors",
".",
"get",
"(",
"constructors",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"for",
"(",
"Element",
"contructor",
":",
"constructors",
")",
"{",
"currentConstructor",
"=",
"(",
"ExecutableElement",
")",
"contructor",
";",
"Content",
"constructorDocTree",
"=",
"writer",
".",
"getConstructorDocTreeHeader",
"(",
"currentConstructor",
",",
"constructorDetailsTree",
")",
";",
"buildChildren",
"(",
"node",
",",
"constructorDocTree",
")",
";",
"constructorDetailsTree",
".",
"addContent",
"(",
"writer",
".",
"getConstructorDoc",
"(",
"constructorDocTree",
",",
"currentConstructor",
"==",
"lastElement",
")",
")",
";",
"}",
"memberDetailsTree",
".",
"addContent",
"(",
"writer",
".",
"getConstructorDetails",
"(",
"constructorDetailsTree",
")",
")",
";",
"}",
"}"
]
| Build the constructor documentation.
@param node the XML element that specifies which components to document
@param memberDetailsTree the content tree to which the documentation will be added
@throws DocletException is there is a problem while building the documentation | [
"Build",
"the",
"constructor",
"documentation",
"."
]
| train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java#L152-L171 |
DiUS/pact-jvm | pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java | PactDslJsonArray.matchUrl | public PactDslJsonArray matchUrl(String basePath, Object... pathFragments) {
"""
Matches a URL that is composed of a base path and a sequence of path expressions
@param basePath The base path for the URL (like "http://localhost:8080/") which will be excluded from the matching
@param pathFragments Series of path fragments to match on. These can be strings or regular expressions.
"""
UrlMatcherSupport urlMatcher = new UrlMatcherSupport(basePath, Arrays.asList(pathFragments));
body.put(urlMatcher.getExampleValue());
matchers.addRule(rootPath + appendArrayIndex(0), regexp(urlMatcher.getRegexExpression()));
return this;
} | java | public PactDslJsonArray matchUrl(String basePath, Object... pathFragments) {
UrlMatcherSupport urlMatcher = new UrlMatcherSupport(basePath, Arrays.asList(pathFragments));
body.put(urlMatcher.getExampleValue());
matchers.addRule(rootPath + appendArrayIndex(0), regexp(urlMatcher.getRegexExpression()));
return this;
} | [
"public",
"PactDslJsonArray",
"matchUrl",
"(",
"String",
"basePath",
",",
"Object",
"...",
"pathFragments",
")",
"{",
"UrlMatcherSupport",
"urlMatcher",
"=",
"new",
"UrlMatcherSupport",
"(",
"basePath",
",",
"Arrays",
".",
"asList",
"(",
"pathFragments",
")",
")",
";",
"body",
".",
"put",
"(",
"urlMatcher",
".",
"getExampleValue",
"(",
")",
")",
";",
"matchers",
".",
"addRule",
"(",
"rootPath",
"+",
"appendArrayIndex",
"(",
"0",
")",
",",
"regexp",
"(",
"urlMatcher",
".",
"getRegexExpression",
"(",
")",
")",
")",
";",
"return",
"this",
";",
"}"
]
| Matches a URL that is composed of a base path and a sequence of path expressions
@param basePath The base path for the URL (like "http://localhost:8080/") which will be excluded from the matching
@param pathFragments Series of path fragments to match on. These can be strings or regular expressions. | [
"Matches",
"a",
"URL",
"that",
"is",
"composed",
"of",
"a",
"base",
"path",
"and",
"a",
"sequence",
"of",
"path",
"expressions"
]
| train | https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L1156-L1161 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geometry/SweepHullDelaunay2D.java | SweepHullDelaunay2D.leftOf | boolean leftOf(double[] a, double[] b, double[] d) {
"""
Test if the double[] AD is right of AB.
@param a Starting point
@param b Reference point
@param d Test point
@return true when on the left side
"""
final double bax = b[0] - a[0], bay = b[1] - a[1];
final double dax = d[0] - a[0], day = d[1] - a[1];
final double cross = bax * day - bay * dax;
return cross > 1e-10 * Math.max(Math.max(bax, bay), Math.max(dax, day));
} | java | boolean leftOf(double[] a, double[] b, double[] d) {
final double bax = b[0] - a[0], bay = b[1] - a[1];
final double dax = d[0] - a[0], day = d[1] - a[1];
final double cross = bax * day - bay * dax;
return cross > 1e-10 * Math.max(Math.max(bax, bay), Math.max(dax, day));
} | [
"boolean",
"leftOf",
"(",
"double",
"[",
"]",
"a",
",",
"double",
"[",
"]",
"b",
",",
"double",
"[",
"]",
"d",
")",
"{",
"final",
"double",
"bax",
"=",
"b",
"[",
"0",
"]",
"-",
"a",
"[",
"0",
"]",
",",
"bay",
"=",
"b",
"[",
"1",
"]",
"-",
"a",
"[",
"1",
"]",
";",
"final",
"double",
"dax",
"=",
"d",
"[",
"0",
"]",
"-",
"a",
"[",
"0",
"]",
",",
"day",
"=",
"d",
"[",
"1",
"]",
"-",
"a",
"[",
"1",
"]",
";",
"final",
"double",
"cross",
"=",
"bax",
"*",
"day",
"-",
"bay",
"*",
"dax",
";",
"return",
"cross",
">",
"1e-10",
"*",
"Math",
".",
"max",
"(",
"Math",
".",
"max",
"(",
"bax",
",",
"bay",
")",
",",
"Math",
".",
"max",
"(",
"dax",
",",
"day",
")",
")",
";",
"}"
]
| Test if the double[] AD is right of AB.
@param a Starting point
@param b Reference point
@param d Test point
@return true when on the left side | [
"Test",
"if",
"the",
"double",
"[]",
"AD",
"is",
"right",
"of",
"AB",
"."
]
| train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geometry/SweepHullDelaunay2D.java#L706-L711 |
hypercube1024/firefly | firefly-common/src/main/java/com/firefly/utils/function/Actions.java | Actions.toFunc | public static <T1, T2, T3, T4, R> Func4<T1, T2, T3, T4, R> toFunc(final Action4<T1, T2, T3, T4> action, final R result) {
"""
Converts an {@link Action4} to a function that calls the action and returns a specified value.
@param action the {@link Action4} to convert
@param result the value to return from the function call
@return a {@link Func4} that calls {@code action} and returns {@code result}
"""
return new Func4<T1, T2, T3, T4, R>() {
@Override
public R call(T1 t1, T2 t2, T3 t3, T4 t4) {
action.call(t1, t2, t3, t4);
return result;
}
};
} | java | public static <T1, T2, T3, T4, R> Func4<T1, T2, T3, T4, R> toFunc(final Action4<T1, T2, T3, T4> action, final R result) {
return new Func4<T1, T2, T3, T4, R>() {
@Override
public R call(T1 t1, T2 t2, T3 t3, T4 t4) {
action.call(t1, t2, t3, t4);
return result;
}
};
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"R",
">",
"Func4",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"R",
">",
"toFunc",
"(",
"final",
"Action4",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
">",
"action",
",",
"final",
"R",
"result",
")",
"{",
"return",
"new",
"Func4",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"R",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"R",
"call",
"(",
"T1",
"t1",
",",
"T2",
"t2",
",",
"T3",
"t3",
",",
"T4",
"t4",
")",
"{",
"action",
".",
"call",
"(",
"t1",
",",
"t2",
",",
"t3",
",",
"t4",
")",
";",
"return",
"result",
";",
"}",
"}",
";",
"}"
]
| Converts an {@link Action4} to a function that calls the action and returns a specified value.
@param action the {@link Action4} to convert
@param result the value to return from the function call
@return a {@link Func4} that calls {@code action} and returns {@code result} | [
"Converts",
"an",
"{",
"@link",
"Action4",
"}",
"to",
"a",
"function",
"that",
"calls",
"the",
"action",
"and",
"returns",
"a",
"specified",
"value",
"."
]
| train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/function/Actions.java#L270-L278 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/InfoPopup.java | InfoPopup.show | public void show (Popups.Position pos, Widget target) {
"""
Displays this info popup directly below the specified widget.
"""
Popups.show(this, pos, target);
} | java | public void show (Popups.Position pos, Widget target)
{
Popups.show(this, pos, target);
} | [
"public",
"void",
"show",
"(",
"Popups",
".",
"Position",
"pos",
",",
"Widget",
"target",
")",
"{",
"Popups",
".",
"show",
"(",
"this",
",",
"pos",
",",
"target",
")",
";",
"}"
]
| Displays this info popup directly below the specified widget. | [
"Displays",
"this",
"info",
"popup",
"directly",
"below",
"the",
"specified",
"widget",
"."
]
| train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/InfoPopup.java#L81-L84 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/util/StringUtils.java | StringUtils.join | public static <T> String join(List<T> list, String separator) {
"""
Constructs and returns a string object that is the result of interposing a separator between the elements of the list
"""
StringBuilder builder = new StringBuilder();
int i = 0;
for (T t : list) {
builder.append(t);
if (++i < list.size()) builder.append(separator);
}
return builder.toString();
} | java | public static <T> String join(List<T> list, String separator) {
StringBuilder builder = new StringBuilder();
int i = 0;
for (T t : list) {
builder.append(t);
if (++i < list.size()) builder.append(separator);
}
return builder.toString();
} | [
"public",
"static",
"<",
"T",
">",
"String",
"join",
"(",
"List",
"<",
"T",
">",
"list",
",",
"String",
"separator",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"T",
"t",
":",
"list",
")",
"{",
"builder",
".",
"append",
"(",
"t",
")",
";",
"if",
"(",
"++",
"i",
"<",
"list",
".",
"size",
"(",
")",
")",
"builder",
".",
"append",
"(",
"separator",
")",
";",
"}",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
]
| Constructs and returns a string object that is the result of interposing a separator between the elements of the list | [
"Constructs",
"and",
"returns",
"a",
"string",
"object",
"that",
"is",
"the",
"result",
"of",
"interposing",
"a",
"separator",
"between",
"the",
"elements",
"of",
"the",
"list"
]
| train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/StringUtils.java#L125-L133 |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/SoapServerActionBuilder.java | SoapServerActionBuilder.receive | public SoapServerRequestActionBuilder receive() {
"""
Generic request builder for receiving SOAP messages on server.
@return
"""
SoapServerRequestActionBuilder soapServerRequestActionBuilder = new SoapServerRequestActionBuilder(action, soapServer)
.withApplicationContext(applicationContext);
return soapServerRequestActionBuilder;
} | java | public SoapServerRequestActionBuilder receive() {
SoapServerRequestActionBuilder soapServerRequestActionBuilder = new SoapServerRequestActionBuilder(action, soapServer)
.withApplicationContext(applicationContext);
return soapServerRequestActionBuilder;
} | [
"public",
"SoapServerRequestActionBuilder",
"receive",
"(",
")",
"{",
"SoapServerRequestActionBuilder",
"soapServerRequestActionBuilder",
"=",
"new",
"SoapServerRequestActionBuilder",
"(",
"action",
",",
"soapServer",
")",
".",
"withApplicationContext",
"(",
"applicationContext",
")",
";",
"return",
"soapServerRequestActionBuilder",
";",
"}"
]
| Generic request builder for receiving SOAP messages on server.
@return | [
"Generic",
"request",
"builder",
"for",
"receiving",
"SOAP",
"messages",
"on",
"server",
"."
]
| train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/SoapServerActionBuilder.java#L50-L54 |
d-michail/jheaps | src/main/java/org/jheaps/tree/BinaryTreeSoftHeap.java | BinaryTreeSoftHeap.meld | @Override
public void meld(MergeableHeap<K> other) {
"""
{@inheritDoc}
@throws IllegalArgumentException
if {@code other} has a different error rate
"""
BinaryTreeSoftHeap<K> h = (BinaryTreeSoftHeap<K>) other;
// check same comparator
if (comparator != null) {
if (h.comparator == null || !h.comparator.equals(comparator)) {
throw new IllegalArgumentException("Cannot meld heaps using different comparators!");
}
} else if (h.comparator != null) {
throw new IllegalArgumentException("Cannot meld heaps using different comparators!");
}
if (rankLimit != h.rankLimit) {
throw new IllegalArgumentException("Cannot meld heaps with different error rates!");
}
// perform the meld
mergeInto(h.rootList.head, h.rootList.tail);
size += h.size;
// clear other
h.size = 0;
h.rootList.head = null;
h.rootList.tail = null;
} | java | @Override
public void meld(MergeableHeap<K> other) {
BinaryTreeSoftHeap<K> h = (BinaryTreeSoftHeap<K>) other;
// check same comparator
if (comparator != null) {
if (h.comparator == null || !h.comparator.equals(comparator)) {
throw new IllegalArgumentException("Cannot meld heaps using different comparators!");
}
} else if (h.comparator != null) {
throw new IllegalArgumentException("Cannot meld heaps using different comparators!");
}
if (rankLimit != h.rankLimit) {
throw new IllegalArgumentException("Cannot meld heaps with different error rates!");
}
// perform the meld
mergeInto(h.rootList.head, h.rootList.tail);
size += h.size;
// clear other
h.size = 0;
h.rootList.head = null;
h.rootList.tail = null;
} | [
"@",
"Override",
"public",
"void",
"meld",
"(",
"MergeableHeap",
"<",
"K",
">",
"other",
")",
"{",
"BinaryTreeSoftHeap",
"<",
"K",
">",
"h",
"=",
"(",
"BinaryTreeSoftHeap",
"<",
"K",
">",
")",
"other",
";",
"// check same comparator",
"if",
"(",
"comparator",
"!=",
"null",
")",
"{",
"if",
"(",
"h",
".",
"comparator",
"==",
"null",
"||",
"!",
"h",
".",
"comparator",
".",
"equals",
"(",
"comparator",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot meld heaps using different comparators!\"",
")",
";",
"}",
"}",
"else",
"if",
"(",
"h",
".",
"comparator",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot meld heaps using different comparators!\"",
")",
";",
"}",
"if",
"(",
"rankLimit",
"!=",
"h",
".",
"rankLimit",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot meld heaps with different error rates!\"",
")",
";",
"}",
"// perform the meld",
"mergeInto",
"(",
"h",
".",
"rootList",
".",
"head",
",",
"h",
".",
"rootList",
".",
"tail",
")",
";",
"size",
"+=",
"h",
".",
"size",
";",
"// clear other",
"h",
".",
"size",
"=",
"0",
";",
"h",
".",
"rootList",
".",
"head",
"=",
"null",
";",
"h",
".",
"rootList",
".",
"tail",
"=",
"null",
";",
"}"
]
| {@inheritDoc}
@throws IllegalArgumentException
if {@code other} has a different error rate | [
"{",
"@inheritDoc",
"}"
]
| train | https://github.com/d-michail/jheaps/blob/7146451dd6591c2a8559dc564c9c40428c4a2c10/src/main/java/org/jheaps/tree/BinaryTreeSoftHeap.java#L220-L245 |
beanshell/beanshell | src/main/java/bsh/NameSpace.java | NameSpace.getNameResolver | Name getNameResolver(final String ambigname) {
"""
This is the factory for Name objects which resolve names within this
namespace (e.g. toObject(), toClass(), toLHS()).
<p>
This was intended to support name resolver caching, allowing Name objects
to cache info about the resolution of names for performance reasons.
However this not proven useful yet.
<p>
We'll leave the caching as it will at least minimize Name object
creation.
<p>
(This method would be called getName() if it weren't already used for the
simple name of the NameSpace)
<p>
This method was public for a time, which was a mistake. Use get()
instead.
@param ambigname the ambigname
@return the name resolver
"""
if (!this.names.containsKey(ambigname))
this.names.put(ambigname, new Name(this, ambigname));
return this.names.get(ambigname);
} | java | Name getNameResolver(final String ambigname) {
if (!this.names.containsKey(ambigname))
this.names.put(ambigname, new Name(this, ambigname));
return this.names.get(ambigname);
} | [
"Name",
"getNameResolver",
"(",
"final",
"String",
"ambigname",
")",
"{",
"if",
"(",
"!",
"this",
".",
"names",
".",
"containsKey",
"(",
"ambigname",
")",
")",
"this",
".",
"names",
".",
"put",
"(",
"ambigname",
",",
"new",
"Name",
"(",
"this",
",",
"ambigname",
")",
")",
";",
"return",
"this",
".",
"names",
".",
"get",
"(",
"ambigname",
")",
";",
"}"
]
| This is the factory for Name objects which resolve names within this
namespace (e.g. toObject(), toClass(), toLHS()).
<p>
This was intended to support name resolver caching, allowing Name objects
to cache info about the resolution of names for performance reasons.
However this not proven useful yet.
<p>
We'll leave the caching as it will at least minimize Name object
creation.
<p>
(This method would be called getName() if it weren't already used for the
simple name of the NameSpace)
<p>
This method was public for a time, which was a mistake. Use get()
instead.
@param ambigname the ambigname
@return the name resolver | [
"This",
"is",
"the",
"factory",
"for",
"Name",
"objects",
"which",
"resolve",
"names",
"within",
"this",
"namespace",
"(",
"e",
".",
"g",
".",
"toObject",
"()",
"toClass",
"()",
"toLHS",
"()",
")",
".",
"<p",
">",
"This",
"was",
"intended",
"to",
"support",
"name",
"resolver",
"caching",
"allowing",
"Name",
"objects",
"to",
"cache",
"info",
"about",
"the",
"resolution",
"of",
"names",
"for",
"performance",
"reasons",
".",
"However",
"this",
"not",
"proven",
"useful",
"yet",
".",
"<p",
">",
"We",
"ll",
"leave",
"the",
"caching",
"as",
"it",
"will",
"at",
"least",
"minimize",
"Name",
"object",
"creation",
".",
"<p",
">",
"(",
"This",
"method",
"would",
"be",
"called",
"getName",
"()",
"if",
"it",
"weren",
"t",
"already",
"used",
"for",
"the",
"simple",
"name",
"of",
"the",
"NameSpace",
")",
"<p",
">",
"This",
"method",
"was",
"public",
"for",
"a",
"time",
"which",
"was",
"a",
"mistake",
".",
"Use",
"get",
"()",
"instead",
"."
]
| train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/NameSpace.java#L1277-L1281 |
UrielCh/ovh-java-sdk | ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java | ApiOvhXdsl.serviceName_monitoringNotifications_id_PUT | public void serviceName_monitoringNotifications_id_PUT(String serviceName, Long id, OvhMonitoringNotification body) throws IOException {
"""
Alter this object properties
REST: PUT /xdsl/{serviceName}/monitoringNotifications/{id}
@param body [required] New object properties
@param serviceName [required] The internal name of your XDSL offer
@param id [required] Id of the object
"""
String qPath = "/xdsl/{serviceName}/monitoringNotifications/{id}";
StringBuilder sb = path(qPath, serviceName, id);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_monitoringNotifications_id_PUT(String serviceName, Long id, OvhMonitoringNotification body) throws IOException {
String qPath = "/xdsl/{serviceName}/monitoringNotifications/{id}";
StringBuilder sb = path(qPath, serviceName, id);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_monitoringNotifications_id_PUT",
"(",
"String",
"serviceName",
",",
"Long",
"id",
",",
"OvhMonitoringNotification",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/xdsl/{serviceName}/monitoringNotifications/{id}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"id",
")",
";",
"exec",
"(",
"qPath",
",",
"\"PUT\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"body",
")",
";",
"}"
]
| Alter this object properties
REST: PUT /xdsl/{serviceName}/monitoringNotifications/{id}
@param body [required] New object properties
@param serviceName [required] The internal name of your XDSL offer
@param id [required] Id of the object | [
"Alter",
"this",
"object",
"properties"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1400-L1404 |
super-csv/super-csv | super-csv/src/main/java/org/supercsv/io/AbstractCsvWriter.java | AbstractCsvWriter.writeRow | protected void writeRow(final String... columns) throws IOException {
"""
Writes one or more String columns as a line to the CsvWriter.
@param columns
the columns to write
@throws IllegalArgumentException
if columns.length == 0
@throws IOException
If an I/O error occurs
@throws NullPointerException
if columns is null
"""
if( columns == null ) {
throw new NullPointerException(String.format("columns to write should not be null on line %d", lineNumber));
} else if( columns.length == 0 ) {
throw new IllegalArgumentException(String.format("columns to write should not be empty on line %d",
lineNumber));
}
StringBuilder builder = new StringBuilder();
for( int i = 0; i < columns.length; i++ ) {
columnNumber = i + 1; // column no used by CsvEncoder
if( i > 0 ) {
builder.append((char) preference.getDelimiterChar()); // delimiter
}
final String csvElement = columns[i];
if( csvElement != null ) {
final CsvContext context = new CsvContext(lineNumber, rowNumber, columnNumber);
final String escapedCsv = encoder.encode(csvElement, context, preference);
builder.append(escapedCsv);
lineNumber = context.getLineNumber(); // line number can increment when encoding multi-line columns
}
}
builder.append(preference.getEndOfLineSymbols()); // EOL
writer.write(builder.toString());
} | java | protected void writeRow(final String... columns) throws IOException {
if( columns == null ) {
throw new NullPointerException(String.format("columns to write should not be null on line %d", lineNumber));
} else if( columns.length == 0 ) {
throw new IllegalArgumentException(String.format("columns to write should not be empty on line %d",
lineNumber));
}
StringBuilder builder = new StringBuilder();
for( int i = 0; i < columns.length; i++ ) {
columnNumber = i + 1; // column no used by CsvEncoder
if( i > 0 ) {
builder.append((char) preference.getDelimiterChar()); // delimiter
}
final String csvElement = columns[i];
if( csvElement != null ) {
final CsvContext context = new CsvContext(lineNumber, rowNumber, columnNumber);
final String escapedCsv = encoder.encode(csvElement, context, preference);
builder.append(escapedCsv);
lineNumber = context.getLineNumber(); // line number can increment when encoding multi-line columns
}
}
builder.append(preference.getEndOfLineSymbols()); // EOL
writer.write(builder.toString());
} | [
"protected",
"void",
"writeRow",
"(",
"final",
"String",
"...",
"columns",
")",
"throws",
"IOException",
"{",
"if",
"(",
"columns",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"String",
".",
"format",
"(",
"\"columns to write should not be null on line %d\"",
",",
"lineNumber",
")",
")",
";",
"}",
"else",
"if",
"(",
"columns",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"columns to write should not be empty on line %d\"",
",",
"lineNumber",
")",
")",
";",
"}",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"columns",
".",
"length",
";",
"i",
"++",
")",
"{",
"columnNumber",
"=",
"i",
"+",
"1",
";",
"// column no used by CsvEncoder",
"if",
"(",
"i",
">",
"0",
")",
"{",
"builder",
".",
"append",
"(",
"(",
"char",
")",
"preference",
".",
"getDelimiterChar",
"(",
")",
")",
";",
"// delimiter",
"}",
"final",
"String",
"csvElement",
"=",
"columns",
"[",
"i",
"]",
";",
"if",
"(",
"csvElement",
"!=",
"null",
")",
"{",
"final",
"CsvContext",
"context",
"=",
"new",
"CsvContext",
"(",
"lineNumber",
",",
"rowNumber",
",",
"columnNumber",
")",
";",
"final",
"String",
"escapedCsv",
"=",
"encoder",
".",
"encode",
"(",
"csvElement",
",",
"context",
",",
"preference",
")",
";",
"builder",
".",
"append",
"(",
"escapedCsv",
")",
";",
"lineNumber",
"=",
"context",
".",
"getLineNumber",
"(",
")",
";",
"// line number can increment when encoding multi-line columns",
"}",
"}",
"builder",
".",
"append",
"(",
"preference",
".",
"getEndOfLineSymbols",
"(",
")",
")",
";",
"// EOL",
"writer",
".",
"write",
"(",
"builder",
".",
"toString",
"(",
")",
")",
";",
"}"
]
| Writes one or more String columns as a line to the CsvWriter.
@param columns
the columns to write
@throws IllegalArgumentException
if columns.length == 0
@throws IOException
If an I/O error occurs
@throws NullPointerException
if columns is null | [
"Writes",
"one",
"or",
"more",
"String",
"columns",
"as",
"a",
"line",
"to",
"the",
"CsvWriter",
"."
]
| train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/io/AbstractCsvWriter.java#L174-L204 |
DiUS/pact-jvm | pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java | PactDslRequestWithPath.matchQuery | public PactDslRequestWithPath matchQuery(String parameter, String regex) {
"""
Match a query parameter with a regex. A random query parameter value will be generated from the regex.
@param parameter Query parameter
@param regex Regular expression to match with
"""
return matchQuery(parameter, regex, new Generex(regex).random());
} | java | public PactDslRequestWithPath matchQuery(String parameter, String regex) {
return matchQuery(parameter, regex, new Generex(regex).random());
} | [
"public",
"PactDslRequestWithPath",
"matchQuery",
"(",
"String",
"parameter",
",",
"String",
"regex",
")",
"{",
"return",
"matchQuery",
"(",
"parameter",
",",
"regex",
",",
"new",
"Generex",
"(",
"regex",
")",
".",
"random",
"(",
")",
")",
";",
"}"
]
| Match a query parameter with a regex. A random query parameter value will be generated from the regex.
@param parameter Query parameter
@param regex Regular expression to match with | [
"Match",
"a",
"query",
"parameter",
"with",
"a",
"regex",
".",
"A",
"random",
"query",
"parameter",
"value",
"will",
"be",
"generated",
"from",
"the",
"regex",
"."
]
| train | https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java#L365-L367 |
jbundle/jbundle | base/remote/src/main/java/org/jbundle/base/remote/lock/ClientLockManager.java | ClientLockManager.lockThisRecord | public int lockThisRecord(Task objSession, String strDatabaseName, String strRecordName, Object bookmark, String strUserName, int iLockType)
throws DBException {
"""
Lock this bookmark in this record for this session.
@param strRecordName The record to create the lock in.
@param bookmark The bookmark to lock.
@param objSession The session that wants the lock.
@param strUser The name of the user that wants the lock.
@param iLockType The type of lock (wait or error lock).
@return null if successful, the name of the user locking if not.
"""
SessionInfo sessionInfo = this.getLockSessionInfo(objSession, strUserName);
try {
return this.getRemoteLockSession(sessionInfo).lockThisRecord(strDatabaseName, strRecordName, bookmark, sessionInfo, iLockType);
} catch (RemoteException ex) {
throw DatabaseException.toDatabaseException(ex);
}
} | java | public int lockThisRecord(Task objSession, String strDatabaseName, String strRecordName, Object bookmark, String strUserName, int iLockType)
throws DBException
{
SessionInfo sessionInfo = this.getLockSessionInfo(objSession, strUserName);
try {
return this.getRemoteLockSession(sessionInfo).lockThisRecord(strDatabaseName, strRecordName, bookmark, sessionInfo, iLockType);
} catch (RemoteException ex) {
throw DatabaseException.toDatabaseException(ex);
}
} | [
"public",
"int",
"lockThisRecord",
"(",
"Task",
"objSession",
",",
"String",
"strDatabaseName",
",",
"String",
"strRecordName",
",",
"Object",
"bookmark",
",",
"String",
"strUserName",
",",
"int",
"iLockType",
")",
"throws",
"DBException",
"{",
"SessionInfo",
"sessionInfo",
"=",
"this",
".",
"getLockSessionInfo",
"(",
"objSession",
",",
"strUserName",
")",
";",
"try",
"{",
"return",
"this",
".",
"getRemoteLockSession",
"(",
"sessionInfo",
")",
".",
"lockThisRecord",
"(",
"strDatabaseName",
",",
"strRecordName",
",",
"bookmark",
",",
"sessionInfo",
",",
"iLockType",
")",
";",
"}",
"catch",
"(",
"RemoteException",
"ex",
")",
"{",
"throw",
"DatabaseException",
".",
"toDatabaseException",
"(",
"ex",
")",
";",
"}",
"}"
]
| Lock this bookmark in this record for this session.
@param strRecordName The record to create the lock in.
@param bookmark The bookmark to lock.
@param objSession The session that wants the lock.
@param strUser The name of the user that wants the lock.
@param iLockType The type of lock (wait or error lock).
@return null if successful, the name of the user locking if not. | [
"Lock",
"this",
"bookmark",
"in",
"this",
"record",
"for",
"this",
"session",
"."
]
| train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/lock/ClientLockManager.java#L73-L82 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/env/Diagnostics.java | Diagnostics.memInfo | public static void memInfo(final Map<String, Object> infos) {
"""
Collects system information as delivered from the {@link MemoryMXBean}.
@param infos a map where the infos are passed in.
"""
infos.put("heap.used", MEM_BEAN.getHeapMemoryUsage());
infos.put("offHeap.used", MEM_BEAN.getNonHeapMemoryUsage());
infos.put("heap.pendingFinalize", MEM_BEAN.getObjectPendingFinalizationCount());
} | java | public static void memInfo(final Map<String, Object> infos) {
infos.put("heap.used", MEM_BEAN.getHeapMemoryUsage());
infos.put("offHeap.used", MEM_BEAN.getNonHeapMemoryUsage());
infos.put("heap.pendingFinalize", MEM_BEAN.getObjectPendingFinalizationCount());
} | [
"public",
"static",
"void",
"memInfo",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"infos",
")",
"{",
"infos",
".",
"put",
"(",
"\"heap.used\"",
",",
"MEM_BEAN",
".",
"getHeapMemoryUsage",
"(",
")",
")",
";",
"infos",
".",
"put",
"(",
"\"offHeap.used\"",
",",
"MEM_BEAN",
".",
"getNonHeapMemoryUsage",
"(",
")",
")",
";",
"infos",
".",
"put",
"(",
"\"heap.pendingFinalize\"",
",",
"MEM_BEAN",
".",
"getObjectPendingFinalizationCount",
"(",
")",
")",
";",
"}"
]
| Collects system information as delivered from the {@link MemoryMXBean}.
@param infos a map where the infos are passed in. | [
"Collects",
"system",
"information",
"as",
"delivered",
"from",
"the",
"{",
"@link",
"MemoryMXBean",
"}",
"."
]
| train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/env/Diagnostics.java#L98-L102 |
Azure/azure-sdk-for-java | datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/VirtualNetworkRulesInner.java | VirtualNetworkRulesInner.listByAccountAsync | public Observable<Page<VirtualNetworkRuleInner>> listByAccountAsync(final String resourceGroupName, final String accountName) {
"""
Lists the Data Lake Store virtual network rules within the specified Data Lake Store account.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Store account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<VirtualNetworkRuleInner> object
"""
return listByAccountWithServiceResponseAsync(resourceGroupName, accountName)
.map(new Func1<ServiceResponse<Page<VirtualNetworkRuleInner>>, Page<VirtualNetworkRuleInner>>() {
@Override
public Page<VirtualNetworkRuleInner> call(ServiceResponse<Page<VirtualNetworkRuleInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<VirtualNetworkRuleInner>> listByAccountAsync(final String resourceGroupName, final String accountName) {
return listByAccountWithServiceResponseAsync(resourceGroupName, accountName)
.map(new Func1<ServiceResponse<Page<VirtualNetworkRuleInner>>, Page<VirtualNetworkRuleInner>>() {
@Override
public Page<VirtualNetworkRuleInner> call(ServiceResponse<Page<VirtualNetworkRuleInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"VirtualNetworkRuleInner",
">",
">",
"listByAccountAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"accountName",
")",
"{",
"return",
"listByAccountWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"VirtualNetworkRuleInner",
">",
">",
",",
"Page",
"<",
"VirtualNetworkRuleInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"VirtualNetworkRuleInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"VirtualNetworkRuleInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Lists the Data Lake Store virtual network rules within the specified Data Lake Store account.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Store account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<VirtualNetworkRuleInner> object | [
"Lists",
"the",
"Data",
"Lake",
"Store",
"virtual",
"network",
"rules",
"within",
"the",
"specified",
"Data",
"Lake",
"Store",
"account",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/VirtualNetworkRulesInner.java#L142-L150 |
apereo/cas | support/cas-server-support-x509-core/src/main/java/org/apereo/cas/adaptors/x509/authentication/handler/support/X509CredentialsAuthenticationHandler.java | X509CredentialsAuthenticationHandler.doesNameMatchPattern | private static boolean doesNameMatchPattern(final Principal principal, final Pattern pattern) {
"""
Does principal name match pattern?
@param principal the principal
@param pattern the pattern
@return true, if successful
"""
if (pattern != null) {
val name = principal.getName();
val result = pattern.matcher(name).matches();
LOGGER.debug("[{}] matches [{}] == [{}]", pattern.pattern(), name, result);
return result;
}
return true;
} | java | private static boolean doesNameMatchPattern(final Principal principal, final Pattern pattern) {
if (pattern != null) {
val name = principal.getName();
val result = pattern.matcher(name).matches();
LOGGER.debug("[{}] matches [{}] == [{}]", pattern.pattern(), name, result);
return result;
}
return true;
} | [
"private",
"static",
"boolean",
"doesNameMatchPattern",
"(",
"final",
"Principal",
"principal",
",",
"final",
"Pattern",
"pattern",
")",
"{",
"if",
"(",
"pattern",
"!=",
"null",
")",
"{",
"val",
"name",
"=",
"principal",
".",
"getName",
"(",
")",
";",
"val",
"result",
"=",
"pattern",
".",
"matcher",
"(",
"name",
")",
".",
"matches",
"(",
")",
";",
"LOGGER",
".",
"debug",
"(",
"\"[{}] matches [{}] == [{}]\"",
",",
"pattern",
".",
"pattern",
"(",
")",
",",
"name",
",",
"result",
")",
";",
"return",
"result",
";",
"}",
"return",
"true",
";",
"}"
]
| Does principal name match pattern?
@param principal the principal
@param pattern the pattern
@return true, if successful | [
"Does",
"principal",
"name",
"match",
"pattern?"
]
| train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-x509-core/src/main/java/org/apereo/cas/adaptors/x509/authentication/handler/support/X509CredentialsAuthenticationHandler.java#L163-L171 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.passwordRecover_POST | public void passwordRecover_POST(OvhOvhCompanyEnum ovhCompany, String ovhId) throws IOException {
"""
Request a password recover
REST: POST /me/passwordRecover
@param ovhId [required] Your OVH Account Id
@param ovhCompany [required] Company of your OVH Account Id
"""
String qPath = "/me/passwordRecover";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ovhCompany", ovhCompany);
addBody(o, "ovhId", ovhId);
execN(qPath, "POST", sb.toString(), o);
} | java | public void passwordRecover_POST(OvhOvhCompanyEnum ovhCompany, String ovhId) throws IOException {
String qPath = "/me/passwordRecover";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ovhCompany", ovhCompany);
addBody(o, "ovhId", ovhId);
execN(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"passwordRecover_POST",
"(",
"OvhOvhCompanyEnum",
"ovhCompany",
",",
"String",
"ovhId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/passwordRecover\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"ovhCompany\"",
",",
"ovhCompany",
")",
";",
"addBody",
"(",
"o",
",",
"\"ovhId\"",
",",
"ovhId",
")",
";",
"execN",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"}"
]
| Request a password recover
REST: POST /me/passwordRecover
@param ovhId [required] Your OVH Account Id
@param ovhCompany [required] Company of your OVH Account Id | [
"Request",
"a",
"password",
"recover"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L3105-L3112 |
aws/aws-sdk-java | aws-java-sdk-storagegateway/src/main/java/com/amazonaws/services/storagegateway/StorageGatewayUtils.java | StorageGatewayUtils.getActivationKey | public static String getActivationKey(String gatewayAddress, String activationRegionName) throws AmazonClientException {
"""
Sends a request to the AWS Storage Gateway server running at the
specified address and activation region, and returns the activation key
for that server.
@param gatewayAddress
The DNS name or IP address of a running AWS Storage Gateway
@param activationRegionName
The name of the region in which the gateway will be activated.
@return The activation key required for some API calls to AWS Storage
Gateway.
@throws AmazonClientException
If any problems are encountered while trying to contact the
remote AWS Storage Gateway server.
"""
try {
HttpParams httpClientParams = new BasicHttpParams();
httpClientParams.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, false);
DefaultHttpClient client = new DefaultHttpClient(httpClientParams);
String url = "http://" + gatewayAddress;
if (activationRegionName != null) {
url += "/?activationRegion=" + activationRegionName;
}
HttpGet method = new HttpGet(url);
HttpResponse response = client.execute(method);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 302)
throw new AmazonClientException("Could not fetch activation key. HTTP status code: " + statusCode);
Header[] headers = response.getHeaders("Location");
if (headers.length < 1)
throw new AmazonClientException("Could not fetch activation key, no location header found");
String activationUrl = headers[0].getValue();
String[] parts = activationUrl.split("activationKey=");
if (parts.length < 2 || null == parts[1])
throw new AmazonClientException("Unable to get activation key from : " + activationUrl);
return parts[1];
} catch (IOException ioe) {
throw new AmazonClientException("Unable to get activation key", ioe);
}
} | java | public static String getActivationKey(String gatewayAddress, String activationRegionName) throws AmazonClientException {
try {
HttpParams httpClientParams = new BasicHttpParams();
httpClientParams.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, false);
DefaultHttpClient client = new DefaultHttpClient(httpClientParams);
String url = "http://" + gatewayAddress;
if (activationRegionName != null) {
url += "/?activationRegion=" + activationRegionName;
}
HttpGet method = new HttpGet(url);
HttpResponse response = client.execute(method);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 302)
throw new AmazonClientException("Could not fetch activation key. HTTP status code: " + statusCode);
Header[] headers = response.getHeaders("Location");
if (headers.length < 1)
throw new AmazonClientException("Could not fetch activation key, no location header found");
String activationUrl = headers[0].getValue();
String[] parts = activationUrl.split("activationKey=");
if (parts.length < 2 || null == parts[1])
throw new AmazonClientException("Unable to get activation key from : " + activationUrl);
return parts[1];
} catch (IOException ioe) {
throw new AmazonClientException("Unable to get activation key", ioe);
}
} | [
"public",
"static",
"String",
"getActivationKey",
"(",
"String",
"gatewayAddress",
",",
"String",
"activationRegionName",
")",
"throws",
"AmazonClientException",
"{",
"try",
"{",
"HttpParams",
"httpClientParams",
"=",
"new",
"BasicHttpParams",
"(",
")",
";",
"httpClientParams",
".",
"setBooleanParameter",
"(",
"ClientPNames",
".",
"HANDLE_REDIRECTS",
",",
"false",
")",
";",
"DefaultHttpClient",
"client",
"=",
"new",
"DefaultHttpClient",
"(",
"httpClientParams",
")",
";",
"String",
"url",
"=",
"\"http://\"",
"+",
"gatewayAddress",
";",
"if",
"(",
"activationRegionName",
"!=",
"null",
")",
"{",
"url",
"+=",
"\"/?activationRegion=\"",
"+",
"activationRegionName",
";",
"}",
"HttpGet",
"method",
"=",
"new",
"HttpGet",
"(",
"url",
")",
";",
"HttpResponse",
"response",
"=",
"client",
".",
"execute",
"(",
"method",
")",
";",
"int",
"statusCode",
"=",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
";",
"if",
"(",
"statusCode",
"!=",
"302",
")",
"throw",
"new",
"AmazonClientException",
"(",
"\"Could not fetch activation key. HTTP status code: \"",
"+",
"statusCode",
")",
";",
"Header",
"[",
"]",
"headers",
"=",
"response",
".",
"getHeaders",
"(",
"\"Location\"",
")",
";",
"if",
"(",
"headers",
".",
"length",
"<",
"1",
")",
"throw",
"new",
"AmazonClientException",
"(",
"\"Could not fetch activation key, no location header found\"",
")",
";",
"String",
"activationUrl",
"=",
"headers",
"[",
"0",
"]",
".",
"getValue",
"(",
")",
";",
"String",
"[",
"]",
"parts",
"=",
"activationUrl",
".",
"split",
"(",
"\"activationKey=\"",
")",
";",
"if",
"(",
"parts",
".",
"length",
"<",
"2",
"||",
"null",
"==",
"parts",
"[",
"1",
"]",
")",
"throw",
"new",
"AmazonClientException",
"(",
"\"Unable to get activation key from : \"",
"+",
"activationUrl",
")",
";",
"return",
"parts",
"[",
"1",
"]",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"AmazonClientException",
"(",
"\"Unable to get activation key\"",
",",
"ioe",
")",
";",
"}",
"}"
]
| Sends a request to the AWS Storage Gateway server running at the
specified address and activation region, and returns the activation key
for that server.
@param gatewayAddress
The DNS name or IP address of a running AWS Storage Gateway
@param activationRegionName
The name of the region in which the gateway will be activated.
@return The activation key required for some API calls to AWS Storage
Gateway.
@throws AmazonClientException
If any problems are encountered while trying to contact the
remote AWS Storage Gateway server. | [
"Sends",
"a",
"request",
"to",
"the",
"AWS",
"Storage",
"Gateway",
"server",
"running",
"at",
"the",
"specified",
"address",
"and",
"activation",
"region",
"and",
"returns",
"the",
"activation",
"key",
"for",
"that",
"server",
"."
]
| train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-storagegateway/src/main/java/com/amazonaws/services/storagegateway/StorageGatewayUtils.java#L96-L127 |
micronaut-projects/micronaut-core | core/src/main/java/io/micronaut/core/util/StringUtils.java | StringUtils.tokenizeToStringArray | @SuppressWarnings( {
"""
Tokenize the given String into a String array via a StringTokenizer.
<p>The given delimiters string is supposed to consist of any number of
delimiter characters. Each of those characters can be used to separate
tokens. A delimiter is always a single character; for multi-character
delimiters, consider using <code>delimitedListToStringArray</code>
<p/>
<p>Copied from the Spring Framework while retaining all license, copyright and author information.
@param str the String to tokenize
@param delimiters the delimiter characters, assembled as String
(each of those characters is individually considered as delimiter)
@param trimTokens trim the tokens via String's <code>trim</code>
@param ignoreEmptyTokens omit empty tokens from the result array
(only applies to tokens that are empty after trimming; StringTokenizer
will not consider subsequent delimiters as token in the first place).
@return an array of the tokens (<code>null</code> if the input String
was <code>null</code>)
@see java.util.StringTokenizer
@see java.lang.String#trim()
""""unchecked"})
public static String[] tokenizeToStringArray(
String str, String delimiters, boolean trimTokens, boolean ignoreEmptyTokens) {
if (str == null) {
return null;
}
StringTokenizer st = new StringTokenizer(str, delimiters);
List<String> tokens = new ArrayList();
while (st.hasMoreTokens()) {
String token = st.nextToken();
if (trimTokens) {
token = token.trim();
}
if (!ignoreEmptyTokens || token.length() > 0) {
tokens.add(token);
}
}
return tokens.toArray(new String[0]);
} | java | @SuppressWarnings({"unchecked"})
public static String[] tokenizeToStringArray(
String str, String delimiters, boolean trimTokens, boolean ignoreEmptyTokens) {
if (str == null) {
return null;
}
StringTokenizer st = new StringTokenizer(str, delimiters);
List<String> tokens = new ArrayList();
while (st.hasMoreTokens()) {
String token = st.nextToken();
if (trimTokens) {
token = token.trim();
}
if (!ignoreEmptyTokens || token.length() > 0) {
tokens.add(token);
}
}
return tokens.toArray(new String[0]);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
"}",
")",
"public",
"static",
"String",
"[",
"]",
"tokenizeToStringArray",
"(",
"String",
"str",
",",
"String",
"delimiters",
",",
"boolean",
"trimTokens",
",",
"boolean",
"ignoreEmptyTokens",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"StringTokenizer",
"st",
"=",
"new",
"StringTokenizer",
"(",
"str",
",",
"delimiters",
")",
";",
"List",
"<",
"String",
">",
"tokens",
"=",
"new",
"ArrayList",
"(",
")",
";",
"while",
"(",
"st",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"String",
"token",
"=",
"st",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"trimTokens",
")",
"{",
"token",
"=",
"token",
".",
"trim",
"(",
")",
";",
"}",
"if",
"(",
"!",
"ignoreEmptyTokens",
"||",
"token",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"tokens",
".",
"add",
"(",
"token",
")",
";",
"}",
"}",
"return",
"tokens",
".",
"toArray",
"(",
"new",
"String",
"[",
"0",
"]",
")",
";",
"}"
]
| Tokenize the given String into a String array via a StringTokenizer.
<p>The given delimiters string is supposed to consist of any number of
delimiter characters. Each of those characters can be used to separate
tokens. A delimiter is always a single character; for multi-character
delimiters, consider using <code>delimitedListToStringArray</code>
<p/>
<p>Copied from the Spring Framework while retaining all license, copyright and author information.
@param str the String to tokenize
@param delimiters the delimiter characters, assembled as String
(each of those characters is individually considered as delimiter)
@param trimTokens trim the tokens via String's <code>trim</code>
@param ignoreEmptyTokens omit empty tokens from the result array
(only applies to tokens that are empty after trimming; StringTokenizer
will not consider subsequent delimiters as token in the first place).
@return an array of the tokens (<code>null</code> if the input String
was <code>null</code>)
@see java.util.StringTokenizer
@see java.lang.String#trim() | [
"Tokenize",
"the",
"given",
"String",
"into",
"a",
"String",
"array",
"via",
"a",
"StringTokenizer",
".",
"<p",
">",
"The",
"given",
"delimiters",
"string",
"is",
"supposed",
"to",
"consist",
"of",
"any",
"number",
"of",
"delimiter",
"characters",
".",
"Each",
"of",
"those",
"characters",
"can",
"be",
"used",
"to",
"separate",
"tokens",
".",
"A",
"delimiter",
"is",
"always",
"a",
"single",
"character",
";",
"for",
"multi",
"-",
"character",
"delimiters",
"consider",
"using",
"<code",
">",
"delimitedListToStringArray<",
"/",
"code",
">",
"<p",
"/",
">",
"<p",
">",
"Copied",
"from",
"the",
"Spring",
"Framework",
"while",
"retaining",
"all",
"license",
"copyright",
"and",
"author",
"information",
"."
]
| train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/util/StringUtils.java#L194-L213 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java | HttpBuilder.deleteAsync | public CompletableFuture<Object> deleteAsync(final Consumer<HttpConfig> configuration) {
"""
Executes an asynchronous DELETE request on the configured URI (asynchronous alias to the `delete(Consumer)` method), with additional
configuration provided by the configuration function.
This method is generally used for Java-specific configuration.
[source,java]
----
HttpBuilder http = HttpBuilder.configure(config -> {
config.getRequest().setUri("http://localhost:10101");
});
CompletableFuture<Object> future = http.deleteAsync(config -> {
config.getRequest().getUri().setPath("/foo");
});
Object result = future.get();
----
The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface.
@param configuration the additional configuration function (delegated to {@link HttpConfig})
@return the {@link CompletableFuture} containing the result of the request
"""
return CompletableFuture.supplyAsync(() -> delete(configuration), getExecutor());
} | java | public CompletableFuture<Object> deleteAsync(final Consumer<HttpConfig> configuration) {
return CompletableFuture.supplyAsync(() -> delete(configuration), getExecutor());
} | [
"public",
"CompletableFuture",
"<",
"Object",
">",
"deleteAsync",
"(",
"final",
"Consumer",
"<",
"HttpConfig",
">",
"configuration",
")",
"{",
"return",
"CompletableFuture",
".",
"supplyAsync",
"(",
"(",
")",
"->",
"delete",
"(",
"configuration",
")",
",",
"getExecutor",
"(",
")",
")",
";",
"}"
]
| Executes an asynchronous DELETE request on the configured URI (asynchronous alias to the `delete(Consumer)` method), with additional
configuration provided by the configuration function.
This method is generally used for Java-specific configuration.
[source,java]
----
HttpBuilder http = HttpBuilder.configure(config -> {
config.getRequest().setUri("http://localhost:10101");
});
CompletableFuture<Object> future = http.deleteAsync(config -> {
config.getRequest().getUri().setPath("/foo");
});
Object result = future.get();
----
The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface.
@param configuration the additional configuration function (delegated to {@link HttpConfig})
@return the {@link CompletableFuture} containing the result of the request | [
"Executes",
"an",
"asynchronous",
"DELETE",
"request",
"on",
"the",
"configured",
"URI",
"(",
"asynchronous",
"alias",
"to",
"the",
"delete",
"(",
"Consumer",
")",
"method",
")",
"with",
"additional",
"configuration",
"provided",
"by",
"the",
"configuration",
"function",
"."
]
| train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L1219-L1221 |
hellosign/hellosign-java-sdk | src/main/java/com/hellosign/sdk/http/HttpClient.java | HttpClient.asHttpCode | public int asHttpCode() throws HelloSignException {
"""
Executes the request and returns the HTTP response code.
@return int HTTP response code
@throws HelloSignException thrown if no request has been performed
"""
Integer code = getLastResponseCode();
if (code == null) {
throw new HelloSignException("No request performed");
}
if (code >= 200 && code < 300) {
reset();
return code;
}
throw new HelloSignException("HTTP Code " + code, code);
} | java | public int asHttpCode() throws HelloSignException {
Integer code = getLastResponseCode();
if (code == null) {
throw new HelloSignException("No request performed");
}
if (code >= 200 && code < 300) {
reset();
return code;
}
throw new HelloSignException("HTTP Code " + code, code);
} | [
"public",
"int",
"asHttpCode",
"(",
")",
"throws",
"HelloSignException",
"{",
"Integer",
"code",
"=",
"getLastResponseCode",
"(",
")",
";",
"if",
"(",
"code",
"==",
"null",
")",
"{",
"throw",
"new",
"HelloSignException",
"(",
"\"No request performed\"",
")",
";",
"}",
"if",
"(",
"code",
">=",
"200",
"&&",
"code",
"<",
"300",
")",
"{",
"reset",
"(",
")",
";",
"return",
"code",
";",
"}",
"throw",
"new",
"HelloSignException",
"(",
"\"HTTP Code \"",
"+",
"code",
",",
"code",
")",
";",
"}"
]
| Executes the request and returns the HTTP response code.
@return int HTTP response code
@throws HelloSignException thrown if no request has been performed | [
"Executes",
"the",
"request",
"and",
"returns",
"the",
"HTTP",
"response",
"code",
"."
]
| train | https://github.com/hellosign/hellosign-java-sdk/blob/08fa7aeb3b0c68ddb6c7ea797d114d55d36d36b1/src/main/java/com/hellosign/sdk/http/HttpClient.java#L273-L283 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/support/BasePool.java | BasePool.unknownStackTrace | static <T extends Throwable> T unknownStackTrace(T cause, Class<?> clazz, String method) {
"""
Set the {@link StackTraceElement} for the given {@link Throwable}, using the {@link Class} and method name.
"""
cause.setStackTrace(new StackTraceElement[] { new StackTraceElement(clazz.getName(), method, null, -1) });
return cause;
} | java | static <T extends Throwable> T unknownStackTrace(T cause, Class<?> clazz, String method) {
cause.setStackTrace(new StackTraceElement[] { new StackTraceElement(clazz.getName(), method, null, -1) });
return cause;
} | [
"static",
"<",
"T",
"extends",
"Throwable",
">",
"T",
"unknownStackTrace",
"(",
"T",
"cause",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"method",
")",
"{",
"cause",
".",
"setStackTrace",
"(",
"new",
"StackTraceElement",
"[",
"]",
"{",
"new",
"StackTraceElement",
"(",
"clazz",
".",
"getName",
"(",
")",
",",
"method",
",",
"null",
",",
"-",
"1",
")",
"}",
")",
";",
"return",
"cause",
";",
"}"
]
| Set the {@link StackTraceElement} for the given {@link Throwable}, using the {@link Class} and method name. | [
"Set",
"the",
"{"
]
| train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/support/BasePool.java#L83-L86 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/exceptions/MessageUtils.java | MessageUtils.buildMessage | static String buildMessage(BeanResolutionContext resolutionContext, FieldInjectionPoint fieldInjectionPoint, String message, boolean circular) {
"""
Builds an appropriate error message.
@param resolutionContext The resolution context
@param fieldInjectionPoint The injection point
@param message The message
@param circular Is the path circular
@return The message
"""
StringBuilder builder = new StringBuilder("Failed to inject value for field [");
String ls = System.getProperty("line.separator");
builder
.append(fieldInjectionPoint.getName()).append("] of class: ")
.append(fieldInjectionPoint.getDeclaringBean().getName())
.append(ls)
.append(ls);
if (message != null) {
builder.append("Message: ").append(message).append(ls);
}
appendPath(resolutionContext, circular, builder, ls);
return builder.toString();
} | java | static String buildMessage(BeanResolutionContext resolutionContext, FieldInjectionPoint fieldInjectionPoint, String message, boolean circular) {
StringBuilder builder = new StringBuilder("Failed to inject value for field [");
String ls = System.getProperty("line.separator");
builder
.append(fieldInjectionPoint.getName()).append("] of class: ")
.append(fieldInjectionPoint.getDeclaringBean().getName())
.append(ls)
.append(ls);
if (message != null) {
builder.append("Message: ").append(message).append(ls);
}
appendPath(resolutionContext, circular, builder, ls);
return builder.toString();
} | [
"static",
"String",
"buildMessage",
"(",
"BeanResolutionContext",
"resolutionContext",
",",
"FieldInjectionPoint",
"fieldInjectionPoint",
",",
"String",
"message",
",",
"boolean",
"circular",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
"\"Failed to inject value for field [\"",
")",
";",
"String",
"ls",
"=",
"System",
".",
"getProperty",
"(",
"\"line.separator\"",
")",
";",
"builder",
".",
"append",
"(",
"fieldInjectionPoint",
".",
"getName",
"(",
")",
")",
".",
"append",
"(",
"\"] of class: \"",
")",
".",
"append",
"(",
"fieldInjectionPoint",
".",
"getDeclaringBean",
"(",
")",
".",
"getName",
"(",
")",
")",
".",
"append",
"(",
"ls",
")",
".",
"append",
"(",
"ls",
")",
";",
"if",
"(",
"message",
"!=",
"null",
")",
"{",
"builder",
".",
"append",
"(",
"\"Message: \"",
")",
".",
"append",
"(",
"message",
")",
".",
"append",
"(",
"ls",
")",
";",
"}",
"appendPath",
"(",
"resolutionContext",
",",
"circular",
",",
"builder",
",",
"ls",
")",
";",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
]
| Builds an appropriate error message.
@param resolutionContext The resolution context
@param fieldInjectionPoint The injection point
@param message The message
@param circular Is the path circular
@return The message | [
"Builds",
"an",
"appropriate",
"error",
"message",
"."
]
| train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/exceptions/MessageUtils.java#L104-L118 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java | TheMovieDbApi.modifyFavoriteStatus | public StatusCode modifyFavoriteStatus(String sessionId, int accountId, Integer mediaId, MediaType mediaType, boolean isFavorite) throws MovieDbException {
"""
Add or remove a movie to an accounts favourite list.
@param sessionId sessionId
@param accountId accountId
@param mediaId mediaId
@param mediaType mediaType
@param isFavorite isFavorite
@return StatusCode
@throws MovieDbException exception
"""
return tmdbAccount.modifyFavoriteStatus(sessionId, accountId, mediaType, mediaId, isFavorite);
} | java | public StatusCode modifyFavoriteStatus(String sessionId, int accountId, Integer mediaId, MediaType mediaType, boolean isFavorite) throws MovieDbException {
return tmdbAccount.modifyFavoriteStatus(sessionId, accountId, mediaType, mediaId, isFavorite);
} | [
"public",
"StatusCode",
"modifyFavoriteStatus",
"(",
"String",
"sessionId",
",",
"int",
"accountId",
",",
"Integer",
"mediaId",
",",
"MediaType",
"mediaType",
",",
"boolean",
"isFavorite",
")",
"throws",
"MovieDbException",
"{",
"return",
"tmdbAccount",
".",
"modifyFavoriteStatus",
"(",
"sessionId",
",",
"accountId",
",",
"mediaType",
",",
"mediaId",
",",
"isFavorite",
")",
";",
"}"
]
| Add or remove a movie to an accounts favourite list.
@param sessionId sessionId
@param accountId accountId
@param mediaId mediaId
@param mediaType mediaType
@param isFavorite isFavorite
@return StatusCode
@throws MovieDbException exception | [
"Add",
"or",
"remove",
"a",
"movie",
"to",
"an",
"accounts",
"favourite",
"list",
"."
]
| train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L234-L236 |
sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java | ImageUtils.createImage | public static BufferedImage createImage(ImageProducer producer) {
"""
Cretae a BufferedImage from an ImageProducer.
@param producer the ImageProducer
@return a new TYPE_INT_ARGB BufferedImage
"""
PixelGrabber pg = new PixelGrabber(producer, 0, 0, -1, -1, null, 0, 0);
try {
pg.grabPixels();
} catch (InterruptedException e) {
throw new RuntimeException("Image fetch interrupted");
}
if ((pg.status() & ImageObserver.ABORT) != 0)
throw new RuntimeException("Image fetch aborted");
if ((pg.status() & ImageObserver.ERROR) != 0)
throw new RuntimeException("Image fetch error");
BufferedImage p = new BufferedImage(pg.getWidth(), pg.getHeight(), BufferedImage.TYPE_INT_ARGB);
p.setRGB(0, 0, pg.getWidth(), pg.getHeight(), (int[])pg.getPixels(), 0, pg.getWidth());
return p;
} | java | public static BufferedImage createImage(ImageProducer producer) {
PixelGrabber pg = new PixelGrabber(producer, 0, 0, -1, -1, null, 0, 0);
try {
pg.grabPixels();
} catch (InterruptedException e) {
throw new RuntimeException("Image fetch interrupted");
}
if ((pg.status() & ImageObserver.ABORT) != 0)
throw new RuntimeException("Image fetch aborted");
if ((pg.status() & ImageObserver.ERROR) != 0)
throw new RuntimeException("Image fetch error");
BufferedImage p = new BufferedImage(pg.getWidth(), pg.getHeight(), BufferedImage.TYPE_INT_ARGB);
p.setRGB(0, 0, pg.getWidth(), pg.getHeight(), (int[])pg.getPixels(), 0, pg.getWidth());
return p;
} | [
"public",
"static",
"BufferedImage",
"createImage",
"(",
"ImageProducer",
"producer",
")",
"{",
"PixelGrabber",
"pg",
"=",
"new",
"PixelGrabber",
"(",
"producer",
",",
"0",
",",
"0",
",",
"-",
"1",
",",
"-",
"1",
",",
"null",
",",
"0",
",",
"0",
")",
";",
"try",
"{",
"pg",
".",
"grabPixels",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Image fetch interrupted\"",
")",
";",
"}",
"if",
"(",
"(",
"pg",
".",
"status",
"(",
")",
"&",
"ImageObserver",
".",
"ABORT",
")",
"!=",
"0",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"Image fetch aborted\"",
")",
";",
"if",
"(",
"(",
"pg",
".",
"status",
"(",
")",
"&",
"ImageObserver",
".",
"ERROR",
")",
"!=",
"0",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"Image fetch error\"",
")",
";",
"BufferedImage",
"p",
"=",
"new",
"BufferedImage",
"(",
"pg",
".",
"getWidth",
"(",
")",
",",
"pg",
".",
"getHeight",
"(",
")",
",",
"BufferedImage",
".",
"TYPE_INT_ARGB",
")",
";",
"p",
".",
"setRGB",
"(",
"0",
",",
"0",
",",
"pg",
".",
"getWidth",
"(",
")",
",",
"pg",
".",
"getHeight",
"(",
")",
",",
"(",
"int",
"[",
"]",
")",
"pg",
".",
"getPixels",
"(",
")",
",",
"0",
",",
"pg",
".",
"getWidth",
"(",
")",
")",
";",
"return",
"p",
";",
"}"
]
| Cretae a BufferedImage from an ImageProducer.
@param producer the ImageProducer
@return a new TYPE_INT_ARGB BufferedImage | [
"Cretae",
"a",
"BufferedImage",
"from",
"an",
"ImageProducer",
"."
]
| train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java#L35-L49 |
Netflix/conductor | redis-persistence/src/main/java/com/netflix/conductor/dao/dynomite/RedisExecutionDAO.java | RedisExecutionDAO.insertOrUpdateWorkflow | private String insertOrUpdateWorkflow(Workflow workflow, boolean update) {
"""
Inserts a new workflow/ updates an existing workflow in the datastore.
Additionally, if a workflow is in terminal state, it is removed from the set of pending workflows.
@param workflow the workflow instance
@param update flag to identify if update or create operation
@return the workflowId
"""
Preconditions.checkNotNull(workflow, "workflow object cannot be null");
if (workflow.getStatus().isTerminal()) {
workflow.setEndTime(System.currentTimeMillis());
}
List<Task> tasks = workflow.getTasks();
workflow.setTasks(new LinkedList<>());
String payload = toJson(workflow);
// Store the workflow object
dynoClient.set(nsKey(WORKFLOW, workflow.getWorkflowId()), payload);
recordRedisDaoRequests("storeWorkflow", "n/a", workflow.getWorkflowName());
recordRedisDaoPayloadSize("storeWorkflow", payload.length(), "n/a", workflow.getWorkflowName());
if (!update) {
// Add to list of workflows for a workflowdef
String key = nsKey(WORKFLOW_DEF_TO_WORKFLOWS, workflow.getWorkflowName(), dateStr(workflow.getCreateTime()));
dynoClient.sadd(key, workflow.getWorkflowId());
if (workflow.getCorrelationId() != null) {
// Add to list of workflows for a correlationId
dynoClient.sadd(nsKey(CORR_ID_TO_WORKFLOWS, workflow.getCorrelationId()), workflow.getWorkflowId());
}
}
// Add or remove from the pending workflows
if (workflow.getStatus().isTerminal()) {
dynoClient.srem(nsKey(PENDING_WORKFLOWS, workflow.getWorkflowName()), workflow.getWorkflowId());
} else {
dynoClient.sadd(nsKey(PENDING_WORKFLOWS, workflow.getWorkflowName()), workflow.getWorkflowId());
}
workflow.setTasks(tasks);
return workflow.getWorkflowId();
} | java | private String insertOrUpdateWorkflow(Workflow workflow, boolean update) {
Preconditions.checkNotNull(workflow, "workflow object cannot be null");
if (workflow.getStatus().isTerminal()) {
workflow.setEndTime(System.currentTimeMillis());
}
List<Task> tasks = workflow.getTasks();
workflow.setTasks(new LinkedList<>());
String payload = toJson(workflow);
// Store the workflow object
dynoClient.set(nsKey(WORKFLOW, workflow.getWorkflowId()), payload);
recordRedisDaoRequests("storeWorkflow", "n/a", workflow.getWorkflowName());
recordRedisDaoPayloadSize("storeWorkflow", payload.length(), "n/a", workflow.getWorkflowName());
if (!update) {
// Add to list of workflows for a workflowdef
String key = nsKey(WORKFLOW_DEF_TO_WORKFLOWS, workflow.getWorkflowName(), dateStr(workflow.getCreateTime()));
dynoClient.sadd(key, workflow.getWorkflowId());
if (workflow.getCorrelationId() != null) {
// Add to list of workflows for a correlationId
dynoClient.sadd(nsKey(CORR_ID_TO_WORKFLOWS, workflow.getCorrelationId()), workflow.getWorkflowId());
}
}
// Add or remove from the pending workflows
if (workflow.getStatus().isTerminal()) {
dynoClient.srem(nsKey(PENDING_WORKFLOWS, workflow.getWorkflowName()), workflow.getWorkflowId());
} else {
dynoClient.sadd(nsKey(PENDING_WORKFLOWS, workflow.getWorkflowName()), workflow.getWorkflowId());
}
workflow.setTasks(tasks);
return workflow.getWorkflowId();
} | [
"private",
"String",
"insertOrUpdateWorkflow",
"(",
"Workflow",
"workflow",
",",
"boolean",
"update",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"workflow",
",",
"\"workflow object cannot be null\"",
")",
";",
"if",
"(",
"workflow",
".",
"getStatus",
"(",
")",
".",
"isTerminal",
"(",
")",
")",
"{",
"workflow",
".",
"setEndTime",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"}",
"List",
"<",
"Task",
">",
"tasks",
"=",
"workflow",
".",
"getTasks",
"(",
")",
";",
"workflow",
".",
"setTasks",
"(",
"new",
"LinkedList",
"<>",
"(",
")",
")",
";",
"String",
"payload",
"=",
"toJson",
"(",
"workflow",
")",
";",
"// Store the workflow object",
"dynoClient",
".",
"set",
"(",
"nsKey",
"(",
"WORKFLOW",
",",
"workflow",
".",
"getWorkflowId",
"(",
")",
")",
",",
"payload",
")",
";",
"recordRedisDaoRequests",
"(",
"\"storeWorkflow\"",
",",
"\"n/a\"",
",",
"workflow",
".",
"getWorkflowName",
"(",
")",
")",
";",
"recordRedisDaoPayloadSize",
"(",
"\"storeWorkflow\"",
",",
"payload",
".",
"length",
"(",
")",
",",
"\"n/a\"",
",",
"workflow",
".",
"getWorkflowName",
"(",
")",
")",
";",
"if",
"(",
"!",
"update",
")",
"{",
"// Add to list of workflows for a workflowdef",
"String",
"key",
"=",
"nsKey",
"(",
"WORKFLOW_DEF_TO_WORKFLOWS",
",",
"workflow",
".",
"getWorkflowName",
"(",
")",
",",
"dateStr",
"(",
"workflow",
".",
"getCreateTime",
"(",
")",
")",
")",
";",
"dynoClient",
".",
"sadd",
"(",
"key",
",",
"workflow",
".",
"getWorkflowId",
"(",
")",
")",
";",
"if",
"(",
"workflow",
".",
"getCorrelationId",
"(",
")",
"!=",
"null",
")",
"{",
"// Add to list of workflows for a correlationId",
"dynoClient",
".",
"sadd",
"(",
"nsKey",
"(",
"CORR_ID_TO_WORKFLOWS",
",",
"workflow",
".",
"getCorrelationId",
"(",
")",
")",
",",
"workflow",
".",
"getWorkflowId",
"(",
")",
")",
";",
"}",
"}",
"// Add or remove from the pending workflows",
"if",
"(",
"workflow",
".",
"getStatus",
"(",
")",
".",
"isTerminal",
"(",
")",
")",
"{",
"dynoClient",
".",
"srem",
"(",
"nsKey",
"(",
"PENDING_WORKFLOWS",
",",
"workflow",
".",
"getWorkflowName",
"(",
")",
")",
",",
"workflow",
".",
"getWorkflowId",
"(",
")",
")",
";",
"}",
"else",
"{",
"dynoClient",
".",
"sadd",
"(",
"nsKey",
"(",
"PENDING_WORKFLOWS",
",",
"workflow",
".",
"getWorkflowName",
"(",
")",
")",
",",
"workflow",
".",
"getWorkflowId",
"(",
")",
")",
";",
"}",
"workflow",
".",
"setTasks",
"(",
"tasks",
")",
";",
"return",
"workflow",
".",
"getWorkflowId",
"(",
")",
";",
"}"
]
| Inserts a new workflow/ updates an existing workflow in the datastore.
Additionally, if a workflow is in terminal state, it is removed from the set of pending workflows.
@param workflow the workflow instance
@param update flag to identify if update or create operation
@return the workflowId | [
"Inserts",
"a",
"new",
"workflow",
"/",
"updates",
"an",
"existing",
"workflow",
"in",
"the",
"datastore",
".",
"Additionally",
"if",
"a",
"workflow",
"is",
"in",
"terminal",
"state",
"it",
"is",
"removed",
"from",
"the",
"set",
"of",
"pending",
"workflows",
"."
]
| train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/redis-persistence/src/main/java/com/netflix/conductor/dao/dynomite/RedisExecutionDAO.java#L494-L526 |
EvidentSolutions/dalesbred | dalesbred/src/main/java/org/dalesbred/Database.java | Database.findUnique | public <T> T findUnique(@NotNull RowMapper<T> mapper, @NotNull @SQL String sql, Object... args) {
"""
Finds a unique result from database, using given {@link RowMapper} to convert the row.
@throws NonUniqueResultException if there is more then one row
@throws EmptyResultException if there are no rows
"""
return findUnique(mapper, SqlQuery.query(sql, args));
} | java | public <T> T findUnique(@NotNull RowMapper<T> mapper, @NotNull @SQL String sql, Object... args) {
return findUnique(mapper, SqlQuery.query(sql, args));
} | [
"public",
"<",
"T",
">",
"T",
"findUnique",
"(",
"@",
"NotNull",
"RowMapper",
"<",
"T",
">",
"mapper",
",",
"@",
"NotNull",
"@",
"SQL",
"String",
"sql",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"findUnique",
"(",
"mapper",
",",
"SqlQuery",
".",
"query",
"(",
"sql",
",",
"args",
")",
")",
";",
"}"
]
| Finds a unique result from database, using given {@link RowMapper} to convert the row.
@throws NonUniqueResultException if there is more then one row
@throws EmptyResultException if there are no rows | [
"Finds",
"a",
"unique",
"result",
"from",
"database",
"using",
"given",
"{",
"@link",
"RowMapper",
"}",
"to",
"convert",
"the",
"row",
"."
]
| train | https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/Database.java#L342-L344 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/reflect/json/Json.java | Json.makeStructureTypes | public static String makeStructureTypes( String nameForStructure, Bindings bindings, boolean mutable ) {
"""
Makes a tree of structure types reflecting the Bindings.
<p>
A structure type contains a property member for each name/value pair in the Bindings. A property has the same name as the key and follows these rules:
<ul>
<li> If the type of the value is a "simple" type, such as a String or Integer, the type of the property matches the simple type exactly
<li> Otherwise, if the value is a Bindings type, the property type is that of a child structure with the same name as the property and recursively follows these rules
<li> Otherwise, if the value is a List, the property is a List parameterized with the component type, and the component type recursively follows these rules
</ul>
"""
JsonStructureType type = (JsonStructureType)transformJsonObject( nameForStructure, null, bindings );
StringBuilder sb = new StringBuilder();
type.render( sb, 0, mutable );
return sb.toString();
} | java | public static String makeStructureTypes( String nameForStructure, Bindings bindings, boolean mutable )
{
JsonStructureType type = (JsonStructureType)transformJsonObject( nameForStructure, null, bindings );
StringBuilder sb = new StringBuilder();
type.render( sb, 0, mutable );
return sb.toString();
} | [
"public",
"static",
"String",
"makeStructureTypes",
"(",
"String",
"nameForStructure",
",",
"Bindings",
"bindings",
",",
"boolean",
"mutable",
")",
"{",
"JsonStructureType",
"type",
"=",
"(",
"JsonStructureType",
")",
"transformJsonObject",
"(",
"nameForStructure",
",",
"null",
",",
"bindings",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"type",
".",
"render",
"(",
"sb",
",",
"0",
",",
"mutable",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
]
| Makes a tree of structure types reflecting the Bindings.
<p>
A structure type contains a property member for each name/value pair in the Bindings. A property has the same name as the key and follows these rules:
<ul>
<li> If the type of the value is a "simple" type, such as a String or Integer, the type of the property matches the simple type exactly
<li> Otherwise, if the value is a Bindings type, the property type is that of a child structure with the same name as the property and recursively follows these rules
<li> Otherwise, if the value is a List, the property is a List parameterized with the component type, and the component type recursively follows these rules
</ul> | [
"Makes",
"a",
"tree",
"of",
"structure",
"types",
"reflecting",
"the",
"Bindings",
".",
"<p",
">",
"A",
"structure",
"type",
"contains",
"a",
"property",
"member",
"for",
"each",
"name",
"/",
"value",
"pair",
"in",
"the",
"Bindings",
".",
"A",
"property",
"has",
"the",
"same",
"name",
"as",
"the",
"key",
"and",
"follows",
"these",
"rules",
":",
"<ul",
">",
"<li",
">",
"If",
"the",
"type",
"of",
"the",
"value",
"is",
"a",
"simple",
"type",
"such",
"as",
"a",
"String",
"or",
"Integer",
"the",
"type",
"of",
"the",
"property",
"matches",
"the",
"simple",
"type",
"exactly",
"<li",
">",
"Otherwise",
"if",
"the",
"value",
"is",
"a",
"Bindings",
"type",
"the",
"property",
"type",
"is",
"that",
"of",
"a",
"child",
"structure",
"with",
"the",
"same",
"name",
"as",
"the",
"property",
"and",
"recursively",
"follows",
"these",
"rules",
"<li",
">",
"Otherwise",
"if",
"the",
"value",
"is",
"a",
"List",
"the",
"property",
"is",
"a",
"List",
"parameterized",
"with",
"the",
"component",
"type",
"and",
"the",
"component",
"type",
"recursively",
"follows",
"these",
"rules",
"<",
"/",
"ul",
">"
]
| train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/reflect/json/Json.java#L78-L84 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java | TheMovieDbApi.getEpisodeAccountState | public MediaState getEpisodeAccountState(int tvID, int seasonNumber, int episodeNumber, String sessionID) throws MovieDbException {
"""
This method lets users get the status of whether or not the TV episode
has been rated.
A valid session id is required.
@param tvID tvID
@param seasonNumber seasonNumber
@param episodeNumber episodeNumber
@param sessionID sessionID
@return
@throws MovieDbException exception
"""
return tmdbEpisodes.getEpisodeAccountState(tvID, seasonNumber, episodeNumber, sessionID);
} | java | public MediaState getEpisodeAccountState(int tvID, int seasonNumber, int episodeNumber, String sessionID) throws MovieDbException {
return tmdbEpisodes.getEpisodeAccountState(tvID, seasonNumber, episodeNumber, sessionID);
} | [
"public",
"MediaState",
"getEpisodeAccountState",
"(",
"int",
"tvID",
",",
"int",
"seasonNumber",
",",
"int",
"episodeNumber",
",",
"String",
"sessionID",
")",
"throws",
"MovieDbException",
"{",
"return",
"tmdbEpisodes",
".",
"getEpisodeAccountState",
"(",
"tvID",
",",
"seasonNumber",
",",
"episodeNumber",
",",
"sessionID",
")",
";",
"}"
]
| This method lets users get the status of whether or not the TV episode
has been rated.
A valid session id is required.
@param tvID tvID
@param seasonNumber seasonNumber
@param episodeNumber episodeNumber
@param sessionID sessionID
@return
@throws MovieDbException exception | [
"This",
"method",
"lets",
"users",
"get",
"the",
"status",
"of",
"whether",
"or",
"not",
"the",
"TV",
"episode",
"has",
"been",
"rated",
"."
]
| train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1802-L1804 |
Samsung/GearVRf | GVRf/Extensions/3DCursor/IODevices/io_hand_template/src/main/java/com/sample/hand/template/IOHand.java | IOHand.addSceneObject | public void addSceneObject(int key, GVRSceneObject sceneObject) {
"""
Add a {@link GVRSceneObject} to this {@link IOHand}
@param key an int value that uniquely helps identify this {@link GVRSceneObject}.
So that
it can easily be looked up later on.
@param sceneObject {@link GVRSceneObject} that is to be added.
"""
// only add if not present
if (!auxSceneObjects.containsKey(key)) {
auxSceneObjects.put(key, sceneObject);
handSceneObject.addChildObject(sceneObject);
}
} | java | public void addSceneObject(int key, GVRSceneObject sceneObject) {
// only add if not present
if (!auxSceneObjects.containsKey(key)) {
auxSceneObjects.put(key, sceneObject);
handSceneObject.addChildObject(sceneObject);
}
} | [
"public",
"void",
"addSceneObject",
"(",
"int",
"key",
",",
"GVRSceneObject",
"sceneObject",
")",
"{",
"// only add if not present",
"if",
"(",
"!",
"auxSceneObjects",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"auxSceneObjects",
".",
"put",
"(",
"key",
",",
"sceneObject",
")",
";",
"handSceneObject",
".",
"addChildObject",
"(",
"sceneObject",
")",
";",
"}",
"}"
]
| Add a {@link GVRSceneObject} to this {@link IOHand}
@param key an int value that uniquely helps identify this {@link GVRSceneObject}.
So that
it can easily be looked up later on.
@param sceneObject {@link GVRSceneObject} that is to be added. | [
"Add",
"a",
"{",
"@link",
"GVRSceneObject",
"}",
"to",
"this",
"{",
"@link",
"IOHand",
"}"
]
| train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/IODevices/io_hand_template/src/main/java/com/sample/hand/template/IOHand.java#L77-L83 |
alkacon/opencms-core | src/org/opencms/widgets/dataview/CmsDataViewFilter.java | CmsDataViewFilter.copyWithValue | public CmsDataViewFilter copyWithValue(String value) {
"""
Creates a copy of the filter, but uses a different filter value for the copy.<p>
@param value the filter value for the copy
@return the copied filter
"""
return new CmsDataViewFilter(m_id, m_niceName, m_helpText, m_options, value);
} | java | public CmsDataViewFilter copyWithValue(String value) {
return new CmsDataViewFilter(m_id, m_niceName, m_helpText, m_options, value);
} | [
"public",
"CmsDataViewFilter",
"copyWithValue",
"(",
"String",
"value",
")",
"{",
"return",
"new",
"CmsDataViewFilter",
"(",
"m_id",
",",
"m_niceName",
",",
"m_helpText",
",",
"m_options",
",",
"value",
")",
";",
"}"
]
| Creates a copy of the filter, but uses a different filter value for the copy.<p>
@param value the filter value for the copy
@return the copied filter | [
"Creates",
"a",
"copy",
"of",
"the",
"filter",
"but",
"uses",
"a",
"different",
"filter",
"value",
"for",
"the",
"copy",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/dataview/CmsDataViewFilter.java#L105-L108 |
google/closure-compiler | src/com/google/javascript/jscomp/PassConfig.java | PassConfig.regenerateGlobalTypedScope | void regenerateGlobalTypedScope(AbstractCompiler compiler, Node root) {
"""
Regenerates the top scope from scratch.
@param compiler The compiler for which the global scope is regenerated.
@param root The root of the AST.
"""
typedScopeCreator = new TypedScopeCreator(compiler);
topScope = typedScopeCreator.createScope(root, null);
} | java | void regenerateGlobalTypedScope(AbstractCompiler compiler, Node root) {
typedScopeCreator = new TypedScopeCreator(compiler);
topScope = typedScopeCreator.createScope(root, null);
} | [
"void",
"regenerateGlobalTypedScope",
"(",
"AbstractCompiler",
"compiler",
",",
"Node",
"root",
")",
"{",
"typedScopeCreator",
"=",
"new",
"TypedScopeCreator",
"(",
"compiler",
")",
";",
"topScope",
"=",
"typedScopeCreator",
".",
"createScope",
"(",
"root",
",",
"null",
")",
";",
"}"
]
| Regenerates the top scope from scratch.
@param compiler The compiler for which the global scope is regenerated.
@param root The root of the AST. | [
"Regenerates",
"the",
"top",
"scope",
"from",
"scratch",
"."
]
| train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PassConfig.java#L53-L56 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java | JacksonUtils.asDate | public static Date asDate(JsonNode node, String dateTimeFormat) {
"""
Extract value from a {@link JsonNode} as a date. If the extracted value is string, parse it
as {@link Date} using the specified date-time format.
@param node
@param dateTimeFormat
@return
@since 0.6.3.3
"""
return node != null ? ValueUtils.convertDate(node, dateTimeFormat) : null;
} | java | public static Date asDate(JsonNode node, String dateTimeFormat) {
return node != null ? ValueUtils.convertDate(node, dateTimeFormat) : null;
} | [
"public",
"static",
"Date",
"asDate",
"(",
"JsonNode",
"node",
",",
"String",
"dateTimeFormat",
")",
"{",
"return",
"node",
"!=",
"null",
"?",
"ValueUtils",
".",
"convertDate",
"(",
"node",
",",
"dateTimeFormat",
")",
":",
"null",
";",
"}"
]
| Extract value from a {@link JsonNode} as a date. If the extracted value is string, parse it
as {@link Date} using the specified date-time format.
@param node
@param dateTimeFormat
@return
@since 0.6.3.3 | [
"Extract",
"value",
"from",
"a",
"{",
"@link",
"JsonNode",
"}",
"as",
"a",
"date",
".",
"If",
"the",
"extracted",
"value",
"is",
"string",
"parse",
"it",
"as",
"{",
"@link",
"Date",
"}",
"using",
"the",
"specified",
"date",
"-",
"time",
"format",
"."
]
| train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java#L204-L206 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/document/RtfDocumentSettings.java | RtfDocumentSettings.setNewPassword | public boolean setNewPassword(String oldPwd, String newPwd) {
"""
Author: Howard Shank ([email protected])
@param oldPwd Old password - clear text
@param newPwd New password - clear text
@return true if password set, false if password not set
@since 2.1.1
"""
boolean result = false;
if (this.protectionHash.equals(RtfProtection.generateHash(oldPwd))) {
this.protectionHash = RtfProtection.generateHash(newPwd);
result = true;
}
return result;
} | java | public boolean setNewPassword(String oldPwd, String newPwd) {
boolean result = false;
if (this.protectionHash.equals(RtfProtection.generateHash(oldPwd))) {
this.protectionHash = RtfProtection.generateHash(newPwd);
result = true;
}
return result;
} | [
"public",
"boolean",
"setNewPassword",
"(",
"String",
"oldPwd",
",",
"String",
"newPwd",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"this",
".",
"protectionHash",
".",
"equals",
"(",
"RtfProtection",
".",
"generateHash",
"(",
"oldPwd",
")",
")",
")",
"{",
"this",
".",
"protectionHash",
"=",
"RtfProtection",
".",
"generateHash",
"(",
"newPwd",
")",
";",
"result",
"=",
"true",
";",
"}",
"return",
"result",
";",
"}"
]
| Author: Howard Shank ([email protected])
@param oldPwd Old password - clear text
@param newPwd New password - clear text
@return true if password set, false if password not set
@since 2.1.1 | [
"Author",
":",
"Howard",
"Shank",
"(",
"hgshank"
]
| train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/document/RtfDocumentSettings.java#L498-L505 |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/utils/JsonUtils.java | JsonUtils.writePrettyPrint | public static void writePrettyPrint(Writer writer, Object jsonObject)
throws JsonGenerationException, IOException {
"""
Writes the given JSON-LD Object out to the given Writer, using
indentation and new lines to improve readability.
@param writer
The writer that is to receive the serialized JSON-LD object.
@param jsonObject
The JSON-LD Object to serialize.
@throws JsonGenerationException
If there is a JSON error during serialization.
@throws IOException
If there is an IO error during serialization.
"""
final JsonGenerator jw = JSON_FACTORY.createGenerator(writer);
jw.useDefaultPrettyPrinter();
jw.writeObject(jsonObject);
} | java | public static void writePrettyPrint(Writer writer, Object jsonObject)
throws JsonGenerationException, IOException {
final JsonGenerator jw = JSON_FACTORY.createGenerator(writer);
jw.useDefaultPrettyPrinter();
jw.writeObject(jsonObject);
} | [
"public",
"static",
"void",
"writePrettyPrint",
"(",
"Writer",
"writer",
",",
"Object",
"jsonObject",
")",
"throws",
"JsonGenerationException",
",",
"IOException",
"{",
"final",
"JsonGenerator",
"jw",
"=",
"JSON_FACTORY",
".",
"createGenerator",
"(",
"writer",
")",
";",
"jw",
".",
"useDefaultPrettyPrinter",
"(",
")",
";",
"jw",
".",
"writeObject",
"(",
"jsonObject",
")",
";",
"}"
]
| Writes the given JSON-LD Object out to the given Writer, using
indentation and new lines to improve readability.
@param writer
The writer that is to receive the serialized JSON-LD object.
@param jsonObject
The JSON-LD Object to serialize.
@throws JsonGenerationException
If there is a JSON error during serialization.
@throws IOException
If there is an IO error during serialization. | [
"Writes",
"the",
"given",
"JSON",
"-",
"LD",
"Object",
"out",
"to",
"the",
"given",
"Writer",
"using",
"indentation",
"and",
"new",
"lines",
"to",
"improve",
"readability",
"."
]
| train | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/utils/JsonUtils.java#L311-L316 |
vdurmont/emoji-java | src/main/java/com/vdurmont/emoji/EmojiParser.java | EmojiParser.removeAllEmojis | public static String removeAllEmojis(String str) {
"""
Removes all emojis from a String
@param str the string to process
@return the string without any emoji
"""
EmojiTransformer emojiTransformer = new EmojiTransformer() {
public String transform(UnicodeCandidate unicodeCandidate) {
return "";
}
};
return parseFromUnicode(str, emojiTransformer);
} | java | public static String removeAllEmojis(String str) {
EmojiTransformer emojiTransformer = new EmojiTransformer() {
public String transform(UnicodeCandidate unicodeCandidate) {
return "";
}
};
return parseFromUnicode(str, emojiTransformer);
} | [
"public",
"static",
"String",
"removeAllEmojis",
"(",
"String",
"str",
")",
"{",
"EmojiTransformer",
"emojiTransformer",
"=",
"new",
"EmojiTransformer",
"(",
")",
"{",
"public",
"String",
"transform",
"(",
"UnicodeCandidate",
"unicodeCandidate",
")",
"{",
"return",
"\"\"",
";",
"}",
"}",
";",
"return",
"parseFromUnicode",
"(",
"str",
",",
"emojiTransformer",
")",
";",
"}"
]
| Removes all emojis from a String
@param str the string to process
@return the string without any emoji | [
"Removes",
"all",
"emojis",
"from",
"a",
"String"
]
| train | https://github.com/vdurmont/emoji-java/blob/8cf5fbe0d7c1020b926791f2b342a263ed07bb0f/src/main/java/com/vdurmont/emoji/EmojiParser.java#L289-L297 |
NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java | DfuServiceInitiator.setBinOrHex | @Deprecated
public DfuServiceInitiator setBinOrHex(@FileType final int fileType, @RawRes final int rawResId) {
"""
Sets the resource ID pointing the BIN or HEX file containing the new firmware.
The file should be in the /res/raw folder. For DFU Bootloader version 0.5 or newer the init
file must be specified using one of {@link #setInitFile(int)} methods.
@param fileType see {@link #setBinOrHex(int, Uri)} for details
@param rawResId resource ID
@return the builder
"""
if (fileType == DfuBaseService.TYPE_AUTO)
throw new UnsupportedOperationException("You must specify the file type");
return init(null, null, rawResId, fileType, DfuBaseService.MIME_TYPE_OCTET_STREAM);
} | java | @Deprecated
public DfuServiceInitiator setBinOrHex(@FileType final int fileType, @RawRes final int rawResId) {
if (fileType == DfuBaseService.TYPE_AUTO)
throw new UnsupportedOperationException("You must specify the file type");
return init(null, null, rawResId, fileType, DfuBaseService.MIME_TYPE_OCTET_STREAM);
} | [
"@",
"Deprecated",
"public",
"DfuServiceInitiator",
"setBinOrHex",
"(",
"@",
"FileType",
"final",
"int",
"fileType",
",",
"@",
"RawRes",
"final",
"int",
"rawResId",
")",
"{",
"if",
"(",
"fileType",
"==",
"DfuBaseService",
".",
"TYPE_AUTO",
")",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"You must specify the file type\"",
")",
";",
"return",
"init",
"(",
"null",
",",
"null",
",",
"rawResId",
",",
"fileType",
",",
"DfuBaseService",
".",
"MIME_TYPE_OCTET_STREAM",
")",
";",
"}"
]
| Sets the resource ID pointing the BIN or HEX file containing the new firmware.
The file should be in the /res/raw folder. For DFU Bootloader version 0.5 or newer the init
file must be specified using one of {@link #setInitFile(int)} methods.
@param fileType see {@link #setBinOrHex(int, Uri)} for details
@param rawResId resource ID
@return the builder | [
"Sets",
"the",
"resource",
"ID",
"pointing",
"the",
"BIN",
"or",
"HEX",
"file",
"containing",
"the",
"new",
"firmware",
".",
"The",
"file",
"should",
"be",
"in",
"the",
"/",
"res",
"/",
"raw",
"folder",
".",
"For",
"DFU",
"Bootloader",
"version",
"0",
".",
"5",
"or",
"newer",
"the",
"init",
"file",
"must",
"be",
"specified",
"using",
"one",
"of",
"{",
"@link",
"#setInitFile",
"(",
"int",
")",
"}",
"methods",
"."
]
| train | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java#L672-L677 |
beangle/beangle3 | commons/model/src/main/java/org/beangle/commons/entity/util/HierarchyEntityUtils.java | HierarchyEntityUtils.sort | public static <T extends HierarchyEntity<T, ?>> Map<T, String> sort(List<T> datas, String property) {
"""
按照上下关系和指定属性排序
@param datas a {@link java.util.List} object.
@param property a {@link java.lang.String} object.
@param <T> a T object.
@return a {@link java.util.Map} object.
"""
final Map<T, String> sortedMap = tag(datas, property);
Collections.sort(datas, new Comparator<HierarchyEntity<T, ?>>() {
public int compare(HierarchyEntity<T, ?> arg0, HierarchyEntity<T, ?> arg1) {
String tag0 = sortedMap.get(arg0);
String tag1 = sortedMap.get(arg1);
return tag0.compareTo(tag1);
}
});
return sortedMap;
} | java | public static <T extends HierarchyEntity<T, ?>> Map<T, String> sort(List<T> datas, String property) {
final Map<T, String> sortedMap = tag(datas, property);
Collections.sort(datas, new Comparator<HierarchyEntity<T, ?>>() {
public int compare(HierarchyEntity<T, ?> arg0, HierarchyEntity<T, ?> arg1) {
String tag0 = sortedMap.get(arg0);
String tag1 = sortedMap.get(arg1);
return tag0.compareTo(tag1);
}
});
return sortedMap;
} | [
"public",
"static",
"<",
"T",
"extends",
"HierarchyEntity",
"<",
"T",
",",
"?",
">",
">",
"Map",
"<",
"T",
",",
"String",
">",
"sort",
"(",
"List",
"<",
"T",
">",
"datas",
",",
"String",
"property",
")",
"{",
"final",
"Map",
"<",
"T",
",",
"String",
">",
"sortedMap",
"=",
"tag",
"(",
"datas",
",",
"property",
")",
";",
"Collections",
".",
"sort",
"(",
"datas",
",",
"new",
"Comparator",
"<",
"HierarchyEntity",
"<",
"T",
",",
"?",
">",
">",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"HierarchyEntity",
"<",
"T",
",",
"?",
">",
"arg0",
",",
"HierarchyEntity",
"<",
"T",
",",
"?",
">",
"arg1",
")",
"{",
"String",
"tag0",
"=",
"sortedMap",
".",
"get",
"(",
"arg0",
")",
";",
"String",
"tag1",
"=",
"sortedMap",
".",
"get",
"(",
"arg1",
")",
";",
"return",
"tag0",
".",
"compareTo",
"(",
"tag1",
")",
";",
"}",
"}",
")",
";",
"return",
"sortedMap",
";",
"}"
]
| 按照上下关系和指定属性排序
@param datas a {@link java.util.List} object.
@param property a {@link java.lang.String} object.
@param <T> a T object.
@return a {@link java.util.Map} object. | [
"按照上下关系和指定属性排序"
]
| train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/model/src/main/java/org/beangle/commons/entity/util/HierarchyEntityUtils.java#L90-L100 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/Topic.java | Topic.setScores | public void setScores(int i, double v) {
"""
indexed setter for scores - sets an indexed value -
@generated
@param i index in the array to set
@param v value to set into the array
"""
if (Topic_Type.featOkTst && ((Topic_Type)jcasType).casFeat_scores == null)
jcasType.jcas.throwFeatMissing("scores", "ch.epfl.bbp.uima.types.Topic");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Topic_Type)jcasType).casFeatCode_scores), i);
jcasType.ll_cas.ll_setDoubleArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Topic_Type)jcasType).casFeatCode_scores), i, v);} | java | public void setScores(int i, double v) {
if (Topic_Type.featOkTst && ((Topic_Type)jcasType).casFeat_scores == null)
jcasType.jcas.throwFeatMissing("scores", "ch.epfl.bbp.uima.types.Topic");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Topic_Type)jcasType).casFeatCode_scores), i);
jcasType.ll_cas.ll_setDoubleArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Topic_Type)jcasType).casFeatCode_scores), i, v);} | [
"public",
"void",
"setScores",
"(",
"int",
"i",
",",
"double",
"v",
")",
"{",
"if",
"(",
"Topic_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"Topic_Type",
")",
"jcasType",
")",
".",
"casFeat_scores",
"==",
"null",
")",
"jcasType",
".",
"jcas",
".",
"throwFeatMissing",
"(",
"\"scores\"",
",",
"\"ch.epfl.bbp.uima.types.Topic\"",
")",
";",
"jcasType",
".",
"jcas",
".",
"checkArrayBounds",
"(",
"jcasType",
".",
"ll_cas",
".",
"ll_getRefValue",
"(",
"addr",
",",
"(",
"(",
"Topic_Type",
")",
"jcasType",
")",
".",
"casFeatCode_scores",
")",
",",
"i",
")",
";",
"jcasType",
".",
"ll_cas",
".",
"ll_setDoubleArrayValue",
"(",
"jcasType",
".",
"ll_cas",
".",
"ll_getRefValue",
"(",
"addr",
",",
"(",
"(",
"Topic_Type",
")",
"jcasType",
")",
".",
"casFeatCode_scores",
")",
",",
"i",
",",
"v",
")",
";",
"}"
]
| indexed setter for scores - sets an indexed value -
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"scores",
"-",
"sets",
"an",
"indexed",
"value",
"-"
]
| train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/Topic.java#L117-L121 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java | OdsElements.addAutofilter | public void addAutofilter(final Table table, final int r1, final int c1, final int r2, final int c2) {
"""
Add an autofilter to a table
@param table the table
@param r1 from row
@param c1 from col
@param r2 to row
@param c2 to col
"""
this.contentElement.addAutofilter(table, r1, c1, r2, c2);
} | java | public void addAutofilter(final Table table, final int r1, final int c1, final int r2, final int c2) {
this.contentElement.addAutofilter(table, r1, c1, r2, c2);
} | [
"public",
"void",
"addAutofilter",
"(",
"final",
"Table",
"table",
",",
"final",
"int",
"r1",
",",
"final",
"int",
"c1",
",",
"final",
"int",
"r2",
",",
"final",
"int",
"c2",
")",
"{",
"this",
".",
"contentElement",
".",
"addAutofilter",
"(",
"table",
",",
"r1",
",",
"c1",
",",
"r2",
",",
"c2",
")",
";",
"}"
]
| Add an autofilter to a table
@param table the table
@param r1 from row
@param c1 from col
@param r2 to row
@param c2 to col | [
"Add",
"an",
"autofilter",
"to",
"a",
"table"
]
| train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java#L438-L440 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getNotNull | @Nullable
public static CharSequence getNotNull (@Nullable final CharSequence s, final CharSequence sDefaultIfNull) {
"""
Get the passed {@link CharSequence} but never return <code>null</code>. If
the passed parameter is <code>null</code> the second parameter is returned.
@param s
The parameter to be not <code>null</code>.
@param sDefaultIfNull
The value to be used of the first parameter is <code>null</code>. May
be <code>null</code> but in this case the call to this method is
obsolete.
@return The passed default value if the string is <code>null</code>,
otherwise the input {@link CharSequence}.
"""
return s == null ? sDefaultIfNull : s;
} | java | @Nullable
public static CharSequence getNotNull (@Nullable final CharSequence s, final CharSequence sDefaultIfNull)
{
return s == null ? sDefaultIfNull : s;
} | [
"@",
"Nullable",
"public",
"static",
"CharSequence",
"getNotNull",
"(",
"@",
"Nullable",
"final",
"CharSequence",
"s",
",",
"final",
"CharSequence",
"sDefaultIfNull",
")",
"{",
"return",
"s",
"==",
"null",
"?",
"sDefaultIfNull",
":",
"s",
";",
"}"
]
| Get the passed {@link CharSequence} but never return <code>null</code>. If
the passed parameter is <code>null</code> the second parameter is returned.
@param s
The parameter to be not <code>null</code>.
@param sDefaultIfNull
The value to be used of the first parameter is <code>null</code>. May
be <code>null</code> but in this case the call to this method is
obsolete.
@return The passed default value if the string is <code>null</code>,
otherwise the input {@link CharSequence}. | [
"Get",
"the",
"passed",
"{",
"@link",
"CharSequence",
"}",
"but",
"never",
"return",
"<code",
">",
"null<",
"/",
"code",
">",
".",
"If",
"the",
"passed",
"parameter",
"is",
"<code",
">",
"null<",
"/",
"code",
">",
"the",
"second",
"parameter",
"is",
"returned",
"."
]
| train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L4562-L4566 |
JOML-CI/JOML | src/org/joml/Quaterniond.java | Quaterniond.fromAxisAngleRad | public Quaterniond fromAxisAngleRad(Vector3dc axis, double angle) {
"""
Set this quaternion to be a representation of the supplied axis and
angle (in radians).
@param axis
the rotation axis
@param angle
the angle in radians
@return this
"""
return fromAxisAngleRad(axis.x(), axis.y(), axis.z(), angle);
} | java | public Quaterniond fromAxisAngleRad(Vector3dc axis, double angle) {
return fromAxisAngleRad(axis.x(), axis.y(), axis.z(), angle);
} | [
"public",
"Quaterniond",
"fromAxisAngleRad",
"(",
"Vector3dc",
"axis",
",",
"double",
"angle",
")",
"{",
"return",
"fromAxisAngleRad",
"(",
"axis",
".",
"x",
"(",
")",
",",
"axis",
".",
"y",
"(",
")",
",",
"axis",
".",
"z",
"(",
")",
",",
"angle",
")",
";",
"}"
]
| Set this quaternion to be a representation of the supplied axis and
angle (in radians).
@param axis
the rotation axis
@param angle
the angle in radians
@return this | [
"Set",
"this",
"quaternion",
"to",
"be",
"a",
"representation",
"of",
"the",
"supplied",
"axis",
"and",
"angle",
"(",
"in",
"radians",
")",
"."
]
| train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaterniond.java#L647-L649 |
deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java | BaseTransport.shardMessageHandler | protected void shardMessageHandler(DirectBuffer buffer, int offset, int length, Header header) {
"""
This message handler is responsible for receiving messages on Shard side
@param buffer
@param offset
@param length
@param header
"""
/**
* All incoming messages here are supposed to be unicast messages.
*/
// TODO: implement fragmentation handler here PROBABLY. Or forbid messages > MTU?
//log.info("shardMessageHandler message request incoming...");
byte[] data = new byte[length];
buffer.getBytes(offset, data);
VoidMessage message = VoidMessage.fromBytes(data);
if (message.getMessageType() == 7) {
// if that's vector request message - it's special case, we don't send it to other shards yet
//log.info("Shortcut for vector request");
messages.add(message);
} else {
// and send it away to other Shards
publicationForShards.offer(buffer, offset, length);
}
} | java | protected void shardMessageHandler(DirectBuffer buffer, int offset, int length, Header header) {
/**
* All incoming messages here are supposed to be unicast messages.
*/
// TODO: implement fragmentation handler here PROBABLY. Or forbid messages > MTU?
//log.info("shardMessageHandler message request incoming...");
byte[] data = new byte[length];
buffer.getBytes(offset, data);
VoidMessage message = VoidMessage.fromBytes(data);
if (message.getMessageType() == 7) {
// if that's vector request message - it's special case, we don't send it to other shards yet
//log.info("Shortcut for vector request");
messages.add(message);
} else {
// and send it away to other Shards
publicationForShards.offer(buffer, offset, length);
}
} | [
"protected",
"void",
"shardMessageHandler",
"(",
"DirectBuffer",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
",",
"Header",
"header",
")",
"{",
"/**\n * All incoming messages here are supposed to be unicast messages.\n */",
"// TODO: implement fragmentation handler here PROBABLY. Or forbid messages > MTU?",
"//log.info(\"shardMessageHandler message request incoming...\");",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"length",
"]",
";",
"buffer",
".",
"getBytes",
"(",
"offset",
",",
"data",
")",
";",
"VoidMessage",
"message",
"=",
"VoidMessage",
".",
"fromBytes",
"(",
"data",
")",
";",
"if",
"(",
"message",
".",
"getMessageType",
"(",
")",
"==",
"7",
")",
"{",
"// if that's vector request message - it's special case, we don't send it to other shards yet",
"//log.info(\"Shortcut for vector request\");",
"messages",
".",
"add",
"(",
"message",
")",
";",
"}",
"else",
"{",
"// and send it away to other Shards",
"publicationForShards",
".",
"offer",
"(",
"buffer",
",",
"offset",
",",
"length",
")",
";",
"}",
"}"
]
| This message handler is responsible for receiving messages on Shard side
@param buffer
@param offset
@param length
@param header | [
"This",
"message",
"handler",
"is",
"responsible",
"for",
"receiving",
"messages",
"on",
"Shard",
"side"
]
| train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java#L220-L238 |
remkop/picocli | src/main/java/picocli/CommandLine.java | CommandLine.getCommandMethods | public static List<Method> getCommandMethods(Class<?> cls, String methodName) {
"""
Helper to get methods of a class annotated with {@link Command @Command} via reflection, optionally filtered by method name (not {@link Command#name() @Command.name}).
Methods have to be either public (inherited) members or be declared by {@code cls}, that is "inherited" static or protected methods will not be picked up.
@param cls the class to search for methods annotated with {@code @Command}
@param methodName if not {@code null}, return only methods whose method name (not {@link Command#name() @Command.name}) equals this string. Ignored if {@code null}.
@return the matching command methods, or an empty list
@see #invoke(String, Class, String...)
@since 3.6.0
"""
Set<Method> candidates = new HashSet<Method>();
// traverse public member methods (excludes static/non-public, includes inherited)
candidates.addAll(Arrays.asList(Assert.notNull(cls, "class").getMethods()));
// traverse directly declared methods (includes static/non-public, excludes inherited)
candidates.addAll(Arrays.asList(Assert.notNull(cls, "class").getDeclaredMethods()));
List<Method> result = new ArrayList<Method>();
for (Method method : candidates) {
if (method.isAnnotationPresent(Command.class)) {
if (methodName == null || methodName.equals(method.getName())) { result.add(method); }
}
}
Collections.sort(result, new Comparator<Method>() {
public int compare(Method o1, Method o2) { return o1.getName().compareTo(o2.getName()); }
});
return result;
} | java | public static List<Method> getCommandMethods(Class<?> cls, String methodName) {
Set<Method> candidates = new HashSet<Method>();
// traverse public member methods (excludes static/non-public, includes inherited)
candidates.addAll(Arrays.asList(Assert.notNull(cls, "class").getMethods()));
// traverse directly declared methods (includes static/non-public, excludes inherited)
candidates.addAll(Arrays.asList(Assert.notNull(cls, "class").getDeclaredMethods()));
List<Method> result = new ArrayList<Method>();
for (Method method : candidates) {
if (method.isAnnotationPresent(Command.class)) {
if (methodName == null || methodName.equals(method.getName())) { result.add(method); }
}
}
Collections.sort(result, new Comparator<Method>() {
public int compare(Method o1, Method o2) { return o1.getName().compareTo(o2.getName()); }
});
return result;
} | [
"public",
"static",
"List",
"<",
"Method",
">",
"getCommandMethods",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"String",
"methodName",
")",
"{",
"Set",
"<",
"Method",
">",
"candidates",
"=",
"new",
"HashSet",
"<",
"Method",
">",
"(",
")",
";",
"// traverse public member methods (excludes static/non-public, includes inherited)",
"candidates",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"Assert",
".",
"notNull",
"(",
"cls",
",",
"\"class\"",
")",
".",
"getMethods",
"(",
")",
")",
")",
";",
"// traverse directly declared methods (includes static/non-public, excludes inherited)",
"candidates",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"Assert",
".",
"notNull",
"(",
"cls",
",",
"\"class\"",
")",
".",
"getDeclaredMethods",
"(",
")",
")",
")",
";",
"List",
"<",
"Method",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"Method",
">",
"(",
")",
";",
"for",
"(",
"Method",
"method",
":",
"candidates",
")",
"{",
"if",
"(",
"method",
".",
"isAnnotationPresent",
"(",
"Command",
".",
"class",
")",
")",
"{",
"if",
"(",
"methodName",
"==",
"null",
"||",
"methodName",
".",
"equals",
"(",
"method",
".",
"getName",
"(",
")",
")",
")",
"{",
"result",
".",
"add",
"(",
"method",
")",
";",
"}",
"}",
"}",
"Collections",
".",
"sort",
"(",
"result",
",",
"new",
"Comparator",
"<",
"Method",
">",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"Method",
"o1",
",",
"Method",
"o2",
")",
"{",
"return",
"o1",
".",
"getName",
"(",
")",
".",
"compareTo",
"(",
"o2",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"return",
"result",
";",
"}"
]
| Helper to get methods of a class annotated with {@link Command @Command} via reflection, optionally filtered by method name (not {@link Command#name() @Command.name}).
Methods have to be either public (inherited) members or be declared by {@code cls}, that is "inherited" static or protected methods will not be picked up.
@param cls the class to search for methods annotated with {@code @Command}
@param methodName if not {@code null}, return only methods whose method name (not {@link Command#name() @Command.name}) equals this string. Ignored if {@code null}.
@return the matching command methods, or an empty list
@see #invoke(String, Class, String...)
@since 3.6.0 | [
"Helper",
"to",
"get",
"methods",
"of",
"a",
"class",
"annotated",
"with",
"{",
"@link",
"Command",
"@Command",
"}",
"via",
"reflection",
"optionally",
"filtered",
"by",
"method",
"name",
"(",
"not",
"{",
"@link",
"Command#name",
"()",
"@Command",
".",
"name",
"}",
")",
".",
"Methods",
"have",
"to",
"be",
"either",
"public",
"(",
"inherited",
")",
"members",
"or",
"be",
"declared",
"by",
"{",
"@code",
"cls",
"}",
"that",
"is",
"inherited",
"static",
"or",
"protected",
"methods",
"will",
"not",
"be",
"picked",
"up",
"."
]
| train | https://github.com/remkop/picocli/blob/3c5384f0d12817401d1921c3013c1282e2edcab2/src/main/java/picocli/CommandLine.java#L2712-L2729 |
netceteragroup/trema-core | src/main/java/com/netcetera/trema/core/importing/ChangesAnalyzer.java | ChangesAnalyzer.applyChange | public static void applyChange(IDatabase db, Change change) {
"""
Applies a change to a trema database. If the change is not to be
accepted (<code>!change.isAccept()</code>, that is) or if the
change is an addition (type <code>Change.TYPE_KEY_ADDITION</code>,
<code>Change.TYPE_LANGUAGE_ADDITION</code> or
<code>Change.TYPE_MASTER_LANGUAGE_ADDITION</code>) this
method has <b>no</b> effect.
<p>
The the master value, the status and the value to be accepted
(<code>change.getAcceptMasterValue()</code>,
<code>change.getAcceptStatus()</code> and
<code>change.getAcceptValue()</code>, that is) will be set for the
corresponding key and language.
@param db the database to apply the changes to
@param change the change to be applied
@see ChangesAnalyzer#isApplicable(Change)
"""
if (isApplicable(change)) {
ITextNode textNode = db.getTextNode(change.getKey());
if (textNode != null) {
// textNode would be null for TYPE_KEY_ADDITION
String language = change.getLanguage();
IValueNode valueNode = textNode.getValueNode(language);
if (valueNode != null) {
// valueNode would be null for TYPE_LANGUAGE_ADDITION
valueNode.setStatus(change.getAcceptStatus());
valueNode.setValue(change.getAcceptValue());
}
if (change.hasMasterLanguage()) {
String masterLanguage = change.getMasterLanguage();
IValueNode masterValueNode = textNode.getValueNode(masterLanguage);
if (masterValueNode != null) {
// masterValueNode would be null for TYPE_MASTER_LANGUAGE_ADDITION
masterValueNode.setValue(change.getAcceptMasterValue());
}
}
}
}
} | java | public static void applyChange(IDatabase db, Change change) {
if (isApplicable(change)) {
ITextNode textNode = db.getTextNode(change.getKey());
if (textNode != null) {
// textNode would be null for TYPE_KEY_ADDITION
String language = change.getLanguage();
IValueNode valueNode = textNode.getValueNode(language);
if (valueNode != null) {
// valueNode would be null for TYPE_LANGUAGE_ADDITION
valueNode.setStatus(change.getAcceptStatus());
valueNode.setValue(change.getAcceptValue());
}
if (change.hasMasterLanguage()) {
String masterLanguage = change.getMasterLanguage();
IValueNode masterValueNode = textNode.getValueNode(masterLanguage);
if (masterValueNode != null) {
// masterValueNode would be null for TYPE_MASTER_LANGUAGE_ADDITION
masterValueNode.setValue(change.getAcceptMasterValue());
}
}
}
}
} | [
"public",
"static",
"void",
"applyChange",
"(",
"IDatabase",
"db",
",",
"Change",
"change",
")",
"{",
"if",
"(",
"isApplicable",
"(",
"change",
")",
")",
"{",
"ITextNode",
"textNode",
"=",
"db",
".",
"getTextNode",
"(",
"change",
".",
"getKey",
"(",
")",
")",
";",
"if",
"(",
"textNode",
"!=",
"null",
")",
"{",
"// textNode would be null for TYPE_KEY_ADDITION",
"String",
"language",
"=",
"change",
".",
"getLanguage",
"(",
")",
";",
"IValueNode",
"valueNode",
"=",
"textNode",
".",
"getValueNode",
"(",
"language",
")",
";",
"if",
"(",
"valueNode",
"!=",
"null",
")",
"{",
"// valueNode would be null for TYPE_LANGUAGE_ADDITION",
"valueNode",
".",
"setStatus",
"(",
"change",
".",
"getAcceptStatus",
"(",
")",
")",
";",
"valueNode",
".",
"setValue",
"(",
"change",
".",
"getAcceptValue",
"(",
")",
")",
";",
"}",
"if",
"(",
"change",
".",
"hasMasterLanguage",
"(",
")",
")",
"{",
"String",
"masterLanguage",
"=",
"change",
".",
"getMasterLanguage",
"(",
")",
";",
"IValueNode",
"masterValueNode",
"=",
"textNode",
".",
"getValueNode",
"(",
"masterLanguage",
")",
";",
"if",
"(",
"masterValueNode",
"!=",
"null",
")",
"{",
"// masterValueNode would be null for TYPE_MASTER_LANGUAGE_ADDITION",
"masterValueNode",
".",
"setValue",
"(",
"change",
".",
"getAcceptMasterValue",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"}"
]
| Applies a change to a trema database. If the change is not to be
accepted (<code>!change.isAccept()</code>, that is) or if the
change is an addition (type <code>Change.TYPE_KEY_ADDITION</code>,
<code>Change.TYPE_LANGUAGE_ADDITION</code> or
<code>Change.TYPE_MASTER_LANGUAGE_ADDITION</code>) this
method has <b>no</b> effect.
<p>
The the master value, the status and the value to be accepted
(<code>change.getAcceptMasterValue()</code>,
<code>change.getAcceptStatus()</code> and
<code>change.getAcceptValue()</code>, that is) will be set for the
corresponding key and language.
@param db the database to apply the changes to
@param change the change to be applied
@see ChangesAnalyzer#isApplicable(Change) | [
"Applies",
"a",
"change",
"to",
"a",
"trema",
"database",
".",
"If",
"the",
"change",
"is",
"not",
"to",
"be",
"accepted",
"(",
"<code",
">",
"!change",
".",
"isAccept",
"()",
"<",
"/",
"code",
">",
"that",
"is",
")",
"or",
"if",
"the",
"change",
"is",
"an",
"addition",
"(",
"type",
"<code",
">",
"Change",
".",
"TYPE_KEY_ADDITION<",
"/",
"code",
">",
"<code",
">",
"Change",
".",
"TYPE_LANGUAGE_ADDITION<",
"/",
"code",
">",
"or",
"<code",
">",
"Change",
".",
"TYPE_MASTER_LANGUAGE_ADDITION<",
"/",
"code",
">",
")",
"this",
"method",
"has",
"<b",
">",
"no<",
"/",
"b",
">",
"effect",
".",
"<p",
">",
"The",
"the",
"master",
"value",
"the",
"status",
"and",
"the",
"value",
"to",
"be",
"accepted",
"(",
"<code",
">",
"change",
".",
"getAcceptMasterValue",
"()",
"<",
"/",
"code",
">",
"<code",
">",
"change",
".",
"getAcceptStatus",
"()",
"<",
"/",
"code",
">",
"and",
"<code",
">",
"change",
".",
"getAcceptValue",
"()",
"<",
"/",
"code",
">",
"that",
"is",
")",
"will",
"be",
"set",
"for",
"the",
"corresponding",
"key",
"and",
"language",
"."
]
| train | https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/importing/ChangesAnalyzer.java#L340-L365 |
graphhopper/graphhopper | api/src/main/java/com/graphhopper/util/DistanceCalcEarth.java | DistanceCalcEarth.calcDist | @Override
public double calcDist(double fromLat, double fromLon, double toLat, double toLon) {
"""
Calculates distance of (from, to) in meter.
<p>
http://en.wikipedia.org/wiki/Haversine_formula a = sin²(Δlat/2) +
cos(lat1).cos(lat2).sin²(Δlong/2) c = 2.atan2(√a, √(1−a)) d = R.c
"""
double normedDist = calcNormalizedDist(fromLat, fromLon, toLat, toLon);
return R * 2 * asin(sqrt(normedDist));
} | java | @Override
public double calcDist(double fromLat, double fromLon, double toLat, double toLon) {
double normedDist = calcNormalizedDist(fromLat, fromLon, toLat, toLon);
return R * 2 * asin(sqrt(normedDist));
} | [
"@",
"Override",
"public",
"double",
"calcDist",
"(",
"double",
"fromLat",
",",
"double",
"fromLon",
",",
"double",
"toLat",
",",
"double",
"toLon",
")",
"{",
"double",
"normedDist",
"=",
"calcNormalizedDist",
"(",
"fromLat",
",",
"fromLon",
",",
"toLat",
",",
"toLon",
")",
";",
"return",
"R",
"*",
"2",
"*",
"asin",
"(",
"sqrt",
"(",
"normedDist",
")",
")",
";",
"}"
]
| Calculates distance of (from, to) in meter.
<p>
http://en.wikipedia.org/wiki/Haversine_formula a = sin²(Δlat/2) +
cos(lat1).cos(lat2).sin²(Δlong/2) c = 2.atan2(√a, √(1−a)) d = R.c | [
"Calculates",
"distance",
"of",
"(",
"from",
"to",
")",
"in",
"meter",
".",
"<p",
">",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Haversine_formula",
"a",
"=",
"sin²",
"(",
"Δlat",
"/",
"2",
")",
"+",
"cos",
"(",
"lat1",
")",
".",
"cos",
"(",
"lat2",
")",
".",
"sin²",
"(",
"Δlong",
"/",
"2",
")",
"c",
"=",
"2",
".",
"atan2",
"(",
"√a",
"√",
"(",
"1−a",
"))",
"d",
"=",
"R",
".",
"c"
]
| train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/api/src/main/java/com/graphhopper/util/DistanceCalcEarth.java#L49-L53 |
Azure/azure-sdk-for-java | recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/ItemLevelRecoveryConnectionsInner.java | ItemLevelRecoveryConnectionsInner.revokeAsync | public Observable<Void> revokeAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, String recoveryPointId) {
"""
Revokes an iSCSI connection which can be used to download a script. Executing this script opens a file explorer displaying all recoverable files and folders. This is an asynchronous operation.
@param vaultName The name of the Recovery Services vault.
@param resourceGroupName The name of the resource group associated with the Recovery Services vault.
@param fabricName The fabric name associated with the backup items. The value allowed is Azure.
@param containerName The container name associated with the backup items.
@param protectedItemName The name of the backup items whose files or folders will be restored.
@param recoveryPointId The string that identifies the recovery point. The iSCSI connection will be revoked for this protected data.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful.
"""
return revokeWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> revokeAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, String recoveryPointId) {
return revokeWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"revokeAsync",
"(",
"String",
"vaultName",
",",
"String",
"resourceGroupName",
",",
"String",
"fabricName",
",",
"String",
"containerName",
",",
"String",
"protectedItemName",
",",
"String",
"recoveryPointId",
")",
"{",
"return",
"revokeWithServiceResponseAsync",
"(",
"vaultName",
",",
"resourceGroupName",
",",
"fabricName",
",",
"containerName",
",",
"protectedItemName",
",",
"recoveryPointId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Void",
">",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
"ServiceResponse",
"<",
"Void",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Revokes an iSCSI connection which can be used to download a script. Executing this script opens a file explorer displaying all recoverable files and folders. This is an asynchronous operation.
@param vaultName The name of the Recovery Services vault.
@param resourceGroupName The name of the resource group associated with the Recovery Services vault.
@param fabricName The fabric name associated with the backup items. The value allowed is Azure.
@param containerName The container name associated with the backup items.
@param protectedItemName The name of the backup items whose files or folders will be restored.
@param recoveryPointId The string that identifies the recovery point. The iSCSI connection will be revoked for this protected data.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Revokes",
"an",
"iSCSI",
"connection",
"which",
"can",
"be",
"used",
"to",
"download",
"a",
"script",
".",
"Executing",
"this",
"script",
"opens",
"a",
"file",
"explorer",
"displaying",
"all",
"recoverable",
"files",
"and",
"folders",
".",
"This",
"is",
"an",
"asynchronous",
"operation",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/ItemLevelRecoveryConnectionsInner.java#L113-L120 |
JoeKerouac/utils | src/main/java/com/joe/utils/common/StringUtils.java | StringUtils.replaceAfter | public static String replaceAfter(String str, int start, String rp) {
"""
替换指定起始位置之后的所有字符
@param str 字符串
@param start 要替换的起始位置(包含该位置)
@param rp 替换字符串
@return 替换后的字符串,例如对123456替换3,*,结果为123*
"""
return replace(str, start, str.length() - 1, rp);
} | java | public static String replaceAfter(String str, int start, String rp) {
return replace(str, start, str.length() - 1, rp);
} | [
"public",
"static",
"String",
"replaceAfter",
"(",
"String",
"str",
",",
"int",
"start",
",",
"String",
"rp",
")",
"{",
"return",
"replace",
"(",
"str",
",",
"start",
",",
"str",
".",
"length",
"(",
")",
"-",
"1",
",",
"rp",
")",
";",
"}"
]
| 替换指定起始位置之后的所有字符
@param str 字符串
@param start 要替换的起始位置(包含该位置)
@param rp 替换字符串
@return 替换后的字符串,例如对123456替换3,*,结果为123* | [
"替换指定起始位置之后的所有字符"
]
| train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/StringUtils.java#L93-L95 |
spring-projects/spring-data-solr | src/main/java/org/springframework/data/solr/core/query/HighlightOptions.java | HighlightOptions.addHighlightParameter | public HighlightOptions addHighlightParameter(String parameterName, Object value) {
"""
Add parameter by name
@param parameterName must not be null
@param value
@return
"""
return addHighlightParameter(new HighlightParameter(parameterName, value));
} | java | public HighlightOptions addHighlightParameter(String parameterName, Object value) {
return addHighlightParameter(new HighlightParameter(parameterName, value));
} | [
"public",
"HighlightOptions",
"addHighlightParameter",
"(",
"String",
"parameterName",
",",
"Object",
"value",
")",
"{",
"return",
"addHighlightParameter",
"(",
"new",
"HighlightParameter",
"(",
"parameterName",
",",
"value",
")",
")",
";",
"}"
]
| Add parameter by name
@param parameterName must not be null
@param value
@return | [
"Add",
"parameter",
"by",
"name"
]
| train | https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/HighlightOptions.java#L224-L226 |
wavesoftware/java-eid-exceptions | src/main/java/pl/wavesoftware/eid/utils/EidPreconditions.java | EidPreconditions.checkElementIndex | public static int checkElementIndex(int index, int size, final String eid) {
"""
Ensures that {@code index} specifies a valid <i>element</i> in an array,
list or string of size {@code size}. An element index may range from
zero, inclusive, to {@code size}, exclusive.
<p>
Please, note that for performance reasons, Eid is not evaluated until
it's needed. If you are using {@code Validator},
please use {@link #checkElementIndex(int, int, Eid)} instead.
@param index a user-supplied index identifying an element of an array,
list or string
@param size the size of that array, list or string
@param eid the text to use to describe this index in an error message
@return the value of {@code index}
@throws EidIndexOutOfBoundsException if {@code index} is negative or is
not less than {@code size}
@throws EidIllegalArgumentException if {@code size} is negative
"""
if (isSizeIllegal(size)) {
throw new EidIllegalArgumentException(ensureEid(eid));
}
if (isIndexAndSizeIllegal(index, size)) {
throw new EidIndexOutOfBoundsException(ensureEid(eid));
}
return index;
} | java | public static int checkElementIndex(int index, int size, final String eid) {
if (isSizeIllegal(size)) {
throw new EidIllegalArgumentException(ensureEid(eid));
}
if (isIndexAndSizeIllegal(index, size)) {
throw new EidIndexOutOfBoundsException(ensureEid(eid));
}
return index;
} | [
"public",
"static",
"int",
"checkElementIndex",
"(",
"int",
"index",
",",
"int",
"size",
",",
"final",
"String",
"eid",
")",
"{",
"if",
"(",
"isSizeIllegal",
"(",
"size",
")",
")",
"{",
"throw",
"new",
"EidIllegalArgumentException",
"(",
"ensureEid",
"(",
"eid",
")",
")",
";",
"}",
"if",
"(",
"isIndexAndSizeIllegal",
"(",
"index",
",",
"size",
")",
")",
"{",
"throw",
"new",
"EidIndexOutOfBoundsException",
"(",
"ensureEid",
"(",
"eid",
")",
")",
";",
"}",
"return",
"index",
";",
"}"
]
| Ensures that {@code index} specifies a valid <i>element</i> in an array,
list or string of size {@code size}. An element index may range from
zero, inclusive, to {@code size}, exclusive.
<p>
Please, note that for performance reasons, Eid is not evaluated until
it's needed. If you are using {@code Validator},
please use {@link #checkElementIndex(int, int, Eid)} instead.
@param index a user-supplied index identifying an element of an array,
list or string
@param size the size of that array, list or string
@param eid the text to use to describe this index in an error message
@return the value of {@code index}
@throws EidIndexOutOfBoundsException if {@code index} is negative or is
not less than {@code size}
@throws EidIllegalArgumentException if {@code size} is negative | [
"Ensures",
"that",
"{",
"@code",
"index",
"}",
"specifies",
"a",
"valid",
"<i",
">",
"element<",
"/",
"i",
">",
"in",
"an",
"array",
"list",
"or",
"string",
"of",
"size",
"{",
"@code",
"size",
"}",
".",
"An",
"element",
"index",
"may",
"range",
"from",
"zero",
"inclusive",
"to",
"{",
"@code",
"size",
"}",
"exclusive",
".",
"<p",
">",
"Please",
"note",
"that",
"for",
"performance",
"reasons",
"Eid",
"is",
"not",
"evaluated",
"until",
"it",
"s",
"needed",
".",
"If",
"you",
"are",
"using",
"{",
"@code",
"Validator",
"}",
"please",
"use",
"{",
"@link",
"#checkElementIndex",
"(",
"int",
"int",
"Eid",
")",
"}",
"instead",
"."
]
| train | https://github.com/wavesoftware/java-eid-exceptions/blob/3d3a3103c5858b6cbf68d2609a8949b717c38a56/src/main/java/pl/wavesoftware/eid/utils/EidPreconditions.java#L426-L434 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java | ValueEnforcer.isBetweenExclusive | public static double isBetweenExclusive (final double dValue,
final String sName,
final double dLowerBoundExclusive,
final double dUpperBoundExclusive) {
"""
Check if
<code>nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusive</code>
@param dValue
Value
@param sName
Name
@param dLowerBoundExclusive
Lower bound
@param dUpperBoundExclusive
Upper bound
@return The value
"""
if (isEnabled ())
return isBetweenExclusive (dValue, () -> sName, dLowerBoundExclusive, dUpperBoundExclusive);
return dValue;
} | java | public static double isBetweenExclusive (final double dValue,
final String sName,
final double dLowerBoundExclusive,
final double dUpperBoundExclusive)
{
if (isEnabled ())
return isBetweenExclusive (dValue, () -> sName, dLowerBoundExclusive, dUpperBoundExclusive);
return dValue;
} | [
"public",
"static",
"double",
"isBetweenExclusive",
"(",
"final",
"double",
"dValue",
",",
"final",
"String",
"sName",
",",
"final",
"double",
"dLowerBoundExclusive",
",",
"final",
"double",
"dUpperBoundExclusive",
")",
"{",
"if",
"(",
"isEnabled",
"(",
")",
")",
"return",
"isBetweenExclusive",
"(",
"dValue",
",",
"(",
")",
"->",
"sName",
",",
"dLowerBoundExclusive",
",",
"dUpperBoundExclusive",
")",
";",
"return",
"dValue",
";",
"}"
]
| Check if
<code>nValue > nLowerBoundInclusive && nValue < nUpperBoundInclusive</code>
@param dValue
Value
@param sName
Name
@param dLowerBoundExclusive
Lower bound
@param dUpperBoundExclusive
Upper bound
@return The value | [
"Check",
"if",
"<code",
">",
"nValue",
">",
";",
"nLowerBoundInclusive",
"&",
";",
"&",
";",
"nValue",
"<",
";",
"nUpperBoundInclusive<",
"/",
"code",
">"
]
| train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L2843-L2851 |
apache/flink | flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java | ExceptionUtils.tryDeserializeAndThrow | public static void tryDeserializeAndThrow(Throwable throwable, ClassLoader classLoader) throws Throwable {
"""
Tries to find a {@link SerializedThrowable} as the cause of the given throwable and throws its
deserialized value. If there is no such throwable, then the original throwable is thrown.
@param throwable to check for a SerializedThrowable
@param classLoader to be used for the deserialization of the SerializedThrowable
@throws Throwable either the deserialized throwable or the given throwable
"""
Throwable current = throwable;
while (!(current instanceof SerializedThrowable) && current.getCause() != null) {
current = current.getCause();
}
if (current instanceof SerializedThrowable) {
throw ((SerializedThrowable) current).deserializeError(classLoader);
} else {
throw throwable;
}
} | java | public static void tryDeserializeAndThrow(Throwable throwable, ClassLoader classLoader) throws Throwable {
Throwable current = throwable;
while (!(current instanceof SerializedThrowable) && current.getCause() != null) {
current = current.getCause();
}
if (current instanceof SerializedThrowable) {
throw ((SerializedThrowable) current).deserializeError(classLoader);
} else {
throw throwable;
}
} | [
"public",
"static",
"void",
"tryDeserializeAndThrow",
"(",
"Throwable",
"throwable",
",",
"ClassLoader",
"classLoader",
")",
"throws",
"Throwable",
"{",
"Throwable",
"current",
"=",
"throwable",
";",
"while",
"(",
"!",
"(",
"current",
"instanceof",
"SerializedThrowable",
")",
"&&",
"current",
".",
"getCause",
"(",
")",
"!=",
"null",
")",
"{",
"current",
"=",
"current",
".",
"getCause",
"(",
")",
";",
"}",
"if",
"(",
"current",
"instanceof",
"SerializedThrowable",
")",
"{",
"throw",
"(",
"(",
"SerializedThrowable",
")",
"current",
")",
".",
"deserializeError",
"(",
"classLoader",
")",
";",
"}",
"else",
"{",
"throw",
"throwable",
";",
"}",
"}"
]
| Tries to find a {@link SerializedThrowable} as the cause of the given throwable and throws its
deserialized value. If there is no such throwable, then the original throwable is thrown.
@param throwable to check for a SerializedThrowable
@param classLoader to be used for the deserialization of the SerializedThrowable
@throws Throwable either the deserialized throwable or the given throwable | [
"Tries",
"to",
"find",
"a",
"{",
"@link",
"SerializedThrowable",
"}",
"as",
"the",
"cause",
"of",
"the",
"given",
"throwable",
"and",
"throws",
"its",
"deserialized",
"value",
".",
"If",
"there",
"is",
"no",
"such",
"throwable",
"then",
"the",
"original",
"throwable",
"is",
"thrown",
"."
]
| train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java#L435-L447 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtil.java | SessionUtil.issueSession | static public LoginOutput issueSession(LoginInput loginInput)
throws SFException, SnowflakeSQLException {
"""
Issue a session
@param loginInput login information
@return login output
@throws SFException if unexpected uri information
@throws SnowflakeSQLException if failed to renew the session
"""
return tokenRequest(loginInput, TokenRequestType.ISSUE);
} | java | static public LoginOutput issueSession(LoginInput loginInput)
throws SFException, SnowflakeSQLException
{
return tokenRequest(loginInput, TokenRequestType.ISSUE);
} | [
"static",
"public",
"LoginOutput",
"issueSession",
"(",
"LoginInput",
"loginInput",
")",
"throws",
"SFException",
",",
"SnowflakeSQLException",
"{",
"return",
"tokenRequest",
"(",
"loginInput",
",",
"TokenRequestType",
".",
"ISSUE",
")",
";",
"}"
]
| Issue a session
@param loginInput login information
@return login output
@throws SFException if unexpected uri information
@throws SnowflakeSQLException if failed to renew the session | [
"Issue",
"a",
"session"
]
| train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtil.java#L913-L917 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/spatial/Mathlib.java | Mathlib.lineIntersection | public static Coordinate lineIntersection(Coordinate c1, Coordinate c2, Coordinate c3, Coordinate c4) {
"""
Calculates the intersection point of 2 lines.
@param c1
First coordinate of the first line.
@param c2
Second coordinate of the first line.
@param c3
First coordinate of the second line.
@param c4
Second coordinate of the second line.
@return Returns a coordinate.
"""
LineSegment ls1 = new LineSegment(c1, c2);
LineSegment ls2 = new LineSegment(c3, c4);
return ls1.getIntersection(ls2);
} | java | public static Coordinate lineIntersection(Coordinate c1, Coordinate c2, Coordinate c3, Coordinate c4) {
LineSegment ls1 = new LineSegment(c1, c2);
LineSegment ls2 = new LineSegment(c3, c4);
return ls1.getIntersection(ls2);
} | [
"public",
"static",
"Coordinate",
"lineIntersection",
"(",
"Coordinate",
"c1",
",",
"Coordinate",
"c2",
",",
"Coordinate",
"c3",
",",
"Coordinate",
"c4",
")",
"{",
"LineSegment",
"ls1",
"=",
"new",
"LineSegment",
"(",
"c1",
",",
"c2",
")",
";",
"LineSegment",
"ls2",
"=",
"new",
"LineSegment",
"(",
"c3",
",",
"c4",
")",
";",
"return",
"ls1",
".",
"getIntersection",
"(",
"ls2",
")",
";",
"}"
]
| Calculates the intersection point of 2 lines.
@param c1
First coordinate of the first line.
@param c2
Second coordinate of the first line.
@param c3
First coordinate of the second line.
@param c4
Second coordinate of the second line.
@return Returns a coordinate. | [
"Calculates",
"the",
"intersection",
"point",
"of",
"2",
"lines",
"."
]
| train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Mathlib.java#L64-L68 |
cdk/cdk | base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/Mappings.java | Mappings.uniqueAtoms | public Mappings uniqueAtoms() {
"""
Filter the mappings for those which cover a unique set of atoms in the
target. The unique atom mappings are a subset of the unique bond
matches.
@return fluent-api instance
@see #uniqueBonds()
"""
// we need the unique predicate to be reset for each new iterator -
// otherwise multiple iterations are always filtered (seen before)
return new Mappings(query, target, new Iterable<int[]>() {
@Override
public Iterator<int[]> iterator() {
return Iterators.filter(iterable.iterator(), new UniqueAtomMatches());
}
});
} | java | public Mappings uniqueAtoms() {
// we need the unique predicate to be reset for each new iterator -
// otherwise multiple iterations are always filtered (seen before)
return new Mappings(query, target, new Iterable<int[]>() {
@Override
public Iterator<int[]> iterator() {
return Iterators.filter(iterable.iterator(), new UniqueAtomMatches());
}
});
} | [
"public",
"Mappings",
"uniqueAtoms",
"(",
")",
"{",
"// we need the unique predicate to be reset for each new iterator -",
"// otherwise multiple iterations are always filtered (seen before)",
"return",
"new",
"Mappings",
"(",
"query",
",",
"target",
",",
"new",
"Iterable",
"<",
"int",
"[",
"]",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Iterator",
"<",
"int",
"[",
"]",
">",
"iterator",
"(",
")",
"{",
"return",
"Iterators",
".",
"filter",
"(",
"iterable",
".",
"iterator",
"(",
")",
",",
"new",
"UniqueAtomMatches",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Filter the mappings for those which cover a unique set of atoms in the
target. The unique atom mappings are a subset of the unique bond
matches.
@return fluent-api instance
@see #uniqueBonds() | [
"Filter",
"the",
"mappings",
"for",
"those",
"which",
"cover",
"a",
"unique",
"set",
"of",
"atoms",
"in",
"the",
"target",
".",
"The",
"unique",
"atom",
"mappings",
"are",
"a",
"subset",
"of",
"the",
"unique",
"bond",
"matches",
"."
]
| train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/Mappings.java#L278-L288 |
phax/ph-commons | ph-tree/src/main/java/com/helger/tree/sort/TreeWithIDSorter.java | TreeWithIDSorter.sortByID | public static <KEYTYPE extends Comparable <? super KEYTYPE>, DATATYPE, ITEMTYPE extends ITreeItemWithID <KEYTYPE, DATATYPE, ITEMTYPE>> void sortByID (@Nonnull final IBasicTree <DATATYPE, ITEMTYPE> aTree) {
"""
Sort each level of the passed tree on the ID with the specified comparator.
This method assumes that the IDs in the tree item implement the
{@link Comparable} interface.
@param <KEYTYPE>
Tree item key type
@param <DATATYPE>
Tree item data type
@param <ITEMTYPE>
Tree item type
@param aTree
The tree to be sorted.
"""
_sort (aTree, IHasID.getComparatorID ());
} | java | public static <KEYTYPE extends Comparable <? super KEYTYPE>, DATATYPE, ITEMTYPE extends ITreeItemWithID <KEYTYPE, DATATYPE, ITEMTYPE>> void sortByID (@Nonnull final IBasicTree <DATATYPE, ITEMTYPE> aTree)
{
_sort (aTree, IHasID.getComparatorID ());
} | [
"public",
"static",
"<",
"KEYTYPE",
"extends",
"Comparable",
"<",
"?",
"super",
"KEYTYPE",
">",
",",
"DATATYPE",
",",
"ITEMTYPE",
"extends",
"ITreeItemWithID",
"<",
"KEYTYPE",
",",
"DATATYPE",
",",
"ITEMTYPE",
">",
">",
"void",
"sortByID",
"(",
"@",
"Nonnull",
"final",
"IBasicTree",
"<",
"DATATYPE",
",",
"ITEMTYPE",
">",
"aTree",
")",
"{",
"_sort",
"(",
"aTree",
",",
"IHasID",
".",
"getComparatorID",
"(",
")",
")",
";",
"}"
]
| Sort each level of the passed tree on the ID with the specified comparator.
This method assumes that the IDs in the tree item implement the
{@link Comparable} interface.
@param <KEYTYPE>
Tree item key type
@param <DATATYPE>
Tree item data type
@param <ITEMTYPE>
Tree item type
@param aTree
The tree to be sorted. | [
"Sort",
"each",
"level",
"of",
"the",
"passed",
"tree",
"on",
"the",
"ID",
"with",
"the",
"specified",
"comparator",
".",
"This",
"method",
"assumes",
"that",
"the",
"IDs",
"in",
"the",
"tree",
"item",
"implement",
"the",
"{",
"@link",
"Comparable",
"}",
"interface",
"."
]
| train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-tree/src/main/java/com/helger/tree/sort/TreeWithIDSorter.java#L107-L110 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.deleteCertificateOperationAsync | public ServiceFuture<CertificateOperation> deleteCertificateOperationAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<CertificateOperation> serviceCallback) {
"""
Deletes the creation operation for a specific certificate.
Deletes the creation operation for a specified certificate that is in the process of being created. The certificate is no longer created. This operation requires the certificates/update permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object
"""
return ServiceFuture.fromResponse(deleteCertificateOperationWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback);
} | java | public ServiceFuture<CertificateOperation> deleteCertificateOperationAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<CertificateOperation> serviceCallback) {
return ServiceFuture.fromResponse(deleteCertificateOperationWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"CertificateOperation",
">",
"deleteCertificateOperationAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
",",
"final",
"ServiceCallback",
"<",
"CertificateOperation",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
".",
"fromResponse",
"(",
"deleteCertificateOperationWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"certificateName",
")",
",",
"serviceCallback",
")",
";",
"}"
]
| Deletes the creation operation for a specific certificate.
Deletes the creation operation for a specified certificate that is in the process of being created. The certificate is no longer created. This operation requires the certificates/update permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Deletes",
"the",
"creation",
"operation",
"for",
"a",
"specific",
"certificate",
".",
"Deletes",
"the",
"creation",
"operation",
"for",
"a",
"specified",
"certificate",
"that",
"is",
"in",
"the",
"process",
"of",
"being",
"created",
".",
"The",
"certificate",
"is",
"no",
"longer",
"created",
".",
"This",
"operation",
"requires",
"the",
"certificates",
"/",
"update",
"permission",
"."
]
| 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#L7836-L7838 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.getDeclaredMethodOfObj | public static Method getDeclaredMethodOfObj(Object obj, String methodName, Object... args) throws SecurityException {
"""
查找指定对象中的所有方法(包括非public方法),也包括父对象和Object类的方法
@param obj 被查找的对象
@param methodName 方法名
@param args 参数
@return 方法
@throws SecurityException 无访问权限抛出异常
"""
return getDeclaredMethod(obj.getClass(), methodName, getClasses(args));
} | java | public static Method getDeclaredMethodOfObj(Object obj, String methodName, Object... args) throws SecurityException {
return getDeclaredMethod(obj.getClass(), methodName, getClasses(args));
} | [
"public",
"static",
"Method",
"getDeclaredMethodOfObj",
"(",
"Object",
"obj",
",",
"String",
"methodName",
",",
"Object",
"...",
"args",
")",
"throws",
"SecurityException",
"{",
"return",
"getDeclaredMethod",
"(",
"obj",
".",
"getClass",
"(",
")",
",",
"methodName",
",",
"getClasses",
"(",
"args",
")",
")",
";",
"}"
]
| 查找指定对象中的所有方法(包括非public方法),也包括父对象和Object类的方法
@param obj 被查找的对象
@param methodName 方法名
@param args 参数
@return 方法
@throws SecurityException 无访问权限抛出异常 | [
"查找指定对象中的所有方法(包括非public方法),也包括父对象和Object类的方法"
]
| train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L328-L330 |
jtablesaw/tablesaw | html/src/main/java/tech/tablesaw/io/html/HtmlReadOptions.java | HtmlReadOptions.builder | public static Builder builder(Reader reader, String tableName) {
"""
This method may cause tablesaw to buffer the entire InputStream.
<p>
If you have a large amount of data, you can do one of the following:
1. Use the method taking a File instead of a reader, or
2. Provide the array of column types as an option. If you provide the columnType array,
we skip type detection and can avoid reading the entire file
"""
Builder builder = new Builder(reader);
return builder.tableName(tableName);
} | java | public static Builder builder(Reader reader, String tableName) {
Builder builder = new Builder(reader);
return builder.tableName(tableName);
} | [
"public",
"static",
"Builder",
"builder",
"(",
"Reader",
"reader",
",",
"String",
"tableName",
")",
"{",
"Builder",
"builder",
"=",
"new",
"Builder",
"(",
"reader",
")",
";",
"return",
"builder",
".",
"tableName",
"(",
"tableName",
")",
";",
"}"
]
| This method may cause tablesaw to buffer the entire InputStream.
<p>
If you have a large amount of data, you can do one of the following:
1. Use the method taking a File instead of a reader, or
2. Provide the array of column types as an option. If you provide the columnType array,
we skip type detection and can avoid reading the entire file | [
"This",
"method",
"may",
"cause",
"tablesaw",
"to",
"buffer",
"the",
"entire",
"InputStream",
"."
]
| train | https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/html/src/main/java/tech/tablesaw/io/html/HtmlReadOptions.java#L70-L73 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.serviceName_PUT | public void serviceName_PUT(String serviceName, net.minidev.ovh.api.dedicatedcloud.OvhDedicatedCloud body) throws IOException {
"""
Alter this object properties
REST: PUT /dedicatedCloud/{serviceName}
@param body [required] New object properties
@param serviceName [required] Domain of the service
@deprecated
"""
String qPath = "/dedicatedCloud/{serviceName}";
StringBuilder sb = path(qPath, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_PUT(String serviceName, net.minidev.ovh.api.dedicatedcloud.OvhDedicatedCloud body) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}";
StringBuilder sb = path(qPath, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_PUT",
"(",
"String",
"serviceName",
",",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"dedicatedcloud",
".",
"OvhDedicatedCloud",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicatedCloud/{serviceName}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"exec",
"(",
"qPath",
",",
"\"PUT\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"body",
")",
";",
"}"
]
| Alter this object properties
REST: PUT /dedicatedCloud/{serviceName}
@param body [required] New object properties
@param serviceName [required] Domain of the service
@deprecated | [
"Alter",
"this",
"object",
"properties"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L2610-L2614 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/time/FastDateFormat.java | FastDateFormat.applyRules | @Deprecated
protected StringBuffer applyRules(final Calendar calendar, final StringBuffer buf) {
"""
<p>Performs the formatting by applying the rules to the
specified calendar.</p>
@param calendar the calendar to format
@param buf the buffer to format into
@return the specified string buffer
@deprecated Use {@link #format(Calendar, Appendable)}
"""
return printer.applyRules(calendar, buf);
} | java | @Deprecated
protected StringBuffer applyRules(final Calendar calendar, final StringBuffer buf) {
return printer.applyRules(calendar, buf);
} | [
"@",
"Deprecated",
"protected",
"StringBuffer",
"applyRules",
"(",
"final",
"Calendar",
"calendar",
",",
"final",
"StringBuffer",
"buf",
")",
"{",
"return",
"printer",
".",
"applyRules",
"(",
"calendar",
",",
"buf",
")",
";",
"}"
]
| <p>Performs the formatting by applying the rules to the
specified calendar.</p>
@param calendar the calendar to format
@param buf the buffer to format into
@return the specified string buffer
@deprecated Use {@link #format(Calendar, Appendable)} | [
"<p",
">",
"Performs",
"the",
"formatting",
"by",
"applying",
"the",
"rules",
"to",
"the",
"specified",
"calendar",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java#L675-L678 |
openskynetwork/java-adsb | src/main/java/org/opensky/libadsb/msgs/AltitudeReply.java | AltitudeReply.grayToBin | private static int grayToBin(int gray, int bitlength) {
"""
This method converts a gray code encoded int to a standard decimal int
@param gray gray code encoded int of length bitlength
bitlength bitlength of gray code
@return radix 2 encoded integer
"""
int result = 0;
for (int i = bitlength-1; i >= 0; --i)
result = result|((((0x1<<(i+1))&result)>>>1)^((1<<i)&gray));
return result;
} | java | private static int grayToBin(int gray, int bitlength) {
int result = 0;
for (int i = bitlength-1; i >= 0; --i)
result = result|((((0x1<<(i+1))&result)>>>1)^((1<<i)&gray));
return result;
} | [
"private",
"static",
"int",
"grayToBin",
"(",
"int",
"gray",
",",
"int",
"bitlength",
")",
"{",
"int",
"result",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"bitlength",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"result",
"=",
"result",
"|",
"(",
"(",
"(",
"(",
"0x1",
"<<",
"(",
"i",
"+",
"1",
")",
")",
"&",
"result",
")",
">>>",
"1",
")",
"^",
"(",
"(",
"1",
"<<",
"i",
")",
"&",
"gray",
")",
")",
";",
"return",
"result",
";",
"}"
]
| This method converts a gray code encoded int to a standard decimal int
@param gray gray code encoded int of length bitlength
bitlength bitlength of gray code
@return radix 2 encoded integer | [
"This",
"method",
"converts",
"a",
"gray",
"code",
"encoded",
"int",
"to",
"a",
"standard",
"decimal",
"int"
]
| train | https://github.com/openskynetwork/java-adsb/blob/01d497d3e74ad10063ab443ab583e9c8653a8b8d/src/main/java/org/opensky/libadsb/msgs/AltitudeReply.java#L187-L192 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/application/AbstractApplication.java | AbstractApplication.preloadAndLaunch | protected static void preloadAndLaunch(final Class<? extends Application> appClass, final Class<? extends Preloader> preloaderClass, final String... args) {
"""
Launch the given JavaFX Application with given preloader.
@param appClass the JavaFX application class to launch
@param preloaderClass the preloader class used as splash screen with progress
@param args arguments passed to java command line
"""
LauncherImpl.launchApplication(appClass, preloaderClass, args);
} | java | protected static void preloadAndLaunch(final Class<? extends Application> appClass, final Class<? extends Preloader> preloaderClass, final String... args) {
LauncherImpl.launchApplication(appClass, preloaderClass, args);
} | [
"protected",
"static",
"void",
"preloadAndLaunch",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Application",
">",
"appClass",
",",
"final",
"Class",
"<",
"?",
"extends",
"Preloader",
">",
"preloaderClass",
",",
"final",
"String",
"...",
"args",
")",
"{",
"LauncherImpl",
".",
"launchApplication",
"(",
"appClass",
",",
"preloaderClass",
",",
"args",
")",
";",
"}"
]
| Launch the given JavaFX Application with given preloader.
@param appClass the JavaFX application class to launch
@param preloaderClass the preloader class used as splash screen with progress
@param args arguments passed to java command line | [
"Launch",
"the",
"given",
"JavaFX",
"Application",
"with",
"given",
"preloader",
"."
]
| train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/application/AbstractApplication.java#L124-L126 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/runtime/JCuda.java | JCuda.cudaDeviceGetP2PAttribute | public static int cudaDeviceGetP2PAttribute(int value[], int attr, int srcDevice, int dstDevice) {
"""
Queries attributes of the link between two devices.<br>
<br>
Returns in *value the value of the requested attribute attrib of the
link between srcDevice and dstDevice. The supported attributes are:
<ul>
<li>CudaDevP2PAttrPerformanceRank: A relative value indicating the
performance of the link between two devices. Lower value means better
performance (0 being the value used for most performant link).
</li>
<li>CudaDevP2PAttrAccessSupported: 1 if peer access is enabled.</li>
<li>CudaDevP2PAttrNativeAtomicSupported: 1 if native atomic operations over
the link are supported.
</li>
</ul>
<br>
Returns ::cudaErrorInvalidDevice if srcDevice or dstDevice are not valid
or if they represent the same device.<br>
<br>
Returns ::cudaErrorInvalidValue if attrib is not valid or if value is
a null pointer.
<br>
@param value Returned value of the requested attribute
@param attrib The requested attribute of the link between srcDevice and dstDevice.
@param srcDevice The source device of the target link.
@param dstDevice The destination device of the target link.
@return cudaSuccess, cudaErrorInvalidDevice, cudaErrorInvalidValue
@see JCuda#cudaCtxEnablePeerAccess
@see JCuda#cudaCtxDisablePeerAccess
@see JCuda#cudaCtxCanAccessPeer
"""
return checkResult(cudaDeviceGetP2PAttributeNative(value, attr, srcDevice, dstDevice));
} | java | public static int cudaDeviceGetP2PAttribute(int value[], int attr, int srcDevice, int dstDevice)
{
return checkResult(cudaDeviceGetP2PAttributeNative(value, attr, srcDevice, dstDevice));
} | [
"public",
"static",
"int",
"cudaDeviceGetP2PAttribute",
"(",
"int",
"value",
"[",
"]",
",",
"int",
"attr",
",",
"int",
"srcDevice",
",",
"int",
"dstDevice",
")",
"{",
"return",
"checkResult",
"(",
"cudaDeviceGetP2PAttributeNative",
"(",
"value",
",",
"attr",
",",
"srcDevice",
",",
"dstDevice",
")",
")",
";",
"}"
]
| Queries attributes of the link between two devices.<br>
<br>
Returns in *value the value of the requested attribute attrib of the
link between srcDevice and dstDevice. The supported attributes are:
<ul>
<li>CudaDevP2PAttrPerformanceRank: A relative value indicating the
performance of the link between two devices. Lower value means better
performance (0 being the value used for most performant link).
</li>
<li>CudaDevP2PAttrAccessSupported: 1 if peer access is enabled.</li>
<li>CudaDevP2PAttrNativeAtomicSupported: 1 if native atomic operations over
the link are supported.
</li>
</ul>
<br>
Returns ::cudaErrorInvalidDevice if srcDevice or dstDevice are not valid
or if they represent the same device.<br>
<br>
Returns ::cudaErrorInvalidValue if attrib is not valid or if value is
a null pointer.
<br>
@param value Returned value of the requested attribute
@param attrib The requested attribute of the link between srcDevice and dstDevice.
@param srcDevice The source device of the target link.
@param dstDevice The destination device of the target link.
@return cudaSuccess, cudaErrorInvalidDevice, cudaErrorInvalidValue
@see JCuda#cudaCtxEnablePeerAccess
@see JCuda#cudaCtxDisablePeerAccess
@see JCuda#cudaCtxCanAccessPeer | [
"Queries",
"attributes",
"of",
"the",
"link",
"between",
"two",
"devices",
".",
"<br",
">",
"<br",
">",
"Returns",
"in",
"*",
"value",
"the",
"value",
"of",
"the",
"requested",
"attribute",
"attrib",
"of",
"the",
"link",
"between",
"srcDevice",
"and",
"dstDevice",
".",
"The",
"supported",
"attributes",
"are",
":",
"<ul",
">",
"<li",
">",
"CudaDevP2PAttrPerformanceRank",
":",
"A",
"relative",
"value",
"indicating",
"the",
"performance",
"of",
"the",
"link",
"between",
"two",
"devices",
".",
"Lower",
"value",
"means",
"better",
"performance",
"(",
"0",
"being",
"the",
"value",
"used",
"for",
"most",
"performant",
"link",
")",
".",
"<",
"/",
"li",
">",
"<li",
">",
"CudaDevP2PAttrAccessSupported",
":",
"1",
"if",
"peer",
"access",
"is",
"enabled",
".",
"<",
"/",
"li",
">",
"<li",
">",
"CudaDevP2PAttrNativeAtomicSupported",
":",
"1",
"if",
"native",
"atomic",
"operations",
"over",
"the",
"link",
"are",
"supported",
".",
"<",
"/",
"li",
">",
"<",
"/",
"ul",
">",
"<br",
">",
"Returns",
"::",
"cudaErrorInvalidDevice",
"if",
"srcDevice",
"or",
"dstDevice",
"are",
"not",
"valid",
"or",
"if",
"they",
"represent",
"the",
"same",
"device",
".",
"<br",
">",
"<br",
">",
"Returns",
"::",
"cudaErrorInvalidValue",
"if",
"attrib",
"is",
"not",
"valid",
"or",
"if",
"value",
"is",
"a",
"null",
"pointer",
".",
"<br",
">"
]
| train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L1751-L1754 |
cdk/cdk | tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaManipulator.java | MolecularFormulaManipulator.getAtomContainer | public static IAtomContainer getAtomContainer(IMolecularFormula formula, IAtomContainer atomContainer) {
"""
Method that actually does the work of convert the IMolecularFormula
to IAtomContainer given a IAtomContainer.
<p> The hydrogens must be implicit.
@param formula IMolecularFormula object
@param atomContainer IAtomContainer to put the new Elements
@return the filled AtomContainer
@see #getAtomContainer(IMolecularFormula)
"""
for (IIsotope isotope : formula.isotopes()) {
int occur = formula.getIsotopeCount(isotope);
for (int i = 0; i < occur; i++) {
IAtom atom = formula.getBuilder().newInstance(IAtom.class, isotope);
atom.setImplicitHydrogenCount(0);
atomContainer.addAtom(atom);
}
}
return atomContainer;
} | java | public static IAtomContainer getAtomContainer(IMolecularFormula formula, IAtomContainer atomContainer) {
for (IIsotope isotope : formula.isotopes()) {
int occur = formula.getIsotopeCount(isotope);
for (int i = 0; i < occur; i++) {
IAtom atom = formula.getBuilder().newInstance(IAtom.class, isotope);
atom.setImplicitHydrogenCount(0);
atomContainer.addAtom(atom);
}
}
return atomContainer;
} | [
"public",
"static",
"IAtomContainer",
"getAtomContainer",
"(",
"IMolecularFormula",
"formula",
",",
"IAtomContainer",
"atomContainer",
")",
"{",
"for",
"(",
"IIsotope",
"isotope",
":",
"formula",
".",
"isotopes",
"(",
")",
")",
"{",
"int",
"occur",
"=",
"formula",
".",
"getIsotopeCount",
"(",
"isotope",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"occur",
";",
"i",
"++",
")",
"{",
"IAtom",
"atom",
"=",
"formula",
".",
"getBuilder",
"(",
")",
".",
"newInstance",
"(",
"IAtom",
".",
"class",
",",
"isotope",
")",
";",
"atom",
".",
"setImplicitHydrogenCount",
"(",
"0",
")",
";",
"atomContainer",
".",
"addAtom",
"(",
"atom",
")",
";",
"}",
"}",
"return",
"atomContainer",
";",
"}"
]
| Method that actually does the work of convert the IMolecularFormula
to IAtomContainer given a IAtomContainer.
<p> The hydrogens must be implicit.
@param formula IMolecularFormula object
@param atomContainer IAtomContainer to put the new Elements
@return the filled AtomContainer
@see #getAtomContainer(IMolecularFormula) | [
"Method",
"that",
"actually",
"does",
"the",
"work",
"of",
"convert",
"the",
"IMolecularFormula",
"to",
"IAtomContainer",
"given",
"a",
"IAtomContainer",
".",
"<p",
">",
"The",
"hydrogens",
"must",
"be",
"implicit",
"."
]
| train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaManipulator.java#L1110-L1121 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/html/Page.java | Page.setBase | public final Page setBase(String target, String href) {
"""
Set the URL Base for the Page.
@param target Default link target, null if none.
@param href Default absolute href, null if none.
@return This Page (for chained commands)
"""
base="<base " +
((target!=null)?("TARGET=\""+target+"\""):"") +
((href!=null)?("HREF=\""+href+"\""):"") +
">";
return this;
} | java | public final Page setBase(String target, String href)
{
base="<base " +
((target!=null)?("TARGET=\""+target+"\""):"") +
((href!=null)?("HREF=\""+href+"\""):"") +
">";
return this;
} | [
"public",
"final",
"Page",
"setBase",
"(",
"String",
"target",
",",
"String",
"href",
")",
"{",
"base",
"=",
"\"<base \"",
"+",
"(",
"(",
"target",
"!=",
"null",
")",
"?",
"(",
"\"TARGET=\\\"\"",
"+",
"target",
"+",
"\"\\\"\"",
")",
":",
"\"\"",
")",
"+",
"(",
"(",
"href",
"!=",
"null",
")",
"?",
"(",
"\"HREF=\\\"\"",
"+",
"href",
"+",
"\"\\\"\"",
")",
":",
"\"\"",
")",
"+",
"\">\"",
";",
"return",
"this",
";",
"}"
]
| Set the URL Base for the Page.
@param target Default link target, null if none.
@param href Default absolute href, null if none.
@return This Page (for chained commands) | [
"Set",
"the",
"URL",
"Base",
"for",
"the",
"Page",
"."
]
| train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/html/Page.java#L166-L173 |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java | KickflipApiClient.startStream | public void startStream(Stream stream, final KickflipCallback cb) {
"""
Start a new Stream. Must be called after
{@link io.kickflip.sdk.api.KickflipApiClient#createNewUser(KickflipCallback)}
Delivers stream endpoint destination data via a {@link io.kickflip.sdk.api.KickflipCallback}.
@param cb This callback will receive a Stream subclass in {@link io.kickflip.sdk.api.KickflipCallback#onSuccess(io.kickflip.sdk.api.json.Response)}
depending on the Kickflip account type. Implementors should
check if the response is instanceof HlsStream, RtmpStream, etc.
"""
if (!assertActiveUserAvailable(cb)) return;
checkNotNull(stream);
startStreamWithUser(getActiveUser(), stream, cb);
} | java | public void startStream(Stream stream, final KickflipCallback cb) {
if (!assertActiveUserAvailable(cb)) return;
checkNotNull(stream);
startStreamWithUser(getActiveUser(), stream, cb);
} | [
"public",
"void",
"startStream",
"(",
"Stream",
"stream",
",",
"final",
"KickflipCallback",
"cb",
")",
"{",
"if",
"(",
"!",
"assertActiveUserAvailable",
"(",
"cb",
")",
")",
"return",
";",
"checkNotNull",
"(",
"stream",
")",
";",
"startStreamWithUser",
"(",
"getActiveUser",
"(",
")",
",",
"stream",
",",
"cb",
")",
";",
"}"
]
| Start a new Stream. Must be called after
{@link io.kickflip.sdk.api.KickflipApiClient#createNewUser(KickflipCallback)}
Delivers stream endpoint destination data via a {@link io.kickflip.sdk.api.KickflipCallback}.
@param cb This callback will receive a Stream subclass in {@link io.kickflip.sdk.api.KickflipCallback#onSuccess(io.kickflip.sdk.api.json.Response)}
depending on the Kickflip account type. Implementors should
check if the response is instanceof HlsStream, RtmpStream, etc. | [
"Start",
"a",
"new",
"Stream",
".",
"Must",
"be",
"called",
"after",
"{",
"@link",
"io",
".",
"kickflip",
".",
"sdk",
".",
"api",
".",
"KickflipApiClient#createNewUser",
"(",
"KickflipCallback",
")",
"}",
"Delivers",
"stream",
"endpoint",
"destination",
"data",
"via",
"a",
"{",
"@link",
"io",
".",
"kickflip",
".",
"sdk",
".",
"api",
".",
"KickflipCallback",
"}",
"."
]
| train | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java#L315-L319 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/instance/ServerSocketHelper.java | ServerSocketHelper.createServerSocketChannel | static ServerSocketChannel createServerSocketChannel(ILogger logger, EndpointConfig endpointConfig, InetAddress bindAddress,
int port, int portCount, boolean isPortAutoIncrement,
boolean isReuseAddress, boolean bindAny) {
"""
Creates and binds {@code ServerSocketChannel} using {@code bindAddress} and {@code initialPort}.
<p>
If the {@code initialPort} is in use, then an available port can be selected by doing an incremental port
search if {@link NetworkConfig#isPortAutoIncrement()} allows.
<p>
When both {@code initialPort} and {@link NetworkConfig#getPort()} are zero, then an ephemeral port will be used.
<p>
When {@code bindAny} is {@code false}, {@code ServerSocket} will be bound to specific {@code bindAddress}.
Otherwise, it will be bound to any local address ({@code 0.0.0.0}).
@param logger logger instance
@param endpointConfig the {@link EndpointConfig} that supplies network configuration for the
server socket
@param bindAddress InetAddress to bind created {@code ServerSocket}
@param port initial port number to attempt to bind
@param portCount count of subsequent ports to attempt to bind to if initial port is already bound
@param isPortAutoIncrement when {@code true} attempt to bind to {@code portCount} subsequent ports
after {@code port} is found already bound
@param isReuseAddress sets reuse address socket option
@param bindAny when {@code true} bind any local address otherwise bind given {@code bindAddress}
@return actual port number that created {@code ServerSocketChannel} is bound to
"""
logger.finest("inet reuseAddress:" + isReuseAddress);
if (port == 0) {
logger.info("No explicit port is given, system will pick up an ephemeral port.");
}
int portTrialCount = port > 0 && isPortAutoIncrement ? portCount : 1;
try {
return tryOpenServerSocketChannel(endpointConfig, bindAddress, port, isReuseAddress, portTrialCount, bindAny, logger);
} catch (IOException e) {
String message = "Cannot bind to a given address: " + bindAddress + ". Hazelcast cannot start. ";
if (isPortAutoIncrement) {
message += "Config-port: " + port + ", latest-port: " + (port + portTrialCount - 1);
} else {
message += "Port [" + port + "] is already in use and auto-increment is disabled.";
}
throw new HazelcastException(message, e);
}
} | java | static ServerSocketChannel createServerSocketChannel(ILogger logger, EndpointConfig endpointConfig, InetAddress bindAddress,
int port, int portCount, boolean isPortAutoIncrement,
boolean isReuseAddress, boolean bindAny) {
logger.finest("inet reuseAddress:" + isReuseAddress);
if (port == 0) {
logger.info("No explicit port is given, system will pick up an ephemeral port.");
}
int portTrialCount = port > 0 && isPortAutoIncrement ? portCount : 1;
try {
return tryOpenServerSocketChannel(endpointConfig, bindAddress, port, isReuseAddress, portTrialCount, bindAny, logger);
} catch (IOException e) {
String message = "Cannot bind to a given address: " + bindAddress + ". Hazelcast cannot start. ";
if (isPortAutoIncrement) {
message += "Config-port: " + port + ", latest-port: " + (port + portTrialCount - 1);
} else {
message += "Port [" + port + "] is already in use and auto-increment is disabled.";
}
throw new HazelcastException(message, e);
}
} | [
"static",
"ServerSocketChannel",
"createServerSocketChannel",
"(",
"ILogger",
"logger",
",",
"EndpointConfig",
"endpointConfig",
",",
"InetAddress",
"bindAddress",
",",
"int",
"port",
",",
"int",
"portCount",
",",
"boolean",
"isPortAutoIncrement",
",",
"boolean",
"isReuseAddress",
",",
"boolean",
"bindAny",
")",
"{",
"logger",
".",
"finest",
"(",
"\"inet reuseAddress:\"",
"+",
"isReuseAddress",
")",
";",
"if",
"(",
"port",
"==",
"0",
")",
"{",
"logger",
".",
"info",
"(",
"\"No explicit port is given, system will pick up an ephemeral port.\"",
")",
";",
"}",
"int",
"portTrialCount",
"=",
"port",
">",
"0",
"&&",
"isPortAutoIncrement",
"?",
"portCount",
":",
"1",
";",
"try",
"{",
"return",
"tryOpenServerSocketChannel",
"(",
"endpointConfig",
",",
"bindAddress",
",",
"port",
",",
"isReuseAddress",
",",
"portTrialCount",
",",
"bindAny",
",",
"logger",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"String",
"message",
"=",
"\"Cannot bind to a given address: \"",
"+",
"bindAddress",
"+",
"\". Hazelcast cannot start. \"",
";",
"if",
"(",
"isPortAutoIncrement",
")",
"{",
"message",
"+=",
"\"Config-port: \"",
"+",
"port",
"+",
"\", latest-port: \"",
"+",
"(",
"port",
"+",
"portTrialCount",
"-",
"1",
")",
";",
"}",
"else",
"{",
"message",
"+=",
"\"Port [\"",
"+",
"port",
"+",
"\"] is already in use and auto-increment is disabled.\"",
";",
"}",
"throw",
"new",
"HazelcastException",
"(",
"message",
",",
"e",
")",
";",
"}",
"}"
]
| Creates and binds {@code ServerSocketChannel} using {@code bindAddress} and {@code initialPort}.
<p>
If the {@code initialPort} is in use, then an available port can be selected by doing an incremental port
search if {@link NetworkConfig#isPortAutoIncrement()} allows.
<p>
When both {@code initialPort} and {@link NetworkConfig#getPort()} are zero, then an ephemeral port will be used.
<p>
When {@code bindAny} is {@code false}, {@code ServerSocket} will be bound to specific {@code bindAddress}.
Otherwise, it will be bound to any local address ({@code 0.0.0.0}).
@param logger logger instance
@param endpointConfig the {@link EndpointConfig} that supplies network configuration for the
server socket
@param bindAddress InetAddress to bind created {@code ServerSocket}
@param port initial port number to attempt to bind
@param portCount count of subsequent ports to attempt to bind to if initial port is already bound
@param isPortAutoIncrement when {@code true} attempt to bind to {@code portCount} subsequent ports
after {@code port} is found already bound
@param isReuseAddress sets reuse address socket option
@param bindAny when {@code true} bind any local address otherwise bind given {@code bindAddress}
@return actual port number that created {@code ServerSocketChannel} is bound to | [
"Creates",
"and",
"binds",
"{",
"@code",
"ServerSocketChannel",
"}",
"using",
"{",
"@code",
"bindAddress",
"}",
"and",
"{",
"@code",
"initialPort",
"}",
".",
"<p",
">",
"If",
"the",
"{",
"@code",
"initialPort",
"}",
"is",
"in",
"use",
"then",
"an",
"available",
"port",
"can",
"be",
"selected",
"by",
"doing",
"an",
"incremental",
"port",
"search",
"if",
"{",
"@link",
"NetworkConfig#isPortAutoIncrement",
"()",
"}",
"allows",
".",
"<p",
">",
"When",
"both",
"{",
"@code",
"initialPort",
"}",
"and",
"{",
"@link",
"NetworkConfig#getPort",
"()",
"}",
"are",
"zero",
"then",
"an",
"ephemeral",
"port",
"will",
"be",
"used",
".",
"<p",
">",
"When",
"{",
"@code",
"bindAny",
"}",
"is",
"{",
"@code",
"false",
"}",
"{",
"@code",
"ServerSocket",
"}",
"will",
"be",
"bound",
"to",
"specific",
"{",
"@code",
"bindAddress",
"}",
".",
"Otherwise",
"it",
"will",
"be",
"bound",
"to",
"any",
"local",
"address",
"(",
"{",
"@code",
"0",
".",
"0",
".",
"0",
".",
"0",
"}",
")",
"."
]
| train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/instance/ServerSocketHelper.java#L65-L86 |
infinispan/infinispan | commons/src/main/java/org/infinispan/commons/util/ReflectionUtil.java | ReflectionUtil.inspectRecursively | private static void inspectRecursively(Class<?> c, List<Method> s, Class<? extends Annotation> annotationType) {
"""
Inspects a class and its superclasses (all the way to {@link Object} for method instances that contain a given
annotation. This even identifies private, package and protected methods, not just public ones.
"""
for (Method m : c.getDeclaredMethods()) {
// don't bother if this method has already been overridden by a subclass
if (notFound(m, s) && m.isAnnotationPresent(annotationType)) {
s.add(m);
}
}
if (!c.equals(Object.class)) {
if (!c.isInterface()) {
inspectRecursively(c.getSuperclass(), s, annotationType);
}
for (Class<?> ifc : c.getInterfaces()) inspectRecursively(ifc, s, annotationType);
}
} | java | private static void inspectRecursively(Class<?> c, List<Method> s, Class<? extends Annotation> annotationType) {
for (Method m : c.getDeclaredMethods()) {
// don't bother if this method has already been overridden by a subclass
if (notFound(m, s) && m.isAnnotationPresent(annotationType)) {
s.add(m);
}
}
if (!c.equals(Object.class)) {
if (!c.isInterface()) {
inspectRecursively(c.getSuperclass(), s, annotationType);
}
for (Class<?> ifc : c.getInterfaces()) inspectRecursively(ifc, s, annotationType);
}
} | [
"private",
"static",
"void",
"inspectRecursively",
"(",
"Class",
"<",
"?",
">",
"c",
",",
"List",
"<",
"Method",
">",
"s",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
")",
"{",
"for",
"(",
"Method",
"m",
":",
"c",
".",
"getDeclaredMethods",
"(",
")",
")",
"{",
"// don't bother if this method has already been overridden by a subclass",
"if",
"(",
"notFound",
"(",
"m",
",",
"s",
")",
"&&",
"m",
".",
"isAnnotationPresent",
"(",
"annotationType",
")",
")",
"{",
"s",
".",
"add",
"(",
"m",
")",
";",
"}",
"}",
"if",
"(",
"!",
"c",
".",
"equals",
"(",
"Object",
".",
"class",
")",
")",
"{",
"if",
"(",
"!",
"c",
".",
"isInterface",
"(",
")",
")",
"{",
"inspectRecursively",
"(",
"c",
".",
"getSuperclass",
"(",
")",
",",
"s",
",",
"annotationType",
")",
";",
"}",
"for",
"(",
"Class",
"<",
"?",
">",
"ifc",
":",
"c",
".",
"getInterfaces",
"(",
")",
")",
"inspectRecursively",
"(",
"ifc",
",",
"s",
",",
"annotationType",
")",
";",
"}",
"}"
]
| Inspects a class and its superclasses (all the way to {@link Object} for method instances that contain a given
annotation. This even identifies private, package and protected methods, not just public ones. | [
"Inspects",
"a",
"class",
"and",
"its",
"superclasses",
"(",
"all",
"the",
"way",
"to",
"{"
]
| train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/util/ReflectionUtil.java#L115-L130 |
alexvasilkov/GestureViews | library/src/main/java/com/alexvasilkov/gestures/StateController.java | StateController.getMovementArea | public void getMovementArea(State state, RectF out) {
"""
Calculates area in which {@link State#getX()} & {@link State#getY()} values can change.
Note, that this is different from {@link Settings#setMovementArea(int, int)} which defines
part of the viewport in which image can move.
@param state Current state
@param out Output movement area rectangle
"""
movBounds.set(state).getExternalBounds(out);
} | java | public void getMovementArea(State state, RectF out) {
movBounds.set(state).getExternalBounds(out);
} | [
"public",
"void",
"getMovementArea",
"(",
"State",
"state",
",",
"RectF",
"out",
")",
"{",
"movBounds",
".",
"set",
"(",
"state",
")",
".",
"getExternalBounds",
"(",
"out",
")",
";",
"}"
]
| Calculates area in which {@link State#getX()} & {@link State#getY()} values can change.
Note, that this is different from {@link Settings#setMovementArea(int, int)} which defines
part of the viewport in which image can move.
@param state Current state
@param out Output movement area rectangle | [
"Calculates",
"area",
"in",
"which",
"{",
"@link",
"State#getX",
"()",
"}",
"&",
";",
"{",
"@link",
"State#getY",
"()",
"}",
"values",
"can",
"change",
".",
"Note",
"that",
"this",
"is",
"different",
"from",
"{",
"@link",
"Settings#setMovementArea",
"(",
"int",
"int",
")",
"}",
"which",
"defines",
"part",
"of",
"the",
"viewport",
"in",
"which",
"image",
"can",
"move",
"."
]
| train | https://github.com/alexvasilkov/GestureViews/blob/f0a4c266e31dcad23bd0d9013531bc1c501b9c9f/library/src/main/java/com/alexvasilkov/gestures/StateController.java#L322-L324 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.writeUtf8 | public static void writeUtf8(OutputStream out, boolean isCloseOut, Object... contents) throws IORuntimeException {
"""
将多部分内容写到流中,自动转换为UTF-8字符串
@param out 输出流
@param isCloseOut 写入完毕是否关闭输出流
@param contents 写入的内容,调用toString()方法,不包括不会自动换行
@throws IORuntimeException IO异常
@since 3.1.1
"""
write(out, CharsetUtil.CHARSET_UTF_8, isCloseOut, contents);
} | java | public static void writeUtf8(OutputStream out, boolean isCloseOut, Object... contents) throws IORuntimeException {
write(out, CharsetUtil.CHARSET_UTF_8, isCloseOut, contents);
} | [
"public",
"static",
"void",
"writeUtf8",
"(",
"OutputStream",
"out",
",",
"boolean",
"isCloseOut",
",",
"Object",
"...",
"contents",
")",
"throws",
"IORuntimeException",
"{",
"write",
"(",
"out",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
",",
"isCloseOut",
",",
"contents",
")",
";",
"}"
]
| 将多部分内容写到流中,自动转换为UTF-8字符串
@param out 输出流
@param isCloseOut 写入完毕是否关闭输出流
@param contents 写入的内容,调用toString()方法,不包括不会自动换行
@throws IORuntimeException IO异常
@since 3.1.1 | [
"将多部分内容写到流中,自动转换为UTF",
"-",
"8字符串"
]
| train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L878-L880 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/RolesInner.java | RolesInner.listByDataBoxEdgeDeviceAsync | public Observable<Page<RoleInner>> listByDataBoxEdgeDeviceAsync(final String deviceName, final String resourceGroupName) {
"""
Lists all the roles configured in a data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<RoleInner> object
"""
return listByDataBoxEdgeDeviceWithServiceResponseAsync(deviceName, resourceGroupName)
.map(new Func1<ServiceResponse<Page<RoleInner>>, Page<RoleInner>>() {
@Override
public Page<RoleInner> call(ServiceResponse<Page<RoleInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<RoleInner>> listByDataBoxEdgeDeviceAsync(final String deviceName, final String resourceGroupName) {
return listByDataBoxEdgeDeviceWithServiceResponseAsync(deviceName, resourceGroupName)
.map(new Func1<ServiceResponse<Page<RoleInner>>, Page<RoleInner>>() {
@Override
public Page<RoleInner> call(ServiceResponse<Page<RoleInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"RoleInner",
">",
">",
"listByDataBoxEdgeDeviceAsync",
"(",
"final",
"String",
"deviceName",
",",
"final",
"String",
"resourceGroupName",
")",
"{",
"return",
"listByDataBoxEdgeDeviceWithServiceResponseAsync",
"(",
"deviceName",
",",
"resourceGroupName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"RoleInner",
">",
">",
",",
"Page",
"<",
"RoleInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"RoleInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"RoleInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Lists all the roles configured in a data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<RoleInner> object | [
"Lists",
"all",
"the",
"roles",
"configured",
"in",
"a",
"data",
"box",
"edge",
"/",
"gateway",
"device",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/RolesInner.java#L143-L151 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/MessagesApi.java | MessagesApi.getLastNormalizedMessages | public NormalizedMessagesEnvelope getLastNormalizedMessages(Integer count, String sdids, String fieldPresence) throws ApiException {
"""
Get Last Normalized Message
Get last messages normalized.
@param count Number of items to return per query. (optional)
@param sdids Comma separated list of source device IDs (minimum: 1). (optional)
@param fieldPresence String representing a field from the specified device ID. (optional)
@return NormalizedMessagesEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
"""
ApiResponse<NormalizedMessagesEnvelope> resp = getLastNormalizedMessagesWithHttpInfo(count, sdids, fieldPresence);
return resp.getData();
} | java | public NormalizedMessagesEnvelope getLastNormalizedMessages(Integer count, String sdids, String fieldPresence) throws ApiException {
ApiResponse<NormalizedMessagesEnvelope> resp = getLastNormalizedMessagesWithHttpInfo(count, sdids, fieldPresence);
return resp.getData();
} | [
"public",
"NormalizedMessagesEnvelope",
"getLastNormalizedMessages",
"(",
"Integer",
"count",
",",
"String",
"sdids",
",",
"String",
"fieldPresence",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"NormalizedMessagesEnvelope",
">",
"resp",
"=",
"getLastNormalizedMessagesWithHttpInfo",
"(",
"count",
",",
"sdids",
",",
"fieldPresence",
")",
";",
"return",
"resp",
".",
"getData",
"(",
")",
";",
"}"
]
| Get Last Normalized Message
Get last messages normalized.
@param count Number of items to return per query. (optional)
@param sdids Comma separated list of source device IDs (minimum: 1). (optional)
@param fieldPresence String representing a field from the specified device ID. (optional)
@return NormalizedMessagesEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"Last",
"Normalized",
"Message",
"Get",
"last",
"messages",
"normalized",
"."
]
| train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/MessagesApi.java#L429-L432 |
mygreen/super-csv-annotation | src/main/java/com/github/mygreen/supercsv/io/LazyCsvAnnotationBeanWriter.java | LazyCsvAnnotationBeanWriter.writeAll | public void writeAll(final Collection<T> sources, final boolean continueOnError) throws IOException {
"""
レコードのデータを全て書き込みます。
<p>ヘッダー行も自動的に処理されます。2回目以降に呼び出した場合、ヘッダー情報は書き込まれません。</p>
@param sources 書き込むレコードのデータ。
@param continueOnError continueOnError レコードの処理中に、
例外{@link SuperCsvBindingException}が発生しても、続行するかどうか指定します。
trueの場合、例外が発生しても、次の処理を行います。
@throws NullPointerException sources is null.
@throws IOException レコードの出力に失敗した場合。
@throws SuperCsvBindingException セルの値に問題がある場合
@throws SuperCsvException 設定など、その他に問題がある場合
"""
Objects.requireNonNull(sources, "sources should not be null.");
if(!initialized) {
init();
}
if(beanMappingCache.getOriginal().isHeader() && getLineNumber() == 0) {
writeHeader();
}
for(T record : sources) {
try {
write(record);
} catch(SuperCsvBindingException e) {
if(!continueOnError) {
throw e;
}
}
}
super.flush();
} | java | public void writeAll(final Collection<T> sources, final boolean continueOnError) throws IOException {
Objects.requireNonNull(sources, "sources should not be null.");
if(!initialized) {
init();
}
if(beanMappingCache.getOriginal().isHeader() && getLineNumber() == 0) {
writeHeader();
}
for(T record : sources) {
try {
write(record);
} catch(SuperCsvBindingException e) {
if(!continueOnError) {
throw e;
}
}
}
super.flush();
} | [
"public",
"void",
"writeAll",
"(",
"final",
"Collection",
"<",
"T",
">",
"sources",
",",
"final",
"boolean",
"continueOnError",
")",
"throws",
"IOException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"sources",
",",
"\"sources should not be null.\"",
")",
";",
"if",
"(",
"!",
"initialized",
")",
"{",
"init",
"(",
")",
";",
"}",
"if",
"(",
"beanMappingCache",
".",
"getOriginal",
"(",
")",
".",
"isHeader",
"(",
")",
"&&",
"getLineNumber",
"(",
")",
"==",
"0",
")",
"{",
"writeHeader",
"(",
")",
";",
"}",
"for",
"(",
"T",
"record",
":",
"sources",
")",
"{",
"try",
"{",
"write",
"(",
"record",
")",
";",
"}",
"catch",
"(",
"SuperCsvBindingException",
"e",
")",
"{",
"if",
"(",
"!",
"continueOnError",
")",
"{",
"throw",
"e",
";",
"}",
"}",
"}",
"super",
".",
"flush",
"(",
")",
";",
"}"
]
| レコードのデータを全て書き込みます。
<p>ヘッダー行も自動的に処理されます。2回目以降に呼び出した場合、ヘッダー情報は書き込まれません。</p>
@param sources 書き込むレコードのデータ。
@param continueOnError continueOnError レコードの処理中に、
例外{@link SuperCsvBindingException}が発生しても、続行するかどうか指定します。
trueの場合、例外が発生しても、次の処理を行います。
@throws NullPointerException sources is null.
@throws IOException レコードの出力に失敗した場合。
@throws SuperCsvBindingException セルの値に問題がある場合
@throws SuperCsvException 設定など、その他に問題がある場合 | [
"レコードのデータを全て書き込みます。",
"<p",
">",
"ヘッダー行も自動的に処理されます。2回目以降に呼び出した場合、ヘッダー情報は書き込まれません。<",
"/",
"p",
">"
]
| train | https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/io/LazyCsvAnnotationBeanWriter.java#L251-L275 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/client/builder/AwsClientBuilder.java | AwsClientBuilder.putAdvancedConfig | protected final <T> void putAdvancedConfig(AdvancedConfig.Key<T> key, T value) {
"""
Sets the value of an advanced config option.
@param key Key of value to set.
@param value The new value.
@param <T> Type of value.
"""
advancedConfig.put(key, value);
} | java | protected final <T> void putAdvancedConfig(AdvancedConfig.Key<T> key, T value) {
advancedConfig.put(key, value);
} | [
"protected",
"final",
"<",
"T",
">",
"void",
"putAdvancedConfig",
"(",
"AdvancedConfig",
".",
"Key",
"<",
"T",
">",
"key",
",",
"T",
"value",
")",
"{",
"advancedConfig",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
]
| Sets the value of an advanced config option.
@param key Key of value to set.
@param value The new value.
@param <T> Type of value. | [
"Sets",
"the",
"value",
"of",
"an",
"advanced",
"config",
"option",
"."
]
| train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/client/builder/AwsClientBuilder.java#L410-L412 |
iobeam/iobeam-client-java | src/main/java/com/iobeam/api/client/Iobeam.java | Iobeam.registerDeviceWithId | @Deprecated
public String registerDeviceWithId(String deviceId, String deviceName)
throws ApiException, IOException {
"""
Registers a device with the provided device ID and device name. This call is <b>BLOCKING</b>
and should not be called on UI threads.
See {@link #registerDevice(Device)} for more details.
@param deviceId The desired id for this device; if null, a random one is assigned.
@param deviceName The desired name for this device; if null, a random one is assigned.
@return The new device id for this device.
@throws ApiException Thrown if the iobeam client is not initialized or there are problems
writing the device ID.
@throws IOException Thrown if network errors occur while trying to register.
@deprecated Use {@link #registerDevice(Device)} instead. Will be removed after 0.6.x
"""
final Device d = new Device.Builder(projectId).id(deviceId).name(deviceName).build();
return registerDevice(d);
} | java | @Deprecated
public String registerDeviceWithId(String deviceId, String deviceName)
throws ApiException, IOException {
final Device d = new Device.Builder(projectId).id(deviceId).name(deviceName).build();
return registerDevice(d);
} | [
"@",
"Deprecated",
"public",
"String",
"registerDeviceWithId",
"(",
"String",
"deviceId",
",",
"String",
"deviceName",
")",
"throws",
"ApiException",
",",
"IOException",
"{",
"final",
"Device",
"d",
"=",
"new",
"Device",
".",
"Builder",
"(",
"projectId",
")",
".",
"id",
"(",
"deviceId",
")",
".",
"name",
"(",
"deviceName",
")",
".",
"build",
"(",
")",
";",
"return",
"registerDevice",
"(",
"d",
")",
";",
"}"
]
| Registers a device with the provided device ID and device name. This call is <b>BLOCKING</b>
and should not be called on UI threads.
See {@link #registerDevice(Device)} for more details.
@param deviceId The desired id for this device; if null, a random one is assigned.
@param deviceName The desired name for this device; if null, a random one is assigned.
@return The new device id for this device.
@throws ApiException Thrown if the iobeam client is not initialized or there are problems
writing the device ID.
@throws IOException Thrown if network errors occur while trying to register.
@deprecated Use {@link #registerDevice(Device)} instead. Will be removed after 0.6.x | [
"Registers",
"a",
"device",
"with",
"the",
"provided",
"device",
"ID",
"and",
"device",
"name",
".",
"This",
"call",
"is",
"<b",
">",
"BLOCKING<",
"/",
"b",
">",
"and",
"should",
"not",
"be",
"called",
"on",
"UI",
"threads",
"."
]
| train | https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/Iobeam.java#L439-L444 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java | AiMaterial.getTextureUVIndex | public int getTextureUVIndex(AiTextureType type, int index) {
"""
Returns the index of the UV coordinate set used by the texture.<p>
If missing, defaults to 0
@param type the texture type
@param index the index in the texture stack
@return the UV index
@throws IndexOutOfBoundsException if index is invalid
"""
checkTexRange(type, index);
return getTyped(PropertyKey.TEX_UV_INDEX, type, index, Integer.class);
} | java | public int getTextureUVIndex(AiTextureType type, int index) {
checkTexRange(type, index);
return getTyped(PropertyKey.TEX_UV_INDEX, type, index, Integer.class);
} | [
"public",
"int",
"getTextureUVIndex",
"(",
"AiTextureType",
"type",
",",
"int",
"index",
")",
"{",
"checkTexRange",
"(",
"type",
",",
"index",
")",
";",
"return",
"getTyped",
"(",
"PropertyKey",
".",
"TEX_UV_INDEX",
",",
"type",
",",
"index",
",",
"Integer",
".",
"class",
")",
";",
"}"
]
| Returns the index of the UV coordinate set used by the texture.<p>
If missing, defaults to 0
@param type the texture type
@param index the index in the texture stack
@return the UV index
@throws IndexOutOfBoundsException if index is invalid | [
"Returns",
"the",
"index",
"of",
"the",
"UV",
"coordinate",
"set",
"used",
"by",
"the",
"texture",
".",
"<p",
">"
]
| train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java#L923-L927 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.