repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
NextFaze/power-adapters | power-adapters/src/main/java/com/nextfaze/poweradapters/PowerAdapters.java | PowerAdapters.toSpinnerAdapter | @CheckResult
@NonNull
public static SpinnerAdapter toSpinnerAdapter(@NonNull PowerAdapter powerAdapter) {
"""
Returns the specified {@link PowerAdapter} as a {@link SpinnerAdapter}.
<p>
<strong>Note that the supplied adapter must only ever use a single view type</strong>, due to constraints
imposed by {... | java | @CheckResult
@NonNull
public static SpinnerAdapter toSpinnerAdapter(@NonNull PowerAdapter powerAdapter) {
// SpinnerAdapter adds additional constraints to the ListAdapter contract: getViewTypeCount must return 1.
// See android.widget.Spinner.setAdapter()
return new ListAdapterConverterA... | [
"@",
"CheckResult",
"@",
"NonNull",
"public",
"static",
"SpinnerAdapter",
"toSpinnerAdapter",
"(",
"@",
"NonNull",
"PowerAdapter",
"powerAdapter",
")",
"{",
"// SpinnerAdapter adds additional constraints to the ListAdapter contract: getViewTypeCount must return 1.",
"// See android.w... | Returns the specified {@link PowerAdapter} as a {@link SpinnerAdapter}.
<p>
<strong>Note that the supplied adapter must only ever use a single view type</strong>, due to constraints
imposed by {@link Spinner#setAdapter(SpinnerAdapter)}.
@param powerAdapter The adapter to be converted.
@return A spinner adapter that pre... | [
"Returns",
"the",
"specified",
"{"
] | train | https://github.com/NextFaze/power-adapters/blob/cdf00b1b723ed9d6bcd549ae9741a19dd59651e1/power-adapters/src/main/java/com/nextfaze/poweradapters/PowerAdapters.java#L44-L50 |
liferay/com-liferay-commerce | commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java | CommerceCurrencyPersistenceImpl.fetchByUUID_G | @Override
public CommerceCurrency fetchByUUID_G(String uuid, long groupId) {
"""
Returns the commerce currency where uuid = ? and groupId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce cu... | java | @Override
public CommerceCurrency fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
} | [
"@",
"Override",
"public",
"CommerceCurrency",
"fetchByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"{",
"return",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
",",
"true",
")",
";",
"}"
] | Returns the commerce currency where uuid = ? and groupId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce currency, or <code>null</code> if a matching commerce currency could not be found | [
"Returns",
"the",
"commerce",
"currency",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
"finder",
"cache",... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java#L701-L704 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/EmbedBuilder.java | EmbedBuilder.build | public MessageEmbed build() {
"""
Returns a {@link net.dv8tion.jda.core.entities.MessageEmbed MessageEmbed}
that has been checked as being valid for sending.
@throws java.lang.IllegalStateException
If the embed is empty. Can be checked with {@link #isEmpty()}.
@return the built, sendable {@link net.dv8tion... | java | public MessageEmbed build()
{
if (isEmpty())
throw new IllegalStateException("Cannot build an empty embed!");
if (description.length() > MessageEmbed.TEXT_MAX_LENGTH)
throw new IllegalStateException(String.format("Description is longer than %d! Please limit your input!", Mess... | [
"public",
"MessageEmbed",
"build",
"(",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot build an empty embed!\"",
")",
";",
"if",
"(",
"description",
".",
"length",
"(",
")",
">",
"MessageEmbed",
".",
"T... | Returns a {@link net.dv8tion.jda.core.entities.MessageEmbed MessageEmbed}
that has been checked as being valid for sending.
@throws java.lang.IllegalStateException
If the embed is empty. Can be checked with {@link #isEmpty()}.
@return the built, sendable {@link net.dv8tion.jda.core.entities.MessageEmbed} | [
"Returns",
"a",
"{",
"@link",
"net",
".",
"dv8tion",
".",
"jda",
".",
"core",
".",
"entities",
".",
"MessageEmbed",
"MessageEmbed",
"}",
"that",
"has",
"been",
"checked",
"as",
"being",
"valid",
"for",
"sending",
"."
] | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/EmbedBuilder.java#L111-L121 |
b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Locales.java | Locales.setLocale | public static void setLocale(final HttpServletRequest request, final Locale locale) {
"""
Sets the specified locale into session of the specified request.
<p>
If no session of the specified request, do nothing.
</p>
@param request the specified request
@param locale a new locale
"""
final Htt... | java | public static void setLocale(final HttpServletRequest request, final Locale locale) {
final HttpSession session = request.getSession(false);
if (null == session) {
LOGGER.warn("Ignores set locale caused by no session");
return;
}
session.setAttribute(Keys.LOCAL... | [
"public",
"static",
"void",
"setLocale",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"Locale",
"locale",
")",
"{",
"final",
"HttpSession",
"session",
"=",
"request",
".",
"getSession",
"(",
"false",
")",
";",
"if",
"(",
"null",
"==",
"sessio... | Sets the specified locale into session of the specified request.
<p>
If no session of the specified request, do nothing.
</p>
@param request the specified request
@param locale a new locale | [
"Sets",
"the",
"specified",
"locale",
"into",
"session",
"of",
"the",
"specified",
"request",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Locales.java#L153-L164 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java | ByteUtils.bytesToInts | public static final void bytesToInts( int[] dst, int dst_offset, byte[] src, int src_offset, int length ) {
"""
Convert an array of <code>bytes</code>s into an array of
<code>ints</code>.
@param dst the array to write
@param dst_offset the start offset in <code>dst</code>, times 4. This
measures the offset a... | java | public static final void bytesToInts( int[] dst, int dst_offset, byte[] src, int src_offset, int length ) {
if ((src == null) || (dst == null) || ((src_offset + length) > src.length) || ((dst_offset + length) > (dst.length * 4))
|| ((dst_offset % 4) != 0) || ((length % 4) != 0)) {
cr... | [
"public",
"static",
"final",
"void",
"bytesToInts",
"(",
"int",
"[",
"]",
"dst",
",",
"int",
"dst_offset",
",",
"byte",
"[",
"]",
"src",
",",
"int",
"src_offset",
",",
"int",
"length",
")",
"{",
"if",
"(",
"(",
"src",
"==",
"null",
")",
"||",
"(",
... | Convert an array of <code>bytes</code>s into an array of
<code>ints</code>.
@param dst the array to write
@param dst_offset the start offset in <code>dst</code>, times 4. This
measures the offset as if <code>dst</code> were an array of
<code>byte</code>s (rather than <code>int</code>s).
@param src the array to read
@p... | [
"Convert",
"an",
"array",
"of",
"<code",
">",
"bytes<",
"/",
"code",
">",
"s",
"into",
"an",
"array",
"of",
"<code",
">",
"ints<",
"/",
"code",
">",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java#L398-L421 |
code4everything/util | src/main/java/com/zhazhapan/util/ThreadPool.java | ThreadPool.init | public static void init(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit timeUnit) {
"""
初始化线程池
@param corePoolSize 初始Size
@param maximumPoolSize 最大Size
@param keepAliveTime 存活时长
@param timeUnit 时间单位
"""
ThreadPool.corePoolSize = corePoolSize;
ThreadPool.maximumPoolSize... | java | public static void init(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit timeUnit) {
ThreadPool.corePoolSize = corePoolSize;
ThreadPool.maximumPoolSize = maximumPoolSize;
ThreadPool.keepAliveTime = keepAliveTime;
ThreadPool.timeUnit = timeUnit;
init();
} | [
"public",
"static",
"void",
"init",
"(",
"int",
"corePoolSize",
",",
"int",
"maximumPoolSize",
",",
"long",
"keepAliveTime",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"ThreadPool",
".",
"corePoolSize",
"=",
"corePoolSize",
";",
"ThreadPool",
".",
"maximumPoolSize",
... | 初始化线程池
@param corePoolSize 初始Size
@param maximumPoolSize 最大Size
@param keepAliveTime 存活时长
@param timeUnit 时间单位 | [
"初始化线程池"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/ThreadPool.java#L62-L68 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Session.java | Session.put | public void put(String key, String value) {
"""
Adds a value to the session, overwriting an existing value
@param key The key to store the value
@param value The value to store
"""
if (INVALID_CHRACTERTS.contains(key) || INVALID_CHRACTERTS.contains(value)) {
LOG.error("Session key or va... | java | public void put(String key, String value) {
if (INVALID_CHRACTERTS.contains(key) || INVALID_CHRACTERTS.contains(value)) {
LOG.error("Session key or value can not contain the following characters: spaces, |, & or :");
} else {
this.changed = true;
this.values.put(key,... | [
"public",
"void",
"put",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"INVALID_CHRACTERTS",
".",
"contains",
"(",
"key",
")",
"||",
"INVALID_CHRACTERTS",
".",
"contains",
"(",
"value",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"\"S... | Adds a value to the session, overwriting an existing value
@param key The key to store the value
@param value The value to store | [
"Adds",
"a",
"value",
"to",
"the",
"session",
"overwriting",
"an",
"existing",
"value"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Session.java#L99-L106 |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java | KernelResolverRepository.listContainsDuplicate | private boolean listContainsDuplicate(List<ProvisioningFeatureDefinition> featureList, ProvisioningFeatureDefinition feature) {
"""
Checks whether {@code featureList} contains a feature with the same name and version as {@code feature}.
@param featureList the list of features
@param feature the feature
@retur... | java | private boolean listContainsDuplicate(List<ProvisioningFeatureDefinition> featureList, ProvisioningFeatureDefinition feature) {
for (ProvisioningFeatureDefinition f : featureList) {
if (hasSameSymbolicNameAndVersion(feature, f)) {
return true;
}
}
return f... | [
"private",
"boolean",
"listContainsDuplicate",
"(",
"List",
"<",
"ProvisioningFeatureDefinition",
">",
"featureList",
",",
"ProvisioningFeatureDefinition",
"feature",
")",
"{",
"for",
"(",
"ProvisioningFeatureDefinition",
"f",
":",
"featureList",
")",
"{",
"if",
"(",
... | Checks whether {@code featureList} contains a feature with the same name and version as {@code feature}.
@param featureList the list of features
@param feature the feature
@return {@code true} if {@code featureList} contains a feature with the same symbolic name and version as {@code feature}, otherwise {@code false} | [
"Checks",
"whether",
"{",
"@code",
"featureList",
"}",
"contains",
"a",
"feature",
"with",
"the",
"same",
"name",
"and",
"version",
"as",
"{",
"@code",
"feature",
"}",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java#L133-L140 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/AbstractPrintQuery.java | AbstractPrintQuery.addAttribute | public AbstractPrintQuery addAttribute(final Attribute... _attributes) {
"""
Add an attribute to the PrintQuery. It is used to get editable values
from the eFaps DataBase.
@param _attributes Attribute to add
@return this PrintQuery
"""
if (isMarked4execute()) {
for (final Attribute att... | java | public AbstractPrintQuery addAttribute(final Attribute... _attributes)
{
if (isMarked4execute()) {
for (final Attribute attr : _attributes) {
final OneSelect oneselect = new OneSelect(this, attr);
this.allSelects.add(oneselect);
this.attr2OneSelect... | [
"public",
"AbstractPrintQuery",
"addAttribute",
"(",
"final",
"Attribute",
"...",
"_attributes",
")",
"{",
"if",
"(",
"isMarked4execute",
"(",
")",
")",
"{",
"for",
"(",
"final",
"Attribute",
"attr",
":",
"_attributes",
")",
"{",
"final",
"OneSelect",
"onesele... | Add an attribute to the PrintQuery. It is used to get editable values
from the eFaps DataBase.
@param _attributes Attribute to add
@return this PrintQuery | [
"Add",
"an",
"attribute",
"to",
"the",
"PrintQuery",
".",
"It",
"is",
"used",
"to",
"get",
"editable",
"values",
"from",
"the",
"eFaps",
"DataBase",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/AbstractPrintQuery.java#L138-L148 |
networknt/light-4j | consul/src/main/java/com/networknt/consul/ConsulUtils.java | ConsulUtils.buildUrl | public static URL buildUrl(ConsulService service) {
"""
build url from service
@param service consul service
@return URL object
"""
URL url = null;
if (url == null) {
Map<String, String> params = new HashMap<String, String>();
//String group = service.getName();
... | java | public static URL buildUrl(ConsulService service) {
URL url = null;
if (url == null) {
Map<String, String> params = new HashMap<String, String>();
//String group = service.getName();
//params.put(URLParamType.group.getName(), group);
//params.put(URLParamT... | [
"public",
"static",
"URL",
"buildUrl",
"(",
"ConsulService",
"service",
")",
"{",
"URL",
"url",
"=",
"null",
";",
"if",
"(",
"url",
"==",
"null",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"HashMap",
"<",
"String",
",",... | build url from service
@param service consul service
@return URL object | [
"build",
"url",
"from",
"service"
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/consul/src/main/java/com/networknt/consul/ConsulUtils.java#L74-L88 |
InsightLab/graphast | core/src/main/java/br/ufc/insightlab/graphast/utils/RandomGraphGenerator.java | RandomGraphGenerator.generateRandomMMapGraph | public Graph generateRandomMMapGraph(String graphName, int size, float dens) {
"""
Create a new Graph which has the given graphName, size and dens.
@param graphName the graph's name.
@param size the graph's size.
@param dens the graph's dens.
@return the graph generated.
"""
Graph graph = null;
Stri... | java | public Graph generateRandomMMapGraph(String graphName, int size, float dens) {
Graph graph = null;
String dir = "graphs/MMap/" + graphName;
SerializationUtils.deleteMMapGraph(dir);
graph = new Graph(new MMapGraphStructure(dir));
Random rand = new Random();
for (int i = 0; i < size; i++)
graph... | [
"public",
"Graph",
"generateRandomMMapGraph",
"(",
"String",
"graphName",
",",
"int",
"size",
",",
"float",
"dens",
")",
"{",
"Graph",
"graph",
"=",
"null",
";",
"String",
"dir",
"=",
"\"graphs/MMap/\"",
"+",
"graphName",
";",
"SerializationUtils",
".",
"delet... | Create a new Graph which has the given graphName, size and dens.
@param graphName the graph's name.
@param size the graph's size.
@param dens the graph's dens.
@return the graph generated. | [
"Create",
"a",
"new",
"Graph",
"which",
"has",
"the",
"given",
"graphName",
"size",
"and",
"dens",
"."
] | train | https://github.com/InsightLab/graphast/blob/b81d10c1ea8378e1fb9fcb545dd75d5e6308fd24/core/src/main/java/br/ufc/insightlab/graphast/utils/RandomGraphGenerator.java#L53-L81 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/Validate.java | Validate.isAssignableFrom | @GwtIncompatible("incompatible method")
public static void isAssignableFrom(final Class<?> superType, final Class<?> type) {
"""
Validates that the argument can be converted to the specified class, if not, throws an exception.
<p>This method is useful when validating that there will be no casting errors.</p... | java | @GwtIncompatible("incompatible method")
public static void isAssignableFrom(final Class<?> superType, final Class<?> type) {
// TODO when breaking BC, consider returning type
if (!superType.isAssignableFrom(type)) {
throw new IllegalArgumentException(StringUtils.simpleFormat(DEFAULT_IS_A... | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"void",
"isAssignableFrom",
"(",
"final",
"Class",
"<",
"?",
">",
"superType",
",",
"final",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"// TODO when breaking BC, consider returning type... | Validates that the argument can be converted to the specified class, if not, throws an exception.
<p>This method is useful when validating that there will be no casting errors.</p>
<pre>Validate.isAssignableFrom(SuperClass.class, object.getClass());</pre>
<p>The message format of the exception is "Cannot assign... | [
"Validates",
"that",
"the",
"argument",
"can",
"be",
"converted",
"to",
"the",
"specified",
"class",
"if",
"not",
"throws",
"an",
"exception",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L1319-L1326 |
centic9/commons-dost | src/main/java/org/dstadler/commons/http/HttpClientWrapper.java | HttpClientWrapper.checkAndFetch | public static HttpEntity checkAndFetch(HttpResponse response, String url) throws IOException {
"""
Helper method to check the status code of the response and throw an IOException if it is
an error or moved state.
@param response A HttpResponse that is resulting from executing a HttpMethod.
@param url The url,... | java | public static HttpEntity checkAndFetch(HttpResponse response, String url) throws IOException {
int statusCode = response.getStatusLine().getStatusCode();
if(statusCode > 206) {
String msg = "Had HTTP StatusCode " + statusCode + " for request: " + url + ", response: " +
response.getStatusLine().g... | [
"public",
"static",
"HttpEntity",
"checkAndFetch",
"(",
"HttpResponse",
"response",
",",
"String",
"url",
")",
"throws",
"IOException",
"{",
"int",
"statusCode",
"=",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
";",
"if",
"(",
... | Helper method to check the status code of the response and throw an IOException if it is
an error or moved state.
@param response A HttpResponse that is resulting from executing a HttpMethod.
@param url The url, only used for building the error message of the exception.
@return The {@link HttpEntity} returned from re... | [
"Helper",
"method",
"to",
"check",
"the",
"status",
"code",
"of",
"the",
"response",
"and",
"throw",
"an",
"IOException",
"if",
"it",
"is",
"an",
"error",
"or",
"moved",
"state",
"."
] | train | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/http/HttpClientWrapper.java#L353-L365 |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/AbstractWisdomMojo.java | AbstractWisdomMojo.getWisdomRootDirectory | public File getWisdomRootDirectory() {
"""
Gets the root directory of the Wisdom server. Generally it's 'target/wisdom' except if the
{@link #wisdomDirectory} parameter is configured. In this case,
it returns the location specified by this parameter.
@return the Wisdom's root.
"""
File wisdom;
... | java | public File getWisdomRootDirectory() {
File wisdom;
if (wisdomDirectory == null) {
wisdom = new File(buildDirectory, Constants.WISDOM_DIRECTORY_NAME);
} else {
this.getLog().debug("Using Wisdom Directory : " + wisdomDirectory.getAbsolutePath());
wisdom = wisdo... | [
"public",
"File",
"getWisdomRootDirectory",
"(",
")",
"{",
"File",
"wisdom",
";",
"if",
"(",
"wisdomDirectory",
"==",
"null",
")",
"{",
"wisdom",
"=",
"new",
"File",
"(",
"buildDirectory",
",",
"Constants",
".",
"WISDOM_DIRECTORY_NAME",
")",
";",
"}",
"else"... | Gets the root directory of the Wisdom server. Generally it's 'target/wisdom' except if the
{@link #wisdomDirectory} parameter is configured. In this case,
it returns the location specified by this parameter.
@return the Wisdom's root. | [
"Gets",
"the",
"root",
"directory",
"of",
"the",
"Wisdom",
"server",
".",
"Generally",
"it",
"s",
"target",
"/",
"wisdom",
"except",
"if",
"the",
"{",
"@link",
"#wisdomDirectory",
"}",
"parameter",
"is",
"configured",
".",
"In",
"this",
"case",
"it",
"retu... | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/AbstractWisdomMojo.java#L134-L147 |
Stratio/stratio-connector-commons | connector-commons/src/main/java/com/stratio/connector/commons/util/ManifestUtil.java | ManifestUtil.getResult | private static Object getResult(Document document, String node) throws XPathExpressionException {
"""
Get the node value.
@param document the document.
@param node the node.
@return the node value.
@throws XPathExpressionException if an exception happens.
"""
// create an XPath object
... | java | private static Object getResult(Document document, String node) throws XPathExpressionException {
// create an XPath object
XPath xpath = XPathFactory.newInstance().newXPath();
Object result;
XPathExpression expr = null;
expr = xpath.compile(node);
result = expr.evaluate(... | [
"private",
"static",
"Object",
"getResult",
"(",
"Document",
"document",
",",
"String",
"node",
")",
"throws",
"XPathExpressionException",
"{",
"// create an XPath object",
"XPath",
"xpath",
"=",
"XPathFactory",
".",
"newInstance",
"(",
")",
".",
"newXPath",
"(",
... | Get the node value.
@param document the document.
@param node the node.
@return the node value.
@throws XPathExpressionException if an exception happens. | [
"Get",
"the",
"node",
"value",
"."
] | train | https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/util/ManifestUtil.java#L113-L121 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/ie/crf/CRFFeatureExporter.java | CRFFeatureExporter.printFeatures | public void printFeatures(String exportFile, int[][][][] docsData, int[][] labels) {
"""
Output features that have already been converted into features
(using documentToDataAndLabels) in format suitable for CRFSuite
Format is with one line per token using the following format
label feat1 feat2 ...
(where each ... | java | public void printFeatures(String exportFile, int[][][][] docsData, int[][] labels) {
try {
PrintWriter pw = IOUtils.getPrintWriter(exportFile);
for (int i = 0; i < docsData.length; i++) {
for (int j = 0; j < docsData[i].length; j++) {
StringBuilder sb = new StringBuilder();
... | [
"public",
"void",
"printFeatures",
"(",
"String",
"exportFile",
",",
"int",
"[",
"]",
"[",
"]",
"[",
"]",
"[",
"]",
"docsData",
",",
"int",
"[",
"]",
"[",
"]",
"labels",
")",
"{",
"try",
"{",
"PrintWriter",
"pw",
"=",
"IOUtils",
".",
"getPrintWriter"... | Output features that have already been converted into features
(using documentToDataAndLabels) in format suitable for CRFSuite
Format is with one line per token using the following format
label feat1 feat2 ...
(where each space is actually a tab)
Each document is separated by an empty line
@param exportFile file to exp... | [
"Output",
"features",
"that",
"have",
"already",
"been",
"converted",
"into",
"features",
"(",
"using",
"documentToDataAndLabels",
")",
"in",
"format",
"suitable",
"for",
"CRFSuite",
"Format",
"is",
"with",
"one",
"line",
"per",
"token",
"using",
"the",
"followi... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/crf/CRFFeatureExporter.java#L107-L131 |
camunda/camunda-commons | utils/src/main/java/org/camunda/commons/utils/IoUtil.java | IoUtil.getClasspathFile | public static File getClasspathFile(String filename) {
"""
Returns the {@link File} for a filename.
@param filename the filename to load
@return the file object
"""
if(filename == null) {
throw LOG.nullParameter("filename");
}
return getClasspathFile(filename, null);
} | java | public static File getClasspathFile(String filename) {
if(filename == null) {
throw LOG.nullParameter("filename");
}
return getClasspathFile(filename, null);
} | [
"public",
"static",
"File",
"getClasspathFile",
"(",
"String",
"filename",
")",
"{",
"if",
"(",
"filename",
"==",
"null",
")",
"{",
"throw",
"LOG",
".",
"nullParameter",
"(",
"\"filename\"",
")",
";",
"}",
"return",
"getClasspathFile",
"(",
"filename",
",",
... | Returns the {@link File} for a filename.
@param filename the filename to load
@return the file object | [
"Returns",
"the",
"{",
"@link",
"File",
"}",
"for",
"a",
"filename",
"."
] | train | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/utils/src/main/java/org/camunda/commons/utils/IoUtil.java#L186-L192 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/TypeElementCatalog.java | TypeElementCatalog.addTypeElement | private void addTypeElement(TypeElement typeElement, Map<PackageElement, SortedSet<TypeElement>> map) {
"""
Add the given class to the given map.
@param typeElement the class to add to the catalog.
@param map the Map to add the TypeElement to.
"""
PackageElement pkg = utils.containingPackage(typeE... | java | private void addTypeElement(TypeElement typeElement, Map<PackageElement, SortedSet<TypeElement>> map) {
PackageElement pkg = utils.containingPackage(typeElement);
if (utils.isSpecified(pkg) || configuration.nodeprecated && utils.isDeprecated(pkg)) {
// No need to catalog this class if it's ... | [
"private",
"void",
"addTypeElement",
"(",
"TypeElement",
"typeElement",
",",
"Map",
"<",
"PackageElement",
",",
"SortedSet",
"<",
"TypeElement",
">",
">",
"map",
")",
"{",
"PackageElement",
"pkg",
"=",
"utils",
".",
"containingPackage",
"(",
"typeElement",
")",
... | Add the given class to the given map.
@param typeElement the class to add to the catalog.
@param map the Map to add the TypeElement to. | [
"Add",
"the",
"given",
"class",
"to",
"the",
"given",
"map",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/TypeElementCatalog.java#L156-L173 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ConnInterfaceCodeGen.java | ConnInterfaceCodeGen.writeImport | @Override
public void writeImport(Definition def, Writer out) throws IOException {
"""
Output class import
@param def definition
@param out Writer
@throws IOException ioException
"""
out.write("package " + def.getRaPackage() + ";\n\n");
} | java | @Override
public void writeImport(Definition def, Writer out) throws IOException
{
out.write("package " + def.getRaPackage() + ";\n\n");
} | [
"@",
"Override",
"public",
"void",
"writeImport",
"(",
"Definition",
"def",
",",
"Writer",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"write",
"(",
"\"package \"",
"+",
"def",
".",
"getRaPackage",
"(",
")",
"+",
"\";\\n\\n\"",
")",
";",
"}"
] | Output class import
@param def definition
@param out Writer
@throws IOException ioException | [
"Output",
"class",
"import"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ConnInterfaceCodeGen.java#L82-L86 |
sonyxperiadev/gerrit-events | src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java | GerritHandler.setIgnoreEMail | public void setIgnoreEMail(String serverName, String ignoreEMail) {
"""
Standard setter for the ignoreEMail.
@param serverName the server name.
@param ignoreEMail the e-mail address to ignore CommentAdded events from.
If you want to remove, please set null.
"""
if (serverName != null) {
... | java | public void setIgnoreEMail(String serverName, String ignoreEMail) {
if (serverName != null) {
if (ignoreEMail != null) {
ignoreEMails.put(serverName, ignoreEMail);
} else {
ignoreEMails.remove(serverName);
}
}
} | [
"public",
"void",
"setIgnoreEMail",
"(",
"String",
"serverName",
",",
"String",
"ignoreEMail",
")",
"{",
"if",
"(",
"serverName",
"!=",
"null",
")",
"{",
"if",
"(",
"ignoreEMail",
"!=",
"null",
")",
"{",
"ignoreEMails",
".",
"put",
"(",
"serverName",
",",
... | Standard setter for the ignoreEMail.
@param serverName the server name.
@param ignoreEMail the e-mail address to ignore CommentAdded events from.
If you want to remove, please set null. | [
"Standard",
"setter",
"for",
"the",
"ignoreEMail",
"."
] | train | https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java#L224-L232 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java | DataService.prepareUpload | private <T extends IEntity> IntuitMessage prepareUpload(T entity, InputStream docContent, String boundaryId) throws FMSException {
"""
Common method to prepare the request params for upload operation for both sync and async calls
@param entity the entity
@param docContent the content for document to upload
@r... | java | private <T extends IEntity> IntuitMessage prepareUpload(T entity, InputStream docContent, String boundaryId) throws FMSException {
IntuitMessage intuitMessage = new IntuitMessage();
RequestElements requestElements = intuitMessage.getRequestElements();
//set the request parameters
Map<St... | [
"private",
"<",
"T",
"extends",
"IEntity",
">",
"IntuitMessage",
"prepareUpload",
"(",
"T",
"entity",
",",
"InputStream",
"docContent",
",",
"String",
"boundaryId",
")",
"throws",
"FMSException",
"{",
"IntuitMessage",
"intuitMessage",
"=",
"new",
"IntuitMessage",
... | Common method to prepare the request params for upload operation for both sync and async calls
@param entity the entity
@param docContent the content for document to upload
@return IntuitMessage the intuit message
@throws FMSException | [
"Common",
"method",
"to",
"prepare",
"the",
"request",
"params",
"for",
"upload",
"operation",
"for",
"both",
"sync",
"and",
"async",
"calls"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java#L1289-L1308 |
dadoonet/fscrawler | framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java | FsCrawlerUtil.isIncluded | public static boolean isIncluded(String filename, List<String> includes) {
"""
We check if we can index the file or if we should ignore it
@param filename The filename to scan
@param includes include rules, may be empty not null
"""
logger.debug("filename = [{}], includes = [{}]", filename, include... | java | public static boolean isIncluded(String filename, List<String> includes) {
logger.debug("filename = [{}], includes = [{}]", filename, includes);
// No rules ? Fine, we index everything
if (includes == null || includes.isEmpty()) {
logger.trace("no include rules");
return... | [
"public",
"static",
"boolean",
"isIncluded",
"(",
"String",
"filename",
",",
"List",
"<",
"String",
">",
"includes",
")",
"{",
"logger",
".",
"debug",
"(",
"\"filename = [{}], includes = [{}]\"",
",",
"filename",
",",
"includes",
")",
";",
"// No rules ? Fine, we ... | We check if we can index the file or if we should ignore it
@param filename The filename to scan
@param includes include rules, may be empty not null | [
"We",
"check",
"if",
"we",
"can",
"index",
"the",
"file",
"or",
"if",
"we",
"should",
"ignore",
"it"
] | train | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L229-L249 |
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/io/FileHelper.java | FileHelper.safeMove | @Deprecated
public static boolean safeMove(File src, File dest) throws SecurityException {
"""
Safely moves a file from one place to another, ensuring the filesystem is left in a consistent state
@param src
File The source file
@param dest
File The destination file
@return boolean True if the file has be... | java | @Deprecated
public static boolean safeMove(File src, File dest) throws SecurityException
{
assert (src.exists());
final boolean createDestIfNotExist = true;
try
{
if (src.isFile())
FileUtils.moveFile(src, dest);
else
FileUtils.moveDirectoryToDirectory(src, dest, createDestIfNotExist);
retu... | [
"@",
"Deprecated",
"public",
"static",
"boolean",
"safeMove",
"(",
"File",
"src",
",",
"File",
"dest",
")",
"throws",
"SecurityException",
"{",
"assert",
"(",
"src",
".",
"exists",
"(",
")",
")",
";",
"final",
"boolean",
"createDestIfNotExist",
"=",
"true",
... | Safely moves a file from one place to another, ensuring the filesystem is left in a consistent state
@param src
File The source file
@param dest
File The destination file
@return boolean True if the file has been completely moved to the new location, false if it is still in the original
location
@throws java.lang.Se... | [
"Safely",
"moves",
"a",
"file",
"from",
"one",
"place",
"to",
"another",
"ensuring",
"the",
"filesystem",
"is",
"left",
"in",
"a",
"consistent",
"state"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/io/FileHelper.java#L335-L356 |
attribyte/wpdb | src/main/java/org/attribyte/wp/db/DB.java | DB.updatePost | public Post updatePost(Post post, final TimeZone tz) throws SQLException {
"""
Updates a post.
@param post The post to update. The {@code id} must be set.
@param tz The local time zone.
@return The updated post.
@throws SQLException on database error or missing post id.
"""
if(post.id < 1L) {
... | java | public Post updatePost(Post post, final TimeZone tz) throws SQLException {
if(post.id < 1L) {
throw new SQLException("The post id must be specified for update");
}
if(post.modifiedTimestamp < 1) {
post = post.modifiedNow();
}
int offset = tz.getOffset(post.publishTimest... | [
"public",
"Post",
"updatePost",
"(",
"Post",
"post",
",",
"final",
"TimeZone",
"tz",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"post",
".",
"id",
"<",
"1L",
")",
"{",
"throw",
"new",
"SQLException",
"(",
"\"The post id must be specified for update\"",
")"... | Updates a post.
@param post The post to update. The {@code id} must be set.
@param tz The local time zone.
@return The updated post.
@throws SQLException on database error or missing post id. | [
"Updates",
"a",
"post",
"."
] | train | https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/db/DB.java#L1699-L1736 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/resource/ClassPathResource.java | ClassPathResource.getInputStreamNoCache | @Nullable
public InputStream getInputStreamNoCache (@Nonnull final ClassLoader aClassLoader) {
"""
Get the input stream to the this resource, using the passed class loader
only.
@param aClassLoader
The class loader to be used. May not be <code>null</code>.
@return <code>null</code> if the path could not be... | java | @Nullable
public InputStream getInputStreamNoCache (@Nonnull final ClassLoader aClassLoader)
{
final URL aURL = getAsURLNoCache (aClassLoader);
return _getInputStream (m_sPath, aURL, aClassLoader);
} | [
"@",
"Nullable",
"public",
"InputStream",
"getInputStreamNoCache",
"(",
"@",
"Nonnull",
"final",
"ClassLoader",
"aClassLoader",
")",
"{",
"final",
"URL",
"aURL",
"=",
"getAsURLNoCache",
"(",
"aClassLoader",
")",
";",
"return",
"_getInputStream",
"(",
"m_sPath",
",... | Get the input stream to the this resource, using the passed class loader
only.
@param aClassLoader
The class loader to be used. May not be <code>null</code>.
@return <code>null</code> if the path could not be resolved. | [
"Get",
"the",
"input",
"stream",
"to",
"the",
"this",
"resource",
"using",
"the",
"passed",
"class",
"loader",
"only",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/resource/ClassPathResource.java#L290-L295 |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/geometry/ExampleImageStitching.java | ExampleImageStitching.stitch | public static <T extends ImageGray<T>>
void stitch( BufferedImage imageA , BufferedImage imageB , Class<T> imageType ) {
"""
Given two input images create and display an image where the two have been overlayed on top of each other.
"""
T inputA = ConvertBufferedImage.convertFromSingle(imageA, null, imageTyp... | java | public static <T extends ImageGray<T>>
void stitch( BufferedImage imageA , BufferedImage imageB , Class<T> imageType )
{
T inputA = ConvertBufferedImage.convertFromSingle(imageA, null, imageType);
T inputB = ConvertBufferedImage.convertFromSingle(imageB, null, imageType);
// Detect using the standard SURF feat... | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
">",
"void",
"stitch",
"(",
"BufferedImage",
"imageA",
",",
"BufferedImage",
"imageB",
",",
"Class",
"<",
"T",
">",
"imageType",
")",
"{",
"T",
"inputA",
"=",
"ConvertBufferedImage",
".",... | Given two input images create and display an image where the two have been overlayed on top of each other. | [
"Given",
"two",
"input",
"images",
"create",
"and",
"display",
"an",
"image",
"where",
"the",
"two",
"have",
"been",
"overlayed",
"on",
"top",
"of",
"each",
"other",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/geometry/ExampleImageStitching.java#L144-L163 |
Samsung/GearVRf | GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBundle.java | GVRScriptBundle.loadFromFile | public static GVRScriptBundle loadFromFile(GVRContext gvrContext, String filePath,
GVRResourceVolume volume) throws IOException {
"""
Loads a {@link GVRScriptBundle} from a file.
@param gvrContext
The GVRContext to use for loading.
@param filePath
The file name of the script bundle in JSON format.
... | java | public static GVRScriptBundle loadFromFile(GVRContext gvrContext, String filePath,
GVRResourceVolume volume) throws IOException {
GVRAndroidResource fileRes = volume.openResource(filePath);
String fileText = TextFile.readTextFile(fileRes.getStream());
fileRes.closeStream();
... | [
"public",
"static",
"GVRScriptBundle",
"loadFromFile",
"(",
"GVRContext",
"gvrContext",
",",
"String",
"filePath",
",",
"GVRResourceVolume",
"volume",
")",
"throws",
"IOException",
"{",
"GVRAndroidResource",
"fileRes",
"=",
"volume",
".",
"openResource",
"(",
"filePat... | Loads a {@link GVRScriptBundle} from a file.
@param gvrContext
The GVRContext to use for loading.
@param filePath
The file name of the script bundle in JSON format.
@param volume
The {@link GVRResourceVolume} from which to load script bundle.
@return
The {@link GVRScriptBundle} object with contents from the JSON file.
... | [
"Loads",
"a",
"{",
"@link",
"GVRScriptBundle",
"}",
"from",
"a",
"file",
".",
"@param",
"gvrContext",
"The",
"GVRContext",
"to",
"use",
"for",
"loading",
".",
"@param",
"filePath",
"The",
"file",
"name",
"of",
"the",
"script",
"bundle",
"in",
"JSON",
"form... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBundle.java#L67-L83 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuObjectUtil.java | GosuObjectUtil.min | public static Object min(Comparable c1, Comparable c2) {
"""
Null safe comparison of Comparables.
@param c1 the first comparable, may be null
@param c2 the second comparable, may be null
@return <ul>
<li>If both objects are non-null and unequal, the lesser object.
<li>If both objects are non-null and equal,... | java | public static Object min(Comparable c1, Comparable c2) {
if (c1 != null && c2 != null) {
return c1.compareTo(c2) < 1 ? c1 : c2;
} else {
return c1 != null ? c1 : c2;
}
} | [
"public",
"static",
"Object",
"min",
"(",
"Comparable",
"c1",
",",
"Comparable",
"c2",
")",
"{",
"if",
"(",
"c1",
"!=",
"null",
"&&",
"c2",
"!=",
"null",
")",
"{",
"return",
"c1",
".",
"compareTo",
"(",
"c2",
")",
"<",
"1",
"?",
"c1",
":",
"c2",
... | Null safe comparison of Comparables.
@param c1 the first comparable, may be null
@param c2 the second comparable, may be null
@return <ul>
<li>If both objects are non-null and unequal, the lesser object.
<li>If both objects are non-null and equal, c1.
<li>If one of the comparables is null, the non-null object.
<li>If ... | [
"Null",
"safe",
"comparison",
"of",
"Comparables",
"."
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuObjectUtil.java#L260-L266 |
btrplace/scheduler | json/src/main/java/org/btrplace/json/JSONs.java | JSONs.requiredString | public static String requiredString(JSONObject o, String id) throws JSONConverterException {
"""
Read an expected string.
@param o the object to parse
@param id the key in the map that points to the string
@return the string
@throws JSONConverterException if the key does not point to a string
"""
... | java | public static String requiredString(JSONObject o, String id) throws JSONConverterException {
checkKeys(o, id);
Object x = o.get(id);
return x.toString();
} | [
"public",
"static",
"String",
"requiredString",
"(",
"JSONObject",
"o",
",",
"String",
"id",
")",
"throws",
"JSONConverterException",
"{",
"checkKeys",
"(",
"o",
",",
"id",
")",
";",
"Object",
"x",
"=",
"o",
".",
"get",
"(",
"id",
")",
";",
"return",
"... | Read an expected string.
@param o the object to parse
@param id the key in the map that points to the string
@return the string
@throws JSONConverterException if the key does not point to a string | [
"Read",
"an",
"expected",
"string",
"."
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L144-L148 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractController.java | AbstractController.getUserData | protected <T> Optional<T> getUserData(Optional<? extends Node> node, WaveItem<T> waveItem) {
"""
Gets the user data.
@param node the node
@param waveItem the wave item
@return the user data
@param <T> the generic type
"""
if (node.isPresent()) {
final Node n = node.get();
... | java | protected <T> Optional<T> getUserData(Optional<? extends Node> node, WaveItem<T> waveItem) {
if (node.isPresent()) {
final Node n = node.get();
return getValue(n, n::getUserData, waveItem);
}
return Optional.empty();
} | [
"protected",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"getUserData",
"(",
"Optional",
"<",
"?",
"extends",
"Node",
">",
"node",
",",
"WaveItem",
"<",
"T",
">",
"waveItem",
")",
"{",
"if",
"(",
"node",
".",
"isPresent",
"(",
")",
")",
"{",
"final",... | Gets the user data.
@param node the node
@param waveItem the wave item
@return the user data
@param <T> the generic type | [
"Gets",
"the",
"user",
"data",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractController.java#L297-L303 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/util/concurrent/ExecutionList.java | ExecutionList.executeListener | private static void executeListener(Runnable runnable, Executor executor) {
"""
Submits the given runnable to the given {@link Executor} catching and logging all {@linkplain
RuntimeException runtime exceptions} thrown by the executor.
"""
try {
executor.execute(runnable);
} catch (RuntimeExcepti... | java | private static void executeListener(Runnable runnable, Executor executor) {
try {
executor.execute(runnable);
} catch (RuntimeException e) {
// Log it and keep going -- bad runnable and/or executor. Don't punish the other runnables if
// we're given a bad one. We only catch RuntimeException be... | [
"private",
"static",
"void",
"executeListener",
"(",
"Runnable",
"runnable",
",",
"Executor",
"executor",
")",
"{",
"try",
"{",
"executor",
".",
"execute",
"(",
"runnable",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"// Log it and keep goi... | Submits the given runnable to the given {@link Executor} catching and logging all {@linkplain
RuntimeException runtime exceptions} thrown by the executor. | [
"Submits",
"the",
"given",
"runnable",
"to",
"the",
"given",
"{"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/util/concurrent/ExecutionList.java#L139-L150 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsListItemWidget.java | CmsListItemWidget.concatIconTitles | String concatIconTitles(String main, String secondary) {
"""
Combines the main icon title with the title for a status icon overlayed over the main icon.<p>
@param main the main icon title
@param secondary the secondary icon title
@return the combined icon title for the secondary icon
"""
if (ma... | java | String concatIconTitles(String main, String secondary) {
if (main == null) {
main = "";
}
if (secondary == null) {
secondary = "";
}
if (secondary.length() == 0) {
return main;
}
return main + " [" + secondary + "]";
} | [
"String",
"concatIconTitles",
"(",
"String",
"main",
",",
"String",
"secondary",
")",
"{",
"if",
"(",
"main",
"==",
"null",
")",
"{",
"main",
"=",
"\"\"",
";",
"}",
"if",
"(",
"secondary",
"==",
"null",
")",
"{",
"secondary",
"=",
"\"\"",
";",
"}",
... | Combines the main icon title with the title for a status icon overlayed over the main icon.<p>
@param main the main icon title
@param secondary the secondary icon title
@return the combined icon title for the secondary icon | [
"Combines",
"the",
"main",
"icon",
"title",
"with",
"the",
"title",
"for",
"a",
"status",
"icon",
"overlayed",
"over",
"the",
"main",
"icon",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsListItemWidget.java#L1185-L1199 |
strator-dev/greenpepper | greenpepper/core/src/main/java/com/greenpepper/reflect/AbstractFixture.java | AbstractFixture.getSetter | protected Method getSetter(Class type, String name) {
"""
<p>getSetter.</p>
@param type a {@link java.lang.Class} object.
@param name a {@link java.lang.String} object.
@return a {@link java.lang.reflect.Method} object.
"""
return introspector(type).getSetter( toJavaIdentifierForm(name));
} | java | protected Method getSetter(Class type, String name)
{
return introspector(type).getSetter( toJavaIdentifierForm(name));
} | [
"protected",
"Method",
"getSetter",
"(",
"Class",
"type",
",",
"String",
"name",
")",
"{",
"return",
"introspector",
"(",
"type",
")",
".",
"getSetter",
"(",
"toJavaIdentifierForm",
"(",
"name",
")",
")",
";",
"}"
] | <p>getSetter.</p>
@param type a {@link java.lang.Class} object.
@param name a {@link java.lang.String} object.
@return a {@link java.lang.reflect.Method} object. | [
"<p",
">",
"getSetter",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/reflect/AbstractFixture.java#L94-L97 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/WxaAPI.java | WxaAPI.getnearbypoilist | public static GetnearbypoilistResult getnearbypoilist(String access_token, int page, int page_rows) {
"""
附近 查看地点列表
@since 2.8.18
@param access_token access_token
@param page 起始页id(从1开始计数)
@param page_rows 每页展示个数(最多1000个)
@return result
"""
HttpUriRequest httpUriRequest = RequestBuilder.get()
.set... | java | public static GetnearbypoilistResult getnearbypoilist(String access_token, int page, int page_rows){
HttpUriRequest httpUriRequest = RequestBuilder.get()
.setHeader(jsonHeader)
.setUri(BASE_URI + "/wxa/getnearbypoilist")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.addParamet... | [
"public",
"static",
"GetnearbypoilistResult",
"getnearbypoilist",
"(",
"String",
"access_token",
",",
"int",
"page",
",",
"int",
"page_rows",
")",
"{",
"HttpUriRequest",
"httpUriRequest",
"=",
"RequestBuilder",
".",
"get",
"(",
")",
".",
"setHeader",
"(",
"jsonHea... | 附近 查看地点列表
@since 2.8.18
@param access_token access_token
@param page 起始页id(从1开始计数)
@param page_rows 每页展示个数(最多1000个)
@return result | [
"附近",
"查看地点列表"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/WxaAPI.java#L374-L383 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java | JSONHelpers.getJSONColor | public static int getJSONColor(final JSONObject json, String elementName) throws JSONException {
"""
Gets a color formatted as an integer with ARGB ordering.
@param json {@link JSONObject} to get the color from
@param elementName Name of the color element
@return An ARGB formatted integer
@throws JSONExcepti... | java | public static int getJSONColor(final JSONObject json, String elementName) throws JSONException {
Object raw = json.get(elementName);
return convertJSONColor(raw);
} | [
"public",
"static",
"int",
"getJSONColor",
"(",
"final",
"JSONObject",
"json",
",",
"String",
"elementName",
")",
"throws",
"JSONException",
"{",
"Object",
"raw",
"=",
"json",
".",
"get",
"(",
"elementName",
")",
";",
"return",
"convertJSONColor",
"(",
"raw",
... | Gets a color formatted as an integer with ARGB ordering.
@param json {@link JSONObject} to get the color from
@param elementName Name of the color element
@return An ARGB formatted integer
@throws JSONException | [
"Gets",
"a",
"color",
"formatted",
"as",
"an",
"integer",
"with",
"ARGB",
"ordering",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java#L1664-L1667 |
lucee/Lucee | core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java | VariableInterpreter.getVariable | public static Object getVariable(PageContext pc, Collection collection, String var) throws PageException {
"""
reads a subelement from a struct
@param pc
@param collection
@param var
@return matching Object
@throws PageException
"""
StringList list = parse(pc, new ParserString(var), false);
if (list =... | java | public static Object getVariable(PageContext pc, Collection collection, String var) throws PageException {
StringList list = parse(pc, new ParserString(var), false);
if (list == null) throw new InterpreterException("invalid variable declaration [" + var + "]");
while (list.hasNextNext()) {
collection = Caster.... | [
"public",
"static",
"Object",
"getVariable",
"(",
"PageContext",
"pc",
",",
"Collection",
"collection",
",",
"String",
"var",
")",
"throws",
"PageException",
"{",
"StringList",
"list",
"=",
"parse",
"(",
"pc",
",",
"new",
"ParserString",
"(",
"var",
")",
","... | reads a subelement from a struct
@param pc
@param collection
@param var
@return matching Object
@throws PageException | [
"reads",
"a",
"subelement",
"from",
"a",
"struct"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java#L58-L66 |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveBasicCommandClass.java | ZWaveBasicCommandClass.processBasicReport | protected void processBasicReport(SerialMessage serialMessage, int offset, int endpoint) {
"""
Processes a BASIC_REPORT / BASIC_SET message.
@param serialMessage the incoming message to process.
@param offset the offset position from which to start message processing.
@param endpoint the endpoint or instance ... | java | protected void processBasicReport(SerialMessage serialMessage, int offset, int endpoint) {
int value = serialMessage.getMessagePayloadByte(offset + 1);
logger.debug(String.format("Basic report from nodeId = %d, value = 0x%02X", this.getNode().getNodeId(), value));
Object eventValue;
if (value == 0) {
e... | [
"protected",
"void",
"processBasicReport",
"(",
"SerialMessage",
"serialMessage",
",",
"int",
"offset",
",",
"int",
"endpoint",
")",
"{",
"int",
"value",
"=",
"serialMessage",
".",
"getMessagePayloadByte",
"(",
"offset",
"+",
"1",
")",
";",
"logger",
".",
"deb... | Processes a BASIC_REPORT / BASIC_SET message.
@param serialMessage the incoming message to process.
@param offset the offset position from which to start message processing.
@param endpoint the endpoint or instance number this message is meant for. | [
"Processes",
"a",
"BASIC_REPORT",
"/",
"BASIC_SET",
"message",
"."
] | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveBasicCommandClass.java#L135-L148 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/collection/PdfTargetDictionary.java | PdfTargetDictionary.setFileAttachmentName | public void setFileAttachmentName(String name) {
"""
If this dictionary refers to a child that is a file attachment added to a page,
you need to specify the page with setFileAttachmentPage or setFileAttachmentPageName,
and then specify the name of the attachment added to this page (or use setFileAttachmentIndex)... | java | public void setFileAttachmentName(String name) {
put(PdfName.A, new PdfString(name, PdfObject.TEXT_UNICODE));
} | [
"public",
"void",
"setFileAttachmentName",
"(",
"String",
"name",
")",
"{",
"put",
"(",
"PdfName",
".",
"A",
",",
"new",
"PdfString",
"(",
"name",
",",
"PdfObject",
".",
"TEXT_UNICODE",
")",
")",
";",
"}"
] | If this dictionary refers to a child that is a file attachment added to a page,
you need to specify the page with setFileAttachmentPage or setFileAttachmentPageName,
and then specify the name of the attachment added to this page (or use setFileAttachmentIndex).
@param name the name of the attachment | [
"If",
"this",
"dictionary",
"refers",
"to",
"a",
"child",
"that",
"is",
"a",
"file",
"attachment",
"added",
"to",
"a",
"page",
"you",
"need",
"to",
"specify",
"the",
"page",
"with",
"setFileAttachmentPage",
"or",
"setFileAttachmentPageName",
"and",
"then",
"sp... | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/collection/PdfTargetDictionary.java#L71-L73 |
ontop/ontop | engine/reformulation/core/src/main/java/it/unibz/inf/ontop/answering/reformulation/rewriting/impl/ImmutableCQSyntacticContainmentCheck.java | ImmutableCQSyntacticContainmentCheck.isContainedIn | @Override
public boolean isContainedIn(ImmutableCQ cq1, ImmutableCQ cq2) {
"""
Check if query cq1 is contained in cq2, syntactically. That is, if the
head of cq1 and cq2 are equal and each atom in cq2 is also in the body of cq1
"""
return cq2.getAnswerVariables().equals(cq1.getAnswerVariables())
... | java | @Override
public boolean isContainedIn(ImmutableCQ cq1, ImmutableCQ cq2) {
return cq2.getAnswerVariables().equals(cq1.getAnswerVariables())
&& !cq2.getAtoms().stream().anyMatch(a -> !cq1.getAtoms().contains(a));
} | [
"@",
"Override",
"public",
"boolean",
"isContainedIn",
"(",
"ImmutableCQ",
"cq1",
",",
"ImmutableCQ",
"cq2",
")",
"{",
"return",
"cq2",
".",
"getAnswerVariables",
"(",
")",
".",
"equals",
"(",
"cq1",
".",
"getAnswerVariables",
"(",
")",
")",
"&&",
"!",
"cq... | Check if query cq1 is contained in cq2, syntactically. That is, if the
head of cq1 and cq2 are equal and each atom in cq2 is also in the body of cq1 | [
"Check",
"if",
"query",
"cq1",
"is",
"contained",
"in",
"cq2",
"syntactically",
".",
"That",
"is",
"if",
"the",
"head",
"of",
"cq1",
"and",
"cq2",
"are",
"equal",
"and",
"each",
"atom",
"in",
"cq2",
"is",
"also",
"in",
"the",
"body",
"of",
"cq1"
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/engine/reformulation/core/src/main/java/it/unibz/inf/ontop/answering/reformulation/rewriting/impl/ImmutableCQSyntacticContainmentCheck.java#L12-L16 |
reactor/reactor-netty | src/main/java/reactor/netty/tcp/TcpClient.java | TcpClient.doOnDisconnected | public final TcpClient doOnDisconnected(Consumer<? super Connection> doOnDisconnected) {
"""
Setup a callback called after {@link Channel} has been disconnected.
@param doOnDisconnected a consumer observing disconnected events
@return a new {@link TcpClient}
"""
Objects.requireNonNull(doOnDisconnected,... | java | public final TcpClient doOnDisconnected(Consumer<? super Connection> doOnDisconnected) {
Objects.requireNonNull(doOnDisconnected, "doOnDisconnected");
return new TcpClientDoOn(this, null, null, doOnDisconnected);
} | [
"public",
"final",
"TcpClient",
"doOnDisconnected",
"(",
"Consumer",
"<",
"?",
"super",
"Connection",
">",
"doOnDisconnected",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"doOnDisconnected",
",",
"\"doOnDisconnected\"",
")",
";",
"return",
"new",
"TcpClientDoOn... | Setup a callback called after {@link Channel} has been disconnected.
@param doOnDisconnected a consumer observing disconnected events
@return a new {@link TcpClient} | [
"Setup",
"a",
"callback",
"called",
"after",
"{",
"@link",
"Channel",
"}",
"has",
"been",
"disconnected",
"."
] | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/tcp/TcpClient.java#L262-L265 |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/rendering/strategy/TiledFeatureService.java | TiledFeatureService.getMaxScreenEnvelope | private Envelope getMaxScreenEnvelope(InternalTile tile, Coordinate panOrigin) {
"""
What is the maximum bounds in screen space? Needed for correct clipping calculation.
@param tile
tile
@param panOrigin
pan origin
@return max screen bbox
"""
int nrOfTilesX = Math.max(1, MAXIMUM_TILE_COORDINATE / tile... | java | private Envelope getMaxScreenEnvelope(InternalTile tile, Coordinate panOrigin) {
int nrOfTilesX = Math.max(1, MAXIMUM_TILE_COORDINATE / tile.getScreenWidth());
int nrOfTilesY = Math.max(1, MAXIMUM_TILE_COORDINATE / tile.getScreenHeight());
double x1 = panOrigin.x - nrOfTilesX * tile.getTileWidth();
// double x... | [
"private",
"Envelope",
"getMaxScreenEnvelope",
"(",
"InternalTile",
"tile",
",",
"Coordinate",
"panOrigin",
")",
"{",
"int",
"nrOfTilesX",
"=",
"Math",
".",
"max",
"(",
"1",
",",
"MAXIMUM_TILE_COORDINATE",
"/",
"tile",
".",
"getScreenWidth",
"(",
")",
")",
";"... | What is the maximum bounds in screen space? Needed for correct clipping calculation.
@param tile
tile
@param panOrigin
pan origin
@return max screen bbox | [
"What",
"is",
"the",
"maximum",
"bounds",
"in",
"screen",
"space?",
"Needed",
"for",
"correct",
"clipping",
"calculation",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/rendering/strategy/TiledFeatureService.java#L205-L216 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.getMarkerAnchor | public Content getMarkerAnchor(String anchorName, Content anchorContent) {
"""
Get the marker anchor which will be added to the documentation tree.
@param anchorName the anchor name or id attribute
@param anchorContent the content that should be added to the anchor
@return a content tree for the marker anchor... | java | public Content getMarkerAnchor(String anchorName, Content anchorContent) {
if (anchorContent == null)
anchorContent = new Comment(" ");
Content markerAnchor = HtmlTree.A(configuration.htmlVersion, anchorName, anchorContent);
return markerAnchor;
} | [
"public",
"Content",
"getMarkerAnchor",
"(",
"String",
"anchorName",
",",
"Content",
"anchorContent",
")",
"{",
"if",
"(",
"anchorContent",
"==",
"null",
")",
"anchorContent",
"=",
"new",
"Comment",
"(",
"\" \"",
")",
";",
"Content",
"markerAnchor",
"=",
"Html... | Get the marker anchor which will be added to the documentation tree.
@param anchorName the anchor name or id attribute
@param anchorContent the content that should be added to the anchor
@return a content tree for the marker anchor | [
"Get",
"the",
"marker",
"anchor",
"which",
"will",
"be",
"added",
"to",
"the",
"documentation",
"tree",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L839-L844 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java | StructureTools.hasDeuteratedEquiv | public static boolean hasDeuteratedEquiv(Atom atom, Group currentGroup) {
"""
Check to see if a Hydrogen has a Deuterated brother in the group.
@param atom the input atom that is putatively hydorgen
@param currentGroup the group the atom is in
@return true if the atom is hydrogen and it's Deuterium equiv exist... | java | public static boolean hasDeuteratedEquiv(Atom atom, Group currentGroup) {
if(atom.getElement()==Element.H && currentGroup.hasAtom(replaceFirstChar(atom.getName(),'H', 'D'))) {
// If it's hydrogen and has a deuterated brother
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"hasDeuteratedEquiv",
"(",
"Atom",
"atom",
",",
"Group",
"currentGroup",
")",
"{",
"if",
"(",
"atom",
".",
"getElement",
"(",
")",
"==",
"Element",
".",
"H",
"&&",
"currentGroup",
".",
"hasAtom",
"(",
"replaceFirstChar",
"(",
... | Check to see if a Hydrogen has a Deuterated brother in the group.
@param atom the input atom that is putatively hydorgen
@param currentGroup the group the atom is in
@return true if the atom is hydrogen and it's Deuterium equiv exists. | [
"Check",
"to",
"see",
"if",
"a",
"Hydrogen",
"has",
"a",
"Deuterated",
"brother",
"in",
"the",
"group",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java#L1909-L1915 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/OpMapVector.java | OpMapVector.setElementAt | public final void setElementAt(int value, int index) {
"""
Sets the component at the specified index of this vector to be the
specified object. The previous component at that position is discarded.
The index must be a value greater than or equal to 0 and less
than the current size of the vector.
@param val... | java | public final void setElementAt(int value, int index)
{
if (index >= m_mapSize)
{
int oldSize = m_mapSize;
m_mapSize += m_blocksize;
int newMap[] = new int[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, oldSize);
m_map = newMap;
}
m_map[index] = value;
} | [
"public",
"final",
"void",
"setElementAt",
"(",
"int",
"value",
",",
"int",
"index",
")",
"{",
"if",
"(",
"index",
">=",
"m_mapSize",
")",
"{",
"int",
"oldSize",
"=",
"m_mapSize",
";",
"m_mapSize",
"+=",
"m_blocksize",
";",
"int",
"newMap",
"[",
"]",
"... | Sets the component at the specified index of this vector to be the
specified object. The previous component at that position is discarded.
The index must be a value greater than or equal to 0 and less
than the current size of the vector.
@param value object to set
@param index Index of where to set the object | [
"Sets",
"the",
"component",
"at",
"the",
"specified",
"index",
"of",
"this",
"vector",
"to",
"be",
"the",
"specified",
"object",
".",
"The",
"previous",
"component",
"at",
"that",
"position",
"is",
"discarded",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/OpMapVector.java#L81-L97 |
transloadit/java-sdk | src/main/java/com/transloadit/sdk/Steps.java | Steps.addStep | public void addStep(String name, String robot, Map<String, Object> options) {
"""
Adds a new step to the list of steps.
@param name Name of the step to add.
@param robot The name of the robot ot use with the step.
@param options extra options required for the step.
"""
all.put(name, new Step(name,... | java | public void addStep(String name, String robot, Map<String, Object> options) {
all.put(name, new Step(name, robot, options));
} | [
"public",
"void",
"addStep",
"(",
"String",
"name",
",",
"String",
"robot",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"options",
")",
"{",
"all",
".",
"put",
"(",
"name",
",",
"new",
"Step",
"(",
"name",
",",
"robot",
",",
"options",
")",
")",... | Adds a new step to the list of steps.
@param name Name of the step to add.
@param robot The name of the robot ot use with the step.
@param options extra options required for the step. | [
"Adds",
"a",
"new",
"step",
"to",
"the",
"list",
"of",
"steps",
"."
] | train | https://github.com/transloadit/java-sdk/blob/9326c540a66f77b3d907d0b2c05bff1145ca14f7/src/main/java/com/transloadit/sdk/Steps.java#L54-L56 |
lucee/Lucee | core/src/main/java/lucee/runtime/type/util/ListUtil.java | ListUtil.listFind | public static int listFind(String list, String value, String delimiter) {
"""
finds a value inside a list, do not case sensitive
@param list list to search
@param value value to find
@param delimiter delimiter of the list
@return position in list or 0
"""
Array arr = listToArrayTrim(list, delimiter);
i... | java | public static int listFind(String list, String value, String delimiter) {
Array arr = listToArrayTrim(list, delimiter);
int len = arr.size();
for (int i = 1; i <= len; i++) {
if (arr.get(i, "").equals(value)) return i - 1;
}
return -1;
} | [
"public",
"static",
"int",
"listFind",
"(",
"String",
"list",
",",
"String",
"value",
",",
"String",
"delimiter",
")",
"{",
"Array",
"arr",
"=",
"listToArrayTrim",
"(",
"list",
",",
"delimiter",
")",
";",
"int",
"len",
"=",
"arr",
".",
"size",
"(",
")"... | finds a value inside a list, do not case sensitive
@param list list to search
@param value value to find
@param delimiter delimiter of the list
@return position in list or 0 | [
"finds",
"a",
"value",
"inside",
"a",
"list",
"do",
"not",
"case",
"sensitive"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ListUtil.java#L729-L737 |
nextreports/nextreports-engine | src/ro/nextreports/integration/DemoUtil.java | DemoUtil.copyImages | public static void copyImages(Report report, String from, String to) {
"""
this must any folder taht is in the project classpath : PDF, EXCEL, RTF
"""
try {
List<String> images = ReportUtil.getStaticImages(report);
File destination = new File(to);
for (String image :... | java | public static void copyImages(Report report, String from, String to) {
try {
List<String> images = ReportUtil.getStaticImages(report);
File destination = new File(to);
for (String image : images) {
File f = new File(from + File.separator + image);
... | [
"public",
"static",
"void",
"copyImages",
"(",
"Report",
"report",
",",
"String",
"from",
",",
"String",
"to",
")",
"{",
"try",
"{",
"List",
"<",
"String",
">",
"images",
"=",
"ReportUtil",
".",
"getStaticImages",
"(",
"report",
")",
";",
"File",
"destin... | this must any folder taht is in the project classpath : PDF, EXCEL, RTF | [
"this",
"must",
"any",
"folder",
"taht",
"is",
"in",
"the",
"project",
"classpath",
":",
"PDF",
"EXCEL",
"RTF"
] | train | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/integration/DemoUtil.java#L103-L116 |
intel/jndn-utils | src/main/java/com/intel/jndn/utils/impl/SegmentationHelper.java | SegmentationHelper.removeSegment | public static Name removeSegment(Name name, byte marker) {
"""
Remove a segment component from the end of a name
@param name the name of a packet
@param marker the marker type (the initial byte of the component)
@return the new name with the segment component removed or a copy of the name if no segment compon... | java | public static Name removeSegment(Name name, byte marker) {
return isSegmented(name, marker) ? name.getPrefix(-1) : new Name(name);
} | [
"public",
"static",
"Name",
"removeSegment",
"(",
"Name",
"name",
",",
"byte",
"marker",
")",
"{",
"return",
"isSegmented",
"(",
"name",
",",
"marker",
")",
"?",
"name",
".",
"getPrefix",
"(",
"-",
"1",
")",
":",
"new",
"Name",
"(",
"name",
")",
";",... | Remove a segment component from the end of a name
@param name the name of a packet
@param marker the marker type (the initial byte of the component)
@return the new name with the segment component removed or a copy of the name if no segment component was present | [
"Remove",
"a",
"segment",
"component",
"from",
"the",
"end",
"of",
"a",
"name"
] | train | https://github.com/intel/jndn-utils/blob/7f670b259484c35d51a6c5acce5715b0573faedd/src/main/java/com/intel/jndn/utils/impl/SegmentationHelper.java#L82-L84 |
reactor/reactor-netty | src/main/java/reactor/netty/udp/UdpClient.java | UdpClient.doOnConnect | public final UdpClient doOnConnect(Consumer<? super Bootstrap> doOnConnect) {
"""
Setup a callback called when {@link io.netty.channel.Channel} is about to
connect.
@param doOnConnect a consumer observing client start event
@return a new {@link UdpClient}
"""
Objects.requireNonNull(doOnConnect, "doOnC... | java | public final UdpClient doOnConnect(Consumer<? super Bootstrap> doOnConnect) {
Objects.requireNonNull(doOnConnect, "doOnConnect");
return new UdpClientDoOn(this, doOnConnect, null, null);
} | [
"public",
"final",
"UdpClient",
"doOnConnect",
"(",
"Consumer",
"<",
"?",
"super",
"Bootstrap",
">",
"doOnConnect",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"doOnConnect",
",",
"\"doOnConnect\"",
")",
";",
"return",
"new",
"UdpClientDoOn",
"(",
"this",
... | Setup a callback called when {@link io.netty.channel.Channel} is about to
connect.
@param doOnConnect a consumer observing client start event
@return a new {@link UdpClient} | [
"Setup",
"a",
"callback",
"called",
"when",
"{",
"@link",
"io",
".",
"netty",
".",
"channel",
".",
"Channel",
"}",
"is",
"about",
"to",
"connect",
"."
] | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/udp/UdpClient.java#L180-L183 |
calimero-project/calimero-core | src/tuwien/auto/calimero/mgmt/ManagementClientImpl.java | ManagementClientImpl.waitForResponse | private byte[] waitForResponse(final IndividualAddress from, final int minAsduLen, final int maxAsduLen,
final long timeout) throws KNXInvalidResponseException, KNXTimeoutException, InterruptedException {
"""
min + max ASDU len are *not* including any field that contains ACPI
"""
return waitForResponse(fro... | java | private byte[] waitForResponse(final IndividualAddress from, final int minAsduLen, final int maxAsduLen,
final long timeout) throws KNXInvalidResponseException, KNXTimeoutException, InterruptedException
{
return waitForResponse(from, minAsduLen, maxAsduLen, timeout, Optional.empty());
} | [
"private",
"byte",
"[",
"]",
"waitForResponse",
"(",
"final",
"IndividualAddress",
"from",
",",
"final",
"int",
"minAsduLen",
",",
"final",
"int",
"maxAsduLen",
",",
"final",
"long",
"timeout",
")",
"throws",
"KNXInvalidResponseException",
",",
"KNXTimeoutException"... | min + max ASDU len are *not* including any field that contains ACPI | [
"min",
"+",
"max",
"ASDU",
"len",
"are",
"*",
"not",
"*",
"including",
"any",
"field",
"that",
"contains",
"ACPI"
] | train | https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/mgmt/ManagementClientImpl.java#L976-L980 |
facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java | PlatformBitmapFactory.checkFinalImageBounds | private static void checkFinalImageBounds(Bitmap source, int x, int y, int width, int height) {
"""
Common code for checking that x + width and y + height are within image bounds
@param source the source Bitmap
@param x starting x coordinate of source image subset
@param y starting y coordinate of source imag... | java | private static void checkFinalImageBounds(Bitmap source, int x, int y, int width, int height) {
Preconditions.checkArgument(
x + width <= source.getWidth(),
"x + width must be <= bitmap.width()");
Preconditions.checkArgument(
y + height <= source.getHeight(),
"y + height must be ... | [
"private",
"static",
"void",
"checkFinalImageBounds",
"(",
"Bitmap",
"source",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"x",
"+",
"width",
"<=",
"source",
".",
"get... | Common code for checking that x + width and y + height are within image bounds
@param source the source Bitmap
@param x starting x coordinate of source image subset
@param y starting y coordinate of source image subset
@param width width of the source image subset
@param height height of the source image subset | [
"Common",
"code",
"for",
"checking",
"that",
"x",
"+",
"width",
"and",
"y",
"+",
"height",
"are",
"within",
"image",
"bounds"
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java#L735-L742 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java | SourceToHTMLConverter.convertClass | public void convertClass(TypeElement te, DocPath outputdir)
throws DocFileIOException, SimpleDocletException {
"""
Convert the given Class to an HTML.
@param te the class to convert.
@param outputdir the name of the directory to output to
@throws DocFileIOException if there is a problem generating... | java | public void convertClass(TypeElement te, DocPath outputdir)
throws DocFileIOException, SimpleDocletException {
if (te == null) {
return;
}
FileObject fo = utils.getFileObject(te);
if (fo == null)
return;
try {
Reader r = fo.openRea... | [
"public",
"void",
"convertClass",
"(",
"TypeElement",
"te",
",",
"DocPath",
"outputdir",
")",
"throws",
"DocFileIOException",
",",
"SimpleDocletException",
"{",
"if",
"(",
"te",
"==",
"null",
")",
"{",
"return",
";",
"}",
"FileObject",
"fo",
"=",
"utils",
".... | Convert the given Class to an HTML.
@param te the class to convert.
@param outputdir the name of the directory to output to
@throws DocFileIOException if there is a problem generating the output file
@throws SimpleDocletException if there is a problem reading the source file | [
"Convert",
"the",
"given",
"Class",
"to",
"an",
"HTML",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java#L165-L198 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | XmlUtil.getByXPath | public static Object getByXPath(String expression, Object source, QName returnType) {
"""
通过XPath方式读取XML节点等信息<br>
Xpath相关文章:https://www.ibm.com/developerworks/cn/xml/x-javaxpathapi.html
@param expression XPath表达式
@param source 资源,可以是Docunent、Node节点等
@param returnType 返回类型,{@link javax.xml.xpath.XPathConstant... | java | public static Object getByXPath(String expression, Object source, QName returnType) {
final XPath xPath = createXPath();
try {
if (source instanceof InputSource) {
return xPath.evaluate(expression, (InputSource) source, returnType);
} else {
return xPath.evaluate(expression, source, returnType);... | [
"public",
"static",
"Object",
"getByXPath",
"(",
"String",
"expression",
",",
"Object",
"source",
",",
"QName",
"returnType",
")",
"{",
"final",
"XPath",
"xPath",
"=",
"createXPath",
"(",
")",
";",
"try",
"{",
"if",
"(",
"source",
"instanceof",
"InputSource"... | 通过XPath方式读取XML节点等信息<br>
Xpath相关文章:https://www.ibm.com/developerworks/cn/xml/x-javaxpathapi.html
@param expression XPath表达式
@param source 资源,可以是Docunent、Node节点等
@param returnType 返回类型,{@link javax.xml.xpath.XPathConstants}
@return 匹配返回类型的值
@since 3.2.0 | [
"通过XPath方式读取XML节点等信息<br",
">",
"Xpath相关文章:https",
":",
"//",
"www",
".",
"ibm",
".",
"com",
"/",
"developerworks",
"/",
"cn",
"/",
"xml",
"/",
"x",
"-",
"javaxpathapi",
".",
"html"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L612-L623 |
JodaOrg/joda-money | src/main/java/org/joda/money/format/MoneyFormatter.java | MoneyFormatter.printIO | public void printIO(Appendable appendable, BigMoneyProvider moneyProvider) throws IOException {
"""
Prints a monetary value to an {@code Appendable} potentially
throwing an {@code IOException}.
<p>
Example implementations of {@code Appendable} are {@code StringBuilder},
{@code StringBuffer} or {@code Writer}. ... | java | public void printIO(Appendable appendable, BigMoneyProvider moneyProvider) throws IOException {
checkNotNull(moneyProvider, "BigMoneyProvider must not be null");
if (isPrinter() == false) {
throw new UnsupportedOperationException("MoneyFomatter has not been configured to be able to print"... | [
"public",
"void",
"printIO",
"(",
"Appendable",
"appendable",
",",
"BigMoneyProvider",
"moneyProvider",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"moneyProvider",
",",
"\"BigMoneyProvider must not be null\"",
")",
";",
"if",
"(",
"isPrinter",
"(",
")",
... | Prints a monetary value to an {@code Appendable} potentially
throwing an {@code IOException}.
<p>
Example implementations of {@code Appendable} are {@code StringBuilder},
{@code StringBuffer} or {@code Writer}. Note that {@code StringBuilder}
and {@code StringBuffer} never throw an {@code IOException}.
@param appendab... | [
"Prints",
"a",
"monetary",
"value",
"to",
"an",
"{",
"@code",
"Appendable",
"}",
"potentially",
"throwing",
"an",
"{",
"@code",
"IOException",
"}",
".",
"<p",
">",
"Example",
"implementations",
"of",
"{",
"@code",
"Appendable",
"}",
"are",
"{",
"@code",
"S... | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/format/MoneyFormatter.java#L203-L212 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionsClient.java | SessionsClient.detectIntent | public final DetectIntentResponse detectIntent(SessionName session, QueryInput queryInput) {
"""
Processes a natural language query and returns structured, actionable data as a result. This
method is not idempotent, because it may cause contexts and session entity types to be updated,
which in turn might affect ... | java | public final DetectIntentResponse detectIntent(SessionName session, QueryInput queryInput) {
DetectIntentRequest request =
DetectIntentRequest.newBuilder()
.setSession(session == null ? null : session.toString())
.setQueryInput(queryInput)
.build();
return detectInte... | [
"public",
"final",
"DetectIntentResponse",
"detectIntent",
"(",
"SessionName",
"session",
",",
"QueryInput",
"queryInput",
")",
"{",
"DetectIntentRequest",
"request",
"=",
"DetectIntentRequest",
".",
"newBuilder",
"(",
")",
".",
"setSession",
"(",
"session",
"==",
"... | Processes a natural language query and returns structured, actionable data as a result. This
method is not idempotent, because it may cause contexts and session entity types to be updated,
which in turn might affect results of future queries.
<p>Sample code:
<pre><code>
try (SessionsClient sessionsClient = SessionsCl... | [
"Processes",
"a",
"natural",
"language",
"query",
"and",
"returns",
"structured",
"actionable",
"data",
"as",
"a",
"result",
".",
"This",
"method",
"is",
"not",
"idempotent",
"because",
"it",
"may",
"cause",
"contexts",
"and",
"session",
"entity",
"types",
"to... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionsClient.java#L177-L185 |
xmlunit/xmlunit | xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java | XMLAssert.assertXMLIdentical | public static void assertXMLIdentical(String msg, Diff diff, boolean assertion) {
"""
Assert that the result of an XML comparison is or is not identical
@param msg Message to display if assertion fails
@param diff the result of an XML comparison
@param assertion true if asserting that result is identical
""... | java | public static void assertXMLIdentical(String msg, Diff diff, boolean assertion) {
if (assertion != diff.identical()) {
fail(getFailMessage(msg, diff));
}
} | [
"public",
"static",
"void",
"assertXMLIdentical",
"(",
"String",
"msg",
",",
"Diff",
"diff",
",",
"boolean",
"assertion",
")",
"{",
"if",
"(",
"assertion",
"!=",
"diff",
".",
"identical",
"(",
")",
")",
"{",
"fail",
"(",
"getFailMessage",
"(",
"msg",
","... | Assert that the result of an XML comparison is or is not identical
@param msg Message to display if assertion fails
@param diff the result of an XML comparison
@param assertion true if asserting that result is identical | [
"Assert",
"that",
"the",
"result",
"of",
"an",
"XML",
"comparison",
"is",
"or",
"is",
"not",
"identical"
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java#L156-L160 |
alkacon/opencms-core | src/org/opencms/staticexport/CmsStaticExportManager.java | CmsStaticExportManager.isSecureLink | public boolean isSecureLink(CmsObject cms, String vfsName, String siteRoot, boolean fromSecure) {
"""
Returns <code>true</code> if the given VFS resource should be transported through a secure channel.<p>
The secure mode is only checked in the "Online" project.
If the given OpenCms context is currently not in ... | java | public boolean isSecureLink(CmsObject cms, String vfsName, String siteRoot, boolean fromSecure) {
if (siteRoot == null) {
return isSecureLink(cms, vfsName, fromSecure);
}
// the site root of the cms object has to be changed so that the property can be read
String storedSite... | [
"public",
"boolean",
"isSecureLink",
"(",
"CmsObject",
"cms",
",",
"String",
"vfsName",
",",
"String",
"siteRoot",
",",
"boolean",
"fromSecure",
")",
"{",
"if",
"(",
"siteRoot",
"==",
"null",
")",
"{",
"return",
"isSecureLink",
"(",
"cms",
",",
"vfsName",
... | Returns <code>true</code> if the given VFS resource should be transported through a secure channel.<p>
The secure mode is only checked in the "Online" project.
If the given OpenCms context is currently not in the "Online" project,
<code>false</code> is returned.<p>
The given resource is read from the site root of the... | [
"Returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"the",
"given",
"VFS",
"resource",
"should",
"be",
"transported",
"through",
"a",
"secure",
"channel",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsStaticExportManager.java#L2026-L2040 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java | TwitterEndpointServices.computeSignature | public String computeSignature(String requestMethod, String targetUrl, Map<String, String> params, @Sensitive String consumerSecret, @Sensitive String tokenSecret) {
"""
Computes the signature for an authorized request per {@link https://dev.twitter.com/oauth/overview/creating-signatures}
@param requestMethod
... | java | public String computeSignature(String requestMethod, String targetUrl, Map<String, String> params, @Sensitive String consumerSecret, @Sensitive String tokenSecret) {
String signatureBaseString = createSignatureBaseString(requestMethod, targetUrl, params);
// Hash the base string using the consumer sec... | [
"public",
"String",
"computeSignature",
"(",
"String",
"requestMethod",
",",
"String",
"targetUrl",
",",
"Map",
"<",
"String",
",",
"String",
">",
"params",
",",
"@",
"Sensitive",
"String",
"consumerSecret",
",",
"@",
"Sensitive",
"String",
"tokenSecret",
")",
... | Computes the signature for an authorized request per {@link https://dev.twitter.com/oauth/overview/creating-signatures}
@param requestMethod
@param targetUrl
@param params
@param consumerSecret
@param tokenSecret
@return | [
"Computes",
"the",
"signature",
"for",
"an",
"authorized",
"request",
"per",
"{",
"@link",
"https",
":",
"//",
"dev",
".",
"twitter",
".",
"com",
"/",
"oauth",
"/",
"overview",
"/",
"creating",
"-",
"signatures",
"}"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java#L119-L146 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java | HttpHeaderMap.setDateHeader | public void setDateHeader (@Nonnull @Nonempty final String sName, final long nMillis) {
"""
Set the passed header as a date header.
@param sName
Header name. May neither be <code>null</code> nor empty.
@param nMillis
The milliseconds to set as a date.
"""
setDateHeader (sName, PDTFactory.createZonedD... | java | public void setDateHeader (@Nonnull @Nonempty final String sName, final long nMillis)
{
setDateHeader (sName, PDTFactory.createZonedDateTime (nMillis));
} | [
"public",
"void",
"setDateHeader",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sName",
",",
"final",
"long",
"nMillis",
")",
"{",
"setDateHeader",
"(",
"sName",
",",
"PDTFactory",
".",
"createZonedDateTime",
"(",
"nMillis",
")",
")",
";",
"}"
] | Set the passed header as a date header.
@param sName
Header name. May neither be <code>null</code> nor empty.
@param nMillis
The milliseconds to set as a date. | [
"Set",
"the",
"passed",
"header",
"as",
"a",
"date",
"header",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java#L237-L240 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/limiter/DefaultLimiterFactory.java | DefaultLimiterFactory.newLimiter | public static Limiter newLimiter(State state) {
"""
Create a new {@link Limiter} instance of one of the types in {@link BaseLimiterType}.
<p>
Note this method will always return a new {@link Limiter} instance of one of the supported types defined
in {@link BaseLimiterType} as long as the input configuration s... | java | public static Limiter newLimiter(State state) {
state = convertDeprecatedConfigs(state);
Preconditions.checkArgument(state.contains(EXTRACT_LIMIT_TYPE_KEY),
String.format("Missing configuration property %s for the Limiter type", EXTRACT_LIMIT_TYPE_KEY));
BaseLimiterType type = BaseLimiterType.forNam... | [
"public",
"static",
"Limiter",
"newLimiter",
"(",
"State",
"state",
")",
"{",
"state",
"=",
"convertDeprecatedConfigs",
"(",
"state",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"state",
".",
"contains",
"(",
"EXTRACT_LIMIT_TYPE_KEY",
")",
",",
"String... | Create a new {@link Limiter} instance of one of the types in {@link BaseLimiterType}.
<p>
Note this method will always return a new {@link Limiter} instance of one of the supported types defined
in {@link BaseLimiterType} as long as the input configuration specifies a supported {@link BaseLimiterType}.
It will throw a... | [
"Create",
"a",
"new",
"{",
"@link",
"Limiter",
"}",
"instance",
"of",
"one",
"of",
"the",
"types",
"in",
"{",
"@link",
"BaseLimiterType",
"}",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/limiter/DefaultLimiterFactory.java#L79-L113 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.waitTask | public void waitTask(String taskID, long timeToWait, RequestOptions requestOptions) throws AlgoliaException {
"""
Wait the publication of a task on the server.
All server task are asynchronous and you can check with this method that the task is published.
@param taskID the id of the task returned by se... | java | public void waitTask(String taskID, long timeToWait, RequestOptions requestOptions) throws AlgoliaException {
try {
while (true) {
JSONObject obj = client.getRequest("/1/indexes/" + encodedIndexName + "/task/" + URLEncoder.encode(taskID, "UTF-8"), false, requestOptions);
if (obj.getString("sta... | [
"public",
"void",
"waitTask",
"(",
"String",
"taskID",
",",
"long",
"timeToWait",
",",
"RequestOptions",
"requestOptions",
")",
"throws",
"AlgoliaException",
"{",
"try",
"{",
"while",
"(",
"true",
")",
"{",
"JSONObject",
"obj",
"=",
"client",
".",
"getRequest"... | Wait the publication of a task on the server.
All server task are asynchronous and you can check with this method that the task is published.
@param taskID the id of the task returned by server
@param timeToWait time to sleep seed
@param requestOptions Options to pass to this request | [
"Wait",
"the",
"publication",
"of",
"a",
"task",
"on",
"the",
"server",
".",
"All",
"server",
"task",
"are",
"asynchronous",
"and",
"you",
"can",
"check",
"with",
"this",
"method",
"that",
"the",
"task",
"is",
"published",
"."
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L853-L871 |
apptik/jus | benchmark/src/perf/java/com/android/volley/toolbox/DiskBasedCache.java | DiskBasedCache.putEntry | private void putEntry(String key, CacheHeader entry) {
"""
Puts the entry with the specified key into the cache.
@param key The key to identify the entry by.
@param entry The entry to cache.
"""
if (!mEntries.containsKey(key)) {
mTotalSize += entry.size;
} else {
Cache... | java | private void putEntry(String key, CacheHeader entry) {
if (!mEntries.containsKey(key)) {
mTotalSize += entry.size;
} else {
CacheHeader oldEntry = mEntries.get(key);
mTotalSize += (entry.size - oldEntry.size);
}
mEntries.put(key, entry);
} | [
"private",
"void",
"putEntry",
"(",
"String",
"key",
",",
"CacheHeader",
"entry",
")",
"{",
"if",
"(",
"!",
"mEntries",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"mTotalSize",
"+=",
"entry",
".",
"size",
";",
"}",
"else",
"{",
"CacheHeader",
"oldE... | Puts the entry with the specified key into the cache.
@param key The key to identify the entry by.
@param entry The entry to cache. | [
"Puts",
"the",
"entry",
"with",
"the",
"specified",
"key",
"into",
"the",
"cache",
"."
] | train | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/benchmark/src/perf/java/com/android/volley/toolbox/DiskBasedCache.java#L300-L308 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java | ArrayHelper.getConcatenated | @Nonnull
@ReturnsMutableCopy
public static <ELEMENTTYPE> ELEMENTTYPE [] getConcatenated (@Nullable final ELEMENTTYPE aHead,
@Nullable final ELEMENTTYPE [] aTailArray,
@Nonnull final Class <ELE... | java | @Nonnull
@ReturnsMutableCopy
public static <ELEMENTTYPE> ELEMENTTYPE [] getConcatenated (@Nullable final ELEMENTTYPE aHead,
@Nullable final ELEMENTTYPE [] aTailArray,
@Nonnull final Class <ELE... | [
"@",
"Nonnull",
"@",
"ReturnsMutableCopy",
"public",
"static",
"<",
"ELEMENTTYPE",
">",
"ELEMENTTYPE",
"[",
"]",
"getConcatenated",
"(",
"@",
"Nullable",
"final",
"ELEMENTTYPE",
"aHead",
",",
"@",
"Nullable",
"final",
"ELEMENTTYPE",
"[",
"]",
"aTailArray",
",",
... | Get a new array that combines the passed head and the array. The head
element will be the first element of the created array.
@param <ELEMENTTYPE>
Array element type
@param aHead
The first element of the result array. If this element is
<code>null</code> it will be inserted as such into the array!
@param aTailArray
Th... | [
"Get",
"a",
"new",
"array",
"that",
"combines",
"the",
"passed",
"head",
"and",
"the",
"array",
".",
"The",
"head",
"element",
"will",
"be",
"the",
"first",
"element",
"of",
"the",
"created",
"array",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java#L1961-L1975 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java | MultiViewOps.inducedHomography12 | public static DMatrixRMaj inducedHomography12( TrifocalTensor tensor ,
Vector3D_F64 line3 ,
DMatrixRMaj output ) {
"""
Computes the homography induced from view 1 to 2 by a line in view 3. The provided line in
view 3 must contain the view 3 observation.
p2 = H12*p1
@param tens... | java | public static DMatrixRMaj inducedHomography12( TrifocalTensor tensor ,
Vector3D_F64 line3 ,
DMatrixRMaj output ) {
if( output == null )
output = new DMatrixRMaj(3,3);
// H(:,0) = T1*line
DMatrixRMaj T = tensor.T1;
output.data[0] = T.data[0]*line3.x + T.data[1]*line3.y + T.data[... | [
"public",
"static",
"DMatrixRMaj",
"inducedHomography12",
"(",
"TrifocalTensor",
"tensor",
",",
"Vector3D_F64",
"line3",
",",
"DMatrixRMaj",
"output",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"output",
"=",
"new",
"DMatrixRMaj",
"(",
"3",
",",
"3",
... | Computes the homography induced from view 1 to 2 by a line in view 3. The provided line in
view 3 must contain the view 3 observation.
p2 = H12*p1
@param tensor Input: Trifocal tensor
@param line3 Input: Line in view 3. {@link LineGeneral2D_F64 General notation}.
@param output Output: Optional storage for homograph... | [
"Computes",
"the",
"homography",
"induced",
"from",
"view",
"1",
"to",
"2",
"by",
"a",
"line",
"in",
"view",
"3",
".",
"The",
"provided",
"line",
"in",
"view",
"3",
"must",
"contain",
"the",
"view",
"3",
"observation",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L486-L520 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java | AbstractIndexWriter.addDescription | protected void addDescription(PackageElement pkg, Content dlTree, SearchIndexItem si) {
"""
Add one line summary comment for the package.
@param pkg the package to be documented
@param dlTree the content tree to which the description will be added
@param si the search index item to be updated
"""
... | java | protected void addDescription(PackageElement pkg, Content dlTree, SearchIndexItem si) {
Content link = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
if (configuration.showModules) {
si.setContainingModule(utils.getFullyQualifiedName(utils.containingModule(pkg)));
... | [
"protected",
"void",
"addDescription",
"(",
"PackageElement",
"pkg",
",",
"Content",
"dlTree",
",",
"SearchIndexItem",
"si",
")",
"{",
"Content",
"link",
"=",
"getPackageLink",
"(",
"pkg",
",",
"new",
"StringContent",
"(",
"utils",
".",
"getPackageName",
"(",
... | Add one line summary comment for the package.
@param pkg the package to be documented
@param dlTree the content tree to which the description will be added
@param si the search index item to be updated | [
"Add",
"one",
"line",
"summary",
"comment",
"for",
"the",
"package",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java#L248-L263 |
fabric8io/kubernetes-client | kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesResourceUtil.java | KubernetesResourceUtil.isValidLabelOrAnnotation | public static boolean isValidLabelOrAnnotation(Map<String, String> map) {
"""
Validates labels/annotations of Kubernetes resources
@param map Label/Annotation of resource
@return returns a boolean value inidicating whether it's valid or not
"""
for(Map.Entry<String, String> entry : map.entrySet()) {
... | java | public static boolean isValidLabelOrAnnotation(Map<String, String> map) {
for(Map.Entry<String, String> entry : map.entrySet()) {
if(!(isValidName(entry.getKey()) && isValidName(entry.getValue()))) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isValidLabelOrAnnotation",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"map",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"map",
".",
"entrySet",
"(",
")",
")",
"{",
"... | Validates labels/annotations of Kubernetes resources
@param map Label/Annotation of resource
@return returns a boolean value inidicating whether it's valid or not | [
"Validates",
"labels",
"/",
"annotations",
"of",
"Kubernetes",
"resources"
] | train | https://github.com/fabric8io/kubernetes-client/blob/141668a882ed8e902c045a5cd0a80f14bd17d132/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesResourceUtil.java#L270-L277 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java | LiveEventsInner.updateAsync | public Observable<LiveEventInner> updateAsync(String resourceGroupName, String accountName, String liveEventName, LiveEventInner parameters) {
"""
Updates a existing Live Event.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account ... | java | public Observable<LiveEventInner> updateAsync(String resourceGroupName, String accountName, String liveEventName, LiveEventInner parameters) {
return updateWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, parameters).map(new Func1<ServiceResponse<LiveEventInner>, LiveEventInner>() {
... | [
"public",
"Observable",
"<",
"LiveEventInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"liveEventName",
",",
"LiveEventInner",
"parameters",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resource... | Updates a existing Live Event.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param liveEventName The name of the Live Event.
@param parameters Live Event properties needed for creation.
@throws IllegalArgumentException thrown... | [
"Updates",
"a",
"existing",
"Live",
"Event",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java#L785-L792 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java | TheMovieDbApi.postTVRating | public StatusCode postTVRating(int tvID, int rating, String sessionID, String guestSessionID) throws MovieDbException {
"""
This method lets users rate a TV show.
A valid session id or guest session id is required.
@param tvID tvID
@param rating rating
@param sessionID sessionID
@param guestSessionID gues... | java | public StatusCode postTVRating(int tvID, int rating, String sessionID, String guestSessionID) throws MovieDbException {
return tmdbTv.postTVRating(tvID, rating, sessionID, guestSessionID);
} | [
"public",
"StatusCode",
"postTVRating",
"(",
"int",
"tvID",
",",
"int",
"rating",
",",
"String",
"sessionID",
",",
"String",
"guestSessionID",
")",
"throws",
"MovieDbException",
"{",
"return",
"tmdbTv",
".",
"postTVRating",
"(",
"tvID",
",",
"rating",
",",
"se... | This method lets users rate a TV show.
A valid session id or guest session id is required.
@param tvID tvID
@param rating rating
@param sessionID sessionID
@param guestSessionID guestSessionID
@return
@throws com.omertron.themoviedbapi.MovieDbException | [
"This",
"method",
"lets",
"users",
"rate",
"a",
"TV",
"show",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1549-L1551 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java | ValueFactoryImpl.loadValue | public Value loadValue(ValueData data, int type) throws RepositoryException {
"""
Creates new Value object using ValueData
@param data
ValueData
@param type
int
@return Value
@throws RepositoryException
if error
"""
try
{
switch (type)
{
case PropertyType.STRI... | java | public Value loadValue(ValueData data, int type) throws RepositoryException
{
try
{
switch (type)
{
case PropertyType.STRING :
return new StringValue(data);
case PropertyType.BINARY :
return new BinaryValue(data, spoolConfig);
... | [
"public",
"Value",
"loadValue",
"(",
"ValueData",
"data",
",",
"int",
"type",
")",
"throws",
"RepositoryException",
"{",
"try",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"PropertyType",
".",
"STRING",
":",
"return",
"new",
"StringValue",
"(",
"data",
"... | Creates new Value object using ValueData
@param data
ValueData
@param type
int
@return Value
@throws RepositoryException
if error | [
"Creates",
"new",
"Value",
"object",
"using",
"ValueData"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java#L374-L410 |
scalecube/scalecube-services | services-gateway-clientsdk/src/main/java/io/scalecube/services/gateway/clientsdk/Client.java | Client.forService | public <T> T forService(Class<T> serviceClazz, ClientErrorMapper errorMapper) {
"""
Proxy creator function.
@param serviceClazz service interface.
@param errorMapper error mapper.
@param <T> type of service interface.
@return proxied service object.
"""
// noinspection unchecked
return (T)
... | java | public <T> T forService(Class<T> serviceClazz, ClientErrorMapper errorMapper) {
// noinspection unchecked
return (T)
proxyMap.computeIfAbsent(
serviceClazz,
(clazz) -> {
Map<Method, MethodInfo> methods = Reflect.methodsInfo(serviceClazz);
return Proxy.... | [
"public",
"<",
"T",
">",
"T",
"forService",
"(",
"Class",
"<",
"T",
">",
"serviceClazz",
",",
"ClientErrorMapper",
"errorMapper",
")",
"{",
"// noinspection unchecked",
"return",
"(",
"T",
")",
"proxyMap",
".",
"computeIfAbsent",
"(",
"serviceClazz",
",",
"(",... | Proxy creator function.
@param serviceClazz service interface.
@param errorMapper error mapper.
@param <T> type of service interface.
@return proxied service object. | [
"Proxy",
"creator",
"function",
"."
] | train | https://github.com/scalecube/scalecube-services/blob/76c8de6019e5480a1436d12b37acf163f70eea47/services-gateway-clientsdk/src/main/java/io/scalecube/services/gateway/clientsdk/Client.java#L139-L150 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/DoubleCheckedLocking.java | DoubleCheckedLocking.handleField | private Description handleField(IfTree outerIf, VarSymbol sym, VisitorState state) {
"""
Report a {@link Description} if a field used in double-checked locking is not volatile.
<p>If the AST node for the field declaration can be located in the current compilation unit,
suggest adding the volatile modifier.
... | java | private Description handleField(IfTree outerIf, VarSymbol sym, VisitorState state) {
if (sym.getModifiers().contains(Modifier.VOLATILE)) {
return Description.NO_MATCH;
}
if (isImmutable(sym.type, state)) {
return Description.NO_MATCH;
}
Description.Builder builder = buildDescription(oute... | [
"private",
"Description",
"handleField",
"(",
"IfTree",
"outerIf",
",",
"VarSymbol",
"sym",
",",
"VisitorState",
"state",
")",
"{",
"if",
"(",
"sym",
".",
"getModifiers",
"(",
")",
".",
"contains",
"(",
"Modifier",
".",
"VOLATILE",
")",
")",
"{",
"return",... | Report a {@link Description} if a field used in double-checked locking is not volatile.
<p>If the AST node for the field declaration can be located in the current compilation unit,
suggest adding the volatile modifier. | [
"Report",
"a",
"{",
"@link",
"Description",
"}",
"if",
"a",
"field",
"used",
"in",
"double",
"-",
"checked",
"locking",
"is",
"not",
"volatile",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/DoubleCheckedLocking.java#L87-L100 |
protegeproject/sparql-dl-api | src/main/java/de/derivo/sparqldlapi/impl/QueryEngineImpl.java | QueryEngineImpl.combineResults | private QueryResultImpl combineResults(Queue<QueryResultImpl> results, boolean distinct) {
"""
Combine the results of the individual components with the cartesian product.
@return the combined result
"""
while (results.size() > 1) {
QueryResultImpl a = results.remove();
Query... | java | private QueryResultImpl combineResults(Queue<QueryResultImpl> results, boolean distinct) {
while (results.size() > 1) {
QueryResultImpl a = results.remove();
QueryResultImpl b = results.remove();
results.add(combineResults(a, b, distinct));
}
return results.r... | [
"private",
"QueryResultImpl",
"combineResults",
"(",
"Queue",
"<",
"QueryResultImpl",
">",
"results",
",",
"boolean",
"distinct",
")",
"{",
"while",
"(",
"results",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"QueryResultImpl",
"a",
"=",
"results",
".",
"re... | Combine the results of the individual components with the cartesian product.
@return the combined result | [
"Combine",
"the",
"results",
"of",
"the",
"individual",
"components",
"with",
"the",
"cartesian",
"product",
"."
] | train | https://github.com/protegeproject/sparql-dl-api/blob/80d430d439e17a691d0111819af2d3613e28d625/src/main/java/de/derivo/sparqldlapi/impl/QueryEngineImpl.java#L273-L281 |
k3po/k3po | specification/socks5/src/main/java/org/kaazing/specification/socks5/internal/Functions.java | Functions.verifyMIC | @Function
public static boolean verifyMIC(GSSContext context, MessageProp prop, byte[] message, byte[] mic) {
"""
Verify a message integrity check sent by a peer. If the MIC correctly identifies the
message then the peer knows that the remote peer correctly received the message.
@param context GSSContext fo... | java | @Function
public static boolean verifyMIC(GSSContext context, MessageProp prop, byte[] message, byte[] mic) {
try {
context.verifyMIC(mic, 0, mic.length,
message, 0, message.length,
prop);
return true;
} catch (GSSException ex) {
... | [
"@",
"Function",
"public",
"static",
"boolean",
"verifyMIC",
"(",
"GSSContext",
"context",
",",
"MessageProp",
"prop",
",",
"byte",
"[",
"]",
"message",
",",
"byte",
"[",
"]",
"mic",
")",
"{",
"try",
"{",
"context",
".",
"verifyMIC",
"(",
"mic",
",",
"... | Verify a message integrity check sent by a peer. If the MIC correctly identifies the
message then the peer knows that the remote peer correctly received the message.
@param context GSSContext for which a connection has been established to the remote peer
@param prop the MessageProp that was used to wrap the original m... | [
"Verify",
"a",
"message",
"integrity",
"check",
"sent",
"by",
"a",
"peer",
".",
"If",
"the",
"MIC",
"correctly",
"identifies",
"the",
"message",
"then",
"the",
"peer",
"knows",
"that",
"the",
"remote",
"peer",
"correctly",
"received",
"the",
"message",
"."
] | train | https://github.com/k3po/k3po/blob/3ca4fd31ab4a397893aa640c62ada0e485c8bbd4/specification/socks5/src/main/java/org/kaazing/specification/socks5/internal/Functions.java#L157-L168 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java | PageFlowRequestProcessor.getPageFlowScopedFormMember | private Field getPageFlowScopedFormMember( ActionMapping mapping, HttpServletRequest request ) {
"""
See if this action mapping is our custom config type, and if so, see if the action should use a member variable
in the page flow controller as its form bean (the <code>useFormBean</code> attribute on
<code>@J... | java | private Field getPageFlowScopedFormMember( ActionMapping mapping, HttpServletRequest request )
{
if ( mapping instanceof PageFlowActionMapping )
{
PageFlowActionMapping pfam = ( PageFlowActionMapping ) mapping;
String formMember = pfam.getFormMember();
if ( formMe... | [
"private",
"Field",
"getPageFlowScopedFormMember",
"(",
"ActionMapping",
"mapping",
",",
"HttpServletRequest",
"request",
")",
"{",
"if",
"(",
"mapping",
"instanceof",
"PageFlowActionMapping",
")",
"{",
"PageFlowActionMapping",
"pfam",
"=",
"(",
"PageFlowActionMapping",
... | See if this action mapping is our custom config type, and if so, see if the action should use a member variable
in the page flow controller as its form bean (the <code>useFormBean</code> attribute on
<code>@Jpf.Action</code>). If so, return the appropriate Field in the controller class. | [
"See",
"if",
"this",
"action",
"mapping",
"is",
"our",
"custom",
"config",
"type",
"and",
"if",
"so",
"see",
"if",
"the",
"action",
"should",
"use",
"a",
"member",
"variable",
"in",
"the",
"page",
"flow",
"controller",
"as",
"its",
"form",
"bean",
"(",
... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java#L148-L178 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfStamper.java | PdfStamper.addFileAttachment | public void addFileAttachment(String description, PdfFileSpecification fs) throws IOException {
"""
Adds a file attachment at the document level. Existing attachments will be kept.
@param description the file description
@param fs the file specification
"""
stamper.addFileAttachment(description, fs);... | java | public void addFileAttachment(String description, PdfFileSpecification fs) throws IOException {
stamper.addFileAttachment(description, fs);
} | [
"public",
"void",
"addFileAttachment",
"(",
"String",
"description",
",",
"PdfFileSpecification",
"fs",
")",
"throws",
"IOException",
"{",
"stamper",
".",
"addFileAttachment",
"(",
"description",
",",
"fs",
")",
";",
"}"
] | Adds a file attachment at the document level. Existing attachments will be kept.
@param description the file description
@param fs the file specification | [
"Adds",
"a",
"file",
"attachment",
"at",
"the",
"document",
"level",
".",
"Existing",
"attachments",
"will",
"be",
"kept",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfStamper.java#L511-L513 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.importCertificateAsync | public Observable<CertificateBundle> importCertificateAsync(String vaultBaseUrl, String certificateName, String base64EncodedCertificate, String password, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags) {
"""
Imports a certificate into a specified key vau... | java | public Observable<CertificateBundle> importCertificateAsync(String vaultBaseUrl, String certificateName, String base64EncodedCertificate, String password, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags) {
return importCertificateWithServiceResponseAsyn... | [
"public",
"Observable",
"<",
"CertificateBundle",
">",
"importCertificateAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
",",
"String",
"base64EncodedCertificate",
",",
"String",
"password",
",",
"CertificatePolicy",
"certificatePolicy",
",",
"Cer... | Imports a certificate into a specified key vault.
Imports an existing valid certificate, containing a private key, into Azure Key Vault. The certificate to be imported can be in either PFX or PEM format. If the certificate is in PEM format the PEM file must contain the key as well as x509 certificates. This operation r... | [
"Imports",
"a",
"certificate",
"into",
"a",
"specified",
"key",
"vault",
".",
"Imports",
"an",
"existing",
"valid",
"certificate",
"containing",
"a",
"private",
"key",
"into",
"Azure",
"Key",
"Vault",
".",
"The",
"certificate",
"to",
"be",
"imported",
"can",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L6823-L6830 |
Talend/tesb-rt-se | locator/src/main/java/org/talend/esb/servicelocator/cxf/internal/CXFEndpointProvider.java | CXFEndpointProvider.serializeEPR | private void serializeEPR(EndpointReferenceType wsAddr, Node parent) throws ServiceLocatorException {
"""
Inserts a marshalled endpoint reference to a given DOM tree rooted by parent.
@param wsAddr
@param parent
@throws ServiceLocatorException
"""
try {
JAXBElement<EndpointReferenceType>... | java | private void serializeEPR(EndpointReferenceType wsAddr, Node parent) throws ServiceLocatorException {
try {
JAXBElement<EndpointReferenceType> ep =
WSA_OBJECT_FACTORY.createEndpointReference(wsAddr);
createMarshaller().marshal(ep, parent);
} catch (JAXBException e... | [
"private",
"void",
"serializeEPR",
"(",
"EndpointReferenceType",
"wsAddr",
",",
"Node",
"parent",
")",
"throws",
"ServiceLocatorException",
"{",
"try",
"{",
"JAXBElement",
"<",
"EndpointReferenceType",
">",
"ep",
"=",
"WSA_OBJECT_FACTORY",
".",
"createEndpointReference"... | Inserts a marshalled endpoint reference to a given DOM tree rooted by parent.
@param wsAddr
@param parent
@throws ServiceLocatorException | [
"Inserts",
"a",
"marshalled",
"endpoint",
"reference",
"to",
"a",
"given",
"DOM",
"tree",
"rooted",
"by",
"parent",
"."
] | train | https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/locator/src/main/java/org/talend/esb/servicelocator/cxf/internal/CXFEndpointProvider.java#L205-L217 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getColorInfo | public void getColorInfo(int[] ids, Callback<List<Color>> callback) throws GuildWars2Exception, NullPointerException {
"""
For more info on Color API go <a href="https://wiki.guildwars2.com/wiki/API:2/colors">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onF... | java | public void getColorInfo(int[] ids, Callback<List<Color>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getColorInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | [
"public",
"void",
"getColorInfo",
"(",
"int",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"Color",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"ids",
"... | For more info on Color API go <a href="https://wiki.guildwars2.com/wiki/API:2/colors">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of color id
@param callback callback that is going... | [
"For",
"more",
"info",
"on",
"Color",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"colors",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"user",
"th... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L889-L892 |
apache/incubator-atlas | webapp/src/main/java/org/apache/atlas/web/service/SecureEmbeddedServer.java | SecureEmbeddedServer.getPassword | private String getPassword(org.apache.commons.configuration.Configuration config, String key) throws IOException {
"""
Retrieves a password from a configured credential provider or prompts for the password and stores it in the
configured credential provider.
@param config application configuration
@param key th... | java | private String getPassword(org.apache.commons.configuration.Configuration config, String key) throws IOException {
String password;
String provider = config.getString(CERT_STORES_CREDENTIAL_PROVIDER_PATH);
if (provider != null) {
LOG.info("Attempting to retrieve password from confi... | [
"private",
"String",
"getPassword",
"(",
"org",
".",
"apache",
".",
"commons",
".",
"configuration",
".",
"Configuration",
"config",
",",
"String",
"key",
")",
"throws",
"IOException",
"{",
"String",
"password",
";",
"String",
"provider",
"=",
"config",
".",
... | Retrieves a password from a configured credential provider or prompts for the password and stores it in the
configured credential provider.
@param config application configuration
@param key the key/alias for the password.
@return the password.
@throws IOException | [
"Retrieves",
"a",
"password",
"from",
"a",
"configured",
"credential",
"provider",
"or",
"prompts",
"for",
"the",
"password",
"and",
"stores",
"it",
"in",
"the",
"configured",
"credential",
"provider",
"."
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/webapp/src/main/java/org/apache/atlas/web/service/SecureEmbeddedServer.java#L122-L145 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getGuildPermissionInfo | public void getGuildPermissionInfo(String[] ids, Callback<List<GuildPermission>> callback) throws GuildWars2Exception, NullPointerException {
"""
For more info on guild permissions API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/permissions">here</a><br/>
Give user the access to {@link Callback#onRes... | java | public void getGuildPermissionInfo(String[] ids, Callback<List<GuildPermission>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getGuildPermissionInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | [
"public",
"void",
"getGuildPermissionInfo",
"(",
"String",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"GuildPermission",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecke... | For more info on guild permissions API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/permissions">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of guild permission id
@par... | [
"For",
"more",
"info",
"on",
"guild",
"permissions",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"guild",
"/",
"permissions",
">",
"here<",
"/",
"a",
">",
"<br",... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1614-L1617 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/result/textwriter/TextWriter.java | TextWriter.getFilename | protected String getFilename(Object result, String filenamepre) {
"""
Try to find a unique file name.
@param result Result we print
@param filenamepre File name prefix to use
@return unique filename
"""
if(filenamepre == null || filenamepre.length() == 0) {
filenamepre = "result";
}
for(... | java | protected String getFilename(Object result, String filenamepre) {
if(filenamepre == null || filenamepre.length() == 0) {
filenamepre = "result";
}
for(int i = 0;; i++) {
String filename = i > 0 ? filenamepre + "-" + i : filenamepre;
Object existing = filenames.get(filename);
if(exist... | [
"protected",
"String",
"getFilename",
"(",
"Object",
"result",
",",
"String",
"filenamepre",
")",
"{",
"if",
"(",
"filenamepre",
"==",
"null",
"||",
"filenamepre",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"filenamepre",
"=",
"\"result\"",
";",
"}",
... | Try to find a unique file name.
@param result Result we print
@param filenamepre File name prefix to use
@return unique filename | [
"Try",
"to",
"find",
"a",
"unique",
"file",
"name",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/result/textwriter/TextWriter.java#L144-L156 |
openbase/jul | processing/default/src/main/java/org/openbase/jul/processing/StringProcessor.java | StringProcessor.fillWithSpaces | public static String fillWithSpaces(String input, int lenght, final Alignment textAlignment) {
"""
Method fills the given input string with width-spaces until the given string length is reached.
<p>
Note: The origin input string will aligned to the left.
@param input the original input string
@param ... | java | public static String fillWithSpaces(String input, int lenght, final Alignment textAlignment) {
String spaces = "";
for (int i = lenght - input.length(); i > 0; i--) {
spaces += " ";
}
switch (textAlignment) {
case RIGHT:
return spaces + input;
... | [
"public",
"static",
"String",
"fillWithSpaces",
"(",
"String",
"input",
",",
"int",
"lenght",
",",
"final",
"Alignment",
"textAlignment",
")",
"{",
"String",
"spaces",
"=",
"\"\"",
";",
"for",
"(",
"int",
"i",
"=",
"lenght",
"-",
"input",
".",
"length",
... | Method fills the given input string with width-spaces until the given string length is reached.
<p>
Note: The origin input string will aligned to the left.
@param input the original input string
@param lenght the requested input string length.
@param textAlignment the alignment of the origin input strin... | [
"Method",
"fills",
"the",
"given",
"input",
"string",
"with",
"width",
"-",
"spaces",
"until",
"the",
"given",
"string",
"length",
"is",
"reached",
".",
"<p",
">",
"Note",
":",
"The",
"origin",
"input",
"string",
"will",
"aligned",
"to",
"the",
"left",
"... | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/processing/default/src/main/java/org/openbase/jul/processing/StringProcessor.java#L142-L157 |
apache/groovy | src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java | StaticTypeCheckingVisitor.checkOrMarkInnerFieldAccess | private String checkOrMarkInnerFieldAccess(Expression source, FieldNode fn, boolean lhsOfAssignment, String delegationData) {
"""
Given a field node, checks if we are accessing or setting a public or protected field from an inner class.
"""
if (fn == null || fn.isStatic()) return delegationData;
... | java | private String checkOrMarkInnerFieldAccess(Expression source, FieldNode fn, boolean lhsOfAssignment, String delegationData) {
if (fn == null || fn.isStatic()) return delegationData;
ClassNode enclosingClassNode = typeCheckingContext.getEnclosingClassNode();
ClassNode declaringClass = fn.getDecla... | [
"private",
"String",
"checkOrMarkInnerFieldAccess",
"(",
"Expression",
"source",
",",
"FieldNode",
"fn",
",",
"boolean",
"lhsOfAssignment",
",",
"String",
"delegationData",
")",
"{",
"if",
"(",
"fn",
"==",
"null",
"||",
"fn",
".",
"isStatic",
"(",
")",
")",
... | Given a field node, checks if we are accessing or setting a public or protected field from an inner class. | [
"Given",
"a",
"field",
"node",
"checks",
"if",
"we",
"are",
"accessing",
"or",
"setting",
"a",
"public",
"or",
"protected",
"field",
"from",
"an",
"inner",
"class",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java#L531-L548 |
springfox/springfox | springfox-core/src/main/java/springfox/documentation/builders/DocumentationBuilder.java | DocumentationBuilder.apiListingsByResourceGroupName | public DocumentationBuilder apiListingsByResourceGroupName(Map<String, List<ApiListing>> apiListings) {
"""
Updates the map with new entries
@param apiListings - entries to add to the existing documentation
@return this
"""
nullToEmptyMultimap(apiListings).entrySet().stream().forEachOrdered(entry -> {
... | java | public DocumentationBuilder apiListingsByResourceGroupName(Map<String, List<ApiListing>> apiListings) {
nullToEmptyMultimap(apiListings).entrySet().stream().forEachOrdered(entry -> {
List<ApiListing> list;
if (this.apiListings.containsKey(entry.getKey())) {
list = this.apiListings.get(entry.getK... | [
"public",
"DocumentationBuilder",
"apiListingsByResourceGroupName",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"ApiListing",
">",
">",
"apiListings",
")",
"{",
"nullToEmptyMultimap",
"(",
"apiListings",
")",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
")",
... | Updates the map with new entries
@param apiListings - entries to add to the existing documentation
@return this | [
"Updates",
"the",
"map",
"with",
"new",
"entries"
] | train | https://github.com/springfox/springfox/blob/e40e2d6f4b345ffa35cd5c0ca7a12589036acaf7/springfox-core/src/main/java/springfox/documentation/builders/DocumentationBuilder.java#L68-L81 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/HTTPBatchClientConnectionInterceptor.java | HTTPBatchClientConnectionInterceptor.extractMethod | private HttpRequestBase extractMethod(RequestElements intuitRequest, URI uri) throws FMSException {
"""
Returns instance of HttpGet or HttpPost type, depends from request parameters
@param intuitRequest
@param uri
@return HttpRequestBase
@throws FMSException
"""
String method = intuitRequest.getReq... | java | private HttpRequestBase extractMethod(RequestElements intuitRequest, URI uri) throws FMSException {
String method = intuitRequest.getRequestParameters().get(RequestElements.REQ_PARAM_METHOD_TYPE);
if (method.equals(MethodType.GET.toString())) {
return new HttpGet(uri);
} else if (me... | [
"private",
"HttpRequestBase",
"extractMethod",
"(",
"RequestElements",
"intuitRequest",
",",
"URI",
"uri",
")",
"throws",
"FMSException",
"{",
"String",
"method",
"=",
"intuitRequest",
".",
"getRequestParameters",
"(",
")",
".",
"get",
"(",
"RequestElements",
".",
... | Returns instance of HttpGet or HttpPost type, depends from request parameters
@param intuitRequest
@param uri
@return HttpRequestBase
@throws FMSException | [
"Returns",
"instance",
"of",
"HttpGet",
"or",
"HttpPost",
"type",
"depends",
"from",
"request",
"parameters"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/HTTPBatchClientConnectionInterceptor.java#L272-L281 |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java | RepositoryResolver.reportErrors | private void reportErrors() throws RepositoryResolutionException {
"""
If any errors occurred during resolution, throw a {@link RepositoryResolutionException}
"""
if (resourcesWrongProduct.isEmpty() && missingTopLevelRequirements.isEmpty() && missingRequirements.isEmpty()) {
// Everything w... | java | private void reportErrors() throws RepositoryResolutionException {
if (resourcesWrongProduct.isEmpty() && missingTopLevelRequirements.isEmpty() && missingRequirements.isEmpty()) {
// Everything went fine!
return;
}
Set<ProductRequirementInformation> missingProductInforma... | [
"private",
"void",
"reportErrors",
"(",
")",
"throws",
"RepositoryResolutionException",
"{",
"if",
"(",
"resourcesWrongProduct",
".",
"isEmpty",
"(",
")",
"&&",
"missingTopLevelRequirements",
".",
"isEmpty",
"(",
")",
"&&",
"missingRequirements",
".",
"isEmpty",
"("... | If any errors occurred during resolution, throw a {@link RepositoryResolutionException} | [
"If",
"any",
"errors",
"occurred",
"during",
"resolution",
"throw",
"a",
"{"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java#L774-L793 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/HeaderHandler.java | HeaderHandler.extractString | private String extractString(char[] data, int start, int end) {
"""
Extract a string from the input array based on the start and end markers.
This will strip off any leading and trailing white space or quotes.
@param data
@param start
@param end
@return String (lowercase converted)
"""
// skip l... | java | private String extractString(char[] data, int start, int end) {
// skip leading whitespace and quotes
while (start < end &&
(' ' == data[start] || '\t' == data[start] || '"' == data[start])) {
start++;
}
// ignore trailing whitespace and quotes
while (e... | [
"private",
"String",
"extractString",
"(",
"char",
"[",
"]",
"data",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"// skip leading whitespace and quotes",
"while",
"(",
"start",
"<",
"end",
"&&",
"(",
"'",
"'",
"==",
"data",
"[",
"start",
"]",
"||",... | Extract a string from the input array based on the start and end markers.
This will strip off any leading and trailing white space or quotes.
@param data
@param start
@param end
@return String (lowercase converted) | [
"Extract",
"a",
"string",
"from",
"the",
"input",
"array",
"based",
"on",
"the",
"start",
"and",
"end",
"markers",
".",
"This",
"will",
"strip",
"off",
"any",
"leading",
"and",
"trailing",
"white",
"space",
"or",
"quotes",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/HeaderHandler.java#L197-L218 |
JodaOrg/joda-time | src/main/java/org/joda/time/tz/DateTimeZoneBuilder.java | DateTimeZoneBuilder.readFrom | public static DateTimeZone readFrom(DataInput in, String id) throws IOException {
"""
Decodes a built DateTimeZone from the given stream, as encoded by
writeTo.
@param in input stream to read encoded DateTimeZone from.
@param id time zone id to assign
"""
switch (in.readUnsignedByte()) {
c... | java | public static DateTimeZone readFrom(DataInput in, String id) throws IOException {
switch (in.readUnsignedByte()) {
case 'F':
DateTimeZone fixed = new FixedDateTimeZone
(id, in.readUTF(), (int)readMillis(in), (int)readMillis(in));
if (fixed.equals(DateTimeZone.UTC)... | [
"public",
"static",
"DateTimeZone",
"readFrom",
"(",
"DataInput",
"in",
",",
"String",
"id",
")",
"throws",
"IOException",
"{",
"switch",
"(",
"in",
".",
"readUnsignedByte",
"(",
")",
")",
"{",
"case",
"'",
"'",
":",
"DateTimeZone",
"fixed",
"=",
"new",
... | Decodes a built DateTimeZone from the given stream, as encoded by
writeTo.
@param in input stream to read encoded DateTimeZone from.
@param id time zone id to assign | [
"Decodes",
"a",
"built",
"DateTimeZone",
"from",
"the",
"given",
"stream",
"as",
"encoded",
"by",
"writeTo",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/tz/DateTimeZoneBuilder.java#L110-L126 |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/QueryEvent.java | QueryEvent.addQueryParticipantObject | public void addQueryParticipantObject(String messageIdentifier, String homeCommunityId, byte[] queryPayload, byte[] objectDetail, IHETransactionEventTypeCodes transaction) {
"""
Adds a Participant Object representing a Query Event (XDS Query / PIX Query, etc)
@param messageIdentifier Identifier for the message
... | java | public void addQueryParticipantObject(String messageIdentifier, String homeCommunityId, byte[] queryPayload, byte[] objectDetail, IHETransactionEventTypeCodes transaction)
{
List<TypeValuePairType> tvp = new LinkedList<>();
if (objectDetail != null) {
// this is true ONLY for PIX/PDQ messages
if (transaction... | [
"public",
"void",
"addQueryParticipantObject",
"(",
"String",
"messageIdentifier",
",",
"String",
"homeCommunityId",
",",
"byte",
"[",
"]",
"queryPayload",
",",
"byte",
"[",
"]",
"objectDetail",
",",
"IHETransactionEventTypeCodes",
"transaction",
")",
"{",
"List",
"... | Adds a Participant Object representing a Query Event (XDS Query / PIX Query, etc)
@param messageIdentifier Identifier for the message
@param homeCommunityId Value of the homeCommunityId, if present
@param queryPayload Payload of the query parameters
@param objectDetail Query Details
@param transaction Transaction even... | [
"Adds",
"a",
"Participant",
"Object",
"representing",
"a",
"Query",
"Event",
"(",
"XDS",
"Query",
"/",
"PIX",
"Query",
"etc",
")"
] | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/QueryEvent.java#L63-L100 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AlternativeAlignment.java | AlternativeAlignment.count_gaps | private int count_gaps(int[] i1, int[] i2) {
"""
Count the number of gaps in an alignment represented by idx1,idx2.
@param i1
@param i2
@return the number of gaps in this alignment
"""
int i0 = i1[0];
int j0 = i2[0];
int gaps = 0;
for (int i =1 ; i<i1.length;i++ ){
if ( Math.abs(i1[i]-i0) != 1... | java | private int count_gaps(int[] i1, int[] i2){
int i0 = i1[0];
int j0 = i2[0];
int gaps = 0;
for (int i =1 ; i<i1.length;i++ ){
if ( Math.abs(i1[i]-i0) != 1 ||
( Math.abs(i2[i]-j0) != 1)){
gaps +=1;
}
i0 = i1[i];
j0 = i2[i];
}
return gaps;
} | [
"private",
"int",
"count_gaps",
"(",
"int",
"[",
"]",
"i1",
",",
"int",
"[",
"]",
"i2",
")",
"{",
"int",
"i0",
"=",
"i1",
"[",
"0",
"]",
";",
"int",
"j0",
"=",
"i2",
"[",
"0",
"]",
";",
"int",
"gaps",
"=",
"0",
";",
"for",
"(",
"int",
"i"... | Count the number of gaps in an alignment represented by idx1,idx2.
@param i1
@param i2
@return the number of gaps in this alignment | [
"Count",
"the",
"number",
"of",
"gaps",
"in",
"an",
"alignment",
"represented",
"by",
"idx1",
"idx2",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AlternativeAlignment.java#L729-L744 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/ConstructorLeakChecker.java | ConstructorLeakChecker.matchClass | @Override
public Description matchClass(ClassTree tree, VisitorState state) {
"""
For each class, visits constructors, instance variables, and instance initializers. Delegates
further scanning of these "constructor-scope" constructs to {@link #traverse}.
"""
// TODO(b/36395371): filter here to exclude s... | java | @Override
public Description matchClass(ClassTree tree, VisitorState state) {
// TODO(b/36395371): filter here to exclude some classes (e.g. not immutable)
if (TEST_CLASS.matches(tree, state)) {
return NO_MATCH;
}
for (Tree member : tree.getMembers()) {
if (isSuppressed(member)) {
... | [
"@",
"Override",
"public",
"Description",
"matchClass",
"(",
"ClassTree",
"tree",
",",
"VisitorState",
"state",
")",
"{",
"// TODO(b/36395371): filter here to exclude some classes (e.g. not immutable)",
"if",
"(",
"TEST_CLASS",
".",
"matches",
"(",
"tree",
",",
"state",
... | For each class, visits constructors, instance variables, and instance initializers. Delegates
further scanning of these "constructor-scope" constructs to {@link #traverse}. | [
"For",
"each",
"class",
"visits",
"constructors",
"instance",
"variables",
"and",
"instance",
"initializers",
".",
"Delegates",
"further",
"scanning",
"of",
"these",
"constructor",
"-",
"scope",
"constructs",
"to",
"{"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/ConstructorLeakChecker.java#L45-L64 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueContainer.java | QueueContainer.mapIterateAndRemove | public void mapIterateAndRemove(Map<Long, Data> map) {
"""
Deletes items from the queue which have IDs contained in the key set of the given map. Also schedules the queue for
destruction if it is empty or destroys it immediately if it is empty and {@link QueueConfig#getEmptyQueueTtl()} is 0.
@param map the map... | java | public void mapIterateAndRemove(Map<Long, Data> map) {
if (map.size() <= 0) {
return;
}
if (store.isEnabled()) {
try {
store.deleteAll(map.keySet());
} catch (Exception e) {
throw new HazelcastException(e);
}
... | [
"public",
"void",
"mapIterateAndRemove",
"(",
"Map",
"<",
"Long",
",",
"Data",
">",
"map",
")",
"{",
"if",
"(",
"map",
".",
"size",
"(",
")",
"<=",
"0",
")",
"{",
"return",
";",
"}",
"if",
"(",
"store",
".",
"isEnabled",
"(",
")",
")",
"{",
"tr... | Deletes items from the queue which have IDs contained in the key set of the given map. Also schedules the queue for
destruction if it is empty or destroys it immediately if it is empty and {@link QueueConfig#getEmptyQueueTtl()} is 0.
@param map the map of items which to be removed. | [
"Deletes",
"items",
"from",
"the",
"queue",
"which",
"have",
"IDs",
"contained",
"in",
"the",
"key",
"set",
"of",
"the",
"given",
"map",
".",
"Also",
"schedules",
"the",
"queue",
"for",
"destruction",
"if",
"it",
"is",
"empty",
"or",
"destroys",
"it",
"i... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueContainer.java#L801-L823 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.notNull | public static <T> T notNull(T object, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
"""
断言对象是否不为{@code null} ,如果为{@code null} 抛出{@link NullPointerException} 异常 Assert that an object is not {@code null} .
<pre class="code">
Assert.notNull(clazz, "The class must not be null");
</p... | java | public static <T> T notNull(T object, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (object == null) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return object;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"notNull",
"(",
"T",
"object",
",",
"String",
"errorMsgTemplate",
",",
"Object",
"...",
"params",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalA... | 断言对象是否不为{@code null} ,如果为{@code null} 抛出{@link NullPointerException} 异常 Assert that an object is not {@code null} .
<pre class="code">
Assert.notNull(clazz, "The class must not be null");
</pre>
@param <T> 被检查对象泛型类型
@param object 被检查对象
@param errorMsgTemplate 错误消息模板,变量使用{}表示
@param params 参数
@return 被检查后的对象
@throws I... | [
"断言对象是否不为",
"{",
"@code",
"null",
"}",
",如果为",
"{",
"@code",
"null",
"}",
"抛出",
"{",
"@link",
"NullPointerException",
"}",
"异常",
"Assert",
"that",
"an",
"object",
"is",
"not",
"{",
"@code",
"null",
"}",
"."
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L130-L135 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java | SimpleCompareFileExtensions.compareFilesByName | public static boolean compareFilesByName(final File sourceFile, final File fileToCompare) {
"""
Compare files by name.
@param sourceFile
the source file
@param fileToCompare
the file to compare
@return true if the name are equal, otherwise false.
"""
return CompareFileExtensions
.compareFiles(sourc... | java | public static boolean compareFilesByName(final File sourceFile, final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, true, true, true, true, false, true)
.getNameEquality();
} | [
"public",
"static",
"boolean",
"compareFilesByName",
"(",
"final",
"File",
"sourceFile",
",",
"final",
"File",
"fileToCompare",
")",
"{",
"return",
"CompareFileExtensions",
".",
"compareFiles",
"(",
"sourceFile",
",",
"fileToCompare",
",",
"true",
",",
"true",
","... | Compare files by name.
@param sourceFile
the source file
@param fileToCompare
the file to compare
@return true if the name are equal, otherwise false. | [
"Compare",
"files",
"by",
"name",
"."
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java#L196-L201 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java | PageFlowUtils.addActionError | public static void addActionError( ServletRequest request, String propertyName, String messageKey,
Object[] messageArgs ) {
"""
Add a property-related message that will be shown with the Errors and Error tags.
@param request the current ServletRequest.
@param propertyName... | java | public static void addActionError( ServletRequest request, String propertyName, String messageKey,
Object[] messageArgs )
{
InternalUtils.addActionError( propertyName, new ActionMessage( messageKey, messageArgs ), request );
} | [
"public",
"static",
"void",
"addActionError",
"(",
"ServletRequest",
"request",
",",
"String",
"propertyName",
",",
"String",
"messageKey",
",",
"Object",
"[",
"]",
"messageArgs",
")",
"{",
"InternalUtils",
".",
"addActionError",
"(",
"propertyName",
",",
"new",
... | Add a property-related message that will be shown with the Errors and Error tags.
@param request the current ServletRequest.
@param propertyName the name of the property with which to associate this error.
@param messageKey the message-resources key for the message.
@param messageArgs zero or more arguments to the mes... | [
"Add",
"a",
"property",
"-",
"related",
"message",
"that",
"will",
"be",
"shown",
"with",
"the",
"Errors",
"and",
"Error",
"tags",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L1027-L1031 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.removeEntry | public static void removeEntry(final File zip, final String path) {
"""
Changes an existing ZIP file: removes entry with a given path.
@param zip
an existing ZIP file
@param path
path of the entry to remove
@since 1.7
"""
operateInPlace(zip, new InPlaceAction() {
public boolean act(File tmpFil... | java | public static void removeEntry(final File zip, final String path) {
operateInPlace(zip, new InPlaceAction() {
public boolean act(File tmpFile) {
removeEntry(zip, path, tmpFile);
return true;
}
});
} | [
"public",
"static",
"void",
"removeEntry",
"(",
"final",
"File",
"zip",
",",
"final",
"String",
"path",
")",
"{",
"operateInPlace",
"(",
"zip",
",",
"new",
"InPlaceAction",
"(",
")",
"{",
"public",
"boolean",
"act",
"(",
"File",
"tmpFile",
")",
"{",
"rem... | Changes an existing ZIP file: removes entry with a given path.
@param zip
an existing ZIP file
@param path
path of the entry to remove
@since 1.7 | [
"Changes",
"an",
"existing",
"ZIP",
"file",
":",
"removes",
"entry",
"with",
"a",
"given",
"path",
"."
] | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2283-L2290 |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/diff/AbsDiff.java | AbsDiff.checkUpdate | boolean checkUpdate(final INodeReadTrx paramNewRtx, final INodeReadTrx paramOldRtx) throws TTIOException {
"""
Check for an update of a node.
@param paramNewRtx
first {@link IReadTransaction} instance
@param paramOldRtx
second {@link IReadTransaction} instance
@return kind of diff
@throws TTIOException
... | java | boolean checkUpdate(final INodeReadTrx paramNewRtx, final INodeReadTrx paramOldRtx) throws TTIOException {
assert paramNewRtx != null;
assert paramOldRtx != null;
boolean updated = false;
final long newKey = paramNewRtx.getNode().getDataKey();
boolean movedNewRtx = paramNewRtx.mo... | [
"boolean",
"checkUpdate",
"(",
"final",
"INodeReadTrx",
"paramNewRtx",
",",
"final",
"INodeReadTrx",
"paramOldRtx",
")",
"throws",
"TTIOException",
"{",
"assert",
"paramNewRtx",
"!=",
"null",
";",
"assert",
"paramOldRtx",
"!=",
"null",
";",
"boolean",
"updated",
"... | Check for an update of a node.
@param paramNewRtx
first {@link IReadTransaction} instance
@param paramOldRtx
second {@link IReadTransaction} instance
@return kind of diff
@throws TTIOException | [
"Check",
"for",
"an",
"update",
"of",
"a",
"node",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/diff/AbsDiff.java#L466-L490 |
apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/expression/TimeUnits.java | TimeUnits.toQueryGranularity | public static PeriodGranularity toQueryGranularity(final TimeUnitRange timeUnitRange, final DateTimeZone timeZone) {
"""
Returns the Druid QueryGranularity corresponding to a Calcite TimeUnitRange, or null if there is none.
@param timeUnitRange time unit
@param timeZone session time zone
@return queryG... | java | public static PeriodGranularity toQueryGranularity(final TimeUnitRange timeUnitRange, final DateTimeZone timeZone)
{
final Period period = PERIOD_MAP.get(timeUnitRange);
if (period == null) {
return null;
}
return new PeriodGranularity(period, null, timeZone);
} | [
"public",
"static",
"PeriodGranularity",
"toQueryGranularity",
"(",
"final",
"TimeUnitRange",
"timeUnitRange",
",",
"final",
"DateTimeZone",
"timeZone",
")",
"{",
"final",
"Period",
"period",
"=",
"PERIOD_MAP",
".",
"get",
"(",
"timeUnitRange",
")",
";",
"if",
"("... | Returns the Druid QueryGranularity corresponding to a Calcite TimeUnitRange, or null if there is none.
@param timeUnitRange time unit
@param timeZone session time zone
@return queryGranularity, or null | [
"Returns",
"the",
"Druid",
"QueryGranularity",
"corresponding",
"to",
"a",
"Calcite",
"TimeUnitRange",
"or",
"null",
"if",
"there",
"is",
"none",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/expression/TimeUnits.java#L51-L59 |
javalite/activejdbc | javalite-common/src/main/java/org/javalite/common/Convert.java | Convert.toDouble | public static Double toDouble(Object value) {
"""
Converts any value to <code>Double</code>.
@param value value to convert.
@return converted double.
"""
if (value == null) {
return null;
} else if (value instanceof Double) {
return (Double) value;
} else if ... | java | public static Double toDouble(Object value) {
if (value == null) {
return null;
} else if (value instanceof Double) {
return (Double) value;
} else if (value instanceof Number) {
return ((Number) value).doubleValue();
} else {
try {
... | [
"public",
"static",
"Double",
"toDouble",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"Double",
")",
"{",
"return",
"(",
"Double",
")",
"value",
"... | Converts any value to <code>Double</code>.
@param value value to convert.
@return converted double. | [
"Converts",
"any",
"value",
"to",
"<code",
">",
"Double<",
"/",
"code",
">",
".",
"@param",
"value",
"value",
"to",
"convert",
"."
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Convert.java#L256-L270 |
alkacon/opencms-core | src-setup/org/opencms/setup/CmsUpdateBean.java | CmsUpdateBean.updateModule | protected void updateModule(String moduleName, String importFile, I_CmsReport report) throws Exception {
"""
Imports a module (zipfile) from the default module directory,
creating a temporary project for this.<p>
@param moduleName the name of the module to replace
@param importFile the name of the import .zip... | java | protected void updateModule(String moduleName, String importFile, I_CmsReport report) throws Exception {
String fileName = getModuleFolder() + importFile;
report.println(
Messages.get().container(Messages.RPT_BEGIN_UPDATE_MODULE_1, moduleName),
I_CmsReport.FORMAT_HEADLINE);
... | [
"protected",
"void",
"updateModule",
"(",
"String",
"moduleName",
",",
"String",
"importFile",
",",
"I_CmsReport",
"report",
")",
"throws",
"Exception",
"{",
"String",
"fileName",
"=",
"getModuleFolder",
"(",
")",
"+",
"importFile",
";",
"report",
".",
"println"... | Imports a module (zipfile) from the default module directory,
creating a temporary project for this.<p>
@param moduleName the name of the module to replace
@param importFile the name of the import .zip file located in the update module directory
@param report the shell report to write the output
@throws Exception if ... | [
"Imports",
"a",
"module",
"(",
"zipfile",
")",
"from",
"the",
"default",
"module",
"directory",
"creating",
"a",
"temporary",
"project",
"for",
"this",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsUpdateBean.java#L1204-L1222 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.