repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
forge/core | ui/api/src/main/java/org/jboss/forge/addon/ui/util/InputComponents.java | InputComponents.validateRequired | public static String validateRequired(final InputComponent<?, ?> input)
{
String requiredMessage = null;
if (input.isEnabled() && input.isRequired() && !InputComponents.hasValue(input))
{
requiredMessage = input.getRequiredMessage();
if (Strings.isNullOrEmpty(requiredMessage))
{
String labelValue = input.getLabel() == null ? input.getName() : input.getLabel();
// Chop : off
if (labelValue.endsWith(COLON))
{
labelValue = labelValue.substring(0, labelValue.length() - 1);
}
requiredMessage = labelValue + " must be specified.";
}
}
return requiredMessage;
} | java | public static String validateRequired(final InputComponent<?, ?> input)
{
String requiredMessage = null;
if (input.isEnabled() && input.isRequired() && !InputComponents.hasValue(input))
{
requiredMessage = input.getRequiredMessage();
if (Strings.isNullOrEmpty(requiredMessage))
{
String labelValue = input.getLabel() == null ? input.getName() : input.getLabel();
// Chop : off
if (labelValue.endsWith(COLON))
{
labelValue = labelValue.substring(0, labelValue.length() - 1);
}
requiredMessage = labelValue + " must be specified.";
}
}
return requiredMessage;
} | [
"public",
"static",
"String",
"validateRequired",
"(",
"final",
"InputComponent",
"<",
"?",
",",
"?",
">",
"input",
")",
"{",
"String",
"requiredMessage",
"=",
"null",
";",
"if",
"(",
"input",
".",
"isEnabled",
"(",
")",
"&&",
"input",
".",
"isRequired",
... | Validate if an required and enabled input has a value. If not, return the error message.
@param input
@return | [
"Validate",
"if",
"an",
"required",
"and",
"enabled",
"input",
"has",
"a",
"value",
".",
"If",
"not",
"return",
"the",
"error",
"message",
"."
] | train | https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/ui/api/src/main/java/org/jboss/forge/addon/ui/util/InputComponents.java#L325-L343 |
OpenVidu/openvidu | openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/MediaEndpoint.java | MediaEndpoint.unregisterElementErrListener | protected void unregisterElementErrListener(MediaElement element, final ListenerSubscription subscription) {
if (element == null || subscription == null) {
return;
}
element.removeErrorListener(subscription);
} | java | protected void unregisterElementErrListener(MediaElement element, final ListenerSubscription subscription) {
if (element == null || subscription == null) {
return;
}
element.removeErrorListener(subscription);
} | [
"protected",
"void",
"unregisterElementErrListener",
"(",
"MediaElement",
"element",
",",
"final",
"ListenerSubscription",
"subscription",
")",
"{",
"if",
"(",
"element",
"==",
"null",
"||",
"subscription",
"==",
"null",
")",
"{",
"return",
";",
"}",
"element",
... | Unregisters the error listener from the media element using the provided
subscription.
@param element the {@link MediaElement}
@param subscription the associated {@link ListenerSubscription} | [
"Unregisters",
"the",
"error",
"listener",
"from",
"the",
"media",
"element",
"using",
"the",
"provided",
"subscription",
"."
] | train | https://github.com/OpenVidu/openvidu/blob/89db47dd37949ceab29e5228371a8fcab04d8d55/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/MediaEndpoint.java#L335-L340 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceSegment.java | EventServiceSegment.removeRegistration | public Registration removeRegistration(String topic, String id) {
Registration registration = registrationIdMap.remove(id);
if (registration != null) {
final Collection<Registration> all = registrations.get(topic);
if (all != null) {
all.remove(registration);
}
pingNotifiableEventListener(topic, registration, false);
}
return registration;
} | java | public Registration removeRegistration(String topic, String id) {
Registration registration = registrationIdMap.remove(id);
if (registration != null) {
final Collection<Registration> all = registrations.get(topic);
if (all != null) {
all.remove(registration);
}
pingNotifiableEventListener(topic, registration, false);
}
return registration;
} | [
"public",
"Registration",
"removeRegistration",
"(",
"String",
"topic",
",",
"String",
"id",
")",
"{",
"Registration",
"registration",
"=",
"registrationIdMap",
".",
"remove",
"(",
"id",
")",
";",
"if",
"(",
"registration",
"!=",
"null",
")",
"{",
"final",
"... | Removes the registration matching the {@code topic} and {@code ID}.
Returns the removed registration or {@code null} if none matched.
@param topic the registration topic name
@param id the registration ID
@return the registration which was removed or {@code null} if none matchec | [
"Removes",
"the",
"registration",
"matching",
"the",
"{",
"@code",
"topic",
"}",
"and",
"{",
"@code",
"ID",
"}",
".",
"Returns",
"the",
"removed",
"registration",
"or",
"{",
"@code",
"null",
"}",
"if",
"none",
"matched",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceSegment.java#L171-L181 |
GoogleCloudPlatform/appengine-mapreduce | java/src/main/java/com/google/appengine/tools/mapreduce/inputs/PeekingInputReader.java | PeekingInputReader.peek | public T peek() {
if (peekedItem == null) {
try {
peekedItem = SerializableValue.of(getMarshaller(), super.next());
} catch (NoSuchElementException e) {
// ignore.
} catch (IOException e) {
throw new RuntimeException("Failed to read next input", e);
}
}
return peekedItem == null ? null : peekedItem.getValue();
} | java | public T peek() {
if (peekedItem == null) {
try {
peekedItem = SerializableValue.of(getMarshaller(), super.next());
} catch (NoSuchElementException e) {
// ignore.
} catch (IOException e) {
throw new RuntimeException("Failed to read next input", e);
}
}
return peekedItem == null ? null : peekedItem.getValue();
} | [
"public",
"T",
"peek",
"(",
")",
"{",
"if",
"(",
"peekedItem",
"==",
"null",
")",
"{",
"try",
"{",
"peekedItem",
"=",
"SerializableValue",
".",
"of",
"(",
"getMarshaller",
"(",
")",
",",
"super",
".",
"next",
"(",
")",
")",
";",
"}",
"catch",
"(",
... | Returns the element that will be returned by {@link #next()} next. Or null if there is no next
element. If null elements are allowed in the input, one can distinguish between the end of the
input and a null element by calling {@link #hasNext()}
@throws RuntimeException In the event that reading from input fails. | [
"Returns",
"the",
"element",
"that",
"will",
"be",
"returned",
"by",
"{",
"@link",
"#next",
"()",
"}",
"next",
".",
"Or",
"null",
"if",
"there",
"is",
"no",
"next",
"element",
".",
"If",
"null",
"elements",
"are",
"allowed",
"in",
"the",
"input",
"one"... | train | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/java/src/main/java/com/google/appengine/tools/mapreduce/inputs/PeekingInputReader.java#L55-L66 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/FaxClientSpiFactory.java | FaxClientSpiFactory.createFaxClientSpi | public static FaxClientSpi createFaxClientSpi(String type,Properties configuration)
{
//create fax client SPI
FaxClientSpi faxClientSpi=FaxClientSpiFactory.createFaxClientSpiImpl(type,configuration,false);
return faxClientSpi;
} | java | public static FaxClientSpi createFaxClientSpi(String type,Properties configuration)
{
//create fax client SPI
FaxClientSpi faxClientSpi=FaxClientSpiFactory.createFaxClientSpiImpl(type,configuration,false);
return faxClientSpi;
} | [
"public",
"static",
"FaxClientSpi",
"createFaxClientSpi",
"(",
"String",
"type",
",",
"Properties",
"configuration",
")",
"{",
"//create fax client SPI",
"FaxClientSpi",
"faxClientSpi",
"=",
"FaxClientSpiFactory",
".",
"createFaxClientSpiImpl",
"(",
"type",
",",
"configur... | This function creates a new fax client SPI based on the provided configuration.<br>
This is an internal framework method and should not be invoked by classes outside the
fax4j framework.
@param type
The fax client type (may be null for default type)
@param configuration
The fax client configuration (may be null)
@return The fax client SPI instance | [
"This",
"function",
"creates",
"a",
"new",
"fax",
"client",
"SPI",
"based",
"on",
"the",
"provided",
"configuration",
".",
"<br",
">",
"This",
"is",
"an",
"internal",
"framework",
"method",
"and",
"should",
"not",
"be",
"invoked",
"by",
"classes",
"outside",... | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/FaxClientSpiFactory.java#L198-L204 |
google/truth | core/src/main/java/com/google/common/truth/MultimapSubject.java | MultimapSubject.containsExactlyEntriesIn | @CanIgnoreReturnValue
public Ordered containsExactlyEntriesIn(Multimap<?, ?> expectedMultimap) {
checkNotNull(expectedMultimap, "expectedMultimap");
ListMultimap<?, ?> missing = difference(expectedMultimap, actual());
ListMultimap<?, ?> extra = difference(actual(), expectedMultimap);
// TODO(kak): Possible enhancement: Include "[1 copy]" if the element does appear in
// the subject but not enough times. Similarly for unexpected extra items.
if (!missing.isEmpty()) {
if (!extra.isEmpty()) {
boolean addTypeInfo = hasMatchingToStringPair(missing.entries(), extra.entries());
failWithoutActual(
simpleFact(
lenientFormat(
"Not true that %s contains exactly <%s>. "
+ "It is missing <%s> and has unexpected items <%s>",
actualAsString(),
annotateEmptyStringsMultimap(expectedMultimap),
// Note: The usage of countDuplicatesAndAddTypeInfo() below causes entries no
// longer to be grouped by key in the 'missing' and 'unexpected items' parts of
// the message (we still show the actual and expected multimaps in the standard
// format).
addTypeInfo
? countDuplicatesAndAddTypeInfo(
annotateEmptyStringsMultimap(missing).entries())
: countDuplicatesMultimap(annotateEmptyStringsMultimap(missing)),
addTypeInfo
? countDuplicatesAndAddTypeInfo(
annotateEmptyStringsMultimap(extra).entries())
: countDuplicatesMultimap(annotateEmptyStringsMultimap(extra)))));
return ALREADY_FAILED;
} else {
failWithBadResults(
"contains exactly",
annotateEmptyStringsMultimap(expectedMultimap),
"is missing",
countDuplicatesMultimap(annotateEmptyStringsMultimap(missing)));
return ALREADY_FAILED;
}
} else if (!extra.isEmpty()) {
failWithBadResults(
"contains exactly",
annotateEmptyStringsMultimap(expectedMultimap),
"has unexpected items",
countDuplicatesMultimap(annotateEmptyStringsMultimap(extra)));
return ALREADY_FAILED;
}
return new MultimapInOrder("contains exactly", expectedMultimap);
} | java | @CanIgnoreReturnValue
public Ordered containsExactlyEntriesIn(Multimap<?, ?> expectedMultimap) {
checkNotNull(expectedMultimap, "expectedMultimap");
ListMultimap<?, ?> missing = difference(expectedMultimap, actual());
ListMultimap<?, ?> extra = difference(actual(), expectedMultimap);
// TODO(kak): Possible enhancement: Include "[1 copy]" if the element does appear in
// the subject but not enough times. Similarly for unexpected extra items.
if (!missing.isEmpty()) {
if (!extra.isEmpty()) {
boolean addTypeInfo = hasMatchingToStringPair(missing.entries(), extra.entries());
failWithoutActual(
simpleFact(
lenientFormat(
"Not true that %s contains exactly <%s>. "
+ "It is missing <%s> and has unexpected items <%s>",
actualAsString(),
annotateEmptyStringsMultimap(expectedMultimap),
// Note: The usage of countDuplicatesAndAddTypeInfo() below causes entries no
// longer to be grouped by key in the 'missing' and 'unexpected items' parts of
// the message (we still show the actual and expected multimaps in the standard
// format).
addTypeInfo
? countDuplicatesAndAddTypeInfo(
annotateEmptyStringsMultimap(missing).entries())
: countDuplicatesMultimap(annotateEmptyStringsMultimap(missing)),
addTypeInfo
? countDuplicatesAndAddTypeInfo(
annotateEmptyStringsMultimap(extra).entries())
: countDuplicatesMultimap(annotateEmptyStringsMultimap(extra)))));
return ALREADY_FAILED;
} else {
failWithBadResults(
"contains exactly",
annotateEmptyStringsMultimap(expectedMultimap),
"is missing",
countDuplicatesMultimap(annotateEmptyStringsMultimap(missing)));
return ALREADY_FAILED;
}
} else if (!extra.isEmpty()) {
failWithBadResults(
"contains exactly",
annotateEmptyStringsMultimap(expectedMultimap),
"has unexpected items",
countDuplicatesMultimap(annotateEmptyStringsMultimap(extra)));
return ALREADY_FAILED;
}
return new MultimapInOrder("contains exactly", expectedMultimap);
} | [
"@",
"CanIgnoreReturnValue",
"public",
"Ordered",
"containsExactlyEntriesIn",
"(",
"Multimap",
"<",
"?",
",",
"?",
">",
"expectedMultimap",
")",
"{",
"checkNotNull",
"(",
"expectedMultimap",
",",
"\"expectedMultimap\"",
")",
";",
"ListMultimap",
"<",
"?",
",",
"?"... | Fails if the {@link Multimap} does not contain precisely the same entries as the argument
{@link Multimap}.
<p>A subsequent call to {@link Ordered#inOrder} may be made if the caller wishes to verify that
the two multimaps iterate fully in the same order. That is, their key sets iterate in the same
order, and the value collections for each key iterate in the same order. | [
"Fails",
"if",
"the",
"{",
"@link",
"Multimap",
"}",
"does",
"not",
"contain",
"precisely",
"the",
"same",
"entries",
"as",
"the",
"argument",
"{",
"@link",
"Multimap",
"}",
"."
] | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/MultimapSubject.java#L205-L254 |
mozilla/rhino | src/org/mozilla/javascript/ScriptableObject.java | ScriptableObject.get | @Override
public Object get(int index, Scriptable start)
{
if (externalData != null) {
if (index < externalData.getArrayLength()) {
return externalData.getArrayElement(index);
}
return Scriptable.NOT_FOUND;
}
Slot slot = slotMap.query(null, index);
if (slot == null) {
return Scriptable.NOT_FOUND;
}
return slot.getValue(start);
} | java | @Override
public Object get(int index, Scriptable start)
{
if (externalData != null) {
if (index < externalData.getArrayLength()) {
return externalData.getArrayElement(index);
}
return Scriptable.NOT_FOUND;
}
Slot slot = slotMap.query(null, index);
if (slot == null) {
return Scriptable.NOT_FOUND;
}
return slot.getValue(start);
} | [
"@",
"Override",
"public",
"Object",
"get",
"(",
"int",
"index",
",",
"Scriptable",
"start",
")",
"{",
"if",
"(",
"externalData",
"!=",
"null",
")",
"{",
"if",
"(",
"index",
"<",
"externalData",
".",
"getArrayLength",
"(",
")",
")",
"{",
"return",
"ext... | Returns the value of the indexed property or NOT_FOUND.
@param index the numeric index for the property
@param start the object in which the lookup began
@return the value of the property (may be null), or NOT_FOUND | [
"Returns",
"the",
"value",
"of",
"the",
"indexed",
"property",
"or",
"NOT_FOUND",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L473-L488 |
frostwire/frostwire-jlibtorrent | src/main/java/com/frostwire/jlibtorrent/TorrentInfo.java | TorrentInfo.mapFile | public PeerRequest mapFile(int file, long offset, int size) {
return new PeerRequest(ti.map_file(file, offset, size));
} | java | public PeerRequest mapFile(int file, long offset, int size) {
return new PeerRequest(ti.map_file(file, offset, size));
} | [
"public",
"PeerRequest",
"mapFile",
"(",
"int",
"file",
",",
"long",
"offset",
",",
"int",
"size",
")",
"{",
"return",
"new",
"PeerRequest",
"(",
"ti",
".",
"map_file",
"(",
"file",
",",
"offset",
",",
"size",
")",
")",
";",
"}"
] | This function will map a range in a specific file into a range in the torrent.
The {@code offset} parameter is the offset in the file, given in bytes, where
0 is the start of the file.
<p>
The input range is assumed to be valid within the torrent. {@code offset + size}
is not allowed to be greater than the file size. {@code index}
must refer to a valid file, i.e. it cannot be {@code >= numFiles()}.
@param file
@param offset
@param size
@return
@see com.frostwire.jlibtorrent.PeerRequest | [
"This",
"function",
"will",
"map",
"a",
"range",
"in",
"a",
"specific",
"file",
"into",
"a",
"range",
"in",
"the",
"torrent",
".",
"The",
"{",
"@code",
"offset",
"}",
"parameter",
"is",
"the",
"offset",
"in",
"the",
"file",
"given",
"in",
"bytes",
"whe... | train | https://github.com/frostwire/frostwire-jlibtorrent/blob/a29249a940d34aba8c4677d238b472ef01833506/src/main/java/com/frostwire/jlibtorrent/TorrentInfo.java#L435-L437 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VpnConnectionsInner.java | VpnConnectionsInner.createOrUpdateAsync | public Observable<VpnConnectionInner> createOrUpdateAsync(String resourceGroupName, String gatewayName, String connectionName, VpnConnectionInner vpnConnectionParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters).map(new Func1<ServiceResponse<VpnConnectionInner>, VpnConnectionInner>() {
@Override
public VpnConnectionInner call(ServiceResponse<VpnConnectionInner> response) {
return response.body();
}
});
} | java | public Observable<VpnConnectionInner> createOrUpdateAsync(String resourceGroupName, String gatewayName, String connectionName, VpnConnectionInner vpnConnectionParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters).map(new Func1<ServiceResponse<VpnConnectionInner>, VpnConnectionInner>() {
@Override
public VpnConnectionInner call(ServiceResponse<VpnConnectionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VpnConnectionInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"gatewayName",
",",
"String",
"connectionName",
",",
"VpnConnectionInner",
"vpnConnectionParameters",
")",
"{",
"return",
"createOrUpdateWithSer... | Creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the existing connection.
@param resourceGroupName The resource group name of the VpnGateway.
@param gatewayName The name of the gateway.
@param connectionName The name of the connection.
@param vpnConnectionParameters Parameters supplied to create or Update a VPN Connection.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"a",
"vpn",
"connection",
"to",
"a",
"scalable",
"vpn",
"gateway",
"if",
"it",
"doesn",
"t",
"exist",
"else",
"updates",
"the",
"existing",
"connection",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VpnConnectionsInner.java#L226-L233 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/protocol/RedisStateMachine.java | RedisStateMachine.safeSet | protected void safeSet(CommandOutput<?, ?, ?> output, long integer, RedisCommand<?, ?, ?> command) {
try {
output.set(integer);
} catch (Exception e) {
command.completeExceptionally(e);
}
} | java | protected void safeSet(CommandOutput<?, ?, ?> output, long integer, RedisCommand<?, ?, ?> command) {
try {
output.set(integer);
} catch (Exception e) {
command.completeExceptionally(e);
}
} | [
"protected",
"void",
"safeSet",
"(",
"CommandOutput",
"<",
"?",
",",
"?",
",",
"?",
">",
"output",
",",
"long",
"integer",
",",
"RedisCommand",
"<",
"?",
",",
"?",
",",
"?",
">",
"command",
")",
"{",
"try",
"{",
"output",
".",
"set",
"(",
"integer"... | Safely sets {@link CommandOutput#set(long)}. Completes a command exceptionally in case an exception occurs.
@param output
@param integer
@param command | [
"Safely",
"sets",
"{",
"@link",
"CommandOutput#set",
"(",
"long",
")",
"}",
".",
"Completes",
"a",
"command",
"exceptionally",
"in",
"case",
"an",
"exception",
"occurs",
"."
] | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/protocol/RedisStateMachine.java#L354-L361 |
awslabs/amazon-sqs-java-messaging-lib | src/main/java/com/amazon/sqs/javamessaging/SQSSession.java | SQSSession.createQueue | @Override
public Queue createQueue(String queueName) throws JMSException {
checkClosed();
return new SQSQueueDestination(queueName, amazonSQSClient.getQueueUrl(queueName).getQueueUrl());
} | java | @Override
public Queue createQueue(String queueName) throws JMSException {
checkClosed();
return new SQSQueueDestination(queueName, amazonSQSClient.getQueueUrl(queueName).getQueueUrl());
} | [
"@",
"Override",
"public",
"Queue",
"createQueue",
"(",
"String",
"queueName",
")",
"throws",
"JMSException",
"{",
"checkClosed",
"(",
")",
";",
"return",
"new",
"SQSQueueDestination",
"(",
"queueName",
",",
"amazonSQSClient",
".",
"getQueueUrl",
"(",
"queueName",... | This does not create SQS Queue. This method is only to create JMS Queue Object.
Make sure the queue exists corresponding to the queueName.
@param queueName
@return a queue destination
@throws JMSException
If session is closed or invalid queue is provided | [
"This",
"does",
"not",
"create",
"SQS",
"Queue",
".",
"This",
"method",
"is",
"only",
"to",
"create",
"JMS",
"Queue",
"Object",
".",
"Make",
"sure",
"the",
"queue",
"exists",
"corresponding",
"to",
"the",
"queueName",
"."
] | train | https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/SQSSession.java#L633-L637 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java | ModelSerializer.restoreComputationGraph | public static ComputationGraph restoreComputationGraph(@NonNull String path, boolean loadUpdater)
throws IOException {
return restoreComputationGraph(new File(path), loadUpdater);
} | java | public static ComputationGraph restoreComputationGraph(@NonNull String path, boolean loadUpdater)
throws IOException {
return restoreComputationGraph(new File(path), loadUpdater);
} | [
"public",
"static",
"ComputationGraph",
"restoreComputationGraph",
"(",
"@",
"NonNull",
"String",
"path",
",",
"boolean",
"loadUpdater",
")",
"throws",
"IOException",
"{",
"return",
"restoreComputationGraph",
"(",
"new",
"File",
"(",
"path",
")",
",",
"loadUpdater",... | Load a computation graph from a file
@param path path to the model file, to get the computation graph from
@return the loaded computation graph
@throws IOException | [
"Load",
"a",
"computation",
"graph",
"from",
"a",
"file",
"@param",
"path",
"path",
"to",
"the",
"model",
"file",
"to",
"get",
"the",
"computation",
"graph",
"from",
"@return",
"the",
"loaded",
"computation",
"graph"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java#L451-L454 |
iig-uni-freiburg/SEWOL | ext/org/deckfour/spex/SXDocument.java | SXDocument.addComment | public void addComment(String comment) throws IOException {
prepareToAddChildNode();
SXCommentNode commentNode = new SXCommentNode(comment, writer, 0, tabString);
lastChildNode = commentNode;
} | java | public void addComment(String comment) throws IOException {
prepareToAddChildNode();
SXCommentNode commentNode = new SXCommentNode(comment, writer, 0, tabString);
lastChildNode = commentNode;
} | [
"public",
"void",
"addComment",
"(",
"String",
"comment",
")",
"throws",
"IOException",
"{",
"prepareToAddChildNode",
"(",
")",
";",
"SXCommentNode",
"commentNode",
"=",
"new",
"SXCommentNode",
"(",
"comment",
",",
"writer",
",",
"0",
",",
"tabString",
")",
";... | Adds a comment to this document.
<b>WARNING:</b> This will close the last added tag, if applicable!
@param comment The comment line to be added. | [
"Adds",
"a",
"comment",
"to",
"this",
"document",
".",
"<b",
">",
"WARNING",
":",
"<",
"/",
"b",
">",
"This",
"will",
"close",
"the",
"last",
"added",
"tag",
"if",
"applicable!"
] | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/spex/SXDocument.java#L171-L175 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/support/AsyncConnectionPoolSupport.java | AsyncConnectionPoolSupport.createBoundedObjectPool | public static <T extends StatefulConnection<?, ?>> BoundedAsyncPool<T> createBoundedObjectPool(
Supplier<CompletionStage<T>> connectionSupplier, BoundedPoolConfig config) {
return createBoundedObjectPool(connectionSupplier, config, true);
} | java | public static <T extends StatefulConnection<?, ?>> BoundedAsyncPool<T> createBoundedObjectPool(
Supplier<CompletionStage<T>> connectionSupplier, BoundedPoolConfig config) {
return createBoundedObjectPool(connectionSupplier, config, true);
} | [
"public",
"static",
"<",
"T",
"extends",
"StatefulConnection",
"<",
"?",
",",
"?",
">",
">",
"BoundedAsyncPool",
"<",
"T",
">",
"createBoundedObjectPool",
"(",
"Supplier",
"<",
"CompletionStage",
"<",
"T",
">",
">",
"connectionSupplier",
",",
"BoundedPoolConfig"... | Creates a new {@link BoundedAsyncPool} using the {@link Supplier}. Allocated instances are wrapped and must not be
returned with {@link AsyncPool#release(Object)}.
@param connectionSupplier must not be {@literal null}.
@param config must not be {@literal null}.
@param <T> connection type.
@return the connection pool. | [
"Creates",
"a",
"new",
"{",
"@link",
"BoundedAsyncPool",
"}",
"using",
"the",
"{",
"@link",
"Supplier",
"}",
".",
"Allocated",
"instances",
"are",
"wrapped",
"and",
"must",
"not",
"be",
"returned",
"with",
"{",
"@link",
"AsyncPool#release",
"(",
"Object",
")... | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/support/AsyncConnectionPoolSupport.java#L88-L91 |
EsotericSoftware/kryo | src/com/esotericsoftware/kryo/util/GenericsUtil.java | GenericsUtil.resolveTypeParameters | static public Type[] resolveTypeParameters (Class fromClass, Class toClass, Type type) {
// Type which has a type parameter, eg ArrayList<T>.
if (type instanceof ParameterizedType) {
Type[] actualArgs = ((ParameterizedType)type).getActualTypeArguments();
int n = actualArgs.length;
Type[] generics = new Type[n];
for (int i = 0; i < n; i++)
generics[i] = resolveType(fromClass, toClass, actualArgs[i]);
return generics;
}
// Array which has a type parameter, eg "ArrayList<T>[]". Discard array types, resolve type parameter of the component type.
if (type instanceof GenericArrayType) {
while (true) {
type = ((GenericArrayType)type).getGenericComponentType();
if (!(type instanceof GenericArrayType)) break;
}
return resolveTypeParameters(fromClass, toClass, type);
}
return null; // No type parameters (is a class or type variable).
} | java | static public Type[] resolveTypeParameters (Class fromClass, Class toClass, Type type) {
// Type which has a type parameter, eg ArrayList<T>.
if (type instanceof ParameterizedType) {
Type[] actualArgs = ((ParameterizedType)type).getActualTypeArguments();
int n = actualArgs.length;
Type[] generics = new Type[n];
for (int i = 0; i < n; i++)
generics[i] = resolveType(fromClass, toClass, actualArgs[i]);
return generics;
}
// Array which has a type parameter, eg "ArrayList<T>[]". Discard array types, resolve type parameter of the component type.
if (type instanceof GenericArrayType) {
while (true) {
type = ((GenericArrayType)type).getGenericComponentType();
if (!(type instanceof GenericArrayType)) break;
}
return resolveTypeParameters(fromClass, toClass, type);
}
return null; // No type parameters (is a class or type variable).
} | [
"static",
"public",
"Type",
"[",
"]",
"resolveTypeParameters",
"(",
"Class",
"fromClass",
",",
"Class",
"toClass",
",",
"Type",
"type",
")",
"{",
"// Type which has a type parameter, eg ArrayList<T>.",
"if",
"(",
"type",
"instanceof",
"ParameterizedType",
")",
"{",
... | Resolves type variables for the type parameters of the specified type by using the class hierarchy between the specified
classes.
@param toClass Must be a sub class of fromClass.
@return Null if the type has no type parameters, else contains Class entries for type parameters that were resolved and
TypeVariable entries for type parameters that couldn't be resolved. | [
"Resolves",
"type",
"variables",
"for",
"the",
"type",
"parameters",
"of",
"the",
"specified",
"type",
"by",
"using",
"the",
"class",
"hierarchy",
"between",
"the",
"specified",
"classes",
"."
] | train | https://github.com/EsotericSoftware/kryo/blob/a8be1ab26f347f299a3c3f7171d6447dd5390845/src/com/esotericsoftware/kryo/util/GenericsUtil.java#L120-L141 |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/Sheet.java | Sheet.renderRowUpdateScript | public void renderRowUpdateScript(final FacesContext context, final Set<String> dirtyRows) {
final String jsVar = resolveWidgetVar();
final StringBuilder eval = new StringBuilder();
for (final String rowKey : dirtyRows) {
setRowVar(context, rowKey);
final int rowIndex = rowNumbers.get(rowKey);
// data is array of array of data
final JavascriptVarBuilder jsRow = new JavascriptVarBuilder(null, false);
final JavascriptVarBuilder jsStyle = new JavascriptVarBuilder(null, true);
final JavascriptVarBuilder jsReadOnly = new JavascriptVarBuilder(null, true);
int renderCol = 0;
for (int col = 0; col < getColumns().size(); col++) {
final SheetColumn column = getColumns().get(col);
if (!column.isRendered()) {
continue;
}
// render data value
final String value = getRenderValueForCell(context, rowKey, col);
jsRow.appendArrayValue(value, true);
// custom style
final String styleClass = column.getStyleClass();
if (styleClass != null) {
jsStyle.appendRowColProperty(rowIndex, renderCol, styleClass, true);
}
// read only per cell
final boolean readOnly = column.isReadonlyCell();
if (readOnly) {
jsReadOnly.appendRowColProperty(rowIndex, renderCol, "true", true);
}
renderCol++;
}
eval.append("PF('").append(jsVar).append("')");
eval.append(".updateData('");
eval.append(rowIndex);
eval.append("',");
eval.append(jsRow.closeVar().toString());
eval.append(",");
eval.append(jsStyle.closeVar().toString());
eval.append(",");
eval.append(jsReadOnly.closeVar().toString());
eval.append(");");
}
eval.append("PF('").append(jsVar).append("')").append(".redraw();");
PrimeFaces.current().executeScript(eval.toString());
} | java | public void renderRowUpdateScript(final FacesContext context, final Set<String> dirtyRows) {
final String jsVar = resolveWidgetVar();
final StringBuilder eval = new StringBuilder();
for (final String rowKey : dirtyRows) {
setRowVar(context, rowKey);
final int rowIndex = rowNumbers.get(rowKey);
// data is array of array of data
final JavascriptVarBuilder jsRow = new JavascriptVarBuilder(null, false);
final JavascriptVarBuilder jsStyle = new JavascriptVarBuilder(null, true);
final JavascriptVarBuilder jsReadOnly = new JavascriptVarBuilder(null, true);
int renderCol = 0;
for (int col = 0; col < getColumns().size(); col++) {
final SheetColumn column = getColumns().get(col);
if (!column.isRendered()) {
continue;
}
// render data value
final String value = getRenderValueForCell(context, rowKey, col);
jsRow.appendArrayValue(value, true);
// custom style
final String styleClass = column.getStyleClass();
if (styleClass != null) {
jsStyle.appendRowColProperty(rowIndex, renderCol, styleClass, true);
}
// read only per cell
final boolean readOnly = column.isReadonlyCell();
if (readOnly) {
jsReadOnly.appendRowColProperty(rowIndex, renderCol, "true", true);
}
renderCol++;
}
eval.append("PF('").append(jsVar).append("')");
eval.append(".updateData('");
eval.append(rowIndex);
eval.append("',");
eval.append(jsRow.closeVar().toString());
eval.append(",");
eval.append(jsStyle.closeVar().toString());
eval.append(",");
eval.append(jsReadOnly.closeVar().toString());
eval.append(");");
}
eval.append("PF('").append(jsVar).append("')").append(".redraw();");
PrimeFaces.current().executeScript(eval.toString());
} | [
"public",
"void",
"renderRowUpdateScript",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"Set",
"<",
"String",
">",
"dirtyRows",
")",
"{",
"final",
"String",
"jsVar",
"=",
"resolveWidgetVar",
"(",
")",
";",
"final",
"StringBuilder",
"eval",
"=",
"new"... | Adds eval scripts to the ajax response to update the rows dirtied by the most recent successful update request.
@param context the FacesContext
@param dirtyRows the set of dirty rows | [
"Adds",
"eval",
"scripts",
"to",
"the",
"ajax",
"response",
"to",
"update",
"the",
"rows",
"dirtied",
"by",
"the",
"most",
"recent",
"successful",
"update",
"request",
"."
] | train | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L1047-L1095 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.expandLine | public static String expandLine(CharSequence self, int tabStop) {
String s = self.toString();
int index;
while ((index = s.indexOf('\t')) != -1) {
StringBuilder builder = new StringBuilder(s);
int count = tabStop - index % tabStop;
builder.deleteCharAt(index);
for (int i = 0; i < count; i++) builder.insert(index, " ");
s = builder.toString();
}
return s;
} | java | public static String expandLine(CharSequence self, int tabStop) {
String s = self.toString();
int index;
while ((index = s.indexOf('\t')) != -1) {
StringBuilder builder = new StringBuilder(s);
int count = tabStop - index % tabStop;
builder.deleteCharAt(index);
for (int i = 0; i < count; i++) builder.insert(index, " ");
s = builder.toString();
}
return s;
} | [
"public",
"static",
"String",
"expandLine",
"(",
"CharSequence",
"self",
",",
"int",
"tabStop",
")",
"{",
"String",
"s",
"=",
"self",
".",
"toString",
"(",
")",
";",
"int",
"index",
";",
"while",
"(",
"(",
"index",
"=",
"s",
".",
"indexOf",
"(",
"'",... | Expands all tabs into spaces. Assumes the CharSequence represents a single line of text.
@param self A line to expand
@param tabStop The number of spaces a tab represents
@return The expanded toString() of this CharSequence
@see #expandLine(String, int)
@since 1.8.2 | [
"Expands",
"all",
"tabs",
"into",
"spaces",
".",
"Assumes",
"the",
"CharSequence",
"represents",
"a",
"single",
"line",
"of",
"text",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L819-L830 |
SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/webhook/WebhookDeliveryDao.java | WebhookDeliveryDao.selectByWebhookUuid | public List<WebhookDeliveryLiteDto> selectByWebhookUuid(DbSession dbSession, String webhookUuid, int offset, int limit) {
return mapper(dbSession).selectByWebhookUuid(webhookUuid, new RowBounds(offset, limit));
} | java | public List<WebhookDeliveryLiteDto> selectByWebhookUuid(DbSession dbSession, String webhookUuid, int offset, int limit) {
return mapper(dbSession).selectByWebhookUuid(webhookUuid, new RowBounds(offset, limit));
} | [
"public",
"List",
"<",
"WebhookDeliveryLiteDto",
">",
"selectByWebhookUuid",
"(",
"DbSession",
"dbSession",
",",
"String",
"webhookUuid",
",",
"int",
"offset",
",",
"int",
"limit",
")",
"{",
"return",
"mapper",
"(",
"dbSession",
")",
".",
"selectByWebhookUuid",
... | All the deliveries for the specified webhook. Results are ordered by descending date. | [
"All",
"the",
"deliveries",
"for",
"the",
"specified",
"webhook",
".",
"Results",
"are",
"ordered",
"by",
"descending",
"date",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/webhook/WebhookDeliveryDao.java#L45-L47 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/CurrencyLocalizationUrl.java | CurrencyLocalizationUrl.deleteCurrencyExchangeRateUrl | public static MozuUrl deleteCurrencyExchangeRateUrl(String currencyCode, String toCurrencyCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/currency/{currencyCode}/exchangerates/{toCurrencyCode}");
formatter.formatUrl("currencyCode", currencyCode);
formatter.formatUrl("toCurrencyCode", toCurrencyCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deleteCurrencyExchangeRateUrl(String currencyCode, String toCurrencyCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/currency/{currencyCode}/exchangerates/{toCurrencyCode}");
formatter.formatUrl("currencyCode", currencyCode);
formatter.formatUrl("toCurrencyCode", toCurrencyCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deleteCurrencyExchangeRateUrl",
"(",
"String",
"currencyCode",
",",
"String",
"toCurrencyCode",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/currency/{currencyCode}/exchangerates/{toCurrency... | Get Resource Url for DeleteCurrencyExchangeRate
@param currencyCode The three character ISOÂ currency code, such as USDÂ for US Dollars.
@param toCurrencyCode
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeleteCurrencyExchangeRate"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/CurrencyLocalizationUrl.java#L140-L146 |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/accesscontrol/CLIAccessControl.java | CLIAccessControl.getAccessControl | public static ModelNode getAccessControl(ModelControllerClient client, OperationRequestAddress address, boolean operations) {
return getAccessControl(client, null, address, operations);
} | java | public static ModelNode getAccessControl(ModelControllerClient client, OperationRequestAddress address, boolean operations) {
return getAccessControl(client, null, address, operations);
} | [
"public",
"static",
"ModelNode",
"getAccessControl",
"(",
"ModelControllerClient",
"client",
",",
"OperationRequestAddress",
"address",
",",
"boolean",
"operations",
")",
"{",
"return",
"getAccessControl",
"(",
"client",
",",
"null",
",",
"address",
",",
"operations",... | Executed read-resource-description and returns access-control info.
Returns null in case there was any kind of problem.
@param client
@param address
@return | [
"Executed",
"read",
"-",
"resource",
"-",
"description",
"and",
"returns",
"access",
"-",
"control",
"info",
".",
"Returns",
"null",
"in",
"case",
"there",
"was",
"any",
"kind",
"of",
"problem",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/accesscontrol/CLIAccessControl.java#L86-L88 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java | ULocale.getDisplayScript | public static String getDisplayScript(String localeID, ULocale displayLocale) {
return getDisplayScriptInternal(new ULocale(localeID), displayLocale);
} | java | public static String getDisplayScript(String localeID, ULocale displayLocale) {
return getDisplayScriptInternal(new ULocale(localeID), displayLocale);
} | [
"public",
"static",
"String",
"getDisplayScript",
"(",
"String",
"localeID",
",",
"ULocale",
"displayLocale",
")",
"{",
"return",
"getDisplayScriptInternal",
"(",
"new",
"ULocale",
"(",
"localeID",
")",
",",
"displayLocale",
")",
";",
"}"
] | <strong>[icu]</strong> Returns a locale's script localized for display in the provided locale.
@param localeID the id of the locale whose script will be displayed.
@param displayLocale the locale in which to display the name.
@return the localized script name. | [
"<strong",
">",
"[",
"icu",
"]",
"<",
"/",
"strong",
">",
"Returns",
"a",
"locale",
"s",
"script",
"localized",
"for",
"display",
"in",
"the",
"provided",
"locale",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1534-L1536 |
minio/minio-java | api/src/main/java/io/minio/MinioClient.java | MinioClient.getObjectUrl | public String getObjectUrl(String bucketName, String objectName)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException {
Request request = createRequest(Method.GET, bucketName, objectName, getRegion(bucketName),
null, null, null, null, 0);
HttpUrl url = request.url();
return url.toString();
} | java | public String getObjectUrl(String bucketName, String objectName)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException {
Request request = createRequest(Method.GET, bucketName, objectName, getRegion(bucketName),
null, null, null, null, 0);
HttpUrl url = request.url();
return url.toString();
} | [
"public",
"String",
"getObjectUrl",
"(",
"String",
"bucketName",
",",
"String",
"objectName",
")",
"throws",
"InvalidBucketNameException",
",",
"NoSuchAlgorithmException",
",",
"InsufficientDataException",
",",
"IOException",
",",
"InvalidKeyException",
",",
"NoResponseExce... | Gets object's URL in given bucket. The URL is ONLY useful to retrieve the object's data if the object has
public read permissions.
<p><b>Example:</b>
<pre>{@code String url = minioClient.getObjectUrl("my-bucketname", "my-objectname");
System.out.println(url); }</pre>
@param bucketName Bucket name.
@param objectName Object name in the bucket.
@return string contains URL to download the object.
@throws InvalidBucketNameException upon invalid bucket name is given
@throws NoSuchAlgorithmException
upon requested algorithm was not found during signature calculation
@throws InsufficientDataException upon getting EOFException while reading given
InputStream even before reading given length
@throws IOException upon connection error
@throws InvalidKeyException
upon an invalid access key or secret key
@throws NoResponseException upon no response from server
@throws XmlPullParserException upon parsing response xml
@throws ErrorResponseException upon unsuccessful execution
@throws InternalException upon internal library error | [
"Gets",
"object",
"s",
"URL",
"in",
"given",
"bucket",
".",
"The",
"URL",
"is",
"ONLY",
"useful",
"to",
"retrieve",
"the",
"object",
"s",
"data",
"if",
"the",
"object",
"has",
"public",
"read",
"permissions",
"."
] | train | https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L1560-L1568 |
op4j/op4j-jodatime | src/main/java/org/op4j/jodatime/functions/FnJodaString.java | FnJodaString.localTimeToStr | public static final Function<LocalTime, String> localTimeToStr(final FormatType formatType, final String format) {
return new LocalTimeToStr(formatType, format);
} | java | public static final Function<LocalTime, String> localTimeToStr(final FormatType formatType, final String format) {
return new LocalTimeToStr(formatType, format);
} | [
"public",
"static",
"final",
"Function",
"<",
"LocalTime",
",",
"String",
">",
"localTimeToStr",
"(",
"final",
"FormatType",
"formatType",
",",
"final",
"String",
"format",
")",
"{",
"return",
"new",
"LocalTimeToStr",
"(",
"formatType",
",",
"format",
")",
";"... | <p>
It converts the input {@link LocalTime} into a {@link String} by means of the given pattern or style
(depending on the value of formatType parameter).
</p>
@param formatType the format {@link FormatType}
@param format string with the format used for the output
@return the {@link String} created from the input and arguments | [
"<p",
">",
"It",
"converts",
"the",
"input",
"{",
"@link",
"LocalTime",
"}",
"into",
"a",
"{",
"@link",
"String",
"}",
"by",
"means",
"of",
"the",
"given",
"pattern",
"or",
"style",
"(",
"depending",
"on",
"the",
"value",
"of",
"formatType",
"parameter",... | train | https://github.com/op4j/op4j-jodatime/blob/26e5b8cda8553fb3b5a4a64b3109dbbf5df21194/src/main/java/org/op4j/jodatime/functions/FnJodaString.java#L157-L159 |
messagebird/java-rest-api | api/src/main/java/com/messagebird/objects/Message.java | Message.createBinarySMS | static public Message createBinarySMS(String originator, String header, String body, List<BigInteger> recipients) {
return Message.createBinarySMS(originator, header, body, receipientsAsCommaSeperated(recipients));
} | java | static public Message createBinarySMS(String originator, String header, String body, List<BigInteger> recipients) {
return Message.createBinarySMS(originator, header, body, receipientsAsCommaSeperated(recipients));
} | [
"static",
"public",
"Message",
"createBinarySMS",
"(",
"String",
"originator",
",",
"String",
"header",
",",
"String",
"body",
",",
"List",
"<",
"BigInteger",
">",
"recipients",
")",
"{",
"return",
"Message",
".",
"createBinarySMS",
"(",
"originator",
",",
"he... | Factory to create Binary SMS message
@param originator
@param header
@param body
@param recipients
@return | [
"Factory",
"to",
"create",
"Binary",
"SMS",
"message"
] | train | https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/objects/Message.java#L88-L90 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/watermarker/PartitionLevelWatermarker.java | PartitionLevelWatermarker.onGetWorkunitsEnd | @Override
public void onGetWorkunitsEnd(List<WorkUnit> workunits) {
try (AutoReturnableObject<IMetaStoreClient> client = this.pool.getClient()) {
for (Map.Entry<String, Map<String, Long>> tableWatermark : this.expectedHighWatermarks.entrySet()) {
String tableKey = tableWatermark.getKey();
Map<String, Long> partitionWatermarks = tableWatermark.getValue();
// Watermark workunits are required only for Partitioned tables
// tableKey is table complete name in the format db@table
if (!HiveUtils.isPartitioned(new org.apache.hadoop.hive.ql.metadata.Table(client.get().getTable(
tableKey.split("@")[0], tableKey.split("@")[1])))) {
continue;
}
// We only keep watermarks for partitions that were updated after leastWatermarkToPersistInState
Map<String, Long> expectedPartitionWatermarks =
ImmutableMap.copyOf(Maps.filterEntries(partitionWatermarks, new Predicate<Map.Entry<String, Long>>() {
@Override
public boolean apply(@Nonnull Map.Entry<String, Long> input) {
return Long.compare(input.getValue(), PartitionLevelWatermarker.this.leastWatermarkToPersistInState) >= 0;
}
}));
// Create dummy workunit to track all the partition watermarks for this table
WorkUnit watermarkWorkunit = WorkUnit.createEmpty();
watermarkWorkunit.setProp(IS_WATERMARK_WORKUNIT_KEY, true);
watermarkWorkunit.setProp(ConfigurationKeys.DATASET_URN_KEY, tableKey);
watermarkWorkunit.setWatermarkInterval(new WatermarkInterval(new MultiKeyValueLongWatermark(
this.previousWatermarks.get(tableKey)), new MultiKeyValueLongWatermark(expectedPartitionWatermarks)));
workunits.add(watermarkWorkunit);
}
} catch (IOException | TException e) {
Throwables.propagate(e);
}
} | java | @Override
public void onGetWorkunitsEnd(List<WorkUnit> workunits) {
try (AutoReturnableObject<IMetaStoreClient> client = this.pool.getClient()) {
for (Map.Entry<String, Map<String, Long>> tableWatermark : this.expectedHighWatermarks.entrySet()) {
String tableKey = tableWatermark.getKey();
Map<String, Long> partitionWatermarks = tableWatermark.getValue();
// Watermark workunits are required only for Partitioned tables
// tableKey is table complete name in the format db@table
if (!HiveUtils.isPartitioned(new org.apache.hadoop.hive.ql.metadata.Table(client.get().getTable(
tableKey.split("@")[0], tableKey.split("@")[1])))) {
continue;
}
// We only keep watermarks for partitions that were updated after leastWatermarkToPersistInState
Map<String, Long> expectedPartitionWatermarks =
ImmutableMap.copyOf(Maps.filterEntries(partitionWatermarks, new Predicate<Map.Entry<String, Long>>() {
@Override
public boolean apply(@Nonnull Map.Entry<String, Long> input) {
return Long.compare(input.getValue(), PartitionLevelWatermarker.this.leastWatermarkToPersistInState) >= 0;
}
}));
// Create dummy workunit to track all the partition watermarks for this table
WorkUnit watermarkWorkunit = WorkUnit.createEmpty();
watermarkWorkunit.setProp(IS_WATERMARK_WORKUNIT_KEY, true);
watermarkWorkunit.setProp(ConfigurationKeys.DATASET_URN_KEY, tableKey);
watermarkWorkunit.setWatermarkInterval(new WatermarkInterval(new MultiKeyValueLongWatermark(
this.previousWatermarks.get(tableKey)), new MultiKeyValueLongWatermark(expectedPartitionWatermarks)));
workunits.add(watermarkWorkunit);
}
} catch (IOException | TException e) {
Throwables.propagate(e);
}
} | [
"@",
"Override",
"public",
"void",
"onGetWorkunitsEnd",
"(",
"List",
"<",
"WorkUnit",
">",
"workunits",
")",
"{",
"try",
"(",
"AutoReturnableObject",
"<",
"IMetaStoreClient",
">",
"client",
"=",
"this",
".",
"pool",
".",
"getClient",
"(",
")",
")",
"{",
"f... | Adds watermark workunits to <code>workunits</code>. A watermark workunit is a dummy workunit that is skipped by extractor/converter/writer.
It stores a map of watermarks. The map has one entry per partition with partition watermark as value.
<ul>
<li>Add one NoOp watermark workunit for each {@link Table}
<li>The workunit has an identifier property {@link #IS_WATERMARK_WORKUNIT_KEY} set to true.
<li>Watermarks for all {@link Partition}s that belong to this {@link Table} are added as {@link Map}
<li>A maximum of {@link #maxPartitionsPerDataset} are persisted. Watermarks are ordered by most recently modified {@link Partition}s
</ul>
{@inheritDoc}
@see org.apache.gobblin.data.management.conversion.hive.watermarker.HiveSourceWatermarker#onGetWorkunitsEnd(java.util.List) | [
"Adds",
"watermark",
"workunits",
"to",
"<code",
">",
"workunits<",
"/",
"code",
">",
".",
"A",
"watermark",
"workunit",
"is",
"a",
"dummy",
"workunit",
"that",
"is",
"skipped",
"by",
"extractor",
"/",
"converter",
"/",
"writer",
".",
"It",
"stores",
"a",
... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/watermarker/PartitionLevelWatermarker.java#L299-L336 |
Cornutum/tcases | tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleCombiner.java | TupleCombiner.getTuples | public Collection<Tuple> getTuples( FunctionInputDef inputDef)
{
List<VarDef> combinedVars = getCombinedVars( inputDef);
return getCombinedTuples( combinedVars, getTuples( combinedVars, getTupleSize()));
} | java | public Collection<Tuple> getTuples( FunctionInputDef inputDef)
{
List<VarDef> combinedVars = getCombinedVars( inputDef);
return getCombinedTuples( combinedVars, getTuples( combinedVars, getTupleSize()));
} | [
"public",
"Collection",
"<",
"Tuple",
">",
"getTuples",
"(",
"FunctionInputDef",
"inputDef",
")",
"{",
"List",
"<",
"VarDef",
">",
"combinedVars",
"=",
"getCombinedVars",
"(",
"inputDef",
")",
";",
"return",
"getCombinedTuples",
"(",
"combinedVars",
",",
"getTup... | Returns all valid N-tuples of values for the included input variables. | [
"Returns",
"all",
"valid",
"N",
"-",
"tuples",
"of",
"values",
"for",
"the",
"included",
"input",
"variables",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleCombiner.java#L241-L245 |
apache/incubator-gobblin | gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/HiveRegister.java | HiveRegister.addOrAlterPartition | public void addOrAlterPartition(HiveTable table, HivePartition partition) throws IOException {
if (!addPartitionIfNotExists(table, partition)) {
alterPartition(table, partition);
}
} | java | public void addOrAlterPartition(HiveTable table, HivePartition partition) throws IOException {
if (!addPartitionIfNotExists(table, partition)) {
alterPartition(table, partition);
}
} | [
"public",
"void",
"addOrAlterPartition",
"(",
"HiveTable",
"table",
",",
"HivePartition",
"partition",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"addPartitionIfNotExists",
"(",
"table",
",",
"partition",
")",
")",
"{",
"alterPartition",
"(",
"table",
",... | Add a partition to a table if not exists, or alter a partition if exists.
@param table the {@link HiveTable} to which the partition belongs.
@param partition a {@link HivePartition} to which the existing partition should be updated.
@throws IOException | [
"Add",
"a",
"partition",
"to",
"a",
"table",
"if",
"not",
"exists",
"or",
"alter",
"a",
"partition",
"if",
"exists",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/HiveRegister.java#L285-L289 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformPreview.java | WaveformPreview.segmentColor | @SuppressWarnings("WeakerAccess")
public Color segmentColor(final int segment, final boolean front) {
final ByteBuffer bytes = getData();
if (isColor) {
final int base = segment * 6;
final int backHeight = segmentHeight(segment, false);
if (backHeight == 0) {
return Color.BLACK;
}
final int maxLevel = front? 255 : 191;
final int red = Util.unsign(bytes.get(base + 3)) * maxLevel / backHeight;
final int green = Util.unsign(bytes.get(base + 4)) * maxLevel / backHeight;
final int blue = Util.unsign(bytes.get(base + 5)) * maxLevel / backHeight;
return new Color(red, green, blue);
} else {
final int intensity = getData().get(segment * 2 + 1) & 0x07;
return (intensity >= 5) ? INTENSE_COLOR : NORMAL_COLOR;
}
} | java | @SuppressWarnings("WeakerAccess")
public Color segmentColor(final int segment, final boolean front) {
final ByteBuffer bytes = getData();
if (isColor) {
final int base = segment * 6;
final int backHeight = segmentHeight(segment, false);
if (backHeight == 0) {
return Color.BLACK;
}
final int maxLevel = front? 255 : 191;
final int red = Util.unsign(bytes.get(base + 3)) * maxLevel / backHeight;
final int green = Util.unsign(bytes.get(base + 4)) * maxLevel / backHeight;
final int blue = Util.unsign(bytes.get(base + 5)) * maxLevel / backHeight;
return new Color(red, green, blue);
} else {
final int intensity = getData().get(segment * 2 + 1) & 0x07;
return (intensity >= 5) ? INTENSE_COLOR : NORMAL_COLOR;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"Color",
"segmentColor",
"(",
"final",
"int",
"segment",
",",
"final",
"boolean",
"front",
")",
"{",
"final",
"ByteBuffer",
"bytes",
"=",
"getData",
"(",
")",
";",
"if",
"(",
"isColor",
")",
... | Determine the color of the waveform given an index into it.
@param segment the index of the first waveform byte to examine
@param front if {@code true} the front (brighter) segment of a color waveform preview is returned,
otherwise the back (dimmer) segment is returned. Has no effect for blue previews.
@return the color of the waveform at that segment, which may be based on an average
of a number of values starting there, determined by the scale | [
"Determine",
"the",
"color",
"of",
"the",
"waveform",
"given",
"an",
"index",
"into",
"it",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformPreview.java#L244-L262 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/pipeline/declarative/utils/DeclarativePipelineUtils.java | DeclarativePipelineUtils.createBuildInfoId | public static String createBuildInfoId(Run build, String customBuildName, String customBuildNumber) {
return StringUtils.defaultIfEmpty(customBuildName, BuildUniqueIdentifierHelper.getBuildName(build)) + "_" +
StringUtils.defaultIfEmpty(customBuildNumber, BuildUniqueIdentifierHelper.getBuildNumber(build));
} | java | public static String createBuildInfoId(Run build, String customBuildName, String customBuildNumber) {
return StringUtils.defaultIfEmpty(customBuildName, BuildUniqueIdentifierHelper.getBuildName(build)) + "_" +
StringUtils.defaultIfEmpty(customBuildNumber, BuildUniqueIdentifierHelper.getBuildNumber(build));
} | [
"public",
"static",
"String",
"createBuildInfoId",
"(",
"Run",
"build",
",",
"String",
"customBuildName",
",",
"String",
"customBuildNumber",
")",
"{",
"return",
"StringUtils",
".",
"defaultIfEmpty",
"(",
"customBuildName",
",",
"BuildUniqueIdentifierHelper",
".",
"ge... | Create build info id: <buildname>_<buildnumber>.
@param build - Step's build.
@param customBuildName - Step's custom build name if exist.
@param customBuildNumber - Step's custom build number if exist.
@return build info id: <buildname>_<buildnumber>. | [
"Create",
"build",
"info",
"id",
":",
"<buildname",
">",
"_<buildnumber",
">",
"."
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/declarative/utils/DeclarativePipelineUtils.java#L101-L104 |
square/jna-gmp | jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java | Gmp.exactDivide | public static BigInteger exactDivide(BigInteger dividend, BigInteger divisor) {
if (divisor.signum() == 0) {
throw new ArithmeticException("BigInteger divide by zero");
}
return INSTANCE.get().exactDivImpl(dividend, divisor);
} | java | public static BigInteger exactDivide(BigInteger dividend, BigInteger divisor) {
if (divisor.signum() == 0) {
throw new ArithmeticException("BigInteger divide by zero");
}
return INSTANCE.get().exactDivImpl(dividend, divisor);
} | [
"public",
"static",
"BigInteger",
"exactDivide",
"(",
"BigInteger",
"dividend",
",",
"BigInteger",
"divisor",
")",
"{",
"if",
"(",
"divisor",
".",
"signum",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"ArithmeticException",
"(",
"\"BigInteger divide by zero\"... | Divide dividend by divisor. This method only returns correct answers when the division produces
no remainder. Correct answers should not be expected when the divison would result in a
remainder.
@return dividend / divisor
@throws ArithmeticException if divisor is zero | [
"Divide",
"dividend",
"by",
"divisor",
".",
"This",
"method",
"only",
"returns",
"correct",
"answers",
"when",
"the",
"division",
"produces",
"no",
"remainder",
".",
"Correct",
"answers",
"should",
"not",
"be",
"expected",
"when",
"the",
"divison",
"would",
"r... | train | https://github.com/square/jna-gmp/blob/192d26d97d6773bc3c68ccfa97450f4257d54838/jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java#L165-L170 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLAnnotationUtil.java | SARLAnnotationUtil.findBooleanValue | public Boolean findBooleanValue(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) {
final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType);
if (reference != null) {
return findBooleanValue(reference);
}
return null;
} | java | public Boolean findBooleanValue(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) {
final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType);
if (reference != null) {
return findBooleanValue(reference);
}
return null;
} | [
"public",
"Boolean",
"findBooleanValue",
"(",
"JvmAnnotationTarget",
"op",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
")",
"{",
"final",
"JvmAnnotationReference",
"reference",
"=",
"this",
".",
"lookup",
".",
"findAnnotation",
"(",
"op... | Extract the boolean value of the given annotation, if it exists.
@param op the annotated element.
@param annotationType the type of the annotation to consider
@return the value of the annotation, or {@code null} if no annotation or no
value.
@since 0.6 | [
"Extract",
"the",
"boolean",
"value",
"of",
"the",
"given",
"annotation",
"if",
"it",
"exists",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLAnnotationUtil.java#L273-L279 |
threerings/nenya | core/src/main/java/com/threerings/util/CompiledConfig.java | CompiledConfig.saveConfig | public static void saveConfig (File target, Serializable config)
throws IOException
{
FileOutputStream fout = new FileOutputStream(target);
ObjectOutputStream oout = new ObjectOutputStream(fout);
oout.writeObject(config);
oout.close();
} | java | public static void saveConfig (File target, Serializable config)
throws IOException
{
FileOutputStream fout = new FileOutputStream(target);
ObjectOutputStream oout = new ObjectOutputStream(fout);
oout.writeObject(config);
oout.close();
} | [
"public",
"static",
"void",
"saveConfig",
"(",
"File",
"target",
",",
"Serializable",
"config",
")",
"throws",
"IOException",
"{",
"FileOutputStream",
"fout",
"=",
"new",
"FileOutputStream",
"(",
"target",
")",
";",
"ObjectOutputStream",
"oout",
"=",
"new",
"Obj... | Serializes the supplied configuration object to the specified file path. | [
"Serializes",
"the",
"supplied",
"configuration",
"object",
"to",
"the",
"specified",
"file",
"path",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/CompiledConfig.java#L54-L61 |
apache/incubator-gobblin | gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/converter/InstrumentedConverterBase.java | InstrumentedConverterBase.beforeConvert | public void beforeConvert(SO outputSchema, DI inputRecord, WorkUnitState workUnit) {
Instrumented.markMeter(this.recordsInMeter);
} | java | public void beforeConvert(SO outputSchema, DI inputRecord, WorkUnitState workUnit) {
Instrumented.markMeter(this.recordsInMeter);
} | [
"public",
"void",
"beforeConvert",
"(",
"SO",
"outputSchema",
",",
"DI",
"inputRecord",
",",
"WorkUnitState",
"workUnit",
")",
"{",
"Instrumented",
".",
"markMeter",
"(",
"this",
".",
"recordsInMeter",
")",
";",
"}"
] | Called before conversion.
@param outputSchema output schema of the {@link #convertSchema(Object, WorkUnitState)} method
@param inputRecord an input data record
@param workUnit a {@link WorkUnitState} instance | [
"Called",
"before",
"conversion",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/converter/InstrumentedConverterBase.java#L147-L149 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/AIStream.java | AIStream.insertRequest | public long insertRequest(
AIRequestedTick rt,
long tick,
long timeout)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"insertRequest",
new Object[] {
rt,
Long.valueOf(tick),
Long.valueOf(timeout)});
long rejectStart = _latestTick + 1;
if (rejectStart < tick)
{
// Notice that the ticks have recovery=false, but the request sent over does not
writeRejected(rejectStart, tick - 1, 0);
}
else
{
rejectStart = tick;
}
TickRange requestRange = new TickRange(TickRange.Requested, tick, tick);
// Associate the tick with the requesting consumer key so that, when the data message arrives,
// we can tell the RCD what consumer it is for
requestRange.value = rt;
requestRange.valuestamp = tick;
_targetStream.writeRange(requestRange);
// Start the get repetition (eager get) timeout, only if timeout is not zero (i.e., it's not a NoWait)
if (timeout > 0L || timeout == _mp.getCustomProperties().get_infinite_timeout())
{
_eagerGetTOM.addTimeoutEntry(rt);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "insertRequest", Long.valueOf(rejectStart));
return rejectStart;
} | java | public long insertRequest(
AIRequestedTick rt,
long tick,
long timeout)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"insertRequest",
new Object[] {
rt,
Long.valueOf(tick),
Long.valueOf(timeout)});
long rejectStart = _latestTick + 1;
if (rejectStart < tick)
{
// Notice that the ticks have recovery=false, but the request sent over does not
writeRejected(rejectStart, tick - 1, 0);
}
else
{
rejectStart = tick;
}
TickRange requestRange = new TickRange(TickRange.Requested, tick, tick);
// Associate the tick with the requesting consumer key so that, when the data message arrives,
// we can tell the RCD what consumer it is for
requestRange.value = rt;
requestRange.valuestamp = tick;
_targetStream.writeRange(requestRange);
// Start the get repetition (eager get) timeout, only if timeout is not zero (i.e., it's not a NoWait)
if (timeout > 0L || timeout == _mp.getCustomProperties().get_infinite_timeout())
{
_eagerGetTOM.addTimeoutEntry(rt);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "insertRequest", Long.valueOf(rejectStart));
return rejectStart;
} | [
"public",
"long",
"insertRequest",
"(",
"AIRequestedTick",
"rt",
",",
"long",
"tick",
",",
"long",
"timeout",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entr... | Insert a get request at tick t. Every tick from latestTick+1 to t-1 is set to rejected. In general,
trying to insert the tick could be denied because there may be a previous L/R in the stream
that needs to turn to L/D. However, in the latest design the RME does not reject any ticks while
the consumer is connected, waiting instead until it disconnects to reject all ticks.
@param tick The point in the stream to insert the request
@param selector The selector associated with the request
@param timeout The timeout on the request, either provided by the consumer or assigned by default by the RCD
@return The reject start tick or -1 if no ticks rejected | [
"Insert",
"a",
"get",
"request",
"at",
"tick",
"t",
".",
"Every",
"tick",
"from",
"latestTick",
"+",
"1",
"to",
"t",
"-",
"1",
"is",
"set",
"to",
"rejected",
".",
"In",
"general",
"trying",
"to",
"insert",
"the",
"tick",
"could",
"be",
"denied",
"bec... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/AIStream.java#L268-L312 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.transformChar | public static void transformChar(Reader self, Writer writer, @ClosureParams(value=SimpleType.class, options="java.lang.String") Closure closure) throws IOException {
int c;
try {
char[] chars = new char[1];
while ((c = self.read()) != -1) {
chars[0] = (char) c;
writer.write((String) closure.call(new String(chars)));
}
writer.flush();
Writer temp2 = writer;
writer = null;
temp2.close();
Reader temp1 = self;
self = null;
temp1.close();
} finally {
closeWithWarning(self);
closeWithWarning(writer);
}
} | java | public static void transformChar(Reader self, Writer writer, @ClosureParams(value=SimpleType.class, options="java.lang.String") Closure closure) throws IOException {
int c;
try {
char[] chars = new char[1];
while ((c = self.read()) != -1) {
chars[0] = (char) c;
writer.write((String) closure.call(new String(chars)));
}
writer.flush();
Writer temp2 = writer;
writer = null;
temp2.close();
Reader temp1 = self;
self = null;
temp1.close();
} finally {
closeWithWarning(self);
closeWithWarning(writer);
}
} | [
"public",
"static",
"void",
"transformChar",
"(",
"Reader",
"self",
",",
"Writer",
"writer",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.lang.String\"",
")",
"Closure",
"closure",
")",
"throws",
"IOExc... | Transforms each character from this reader by passing it to the given
closure. The Closure should return each transformed character, which
will be passed to the Writer. The reader and writer will be both be
closed before this method returns.
@param self a Reader object
@param writer a Writer to receive the transformed characters
@param closure a closure that performs the required transformation
@throws IOException if an IOException occurs.
@since 1.5.0 | [
"Transforms",
"each",
"character",
"from",
"this",
"reader",
"by",
"passing",
"it",
"to",
"the",
"given",
"closure",
".",
"The",
"Closure",
"should",
"return",
"each",
"transformed",
"character",
"which",
"will",
"be",
"passed",
"to",
"the",
"Writer",
".",
"... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1398-L1418 |
Jasig/uPortal | uPortal-portlets/src/main/java/org/apereo/portal/portlets/portletadmin/PortletAdministrationHelper.java | PortletAdministrationHelper.removePortletRegistration | public void removePortletRegistration(IPerson person, PortletDefinitionForm form) {
/* TODO: Service-Layer Security Reboot (great need of refactoring with a community-approved plan in place) */
// Arguably a check here is redundant since -- in the current
// portlet-manager webflow -- you can't get to this point in the
// conversation with out first obtaining a PortletDefinitionForm; but
// it makes sense to check permissions here as well since the route(s)
// to reach this method could evolve in the future.
// Let's enforce the policy that you may only delete a portlet thet's
// currently in a lifecycle state you have permission to MANAGE.
// (They're hierarchical.)
if (!hasLifecyclePermission(person, form.getLifecycleState(), form.getCategories())) {
logger.warn(
"User '"
+ person.getUserName()
+ "' attempted to remove portlet '"
+ form.getFname()
+ "' without the proper MANAGE permission");
throw new SecurityException("Not Authorized");
}
IPortletDefinition def = portletDefinitionRegistry.getPortletDefinition(form.getId());
/*
* It's very important to remove portlets via the portletPublishingService
* because that API cleans up details like category memberships and permissions.
*/
portletPublishingService.removePortletDefinition(def, person);
} | java | public void removePortletRegistration(IPerson person, PortletDefinitionForm form) {
/* TODO: Service-Layer Security Reboot (great need of refactoring with a community-approved plan in place) */
// Arguably a check here is redundant since -- in the current
// portlet-manager webflow -- you can't get to this point in the
// conversation with out first obtaining a PortletDefinitionForm; but
// it makes sense to check permissions here as well since the route(s)
// to reach this method could evolve in the future.
// Let's enforce the policy that you may only delete a portlet thet's
// currently in a lifecycle state you have permission to MANAGE.
// (They're hierarchical.)
if (!hasLifecyclePermission(person, form.getLifecycleState(), form.getCategories())) {
logger.warn(
"User '"
+ person.getUserName()
+ "' attempted to remove portlet '"
+ form.getFname()
+ "' without the proper MANAGE permission");
throw new SecurityException("Not Authorized");
}
IPortletDefinition def = portletDefinitionRegistry.getPortletDefinition(form.getId());
/*
* It's very important to remove portlets via the portletPublishingService
* because that API cleans up details like category memberships and permissions.
*/
portletPublishingService.removePortletDefinition(def, person);
} | [
"public",
"void",
"removePortletRegistration",
"(",
"IPerson",
"person",
",",
"PortletDefinitionForm",
"form",
")",
"{",
"/* TODO: Service-Layer Security Reboot (great need of refactoring with a community-approved plan in place) */",
"// Arguably a check here is redundant since -- in the cu... | Delete the portlet with the given portlet ID.
@param person the person removing the portlet
@param form | [
"Delete",
"the",
"portlet",
"with",
"the",
"given",
"portlet",
"ID",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/portletadmin/PortletAdministrationHelper.java#L518-L546 |
qsardb/qsardb-common | resolution/chemical/src/main/java/org/qsardb/resolution/chemical/Service.java | Service.resolve | static
private String resolve(String structure, String representation) throws IOException {
String host = "cactus.nci.nih.gov";
String path = "/chemical/structure/" + structure + "/" + representation;
RequestConfig config = RequestConfig.custom()
.setConnectTimeout(10*1000)
.setSocketTimeout(2*1000).build();
CloseableHttpClient client = HttpClients.custom()
.setDefaultRequestConfig(config).build();
try {
URI uri = new URI("http", host, path, null);
HttpGet request = new HttpGet(uri);
HttpResponse response = client.execute(request);
StatusLine status = response.getStatusLine();
switch(status.getStatusCode()){
case HttpStatus.SC_OK:
break;
case HttpStatus.SC_NOT_FOUND:
throw new FileNotFoundException(structure);
default:
throw new IOException(status.getReasonPhrase());
}
ByteArrayOutputStream os = new ByteArrayOutputStream(10 * 1024);
try {
HttpEntity responseBody = response.getEntity();
try {
responseBody.writeTo(os);
} finally {
os.flush();
}
String encoding = EntityUtils.getContentCharSet(responseBody);
if(encoding == null){
encoding = "UTF-8";
}
return os.toString(encoding);
} finally {
os.close();
}
} catch(URISyntaxException use){
throw new IOException(use);
} finally {
client.close();
}
} | java | static
private String resolve(String structure, String representation) throws IOException {
String host = "cactus.nci.nih.gov";
String path = "/chemical/structure/" + structure + "/" + representation;
RequestConfig config = RequestConfig.custom()
.setConnectTimeout(10*1000)
.setSocketTimeout(2*1000).build();
CloseableHttpClient client = HttpClients.custom()
.setDefaultRequestConfig(config).build();
try {
URI uri = new URI("http", host, path, null);
HttpGet request = new HttpGet(uri);
HttpResponse response = client.execute(request);
StatusLine status = response.getStatusLine();
switch(status.getStatusCode()){
case HttpStatus.SC_OK:
break;
case HttpStatus.SC_NOT_FOUND:
throw new FileNotFoundException(structure);
default:
throw new IOException(status.getReasonPhrase());
}
ByteArrayOutputStream os = new ByteArrayOutputStream(10 * 1024);
try {
HttpEntity responseBody = response.getEntity();
try {
responseBody.writeTo(os);
} finally {
os.flush();
}
String encoding = EntityUtils.getContentCharSet(responseBody);
if(encoding == null){
encoding = "UTF-8";
}
return os.toString(encoding);
} finally {
os.close();
}
} catch(URISyntaxException use){
throw new IOException(use);
} finally {
client.close();
}
} | [
"static",
"private",
"String",
"resolve",
"(",
"String",
"structure",
",",
"String",
"representation",
")",
"throws",
"IOException",
"{",
"String",
"host",
"=",
"\"cactus.nci.nih.gov\"",
";",
"String",
"path",
"=",
"\"/chemical/structure/\"",
"+",
"structure",
"+",
... | /*
@throws FileNotFoundException If the structure is not found
@throws IOException If an I/O exception occurs | [
"/",
"*"
] | train | https://github.com/qsardb/qsardb-common/blob/6c5e8e79294bf2b634fb9c1debd5c0b081cc83e1/resolution/chemical/src/main/java/org/qsardb/resolution/chemical/Service.java#L65-L118 |
Azure/azure-sdk-for-java | locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java | ManagementLocksInner.deleteAtResourceGroupLevel | public void deleteAtResourceGroupLevel(String resourceGroupName, String lockName) {
deleteAtResourceGroupLevelWithServiceResponseAsync(resourceGroupName, lockName).toBlocking().single().body();
} | java | public void deleteAtResourceGroupLevel(String resourceGroupName, String lockName) {
deleteAtResourceGroupLevelWithServiceResponseAsync(resourceGroupName, lockName).toBlocking().single().body();
} | [
"public",
"void",
"deleteAtResourceGroupLevel",
"(",
"String",
"resourceGroupName",
",",
"String",
"lockName",
")",
"{",
"deleteAtResourceGroupLevelWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"lockName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"("... | Deletes a management lock at the resource group level.
To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.
@param resourceGroupName The name of the resource group containing the lock.
@param lockName The name of lock to delete.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Deletes",
"a",
"management",
"lock",
"at",
"the",
"resource",
"group",
"level",
".",
"To",
"delete",
"management",
"locks",
"you",
"must",
"have",
"access",
"to",
"Microsoft",
".",
"Authorization",
"/",
"*",
"or",
"Microsoft",
".",
"Authorization",
"/",
"lo... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java#L249-L251 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java | TwitterEndpointServices.computeSha1Signature | protected String computeSha1Signature(String baseString, @Sensitive String keyString) throws GeneralSecurityException, UnsupportedEncodingException {
byte[] keyBytes = keyString.getBytes(CommonWebConstants.UTF_8);
SecretKey secretKey = new SecretKeySpec(keyBytes, "HmacSHA1");
Mac mac = Mac.getInstance("HmacSHA1");
mac.init(secretKey);
byte[] text = baseString.getBytes(CommonWebConstants.UTF_8);
return new String(Base64.encodeBase64(mac.doFinal(text)), CommonWebConstants.UTF_8).trim();
} | java | protected String computeSha1Signature(String baseString, @Sensitive String keyString) throws GeneralSecurityException, UnsupportedEncodingException {
byte[] keyBytes = keyString.getBytes(CommonWebConstants.UTF_8);
SecretKey secretKey = new SecretKeySpec(keyBytes, "HmacSHA1");
Mac mac = Mac.getInstance("HmacSHA1");
mac.init(secretKey);
byte[] text = baseString.getBytes(CommonWebConstants.UTF_8);
return new String(Base64.encodeBase64(mac.doFinal(text)), CommonWebConstants.UTF_8).trim();
} | [
"protected",
"String",
"computeSha1Signature",
"(",
"String",
"baseString",
",",
"@",
"Sensitive",
"String",
"keyString",
")",
"throws",
"GeneralSecurityException",
",",
"UnsupportedEncodingException",
"{",
"byte",
"[",
"]",
"keyBytes",
"=",
"keyString",
".",
"getByte... | Computes the HMAC-SHA1 signature of the provided baseString using keyString as the secret key.
@param baseString
@param keyString
@return
@throws GeneralSecurityException
@throws UnsupportedEncodingException | [
"Computes",
"the",
"HMAC",
"-",
"SHA1",
"signature",
"of",
"the",
"provided",
"baseString",
"using",
"keyString",
"as",
"the",
"secret",
"key",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java#L157-L168 |
threerings/narya | core/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java | PresentsDObjectMgr.dispatchEvent | protected boolean dispatchEvent (DEvent event, DObject target)
{
boolean notify = true; // assume always notify
try {
// do any internal management necessary based on this event
EventHelper helper = _helpers.get(event.getClass());
if (helper != null) {
// if helper returns false, we abort event processing
if (!helper.invoke(event, target)) {
return false;
}
}
// everything's good so far, apply the event to the object
notify = event.applyToObject(target);
// if the event returns false from applyToObject, this means it's a silent event and we
// shouldn't notify the listeners
if (notify) {
target.notifyListeners(event);
}
} catch (VirtualMachineError e) {
handleFatalError(event, e);
} catch (Throwable t) {
log.warning("Failure processing event", "event", event, "target", target, t);
}
// track the number of events dispatched
++_eventCount;
++_current.eventCount;
return true;
} | java | protected boolean dispatchEvent (DEvent event, DObject target)
{
boolean notify = true; // assume always notify
try {
// do any internal management necessary based on this event
EventHelper helper = _helpers.get(event.getClass());
if (helper != null) {
// if helper returns false, we abort event processing
if (!helper.invoke(event, target)) {
return false;
}
}
// everything's good so far, apply the event to the object
notify = event.applyToObject(target);
// if the event returns false from applyToObject, this means it's a silent event and we
// shouldn't notify the listeners
if (notify) {
target.notifyListeners(event);
}
} catch (VirtualMachineError e) {
handleFatalError(event, e);
} catch (Throwable t) {
log.warning("Failure processing event", "event", event, "target", target, t);
}
// track the number of events dispatched
++_eventCount;
++_current.eventCount;
return true;
} | [
"protected",
"boolean",
"dispatchEvent",
"(",
"DEvent",
"event",
",",
"DObject",
"target",
")",
"{",
"boolean",
"notify",
"=",
"true",
";",
"// assume always notify",
"try",
"{",
"// do any internal management necessary based on this event",
"EventHelper",
"helper",
"=",
... | Dispatches an event after the target object has been resolved and the permissions have been
checked. This is used by {@link #processEvent} and {@link #processCompoundEvent}.
@return the value returned by {@link DEvent#applyToObject}. | [
"Dispatches",
"an",
"event",
"after",
"the",
"target",
"object",
"has",
"been",
"resolved",
"and",
"the",
"permissions",
"have",
"been",
"checked",
".",
"This",
"is",
"used",
"by",
"{",
"@link",
"#processEvent",
"}",
"and",
"{",
"@link",
"#processCompoundEvent... | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java#L790-L823 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/V1InstanceGetter.java | V1InstanceGetter.changeSets | public Collection<ChangeSet> changeSets(ChangeSetFilter filter) {
return get(ChangeSet.class, (filter != null) ? filter : new ChangeSetFilter());
} | java | public Collection<ChangeSet> changeSets(ChangeSetFilter filter) {
return get(ChangeSet.class, (filter != null) ? filter : new ChangeSetFilter());
} | [
"public",
"Collection",
"<",
"ChangeSet",
">",
"changeSets",
"(",
"ChangeSetFilter",
"filter",
")",
"{",
"return",
"get",
"(",
"ChangeSet",
".",
"class",
",",
"(",
"filter",
"!=",
"null",
")",
"?",
"filter",
":",
"new",
"ChangeSetFilter",
"(",
")",
")",
... | Get ChangeSets filtered by the criteria specified in the passed in
filter.
@param filter Limit the items returned. If null, then all items returned.
@return Collection of items as specified in the filter. | [
"Get",
"ChangeSets",
"filtered",
"by",
"the",
"criteria",
"specified",
"in",
"the",
"passed",
"in",
"filter",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceGetter.java#L316-L318 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/FileLockTable.java | FileLockTable.newSharedFileLockTable | public static FileLockTable newSharedFileLockTable(Channel channel,
FileDescriptor fd)
throws IOException
{
return new SharedFileLockTable(channel, fd);
} | java | public static FileLockTable newSharedFileLockTable(Channel channel,
FileDescriptor fd)
throws IOException
{
return new SharedFileLockTable(channel, fd);
} | [
"public",
"static",
"FileLockTable",
"newSharedFileLockTable",
"(",
"Channel",
"channel",
",",
"FileDescriptor",
"fd",
")",
"throws",
"IOException",
"{",
"return",
"new",
"SharedFileLockTable",
"(",
"channel",
",",
"fd",
")",
";",
"}"
] | Creates and returns a file lock table for a channel that is connected to
the a system-wide map of all file locks for the Java virtual machine. | [
"Creates",
"and",
"returns",
"a",
"file",
"lock",
"table",
"for",
"a",
"channel",
"that",
"is",
"connected",
"to",
"the",
"a",
"system",
"-",
"wide",
"map",
"of",
"all",
"file",
"locks",
"for",
"the",
"Java",
"virtual",
"machine",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/FileLockTable.java#L43-L48 |
cdk/cdk | display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicBondGenerator.java | BasicBondGenerator.generateRingElements | public IRenderingElement generateRingElements(IBond bond, IRing ring, RendererModel model) {
if (isSingle(bond) && isStereoBond(bond)) {
return generateStereoElement(bond, model);
} else if (isDouble(bond)) {
ElementGroup pair = new ElementGroup();
pair.add(generateBondElement(bond, IBond.Order.SINGLE, model));
pair.add(generateInnerElement(bond, ring, model));
return pair;
} else {
return generateBondElement(bond, model);
}
} | java | public IRenderingElement generateRingElements(IBond bond, IRing ring, RendererModel model) {
if (isSingle(bond) && isStereoBond(bond)) {
return generateStereoElement(bond, model);
} else if (isDouble(bond)) {
ElementGroup pair = new ElementGroup();
pair.add(generateBondElement(bond, IBond.Order.SINGLE, model));
pair.add(generateInnerElement(bond, ring, model));
return pair;
} else {
return generateBondElement(bond, model);
}
} | [
"public",
"IRenderingElement",
"generateRingElements",
"(",
"IBond",
"bond",
",",
"IRing",
"ring",
",",
"RendererModel",
"model",
")",
"{",
"if",
"(",
"isSingle",
"(",
"bond",
")",
"&&",
"isStereoBond",
"(",
"bond",
")",
")",
"{",
"return",
"generateStereoElem... | Generate ring elements, such as inner-ring bonds or ring stereo elements.
@param bond the ring bond to use when generating elements
@param ring the ring that the bond is in
@param model the renderer model
@return one or more rendering elements | [
"Generate",
"ring",
"elements",
"such",
"as",
"inner",
"-",
"ring",
"bonds",
"or",
"ring",
"stereo",
"elements",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicBondGenerator.java#L378-L389 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java | InternalService.queryConversationEvents | public void queryConversationEvents(@NonNull final String conversationId, @NonNull final Long from, @NonNull final Integer limit, @Nullable Callback<ComapiResult<ConversationEventsResponse>> callback) {
adapter.adapt(queryConversationEvents(conversationId, from, limit), callback);
} | java | public void queryConversationEvents(@NonNull final String conversationId, @NonNull final Long from, @NonNull final Integer limit, @Nullable Callback<ComapiResult<ConversationEventsResponse>> callback) {
adapter.adapt(queryConversationEvents(conversationId, from, limit), callback);
} | [
"public",
"void",
"queryConversationEvents",
"(",
"@",
"NonNull",
"final",
"String",
"conversationId",
",",
"@",
"NonNull",
"final",
"Long",
"from",
",",
"@",
"NonNull",
"final",
"Integer",
"limit",
",",
"@",
"Nullable",
"Callback",
"<",
"ComapiResult",
"<",
"... | Query chanel events.
@param conversationId ID of a conversation to query events in it.
@param from ID of the event to start from.
@param limit Limit of events to obtain in this call.
@param callback Callback to deliver new session instance. | [
"Query",
"chanel",
"events",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L869-L871 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.telephony_billingAccount_accessories_POST | public OvhOrder telephony_billingAccount_accessories_POST(String billingAccount, String[] accessories, String mondialRelayId, Boolean retractation, Long shippingContactId) throws IOException {
String qPath = "/order/telephony/{billingAccount}/accessories";
StringBuilder sb = path(qPath, billingAccount);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "accessories", accessories);
addBody(o, "mondialRelayId", mondialRelayId);
addBody(o, "retractation", retractation);
addBody(o, "shippingContactId", shippingContactId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder telephony_billingAccount_accessories_POST(String billingAccount, String[] accessories, String mondialRelayId, Boolean retractation, Long shippingContactId) throws IOException {
String qPath = "/order/telephony/{billingAccount}/accessories";
StringBuilder sb = path(qPath, billingAccount);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "accessories", accessories);
addBody(o, "mondialRelayId", mondialRelayId);
addBody(o, "retractation", retractation);
addBody(o, "shippingContactId", shippingContactId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"telephony_billingAccount_accessories_POST",
"(",
"String",
"billingAccount",
",",
"String",
"[",
"]",
"accessories",
",",
"String",
"mondialRelayId",
",",
"Boolean",
"retractation",
",",
"Long",
"shippingContactId",
")",
"throws",
"IOException",
"... | Create order
REST: POST /order/telephony/{billingAccount}/accessories
@param mondialRelayId [required] Use /supply/mondialRelay entry point to specify a relay point and ignore shipping contact address information entry.
@param shippingContactId [required] Shipping contact information id from /me entry point
@param retractation [required] Retractation rights if set
@param accessories [required] Accessories to order
@param billingAccount [required] The name of your billingAccount | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L6701-L6711 |
netty/netty | codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java | ByteToMessageDecoder.fireChannelRead | static void fireChannelRead(ChannelHandlerContext ctx, CodecOutputList msgs, int numElements) {
for (int i = 0; i < numElements; i ++) {
ctx.fireChannelRead(msgs.getUnsafe(i));
}
} | java | static void fireChannelRead(ChannelHandlerContext ctx, CodecOutputList msgs, int numElements) {
for (int i = 0; i < numElements; i ++) {
ctx.fireChannelRead(msgs.getUnsafe(i));
}
} | [
"static",
"void",
"fireChannelRead",
"(",
"ChannelHandlerContext",
"ctx",
",",
"CodecOutputList",
"msgs",
",",
"int",
"numElements",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numElements",
";",
"i",
"++",
")",
"{",
"ctx",
".",
"fireChan... | Get {@code numElements} out of the {@link CodecOutputList} and forward these through the pipeline. | [
"Get",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java#L321-L325 |
iipc/webarchive-commons | src/main/java/org/archive/io/arc/ARCReader.java | ARCReader.createArchiveRecord | protected ARCRecord createArchiveRecord(InputStream is, long offset)
throws IOException {
try {
String version = super.getVersion();
ARCRecord record = new ARCRecord(is, getReaderIdentifier(), offset,
isDigest(), isStrict(), isParseHttpHeaders(),
isAlignedOnFirstRecord(), version);
if (version != null && super.getVersion() == null)
super.setVersion(version);
currentRecord(record);
} catch (IOException e) {
if (e instanceof RecoverableIOException) {
// Don't mess with RecoverableIOExceptions. Let them out.
throw e;
}
IOException newE = new IOException(e.getMessage() + " (Offset " +
offset + ").");
newE.setStackTrace(e.getStackTrace());
throw newE;
}
return (ARCRecord)getCurrentRecord();
} | java | protected ARCRecord createArchiveRecord(InputStream is, long offset)
throws IOException {
try {
String version = super.getVersion();
ARCRecord record = new ARCRecord(is, getReaderIdentifier(), offset,
isDigest(), isStrict(), isParseHttpHeaders(),
isAlignedOnFirstRecord(), version);
if (version != null && super.getVersion() == null)
super.setVersion(version);
currentRecord(record);
} catch (IOException e) {
if (e instanceof RecoverableIOException) {
// Don't mess with RecoverableIOExceptions. Let them out.
throw e;
}
IOException newE = new IOException(e.getMessage() + " (Offset " +
offset + ").");
newE.setStackTrace(e.getStackTrace());
throw newE;
}
return (ARCRecord)getCurrentRecord();
} | [
"protected",
"ARCRecord",
"createArchiveRecord",
"(",
"InputStream",
"is",
",",
"long",
"offset",
")",
"throws",
"IOException",
"{",
"try",
"{",
"String",
"version",
"=",
"super",
".",
"getVersion",
"(",
")",
";",
"ARCRecord",
"record",
"=",
"new",
"ARCRecord"... | Create new arc record.
Encapsulate housekeeping that has to do w/ creating a new record.
<p>Call this method at end of constructor to read in the
arcfile header. Will be problems reading subsequent arc records
if you don't since arcfile header has the list of metadata fields for
all records that follow.
<p>When parsing through ARCs writing out CDX info, we spend about
38% of CPU in here -- about 30% of which is in getTokenizedHeaderLine
-- of which 16% is reading.
@param is InputStream to use.
@param offset Absolute offset into arc file.
@return An arc record.
@throws IOException | [
"Create",
"new",
"arc",
"record",
"."
] | train | https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/arc/ARCReader.java#L145-L166 |
alkacon/opencms-core | src/org/opencms/flex/CmsFlexController.java | CmsFlexController.setThrowable | public Throwable setThrowable(Throwable throwable, String resource) {
if (m_throwable == null) {
m_throwable = throwable;
m_throwableResourceUri = resource;
} else {
if (LOG.isDebugEnabled()) {
if (resource != null) {
LOG.debug(
Messages.get().getBundle().key(Messages.LOG_FLEXCONTROLLER_IGNORED_EXCEPTION_1, resource));
} else {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_FLEXCONTROLLER_IGNORED_EXCEPTION_0));
}
}
}
return m_throwable;
} | java | public Throwable setThrowable(Throwable throwable, String resource) {
if (m_throwable == null) {
m_throwable = throwable;
m_throwableResourceUri = resource;
} else {
if (LOG.isDebugEnabled()) {
if (resource != null) {
LOG.debug(
Messages.get().getBundle().key(Messages.LOG_FLEXCONTROLLER_IGNORED_EXCEPTION_1, resource));
} else {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_FLEXCONTROLLER_IGNORED_EXCEPTION_0));
}
}
}
return m_throwable;
} | [
"public",
"Throwable",
"setThrowable",
"(",
"Throwable",
"throwable",
",",
"String",
"resource",
")",
"{",
"if",
"(",
"m_throwable",
"==",
"null",
")",
"{",
"m_throwable",
"=",
"throwable",
";",
"m_throwableResourceUri",
"=",
"resource",
";",
"}",
"else",
"{",... | Sets an exception (Throwable) that was caught during inclusion of sub elements.<p>
If another exception is already set in this controller, then the additional exception
is ignored.<p>
@param throwable the exception (Throwable) to set
@param resource the URI of the VFS resource the error occurred on (might be <code>null</code> if unknown)
@return the exception stored in the controller | [
"Sets",
"an",
"exception",
"(",
"Throwable",
")",
"that",
"was",
"caught",
"during",
"inclusion",
"of",
"sub",
"elements",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexController.java#L661-L677 |
phax/ph-oton | ph-oton-uicore/src/main/java/com/helger/photon/uicore/page/AbstractWebPageSimpleForm.java | AbstractWebPageSimpleForm.getObjectDisplayName | @Nullable
@OverrideOnDemand
protected String getObjectDisplayName (@Nonnull final WPECTYPE aWPEC, @Nonnull final DATATYPE aObject)
{
return null;
} | java | @Nullable
@OverrideOnDemand
protected String getObjectDisplayName (@Nonnull final WPECTYPE aWPEC, @Nonnull final DATATYPE aObject)
{
return null;
} | [
"@",
"Nullable",
"@",
"OverrideOnDemand",
"protected",
"String",
"getObjectDisplayName",
"(",
"@",
"Nonnull",
"final",
"WPECTYPE",
"aWPEC",
",",
"@",
"Nonnull",
"final",
"DATATYPE",
"aObject",
")",
"{",
"return",
"null",
";",
"}"
] | Get the display name of the passed object.
@param aWPEC
The current web page execution context. Never <code>null</code>.
@param aObject
The object to get the display name from. Never <code>null</code>.
@return <code>null</code> to indicate that no display name is available | [
"Get",
"the",
"display",
"name",
"of",
"the",
"passed",
"object",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uicore/src/main/java/com/helger/photon/uicore/page/AbstractWebPageSimpleForm.java#L105-L110 |
Ekryd/sortpom | sorter/src/main/java/sortpom/util/XmlOrderedResult.java | XmlOrderedResult.textContentDiffers | public static XmlOrderedResult textContentDiffers(String name, String originalElementText, String newElementText) {
return new XmlOrderedResult(false, String.format("The xml element <%s>%s</%s> should be placed before <%s>%s</%s>",
name, newElementText, name, name, originalElementText, name));
} | java | public static XmlOrderedResult textContentDiffers(String name, String originalElementText, String newElementText) {
return new XmlOrderedResult(false, String.format("The xml element <%s>%s</%s> should be placed before <%s>%s</%s>",
name, newElementText, name, name, originalElementText, name));
} | [
"public",
"static",
"XmlOrderedResult",
"textContentDiffers",
"(",
"String",
"name",
",",
"String",
"originalElementText",
",",
"String",
"newElementText",
")",
"{",
"return",
"new",
"XmlOrderedResult",
"(",
"false",
",",
"String",
".",
"format",
"(",
"\"The xml ele... | The texts inside two elements differ. Example: when maven properties should be sorted | [
"The",
"texts",
"inside",
"two",
"elements",
"differ",
".",
"Example",
":",
"when",
"maven",
"properties",
"should",
"be",
"sorted"
] | train | https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/util/XmlOrderedResult.java#L37-L40 |
codelibs/fess | src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java | FessMessages.addErrorsCouldNotOpenOnSystem | public FessMessages addErrorsCouldNotOpenOnSystem(String property, String arg0) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_could_not_open_on_system, arg0));
return this;
} | java | public FessMessages addErrorsCouldNotOpenOnSystem(String property, String arg0) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_could_not_open_on_system, arg0));
return this;
} | [
"public",
"FessMessages",
"addErrorsCouldNotOpenOnSystem",
"(",
"String",
"property",
",",
"String",
"arg0",
")",
"{",
"assertPropertyNotNull",
"(",
"property",
")",
";",
"add",
"(",
"property",
",",
"new",
"UserMessage",
"(",
"ERRORS_could_not_open_on_system",
",",
... | Add the created action message for the key 'errors.could_not_open_on_system' with parameters.
<pre>
message: Could not open {0}. <br/>Please check if the file is associated with an application.
</pre>
@param property The property name for the message. (NotNull)
@param arg0 The parameter arg0 for message. (NotNull)
@return this. (NotNull) | [
"Add",
"the",
"created",
"action",
"message",
"for",
"the",
"key",
"errors",
".",
"could_not_open_on_system",
"with",
"parameters",
".",
"<pre",
">",
"message",
":",
"Could",
"not",
"open",
"{",
"0",
"}",
".",
"<",
";",
"br",
"/",
">",
";",
"Please",... | train | https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L1418-L1422 |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traj/math/ConfinedDiffusionMSDCurveFit.java | ConfinedDiffusionMSDCurveFit.doFit | public void doFit(double[] xdata, double[] ydata, boolean reduced){
CurveFitter fitter = new CurveFitter(xdata, ydata);
if(reduced==false){
double ia = Double.isNaN(initA)?0:initA;
double ib = Double.isNaN(initB)?0:initB;
double ic = Double.isNaN(initC)?0:initC;
double id = Double.isNaN(initD)?0:initD;
double[] initialParams = new double[]{ia,ib,ic,id};//,regest.evaluate()[0]};
fitter.setInitialParameters(initialParams);
//fitter.doCustomFit("y=a*(1-b*exp(-4*c*d*x/a))", initialParams, false);
fitter.doCustomFit("y=sqrt(a*a)*(1-sqrt(b*b)*exp(-4*sqrt(c*c)*sqrt(d*d)*x/sqrt(a*a)))", initialParams, false);
double[] params = fitter.getParams();
a = Math.abs(params[0]);
b = Math.abs(params[1]);
c = Math.abs(params[2]);
D = Math.abs(params[3]);
goodness = fitter.getFitGoodness();
}else{
double ia = Double.isNaN(initA)?0:initA;
double id = Double.isNaN(initD)?0:initD;
double[] initialParams = new double[]{ia,id};//,regest.evaluate()[0]};
fitter.setInitialParameters(initialParams);
//fitter.doCustomFit("y=a*(1-b*exp(-4*c*d*x/a))", initialParams, false);
fitter.doCustomFit("y=sqrt(a*a)*(1-exp(-4*sqrt(b*b)*x/sqrt(a*a)))", initialParams, false);
double[] params = fitter.getParams();
a = Math.abs(params[0]);
D = Math.abs(params[1]);
goodness = fitter.getFitGoodness();
}
} | java | public void doFit(double[] xdata, double[] ydata, boolean reduced){
CurveFitter fitter = new CurveFitter(xdata, ydata);
if(reduced==false){
double ia = Double.isNaN(initA)?0:initA;
double ib = Double.isNaN(initB)?0:initB;
double ic = Double.isNaN(initC)?0:initC;
double id = Double.isNaN(initD)?0:initD;
double[] initialParams = new double[]{ia,ib,ic,id};//,regest.evaluate()[0]};
fitter.setInitialParameters(initialParams);
//fitter.doCustomFit("y=a*(1-b*exp(-4*c*d*x/a))", initialParams, false);
fitter.doCustomFit("y=sqrt(a*a)*(1-sqrt(b*b)*exp(-4*sqrt(c*c)*sqrt(d*d)*x/sqrt(a*a)))", initialParams, false);
double[] params = fitter.getParams();
a = Math.abs(params[0]);
b = Math.abs(params[1]);
c = Math.abs(params[2]);
D = Math.abs(params[3]);
goodness = fitter.getFitGoodness();
}else{
double ia = Double.isNaN(initA)?0:initA;
double id = Double.isNaN(initD)?0:initD;
double[] initialParams = new double[]{ia,id};//,regest.evaluate()[0]};
fitter.setInitialParameters(initialParams);
//fitter.doCustomFit("y=a*(1-b*exp(-4*c*d*x/a))", initialParams, false);
fitter.doCustomFit("y=sqrt(a*a)*(1-exp(-4*sqrt(b*b)*x/sqrt(a*a)))", initialParams, false);
double[] params = fitter.getParams();
a = Math.abs(params[0]);
D = Math.abs(params[1]);
goodness = fitter.getFitGoodness();
}
} | [
"public",
"void",
"doFit",
"(",
"double",
"[",
"]",
"xdata",
",",
"double",
"[",
"]",
"ydata",
",",
"boolean",
"reduced",
")",
"{",
"CurveFitter",
"fitter",
"=",
"new",
"CurveFitter",
"(",
"xdata",
",",
"ydata",
")",
";",
"if",
"(",
"reduced",
"==",
... | Fits the curve y = a*(1-b*exp((-4*D)*(x/a)*c)) to the x- and y data.
The parameters have the follow meaning:
@param xdata
@param ydata | [
"Fits",
"the",
"curve",
"y",
"=",
"a",
"*",
"(",
"1",
"-",
"b",
"*",
"exp",
"((",
"-",
"4",
"*",
"D",
")",
"*",
"(",
"x",
"/",
"a",
")",
"*",
"c",
"))",
"to",
"the",
"x",
"-",
"and",
"y",
"data",
".",
"The",
"parameters",
"have",
"the",
... | train | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traj/math/ConfinedDiffusionMSDCurveFit.java#L65-L94 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/dnd/CmsDNDHandler.java | CmsDNDHandler.animateCancel | protected void animateCancel(final I_CmsDraggable draggable, final I_CmsDNDController controller) {
controller.onAnimationStart(draggable, null, this);
stopDragging();
Command callback = new Command() {
/**
* @see com.google.gwt.user.client.Command#execute()
*/
public void execute() {
controller.onDragCancel(draggable, null, CmsDNDHandler.this);
draggable.onDragCancel();
clear();
}
};
showEndAnimation(callback, m_startTop, m_startLeft, false);
} | java | protected void animateCancel(final I_CmsDraggable draggable, final I_CmsDNDController controller) {
controller.onAnimationStart(draggable, null, this);
stopDragging();
Command callback = new Command() {
/**
* @see com.google.gwt.user.client.Command#execute()
*/
public void execute() {
controller.onDragCancel(draggable, null, CmsDNDHandler.this);
draggable.onDragCancel();
clear();
}
};
showEndAnimation(callback, m_startTop, m_startLeft, false);
} | [
"protected",
"void",
"animateCancel",
"(",
"final",
"I_CmsDraggable",
"draggable",
",",
"final",
"I_CmsDNDController",
"controller",
")",
"{",
"controller",
".",
"onAnimationStart",
"(",
"draggable",
",",
"null",
",",
"this",
")",
";",
"stopDragging",
"(",
")",
... | Clears the drag process with a move animation of the drag element to it's original position.<p>
@param draggable the draggable
@param controller the drag and drop controller | [
"Clears",
"the",
"drag",
"process",
"with",
"a",
"move",
"animation",
"of",
"the",
"drag",
"element",
"to",
"it",
"s",
"original",
"position",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/dnd/CmsDNDHandler.java#L776-L793 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/ClassUtils.java | ClassUtils.getClass | @GwtIncompatible("incompatible method")
public static Class<?> getClass(final String className, final boolean initialize) throws ClassNotFoundException {
final ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
final ClassLoader loader = contextCL == null ? ClassUtils.class.getClassLoader() : contextCL;
return getClass(loader, className, initialize);
} | java | @GwtIncompatible("incompatible method")
public static Class<?> getClass(final String className, final boolean initialize) throws ClassNotFoundException {
final ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
final ClassLoader loader = contextCL == null ? ClassUtils.class.getClassLoader() : contextCL;
return getClass(loader, className, initialize);
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"Class",
"<",
"?",
">",
"getClass",
"(",
"final",
"String",
"className",
",",
"final",
"boolean",
"initialize",
")",
"throws",
"ClassNotFoundException",
"{",
"final",
"ClassLoader",
"... | Returns the class represented by {@code className} using the
current thread's context class loader. This implementation supports the
syntaxes "{@code java.util.Map.Entry[]}", "{@code java.util.Map$Entry[]}",
"{@code [Ljava.util.Map.Entry;}", and "{@code [Ljava.util.Map$Entry;}".
@param className the class name
@param initialize whether the class must be initialized
@return the class represented by {@code className} using the current thread's context class loader
@throws ClassNotFoundException if the class is not found | [
"Returns",
"the",
"class",
"represented",
"by",
"{",
"@code",
"className",
"}",
"using",
"the",
"current",
"thread",
"s",
"context",
"class",
"loader",
".",
"This",
"implementation",
"supports",
"the",
"syntaxes",
"{",
"@code",
"java",
".",
"util",
".",
"Map... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ClassUtils.java#L1069-L1074 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.restoreSecret | public SecretBundle restoreSecret(String vaultBaseUrl, byte[] secretBundleBackup) {
return restoreSecretWithServiceResponseAsync(vaultBaseUrl, secretBundleBackup).toBlocking().single().body();
} | java | public SecretBundle restoreSecret(String vaultBaseUrl, byte[] secretBundleBackup) {
return restoreSecretWithServiceResponseAsync(vaultBaseUrl, secretBundleBackup).toBlocking().single().body();
} | [
"public",
"SecretBundle",
"restoreSecret",
"(",
"String",
"vaultBaseUrl",
",",
"byte",
"[",
"]",
"secretBundleBackup",
")",
"{",
"return",
"restoreSecretWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"secretBundleBackup",
")",
".",
"toBlocking",
"(",
")",
".",
... | Restores a backed up secret to a vault.
Restores a backed up secret, and all its versions, to a vault. This operation requires the secrets/restore permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param secretBundleBackup The backup blob associated with a secret bundle.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the SecretBundle object if successful. | [
"Restores",
"a",
"backed",
"up",
"secret",
"to",
"a",
"vault",
".",
"Restores",
"a",
"backed",
"up",
"secret",
"and",
"all",
"its",
"versions",
"to",
"a",
"vault",
".",
"This",
"operation",
"requires",
"the",
"secrets",
"/",
"restore",
"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#L4994-L4996 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/EventCollector.java | EventCollector.addManagementGraph | void addManagementGraph(final JobID jobID, final ManagementGraph managementGraph) {
synchronized (this.recentManagementGraphs) {
this.recentManagementGraphs.put(jobID, managementGraph);
}
} | java | void addManagementGraph(final JobID jobID, final ManagementGraph managementGraph) {
synchronized (this.recentManagementGraphs) {
this.recentManagementGraphs.put(jobID, managementGraph);
}
} | [
"void",
"addManagementGraph",
"(",
"final",
"JobID",
"jobID",
",",
"final",
"ManagementGraph",
"managementGraph",
")",
"{",
"synchronized",
"(",
"this",
".",
"recentManagementGraphs",
")",
"{",
"this",
".",
"recentManagementGraphs",
".",
"put",
"(",
"jobID",
",",
... | Adds a {@link ManagementGraph} to the map of recently created management graphs.
@param jobID
the ID of the job the management graph belongs to
@param managementGraph
the management graph to be added | [
"Adds",
"a",
"{",
"@link",
"ManagementGraph",
"}",
"to",
"the",
"map",
"of",
"recently",
"created",
"management",
"graphs",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/EventCollector.java#L568-L573 |
apereo/cas | support/cas-server-support-otp-mfa-core/src/main/java/org/apereo/cas/otp/util/QRUtils.java | QRUtils.generateQRCode | @SneakyThrows
public static void generateQRCode(final OutputStream stream, final String key,
final int width, final int height) {
val hintMap = new EnumMap<EncodeHintType, Object>(EncodeHintType.class);
hintMap.put(EncodeHintType.CHARACTER_SET, StandardCharsets.UTF_8.name());
hintMap.put(EncodeHintType.MARGIN, 2);
hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
val qrCodeWriter = new QRCodeWriter();
val byteMatrix = qrCodeWriter.encode(key, BarcodeFormat.QR_CODE, width, height, hintMap);
val byteMatrixWidth = byteMatrix.getWidth();
val image = new BufferedImage(byteMatrixWidth, byteMatrixWidth, BufferedImage.TYPE_INT_RGB);
image.createGraphics();
@Cleanup("dispose")
val graphics = (Graphics2D) image.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, byteMatrixWidth, byteMatrixWidth);
graphics.setColor(Color.BLACK);
IntStream.range(0, byteMatrixWidth)
.forEach(i -> IntStream.range(0, byteMatrixWidth)
.filter(j -> byteMatrix.get(i, j))
.forEach(j -> graphics.fillRect(i, j, 1, 1)));
ImageIO.write(image, "png", stream);
} | java | @SneakyThrows
public static void generateQRCode(final OutputStream stream, final String key,
final int width, final int height) {
val hintMap = new EnumMap<EncodeHintType, Object>(EncodeHintType.class);
hintMap.put(EncodeHintType.CHARACTER_SET, StandardCharsets.UTF_8.name());
hintMap.put(EncodeHintType.MARGIN, 2);
hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
val qrCodeWriter = new QRCodeWriter();
val byteMatrix = qrCodeWriter.encode(key, BarcodeFormat.QR_CODE, width, height, hintMap);
val byteMatrixWidth = byteMatrix.getWidth();
val image = new BufferedImage(byteMatrixWidth, byteMatrixWidth, BufferedImage.TYPE_INT_RGB);
image.createGraphics();
@Cleanup("dispose")
val graphics = (Graphics2D) image.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, byteMatrixWidth, byteMatrixWidth);
graphics.setColor(Color.BLACK);
IntStream.range(0, byteMatrixWidth)
.forEach(i -> IntStream.range(0, byteMatrixWidth)
.filter(j -> byteMatrix.get(i, j))
.forEach(j -> graphics.fillRect(i, j, 1, 1)));
ImageIO.write(image, "png", stream);
} | [
"@",
"SneakyThrows",
"public",
"static",
"void",
"generateQRCode",
"(",
"final",
"OutputStream",
"stream",
",",
"final",
"String",
"key",
",",
"final",
"int",
"width",
",",
"final",
"int",
"height",
")",
"{",
"val",
"hintMap",
"=",
"new",
"EnumMap",
"<",
"... | Generate qr code.
@param stream the stream
@param key the key
@param width the width
@param height the height | [
"Generate",
"qr",
"code",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-otp-mfa-core/src/main/java/org/apereo/cas/otp/util/QRUtils.java#L43-L70 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java | CommonOps_DDF2.subtract | public static void subtract( DMatrix2 a , DMatrix2 b , DMatrix2 c ) {
c.a1 = a.a1 - b.a1;
c.a2 = a.a2 - b.a2;
} | java | public static void subtract( DMatrix2 a , DMatrix2 b , DMatrix2 c ) {
c.a1 = a.a1 - b.a1;
c.a2 = a.a2 - b.a2;
} | [
"public",
"static",
"void",
"subtract",
"(",
"DMatrix2",
"a",
",",
"DMatrix2",
"b",
",",
"DMatrix2",
"c",
")",
"{",
"c",
".",
"a1",
"=",
"a",
".",
"a1",
"-",
"b",
".",
"a1",
";",
"c",
".",
"a2",
"=",
"a",
".",
"a2",
"-",
"b",
".",
"a2",
";"... | <p>Performs the following operation:<br>
<br>
c = a - b <br>
c<sub>i</sub> = a<sub>i</sub> - b<sub>i</sub> <br>
</p>
<p>
Vector C can be the same instance as Vector A and/or B.
</p>
@param a A Vector. Not modified.
@param b A Vector. Not modified.
@param c A Vector where the results are stored. Modified. | [
"<p",
">",
"Performs",
"the",
"following",
"operation",
":",
"<br",
">",
"<br",
">",
"c",
"=",
"a",
"-",
"b",
"<br",
">",
"c<sub",
">",
"i<",
"/",
"sub",
">",
"=",
"a<sub",
">",
"i<",
"/",
"sub",
">",
"-",
"b<sub",
">",
"i<",
"/",
"sub",
">",... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java#L143-L146 |
aws/aws-sdk-java | aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/internal/validation/ValidationContext.java | ValidationContext.assertStringNotEmpty | public void assertStringNotEmpty(String propertyValue, String propertyName) {
if (StringUtils.isNullOrEmpty(propertyValue)) {
problemReporter.report(new Problem(this, String.format("%s is a required property.", propertyName)));
}
} | java | public void assertStringNotEmpty(String propertyValue, String propertyName) {
if (StringUtils.isNullOrEmpty(propertyValue)) {
problemReporter.report(new Problem(this, String.format("%s is a required property.", propertyName)));
}
} | [
"public",
"void",
"assertStringNotEmpty",
"(",
"String",
"propertyValue",
",",
"String",
"propertyName",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"propertyValue",
")",
")",
"{",
"problemReporter",
".",
"report",
"(",
"new",
"Problem",
"(",
... | Asserts the string is not null and not empty, reporting to {@link ProblemReporter} with this context if it is.
@param propertyValue Value to assert on.
@param propertyName Name of property. | [
"Asserts",
"the",
"string",
"is",
"not",
"null",
"and",
"not",
"empty",
"reporting",
"to",
"{",
"@link",
"ProblemReporter",
"}",
"with",
"this",
"context",
"if",
"it",
"is",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/internal/validation/ValidationContext.java#L78-L82 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/JMapper.java | JMapper.getDestinationWithoutControl | public D getDestinationWithoutControl(D destination,final S source){
try {
return mapper.vVNotAllAll(destination, source);
} catch (Exception e) {
JmapperLog.error(e);
}
return null;
} | java | public D getDestinationWithoutControl(D destination,final S source){
try {
return mapper.vVNotAllAll(destination, source);
} catch (Exception e) {
JmapperLog.error(e);
}
return null;
} | [
"public",
"D",
"getDestinationWithoutControl",
"(",
"D",
"destination",
",",
"final",
"S",
"source",
")",
"{",
"try",
"{",
"return",
"mapper",
".",
"vVNotAllAll",
"(",
"destination",
",",
"source",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
... | This Method returns the destination given in input enriched with data contained in source given in input<br>
with this setting:
<table summary = "">
<tr>
<td><code>NullPointerControl</code></td><td><code>NOT_ANY</code></td>
</tr><tr>
<td><code>MappingType</code> of Destination</td><td><code>ALL_FIELDS</code></td>
</tr><tr>
<td><code>MappingType</code> of Source</td><td><code>ALL_FIELDS</code></td>
</tr>
</table>
@param destination instance to enrich
@param source instance that contains the data
@return destination enriched
@see NullPointerControl
@see MappingType | [
"This",
"Method",
"returns",
"the",
"destination",
"given",
"in",
"input",
"enriched",
"with",
"data",
"contained",
"in",
"source",
"given",
"in",
"input<br",
">",
"with",
"this",
"setting",
":",
"<table",
"summary",
"=",
">",
"<tr",
">",
"<td",
">",
"<cod... | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/JMapper.java#L175-L182 |
hmsonline/storm-cassandra | src/main/java/com/hmsonline/storm/cassandra/bolt/mapper/ValuelessColumnsMapper.java | ValuelessColumnsMapper.mapToValues | @Override
public List<Values> mapToValues(String rowKey, Map<String, String> columns, Tuple input) {
List<Values> values = new ArrayList<Values>();
Set<String> vals = columns.keySet();
for(String columnName : vals){
if(this.isDrpc){
values.add(new Values(input.getValue(0), rowKey, columnName));
} else {
values.add(new Values(rowKey, columnName));
}
}
return values;
} | java | @Override
public List<Values> mapToValues(String rowKey, Map<String, String> columns, Tuple input) {
List<Values> values = new ArrayList<Values>();
Set<String> vals = columns.keySet();
for(String columnName : vals){
if(this.isDrpc){
values.add(new Values(input.getValue(0), rowKey, columnName));
} else {
values.add(new Values(rowKey, columnName));
}
}
return values;
} | [
"@",
"Override",
"public",
"List",
"<",
"Values",
">",
"mapToValues",
"(",
"String",
"rowKey",
",",
"Map",
"<",
"String",
",",
"String",
">",
"columns",
",",
"Tuple",
"input",
")",
"{",
"List",
"<",
"Values",
">",
"values",
"=",
"new",
"ArrayList",
"<"... | Given a set of columns, maps to values to emit.
@param columns
@return | [
"Given",
"a",
"set",
"of",
"columns",
"maps",
"to",
"values",
"to",
"emit",
"."
] | train | https://github.com/hmsonline/storm-cassandra/blob/94303fad18f4692224187867144921904e35b001/src/main/java/com/hmsonline/storm/cassandra/bolt/mapper/ValuelessColumnsMapper.java#L117-L129 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java | WikipediaTemplateInfo.getRevisionIdsContainingTemplateFragments | public List<Integer> getRevisionIdsContainingTemplateFragments(List<String> templateFragments) throws WikiApiException{
return getFragmentFilteredRevisionIds(templateFragments,true);
} | java | public List<Integer> getRevisionIdsContainingTemplateFragments(List<String> templateFragments) throws WikiApiException{
return getFragmentFilteredRevisionIds(templateFragments,true);
} | [
"public",
"List",
"<",
"Integer",
">",
"getRevisionIdsContainingTemplateFragments",
"(",
"List",
"<",
"String",
">",
"templateFragments",
")",
"throws",
"WikiApiException",
"{",
"return",
"getFragmentFilteredRevisionIds",
"(",
"templateFragments",
",",
"true",
")",
";",... | Returns a list containing the ids of all revisions that contain a
template the name of which starts with any of the given Strings.
@param templateFragments
the beginning of the templates that have to be matched
@return An list with the ids of the revisions that contain templates
beginning with any String in templateFragments
@throws WikiApiException
If there was any error retrieving the page object (most
likely if the template templates are corrupted) | [
"Returns",
"a",
"list",
"containing",
"the",
"ids",
"of",
"all",
"revisions",
"that",
"contain",
"a",
"template",
"the",
"name",
"of",
"which",
"starts",
"with",
"any",
"of",
"the",
"given",
"Strings",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java#L812-L814 |
btrplace/scheduler | api/src/main/java/org/btrplace/model/view/ShareableResource.java | ShareableResource.setConsumption | public ShareableResource setConsumption(VM vm, int val) {
if (val < 0) {
throw new IllegalArgumentException(String.format("The '%s' consumption of VM '%s' must be >= 0", rcId, vm));
}
vmsConsumption.put(vm, val);
return this;
} | java | public ShareableResource setConsumption(VM vm, int val) {
if (val < 0) {
throw new IllegalArgumentException(String.format("The '%s' consumption of VM '%s' must be >= 0", rcId, vm));
}
vmsConsumption.put(vm, val);
return this;
} | [
"public",
"ShareableResource",
"setConsumption",
"(",
"VM",
"vm",
",",
"int",
"val",
")",
"{",
"if",
"(",
"val",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"The '%s' consumption of VM '%s' must be >= 0\"",
... | Set the resource consumption of a VM.
@param vm the VM
@param val the value to set
@return the current resource | [
"Set",
"the",
"resource",
"consumption",
"of",
"a",
"VM",
"."
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/view/ShareableResource.java#L150-L156 |
io7m/jaffirm | com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Invariants.java | Invariants.checkInvariantL | public static long checkInvariantL(
final long value,
final ContractLongConditionType condition)
throws InvariantViolationException
{
return checkInvariantL(value, condition.predicate(), condition.describer());
} | java | public static long checkInvariantL(
final long value,
final ContractLongConditionType condition)
throws InvariantViolationException
{
return checkInvariantL(value, condition.predicate(), condition.describer());
} | [
"public",
"static",
"long",
"checkInvariantL",
"(",
"final",
"long",
"value",
",",
"final",
"ContractLongConditionType",
"condition",
")",
"throws",
"InvariantViolationException",
"{",
"return",
"checkInvariantL",
"(",
"value",
",",
"condition",
".",
"predicate",
"(",... | A {@code long} specialized version of {@link #checkInvariant(Object,
ContractConditionType)}.
@param value The value
@param condition The predicate
@return value
@throws InvariantViolationException If the predicate is false | [
"A",
"{",
"@code",
"long",
"}",
"specialized",
"version",
"of",
"{",
"@link",
"#checkInvariant",
"(",
"Object",
"ContractConditionType",
")",
"}",
"."
] | train | https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Invariants.java#L429-L435 |
joniles/mpxj | src/main/java/net/sf/mpxj/common/DateHelper.java | DateHelper.getVariance | public static Duration getVariance(Task task, Date date1, Date date2, TimeUnit format)
{
Duration variance = null;
if (date1 != null && date2 != null)
{
ProjectCalendar calendar = task.getEffectiveCalendar();
if (calendar != null)
{
variance = calendar.getWork(date1, date2, format);
}
}
if (variance == null)
{
variance = Duration.getInstance(0, format);
}
return (variance);
} | java | public static Duration getVariance(Task task, Date date1, Date date2, TimeUnit format)
{
Duration variance = null;
if (date1 != null && date2 != null)
{
ProjectCalendar calendar = task.getEffectiveCalendar();
if (calendar != null)
{
variance = calendar.getWork(date1, date2, format);
}
}
if (variance == null)
{
variance = Duration.getInstance(0, format);
}
return (variance);
} | [
"public",
"static",
"Duration",
"getVariance",
"(",
"Task",
"task",
",",
"Date",
"date1",
",",
"Date",
"date2",
",",
"TimeUnit",
"format",
")",
"{",
"Duration",
"variance",
"=",
"null",
";",
"if",
"(",
"date1",
"!=",
"null",
"&&",
"date2",
"!=",
"null",
... | This utility method calculates the difference in working
time between two dates, given the context of a task.
@param task parent task
@param date1 first date
@param date2 second date
@param format required format for the resulting duration
@return difference in working time between the two dates | [
"This",
"utility",
"method",
"calculates",
"the",
"difference",
"in",
"working",
"time",
"between",
"two",
"dates",
"given",
"the",
"context",
"of",
"a",
"task",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L247-L266 |
igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/EventManger.java | EventManger.performActionAndWaitForEvent | public R performActionAndWaitForEvent(K eventKey, long timeout, Callback<E> action) throws InterruptedException, E {
final Reference<R> reference = new Reference<>();
events.put(eventKey, reference);
try {
synchronized (reference) {
action.action();
reference.wait(timeout);
}
return reference.eventResult;
}
finally {
events.remove(eventKey);
}
} | java | public R performActionAndWaitForEvent(K eventKey, long timeout, Callback<E> action) throws InterruptedException, E {
final Reference<R> reference = new Reference<>();
events.put(eventKey, reference);
try {
synchronized (reference) {
action.action();
reference.wait(timeout);
}
return reference.eventResult;
}
finally {
events.remove(eventKey);
}
} | [
"public",
"R",
"performActionAndWaitForEvent",
"(",
"K",
"eventKey",
",",
"long",
"timeout",
",",
"Callback",
"<",
"E",
">",
"action",
")",
"throws",
"InterruptedException",
",",
"E",
"{",
"final",
"Reference",
"<",
"R",
">",
"reference",
"=",
"new",
"Refere... | Perform an action and wait for an event.
<p>
The event is signaled with {@link #signalEvent(Object, Object)}.
</p>
@param eventKey the event key, must not be null.
@param timeout the timeout to wait for the event in milliseconds.
@param action the action to perform prior waiting for the event, must not be null.
@return the event value, may be null.
@throws InterruptedException if interrupted while waiting for the event.
@throws E | [
"Perform",
"an",
"action",
"and",
"wait",
"for",
"an",
"event",
".",
"<p",
">",
"The",
"event",
"is",
"signaled",
"with",
"{",
"@link",
"#signalEvent",
"(",
"Object",
"Object",
")",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/EventManger.java#L52-L65 |
comapi/comapi-chat-sdk-android | COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java | ChatController.synchroniseEvents | private Observable<Boolean> synchroniseEvents(final RxComapiClient client, @NonNull final List<ChatConversation> conversationsToUpdate, @NonNull final List<Boolean> successes) {
final List<ChatConversation> limited = limitNumberOfConversations(conversationsToUpdate);
if (limited.isEmpty()) {
return Observable.fromCallable(() -> true);
}
return Observable.from(limited)
.onBackpressureBuffer()
.flatMap(conversation -> persistenceController.getConversation(conversation.getConversationId()))
.flatMap(conversation -> {
if (conversation.getLastRemoteEventId() > conversation.getLastLocalEventId()) {
final long from = conversation.getLastLocalEventId() >= 0 ? conversation.getLastLocalEventId() : 0;
return queryEventsRecursively(client, conversation.getConversationId(), from, 0, successes).map(ComapiResult::isSuccessful);
} else {
return Observable.fromCallable((Callable<Object>) () -> true);
}
})
.flatMap(res -> Observable.from(successes).all(Boolean::booleanValue));
} | java | private Observable<Boolean> synchroniseEvents(final RxComapiClient client, @NonNull final List<ChatConversation> conversationsToUpdate, @NonNull final List<Boolean> successes) {
final List<ChatConversation> limited = limitNumberOfConversations(conversationsToUpdate);
if (limited.isEmpty()) {
return Observable.fromCallable(() -> true);
}
return Observable.from(limited)
.onBackpressureBuffer()
.flatMap(conversation -> persistenceController.getConversation(conversation.getConversationId()))
.flatMap(conversation -> {
if (conversation.getLastRemoteEventId() > conversation.getLastLocalEventId()) {
final long from = conversation.getLastLocalEventId() >= 0 ? conversation.getLastLocalEventId() : 0;
return queryEventsRecursively(client, conversation.getConversationId(), from, 0, successes).map(ComapiResult::isSuccessful);
} else {
return Observable.fromCallable((Callable<Object>) () -> true);
}
})
.flatMap(res -> Observable.from(successes).all(Boolean::booleanValue));
} | [
"private",
"Observable",
"<",
"Boolean",
">",
"synchroniseEvents",
"(",
"final",
"RxComapiClient",
"client",
",",
"@",
"NonNull",
"final",
"List",
"<",
"ChatConversation",
">",
"conversationsToUpdate",
",",
"@",
"NonNull",
"final",
"List",
"<",
"Boolean",
">",
"... | Synchronise missing events for the list of locally stored conversations.
@param client Foundation client.
@param conversationsToUpdate List of conversations to query last events.
@param successes List of partial successes.
@return Observable with the merged result of operations. | [
"Synchronise",
"missing",
"events",
"for",
"the",
"list",
"of",
"locally",
"stored",
"conversations",
"."
] | train | https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java#L568-L588 |
pravega/pravega | common/src/main/java/io/pravega/common/util/DelimitedStringParser.java | DelimitedStringParser.extractInteger | public DelimitedStringParser extractInteger(String key, Consumer<Integer> consumer) {
this.extractors.put(key, new Extractor<>(consumer, Integer::parseInt));
return this;
} | java | public DelimitedStringParser extractInteger(String key, Consumer<Integer> consumer) {
this.extractors.put(key, new Extractor<>(consumer, Integer::parseInt));
return this;
} | [
"public",
"DelimitedStringParser",
"extractInteger",
"(",
"String",
"key",
",",
"Consumer",
"<",
"Integer",
">",
"consumer",
")",
"{",
"this",
".",
"extractors",
".",
"put",
"(",
"key",
",",
"new",
"Extractor",
"<>",
"(",
"consumer",
",",
"Integer",
"::",
... | Associates the given consumer with the given key. This consumer will be invoked every time a Key-Value pair with
the given key is encountered (argument is the Value of the pair). Note that this may be invoked multiple times or
not at all, based on the given input.
@param key The key for which to invoke the consumer.
@param consumer The consumer to invoke.
@return This object instance. | [
"Associates",
"the",
"given",
"consumer",
"with",
"the",
"given",
"key",
".",
"This",
"consumer",
"will",
"be",
"invoked",
"every",
"time",
"a",
"Key",
"-",
"Value",
"pair",
"with",
"the",
"given",
"key",
"is",
"encountered",
"(",
"argument",
"is",
"the",
... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/DelimitedStringParser.java#L87-L90 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Period.java | Period.plusYears | public Period plusYears(long yearsToAdd) {
if (yearsToAdd == 0) {
return this;
}
return create(Math.toIntExact(Math.addExact(years, yearsToAdd)), months, days);
} | java | public Period plusYears(long yearsToAdd) {
if (yearsToAdd == 0) {
return this;
}
return create(Math.toIntExact(Math.addExact(years, yearsToAdd)), months, days);
} | [
"public",
"Period",
"plusYears",
"(",
"long",
"yearsToAdd",
")",
"{",
"if",
"(",
"yearsToAdd",
"==",
"0",
")",
"{",
"return",
"this",
";",
"}",
"return",
"create",
"(",
"Math",
".",
"toIntExact",
"(",
"Math",
".",
"addExact",
"(",
"years",
",",
"yearsT... | Returns a copy of this period with the specified years added.
<p>
This adds the amount to the years unit in a copy of this period.
The months and days units are unaffected.
For example, "1 year, 6 months and 3 days" plus 2 years returns "3 years, 6 months and 3 days".
<p>
This instance is immutable and unaffected by this method call.
@param yearsToAdd the years to add, positive or negative
@return a {@code Period} based on this period with the specified years added, not null
@throws ArithmeticException if numeric overflow occurs | [
"Returns",
"a",
"copy",
"of",
"this",
"period",
"with",
"the",
"specified",
"years",
"added",
".",
"<p",
">",
"This",
"adds",
"the",
"amount",
"to",
"the",
"years",
"unit",
"in",
"a",
"copy",
"of",
"this",
"period",
".",
"The",
"months",
"and",
"days",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Period.java#L640-L645 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJobHistory.java | CoronaJobHistory.logInited | public void logInited(long startTime, int totalMaps, int totalReduces) {
if (disableHistory) {
return;
}
if (null != writers) {
log(writers, RecordTypes.Job,
new Keys[] {Keys.JOBID, Keys.LAUNCH_TIME, Keys.TOTAL_MAPS,
Keys.TOTAL_REDUCES, Keys.JOB_STATUS},
new String[] {jobId.toString(), String.valueOf(startTime),
String.valueOf(totalMaps),
String.valueOf(totalReduces),
Values.PREP.name()});
}
} | java | public void logInited(long startTime, int totalMaps, int totalReduces) {
if (disableHistory) {
return;
}
if (null != writers) {
log(writers, RecordTypes.Job,
new Keys[] {Keys.JOBID, Keys.LAUNCH_TIME, Keys.TOTAL_MAPS,
Keys.TOTAL_REDUCES, Keys.JOB_STATUS},
new String[] {jobId.toString(), String.valueOf(startTime),
String.valueOf(totalMaps),
String.valueOf(totalReduces),
Values.PREP.name()});
}
} | [
"public",
"void",
"logInited",
"(",
"long",
"startTime",
",",
"int",
"totalMaps",
",",
"int",
"totalReduces",
")",
"{",
"if",
"(",
"disableHistory",
")",
"{",
"return",
";",
"}",
"if",
"(",
"null",
"!=",
"writers",
")",
"{",
"log",
"(",
"writers",
",",... | Logs launch time of job.
@param startTime start time of job.
@param totalMaps total maps assigned by jobtracker.
@param totalReduces total reduces. | [
"Logs",
"launch",
"time",
"of",
"job",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJobHistory.java#L303-L317 |
Stratio/stratio-cassandra | src/java/com/stratio/cassandra/index/service/FullKeyMapper.java | FullKeyMapper.addFields | public void addFields(Document document, DecoratedKey partitionKey, CellName clusteringKey) {
ByteBuffer fullKey = byteBuffer(partitionKey, clusteringKey);
Field field = new StringField(FIELD_NAME, ByteBufferUtils.toString(fullKey), Store.NO);
document.add(field);
} | java | public void addFields(Document document, DecoratedKey partitionKey, CellName clusteringKey) {
ByteBuffer fullKey = byteBuffer(partitionKey, clusteringKey);
Field field = new StringField(FIELD_NAME, ByteBufferUtils.toString(fullKey), Store.NO);
document.add(field);
} | [
"public",
"void",
"addFields",
"(",
"Document",
"document",
",",
"DecoratedKey",
"partitionKey",
",",
"CellName",
"clusteringKey",
")",
"{",
"ByteBuffer",
"fullKey",
"=",
"byteBuffer",
"(",
"partitionKey",
",",
"clusteringKey",
")",
";",
"Field",
"field",
"=",
"... | Adds to the specified Lucene {@link Document} the full row key formed by the specified partition key and the
clustering key.
@param document A Lucene {@link Document}.
@param partitionKey A partition key.
@param clusteringKey A clustering key. | [
"Adds",
"to",
"the",
"specified",
"Lucene",
"{",
"@link",
"Document",
"}",
"the",
"full",
"row",
"key",
"formed",
"by",
"the",
"specified",
"partition",
"key",
"and",
"the",
"clustering",
"key",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/index/service/FullKeyMapper.java#L89-L93 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java | StringIterate.detectCharIfNone | public static Character detectCharIfNone(String string, CharPredicate predicate, String resultIfNone)
{
Character result = StringIterate.detectChar(string, predicate);
return result == null ? Character.valueOf(resultIfNone.charAt(0)) : result;
} | java | public static Character detectCharIfNone(String string, CharPredicate predicate, String resultIfNone)
{
Character result = StringIterate.detectChar(string, predicate);
return result == null ? Character.valueOf(resultIfNone.charAt(0)) : result;
} | [
"public",
"static",
"Character",
"detectCharIfNone",
"(",
"String",
"string",
",",
"CharPredicate",
"predicate",
",",
"String",
"resultIfNone",
")",
"{",
"Character",
"result",
"=",
"StringIterate",
".",
"detectChar",
"(",
"string",
",",
"predicate",
")",
";",
"... | Find the first element that returns true for the specified {@code predicate}. Return the first char of the
default string if no value is found. | [
"Find",
"the",
"first",
"element",
"that",
"returns",
"true",
"for",
"the",
"specified",
"{"
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L714-L718 |
litsec/swedish-eid-shibboleth-base | shibboleth-base/shibboleth-extensions/src/main/java/se/litsec/shibboleth/idp/authn/controller/AbstractExternalAuthenticationController.java | AbstractExternalAuthenticationController.processIsPassive | protected void processIsPassive(ProfileRequestContext<?, ?> profileRequestContext) throws ExternalAutenticationErrorCodeException {
final AuthnRequest authnRequest = this.getAuthnRequest(profileRequestContext);
if (authnRequest != null && authnRequest.isPassive() != null && authnRequest.isPassive() == Boolean.TRUE) {
logger.info("AuthnRequest contains IsPassive=true, can not continue ...");
Status status = IdpErrorStatusException.getStatusBuilder(StatusCode.REQUESTER)
.subStatusCode(StatusCode.NO_PASSIVE)
.statusMessage("Can not perform passive authentication")
.build();
throw new IdpErrorStatusException(status, AuthnEventIds.NO_PASSIVE);
}
} | java | protected void processIsPassive(ProfileRequestContext<?, ?> profileRequestContext) throws ExternalAutenticationErrorCodeException {
final AuthnRequest authnRequest = this.getAuthnRequest(profileRequestContext);
if (authnRequest != null && authnRequest.isPassive() != null && authnRequest.isPassive() == Boolean.TRUE) {
logger.info("AuthnRequest contains IsPassive=true, can not continue ...");
Status status = IdpErrorStatusException.getStatusBuilder(StatusCode.REQUESTER)
.subStatusCode(StatusCode.NO_PASSIVE)
.statusMessage("Can not perform passive authentication")
.build();
throw new IdpErrorStatusException(status, AuthnEventIds.NO_PASSIVE);
}
} | [
"protected",
"void",
"processIsPassive",
"(",
"ProfileRequestContext",
"<",
"?",
",",
"?",
">",
"profileRequestContext",
")",
"throws",
"ExternalAutenticationErrorCodeException",
"{",
"final",
"AuthnRequest",
"authnRequest",
"=",
"this",
".",
"getAuthnRequest",
"(",
"pr... | Checks if the IsPassive flag is set in the AuthnRequest and fails with a NO_PASSIVE error code if this is the case.
<p>
Implementations that do support passive authentication MUST override this method and handle the IsPassive
processing themselves.
</p>
@param profileRequestContext
the context
@throws ExternalAutenticationErrorCodeException
if the IsPassive-flag is set | [
"Checks",
"if",
"the",
"IsPassive",
"flag",
"is",
"set",
"in",
"the",
"AuthnRequest",
"and",
"fails",
"with",
"a",
"NO_PASSIVE",
"error",
"code",
"if",
"this",
"is",
"the",
"case",
".",
"<p",
">",
"Implementations",
"that",
"do",
"support",
"passive",
"aut... | train | https://github.com/litsec/swedish-eid-shibboleth-base/blob/aaaa467ff61f07d7dfa31627fb36851a37da6804/shibboleth-base/shibboleth-extensions/src/main/java/se/litsec/shibboleth/idp/authn/controller/AbstractExternalAuthenticationController.java#L191-L201 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_volume_snapshot_GET | public ArrayList<OvhSnapshot> project_serviceName_volume_snapshot_GET(String serviceName, String region) throws IOException {
String qPath = "/cloud/project/{serviceName}/volume/snapshot";
StringBuilder sb = path(qPath, serviceName);
query(sb, "region", region);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t12);
} | java | public ArrayList<OvhSnapshot> project_serviceName_volume_snapshot_GET(String serviceName, String region) throws IOException {
String qPath = "/cloud/project/{serviceName}/volume/snapshot";
StringBuilder sb = path(qPath, serviceName);
query(sb, "region", region);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t12);
} | [
"public",
"ArrayList",
"<",
"OvhSnapshot",
">",
"project_serviceName_volume_snapshot_GET",
"(",
"String",
"serviceName",
",",
"String",
"region",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/volume/snapshot\"",
";",
"StringBuild... | Get volume snapshots
REST: GET /cloud/project/{serviceName}/volume/snapshot
@param region [required] Snapshots region
@param serviceName [required] Project id | [
"Get",
"volume",
"snapshots"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1249-L1255 |
asterisk-java/asterisk-java | src/main/java/org/asteriskjava/manager/internal/ManagerConnectionImpl.java | ManagerConnectionImpl.sendAction | public ManagerResponse sendAction(ManagerAction action, long timeout)
throws IOException, TimeoutException, IllegalArgumentException, IllegalStateException
{
ResponseHandlerResult result = new ResponseHandlerResult();
SendActionCallback callbackHandler = new DefaultSendActionCallback(result);
sendAction(action, callbackHandler);
// definitely return null for the response of user events
if (action instanceof UserEventAction)
{
return null;
}
// only wait if we did not yet receive the response.
// Responses may be returned really fast.
if (result.getResponse() == null)
{
try
{
result.await(timeout);
}
catch (InterruptedException ex)
{
logger.warn("Interrupted while waiting for result");
Thread.currentThread().interrupt();
}
}
// still no response?
if (result.getResponse() == null)
{
throw new TimeoutException("Timeout waiting for response to " + action.getAction()
+ (action.getActionId() == null ? "" : " (actionId: " + action.getActionId() + ")"));
}
return result.getResponse();
} | java | public ManagerResponse sendAction(ManagerAction action, long timeout)
throws IOException, TimeoutException, IllegalArgumentException, IllegalStateException
{
ResponseHandlerResult result = new ResponseHandlerResult();
SendActionCallback callbackHandler = new DefaultSendActionCallback(result);
sendAction(action, callbackHandler);
// definitely return null for the response of user events
if (action instanceof UserEventAction)
{
return null;
}
// only wait if we did not yet receive the response.
// Responses may be returned really fast.
if (result.getResponse() == null)
{
try
{
result.await(timeout);
}
catch (InterruptedException ex)
{
logger.warn("Interrupted while waiting for result");
Thread.currentThread().interrupt();
}
}
// still no response?
if (result.getResponse() == null)
{
throw new TimeoutException("Timeout waiting for response to " + action.getAction()
+ (action.getActionId() == null ? "" : " (actionId: " + action.getActionId() + ")"));
}
return result.getResponse();
} | [
"public",
"ManagerResponse",
"sendAction",
"(",
"ManagerAction",
"action",
",",
"long",
"timeout",
")",
"throws",
"IOException",
",",
"TimeoutException",
",",
"IllegalArgumentException",
",",
"IllegalStateException",
"{",
"ResponseHandlerResult",
"result",
"=",
"new",
"... | Implements synchronous sending of "simple" actions.
@param timeout - in milliseconds | [
"Implements",
"synchronous",
"sending",
"of",
"simple",
"actions",
"."
] | train | https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/manager/internal/ManagerConnectionImpl.java#L817-L854 |
cdk/cdk | tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAromaticTypeMapping.java | MmffAromaticTypeMapping.getAromaticType | static String getAromaticType(Map<String, String> map, char suffix, String symb, boolean imidazolium, boolean anion) {
if (anion && symb.startsWith("N")) symb = "N5M";
if (map.containsKey(symb)) symb = map.get(symb);
if ((imidazolium || anion) && symb.charAt(symb.length() - 1) == suffix)
symb = symb.substring(0, symb.length() - 1);
return symb;
} | java | static String getAromaticType(Map<String, String> map, char suffix, String symb, boolean imidazolium, boolean anion) {
if (anion && symb.startsWith("N")) symb = "N5M";
if (map.containsKey(symb)) symb = map.get(symb);
if ((imidazolium || anion) && symb.charAt(symb.length() - 1) == suffix)
symb = symb.substring(0, symb.length() - 1);
return symb;
} | [
"static",
"String",
"getAromaticType",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"map",
",",
"char",
"suffix",
",",
"String",
"symb",
",",
"boolean",
"imidazolium",
",",
"boolean",
"anion",
")",
"{",
"if",
"(",
"anion",
"&&",
"symb",
".",
"startsWit... | Obtain the aromatic atom type for an atom in the alpha or beta position of a 5-member
aromatic ring. The method primarily uses an HashMap to lookup up the aromatic type. The two
maps are, {@link #alphaTypes} and {@link #betaTypes}. Depending on the position (alpha or
beta), one map is passed to the method. The exceptions to using the HashMap directly are as
follows: 1) if AN flag is raised and the symbolic type is a nitrogen, the type is 'N5M'. 2)
If the IM or AN flag is raised, the atom is 'C5' or 'N5 instead of 'C5A', 'C5B', 'N5A', or
'N5B'. This is because the hetroatom in these rings can resonate and so the atom is both
alpha and beta.
@param map mapping of alpha or beta types
@param suffix 'A' or 'B'
@param symb input symbolic type
@param imidazolium imidazolium flag (IM naming from MMFFAROM.PAR)
@param anion anion flag (AN naming from MMFFAROM.PAR)
@return the aromatic type | [
"Obtain",
"the",
"aromatic",
"atom",
"type",
"for",
"an",
"atom",
"in",
"the",
"alpha",
"or",
"beta",
"position",
"of",
"a",
"5",
"-",
"member",
"aromatic",
"ring",
".",
"The",
"method",
"primarily",
"uses",
"an",
"HashMap",
"to",
"lookup",
"up",
"the",
... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAromaticTypeMapping.java#L307-L313 |
CenturyLinkCloud/mdw | mdw-common/src/com/centurylink/mdw/model/event/InternalEvent.java | InternalEvent.createEventParameters | private EventParameters createEventParameters(Map<String,String> pParams){
EventParameters evParams = EventParameters.Factory.newInstance();
for (String name : pParams.keySet()) {
String val = pParams.get(name);
if(val == null){
continue;
}
Parameter evParam = evParams.addNewParameter();
evParam.setName(name);
evParam.setStringValue(val);
}
return evParams;
} | java | private EventParameters createEventParameters(Map<String,String> pParams){
EventParameters evParams = EventParameters.Factory.newInstance();
for (String name : pParams.keySet()) {
String val = pParams.get(name);
if(val == null){
continue;
}
Parameter evParam = evParams.addNewParameter();
evParam.setName(name);
evParam.setStringValue(val);
}
return evParams;
} | [
"private",
"EventParameters",
"createEventParameters",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"pParams",
")",
"{",
"EventParameters",
"evParams",
"=",
"EventParameters",
".",
"Factory",
".",
"newInstance",
"(",
")",
";",
"for",
"(",
"String",
"name",
"... | Method that creates the event params based on the passed in Map
@param pParams
@return EventParameters | [
"Method",
"that",
"creates",
"the",
"event",
"params",
"based",
"on",
"the",
"passed",
"in",
"Map"
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/model/event/InternalEvent.java#L104-L117 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/webui/WebUtils.java | WebUtils.convertByteArrayToStringWithoutEscape | public static String convertByteArrayToStringWithoutEscape(byte[] data, int offset, int length) {
StringBuilder sb = new StringBuilder(length);
for (int i = offset; i < length && i < data.length; i++) {
sb.append((char) data[i]);
}
return sb.toString();
} | java | public static String convertByteArrayToStringWithoutEscape(byte[] data, int offset, int length) {
StringBuilder sb = new StringBuilder(length);
for (int i = offset; i < length && i < data.length; i++) {
sb.append((char) data[i]);
}
return sb.toString();
} | [
"public",
"static",
"String",
"convertByteArrayToStringWithoutEscape",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"length",
")",
";",
"for",
"(",
"int",
"i",
... | Converts a byte array to string.
@param data byte array
@param offset offset
@param length number of bytes to encode
@return string representation of the encoded byte sub-array | [
"Converts",
"a",
"byte",
"array",
"to",
"string",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/webui/WebUtils.java#L37-L43 |
biojava/biojava | biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoHelper.java | SurvivalInfoHelper.isCategorical | private static boolean isCategorical(LinkedHashMap<String, Double> values) {
try {
for (String value : values.keySet()) {
Double.parseDouble(value);
}
return false;
} catch (Exception e) {
return true;
}
} | java | private static boolean isCategorical(LinkedHashMap<String, Double> values) {
try {
for (String value : values.keySet()) {
Double.parseDouble(value);
}
return false;
} catch (Exception e) {
return true;
}
} | [
"private",
"static",
"boolean",
"isCategorical",
"(",
"LinkedHashMap",
"<",
"String",
",",
"Double",
">",
"values",
")",
"{",
"try",
"{",
"for",
"(",
"String",
"value",
":",
"values",
".",
"keySet",
"(",
")",
")",
"{",
"Double",
".",
"parseDouble",
"(",
... | If any not numeric value then categorical
@param values
@return | [
"If",
"any",
"not",
"numeric",
"value",
"then",
"categorical"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoHelper.java#L70-L80 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/runtime/JCuda.java | JCuda.cudaGLGetDevices | public static int cudaGLGetDevices(int pCudaDeviceCount[], int pCudaDevices[], int cudaDeviceCount, int cudaGLDeviceList_deviceList)
{
return checkResult(cudaGLGetDevicesNative(pCudaDeviceCount, pCudaDevices, cudaDeviceCount, cudaGLDeviceList_deviceList));
} | java | public static int cudaGLGetDevices(int pCudaDeviceCount[], int pCudaDevices[], int cudaDeviceCount, int cudaGLDeviceList_deviceList)
{
return checkResult(cudaGLGetDevicesNative(pCudaDeviceCount, pCudaDevices, cudaDeviceCount, cudaGLDeviceList_deviceList));
} | [
"public",
"static",
"int",
"cudaGLGetDevices",
"(",
"int",
"pCudaDeviceCount",
"[",
"]",
",",
"int",
"pCudaDevices",
"[",
"]",
",",
"int",
"cudaDeviceCount",
",",
"int",
"cudaGLDeviceList_deviceList",
")",
"{",
"return",
"checkResult",
"(",
"cudaGLGetDevicesNative",... | Gets the CUDA devices associated with the current OpenGL context.
<pre>
cudaError_t cudaGLGetDevices (
unsigned int* pCudaDeviceCount,
int* pCudaDevices,
unsigned int cudaDeviceCount,
cudaGLDeviceList deviceList )
</pre>
<div>
<p>Gets the CUDA devices associated with
the current OpenGL context. Returns in <tt>*pCudaDeviceCount</tt>
the number of CUDA-compatible devices corresponding to the current
OpenGL context. Also returns in <tt>*pCudaDevices</tt> at most <tt>cudaDeviceCount</tt> of the CUDA-compatible devices corresponding to
the current OpenGL context. If any of the GPUs being used by the
current
OpenGL context are not CUDA capable then
the call will return cudaErrorNoDevice.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param pCudaDeviceCount Returned number of CUDA devices corresponding to the current OpenGL context
@param pCudaDevices Returned CUDA devices corresponding to the current OpenGL context
@param cudaDeviceCount The size of the output device array pCudaDevices
@param deviceList The set of devices to return. This set may be cudaGLDeviceListAll for all devices, cudaGLDeviceListCurrentFrame for the devices used to render the current frame (in SLI), or cudaGLDeviceListNextFrame for the devices used to render the next frame (in SLI).
@return cudaSuccess, cudaErrorNoDevice, cudaErrorUnknown
@see JCuda#cudaGraphicsUnregisterResource
@see JCuda#cudaGraphicsMapResources
@see JCuda#cudaGraphicsSubResourceGetMappedArray
@see JCuda#cudaGraphicsResourceGetMappedPointer | [
"Gets",
"the",
"CUDA",
"devices",
"associated",
"with",
"the",
"current",
"OpenGL",
"context",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L10476-L10479 |
albfernandez/itext2 | src/main/java/com/lowagie/text/html/HtmlWriter.java | HtmlWriter.writeCssProperty | protected void writeCssProperty(String prop, String value) throws IOException {
write(new StringBuffer(prop).append(": ").append(value).append("; ").toString());
} | java | protected void writeCssProperty(String prop, String value) throws IOException {
write(new StringBuffer(prop).append(": ").append(value).append("; ").toString());
} | [
"protected",
"void",
"writeCssProperty",
"(",
"String",
"prop",
",",
"String",
"value",
")",
"throws",
"IOException",
"{",
"write",
"(",
"new",
"StringBuffer",
"(",
"prop",
")",
".",
"append",
"(",
"\": \"",
")",
".",
"append",
"(",
"value",
")",
".",
"a... | Writes out a CSS property.
@param prop a CSS property
@param value the value of the CSS property
@throws IOException | [
"Writes",
"out",
"a",
"CSS",
"property",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/html/HtmlWriter.java#L1127-L1129 |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java | Graph.fromTupleDataSet | public static <K, EV> Graph<K, NullValue, EV> fromTupleDataSet(DataSet<Tuple3<K, K, EV>> edges,
ExecutionEnvironment context) {
DataSet<Edge<K, EV>> edgeDataSet = edges
.map(new Tuple3ToEdgeMap<>())
.name("Type conversion");
return fromDataSet(edgeDataSet, context);
} | java | public static <K, EV> Graph<K, NullValue, EV> fromTupleDataSet(DataSet<Tuple3<K, K, EV>> edges,
ExecutionEnvironment context) {
DataSet<Edge<K, EV>> edgeDataSet = edges
.map(new Tuple3ToEdgeMap<>())
.name("Type conversion");
return fromDataSet(edgeDataSet, context);
} | [
"public",
"static",
"<",
"K",
",",
"EV",
">",
"Graph",
"<",
"K",
",",
"NullValue",
",",
"EV",
">",
"fromTupleDataSet",
"(",
"DataSet",
"<",
"Tuple3",
"<",
"K",
",",
"K",
",",
"EV",
">",
">",
"edges",
",",
"ExecutionEnvironment",
"context",
")",
"{",
... | Creates a graph from a DataSet of Tuple3 objects for edges.
<p>The first field of the Tuple3 object will become the source ID,
the second field will become the target ID, and the third field will become
the edge value.
<p>Vertices are created automatically and their values are set to NullValue.
@param edges a DataSet of Tuple3 representing the edges.
@param context the flink execution environment.
@return the newly created graph. | [
"Creates",
"a",
"graph",
"from",
"a",
"DataSet",
"of",
"Tuple3",
"objects",
"for",
"edges",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L295-L303 |
OpenVidu/openvidu | openvidu-java-client/src/main/java/io/openvidu/java/client/OpenVidu.java | OpenVidu.startRecording | public Recording startRecording(String sessionId, String name)
throws OpenViduJavaClientException, OpenViduHttpException {
if (name == null) {
name = "";
}
return this.startRecording(sessionId, new RecordingProperties.Builder().name(name).build());
} | java | public Recording startRecording(String sessionId, String name)
throws OpenViduJavaClientException, OpenViduHttpException {
if (name == null) {
name = "";
}
return this.startRecording(sessionId, new RecordingProperties.Builder().name(name).build());
} | [
"public",
"Recording",
"startRecording",
"(",
"String",
"sessionId",
",",
"String",
"name",
")",
"throws",
"OpenViduJavaClientException",
",",
"OpenViduHttpException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"name",
"=",
"\"\"",
";",
"}",
"return",
"th... | Starts the recording of a {@link io.openvidu.java.client.Session}
@param sessionId The sessionId of the session you want to start recording
@param name The name you want to give to the video file. You can access
this same value in your clients on recording events
(recordingStarted, recordingStopped). <strong>WARNING: this
parameter follows an overwriting policy.</strong> If you
name two recordings the same, the newest MP4 file will
overwrite the oldest one
@return The started recording. If this method successfully returns the
Recording object it means that the recording can be stopped with
guarantees
@throws OpenViduJavaClientException
@throws OpenViduHttpException Value returned from
{@link io.openvidu.java.client.OpenViduHttpException#getStatus()}
<ul>
<li><code>404</code>: no session exists
for the passed <i>sessionId</i></li>
<li><code>406</code>: the session has no
connected participants</li>
<li><code>422</code>: "resolution"
parameter exceeds acceptable values (for
both width and height, min 100px and max
1999px) or trying to start a recording
with both "hasAudio" and "hasVideo" to
false</li>
<li><code>409</code>: the session is not
configured for using
{@link io.openvidu.java.client.MediaMode#ROUTED}
or it is already being recorded</li>
<li><code>501</code>: OpenVidu Server
recording module is disabled
(<i>openvidu.recording</i> property set
to <i>false</i>)</li>
</ul> | [
"Starts",
"the",
"recording",
"of",
"a",
"{",
"@link",
"io",
".",
"openvidu",
".",
"java",
".",
"client",
".",
"Session",
"}"
] | train | https://github.com/OpenVidu/openvidu/blob/89db47dd37949ceab29e5228371a8fcab04d8d55/openvidu-java-client/src/main/java/io/openvidu/java/client/OpenVidu.java#L288-L294 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java | CPInstancePersistenceImpl.removeByG_ST | @Override
public void removeByG_ST(long groupId, int status) {
for (CPInstance cpInstance : findByG_ST(groupId, status,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpInstance);
}
} | java | @Override
public void removeByG_ST(long groupId, int status) {
for (CPInstance cpInstance : findByG_ST(groupId, status,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpInstance);
}
} | [
"@",
"Override",
"public",
"void",
"removeByG_ST",
"(",
"long",
"groupId",
",",
"int",
"status",
")",
"{",
"for",
"(",
"CPInstance",
"cpInstance",
":",
"findByG_ST",
"(",
"groupId",
",",
"status",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"A... | Removes all the cp instances where groupId = ? and status = ? from the database.
@param groupId the group ID
@param status the status | [
"Removes",
"all",
"the",
"cp",
"instances",
"where",
"groupId",
"=",
"?",
";",
"and",
"status",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L3477-L3483 |
facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java | PlatformBitmapFactory.createScaledBitmap | public CloseableReference<Bitmap> createScaledBitmap(
Bitmap source,
int destinationWidth,
int destinationHeight,
boolean filter) {
return createScaledBitmap(source, destinationWidth, destinationHeight, filter, null);
} | java | public CloseableReference<Bitmap> createScaledBitmap(
Bitmap source,
int destinationWidth,
int destinationHeight,
boolean filter) {
return createScaledBitmap(source, destinationWidth, destinationHeight, filter, null);
} | [
"public",
"CloseableReference",
"<",
"Bitmap",
">",
"createScaledBitmap",
"(",
"Bitmap",
"source",
",",
"int",
"destinationWidth",
",",
"int",
"destinationHeight",
",",
"boolean",
"filter",
")",
"{",
"return",
"createScaledBitmap",
"(",
"source",
",",
"destinationWi... | Creates a bitmap from the specified source scaled to have the height and width
as specified. It is initialized with the same density as the original bitmap.
@param source The bitmap we are subsetting
@param destinationWidth The number of pixels in each row of the final bitmap
@param destinationHeight The number of rows in the final bitmap
@return a reference to the bitmap
@throws IllegalArgumentException if the destinationWidth is <= 0,
or destinationHeight is <= 0
@throws TooManyBitmapsException if the pool is full
@throws java.lang.OutOfMemoryError if the Bitmap cannot be allocated | [
"Creates",
"a",
"bitmap",
"from",
"the",
"specified",
"source",
"scaled",
"to",
"have",
"the",
"height",
"and",
"width",
"as",
"specified",
".",
"It",
"is",
"initialized",
"with",
"the",
"same",
"density",
"as",
"the",
"original",
"bitmap",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java#L233-L239 |
apache/flink | flink-core/src/main/java/org/apache/flink/types/StringValue.java | StringValue.startsWith | public boolean startsWith(CharSequence prefix, int startIndex) {
final char[] thisChars = this.value;
final int pLen = this.len;
final int sLen = prefix.length();
if ((startIndex < 0) || (startIndex > pLen - sLen)) {
return false;
}
int sPos = 0;
while (sPos < sLen) {
if (thisChars[startIndex++] != prefix.charAt(sPos++)) {
return false;
}
}
return true;
} | java | public boolean startsWith(CharSequence prefix, int startIndex) {
final char[] thisChars = this.value;
final int pLen = this.len;
final int sLen = prefix.length();
if ((startIndex < 0) || (startIndex > pLen - sLen)) {
return false;
}
int sPos = 0;
while (sPos < sLen) {
if (thisChars[startIndex++] != prefix.charAt(sPos++)) {
return false;
}
}
return true;
} | [
"public",
"boolean",
"startsWith",
"(",
"CharSequence",
"prefix",
",",
"int",
"startIndex",
")",
"{",
"final",
"char",
"[",
"]",
"thisChars",
"=",
"this",
".",
"value",
";",
"final",
"int",
"pLen",
"=",
"this",
".",
"len",
";",
"final",
"int",
"sLen",
... | Checks whether the substring, starting at the specified index, starts with the given prefix string.
@param prefix The prefix character sequence.
@param startIndex The position to start checking for the prefix.
@return True, if this StringValue substring, starting at position <code>startIndex</code> has <code>prefix</code>
as its prefix. | [
"Checks",
"whether",
"the",
"substring",
"starting",
"at",
"the",
"specified",
"index",
"starts",
"with",
"the",
"given",
"prefix",
"string",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/StringValue.java#L383-L399 |
google/error-prone | check_api/src/main/java/com/google/errorprone/scanner/Scanner.java | Scanner.updateSuppressions | private SuppressionInfo updateSuppressions(Tree tree, VisitorState state) {
SuppressionInfo prevSuppressionInfo = currentSuppressions;
if (tree instanceof CompilationUnitTree) {
currentSuppressions =
currentSuppressions.forCompilationUnit((CompilationUnitTree) tree, state);
} else {
Symbol sym = ASTHelpers.getDeclaredSymbol(tree);
if (sym != null) {
currentSuppressions =
currentSuppressions.withExtendedSuppressions(
sym, state, getCustomSuppressionAnnotations());
}
}
return prevSuppressionInfo;
} | java | private SuppressionInfo updateSuppressions(Tree tree, VisitorState state) {
SuppressionInfo prevSuppressionInfo = currentSuppressions;
if (tree instanceof CompilationUnitTree) {
currentSuppressions =
currentSuppressions.forCompilationUnit((CompilationUnitTree) tree, state);
} else {
Symbol sym = ASTHelpers.getDeclaredSymbol(tree);
if (sym != null) {
currentSuppressions =
currentSuppressions.withExtendedSuppressions(
sym, state, getCustomSuppressionAnnotations());
}
}
return prevSuppressionInfo;
} | [
"private",
"SuppressionInfo",
"updateSuppressions",
"(",
"Tree",
"tree",
",",
"VisitorState",
"state",
")",
"{",
"SuppressionInfo",
"prevSuppressionInfo",
"=",
"currentSuppressions",
";",
"if",
"(",
"tree",
"instanceof",
"CompilationUnitTree",
")",
"{",
"currentSuppress... | Updates current suppression state with information for the given {@code tree}. Returns the
previous suppression state so that it can be restored when going up the tree. | [
"Updates",
"current",
"suppression",
"state",
"with",
"information",
"for",
"the",
"given",
"{"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/scanner/Scanner.java#L82-L96 |
liferay/com-liferay-commerce | commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java | CommerceNotificationTemplatePersistenceImpl.filterCountByG_T_E | @Override
public int filterCountByG_T_E(long groupId, String type, boolean enabled) {
if (!InlineSQLHelperUtil.isEnabled(groupId)) {
return countByG_T_E(groupId, type, enabled);
}
StringBundler query = new StringBundler(4);
query.append(_FILTER_SQL_COUNT_COMMERCENOTIFICATIONTEMPLATE_WHERE);
query.append(_FINDER_COLUMN_G_T_E_GROUPID_2);
boolean bindType = false;
if (type == null) {
query.append(_FINDER_COLUMN_G_T_E_TYPE_1_SQL);
}
else if (type.equals("")) {
query.append(_FINDER_COLUMN_G_T_E_TYPE_3_SQL);
}
else {
bindType = true;
query.append(_FINDER_COLUMN_G_T_E_TYPE_2_SQL);
}
query.append(_FINDER_COLUMN_G_T_E_ENABLED_2);
String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
CommerceNotificationTemplate.class.getName(),
_FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
Session session = null;
try {
session = openSession();
SQLQuery q = session.createSynchronizedSQLQuery(sql);
q.addScalar(COUNT_COLUMN_NAME,
com.liferay.portal.kernel.dao.orm.Type.LONG);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(groupId);
if (bindType) {
qPos.add(type);
}
qPos.add(enabled);
Long count = (Long)q.uniqueResult();
return count.intValue();
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} | java | @Override
public int filterCountByG_T_E(long groupId, String type, boolean enabled) {
if (!InlineSQLHelperUtil.isEnabled(groupId)) {
return countByG_T_E(groupId, type, enabled);
}
StringBundler query = new StringBundler(4);
query.append(_FILTER_SQL_COUNT_COMMERCENOTIFICATIONTEMPLATE_WHERE);
query.append(_FINDER_COLUMN_G_T_E_GROUPID_2);
boolean bindType = false;
if (type == null) {
query.append(_FINDER_COLUMN_G_T_E_TYPE_1_SQL);
}
else if (type.equals("")) {
query.append(_FINDER_COLUMN_G_T_E_TYPE_3_SQL);
}
else {
bindType = true;
query.append(_FINDER_COLUMN_G_T_E_TYPE_2_SQL);
}
query.append(_FINDER_COLUMN_G_T_E_ENABLED_2);
String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
CommerceNotificationTemplate.class.getName(),
_FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
Session session = null;
try {
session = openSession();
SQLQuery q = session.createSynchronizedSQLQuery(sql);
q.addScalar(COUNT_COLUMN_NAME,
com.liferay.portal.kernel.dao.orm.Type.LONG);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(groupId);
if (bindType) {
qPos.add(type);
}
qPos.add(enabled);
Long count = (Long)q.uniqueResult();
return count.intValue();
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} | [
"@",
"Override",
"public",
"int",
"filterCountByG_T_E",
"(",
"long",
"groupId",
",",
"String",
"type",
",",
"boolean",
"enabled",
")",
"{",
"if",
"(",
"!",
"InlineSQLHelperUtil",
".",
"isEnabled",
"(",
"groupId",
")",
")",
"{",
"return",
"countByG_T_E",
"(",... | Returns the number of commerce notification templates that the user has permission to view where groupId = ? and type = ? and enabled = ?.
@param groupId the group ID
@param type the type
@param enabled the enabled
@return the number of matching commerce notification templates that the user has permission to view | [
"Returns",
"the",
"number",
"of",
"commerce",
"notification",
"templates",
"that",
"the",
"user",
"has",
"permission",
"to",
"view",
"where",
"groupId",
"=",
"?",
";",
"and",
"type",
"=",
"?",
";",
"and",
"enabled",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java#L4371-L4433 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java | ValueEnforcer.isBetweenInclusive | public static float isBetweenInclusive (final float fValue,
final String sName,
final float fLowerBoundInclusive,
final float fUpperBoundInclusive)
{
if (isEnabled ())
return isBetweenInclusive (fValue, () -> sName, fLowerBoundInclusive, fUpperBoundInclusive);
return fValue;
} | java | public static float isBetweenInclusive (final float fValue,
final String sName,
final float fLowerBoundInclusive,
final float fUpperBoundInclusive)
{
if (isEnabled ())
return isBetweenInclusive (fValue, () -> sName, fLowerBoundInclusive, fUpperBoundInclusive);
return fValue;
} | [
"public",
"static",
"float",
"isBetweenInclusive",
"(",
"final",
"float",
"fValue",
",",
"final",
"String",
"sName",
",",
"final",
"float",
"fLowerBoundInclusive",
",",
"final",
"float",
"fUpperBoundInclusive",
")",
"{",
"if",
"(",
"isEnabled",
"(",
")",
")",
... | Check if
<code>nValue ≥ nLowerBoundInclusive && nValue ≤ nUpperBoundInclusive</code>
@param fValue
Value
@param sName
Name
@param fLowerBoundInclusive
Lower bound
@param fUpperBoundInclusive
Upper bound
@return The value | [
"Check",
"if",
"<code",
">",
"nValue",
"&ge",
";",
"nLowerBoundInclusive",
"&",
";",
"&",
";",
"nValue",
"&le",
";",
"nUpperBoundInclusive<",
"/",
"code",
">"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L2501-L2509 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/cell/CellUtil.java | CellUtil.isMergedRegion | public static boolean isMergedRegion(Sheet sheet, int row, int column) {
final int sheetMergeCount = sheet.getNumMergedRegions();
CellRangeAddress ca;
for (int i = 0; i < sheetMergeCount; i++) {
ca = sheet.getMergedRegion(i);
if (row >= ca.getFirstRow() && row <= ca.getLastRow() && column >= ca.getFirstColumn() && column <= ca.getLastColumn()) {
return true;
}
}
return false;
} | java | public static boolean isMergedRegion(Sheet sheet, int row, int column) {
final int sheetMergeCount = sheet.getNumMergedRegions();
CellRangeAddress ca;
for (int i = 0; i < sheetMergeCount; i++) {
ca = sheet.getMergedRegion(i);
if (row >= ca.getFirstRow() && row <= ca.getLastRow() && column >= ca.getFirstColumn() && column <= ca.getLastColumn()) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isMergedRegion",
"(",
"Sheet",
"sheet",
",",
"int",
"row",
",",
"int",
"column",
")",
"{",
"final",
"int",
"sheetMergeCount",
"=",
"sheet",
".",
"getNumMergedRegions",
"(",
")",
";",
"CellRangeAddress",
"ca",
";",
"for",
"(",
... | 判断指定的单元格是否是合并单元格
@param sheet {@link Sheet}
@param row 行号
@param column 列号
@return 是否是合并单元格 | [
"判断指定的单元格是否是合并单元格"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/cell/CellUtil.java#L181-L191 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/expressions/Expressions.java | Expressions.isLessThanOrEqual | public static StringIsLessThanOrEqual isLessThanOrEqual(StringExpression left, Object constant) {
if (!(constant instanceof String))
throw new IllegalArgumentException("constant is not a String");
return new StringIsLessThanOrEqual(left, constant((String)constant));
} | java | public static StringIsLessThanOrEqual isLessThanOrEqual(StringExpression left, Object constant) {
if (!(constant instanceof String))
throw new IllegalArgumentException("constant is not a String");
return new StringIsLessThanOrEqual(left, constant((String)constant));
} | [
"public",
"static",
"StringIsLessThanOrEqual",
"isLessThanOrEqual",
"(",
"StringExpression",
"left",
",",
"Object",
"constant",
")",
"{",
"if",
"(",
"!",
"(",
"constant",
"instanceof",
"String",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"constant ... | Creates an StringIsLessThanOrEqual expression from the given expression and constant.
@param left The left expression.
@param constant The constant to compare to (must be a String).
@throws IllegalArgumentException If the constant is not a String
@return A new is less than binary expression. | [
"Creates",
"an",
"StringIsLessThanOrEqual",
"expression",
"from",
"the",
"given",
"expression",
"and",
"constant",
"."
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/expressions/Expressions.java#L445-L451 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java | RTFEmbeddedObject.skipEndOfLine | private static int skipEndOfLine(String text, int offset)
{
char c;
boolean finished = false;
while (finished == false)
{
c = text.charAt(offset);
switch (c)
{
case ' ': // found that OBJDATA could be followed by a space the EOL
case '\r':
case '\n':
{
++offset;
break;
}
case '}':
{
offset = -1;
finished = true;
break;
}
default:
{
finished = true;
break;
}
}
}
return (offset);
} | java | private static int skipEndOfLine(String text, int offset)
{
char c;
boolean finished = false;
while (finished == false)
{
c = text.charAt(offset);
switch (c)
{
case ' ': // found that OBJDATA could be followed by a space the EOL
case '\r':
case '\n':
{
++offset;
break;
}
case '}':
{
offset = -1;
finished = true;
break;
}
default:
{
finished = true;
break;
}
}
}
return (offset);
} | [
"private",
"static",
"int",
"skipEndOfLine",
"(",
"String",
"text",
",",
"int",
"offset",
")",
"{",
"char",
"c",
";",
"boolean",
"finished",
"=",
"false",
";",
"while",
"(",
"finished",
"==",
"false",
")",
"{",
"c",
"=",
"text",
".",
"charAt",
"(",
"... | This method skips the end-of-line markers in the RTF document.
It also indicates if the end of the embedded object has been reached.
@param text RTF document test
@param offset offset into the RTF document
@return new offset | [
"This",
"method",
"skips",
"the",
"end",
"-",
"of",
"-",
"line",
"markers",
"in",
"the",
"RTF",
"document",
".",
"It",
"also",
"indicates",
"if",
"the",
"end",
"of",
"the",
"embedded",
"object",
"has",
"been",
"reached",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L285-L319 |
OpenBEL/openbel-framework | org.openbel.framework.core/src/main/java/org/openbel/framework/core/protonetwork/BinaryProtoNetworkExternalizer.java | BinaryProtoNetworkExternalizer.writeProtoNetwork | @Override
public ProtoNetworkDescriptor writeProtoNetwork(ProtoNetwork protoNetwork,
String protoNetworkRootPath) throws ProtoNetworkError {
final String filename = PROTO_NETWORK_FILENAME;
final File file = new File(asPath(protoNetworkRootPath, filename));
ObjectOutputStream oos = null;
try {
oos = new ObjectOutputStream(new FileOutputStream(file));
protoNetwork.writeExternal(oos);
return new BinaryProtoNetworkDescriptor(file);
} catch (IOException e) {
final String name = file.getAbsolutePath();
final String msg =
"Cannot create temporary binary file for proto-network";
throw new ProtoNetworkError(name, msg, e);
} finally {
// clean up IO resources
IOUtils.closeQuietly(oos);
}
} | java | @Override
public ProtoNetworkDescriptor writeProtoNetwork(ProtoNetwork protoNetwork,
String protoNetworkRootPath) throws ProtoNetworkError {
final String filename = PROTO_NETWORK_FILENAME;
final File file = new File(asPath(protoNetworkRootPath, filename));
ObjectOutputStream oos = null;
try {
oos = new ObjectOutputStream(new FileOutputStream(file));
protoNetwork.writeExternal(oos);
return new BinaryProtoNetworkDescriptor(file);
} catch (IOException e) {
final String name = file.getAbsolutePath();
final String msg =
"Cannot create temporary binary file for proto-network";
throw new ProtoNetworkError(name, msg, e);
} finally {
// clean up IO resources
IOUtils.closeQuietly(oos);
}
} | [
"@",
"Override",
"public",
"ProtoNetworkDescriptor",
"writeProtoNetwork",
"(",
"ProtoNetwork",
"protoNetwork",
",",
"String",
"protoNetworkRootPath",
")",
"throws",
"ProtoNetworkError",
"{",
"final",
"String",
"filename",
"=",
"PROTO_NETWORK_FILENAME",
";",
"final",
"File... | Writes a binary-based proto network and produces a descriptor including
the binary file.
@param protoNetwork {@link ProtoNetwork}, the proto network, which cannot
be null
@param protoNetworkRootPath {@link String}, the root path where proto
network files should be created
@return {@link ProtoNetworkDescriptor}, the proto network descriptor
@throws ProtoNetworkError, if there was an error writing the
{@link ProtoNetwork} | [
"Writes",
"a",
"binary",
"-",
"based",
"proto",
"network",
"and",
"produces",
"a",
"descriptor",
"including",
"the",
"binary",
"file",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/protonetwork/BinaryProtoNetworkExternalizer.java#L126-L146 |
UrielCh/ovh-java-sdk | ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java | ApiOvhPackxdsl.packName_subServices_domain_keepServiceTerms_GET | public OvhUnpackTerms packName_subServices_domain_keepServiceTerms_GET(String packName, String domain) throws IOException {
String qPath = "/pack/xdsl/{packName}/subServices/{domain}/keepServiceTerms";
StringBuilder sb = path(qPath, packName, domain);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhUnpackTerms.class);
} | java | public OvhUnpackTerms packName_subServices_domain_keepServiceTerms_GET(String packName, String domain) throws IOException {
String qPath = "/pack/xdsl/{packName}/subServices/{domain}/keepServiceTerms";
StringBuilder sb = path(qPath, packName, domain);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhUnpackTerms.class);
} | [
"public",
"OvhUnpackTerms",
"packName_subServices_domain_keepServiceTerms_GET",
"(",
"String",
"packName",
",",
"String",
"domain",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/pack/xdsl/{packName}/subServices/{domain}/keepServiceTerms\"",
";",
"StringBuilder",
... | Give the condition to unpack service from pack
REST: GET /pack/xdsl/{packName}/subServices/{domain}/keepServiceTerms
@param packName [required] The internal name of your pack
@param domain [required] | [
"Give",
"the",
"condition",
"to",
"unpack",
"service",
"from",
"pack"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L716-L721 |
alkacon/opencms-core | src/org/opencms/ade/containerpage/CmsElementUtil.java | CmsElementUtil.getBaseElementData | private CmsContainerElementData getBaseElementData(CmsResource page, CmsContainerElementBean element)
throws CmsException {
CmsResourceUtil resUtil = new CmsResourceUtil(m_cms, element.getResource());
CmsContainerElementData elementData = new CmsContainerElementData();
setElementInfo(element, elementData);
elementData.setLoadTime(System.currentTimeMillis());
elementData.setLastModifiedDate(element.getResource().getDateLastModified());
elementData.setLastModifiedByUser(m_cms.readUser(element.getResource().getUserLastModified()).getName());
elementData.setNavText(resUtil.getNavText());
Map<String, CmsXmlContentProperty> settingConfig = CmsXmlContentPropertyHelper.getPropertyInfo(
m_cms,
page,
element.getResource());
elementData.setSettings(
CmsXmlContentPropertyHelper.convertPropertiesToClientFormat(
m_cms,
element.getIndividualSettings(),
settingConfig));
return elementData;
} | java | private CmsContainerElementData getBaseElementData(CmsResource page, CmsContainerElementBean element)
throws CmsException {
CmsResourceUtil resUtil = new CmsResourceUtil(m_cms, element.getResource());
CmsContainerElementData elementData = new CmsContainerElementData();
setElementInfo(element, elementData);
elementData.setLoadTime(System.currentTimeMillis());
elementData.setLastModifiedDate(element.getResource().getDateLastModified());
elementData.setLastModifiedByUser(m_cms.readUser(element.getResource().getUserLastModified()).getName());
elementData.setNavText(resUtil.getNavText());
Map<String, CmsXmlContentProperty> settingConfig = CmsXmlContentPropertyHelper.getPropertyInfo(
m_cms,
page,
element.getResource());
elementData.setSettings(
CmsXmlContentPropertyHelper.convertPropertiesToClientFormat(
m_cms,
element.getIndividualSettings(),
settingConfig));
return elementData;
} | [
"private",
"CmsContainerElementData",
"getBaseElementData",
"(",
"CmsResource",
"page",
",",
"CmsContainerElementBean",
"element",
")",
"throws",
"CmsException",
"{",
"CmsResourceUtil",
"resUtil",
"=",
"new",
"CmsResourceUtil",
"(",
"m_cms",
",",
"element",
".",
"getRes... | Returns the base element data for the given element bean, without content or formatter info.<p>
@param page the current container page
@param element the resource
@return base element data
@throws CmsException in case reading the data fails | [
"Returns",
"the",
"base",
"element",
"data",
"for",
"the",
"given",
"element",
"bean",
"without",
"content",
"or",
"formatter",
"info",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/CmsElementUtil.java#L926-L946 |
pardom-zz/Ollie | core/src/main/java/ollie/OllieProvider.java | OllieProvider.createUri | public static Uri createUri(Class<? extends Model> type, Long id) {
final StringBuilder uri = new StringBuilder();
uri.append("content://");
uri.append(sAuthority);
uri.append("/");
uri.append(Ollie.getTableName(type).toLowerCase());
if (id != null) {
uri.append("/");
uri.append(id.toString());
}
return Uri.parse(uri.toString());
} | java | public static Uri createUri(Class<? extends Model> type, Long id) {
final StringBuilder uri = new StringBuilder();
uri.append("content://");
uri.append(sAuthority);
uri.append("/");
uri.append(Ollie.getTableName(type).toLowerCase());
if (id != null) {
uri.append("/");
uri.append(id.toString());
}
return Uri.parse(uri.toString());
} | [
"public",
"static",
"Uri",
"createUri",
"(",
"Class",
"<",
"?",
"extends",
"Model",
">",
"type",
",",
"Long",
"id",
")",
"{",
"final",
"StringBuilder",
"uri",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"uri",
".",
"append",
"(",
"\"content://\"",
")",
... | Create a Uri for a model row.
@param type The model type.
@param id The row Id.
@return The Uri for the model row. | [
"Create",
"a",
"Uri",
"for",
"a",
"model",
"row",
"."
] | train | https://github.com/pardom-zz/Ollie/blob/9d20468ca78064002187f2c5db3be06d1d29e310/core/src/main/java/ollie/OllieProvider.java#L77-L90 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/OsgiPropertyUtils.java | OsgiPropertyUtils.getLong | public static long getLong(String propertyName, long defaultValue) {
String tmpObj = get(propertyName);
if (tmpObj != null) {
try {
return Long.parseLong(tmpObj);
} catch (NumberFormatException e) {
}
}
return defaultValue;
} | java | public static long getLong(String propertyName, long defaultValue) {
String tmpObj = get(propertyName);
if (tmpObj != null) {
try {
return Long.parseLong(tmpObj);
} catch (NumberFormatException e) {
}
}
return defaultValue;
} | [
"public",
"static",
"long",
"getLong",
"(",
"String",
"propertyName",
",",
"long",
"defaultValue",
")",
"{",
"String",
"tmpObj",
"=",
"get",
"(",
"propertyName",
")",
";",
"if",
"(",
"tmpObj",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"Long",
".",
... | Retrieve the value of the specified property from framework/system properties.
Value is converted and returned as an long.
@param propertyName Name of property
@param defaultValue Default value to return if property is not set
@return Property or default value as an long | [
"Retrieve",
"the",
"value",
"of",
"the",
"specified",
"property",
"from",
"framework",
"/",
"system",
"properties",
".",
"Value",
"is",
"converted",
"and",
"returned",
"as",
"an",
"long",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/OsgiPropertyUtils.java#L117-L127 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalCreator.java | JournalCreator.setDatastreamVersionable | public Date setDatastreamVersionable(Context context,
String pid,
String dsID,
boolean versionable,
String logMessage)
throws ServerException {
try {
CreatorJournalEntry cje =
new CreatorJournalEntry(METHOD_SET_DATASTREAM_VERSIONABLE,
context);
cje.addArgument(ARGUMENT_NAME_PID, pid);
cje.addArgument(ARGUMENT_NAME_DS_ID, dsID);
cje.addArgument(ARGUMENT_NAME_VERSIONABLE, versionable);
cje.addArgument(ARGUMENT_NAME_LOG_MESSAGE, logMessage);
return (Date) cje.invokeAndClose(delegate, writer);
} catch (JournalException e) {
throw new GeneralException("Problem creating the Journal", e);
}
} | java | public Date setDatastreamVersionable(Context context,
String pid,
String dsID,
boolean versionable,
String logMessage)
throws ServerException {
try {
CreatorJournalEntry cje =
new CreatorJournalEntry(METHOD_SET_DATASTREAM_VERSIONABLE,
context);
cje.addArgument(ARGUMENT_NAME_PID, pid);
cje.addArgument(ARGUMENT_NAME_DS_ID, dsID);
cje.addArgument(ARGUMENT_NAME_VERSIONABLE, versionable);
cje.addArgument(ARGUMENT_NAME_LOG_MESSAGE, logMessage);
return (Date) cje.invokeAndClose(delegate, writer);
} catch (JournalException e) {
throw new GeneralException("Problem creating the Journal", e);
}
} | [
"public",
"Date",
"setDatastreamVersionable",
"(",
"Context",
"context",
",",
"String",
"pid",
",",
"String",
"dsID",
",",
"boolean",
"versionable",
",",
"String",
"logMessage",
")",
"throws",
"ServerException",
"{",
"try",
"{",
"CreatorJournalEntry",
"cje",
"=",
... | Create a journal entry, add the arguments, and invoke the method. | [
"Create",
"a",
"journal",
"entry",
"add",
"the",
"arguments",
"and",
"invoke",
"the",
"method",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalCreator.java#L299-L317 |
redkale/redkale | src/org/redkale/source/ColumnValue.java | ColumnValue.inc | public static ColumnValue inc(String column, Serializable value) {
return new ColumnValue(column, INC, value);
} | java | public static ColumnValue inc(String column, Serializable value) {
return new ColumnValue(column, INC, value);
} | [
"public",
"static",
"ColumnValue",
"inc",
"(",
"String",
"column",
",",
"Serializable",
"value",
")",
"{",
"return",
"new",
"ColumnValue",
"(",
"column",
",",
"INC",
",",
"value",
")",
";",
"}"
] | 返回 {column} = {column} + {value} 操作
@param column 字段名
@param value 字段值
@return ColumnValue | [
"返回",
"{",
"column",
"}",
"=",
"{",
"column",
"}",
"+",
"{",
"value",
"}",
"操作"
] | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/source/ColumnValue.java#L73-L75 |
aws/aws-sdk-java | aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/model/transform/AckEventUnmarshaller.java | AckEventUnmarshaller.getIntegerField | private Integer getIntegerField(JsonNode json, String fieldName) {
if (!json.has(fieldName)) {
return null;
}
return json.get(fieldName).intValue();
} | java | private Integer getIntegerField(JsonNode json, String fieldName) {
if (!json.has(fieldName)) {
return null;
}
return json.get(fieldName).intValue();
} | [
"private",
"Integer",
"getIntegerField",
"(",
"JsonNode",
"json",
",",
"String",
"fieldName",
")",
"{",
"if",
"(",
"!",
"json",
".",
"has",
"(",
"fieldName",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"json",
".",
"get",
"(",
"fieldName",
")"... | Get an Integer field from the JSON.
@param json JSON document.
@param fieldName Field name to get.
@return Integer value of field or null if not present. | [
"Get",
"an",
"Integer",
"field",
"from",
"the",
"JSON",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/model/transform/AckEventUnmarshaller.java#L85-L90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.