repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
aoindustries/aocode-public | src/main/java/com/aoindustries/awt/image/Images.java | Images.findImage | public static Point findImage(BufferedImage image, BufferedImage findme, double tolerance) {
final int imageWidth = image.getWidth();
final int findmeWidth = findme.getWidth();
if(imageWidth >= findmeWidth) {
final int imageHeight = image.getHeight();
final int findmeHeight = findme.getHeight();
if(imageHeight >= findmeHeight) {
return findImage(
getRGB(image),
imageWidth,
imageHeight,
getRGB(findme),
findmeWidth,
findmeHeight,
tolerance
);
}
}
return null;
} | java | public static Point findImage(BufferedImage image, BufferedImage findme, double tolerance) {
final int imageWidth = image.getWidth();
final int findmeWidth = findme.getWidth();
if(imageWidth >= findmeWidth) {
final int imageHeight = image.getHeight();
final int findmeHeight = findme.getHeight();
if(imageHeight >= findmeHeight) {
return findImage(
getRGB(image),
imageWidth,
imageHeight,
getRGB(findme),
findmeWidth,
findmeHeight,
tolerance
);
}
}
return null;
} | [
"public",
"static",
"Point",
"findImage",
"(",
"BufferedImage",
"image",
",",
"BufferedImage",
"findme",
",",
"double",
"tolerance",
")",
"{",
"final",
"int",
"imageWidth",
"=",
"image",
".",
"getWidth",
"(",
")",
";",
"final",
"int",
"findmeWidth",
"=",
"fi... | Finds one image within another.
@param tolerance The portion of red, green, and blue differences
allowed before ignoring a certain location. Zero implies
an exact match.
@return The top-left point where the top left of the image is found or
<code>null</code> if not found within tolerance. | [
"Finds",
"one",
"image",
"within",
"another",
"."
] | train | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/awt/image/Images.java#L91-L110 |
Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/EntityNameHelper.java | EntityNameHelper.formatSubscriptionPath | public static String formatSubscriptionPath(String topicPath, String subscriptionName) {
return String.join(pathDelimiter, topicPath, subscriptionsSubPath, subscriptionName);
} | java | public static String formatSubscriptionPath(String topicPath, String subscriptionName) {
return String.join(pathDelimiter, topicPath, subscriptionsSubPath, subscriptionName);
} | [
"public",
"static",
"String",
"formatSubscriptionPath",
"(",
"String",
"topicPath",
",",
"String",
"subscriptionName",
")",
"{",
"return",
"String",
".",
"join",
"(",
"pathDelimiter",
",",
"topicPath",
",",
"subscriptionsSubPath",
",",
"subscriptionName",
")",
";",
... | Formats the subscription path, based on the topic path and subscription name.
@param topicPath - The name of the topic, including slashes.
@param subscriptionName - The name of the subscription.
@return The path of the subscription. | [
"Formats",
"the",
"subscription",
"path",
"based",
"on",
"the",
"topic",
"path",
"and",
"subscription",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/EntityNameHelper.java#L31-L33 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-component/xwiki-commons-component-api/src/main/java/org/xwiki/component/util/ReflectionUtils.java | ReflectionUtils.unserializeType | public static Type unserializeType(String serializedType, ClassLoader classLoader) throws ClassNotFoundException
{
String sType = serializedType.replaceAll(" ", "");
Type type = null;
// A real parser could be used here but it would probably be overkill.
if (sType.contains(OPEN_GENERIC)) {
// Parameterized type
int firstInferior = sType.indexOf(OPEN_GENERIC);
int lastSuperior = sType.lastIndexOf(CLOSE_GENERIC);
String rawType = sType.substring(0, firstInferior);
String sArguments = sType.substring(firstInferior + 1, lastSuperior);
List<Type> argumentTypes = new ArrayList<Type>();
int nestedArgsDepth = 0;
int previousSplit = 0;
// We'll go through all the Type arguments and they will be unserialized, since arguments can be
// ParameterizedTypes themselves we need to avoid parsing their arguments, that's why we need the
// nestedArgsDepth counter.
for (int i = 0; i < sArguments.length(); i++) {
char current = sArguments.charAt(i);
switch (current) {
case '<':
nestedArgsDepth++;
break;
case '>':
nestedArgsDepth--;
break;
case ',':
if (nestedArgsDepth == 0) {
argumentTypes.add(unserializeType(sArguments.substring(previousSplit, i), classLoader));
previousSplit = i + 1;
}
break;
default:
break;
}
if (i == sArguments.length() - 1) {
// We're at the end of the parameter list, we need to unserialize the Type of the last element.
// If there was only one argument it will be unserialized here.
argumentTypes.add(unserializeType(sArguments.substring(previousSplit), classLoader));
}
}
type =
new DefaultParameterizedType(null, Class.forName(rawType, false, classLoader),
argumentTypes.toArray(new Type[1]));
} else {
// This was a simple type, no type arguments were found.
type = Class.forName(sType, false, classLoader);
}
return type;
} | java | public static Type unserializeType(String serializedType, ClassLoader classLoader) throws ClassNotFoundException
{
String sType = serializedType.replaceAll(" ", "");
Type type = null;
// A real parser could be used here but it would probably be overkill.
if (sType.contains(OPEN_GENERIC)) {
// Parameterized type
int firstInferior = sType.indexOf(OPEN_GENERIC);
int lastSuperior = sType.lastIndexOf(CLOSE_GENERIC);
String rawType = sType.substring(0, firstInferior);
String sArguments = sType.substring(firstInferior + 1, lastSuperior);
List<Type> argumentTypes = new ArrayList<Type>();
int nestedArgsDepth = 0;
int previousSplit = 0;
// We'll go through all the Type arguments and they will be unserialized, since arguments can be
// ParameterizedTypes themselves we need to avoid parsing their arguments, that's why we need the
// nestedArgsDepth counter.
for (int i = 0; i < sArguments.length(); i++) {
char current = sArguments.charAt(i);
switch (current) {
case '<':
nestedArgsDepth++;
break;
case '>':
nestedArgsDepth--;
break;
case ',':
if (nestedArgsDepth == 0) {
argumentTypes.add(unserializeType(sArguments.substring(previousSplit, i), classLoader));
previousSplit = i + 1;
}
break;
default:
break;
}
if (i == sArguments.length() - 1) {
// We're at the end of the parameter list, we need to unserialize the Type of the last element.
// If there was only one argument it will be unserialized here.
argumentTypes.add(unserializeType(sArguments.substring(previousSplit), classLoader));
}
}
type =
new DefaultParameterizedType(null, Class.forName(rawType, false, classLoader),
argumentTypes.toArray(new Type[1]));
} else {
// This was a simple type, no type arguments were found.
type = Class.forName(sType, false, classLoader);
}
return type;
} | [
"public",
"static",
"Type",
"unserializeType",
"(",
"String",
"serializedType",
",",
"ClassLoader",
"classLoader",
")",
"throws",
"ClassNotFoundException",
"{",
"String",
"sType",
"=",
"serializedType",
".",
"replaceAll",
"(",
"\" \"",
",",
"\"\"",
")",
";",
"Type... | Retrieve a {@link Type} object from it's serialized form.
@param serializedType the serialized form of the {@link Type} to retrieve
@param classLoader the {@link ClassLoader} to look into to find the given {@link Type}
@return the type built from the given {@link String}
@throws ClassNotFoundException if no class corresponding to the passed serialized type can be found | [
"Retrieve",
"a",
"{",
"@link",
"Type",
"}",
"object",
"from",
"it",
"s",
"serialized",
"form",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-component/xwiki-commons-component-api/src/main/java/org/xwiki/component/util/ReflectionUtils.java#L494-L546 |
Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java | DAGraph.reportError | public void reportError(NodeT faulted, Throwable throwable) {
faulted.setPreparer(true);
String dependency = faulted.key();
for (String dependentKey : nodeTable.get(dependency).dependentKeys()) {
DAGNode<DataT, NodeT> dependent = nodeTable.get(dependentKey);
dependent.lock().lock();
try {
dependent.onFaultedResolution(dependency, throwable);
if (dependent.hasAllResolved()) {
queue.add(dependent.key());
}
} finally {
dependent.lock().unlock();
}
}
} | java | public void reportError(NodeT faulted, Throwable throwable) {
faulted.setPreparer(true);
String dependency = faulted.key();
for (String dependentKey : nodeTable.get(dependency).dependentKeys()) {
DAGNode<DataT, NodeT> dependent = nodeTable.get(dependentKey);
dependent.lock().lock();
try {
dependent.onFaultedResolution(dependency, throwable);
if (dependent.hasAllResolved()) {
queue.add(dependent.key());
}
} finally {
dependent.lock().unlock();
}
}
} | [
"public",
"void",
"reportError",
"(",
"NodeT",
"faulted",
",",
"Throwable",
"throwable",
")",
"{",
"faulted",
".",
"setPreparer",
"(",
"true",
")",
";",
"String",
"dependency",
"=",
"faulted",
".",
"key",
"(",
")",
";",
"for",
"(",
"String",
"dependentKey"... | Reports that a node is faulted.
@param faulted the node faulted
@param throwable the reason for fault | [
"Reports",
"that",
"a",
"node",
"is",
"faulted",
"."
] | train | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java#L182-L197 |
beangle/beangle3 | ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java | BeanDefinitionParser.decorateBeanDefinitionIfRequired | public BeanDefinitionHolder decorateBeanDefinitionIfRequired(Element ele,
BeanDefinitionHolder definitionHolder) {
return decorateBeanDefinitionIfRequired(ele, definitionHolder, null);
} | java | public BeanDefinitionHolder decorateBeanDefinitionIfRequired(Element ele,
BeanDefinitionHolder definitionHolder) {
return decorateBeanDefinitionIfRequired(ele, definitionHolder, null);
} | [
"public",
"BeanDefinitionHolder",
"decorateBeanDefinitionIfRequired",
"(",
"Element",
"ele",
",",
"BeanDefinitionHolder",
"definitionHolder",
")",
"{",
"return",
"decorateBeanDefinitionIfRequired",
"(",
"ele",
",",
"definitionHolder",
",",
"null",
")",
";",
"}"
] | <p>
decorateBeanDefinitionIfRequired.
</p>
@param ele a {@link org.w3c.dom.Element} object.
@param definitionHolder a {@link org.springframework.beans.factory.config.BeanDefinitionHolder}
object.
@return a {@link org.springframework.beans.factory.config.BeanDefinitionHolder} object. | [
"<p",
">",
"decorateBeanDefinitionIfRequired",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java#L1053-L1056 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemDesc.java | ElemDesc.setAttr | void setAttr(String name, int flags)
{
if (null == m_attrs)
m_attrs = new StringToIntTable();
m_attrs.put(name, flags);
} | java | void setAttr(String name, int flags)
{
if (null == m_attrs)
m_attrs = new StringToIntTable();
m_attrs.put(name, flags);
} | [
"void",
"setAttr",
"(",
"String",
"name",
",",
"int",
"flags",
")",
"{",
"if",
"(",
"null",
"==",
"m_attrs",
")",
"m_attrs",
"=",
"new",
"StringToIntTable",
"(",
")",
";",
"m_attrs",
".",
"put",
"(",
"name",
",",
"flags",
")",
";",
"}"
] | Set an attribute name and it's bit properties.
@param name non-null name of attribute, in upper case.
@param flags flag bits. | [
"Set",
"an",
"attribute",
"name",
"and",
"it",
"s",
"bit",
"properties",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemDesc.java#L156-L163 |
google/closure-templates | java/src/com/google/template/soy/data/SanitizedContents.java | SanitizedContents.constantHtml | public static SanitizedContent constantHtml(@CompileTimeConstant final String constant) {
return fromConstant(constant, ContentKind.HTML, null);
} | java | public static SanitizedContent constantHtml(@CompileTimeConstant final String constant) {
return fromConstant(constant, ContentKind.HTML, null);
} | [
"public",
"static",
"SanitizedContent",
"constantHtml",
"(",
"@",
"CompileTimeConstant",
"final",
"String",
"constant",
")",
"{",
"return",
"fromConstant",
"(",
"constant",
",",
"ContentKind",
".",
"HTML",
",",
"null",
")",
";",
"}"
] | Wraps an assumed-safe constant string that specifies a safe, balanced, document fragment.
<p>This only accepts compile-time constants, based on the assumption that HTML snippets that
are controlled by the application (and not user input) are considered safe. | [
"Wraps",
"an",
"assumed",
"-",
"safe",
"constant",
"string",
"that",
"specifies",
"a",
"safe",
"balanced",
"document",
"fragment",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/SanitizedContents.java#L198-L200 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/action/toolbar/ToolbarRegistry.java | ToolbarRegistry.put | public static void put(String key, ToolCreator toolCreator) {
if (null != key && null != toolCreator) {
REGISTRY.put(key, toolCreator);
}
} | java | public static void put(String key, ToolCreator toolCreator) {
if (null != key && null != toolCreator) {
REGISTRY.put(key, toolCreator);
}
} | [
"public",
"static",
"void",
"put",
"(",
"String",
"key",
",",
"ToolCreator",
"toolCreator",
")",
"{",
"if",
"(",
"null",
"!=",
"key",
"&&",
"null",
"!=",
"toolCreator",
")",
"{",
"REGISTRY",
".",
"put",
"(",
"key",
",",
"toolCreator",
")",
";",
"}",
... | Add another key to the registry. This will overwrite the previous value.
@param key
key for the toolbar actions
@param toolCreator
toolbar action creator | [
"Add",
"another",
"key",
"to",
"the",
"registry",
".",
"This",
"will",
"overwrite",
"the",
"previous",
"value",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/toolbar/ToolbarRegistry.java#L164-L168 |
liuyukuai/commons | commons-core/src/main/java/com/itxiaoer/commons/core/beans/ProcessUtils.java | ProcessUtils.processList | public static <T, R> List<R> processList(Class<R> clazz, List<T> src) {
return processList(clazz, src, (r, s) -> {
});
} | java | public static <T, R> List<R> processList(Class<R> clazz, List<T> src) {
return processList(clazz, src, (r, s) -> {
});
} | [
"public",
"static",
"<",
"T",
",",
"R",
">",
"List",
"<",
"R",
">",
"processList",
"(",
"Class",
"<",
"R",
">",
"clazz",
",",
"List",
"<",
"T",
">",
"src",
")",
"{",
"return",
"processList",
"(",
"clazz",
",",
"src",
",",
"(",
"r",
",",
"s",
... | 拷贝list对象
@param clazz 目标类型
@param src 原对象集合
@param <T> 原数据类型
@param <R> 目标数据类型
@return 目标对象集合 | [
"拷贝list对象"
] | train | https://github.com/liuyukuai/commons/blob/ba67eddb542446b12f419f1866dbaa82e47fbf35/commons-core/src/main/java/com/itxiaoer/commons/core/beans/ProcessUtils.java#L43-L46 |
ops4j/org.ops4j.pax.wicket | service/src/main/java/org/ops4j/pax/wicket/internal/extender/BundleDelegatingExtensionTracker.java | BundleDelegatingExtensionTracker.addWebApplicationFactory | @Reference(service = WebApplicationFactory.class, unbind = "removeWebApplicationFactory",
updated = "modifiedWebApplicationFactory",
cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
public void addWebApplicationFactory(WebApplicationFactory<?> webApplicationFactory, Map<String, ?> properties) {
synchronized (this) {
addServicesForServiceReference(webApplicationFactory, properties);
reevaluateAllBundles(webApplicationFactory);
}
} | java | @Reference(service = WebApplicationFactory.class, unbind = "removeWebApplicationFactory",
updated = "modifiedWebApplicationFactory",
cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
public void addWebApplicationFactory(WebApplicationFactory<?> webApplicationFactory, Map<String, ?> properties) {
synchronized (this) {
addServicesForServiceReference(webApplicationFactory, properties);
reevaluateAllBundles(webApplicationFactory);
}
} | [
"@",
"Reference",
"(",
"service",
"=",
"WebApplicationFactory",
".",
"class",
",",
"unbind",
"=",
"\"removeWebApplicationFactory\"",
",",
"updated",
"=",
"\"modifiedWebApplicationFactory\"",
",",
"cardinality",
"=",
"ReferenceCardinality",
".",
"MULTIPLE",
",",
"policy"... | <p>addWebApplicationFactory.</p>
@param webApplicationFactory a {@link org.ops4j.pax.wicket.api.WebApplicationFactory} object.
@param properties a {@link java.util.Map} object.
@since 3.0.5 | [
"<p",
">",
"addWebApplicationFactory",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ops4j/org.ops4j.pax.wicket/blob/ef7cb4bdf918e9e61ec69789b9c690567616faa9/service/src/main/java/org/ops4j/pax/wicket/internal/extender/BundleDelegatingExtensionTracker.java#L99-L107 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VpnSitesConfigurationsInner.java | VpnSitesConfigurationsInner.beginDownloadAsync | public Observable<Void> beginDownloadAsync(String resourceGroupName, String virtualWANName, GetVpnSitesConfigurationRequest request) {
return beginDownloadWithServiceResponseAsync(resourceGroupName, virtualWANName, request).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginDownloadAsync(String resourceGroupName, String virtualWANName, GetVpnSitesConfigurationRequest request) {
return beginDownloadWithServiceResponseAsync(resourceGroupName, virtualWANName, request).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginDownloadAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualWANName",
",",
"GetVpnSitesConfigurationRequest",
"request",
")",
"{",
"return",
"beginDownloadWithServiceResponseAsync",
"(",
"resourceGroupName",
","... | Gives the sas-url to download the configurations for vpn-sites in a resource group.
@param resourceGroupName The resource group name.
@param virtualWANName The name of the VirtualWAN for which configuration of all vpn-sites is needed.
@param request Parameters supplied to download vpn-sites configuration.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Gives",
"the",
"sas",
"-",
"url",
"to",
"download",
"the",
"configurations",
"for",
"vpn",
"-",
"sites",
"in",
"a",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VpnSitesConfigurationsInner.java#L178-L185 |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/gui2/dialogs/TextInputDialog.java | TextInputDialog.showNumberDialog | public static BigInteger showNumberDialog(WindowBasedTextGUI textGUI, String title, String description, String initialContent) {
TextInputDialog textInputDialog = new TextInputDialogBuilder()
.setTitle(title)
.setDescription(description)
.setInitialContent(initialContent)
.setValidationPattern(Pattern.compile("[0-9]+"), "Not a number")
.build();
String numberString = textInputDialog.showDialog(textGUI);
return numberString != null ? new BigInteger(numberString) : null;
} | java | public static BigInteger showNumberDialog(WindowBasedTextGUI textGUI, String title, String description, String initialContent) {
TextInputDialog textInputDialog = new TextInputDialogBuilder()
.setTitle(title)
.setDescription(description)
.setInitialContent(initialContent)
.setValidationPattern(Pattern.compile("[0-9]+"), "Not a number")
.build();
String numberString = textInputDialog.showDialog(textGUI);
return numberString != null ? new BigInteger(numberString) : null;
} | [
"public",
"static",
"BigInteger",
"showNumberDialog",
"(",
"WindowBasedTextGUI",
"textGUI",
",",
"String",
"title",
",",
"String",
"description",
",",
"String",
"initialContent",
")",
"{",
"TextInputDialog",
"textInputDialog",
"=",
"new",
"TextInputDialogBuilder",
"(",
... | Shortcut for quickly showing a {@code TextInputDialog} that only accepts numbers
@param textGUI GUI to show the dialog on
@param title Title of the dialog
@param description Description of the dialog
@param initialContent What content to place in the text box initially
@return The number the user typed into the text box, or {@code null} if the dialog was cancelled | [
"Shortcut",
"for",
"quickly",
"showing",
"a",
"{"
] | train | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/gui2/dialogs/TextInputDialog.java#L146-L155 |
google/closure-compiler | src/com/google/javascript/jscomp/TypeValidator.java | TypeValidator.expectValidTypeofName | void expectValidTypeofName(Node n, String found) {
report(JSError.make(n, UNKNOWN_TYPEOF_VALUE, found));
} | java | void expectValidTypeofName(Node n, String found) {
report(JSError.make(n, UNKNOWN_TYPEOF_VALUE, found));
} | [
"void",
"expectValidTypeofName",
"(",
"Node",
"n",
",",
"String",
"found",
")",
"{",
"report",
"(",
"JSError",
".",
"make",
"(",
"n",
",",
"UNKNOWN_TYPEOF_VALUE",
",",
"found",
")",
")",
";",
"}"
] | a warning and attempt to correct the mismatch, when possible. | [
"a",
"warning",
"and",
"attempt",
"to",
"correct",
"the",
"mismatch",
"when",
"possible",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L239-L241 |
tcurdt/jdeb | src/main/java/org/vafer/jdeb/utils/Utils.java | Utils.guessKeyRingFile | public static File guessKeyRingFile() throws FileNotFoundException {
final Collection<String> possibleLocations = getKnownPGPSecureRingLocations();
for (final String location : possibleLocations) {
final File candidate = new File(location);
if (candidate.exists()) {
return candidate;
}
}
final StringBuilder message = new StringBuilder("Could not locate secure keyring, locations tried: ");
final Iterator<String> it = possibleLocations.iterator();
while (it.hasNext()) {
message.append(it.next());
if (it.hasNext()) {
message.append(", ");
}
}
throw new FileNotFoundException(message.toString());
} | java | public static File guessKeyRingFile() throws FileNotFoundException {
final Collection<String> possibleLocations = getKnownPGPSecureRingLocations();
for (final String location : possibleLocations) {
final File candidate = new File(location);
if (candidate.exists()) {
return candidate;
}
}
final StringBuilder message = new StringBuilder("Could not locate secure keyring, locations tried: ");
final Iterator<String> it = possibleLocations.iterator();
while (it.hasNext()) {
message.append(it.next());
if (it.hasNext()) {
message.append(", ");
}
}
throw new FileNotFoundException(message.toString());
} | [
"public",
"static",
"File",
"guessKeyRingFile",
"(",
")",
"throws",
"FileNotFoundException",
"{",
"final",
"Collection",
"<",
"String",
">",
"possibleLocations",
"=",
"getKnownPGPSecureRingLocations",
"(",
")",
";",
"for",
"(",
"final",
"String",
"location",
":",
... | Tries to guess location of the user secure keyring using various
heuristics.
@return path to the keyring file
@throws FileNotFoundException if no keyring file found | [
"Tries",
"to",
"guess",
"location",
"of",
"the",
"user",
"secure",
"keyring",
"using",
"various",
"heuristics",
"."
] | train | https://github.com/tcurdt/jdeb/blob/b899a7b1b3391356aafc491ab601f258961f67f0/src/main/java/org/vafer/jdeb/utils/Utils.java#L383-L400 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/io/BufferUtils.java | BufferUtils.equalConstantByteArray | public static boolean equalConstantByteArray(byte value, int len, byte[] arr) {
if (arr == null || arr.length != len) {
return false;
}
for (int k = 0; k < len; k++) {
if (arr[k] != value) {
return false;
}
}
return true;
} | java | public static boolean equalConstantByteArray(byte value, int len, byte[] arr) {
if (arr == null || arr.length != len) {
return false;
}
for (int k = 0; k < len; k++) {
if (arr[k] != value) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"equalConstantByteArray",
"(",
"byte",
"value",
",",
"int",
"len",
",",
"byte",
"[",
"]",
"arr",
")",
"{",
"if",
"(",
"arr",
"==",
"null",
"||",
"arr",
".",
"length",
"!=",
"len",
")",
"{",
"return",
"false",
";",
"}",
... | Checks if the given byte array starts with a constant sequence of bytes of the given value
and length.
@param value the value to check for
@param len the target length of the sequence
@param arr the byte array to check
@return true if the byte array has a prefix of length {@code len} that is a constant
sequence of bytes of the given value | [
"Checks",
"if",
"the",
"given",
"byte",
"array",
"starts",
"with",
"a",
"constant",
"sequence",
"of",
"bytes",
"of",
"the",
"given",
"value",
"and",
"length",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/io/BufferUtils.java#L172-L182 |
eclipse/xtext-core | org.eclipse.xtext.util/src/org/eclipse/xtext/util/OnChangeEvictingCache.java | OnChangeEvictingCache.execWithoutCacheClear | public <Result, Param extends Resource> Result execWithoutCacheClear(Param resource, IUnitOfWork<Result, Param> transaction) throws WrappedException {
CacheAdapter cacheAdapter = getOrCreate(resource);
try {
cacheAdapter.ignoreNotifications();
return transaction.exec(resource);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new WrappedException(e);
} finally {
cacheAdapter.listenToNotifications();
}
} | java | public <Result, Param extends Resource> Result execWithoutCacheClear(Param resource, IUnitOfWork<Result, Param> transaction) throws WrappedException {
CacheAdapter cacheAdapter = getOrCreate(resource);
try {
cacheAdapter.ignoreNotifications();
return transaction.exec(resource);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new WrappedException(e);
} finally {
cacheAdapter.listenToNotifications();
}
} | [
"public",
"<",
"Result",
",",
"Param",
"extends",
"Resource",
">",
"Result",
"execWithoutCacheClear",
"(",
"Param",
"resource",
",",
"IUnitOfWork",
"<",
"Result",
",",
"Param",
">",
"transaction",
")",
"throws",
"WrappedException",
"{",
"CacheAdapter",
"cacheAdapt... | The transaction will be executed. While it is running, any semantic state change
in the given resource will be ignored and the cache will not be cleared. | [
"The",
"transaction",
"will",
"be",
"executed",
".",
"While",
"it",
"is",
"running",
"any",
"semantic",
"state",
"change",
"in",
"the",
"given",
"resource",
"will",
"be",
"ignored",
"and",
"the",
"cache",
"will",
"not",
"be",
"cleared",
"."
] | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/OnChangeEvictingCache.java#L124-L136 |
hibernate/hibernate-ogm | mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/binarystorage/GridFSStorageManager.java | GridFSStorageManager.fileName | private String fileName(String fieldName, Object documentId) {
return fieldName + "_" + String.valueOf( documentId );
} | java | private String fileName(String fieldName, Object documentId) {
return fieldName + "_" + String.valueOf( documentId );
} | [
"private",
"String",
"fileName",
"(",
"String",
"fieldName",
",",
"Object",
"documentId",
")",
"{",
"return",
"fieldName",
"+",
"\"_\"",
"+",
"String",
".",
"valueOf",
"(",
"documentId",
")",
";",
"}"
] | /*
The id is necessary, otherwise two instances of the same entity will have the same file name
and override each other. | [
"/",
"*",
"The",
"id",
"is",
"necessary",
"otherwise",
"two",
"instances",
"of",
"the",
"same",
"entity",
"will",
"have",
"the",
"same",
"file",
"name",
"and",
"override",
"each",
"other",
"."
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/binarystorage/GridFSStorageManager.java#L100-L102 |
scribejava/scribejava | scribejava-core/src/main/java/com/github/scribejava/core/model/OAuthRequest.java | OAuthRequest.getQueryStringParams | public ParameterList getQueryStringParams() {
try {
final ParameterList result = new ParameterList();
final String queryString = new URL(url).getQuery();
result.addQuerystring(queryString);
result.addAll(querystringParams);
return result;
} catch (MalformedURLException mue) {
throw new OAuthException("Malformed URL", mue);
}
} | java | public ParameterList getQueryStringParams() {
try {
final ParameterList result = new ParameterList();
final String queryString = new URL(url).getQuery();
result.addQuerystring(queryString);
result.addAll(querystringParams);
return result;
} catch (MalformedURLException mue) {
throw new OAuthException("Malformed URL", mue);
}
} | [
"public",
"ParameterList",
"getQueryStringParams",
"(",
")",
"{",
"try",
"{",
"final",
"ParameterList",
"result",
"=",
"new",
"ParameterList",
"(",
")",
";",
"final",
"String",
"queryString",
"=",
"new",
"URL",
"(",
"url",
")",
".",
"getQuery",
"(",
")",
"... | Get a {@link ParameterList} with the query string parameters.
@return a {@link ParameterList} containing the query string parameters.
@throws OAuthException if the request URL is not valid. | [
"Get",
"a",
"{",
"@link",
"ParameterList",
"}",
"with",
"the",
"query",
"string",
"parameters",
"."
] | train | https://github.com/scribejava/scribejava/blob/030d76872fe371a84b5d05c6c3c33c34e8f611f1/scribejava-core/src/main/java/com/github/scribejava/core/model/OAuthRequest.java#L301-L311 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.addSource | public <OUT> DataStreamSource<OUT> addSource(SourceFunction<OUT> function, String sourceName) {
return addSource(function, sourceName, null);
} | java | public <OUT> DataStreamSource<OUT> addSource(SourceFunction<OUT> function, String sourceName) {
return addSource(function, sourceName, null);
} | [
"public",
"<",
"OUT",
">",
"DataStreamSource",
"<",
"OUT",
">",
"addSource",
"(",
"SourceFunction",
"<",
"OUT",
">",
"function",
",",
"String",
"sourceName",
")",
"{",
"return",
"addSource",
"(",
"function",
",",
"sourceName",
",",
"null",
")",
";",
"}"
] | Adds a data source with a custom type information thus opening a
{@link DataStream}. Only in very special cases does the user need to
support type information. Otherwise use
{@link #addSource(org.apache.flink.streaming.api.functions.source.SourceFunction)}
@param function
the user defined function
@param sourceName
Name of the data source
@param <OUT>
type of the returned stream
@return the data stream constructed | [
"Adds",
"a",
"data",
"source",
"with",
"a",
"custom",
"type",
"information",
"thus",
"opening",
"a",
"{",
"@link",
"DataStream",
"}",
".",
"Only",
"in",
"very",
"special",
"cases",
"does",
"the",
"user",
"need",
"to",
"support",
"type",
"information",
".",... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1411-L1413 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/BatchUpdateDaemon.java | BatchUpdateDaemon.invalidateById | public void invalidateById(Object id, boolean waitOnInvalidation, DCache cache) {
invalidateById(id, CachePerf.DIRECT, waitOnInvalidation, cache, Cache.CHECK_PREINVALIDATION_LISTENER);
} | java | public void invalidateById(Object id, boolean waitOnInvalidation, DCache cache) {
invalidateById(id, CachePerf.DIRECT, waitOnInvalidation, cache, Cache.CHECK_PREINVALIDATION_LISTENER);
} | [
"public",
"void",
"invalidateById",
"(",
"Object",
"id",
",",
"boolean",
"waitOnInvalidation",
",",
"DCache",
"cache",
")",
"{",
"invalidateById",
"(",
"id",
",",
"CachePerf",
".",
"DIRECT",
",",
"waitOnInvalidation",
",",
"cache",
",",
"Cache",
".",
"CHECK_PR... | This invalidates all cache entries in all caches whose cache id
or data id is specified. Assumes this is the result of a direct
invalidation.
@param id The id (cache id or data id) that is used to to
invalidate fragments.
@param waitOnInvalidation True indicates that this method should
not return until all invalidations have taken effect.
False indicates that the invalidations will take effect the next
time the BatchUpdateDaemon wakes.
@param causeOfInvalidation The cause of this invalidation. | [
"This",
"invalidates",
"all",
"cache",
"entries",
"in",
"all",
"caches",
"whose",
"cache",
"id",
"or",
"data",
"id",
"is",
"specified",
".",
"Assumes",
"this",
"is",
"the",
"result",
"of",
"a",
"direct",
"invalidation",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/BatchUpdateDaemon.java#L181-L183 |
strator-dev/greenpepper | greenpepper/core/src/main/java/com/greenpepper/util/URIUtil.java | URIUtil.getAttribute | public static String getAttribute(URI uri, String attributeName)
{
String query = uri.getQuery();
if(StringUtil.isEmpty(query)) return null;
Pattern pattern = Pattern.compile( attributeName + "\\=([^&]*)" );
Matcher matcher = pattern.matcher( query );
if (matcher.find())
return matcher.group( 1 );
else
return null;
} | java | public static String getAttribute(URI uri, String attributeName)
{
String query = uri.getQuery();
if(StringUtil.isEmpty(query)) return null;
Pattern pattern = Pattern.compile( attributeName + "\\=([^&]*)" );
Matcher matcher = pattern.matcher( query );
if (matcher.find())
return matcher.group( 1 );
else
return null;
} | [
"public",
"static",
"String",
"getAttribute",
"(",
"URI",
"uri",
",",
"String",
"attributeName",
")",
"{",
"String",
"query",
"=",
"uri",
".",
"getQuery",
"(",
")",
";",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"query",
")",
")",
"return",
"null",
... | <p>getAttribute.</p>
@param uri a {@link java.net.URI} object.
@param attributeName a {@link java.lang.String} object.
@return a {@link java.lang.String} object. | [
"<p",
">",
"getAttribute",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/util/URIUtil.java#L103-L115 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/processing/JavacFiler.java | JavacFiler.checkFileReopening | private void checkFileReopening(FileObject fileObject, boolean addToHistory) throws FilerException {
for(FileObject veteran : fileObjectHistory) {
if (fileManager.isSameFile(veteran, fileObject)) {
if (lint)
log.warning("proc.file.reopening", fileObject.getName());
throw new FilerException("Attempt to reopen a file for path " + fileObject.getName());
}
}
if (addToHistory)
fileObjectHistory.add(fileObject);
} | java | private void checkFileReopening(FileObject fileObject, boolean addToHistory) throws FilerException {
for(FileObject veteran : fileObjectHistory) {
if (fileManager.isSameFile(veteran, fileObject)) {
if (lint)
log.warning("proc.file.reopening", fileObject.getName());
throw new FilerException("Attempt to reopen a file for path " + fileObject.getName());
}
}
if (addToHistory)
fileObjectHistory.add(fileObject);
} | [
"private",
"void",
"checkFileReopening",
"(",
"FileObject",
"fileObject",
",",
"boolean",
"addToHistory",
")",
"throws",
"FilerException",
"{",
"for",
"(",
"FileObject",
"veteran",
":",
"fileObjectHistory",
")",
"{",
"if",
"(",
"fileManager",
".",
"isSameFile",
"(... | Check to see if the file has already been opened; if so, throw
an exception, otherwise add it to the set of files. | [
"Check",
"to",
"see",
"if",
"the",
"file",
"has",
"already",
"been",
"opened",
";",
"if",
"so",
"throw",
"an",
"exception",
"otherwise",
"add",
"it",
"to",
"the",
"set",
"of",
"files",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java#L530-L540 |
algolia/instantsearch-android | core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java | Searcher.removeNumericRefinement | @SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public Searcher removeNumericRefinement(@NonNull String attribute, @NonNull Integer operator) {
return removeNumericRefinement(new NumericRefinement(attribute, operator, NumericRefinement.VALUE_UNKNOWN));
} | java | @SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public Searcher removeNumericRefinement(@NonNull String attribute, @NonNull Integer operator) {
return removeNumericRefinement(new NumericRefinement(attribute, operator, NumericRefinement.VALUE_UNKNOWN));
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"WeakerAccess\"",
",",
"\"unused\"",
"}",
")",
"// For library users",
"public",
"Searcher",
"removeNumericRefinement",
"(",
"@",
"NonNull",
"String",
"attribute",
",",
"@",
"NonNull",
"Integer",
"operator",
")",
"{",
"return",
... | Removes the numeric refinement relative to an attribute and operator for the next queries.
@param attribute an attribute that maybe has some refinements.
@param operator an {@link NumericRefinement#OPERATOR_EQ operator}.
@return this {@link Searcher} for chaining. | [
"Removes",
"the",
"numeric",
"refinement",
"relative",
"to",
"an",
"attribute",
"and",
"operator",
"for",
"the",
"next",
"queries",
"."
] | train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java#L731-L734 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java | Utils.isFunctionalInterface | public static boolean isFunctionalInterface(JvmGenericType type, IActionPrototypeProvider sarlSignatureProvider) {
if (type != null && type.isInterface()) {
final Map<ActionPrototype, JvmOperation> operations = new HashMap<>();
populateInterfaceElements(type, operations, null, sarlSignatureProvider);
if (operations.size() == 1) {
final JvmOperation op = operations.values().iterator().next();
return !op.isStatic() && !op.isDefault();
}
}
return false;
} | java | public static boolean isFunctionalInterface(JvmGenericType type, IActionPrototypeProvider sarlSignatureProvider) {
if (type != null && type.isInterface()) {
final Map<ActionPrototype, JvmOperation> operations = new HashMap<>();
populateInterfaceElements(type, operations, null, sarlSignatureProvider);
if (operations.size() == 1) {
final JvmOperation op = operations.values().iterator().next();
return !op.isStatic() && !op.isDefault();
}
}
return false;
} | [
"public",
"static",
"boolean",
"isFunctionalInterface",
"(",
"JvmGenericType",
"type",
",",
"IActionPrototypeProvider",
"sarlSignatureProvider",
")",
"{",
"if",
"(",
"type",
"!=",
"null",
"&&",
"type",
".",
"isInterface",
"(",
")",
")",
"{",
"final",
"Map",
"<",... | Replies if the given type is a functional interface.
<p>This function does not test if the {@code @FunctionalInterface} is attached to the type.
The function counts the number of operations.
@param type the type to test.
@param sarlSignatureProvider the provider of SARL operation signatures.
@return <code>true</code> if the given type is final. | [
"Replies",
"if",
"the",
"given",
"type",
"is",
"a",
"functional",
"interface",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java#L1229-L1239 |
ecclesia/kipeto | kipeto-core/src/main/java/de/ecclesia/kipeto/repository/WritingRepositoryStrategy.java | WritingRepositoryStrategy.storeStream | public void storeStream(String id, InputStream inputStream) throws IOException {
storeStream(id, inputStream, null);
} | java | public void storeStream(String id, InputStream inputStream) throws IOException {
storeStream(id, inputStream, null);
} | [
"public",
"void",
"storeStream",
"(",
"String",
"id",
",",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"storeStream",
"(",
"id",
",",
"inputStream",
",",
"null",
")",
";",
"}"
] | Speichert den übergebenen InputStream unter der angegebenen Id. Per
Definition ist die Id der Hash des InputStreams. Falls unter der
angegebenen Id also bereits ein Objekt anderer Länge gepeichert ist,
schlägt das Speichern fehl.
@param id
Id des Objektes, unter der es abgelegt wird
@param inputStream
des zu speichernden Objektes
@throws IOException | [
"Speichert",
"den",
"übergebenen",
"InputStream",
"unter",
"der",
"angegebenen",
"Id",
".",
"Per",
"Definition",
"ist",
"die",
"Id",
"der",
"Hash",
"des",
"InputStreams",
".",
"Falls",
"unter",
"der",
"angegebenen",
"Id",
"also",
"bereits",
"ein",
"Objekt",
"a... | train | https://github.com/ecclesia/kipeto/blob/ea39a10ae4eaa550f71a856ab2f2845270a64913/kipeto-core/src/main/java/de/ecclesia/kipeto/repository/WritingRepositoryStrategy.java#L82-L84 |
BlueBrain/bluima | modules/bluima_abbreviations/src/main/java/com/wcohen/ss/lookup/SoftTFIDFDictionary.java | SoftTFIDFDictionary.slowLookup | public int slowLookup(double minScore,String toFind)
{
if (!frozen) freeze();
long start = System.currentTimeMillis();
StringWrapper wa = softTFIDFDistance.prepare( toFind );
result = new ArrayList();
for (Iterator i=valueMap.keySet().iterator(); i.hasNext(); ) {
String found = (String)i.next();
StringWrapper wb = softTFIDFDistance.prepare( found );
double d = softTFIDFDistance.score( wa, wb );
if (d>=minScore) {
Set valset = (Set)valueMap.get(found);
for (Iterator j=valset.iterator(); j.hasNext(); ) {
String valj=(String)j.next();
result.add(new LookupResult(found,valj,d));
}
}
}
Collections.sort( result );
lookupTime = (System.currentTimeMillis()-start) / 1000.0;
return result.size();
} | java | public int slowLookup(double minScore,String toFind)
{
if (!frozen) freeze();
long start = System.currentTimeMillis();
StringWrapper wa = softTFIDFDistance.prepare( toFind );
result = new ArrayList();
for (Iterator i=valueMap.keySet().iterator(); i.hasNext(); ) {
String found = (String)i.next();
StringWrapper wb = softTFIDFDistance.prepare( found );
double d = softTFIDFDistance.score( wa, wb );
if (d>=minScore) {
Set valset = (Set)valueMap.get(found);
for (Iterator j=valset.iterator(); j.hasNext(); ) {
String valj=(String)j.next();
result.add(new LookupResult(found,valj,d));
}
}
}
Collections.sort( result );
lookupTime = (System.currentTimeMillis()-start) / 1000.0;
return result.size();
} | [
"public",
"int",
"slowLookup",
"(",
"double",
"minScore",
",",
"String",
"toFind",
")",
"{",
"if",
"(",
"!",
"frozen",
")",
"freeze",
"(",
")",
";",
"long",
"start",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"StringWrapper",
"wa",
"=",
"s... | Exactly like lookup, but works by exhaustively checking every stored string. | [
"Exactly",
"like",
"lookup",
"but",
"works",
"by",
"exhaustively",
"checking",
"every",
"stored",
"string",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/lookup/SoftTFIDFDictionary.java#L452-L473 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java | Strs.betnLast | public static Betner betnLast(String target, String leftSameWithRight) {
return betn(target).betweenLast(leftSameWithRight);
} | java | public static Betner betnLast(String target, String leftSameWithRight) {
return betn(target).betweenLast(leftSameWithRight);
} | [
"public",
"static",
"Betner",
"betnLast",
"(",
"String",
"target",
",",
"String",
"leftSameWithRight",
")",
"{",
"return",
"betn",
"(",
"target",
")",
".",
"betweenLast",
"(",
"leftSameWithRight",
")",
";",
"}"
] | Returns a {@code String} between matcher that matches any character
in the two instances of the same String, The first and last one matches.
@param target
@param leftSameWithRight
@return | [
"Returns",
"a",
"{",
"@code",
"String",
"}",
"between",
"matcher",
"that",
"matches",
"any",
"character",
"in",
"the",
"two",
"instances",
"of",
"the",
"same",
"String",
"The",
"first",
"and",
"last",
"one",
"matches",
"."
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java#L455-L457 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/formatting2/FormatterFacade.java | FormatterFacade.formatRegion | public void formatRegion(XtextResource resource, int offset, int length) {
assert resource != null;
assert offset >= 0;
assert length >= 0;
final String result = formatResourceRegion(resource, offset, length);
// Write back to the resource
try (StringInputStream stringInputStream = new StringInputStream(result)) {
resource.load(stringInputStream, Collections.emptyMap());
} catch (Exception exception) {
throw Exceptions.sneakyThrow(exception);
}
} | java | public void formatRegion(XtextResource resource, int offset, int length) {
assert resource != null;
assert offset >= 0;
assert length >= 0;
final String result = formatResourceRegion(resource, offset, length);
// Write back to the resource
try (StringInputStream stringInputStream = new StringInputStream(result)) {
resource.load(stringInputStream, Collections.emptyMap());
} catch (Exception exception) {
throw Exceptions.sneakyThrow(exception);
}
} | [
"public",
"void",
"formatRegion",
"(",
"XtextResource",
"resource",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"assert",
"resource",
"!=",
"null",
";",
"assert",
"offset",
">=",
"0",
";",
"assert",
"length",
">=",
"0",
";",
"final",
"String",
... | Format the code in the given region.
@param resource the resource to format.
@param offset the offset of the text to format.
@param length the length of the text. | [
"Format",
"the",
"code",
"in",
"the",
"given",
"region",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/formatting2/FormatterFacade.java#L163-L174 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.leftShift | public static OutputStream leftShift(OutputStream self, InputStream in) throws IOException {
byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
for (int count; -1 != (count = in.read(buf)); ) {
self.write(buf, 0, count);
}
self.flush();
return self;
} | java | public static OutputStream leftShift(OutputStream self, InputStream in) throws IOException {
byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
for (int count; -1 != (count = in.read(buf)); ) {
self.write(buf, 0, count);
}
self.flush();
return self;
} | [
"public",
"static",
"OutputStream",
"leftShift",
"(",
"OutputStream",
"self",
",",
"InputStream",
"in",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"DEFAULT_BUFFER_SIZE",
"]",
";",
"for",
"(",
"int",
"count",
";",
"... | Pipe an InputStream into an OutputStream for efficient stream copying.
@param self stream on which to write
@param in stream to read from
@return the outputstream itself
@throws IOException if an I/O error occurs.
@since 1.0 | [
"Pipe",
"an",
"InputStream",
"into",
"an",
"OutputStream",
"for",
"efficient",
"stream",
"copying",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L207-L214 |
pravega/pravega | common/src/main/java/io/pravega/common/util/AvlTreeIndex.java | AvlTreeIndex.delete | private UpdateResult delete(long key, Node node) {
UpdateResult result;
if (node == null) {
// Item not found.
result = new UpdateResult();
} else {
long itemKey = node.item.key();
if (key < itemKey) {
// Given key is smaller than the current node's item key; proceed to the node's left child.
result = delete(key, node.left);
node.left = result.node;
} else if (key > itemKey) {
// Given key is larger than the current node's item key; proceed to the node's right child.
result = delete(key, node.right);
node.right = result.node;
} else {
// Found the node. Remember it's item.
result = new UpdateResult();
result.updatedItem = node.item;
if (node.left != null && node.right != null) {
// The node has two children. Replace the node's item with its in-order successor, and then remove
// that successor's node.
node.item = findSmallest(node.right);
node.right = delete(node.item.key(), node.right).node;
} else {
// The node has just one child. Replace it with that child.
node = (node.left != null) ? node.left : node.right;
this.size--;
this.modCount++;
}
}
// Rebalance the sub-tree, if necessary.
result.node = balance(node);
}
return result;
} | java | private UpdateResult delete(long key, Node node) {
UpdateResult result;
if (node == null) {
// Item not found.
result = new UpdateResult();
} else {
long itemKey = node.item.key();
if (key < itemKey) {
// Given key is smaller than the current node's item key; proceed to the node's left child.
result = delete(key, node.left);
node.left = result.node;
} else if (key > itemKey) {
// Given key is larger than the current node's item key; proceed to the node's right child.
result = delete(key, node.right);
node.right = result.node;
} else {
// Found the node. Remember it's item.
result = new UpdateResult();
result.updatedItem = node.item;
if (node.left != null && node.right != null) {
// The node has two children. Replace the node's item with its in-order successor, and then remove
// that successor's node.
node.item = findSmallest(node.right);
node.right = delete(node.item.key(), node.right).node;
} else {
// The node has just one child. Replace it with that child.
node = (node.left != null) ? node.left : node.right;
this.size--;
this.modCount++;
}
}
// Rebalance the sub-tree, if necessary.
result.node = balance(node);
}
return result;
} | [
"private",
"UpdateResult",
"delete",
"(",
"long",
"key",
",",
"Node",
"node",
")",
"{",
"UpdateResult",
"result",
";",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"// Item not found.",
"result",
"=",
"new",
"UpdateResult",
"(",
")",
";",
"}",
"else",
"{",... | Removes an item with given key from a subtree.
@param key The Key to remove.
@param node The node at the root of the subtree.
@return The new root of the subtree. | [
"Removes",
"an",
"item",
"with",
"given",
"key",
"from",
"a",
"subtree",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/AvlTreeIndex.java#L300-L337 |
apache/groovy | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.executeInsert | public List<List<Object>> executeInsert(GString gstring) throws SQLException {
List<Object> params = getParameters(gstring);
String sql = asSql(gstring, params);
return executeInsert(sql, params);
} | java | public List<List<Object>> executeInsert(GString gstring) throws SQLException {
List<Object> params = getParameters(gstring);
String sql = asSql(gstring, params);
return executeInsert(sql, params);
} | [
"public",
"List",
"<",
"List",
"<",
"Object",
">",
">",
"executeInsert",
"(",
"GString",
"gstring",
")",
"throws",
"SQLException",
"{",
"List",
"<",
"Object",
">",
"params",
"=",
"getParameters",
"(",
"gstring",
")",
";",
"String",
"sql",
"=",
"asSql",
"... | Executes the given SQL statement (typically an INSERT statement).
Use this variant when you want to receive the values of any
auto-generated columns, such as an autoincrement ID field.
The query may contain GString expressions.
<p>
Generated key values can be accessed using
array notation. For example, to return the second auto-generated
column value of the third row, use <code>keys[3][1]</code>. The
method is designed to be used with SQL INSERT statements, but is
not limited to them.
<p>
The standard use for this method is when a table has an
autoincrement ID column and you want to know what the ID is for
a newly inserted row. In this example, we insert a single row
into a table in which the first column contains the autoincrement ID:
<pre>
def sql = Sql.newInstance("jdbc:mysql://localhost:3306/groovy",
"user",
"password",
"com.mysql.jdbc.Driver")
def keys = sql.executeInsert("insert into test_table (INT_DATA, STRING_DATA) "
+ "VALUES (1, 'Key Largo')")
def id = keys[0][0]
// 'id' now contains the value of the new row's ID column.
// It can be used to update an object representation's
// id attribute for example.
...
</pre>
<p>
Resource handling is performed automatically where appropriate.
@param gstring a GString containing the SQL query with embedded params
@return A list of the auto-generated column values for each
inserted row (typically auto-generated keys)
@throws SQLException if a database access error occurs
@see #expand(Object) | [
"Executes",
"the",
"given",
"SQL",
"statement",
"(",
"typically",
"an",
"INSERT",
"statement",
")",
".",
"Use",
"this",
"variant",
"when",
"you",
"want",
"to",
"receive",
"the",
"values",
"of",
"any",
"auto",
"-",
"generated",
"columns",
"such",
"as",
"an"... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L2854-L2858 |
JRebirth/JRebirth | org.jrebirth.af/component/src/main/java/org/jrebirth/af/component/ui/tab/TabbedPaneModel.java | TabbedPaneModel.doInsertTab | public void doInsertTab(int idx, final Dockable tab, final Wave wave) {
// final TabBB<M> t = TabBB.create()
// //.name(model.modelName())
// .modelKey(model.getKey());
// Tab t = model.getBehaviorBean(TabBehavior.class);
if (idx < 0) {
idx = object().tabs().isEmpty() ? 0 : object().tabs().size();
}
// view().addTab(idx, tab);
object().tabs().add(idx, tab);
} | java | public void doInsertTab(int idx, final Dockable tab, final Wave wave) {
// final TabBB<M> t = TabBB.create()
// //.name(model.modelName())
// .modelKey(model.getKey());
// Tab t = model.getBehaviorBean(TabBehavior.class);
if (idx < 0) {
idx = object().tabs().isEmpty() ? 0 : object().tabs().size();
}
// view().addTab(idx, tab);
object().tabs().add(idx, tab);
} | [
"public",
"void",
"doInsertTab",
"(",
"int",
"idx",
",",
"final",
"Dockable",
"tab",
",",
"final",
"Wave",
"wave",
")",
"{",
"// final TabBB<M> t = TabBB.create()",
"// //.name(model.modelName())",
"// .modelKey(model.getKey());",
"// Tab t = model.getBehaviorBean(TabBehavior.c... | Insert tab.
@param idx the idx
@param tab the tab
@param wave the wave | [
"Insert",
"tab",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/component/src/main/java/org/jrebirth/af/component/ui/tab/TabbedPaneModel.java#L180-L194 |
threerings/nenya | core/src/main/java/com/threerings/miso/client/SceneObjectTip.java | SceneObjectTip.layout | public void layout (Graphics2D gfx, SceneObject tipFor, Rectangle boundary)
{
layout(gfx, ICON_PAD, EXTRA_PAD);
bounds = new Rectangle(_size);
// locate the most appropriate tip layout
for (int ii = 0, ll = _layouts.size(); ii < ll; ii++) {
LayoutReg reg = _layouts.get(ii);
String act = tipFor.info.action == null ? "" : tipFor.info.action;
if (act.startsWith(reg.prefix)) {
reg.layout.layout(gfx, boundary, tipFor, this);
break;
}
}
} | java | public void layout (Graphics2D gfx, SceneObject tipFor, Rectangle boundary)
{
layout(gfx, ICON_PAD, EXTRA_PAD);
bounds = new Rectangle(_size);
// locate the most appropriate tip layout
for (int ii = 0, ll = _layouts.size(); ii < ll; ii++) {
LayoutReg reg = _layouts.get(ii);
String act = tipFor.info.action == null ? "" : tipFor.info.action;
if (act.startsWith(reg.prefix)) {
reg.layout.layout(gfx, boundary, tipFor, this);
break;
}
}
} | [
"public",
"void",
"layout",
"(",
"Graphics2D",
"gfx",
",",
"SceneObject",
"tipFor",
",",
"Rectangle",
"boundary",
")",
"{",
"layout",
"(",
"gfx",
",",
"ICON_PAD",
",",
"EXTRA_PAD",
")",
";",
"bounds",
"=",
"new",
"Rectangle",
"(",
"_size",
")",
";",
"// ... | Called to initialize the tip so that it can be painted.
@param tipFor the scene object that we're a tip for.
@param boundary the boundary of all displayable space. | [
"Called",
"to",
"initialize",
"the",
"tip",
"so",
"that",
"it",
"can",
"be",
"painted",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneObjectTip.java#L87-L101 |
SahaginOrg/sahagin-java | src/main/java/org/sahagin/runlib/srctreegen/SrcTreeGenerator.java | SrcTreeGenerator.generate | public SrcTree generate(String[] srcFiles, Charset srcCharset, String[] classPathEntries) {
// collect root class and method table without code body
CollectRootRequestor rootRequestor = new CollectRootRequestor();
parseAST(srcFiles, srcCharset, classPathEntries, rootRequestor);
// collect sub class and method table without code body
CollectSubRequestor subRequestor = new CollectSubRequestor(rootRequestor.getRootClassTable());
parseAST(srcFiles, srcCharset, classPathEntries, subRequestor);
// add additional TestDoc to the table
AdditionalTestDocsSetter setter = new AdditionalTestDocsSetter(
rootRequestor.getRootClassTable(), subRequestor.getSubClassTable(),
rootRequestor.getRootMethodTable(), subRequestor.getSubMethodTable());
setter.set(additionalTestDocs);
// collect code
CollectCodeRequestor codeRequestor = new CollectCodeRequestor(
subRequestor.getSubClassTable(), rootRequestor.getRootMethodTable(),
subRequestor.getSubMethodTable(), subRequestor.getFieldTable());
parseAST(srcFiles, srcCharset, classPathEntries, codeRequestor);
SrcTree result = new SrcTree();
result.setRootClassTable(rootRequestor.getRootClassTable());
result.setSubClassTable(subRequestor.getSubClassTable());
result.setRootMethodTable(rootRequestor.getRootMethodTable());
result.setSubMethodTable(subRequestor.getSubMethodTable());
result.setFieldTable(subRequestor.getFieldTable());
return result;
} | java | public SrcTree generate(String[] srcFiles, Charset srcCharset, String[] classPathEntries) {
// collect root class and method table without code body
CollectRootRequestor rootRequestor = new CollectRootRequestor();
parseAST(srcFiles, srcCharset, classPathEntries, rootRequestor);
// collect sub class and method table without code body
CollectSubRequestor subRequestor = new CollectSubRequestor(rootRequestor.getRootClassTable());
parseAST(srcFiles, srcCharset, classPathEntries, subRequestor);
// add additional TestDoc to the table
AdditionalTestDocsSetter setter = new AdditionalTestDocsSetter(
rootRequestor.getRootClassTable(), subRequestor.getSubClassTable(),
rootRequestor.getRootMethodTable(), subRequestor.getSubMethodTable());
setter.set(additionalTestDocs);
// collect code
CollectCodeRequestor codeRequestor = new CollectCodeRequestor(
subRequestor.getSubClassTable(), rootRequestor.getRootMethodTable(),
subRequestor.getSubMethodTable(), subRequestor.getFieldTable());
parseAST(srcFiles, srcCharset, classPathEntries, codeRequestor);
SrcTree result = new SrcTree();
result.setRootClassTable(rootRequestor.getRootClassTable());
result.setSubClassTable(subRequestor.getSubClassTable());
result.setRootMethodTable(rootRequestor.getRootMethodTable());
result.setSubMethodTable(subRequestor.getSubMethodTable());
result.setFieldTable(subRequestor.getFieldTable());
return result;
} | [
"public",
"SrcTree",
"generate",
"(",
"String",
"[",
"]",
"srcFiles",
",",
"Charset",
"srcCharset",
",",
"String",
"[",
"]",
"classPathEntries",
")",
"{",
"// collect root class and method table without code body",
"CollectRootRequestor",
"rootRequestor",
"=",
"new",
"C... | all class containing sub directories even if the class is in a named package | [
"all",
"class",
"containing",
"sub",
"directories",
"even",
"if",
"the",
"class",
"is",
"in",
"a",
"named",
"package"
] | train | https://github.com/SahaginOrg/sahagin-java/blob/7ace428adebe3466ceb5826bc9681f8e3d52be68/src/main/java/org/sahagin/runlib/srctreegen/SrcTreeGenerator.java#L871-L899 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.addCompositeEntityChild | public UUID addCompositeEntityChild(UUID appId, String versionId, UUID cEntityId, AddCompositeEntityChildOptionalParameter addCompositeEntityChildOptionalParameter) {
return addCompositeEntityChildWithServiceResponseAsync(appId, versionId, cEntityId, addCompositeEntityChildOptionalParameter).toBlocking().single().body();
} | java | public UUID addCompositeEntityChild(UUID appId, String versionId, UUID cEntityId, AddCompositeEntityChildOptionalParameter addCompositeEntityChildOptionalParameter) {
return addCompositeEntityChildWithServiceResponseAsync(appId, versionId, cEntityId, addCompositeEntityChildOptionalParameter).toBlocking().single().body();
} | [
"public",
"UUID",
"addCompositeEntityChild",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"cEntityId",
",",
"AddCompositeEntityChildOptionalParameter",
"addCompositeEntityChildOptionalParameter",
")",
"{",
"return",
"addCompositeEntityChildWithServiceResponseAsy... | Creates a single child in an existing composite entity model.
@param appId The application ID.
@param versionId The version ID.
@param cEntityId The composite entity extractor ID.
@param addCompositeEntityChildOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the UUID object if successful. | [
"Creates",
"a",
"single",
"child",
"in",
"an",
"existing",
"composite",
"entity",
"model",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L6834-L6836 |
uPortal-Project/uportal-home | web/src/main/java/edu/wisc/my/home/api/RestProxyApplicationConfiguration.java | RestProxyApplicationConfiguration.restTemplate | @Bean
public RestTemplate restTemplate(){
RestTemplate restTemplate=new RestTemplate();
List<HttpMessageConverter<?>> mc=restTemplate.getMessageConverters();
MappingJackson2HttpMessageConverter json=new MappingJackson2HttpMessageConverter();
List<MediaType> supportedMediaTypes=new ArrayList<MediaType>();
supportedMediaTypes.add(new MediaType("text","javascript",Charset.forName("utf-8")));
supportedMediaTypes.add(new MediaType("application", "javascript", Charset.forName("UTF-8")));
json.setSupportedMediaTypes(supportedMediaTypes);
mc.add(json);
restTemplate.setMessageConverters(mc);
return restTemplate;
} | java | @Bean
public RestTemplate restTemplate(){
RestTemplate restTemplate=new RestTemplate();
List<HttpMessageConverter<?>> mc=restTemplate.getMessageConverters();
MappingJackson2HttpMessageConverter json=new MappingJackson2HttpMessageConverter();
List<MediaType> supportedMediaTypes=new ArrayList<MediaType>();
supportedMediaTypes.add(new MediaType("text","javascript",Charset.forName("utf-8")));
supportedMediaTypes.add(new MediaType("application", "javascript", Charset.forName("UTF-8")));
json.setSupportedMediaTypes(supportedMediaTypes);
mc.add(json);
restTemplate.setMessageConverters(mc);
return restTemplate;
} | [
"@",
"Bean",
"public",
"RestTemplate",
"restTemplate",
"(",
")",
"{",
"RestTemplate",
"restTemplate",
"=",
"new",
"RestTemplate",
"(",
")",
";",
"List",
"<",
"HttpMessageConverter",
"<",
"?",
">",
">",
"mc",
"=",
"restTemplate",
".",
"getMessageConverters",
"(... | This bean adds in unsupported return types. Necessary because even though
rest proxy accepts all types, there are still a few that are unsupported
@return a {@link RestTemplate} | [
"This",
"bean",
"adds",
"in",
"unsupported",
"return",
"types",
".",
"Necessary",
"because",
"even",
"though",
"rest",
"proxy",
"accepts",
"all",
"types",
"there",
"are",
"still",
"a",
"few",
"that",
"are",
"unsupported"
] | train | https://github.com/uPortal-Project/uportal-home/blob/beefe0e95920cb9e6e78f1005ea1e8e3064c0f69/web/src/main/java/edu/wisc/my/home/api/RestProxyApplicationConfiguration.java#L61-L73 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java | BlobContainersInner.getAsync | public Observable<BlobContainerInner> getAsync(String resourceGroupName, String accountName, String containerName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, containerName).map(new Func1<ServiceResponse<BlobContainerInner>, BlobContainerInner>() {
@Override
public BlobContainerInner call(ServiceResponse<BlobContainerInner> response) {
return response.body();
}
});
} | java | public Observable<BlobContainerInner> getAsync(String resourceGroupName, String accountName, String containerName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, containerName).map(new Func1<ServiceResponse<BlobContainerInner>, BlobContainerInner>() {
@Override
public BlobContainerInner call(ServiceResponse<BlobContainerInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"BlobContainerInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"containerName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
... | Gets properties of a specified container.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the BlobContainerInner object | [
"Gets",
"properties",
"of",
"a",
"specified",
"container",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java#L635-L642 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/message/MessageClient.java | MessageClient.retractMessage | public ResponseWrapper retractMessage(String username, long messageId)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
return _httpClient.sendPost(_baseUrl + messagePath + "/" + username + "/" + messageId + "/retract", null);
} | java | public ResponseWrapper retractMessage(String username, long messageId)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
return _httpClient.sendPost(_baseUrl + messagePath + "/" + username + "/" + messageId + "/retract", null);
} | [
"public",
"ResponseWrapper",
"retractMessage",
"(",
"String",
"username",
",",
"long",
"messageId",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"StringUtils",
".",
"checkUsername",
"(",
"username",
")",
";",
"return",
"_httpClient",
".",
... | retract message
消息撤回
@param username 用户名
@param messageId message id
@return No Content, Error Code:
855001 out of retract message time, the effective time is within 3 minutes after sending message
855003 the retract message is not exist
855004 the message had been retracted
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"retract",
"message",
"消息撤回"
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/message/MessageClient.java#L209-L213 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java | TransliteratorParser.parsePragma | private int parsePragma(String rule, int pos, int limit) {
int[] array = new int[2];
// resemblesPragma() has already returned true, so we
// know that pos points to /use\s/i; we can skip 4 characters
// immediately
pos += 4;
// Here are the pragmas we recognize:
// use variable range 0xE000 0xEFFF;
// use maximum backup 16;
// use nfd rules;
int p = Utility.parsePattern(rule, pos, limit, "~variable range # #~;", array);
if (p >= 0) {
setVariableRange(array[0], array[1]);
return p;
}
p = Utility.parsePattern(rule, pos, limit, "~maximum backup #~;", array);
if (p >= 0) {
pragmaMaximumBackup(array[0]);
return p;
}
p = Utility.parsePattern(rule, pos, limit, "~nfd rules~;", null);
if (p >= 0) {
pragmaNormalizeRules(Normalizer.NFD);
return p;
}
p = Utility.parsePattern(rule, pos, limit, "~nfc rules~;", null);
if (p >= 0) {
pragmaNormalizeRules(Normalizer.NFC);
return p;
}
// Syntax error: unable to parse pragma
return -1;
} | java | private int parsePragma(String rule, int pos, int limit) {
int[] array = new int[2];
// resemblesPragma() has already returned true, so we
// know that pos points to /use\s/i; we can skip 4 characters
// immediately
pos += 4;
// Here are the pragmas we recognize:
// use variable range 0xE000 0xEFFF;
// use maximum backup 16;
// use nfd rules;
int p = Utility.parsePattern(rule, pos, limit, "~variable range # #~;", array);
if (p >= 0) {
setVariableRange(array[0], array[1]);
return p;
}
p = Utility.parsePattern(rule, pos, limit, "~maximum backup #~;", array);
if (p >= 0) {
pragmaMaximumBackup(array[0]);
return p;
}
p = Utility.parsePattern(rule, pos, limit, "~nfd rules~;", null);
if (p >= 0) {
pragmaNormalizeRules(Normalizer.NFD);
return p;
}
p = Utility.parsePattern(rule, pos, limit, "~nfc rules~;", null);
if (p >= 0) {
pragmaNormalizeRules(Normalizer.NFC);
return p;
}
// Syntax error: unable to parse pragma
return -1;
} | [
"private",
"int",
"parsePragma",
"(",
"String",
"rule",
",",
"int",
"pos",
",",
"int",
"limit",
")",
"{",
"int",
"[",
"]",
"array",
"=",
"new",
"int",
"[",
"2",
"]",
";",
"// resemblesPragma() has already returned true, so we",
"// know that pos points to /use\\s/... | Parse a pragma. This method assumes resemblesPragma() has
already returned true.
@param pos offset to the first non-whitespace character
of the rule.
@param limit pointer past the last character of the rule.
@return the position index after the final ';' of the pragma,
or -1 on failure. | [
"Parse",
"a",
"pragma",
".",
"This",
"method",
"assumes",
"resemblesPragma",
"()",
"has",
"already",
"returned",
"true",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java#L1386-L1424 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/ui/CmsGalleriesTab.java | CmsGalleriesTab.createTreeItem | protected CmsTreeItem createTreeItem(
CmsGalleryFolderBean galleryInfo,
List<String> selectedGalleries,
boolean forTree) {
CmsListItemWidget listItemWidget = new CmsListItemWidget(galleryInfo);
listItemWidget.setUnselectable();
CmsCheckBox checkBox = new CmsCheckBox();
SelectionHandler selectionHandler = new SelectionHandler(galleryInfo.getPath(), checkBox);
checkBox.addClickHandler(selectionHandler);
listItemWidget.addClickHandler(selectionHandler);
if ((selectedGalleries != null) && selectedGalleries.contains(galleryInfo.getPath())) {
checkBox.setChecked(true);
}
if (galleryInfo.isEditable()) {
if (CmsEditExternalLinkDialog.LINK_GALLERY_RESOURCE_TYPE_NAME.equals(galleryInfo.getType())) {
CmsPushButton createExternalLink = createNewExternalLinkButton(galleryInfo.getPath());
if (createExternalLink != null) {
listItemWidget.addButton(createExternalLink);
}
} else {
listItemWidget.addButton(createUploadButtonForTarget(galleryInfo.getPath(), false));
}
}
listItemWidget.addButton(createSelectButton(selectionHandler));
if (m_tabHandler.hasGalleriesSelectable()) {
CmsPushButton selectButton = createSelectResourceButton(
galleryInfo.getPath(),
CmsUUID.getNullUUID(),
"",
"");
listItemWidget.addButton(selectButton);
}
CmsTreeItem treeItem = new CmsTreeItem(forTree, checkBox, listItemWidget);
treeItem.setId(galleryInfo.getPath());
return treeItem;
} | java | protected CmsTreeItem createTreeItem(
CmsGalleryFolderBean galleryInfo,
List<String> selectedGalleries,
boolean forTree) {
CmsListItemWidget listItemWidget = new CmsListItemWidget(galleryInfo);
listItemWidget.setUnselectable();
CmsCheckBox checkBox = new CmsCheckBox();
SelectionHandler selectionHandler = new SelectionHandler(galleryInfo.getPath(), checkBox);
checkBox.addClickHandler(selectionHandler);
listItemWidget.addClickHandler(selectionHandler);
if ((selectedGalleries != null) && selectedGalleries.contains(galleryInfo.getPath())) {
checkBox.setChecked(true);
}
if (galleryInfo.isEditable()) {
if (CmsEditExternalLinkDialog.LINK_GALLERY_RESOURCE_TYPE_NAME.equals(galleryInfo.getType())) {
CmsPushButton createExternalLink = createNewExternalLinkButton(galleryInfo.getPath());
if (createExternalLink != null) {
listItemWidget.addButton(createExternalLink);
}
} else {
listItemWidget.addButton(createUploadButtonForTarget(galleryInfo.getPath(), false));
}
}
listItemWidget.addButton(createSelectButton(selectionHandler));
if (m_tabHandler.hasGalleriesSelectable()) {
CmsPushButton selectButton = createSelectResourceButton(
galleryInfo.getPath(),
CmsUUID.getNullUUID(),
"",
"");
listItemWidget.addButton(selectButton);
}
CmsTreeItem treeItem = new CmsTreeItem(forTree, checkBox, listItemWidget);
treeItem.setId(galleryInfo.getPath());
return treeItem;
} | [
"protected",
"CmsTreeItem",
"createTreeItem",
"(",
"CmsGalleryFolderBean",
"galleryInfo",
",",
"List",
"<",
"String",
">",
"selectedGalleries",
",",
"boolean",
"forTree",
")",
"{",
"CmsListItemWidget",
"listItemWidget",
"=",
"new",
"CmsListItemWidget",
"(",
"galleryInfo... | Creates a tree item widget used in list and tree view of this tab.<p>
@param galleryInfo the gallery folder bean
@param selectedGalleries the selected galleries
@param forTree <code>true</code> if the item is used within tree view
@return the tree item | [
"Creates",
"a",
"tree",
"item",
"widget",
"used",
"in",
"list",
"and",
"tree",
"view",
"of",
"this",
"tab",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsGalleriesTab.java#L473-L511 |
FXMisc/WellBehavedFX | src/main/java/org/fxmisc/wellbehaved/event/template/InputMapTemplate.java | InputMapTemplate.installOverride | public static <S extends Node, E extends Event> void installOverride(InputMapTemplate<S, E> imt, S node) {
Nodes.addInputMap(node, imt.instantiate(node));
} | java | public static <S extends Node, E extends Event> void installOverride(InputMapTemplate<S, E> imt, S node) {
Nodes.addInputMap(node, imt.instantiate(node));
} | [
"public",
"static",
"<",
"S",
"extends",
"Node",
",",
"E",
"extends",
"Event",
">",
"void",
"installOverride",
"(",
"InputMapTemplate",
"<",
"S",
",",
"E",
">",
"imt",
",",
"S",
"node",
")",
"{",
"Nodes",
".",
"addInputMap",
"(",
"node",
",",
"imt",
... | Instantiates the input map and installs it into the node via {@link Nodes#addInputMap(Node, InputMap)} | [
"Instantiates",
"the",
"input",
"map",
"and",
"installs",
"it",
"into",
"the",
"node",
"via",
"{"
] | train | https://github.com/FXMisc/WellBehavedFX/blob/ca889734481f5439655ca8deb6f742964b5654b0/src/main/java/org/fxmisc/wellbehaved/event/template/InputMapTemplate.java#L371-L373 |
ops4j/org.ops4j.pax.exam2 | core/pax-exam/src/main/java/org/ops4j/pax/exam/ConfigurationManager.java | ConfigurationManager.getProperty | public String getProperty(String key, String defaultValue) {
String value = resolver.get(key);
return (value == null) ? defaultValue : value;
} | java | public String getProperty(String key, String defaultValue) {
String value = resolver.get(key);
return (value == null) ? defaultValue : value;
} | [
"public",
"String",
"getProperty",
"(",
"String",
"key",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"resolver",
".",
"get",
"(",
"key",
")",
";",
"return",
"(",
"value",
"==",
"null",
")",
"?",
"defaultValue",
":",
"value",
";",
"... | Returns the configuration property for the given key, or the given default value.
@param key
configuration key
@param defaultValue
default value for key
@return configuration value, or the default value if the key is not defined | [
"Returns",
"the",
"configuration",
"property",
"for",
"the",
"given",
"key",
"or",
"the",
"given",
"default",
"value",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam/src/main/java/org/ops4j/pax/exam/ConfigurationManager.java#L91-L94 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.serviceName_users_login_receivers_POST | public OvhReceiver serviceName_users_login_receivers_POST(String serviceName, String login, Boolean autoUpdate, String csvUrl, String description, String documentId, Long slotId) throws IOException {
String qPath = "/sms/{serviceName}/users/{login}/receivers";
StringBuilder sb = path(qPath, serviceName, login);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "autoUpdate", autoUpdate);
addBody(o, "csvUrl", csvUrl);
addBody(o, "description", description);
addBody(o, "documentId", documentId);
addBody(o, "slotId", slotId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhReceiver.class);
} | java | public OvhReceiver serviceName_users_login_receivers_POST(String serviceName, String login, Boolean autoUpdate, String csvUrl, String description, String documentId, Long slotId) throws IOException {
String qPath = "/sms/{serviceName}/users/{login}/receivers";
StringBuilder sb = path(qPath, serviceName, login);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "autoUpdate", autoUpdate);
addBody(o, "csvUrl", csvUrl);
addBody(o, "description", description);
addBody(o, "documentId", documentId);
addBody(o, "slotId", slotId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhReceiver.class);
} | [
"public",
"OvhReceiver",
"serviceName_users_login_receivers_POST",
"(",
"String",
"serviceName",
",",
"String",
"login",
",",
"Boolean",
"autoUpdate",
",",
"String",
"csvUrl",
",",
"String",
"description",
",",
"String",
"documentId",
",",
"Long",
"slotId",
")",
"th... | Add a new document of csv receivers
REST: POST /sms/{serviceName}/users/{login}/receivers
@param slotId [required] Slot number id used to handle the document
@param autoUpdate [required] Download file from URL before sending to contacts (works only with csvUrl and not document ID)
@param documentId [required] ID of the /me/document file you want to import
@param description [required] Description name of the document
@param csvUrl [required] URL of the file you want to import
@param serviceName [required] The internal name of your SMS offer
@param login [required] The sms user login | [
"Add",
"a",
"new",
"document",
"of",
"csv",
"receivers"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L814-L825 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorsInner.java | ServiceTierAdvisorsInner.getAsync | public Observable<ServiceTierAdvisorInner> getAsync(String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName).map(new Func1<ServiceResponse<ServiceTierAdvisorInner>, ServiceTierAdvisorInner>() {
@Override
public ServiceTierAdvisorInner call(ServiceResponse<ServiceTierAdvisorInner> response) {
return response.body();
}
});
} | java | public Observable<ServiceTierAdvisorInner> getAsync(String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName).map(new Func1<ServiceResponse<ServiceTierAdvisorInner>, ServiceTierAdvisorInner>() {
@Override
public ServiceTierAdvisorInner call(ServiceResponse<ServiceTierAdvisorInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServiceTierAdvisorInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"String",
"serviceTierAdvisorName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"res... | Gets a service tier advisor.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of database.
@param serviceTierAdvisorName The name of service tier advisor.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServiceTierAdvisorInner object | [
"Gets",
"a",
"service",
"tier",
"advisor",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorsInner.java#L106-L113 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/parser/lexparser/Options.java | Options.readData | public void readData(BufferedReader in) throws IOException {
String line, value;
// skip old variables if still present
lexOptions.readData(in);
line = in.readLine();
value = line.substring(line.indexOf(' ') + 1);
try {
tlpParams = (TreebankLangParserParams) Class.forName(value).newInstance();
} catch (Exception e) {
IOException ioe = new IOException("Problem instantiating parserParams: " + line);
ioe.initCause(e);
throw ioe;
}
line = in.readLine();
// ensure backwards compatibility
if (line.matches("^forceCNF.*")) {
value = line.substring(line.indexOf(' ') + 1);
forceCNF = Boolean.parseBoolean(value);
line = in.readLine();
}
value = line.substring(line.indexOf(' ') + 1);
doPCFG = Boolean.parseBoolean(value);
line = in.readLine();
value = line.substring(line.indexOf(' ') + 1);
doDep = Boolean.parseBoolean(value);
line = in.readLine();
value = line.substring(line.indexOf(' ') + 1);
freeDependencies = Boolean.parseBoolean(value);
line = in.readLine();
value = line.substring(line.indexOf(' ') + 1);
directional = Boolean.parseBoolean(value);
line = in.readLine();
value = line.substring(line.indexOf(' ') + 1);
genStop = Boolean.parseBoolean(value);
line = in.readLine();
value = line.substring(line.indexOf(' ') + 1);
distance = Boolean.parseBoolean(value);
line = in.readLine();
value = line.substring(line.indexOf(' ') + 1);
coarseDistance = Boolean.parseBoolean(value);
line = in.readLine();
value = line.substring(line.indexOf(' ') + 1);
dcTags = Boolean.parseBoolean(value);
line = in.readLine();
if ( ! line.matches("^nPrune.*")) {
throw new RuntimeException("Expected nPrune, found: " + line);
}
value = line.substring(line.indexOf(' ') + 1);
nodePrune = Boolean.parseBoolean(value);
line = in.readLine(); // get rid of last line
if (line.length() != 0) {
throw new RuntimeException("Expected blank line, found: " + line);
}
} | java | public void readData(BufferedReader in) throws IOException {
String line, value;
// skip old variables if still present
lexOptions.readData(in);
line = in.readLine();
value = line.substring(line.indexOf(' ') + 1);
try {
tlpParams = (TreebankLangParserParams) Class.forName(value).newInstance();
} catch (Exception e) {
IOException ioe = new IOException("Problem instantiating parserParams: " + line);
ioe.initCause(e);
throw ioe;
}
line = in.readLine();
// ensure backwards compatibility
if (line.matches("^forceCNF.*")) {
value = line.substring(line.indexOf(' ') + 1);
forceCNF = Boolean.parseBoolean(value);
line = in.readLine();
}
value = line.substring(line.indexOf(' ') + 1);
doPCFG = Boolean.parseBoolean(value);
line = in.readLine();
value = line.substring(line.indexOf(' ') + 1);
doDep = Boolean.parseBoolean(value);
line = in.readLine();
value = line.substring(line.indexOf(' ') + 1);
freeDependencies = Boolean.parseBoolean(value);
line = in.readLine();
value = line.substring(line.indexOf(' ') + 1);
directional = Boolean.parseBoolean(value);
line = in.readLine();
value = line.substring(line.indexOf(' ') + 1);
genStop = Boolean.parseBoolean(value);
line = in.readLine();
value = line.substring(line.indexOf(' ') + 1);
distance = Boolean.parseBoolean(value);
line = in.readLine();
value = line.substring(line.indexOf(' ') + 1);
coarseDistance = Boolean.parseBoolean(value);
line = in.readLine();
value = line.substring(line.indexOf(' ') + 1);
dcTags = Boolean.parseBoolean(value);
line = in.readLine();
if ( ! line.matches("^nPrune.*")) {
throw new RuntimeException("Expected nPrune, found: " + line);
}
value = line.substring(line.indexOf(' ') + 1);
nodePrune = Boolean.parseBoolean(value);
line = in.readLine(); // get rid of last line
if (line.length() != 0) {
throw new RuntimeException("Expected blank line, found: " + line);
}
} | [
"public",
"void",
"readData",
"(",
"BufferedReader",
"in",
")",
"throws",
"IOException",
"{",
"String",
"line",
",",
"value",
";",
"// skip old variables if still present\r",
"lexOptions",
".",
"readData",
"(",
"in",
")",
";",
"line",
"=",
"in",
".",
"readLine",... | Populates data in this Options from the character stream.
@param in The Reader
@throws IOException If there is a problem reading data | [
"Populates",
"data",
"in",
"this",
"Options",
"from",
"the",
"character",
"stream",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/Options.java#L1003-L1056 |
lecho/hellocharts-android | hellocharts-library/src/lecho/lib/hellocharts/computator/ChartComputator.java | ChartComputator.rawPixelsToDataPoint | public boolean rawPixelsToDataPoint(float x, float y, PointF dest) {
if (!contentRectMinusAllMargins.contains((int) x, (int) y)) {
return false;
}
dest.set(currentViewport.left + (x - contentRectMinusAllMargins.left) * currentViewport.width() /
contentRectMinusAllMargins.width(),
currentViewport.bottom + (y - contentRectMinusAllMargins.bottom) * currentViewport.height() /
-contentRectMinusAllMargins.height());
return true;
} | java | public boolean rawPixelsToDataPoint(float x, float y, PointF dest) {
if (!contentRectMinusAllMargins.contains((int) x, (int) y)) {
return false;
}
dest.set(currentViewport.left + (x - contentRectMinusAllMargins.left) * currentViewport.width() /
contentRectMinusAllMargins.width(),
currentViewport.bottom + (y - contentRectMinusAllMargins.bottom) * currentViewport.height() /
-contentRectMinusAllMargins.height());
return true;
} | [
"public",
"boolean",
"rawPixelsToDataPoint",
"(",
"float",
"x",
",",
"float",
"y",
",",
"PointF",
"dest",
")",
"{",
"if",
"(",
"!",
"contentRectMinusAllMargins",
".",
"contains",
"(",
"(",
"int",
")",
"x",
",",
"(",
"int",
")",
"y",
")",
")",
"{",
"r... | Finds the chart point (i.e. within the chart's domain and range) represented by the given pixel coordinates, if
that pixel is within the chart region described by {@link #contentRectMinusAllMargins}. If the point is found,
the "dest"
argument is set to the point and this function returns true. Otherwise, this function returns false and
"dest" is
unchanged. | [
"Finds",
"the",
"chart",
"point",
"(",
"i",
".",
"e",
".",
"within",
"the",
"chart",
"s",
"domain",
"and",
"range",
")",
"represented",
"by",
"the",
"given",
"pixel",
"coordinates",
"if",
"that",
"pixel",
"is",
"within",
"the",
"chart",
"region",
"descri... | train | https://github.com/lecho/hellocharts-android/blob/c41419c9afa097452dee823c7eba0e5136aa96bd/hellocharts-library/src/lecho/lib/hellocharts/computator/ChartComputator.java#L178-L187 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.instanceOf | @NullSafe
public static boolean instanceOf(Object obj, Class<?> type) {
return type != null && type.isInstance(obj);
} | java | @NullSafe
public static boolean instanceOf(Object obj, Class<?> type) {
return type != null && type.isInstance(obj);
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"instanceOf",
"(",
"Object",
"obj",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"return",
"type",
"!=",
"null",
"&&",
"type",
".",
"isInstance",
"(",
"obj",
")",
";",
"}"
] | Determines whether the given Object is an instance of the specified Class. Note, an Object cannot be an
instance of null, so this method returns false if the Class type is null or the Object is null.
@param obj the Object to test as an instance of the specified Class type.
@param type the Class type used in the instanceof operation.
@return a boolean value indicating whether the Object is an instance of the Class type.
@see java.lang.Class#isInstance(Object)
@see #assignableTo(Class, Class) | [
"Determines",
"whether",
"the",
"given",
"Object",
"is",
"an",
"instance",
"of",
"the",
"specified",
"Class",
".",
"Note",
"an",
"Object",
"cannot",
"be",
"an",
"instance",
"of",
"null",
"so",
"this",
"method",
"returns",
"false",
"if",
"the",
"Class",
"ty... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L565-L568 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java | HtmlTree.CODE | public static HtmlTree CODE(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.CODE, nullCheck(body));
return htmltree;
} | java | public static HtmlTree CODE(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.CODE, nullCheck(body));
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"CODE",
"(",
"Content",
"body",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"CODE",
",",
"nullCheck",
"(",
"body",
")",
")",
";",
"return",
"htmltree",
";",
"}"
] | Generates a CODE tag with some content.
@param body content for the tag
@return an HtmlTree object for the CODE tag | [
"Generates",
"a",
"CODE",
"tag",
"with",
"some",
"content",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L299-L302 |
spotify/helios | helios-tools/src/main/java/com/spotify/helios/cli/command/RollingUpdateCommand.java | RollingUpdateCommand.nullableWithFallback | private <T> T nullableWithFallback(final T first, final T second) {
return first != null ? first : second;
} | java | private <T> T nullableWithFallback(final T first, final T second) {
return first != null ? first : second;
} | [
"private",
"<",
"T",
">",
"T",
"nullableWithFallback",
"(",
"final",
"T",
"first",
",",
"final",
"T",
"second",
")",
"{",
"return",
"first",
"!=",
"null",
"?",
"first",
":",
"second",
";",
"}"
] | Return first argument if not null. Otherwise return second argument. | [
"Return",
"first",
"argument",
"if",
"not",
"null",
".",
"Otherwise",
"return",
"second",
"argument",
"."
] | train | https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-tools/src/main/java/com/spotify/helios/cli/command/RollingUpdateCommand.java#L321-L323 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebApp.java | WebApp.initializeExtensionPointSCIs | private boolean initializeExtensionPointSCIs(List<ServletContainerInitializer> myScis, DeployedModule module, HashMap<ServletContainerInitializer, Class[]> handleTypesHashMap, HashMap<ServletContainerInitializer, HashSet<Class<?>>> onStartupHashMap){
Iterator<ServletContainerInitializer> servletContainerInitializersIterator = com.ibm.ws.webcontainer.osgi.WebContainer.getServletContainerInitializerExtension();//com.ibm.ws.webcontainer.WSWebContainer.getServletContainerInitializerRegistry();
if (servletContainerInitializersIterator==null)
return false;
boolean needToScanClasses = false;
while(servletContainerInitializersIterator.hasNext()){
ServletContainerInitializer sci = servletContainerInitializersIterator.next();
String className = sci.getClass().getName();
try{
myScis.add(sci);
if(investigateHandlesTypes(sci, handleTypesHashMap, onStartupHashMap)){
needToScanClasses = true;
}
}catch (Exception e){
logger.logp(Level.SEVERE, CLASS_NAME,"initializeExtensionPointSCIs", "exception.occured.while.processing.ServletContainerInitializer.initializeExtensionPointSCIs", new Object[] {className});
}
}
return needToScanClasses;
} | java | private boolean initializeExtensionPointSCIs(List<ServletContainerInitializer> myScis, DeployedModule module, HashMap<ServletContainerInitializer, Class[]> handleTypesHashMap, HashMap<ServletContainerInitializer, HashSet<Class<?>>> onStartupHashMap){
Iterator<ServletContainerInitializer> servletContainerInitializersIterator = com.ibm.ws.webcontainer.osgi.WebContainer.getServletContainerInitializerExtension();//com.ibm.ws.webcontainer.WSWebContainer.getServletContainerInitializerRegistry();
if (servletContainerInitializersIterator==null)
return false;
boolean needToScanClasses = false;
while(servletContainerInitializersIterator.hasNext()){
ServletContainerInitializer sci = servletContainerInitializersIterator.next();
String className = sci.getClass().getName();
try{
myScis.add(sci);
if(investigateHandlesTypes(sci, handleTypesHashMap, onStartupHashMap)){
needToScanClasses = true;
}
}catch (Exception e){
logger.logp(Level.SEVERE, CLASS_NAME,"initializeExtensionPointSCIs", "exception.occured.while.processing.ServletContainerInitializer.initializeExtensionPointSCIs", new Object[] {className});
}
}
return needToScanClasses;
} | [
"private",
"boolean",
"initializeExtensionPointSCIs",
"(",
"List",
"<",
"ServletContainerInitializer",
">",
"myScis",
",",
"DeployedModule",
"module",
",",
"HashMap",
"<",
"ServletContainerInitializer",
",",
"Class",
"[",
"]",
">",
"handleTypesHashMap",
",",
"HashMap",
... | /*
F743-31926
Called from initializeServletContainerInitializers(boolean, boolean,includedJars,warFile)
Grabs all of the SCIs from the ExtensionPoint and investigates each to
see if we need to scan for classes.
@return - True if we need to scan for classes, False otherwise. | [
"/",
"*",
"F743",
"-",
"31926"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebApp.java#L2517-L2537 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePatternUtil.java | MessagePatternUtil.buildMessageNode | public static MessageNode buildMessageNode(MessagePattern pattern) {
int limit = pattern.countParts() - 1;
if (limit < 0) {
throw new IllegalArgumentException("The MessagePattern is empty");
} else if (pattern.getPartType(0) != MessagePattern.Part.Type.MSG_START) {
throw new IllegalArgumentException(
"The MessagePattern does not represent a MessageFormat pattern");
}
return buildMessageNode(pattern, 0, limit);
} | java | public static MessageNode buildMessageNode(MessagePattern pattern) {
int limit = pattern.countParts() - 1;
if (limit < 0) {
throw new IllegalArgumentException("The MessagePattern is empty");
} else if (pattern.getPartType(0) != MessagePattern.Part.Type.MSG_START) {
throw new IllegalArgumentException(
"The MessagePattern does not represent a MessageFormat pattern");
}
return buildMessageNode(pattern, 0, limit);
} | [
"public",
"static",
"MessageNode",
"buildMessageNode",
"(",
"MessagePattern",
"pattern",
")",
"{",
"int",
"limit",
"=",
"pattern",
".",
"countParts",
"(",
")",
"-",
"1",
";",
"if",
"(",
"limit",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",... | Factory method, builds and returns a MessageNode from a MessagePattern.
@param pattern a parsed MessageFormat pattern string
@return a MessageNode or a ComplexArgStyleNode
@throws IllegalArgumentException if the MessagePattern is empty
or does not represent a MessageFormat pattern | [
"Factory",
"method",
"builds",
"and",
"returns",
"a",
"MessageNode",
"from",
"a",
"MessagePattern",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePatternUtil.java#L55-L64 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java | Collections.synchronizedList | public static <T> List<T> synchronizedList(List<T> list) {
return (list instanceof RandomAccess ?
new SynchronizedRandomAccessList<>(list) :
new SynchronizedList<>(list));
} | java | public static <T> List<T> synchronizedList(List<T> list) {
return (list instanceof RandomAccess ?
new SynchronizedRandomAccessList<>(list) :
new SynchronizedList<>(list));
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"synchronizedList",
"(",
"List",
"<",
"T",
">",
"list",
")",
"{",
"return",
"(",
"list",
"instanceof",
"RandomAccess",
"?",
"new",
"SynchronizedRandomAccessList",
"<>",
"(",
"list",
")",
":",
"new... | Returns a synchronized (thread-safe) list backed by the specified
list. In order to guarantee serial access, it is critical that
<strong>all</strong> access to the backing list is accomplished
through the returned list.<p>
It is imperative that the user manually synchronize on the returned
list when iterating over it:
<pre>
List list = Collections.synchronizedList(new ArrayList());
...
synchronized (list) {
Iterator i = list.iterator(); // Must be in synchronized block
while (i.hasNext())
foo(i.next());
}
</pre>
Failure to follow this advice may result in non-deterministic behavior.
<p>The returned list will be serializable if the specified list is
serializable.
@param <T> the class of the objects in the list
@param list the list to be "wrapped" in a synchronized list.
@return a synchronized view of the specified list. | [
"Returns",
"a",
"synchronized",
"(",
"thread",
"-",
"safe",
")",
"list",
"backed",
"by",
"the",
"specified",
"list",
".",
"In",
"order",
"to",
"guarantee",
"serial",
"access",
"it",
"is",
"critical",
"that",
"<strong",
">",
"all<",
"/",
"strong",
">",
"a... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java#L2410-L2414 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/nio/PacketIOHelper.java | PacketIOHelper.readFrom | public Packet readFrom(ByteBuffer src) {
if (!headerComplete) {
if (src.remaining() < HEADER_SIZE) {
return null;
}
byte version = src.get();
if (VERSION != version) {
throw new IllegalArgumentException("Packet versions are not matching! Expected -> "
+ VERSION + ", Incoming -> " + version);
}
flags = src.getChar();
partitionId = src.getInt();
size = src.getInt();
headerComplete = true;
}
if (readValue(src)) {
Packet packet = new Packet(payload, partitionId).resetFlagsTo(flags);
reset();
return packet;
} else {
return null;
}
} | java | public Packet readFrom(ByteBuffer src) {
if (!headerComplete) {
if (src.remaining() < HEADER_SIZE) {
return null;
}
byte version = src.get();
if (VERSION != version) {
throw new IllegalArgumentException("Packet versions are not matching! Expected -> "
+ VERSION + ", Incoming -> " + version);
}
flags = src.getChar();
partitionId = src.getInt();
size = src.getInt();
headerComplete = true;
}
if (readValue(src)) {
Packet packet = new Packet(payload, partitionId).resetFlagsTo(flags);
reset();
return packet;
} else {
return null;
}
} | [
"public",
"Packet",
"readFrom",
"(",
"ByteBuffer",
"src",
")",
"{",
"if",
"(",
"!",
"headerComplete",
")",
"{",
"if",
"(",
"src",
".",
"remaining",
"(",
")",
"<",
"HEADER_SIZE",
")",
"{",
"return",
"null",
";",
"}",
"byte",
"version",
"=",
"src",
"."... | Reads the packet data from the supplied {@code ByteBuffer}. The buffer may not contain the complete packet.
If this method returns {@code false}, it should be called again to read more packet data.
@param src the source byte buffer
@return the read Packet if all the packet's data is now read; {@code null} otherwise. | [
"Reads",
"the",
"packet",
"data",
"from",
"the",
"supplied",
"{",
"@code",
"ByteBuffer",
"}",
".",
"The",
"buffer",
"may",
"not",
"contain",
"the",
"complete",
"packet",
".",
"If",
"this",
"method",
"returns",
"{",
"@code",
"false",
"}",
"it",
"should",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/nio/PacketIOHelper.java#L118-L143 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/operator/aggregation/NumericHistogram.java | NumericHistogram.concat | private static void concat(double[] target, double[] first, int firstLength, double[] second, int secondLength)
{
System.arraycopy(first, 0, target, 0, firstLength);
System.arraycopy(second, 0, target, firstLength, secondLength);
} | java | private static void concat(double[] target, double[] first, int firstLength, double[] second, int secondLength)
{
System.arraycopy(first, 0, target, 0, firstLength);
System.arraycopy(second, 0, target, firstLength, secondLength);
} | [
"private",
"static",
"void",
"concat",
"(",
"double",
"[",
"]",
"target",
",",
"double",
"[",
"]",
"first",
",",
"int",
"firstLength",
",",
"double",
"[",
"]",
"second",
",",
"int",
"secondLength",
")",
"{",
"System",
".",
"arraycopy",
"(",
"first",
",... | Copy two arrays back-to-back onto the target array starting at offset 0 | [
"Copy",
"two",
"arrays",
"back",
"-",
"to",
"-",
"back",
"onto",
"the",
"target",
"array",
"starting",
"at",
"offset",
"0"
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/NumericHistogram.java#L238-L242 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceTdeCertificatesInner.java | ManagedInstanceTdeCertificatesInner.beginCreateAsync | public Observable<Void> beginCreateAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginCreateAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginCreateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedInstanceName",
",",
"TdeCertificateInner",
"parameters",
")",
"{",
"return",
"beginCreateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"man... | Creates a TDE certificate for a given server.
@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 managedInstanceName The name of the managed instance.
@param parameters The requested TDE certificate to be created or updated.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Creates",
"a",
"TDE",
"certificate",
"for",
"a",
"given",
"server",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceTdeCertificatesInner.java#L179-L186 |
maxirosson/jdroid-android | jdroid-android-core/src/main/java/com/jdroid/android/utils/ToastUtils.java | ToastUtils.showToast | public static void showToast(String message, int duration, Integer gravity, Integer xOffset, Integer yOffset) {
AbstractApplication androidApplication = AbstractApplication.get();
if (!androidApplication.isInBackground()) {
cancelCurrentToast();
Toast toast = Toast.makeText(androidApplication, message, duration);
if ((gravity != null) && (xOffset != null) && (yOffset != null)) {
toast.setGravity(gravity, xOffset, yOffset);
}
toast.setDuration(duration);
toast.show();
currentToast = new WeakReference<>(toast);
}
} | java | public static void showToast(String message, int duration, Integer gravity, Integer xOffset, Integer yOffset) {
AbstractApplication androidApplication = AbstractApplication.get();
if (!androidApplication.isInBackground()) {
cancelCurrentToast();
Toast toast = Toast.makeText(androidApplication, message, duration);
if ((gravity != null) && (xOffset != null) && (yOffset != null)) {
toast.setGravity(gravity, xOffset, yOffset);
}
toast.setDuration(duration);
toast.show();
currentToast = new WeakReference<>(toast);
}
} | [
"public",
"static",
"void",
"showToast",
"(",
"String",
"message",
",",
"int",
"duration",
",",
"Integer",
"gravity",
",",
"Integer",
"xOffset",
",",
"Integer",
"yOffset",
")",
"{",
"AbstractApplication",
"androidApplication",
"=",
"AbstractApplication",
".",
"get... | Show the {@link Toast} on the current Thread.
@param message The text to show. Can be formatted text.
@param duration How long to display the message. Either {@link Toast#LENGTH_SHORT} {@link Toast#LENGTH_LONG}
@param gravity The location at which the notification should appear on the screen.
@param xOffset The X offset in pixels to apply to the gravity's location.
@param yOffset The Y offset in pixels to apply to the gravity's location. | [
"Show",
"the",
"{",
"@link",
"Toast",
"}",
"on",
"the",
"current",
"Thread",
"."
] | train | https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-core/src/main/java/com/jdroid/android/utils/ToastUtils.java#L98-L113 |
brettwooldridge/HikariCP | src/main/java/com/zaxxer/hikari/pool/HikariPool.java | HikariPool.createTimeoutException | private SQLException createTimeoutException(long startTime)
{
logPoolState("Timeout failure ");
metricsTracker.recordConnectionTimeout();
String sqlState = null;
final Throwable originalException = getLastConnectionFailure();
if (originalException instanceof SQLException) {
sqlState = ((SQLException) originalException).getSQLState();
}
final SQLException connectionException = new SQLTransientConnectionException(poolName + " - Connection is not available, request timed out after " + elapsedMillis(startTime) + "ms.", sqlState, originalException);
if (originalException instanceof SQLException) {
connectionException.setNextException((SQLException) originalException);
}
return connectionException;
} | java | private SQLException createTimeoutException(long startTime)
{
logPoolState("Timeout failure ");
metricsTracker.recordConnectionTimeout();
String sqlState = null;
final Throwable originalException = getLastConnectionFailure();
if (originalException instanceof SQLException) {
sqlState = ((SQLException) originalException).getSQLState();
}
final SQLException connectionException = new SQLTransientConnectionException(poolName + " - Connection is not available, request timed out after " + elapsedMillis(startTime) + "ms.", sqlState, originalException);
if (originalException instanceof SQLException) {
connectionException.setNextException((SQLException) originalException);
}
return connectionException;
} | [
"private",
"SQLException",
"createTimeoutException",
"(",
"long",
"startTime",
")",
"{",
"logPoolState",
"(",
"\"Timeout failure \"",
")",
";",
"metricsTracker",
".",
"recordConnectionTimeout",
"(",
")",
";",
"String",
"sqlState",
"=",
"null",
";",
"final",
"Throwab... | Create a timeout exception (specifically, {@link SQLTransientConnectionException}) to be thrown, because a
timeout occurred when trying to acquire a Connection from the pool. If there was an underlying cause for the
timeout, e.g. a SQLException thrown by the driver while trying to create a new Connection, then use the
SQL State from that exception as our own and additionally set that exception as the "next" SQLException inside
of our exception.
As a side-effect, log the timeout failure at DEBUG, and record the timeout failure in the metrics tracker.
@param startTime the start time (timestamp) of the acquisition attempt
@return a SQLException to be thrown from {@link #getConnection()} | [
"Create",
"a",
"timeout",
"exception",
"(",
"specifically",
"{",
"@link",
"SQLTransientConnectionException",
"}",
")",
"to",
"be",
"thrown",
"because",
"a",
"timeout",
"occurred",
"when",
"trying",
"to",
"acquire",
"a",
"Connection",
"from",
"the",
"pool",
".",
... | train | https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L687-L703 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/SignatureFinder.java | SignatureFinder.digestInteger | private void digestInteger(MessageDigest digest, int value) {
byte[] valueBytes = new byte[4];
Util.numberToBytes(value, valueBytes, 0, 4);
digest.update(valueBytes);
} | java | private void digestInteger(MessageDigest digest, int value) {
byte[] valueBytes = new byte[4];
Util.numberToBytes(value, valueBytes, 0, 4);
digest.update(valueBytes);
} | [
"private",
"void",
"digestInteger",
"(",
"MessageDigest",
"digest",
",",
"int",
"value",
")",
"{",
"byte",
"[",
"]",
"valueBytes",
"=",
"new",
"byte",
"[",
"4",
"]",
";",
"Util",
".",
"numberToBytes",
"(",
"value",
",",
"valueBytes",
",",
"0",
",",
"4"... | Helper method to add a Java integer value to a message digest.
@param digest the message digest being built
@param value the integer whose bytes should be included in the digest | [
"Helper",
"method",
"to",
"add",
"a",
"Java",
"integer",
"value",
"to",
"a",
"message",
"digest",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/SignatureFinder.java#L286-L290 |
alibaba/Tangram-Android | tangram/src/main/java/com/tmall/wireless/tangram3/DefaultResolverRegistry.java | DefaultResolverRegistry.registerCell | public <V extends View> void registerCell(String type, final @NonNull Class<V> viewClz) {
if (viewHolderMap.get(type) == null) {
mDefaultCellBinderResolver.register(type, new BaseCellBinder<>(viewClz, mMVHelper));
} else {
mDefaultCellBinderResolver.register(type, new BaseCellBinder<ViewHolderCreator.ViewHolder, V>(viewHolderMap.get(type),
mMVHelper));
}
mMVHelper.resolver().register(type, viewClz);
} | java | public <V extends View> void registerCell(String type, final @NonNull Class<V> viewClz) {
if (viewHolderMap.get(type) == null) {
mDefaultCellBinderResolver.register(type, new BaseCellBinder<>(viewClz, mMVHelper));
} else {
mDefaultCellBinderResolver.register(type, new BaseCellBinder<ViewHolderCreator.ViewHolder, V>(viewHolderMap.get(type),
mMVHelper));
}
mMVHelper.resolver().register(type, viewClz);
} | [
"public",
"<",
"V",
"extends",
"View",
">",
"void",
"registerCell",
"(",
"String",
"type",
",",
"final",
"@",
"NonNull",
"Class",
"<",
"V",
">",
"viewClz",
")",
"{",
"if",
"(",
"viewHolderMap",
".",
"get",
"(",
"type",
")",
"==",
"null",
")",
"{",
... | register cell with custom view class, the model of cell is provided with default type
@param type
@param viewClz
@param <V> | [
"register",
"cell",
"with",
"custom",
"view",
"class",
"the",
"model",
"of",
"cell",
"is",
"provided",
"with",
"default",
"type"
] | train | https://github.com/alibaba/Tangram-Android/blob/caa57f54e009c8dacd34a2322d5761956ebed321/tangram/src/main/java/com/tmall/wireless/tangram3/DefaultResolverRegistry.java#L67-L75 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java | PropertyBuilder.buildPropertyComments | public void buildPropertyComments(XMLNode node, Content propertyDocTree) {
if (!configuration.nocomment) {
writer.addComments(currentProperty, propertyDocTree);
}
} | java | public void buildPropertyComments(XMLNode node, Content propertyDocTree) {
if (!configuration.nocomment) {
writer.addComments(currentProperty, propertyDocTree);
}
} | [
"public",
"void",
"buildPropertyComments",
"(",
"XMLNode",
"node",
",",
"Content",
"propertyDocTree",
")",
"{",
"if",
"(",
"!",
"configuration",
".",
"nocomment",
")",
"{",
"writer",
".",
"addComments",
"(",
"currentProperty",
",",
"propertyDocTree",
")",
";",
... | Build the comments for the property. Do nothing if
{@link Configuration#nocomment} is set to true.
@param node the XML element that specifies which components to document
@param propertyDocTree the content tree to which the documentation will be added | [
"Build",
"the",
"comments",
"for",
"the",
"property",
".",
"Do",
"nothing",
"if",
"{",
"@link",
"Configuration#nocomment",
"}",
"is",
"set",
"to",
"true",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java#L185-L189 |
alkacon/opencms-core | src/org/opencms/ade/configuration/formatters/CmsFormatterConfigurationCacheState.java | CmsFormatterConfigurationCacheState.createUpdatedCopy | public CmsFormatterConfigurationCacheState createUpdatedCopy(Map<CmsUUID, I_CmsFormatterBean> updateFormatters) {
Map<CmsUUID, I_CmsFormatterBean> newFormatters = Maps.newHashMap(getFormatters());
for (Map.Entry<CmsUUID, I_CmsFormatterBean> entry : updateFormatters.entrySet()) {
CmsUUID key = entry.getKey();
I_CmsFormatterBean value = entry.getValue();
if (value != null) {
newFormatters.put(key, value);
} else {
newFormatters.remove(key);
}
}
return new CmsFormatterConfigurationCacheState(newFormatters);
} | java | public CmsFormatterConfigurationCacheState createUpdatedCopy(Map<CmsUUID, I_CmsFormatterBean> updateFormatters) {
Map<CmsUUID, I_CmsFormatterBean> newFormatters = Maps.newHashMap(getFormatters());
for (Map.Entry<CmsUUID, I_CmsFormatterBean> entry : updateFormatters.entrySet()) {
CmsUUID key = entry.getKey();
I_CmsFormatterBean value = entry.getValue();
if (value != null) {
newFormatters.put(key, value);
} else {
newFormatters.remove(key);
}
}
return new CmsFormatterConfigurationCacheState(newFormatters);
} | [
"public",
"CmsFormatterConfigurationCacheState",
"createUpdatedCopy",
"(",
"Map",
"<",
"CmsUUID",
",",
"I_CmsFormatterBean",
">",
"updateFormatters",
")",
"{",
"Map",
"<",
"CmsUUID",
",",
"I_CmsFormatterBean",
">",
"newFormatters",
"=",
"Maps",
".",
"newHashMap",
"(",... | Creates a new copy of this state in which some entries are removed or replaced.<p>
This does not change the state object on which the method is called.
@param updateFormatters a map of formatters to change, where the key is the structure id and the value is either the replacement or null if the map entry should be removed
@return the updated copy | [
"Creates",
"a",
"new",
"copy",
"of",
"this",
"state",
"in",
"which",
"some",
"entries",
"are",
"removed",
"or",
"replaced",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/formatters/CmsFormatterConfigurationCacheState.java#L90-L103 |
BioPAX/Paxtools | sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java | L3ToSBGNPDConverter.createComplexMember | private Glyph createComplexMember(PhysicalEntity pe, Glyph container) {
Glyph g = createGlyphBasics(pe, false);
container.getGlyph().add(g);
// A PhysicalEntity may appear in many complexes -- we identify the member using its complex
g.setId(g.getId() + "_" + ModelUtils.md5hex(container.getId()));
glyphMap.put(g.getId(), g);
Set<String> uris = new HashSet<String>();
uris.add(pe.getUri());
sbgn2BPMap.put(g.getId(), uris);
if("or".equalsIgnoreCase(g.getClazz())) {
buildGeneric(pe, g, container);
}
return g;
} | java | private Glyph createComplexMember(PhysicalEntity pe, Glyph container) {
Glyph g = createGlyphBasics(pe, false);
container.getGlyph().add(g);
// A PhysicalEntity may appear in many complexes -- we identify the member using its complex
g.setId(g.getId() + "_" + ModelUtils.md5hex(container.getId()));
glyphMap.put(g.getId(), g);
Set<String> uris = new HashSet<String>();
uris.add(pe.getUri());
sbgn2BPMap.put(g.getId(), uris);
if("or".equalsIgnoreCase(g.getClazz())) {
buildGeneric(pe, g, container);
}
return g;
} | [
"private",
"Glyph",
"createComplexMember",
"(",
"PhysicalEntity",
"pe",
",",
"Glyph",
"container",
")",
"{",
"Glyph",
"g",
"=",
"createGlyphBasics",
"(",
"pe",
",",
"false",
")",
";",
"container",
".",
"getGlyph",
"(",
")",
".",
"add",
"(",
"g",
")",
";"... | /*
Creates a glyph for the complex member.
@param pe PhysicalEntity to represent as complex member
@param container Glyph for the complex shell | [
"/",
"*",
"Creates",
"a",
"glyph",
"for",
"the",
"complex",
"member",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java#L650-L667 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/utilities/SQLUtility.java | SQLUtility.getDefaultConnection | public static Connection getDefaultConnection(ServerConfiguration serverConfig) {
ModuleConfiguration poolConfig =
serverConfig
.getModuleConfiguration("org.fcrepo.server.storage.ConnectionPoolManager");
String datastoreID =
poolConfig.getParameter("defaultPoolName",Parameter.class).getValue();
DatastoreConfiguration dbConfig =
serverConfig.getDatastoreConfiguration(datastoreID);
return getConnection(dbConfig.getParameter("jdbcDriverClass",Parameter.class)
.getValue(),
dbConfig.getParameter("jdbcURL",Parameter.class).getValue(),
dbConfig.getParameter("dbUsername",Parameter.class).getValue(),
dbConfig.getParameter("dbPassword",Parameter.class).getValue());
} | java | public static Connection getDefaultConnection(ServerConfiguration serverConfig) {
ModuleConfiguration poolConfig =
serverConfig
.getModuleConfiguration("org.fcrepo.server.storage.ConnectionPoolManager");
String datastoreID =
poolConfig.getParameter("defaultPoolName",Parameter.class).getValue();
DatastoreConfiguration dbConfig =
serverConfig.getDatastoreConfiguration(datastoreID);
return getConnection(dbConfig.getParameter("jdbcDriverClass",Parameter.class)
.getValue(),
dbConfig.getParameter("jdbcURL",Parameter.class).getValue(),
dbConfig.getParameter("dbUsername",Parameter.class).getValue(),
dbConfig.getParameter("dbPassword",Parameter.class).getValue());
} | [
"public",
"static",
"Connection",
"getDefaultConnection",
"(",
"ServerConfiguration",
"serverConfig",
")",
"{",
"ModuleConfiguration",
"poolConfig",
"=",
"serverConfig",
".",
"getModuleConfiguration",
"(",
"\"org.fcrepo.server.storage.ConnectionPoolManager\"",
")",
";",
"String... | Gets a connection to the database specified in connection pool module's
"defaultPoolName" config value. This allows us to the connect to the
database without the server running. | [
"Gets",
"a",
"connection",
"to",
"the",
"database",
"specified",
"in",
"connection",
"pool",
"module",
"s",
"defaultPoolName",
"config",
"value",
".",
"This",
"allows",
"us",
"to",
"the",
"connect",
"to",
"the",
"database",
"without",
"the",
"server",
"running... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/utilities/SQLUtility.java#L171-L184 |
mfornos/humanize | humanize-slim/src/main/java/humanize/Humanize.java | Humanize.metricPrefix | @Expose
public static String metricPrefix(final Number value, final Locale locale)
{
return withinLocale(new Callable<String>()
{
public String call() throws Exception
{
return metricPrefix(value);
}
}, locale);
} | java | @Expose
public static String metricPrefix(final Number value, final Locale locale)
{
return withinLocale(new Callable<String>()
{
public String call() throws Exception
{
return metricPrefix(value);
}
}, locale);
} | [
"@",
"Expose",
"public",
"static",
"String",
"metricPrefix",
"(",
"final",
"Number",
"value",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"withinLocale",
"(",
"new",
"Callable",
"<",
"String",
">",
"(",
")",
"{",
"public",
"String",
"call",
"(",
... | <p>
Same as {@link #metricPrefix(Number)} for the specified locale.
</p>
@param value
Number to be converted
@param locale
Target locale
@return The number preceded by the corresponding SI prefix | [
"<p",
">",
"Same",
"as",
"{",
"@link",
"#metricPrefix",
"(",
"Number",
")",
"}",
"for",
"the",
"specified",
"locale",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L1399-L1409 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java | JsApiMessageImpl.typeCheck | private final Object typeCheck(Object value, int type) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "typecheck: value = " + value + ", " + value.getClass() + " , type=" + type);
switch (type) {
/* No checking, just return the value */
case Selector.UNKNOWN:
return value;
/* STRING - simple! */
case Selector.STRING:
return (value instanceof String) ? value : null;
/* BOOLEAN - Boolean or BooleanValue are suitable */
case Selector.BOOLEAN:
return (value instanceof Boolean) ? value : null;
/* Any numeric - any Number or a NumericValue are suitable */
default:
return (value instanceof Number) ? value : null;
}
} | java | private final Object typeCheck(Object value, int type) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "typecheck: value = " + value + ", " + value.getClass() + " , type=" + type);
switch (type) {
/* No checking, just return the value */
case Selector.UNKNOWN:
return value;
/* STRING - simple! */
case Selector.STRING:
return (value instanceof String) ? value : null;
/* BOOLEAN - Boolean or BooleanValue are suitable */
case Selector.BOOLEAN:
return (value instanceof Boolean) ? value : null;
/* Any numeric - any Number or a NumericValue are suitable */
default:
return (value instanceof Number) ? value : null;
}
} | [
"private",
"final",
"Object",
"typeCheck",
"(",
"Object",
"value",
",",
"int",
"type",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",... | Check the type of the value obtained from the message.
The value is returned as is if it is of the correct
type, otherwise null is returned.
@param value The Object value retrieved from the message
@param type The expected SelectorType of the value.
@return Object Either the original Object value, or null if the type of
value was not correct. | [
"Check",
"the",
"type",
"of",
"the",
"value",
"obtained",
"from",
"the",
"message",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java#L723-L746 |
duracloud/duracloud | durastore/src/main/java/org/duracloud/durastore/rest/SpaceRest.java | SpaceRest.deleteSpace | @Path("/{spaceID}")
@DELETE
public Response deleteSpace(@PathParam("spaceID") String spaceID,
@QueryParam("storeID") String storeID) {
String msg = "deleting space(" + spaceID + ", " + storeID + ")";
try {
log.debug(msg);
return doDeleteSpace(spaceID, storeID);
} catch (ResourceNotFoundException e) {
return responseNotFound(msg, e, NOT_FOUND);
} catch (ResourceException e) {
return responseBad(msg, e, INTERNAL_SERVER_ERROR);
} catch (Exception e) {
return responseBad(msg, e, INTERNAL_SERVER_ERROR);
}
} | java | @Path("/{spaceID}")
@DELETE
public Response deleteSpace(@PathParam("spaceID") String spaceID,
@QueryParam("storeID") String storeID) {
String msg = "deleting space(" + spaceID + ", " + storeID + ")";
try {
log.debug(msg);
return doDeleteSpace(spaceID, storeID);
} catch (ResourceNotFoundException e) {
return responseNotFound(msg, e, NOT_FOUND);
} catch (ResourceException e) {
return responseBad(msg, e, INTERNAL_SERVER_ERROR);
} catch (Exception e) {
return responseBad(msg, e, INTERNAL_SERVER_ERROR);
}
} | [
"@",
"Path",
"(",
"\"/{spaceID}\"",
")",
"@",
"DELETE",
"public",
"Response",
"deleteSpace",
"(",
"@",
"PathParam",
"(",
"\"spaceID\"",
")",
"String",
"spaceID",
",",
"@",
"QueryParam",
"(",
"\"storeID\"",
")",
"String",
"storeID",
")",
"{",
"String",
"msg",... | see SpaceResource.deleteSpace(String, String);
@return 200 response indicating space deleted successfully | [
"see",
"SpaceResource",
".",
"deleteSpace",
"(",
"String",
"String",
")",
";"
] | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/durastore/src/main/java/org/duracloud/durastore/rest/SpaceRest.java#L323-L342 |
finnyb/javampd | src/main/java/org/bff/javampd/monitor/MPDPlaylistMonitor.java | MPDPlaylistMonitor.firePlaylistChangeEvent | public synchronized void firePlaylistChangeEvent(PlaylistBasicChangeEvent.Event event) {
PlaylistBasicChangeEvent pce = new PlaylistBasicChangeEvent(this, event);
for (PlaylistBasicChangeListener pcl : playlistListeners) {
pcl.playlistBasicChange(pce);
}
} | java | public synchronized void firePlaylistChangeEvent(PlaylistBasicChangeEvent.Event event) {
PlaylistBasicChangeEvent pce = new PlaylistBasicChangeEvent(this, event);
for (PlaylistBasicChangeListener pcl : playlistListeners) {
pcl.playlistBasicChange(pce);
}
} | [
"public",
"synchronized",
"void",
"firePlaylistChangeEvent",
"(",
"PlaylistBasicChangeEvent",
".",
"Event",
"event",
")",
"{",
"PlaylistBasicChangeEvent",
"pce",
"=",
"new",
"PlaylistBasicChangeEvent",
"(",
"this",
",",
"event",
")",
";",
"for",
"(",
"PlaylistBasicCha... | Sends the appropriate {@link org.bff.javampd.playlist.PlaylistChangeEvent} to all registered
{@link org.bff.javampd.playlist.PlaylistChangeListener}.
@param event the {@link org.bff.javampd.playlist.PlaylistBasicChangeEvent.Event} | [
"Sends",
"the",
"appropriate",
"{",
"@link",
"org",
".",
"bff",
".",
"javampd",
".",
"playlist",
".",
"PlaylistChangeEvent",
"}",
"to",
"all",
"registered",
"{",
"@link",
"org",
".",
"bff",
".",
"javampd",
".",
"playlist",
".",
"PlaylistChangeListener",
"}",... | train | https://github.com/finnyb/javampd/blob/186736e85fc238b4208cc9ee23373f9249376b4c/src/main/java/org/bff/javampd/monitor/MPDPlaylistMonitor.java#L61-L67 |
palatable/lambda | src/main/java/com/jnape/palatable/lambda/adt/Try.java | Try.catching | @SuppressWarnings("unchecked")
public final <S extends T> Try<T, A> catching(Class<S> throwableType, Function<? super S, ? extends A> recoveryFn) {
return catching(throwableType::isInstance, t -> recoveryFn.apply((S) t));
} | java | @SuppressWarnings("unchecked")
public final <S extends T> Try<T, A> catching(Class<S> throwableType, Function<? super S, ? extends A> recoveryFn) {
return catching(throwableType::isInstance, t -> recoveryFn.apply((S) t));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"final",
"<",
"S",
"extends",
"T",
">",
"Try",
"<",
"T",
",",
"A",
">",
"catching",
"(",
"Class",
"<",
"S",
">",
"throwableType",
",",
"Function",
"<",
"?",
"super",
"S",
",",
"?",
"extend... | Catch any instance of <code>throwableType</code> and map it to a success value.
@param throwableType the {@link Throwable} (sub)type to be caught
@param recoveryFn the function mapping the {@link Throwable} to the result
@param <S> the {@link Throwable} (sub)type
@return a new {@link Try} instance around either the original successful result or the mapped result | [
"Catch",
"any",
"instance",
"of",
"<code",
">",
"throwableType<",
"/",
"code",
">",
"and",
"map",
"it",
"to",
"a",
"success",
"value",
"."
] | train | https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/adt/Try.java#L45-L48 |
aaberg/sql2o | core/src/main/java/org/sql2o/Query.java | Query.addParameter | public Query addParameter(String name, final Collection<?> values) {
if(values == null) {
throw new NullPointerException("Array parameter cannot be null");
}
return addParameter(name, values.toArray());
} | java | public Query addParameter(String name, final Collection<?> values) {
if(values == null) {
throw new NullPointerException("Array parameter cannot be null");
}
return addParameter(name, values.toArray());
} | [
"public",
"Query",
"addParameter",
"(",
"String",
"name",
",",
"final",
"Collection",
"<",
"?",
">",
"values",
")",
"{",
"if",
"(",
"values",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Array parameter cannot be null\"",
")",
";",
... | Set an array parameter.<br>
See {@link #addParameter(String, Object...)} for details | [
"Set",
"an",
"array",
"parameter",
".",
"<br",
">",
"See",
"{"
] | train | https://github.com/aaberg/sql2o/blob/01d3490a6d2440cf60f973d23508ac4ed57a8e20/core/src/main/java/org/sql2o/Query.java#L374-L380 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java | Blacklist.addEntry | public void addEntry(String id, int score, RelType context)
{
this.score.put(id, score);
this.context.put(id, context);
} | java | public void addEntry(String id, int score, RelType context)
{
this.score.put(id, score);
this.context.put(id, context);
} | [
"public",
"void",
"addEntry",
"(",
"String",
"id",
",",
"int",
"score",
",",
"RelType",
"context",
")",
"{",
"this",
".",
"score",
".",
"put",
"(",
"id",
",",
"score",
")",
";",
"this",
".",
"context",
".",
"put",
"(",
"id",
",",
"context",
")",
... | Adds a new blacklisted ID.
@param id ID of the blacklisted molecule
@param score the ubiquity score
@param context context of ubiquity | [
"Adds",
"a",
"new",
"blacklisted",
"ID",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java#L114-L118 |
atomix/atomix | cluster/src/main/java/io/atomix/cluster/MemberConfig.java | MemberConfig.setProperty | public MemberConfig setProperty(String key, String value) {
this.properties.put(key, value);
return this;
} | java | public MemberConfig setProperty(String key, String value) {
this.properties.put(key, value);
return this;
} | [
"public",
"MemberConfig",
"setProperty",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"this",
".",
"properties",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Sets a member property.
@param key the property key to et
@param value the property value to et
@return the member configuration | [
"Sets",
"a",
"member",
"property",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/cluster/src/main/java/io/atomix/cluster/MemberConfig.java#L212-L215 |
protostuff/protostuff | protostuff-core/src/main/java/io/protostuff/CodedInput.java | CodedInput.readRawVarint32 | static int readRawVarint32(final DataInput input, final byte firstByte) throws IOException
{
int result = firstByte & 0x7f;
int offset = 7;
for (; offset < 32; offset += 7)
{
final byte b = input.readByte();
result |= (b & 0x7f) << offset;
if ((b & 0x80) == 0)
{
return result;
}
}
// Keep reading up to 64 bits.
for (; offset < 64; offset += 7)
{
final byte b = input.readByte();
if ((b & 0x80) == 0)
{
return result;
}
}
throw ProtobufException.malformedVarint();
} | java | static int readRawVarint32(final DataInput input, final byte firstByte) throws IOException
{
int result = firstByte & 0x7f;
int offset = 7;
for (; offset < 32; offset += 7)
{
final byte b = input.readByte();
result |= (b & 0x7f) << offset;
if ((b & 0x80) == 0)
{
return result;
}
}
// Keep reading up to 64 bits.
for (; offset < 64; offset += 7)
{
final byte b = input.readByte();
if ((b & 0x80) == 0)
{
return result;
}
}
throw ProtobufException.malformedVarint();
} | [
"static",
"int",
"readRawVarint32",
"(",
"final",
"DataInput",
"input",
",",
"final",
"byte",
"firstByte",
")",
"throws",
"IOException",
"{",
"int",
"result",
"=",
"firstByte",
"&",
"0x7f",
";",
"int",
"offset",
"=",
"7",
";",
"for",
"(",
";",
"offset",
... | Reads a varint from the input one byte at a time from a {@link DataInput}, so that it does not read any bytes
after the end of the varint. | [
"Reads",
"a",
"varint",
"from",
"the",
"input",
"one",
"byte",
"at",
"a",
"time",
"from",
"a",
"{"
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-core/src/main/java/io/protostuff/CodedInput.java#L586-L609 |
kubernetes-client/java | kubernetes/src/main/java/io/kubernetes/client/apis/BatchV1beta1Api.java | BatchV1beta1Api.deleteNamespacedCronJobAsync | public com.squareup.okhttp.Call deleteNamespacedCronJobAsync(String name, String namespace, String pretty, V1DeleteOptions body, String dryRun, Integer gracePeriodSeconds, Boolean orphanDependents, String propagationPolicy, final ApiCallback<V1Status> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = deleteNamespacedCronJobValidateBeforeCall(name, namespace, pretty, body, dryRun, gracePeriodSeconds, orphanDependents, propagationPolicy, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<V1Status>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | java | public com.squareup.okhttp.Call deleteNamespacedCronJobAsync(String name, String namespace, String pretty, V1DeleteOptions body, String dryRun, Integer gracePeriodSeconds, Boolean orphanDependents, String propagationPolicy, final ApiCallback<V1Status> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = deleteNamespacedCronJobValidateBeforeCall(name, namespace, pretty, body, dryRun, gracePeriodSeconds, orphanDependents, propagationPolicy, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<V1Status>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | [
"public",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"deleteNamespacedCronJobAsync",
"(",
"String",
"name",
",",
"String",
"namespace",
",",
"String",
"pretty",
",",
"V1DeleteOptions",
"body",
",",
"String",
"dryRun",
",",
"Integer",
"gracePeriodSeconds",... | (asynchronously)
delete a CronJob
@param name name of the CronJob (required)
@param namespace object name and auth scope, such as for teams and projects (required)
@param pretty If 'true', then the output is pretty printed. (optional)
@param body (optional)
@param dryRun When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed (optional)
@param gracePeriodSeconds The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. (optional)
@param orphanDependents Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. (optional)
@param propagationPolicy Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground. (optional)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object | [
"(",
"asynchronously",
")",
"delete",
"a",
"CronJob"
] | train | https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/kubernetes/src/main/java/io/kubernetes/client/apis/BatchV1beta1Api.java#L541-L566 |
sd4324530/fastweixin | src/main/java/com/github/sd4324530/fastweixin/servlet/QYWeixinControllerSupport.java | QYWeixinControllerSupport.process | @RequestMapping(method = RequestMethod.POST)
@ResponseBody
protected final String process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
// if(StrUtil.isBlank(legalStr(request))){
// return "";
// }
String result = processRequest(request);
response.getWriter().write(result);
return null;
} | java | @RequestMapping(method = RequestMethod.POST)
@ResponseBody
protected final String process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
// if(StrUtil.isBlank(legalStr(request))){
// return "";
// }
String result = processRequest(request);
response.getWriter().write(result);
return null;
} | [
"@",
"RequestMapping",
"(",
"method",
"=",
"RequestMethod",
".",
"POST",
")",
"@",
"ResponseBody",
"protected",
"final",
"String",
"process",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"ServletException",
",",
"IOExc... | 微信消息交互处理
@param request 请求
@param response 响应
@return 结果
@throws ServletException servlet异常
@throws IOException IO异常 | [
"微信消息交互处理"
] | train | https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/servlet/QYWeixinControllerSupport.java#L50-L59 |
PunchThrough/bean-sdk-android | sdk/src/main/java/com/punchthrough/bean/sdk/internal/utility/EnumParse.java | EnumParse.enumWithRawValue | public static <T extends Enum & ParsableEnum> T enumWithRawValue(Class<T> enumClass, byte value)
throws NoEnumFoundException {
return enumWithRawValue(enumClass, (int) value);
} | java | public static <T extends Enum & ParsableEnum> T enumWithRawValue(Class<T> enumClass, byte value)
throws NoEnumFoundException {
return enumWithRawValue(enumClass, (int) value);
} | [
"public",
"static",
"<",
"T",
"extends",
"Enum",
"&",
"ParsableEnum",
">",
"T",
"enumWithRawValue",
"(",
"Class",
"<",
"T",
">",
"enumClass",
",",
"byte",
"value",
")",
"throws",
"NoEnumFoundException",
"{",
"return",
"enumWithRawValue",
"(",
"enumClass",
",",... | Retrieve the enum of a given type from a given raw value. Enums must implement the
{@link com.punchthrough.bean.sdk.internal.utility.EnumParse.ParsableEnum} interface to ensure they have
a {@link com.punchthrough.bean.sdk.internal.utility.EnumParse.ParsableEnum#getRawValue()} method.
@param enumClass The class of the enum type being parsed, e.g. <code>BeanState.class</code>
@param value The raw byte value of the enum to be retrieved
@param <T> The enum type being parsed
@return The enum value with the given raw value
@throws com.punchthrough.bean.sdk.internal.exception.NoEnumFoundException if the given enum type has no enum value with a raw value
matching the given value | [
"Retrieve",
"the",
"enum",
"of",
"a",
"given",
"type",
"from",
"a",
"given",
"raw",
"value",
".",
"Enums",
"must",
"implement",
"the",
"{",
"@link",
"com",
".",
"punchthrough",
".",
"bean",
".",
"sdk",
".",
"internal",
".",
"utility",
".",
"EnumParse",
... | train | https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/utility/EnumParse.java#L63-L68 |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/io/IO.java | IO.mkdirs | private static void mkdirs(@Nonnull IResource resource, IProgressMonitor monitor) throws CoreException {
IContainer container = resource.getParent();
if (container.getType() == IResource.FOLDER && !container.exists()) {
if(!container.getParent().exists()) {
mkdirs(container, monitor);
}
((IFolder) container).create(true, true, monitor);
}
} | java | private static void mkdirs(@Nonnull IResource resource, IProgressMonitor monitor) throws CoreException {
IContainer container = resource.getParent();
if (container.getType() == IResource.FOLDER && !container.exists()) {
if(!container.getParent().exists()) {
mkdirs(container, monitor);
}
((IFolder) container).create(true, true, monitor);
}
} | [
"private",
"static",
"void",
"mkdirs",
"(",
"@",
"Nonnull",
"IResource",
"resource",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"IContainer",
"container",
"=",
"resource",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"container",
"... | Recursively creates all folders needed, up to the project. Project must
already exist.
@param resource
non null
@param monitor
non null
@throws CoreException | [
"Recursively",
"creates",
"all",
"folders",
"needed",
"up",
"to",
"the",
"project",
".",
"Project",
"must",
"already",
"exist",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/io/IO.java#L86-L94 |
jmxtrans/jmxtrans | jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/naming/JexlNamingStrategy.java | JexlNamingStrategy.populateContext | protected void populateContext(JexlContext context, Result result) {
context.set(VAR_CLASSNAME, result.getClassName());
context.set(VAR_ATTRIBUTE_NAME, result.getAttributeName());
context.set(VAR_CLASSNAME_ALIAS, result.getKeyAlias());
Map<String, String> typeNameMap = TypeNameValue.extractMap(result.getTypeName());
context.set(VAR_TYPENAME, typeNameMap);
String effectiveClassname = result.getKeyAlias();
if (effectiveClassname == null) {
effectiveClassname = result.getClassName();
}
context.set(VAR_EFFECTIVE_CLASSNAME, effectiveClassname);
context.set(VAR_RESULT, result);
} | java | protected void populateContext(JexlContext context, Result result) {
context.set(VAR_CLASSNAME, result.getClassName());
context.set(VAR_ATTRIBUTE_NAME, result.getAttributeName());
context.set(VAR_CLASSNAME_ALIAS, result.getKeyAlias());
Map<String, String> typeNameMap = TypeNameValue.extractMap(result.getTypeName());
context.set(VAR_TYPENAME, typeNameMap);
String effectiveClassname = result.getKeyAlias();
if (effectiveClassname == null) {
effectiveClassname = result.getClassName();
}
context.set(VAR_EFFECTIVE_CLASSNAME, effectiveClassname);
context.set(VAR_RESULT, result);
} | [
"protected",
"void",
"populateContext",
"(",
"JexlContext",
"context",
",",
"Result",
"result",
")",
"{",
"context",
".",
"set",
"(",
"VAR_CLASSNAME",
",",
"result",
".",
"getClassName",
"(",
")",
")",
";",
"context",
".",
"set",
"(",
"VAR_ATTRIBUTE_NAME",
"... | Populate the context with values from the result.
@param context - the expression context used when evaluating JEXL expressions.
@param result - the result of a JMX query. | [
"Populate",
"the",
"context",
"with",
"values",
"from",
"the",
"result",
"."
] | train | https://github.com/jmxtrans/jmxtrans/blob/496f342de3bcf2c2226626374b7a16edf8f4ba2a/jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/naming/JexlNamingStrategy.java#L126-L141 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java | DoubleArrayTrie.exactMatchSearch | public int exactMatchSearch(char[] keyChars, int pos, int len, int nodePos)
{
int result = -1;
int b = base[nodePos];
int p;
for (int i = pos; i < len; i++)
{
p = b + (int) (keyChars[i]) + 1;
if (b == check[p])
b = base[p];
else
return result;
}
p = b;
int n = base[p];
if (b == check[p] && n < 0)
{
result = -n - 1;
}
return result;
} | java | public int exactMatchSearch(char[] keyChars, int pos, int len, int nodePos)
{
int result = -1;
int b = base[nodePos];
int p;
for (int i = pos; i < len; i++)
{
p = b + (int) (keyChars[i]) + 1;
if (b == check[p])
b = base[p];
else
return result;
}
p = b;
int n = base[p];
if (b == check[p] && n < 0)
{
result = -n - 1;
}
return result;
} | [
"public",
"int",
"exactMatchSearch",
"(",
"char",
"[",
"]",
"keyChars",
",",
"int",
"pos",
",",
"int",
"len",
",",
"int",
"nodePos",
")",
"{",
"int",
"result",
"=",
"-",
"1",
";",
"int",
"b",
"=",
"base",
"[",
"nodePos",
"]",
";",
"int",
"p",
";"... | 精确查询
@param keyChars 键的char数组
@param pos char数组的起始位置
@param len 键的长度
@param nodePos 开始查找的位置(本参数允许从非根节点查询)
@return 查到的节点代表的value ID,负数表示不存在 | [
"精确查询"
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L746-L769 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_screen_serviceName_screenLists_id_GET | public OvhScreenList billingAccount_screen_serviceName_screenLists_id_GET(String billingAccount, String serviceName, Long id) throws IOException {
String qPath = "/telephony/{billingAccount}/screen/{serviceName}/screenLists/{id}";
StringBuilder sb = path(qPath, billingAccount, serviceName, id);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhScreenList.class);
} | java | public OvhScreenList billingAccount_screen_serviceName_screenLists_id_GET(String billingAccount, String serviceName, Long id) throws IOException {
String qPath = "/telephony/{billingAccount}/screen/{serviceName}/screenLists/{id}";
StringBuilder sb = path(qPath, billingAccount, serviceName, id);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhScreenList.class);
} | [
"public",
"OvhScreenList",
"billingAccount_screen_serviceName_screenLists_id_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"id",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/screen/{serviceName}/sc... | Get this object properties
REST: GET /telephony/{billingAccount}/screen/{serviceName}/screenLists/{id}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param id [required] Id of the object | [
"Get",
"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#L5386-L5391 |
cloudendpoints/endpoints-management-java | endpoints-control/src/main/java/com/google/api/control/aggregator/Signing.java | Signing.putLabels | public static Hasher putLabels(Hasher h, Map<String, String> labels) {
for (Map.Entry<String, String> labelsEntry : labels.entrySet()) {
h.putChar('\0');
h.putString(labelsEntry.getKey(), StandardCharsets.UTF_8);
h.putChar('\0');
h.putString(labelsEntry.getValue(), StandardCharsets.UTF_8);
}
return h;
} | java | public static Hasher putLabels(Hasher h, Map<String, String> labels) {
for (Map.Entry<String, String> labelsEntry : labels.entrySet()) {
h.putChar('\0');
h.putString(labelsEntry.getKey(), StandardCharsets.UTF_8);
h.putChar('\0');
h.putString(labelsEntry.getValue(), StandardCharsets.UTF_8);
}
return h;
} | [
"public",
"static",
"Hasher",
"putLabels",
"(",
"Hasher",
"h",
",",
"Map",
"<",
"String",
",",
"String",
">",
"labels",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"labelsEntry",
":",
"labels",
".",
"entrySet",
"(",
... | Updates {@code h} with the contents of {@code labels}.
{@code labels} can be any Map<String, String>, but intended to be used for the labels of
one of the model protobufs.
@param h a {@link Hasher}
@param labels some labels
@return the {@code Hasher}, to allow fluent-style usage | [
"Updates",
"{",
"@code",
"h",
"}",
"with",
"the",
"contents",
"of",
"{",
"@code",
"labels",
"}",
"."
] | train | https://github.com/cloudendpoints/endpoints-management-java/blob/5bbf20ddadbbd51b890049e3c338c28abe2c9f94/endpoints-control/src/main/java/com/google/api/control/aggregator/Signing.java#L40-L48 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/rest/DatastreamResource.java | DatastreamResource.listDatastreams | @GET
public Response listDatastreams(@PathParam(RestParam.PID) String pid,
@QueryParam(RestParam.AS_OF_DATE_TIME) String dateTime,
@QueryParam(RestParam.FORMAT) @DefaultValue(HTML) String format,
@QueryParam(RestParam.FLASH) @DefaultValue("false") boolean flash,
@QueryParam(RestParam.PROFILES) @DefaultValue("false") boolean profiles,
@QueryParam(RestParam.DS_STATE) String dsState,
@QueryParam(RestParam.VALIDATE_CHECKSUM) @DefaultValue("false") boolean validateChecksum
) {
try {
Date asOfDateTime = DateUtility.parseDateOrNull(dateTime);
Context context = getContext();
MediaType mime = RestHelper.getContentType(format);
Reader output;
if (profiles){
mime=MediaType.TEXT_XML_TYPE;
final Datastream[] datastreams = m_management.getDatastreams(context, pid, asOfDateTime, dsState);
ReadableCharArrayWriter xml = new ReadableCharArrayWriter(2048);
getSerializer(context).datastreamProfilesToXML(pid, datastreams, asOfDateTime, validateChecksum, xml);
xml.close();
output = xml.toReader();
} else {
mime = RestHelper.getContentType(format);
DatastreamDef[] dsDefs =
m_access.listDatastreams(context, pid, asOfDateTime);
ReadableCharArrayWriter xml = new ReadableCharArrayWriter(1024);
getSerializer(context).dataStreamsToXML(pid, asOfDateTime, dsDefs, xml);
xml.close();
if (TEXT_HTML.isCompatible(mime)) {
Reader reader = xml.toReader();
xml = new ReadableCharArrayWriter(1024);
transform(reader, "access/listDatastreams.xslt", xml);
xml.close();
}
output = xml.toReader();
}
return Response.ok(output, mime).build();
} catch (Exception ex) {
return handleException(ex, flash);
}
} | java | @GET
public Response listDatastreams(@PathParam(RestParam.PID) String pid,
@QueryParam(RestParam.AS_OF_DATE_TIME) String dateTime,
@QueryParam(RestParam.FORMAT) @DefaultValue(HTML) String format,
@QueryParam(RestParam.FLASH) @DefaultValue("false") boolean flash,
@QueryParam(RestParam.PROFILES) @DefaultValue("false") boolean profiles,
@QueryParam(RestParam.DS_STATE) String dsState,
@QueryParam(RestParam.VALIDATE_CHECKSUM) @DefaultValue("false") boolean validateChecksum
) {
try {
Date asOfDateTime = DateUtility.parseDateOrNull(dateTime);
Context context = getContext();
MediaType mime = RestHelper.getContentType(format);
Reader output;
if (profiles){
mime=MediaType.TEXT_XML_TYPE;
final Datastream[] datastreams = m_management.getDatastreams(context, pid, asOfDateTime, dsState);
ReadableCharArrayWriter xml = new ReadableCharArrayWriter(2048);
getSerializer(context).datastreamProfilesToXML(pid, datastreams, asOfDateTime, validateChecksum, xml);
xml.close();
output = xml.toReader();
} else {
mime = RestHelper.getContentType(format);
DatastreamDef[] dsDefs =
m_access.listDatastreams(context, pid, asOfDateTime);
ReadableCharArrayWriter xml = new ReadableCharArrayWriter(1024);
getSerializer(context).dataStreamsToXML(pid, asOfDateTime, dsDefs, xml);
xml.close();
if (TEXT_HTML.isCompatible(mime)) {
Reader reader = xml.toReader();
xml = new ReadableCharArrayWriter(1024);
transform(reader, "access/listDatastreams.xslt", xml);
xml.close();
}
output = xml.toReader();
}
return Response.ok(output, mime).build();
} catch (Exception ex) {
return handleException(ex, flash);
}
} | [
"@",
"GET",
"public",
"Response",
"listDatastreams",
"(",
"@",
"PathParam",
"(",
"RestParam",
".",
"PID",
")",
"String",
"pid",
",",
"@",
"QueryParam",
"(",
"RestParam",
".",
"AS_OF_DATE_TIME",
")",
"String",
"dateTime",
",",
"@",
"QueryParam",
"(",
"RestPar... | <p>Inquires upon all object Datastreams to obtain datastreams contained by a
digital object. This returns a set of datastream locations that represent
all possible datastreams available in the object.
</p><p>
GET /objects/{pid}/datastreams ? asOfDateTime format</p>
@param pid
@param dateTime
@param format | [
"<p",
">",
"Inquires",
"upon",
"all",
"object",
"Datastreams",
"to",
"obtain",
"datastreams",
"contained",
"by",
"a",
"digital",
"object",
".",
"This",
"returns",
"a",
"set",
"of",
"datastream",
"locations",
"that",
"represent",
"all",
"possible",
"datastreams",... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/rest/DatastreamResource.java#L89-L133 |
Netflix/Hystrix | hystrix-core/src/main/java/com/netflix/hystrix/strategy/executionhook/HystrixCommandExecutionHook.java | HystrixCommandExecutionHook.onRunError | @Deprecated
public <T> Exception onRunError(HystrixInvokable<T> commandInstance, Exception e) {
// pass-thru by default
return e;
} | java | @Deprecated
public <T> Exception onRunError(HystrixInvokable<T> commandInstance, Exception e) {
// pass-thru by default
return e;
} | [
"@",
"Deprecated",
"public",
"<",
"T",
">",
"Exception",
"onRunError",
"(",
"HystrixInvokable",
"<",
"T",
">",
"commandInstance",
",",
"Exception",
"e",
")",
"{",
"// pass-thru by default",
"return",
"e",
";",
"}"
] | DEPRECATED: Change usages of this to {@link #onExecutionError}
Invoked after failed execution of {@link HystrixCommand#run()} with thrown Exception.
@param commandInstance
The executing HystrixCommand instance.
@param e
Exception thrown by {@link HystrixCommand#run()}
@return Exception that can be decorated, replaced or just returned as a pass-thru.
@since 1.2 | [
"DEPRECATED",
":",
"Change",
"usages",
"of",
"this",
"to",
"{",
"@link",
"#onExecutionError",
"}"
] | train | https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/strategy/executionhook/HystrixCommandExecutionHook.java#L336-L340 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.debugf | public void debugf(String format, Object... params) {
doLogf(Level.DEBUG, FQCN, format, params, null);
} | java | public void debugf(String format, Object... params) {
doLogf(Level.DEBUG, FQCN, format, params, null);
} | [
"public",
"void",
"debugf",
"(",
"String",
"format",
",",
"Object",
"...",
"params",
")",
"{",
"doLogf",
"(",
"Level",
".",
"DEBUG",
",",
"FQCN",
",",
"format",
",",
"params",
",",
"null",
")",
";",
"}"
] | Issue a formatted log message with a level of DEBUG.
@param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
@param params the parameters | [
"Issue",
"a",
"formatted",
"log",
"message",
"with",
"a",
"level",
"of",
"DEBUG",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L700-L702 |
samskivert/samskivert | src/main/java/com/samskivert/util/StringUtil.java | StringUtil.getOr | public static String getOr (String value, String defval)
{
return isBlank(value) ? defval : value;
} | java | public static String getOr (String value, String defval)
{
return isBlank(value) ? defval : value;
} | [
"public",
"static",
"String",
"getOr",
"(",
"String",
"value",
",",
"String",
"defval",
")",
"{",
"return",
"isBlank",
"(",
"value",
")",
"?",
"defval",
":",
"value",
";",
"}"
] | Returns the string if it is non-blank (see {@link #isBlank}), the default value otherwise. | [
"Returns",
"the",
"string",
"if",
"it",
"is",
"non",
"-",
"blank",
"(",
"see",
"{"
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/StringUtil.java#L113-L116 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java | ItemsSketch.getInstance | public static <T> ItemsSketch<T> getInstance(final Comparator<? super T> comparator) {
return getInstance(PreambleUtil.DEFAULT_K, comparator);
} | java | public static <T> ItemsSketch<T> getInstance(final Comparator<? super T> comparator) {
return getInstance(PreambleUtil.DEFAULT_K, comparator);
} | [
"public",
"static",
"<",
"T",
">",
"ItemsSketch",
"<",
"T",
">",
"getInstance",
"(",
"final",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comparator",
")",
"{",
"return",
"getInstance",
"(",
"PreambleUtil",
".",
"DEFAULT_K",
",",
"comparator",
")",
";",
... | Obtains a new instance of an ItemsSketch using the DEFAULT_K.
@param <T> type of item
@param comparator to compare items
@return a GenericQuantileSketch | [
"Obtains",
"a",
"new",
"instance",
"of",
"an",
"ItemsSketch",
"using",
"the",
"DEFAULT_K",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L125-L127 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/inline/InlineRendition.java | InlineRendition.buildMediaUrl | private String buildMediaUrl(Dimension scaledDimension) {
// check for file extension filtering
if (!isMatchingFileExtension()) {
return null;
}
// check if image has to be rescaled
if (scaledDimension != null) {
// check if scaling is not possible
if (scaledDimension.equals(SCALING_NOT_POSSIBLE_DIMENSION)) {
return null;
}
// otherwise generate scaled image URL
return buildScaledMediaUrl(scaledDimension, this.media.getCropDimension());
}
// if no scaling but cropping required builid scaled image URL
if (this.media.getCropDimension() != null) {
return buildScaledMediaUrl(this.media.getCropDimension(), this.media.getCropDimension());
}
if (mediaArgs.isContentDispositionAttachment()) {
// if not scaling and no cropping required but special content disposition headers required build download url
return buildDownloadMediaUrl();
}
else {
// if not scaling and no cropping required build native media URL
return buildNativeMediaUrl();
}
} | java | private String buildMediaUrl(Dimension scaledDimension) {
// check for file extension filtering
if (!isMatchingFileExtension()) {
return null;
}
// check if image has to be rescaled
if (scaledDimension != null) {
// check if scaling is not possible
if (scaledDimension.equals(SCALING_NOT_POSSIBLE_DIMENSION)) {
return null;
}
// otherwise generate scaled image URL
return buildScaledMediaUrl(scaledDimension, this.media.getCropDimension());
}
// if no scaling but cropping required builid scaled image URL
if (this.media.getCropDimension() != null) {
return buildScaledMediaUrl(this.media.getCropDimension(), this.media.getCropDimension());
}
if (mediaArgs.isContentDispositionAttachment()) {
// if not scaling and no cropping required but special content disposition headers required build download url
return buildDownloadMediaUrl();
}
else {
// if not scaling and no cropping required build native media URL
return buildNativeMediaUrl();
}
} | [
"private",
"String",
"buildMediaUrl",
"(",
"Dimension",
"scaledDimension",
")",
"{",
"// check for file extension filtering",
"if",
"(",
"!",
"isMatchingFileExtension",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"// check if image has to be rescaled",
"if",
"(",
... | Build media URL for this rendition - either "native" URL to repository or virtual url to rescaled version.
@return Media URL - null if no rendition is available | [
"Build",
"media",
"URL",
"for",
"this",
"rendition",
"-",
"either",
"native",
"URL",
"to",
"repository",
"or",
"virtual",
"url",
"to",
"rescaled",
"version",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/inline/InlineRendition.java#L193-L225 |
samskivert/pythagoras | src/main/java/pythagoras/f/Box.java | Box.intersectionZ | protected float intersectionZ (IRay3 ray, float z) {
IVector3 origin = ray.origin(), dir = ray.direction();
float t = (z - origin.z()) / dir.z();
if (t < 0f) {
return Float.MAX_VALUE;
}
float ix = origin.x() + t*dir.x(), iy = origin.y() + t*dir.y();
return (ix >= _minExtent.x && ix <= _maxExtent.x &&
iy >= _minExtent.y && iy <= _maxExtent.y) ? t : Float.MAX_VALUE;
} | java | protected float intersectionZ (IRay3 ray, float z) {
IVector3 origin = ray.origin(), dir = ray.direction();
float t = (z - origin.z()) / dir.z();
if (t < 0f) {
return Float.MAX_VALUE;
}
float ix = origin.x() + t*dir.x(), iy = origin.y() + t*dir.y();
return (ix >= _minExtent.x && ix <= _maxExtent.x &&
iy >= _minExtent.y && iy <= _maxExtent.y) ? t : Float.MAX_VALUE;
} | [
"protected",
"float",
"intersectionZ",
"(",
"IRay3",
"ray",
",",
"float",
"z",
")",
"{",
"IVector3",
"origin",
"=",
"ray",
".",
"origin",
"(",
")",
",",
"dir",
"=",
"ray",
".",
"direction",
"(",
")",
";",
"float",
"t",
"=",
"(",
"z",
"-",
"origin",... | Helper method for {@link #intersection}. Finds the <code>t</code> value where the ray
intersects the box at the plane where z equals the value specified, or returns
{@link Float#MAX_VALUE} if there is no such intersection. | [
"Helper",
"method",
"for",
"{"
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Box.java#L512-L521 |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.getObjectTitle | public String getObjectTitle(final Graph graph, final Node sub) {
if (sub == null) {
return "";
}
final Optional<String> title = TITLE_PROPERTIES.stream().map(Property::asNode).flatMap(p -> listObjects(
graph, sub, p).toList().stream()).filter(Node::isLiteral).map(Node::getLiteral).map(
LiteralLabel::toString).findFirst();
return title.orElse(sub.isURI() ? sub.getURI() : sub.isBlank() ? sub.getBlankNodeLabel() : sub.toString());
} | java | public String getObjectTitle(final Graph graph, final Node sub) {
if (sub == null) {
return "";
}
final Optional<String> title = TITLE_PROPERTIES.stream().map(Property::asNode).flatMap(p -> listObjects(
graph, sub, p).toList().stream()).filter(Node::isLiteral).map(Node::getLiteral).map(
LiteralLabel::toString).findFirst();
return title.orElse(sub.isURI() ? sub.getURI() : sub.isBlank() ? sub.getBlankNodeLabel() : sub.toString());
} | [
"public",
"String",
"getObjectTitle",
"(",
"final",
"Graph",
"graph",
",",
"final",
"Node",
"sub",
")",
"{",
"if",
"(",
"sub",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"final",
"Optional",
"<",
"String",
">",
"title",
"=",
"TITLE_PROPERTIES",
... | Get the canonical title of a subject from the graph
@param graph the graph
@param sub the subject
@return canonical title of the subject in the graph | [
"Get",
"the",
"canonical",
"title",
"of",
"a",
"subject",
"from",
"the",
"graph"
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L184-L192 |
tomakehurst/wiremock | src/main/java/com/github/tomakehurst/wiremock/extension/responsetemplating/helpers/HandlebarsHelper.java | HandlebarsHelper.handleError | protected String handleError(final String message, final Throwable cause) {
notifier().error(formatMessage(message), cause);
return formatMessage(message);
} | java | protected String handleError(final String message, final Throwable cause) {
notifier().error(formatMessage(message), cause);
return formatMessage(message);
} | [
"protected",
"String",
"handleError",
"(",
"final",
"String",
"message",
",",
"final",
"Throwable",
"cause",
")",
"{",
"notifier",
"(",
")",
".",
"error",
"(",
"formatMessage",
"(",
"message",
")",
",",
"cause",
")",
";",
"return",
"formatMessage",
"(",
"m... | Handle invalid helper data with exception details in the log message.
@param message message to log and return
@param cause which occurred during application of the helper
@return a message which will be used as content | [
"Handle",
"invalid",
"helper",
"data",
"with",
"exception",
"details",
"in",
"the",
"log",
"message",
"."
] | train | https://github.com/tomakehurst/wiremock/blob/9d9d73463a82184ec129d620f21133ee7d52f632/src/main/java/com/github/tomakehurst/wiremock/extension/responsetemplating/helpers/HandlebarsHelper.java#L51-L54 |
nostra13/Android-Universal-Image-Loader | library/src/main/java/com/nostra13/universalimageloader/utils/StorageUtils.java | StorageUtils.getIndividualCacheDirectory | public static File getIndividualCacheDirectory(Context context, String cacheDir) {
File appCacheDir = getCacheDirectory(context);
File individualCacheDir = new File(appCacheDir, cacheDir);
if (!individualCacheDir.exists()) {
if (!individualCacheDir.mkdir()) {
individualCacheDir = appCacheDir;
}
}
return individualCacheDir;
} | java | public static File getIndividualCacheDirectory(Context context, String cacheDir) {
File appCacheDir = getCacheDirectory(context);
File individualCacheDir = new File(appCacheDir, cacheDir);
if (!individualCacheDir.exists()) {
if (!individualCacheDir.mkdir()) {
individualCacheDir = appCacheDir;
}
}
return individualCacheDir;
} | [
"public",
"static",
"File",
"getIndividualCacheDirectory",
"(",
"Context",
"context",
",",
"String",
"cacheDir",
")",
"{",
"File",
"appCacheDir",
"=",
"getCacheDirectory",
"(",
"context",
")",
";",
"File",
"individualCacheDir",
"=",
"new",
"File",
"(",
"appCacheDi... | Returns individual application cache directory (for only image caching from ImageLoader). Cache directory will be
created on SD card <i>("/Android/data/[app_package_name]/cache/uil-images")</i> if card is mounted and app has
appropriate permission. Else - Android defines cache directory on device's file system.
@param context Application context
@param cacheDir Cache directory path (e.g.: "AppCacheDir", "AppDir/cache/images")
@return Cache {@link File directory} | [
"Returns",
"individual",
"application",
"cache",
"directory",
"(",
"for",
"only",
"image",
"caching",
"from",
"ImageLoader",
")",
".",
"Cache",
"directory",
"will",
"be",
"created",
"on",
"SD",
"card",
"<i",
">",
"(",
"/",
"Android",
"/",
"data",
"/",
"[",... | train | https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/utils/StorageUtils.java#L111-L120 |
elibom/jogger | src/main/java/com/elibom/jogger/http/servlet/multipart/ParameterParser.java | ParameterParser.getToken | private String getToken(boolean quoted) {
// Trim leading white spaces
while ((i1 < i2) && (Character.isWhitespace(chars[i1]))) {
i1++;
}
// Trim trailing white spaces
while ((i2 > i1) && (Character.isWhitespace(chars[i2 - 1]))) {
i2--;
}
// Strip away quotation marks if necessary
if (quoted) {
if (((i2 - i1) >= 2) && (chars[i1] == '"') && (chars[i2 - 1] == '"')) {
i1++;
i2--;
}
}
String result = null;
if (i2 > i1) {
result = new String(chars, i1, i2 - i1);
}
return result;
} | java | private String getToken(boolean quoted) {
// Trim leading white spaces
while ((i1 < i2) && (Character.isWhitespace(chars[i1]))) {
i1++;
}
// Trim trailing white spaces
while ((i2 > i1) && (Character.isWhitespace(chars[i2 - 1]))) {
i2--;
}
// Strip away quotation marks if necessary
if (quoted) {
if (((i2 - i1) >= 2) && (chars[i1] == '"') && (chars[i2 - 1] == '"')) {
i1++;
i2--;
}
}
String result = null;
if (i2 > i1) {
result = new String(chars, i1, i2 - i1);
}
return result;
} | [
"private",
"String",
"getToken",
"(",
"boolean",
"quoted",
")",
"{",
"// Trim leading white spaces",
"while",
"(",
"(",
"i1",
"<",
"i2",
")",
"&&",
"(",
"Character",
".",
"isWhitespace",
"(",
"chars",
"[",
"i1",
"]",
")",
")",
")",
"{",
"i1",
"++",
";"... | A helper method to process the parsed token. This method removes leading and trailing blanks as well as enclosing
quotation marks, when necessary.
@param quoted <tt>true</tt> if quotation marks are expected, <tt>false</tt> otherwise.
@return the token | [
"A",
"helper",
"method",
"to",
"process",
"the",
"parsed",
"token",
".",
"This",
"method",
"removes",
"leading",
"and",
"trailing",
"blanks",
"as",
"well",
"as",
"enclosing",
"quotation",
"marks",
"when",
"necessary",
"."
] | train | https://github.com/elibom/jogger/blob/d5892ff45e76328d444a68b5a38c26e7bdd0692b/src/main/java/com/elibom/jogger/http/servlet/multipart/ParameterParser.java#L84-L105 |
sdl/Testy | src/main/java/com/sdl/selenium/WebLocatorSuggestions.java | WebLocatorSuggestions.proposeSolutions | private static void proposeSolutions(String[] dataSet, int k, int startPosition, String[] result, WebLocator webLocator) throws SolutionFoundException {
if (k == 0) {
validateSolution(webLocator, differences(dataSet, result));
return;
}
for (int i = startPosition; i <= dataSet.length - k; i++) {
result[result.length - k] = dataSet[i];
proposeSolutions(dataSet, k - 1, i + 1, result, webLocator);
}
} | java | private static void proposeSolutions(String[] dataSet, int k, int startPosition, String[] result, WebLocator webLocator) throws SolutionFoundException {
if (k == 0) {
validateSolution(webLocator, differences(dataSet, result));
return;
}
for (int i = startPosition; i <= dataSet.length - k; i++) {
result[result.length - k] = dataSet[i];
proposeSolutions(dataSet, k - 1, i + 1, result, webLocator);
}
} | [
"private",
"static",
"void",
"proposeSolutions",
"(",
"String",
"[",
"]",
"dataSet",
",",
"int",
"k",
",",
"int",
"startPosition",
",",
"String",
"[",
"]",
"result",
",",
"WebLocator",
"webLocator",
")",
"throws",
"SolutionFoundException",
"{",
"if",
"(",
"k... | Generates combinations of all objects from the dataSet taken k at a time.
Each combination is a possible solution that must be validated. | [
"Generates",
"combinations",
"of",
"all",
"objects",
"from",
"the",
"dataSet",
"taken",
"k",
"at",
"a",
"time",
".",
"Each",
"combination",
"is",
"a",
"possible",
"solution",
"that",
"must",
"be",
"validated",
"."
] | train | https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/WebLocatorSuggestions.java#L357-L368 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java | CassandraDataHandlerBase.setFieldValue | private void setFieldValue(Object entity, Object thriftColumnValue, Attribute attribute)
{
if (attribute != null)
{
try
{
if (thriftColumnValue.getClass().isAssignableFrom(String.class))
{
PropertyAccessorHelper.set(entity, (Field) attribute.getJavaMember(), (String) thriftColumnValue);
}
else if (CassandraDataTranslator.isCassandraDataTypeClass(((AbstractAttribute) attribute)
.getBindableJavaType()))
{
Object decomposed = null;
try
{
Class<?> clazz = ((AbstractAttribute) attribute).getBindableJavaType();
decomposed = CassandraDataTranslator.decompose(clazz, thriftColumnValue, false);
}
catch (Exception e)
{
String tableName = entity.getClass().getSimpleName();
String fieldName = attribute.getName();
String msg = "Decomposing failed for `" + tableName + "`.`" + fieldName
+ "`, did you set the correct type in your entity class?";
log.error(msg, e);
throw new KunderaException(msg, e);
}
PropertyAccessorHelper.set(entity, (Field) attribute.getJavaMember(), decomposed);
}
else
{
PropertyAccessorHelper.set(entity, (Field) attribute.getJavaMember(), (byte[]) thriftColumnValue);
}
}
catch (PropertyAccessException pae)
{
log.warn("Error while setting field value, Caused by: .", pae);
}
}
} | java | private void setFieldValue(Object entity, Object thriftColumnValue, Attribute attribute)
{
if (attribute != null)
{
try
{
if (thriftColumnValue.getClass().isAssignableFrom(String.class))
{
PropertyAccessorHelper.set(entity, (Field) attribute.getJavaMember(), (String) thriftColumnValue);
}
else if (CassandraDataTranslator.isCassandraDataTypeClass(((AbstractAttribute) attribute)
.getBindableJavaType()))
{
Object decomposed = null;
try
{
Class<?> clazz = ((AbstractAttribute) attribute).getBindableJavaType();
decomposed = CassandraDataTranslator.decompose(clazz, thriftColumnValue, false);
}
catch (Exception e)
{
String tableName = entity.getClass().getSimpleName();
String fieldName = attribute.getName();
String msg = "Decomposing failed for `" + tableName + "`.`" + fieldName
+ "`, did you set the correct type in your entity class?";
log.error(msg, e);
throw new KunderaException(msg, e);
}
PropertyAccessorHelper.set(entity, (Field) attribute.getJavaMember(), decomposed);
}
else
{
PropertyAccessorHelper.set(entity, (Field) attribute.getJavaMember(), (byte[]) thriftColumnValue);
}
}
catch (PropertyAccessException pae)
{
log.warn("Error while setting field value, Caused by: .", pae);
}
}
} | [
"private",
"void",
"setFieldValue",
"(",
"Object",
"entity",
",",
"Object",
"thriftColumnValue",
",",
"Attribute",
"attribute",
")",
"{",
"if",
"(",
"attribute",
"!=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"thriftColumnValue",
".",
"getClass",
"(",
")",
... | Sets the field value.
@param entity
the entity
@param thriftColumnValue
the thrift column value
@param attribute
the attribute | [
"Sets",
"the",
"field",
"value",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java#L1507-L1548 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/BeanPath.java | BeanPath.createEnum | protected <A extends Enum<A>> EnumPath<A> createEnum(String property, Class<A> type) {
return add(new EnumPath<A>(type, forProperty(property)));
} | java | protected <A extends Enum<A>> EnumPath<A> createEnum(String property, Class<A> type) {
return add(new EnumPath<A>(type, forProperty(property)));
} | [
"protected",
"<",
"A",
"extends",
"Enum",
"<",
"A",
">",
">",
"EnumPath",
"<",
"A",
">",
"createEnum",
"(",
"String",
"property",
",",
"Class",
"<",
"A",
">",
"type",
")",
"{",
"return",
"add",
"(",
"new",
"EnumPath",
"<",
"A",
">",
"(",
"type",
... | Create a new Enum path
@param <A>
@param property property name
@param type property type
@return property path | [
"Create",
"a",
"new",
"Enum",
"path"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/BeanPath.java#L175-L177 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/ComparatorCompat.java | ComparatorCompat.nullsFirst | @NotNull
public static <T> ComparatorCompat<T> nullsFirst(@Nullable Comparator<? super T> comparator) {
return nullsComparator(true, comparator);
} | java | @NotNull
public static <T> ComparatorCompat<T> nullsFirst(@Nullable Comparator<? super T> comparator) {
return nullsComparator(true, comparator);
} | [
"@",
"NotNull",
"public",
"static",
"<",
"T",
">",
"ComparatorCompat",
"<",
"T",
">",
"nullsFirst",
"(",
"@",
"Nullable",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comparator",
")",
"{",
"return",
"nullsComparator",
"(",
"true",
",",
"comparator",
")",
... | Returns a comparator that considers {@code null} to be less than non-null.
If the specified comparator is {@code null}, then the returned
comparator considers all non-null values to be equal.
@param <T> the type of the objects compared by the comparator
@param comparator a comparator for comparing non-null values
@return a comparator | [
"Returns",
"a",
"comparator",
"that",
"considers",
"{",
"@code",
"null",
"}",
"to",
"be",
"less",
"than",
"non",
"-",
"null",
".",
"If",
"the",
"specified",
"comparator",
"is",
"{",
"@code",
"null",
"}",
"then",
"the",
"returned",
"comparator",
"considers"... | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/ComparatorCompat.java#L246-L249 |
google/error-prone-javac | src/jdk.jshell/share/classes/jdk/jshell/execution/JdiExecutionControl.java | JdiExecutionControl.referenceType | protected ReferenceType referenceType(VirtualMachine vm, String name) {
return toReferenceType.computeIfAbsent(name, n -> nameToRef(vm, n));
} | java | protected ReferenceType referenceType(VirtualMachine vm, String name) {
return toReferenceType.computeIfAbsent(name, n -> nameToRef(vm, n));
} | [
"protected",
"ReferenceType",
"referenceType",
"(",
"VirtualMachine",
"vm",
",",
"String",
"name",
")",
"{",
"return",
"toReferenceType",
".",
"computeIfAbsent",
"(",
"name",
",",
"n",
"->",
"nameToRef",
"(",
"vm",
",",
"n",
")",
")",
";",
"}"
] | Returns the JDI {@link ReferenceType} corresponding to the specified
class name.
@param vm the current JDI {@link VirtualMachine} as returned by
{@code vm()}
@param name the class name to look-up
@return the corresponding {@link ReferenceType} | [
"Returns",
"the",
"JDI",
"{",
"@link",
"ReferenceType",
"}",
"corresponding",
"to",
"the",
"specified",
"class",
"name",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiExecutionControl.java#L113-L115 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java | CheckpointListener.loadCheckpointCG | public static ComputationGraph loadCheckpointCG(File rootDir, Checkpoint checkpoint){
return loadCheckpointCG(rootDir, checkpoint.getCheckpointNum());
} | java | public static ComputationGraph loadCheckpointCG(File rootDir, Checkpoint checkpoint){
return loadCheckpointCG(rootDir, checkpoint.getCheckpointNum());
} | [
"public",
"static",
"ComputationGraph",
"loadCheckpointCG",
"(",
"File",
"rootDir",
",",
"Checkpoint",
"checkpoint",
")",
"{",
"return",
"loadCheckpointCG",
"(",
"rootDir",
",",
"checkpoint",
".",
"getCheckpointNum",
"(",
")",
")",
";",
"}"
] | Load a ComputationGraph for the given checkpoint from the specified root direcotry
@param checkpoint Checkpoint model to load
@return The loaded model | [
"Load",
"a",
"ComputationGraph",
"for",
"the",
"given",
"checkpoint",
"from",
"the",
"specified",
"root",
"direcotry"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java#L500-L502 |
aol/cyclops | cyclops/src/main/java/cyclops/companion/Streams.java | Streams.startsWith | public final static <T> boolean startsWith(final Stream<T> stream, final Iterator<T> iterator) {
final Iterator<T> it = stream.iterator();
while (iterator.hasNext()) {
if (!it.hasNext())
return false;
if (!Objects.equals(it.next(), iterator.next()))
return false;
}
return true;
} | java | public final static <T> boolean startsWith(final Stream<T> stream, final Iterator<T> iterator) {
final Iterator<T> it = stream.iterator();
while (iterator.hasNext()) {
if (!it.hasNext())
return false;
if (!Objects.equals(it.next(), iterator.next()))
return false;
}
return true;
} | [
"public",
"final",
"static",
"<",
"T",
">",
"boolean",
"startsWith",
"(",
"final",
"Stream",
"<",
"T",
">",
"stream",
",",
"final",
"Iterator",
"<",
"T",
">",
"iterator",
")",
"{",
"final",
"Iterator",
"<",
"T",
">",
"it",
"=",
"stream",
".",
"iterat... | <pre>
{@code
assertTrue(Streams.startsWith(Stream.of(1,2,3,4),Arrays.asList(1,2,3).iterator()))
}</pre>
@param iterator
@return True if Monad starts with Iterators sequence of data | [
"<pre",
">",
"{",
"@code",
"assertTrue",
"(",
"Streams",
".",
"startsWith",
"(",
"Stream",
".",
"of",
"(",
"1",
"2",
"3",
"4",
")",
"Arrays",
".",
"asList",
"(",
"1",
"2",
"3",
")",
".",
"iterator",
"()",
"))",
"}",
"<",
"/",
"pre",
">"
] | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L2074-L2084 |
threerings/playn | core/src/playn/core/AbstractPlatform.java | AbstractPlatform.notifyFailure | public void notifyFailure(final Callback<?> callback, final Throwable error) {
invokeLater(new Runnable() {
public void run() {
callback.onFailure(error);
}
});
} | java | public void notifyFailure(final Callback<?> callback, final Throwable error) {
invokeLater(new Runnable() {
public void run() {
callback.onFailure(error);
}
});
} | [
"public",
"void",
"notifyFailure",
"(",
"final",
"Callback",
"<",
"?",
">",
"callback",
",",
"final",
"Throwable",
"error",
")",
"{",
"invokeLater",
"(",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"callback",
".",
"onFailur... | Delivers {@code error} to {@code callback} on the next game tick (on the PlayN thread). | [
"Delivers",
"{"
] | train | https://github.com/threerings/playn/blob/c266eeb39188dcada4b00992a0d1199759e03d42/core/src/playn/core/AbstractPlatform.java#L77-L83 |
anotheria/moskito | moskito-webui/src/main/java/net/anotheria/moskito/webui/shared/action/BaseMoskitoUIAction.java | BaseMoskitoUIAction.getCurrentUnit | protected UnitBean getCurrentUnit(HttpServletRequest req, boolean saveToSession){
String unitParameter = req.getParameter(PARAM_UNIT);
if (unitParameter==null){
UnitBean ret = (UnitBean)req.getSession().getAttribute(BEAN_UNIT);
if (ret==null){
ret = DEFAULT_UNIT_BEAN;
//ensure a unit bean is always in the session.
req.getSession().setAttribute(BEAN_UNIT, ret);
}
return ret;
}
int index = -1;
for (int i = 0; i<AVAILABLE_UNITS_LIST.size(); i++){
if (AVAILABLE_UNITS_LIST.get(i).getUnitName().equalsIgnoreCase(unitParameter)){
index = i;
break;
}
}
UnitBean ret = index == -1 ? DEFAULT_UNIT_BEAN : AVAILABLE_UNITS[index];
if (saveToSession)
req.getSession().setAttribute(BEAN_UNIT, ret);
return ret;
} | java | protected UnitBean getCurrentUnit(HttpServletRequest req, boolean saveToSession){
String unitParameter = req.getParameter(PARAM_UNIT);
if (unitParameter==null){
UnitBean ret = (UnitBean)req.getSession().getAttribute(BEAN_UNIT);
if (ret==null){
ret = DEFAULT_UNIT_BEAN;
//ensure a unit bean is always in the session.
req.getSession().setAttribute(BEAN_UNIT, ret);
}
return ret;
}
int index = -1;
for (int i = 0; i<AVAILABLE_UNITS_LIST.size(); i++){
if (AVAILABLE_UNITS_LIST.get(i).getUnitName().equalsIgnoreCase(unitParameter)){
index = i;
break;
}
}
UnitBean ret = index == -1 ? DEFAULT_UNIT_BEAN : AVAILABLE_UNITS[index];
if (saveToSession)
req.getSession().setAttribute(BEAN_UNIT, ret);
return ret;
} | [
"protected",
"UnitBean",
"getCurrentUnit",
"(",
"HttpServletRequest",
"req",
",",
"boolean",
"saveToSession",
")",
"{",
"String",
"unitParameter",
"=",
"req",
".",
"getParameter",
"(",
"PARAM_UNIT",
")",
";",
"if",
"(",
"unitParameter",
"==",
"null",
")",
"{",
... | Returns the currently selected unit either from request or session.
@param req
@param saveToSession - if true the request parameter will be saved into session.
@return | [
"Returns",
"the",
"currently",
"selected",
"unit",
"either",
"from",
"request",
"or",
"session",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-webui/src/main/java/net/anotheria/moskito/webui/shared/action/BaseMoskitoUIAction.java#L327-L350 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.