repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
zandero/mail | src/main/java/com/zandero/mail/MailMessage.java | MailMessage.defaultFrom | public MailMessage defaultFrom(String email, String name) {
"""
Sets from email address only if not already set
@param email target email address
@param name target name associated with email address
@return mail message
"""
if (StringUtils.isNullOrEmptyTrimmed(fromEmail)) {
from(email, name);
}
if (!StringUtils.isNullOrEmptyTrimmed(email) &&
StringUtils.equals(fromEmail, email.trim(), true) &&
StringUtils.isNullOrEmptyTrimmed(fromName)) {
from(email, name);
}
return this;
} | java | public MailMessage defaultFrom(String email, String name) {
if (StringUtils.isNullOrEmptyTrimmed(fromEmail)) {
from(email, name);
}
if (!StringUtils.isNullOrEmptyTrimmed(email) &&
StringUtils.equals(fromEmail, email.trim(), true) &&
StringUtils.isNullOrEmptyTrimmed(fromName)) {
from(email, name);
}
return this;
} | [
"public",
"MailMessage",
"defaultFrom",
"(",
"String",
"email",
",",
"String",
"name",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNullOrEmptyTrimmed",
"(",
"fromEmail",
")",
")",
"{",
"from",
"(",
"email",
",",
"name",
")",
";",
"}",
"if",
"(",
"!",
"... | Sets from email address only if not already set
@param email target email address
@param name target name associated with email address
@return mail message | [
"Sets",
"from",
"email",
"address",
"only",
"if",
"not",
"already",
"set"
] | train | https://github.com/zandero/mail/blob/2e30fe99e1dde755113bd4652b01033c0583f8a6/src/main/java/com/zandero/mail/MailMessage.java#L242-L255 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java | VirtualMachinesInner.convertToManagedDisks | public OperationStatusResponseInner convertToManagedDisks(String resourceGroupName, String vmName) {
"""
Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation.
@param resourceGroupName The name of the resource group.
@param vmName The name of the virtual machine.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatusResponseInner object if successful.
"""
return convertToManagedDisksWithServiceResponseAsync(resourceGroupName, vmName).toBlocking().last().body();
} | java | public OperationStatusResponseInner convertToManagedDisks(String resourceGroupName, String vmName) {
return convertToManagedDisksWithServiceResponseAsync(resourceGroupName, vmName).toBlocking().last().body();
} | [
"public",
"OperationStatusResponseInner",
"convertToManagedDisks",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmName",
")",
"{",
"return",
"convertToManagedDisksWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmName",
")",
".",
"toBlocking",
"(",
")",
... | Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation.
@param resourceGroupName The name of the resource group.
@param vmName The name of the virtual machine.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatusResponseInner object if successful. | [
"Converts",
"virtual",
"machine",
"disks",
"from",
"blob",
"-",
"based",
"to",
"managed",
"disks",
".",
"Virtual",
"machine",
"must",
"be",
"stop",
"-",
"deallocated",
"before",
"invoking",
"this",
"operation",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L1134-L1136 |
facebookarchive/hadoop-20 | src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/HadoopLocationWizard.java | HadoopLocationWizard.createConfCheckButton | private Button createConfCheckButton(SelectionListener listener,
Composite parent, ConfProp prop, String text) {
"""
Create a SWT Checked Button component for the given {@link ConfProp}
boolean configuration property.
@param listener
@param parent
@param prop
@return
"""
Button button = new Button(parent, SWT.CHECK);
button.setText(text);
button.setData("hProp", prop);
button.setSelection(location.getConfProp(prop).equalsIgnoreCase("yes"));
button.addSelectionListener(listener);
return button;
} | java | private Button createConfCheckButton(SelectionListener listener,
Composite parent, ConfProp prop, String text) {
Button button = new Button(parent, SWT.CHECK);
button.setText(text);
button.setData("hProp", prop);
button.setSelection(location.getConfProp(prop).equalsIgnoreCase("yes"));
button.addSelectionListener(listener);
return button;
} | [
"private",
"Button",
"createConfCheckButton",
"(",
"SelectionListener",
"listener",
",",
"Composite",
"parent",
",",
"ConfProp",
"prop",
",",
"String",
"text",
")",
"{",
"Button",
"button",
"=",
"new",
"Button",
"(",
"parent",
",",
"SWT",
".",
"CHECK",
")",
... | Create a SWT Checked Button component for the given {@link ConfProp}
boolean configuration property.
@param listener
@param parent
@param prop
@return | [
"Create",
"a",
"SWT",
"Checked",
"Button",
"component",
"for",
"the",
"given",
"{",
"@link",
"ConfProp",
"}",
"boolean",
"configuration",
"property",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/HadoopLocationWizard.java#L518-L528 |
mcxiaoke/Android-Next | core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java | IOUtils.skipFully | public static void skipFully(Reader input, long toSkip) throws IOException {
"""
Skip the requested number of characters or fail if there are not enough left.
<p/>
This allows for the possibility that {@link Reader#skip(long)} may
not skip as many characters as requested (most likely because of reaching EOF).
@param input stream to skip
@param toSkip the number of characters to skip
@throws IOException if there is a problem reading the file
@throws IllegalArgumentException if toSkip is negative
@throws EOFException if the number of characters skipped was incorrect
@see Reader#skip(long)
@since 2.0
"""
long skipped = skip(input, toSkip);
if (skipped != toSkip) {
throw new EOFException("Chars to skip: " + toSkip + " actual: " + skipped);
}
} | java | public static void skipFully(Reader input, long toSkip) throws IOException {
long skipped = skip(input, toSkip);
if (skipped != toSkip) {
throw new EOFException("Chars to skip: " + toSkip + " actual: " + skipped);
}
} | [
"public",
"static",
"void",
"skipFully",
"(",
"Reader",
"input",
",",
"long",
"toSkip",
")",
"throws",
"IOException",
"{",
"long",
"skipped",
"=",
"skip",
"(",
"input",
",",
"toSkip",
")",
";",
"if",
"(",
"skipped",
"!=",
"toSkip",
")",
"{",
"throw",
"... | Skip the requested number of characters or fail if there are not enough left.
<p/>
This allows for the possibility that {@link Reader#skip(long)} may
not skip as many characters as requested (most likely because of reaching EOF).
@param input stream to skip
@param toSkip the number of characters to skip
@throws IOException if there is a problem reading the file
@throws IllegalArgumentException if toSkip is negative
@throws EOFException if the number of characters skipped was incorrect
@see Reader#skip(long)
@since 2.0 | [
"Skip",
"the",
"requested",
"number",
"of",
"characters",
"or",
"fail",
"if",
"there",
"are",
"not",
"enough",
"left",
".",
"<p",
"/",
">",
"This",
"allows",
"for",
"the",
"possibility",
"that",
"{",
"@link",
"Reader#skip",
"(",
"long",
")",
"}",
"may",
... | train | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java#L869-L874 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br/br_configurealert.java | br_configurealert.configurealert | public static br_configurealert configurealert(nitro_service client, br_configurealert resource) throws Exception {
"""
<pre>
Use this operation to configure alerts on Repeater Instances.
</pre>
"""
return ((br_configurealert[]) resource.perform_operation(client, "configurealert"))[0];
} | java | public static br_configurealert configurealert(nitro_service client, br_configurealert resource) throws Exception
{
return ((br_configurealert[]) resource.perform_operation(client, "configurealert"))[0];
} | [
"public",
"static",
"br_configurealert",
"configurealert",
"(",
"nitro_service",
"client",
",",
"br_configurealert",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"br_configurealert",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"clie... | <pre>
Use this operation to configure alerts on Repeater Instances.
</pre> | [
"<pre",
">",
"Use",
"this",
"operation",
"to",
"configure",
"alerts",
"on",
"Repeater",
"Instances",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br/br_configurealert.java#L126-L129 |
Cleveroad/LoopBar | LoopBar-widget/src/main/java/com/cleveroad/loopbar/widget/LoopBarView.java | LoopBarView.selectItem | @SuppressWarnings("unused")
public void selectItem(int position, boolean invokeListeners) {
"""
Select item by it's position
@param position int value of item position to select
@param invokeListeners boolean value for invoking listeners
"""
IOperationItem item = mOuterAdapter.getItem(position);
IOperationItem oldHidedItem = mOuterAdapter.getItem(mRealHidedPosition);
int realPosition = mOuterAdapter.normalizePosition(position);
//do nothing if position not changed
if (realPosition == mCurrentItemPosition) {
return;
}
int itemToShowAdapterPosition = position - realPosition + mRealHidedPosition;
item.setVisible(false);
startSelectedViewOutAnimation(position);
mOuterAdapter.notifyRealItemChanged(position);
mRealHidedPosition = realPosition;
oldHidedItem.setVisible(true);
mFlContainerSelected.requestLayout();
mOuterAdapter.notifyRealItemChanged(itemToShowAdapterPosition);
mCurrentItemPosition = realPosition;
if (invokeListeners) {
notifyItemClickListeners(realPosition);
}
if (BuildConfig.DEBUG) {
Log.i(TAG, "clicked on position =" + position);
}
} | java | @SuppressWarnings("unused")
public void selectItem(int position, boolean invokeListeners) {
IOperationItem item = mOuterAdapter.getItem(position);
IOperationItem oldHidedItem = mOuterAdapter.getItem(mRealHidedPosition);
int realPosition = mOuterAdapter.normalizePosition(position);
//do nothing if position not changed
if (realPosition == mCurrentItemPosition) {
return;
}
int itemToShowAdapterPosition = position - realPosition + mRealHidedPosition;
item.setVisible(false);
startSelectedViewOutAnimation(position);
mOuterAdapter.notifyRealItemChanged(position);
mRealHidedPosition = realPosition;
oldHidedItem.setVisible(true);
mFlContainerSelected.requestLayout();
mOuterAdapter.notifyRealItemChanged(itemToShowAdapterPosition);
mCurrentItemPosition = realPosition;
if (invokeListeners) {
notifyItemClickListeners(realPosition);
}
if (BuildConfig.DEBUG) {
Log.i(TAG, "clicked on position =" + position);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"public",
"void",
"selectItem",
"(",
"int",
"position",
",",
"boolean",
"invokeListeners",
")",
"{",
"IOperationItem",
"item",
"=",
"mOuterAdapter",
".",
"getItem",
"(",
"position",
")",
";",
"IOperationItem",
"ol... | Select item by it's position
@param position int value of item position to select
@param invokeListeners boolean value for invoking listeners | [
"Select",
"item",
"by",
"it",
"s",
"position"
] | train | https://github.com/Cleveroad/LoopBar/blob/6ff5e0b35e637202202f9b4ca141195bdcfd5697/LoopBar-widget/src/main/java/com/cleveroad/loopbar/widget/LoopBarView.java#L778-L810 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.appendRange | public static Collection<Integer> appendRange(int start, int stop, Collection<Integer> values) {
"""
将给定范围内的整数添加到已有集合中,步进为1
@param start 开始(包含)
@param stop 结束(包含)
@param values 集合
@return 集合
"""
return appendRange(start, stop, 1, values);
} | java | public static Collection<Integer> appendRange(int start, int stop, Collection<Integer> values) {
return appendRange(start, stop, 1, values);
} | [
"public",
"static",
"Collection",
"<",
"Integer",
">",
"appendRange",
"(",
"int",
"start",
",",
"int",
"stop",
",",
"Collection",
"<",
"Integer",
">",
"values",
")",
"{",
"return",
"appendRange",
"(",
"start",
",",
"stop",
",",
"1",
",",
"values",
")",
... | 将给定范围内的整数添加到已有集合中,步进为1
@param start 开始(包含)
@param stop 结束(包含)
@param values 集合
@return 集合 | [
"将给定范围内的整数添加到已有集合中,步进为1"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L1343-L1345 |
aerogear/aerogear-android-core | library/src/main/java/org/jboss/aerogear/android/core/reflection/Property.java | Property.setValue | public void setValue(Object instance, Object value) {
"""
Set new value
@param instance Instance to set new value
@param value new value
"""
try {
setMethod.invoke(instance, value);
} catch (Exception e) {
throw new PropertyNotFoundException(klass, getType(), fieldName);
}
} | java | public void setValue(Object instance, Object value) {
try {
setMethod.invoke(instance, value);
} catch (Exception e) {
throw new PropertyNotFoundException(klass, getType(), fieldName);
}
} | [
"public",
"void",
"setValue",
"(",
"Object",
"instance",
",",
"Object",
"value",
")",
"{",
"try",
"{",
"setMethod",
".",
"invoke",
"(",
"instance",
",",
"value",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"PropertyNotFoundEx... | Set new value
@param instance Instance to set new value
@param value new value | [
"Set",
"new",
"value"
] | train | https://github.com/aerogear/aerogear-android-core/blob/3be24a79dd3d2792804935572bb672ff8714e6aa/library/src/main/java/org/jboss/aerogear/android/core/reflection/Property.java#L139-L146 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/utils/FileUtils.java | FileUtils.copyFileStreams | public static void copyFileStreams(final File fromFile, final File toFile) throws IOException {
"""
Copy a file from one location to another, and set the modification time to match. (Uses java Streams).
@param fromFile source file
@param toFile dest file
@throws IOException on io error
"""
if (!fromFile.exists()) {
return;
}
Files.copy(fromFile.toPath(), toFile.toPath(),
StandardCopyOption.REPLACE_EXISTING,
StandardCopyOption.COPY_ATTRIBUTES);
} | java | public static void copyFileStreams(final File fromFile, final File toFile) throws IOException {
if (!fromFile.exists()) {
return;
}
Files.copy(fromFile.toPath(), toFile.toPath(),
StandardCopyOption.REPLACE_EXISTING,
StandardCopyOption.COPY_ATTRIBUTES);
} | [
"public",
"static",
"void",
"copyFileStreams",
"(",
"final",
"File",
"fromFile",
",",
"final",
"File",
"toFile",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"fromFile",
".",
"exists",
"(",
")",
")",
"{",
"return",
";",
"}",
"Files",
".",
"copy",
... | Copy a file from one location to another, and set the modification time to match. (Uses java Streams).
@param fromFile source file
@param toFile dest file
@throws IOException on io error | [
"Copy",
"a",
"file",
"from",
"one",
"location",
"to",
"another",
"and",
"set",
"the",
"modification",
"time",
"to",
"match",
".",
"(",
"Uses",
"java",
"Streams",
")",
"."
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/FileUtils.java#L64-L72 |
grpc/grpc-java | api/src/main/java/io/grpc/Status.java | Status.augmentDescription | public Status augmentDescription(String additionalDetail) {
"""
Create a derived instance of {@link Status} augmenting the current description with
additional detail. Leading and trailing whitespace may be removed; this may change in the
future.
"""
if (additionalDetail == null) {
return this;
} else if (this.description == null) {
return new Status(this.code, additionalDetail, this.cause);
} else {
return new Status(this.code, this.description + "\n" + additionalDetail, this.cause);
}
} | java | public Status augmentDescription(String additionalDetail) {
if (additionalDetail == null) {
return this;
} else if (this.description == null) {
return new Status(this.code, additionalDetail, this.cause);
} else {
return new Status(this.code, this.description + "\n" + additionalDetail, this.cause);
}
} | [
"public",
"Status",
"augmentDescription",
"(",
"String",
"additionalDetail",
")",
"{",
"if",
"(",
"additionalDetail",
"==",
"null",
")",
"{",
"return",
"this",
";",
"}",
"else",
"if",
"(",
"this",
".",
"description",
"==",
"null",
")",
"{",
"return",
"new"... | Create a derived instance of {@link Status} augmenting the current description with
additional detail. Leading and trailing whitespace may be removed; this may change in the
future. | [
"Create",
"a",
"derived",
"instance",
"of",
"{"
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/Status.java#L478-L486 |
micronaut-projects/micronaut-core | core/src/main/java/io/micronaut/core/cli/CommandLineParser.java | CommandLineParser.processOption | protected String processOption(DefaultCommandLine cl, String arg) {
"""
Process the passed in options.
@param cl cl
@param arg arg
@return argument processed
"""
if (arg.length() < 2) {
return null;
}
if (arg.charAt(1) == 'D' && arg.contains("=")) {
processSystemArg(cl, arg);
return null;
}
arg = (arg.charAt(1) == '-' ? arg.substring(2, arg.length()) : arg.substring(1, arg.length())).trim();
if (arg.contains("=")) {
String[] split = arg.split("=");
String name = split[0].trim();
validateOptionName(name);
String value = split[1].trim();
if (declaredOptions.containsKey(name)) {
cl.addDeclaredOption(declaredOptions.get(name), value);
} else {
cl.addUndeclaredOption(name, value);
}
return null;
}
validateOptionName(arg);
if (declaredOptions.containsKey(arg)) {
cl.addDeclaredOption(declaredOptions.get(arg));
} else {
cl.addUndeclaredOption(arg);
}
return arg;
} | java | protected String processOption(DefaultCommandLine cl, String arg) {
if (arg.length() < 2) {
return null;
}
if (arg.charAt(1) == 'D' && arg.contains("=")) {
processSystemArg(cl, arg);
return null;
}
arg = (arg.charAt(1) == '-' ? arg.substring(2, arg.length()) : arg.substring(1, arg.length())).trim();
if (arg.contains("=")) {
String[] split = arg.split("=");
String name = split[0].trim();
validateOptionName(name);
String value = split[1].trim();
if (declaredOptions.containsKey(name)) {
cl.addDeclaredOption(declaredOptions.get(name), value);
} else {
cl.addUndeclaredOption(name, value);
}
return null;
}
validateOptionName(arg);
if (declaredOptions.containsKey(arg)) {
cl.addDeclaredOption(declaredOptions.get(arg));
} else {
cl.addUndeclaredOption(arg);
}
return arg;
} | [
"protected",
"String",
"processOption",
"(",
"DefaultCommandLine",
"cl",
",",
"String",
"arg",
")",
"{",
"if",
"(",
"arg",
".",
"length",
"(",
")",
"<",
"2",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"arg",
".",
"charAt",
"(",
"1",
")",
"=="... | Process the passed in options.
@param cl cl
@param arg arg
@return argument processed | [
"Process",
"the",
"passed",
"in",
"options",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/cli/CommandLineParser.java#L153-L185 |
icode/ameba | src/main/java/ameba/core/Addon.java | Addon.subscribeSystemEvent | protected static <E extends Event> void subscribeSystemEvent(Class<E> eventClass, final Listener<E> listener) {
"""
<p>subscribeSystemEvent.</p>
@param eventClass a {@link java.lang.Class} object.
@param listener a {@link ameba.event.Listener} object.
@param <E> a E object.
"""
SystemEventBus.subscribe(eventClass, listener);
} | java | protected static <E extends Event> void subscribeSystemEvent(Class<E> eventClass, final Listener<E> listener) {
SystemEventBus.subscribe(eventClass, listener);
} | [
"protected",
"static",
"<",
"E",
"extends",
"Event",
">",
"void",
"subscribeSystemEvent",
"(",
"Class",
"<",
"E",
">",
"eventClass",
",",
"final",
"Listener",
"<",
"E",
">",
"listener",
")",
"{",
"SystemEventBus",
".",
"subscribe",
"(",
"eventClass",
",",
... | <p>subscribeSystemEvent.</p>
@param eventClass a {@link java.lang.Class} object.
@param listener a {@link ameba.event.Listener} object.
@param <E> a E object. | [
"<p",
">",
"subscribeSystemEvent",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/core/Addon.java#L83-L85 |
h2oai/h2o-3 | h2o-core/src/main/java/water/api/RequestServer.java | RequestServer.maybeLogRequest | private static boolean maybeLogRequest(RequestUri uri, Properties header, Properties parms) {
"""
Log the request (unless it's an overly common one).
@return flag whether the request parameters might be sensitive or not
"""
LogFilterLevel level = LogFilterLevel.LOG;
for (HttpLogFilter f : _filters)
level = level.reduce(f.filter(uri, header, parms));
switch (level) {
case DO_NOT_LOG:
return false; // do not log the request by default but allow parameters to be logged on exceptional completion
case URL_ONLY:
Log.info(uri, ", parms: <hidden>");
return true; // parameters are sensitive - never log them
default:
Log.info(uri + ", parms: " + parms);
return false;
}
} | java | private static boolean maybeLogRequest(RequestUri uri, Properties header, Properties parms) {
LogFilterLevel level = LogFilterLevel.LOG;
for (HttpLogFilter f : _filters)
level = level.reduce(f.filter(uri, header, parms));
switch (level) {
case DO_NOT_LOG:
return false; // do not log the request by default but allow parameters to be logged on exceptional completion
case URL_ONLY:
Log.info(uri, ", parms: <hidden>");
return true; // parameters are sensitive - never log them
default:
Log.info(uri + ", parms: " + parms);
return false;
}
} | [
"private",
"static",
"boolean",
"maybeLogRequest",
"(",
"RequestUri",
"uri",
",",
"Properties",
"header",
",",
"Properties",
"parms",
")",
"{",
"LogFilterLevel",
"level",
"=",
"LogFilterLevel",
".",
"LOG",
";",
"for",
"(",
"HttpLogFilter",
"f",
":",
"_filters",
... | Log the request (unless it's an overly common one).
@return flag whether the request parameters might be sensitive or not | [
"Log",
"the",
"request",
"(",
"unless",
"it",
"s",
"an",
"overly",
"common",
"one",
")",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/api/RequestServer.java#L532-L546 |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/interestrate/products/LIBORBond.java | LIBORBond.getValue | @Override
public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException {
"""
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime.
Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time.
Cashflows prior evaluationTime are not considered.
@param evaluationTime The time on which this products value should be observed.
@param model The model used to price the product.
@return The random variable representing the value of the product discounted to evaluation time
@throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method.
"""
if(evaluationTime > maturity) {
return new Scalar(0);
}
return model.getLIBOR(evaluationTime, evaluationTime, maturity).mult(maturity - evaluationTime).add(1.0).invert();
} | java | @Override
public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException {
if(evaluationTime > maturity) {
return new Scalar(0);
}
return model.getLIBOR(evaluationTime, evaluationTime, maturity).mult(maturity - evaluationTime).add(1.0).invert();
} | [
"@",
"Override",
"public",
"RandomVariable",
"getValue",
"(",
"double",
"evaluationTime",
",",
"LIBORModelMonteCarloSimulationModel",
"model",
")",
"throws",
"CalculationException",
"{",
"if",
"(",
"evaluationTime",
">",
"maturity",
")",
"{",
"return",
"new",
"Scalar"... | This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime.
Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time.
Cashflows prior evaluationTime are not considered.
@param evaluationTime The time on which this products value should be observed.
@param model The model used to price the product.
@return The random variable representing the value of the product discounted to evaluation time
@throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method. | [
"This",
"method",
"returns",
"the",
"value",
"random",
"variable",
"of",
"the",
"product",
"within",
"the",
"specified",
"model",
"evaluated",
"at",
"a",
"given",
"evalutationTime",
".",
"Note",
":",
"For",
"a",
"lattice",
"this",
"is",
"often",
"the",
"valu... | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/LIBORBond.java#L43-L50 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManagerAsync.java | IOManagerAsync.createBulkBlockChannelReader | @Override
public BulkBlockChannelReader createBulkBlockChannelReader(FileIOChannel.ID channelID,
List<MemorySegment> targetSegments, int numBlocks) throws IOException {
"""
Creates a block channel reader that reads all blocks from the given channel directly in one bulk.
The reader draws segments to read the blocks into from a supplied list, which must contain as many
segments as the channel has blocks. After the reader is done, the list with the full segments can be
obtained from the reader.
<p>
If a channel is not to be read in one bulk, but in multiple smaller batches, a
{@link BlockChannelReader} should be used.
@param channelID The descriptor for the channel to write to.
@param targetSegments The list to take the segments from into which to read the data.
@param numBlocks The number of blocks in the channel to read.
@return A block channel reader that reads from the given channel.
@throws IOException Thrown, if the channel for the reader could not be opened.
"""
checkState(!isShutdown.get(), "I/O-Manager is shut down.");
return new AsynchronousBulkBlockReader(channelID, this.readers[channelID.getThreadNum()].requestQueue, targetSegments, numBlocks);
} | java | @Override
public BulkBlockChannelReader createBulkBlockChannelReader(FileIOChannel.ID channelID,
List<MemorySegment> targetSegments, int numBlocks) throws IOException
{
checkState(!isShutdown.get(), "I/O-Manager is shut down.");
return new AsynchronousBulkBlockReader(channelID, this.readers[channelID.getThreadNum()].requestQueue, targetSegments, numBlocks);
} | [
"@",
"Override",
"public",
"BulkBlockChannelReader",
"createBulkBlockChannelReader",
"(",
"FileIOChannel",
".",
"ID",
"channelID",
",",
"List",
"<",
"MemorySegment",
">",
"targetSegments",
",",
"int",
"numBlocks",
")",
"throws",
"IOException",
"{",
"checkState",
"(",
... | Creates a block channel reader that reads all blocks from the given channel directly in one bulk.
The reader draws segments to read the blocks into from a supplied list, which must contain as many
segments as the channel has blocks. After the reader is done, the list with the full segments can be
obtained from the reader.
<p>
If a channel is not to be read in one bulk, but in multiple smaller batches, a
{@link BlockChannelReader} should be used.
@param channelID The descriptor for the channel to write to.
@param targetSegments The list to take the segments from into which to read the data.
@param numBlocks The number of blocks in the channel to read.
@return A block channel reader that reads from the given channel.
@throws IOException Thrown, if the channel for the reader could not be opened. | [
"Creates",
"a",
"block",
"channel",
"reader",
"that",
"reads",
"all",
"blocks",
"from",
"the",
"given",
"channel",
"directly",
"in",
"one",
"bulk",
".",
"The",
"reader",
"draws",
"segments",
"to",
"read",
"the",
"blocks",
"into",
"from",
"a",
"supplied",
"... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManagerAsync.java#L264-L270 |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java | SFSUtilities.getTableEnvelope | public static Envelope getTableEnvelope(Connection connection, TableLocation location, String geometryField)
throws SQLException {
"""
Merge the bounding box of all geometries inside the provided table.
@param connection Active connection (not closed by this function)
@param location Location of the table
@param geometryField Geometry field or empty string (take the first geometry field)
@return Envelope of the table
@throws SQLException If the table not exists, empty or does not contain a geometry field.
"""
if(geometryField==null || geometryField.isEmpty()) {
List<String> geometryFields = getGeometryFields(connection, location);
if(geometryFields.isEmpty()) {
throw new SQLException("The table "+location+" does not contain a Geometry field, then the extent " +
"cannot be computed");
}
geometryField = geometryFields.get(0);
}
ResultSet rs = connection.createStatement().executeQuery("SELECT ST_Extent("+
TableLocation.quoteIdentifier(geometryField)+") ext FROM "+location);
if(rs.next()) {
// Todo under postgis it is a BOX type
return ((Geometry)rs.getObject(1)).getEnvelopeInternal();
}
throw new SQLException("Unable to get the table extent it may be empty");
} | java | public static Envelope getTableEnvelope(Connection connection, TableLocation location, String geometryField)
throws SQLException {
if(geometryField==null || geometryField.isEmpty()) {
List<String> geometryFields = getGeometryFields(connection, location);
if(geometryFields.isEmpty()) {
throw new SQLException("The table "+location+" does not contain a Geometry field, then the extent " +
"cannot be computed");
}
geometryField = geometryFields.get(0);
}
ResultSet rs = connection.createStatement().executeQuery("SELECT ST_Extent("+
TableLocation.quoteIdentifier(geometryField)+") ext FROM "+location);
if(rs.next()) {
// Todo under postgis it is a BOX type
return ((Geometry)rs.getObject(1)).getEnvelopeInternal();
}
throw new SQLException("Unable to get the table extent it may be empty");
} | [
"public",
"static",
"Envelope",
"getTableEnvelope",
"(",
"Connection",
"connection",
",",
"TableLocation",
"location",
",",
"String",
"geometryField",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"geometryField",
"==",
"null",
"||",
"geometryField",
".",
"isEmpty"... | Merge the bounding box of all geometries inside the provided table.
@param connection Active connection (not closed by this function)
@param location Location of the table
@param geometryField Geometry field or empty string (take the first geometry field)
@return Envelope of the table
@throws SQLException If the table not exists, empty or does not contain a geometry field. | [
"Merge",
"the",
"bounding",
"box",
"of",
"all",
"geometries",
"inside",
"the",
"provided",
"table",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java#L212-L229 |
btrplace/scheduler | json/src/main/java/org/btrplace/json/JSONs.java | JSONs.requiredBoolean | public static boolean requiredBoolean(JSONObject o, String id) throws JSONConverterException {
"""
Read an expected boolean.
@param o the object to parse
@param id the id in the map that should point to the boolean
@return the boolean
@throws org.btrplace.json.JSONConverterException if the key does not point to a boolean
"""
checkKeys(o, id);
Object x = o.get(id);
if (!(x instanceof Boolean)) {
throw new JSONConverterException("Boolean expected at key '" + id + "' but was '" + x.getClass() + "'.");
}
return (Boolean) x;
} | java | public static boolean requiredBoolean(JSONObject o, String id) throws JSONConverterException {
checkKeys(o, id);
Object x = o.get(id);
if (!(x instanceof Boolean)) {
throw new JSONConverterException("Boolean expected at key '" + id + "' but was '" + x.getClass() + "'.");
}
return (Boolean) x;
} | [
"public",
"static",
"boolean",
"requiredBoolean",
"(",
"JSONObject",
"o",
",",
"String",
"id",
")",
"throws",
"JSONConverterException",
"{",
"checkKeys",
"(",
"o",
",",
"id",
")",
";",
"Object",
"x",
"=",
"o",
".",
"get",
"(",
"id",
")",
";",
"if",
"("... | Read an expected boolean.
@param o the object to parse
@param id the id in the map that should point to the boolean
@return the boolean
@throws org.btrplace.json.JSONConverterException if the key does not point to a boolean | [
"Read",
"an",
"expected",
"boolean",
"."
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L175-L182 |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/driver/restart/EvaluatorRestartInfo.java | EvaluatorRestartInfo.createFailedEvaluatorInfo | public static EvaluatorRestartInfo createFailedEvaluatorInfo(final String evaluatorId) {
"""
Creates an {@link EvaluatorRestartInfo} object that represents the information of an evaluator that
has failed on driver restart.
"""
final ResourceRecoverEvent resourceRecoverEvent =
ResourceEventImpl.newRecoveryBuilder().setIdentifier(evaluatorId).build();
return new EvaluatorRestartInfo(resourceRecoverEvent, EvaluatorRestartState.FAILED);
} | java | public static EvaluatorRestartInfo createFailedEvaluatorInfo(final String evaluatorId) {
final ResourceRecoverEvent resourceRecoverEvent =
ResourceEventImpl.newRecoveryBuilder().setIdentifier(evaluatorId).build();
return new EvaluatorRestartInfo(resourceRecoverEvent, EvaluatorRestartState.FAILED);
} | [
"public",
"static",
"EvaluatorRestartInfo",
"createFailedEvaluatorInfo",
"(",
"final",
"String",
"evaluatorId",
")",
"{",
"final",
"ResourceRecoverEvent",
"resourceRecoverEvent",
"=",
"ResourceEventImpl",
".",
"newRecoveryBuilder",
"(",
")",
".",
"setIdentifier",
"(",
"ev... | Creates an {@link EvaluatorRestartInfo} object that represents the information of an evaluator that
has failed on driver restart. | [
"Creates",
"an",
"{"
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/driver/restart/EvaluatorRestartInfo.java#L60-L66 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgPreparedStatement.java | PgPreparedStatement.bindLiteral | protected void bindLiteral(int paramIndex, String s, int oid) throws SQLException {
"""
Note if s is a String it should be escaped by the caller to avoid SQL injection attacks. It is
not done here for efficiency reasons as most calls to this method do not require escaping as
the source of the string is known safe (i.e. {@code Integer.toString()})
@param paramIndex parameter index
@param s value (the value should already be escaped)
@param oid type oid
@throws SQLException if something goes wrong
"""
preparedParameters.setLiteralParameter(paramIndex, s, oid);
} | java | protected void bindLiteral(int paramIndex, String s, int oid) throws SQLException {
preparedParameters.setLiteralParameter(paramIndex, s, oid);
} | [
"protected",
"void",
"bindLiteral",
"(",
"int",
"paramIndex",
",",
"String",
"s",
",",
"int",
"oid",
")",
"throws",
"SQLException",
"{",
"preparedParameters",
".",
"setLiteralParameter",
"(",
"paramIndex",
",",
"s",
",",
"oid",
")",
";",
"}"
] | Note if s is a String it should be escaped by the caller to avoid SQL injection attacks. It is
not done here for efficiency reasons as most calls to this method do not require escaping as
the source of the string is known safe (i.e. {@code Integer.toString()})
@param paramIndex parameter index
@param s value (the value should already be escaped)
@param oid type oid
@throws SQLException if something goes wrong | [
"Note",
"if",
"s",
"is",
"a",
"String",
"it",
"should",
"be",
"escaped",
"by",
"the",
"caller",
"to",
"avoid",
"SQL",
"injection",
"attacks",
".",
"It",
"is",
"not",
"done",
"here",
"for",
"efficiency",
"reasons",
"as",
"most",
"calls",
"to",
"this",
"... | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgPreparedStatement.java#L984-L986 |
morimekta/utils | io-util/src/main/java/net/morimekta/util/io/BinaryReader.java | BinaryReader.expectUInt16 | public int expectUInt16() throws IOException {
"""
Read an unsigned short from the input stream.
@return The number read.
@throws IOException If no number to read.
"""
int b1 = in.read();
if (b1 < 0) {
throw new IOException("Missing byte 1 to expected uint16");
}
int b2 = in.read();
if (b2 < 0) {
throw new IOException("Missing byte 2 to expected uint16");
}
return unshift2bytes(b1, b2);
} | java | public int expectUInt16() throws IOException {
int b1 = in.read();
if (b1 < 0) {
throw new IOException("Missing byte 1 to expected uint16");
}
int b2 = in.read();
if (b2 < 0) {
throw new IOException("Missing byte 2 to expected uint16");
}
return unshift2bytes(b1, b2);
} | [
"public",
"int",
"expectUInt16",
"(",
")",
"throws",
"IOException",
"{",
"int",
"b1",
"=",
"in",
".",
"read",
"(",
")",
";",
"if",
"(",
"b1",
"<",
"0",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Missing byte 1 to expected uint16\"",
")",
";",
"}",
... | Read an unsigned short from the input stream.
@return The number read.
@throws IOException If no number to read. | [
"Read",
"an",
"unsigned",
"short",
"from",
"the",
"input",
"stream",
"."
] | train | https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/io/BinaryReader.java#L279-L289 |
grpc/grpc-java | stub/src/main/java/io/grpc/stub/ClientCalls.java | ClientCalls.asyncBidiStreamingCall | public static <ReqT, RespT> StreamObserver<ReqT> asyncBidiStreamingCall(
ClientCall<ReqT, RespT> call, StreamObserver<RespT> responseObserver) {
"""
Executes a bidirectional-streaming call. The {@code call} should not be already started.
After calling this method, {@code call} should no longer be used.
@return request stream observer.
"""
return asyncStreamingRequestCall(call, responseObserver, true);
} | java | public static <ReqT, RespT> StreamObserver<ReqT> asyncBidiStreamingCall(
ClientCall<ReqT, RespT> call, StreamObserver<RespT> responseObserver) {
return asyncStreamingRequestCall(call, responseObserver, true);
} | [
"public",
"static",
"<",
"ReqT",
",",
"RespT",
">",
"StreamObserver",
"<",
"ReqT",
">",
"asyncBidiStreamingCall",
"(",
"ClientCall",
"<",
"ReqT",
",",
"RespT",
">",
"call",
",",
"StreamObserver",
"<",
"RespT",
">",
"responseObserver",
")",
"{",
"return",
"as... | Executes a bidirectional-streaming call. The {@code call} should not be already started.
After calling this method, {@code call} should no longer be used.
@return request stream observer. | [
"Executes",
"a",
"bidirectional",
"-",
"streaming",
"call",
".",
"The",
"{",
"@code",
"call",
"}",
"should",
"not",
"be",
"already",
"started",
".",
"After",
"calling",
"this",
"method",
"{",
"@code",
"call",
"}",
"should",
"no",
"longer",
"be",
"used",
... | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/stub/src/main/java/io/grpc/stub/ClientCalls.java#L96-L99 |
Alexey1Gavrilov/ExpectIt | expectit-core/src/main/java/net/sf/expectit/filter/Filters.java | Filters.replaceInString | public static Filter replaceInString(final String regexp, final String replacement) {
"""
Equivalent to {@link #replaceInString(java.util.regex.Pattern,
String)} but takes the regular expression
as string and default overlap in 80 characters.
@param regexp the regular expression
@param replacement the string to be substituted for each match
@return the filter
"""
return replaceInString(Pattern.compile(regexp), replacement, DEFAULT_FILTER_OVERLAP);
} | java | public static Filter replaceInString(final String regexp, final String replacement) {
return replaceInString(Pattern.compile(regexp), replacement, DEFAULT_FILTER_OVERLAP);
} | [
"public",
"static",
"Filter",
"replaceInString",
"(",
"final",
"String",
"regexp",
",",
"final",
"String",
"replacement",
")",
"{",
"return",
"replaceInString",
"(",
"Pattern",
".",
"compile",
"(",
"regexp",
")",
",",
"replacement",
",",
"DEFAULT_FILTER_OVERLAP",
... | Equivalent to {@link #replaceInString(java.util.regex.Pattern,
String)} but takes the regular expression
as string and default overlap in 80 characters.
@param regexp the regular expression
@param replacement the string to be substituted for each match
@return the filter | [
"Equivalent",
"to",
"{",
"@link",
"#replaceInString",
"(",
"java",
".",
"util",
".",
"regex",
".",
"Pattern",
"String",
")",
"}",
"but",
"takes",
"the",
"regular",
"expression",
"as",
"string",
"and",
"default",
"overlap",
"in",
"80",
"characters",
"."
] | train | https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-core/src/main/java/net/sf/expectit/filter/Filters.java#L114-L116 |
casbin/jcasbin | src/main/java/org/casbin/jcasbin/main/Enforcer.java | Enforcer.deletePermissionForUser | public boolean deletePermissionForUser(String user, String... permission) {
"""
deletePermissionForUser deletes a permission for a user or role.
Returns false if the user or role does not have the permission (aka not affected).
@param user the user.
@param permission the permission, usually be (obj, act). It is actually the rule without the subject.
@return succeeds or not.
"""
List<String> params = new ArrayList<>();
params.add(user);
Collections.addAll(params, permission);
return removePolicy(params);
} | java | public boolean deletePermissionForUser(String user, String... permission) {
List<String> params = new ArrayList<>();
params.add(user);
Collections.addAll(params, permission);
return removePolicy(params);
} | [
"public",
"boolean",
"deletePermissionForUser",
"(",
"String",
"user",
",",
"String",
"...",
"permission",
")",
"{",
"List",
"<",
"String",
">",
"params",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"params",
".",
"add",
"(",
"user",
")",
";",
"Collect... | deletePermissionForUser deletes a permission for a user or role.
Returns false if the user or role does not have the permission (aka not affected).
@param user the user.
@param permission the permission, usually be (obj, act). It is actually the rule without the subject.
@return succeeds or not. | [
"deletePermissionForUser",
"deletes",
"a",
"permission",
"for",
"a",
"user",
"or",
"role",
".",
"Returns",
"false",
"if",
"the",
"user",
"or",
"role",
"does",
"not",
"have",
"the",
"permission",
"(",
"aka",
"not",
"affected",
")",
"."
] | train | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/Enforcer.java#L280-L287 |
undera/jmeter-plugins | tools/synthesis/src/main/java/kg/apc/jmeter/vizualizers/SynthesisReportGui.java | SynthesisReportGui.getAllDataAsTable | public static DefaultTableModel getAllDataAsTable(ObjectTableModel model, Format[] formats, String[] columns) {
"""
Present data in javax.swing.table.DefaultTableModel form.
@param model {@link ObjectTableModel}
@param formats Array of {@link Format} array can contain null formatters in this case value is added as is
@param columns Columns headers
@return data in table form
"""
final List<List<Object>> table = getAllTableData(model, formats);
final DefaultTableModel tableModel = new DefaultTableModel();
for (String header : columns) {
tableModel.addColumn(header);
}
for (List<Object> row : table) {
tableModel.addRow(new Vector(row));
}
return tableModel;
} | java | public static DefaultTableModel getAllDataAsTable(ObjectTableModel model, Format[] formats, String[] columns) {
final List<List<Object>> table = getAllTableData(model, formats);
final DefaultTableModel tableModel = new DefaultTableModel();
for (String header : columns) {
tableModel.addColumn(header);
}
for (List<Object> row : table) {
tableModel.addRow(new Vector(row));
}
return tableModel;
} | [
"public",
"static",
"DefaultTableModel",
"getAllDataAsTable",
"(",
"ObjectTableModel",
"model",
",",
"Format",
"[",
"]",
"formats",
",",
"String",
"[",
"]",
"columns",
")",
"{",
"final",
"List",
"<",
"List",
"<",
"Object",
">",
">",
"table",
"=",
"getAllTabl... | Present data in javax.swing.table.DefaultTableModel form.
@param model {@link ObjectTableModel}
@param formats Array of {@link Format} array can contain null formatters in this case value is added as is
@param columns Columns headers
@return data in table form | [
"Present",
"data",
"in",
"javax",
".",
"swing",
".",
"table",
".",
"DefaultTableModel",
"form",
"."
] | train | https://github.com/undera/jmeter-plugins/blob/416d2a77249ab921c7e4134c3e6a9639901ef7e8/tools/synthesis/src/main/java/kg/apc/jmeter/vizualizers/SynthesisReportGui.java#L467-L481 |
samskivert/samskivert | src/main/java/com/samskivert/util/Config.java | Config.getValue | public int getValue (String name, int defval) {
"""
Fetches and returns the value for the specified configuration property. If the value is not
specified in the associated properties file, the supplied default value is returned instead.
If the property specified in the file is poorly formatted (not and integer, not in proper
array specification), a warning message will be logged and the default value will be
returned.
@param name name of the property.
@param defval the value to return if the property is not specified in the config file.
@return the value of the requested property.
"""
String val = _props.getProperty(name);
if (val != null) {
try {
return Integer.decode(val).intValue(); // handles base 10, hex values, etc.
} catch (NumberFormatException nfe) {
log.warning("Malformed integer property", "name", name, "value", val);
}
}
return defval;
} | java | public int getValue (String name, int defval)
{
String val = _props.getProperty(name);
if (val != null) {
try {
return Integer.decode(val).intValue(); // handles base 10, hex values, etc.
} catch (NumberFormatException nfe) {
log.warning("Malformed integer property", "name", name, "value", val);
}
}
return defval;
} | [
"public",
"int",
"getValue",
"(",
"String",
"name",
",",
"int",
"defval",
")",
"{",
"String",
"val",
"=",
"_props",
".",
"getProperty",
"(",
"name",
")",
";",
"if",
"(",
"val",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"Integer",
".",
"decode",
... | Fetches and returns the value for the specified configuration property. If the value is not
specified in the associated properties file, the supplied default value is returned instead.
If the property specified in the file is poorly formatted (not and integer, not in proper
array specification), a warning message will be logged and the default value will be
returned.
@param name name of the property.
@param defval the value to return if the property is not specified in the config file.
@return the value of the requested property. | [
"Fetches",
"and",
"returns",
"the",
"value",
"for",
"the",
"specified",
"configuration",
"property",
".",
"If",
"the",
"value",
"is",
"not",
"specified",
"in",
"the",
"associated",
"properties",
"file",
"the",
"supplied",
"default",
"value",
"is",
"returned",
... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/Config.java#L110-L121 |
Azure/azure-sdk-for-java | streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/OutputsInner.java | OutputsInner.listByStreamingJobAsync | public Observable<Page<OutputInner>> listByStreamingJobAsync(final String resourceGroupName, final String jobName) {
"""
Lists all of the outputs under the specified streaming job.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param jobName The name of the streaming job.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<OutputInner> object
"""
return listByStreamingJobWithServiceResponseAsync(resourceGroupName, jobName)
.map(new Func1<ServiceResponse<Page<OutputInner>>, Page<OutputInner>>() {
@Override
public Page<OutputInner> call(ServiceResponse<Page<OutputInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<OutputInner>> listByStreamingJobAsync(final String resourceGroupName, final String jobName) {
return listByStreamingJobWithServiceResponseAsync(resourceGroupName, jobName)
.map(new Func1<ServiceResponse<Page<OutputInner>>, Page<OutputInner>>() {
@Override
public Page<OutputInner> call(ServiceResponse<Page<OutputInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"OutputInner",
">",
">",
"listByStreamingJobAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"jobName",
")",
"{",
"return",
"listByStreamingJobWithServiceResponseAsync",
"(",
"resourceGroupName",
",",... | Lists all of the outputs under the specified streaming job.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param jobName The name of the streaming job.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<OutputInner> object | [
"Lists",
"all",
"of",
"the",
"outputs",
"under",
"the",
"specified",
"streaming",
"job",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/OutputsInner.java#L745-L753 |
b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java | RequestContext.renderJSONValue | public RequestContext renderJSONValue(final String name, final Object obj) {
"""
Renders with {"name", obj}.
@param name the specified name
@param obj the specified object
@return this context
"""
if (renderer instanceof JsonRenderer) {
final JsonRenderer r = (JsonRenderer) renderer;
final JSONObject ret = r.getJSONObject();
ret.put(name, obj);
}
return this;
} | java | public RequestContext renderJSONValue(final String name, final Object obj) {
if (renderer instanceof JsonRenderer) {
final JsonRenderer r = (JsonRenderer) renderer;
final JSONObject ret = r.getJSONObject();
ret.put(name, obj);
}
return this;
} | [
"public",
"RequestContext",
"renderJSONValue",
"(",
"final",
"String",
"name",
",",
"final",
"Object",
"obj",
")",
"{",
"if",
"(",
"renderer",
"instanceof",
"JsonRenderer",
")",
"{",
"final",
"JsonRenderer",
"r",
"=",
"(",
"JsonRenderer",
")",
"renderer",
";",... | Renders with {"name", obj}.
@param name the specified name
@param obj the specified object
@return this context | [
"Renders",
"with",
"{",
"name",
"obj",
"}",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/RequestContext.java#L528-L537 |
trustathsh/ifmapj | src/main/java/de/hshannover/f4/trust/ifmapj/messages/Requests.java | Requests.createPublishDelete | public static PublishDelete createPublishDelete(Identifier i1, String filter) {
"""
Create a new {@link PublishDelete} instance for a specific {@link Identifier}
in order to delete its metadata that matches the given filter.
@param i1 the {@link Identifier} that is the target of the delete request
@param filter a filter that expresses the metadata that shall be deleted
@return the new {@link PublishDelete} instance
"""
return createPublishDelete(i1, null, filter);
} | java | public static PublishDelete createPublishDelete(Identifier i1, String filter) {
return createPublishDelete(i1, null, filter);
} | [
"public",
"static",
"PublishDelete",
"createPublishDelete",
"(",
"Identifier",
"i1",
",",
"String",
"filter",
")",
"{",
"return",
"createPublishDelete",
"(",
"i1",
",",
"null",
",",
"filter",
")",
";",
"}"
] | Create a new {@link PublishDelete} instance for a specific {@link Identifier}
in order to delete its metadata that matches the given filter.
@param i1 the {@link Identifier} that is the target of the delete request
@param filter a filter that expresses the metadata that shall be deleted
@return the new {@link PublishDelete} instance | [
"Create",
"a",
"new",
"{",
"@link",
"PublishDelete",
"}",
"instance",
"for",
"a",
"specific",
"{",
"@link",
"Identifier",
"}",
"in",
"order",
"to",
"delete",
"its",
"metadata",
"that",
"matches",
"the",
"given",
"filter",
"."
] | train | https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/messages/Requests.java#L590-L592 |
census-instrumentation/opencensus-java | api/src/main/java/io/opencensus/trace/Span.java | Span.putAttribute | public void putAttribute(String key, AttributeValue value) {
"""
Sets an attribute to the {@code Span}. If the {@code Span} previously contained a mapping for
the key, the old value is replaced by the specified value.
@param key the key for this attribute.
@param value the value for this attribute.
@since 0.6
"""
// Not final because for performance reasons we want to override this in the implementation.
// Also a default implementation is needed to not break the compatibility (users may extend this
// for testing).
Utils.checkNotNull(key, "key");
Utils.checkNotNull(value, "value");
putAttributes(Collections.singletonMap(key, value));
} | java | public void putAttribute(String key, AttributeValue value) {
// Not final because for performance reasons we want to override this in the implementation.
// Also a default implementation is needed to not break the compatibility (users may extend this
// for testing).
Utils.checkNotNull(key, "key");
Utils.checkNotNull(value, "value");
putAttributes(Collections.singletonMap(key, value));
} | [
"public",
"void",
"putAttribute",
"(",
"String",
"key",
",",
"AttributeValue",
"value",
")",
"{",
"// Not final because for performance reasons we want to override this in the implementation.",
"// Also a default implementation is needed to not break the compatibility (users may extend this"... | Sets an attribute to the {@code Span}. If the {@code Span} previously contained a mapping for
the key, the old value is replaced by the specified value.
@param key the key for this attribute.
@param value the value for this attribute.
@since 0.6 | [
"Sets",
"an",
"attribute",
"to",
"the",
"{",
"@code",
"Span",
"}",
".",
"If",
"the",
"{",
"@code",
"Span",
"}",
"previously",
"contained",
"a",
"mapping",
"for",
"the",
"key",
"the",
"old",
"value",
"is",
"replaced",
"by",
"the",
"specified",
"value",
... | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/Span.java#L95-L102 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.pressImage | public static void pressImage(ImageInputStream srcStream, ImageOutputStream destStream, Image pressImg, int x, int y, float alpha) throws IORuntimeException {
"""
给图片添加图片水印<br>
此方法并不关闭流
@param srcStream 源图像流
@param destStream 目标图像流
@param pressImg 水印图片,可以使用{@link ImageIO#read(File)}方法读取文件
@param x 修正值。 默认在中间,偏移量相对于中间偏移
@param y 修正值。 默认在中间,偏移量相对于中间偏移
@param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
@throws IORuntimeException IO异常
"""
pressImage(read(srcStream), destStream, pressImg, x, y, alpha);
} | java | public static void pressImage(ImageInputStream srcStream, ImageOutputStream destStream, Image pressImg, int x, int y, float alpha) throws IORuntimeException {
pressImage(read(srcStream), destStream, pressImg, x, y, alpha);
} | [
"public",
"static",
"void",
"pressImage",
"(",
"ImageInputStream",
"srcStream",
",",
"ImageOutputStream",
"destStream",
",",
"Image",
"pressImg",
",",
"int",
"x",
",",
"int",
"y",
",",
"float",
"alpha",
")",
"throws",
"IORuntimeException",
"{",
"pressImage",
"("... | 给图片添加图片水印<br>
此方法并不关闭流
@param srcStream 源图像流
@param destStream 目标图像流
@param pressImg 水印图片,可以使用{@link ImageIO#read(File)}方法读取文件
@param x 修正值。 默认在中间,偏移量相对于中间偏移
@param y 修正值。 默认在中间,偏移量相对于中间偏移
@param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
@throws IORuntimeException IO异常 | [
"给图片添加图片水印<br",
">",
"此方法并不关闭流"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L907-L909 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/views/Projection.java | Projection.fromPixels | public IGeoPoint fromPixels(final int pPixelX, final int pPixelY, final GeoPoint pReuse) {
"""
note: if {@link MapView#setHorizontalMapRepetitionEnabled(boolean)} or
{@link MapView#setVerticalMapRepetitionEnabled(boolean)} is false, then this
can return values that beyond the max extents of the world. This may or may not be
desired. <a href="https://github.com/osmdroid/osmdroid/pull/722">https://github.com/osmdroid/osmdroid/pull/722</a>
for more information and the discussion associated with this.
@param pPixelX
@param pPixelY
@param pReuse
@return
"""
return fromPixels(pPixelX, pPixelY, pReuse, false);
} | java | public IGeoPoint fromPixels(final int pPixelX, final int pPixelY, final GeoPoint pReuse) {
return fromPixels(pPixelX, pPixelY, pReuse, false);
} | [
"public",
"IGeoPoint",
"fromPixels",
"(",
"final",
"int",
"pPixelX",
",",
"final",
"int",
"pPixelY",
",",
"final",
"GeoPoint",
"pReuse",
")",
"{",
"return",
"fromPixels",
"(",
"pPixelX",
",",
"pPixelY",
",",
"pReuse",
",",
"false",
")",
";",
"}"
] | note: if {@link MapView#setHorizontalMapRepetitionEnabled(boolean)} or
{@link MapView#setVerticalMapRepetitionEnabled(boolean)} is false, then this
can return values that beyond the max extents of the world. This may or may not be
desired. <a href="https://github.com/osmdroid/osmdroid/pull/722">https://github.com/osmdroid/osmdroid/pull/722</a>
for more information and the discussion associated with this.
@param pPixelX
@param pPixelY
@param pReuse
@return | [
"note",
":",
"if",
"{"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/Projection.java#L163-L165 |
aws/aws-sdk-java | aws-java-sdk-mediaconvert/src/main/java/com/amazonaws/services/mediaconvert/model/CreateJobTemplateRequest.java | CreateJobTemplateRequest.withTags | public CreateJobTemplateRequest withTags(java.util.Map<String, String> tags) {
"""
The tags that you want to add to the resource. You can tag resources with a key-value pair or with only a key.
@param tags
The tags that you want to add to the resource. You can tag resources with a key-value pair or with only a
key.
@return Returns a reference to this object so that method calls can be chained together.
"""
setTags(tags);
return this;
} | java | public CreateJobTemplateRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"CreateJobTemplateRequest",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | The tags that you want to add to the resource. You can tag resources with a key-value pair or with only a key.
@param tags
The tags that you want to add to the resource. You can tag resources with a key-value pair or with only a
key.
@return Returns a reference to this object so that method calls can be chained together. | [
"The",
"tags",
"that",
"you",
"want",
"to",
"add",
"to",
"the",
"resource",
".",
"You",
"can",
"tag",
"resources",
"with",
"a",
"key",
"-",
"value",
"pair",
"or",
"with",
"only",
"a",
"key",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-mediaconvert/src/main/java/com/amazonaws/services/mediaconvert/model/CreateJobTemplateRequest.java#L370-L373 |
zxing/zxing | core/src/main/java/com/google/zxing/pdf417/PDF417Writer.java | PDF417Writer.bitMatrixFromEncoder | private static BitMatrix bitMatrixFromEncoder(PDF417 encoder,
String contents,
int errorCorrectionLevel,
int width,
int height,
int margin) throws WriterException {
"""
Takes encoder, accounts for width/height, and retrieves bit matrix
"""
encoder.generateBarcodeLogic(contents, errorCorrectionLevel);
int aspectRatio = 4;
byte[][] originalScale = encoder.getBarcodeMatrix().getScaledMatrix(1, aspectRatio);
boolean rotated = false;
if ((height > width) != (originalScale[0].length < originalScale.length)) {
originalScale = rotateArray(originalScale);
rotated = true;
}
int scaleX = width / originalScale[0].length;
int scaleY = height / originalScale.length;
int scale;
if (scaleX < scaleY) {
scale = scaleX;
} else {
scale = scaleY;
}
if (scale > 1) {
byte[][] scaledMatrix =
encoder.getBarcodeMatrix().getScaledMatrix(scale, scale * aspectRatio);
if (rotated) {
scaledMatrix = rotateArray(scaledMatrix);
}
return bitMatrixFromBitArray(scaledMatrix, margin);
}
return bitMatrixFromBitArray(originalScale, margin);
} | java | private static BitMatrix bitMatrixFromEncoder(PDF417 encoder,
String contents,
int errorCorrectionLevel,
int width,
int height,
int margin) throws WriterException {
encoder.generateBarcodeLogic(contents, errorCorrectionLevel);
int aspectRatio = 4;
byte[][] originalScale = encoder.getBarcodeMatrix().getScaledMatrix(1, aspectRatio);
boolean rotated = false;
if ((height > width) != (originalScale[0].length < originalScale.length)) {
originalScale = rotateArray(originalScale);
rotated = true;
}
int scaleX = width / originalScale[0].length;
int scaleY = height / originalScale.length;
int scale;
if (scaleX < scaleY) {
scale = scaleX;
} else {
scale = scaleY;
}
if (scale > 1) {
byte[][] scaledMatrix =
encoder.getBarcodeMatrix().getScaledMatrix(scale, scale * aspectRatio);
if (rotated) {
scaledMatrix = rotateArray(scaledMatrix);
}
return bitMatrixFromBitArray(scaledMatrix, margin);
}
return bitMatrixFromBitArray(originalScale, margin);
} | [
"private",
"static",
"BitMatrix",
"bitMatrixFromEncoder",
"(",
"PDF417",
"encoder",
",",
"String",
"contents",
",",
"int",
"errorCorrectionLevel",
",",
"int",
"width",
",",
"int",
"height",
",",
"int",
"margin",
")",
"throws",
"WriterException",
"{",
"encoder",
... | Takes encoder, accounts for width/height, and retrieves bit matrix | [
"Takes",
"encoder",
"accounts",
"for",
"width",
"/",
"height",
"and",
"retrieves",
"bit",
"matrix"
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/PDF417Writer.java#L101-L136 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_PUT | public void billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_PUT(String billingAccount, String serviceName, Long conditionId, OvhEasyHuntingTimeConditions body) throws IOException {
"""
Alter this object properties
REST: PUT /telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId}
@param body [required] New object properties
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param conditionId [required]
"""
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, conditionId);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_PUT(String billingAccount, String serviceName, Long conditionId, OvhEasyHuntingTimeConditions body) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, conditionId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_PUT",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"conditionId",
",",
"OvhEasyHuntingTimeConditions",
"body",
")",
"throws",
"IOException",
"{",
"Stri... | Alter this object properties
REST: PUT /telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId}
@param body [required] New object properties
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param conditionId [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3341-L3345 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/QueryResult.java | QueryResult.withLastEvaluatedKey | public QueryResult withLastEvaluatedKey(java.util.Map<String, AttributeValue> lastEvaluatedKey) {
"""
<p>
The primary key of the item where the operation stopped, inclusive of the previous result set. Use this value to
start a new operation, excluding this value in the new request.
</p>
<p>
If <code>LastEvaluatedKey</code> is empty, then the "last page" of results has been processed and there is no
more data to be retrieved.
</p>
<p>
If <code>LastEvaluatedKey</code> is not empty, it does not necessarily mean that there is more data in the result
set. The only way to know when you have reached the end of the result set is when <code>LastEvaluatedKey</code>
is empty.
</p>
@param lastEvaluatedKey
The primary key of the item where the operation stopped, inclusive of the previous result set. Use this
value to start a new operation, excluding this value in the new request.</p>
<p>
If <code>LastEvaluatedKey</code> is empty, then the "last page" of results has been processed and there is
no more data to be retrieved.
</p>
<p>
If <code>LastEvaluatedKey</code> is not empty, it does not necessarily mean that there is more data in the
result set. The only way to know when you have reached the end of the result set is when
<code>LastEvaluatedKey</code> is empty.
@return Returns a reference to this object so that method calls can be chained together.
"""
setLastEvaluatedKey(lastEvaluatedKey);
return this;
} | java | public QueryResult withLastEvaluatedKey(java.util.Map<String, AttributeValue> lastEvaluatedKey) {
setLastEvaluatedKey(lastEvaluatedKey);
return this;
} | [
"public",
"QueryResult",
"withLastEvaluatedKey",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"AttributeValue",
">",
"lastEvaluatedKey",
")",
"{",
"setLastEvaluatedKey",
"(",
"lastEvaluatedKey",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The primary key of the item where the operation stopped, inclusive of the previous result set. Use this value to
start a new operation, excluding this value in the new request.
</p>
<p>
If <code>LastEvaluatedKey</code> is empty, then the "last page" of results has been processed and there is no
more data to be retrieved.
</p>
<p>
If <code>LastEvaluatedKey</code> is not empty, it does not necessarily mean that there is more data in the result
set. The only way to know when you have reached the end of the result set is when <code>LastEvaluatedKey</code>
is empty.
</p>
@param lastEvaluatedKey
The primary key of the item where the operation stopped, inclusive of the previous result set. Use this
value to start a new operation, excluding this value in the new request.</p>
<p>
If <code>LastEvaluatedKey</code> is empty, then the "last page" of results has been processed and there is
no more data to be retrieved.
</p>
<p>
If <code>LastEvaluatedKey</code> is not empty, it does not necessarily mean that there is more data in the
result set. The only way to know when you have reached the end of the result set is when
<code>LastEvaluatedKey</code> is empty.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"primary",
"key",
"of",
"the",
"item",
"where",
"the",
"operation",
"stopped",
"inclusive",
"of",
"the",
"previous",
"result",
"set",
".",
"Use",
"this",
"value",
"to",
"start",
"a",
"new",
"operation",
"excluding",
"this",
"value",
"in",... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/QueryResult.java#L431-L434 |
kite-sdk/kite | kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/impl/HBaseUtils.java | HBaseUtils.mergePuts | public static Put mergePuts(byte[] keyBytes, List<Put> putList) {
"""
Given a list of puts, create a new put with the values in each put merged
together. It is expected that no puts have a value for the same fully
qualified column. Return the new put.
@param key
The key of the new put.
@param putList
The list of puts to merge
@return the new Put instance
"""
Put put = new Put(keyBytes);
for (Put putToMerge : putList) {
Map<byte[], List<KeyValue>> familyMap =
(Map<byte[], List<KeyValue>>) GET_FAMILY_MAP_METHOD.invoke(putToMerge);
for (List<KeyValue> keyValueList : familyMap.values()) {
for (KeyValue keyValue : keyValueList) {
// don't use put.add(KeyValue) since it doesn't work with HBase 0.96 onwards
put.add(keyValue.getFamily(), keyValue.getQualifier(),
keyValue.getTimestamp(), keyValue.getValue());
}
}
}
return put;
} | java | public static Put mergePuts(byte[] keyBytes, List<Put> putList) {
Put put = new Put(keyBytes);
for (Put putToMerge : putList) {
Map<byte[], List<KeyValue>> familyMap =
(Map<byte[], List<KeyValue>>) GET_FAMILY_MAP_METHOD.invoke(putToMerge);
for (List<KeyValue> keyValueList : familyMap.values()) {
for (KeyValue keyValue : keyValueList) {
// don't use put.add(KeyValue) since it doesn't work with HBase 0.96 onwards
put.add(keyValue.getFamily(), keyValue.getQualifier(),
keyValue.getTimestamp(), keyValue.getValue());
}
}
}
return put;
} | [
"public",
"static",
"Put",
"mergePuts",
"(",
"byte",
"[",
"]",
"keyBytes",
",",
"List",
"<",
"Put",
">",
"putList",
")",
"{",
"Put",
"put",
"=",
"new",
"Put",
"(",
"keyBytes",
")",
";",
"for",
"(",
"Put",
"putToMerge",
":",
"putList",
")",
"{",
"Ma... | Given a list of puts, create a new put with the values in each put merged
together. It is expected that no puts have a value for the same fully
qualified column. Return the new put.
@param key
The key of the new put.
@param putList
The list of puts to merge
@return the new Put instance | [
"Given",
"a",
"list",
"of",
"puts",
"create",
"a",
"new",
"put",
"with",
"the",
"values",
"in",
"each",
"put",
"merged",
"together",
".",
"It",
"is",
"expected",
"that",
"no",
"puts",
"have",
"a",
"value",
"for",
"the",
"same",
"fully",
"qualified",
"c... | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/impl/HBaseUtils.java#L65-L80 |
awltech/org.parallelj | parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/launching/Launcher.java | Launcher.newLaunch | public <T> Launch<T> newLaunch(Class<? extends T> programClass)
throws LaunchException {
"""
Create a new instance of {@link Launch} for a
{@link org.parallelj.Program Program} execution.
@param programClass
The class of the {@link org.parallelj.Program Program}.
@return a {@link Launch} instance.
@throws LaunchException
"""
return newLaunch(programClass, null);
} | java | public <T> Launch<T> newLaunch(Class<? extends T> programClass)
throws LaunchException {
return newLaunch(programClass, null);
} | [
"public",
"<",
"T",
">",
"Launch",
"<",
"T",
">",
"newLaunch",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"programClass",
")",
"throws",
"LaunchException",
"{",
"return",
"newLaunch",
"(",
"programClass",
",",
"null",
")",
";",
"}"
] | Create a new instance of {@link Launch} for a
{@link org.parallelj.Program Program} execution.
@param programClass
The class of the {@link org.parallelj.Program Program}.
@return a {@link Launch} instance.
@throws LaunchException | [
"Create",
"a",
"new",
"instance",
"of",
"{",
"@link",
"Launch",
"}",
"for",
"a",
"{",
"@link",
"org",
".",
"parallelj",
".",
"Program",
"Program",
"}",
"execution",
"."
] | train | https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/launching/Launcher.java#L69-L72 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_option_option_DELETE | public void serviceName_option_option_DELETE(String serviceName, net.minidev.ovh.api.dedicated.server.OvhOptionEnum option) throws IOException {
"""
Release a given option
REST: DELETE /dedicated/server/{serviceName}/option/{option}
@param serviceName [required] The internal name of your dedicated server
@param option [required] The option name
"""
String qPath = "/dedicated/server/{serviceName}/option/{option}";
StringBuilder sb = path(qPath, serviceName, option);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void serviceName_option_option_DELETE(String serviceName, net.minidev.ovh.api.dedicated.server.OvhOptionEnum option) throws IOException {
String qPath = "/dedicated/server/{serviceName}/option/{option}";
StringBuilder sb = path(qPath, serviceName, option);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"serviceName_option_option_DELETE",
"(",
"String",
"serviceName",
",",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"dedicated",
".",
"server",
".",
"OvhOptionEnum",
"option",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
... | Release a given option
REST: DELETE /dedicated/server/{serviceName}/option/{option}
@param serviceName [required] The internal name of your dedicated server
@param option [required] The option name | [
"Release",
"a",
"given",
"option"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1571-L1575 |
michael-rapp/AndroidUtil | library/src/main/java/de/mrapp/android/util/view/ExpandableGridView.java | ExpandableGridView.createItemLongClickListener | private OnItemLongClickListener createItemLongClickListener() {
"""
Creates and returns a listener, which allows to delegate, when any item of the grid view has
been long-clicked, to the appropriate listeners.
@return The listener, which has been created, as an instance of the type {@link
OnItemLongClickListener}
"""
return new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position,
long id) {
Pair<Integer, Integer> itemPosition =
getItemPosition(position - getHeaderViewsCount());
int groupIndex = itemPosition.first;
int childIndex = itemPosition.second;
long packedId;
if (childIndex != -1) {
packedId = getPackedPositionForChild(groupIndex, childIndex);
} else if (groupIndex != -1) {
packedId = getPackedPositionForGroup(groupIndex);
} else {
packedId = getPackedPositionForChild(Integer.MAX_VALUE, position);
}
return notifyOnItemLongClicked(view, getPackedPosition(position), packedId);
}
};
} | java | private OnItemLongClickListener createItemLongClickListener() {
return new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position,
long id) {
Pair<Integer, Integer> itemPosition =
getItemPosition(position - getHeaderViewsCount());
int groupIndex = itemPosition.first;
int childIndex = itemPosition.second;
long packedId;
if (childIndex != -1) {
packedId = getPackedPositionForChild(groupIndex, childIndex);
} else if (groupIndex != -1) {
packedId = getPackedPositionForGroup(groupIndex);
} else {
packedId = getPackedPositionForChild(Integer.MAX_VALUE, position);
}
return notifyOnItemLongClicked(view, getPackedPosition(position), packedId);
}
};
} | [
"private",
"OnItemLongClickListener",
"createItemLongClickListener",
"(",
")",
"{",
"return",
"new",
"OnItemLongClickListener",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"onItemLongClick",
"(",
"AdapterView",
"<",
"?",
">",
"parent",
",",
"View",
"view",
... | Creates and returns a listener, which allows to delegate, when any item of the grid view has
been long-clicked, to the appropriate listeners.
@return The listener, which has been created, as an instance of the type {@link
OnItemLongClickListener} | [
"Creates",
"and",
"returns",
"a",
"listener",
"which",
"allows",
"to",
"delegate",
"when",
"any",
"item",
"of",
"the",
"grid",
"view",
"has",
"been",
"long",
"-",
"clicked",
"to",
"the",
"appropriate",
"listeners",
"."
] | train | https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/view/ExpandableGridView.java#L362-L386 |
algolia/instantsearch-android | core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java | Searcher.addFacetRefinement | @SuppressWarnings( {
"""
Adds a facet refinement for the next queries.
<p>
<b>This method resets the current page to 0.</b>
@param attribute the facet name.
@param values an eventual list of values to refine on.
@param isDisjunctive if {@code true}, the facet will be added as a disjunctive facet.
""""WeakerAccess", "unused"}) // For library users
public Searcher addFacetRefinement(@NonNull String attribute, @Nullable List<String> values, boolean isDisjunctive) {
if (values == null) {
values = new ArrayList<>();
}
if (isDisjunctive) {
disjunctiveFacets.add(attribute);
}
List<String> attributeRefinements = getOrCreateRefinements(attribute);
attributeRefinements.addAll(values);
rebuildQueryFacetFilters();
for (String value : values) {
EventBus.getDefault().post(new FacetRefinementEvent(this, ADD, attribute, value, isDisjunctive));
}
return this;
} | java | @SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public Searcher addFacetRefinement(@NonNull String attribute, @Nullable List<String> values, boolean isDisjunctive) {
if (values == null) {
values = new ArrayList<>();
}
if (isDisjunctive) {
disjunctiveFacets.add(attribute);
}
List<String> attributeRefinements = getOrCreateRefinements(attribute);
attributeRefinements.addAll(values);
rebuildQueryFacetFilters();
for (String value : values) {
EventBus.getDefault().post(new FacetRefinementEvent(this, ADD, attribute, value, isDisjunctive));
}
return this;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"WeakerAccess\"",
",",
"\"unused\"",
"}",
")",
"// For library users",
"public",
"Searcher",
"addFacetRefinement",
"(",
"@",
"NonNull",
"String",
"attribute",
",",
"@",
"Nullable",
"List",
"<",
"String",
">",
"values",
",",
"... | Adds a facet refinement for the next queries.
<p>
<b>This method resets the current page to 0.</b>
@param attribute the facet name.
@param values an eventual list of values to refine on.
@param isDisjunctive if {@code true}, the facet will be added as a disjunctive facet. | [
"Adds",
"a",
"facet",
"refinement",
"for",
"the",
"next",
"queries",
".",
"<p",
">",
"<b",
">",
"This",
"method",
"resets",
"the",
"current",
"page",
"to",
"0",
".",
"<",
"/",
"b",
">"
] | train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java#L562-L577 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Flowable.java | Flowable.concatMapCompletable | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
@BackpressureSupport(BackpressureKind.FULL)
public final Completable concatMapCompletable(Function<? super T, ? extends CompletableSource> mapper, int prefetch) {
"""
Maps the upstream items into {@link CompletableSource}s and subscribes to them one after the
other completes.
<p>
<img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/concatMap.png" alt="">
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator expects the upstream to support backpressure. If this {@code Flowable} violates the rule, the operator will
signal a {@code MissingBackpressureException}.</dd>
<dt><b>Scheduler:</b></dt>
<dd>{@code concatMapCompletable} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
<p>History: 2.1.11 - experimental
@param mapper the function called with the upstream item and should return
a {@code CompletableSource} to become the next source to
be subscribed to
@param prefetch The number of upstream items to prefetch so that fresh items are
ready to be mapped when a previous {@code CompletableSource} terminates.
The operator replenishes after half of the prefetch amount has been consumed
and turned into {@code CompletableSource}s.
@return a new Completable instance
@see #concatMapCompletableDelayError(Function, boolean, int)
@since 2.2
"""
ObjectHelper.requireNonNull(mapper, "mapper is null");
ObjectHelper.verifyPositive(prefetch, "prefetch");
return RxJavaPlugins.onAssembly(new FlowableConcatMapCompletable<T>(this, mapper, ErrorMode.IMMEDIATE, prefetch));
} | java | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
@BackpressureSupport(BackpressureKind.FULL)
public final Completable concatMapCompletable(Function<? super T, ? extends CompletableSource> mapper, int prefetch) {
ObjectHelper.requireNonNull(mapper, "mapper is null");
ObjectHelper.verifyPositive(prefetch, "prefetch");
return RxJavaPlugins.onAssembly(new FlowableConcatMapCompletable<T>(this, mapper, ErrorMode.IMMEDIATE, prefetch));
} | [
"@",
"CheckReturnValue",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"@",
"BackpressureSupport",
"(",
"BackpressureKind",
".",
"FULL",
")",
"public",
"final",
"Completable",
"concatMapCompletable",
"(",
"Function",
"<",
"?",
"super",
"T",
"... | Maps the upstream items into {@link CompletableSource}s and subscribes to them one after the
other completes.
<p>
<img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/concatMap.png" alt="">
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator expects the upstream to support backpressure. If this {@code Flowable} violates the rule, the operator will
signal a {@code MissingBackpressureException}.</dd>
<dt><b>Scheduler:</b></dt>
<dd>{@code concatMapCompletable} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
<p>History: 2.1.11 - experimental
@param mapper the function called with the upstream item and should return
a {@code CompletableSource} to become the next source to
be subscribed to
@param prefetch The number of upstream items to prefetch so that fresh items are
ready to be mapped when a previous {@code CompletableSource} terminates.
The operator replenishes after half of the prefetch amount has been consumed
and turned into {@code CompletableSource}s.
@return a new Completable instance
@see #concatMapCompletableDelayError(Function, boolean, int)
@since 2.2 | [
"Maps",
"the",
"upstream",
"items",
"into",
"{"
] | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L7182-L7189 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/core/ServerParams.java | ServerParams.getModuleParam | public Object getModuleParam(String moduleName, String paramName) {
"""
Get the value of the given parameter name belonging to the given module name. If
no such module/parameter name is known, null is returned. Otherwise, the parsed
parameter is returned as an Object. This may be a String, Map, or List depending
on the parameter's structure.
@param moduleName Name of module to get parameter for.
@param paramName Name of parameter to get value of.
@return Parameter value as an Object or null if unknown.
"""
Map<String, Object> moduleParams = getModuleParams(moduleName);
if (moduleParams == null) {
return null;
}
return moduleParams.get(paramName);
} | java | public Object getModuleParam(String moduleName, String paramName) {
Map<String, Object> moduleParams = getModuleParams(moduleName);
if (moduleParams == null) {
return null;
}
return moduleParams.get(paramName);
} | [
"public",
"Object",
"getModuleParam",
"(",
"String",
"moduleName",
",",
"String",
"paramName",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"moduleParams",
"=",
"getModuleParams",
"(",
"moduleName",
")",
";",
"if",
"(",
"moduleParams",
"==",
"null",
"... | Get the value of the given parameter name belonging to the given module name. If
no such module/parameter name is known, null is returned. Otherwise, the parsed
parameter is returned as an Object. This may be a String, Map, or List depending
on the parameter's structure.
@param moduleName Name of module to get parameter for.
@param paramName Name of parameter to get value of.
@return Parameter value as an Object or null if unknown. | [
"Get",
"the",
"value",
"of",
"the",
"given",
"parameter",
"name",
"belonging",
"to",
"the",
"given",
"module",
"name",
".",
"If",
"no",
"such",
"module",
"/",
"parameter",
"name",
"is",
"known",
"null",
"is",
"returned",
".",
"Otherwise",
"the",
"parsed",
... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/core/ServerParams.java#L295-L301 |
sarxos/webcam-capture | webcam-capture/src/main/java/com/github/sarxos/webcam/Webcam.java | Webcam.getWebcams | public static List<Webcam> getWebcams(long timeout) throws TimeoutException, WebcamException {
"""
Get list of webcams to use. This method will wait given time interval for webcam devices to
be discovered. Time argument is given in milliseconds.
@param timeout the time to wait for webcam devices to be discovered
@return List of webcams existing in the ssytem
@throws TimeoutException when timeout occurs
@throws WebcamException when something is wrong
@throws IllegalArgumentException when timeout is negative
@see Webcam#getWebcams(long, TimeUnit)
"""
if (timeout < 0) {
throw new IllegalArgumentException(String.format("Timeout cannot be negative (%d)", timeout));
}
return getWebcams(timeout, TimeUnit.MILLISECONDS);
} | java | public static List<Webcam> getWebcams(long timeout) throws TimeoutException, WebcamException {
if (timeout < 0) {
throw new IllegalArgumentException(String.format("Timeout cannot be negative (%d)", timeout));
}
return getWebcams(timeout, TimeUnit.MILLISECONDS);
} | [
"public",
"static",
"List",
"<",
"Webcam",
">",
"getWebcams",
"(",
"long",
"timeout",
")",
"throws",
"TimeoutException",
",",
"WebcamException",
"{",
"if",
"(",
"timeout",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"f... | Get list of webcams to use. This method will wait given time interval for webcam devices to
be discovered. Time argument is given in milliseconds.
@param timeout the time to wait for webcam devices to be discovered
@return List of webcams existing in the ssytem
@throws TimeoutException when timeout occurs
@throws WebcamException when something is wrong
@throws IllegalArgumentException when timeout is negative
@see Webcam#getWebcams(long, TimeUnit) | [
"Get",
"list",
"of",
"webcams",
"to",
"use",
".",
"This",
"method",
"will",
"wait",
"given",
"time",
"interval",
"for",
"webcam",
"devices",
"to",
"be",
"discovered",
".",
"Time",
"argument",
"is",
"given",
"in",
"milliseconds",
"."
] | train | https://github.com/sarxos/webcam-capture/blob/efbdae04f9ba48db9ec621e94a9bcd6f031882c8/webcam-capture/src/main/java/com/github/sarxos/webcam/Webcam.java#L862-L867 |
kiegroup/drools | kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/lang/impl/FEELImpl.java | FEELImpl.newEvaluationContext | public EvaluationContextImpl newEvaluationContext(ClassLoader cl, Collection<FEELEventListener> listeners, Map<String, Object> inputVariables) {
"""
Creates a new EvaluationContext with the supplied classloader, and the supplied parameters listeners and inputVariables
"""
FEELEventListenersManager eventsManager = getEventsManager(listeners);
EvaluationContextImpl ctx = new EvaluationContextImpl(cl, eventsManager, inputVariables.size());
if (customFrame.isPresent()) {
ExecutionFrameImpl globalFrame = (ExecutionFrameImpl) ctx.pop();
ExecutionFrameImpl interveawedFrame = customFrame.get();
interveawedFrame.setParentFrame(ctx.peek());
globalFrame.setParentFrame(interveawedFrame);
ctx.push(interveawedFrame);
ctx.push(globalFrame);
}
ctx.setValues(inputVariables);
return ctx;
} | java | public EvaluationContextImpl newEvaluationContext(ClassLoader cl, Collection<FEELEventListener> listeners, Map<String, Object> inputVariables) {
FEELEventListenersManager eventsManager = getEventsManager(listeners);
EvaluationContextImpl ctx = new EvaluationContextImpl(cl, eventsManager, inputVariables.size());
if (customFrame.isPresent()) {
ExecutionFrameImpl globalFrame = (ExecutionFrameImpl) ctx.pop();
ExecutionFrameImpl interveawedFrame = customFrame.get();
interveawedFrame.setParentFrame(ctx.peek());
globalFrame.setParentFrame(interveawedFrame);
ctx.push(interveawedFrame);
ctx.push(globalFrame);
}
ctx.setValues(inputVariables);
return ctx;
} | [
"public",
"EvaluationContextImpl",
"newEvaluationContext",
"(",
"ClassLoader",
"cl",
",",
"Collection",
"<",
"FEELEventListener",
">",
"listeners",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"inputVariables",
")",
"{",
"FEELEventListenersManager",
"eventsManager",
... | Creates a new EvaluationContext with the supplied classloader, and the supplied parameters listeners and inputVariables | [
"Creates",
"a",
"new",
"EvaluationContext",
"with",
"the",
"supplied",
"classloader",
"and",
"the",
"supplied",
"parameters",
"listeners",
"and",
"inputVariables"
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/lang/impl/FEELImpl.java#L177-L190 |
aws/aws-sdk-java | aws-java-sdk-glacier/src/main/java/com/amazonaws/services/glacier/model/S3Location.java | S3Location.withTagging | public S3Location withTagging(java.util.Map<String, String> tagging) {
"""
<p>
The tag-set that is applied to the job results.
</p>
@param tagging
The tag-set that is applied to the job results.
@return Returns a reference to this object so that method calls can be chained together.
"""
setTagging(tagging);
return this;
} | java | public S3Location withTagging(java.util.Map<String, String> tagging) {
setTagging(tagging);
return this;
} | [
"public",
"S3Location",
"withTagging",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tagging",
")",
"{",
"setTagging",
"(",
"tagging",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The tag-set that is applied to the job results.
</p>
@param tagging
The tag-set that is applied to the job results.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"tag",
"-",
"set",
"that",
"is",
"applied",
"to",
"the",
"job",
"results",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glacier/src/main/java/com/amazonaws/services/glacier/model/S3Location.java#L361-L364 |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java | DefaultElementProducer.createAnchor | public Anchor createAnchor(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException {
"""
Create a Anchor, style it and add the data
@param data
@param stylers
@return
@throws VectorPrintException
"""
return initTextElementArray(styleHelper.style(new Anchor(Float.NaN), data, stylers), data, stylers);
} | java | public Anchor createAnchor(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException {
return initTextElementArray(styleHelper.style(new Anchor(Float.NaN), data, stylers), data, stylers);
} | [
"public",
"Anchor",
"createAnchor",
"(",
"Object",
"data",
",",
"Collection",
"<",
"?",
"extends",
"BaseStyler",
">",
"stylers",
")",
"throws",
"VectorPrintException",
"{",
"return",
"initTextElementArray",
"(",
"styleHelper",
".",
"style",
"(",
"new",
"Anchor",
... | Create a Anchor, style it and add the data
@param data
@param stylers
@return
@throws VectorPrintException | [
"Create",
"a",
"Anchor",
"style",
"it",
"and",
"add",
"the",
"data"
] | train | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L237-L239 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/property/PropertyAccessorHelper.java | PropertyAccessorHelper.getString | public static String getString(Object from, Field field) {
"""
Gets the string.
@param from
the from
@param field
the field
@return the string
@throws PropertyAccessException
the property access exception
"""
PropertyAccessor<?> accessor = PropertyAccessorFactory.getPropertyAccessor(field);
Object object = getObject(from, field);
return object != null ? accessor.toString(object) : null;
} | java | public static String getString(Object from, Field field)
{
PropertyAccessor<?> accessor = PropertyAccessorFactory.getPropertyAccessor(field);
Object object = getObject(from, field);
return object != null ? accessor.toString(object) : null;
} | [
"public",
"static",
"String",
"getString",
"(",
"Object",
"from",
",",
"Field",
"field",
")",
"{",
"PropertyAccessor",
"<",
"?",
">",
"accessor",
"=",
"PropertyAccessorFactory",
".",
"getPropertyAccessor",
"(",
"field",
")",
";",
"Object",
"object",
"=",
"getO... | Gets the string.
@param from
the from
@param field
the field
@return the string
@throws PropertyAccessException
the property access exception | [
"Gets",
"the",
"string",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/property/PropertyAccessorHelper.java#L193-L198 |
thombergs/docx-stamper | src/main/java/org/wickedsource/docxstamper/util/RunUtil.java | RunUtil.setText | public static void setText(R run, String text) {
"""
Sets the text of the given run to the given value.
@param run the run whose text to change.
@param text the text to set.
"""
run.getContent().clear();
Text textObj = factory.createText();
textObj.setSpace("preserve");
textObj.setValue(text);
textObj.setSpace("preserve"); // make the text preserve spaces
run.getContent().add(textObj);
} | java | public static void setText(R run, String text) {
run.getContent().clear();
Text textObj = factory.createText();
textObj.setSpace("preserve");
textObj.setValue(text);
textObj.setSpace("preserve"); // make the text preserve spaces
run.getContent().add(textObj);
} | [
"public",
"static",
"void",
"setText",
"(",
"R",
"run",
",",
"String",
"text",
")",
"{",
"run",
".",
"getContent",
"(",
")",
".",
"clear",
"(",
")",
";",
"Text",
"textObj",
"=",
"factory",
".",
"createText",
"(",
")",
";",
"textObj",
".",
"setSpace",... | Sets the text of the given run to the given value.
@param run the run whose text to change.
@param text the text to set. | [
"Sets",
"the",
"text",
"of",
"the",
"given",
"run",
"to",
"the",
"given",
"value",
"."
] | train | https://github.com/thombergs/docx-stamper/blob/f1a7e3e92a59abaffac299532fe49450c3b041eb/src/main/java/org/wickedsource/docxstamper/util/RunUtil.java#L67-L74 |
alipay/sofa-rpc | core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AllConnectConnectionHolder.java | AllConnectConnectionHolder.subHealthToRetry | protected void subHealthToRetry(ProviderInfo providerInfo, ClientTransport transport) {
"""
从亚健康丢到重试列表
@param providerInfo Provider
@param transport 连接
"""
providerLock.lock();
try {
if (subHealthConnections.remove(providerInfo) != null) {
retryConnections.put(providerInfo, transport);
}
} finally {
providerLock.unlock();
}
} | java | protected void subHealthToRetry(ProviderInfo providerInfo, ClientTransport transport) {
providerLock.lock();
try {
if (subHealthConnections.remove(providerInfo) != null) {
retryConnections.put(providerInfo, transport);
}
} finally {
providerLock.unlock();
}
} | [
"protected",
"void",
"subHealthToRetry",
"(",
"ProviderInfo",
"providerInfo",
",",
"ClientTransport",
"transport",
")",
"{",
"providerLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"subHealthConnections",
".",
"remove",
"(",
"providerInfo",
")",
"!=",... | 从亚健康丢到重试列表
@param providerInfo Provider
@param transport 连接 | [
"从亚健康丢到重试列表"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AllConnectConnectionHolder.java#L234-L243 |
ngageoint/geopackage-java | src/main/java/mil/nga/geopackage/property/GeoPackageJavaProperties.java | GeoPackageJavaProperties.getColorProperty | public static Color getColorProperty(String key, boolean required) {
"""
Get a color by key
@param key
key
@param required
required flag
@return property value
"""
Color value = null;
String redProperty = key + JavaPropertyConstants.PROPERTY_DIVIDER
+ JavaPropertyConstants.COLOR_RED;
String greenProperty = key + JavaPropertyConstants.PROPERTY_DIVIDER
+ JavaPropertyConstants.COLOR_GREEN;
String blueProperty = key + JavaPropertyConstants.PROPERTY_DIVIDER
+ JavaPropertyConstants.COLOR_BLUE;
String alphaProperty = key + JavaPropertyConstants.PROPERTY_DIVIDER
+ JavaPropertyConstants.COLOR_ALPHA;
Integer red = getIntegerProperty(redProperty, required);
Integer green = getIntegerProperty(greenProperty, required);
Integer blue = getIntegerProperty(blueProperty, required);
Integer alpha = getIntegerProperty(alphaProperty, required);
if (red != null && green != null && blue != null && alpha != null) {
value = new Color(red, green, blue, alpha);
}
return value;
} | java | public static Color getColorProperty(String key, boolean required) {
Color value = null;
String redProperty = key + JavaPropertyConstants.PROPERTY_DIVIDER
+ JavaPropertyConstants.COLOR_RED;
String greenProperty = key + JavaPropertyConstants.PROPERTY_DIVIDER
+ JavaPropertyConstants.COLOR_GREEN;
String blueProperty = key + JavaPropertyConstants.PROPERTY_DIVIDER
+ JavaPropertyConstants.COLOR_BLUE;
String alphaProperty = key + JavaPropertyConstants.PROPERTY_DIVIDER
+ JavaPropertyConstants.COLOR_ALPHA;
Integer red = getIntegerProperty(redProperty, required);
Integer green = getIntegerProperty(greenProperty, required);
Integer blue = getIntegerProperty(blueProperty, required);
Integer alpha = getIntegerProperty(alphaProperty, required);
if (red != null && green != null && blue != null && alpha != null) {
value = new Color(red, green, blue, alpha);
}
return value;
} | [
"public",
"static",
"Color",
"getColorProperty",
"(",
"String",
"key",
",",
"boolean",
"required",
")",
"{",
"Color",
"value",
"=",
"null",
";",
"String",
"redProperty",
"=",
"key",
"+",
"JavaPropertyConstants",
".",
"PROPERTY_DIVIDER",
"+",
"JavaPropertyConstants... | Get a color by key
@param key
key
@param required
required flag
@return property value | [
"Get",
"a",
"color",
"by",
"key"
] | train | https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/property/GeoPackageJavaProperties.java#L287-L308 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/multilayer/MultiLayerNetwork.java | MultiLayerNetwork.calculateGradients | public Pair<Gradient,INDArray> calculateGradients(@NonNull INDArray features, @NonNull INDArray label,
INDArray fMask, INDArray labelMask) {
"""
Calculate parameter gradients and input activation gradients given the input and labels, and optionally mask arrays
@param features Features for gradient calculation
@param label Labels for gradient
@param fMask Features mask array (may be null)
@param labelMask Label mask array (may be null)
@return A pair of gradient arrays: parameter gradients (in Gradient object) and input activation gradients
"""
try{
return calculateGradientsHelper(features, label, fMask, labelMask);
} catch (OutOfMemoryError e){
CrashReportingUtil.writeMemoryCrashDump(this, e);
throw e;
}
} | java | public Pair<Gradient,INDArray> calculateGradients(@NonNull INDArray features, @NonNull INDArray label,
INDArray fMask, INDArray labelMask) {
try{
return calculateGradientsHelper(features, label, fMask, labelMask);
} catch (OutOfMemoryError e){
CrashReportingUtil.writeMemoryCrashDump(this, e);
throw e;
}
} | [
"public",
"Pair",
"<",
"Gradient",
",",
"INDArray",
">",
"calculateGradients",
"(",
"@",
"NonNull",
"INDArray",
"features",
",",
"@",
"NonNull",
"INDArray",
"label",
",",
"INDArray",
"fMask",
",",
"INDArray",
"labelMask",
")",
"{",
"try",
"{",
"return",
"cal... | Calculate parameter gradients and input activation gradients given the input and labels, and optionally mask arrays
@param features Features for gradient calculation
@param label Labels for gradient
@param fMask Features mask array (may be null)
@param labelMask Label mask array (may be null)
@return A pair of gradient arrays: parameter gradients (in Gradient object) and input activation gradients | [
"Calculate",
"parameter",
"gradients",
"and",
"input",
"activation",
"gradients",
"given",
"the",
"input",
"and",
"labels",
"and",
"optionally",
"mask",
"arrays"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/multilayer/MultiLayerNetwork.java#L1708-L1716 |
lessthanoptimal/BoofCV | integration/boofcv-ffmpeg/src/main/java/org/bytedeco/copiedstuff/Java2DFrameConverter.java | Java2DFrameConverter.getFrame | public Frame getFrame(BufferedImage image, double gamma, boolean flipChannels) {
"""
Returns a Frame based on a BufferedImage, given gamma, and inverted channels flag.
"""
if (image == null) {
return null;
}
SampleModel sm = image.getSampleModel();
int depth = 0, numChannels = sm.getNumBands();
switch (image.getType()) {
case BufferedImage.TYPE_INT_RGB:
case BufferedImage.TYPE_INT_ARGB:
case BufferedImage.TYPE_INT_ARGB_PRE:
case BufferedImage.TYPE_INT_BGR:
depth = Frame.DEPTH_UBYTE;
numChannels = 4;
break;
}
if (depth == 0 || numChannels == 0) {
switch (sm.getDataType()) {
case DataBuffer.TYPE_BYTE: depth = Frame.DEPTH_UBYTE; break;
case DataBuffer.TYPE_USHORT: depth = Frame.DEPTH_USHORT; break;
case DataBuffer.TYPE_SHORT: depth = Frame.DEPTH_SHORT; break;
case DataBuffer.TYPE_INT: depth = Frame.DEPTH_INT; break;
case DataBuffer.TYPE_FLOAT: depth = Frame.DEPTH_FLOAT; break;
case DataBuffer.TYPE_DOUBLE: depth = Frame.DEPTH_DOUBLE; break;
default: assert false;
}
}
if (frame == null || frame.imageWidth != image.getWidth() || frame.imageHeight != image.getHeight()
|| frame.imageDepth != depth || frame.imageChannels != numChannels) {
frame = new Frame(image.getWidth(), image.getHeight(), depth, numChannels);
}
copy(image, frame, gamma, flipChannels, null);
return frame;
} | java | public Frame getFrame(BufferedImage image, double gamma, boolean flipChannels) {
if (image == null) {
return null;
}
SampleModel sm = image.getSampleModel();
int depth = 0, numChannels = sm.getNumBands();
switch (image.getType()) {
case BufferedImage.TYPE_INT_RGB:
case BufferedImage.TYPE_INT_ARGB:
case BufferedImage.TYPE_INT_ARGB_PRE:
case BufferedImage.TYPE_INT_BGR:
depth = Frame.DEPTH_UBYTE;
numChannels = 4;
break;
}
if (depth == 0 || numChannels == 0) {
switch (sm.getDataType()) {
case DataBuffer.TYPE_BYTE: depth = Frame.DEPTH_UBYTE; break;
case DataBuffer.TYPE_USHORT: depth = Frame.DEPTH_USHORT; break;
case DataBuffer.TYPE_SHORT: depth = Frame.DEPTH_SHORT; break;
case DataBuffer.TYPE_INT: depth = Frame.DEPTH_INT; break;
case DataBuffer.TYPE_FLOAT: depth = Frame.DEPTH_FLOAT; break;
case DataBuffer.TYPE_DOUBLE: depth = Frame.DEPTH_DOUBLE; break;
default: assert false;
}
}
if (frame == null || frame.imageWidth != image.getWidth() || frame.imageHeight != image.getHeight()
|| frame.imageDepth != depth || frame.imageChannels != numChannels) {
frame = new Frame(image.getWidth(), image.getHeight(), depth, numChannels);
}
copy(image, frame, gamma, flipChannels, null);
return frame;
} | [
"public",
"Frame",
"getFrame",
"(",
"BufferedImage",
"image",
",",
"double",
"gamma",
",",
"boolean",
"flipChannels",
")",
"{",
"if",
"(",
"image",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"SampleModel",
"sm",
"=",
"image",
".",
"getSampleModel"... | Returns a Frame based on a BufferedImage, given gamma, and inverted channels flag. | [
"Returns",
"a",
"Frame",
"based",
"on",
"a",
"BufferedImage",
"given",
"gamma",
"and",
"inverted",
"channels",
"flag",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-ffmpeg/src/main/java/org/bytedeco/copiedstuff/Java2DFrameConverter.java#L680-L712 |
operasoftware/operaprestodriver | src/com/opera/core/systems/arguments/OperaArgument.java | OperaArgument.hasSwitch | private static Boolean hasSwitch(String key, String sign) {
"""
Determines whether given argument key contains given argument sign.
@param key the argument key to check
@param sign the sign to check for
@return true if key contains sign as first characters, false otherwise
@see OperaArgumentSign
"""
return (key.length() > sign.length()) && key.substring(0, sign.length()).equals(sign);
} | java | private static Boolean hasSwitch(String key, String sign) {
return (key.length() > sign.length()) && key.substring(0, sign.length()).equals(sign);
} | [
"private",
"static",
"Boolean",
"hasSwitch",
"(",
"String",
"key",
",",
"String",
"sign",
")",
"{",
"return",
"(",
"key",
".",
"length",
"(",
")",
">",
"sign",
".",
"length",
"(",
")",
")",
"&&",
"key",
".",
"substring",
"(",
"0",
",",
"sign",
".",... | Determines whether given argument key contains given argument sign.
@param key the argument key to check
@param sign the sign to check for
@return true if key contains sign as first characters, false otherwise
@see OperaArgumentSign | [
"Determines",
"whether",
"given",
"argument",
"key",
"contains",
"given",
"argument",
"sign",
"."
] | train | https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/arguments/OperaArgument.java#L137-L139 |
zaproxy/zaproxy | src/org/zaproxy/zap/view/StandardFieldsDialog.java | StandardFieldsDialog.createTabScrollable | protected JScrollPane createTabScrollable(String tabLabel, JPanel tabPanel) {
"""
Creates and returns a {@link JScrollPane} for the given panel. Called when a tab is
{@link #setTabScrollable(String, boolean) set to be scrollable}.
<p>
By default this method returns a {@code JScrollPane} that has the vertical and horizontal scrollbars shown as needed.
@param tabLabel the label of the tab, as set during construction of the dialogue.
@param tabPanel the panel of the tab that should be scrollable, never {@code null}.
@return the JScrollPane
@since 2.7.0
"""
return new JScrollPane(tabPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
} | java | protected JScrollPane createTabScrollable(String tabLabel, JPanel tabPanel) {
return new JScrollPane(tabPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
} | [
"protected",
"JScrollPane",
"createTabScrollable",
"(",
"String",
"tabLabel",
",",
"JPanel",
"tabPanel",
")",
"{",
"return",
"new",
"JScrollPane",
"(",
"tabPanel",
",",
"JScrollPane",
".",
"VERTICAL_SCROLLBAR_AS_NEEDED",
",",
"JScrollPane",
".",
"HORIZONTAL_SCROLLBAR_AS... | Creates and returns a {@link JScrollPane} for the given panel. Called when a tab is
{@link #setTabScrollable(String, boolean) set to be scrollable}.
<p>
By default this method returns a {@code JScrollPane} that has the vertical and horizontal scrollbars shown as needed.
@param tabLabel the label of the tab, as set during construction of the dialogue.
@param tabPanel the panel of the tab that should be scrollable, never {@code null}.
@return the JScrollPane
@since 2.7.0 | [
"Creates",
"and",
"returns",
"a",
"{",
"@link",
"JScrollPane",
"}",
"for",
"the",
"given",
"panel",
".",
"Called",
"when",
"a",
"tab",
"is",
"{",
"@link",
"#setTabScrollable",
"(",
"String",
"boolean",
")",
"set",
"to",
"be",
"scrollable",
"}",
".",
"<p"... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/view/StandardFieldsDialog.java#L1939-L1941 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JawrApplicationConfigManager.java | JawrApplicationConfigManager.getStringValue | public String getStringValue(String property) {
"""
Returns the string value of the configuration managers
@param property
the property to retrieve
@return the string value of the configuration managers
"""
final List<JawrConfigManagerMBean> mBeans = getInitializedConfigurationManagers();
try {
if (mBeans.size() == 3) {
if (areEquals(getProperty(jsMBean, property), getProperty(cssMBean, property),
getProperty(binaryMBean, property))) {
return getProperty(jsMBean, property);
} else {
return NOT_IDENTICAL_VALUES;
}
}
if (mBeans.size() == 2) {
JawrConfigManagerMBean mBean1 = mBeans.get(0);
JawrConfigManagerMBean mBean2 = mBeans.get(1);
if (areEquals(getProperty(mBean1, property), getProperty(mBean2, property))) {
return getProperty(mBean1, property);
} else {
return NOT_IDENTICAL_VALUES;
}
}
JawrConfigManagerMBean mBean1 = mBeans.get(0);
return getProperty(mBean1, property);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
return ERROR_VALUE;
}
} | java | public String getStringValue(String property) {
final List<JawrConfigManagerMBean> mBeans = getInitializedConfigurationManagers();
try {
if (mBeans.size() == 3) {
if (areEquals(getProperty(jsMBean, property), getProperty(cssMBean, property),
getProperty(binaryMBean, property))) {
return getProperty(jsMBean, property);
} else {
return NOT_IDENTICAL_VALUES;
}
}
if (mBeans.size() == 2) {
JawrConfigManagerMBean mBean1 = mBeans.get(0);
JawrConfigManagerMBean mBean2 = mBeans.get(1);
if (areEquals(getProperty(mBean1, property), getProperty(mBean2, property))) {
return getProperty(mBean1, property);
} else {
return NOT_IDENTICAL_VALUES;
}
}
JawrConfigManagerMBean mBean1 = mBeans.get(0);
return getProperty(mBean1, property);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
return ERROR_VALUE;
}
} | [
"public",
"String",
"getStringValue",
"(",
"String",
"property",
")",
"{",
"final",
"List",
"<",
"JawrConfigManagerMBean",
">",
"mBeans",
"=",
"getInitializedConfigurationManagers",
"(",
")",
";",
"try",
"{",
"if",
"(",
"mBeans",
".",
"size",
"(",
")",
"==",
... | Returns the string value of the configuration managers
@param property
the property to retrieve
@return the string value of the configuration managers | [
"Returns",
"the",
"string",
"value",
"of",
"the",
"configuration",
"managers"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JawrApplicationConfigManager.java#L512-L547 |
d-sauer/JCalcAPI | src/main/java/org/jdice/calc/Properties.java | Properties.getInheritedScale | public static int getInheritedScale(AbstractCalculator calc, Num value) {
"""
If {@link Num} don't define scale then use scale from {@link AbstractCalculator} instance.
Othervise use default scale {@link Properties#DEFAULT_SCALE}
@param calc
@param value
"""
if (value.getScale() == null) {
if (calc != null && calc.getScale() != null)
return calc.getScale();
else
return Properties.DEFAULT_SCALE;
}
else
return value.getScale();
} | java | public static int getInheritedScale(AbstractCalculator calc, Num value) {
if (value.getScale() == null) {
if (calc != null && calc.getScale() != null)
return calc.getScale();
else
return Properties.DEFAULT_SCALE;
}
else
return value.getScale();
} | [
"public",
"static",
"int",
"getInheritedScale",
"(",
"AbstractCalculator",
"calc",
",",
"Num",
"value",
")",
"{",
"if",
"(",
"value",
".",
"getScale",
"(",
")",
"==",
"null",
")",
"{",
"if",
"(",
"calc",
"!=",
"null",
"&&",
"calc",
".",
"getScale",
"("... | If {@link Num} don't define scale then use scale from {@link AbstractCalculator} instance.
Othervise use default scale {@link Properties#DEFAULT_SCALE}
@param calc
@param value | [
"If",
"{",
"@link",
"Num",
"}",
"don",
"t",
"define",
"scale",
"then",
"use",
"scale",
"from",
"{",
"@link",
"AbstractCalculator",
"}",
"instance",
".",
"Othervise",
"use",
"default",
"scale",
"{",
"@link",
"Properties#DEFAULT_SCALE",
"}"
] | train | https://github.com/d-sauer/JCalcAPI/blob/36ae1f9adfe611a6f1bd8ef87cf1dc0ec88ac035/src/main/java/org/jdice/calc/Properties.java#L435-L444 |
geomajas/geomajas-project-server | plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/PdfContext.java | PdfContext.drawImage | public void drawImage(Image img, Rectangle rect, Rectangle clipRect) {
"""
Draws the specified image with the first rectangle's bounds, clipping with the second one and adding
transparency.
@param img image
@param rect rectangle
@param clipRect clipping bounds
"""
drawImage(img, rect, clipRect, 1);
} | java | public void drawImage(Image img, Rectangle rect, Rectangle clipRect) {
drawImage(img, rect, clipRect, 1);
} | [
"public",
"void",
"drawImage",
"(",
"Image",
"img",
",",
"Rectangle",
"rect",
",",
"Rectangle",
"clipRect",
")",
"{",
"drawImage",
"(",
"img",
",",
"rect",
",",
"clipRect",
",",
"1",
")",
";",
"}"
] | Draws the specified image with the first rectangle's bounds, clipping with the second one and adding
transparency.
@param img image
@param rect rectangle
@param clipRect clipping bounds | [
"Draws",
"the",
"specified",
"image",
"with",
"the",
"first",
"rectangle",
"s",
"bounds",
"clipping",
"with",
"the",
"second",
"one",
"and",
"adding",
"transparency",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/PdfContext.java#L389-L391 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxStoragePolicyAssignment.java | BoxStoragePolicyAssignment.getAssignmentForTarget | public static BoxStoragePolicyAssignment.Info getAssignmentForTarget(final BoxAPIConnection api,
String resolvedForType, String resolvedForID) {
"""
Returns a BoxStoragePolicyAssignment information.
@param api the API connection to be used by the resource.
@param resolvedForType the assigned entity type for the storage policy.
@param resolvedForID the assigned entity id for the storage policy.
@return information about this {@link BoxStoragePolicyAssignment}.
"""
QueryStringBuilder builder = new QueryStringBuilder();
builder.appendParam("resolved_for_type", resolvedForType)
.appendParam("resolved_for_id", resolvedForID);
URL url = STORAGE_POLICY_ASSIGNMENT_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString());
BoxAPIRequest request = new BoxAPIRequest(api, url, HttpMethod.GET);
BoxJSONResponse response = (BoxJSONResponse) request.send();
BoxStoragePolicyAssignment storagePolicyAssignment = new BoxStoragePolicyAssignment(api,
response.getJsonObject().get("entries").asArray().get(0).asObject().get("id").asString());
BoxStoragePolicyAssignment.Info info = storagePolicyAssignment.new
Info(response.getJsonObject().get("entries").asArray().get(0).asObject());
return info;
} | java | public static BoxStoragePolicyAssignment.Info getAssignmentForTarget(final BoxAPIConnection api,
String resolvedForType, String resolvedForID) {
QueryStringBuilder builder = new QueryStringBuilder();
builder.appendParam("resolved_for_type", resolvedForType)
.appendParam("resolved_for_id", resolvedForID);
URL url = STORAGE_POLICY_ASSIGNMENT_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString());
BoxAPIRequest request = new BoxAPIRequest(api, url, HttpMethod.GET);
BoxJSONResponse response = (BoxJSONResponse) request.send();
BoxStoragePolicyAssignment storagePolicyAssignment = new BoxStoragePolicyAssignment(api,
response.getJsonObject().get("entries").asArray().get(0).asObject().get("id").asString());
BoxStoragePolicyAssignment.Info info = storagePolicyAssignment.new
Info(response.getJsonObject().get("entries").asArray().get(0).asObject());
return info;
} | [
"public",
"static",
"BoxStoragePolicyAssignment",
".",
"Info",
"getAssignmentForTarget",
"(",
"final",
"BoxAPIConnection",
"api",
",",
"String",
"resolvedForType",
",",
"String",
"resolvedForID",
")",
"{",
"QueryStringBuilder",
"builder",
"=",
"new",
"QueryStringBuilder",... | Returns a BoxStoragePolicyAssignment information.
@param api the API connection to be used by the resource.
@param resolvedForType the assigned entity type for the storage policy.
@param resolvedForID the assigned entity id for the storage policy.
@return information about this {@link BoxStoragePolicyAssignment}. | [
"Returns",
"a",
"BoxStoragePolicyAssignment",
"information",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxStoragePolicyAssignment.java#L88-L103 |
Samsung/GearVRf | GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/CursorManager.java | CursorManager.updateCursorsInScene | private void updateCursorsInScene(GVRScene scene, boolean add) {
"""
Add or remove the active cursors from the provided scene.
@param scene The GVRScene.
@param add <code>true</code> for add, <code>false</code> to remove
"""
synchronized (mCursors) {
for (Cursor cursor : mCursors) {
if (cursor.isActive()) {
if (add) {
addCursorToScene(cursor);
} else {
removeCursorFromScene(cursor);
}
}
}
}
} | java | private void updateCursorsInScene(GVRScene scene, boolean add) {
synchronized (mCursors) {
for (Cursor cursor : mCursors) {
if (cursor.isActive()) {
if (add) {
addCursorToScene(cursor);
} else {
removeCursorFromScene(cursor);
}
}
}
}
} | [
"private",
"void",
"updateCursorsInScene",
"(",
"GVRScene",
"scene",
",",
"boolean",
"add",
")",
"{",
"synchronized",
"(",
"mCursors",
")",
"{",
"for",
"(",
"Cursor",
"cursor",
":",
"mCursors",
")",
"{",
"if",
"(",
"cursor",
".",
"isActive",
"(",
")",
")... | Add or remove the active cursors from the provided scene.
@param scene The GVRScene.
@param add <code>true</code> for add, <code>false</code> to remove | [
"Add",
"or",
"remove",
"the",
"active",
"cursors",
"from",
"the",
"provided",
"scene",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/CursorManager.java#L621-L633 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.getAward | public GitlabAward getAward(GitlabIssue issue, Integer awardId) throws IOException {
"""
Get a specific award for an issue
@param issue
@param awardId
@throws IOException on gitlab api call error
"""
String tailUrl = GitlabProject.URL + "/" + issue.getProjectId() + GitlabIssue.URL + "/" + issue.getId()
+ GitlabAward.URL + "/" + awardId;
return retrieve().to(tailUrl, GitlabAward.class);
} | java | public GitlabAward getAward(GitlabIssue issue, Integer awardId) throws IOException {
String tailUrl = GitlabProject.URL + "/" + issue.getProjectId() + GitlabIssue.URL + "/" + issue.getId()
+ GitlabAward.URL + "/" + awardId;
return retrieve().to(tailUrl, GitlabAward.class);
} | [
"public",
"GitlabAward",
"getAward",
"(",
"GitlabIssue",
"issue",
",",
"Integer",
"awardId",
")",
"throws",
"IOException",
"{",
"String",
"tailUrl",
"=",
"GitlabProject",
".",
"URL",
"+",
"\"/\"",
"+",
"issue",
".",
"getProjectId",
"(",
")",
"+",
"GitlabIssue"... | Get a specific award for an issue
@param issue
@param awardId
@throws IOException on gitlab api call error | [
"Get",
"a",
"specific",
"award",
"for",
"an",
"issue"
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3518-L3523 |
headius/invokebinder | src/main/java/com/headius/invokebinder/SmartHandle.java | SmartHandle.dropLast | public SmartHandle dropLast(String newName, Class<?> type) {
"""
Drop an argument from the handle at the end, returning a new
SmartHandle.
@param newName name of the argument
@param type type of the argument
@return a new SmartHandle with the additional argument
"""
return new SmartHandle(signature.appendArg(newName, type), MethodHandles.dropArguments(handle, signature.argOffset(newName), type));
} | java | public SmartHandle dropLast(String newName, Class<?> type) {
return new SmartHandle(signature.appendArg(newName, type), MethodHandles.dropArguments(handle, signature.argOffset(newName), type));
} | [
"public",
"SmartHandle",
"dropLast",
"(",
"String",
"newName",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"return",
"new",
"SmartHandle",
"(",
"signature",
".",
"appendArg",
"(",
"newName",
",",
"type",
")",
",",
"MethodHandles",
".",
"dropArguments",
... | Drop an argument from the handle at the end, returning a new
SmartHandle.
@param newName name of the argument
@param type type of the argument
@return a new SmartHandle with the additional argument | [
"Drop",
"an",
"argument",
"from",
"the",
"handle",
"at",
"the",
"end",
"returning",
"a",
"new",
"SmartHandle",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/SmartHandle.java#L204-L206 |
grpc/grpc-java | stub/src/main/java/io/grpc/stub/MetadataUtils.java | MetadataUtils.attachHeaders | @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1789")
public static <T extends AbstractStub<T>> T attachHeaders(T stub, Metadata extraHeaders) {
"""
Attaches a set of request headers to a stub.
@param stub to bind the headers to.
@param extraHeaders the headers to be passed by each call on the returned stub.
@return an implementation of the stub with {@code extraHeaders} bound to each call.
"""
return stub.withInterceptors(newAttachHeadersInterceptor(extraHeaders));
} | java | @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1789")
public static <T extends AbstractStub<T>> T attachHeaders(T stub, Metadata extraHeaders) {
return stub.withInterceptors(newAttachHeadersInterceptor(extraHeaders));
} | [
"@",
"ExperimentalApi",
"(",
"\"https://github.com/grpc/grpc-java/issues/1789\"",
")",
"public",
"static",
"<",
"T",
"extends",
"AbstractStub",
"<",
"T",
">",
">",
"T",
"attachHeaders",
"(",
"T",
"stub",
",",
"Metadata",
"extraHeaders",
")",
"{",
"return",
"stub",... | Attaches a set of request headers to a stub.
@param stub to bind the headers to.
@param extraHeaders the headers to be passed by each call on the returned stub.
@return an implementation of the stub with {@code extraHeaders} bound to each call. | [
"Attaches",
"a",
"set",
"of",
"request",
"headers",
"to",
"a",
"stub",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/stub/src/main/java/io/grpc/stub/MetadataUtils.java#L47-L50 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/app/SupportSimpleAlertDialogFragment.java | SupportSimpleAlertDialogFragment.newInstance | public static SupportSimpleAlertDialogFragment newInstance(int titleResId, int messageResId) {
"""
Construct {@link com.amalgam.app.SupportSimpleAlertDialogFragment} with the specified message and title resource.
@param titleResId to show as an alert dialog title.
@param messageResId to show on alert dialog
@return simplified alert dialog fragment.
"""
SupportSimpleAlertDialogFragment fragment = new SupportSimpleAlertDialogFragment();
Bundle args = new Bundle();
args.putInt(ARGS_MESSAGE_RES, messageResId);
args.putInt(ARGS_TITLE_RES, titleResId);
fragment.setArguments(args);
return fragment;
} | java | public static SupportSimpleAlertDialogFragment newInstance(int titleResId, int messageResId) {
SupportSimpleAlertDialogFragment fragment = new SupportSimpleAlertDialogFragment();
Bundle args = new Bundle();
args.putInt(ARGS_MESSAGE_RES, messageResId);
args.putInt(ARGS_TITLE_RES, titleResId);
fragment.setArguments(args);
return fragment;
} | [
"public",
"static",
"SupportSimpleAlertDialogFragment",
"newInstance",
"(",
"int",
"titleResId",
",",
"int",
"messageResId",
")",
"{",
"SupportSimpleAlertDialogFragment",
"fragment",
"=",
"new",
"SupportSimpleAlertDialogFragment",
"(",
")",
";",
"Bundle",
"args",
"=",
"... | Construct {@link com.amalgam.app.SupportSimpleAlertDialogFragment} with the specified message and title resource.
@param titleResId to show as an alert dialog title.
@param messageResId to show on alert dialog
@return simplified alert dialog fragment. | [
"Construct",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/app/SupportSimpleAlertDialogFragment.java#L58-L65 |
syphr42/prom | src/main/java/org/syphr/prom/PropertiesManager.java | PropertiesManager.getEnumProperty | public <E extends Enum<E>> E getEnumProperty(T property, Class<E> type) throws IllegalArgumentException {
"""
Retrieve the value of the given property as an Enum constant of the given
type.<br>
<br>
Note that this method requires the Enum constants to all have upper case
names (following Java naming conventions). This allows for case
insensitivity in the properties file.
@param <E>
the type of Enum that will be returned
@param property
the property to retrieve
@param type
the Enum type to which the property will be converted
@return the Enum constant corresponding to the value of the given
property
@throws IllegalArgumentException
if the current value is not a valid constant of the given
type
"""
return Enum.valueOf(type, getProperty(property).toUpperCase());
} | java | public <E extends Enum<E>> E getEnumProperty(T property, Class<E> type) throws IllegalArgumentException
{
return Enum.valueOf(type, getProperty(property).toUpperCase());
} | [
"public",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
">",
"E",
"getEnumProperty",
"(",
"T",
"property",
",",
"Class",
"<",
"E",
">",
"type",
")",
"throws",
"IllegalArgumentException",
"{",
"return",
"Enum",
".",
"valueOf",
"(",
"type",
",",
"getProperty... | Retrieve the value of the given property as an Enum constant of the given
type.<br>
<br>
Note that this method requires the Enum constants to all have upper case
names (following Java naming conventions). This allows for case
insensitivity in the properties file.
@param <E>
the type of Enum that will be returned
@param property
the property to retrieve
@param type
the Enum type to which the property will be converted
@return the Enum constant corresponding to the value of the given
property
@throws IllegalArgumentException
if the current value is not a valid constant of the given
type | [
"Retrieve",
"the",
"value",
"of",
"the",
"given",
"property",
"as",
"an",
"Enum",
"constant",
"of",
"the",
"given",
"type",
".",
"<br",
">",
"<br",
">",
"Note",
"that",
"this",
"method",
"requires",
"the",
"Enum",
"constants",
"to",
"all",
"have",
"upper... | train | https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/PropertiesManager.java#L582-L585 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java | DOM2DTM.getNodeData | protected static void getNodeData(Node node, FastStringBuffer buf) {
"""
Retrieve the text content of a DOM subtree, appending it into a
user-supplied FastStringBuffer object. Note that attributes are
not considered part of the content of an element.
<p>
There are open questions regarding whitespace stripping.
Currently we make no special effort in that regard, since the standard
DOM doesn't yet provide DTD-based information to distinguish
whitespace-in-element-context from genuine #PCDATA. Note that we
should probably also consider xml:space if/when we address this.
DOM Level 3 may solve the problem for us.
<p>
%REVIEW% Actually, since this method operates on the DOM side of the
fence rather than the DTM side, it SHOULDN'T do
any special handling. The DOM does what the DOM does; if you want
DTM-level abstractions, use DTM-level methods.
@param node Node whose subtree is to be walked, gathering the
contents of all Text or CDATASection nodes.
@param buf FastStringBuffer into which the contents of the text
nodes are to be concatenated.
"""
switch (node.getNodeType())
{
case Node.DOCUMENT_FRAGMENT_NODE :
case Node.DOCUMENT_NODE :
case Node.ELEMENT_NODE :
{
for (Node child = node.getFirstChild(); null != child;
child = child.getNextSibling())
{
getNodeData(child, buf);
}
}
break;
case Node.TEXT_NODE :
case Node.CDATA_SECTION_NODE :
case Node.ATTRIBUTE_NODE : // Never a child but might be our starting node
buf.append(node.getNodeValue());
break;
case Node.PROCESSING_INSTRUCTION_NODE :
// warning(XPATHErrorResources.WG_PARSING_AND_PREPARING);
break;
default :
// ignore
break;
}
} | java | protected static void getNodeData(Node node, FastStringBuffer buf)
{
switch (node.getNodeType())
{
case Node.DOCUMENT_FRAGMENT_NODE :
case Node.DOCUMENT_NODE :
case Node.ELEMENT_NODE :
{
for (Node child = node.getFirstChild(); null != child;
child = child.getNextSibling())
{
getNodeData(child, buf);
}
}
break;
case Node.TEXT_NODE :
case Node.CDATA_SECTION_NODE :
case Node.ATTRIBUTE_NODE : // Never a child but might be our starting node
buf.append(node.getNodeValue());
break;
case Node.PROCESSING_INSTRUCTION_NODE :
// warning(XPATHErrorResources.WG_PARSING_AND_PREPARING);
break;
default :
// ignore
break;
}
} | [
"protected",
"static",
"void",
"getNodeData",
"(",
"Node",
"node",
",",
"FastStringBuffer",
"buf",
")",
"{",
"switch",
"(",
"node",
".",
"getNodeType",
"(",
")",
")",
"{",
"case",
"Node",
".",
"DOCUMENT_FRAGMENT_NODE",
":",
"case",
"Node",
".",
"DOCUMENT_NOD... | Retrieve the text content of a DOM subtree, appending it into a
user-supplied FastStringBuffer object. Note that attributes are
not considered part of the content of an element.
<p>
There are open questions regarding whitespace stripping.
Currently we make no special effort in that regard, since the standard
DOM doesn't yet provide DTD-based information to distinguish
whitespace-in-element-context from genuine #PCDATA. Note that we
should probably also consider xml:space if/when we address this.
DOM Level 3 may solve the problem for us.
<p>
%REVIEW% Actually, since this method operates on the DOM side of the
fence rather than the DTM side, it SHOULDN'T do
any special handling. The DOM does what the DOM does; if you want
DTM-level abstractions, use DTM-level methods.
@param node Node whose subtree is to be walked, gathering the
contents of all Text or CDATASection nodes.
@param buf FastStringBuffer into which the contents of the text
nodes are to be concatenated. | [
"Retrieve",
"the",
"text",
"content",
"of",
"a",
"DOM",
"subtree",
"appending",
"it",
"into",
"a",
"user",
"-",
"supplied",
"FastStringBuffer",
"object",
".",
"Note",
"that",
"attributes",
"are",
"not",
"considered",
"part",
"of",
"the",
"content",
"of",
"an... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java#L916-L944 |
antopen/alipay-sdk-java | src/main/java/com/alipay/api/internal/util/XmlUtils.java | XmlUtils.validateXml | public static void validateXml(Node doc, File schemaFile)
throws AlipayApiException {
"""
Validates the element tree context via given XML schema file.
@param doc the XML document to validate
@param schemaFile the XML schema file instance
@throws ApiException error occurs if the schema file not exists
"""
validateXml(doc, getInputStream(schemaFile));
} | java | public static void validateXml(Node doc, File schemaFile)
throws AlipayApiException {
validateXml(doc, getInputStream(schemaFile));
} | [
"public",
"static",
"void",
"validateXml",
"(",
"Node",
"doc",
",",
"File",
"schemaFile",
")",
"throws",
"AlipayApiException",
"{",
"validateXml",
"(",
"doc",
",",
"getInputStream",
"(",
"schemaFile",
")",
")",
";",
"}"
] | Validates the element tree context via given XML schema file.
@param doc the XML document to validate
@param schemaFile the XML schema file instance
@throws ApiException error occurs if the schema file not exists | [
"Validates",
"the",
"element",
"tree",
"context",
"via",
"given",
"XML",
"schema",
"file",
"."
] | train | https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/XmlUtils.java#L524-L527 |
kite-sdk/kite | kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/impl/HBaseUtils.java | HBaseUtils.mergePutActions | public static PutAction mergePutActions(byte[] keyBytes,
List<PutAction> putActionList) {
"""
Given a list of PutActions, create a new PutAction with the values in each
put merged together. It is expected that no puts have a value for the same
fully qualified column. Return the new PutAction.
@param key
The key of the new put.
@param putActionList
The list of PutActions to merge
@return the new PutAction instance
"""
VersionCheckAction checkAction = null;
List<Put> putsToMerge = new ArrayList<Put>();
for (PutAction putActionToMerge : putActionList) {
putsToMerge.add(putActionToMerge.getPut());
VersionCheckAction checkActionToMerge = putActionToMerge.getVersionCheckAction();
if (checkActionToMerge != null) {
checkAction = checkActionToMerge;
}
}
Put put = mergePuts(keyBytes, putsToMerge);
return new PutAction(put, checkAction);
} | java | public static PutAction mergePutActions(byte[] keyBytes,
List<PutAction> putActionList) {
VersionCheckAction checkAction = null;
List<Put> putsToMerge = new ArrayList<Put>();
for (PutAction putActionToMerge : putActionList) {
putsToMerge.add(putActionToMerge.getPut());
VersionCheckAction checkActionToMerge = putActionToMerge.getVersionCheckAction();
if (checkActionToMerge != null) {
checkAction = checkActionToMerge;
}
}
Put put = mergePuts(keyBytes, putsToMerge);
return new PutAction(put, checkAction);
} | [
"public",
"static",
"PutAction",
"mergePutActions",
"(",
"byte",
"[",
"]",
"keyBytes",
",",
"List",
"<",
"PutAction",
">",
"putActionList",
")",
"{",
"VersionCheckAction",
"checkAction",
"=",
"null",
";",
"List",
"<",
"Put",
">",
"putsToMerge",
"=",
"new",
"... | Given a list of PutActions, create a new PutAction with the values in each
put merged together. It is expected that no puts have a value for the same
fully qualified column. Return the new PutAction.
@param key
The key of the new put.
@param putActionList
The list of PutActions to merge
@return the new PutAction instance | [
"Given",
"a",
"list",
"of",
"PutActions",
"create",
"a",
"new",
"PutAction",
"with",
"the",
"values",
"in",
"each",
"put",
"merged",
"together",
".",
"It",
"is",
"expected",
"that",
"no",
"puts",
"have",
"a",
"value",
"for",
"the",
"same",
"fully",
"qual... | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/impl/HBaseUtils.java#L93-L106 |
Alluxio/alluxio | core/server/worker/src/main/java/alluxio/worker/block/UnderFileSystemBlockStore.java | UnderFileSystemBlockStore.getBlockInfo | private BlockInfo getBlockInfo(long sessionId, long blockId) throws BlockDoesNotExistException {
"""
Gets the {@link UnderFileSystemBlockMeta} for a session ID and block ID pair.
@param sessionId the session ID
@param blockId the block ID
@return the {@link UnderFileSystemBlockMeta} instance
@throws BlockDoesNotExistException if the UFS block does not exist in the
{@link UnderFileSystemBlockStore}
"""
Key key = new Key(sessionId, blockId);
BlockInfo blockInfo = mBlocks.get(key);
if (blockInfo == null) {
throw new BlockDoesNotExistException(ExceptionMessage.UFS_BLOCK_DOES_NOT_EXIST_FOR_SESSION,
blockId, sessionId);
}
return blockInfo;
} | java | private BlockInfo getBlockInfo(long sessionId, long blockId) throws BlockDoesNotExistException {
Key key = new Key(sessionId, blockId);
BlockInfo blockInfo = mBlocks.get(key);
if (blockInfo == null) {
throw new BlockDoesNotExistException(ExceptionMessage.UFS_BLOCK_DOES_NOT_EXIST_FOR_SESSION,
blockId, sessionId);
}
return blockInfo;
} | [
"private",
"BlockInfo",
"getBlockInfo",
"(",
"long",
"sessionId",
",",
"long",
"blockId",
")",
"throws",
"BlockDoesNotExistException",
"{",
"Key",
"key",
"=",
"new",
"Key",
"(",
"sessionId",
",",
"blockId",
")",
";",
"BlockInfo",
"blockInfo",
"=",
"mBlocks",
"... | Gets the {@link UnderFileSystemBlockMeta} for a session ID and block ID pair.
@param sessionId the session ID
@param blockId the block ID
@return the {@link UnderFileSystemBlockMeta} instance
@throws BlockDoesNotExistException if the UFS block does not exist in the
{@link UnderFileSystemBlockStore} | [
"Gets",
"the",
"{",
"@link",
"UnderFileSystemBlockMeta",
"}",
"for",
"a",
"session",
"ID",
"and",
"block",
"ID",
"pair",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/UnderFileSystemBlockStore.java#L257-L265 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePolynomialMath.java | QrCodePolynomialMath.correctDCH | public static int correctDCH( int N , int messageNoMask , int generator , int totalBits, int dataBits) {
"""
Applies a brute force algorithm to find the message which has the smallest hamming distance. if two
messages have the same distance -1 is returned.
@param N Number of possible messages. 32 or 64
@param messageNoMask The observed message with mask removed
@param generator Generator polynomial
@param totalBits Total number of bits in the message.
@param dataBits Total number of data bits in the message
@return The error corrected message or -1 if it can't be determined.
"""
int bestHamming = 255;
int bestMessage = -1;
int errorBits = totalBits-dataBits;
// exhaustively check all possibilities
for (int i = 0; i < N; i++) {
int test = i << errorBits;
test = test ^ bitPolyModulus(test,generator,totalBits,dataBits);
int distance = DescriptorDistance.hamming(test^messageNoMask);
// see if it found a better match
if( distance < bestHamming ) {
bestHamming = distance;
bestMessage = i;
} else if( distance == bestHamming ) {
// ambiguous so reject
bestMessage = -1;
}
}
return bestMessage;
} | java | public static int correctDCH( int N , int messageNoMask , int generator , int totalBits, int dataBits) {
int bestHamming = 255;
int bestMessage = -1;
int errorBits = totalBits-dataBits;
// exhaustively check all possibilities
for (int i = 0; i < N; i++) {
int test = i << errorBits;
test = test ^ bitPolyModulus(test,generator,totalBits,dataBits);
int distance = DescriptorDistance.hamming(test^messageNoMask);
// see if it found a better match
if( distance < bestHamming ) {
bestHamming = distance;
bestMessage = i;
} else if( distance == bestHamming ) {
// ambiguous so reject
bestMessage = -1;
}
}
return bestMessage;
} | [
"public",
"static",
"int",
"correctDCH",
"(",
"int",
"N",
",",
"int",
"messageNoMask",
",",
"int",
"generator",
",",
"int",
"totalBits",
",",
"int",
"dataBits",
")",
"{",
"int",
"bestHamming",
"=",
"255",
";",
"int",
"bestMessage",
"=",
"-",
"1",
";",
... | Applies a brute force algorithm to find the message which has the smallest hamming distance. if two
messages have the same distance -1 is returned.
@param N Number of possible messages. 32 or 64
@param messageNoMask The observed message with mask removed
@param generator Generator polynomial
@param totalBits Total number of bits in the message.
@param dataBits Total number of data bits in the message
@return The error corrected message or -1 if it can't be determined. | [
"Applies",
"a",
"brute",
"force",
"algorithm",
"to",
"find",
"the",
"message",
"which",
"has",
"the",
"smallest",
"hamming",
"distance",
".",
"if",
"two",
"messages",
"have",
"the",
"same",
"distance",
"-",
"1",
"is",
"returned",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePolynomialMath.java#L120-L143 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobInProgress.java | JobInProgress.refreshTaskCountsAndWaitTime | protected void refreshTaskCountsAndWaitTime(TaskType type, long now) {
"""
Refresh runningTasks, neededTasks and pendingTasks counters
@param type TaskType to refresh
"""
TaskInProgress[] allTips = getTasks(type);
int finishedTips = 0;
int runningTips = 0;
int runningTaskAttempts = 0;
long totalWaitTime = 0;
long jobStartTime = this.getStartTime();
for (TaskInProgress tip : allTips) {
if (tip.isComplete()) {
finishedTips += 1;
} else if(tip.isRunning()) {
runningTaskAttempts += tip.getActiveTasks().size();
runningTips += 1;
}
if (tip.getExecStartTime() > 0) {
totalWaitTime += tip.getExecStartTime() - jobStartTime;
} else {
totalWaitTime += now - jobStartTime;
}
}
if (TaskType.MAP == type) {
totalMapWaitTime = totalWaitTime;
runningMapTasks = runningTaskAttempts;
neededMapTasks = numMapTasks - runningTips - finishedTips
+ neededSpeculativeMaps();
pendingMapTasks = numMapTasks - runningTaskAttempts
- failedMapTIPs - finishedMapTasks + speculativeMapTasks;
} else {
totalReduceWaitTime = totalWaitTime;
runningReduceTasks = runningTaskAttempts;
neededReduceTasks = numReduceTasks - runningTips - finishedTips
+ neededSpeculativeReduces();
pendingReduceTasks = numReduceTasks - runningTaskAttempts
- failedReduceTIPs - finishedReduceTasks + speculativeReduceTasks;
}
} | java | protected void refreshTaskCountsAndWaitTime(TaskType type, long now) {
TaskInProgress[] allTips = getTasks(type);
int finishedTips = 0;
int runningTips = 0;
int runningTaskAttempts = 0;
long totalWaitTime = 0;
long jobStartTime = this.getStartTime();
for (TaskInProgress tip : allTips) {
if (tip.isComplete()) {
finishedTips += 1;
} else if(tip.isRunning()) {
runningTaskAttempts += tip.getActiveTasks().size();
runningTips += 1;
}
if (tip.getExecStartTime() > 0) {
totalWaitTime += tip.getExecStartTime() - jobStartTime;
} else {
totalWaitTime += now - jobStartTime;
}
}
if (TaskType.MAP == type) {
totalMapWaitTime = totalWaitTime;
runningMapTasks = runningTaskAttempts;
neededMapTasks = numMapTasks - runningTips - finishedTips
+ neededSpeculativeMaps();
pendingMapTasks = numMapTasks - runningTaskAttempts
- failedMapTIPs - finishedMapTasks + speculativeMapTasks;
} else {
totalReduceWaitTime = totalWaitTime;
runningReduceTasks = runningTaskAttempts;
neededReduceTasks = numReduceTasks - runningTips - finishedTips
+ neededSpeculativeReduces();
pendingReduceTasks = numReduceTasks - runningTaskAttempts
- failedReduceTIPs - finishedReduceTasks + speculativeReduceTasks;
}
} | [
"protected",
"void",
"refreshTaskCountsAndWaitTime",
"(",
"TaskType",
"type",
",",
"long",
"now",
")",
"{",
"TaskInProgress",
"[",
"]",
"allTips",
"=",
"getTasks",
"(",
"type",
")",
";",
"int",
"finishedTips",
"=",
"0",
";",
"int",
"runningTips",
"=",
"0",
... | Refresh runningTasks, neededTasks and pendingTasks counters
@param type TaskType to refresh | [
"Refresh",
"runningTasks",
"neededTasks",
"and",
"pendingTasks",
"counters"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobInProgress.java#L3847-L3882 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.weekNumber | protected int weekNumber(int desiredDay, int dayOfPeriod, int dayOfWeek) {
"""
Returns the week number of a day, within a period. This may be the week number in
a year or the week number in a month. Usually this will be a value >= 1, but if
some initial days of the period are excluded from week 1, because
{@link #getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek} is > 1, then
the week number will be zero for those
initial days. This method requires the day number and day of week for some
known date in the period in order to determine the day of week
on the desired day.
<p>
<b>Subclassing:</b>
<br>
This method is intended for use by subclasses in implementing their
{@link #computeTime computeTime} and/or {@link #computeFields computeFields} methods.
It is often useful in {@link #getActualMinimum getActualMinimum} and
{@link #getActualMaximum getActualMaximum} as well.
<p>
This variant is handy for computing the week number of some other
day of a period (often the first or last day of the period) when its day
of the week is not known but the day number and day of week for some other
day in the period (e.g. the current date) <em>is</em> known.
<p>
@param desiredDay The {@link #DAY_OF_YEAR DAY_OF_YEAR} or
{@link #DAY_OF_MONTH DAY_OF_MONTH} whose week number is desired.
Should be 1 for the first day of the period.
@param dayOfPeriod The {@link #DAY_OF_YEAR DAY_OF_YEAR}
or {@link #DAY_OF_MONTH DAY_OF_MONTH} for a day in the period whose
{@link #DAY_OF_WEEK DAY_OF_WEEK} is specified by the
<code>dayOfWeek</code> parameter.
Should be 1 for first day of period.
@param dayOfWeek The {@link #DAY_OF_WEEK DAY_OF_WEEK} for the day
corresponding to the <code>dayOfPeriod</code> parameter.
1-based with 1=Sunday.
@return The week number (one-based), or zero if the day falls before
the first week because
{@link #getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek}
is more than one.
"""
// Determine the day of the week of the first day of the period
// in question (either a year or a month). Zero represents the
// first day of the week on this calendar.
int periodStartDayOfWeek = (dayOfWeek - getFirstDayOfWeek() - dayOfPeriod + 1) % 7;
if (periodStartDayOfWeek < 0) periodStartDayOfWeek += 7;
// Compute the week number. Initially, ignore the first week, which
// may be fractional (or may not be). We add periodStartDayOfWeek in
// order to fill out the first week, if it is fractional.
int weekNo = (desiredDay + periodStartDayOfWeek - 1)/7;
// If the first week is long enough, then count it. If
// the minimal days in the first week is one, or if the period start
// is zero, we always increment weekNo.
if ((7 - periodStartDayOfWeek) >= getMinimalDaysInFirstWeek()) ++weekNo;
return weekNo;
} | java | protected int weekNumber(int desiredDay, int dayOfPeriod, int dayOfWeek)
{
// Determine the day of the week of the first day of the period
// in question (either a year or a month). Zero represents the
// first day of the week on this calendar.
int periodStartDayOfWeek = (dayOfWeek - getFirstDayOfWeek() - dayOfPeriod + 1) % 7;
if (periodStartDayOfWeek < 0) periodStartDayOfWeek += 7;
// Compute the week number. Initially, ignore the first week, which
// may be fractional (or may not be). We add periodStartDayOfWeek in
// order to fill out the first week, if it is fractional.
int weekNo = (desiredDay + periodStartDayOfWeek - 1)/7;
// If the first week is long enough, then count it. If
// the minimal days in the first week is one, or if the period start
// is zero, we always increment weekNo.
if ((7 - periodStartDayOfWeek) >= getMinimalDaysInFirstWeek()) ++weekNo;
return weekNo;
} | [
"protected",
"int",
"weekNumber",
"(",
"int",
"desiredDay",
",",
"int",
"dayOfPeriod",
",",
"int",
"dayOfWeek",
")",
"{",
"// Determine the day of the week of the first day of the period",
"// in question (either a year or a month). Zero represents the",
"// first day of the week on... | Returns the week number of a day, within a period. This may be the week number in
a year or the week number in a month. Usually this will be a value >= 1, but if
some initial days of the period are excluded from week 1, because
{@link #getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek} is > 1, then
the week number will be zero for those
initial days. This method requires the day number and day of week for some
known date in the period in order to determine the day of week
on the desired day.
<p>
<b>Subclassing:</b>
<br>
This method is intended for use by subclasses in implementing their
{@link #computeTime computeTime} and/or {@link #computeFields computeFields} methods.
It is often useful in {@link #getActualMinimum getActualMinimum} and
{@link #getActualMaximum getActualMaximum} as well.
<p>
This variant is handy for computing the week number of some other
day of a period (often the first or last day of the period) when its day
of the week is not known but the day number and day of week for some other
day in the period (e.g. the current date) <em>is</em> known.
<p>
@param desiredDay The {@link #DAY_OF_YEAR DAY_OF_YEAR} or
{@link #DAY_OF_MONTH DAY_OF_MONTH} whose week number is desired.
Should be 1 for the first day of the period.
@param dayOfPeriod The {@link #DAY_OF_YEAR DAY_OF_YEAR}
or {@link #DAY_OF_MONTH DAY_OF_MONTH} for a day in the period whose
{@link #DAY_OF_WEEK DAY_OF_WEEK} is specified by the
<code>dayOfWeek</code> parameter.
Should be 1 for first day of period.
@param dayOfWeek The {@link #DAY_OF_WEEK DAY_OF_WEEK} for the day
corresponding to the <code>dayOfPeriod</code> parameter.
1-based with 1=Sunday.
@return The week number (one-based), or zero if the day falls before
the first week because
{@link #getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek}
is more than one. | [
"Returns",
"the",
"week",
"number",
"of",
"a",
"day",
"within",
"a",
"period",
".",
"This",
"may",
"be",
"the",
"week",
"number",
"in",
"a",
"year",
"or",
"the",
"week",
"number",
"in",
"a",
"month",
".",
"Usually",
"this",
"will",
"be",
"a",
"value"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L3828-L3847 |
openbase/jul | extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/LabelProcessor.java | LabelProcessor.getLabelByLanguage | public static String getLabelByLanguage(final String languageCode, final LabelOrBuilder label) throws NotAvailableException {
"""
Get the first label for a languageCode from a label type.
This method will call {@link #getLabelListByLanguage(String, LabelOrBuilder)} to extract the list of labels
for the languageCode and then return its first entry.
@param languageCode the languageCode which is checked
@param label the label type which is searched for labels in the language
@return the first label from the label type for the language code.
@throws NotAvailableException if no label list for the language code exists or if the list is empty
"""
final List<String> labelList = getLabelListByLanguage(languageCode, label);
if (labelList.isEmpty()) {
throw new NotAvailableException("Label for Language[" + languageCode + "]");
}
return labelList.get(0);
} | java | public static String getLabelByLanguage(final String languageCode, final LabelOrBuilder label) throws NotAvailableException {
final List<String> labelList = getLabelListByLanguage(languageCode, label);
if (labelList.isEmpty()) {
throw new NotAvailableException("Label for Language[" + languageCode + "]");
}
return labelList.get(0);
} | [
"public",
"static",
"String",
"getLabelByLanguage",
"(",
"final",
"String",
"languageCode",
",",
"final",
"LabelOrBuilder",
"label",
")",
"throws",
"NotAvailableException",
"{",
"final",
"List",
"<",
"String",
">",
"labelList",
"=",
"getLabelListByLanguage",
"(",
"l... | Get the first label for a languageCode from a label type.
This method will call {@link #getLabelListByLanguage(String, LabelOrBuilder)} to extract the list of labels
for the languageCode and then return its first entry.
@param languageCode the languageCode which is checked
@param label the label type which is searched for labels in the language
@return the first label from the label type for the language code.
@throws NotAvailableException if no label list for the language code exists or if the list is empty | [
"Get",
"the",
"first",
"label",
"for",
"a",
"languageCode",
"from",
"a",
"label",
"type",
".",
"This",
"method",
"will",
"call",
"{",
"@link",
"#getLabelListByLanguage",
"(",
"String",
"LabelOrBuilder",
")",
"}",
"to",
"extract",
"the",
"list",
"of",
"labels... | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/LabelProcessor.java#L291-L297 |
milaboratory/milib | src/main/java/com/milaboratory/util/HashFunctions.java | HashFunctions.MurmurHash2 | public static int MurmurHash2(int c, int seed) {
"""
MurmurHash hash function integer. <p/> <h3>Links</h3> <a href="http://sites.google.com/site/murmurhash/">http://sites.google.com/site/murmurhash/</a><br/>
<a href="http://dmy999.com/article/50/murmurhash-2-java-port">http://dmy999.com/article/50/murmurhash-2-java-port</a><br/>
<a href="http://en.wikipedia.org/wiki/MurmurHash">http://en.wikipedia.org/wiki/MurmurHash</a><br/>
@param c int to be hashed
@param seed seed parameter
@return 32 bit hash
"""
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.
int m = 0x5bd1e995;
// Initialize the hash to a 'random' value
int h = seed ^ 4;
c *= m;
c ^= c >>> 24;
c *= m;
h *= m;
h ^= c;
h ^= h >>> 13;
h *= m;
h ^= h >>> 15;
return h;
} | java | public static int MurmurHash2(int c, int seed) {
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.
int m = 0x5bd1e995;
// Initialize the hash to a 'random' value
int h = seed ^ 4;
c *= m;
c ^= c >>> 24;
c *= m;
h *= m;
h ^= c;
h ^= h >>> 13;
h *= m;
h ^= h >>> 15;
return h;
} | [
"public",
"static",
"int",
"MurmurHash2",
"(",
"int",
"c",
",",
"int",
"seed",
")",
"{",
"// 'm' and 'r' are mixing constants generated offline.",
"// They're not really 'magic', they just happen to work well.",
"int",
"m",
"=",
"0x5bd1e995",
";",
"// Initialize the hash to a '... | MurmurHash hash function integer. <p/> <h3>Links</h3> <a href="http://sites.google.com/site/murmurhash/">http://sites.google.com/site/murmurhash/</a><br/>
<a href="http://dmy999.com/article/50/murmurhash-2-java-port">http://dmy999.com/article/50/murmurhash-2-java-port</a><br/>
<a href="http://en.wikipedia.org/wiki/MurmurHash">http://en.wikipedia.org/wiki/MurmurHash</a><br/>
@param c int to be hashed
@param seed seed parameter
@return 32 bit hash | [
"MurmurHash",
"hash",
"function",
"integer",
".",
"<p",
"/",
">",
"<h3",
">",
"Links<",
"/",
"h3",
">",
"<a",
"href",
"=",
"http",
":",
"//",
"sites",
".",
"google",
".",
"com",
"/",
"site",
"/",
"murmurhash",
"/",
">",
"http",
":",
"//",
"sites",
... | train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/util/HashFunctions.java#L397-L412 |
mcaserta/spring-crypto-utils | src/main/java/com/springcryptoutils/core/key/PublicKeyRegistryByAliasImpl.java | PublicKeyRegistryByAliasImpl.get | public PublicKey get(KeyStoreChooser keyStoreChooser, PublicKeyChooserByAlias publicKeyChooserByAlias) {
"""
Returns the selected public key or null if not found.
@param keyStoreChooser the keystore chooser
@param publicKeyChooserByAlias the public key chooser by alias
@return the selected public key or null if not found
"""
CacheKey cacheKey = new CacheKey(keyStoreChooser.getKeyStoreName(), publicKeyChooserByAlias.getAlias());
PublicKey retrievedPublicKey = cache.get(cacheKey);
if (retrievedPublicKey != null) {
return retrievedPublicKey;
}
KeyStore keyStore = keyStoreRegistry.get(keyStoreChooser);
if (keyStore != null) {
PublicKeyFactoryBean factory = new PublicKeyFactoryBean();
factory.setKeystore(keyStore);
factory.setAlias(publicKeyChooserByAlias.getAlias());
try {
factory.afterPropertiesSet();
PublicKey publicKey = (PublicKey) factory.getObject();
if (publicKey != null) {
cache.put(cacheKey, publicKey);
}
return publicKey;
} catch (Exception e) {
throw new PublicKeyException("error initializing the public key factory bean", e);
}
}
return null;
} | java | public PublicKey get(KeyStoreChooser keyStoreChooser, PublicKeyChooserByAlias publicKeyChooserByAlias) {
CacheKey cacheKey = new CacheKey(keyStoreChooser.getKeyStoreName(), publicKeyChooserByAlias.getAlias());
PublicKey retrievedPublicKey = cache.get(cacheKey);
if (retrievedPublicKey != null) {
return retrievedPublicKey;
}
KeyStore keyStore = keyStoreRegistry.get(keyStoreChooser);
if (keyStore != null) {
PublicKeyFactoryBean factory = new PublicKeyFactoryBean();
factory.setKeystore(keyStore);
factory.setAlias(publicKeyChooserByAlias.getAlias());
try {
factory.afterPropertiesSet();
PublicKey publicKey = (PublicKey) factory.getObject();
if (publicKey != null) {
cache.put(cacheKey, publicKey);
}
return publicKey;
} catch (Exception e) {
throw new PublicKeyException("error initializing the public key factory bean", e);
}
}
return null;
} | [
"public",
"PublicKey",
"get",
"(",
"KeyStoreChooser",
"keyStoreChooser",
",",
"PublicKeyChooserByAlias",
"publicKeyChooserByAlias",
")",
"{",
"CacheKey",
"cacheKey",
"=",
"new",
"CacheKey",
"(",
"keyStoreChooser",
".",
"getKeyStoreName",
"(",
")",
",",
"publicKeyChooser... | Returns the selected public key or null if not found.
@param keyStoreChooser the keystore chooser
@param publicKeyChooserByAlias the public key chooser by alias
@return the selected public key or null if not found | [
"Returns",
"the",
"selected",
"public",
"key",
"or",
"null",
"if",
"not",
"found",
"."
] | train | https://github.com/mcaserta/spring-crypto-utils/blob/1dbf6211542fb1e3f9297941d691e7e89cc72c46/src/main/java/com/springcryptoutils/core/key/PublicKeyRegistryByAliasImpl.java#L53-L81 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/util/Resource.java | Resource.newResource | public static Resource newResource(URL url)
throws IOException {
"""
Construct a resource from a url.
@param url A URL.
@return A Resource object.
"""
if (url==null)
return null;
String urls=url.toExternalForm();
if( urls.startsWith( "file:"))
{
try
{
FileResource fileResource= new FileResource(url);
return fileResource;
}
catch(Exception e)
{
log.debug(LogSupport.EXCEPTION,e);
return new BadResource(url,e.toString());
}
}
else if( urls.startsWith( "jar:file:"))
{
return new JarFileResource(url);
}
else if( urls.startsWith( "jar:"))
{
return new JarResource(url);
}
return new URLResource(url,null);
} | java | public static Resource newResource(URL url)
throws IOException
{
if (url==null)
return null;
String urls=url.toExternalForm();
if( urls.startsWith( "file:"))
{
try
{
FileResource fileResource= new FileResource(url);
return fileResource;
}
catch(Exception e)
{
log.debug(LogSupport.EXCEPTION,e);
return new BadResource(url,e.toString());
}
}
else if( urls.startsWith( "jar:file:"))
{
return new JarFileResource(url);
}
else if( urls.startsWith( "jar:"))
{
return new JarResource(url);
}
return new URLResource(url,null);
} | [
"public",
"static",
"Resource",
"newResource",
"(",
"URL",
"url",
")",
"throws",
"IOException",
"{",
"if",
"(",
"url",
"==",
"null",
")",
"return",
"null",
";",
"String",
"urls",
"=",
"url",
".",
"toExternalForm",
"(",
")",
";",
"if",
"(",
"urls",
".",... | Construct a resource from a url.
@param url A URL.
@return A Resource object. | [
"Construct",
"a",
"resource",
"from",
"a",
"url",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/Resource.java#L47-L77 |
IBM/ibm-cos-sdk-java | ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/TransferListener.java | TransferListener.getInstance | public static TransferListener getInstance(String xferId, AsperaTransaction transaction) {
"""
Returns TransferListener instance and associates an AsperaTransaction with a Transfer ID.
On change of transfer status or bytes transferred the TransferLsitener will fire a progress
change event to all progress listeners attached to the AsperaTransaction.
@param xferId
@param transaction
@return
"""
if(instance == null) {
instance = new TransferListener();
}
if(transactions.get(xferId) != null) {
transactions.get(xferId).add(transaction);
} else {
List<AsperaTransaction> transferTransactions = new ArrayList<AsperaTransaction>();
transferTransactions.add(transaction);
transactions.put(xferId, transferTransactions);
}
return instance;
} | java | public static TransferListener getInstance(String xferId, AsperaTransaction transaction) {
if(instance == null) {
instance = new TransferListener();
}
if(transactions.get(xferId) != null) {
transactions.get(xferId).add(transaction);
} else {
List<AsperaTransaction> transferTransactions = new ArrayList<AsperaTransaction>();
transferTransactions.add(transaction);
transactions.put(xferId, transferTransactions);
}
return instance;
} | [
"public",
"static",
"TransferListener",
"getInstance",
"(",
"String",
"xferId",
",",
"AsperaTransaction",
"transaction",
")",
"{",
"if",
"(",
"instance",
"==",
"null",
")",
"{",
"instance",
"=",
"new",
"TransferListener",
"(",
")",
";",
"}",
"if",
"(",
"tran... | Returns TransferListener instance and associates an AsperaTransaction with a Transfer ID.
On change of transfer status or bytes transferred the TransferLsitener will fire a progress
change event to all progress listeners attached to the AsperaTransaction.
@param xferId
@param transaction
@return | [
"Returns",
"TransferListener",
"instance",
"and",
"associates",
"an",
"AsperaTransaction",
"with",
"a",
"Transfer",
"ID",
".",
"On",
"change",
"of",
"transfer",
"status",
"or",
"bytes",
"transferred",
"the",
"TransferLsitener",
"will",
"fire",
"a",
"progress",
"ch... | train | https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/TransferListener.java#L80-L94 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionsInner.java | VirtualMachineExtensionsInner.createOrUpdateAsync | public Observable<VirtualMachineExtensionInner> createOrUpdateAsync(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtensionInner extensionParameters) {
"""
The operation to create or update the extension.
@param resourceGroupName The name of the resource group.
@param vmName The name of the virtual machine where the extension should be created or updated.
@param vmExtensionName The name of the virtual machine extension.
@param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).map(new Func1<ServiceResponse<VirtualMachineExtensionInner>, VirtualMachineExtensionInner>() {
@Override
public VirtualMachineExtensionInner call(ServiceResponse<VirtualMachineExtensionInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualMachineExtensionInner> createOrUpdateAsync(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtensionInner extensionParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).map(new Func1<ServiceResponse<VirtualMachineExtensionInner>, VirtualMachineExtensionInner>() {
@Override
public VirtualMachineExtensionInner call(ServiceResponse<VirtualMachineExtensionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualMachineExtensionInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmName",
",",
"String",
"vmExtensionName",
",",
"VirtualMachineExtensionInner",
"extensionParameters",
")",
"{",
"return",
"createOrU... | The operation to create or update the extension.
@param resourceGroupName The name of the resource group.
@param vmName The name of the virtual machine where the extension should be created or updated.
@param vmExtensionName The name of the virtual machine extension.
@param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"The",
"operation",
"to",
"create",
"or",
"update",
"the",
"extension",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionsInner.java#L131-L138 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/MutableDictionary.java | MutableDictionary.setData | @NonNull
@Override
public MutableDictionary setData(Map<String, Object> data) {
"""
Set a dictionary as a content. Allowed value types are List, Date, Map, Number, null, String,
Array, Blob, and Dictionary. The List and Map must contain only the above types.
Setting the new dictionary content will replace the current data including the existing Array
and Dictionary objects.
@param data the dictionary object.
@return The self object.
"""
synchronized (lock) {
internalDict.clear();
for (Map.Entry<String, Object> entry : data.entrySet()) {
internalDict.set(
entry.getKey(),
new MValue(Fleece.toCBLObject(entry.getValue())));
}
return this;
}
} | java | @NonNull
@Override
public MutableDictionary setData(Map<String, Object> data) {
synchronized (lock) {
internalDict.clear();
for (Map.Entry<String, Object> entry : data.entrySet()) {
internalDict.set(
entry.getKey(),
new MValue(Fleece.toCBLObject(entry.getValue())));
}
return this;
}
} | [
"@",
"NonNull",
"@",
"Override",
"public",
"MutableDictionary",
"setData",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"internalDict",
".",
"clear",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Ent... | Set a dictionary as a content. Allowed value types are List, Date, Map, Number, null, String,
Array, Blob, and Dictionary. The List and Map must contain only the above types.
Setting the new dictionary content will replace the current data including the existing Array
and Dictionary objects.
@param data the dictionary object.
@return The self object. | [
"Set",
"a",
"dictionary",
"as",
"a",
"content",
".",
"Allowed",
"value",
"types",
"are",
"List",
"Date",
"Map",
"Number",
"null",
"String",
"Array",
"Blob",
"and",
"Dictionary",
".",
"The",
"List",
"and",
"Map",
"must",
"contain",
"only",
"the",
"above",
... | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableDictionary.java#L74-L86 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildTasksInner.java | BuildTasksInner.listSourceRepositoryPropertiesAsync | public Observable<SourceRepositoryPropertiesInner> listSourceRepositoryPropertiesAsync(String resourceGroupName, String registryName, String buildTaskName) {
"""
Get the source control properties for a build task.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param buildTaskName The name of the container registry build task.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the SourceRepositoryPropertiesInner object
"""
return listSourceRepositoryPropertiesWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName).map(new Func1<ServiceResponse<SourceRepositoryPropertiesInner>, SourceRepositoryPropertiesInner>() {
@Override
public SourceRepositoryPropertiesInner call(ServiceResponse<SourceRepositoryPropertiesInner> response) {
return response.body();
}
});
} | java | public Observable<SourceRepositoryPropertiesInner> listSourceRepositoryPropertiesAsync(String resourceGroupName, String registryName, String buildTaskName) {
return listSourceRepositoryPropertiesWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName).map(new Func1<ServiceResponse<SourceRepositoryPropertiesInner>, SourceRepositoryPropertiesInner>() {
@Override
public SourceRepositoryPropertiesInner call(ServiceResponse<SourceRepositoryPropertiesInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"SourceRepositoryPropertiesInner",
">",
"listSourceRepositoryPropertiesAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"buildTaskName",
")",
"{",
"return",
"listSourceRepositoryPropertiesWithServiceResponseAsy... | Get the source control properties for a build task.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param buildTaskName The name of the container registry build task.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the SourceRepositoryPropertiesInner object | [
"Get",
"the",
"source",
"control",
"properties",
"for",
"a",
"build",
"task",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildTasksInner.java#L1014-L1021 |
jqno/equalsverifier | src/main/java/nl/jqno/equalsverifier/internal/prefabvalues/FactoryCache.java | FactoryCache.put | public <T> void put(String typeName, PrefabValueFactory<T> factory) {
"""
Adds the given factory to the cache and associates it with the given
type name.
@param <T> Should match {@code typeName}.
@param typeName The fully qualified name of the type.
@param factory The factory to associate with {@code typeName}
"""
if (typeName != null) {
cache.put(typeName, factory);
}
} | java | public <T> void put(String typeName, PrefabValueFactory<T> factory) {
if (typeName != null) {
cache.put(typeName, factory);
}
} | [
"public",
"<",
"T",
">",
"void",
"put",
"(",
"String",
"typeName",
",",
"PrefabValueFactory",
"<",
"T",
">",
"factory",
")",
"{",
"if",
"(",
"typeName",
"!=",
"null",
")",
"{",
"cache",
".",
"put",
"(",
"typeName",
",",
"factory",
")",
";",
"}",
"}... | Adds the given factory to the cache and associates it with the given
type name.
@param <T> Should match {@code typeName}.
@param typeName The fully qualified name of the type.
@param factory The factory to associate with {@code typeName} | [
"Adds",
"the",
"given",
"factory",
"to",
"the",
"cache",
"and",
"associates",
"it",
"with",
"the",
"given",
"type",
"name",
"."
] | train | https://github.com/jqno/equalsverifier/blob/25d73c9cb801c8b20b257d1d1283ac6e0585ef1d/src/main/java/nl/jqno/equalsverifier/internal/prefabvalues/FactoryCache.java#L41-L45 |
structurizr/java | structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java | DocumentationTemplate.addSection | public Section addSection(SoftwareSystem softwareSystem, String title, Format format, String content) {
"""
Adds a section relating to a {@link SoftwareSystem}.
@param softwareSystem the {@link SoftwareSystem} the documentation content relates to
@param title the section title
@param format the {@link Format} of the documentation content
@param content a String containing the documentation content
@return a documentation {@link Section}
"""
return add(softwareSystem, title, format, content);
} | java | public Section addSection(SoftwareSystem softwareSystem, String title, Format format, String content) {
return add(softwareSystem, title, format, content);
} | [
"public",
"Section",
"addSection",
"(",
"SoftwareSystem",
"softwareSystem",
",",
"String",
"title",
",",
"Format",
"format",
",",
"String",
"content",
")",
"{",
"return",
"add",
"(",
"softwareSystem",
",",
"title",
",",
"format",
",",
"content",
")",
";",
"}... | Adds a section relating to a {@link SoftwareSystem}.
@param softwareSystem the {@link SoftwareSystem} the documentation content relates to
@param title the section title
@param format the {@link Format} of the documentation content
@param content a String containing the documentation content
@return a documentation {@link Section} | [
"Adds",
"a",
"section",
"relating",
"to",
"a",
"{",
"@link",
"SoftwareSystem",
"}",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java#L87-L89 |
evant/binding-collection-adapter | bindingcollectionadapter-recyclerview/src/main/java/me/tatarka/bindingcollectionadapter2/collections/DiffObservableList.java | DiffObservableList.calculateDiff | @NonNull
public DiffUtil.DiffResult calculateDiff(@NonNull final List<T> newItems) {
"""
Calculates the list of update operations that can convert this list into the given one.
@param newItems The items that this list will be set to.
@return A DiffResult that contains the information about the edit sequence to covert this
list into the given one.
"""
final ArrayList<T> frozenList;
synchronized (LIST_LOCK) {
frozenList = new ArrayList<>(list);
}
return doCalculateDiff(frozenList, newItems);
} | java | @NonNull
public DiffUtil.DiffResult calculateDiff(@NonNull final List<T> newItems) {
final ArrayList<T> frozenList;
synchronized (LIST_LOCK) {
frozenList = new ArrayList<>(list);
}
return doCalculateDiff(frozenList, newItems);
} | [
"@",
"NonNull",
"public",
"DiffUtil",
".",
"DiffResult",
"calculateDiff",
"(",
"@",
"NonNull",
"final",
"List",
"<",
"T",
">",
"newItems",
")",
"{",
"final",
"ArrayList",
"<",
"T",
">",
"frozenList",
";",
"synchronized",
"(",
"LIST_LOCK",
")",
"{",
"frozen... | Calculates the list of update operations that can convert this list into the given one.
@param newItems The items that this list will be set to.
@return A DiffResult that contains the information about the edit sequence to covert this
list into the given one. | [
"Calculates",
"the",
"list",
"of",
"update",
"operations",
"that",
"can",
"convert",
"this",
"list",
"into",
"the",
"given",
"one",
"."
] | train | https://github.com/evant/binding-collection-adapter/blob/f669eda0a7002128bb504dcba012c51531f1bedd/bindingcollectionadapter-recyclerview/src/main/java/me/tatarka/bindingcollectionadapter2/collections/DiffObservableList.java#L82-L89 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/sc/scparameter.java | scparameter.get | public static scparameter get(nitro_service service, options option) throws Exception {
"""
Use this API to fetch all the scparameter resources that are configured on netscaler.
"""
scparameter obj = new scparameter();
scparameter[] response = (scparameter[])obj.get_resources(service,option);
return response[0];
} | java | public static scparameter get(nitro_service service, options option) throws Exception{
scparameter obj = new scparameter();
scparameter[] response = (scparameter[])obj.get_resources(service,option);
return response[0];
} | [
"public",
"static",
"scparameter",
"get",
"(",
"nitro_service",
"service",
",",
"options",
"option",
")",
"throws",
"Exception",
"{",
"scparameter",
"obj",
"=",
"new",
"scparameter",
"(",
")",
";",
"scparameter",
"[",
"]",
"response",
"=",
"(",
"scparameter",
... | Use this API to fetch all the scparameter resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"scparameter",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/sc/scparameter.java#L150-L154 |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.getInteger | @PublicEvolving
public int getInteger(ConfigOption<Integer> configOption, int overrideDefault) {
"""
Returns the value associated with the given config option as an integer.
If no value is mapped under any key of the option, it returns the specified
default instead of the option's default value.
@param configOption The configuration option
@param overrideDefault The value to return if no value was mapper for any key of the option
@return the configured value associated with the given config option, or the overrideDefault
"""
Object o = getRawValueFromOption(configOption);
if (o == null) {
return overrideDefault;
}
return convertToInt(o, configOption.defaultValue());
} | java | @PublicEvolving
public int getInteger(ConfigOption<Integer> configOption, int overrideDefault) {
Object o = getRawValueFromOption(configOption);
if (o == null) {
return overrideDefault;
}
return convertToInt(o, configOption.defaultValue());
} | [
"@",
"PublicEvolving",
"public",
"int",
"getInteger",
"(",
"ConfigOption",
"<",
"Integer",
">",
"configOption",
",",
"int",
"overrideDefault",
")",
"{",
"Object",
"o",
"=",
"getRawValueFromOption",
"(",
"configOption",
")",
";",
"if",
"(",
"o",
"==",
"null",
... | Returns the value associated with the given config option as an integer.
If no value is mapped under any key of the option, it returns the specified
default instead of the option's default value.
@param configOption The configuration option
@param overrideDefault The value to return if no value was mapper for any key of the option
@return the configured value associated with the given config option, or the overrideDefault | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"config",
"option",
"as",
"an",
"integer",
".",
"If",
"no",
"value",
"is",
"mapped",
"under",
"any",
"key",
"of",
"the",
"option",
"it",
"returns",
"the",
"specified",
"default",
"instead",
"... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L234-L241 |
weld/core | impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java | ProxyFactory.createInterceptorBody | protected void createInterceptorBody(ClassMethod classMethod, MethodInformation method, ClassMethod staticConstructor) {
"""
Creates the given method on the proxy class where the implementation
forwards the call directly to the method handler.
<p/>
the generated bytecode is equivalent to:
<p/>
return (RetType) methodHandler.invoke(this,param1,param2);
@param classMethod the class method
@param method any JLR method
@return the method byte code
"""
invokeMethodHandler(classMethod, method, true, DEFAULT_METHOD_RESOLVER, staticConstructor);
} | java | protected void createInterceptorBody(ClassMethod classMethod, MethodInformation method, ClassMethod staticConstructor) {
invokeMethodHandler(classMethod, method, true, DEFAULT_METHOD_RESOLVER, staticConstructor);
} | [
"protected",
"void",
"createInterceptorBody",
"(",
"ClassMethod",
"classMethod",
",",
"MethodInformation",
"method",
",",
"ClassMethod",
"staticConstructor",
")",
"{",
"invokeMethodHandler",
"(",
"classMethod",
",",
"method",
",",
"true",
",",
"DEFAULT_METHOD_RESOLVER",
... | Creates the given method on the proxy class where the implementation
forwards the call directly to the method handler.
<p/>
the generated bytecode is equivalent to:
<p/>
return (RetType) methodHandler.invoke(this,param1,param2);
@param classMethod the class method
@param method any JLR method
@return the method byte code | [
"Creates",
"the",
"given",
"method",
"on",
"the",
"proxy",
"class",
"where",
"the",
"implementation",
"forwards",
"the",
"call",
"directly",
"to",
"the",
"method",
"handler",
".",
"<p",
"/",
">",
"the",
"generated",
"bytecode",
"is",
"equivalent",
"to",
":",... | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java#L732-L734 |
SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/measure/LiveMeasureDao.java | LiveMeasureDao.sumNclocOfBiggestLongLivingBranch | public long sumNclocOfBiggestLongLivingBranch(DbSession dbSession, SumNclocDbQuery dbQuery) {
"""
Example:
If Main Branch = 0 LOCs (provisioned but never analyzed) and the "largest long-lived branch" is 120 LOCs, I'm expecting to consider the value 120.
If Main Branch = 100 LOCs and the "largest long-lived branch" is 120 LOCs, I'm expecting to consider the value 120.
If Main Branch = 100 LOCs and the "largest long-lived branch" is 80 LOCs, I'm expecting to consider the value 100.
"""
Long ncloc = mapper(dbSession).sumNclocOfBiggestLongLivingBranch(
NCLOC_KEY, KeyType.BRANCH, BranchType.LONG, dbQuery.getOrganizationUuid(), dbQuery.getOnlyPrivateProjects(), dbQuery.getProjectUuidToExclude());
return ncloc == null ? 0L : ncloc;
} | java | public long sumNclocOfBiggestLongLivingBranch(DbSession dbSession, SumNclocDbQuery dbQuery) {
Long ncloc = mapper(dbSession).sumNclocOfBiggestLongLivingBranch(
NCLOC_KEY, KeyType.BRANCH, BranchType.LONG, dbQuery.getOrganizationUuid(), dbQuery.getOnlyPrivateProjects(), dbQuery.getProjectUuidToExclude());
return ncloc == null ? 0L : ncloc;
} | [
"public",
"long",
"sumNclocOfBiggestLongLivingBranch",
"(",
"DbSession",
"dbSession",
",",
"SumNclocDbQuery",
"dbQuery",
")",
"{",
"Long",
"ncloc",
"=",
"mapper",
"(",
"dbSession",
")",
".",
"sumNclocOfBiggestLongLivingBranch",
"(",
"NCLOC_KEY",
",",
"KeyType",
".",
... | Example:
If Main Branch = 0 LOCs (provisioned but never analyzed) and the "largest long-lived branch" is 120 LOCs, I'm expecting to consider the value 120.
If Main Branch = 100 LOCs and the "largest long-lived branch" is 120 LOCs, I'm expecting to consider the value 120.
If Main Branch = 100 LOCs and the "largest long-lived branch" is 80 LOCs, I'm expecting to consider the value 100. | [
"Example",
":",
"If",
"Main",
"Branch",
"=",
"0",
"LOCs",
"(",
"provisioned",
"but",
"never",
"analyzed",
")",
"and",
"the",
"largest",
"long",
"-",
"lived",
"branch",
"is",
"120",
"LOCs",
"I",
"m",
"expecting",
"to",
"consider",
"the",
"value",
"120",
... | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/measure/LiveMeasureDao.java#L105-L109 |
Netflix/Nicobar | nicobar-core/src/main/java/com/netflix/nicobar/core/module/GraphUtils.java | GraphUtils.swapVertices | public static <V> void swapVertices(DirectedGraph<V, DefaultEdge> graph, Map<V, Set<V>> alternates) {
"""
replace the vertices in the graph with an alternate set of vertices.
@param graph graph to be mutated
@param alternates alternate vertices to insert into the graph. map of vertices to their direct dependents.
"""
Objects.requireNonNull(graph,"graph");
Objects.requireNonNull(alternates, "alternates");
// add all of the new vertices to prep for linking
addAllVertices(graph, alternates.keySet());
for (Entry<V, Set<V>> entry : alternates.entrySet()) {
V alternateVertex = entry.getKey();
Set<V> dependencies = entry.getValue();
// make sure we can satisfy all dependencies before continuing
// TODO: this should probably done outside so it can be handled better.
if (!graph.vertexSet().containsAll(dependencies)) {
continue;
}
// figure out which vertices depend on the incumbent vertex
Set<V> dependents = Collections.emptySet();
if (graph.containsVertex(alternateVertex)) {
dependents = getIncomingVertices(graph, alternateVertex);
graph.removeVertex(alternateVertex);
}
// (re)insert the vertex and re-link the dependents
graph.addVertex(alternateVertex);
addIncomingEdges(graph, alternateVertex, dependents);
// create the dependencies
addOutgoingEdges(graph, alternateVertex, dependencies);
}
} | java | public static <V> void swapVertices(DirectedGraph<V, DefaultEdge> graph, Map<V, Set<V>> alternates) {
Objects.requireNonNull(graph,"graph");
Objects.requireNonNull(alternates, "alternates");
// add all of the new vertices to prep for linking
addAllVertices(graph, alternates.keySet());
for (Entry<V, Set<V>> entry : alternates.entrySet()) {
V alternateVertex = entry.getKey();
Set<V> dependencies = entry.getValue();
// make sure we can satisfy all dependencies before continuing
// TODO: this should probably done outside so it can be handled better.
if (!graph.vertexSet().containsAll(dependencies)) {
continue;
}
// figure out which vertices depend on the incumbent vertex
Set<V> dependents = Collections.emptySet();
if (graph.containsVertex(alternateVertex)) {
dependents = getIncomingVertices(graph, alternateVertex);
graph.removeVertex(alternateVertex);
}
// (re)insert the vertex and re-link the dependents
graph.addVertex(alternateVertex);
addIncomingEdges(graph, alternateVertex, dependents);
// create the dependencies
addOutgoingEdges(graph, alternateVertex, dependencies);
}
} | [
"public",
"static",
"<",
"V",
">",
"void",
"swapVertices",
"(",
"DirectedGraph",
"<",
"V",
",",
"DefaultEdge",
">",
"graph",
",",
"Map",
"<",
"V",
",",
"Set",
"<",
"V",
">",
">",
"alternates",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"graph",
... | replace the vertices in the graph with an alternate set of vertices.
@param graph graph to be mutated
@param alternates alternate vertices to insert into the graph. map of vertices to their direct dependents. | [
"replace",
"the",
"vertices",
"in",
"the",
"graph",
"with",
"an",
"alternate",
"set",
"of",
"vertices",
"."
] | train | https://github.com/Netflix/Nicobar/blob/507173dcae4a86a955afc3df222a855862fab8d7/nicobar-core/src/main/java/com/netflix/nicobar/core/module/GraphUtils.java#L43-L71 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java | SDNN.sigmoidDerivative | public SDVariable sigmoidDerivative(SDVariable x, SDVariable wrt) {
"""
Element-wise sigmoid function derivative: dL/dIn given input and dL/dOut
@param x Input Variable
@param wrt Gradient at the output - dL/dOut. Must have same shape as the input
@return Output variable
"""
return sigmoidDerivative(null, x, wrt);
} | java | public SDVariable sigmoidDerivative(SDVariable x, SDVariable wrt) {
return sigmoidDerivative(null, x, wrt);
} | [
"public",
"SDVariable",
"sigmoidDerivative",
"(",
"SDVariable",
"x",
",",
"SDVariable",
"wrt",
")",
"{",
"return",
"sigmoidDerivative",
"(",
"null",
",",
"x",
",",
"wrt",
")",
";",
"}"
] | Element-wise sigmoid function derivative: dL/dIn given input and dL/dOut
@param x Input Variable
@param wrt Gradient at the output - dL/dOut. Must have same shape as the input
@return Output variable | [
"Element",
"-",
"wise",
"sigmoid",
"function",
"derivative",
":",
"dL",
"/",
"dIn",
"given",
"input",
"and",
"dL",
"/",
"dOut"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java#L538-L540 |
classgraph/classgraph | src/main/java/io/github/classgraph/ResourceList.java | ResourceList.forEachByteBuffer | public void forEachByteBuffer(final ByteBufferConsumer byteBufferConsumer, final boolean ignoreIOExceptions) {
"""
Read each {@link Resource} in this {@link ResourceList} as a {@link ByteBuffer}, pass the {@link ByteBuffer}
to the given {@link InputStreamConsumer}, then release the {@link ByteBuffer} after the
{@link ByteBufferConsumer} returns, by calling {@link Resource#close()}.
@param byteBufferConsumer
The {@link ByteBufferConsumer}.
@param ignoreIOExceptions
if true, any {@link IOException} thrown while trying to load any of the resources will be silently
ignored.
@throws IllegalArgumentException
if ignoreExceptions is false, and an {@link IOException} is thrown while trying to load any of
the resources.
"""
for (final Resource resource : this) {
try {
final ByteBuffer byteBuffer = resource.read();
byteBufferConsumer.accept(resource, byteBuffer);
} catch (final IOException e) {
if (!ignoreIOExceptions) {
throw new IllegalArgumentException("Could not load resource " + resource, e);
}
} finally {
resource.close();
}
}
} | java | public void forEachByteBuffer(final ByteBufferConsumer byteBufferConsumer, final boolean ignoreIOExceptions) {
for (final Resource resource : this) {
try {
final ByteBuffer byteBuffer = resource.read();
byteBufferConsumer.accept(resource, byteBuffer);
} catch (final IOException e) {
if (!ignoreIOExceptions) {
throw new IllegalArgumentException("Could not load resource " + resource, e);
}
} finally {
resource.close();
}
}
} | [
"public",
"void",
"forEachByteBuffer",
"(",
"final",
"ByteBufferConsumer",
"byteBufferConsumer",
",",
"final",
"boolean",
"ignoreIOExceptions",
")",
"{",
"for",
"(",
"final",
"Resource",
"resource",
":",
"this",
")",
"{",
"try",
"{",
"final",
"ByteBuffer",
"byteBu... | Read each {@link Resource} in this {@link ResourceList} as a {@link ByteBuffer}, pass the {@link ByteBuffer}
to the given {@link InputStreamConsumer}, then release the {@link ByteBuffer} after the
{@link ByteBufferConsumer} returns, by calling {@link Resource#close()}.
@param byteBufferConsumer
The {@link ByteBufferConsumer}.
@param ignoreIOExceptions
if true, any {@link IOException} thrown while trying to load any of the resources will be silently
ignored.
@throws IllegalArgumentException
if ignoreExceptions is false, and an {@link IOException} is thrown while trying to load any of
the resources. | [
"Read",
"each",
"{",
"@link",
"Resource",
"}",
"in",
"this",
"{",
"@link",
"ResourceList",
"}",
"as",
"a",
"{",
"@link",
"ByteBuffer",
"}",
"pass",
"the",
"{",
"@link",
"ByteBuffer",
"}",
"to",
"the",
"given",
"{",
"@link",
"InputStreamConsumer",
"}",
"t... | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/ResourceList.java#L447-L460 |
apereo/cas | support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java | LdapUtils.executeDeleteOperation | public static boolean executeDeleteOperation(final ConnectionFactory connectionFactory, final LdapEntry entry) {
"""
Execute delete operation boolean.
@param connectionFactory the connection factory
@param entry the entry
@return true/false
"""
try (val connection = createConnection(connectionFactory)) {
val delete = new DeleteOperation(connection);
val request = new DeleteRequest(entry.getDn());
request.setReferralHandler(new DeleteReferralHandler());
val res = delete.execute(request);
return res.getResultCode() == ResultCode.SUCCESS;
} catch (final LdapException e) {
LOGGER.error(e.getMessage(), e);
}
return false;
} | java | public static boolean executeDeleteOperation(final ConnectionFactory connectionFactory, final LdapEntry entry) {
try (val connection = createConnection(connectionFactory)) {
val delete = new DeleteOperation(connection);
val request = new DeleteRequest(entry.getDn());
request.setReferralHandler(new DeleteReferralHandler());
val res = delete.execute(request);
return res.getResultCode() == ResultCode.SUCCESS;
} catch (final LdapException e) {
LOGGER.error(e.getMessage(), e);
}
return false;
} | [
"public",
"static",
"boolean",
"executeDeleteOperation",
"(",
"final",
"ConnectionFactory",
"connectionFactory",
",",
"final",
"LdapEntry",
"entry",
")",
"{",
"try",
"(",
"val",
"connection",
"=",
"createConnection",
"(",
"connectionFactory",
")",
")",
"{",
"val",
... | Execute delete operation boolean.
@param connectionFactory the connection factory
@param entry the entry
@return true/false | [
"Execute",
"delete",
"operation",
"boolean",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java#L417-L428 |
lessthanoptimal/BoofCV | integration/boofcv-android/src/main/java/boofcv/android/camera2/SimpleCamera2Activity.java | SimpleCamera2Activity.configureTransform | private void configureTransform(int viewWidth, int viewHeight) {
"""
Configures the necessary {@link Matrix} transformation to `mTextureView`.
This method should not to be called until the camera preview size is determined in
openCamera, or until the size of `mTextureView` is fixed.
@param viewWidth The width of `mTextureView`
@param viewHeight The height of `mTextureView`
"""
int cameraWidth,cameraHeight;
try {
open.mLock.lock();
if (null == mTextureView || null == open.mCameraSize) {
return;
}
cameraWidth = open.mCameraSize.getWidth();
cameraHeight = open.mCameraSize.getHeight();
} finally {
open.mLock.unlock();
}
int rotation = getWindowManager().getDefaultDisplay().getRotation();
Matrix matrix = new Matrix();
RectF viewRect = new RectF(0, 0, viewWidth, viewHeight);
RectF bufferRect = new RectF(0, 0, cameraHeight, cameraWidth);// TODO why w/h swapped?
float centerX = viewRect.centerX();
float centerY = viewRect.centerY();
if (Surface.ROTATION_90 == rotation || Surface.ROTATION_270 == rotation) {
bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY());
matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL);
float scale = Math.max(
(float) viewHeight / cameraHeight,
(float) viewWidth / cameraWidth);
matrix.postScale(scale, scale, centerX, centerY);
matrix.postRotate(90 * (rotation - 2), centerX, centerY);
}
mTextureView.setTransform(matrix);
} | java | private void configureTransform(int viewWidth, int viewHeight) {
int cameraWidth,cameraHeight;
try {
open.mLock.lock();
if (null == mTextureView || null == open.mCameraSize) {
return;
}
cameraWidth = open.mCameraSize.getWidth();
cameraHeight = open.mCameraSize.getHeight();
} finally {
open.mLock.unlock();
}
int rotation = getWindowManager().getDefaultDisplay().getRotation();
Matrix matrix = new Matrix();
RectF viewRect = new RectF(0, 0, viewWidth, viewHeight);
RectF bufferRect = new RectF(0, 0, cameraHeight, cameraWidth);// TODO why w/h swapped?
float centerX = viewRect.centerX();
float centerY = viewRect.centerY();
if (Surface.ROTATION_90 == rotation || Surface.ROTATION_270 == rotation) {
bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY());
matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL);
float scale = Math.max(
(float) viewHeight / cameraHeight,
(float) viewWidth / cameraWidth);
matrix.postScale(scale, scale, centerX, centerY);
matrix.postRotate(90 * (rotation - 2), centerX, centerY);
}
mTextureView.setTransform(matrix);
} | [
"private",
"void",
"configureTransform",
"(",
"int",
"viewWidth",
",",
"int",
"viewHeight",
")",
"{",
"int",
"cameraWidth",
",",
"cameraHeight",
";",
"try",
"{",
"open",
".",
"mLock",
".",
"lock",
"(",
")",
";",
"if",
"(",
"null",
"==",
"mTextureView",
"... | Configures the necessary {@link Matrix} transformation to `mTextureView`.
This method should not to be called until the camera preview size is determined in
openCamera, or until the size of `mTextureView` is fixed.
@param viewWidth The width of `mTextureView`
@param viewHeight The height of `mTextureView` | [
"Configures",
"the",
"necessary",
"{",
"@link",
"Matrix",
"}",
"transformation",
"to",
"mTextureView",
".",
"This",
"method",
"should",
"not",
"to",
"be",
"called",
"until",
"the",
"camera",
"preview",
"size",
"is",
"determined",
"in",
"openCamera",
"or",
"unt... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/camera2/SimpleCamera2Activity.java#L728-L757 |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ThreadContextBuilderImpl.java | ThreadContextBuilderImpl.failOnOverlapOfClearedPropagatedUnchanged | private void failOnOverlapOfClearedPropagatedUnchanged(Set<String> cleared, Set<String> propagated, Set<String> unchanged) {
"""
Fail with error identifying the overlap(s) in context types between any two of:
cleared, propagated, unchanged.
@throws IllegalStateException identifying the overlap.
"""
HashSet<String> overlap = new HashSet<String>(cleared);
overlap.retainAll(propagated);
HashSet<String> s = new HashSet<String>(cleared);
s.retainAll(unchanged);
overlap.addAll(s);
s = new HashSet<String>(propagated);
s.retainAll(unchanged);
overlap.addAll(s);
if (overlap.isEmpty()) // only possible if builder is concurrently modified during build
throw new ConcurrentModificationException();
throw new IllegalStateException(Tr.formatMessage(tc, "CWWKC1152.context.lists.overlap", overlap));
} | java | private void failOnOverlapOfClearedPropagatedUnchanged(Set<String> cleared, Set<String> propagated, Set<String> unchanged) {
HashSet<String> overlap = new HashSet<String>(cleared);
overlap.retainAll(propagated);
HashSet<String> s = new HashSet<String>(cleared);
s.retainAll(unchanged);
overlap.addAll(s);
s = new HashSet<String>(propagated);
s.retainAll(unchanged);
overlap.addAll(s);
if (overlap.isEmpty()) // only possible if builder is concurrently modified during build
throw new ConcurrentModificationException();
throw new IllegalStateException(Tr.formatMessage(tc, "CWWKC1152.context.lists.overlap", overlap));
} | [
"private",
"void",
"failOnOverlapOfClearedPropagatedUnchanged",
"(",
"Set",
"<",
"String",
">",
"cleared",
",",
"Set",
"<",
"String",
">",
"propagated",
",",
"Set",
"<",
"String",
">",
"unchanged",
")",
"{",
"HashSet",
"<",
"String",
">",
"overlap",
"=",
"ne... | Fail with error identifying the overlap(s) in context types between any two of:
cleared, propagated, unchanged.
@throws IllegalStateException identifying the overlap. | [
"Fail",
"with",
"error",
"identifying",
"the",
"overlap",
"(",
"s",
")",
"in",
"context",
"types",
"between",
"any",
"two",
"of",
":",
"cleared",
"propagated",
"unchanged",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ThreadContextBuilderImpl.java#L136-L148 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/xml/IronjacamarXmlGen.java | IronjacamarXmlGen.getPropsString | private void getPropsString(StringBuilder strProps, List<ConfigPropType> propsList, int indent) {
"""
generate properties String
@param strProps the string property
@param propsList the properties list
@param indent how much indent
"""
for (ConfigPropType props : propsList)
{
for (int i = 0; i < indent; i++)
strProps.append(" ");
strProps.append("<config-property name=\"");
strProps.append(props.getName());
strProps.append("\">");
strProps.append(props.getValue());
strProps.append("</config-property>");
strProps.append("\n");
}
} | java | private void getPropsString(StringBuilder strProps, List<ConfigPropType> propsList, int indent)
{
for (ConfigPropType props : propsList)
{
for (int i = 0; i < indent; i++)
strProps.append(" ");
strProps.append("<config-property name=\"");
strProps.append(props.getName());
strProps.append("\">");
strProps.append(props.getValue());
strProps.append("</config-property>");
strProps.append("\n");
}
} | [
"private",
"void",
"getPropsString",
"(",
"StringBuilder",
"strProps",
",",
"List",
"<",
"ConfigPropType",
">",
"propsList",
",",
"int",
"indent",
")",
"{",
"for",
"(",
"ConfigPropType",
"props",
":",
"propsList",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0"... | generate properties String
@param strProps the string property
@param propsList the properties list
@param indent how much indent | [
"generate",
"properties",
"String"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/xml/IronjacamarXmlGen.java#L140-L153 |
podio/podio-java | src/main/java/com/podio/app/AppAPI.java | AppAPI.getField | public ApplicationField getField(int appId, String externalId) {
"""
Returns a single field from an app.
@param appId
The id of the app the field is on
@param externalId
The id of the field to be returned
@return The definition and current configuration of the requested field
"""
return getResourceFactory().getApiResource(
"/app/" + appId + "/field/" + externalId).get(
ApplicationField.class);
} | java | public ApplicationField getField(int appId, String externalId) {
return getResourceFactory().getApiResource(
"/app/" + appId + "/field/" + externalId).get(
ApplicationField.class);
} | [
"public",
"ApplicationField",
"getField",
"(",
"int",
"appId",
",",
"String",
"externalId",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/app/\"",
"+",
"appId",
"+",
"\"/field/\"",
"+",
"externalId",
")",
".",
"get",
"(",
... | Returns a single field from an app.
@param appId
The id of the app the field is on
@param externalId
The id of the field to be returned
@return The definition and current configuration of the requested field | [
"Returns",
"a",
"single",
"field",
"from",
"an",
"app",
"."
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/app/AppAPI.java#L159-L163 |
js-lib-com/commons | src/main/java/js/converter/LocaleConverter.java | LocaleConverter.asObject | @Override
public <T> T asObject(String string, Class<T> valueType) throws IllegalArgumentException {
"""
Create locale instance from ISO-639 language and ISO-3166 country code, for example en-US.
@throws IllegalArgumentException if given string argument is not well formatted.
"""
// at this point value type is guaranteed to be a Locale
int dashIndex = string.indexOf('-');
if (dashIndex == -1) {
throw new IllegalArgumentException(String.format("Cannot convert |%s| to locale instance.", string));
}
return (T) new Locale(string.substring(0, dashIndex), string.substring(dashIndex + 1));
} | java | @Override
public <T> T asObject(String string, Class<T> valueType) throws IllegalArgumentException {
// at this point value type is guaranteed to be a Locale
int dashIndex = string.indexOf('-');
if (dashIndex == -1) {
throw new IllegalArgumentException(String.format("Cannot convert |%s| to locale instance.", string));
}
return (T) new Locale(string.substring(0, dashIndex), string.substring(dashIndex + 1));
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"asObject",
"(",
"String",
"string",
",",
"Class",
"<",
"T",
">",
"valueType",
")",
"throws",
"IllegalArgumentException",
"{",
"// at this point value type is guaranteed to be a Locale\r",
"int",
"dashIndex",
"=",
"stri... | Create locale instance from ISO-639 language and ISO-3166 country code, for example en-US.
@throws IllegalArgumentException if given string argument is not well formatted. | [
"Create",
"locale",
"instance",
"from",
"ISO",
"-",
"639",
"language",
"and",
"ISO",
"-",
"3166",
"country",
"code",
"for",
"example",
"en",
"-",
"US",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/LocaleConverter.java#L24-L32 |
igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java | AgentSession.setStatus | public void setStatus(Presence.Mode presenceMode, String status) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
"""
Sets the agent's current status with the workgroup. The presence mode affects how offers
are routed to the agent. The possible presence modes with their meanings are as follows:<ul>
<li>Presence.Mode.AVAILABLE -- (Default) the agent is available for more chats
(equivalent to Presence.Mode.CHAT).
<li>Presence.Mode.DO_NOT_DISTURB -- the agent is busy and should not be disturbed.
However, special case, or extreme urgency chats may still be offered to the agent.
<li>Presence.Mode.AWAY -- the agent is not available and should not
have a chat routed to them (equivalent to Presence.Mode.EXTENDED_AWAY).</ul>
@param presenceMode the presence mode of the agent.
@param status sets the status message of the presence update.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException
@throws IllegalStateException if the agent is not online with the workgroup.
"""
if (!online) {
throw new IllegalStateException("Cannot set status when the agent is not online.");
}
if (presenceMode == null) {
presenceMode = Presence.Mode.available;
}
this.presenceMode = presenceMode;
Presence presence = new Presence(Presence.Type.available);
presence.setMode(presenceMode);
presence.setTo(this.getWorkgroupJID());
if (status != null) {
presence.setStatus(status);
}
presence.addExtension(new MetaData(this.metaData));
StanzaCollector collector = this.connection.createStanzaCollectorAndSend(new AndFilter(new StanzaTypeFilter(Presence.class),
FromMatchesFilter.create(workgroupJID)), presence);
collector.nextResultOrThrow();
} | java | public void setStatus(Presence.Mode presenceMode, String status) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (!online) {
throw new IllegalStateException("Cannot set status when the agent is not online.");
}
if (presenceMode == null) {
presenceMode = Presence.Mode.available;
}
this.presenceMode = presenceMode;
Presence presence = new Presence(Presence.Type.available);
presence.setMode(presenceMode);
presence.setTo(this.getWorkgroupJID());
if (status != null) {
presence.setStatus(status);
}
presence.addExtension(new MetaData(this.metaData));
StanzaCollector collector = this.connection.createStanzaCollectorAndSend(new AndFilter(new StanzaTypeFilter(Presence.class),
FromMatchesFilter.create(workgroupJID)), presence);
collector.nextResultOrThrow();
} | [
"public",
"void",
"setStatus",
"(",
"Presence",
".",
"Mode",
"presenceMode",
",",
"String",
"status",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"if",
"(",
"!",
"online",
")",
"{... | Sets the agent's current status with the workgroup. The presence mode affects how offers
are routed to the agent. The possible presence modes with their meanings are as follows:<ul>
<li>Presence.Mode.AVAILABLE -- (Default) the agent is available for more chats
(equivalent to Presence.Mode.CHAT).
<li>Presence.Mode.DO_NOT_DISTURB -- the agent is busy and should not be disturbed.
However, special case, or extreme urgency chats may still be offered to the agent.
<li>Presence.Mode.AWAY -- the agent is not available and should not
have a chat routed to them (equivalent to Presence.Mode.EXTENDED_AWAY).</ul>
@param presenceMode the presence mode of the agent.
@param status sets the status message of the presence update.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException
@throws IllegalStateException if the agent is not online with the workgroup. | [
"Sets",
"the",
"agent",
"s",
"current",
"status",
"with",
"the",
"workgroup",
".",
"The",
"presence",
"mode",
"affects",
"how",
"offers",
"are",
"routed",
"to",
"the",
"agent",
".",
"The",
"possible",
"presence",
"modes",
"with",
"their",
"meanings",
"are",
... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java#L471-L494 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/TableWorks.java | TableWorks.setColDefaultExpression | void setColDefaultExpression(int colIndex, Expression def) {
"""
performs the work for changing the default value of a column
@param colIndex int
@param def Expression
"""
if (def == null) {
table.checkColumnInFKConstraint(colIndex, Constraint.SET_DEFAULT);
}
table.setDefaultExpression(colIndex, def);
} | java | void setColDefaultExpression(int colIndex, Expression def) {
if (def == null) {
table.checkColumnInFKConstraint(colIndex, Constraint.SET_DEFAULT);
}
table.setDefaultExpression(colIndex, def);
} | [
"void",
"setColDefaultExpression",
"(",
"int",
"colIndex",
",",
"Expression",
"def",
")",
"{",
"if",
"(",
"def",
"==",
"null",
")",
"{",
"table",
".",
"checkColumnInFKConstraint",
"(",
"colIndex",
",",
"Constraint",
".",
"SET_DEFAULT",
")",
";",
"}",
"table"... | performs the work for changing the default value of a column
@param colIndex int
@param def Expression | [
"performs",
"the",
"work",
"for",
"changing",
"the",
"default",
"value",
"of",
"a",
"column"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/TableWorks.java#L1066-L1073 |
haraldk/TwelveMonkeys | common/common-image/src/main/java/com/twelvemonkeys/image/MagickUtil.java | MagickUtil.toMagick | public static MagickImage toMagick(BufferedImage pImage) throws MagickException {
"""
Converts a {@code BufferedImage} to a {@code MagickImage}.
<p/>
The conversion depends on {@code pImage}'s {@code ColorModel}:
<dl>
<dt>{@code IndexColorModel} with 1 bit b/w</dt>
<dd>{@code MagickImage} of type {@code ImageType.BilevelType}</dd>
<dt>{@code IndexColorModel} > 1 bit,</dt>
<dd>{@code MagickImage} of type {@code ImageType.PaletteType}
or {@code MagickImage} of type {@code ImageType.PaletteMatteType}
depending on <tt>ColorModel.getAlpha()</dd>
<dt>{@code ColorModel.getColorSpace().getType() == ColorSpace.TYPE_GRAY}</dt>
<dd>{@code MagickImage} of type {@code ImageType.GrayscaleType}
or {@code MagickImage} of type {@code ImageType.GrayscaleMatteType}
depending on <tt>ColorModel.getAlpha()</dd>
<dt>{@code ColorModel.getColorSpace().getType() == ColorSpace.TYPE_RGB}</dt>
<dd>{@code MagickImage} of type {@code ImageType.TrueColorType}
or {@code MagickImage} of type {@code ImageType.TrueColorPaletteType}</dd>
@param pImage the original {@code BufferedImage}
@return a new {@code MagickImage}
@throws IllegalArgumentException if {@code pImage} is {@code null}
or if the {@code ColorModel} is not one mentioned above.
@throws MagickException if an exception occurs during conversion
@see BufferedImage
"""
if (pImage == null) {
throw new IllegalArgumentException("image == null");
}
long start = 0L;
if (DEBUG) {
start = System.currentTimeMillis();
}
try {
ColorModel cm = pImage.getColorModel();
if (cm instanceof IndexColorModel) {
// Handles both BilevelType, PaletteType and PaletteMatteType
return indexedToMagick(pImage, (IndexColorModel) cm, cm.hasAlpha());
}
switch (cm.getColorSpace().getType()) {
case ColorSpace.TYPE_GRAY:
// Handles GrayType and GrayMatteType
return grayToMagick(pImage, cm.hasAlpha());
case ColorSpace.TYPE_RGB:
// Handles TrueColorType and TrueColorMatteType
return rgbToMagic(pImage, cm.hasAlpha());
case ColorSpace.TYPE_CMY:
case ColorSpace.TYPE_CMYK:
case ColorSpace.TYPE_HLS:
case ColorSpace.TYPE_HSV:
// Other types not supported yet
default:
throw new IllegalArgumentException("Unknown buffered image type: " + pImage);
}
}
finally {
if (DEBUG) {
long time = System.currentTimeMillis() - start;
System.out.println("Conversion to MagickImage: " + time + " ms");
}
}
} | java | public static MagickImage toMagick(BufferedImage pImage) throws MagickException {
if (pImage == null) {
throw new IllegalArgumentException("image == null");
}
long start = 0L;
if (DEBUG) {
start = System.currentTimeMillis();
}
try {
ColorModel cm = pImage.getColorModel();
if (cm instanceof IndexColorModel) {
// Handles both BilevelType, PaletteType and PaletteMatteType
return indexedToMagick(pImage, (IndexColorModel) cm, cm.hasAlpha());
}
switch (cm.getColorSpace().getType()) {
case ColorSpace.TYPE_GRAY:
// Handles GrayType and GrayMatteType
return grayToMagick(pImage, cm.hasAlpha());
case ColorSpace.TYPE_RGB:
// Handles TrueColorType and TrueColorMatteType
return rgbToMagic(pImage, cm.hasAlpha());
case ColorSpace.TYPE_CMY:
case ColorSpace.TYPE_CMYK:
case ColorSpace.TYPE_HLS:
case ColorSpace.TYPE_HSV:
// Other types not supported yet
default:
throw new IllegalArgumentException("Unknown buffered image type: " + pImage);
}
}
finally {
if (DEBUG) {
long time = System.currentTimeMillis() - start;
System.out.println("Conversion to MagickImage: " + time + " ms");
}
}
} | [
"public",
"static",
"MagickImage",
"toMagick",
"(",
"BufferedImage",
"pImage",
")",
"throws",
"MagickException",
"{",
"if",
"(",
"pImage",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"image == null\"",
")",
";",
"}",
"long",
"start... | Converts a {@code BufferedImage} to a {@code MagickImage}.
<p/>
The conversion depends on {@code pImage}'s {@code ColorModel}:
<dl>
<dt>{@code IndexColorModel} with 1 bit b/w</dt>
<dd>{@code MagickImage} of type {@code ImageType.BilevelType}</dd>
<dt>{@code IndexColorModel} > 1 bit,</dt>
<dd>{@code MagickImage} of type {@code ImageType.PaletteType}
or {@code MagickImage} of type {@code ImageType.PaletteMatteType}
depending on <tt>ColorModel.getAlpha()</dd>
<dt>{@code ColorModel.getColorSpace().getType() == ColorSpace.TYPE_GRAY}</dt>
<dd>{@code MagickImage} of type {@code ImageType.GrayscaleType}
or {@code MagickImage} of type {@code ImageType.GrayscaleMatteType}
depending on <tt>ColorModel.getAlpha()</dd>
<dt>{@code ColorModel.getColorSpace().getType() == ColorSpace.TYPE_RGB}</dt>
<dd>{@code MagickImage} of type {@code ImageType.TrueColorType}
or {@code MagickImage} of type {@code ImageType.TrueColorPaletteType}</dd>
@param pImage the original {@code BufferedImage}
@return a new {@code MagickImage}
@throws IllegalArgumentException if {@code pImage} is {@code null}
or if the {@code ColorModel} is not one mentioned above.
@throws MagickException if an exception occurs during conversion
@see BufferedImage | [
"Converts",
"a",
"{",
"@code",
"BufferedImage",
"}",
"to",
"a",
"{",
"@code",
"MagickImage",
"}",
".",
"<p",
"/",
">",
"The",
"conversion",
"depends",
"on",
"{",
"@code",
"pImage",
"}",
"s",
"{",
"@code",
"ColorModel",
"}",
":",
"<dl",
">",
"<dt",
">... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/MagickUtil.java#L222-L261 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.createInput | @PublicEvolving
public <OUT> DataStreamSource<OUT> createInput(InputFormat<OUT, ?> inputFormat) {
"""
Generic method to create an input data stream with {@link org.apache.flink.api.common.io.InputFormat}.
<p>Since all data streams need specific information about their types, this method needs to determine the
type of the data produced by the input format. It will attempt to determine the data type by reflection,
unless the input format implements the {@link org.apache.flink.api.java.typeutils.ResultTypeQueryable} interface.
In the latter case, this method will invoke the
{@link org.apache.flink.api.java.typeutils.ResultTypeQueryable#getProducedType()} method to determine data
type produced by the input format.
<p><b>NOTES ON CHECKPOINTING: </b> In the case of a {@link FileInputFormat}, the source
(which executes the {@link ContinuousFileMonitoringFunction}) monitors the path, creates the
{@link org.apache.flink.core.fs.FileInputSplit FileInputSplits} to be processed, forwards
them to the downstream {@link ContinuousFileReaderOperator} to read the actual data, and exits,
without waiting for the readers to finish reading. This implies that no more checkpoint
barriers are going to be forwarded after the source exits, thus having no checkpoints.
@param inputFormat
The input format used to create the data stream
@param <OUT>
The type of the returned data stream
@return The data stream that represents the data created by the input format
"""
return createInput(inputFormat, TypeExtractor.getInputFormatTypes(inputFormat));
} | java | @PublicEvolving
public <OUT> DataStreamSource<OUT> createInput(InputFormat<OUT, ?> inputFormat) {
return createInput(inputFormat, TypeExtractor.getInputFormatTypes(inputFormat));
} | [
"@",
"PublicEvolving",
"public",
"<",
"OUT",
">",
"DataStreamSource",
"<",
"OUT",
">",
"createInput",
"(",
"InputFormat",
"<",
"OUT",
",",
"?",
">",
"inputFormat",
")",
"{",
"return",
"createInput",
"(",
"inputFormat",
",",
"TypeExtractor",
".",
"getInputForma... | Generic method to create an input data stream with {@link org.apache.flink.api.common.io.InputFormat}.
<p>Since all data streams need specific information about their types, this method needs to determine the
type of the data produced by the input format. It will attempt to determine the data type by reflection,
unless the input format implements the {@link org.apache.flink.api.java.typeutils.ResultTypeQueryable} interface.
In the latter case, this method will invoke the
{@link org.apache.flink.api.java.typeutils.ResultTypeQueryable#getProducedType()} method to determine data
type produced by the input format.
<p><b>NOTES ON CHECKPOINTING: </b> In the case of a {@link FileInputFormat}, the source
(which executes the {@link ContinuousFileMonitoringFunction}) monitors the path, creates the
{@link org.apache.flink.core.fs.FileInputSplit FileInputSplits} to be processed, forwards
them to the downstream {@link ContinuousFileReaderOperator} to read the actual data, and exits,
without waiting for the readers to finish reading. This implies that no more checkpoint
barriers are going to be forwarded after the source exits, thus having no checkpoints.
@param inputFormat
The input format used to create the data stream
@param <OUT>
The type of the returned data stream
@return The data stream that represents the data created by the input format | [
"Generic",
"method",
"to",
"create",
"an",
"input",
"data",
"stream",
"with",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"api",
".",
"common",
".",
"io",
".",
"InputFormat",
"}",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1299-L1302 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/util/Maps2.java | Maps2.putIntoSetMap | public static <K, V> void putIntoSetMap(K key, V value, Map<? super K, Set<V>> map) {
"""
Puts a value into a map that supports lists as values.
The list is created on-demand.
"""
Set<V> list = map.get(key);
if (list == null) {
list = Sets.newHashSetWithExpectedSize(2);
map.put(key, list);
}
list.add(value);
} | java | public static <K, V> void putIntoSetMap(K key, V value, Map<? super K, Set<V>> map) {
Set<V> list = map.get(key);
if (list == null) {
list = Sets.newHashSetWithExpectedSize(2);
map.put(key, list);
}
list.add(value);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"void",
"putIntoSetMap",
"(",
"K",
"key",
",",
"V",
"value",
",",
"Map",
"<",
"?",
"super",
"K",
",",
"Set",
"<",
"V",
">",
">",
"map",
")",
"{",
"Set",
"<",
"V",
">",
"list",
"=",
"map",
".",
"g... | Puts a value into a map that supports lists as values.
The list is created on-demand. | [
"Puts",
"a",
"value",
"into",
"a",
"map",
"that",
"supports",
"lists",
"as",
"values",
".",
"The",
"list",
"is",
"created",
"on",
"-",
"demand",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/util/Maps2.java#L71-L78 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.