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 |
|---|---|---|---|---|---|---|---|---|---|---|
algolia/instantsearch-android | core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java | Searcher.create | @SuppressWarnings( {
"""
Constructs a Searcher, creating its {@link Searcher#searchable} and {@link Searcher#client} with the given parameters.
@param appId your Algolia Application ID.
@param apiKey a search-only API Key. (never use API keys that could modify your records! see https://www.algolia.com/doc/guides/security/api-keys)
@param indexName the name of the searchable to target.
@return the new instance.
""""WeakerAccess", "unused"}) // For library users
public static Searcher create(@NonNull final String appId, @NonNull final String apiKey, @NonNull final String indexName) {
return create(new Client(appId, apiKey).getIndex(indexName), indexName);
} | java | @SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public static Searcher create(@NonNull final String appId, @NonNull final String apiKey, @NonNull final String indexName) {
return create(new Client(appId, apiKey).getIndex(indexName), indexName);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"WeakerAccess\"",
",",
"\"unused\"",
"}",
")",
"// For library users",
"public",
"static",
"Searcher",
"create",
"(",
"@",
"NonNull",
"final",
"String",
"appId",
",",
"@",
"NonNull",
"final",
"String",
"apiKey",
",",
"@",
"... | Constructs a Searcher, creating its {@link Searcher#searchable} and {@link Searcher#client} with the given parameters.
@param appId your Algolia Application ID.
@param apiKey a search-only API Key. (never use API keys that could modify your records! see https://www.algolia.com/doc/guides/security/api-keys)
@param indexName the name of the searchable to target.
@return the new instance. | [
"Constructs",
"a",
"Searcher",
"creating",
"its",
"{",
"@link",
"Searcher#searchable",
"}",
"and",
"{",
"@link",
"Searcher#client",
"}",
"with",
"the",
"given",
"parameters",
"."
] | train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java#L182-L185 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/RecountOnValidHandler.java | RecountOnValidHandler.init | public void init(Record record, Record recordSub, boolean bRestoreCurrentRecord) {
"""
Constructor.
@param record My owner (usually passed as null, and set on addListener in setOwner()).
@param recordSub The sub-record.
"""
m_recordSub = recordSub;
m_bRestoreCurrentRecord = bRestoreCurrentRecord;
super.init(record);
} | java | public void init(Record record, Record recordSub, boolean bRestoreCurrentRecord)
{
m_recordSub = recordSub;
m_bRestoreCurrentRecord = bRestoreCurrentRecord;
super.init(record);
} | [
"public",
"void",
"init",
"(",
"Record",
"record",
",",
"Record",
"recordSub",
",",
"boolean",
"bRestoreCurrentRecord",
")",
"{",
"m_recordSub",
"=",
"recordSub",
";",
"m_bRestoreCurrentRecord",
"=",
"bRestoreCurrentRecord",
";",
"super",
".",
"init",
"(",
"record... | Constructor.
@param record My owner (usually passed as null, and set on addListener in setOwner()).
@param recordSub The sub-record. | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/RecountOnValidHandler.java#L65-L70 |
alamkanak/Android-Week-View | sample/src/main/java/com/alamkanak/weekview/sample/BaseActivity.java | BaseActivity.setupDateTimeInterpreter | private void setupDateTimeInterpreter(final boolean shortDate) {
"""
Set up a date time interpreter which will show short date values when in week view and long
date values otherwise.
@param shortDate True if the date values should be short.
"""
mWeekView.setDateTimeInterpreter(new DateTimeInterpreter() {
@Override
public String interpretDate(Calendar date) {
SimpleDateFormat weekdayNameFormat = new SimpleDateFormat("EEE", Locale.getDefault());
String weekday = weekdayNameFormat.format(date.getTime());
SimpleDateFormat format = new SimpleDateFormat(" M/d", Locale.getDefault());
// All android api level do not have a standard way of getting the first letter of
// the week day name. Hence we get the first char programmatically.
// Details: http://stackoverflow.com/questions/16959502/get-one-letter-abbreviation-of-week-day-of-a-date-in-java#answer-16959657
if (shortDate)
weekday = String.valueOf(weekday.charAt(0));
return weekday.toUpperCase() + format.format(date.getTime());
}
@Override
public String interpretTime(int hour) {
return hour > 11 ? (hour - 12) + " PM" : (hour == 0 ? "12 AM" : hour + " AM");
}
});
} | java | private void setupDateTimeInterpreter(final boolean shortDate) {
mWeekView.setDateTimeInterpreter(new DateTimeInterpreter() {
@Override
public String interpretDate(Calendar date) {
SimpleDateFormat weekdayNameFormat = new SimpleDateFormat("EEE", Locale.getDefault());
String weekday = weekdayNameFormat.format(date.getTime());
SimpleDateFormat format = new SimpleDateFormat(" M/d", Locale.getDefault());
// All android api level do not have a standard way of getting the first letter of
// the week day name. Hence we get the first char programmatically.
// Details: http://stackoverflow.com/questions/16959502/get-one-letter-abbreviation-of-week-day-of-a-date-in-java#answer-16959657
if (shortDate)
weekday = String.valueOf(weekday.charAt(0));
return weekday.toUpperCase() + format.format(date.getTime());
}
@Override
public String interpretTime(int hour) {
return hour > 11 ? (hour - 12) + " PM" : (hour == 0 ? "12 AM" : hour + " AM");
}
});
} | [
"private",
"void",
"setupDateTimeInterpreter",
"(",
"final",
"boolean",
"shortDate",
")",
"{",
"mWeekView",
".",
"setDateTimeInterpreter",
"(",
"new",
"DateTimeInterpreter",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"interpretDate",
"(",
"Calendar",
"date"... | Set up a date time interpreter which will show short date values when in week view and long
date values otherwise.
@param shortDate True if the date values should be short. | [
"Set",
"up",
"a",
"date",
"time",
"interpreter",
"which",
"will",
"show",
"short",
"date",
"values",
"when",
"in",
"week",
"view",
"and",
"long",
"date",
"values",
"otherwise",
"."
] | train | https://github.com/alamkanak/Android-Week-View/blob/dc3f97d65d44785d1a761b52b58527c86c4eee1b/sample/src/main/java/com/alamkanak/weekview/sample/BaseActivity.java#L121-L142 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/DateTimeFormatter.java | DateTimeFormatter.printTo | public void printTo(StringBuffer buf, ReadablePartial partial) {
"""
Prints a ReadablePartial.
<p>
Neither the override chronology nor the override zone are used
by this method.
@param buf the destination to format to, not null
@param partial partial to format
"""
try {
printTo((Appendable) buf, partial);
} catch (IOException ex) {
// StringBuffer does not throw IOException
}
} | java | public void printTo(StringBuffer buf, ReadablePartial partial) {
try {
printTo((Appendable) buf, partial);
} catch (IOException ex) {
// StringBuffer does not throw IOException
}
} | [
"public",
"void",
"printTo",
"(",
"StringBuffer",
"buf",
",",
"ReadablePartial",
"partial",
")",
"{",
"try",
"{",
"printTo",
"(",
"(",
"Appendable",
")",
"buf",
",",
"partial",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"// StringBuffer do... | Prints a ReadablePartial.
<p>
Neither the override chronology nor the override zone are used
by this method.
@param buf the destination to format to, not null
@param partial partial to format | [
"Prints",
"a",
"ReadablePartial",
".",
"<p",
">",
"Neither",
"the",
"override",
"chronology",
"nor",
"the",
"override",
"zone",
"are",
"used",
"by",
"this",
"method",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormatter.java#L602-L608 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/calendar/CalendarUtils.java | CalendarUtils.floorDivide | public static final int floorDivide(int n, int d, int[] r) {
"""
Divides two integers and returns the floor of the quotient and
the modulus remainder. For example,
<code>floorDivide(-1,4)</code> returns <code>-1</code> with
<code>3</code> as its remainder, while <code>-1/4</code> is
<code>0</code> and <code>-1%4</code> is <code>-1</code>.
@param n the numerator
@param d a divisor which must be > 0
@param r an array of at least one element in which the value
<code>mod(n, d)</code> is returned.
@return the floor of the quotient.
"""
if (n >= 0) {
r[0] = n % d;
return n / d;
}
int q = ((n + 1) / d) - 1;
r[0] = n - (q * d);
return q;
} | java | public static final int floorDivide(int n, int d, int[] r) {
if (n >= 0) {
r[0] = n % d;
return n / d;
}
int q = ((n + 1) / d) - 1;
r[0] = n - (q * d);
return q;
} | [
"public",
"static",
"final",
"int",
"floorDivide",
"(",
"int",
"n",
",",
"int",
"d",
",",
"int",
"[",
"]",
"r",
")",
"{",
"if",
"(",
"n",
">=",
"0",
")",
"{",
"r",
"[",
"0",
"]",
"=",
"n",
"%",
"d",
";",
"return",
"n",
"/",
"d",
";",
"}",... | Divides two integers and returns the floor of the quotient and
the modulus remainder. For example,
<code>floorDivide(-1,4)</code> returns <code>-1</code> with
<code>3</code> as its remainder, while <code>-1/4</code> is
<code>0</code> and <code>-1%4</code> is <code>-1</code>.
@param n the numerator
@param d a divisor which must be > 0
@param r an array of at least one element in which the value
<code>mod(n, d)</code> is returned.
@return the floor of the quotient. | [
"Divides",
"two",
"integers",
"and",
"returns",
"the",
"floor",
"of",
"the",
"quotient",
"and",
"the",
"modulus",
"remainder",
".",
"For",
"example",
"<code",
">",
"floorDivide",
"(",
"-",
"1",
"4",
")",
"<",
"/",
"code",
">",
"returns",
"<code",
">",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/calendar/CalendarUtils.java#L102-L110 |
jamesagnew/hapi-fhir | hapi-fhir-osgi-core/src/main/java/ca/uhn/fhir/osgi/FhirServerImpl.java | FhirServerImpl.unregisterOsgiProviders | @Override
public void unregisterOsgiProviders (Collection<Object> providers) throws FhirConfigurationException {
"""
Dynamically unregisters a list of providers with the RestfulServer
@param provider the providers to be unregistered
@throws FhirConfigurationException
"""
if (null == providers) {
throw new NullPointerException("FHIR Provider list cannot be null");
}
try {
for (Object provider : providers) {
log.trace("unregistered provider. class ["+provider.getClass().getName()+"]");
this.serverProviders.remove(provider);
}
super.unregisterProvider(providers);
} catch (Exception e) {
log.error("Error unregistering FHIR Providers", e);
throw new FhirConfigurationException("Error unregistering FHIR Providers", e);
}
} | java | @Override
public void unregisterOsgiProviders (Collection<Object> providers) throws FhirConfigurationException {
if (null == providers) {
throw new NullPointerException("FHIR Provider list cannot be null");
}
try {
for (Object provider : providers) {
log.trace("unregistered provider. class ["+provider.getClass().getName()+"]");
this.serverProviders.remove(provider);
}
super.unregisterProvider(providers);
} catch (Exception e) {
log.error("Error unregistering FHIR Providers", e);
throw new FhirConfigurationException("Error unregistering FHIR Providers", e);
}
} | [
"@",
"Override",
"public",
"void",
"unregisterOsgiProviders",
"(",
"Collection",
"<",
"Object",
">",
"providers",
")",
"throws",
"FhirConfigurationException",
"{",
"if",
"(",
"null",
"==",
"providers",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"FHIR... | Dynamically unregisters a list of providers with the RestfulServer
@param provider the providers to be unregistered
@throws FhirConfigurationException | [
"Dynamically",
"unregisters",
"a",
"list",
"of",
"providers",
"with",
"the",
"RestfulServer"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-osgi-core/src/main/java/ca/uhn/fhir/osgi/FhirServerImpl.java#L125-L140 |
pvanassen/ns-api | src/main/java/nl/pvanassen/ns/RequestBuilder.java | RequestBuilder.getPrijzen | public static ApiRequest<Prijzen> getPrijzen(String fromStation, String toStation) {
"""
Builds a request to get all fares for a ride between station from, to station to. See <a
href="http://www.ns.nl/api/api#api-documentatie-prijzen">prijzen</a>
@param fromStation Starting point of the trip
@param toStation End point of the trip
@return Request for getting the fares
"""
return RequestBuilder.getPrijzen(fromStation, toStation, null, null);
} | java | public static ApiRequest<Prijzen> getPrijzen(String fromStation, String toStation) {
return RequestBuilder.getPrijzen(fromStation, toStation, null, null);
} | [
"public",
"static",
"ApiRequest",
"<",
"Prijzen",
">",
"getPrijzen",
"(",
"String",
"fromStation",
",",
"String",
"toStation",
")",
"{",
"return",
"RequestBuilder",
".",
"getPrijzen",
"(",
"fromStation",
",",
"toStation",
",",
"null",
",",
"null",
")",
";",
... | Builds a request to get all fares for a ride between station from, to station to. See <a
href="http://www.ns.nl/api/api#api-documentatie-prijzen">prijzen</a>
@param fromStation Starting point of the trip
@param toStation End point of the trip
@return Request for getting the fares | [
"Builds",
"a",
"request",
"to",
"get",
"all",
"fares",
"for",
"a",
"ride",
"between",
"station",
"from",
"to",
"station",
"to",
".",
"See",
"<a",
"href",
"=",
"http",
":",
"//",
"www",
".",
"ns",
".",
"nl",
"/",
"api",
"/",
"api#api",
"-",
"documen... | train | https://github.com/pvanassen/ns-api/blob/e90e01028a0eb24006e4fddd4c85e7a25c4fe0ae/src/main/java/nl/pvanassen/ns/RequestBuilder.java#L96-L98 |
line/armeria | core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedBeanFactoryRegistry.java | AnnotatedBeanFactoryRegistry.register | static synchronized BeanFactoryId register(Class<?> clazz, Set<String> pathParams,
List<RequestObjectResolver> objectResolvers) {
"""
Returns a {@link BeanFactoryId} of the specified {@link Class} and {@code pathParams} for finding its
factory from the factory cache later.
"""
final BeanFactoryId beanFactoryId = new BeanFactoryId(clazz, pathParams);
if (!factories.containsKey(beanFactoryId)) {
final AnnotatedBeanFactory<Object> factory = createFactory(beanFactoryId, objectResolvers);
if (factory != null) {
factories.put(beanFactoryId, factory);
logger.debug("Registered a bean factory: {}", beanFactoryId);
} else {
factories.put(beanFactoryId, unsupportedBeanFactory);
}
}
return beanFactoryId;
} | java | static synchronized BeanFactoryId register(Class<?> clazz, Set<String> pathParams,
List<RequestObjectResolver> objectResolvers) {
final BeanFactoryId beanFactoryId = new BeanFactoryId(clazz, pathParams);
if (!factories.containsKey(beanFactoryId)) {
final AnnotatedBeanFactory<Object> factory = createFactory(beanFactoryId, objectResolvers);
if (factory != null) {
factories.put(beanFactoryId, factory);
logger.debug("Registered a bean factory: {}", beanFactoryId);
} else {
factories.put(beanFactoryId, unsupportedBeanFactory);
}
}
return beanFactoryId;
} | [
"static",
"synchronized",
"BeanFactoryId",
"register",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Set",
"<",
"String",
">",
"pathParams",
",",
"List",
"<",
"RequestObjectResolver",
">",
"objectResolvers",
")",
"{",
"final",
"BeanFactoryId",
"beanFactoryId",
"="... | Returns a {@link BeanFactoryId} of the specified {@link Class} and {@code pathParams} for finding its
factory from the factory cache later. | [
"Returns",
"a",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedBeanFactoryRegistry.java#L81-L94 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/validation/fieldvalidation/FieldFormatterRegistry.java | FieldFormatterRegistry.registerFormatter | public <T> void registerFormatter(final Class<T> requiredType, FieldFormatter<T> formatter) {
"""
クラスタイプを指定してフォーマッタを登録する。
@param <T> 処理対象のタイプ
@param requiredType クラスタイプ
@param formatter 登録対象のフォーマッタ
@throws IllegalArgumentException {@literal requiredType == null or formatter == null}
"""
ArgUtils.notNull(requiredType, "requiredType");
ArgUtils.notNull(formatter, "formatter");
this.typeMap.put(requiredType, formatter);
} | java | public <T> void registerFormatter(final Class<T> requiredType, FieldFormatter<T> formatter) {
ArgUtils.notNull(requiredType, "requiredType");
ArgUtils.notNull(formatter, "formatter");
this.typeMap.put(requiredType, formatter);
} | [
"public",
"<",
"T",
">",
"void",
"registerFormatter",
"(",
"final",
"Class",
"<",
"T",
">",
"requiredType",
",",
"FieldFormatter",
"<",
"T",
">",
"formatter",
")",
"{",
"ArgUtils",
".",
"notNull",
"(",
"requiredType",
",",
"\"requiredType\"",
")",
";",
"Ar... | クラスタイプを指定してフォーマッタを登録する。
@param <T> 処理対象のタイプ
@param requiredType クラスタイプ
@param formatter 登録対象のフォーマッタ
@throws IllegalArgumentException {@literal requiredType == null or formatter == null} | [
"クラスタイプを指定してフォーマッタを登録する。"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/validation/fieldvalidation/FieldFormatterRegistry.java#L48-L54 |
alkacon/opencms-core | src/org/opencms/flex/CmsFlexController.java | CmsFlexController.setDateExpiresHeader | public static void setDateExpiresHeader(HttpServletResponse res, long dateExpires, long maxAge) {
"""
Sets the <code>Expires</code> date header for a given http request.<p>
Also sets the <code>cache-control: max-age</code> header to the time of the expiration.
A certain upper limit is imposed on the expiration date parameter to ensure the resources are
not cached to long in proxies. This can be controlled by the <code>maxAge</code> parameter.
If <code>maxAge</code> is lower then 0, then a default max age of 86400000 msec (1 day) is used.<p>
@param res the response to set the "Expires" date header for
@param maxAge maximum amount of time in milliseconds the response remains valid
@param dateExpires the date to set (if this is not in the future, it is ignored)
"""
long now = System.currentTimeMillis();
if ((dateExpires > now) && (dateExpires != CmsResource.DATE_EXPIRED_DEFAULT)) {
// important: many caches (browsers or proxy) use the "Expires" header
// to avoid re-loading of pages that are not expired
// while this is right in general, no changes before the expiration date
// will be displayed
// therefore it is better to not use an expiration to far in the future
// if no valid max age is set, restrict it to 24 hrs
if (maxAge < 0L) {
maxAge = 86400000;
}
if ((dateExpires - now) > maxAge) {
// set "Expires" header max one day into the future
dateExpires = now + maxAge;
}
res.setDateHeader(CmsRequestUtil.HEADER_EXPIRES, dateExpires);
// setting the "Expires" header only is not sufficient - even expired documents seems to be cached
// therefore, the "cache-control: max-age" is also set
res.setHeader(CmsRequestUtil.HEADER_CACHE_CONTROL, CmsRequestUtil.HEADER_VALUE_MAX_AGE + (maxAge / 1000L));
}
} | java | public static void setDateExpiresHeader(HttpServletResponse res, long dateExpires, long maxAge) {
long now = System.currentTimeMillis();
if ((dateExpires > now) && (dateExpires != CmsResource.DATE_EXPIRED_DEFAULT)) {
// important: many caches (browsers or proxy) use the "Expires" header
// to avoid re-loading of pages that are not expired
// while this is right in general, no changes before the expiration date
// will be displayed
// therefore it is better to not use an expiration to far in the future
// if no valid max age is set, restrict it to 24 hrs
if (maxAge < 0L) {
maxAge = 86400000;
}
if ((dateExpires - now) > maxAge) {
// set "Expires" header max one day into the future
dateExpires = now + maxAge;
}
res.setDateHeader(CmsRequestUtil.HEADER_EXPIRES, dateExpires);
// setting the "Expires" header only is not sufficient - even expired documents seems to be cached
// therefore, the "cache-control: max-age" is also set
res.setHeader(CmsRequestUtil.HEADER_CACHE_CONTROL, CmsRequestUtil.HEADER_VALUE_MAX_AGE + (maxAge / 1000L));
}
} | [
"public",
"static",
"void",
"setDateExpiresHeader",
"(",
"HttpServletResponse",
"res",
",",
"long",
"dateExpires",
",",
"long",
"maxAge",
")",
"{",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"(",
"dateExpires",
">",
"no... | Sets the <code>Expires</code> date header for a given http request.<p>
Also sets the <code>cache-control: max-age</code> header to the time of the expiration.
A certain upper limit is imposed on the expiration date parameter to ensure the resources are
not cached to long in proxies. This can be controlled by the <code>maxAge</code> parameter.
If <code>maxAge</code> is lower then 0, then a default max age of 86400000 msec (1 day) is used.<p>
@param res the response to set the "Expires" date header for
@param maxAge maximum amount of time in milliseconds the response remains valid
@param dateExpires the date to set (if this is not in the future, it is ignored) | [
"Sets",
"the",
"<code",
">",
"Expires<",
"/",
"code",
">",
"date",
"header",
"for",
"a",
"given",
"http",
"request",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexController.java#L335-L361 |
alkacon/opencms-core | src/org/opencms/ui/CmsVaadinUtils.java | CmsVaadinUtils.visitDescendants | public static void visitDescendants(Component component, Predicate<Component> handler) {
"""
Visits all descendants of a given component (including the component itself) and applies a predicate
to each.<p>
If the predicate returns false for a component, no further descendants will be processed.<p>
@param component the component
@param handler the predicate
"""
List<Component> stack = Lists.newArrayList();
stack.add(component);
while (!stack.isEmpty()) {
Component currentComponent = stack.get(stack.size() - 1);
stack.remove(stack.size() - 1);
if (!handler.apply(currentComponent)) {
return;
}
if (currentComponent instanceof HasComponents) {
List<Component> children = Lists.newArrayList((HasComponents)currentComponent);
Collections.reverse(children);
stack.addAll(children);
}
}
} | java | public static void visitDescendants(Component component, Predicate<Component> handler) {
List<Component> stack = Lists.newArrayList();
stack.add(component);
while (!stack.isEmpty()) {
Component currentComponent = stack.get(stack.size() - 1);
stack.remove(stack.size() - 1);
if (!handler.apply(currentComponent)) {
return;
}
if (currentComponent instanceof HasComponents) {
List<Component> children = Lists.newArrayList((HasComponents)currentComponent);
Collections.reverse(children);
stack.addAll(children);
}
}
} | [
"public",
"static",
"void",
"visitDescendants",
"(",
"Component",
"component",
",",
"Predicate",
"<",
"Component",
">",
"handler",
")",
"{",
"List",
"<",
"Component",
">",
"stack",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"stack",
".",
"add",
"(",... | Visits all descendants of a given component (including the component itself) and applies a predicate
to each.<p>
If the predicate returns false for a component, no further descendants will be processed.<p>
@param component the component
@param handler the predicate | [
"Visits",
"all",
"descendants",
"of",
"a",
"given",
"component",
"(",
"including",
"the",
"component",
"itself",
")",
"and",
"applies",
"a",
"predicate",
"to",
"each",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L1251-L1267 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/tuple/Triple.java | Triple.compareTo | @Override
public int compareTo(final Triple<L, M, R> other) {
"""
<p>Compares the triple based on the left element, followed by the middle element,
finally the right element.
The types must be {@code Comparable}.</p>
@param other the other triple, not null
@return negative if this is less, zero if equal, positive if greater
"""
return new CompareToBuilder().append(getLeft(), other.getLeft())
.append(getMiddle(), other.getMiddle())
.append(getRight(), other.getRight()).toComparison();
} | java | @Override
public int compareTo(final Triple<L, M, R> other) {
return new CompareToBuilder().append(getLeft(), other.getLeft())
.append(getMiddle(), other.getMiddle())
.append(getRight(), other.getRight()).toComparison();
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"final",
"Triple",
"<",
"L",
",",
"M",
",",
"R",
">",
"other",
")",
"{",
"return",
"new",
"CompareToBuilder",
"(",
")",
".",
"append",
"(",
"getLeft",
"(",
")",
",",
"other",
".",
"getLeft",
"(",
... | <p>Compares the triple based on the left element, followed by the middle element,
finally the right element.
The types must be {@code Comparable}.</p>
@param other the other triple, not null
@return negative if this is less, zero if equal, positive if greater | [
"<p",
">",
"Compares",
"the",
"triple",
"based",
"on",
"the",
"left",
"element",
"followed",
"by",
"the",
"middle",
"element",
"finally",
"the",
"right",
"element",
".",
"The",
"types",
"must",
"be",
"{",
"@code",
"Comparable",
"}",
".",
"<",
"/",
"p",
... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/tuple/Triple.java#L96-L101 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.binary | public static void binary(ImageInputStream srcStream, ImageOutputStream destStream, String imageType) {
"""
彩色转为黑白黑白二值化图片<br>
此方法并不关闭流
@param srcStream 源图像流
@param destStream 目标图像流
@param imageType 图片格式(扩展名)
@since 4.0.5
"""
binary(read(srcStream), destStream, imageType);
} | java | public static void binary(ImageInputStream srcStream, ImageOutputStream destStream, String imageType) {
binary(read(srcStream), destStream, imageType);
} | [
"public",
"static",
"void",
"binary",
"(",
"ImageInputStream",
"srcStream",
",",
"ImageOutputStream",
"destStream",
",",
"String",
"imageType",
")",
"{",
"binary",
"(",
"read",
"(",
"srcStream",
")",
",",
"destStream",
",",
"imageType",
")",
";",
"}"
] | 彩色转为黑白黑白二值化图片<br>
此方法并不关闭流
@param srcStream 源图像流
@param destStream 目标图像流
@param imageType 图片格式(扩展名)
@since 4.0.5 | [
"彩色转为黑白黑白二值化图片<br",
">",
"此方法并不关闭流"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L688-L690 |
deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Atomic.java | Atomic.cas | public boolean cas(T expected, T newValue) {
"""
This method implements compare-and-swap
@param expected
@param newValue
@return true if value was swapped, false otherwise
"""
try {
lock.writeLock().lock();
if (Objects.equals(value, expected)) {
this.value = newValue;
return true;
} else
return false;
} finally {
lock.writeLock().unlock();
}
} | java | public boolean cas(T expected, T newValue) {
try {
lock.writeLock().lock();
if (Objects.equals(value, expected)) {
this.value = newValue;
return true;
} else
return false;
} finally {
lock.writeLock().unlock();
}
} | [
"public",
"boolean",
"cas",
"(",
"T",
"expected",
",",
"T",
"newValue",
")",
"{",
"try",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"if",
"(",
"Objects",
".",
"equals",
"(",
"value",
",",
"expected",
")",
")",
"{",
"this... | This method implements compare-and-swap
@param expected
@param newValue
@return true if value was swapped, false otherwise | [
"This",
"method",
"implements",
"compare",
"-",
"and",
"-",
"swap"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Atomic.java#L76-L88 |
mgledi/DRUMS | src/main/java/com/unister/semweb/drums/util/KeyUtils.java | KeyUtils.compareKey | public static int compareKey(byte[] key1, byte[] key2) {
"""
Compares the two byte-arrays on the basis of unsigned bytes. The array will be compared by each element up to the
length of the smaller array. If all elements are equal and the array are not equal sized, the larger array is
seen as larger.
@param key1
@param key2
@return <0 if key1 < key2<br>
0 if key1 == key2<br>
>0 if key1 > key2
"""
return compareKey(key1, key2, Math.min(key1.length, key2.length));
} | java | public static int compareKey(byte[] key1, byte[] key2) {
return compareKey(key1, key2, Math.min(key1.length, key2.length));
} | [
"public",
"static",
"int",
"compareKey",
"(",
"byte",
"[",
"]",
"key1",
",",
"byte",
"[",
"]",
"key2",
")",
"{",
"return",
"compareKey",
"(",
"key1",
",",
"key2",
",",
"Math",
".",
"min",
"(",
"key1",
".",
"length",
",",
"key2",
".",
"length",
")",... | Compares the two byte-arrays on the basis of unsigned bytes. The array will be compared by each element up to the
length of the smaller array. If all elements are equal and the array are not equal sized, the larger array is
seen as larger.
@param key1
@param key2
@return <0 if key1 < key2<br>
0 if key1 == key2<br>
>0 if key1 > key2 | [
"Compares",
"the",
"two",
"byte",
"-",
"arrays",
"on",
"the",
"basis",
"of",
"unsigned",
"bytes",
".",
"The",
"array",
"will",
"be",
"compared",
"by",
"each",
"element",
"up",
"to",
"the",
"length",
"of",
"the",
"smaller",
"array",
".",
"If",
"all",
"e... | train | https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/util/KeyUtils.java#L88-L90 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/Minimap.java | Minimap.computeSheet | private void computeSheet(Map<TileRef, ColorRgba> colors, Integer sheet) {
"""
Compute the current sheet.
@param colors The colors data.
@param sheet The sheet number.
"""
final SpriteTiled tiles = map.getSheet(sheet);
final ImageBuffer tilesSurface = tiles.getSurface();
final int tw = map.getTileWidth();
final int th = map.getTileHeight();
int number = 0;
for (int i = 0; i < tilesSurface.getWidth(); i += tw)
{
for (int j = 0; j < tilesSurface.getHeight(); j += th)
{
final int h = number * tw % tiles.getWidth();
final int v = number / tiles.getTilesHorizontal() * th;
final ColorRgba color = UtilColor.getWeightedColor(tilesSurface, h, v, tw, th);
if (!(NO_TILE.equals(color) || color.getAlpha() == 0))
{
colors.put(new TileRef(sheet, number), color);
}
number++;
}
}
} | java | private void computeSheet(Map<TileRef, ColorRgba> colors, Integer sheet)
{
final SpriteTiled tiles = map.getSheet(sheet);
final ImageBuffer tilesSurface = tiles.getSurface();
final int tw = map.getTileWidth();
final int th = map.getTileHeight();
int number = 0;
for (int i = 0; i < tilesSurface.getWidth(); i += tw)
{
for (int j = 0; j < tilesSurface.getHeight(); j += th)
{
final int h = number * tw % tiles.getWidth();
final int v = number / tiles.getTilesHorizontal() * th;
final ColorRgba color = UtilColor.getWeightedColor(tilesSurface, h, v, tw, th);
if (!(NO_TILE.equals(color) || color.getAlpha() == 0))
{
colors.put(new TileRef(sheet, number), color);
}
number++;
}
}
} | [
"private",
"void",
"computeSheet",
"(",
"Map",
"<",
"TileRef",
",",
"ColorRgba",
">",
"colors",
",",
"Integer",
"sheet",
")",
"{",
"final",
"SpriteTiled",
"tiles",
"=",
"map",
".",
"getSheet",
"(",
"sheet",
")",
";",
"final",
"ImageBuffer",
"tilesSurface",
... | Compute the current sheet.
@param colors The colors data.
@param sheet The sheet number. | [
"Compute",
"the",
"current",
"sheet",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/Minimap.java#L162-L185 |
k3po/k3po | specification/socks5/src/main/java/org/kaazing/specification/socks5/internal/Functions.java | Functions.generateMIC | @Function
public static byte[] generateMIC(GSSContext context, MessageProp prop, byte[] message) {
"""
Generate a message integrity check for a given received message.
@param context GSSContext for which a connection has been established to the remote peer
@param prop the MessageProp used for exchanging messages
@param message the bytes of the received message
@return the bytes of the message integrity check (like a checksum) that is
sent to a peer for verifying that the message was received correctly
"""
try {
// Ensure the default Quality-of-Protection is applied.
prop.setQOP(0);
byte[] initialToken = context.getMIC(message, 0, message.length, prop);
return getTokenWithLengthPrefix(initialToken);
} catch (GSSException ex) {
throw new RuntimeException("Exception generating MIC for message", ex);
}
} | java | @Function
public static byte[] generateMIC(GSSContext context, MessageProp prop, byte[] message) {
try {
// Ensure the default Quality-of-Protection is applied.
prop.setQOP(0);
byte[] initialToken = context.getMIC(message, 0, message.length, prop);
return getTokenWithLengthPrefix(initialToken);
} catch (GSSException ex) {
throw new RuntimeException("Exception generating MIC for message", ex);
}
} | [
"@",
"Function",
"public",
"static",
"byte",
"[",
"]",
"generateMIC",
"(",
"GSSContext",
"context",
",",
"MessageProp",
"prop",
",",
"byte",
"[",
"]",
"message",
")",
"{",
"try",
"{",
"// Ensure the default Quality-of-Protection is applied.",
"prop",
".",
"setQOP"... | Generate a message integrity check for a given received message.
@param context GSSContext for which a connection has been established to the remote peer
@param prop the MessageProp used for exchanging messages
@param message the bytes of the received message
@return the bytes of the message integrity check (like a checksum) that is
sent to a peer for verifying that the message was received correctly | [
"Generate",
"a",
"message",
"integrity",
"check",
"for",
"a",
"given",
"received",
"message",
"."
] | train | https://github.com/k3po/k3po/blob/3ca4fd31ab4a397893aa640c62ada0e485c8bbd4/specification/socks5/src/main/java/org/kaazing/specification/socks5/internal/Functions.java#L242-L254 |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/ODataLocal.java | ODataLocal.setRecord | public long setRecord(final long iPosition, final ORecordId iRid, final byte[] iContent) throws IOException {
"""
Set the record content in file.
@param iPosition
The previous record's offset
@param iContent
The content to write
@return The new record offset or the same received as parameter is the old space was reused.
@throws IOException
"""
acquireExclusiveLock();
try {
long[] pos = getRelativePosition(iPosition);
final OFile file = files[(int) pos[0]];
final int recordSize = file.readInt(pos[1]);
final int contentLength = iContent != null ? iContent.length : 0;
if (contentLength == recordSize) {
// USE THE OLD SPACE SINCE SIZE ISN'T CHANGED
file.write(pos[1] + RECORD_FIX_SIZE, iContent);
OProfiler.getInstance().updateCounter(PROFILER_UPDATE_REUSED_ALL, +1);
return iPosition;
} else if (recordSize - contentLength > RECORD_FIX_SIZE + 50) {
// USE THE OLD SPACE BUT UPDATE THE CURRENT SIZE. IT'S PREFEREABLE TO USE THE SAME INSTEAD FINDING A BEST SUITED FOR IT TO
// AVOID CHANGES TO REF FILE AS WELL.
writeRecord(pos, iRid.clusterId, iRid.clusterPosition, iContent);
// CREATE A HOLE WITH THE DIFFERENCE OF SPACE
handleHole(iPosition + RECORD_FIX_SIZE + contentLength, recordSize - contentLength - RECORD_FIX_SIZE);
OProfiler.getInstance().updateCounter(PROFILER_UPDATE_REUSED_PARTIAL, +1);
} else {
// CREATE A HOLE FOR THE ENTIRE OLD RECORD
handleHole(iPosition, recordSize);
// USE A NEW SPACE
pos = getFreeSpace(contentLength + RECORD_FIX_SIZE);
writeRecord(pos, iRid.clusterId, iRid.clusterPosition, iContent);
OProfiler.getInstance().updateCounter(PROFILER_UPDATE_NOT_REUSED, +1);
}
return getAbsolutePosition(pos);
} finally {
releaseExclusiveLock();
}
} | java | public long setRecord(final long iPosition, final ORecordId iRid, final byte[] iContent) throws IOException {
acquireExclusiveLock();
try {
long[] pos = getRelativePosition(iPosition);
final OFile file = files[(int) pos[0]];
final int recordSize = file.readInt(pos[1]);
final int contentLength = iContent != null ? iContent.length : 0;
if (contentLength == recordSize) {
// USE THE OLD SPACE SINCE SIZE ISN'T CHANGED
file.write(pos[1] + RECORD_FIX_SIZE, iContent);
OProfiler.getInstance().updateCounter(PROFILER_UPDATE_REUSED_ALL, +1);
return iPosition;
} else if (recordSize - contentLength > RECORD_FIX_SIZE + 50) {
// USE THE OLD SPACE BUT UPDATE THE CURRENT SIZE. IT'S PREFEREABLE TO USE THE SAME INSTEAD FINDING A BEST SUITED FOR IT TO
// AVOID CHANGES TO REF FILE AS WELL.
writeRecord(pos, iRid.clusterId, iRid.clusterPosition, iContent);
// CREATE A HOLE WITH THE DIFFERENCE OF SPACE
handleHole(iPosition + RECORD_FIX_SIZE + contentLength, recordSize - contentLength - RECORD_FIX_SIZE);
OProfiler.getInstance().updateCounter(PROFILER_UPDATE_REUSED_PARTIAL, +1);
} else {
// CREATE A HOLE FOR THE ENTIRE OLD RECORD
handleHole(iPosition, recordSize);
// USE A NEW SPACE
pos = getFreeSpace(contentLength + RECORD_FIX_SIZE);
writeRecord(pos, iRid.clusterId, iRid.clusterPosition, iContent);
OProfiler.getInstance().updateCounter(PROFILER_UPDATE_NOT_REUSED, +1);
}
return getAbsolutePosition(pos);
} finally {
releaseExclusiveLock();
}
} | [
"public",
"long",
"setRecord",
"(",
"final",
"long",
"iPosition",
",",
"final",
"ORecordId",
"iRid",
",",
"final",
"byte",
"[",
"]",
"iContent",
")",
"throws",
"IOException",
"{",
"acquireExclusiveLock",
"(",
")",
";",
"try",
"{",
"long",
"[",
"]",
"pos",
... | Set the record content in file.
@param iPosition
The previous record's offset
@param iContent
The content to write
@return The new record offset or the same received as parameter is the old space was reused.
@throws IOException | [
"Set",
"the",
"record",
"content",
"in",
"file",
"."
] | train | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/ODataLocal.java#L292-L333 |
bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/utils/JoltUtils.java | JoltUtils.isBlankJson | public static boolean isBlankJson(final Object obj) {
"""
Given a json document checks if its jst blank doc, i.e. [] or {}
@param obj source
@return true if the json doc is [] or {}
"""
if (obj == null) {
return true;
}
if(obj instanceof Collection) {
return (((Collection) obj).size() == 0);
}
if(obj instanceof Map) {
return (((Map) obj).size() == 0);
}
throw new UnsupportedOperationException("map or list is supported, got ${obj?obj.getClass():null}");
} | java | public static boolean isBlankJson(final Object obj) {
if (obj == null) {
return true;
}
if(obj instanceof Collection) {
return (((Collection) obj).size() == 0);
}
if(obj instanceof Map) {
return (((Map) obj).size() == 0);
}
throw new UnsupportedOperationException("map or list is supported, got ${obj?obj.getClass():null}");
} | [
"public",
"static",
"boolean",
"isBlankJson",
"(",
"final",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"obj",
"instanceof",
"Collection",
")",
"{",
"return",
"(",
"(",
"(",
"Collection",
... | Given a json document checks if its jst blank doc, i.e. [] or {}
@param obj source
@return true if the json doc is [] or {} | [
"Given",
"a",
"json",
"document",
"checks",
"if",
"its",
"jst",
"blank",
"doc",
"i",
".",
"e",
".",
"[]",
"or",
"{}"
] | train | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/utils/JoltUtils.java#L287-L298 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java | BytecodeUtils.constantNull | public static Expression constantNull(Type type) {
"""
Returns an {@link Expression} with the given type that always returns null.
"""
checkArgument(
type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY,
"%s is not a reference type",
type);
return new Expression(type, Feature.CHEAP) {
@Override
protected void doGen(CodeBuilder mv) {
mv.visitInsn(Opcodes.ACONST_NULL);
}
};
} | java | public static Expression constantNull(Type type) {
checkArgument(
type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY,
"%s is not a reference type",
type);
return new Expression(type, Feature.CHEAP) {
@Override
protected void doGen(CodeBuilder mv) {
mv.visitInsn(Opcodes.ACONST_NULL);
}
};
} | [
"public",
"static",
"Expression",
"constantNull",
"(",
"Type",
"type",
")",
"{",
"checkArgument",
"(",
"type",
".",
"getSort",
"(",
")",
"==",
"Type",
".",
"OBJECT",
"||",
"type",
".",
"getSort",
"(",
")",
"==",
"Type",
".",
"ARRAY",
",",
"\"%s is not a ... | Returns an {@link Expression} with the given type that always returns null. | [
"Returns",
"an",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java#L389-L400 |
mijecu25/dsa | src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java | BinarySearch.searchDescending | public static int searchDescending(short[] shortArray, short value) {
"""
Search for the value in the reverse sorted short array and return the index.
@param shortArray array that we are searching in.
@param value value that is being searched in the array.
@return the index where the value is found in the array, else -1.
"""
int start = 0;
int end = shortArray.length - 1;
int middle = 0;
while(start <= end) {
middle = (start + end) >> 1;
if(value == shortArray[middle]) {
return middle;
}
if(value > shortArray[middle]) {
end = middle - 1 ;
}
else {
start = middle + 1;
}
}
return -1;
} | java | public static int searchDescending(short[] shortArray, short value) {
int start = 0;
int end = shortArray.length - 1;
int middle = 0;
while(start <= end) {
middle = (start + end) >> 1;
if(value == shortArray[middle]) {
return middle;
}
if(value > shortArray[middle]) {
end = middle - 1 ;
}
else {
start = middle + 1;
}
}
return -1;
} | [
"public",
"static",
"int",
"searchDescending",
"(",
"short",
"[",
"]",
"shortArray",
",",
"short",
"value",
")",
"{",
"int",
"start",
"=",
"0",
";",
"int",
"end",
"=",
"shortArray",
".",
"length",
"-",
"1",
";",
"int",
"middle",
"=",
"0",
";",
"while... | Search for the value in the reverse sorted short array and return the index.
@param shortArray array that we are searching in.
@param value value that is being searched in the array.
@return the index where the value is found in the array, else -1. | [
"Search",
"for",
"the",
"value",
"in",
"the",
"reverse",
"sorted",
"short",
"array",
"and",
"return",
"the",
"index",
"."
] | train | https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L505-L527 |
voldemort/voldemort | src/java/voldemort/versioning/VectorClock.java | VectorClock.incrementVersion | public void incrementVersion(int node, long time) {
"""
Increment the version info associated with the given node
@param node The node
"""
if(node < 0 || node > Short.MAX_VALUE)
throw new IllegalArgumentException(node
+ " is outside the acceptable range of node ids.");
this.timestamp = time;
Long version = versionMap.get((short) node);
if(version == null) {
version = 1L;
} else {
version = version + 1L;
}
versionMap.put((short) node, version);
if(versionMap.size() >= MAX_NUMBER_OF_VERSIONS) {
throw new IllegalStateException("Vector clock is full!");
}
} | java | public void incrementVersion(int node, long time) {
if(node < 0 || node > Short.MAX_VALUE)
throw new IllegalArgumentException(node
+ " is outside the acceptable range of node ids.");
this.timestamp = time;
Long version = versionMap.get((short) node);
if(version == null) {
version = 1L;
} else {
version = version + 1L;
}
versionMap.put((short) node, version);
if(versionMap.size() >= MAX_NUMBER_OF_VERSIONS) {
throw new IllegalStateException("Vector clock is full!");
}
} | [
"public",
"void",
"incrementVersion",
"(",
"int",
"node",
",",
"long",
"time",
")",
"{",
"if",
"(",
"node",
"<",
"0",
"||",
"node",
">",
"Short",
".",
"MAX_VALUE",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"node",
"+",
"\" is outside the acceptab... | Increment the version info associated with the given node
@param node The node | [
"Increment",
"the",
"version",
"info",
"associated",
"with",
"the",
"given",
"node"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/versioning/VectorClock.java#L205-L224 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringParser.java | StringParser.parseLongObj | @Nullable
public static Long parseLongObj (@Nullable final Object aObject) {
"""
Parse the given {@link Object} as {@link Long} with radix
{@value #DEFAULT_RADIX}.
@param aObject
The object to parse. May be <code>null</code>.
@return <code>null</code> if the object does not represent a valid value.
"""
return parseLongObj (aObject, DEFAULT_RADIX, null);
} | java | @Nullable
public static Long parseLongObj (@Nullable final Object aObject)
{
return parseLongObj (aObject, DEFAULT_RADIX, null);
} | [
"@",
"Nullable",
"public",
"static",
"Long",
"parseLongObj",
"(",
"@",
"Nullable",
"final",
"Object",
"aObject",
")",
"{",
"return",
"parseLongObj",
"(",
"aObject",
",",
"DEFAULT_RADIX",
",",
"null",
")",
";",
"}"
] | Parse the given {@link Object} as {@link Long} with radix
{@value #DEFAULT_RADIX}.
@param aObject
The object to parse. May be <code>null</code>.
@return <code>null</code> if the object does not represent a valid value. | [
"Parse",
"the",
"given",
"{",
"@link",
"Object",
"}",
"as",
"{",
"@link",
"Long",
"}",
"with",
"radix",
"{",
"@value",
"#DEFAULT_RADIX",
"}",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L1057-L1061 |
pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java | BTreeIndex.locatePage | private CompletableFuture<PageWrapper> locatePage(ByteArraySegment key, PageCollection pageCollection, TimeoutTimer timer) {
"""
Locates the Leaf Page that contains or should contain the given Key.
@param key A ByteArraySegment that represents the Key to look up the Leaf Page for.
@param pageCollection A PageCollection that contains already looked-up pages. Any newly looked up pages will be
inserted in this instance as well.
@param timer Timer for the operation.
@return A CompletableFuture with a PageWrapper for the sought page.
"""
// Verify the sought key has the expected length.
Preconditions.checkArgument(key.getLength() == this.leafPageConfig.getKeyLength(), "Invalid key length.");
// Sanity check that our pageCollection has a somewhat correct view of the data index state. It is OK for it to
// think the index length is less than what it actually is (since a concurrent update may have increased it), but
// it is not a good sign if it thinks it's longer than the actual length.
Preconditions.checkArgument(pageCollection.getIndexLength() <= this.state.get().length, "Unexpected PageCollection.IndexLength.");
if (this.state.get().rootPageOffset == PagePointer.NO_OFFSET && pageCollection.getCount() == 0) {
// No data. Return an empty (leaf) page, which will serve as the root for now.
return CompletableFuture.completedFuture(pageCollection.insert(PageWrapper.wrapNew(createEmptyLeafPage(), null, null)));
}
// Locate the page by searching on the Key (within the page).
return locatePage(page -> getPagePointer(key, page), page -> !page.isIndexPage(), pageCollection, timer);
} | java | private CompletableFuture<PageWrapper> locatePage(ByteArraySegment key, PageCollection pageCollection, TimeoutTimer timer) {
// Verify the sought key has the expected length.
Preconditions.checkArgument(key.getLength() == this.leafPageConfig.getKeyLength(), "Invalid key length.");
// Sanity check that our pageCollection has a somewhat correct view of the data index state. It is OK for it to
// think the index length is less than what it actually is (since a concurrent update may have increased it), but
// it is not a good sign if it thinks it's longer than the actual length.
Preconditions.checkArgument(pageCollection.getIndexLength() <= this.state.get().length, "Unexpected PageCollection.IndexLength.");
if (this.state.get().rootPageOffset == PagePointer.NO_OFFSET && pageCollection.getCount() == 0) {
// No data. Return an empty (leaf) page, which will serve as the root for now.
return CompletableFuture.completedFuture(pageCollection.insert(PageWrapper.wrapNew(createEmptyLeafPage(), null, null)));
}
// Locate the page by searching on the Key (within the page).
return locatePage(page -> getPagePointer(key, page), page -> !page.isIndexPage(), pageCollection, timer);
} | [
"private",
"CompletableFuture",
"<",
"PageWrapper",
">",
"locatePage",
"(",
"ByteArraySegment",
"key",
",",
"PageCollection",
"pageCollection",
",",
"TimeoutTimer",
"timer",
")",
"{",
"// Verify the sought key has the expected length.",
"Preconditions",
".",
"checkArgument",
... | Locates the Leaf Page that contains or should contain the given Key.
@param key A ByteArraySegment that represents the Key to look up the Leaf Page for.
@param pageCollection A PageCollection that contains already looked-up pages. Any newly looked up pages will be
inserted in this instance as well.
@param timer Timer for the operation.
@return A CompletableFuture with a PageWrapper for the sought page. | [
"Locates",
"the",
"Leaf",
"Page",
"that",
"contains",
"or",
"should",
"contain",
"the",
"given",
"Key",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java#L586-L602 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java | CacheProviderWrapper.internalInvalidateByDepId | @Override
public void internalInvalidateByDepId(Object id, int causeOfInvalidation, int source, boolean bFireIL) {
"""
This invalidates all entries in this Cache having a dependency
on this dependency id.
@param id dependency id.
@param causeOfInvalidation The cause of invalidation
@param source The source of invalidation (local or remote)
@param bFireIL True to fire invalidation event
"""
final String methodName = "internalInvalidateByDepId()";
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " id=" + id);
}
this.invalidateExternalCaches(id, null);
this.coreCache.invalidateByDependency(id, true);
} | java | @Override
public void internalInvalidateByDepId(Object id, int causeOfInvalidation, int source, boolean bFireIL) {
final String methodName = "internalInvalidateByDepId()";
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " id=" + id);
}
this.invalidateExternalCaches(id, null);
this.coreCache.invalidateByDependency(id, true);
} | [
"@",
"Override",
"public",
"void",
"internalInvalidateByDepId",
"(",
"Object",
"id",
",",
"int",
"causeOfInvalidation",
",",
"int",
"source",
",",
"boolean",
"bFireIL",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"internalInvalidateByDepId()\"",
";",
"if",
"... | This invalidates all entries in this Cache having a dependency
on this dependency id.
@param id dependency id.
@param causeOfInvalidation The cause of invalidation
@param source The source of invalidation (local or remote)
@param bFireIL True to fire invalidation event | [
"This",
"invalidates",
"all",
"entries",
"in",
"this",
"Cache",
"having",
"a",
"dependency",
"on",
"this",
"dependency",
"id",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L466-L474 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/LookasideCache.java | LookasideCache.addCache | void addCache(Path hdfsPath, Path localPath, long size) throws IOException {
"""
Adds an entry into the cache.
The size is the virtual size of this entry.
"""
localMetrics.numAdd++;
CacheEntry c = new CacheEntry(hdfsPath, localPath, size);
CacheEntry found = cacheMap.putIfAbsent(hdfsPath, c);
if (found != null) {
// If entry was already in the cache, update its timestamp
assert size == found.entrySize;
assert localPath.equals(found.localPath);
found.setGenstamp(globalStamp.incrementAndGet());
localMetrics.numAddExisting++;
if (LOG.isDebugEnabled()) {
LOG.debug("LookasideCache updating path " + hdfsPath);
}
} else {
// We just inserted an entry in the cache. Increment the
// recorded size of the cache.
cacheSize.addAndGet(size);
localMetrics.numAddNew++;
if (LOG.isDebugEnabled()) {
LOG.debug("LookasideCache add new path:" + hdfsPath +
" cachedPath:" + localPath +
" size " + size);
}
}
// check if we need to evict because cache is full
if (cacheSize.get() > cacheSizeMax) {
checkEvict();
}
} | java | void addCache(Path hdfsPath, Path localPath, long size) throws IOException {
localMetrics.numAdd++;
CacheEntry c = new CacheEntry(hdfsPath, localPath, size);
CacheEntry found = cacheMap.putIfAbsent(hdfsPath, c);
if (found != null) {
// If entry was already in the cache, update its timestamp
assert size == found.entrySize;
assert localPath.equals(found.localPath);
found.setGenstamp(globalStamp.incrementAndGet());
localMetrics.numAddExisting++;
if (LOG.isDebugEnabled()) {
LOG.debug("LookasideCache updating path " + hdfsPath);
}
} else {
// We just inserted an entry in the cache. Increment the
// recorded size of the cache.
cacheSize.addAndGet(size);
localMetrics.numAddNew++;
if (LOG.isDebugEnabled()) {
LOG.debug("LookasideCache add new path:" + hdfsPath +
" cachedPath:" + localPath +
" size " + size);
}
}
// check if we need to evict because cache is full
if (cacheSize.get() > cacheSizeMax) {
checkEvict();
}
} | [
"void",
"addCache",
"(",
"Path",
"hdfsPath",
",",
"Path",
"localPath",
",",
"long",
"size",
")",
"throws",
"IOException",
"{",
"localMetrics",
".",
"numAdd",
"++",
";",
"CacheEntry",
"c",
"=",
"new",
"CacheEntry",
"(",
"hdfsPath",
",",
"localPath",
",",
"s... | Adds an entry into the cache.
The size is the virtual size of this entry. | [
"Adds",
"an",
"entry",
"into",
"the",
"cache",
".",
"The",
"size",
"is",
"the",
"virtual",
"size",
"of",
"this",
"entry",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/LookasideCache.java#L199-L227 |
google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/ErrorUtil.java | ErrorUtil.fatalError | public static void fatalError(Throwable error, String path) {
"""
Report that an internal error happened when translating a specific source.
"""
StringWriter msg = new StringWriter();
PrintWriter writer = new PrintWriter(msg);
writer.println(String.format("internal error translating \"%s\"", path));
error.printStackTrace(writer);
writer.flush();
error(msg.toString());
} | java | public static void fatalError(Throwable error, String path) {
StringWriter msg = new StringWriter();
PrintWriter writer = new PrintWriter(msg);
writer.println(String.format("internal error translating \"%s\"", path));
error.printStackTrace(writer);
writer.flush();
error(msg.toString());
} | [
"public",
"static",
"void",
"fatalError",
"(",
"Throwable",
"error",
",",
"String",
"path",
")",
"{",
"StringWriter",
"msg",
"=",
"new",
"StringWriter",
"(",
")",
";",
"PrintWriter",
"writer",
"=",
"new",
"PrintWriter",
"(",
"msg",
")",
";",
"writer",
".",... | Report that an internal error happened when translating a specific source. | [
"Report",
"that",
"an",
"internal",
"error",
"happened",
"when",
"translating",
"a",
"specific",
"source",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/ErrorUtil.java#L161-L168 |
flow/caustic | lwjgl/src/main/java/com/flowpowered/caustic/lwjgl/LWJGLUtil.java | LWJGLUtil.deployNatives | public static boolean deployNatives(File directory) {
"""
Attempts to deploy the LWJGL native libraries into the given directory. The sub-directory "natives/PLATFORM_NAME" (where PLATFORM_NAME is the name of the platform) will be created inside, and
will contain the natives. The path to the natives property will be set, but the libraries not loaded. If any error is encountered while copying the natives, the operation will be aborted and
the method will return false.
@param directory The directory into which to deploy the natives. Can be null if the path to use is the working directory
@return Whether or not the operation succeeded.
"""
final File nativesDir = new File(directory, getNativesDirectory());
nativesDir.mkdirs();
for (String nativeLib : getNativeLibraries()) {
final File nativeFile = new File(nativesDir, nativeLib);
if (!nativeFile.exists()) {
try {
Files.copy(LWJGLUtil.class.getResourceAsStream("/" + nativeLib), nativeFile.toPath());
} catch (IOException ex) {
CausticUtil.getCausticLogger().log(Level.SEVERE, "Failed to copy native library file", ex);
return false;
}
}
}
final String nativesPath = nativesDir.getAbsolutePath();
System.setProperty("org.lwjgl.librarypath", nativesPath);
System.setProperty("net.java.games.input.librarypath", nativesPath);
return true;
} | java | public static boolean deployNatives(File directory) {
final File nativesDir = new File(directory, getNativesDirectory());
nativesDir.mkdirs();
for (String nativeLib : getNativeLibraries()) {
final File nativeFile = new File(nativesDir, nativeLib);
if (!nativeFile.exists()) {
try {
Files.copy(LWJGLUtil.class.getResourceAsStream("/" + nativeLib), nativeFile.toPath());
} catch (IOException ex) {
CausticUtil.getCausticLogger().log(Level.SEVERE, "Failed to copy native library file", ex);
return false;
}
}
}
final String nativesPath = nativesDir.getAbsolutePath();
System.setProperty("org.lwjgl.librarypath", nativesPath);
System.setProperty("net.java.games.input.librarypath", nativesPath);
return true;
} | [
"public",
"static",
"boolean",
"deployNatives",
"(",
"File",
"directory",
")",
"{",
"final",
"File",
"nativesDir",
"=",
"new",
"File",
"(",
"directory",
",",
"getNativesDirectory",
"(",
")",
")",
";",
"nativesDir",
".",
"mkdirs",
"(",
")",
";",
"for",
"(",... | Attempts to deploy the LWJGL native libraries into the given directory. The sub-directory "natives/PLATFORM_NAME" (where PLATFORM_NAME is the name of the platform) will be created inside, and
will contain the natives. The path to the natives property will be set, but the libraries not loaded. If any error is encountered while copying the natives, the operation will be aborted and
the method will return false.
@param directory The directory into which to deploy the natives. Can be null if the path to use is the working directory
@return Whether or not the operation succeeded. | [
"Attempts",
"to",
"deploy",
"the",
"LWJGL",
"native",
"libraries",
"into",
"the",
"given",
"directory",
".",
"The",
"sub",
"-",
"directory",
"natives",
"/",
"PLATFORM_NAME",
"(",
"where",
"PLATFORM_NAME",
"is",
"the",
"name",
"of",
"the",
"platform",
")",
"w... | train | https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/lwjgl/src/main/java/com/flowpowered/caustic/lwjgl/LWJGLUtil.java#L74-L92 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java | ServiceEndpointPoliciesInner.getByResourceGroupAsync | public Observable<ServiceEndpointPolicyInner> getByResourceGroupAsync(String resourceGroupName, String serviceEndpointPolicyName, String expand) {
"""
Gets the specified service Endpoint Policies in a specified resource group.
@param resourceGroupName The name of the resource group.
@param serviceEndpointPolicyName The name of the service endpoint policy.
@param expand Expands referenced resources.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServiceEndpointPolicyInner object
"""
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, expand).map(new Func1<ServiceResponse<ServiceEndpointPolicyInner>, ServiceEndpointPolicyInner>() {
@Override
public ServiceEndpointPolicyInner call(ServiceResponse<ServiceEndpointPolicyInner> response) {
return response.body();
}
});
} | java | public Observable<ServiceEndpointPolicyInner> getByResourceGroupAsync(String resourceGroupName, String serviceEndpointPolicyName, String expand) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, expand).map(new Func1<ServiceResponse<ServiceEndpointPolicyInner>, ServiceEndpointPolicyInner>() {
@Override
public ServiceEndpointPolicyInner call(ServiceResponse<ServiceEndpointPolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServiceEndpointPolicyInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serviceEndpointPolicyName",
",",
"String",
"expand",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resource... | Gets the specified service Endpoint Policies in a specified resource group.
@param resourceGroupName The name of the resource group.
@param serviceEndpointPolicyName The name of the service endpoint policy.
@param expand Expands referenced resources.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServiceEndpointPolicyInner object | [
"Gets",
"the",
"specified",
"service",
"Endpoint",
"Policies",
"in",
"a",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java#L383-L390 |
code4everything/util | src/main/java/com/zhazhapan/util/LoggerUtils.java | LoggerUtils.debug | public static void debug(Object object, String message, String... values) {
"""
调试
@param object 指定对象
@param message 消息
@param values 格式化参数
@since 1.0.8
"""
if (Checker.isNull(object)) {
debug(message, values);
} else {
debug(object.getClass(), message, values);
}
} | java | public static void debug(Object object, String message, String... values) {
if (Checker.isNull(object)) {
debug(message, values);
} else {
debug(object.getClass(), message, values);
}
} | [
"public",
"static",
"void",
"debug",
"(",
"Object",
"object",
",",
"String",
"message",
",",
"String",
"...",
"values",
")",
"{",
"if",
"(",
"Checker",
".",
"isNull",
"(",
"object",
")",
")",
"{",
"debug",
"(",
"message",
",",
"values",
")",
";",
"}"... | 调试
@param object 指定对象
@param message 消息
@param values 格式化参数
@since 1.0.8 | [
"调试"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/LoggerUtils.java#L202-L208 |
litsec/eidas-opensaml | opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/RequestedAttributeTemplates.java | RequestedAttributeTemplates.DATE_OF_BIRTH | public static RequestedAttribute DATE_OF_BIRTH(Boolean isRequired, boolean includeFriendlyName) {
"""
Creates a {@code RequestedAttribute} object for the DateOfBirth attribute.
@param isRequired
flag to tell whether the attribute is required
@param includeFriendlyName
flag that tells whether the friendly name should be included
@return a {@code RequestedAttribute} object representing the DateOfBirth attribute
"""
return create(AttributeConstants.EIDAS_DATE_OF_BIRTH_ATTRIBUTE_NAME,
includeFriendlyName ? AttributeConstants.EIDAS_DATE_OF_BIRTH_ATTRIBUTE_FRIENDLY_NAME : null,
Attribute.URI_REFERENCE, isRequired);
} | java | public static RequestedAttribute DATE_OF_BIRTH(Boolean isRequired, boolean includeFriendlyName) {
return create(AttributeConstants.EIDAS_DATE_OF_BIRTH_ATTRIBUTE_NAME,
includeFriendlyName ? AttributeConstants.EIDAS_DATE_OF_BIRTH_ATTRIBUTE_FRIENDLY_NAME : null,
Attribute.URI_REFERENCE, isRequired);
} | [
"public",
"static",
"RequestedAttribute",
"DATE_OF_BIRTH",
"(",
"Boolean",
"isRequired",
",",
"boolean",
"includeFriendlyName",
")",
"{",
"return",
"create",
"(",
"AttributeConstants",
".",
"EIDAS_DATE_OF_BIRTH_ATTRIBUTE_NAME",
",",
"includeFriendlyName",
"?",
"AttributeCon... | Creates a {@code RequestedAttribute} object for the DateOfBirth attribute.
@param isRequired
flag to tell whether the attribute is required
@param includeFriendlyName
flag that tells whether the friendly name should be included
@return a {@code RequestedAttribute} object representing the DateOfBirth attribute | [
"Creates",
"a",
"{",
"@code",
"RequestedAttribute",
"}",
"object",
"for",
"the",
"DateOfBirth",
"attribute",
"."
] | train | https://github.com/litsec/eidas-opensaml/blob/522ba6dba433a9524cb8a02464cc3b087b47a2b7/opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/RequestedAttributeTemplates.java#L86-L90 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Address.java | Address.fromKey | public static Address fromKey(final NetworkParameters params, final ECKey key, final ScriptType outputScriptType) {
"""
Construct an {@link Address} that represents the public part of the given {@link ECKey}.
@param params
network this address is valid for
@param key
only the public part is used
@param outputScriptType
script type the address should use
@return constructed address
"""
if (outputScriptType == Script.ScriptType.P2PKH)
return LegacyAddress.fromKey(params, key);
else if (outputScriptType == Script.ScriptType.P2WPKH)
return SegwitAddress.fromKey(params, key);
else
throw new IllegalArgumentException(outputScriptType.toString());
} | java | public static Address fromKey(final NetworkParameters params, final ECKey key, final ScriptType outputScriptType) {
if (outputScriptType == Script.ScriptType.P2PKH)
return LegacyAddress.fromKey(params, key);
else if (outputScriptType == Script.ScriptType.P2WPKH)
return SegwitAddress.fromKey(params, key);
else
throw new IllegalArgumentException(outputScriptType.toString());
} | [
"public",
"static",
"Address",
"fromKey",
"(",
"final",
"NetworkParameters",
"params",
",",
"final",
"ECKey",
"key",
",",
"final",
"ScriptType",
"outputScriptType",
")",
"{",
"if",
"(",
"outputScriptType",
"==",
"Script",
".",
"ScriptType",
".",
"P2PKH",
")",
... | Construct an {@link Address} that represents the public part of the given {@link ECKey}.
@param params
network this address is valid for
@param key
only the public part is used
@param outputScriptType
script type the address should use
@return constructed address | [
"Construct",
"an",
"{",
"@link",
"Address",
"}",
"that",
"represents",
"the",
"public",
"part",
"of",
"the",
"given",
"{",
"@link",
"ECKey",
"}",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Address.java#L82-L89 |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/NodeAvailabilityCache.java | NodeAvailabilityCache.setNodeAvailable | @CheckForNull
@SuppressWarnings( "NP_BOOLEAN_RETURN_NULL" )
public Boolean setNodeAvailable( final K key, final boolean available ) {
"""
If the specified key is not already associated with a value or if it's
associated with a different value, associate it with the given value.
This is equivalent to
<pre>
<code> if (map.get(key) == null || !map.get(key).equals(value))
return map.put(key, value);
else
return map.get(key);
</code>
</pre>
except that the action is performed atomically.
@param key
the key to associate the value with.
@param available
the value to associate with the provided key.
@return the previous value associated with the specified key, or null if
there was no mapping for the key
"""
final ManagedItem<Boolean> item = _map.get( key );
final Boolean availableObj = Boolean.valueOf( available );
if ( item == null || item._value != availableObj ) {
final ManagedItem<Boolean> previous =
_map.put( key, new ManagedItem<Boolean>( availableObj, System.currentTimeMillis() ) );
return previous != null
? previous._value
: null;
} else {
return item._value;
}
} | java | @CheckForNull
@SuppressWarnings( "NP_BOOLEAN_RETURN_NULL" )
public Boolean setNodeAvailable( final K key, final boolean available ) {
final ManagedItem<Boolean> item = _map.get( key );
final Boolean availableObj = Boolean.valueOf( available );
if ( item == null || item._value != availableObj ) {
final ManagedItem<Boolean> previous =
_map.put( key, new ManagedItem<Boolean>( availableObj, System.currentTimeMillis() ) );
return previous != null
? previous._value
: null;
} else {
return item._value;
}
} | [
"@",
"CheckForNull",
"@",
"SuppressWarnings",
"(",
"\"NP_BOOLEAN_RETURN_NULL\"",
")",
"public",
"Boolean",
"setNodeAvailable",
"(",
"final",
"K",
"key",
",",
"final",
"boolean",
"available",
")",
"{",
"final",
"ManagedItem",
"<",
"Boolean",
">",
"item",
"=",
"_m... | If the specified key is not already associated with a value or if it's
associated with a different value, associate it with the given value.
This is equivalent to
<pre>
<code> if (map.get(key) == null || !map.get(key).equals(value))
return map.put(key, value);
else
return map.get(key);
</code>
</pre>
except that the action is performed atomically.
@param key
the key to associate the value with.
@param available
the value to associate with the provided key.
@return the previous value associated with the specified key, or null if
there was no mapping for the key | [
"If",
"the",
"specified",
"key",
"is",
"not",
"already",
"associated",
"with",
"a",
"value",
"or",
"if",
"it",
"s",
"associated",
"with",
"a",
"different",
"value",
"associate",
"it",
"with",
"the",
"given",
"value",
".",
"This",
"is",
"equivalent",
"to"
] | train | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/NodeAvailabilityCache.java#L91-L105 |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/DirectAnalyzer.java | DirectAnalyzer.getElementStyle | public NodeData getElementStyle(Element el, PseudoElementType pseudo, String media) {
"""
Computes the style of an element with an eventual pseudo element for the given media.
@param el The DOM element.
@param pseudo A pseudo element that should be used for style computation or <code>null</code> if no pseudo element should be used (e.g. :after).
@param media Used media name (e.g. "screen" or "all")
@return The relevant declarations from the registered style sheets.
"""
return getElementStyle(el, pseudo, new MediaSpec(media));
} | java | public NodeData getElementStyle(Element el, PseudoElementType pseudo, String media)
{
return getElementStyle(el, pseudo, new MediaSpec(media));
} | [
"public",
"NodeData",
"getElementStyle",
"(",
"Element",
"el",
",",
"PseudoElementType",
"pseudo",
",",
"String",
"media",
")",
"{",
"return",
"getElementStyle",
"(",
"el",
",",
"pseudo",
",",
"new",
"MediaSpec",
"(",
"media",
")",
")",
";",
"}"
] | Computes the style of an element with an eventual pseudo element for the given media.
@param el The DOM element.
@param pseudo A pseudo element that should be used for style computation or <code>null</code> if no pseudo element should be used (e.g. :after).
@param media Used media name (e.g. "screen" or "all")
@return The relevant declarations from the registered style sheets. | [
"Computes",
"the",
"style",
"of",
"an",
"element",
"with",
"an",
"eventual",
"pseudo",
"element",
"for",
"the",
"given",
"media",
"."
] | train | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DirectAnalyzer.java#L70-L73 |
schallee/alib4j | servlet/src/main/java/net/darkmist/alib/servlet/SerializableRequestDispatcher.java | SerializableRequestDispatcher.readObject | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
"""
Custom deserialization. This handles setting transient fields
through @{link #init()}.
"""
// this should set servlet...
in.defaultReadObject();
try
{
init();
}
catch(ServletException e)
{ // This could happen if it is deserialized in
// a container where the name or path does not
// exist. I can't see this happening unless the
// container itself is screwed up though.
throw new IllegalStateException("Unable to reinitialize dispatcher after deserialization.", e);
}
} | java | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
// this should set servlet...
in.defaultReadObject();
try
{
init();
}
catch(ServletException e)
{ // This could happen if it is deserialized in
// a container where the name or path does not
// exist. I can't see this happening unless the
// container itself is screwed up though.
throw new IllegalStateException("Unable to reinitialize dispatcher after deserialization.", e);
}
} | [
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"// this should set servlet...",
"in",
".",
"defaultReadObject",
"(",
")",
";",
"try",
"{",
"init",
"(",
")",
";",
"}",
"catch",
"(... | Custom deserialization. This handles setting transient fields
through @{link #init()}. | [
"Custom",
"deserialization",
".",
"This",
"handles",
"setting",
"transient",
"fields",
"through"
] | train | https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/servlet/src/main/java/net/darkmist/alib/servlet/SerializableRequestDispatcher.java#L102-L117 |
apereo/cas | support/cas-server-support-validation/src/main/java/org/apereo/cas/web/view/attributes/DefaultCas30ProtocolAttributesRenderer.java | DefaultCas30ProtocolAttributesRenderer.buildSingleAttributeDefinitionLine | protected String buildSingleAttributeDefinitionLine(final String attributeName, final Object value) {
"""
Build single attribute definition line.
@param attributeName the attribute name
@param value the value
@return the string
"""
return new StringBuilder()
.append("<cas:".concat(attributeName).concat(">"))
.append(encodeAttributeValue(value))
.append("</cas:".concat(attributeName).concat(">"))
.toString();
} | java | protected String buildSingleAttributeDefinitionLine(final String attributeName, final Object value) {
return new StringBuilder()
.append("<cas:".concat(attributeName).concat(">"))
.append(encodeAttributeValue(value))
.append("</cas:".concat(attributeName).concat(">"))
.toString();
} | [
"protected",
"String",
"buildSingleAttributeDefinitionLine",
"(",
"final",
"String",
"attributeName",
",",
"final",
"Object",
"value",
")",
"{",
"return",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"\"<cas:\"",
".",
"concat",
"(",
"attributeName",
")",
... | Build single attribute definition line.
@param attributeName the attribute name
@param value the value
@return the string | [
"Build",
"single",
"attribute",
"definition",
"line",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-validation/src/main/java/org/apereo/cas/web/view/attributes/DefaultCas30ProtocolAttributesRenderer.java#L45-L51 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java | EventListenerSupport.addListener | public void addListener(final L listener, final boolean allowDuplicate) {
"""
Registers an event listener. Will not add a pre-existing listener
object to the list if <code>allowDuplicate</code> is false.
@param listener the event listener (may not be <code>null</code>).
@param allowDuplicate the flag for determining if duplicate listener
objects are allowed to be registered.
@throws NullPointerException if <code>listener</code> is <code>null</code>.
@since 3.5
"""
Validate.notNull(listener, "Listener object cannot be null.");
if (allowDuplicate) {
listeners.add(listener);
} else if (!listeners.contains(listener)) {
listeners.add(listener);
}
} | java | public void addListener(final L listener, final boolean allowDuplicate) {
Validate.notNull(listener, "Listener object cannot be null.");
if (allowDuplicate) {
listeners.add(listener);
} else if (!listeners.contains(listener)) {
listeners.add(listener);
}
} | [
"public",
"void",
"addListener",
"(",
"final",
"L",
"listener",
",",
"final",
"boolean",
"allowDuplicate",
")",
"{",
"Validate",
".",
"notNull",
"(",
"listener",
",",
"\"Listener object cannot be null.\"",
")",
";",
"if",
"(",
"allowDuplicate",
")",
"{",
"listen... | Registers an event listener. Will not add a pre-existing listener
object to the list if <code>allowDuplicate</code> is false.
@param listener the event listener (may not be <code>null</code>).
@param allowDuplicate the flag for determining if duplicate listener
objects are allowed to be registered.
@throws NullPointerException if <code>listener</code> is <code>null</code>.
@since 3.5 | [
"Registers",
"an",
"event",
"listener",
".",
"Will",
"not",
"add",
"a",
"pre",
"-",
"existing",
"listener",
"object",
"to",
"the",
"list",
"if",
"<code",
">",
"allowDuplicate<",
"/",
"code",
">",
"is",
"false",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java#L199-L206 |
sarxos/webcam-capture | webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamUtils.java | WebcamUtils.getImageByteBuffer | public static final ByteBuffer getImageByteBuffer(Webcam webcam, String format) {
"""
Capture image as BYteBuffer.
@param webcam the webcam from which image should be obtained
@param format the file format
@return Byte buffer
"""
return ByteBuffer.wrap(getImageBytes(webcam, format));
} | java | public static final ByteBuffer getImageByteBuffer(Webcam webcam, String format) {
return ByteBuffer.wrap(getImageBytes(webcam, format));
} | [
"public",
"static",
"final",
"ByteBuffer",
"getImageByteBuffer",
"(",
"Webcam",
"webcam",
",",
"String",
"format",
")",
"{",
"return",
"ByteBuffer",
".",
"wrap",
"(",
"getImageBytes",
"(",
"webcam",
",",
"format",
")",
")",
";",
"}"
] | Capture image as BYteBuffer.
@param webcam the webcam from which image should be obtained
@param format the file format
@return Byte buffer | [
"Capture",
"image",
"as",
"BYteBuffer",
"."
] | train | https://github.com/sarxos/webcam-capture/blob/efbdae04f9ba48db9ec621e94a9bcd6f031882c8/webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamUtils.java#L65-L67 |
adyliu/jafka | src/main/java/io/jafka/consumer/StringConsumers.java | StringConsumers.buildConsumer | public static StringConsumers buildConsumer(Properties props, final String topic,//
final String groupId,//
final IMessageListener<String> listener,//
final int threads
) {
"""
build a callback consumer
@param props consumer configuration
@param topic the topic to be watched
@param groupId grouping the consumer clients
@param listener message listener
@param threads threads of consumer per topic
@return the real consumer
"""
if (props == null || props.isEmpty()) {
props = new Properties();
}
props.put("groupid", groupId);
return new StringConsumers(props, topic, threads, listener);
} | java | public static StringConsumers buildConsumer(Properties props, final String topic,//
final String groupId,//
final IMessageListener<String> listener,//
final int threads
) {
if (props == null || props.isEmpty()) {
props = new Properties();
}
props.put("groupid", groupId);
return new StringConsumers(props, topic, threads, listener);
} | [
"public",
"static",
"StringConsumers",
"buildConsumer",
"(",
"Properties",
"props",
",",
"final",
"String",
"topic",
",",
"//",
"final",
"String",
"groupId",
",",
"//",
"final",
"IMessageListener",
"<",
"String",
">",
"listener",
",",
"//",
"final",
"int",
"th... | build a callback consumer
@param props consumer configuration
@param topic the topic to be watched
@param groupId grouping the consumer clients
@param listener message listener
@param threads threads of consumer per topic
@return the real consumer | [
"build",
"a",
"callback",
"consumer"
] | train | https://github.com/adyliu/jafka/blob/cc14d2ed60c039b12d7b106bb5269ef21d0add7e/src/main/java/io/jafka/consumer/StringConsumers.java#L74-L84 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java | StyleCache.setStyle | public boolean setStyle(PolygonOptions polygonOptions, StyleRow style) {
"""
Set the style into the polygon options
@param polygonOptions polygon options
@param style style row
@return true if style was set into the polygon options
"""
return StyleUtils.setStyle(polygonOptions, style, density);
} | java | public boolean setStyle(PolygonOptions polygonOptions, StyleRow style) {
return StyleUtils.setStyle(polygonOptions, style, density);
} | [
"public",
"boolean",
"setStyle",
"(",
"PolygonOptions",
"polygonOptions",
",",
"StyleRow",
"style",
")",
"{",
"return",
"StyleUtils",
".",
"setStyle",
"(",
"polygonOptions",
",",
"style",
",",
"density",
")",
";",
"}"
] | Set the style into the polygon options
@param polygonOptions polygon options
@param style style row
@return true if style was set into the polygon options | [
"Set",
"the",
"style",
"into",
"the",
"polygon",
"options"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java#L334-L336 |
googleapis/google-http-java-client | google-http-client/src/main/java/com/google/api/client/util/ArrayMap.java | ArrayMap.put | @Override
public final V put(K key, V value) {
"""
Sets the value for the given key, overriding any existing value.
@return previous value or {@code null} for none
"""
int index = getIndexOfKey(key);
if (index == -1) {
index = this.size;
}
return set(index, key, value);
} | java | @Override
public final V put(K key, V value) {
int index = getIndexOfKey(key);
if (index == -1) {
index = this.size;
}
return set(index, key, value);
} | [
"@",
"Override",
"public",
"final",
"V",
"put",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"int",
"index",
"=",
"getIndexOfKey",
"(",
"key",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"index",
"=",
"this",
".",
"size",
";",
"}",... | Sets the value for the given key, overriding any existing value.
@return previous value or {@code null} for none | [
"Sets",
"the",
"value",
"for",
"the",
"given",
"key",
"overriding",
"any",
"existing",
"value",
"."
] | train | https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/util/ArrayMap.java#L198-L205 |
ggrandes/kvstore | src/main/java/org/javastack/kvstore/structures/btree/BplusTree.java | BplusTree.ceilingEntry | public synchronized TreeEntry<K, V> ceilingEntry(final K key) {
"""
Returns the least key greater than or equal to the given key, or null if there is no such key.
@param key the key
@return the Entry with least key greater than or equal to key, or null if there is no such key
"""
// Retorna la clave mas cercana mayor o igual a la clave indicada
return getRoundEntry(key, true, true);
} | java | public synchronized TreeEntry<K, V> ceilingEntry(final K key) {
// Retorna la clave mas cercana mayor o igual a la clave indicada
return getRoundEntry(key, true, true);
} | [
"public",
"synchronized",
"TreeEntry",
"<",
"K",
",",
"V",
">",
"ceilingEntry",
"(",
"final",
"K",
"key",
")",
"{",
"// Retorna la clave mas cercana mayor o igual a la clave indicada",
"return",
"getRoundEntry",
"(",
"key",
",",
"true",
",",
"true",
")",
";",
"}"
... | Returns the least key greater than or equal to the given key, or null if there is no such key.
@param key the key
@return the Entry with least key greater than or equal to key, or null if there is no such key | [
"Returns",
"the",
"least",
"key",
"greater",
"than",
"or",
"equal",
"to",
"the",
"given",
"key",
"or",
"null",
"if",
"there",
"is",
"no",
"such",
"key",
"."
] | train | https://github.com/ggrandes/kvstore/blob/c79277f79f4604e0fec8349a98519838e3de38f0/src/main/java/org/javastack/kvstore/structures/btree/BplusTree.java#L649-L652 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/slim/FileFixture.java | FileFixture.createContainingValue | public String createContainingValue(String filename, String key) {
"""
Creates new file, containing value 'key'.
@param filename name of file to create.
@param key key whose value should be used to generate the file.
@return file created.
"""
Object data = value(key);
if (data == null) {
throw new SlimFixtureException(false, "No value for key: " + key);
}
return createContaining(filename, data);
} | java | public String createContainingValue(String filename, String key) {
Object data = value(key);
if (data == null) {
throw new SlimFixtureException(false, "No value for key: " + key);
}
return createContaining(filename, data);
} | [
"public",
"String",
"createContainingValue",
"(",
"String",
"filename",
",",
"String",
"key",
")",
"{",
"Object",
"data",
"=",
"value",
"(",
"key",
")",
";",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"throw",
"new",
"SlimFixtureException",
"(",
"false",
... | Creates new file, containing value 'key'.
@param filename name of file to create.
@param key key whose value should be used to generate the file.
@return file created. | [
"Creates",
"new",
"file",
"containing",
"value",
"key",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/FileFixture.java#L54-L60 |
logic-ng/LogicNG | src/main/java/org/logicng/io/readers/FormulaReader.java | FormulaReader.readPropositionalFormula | public static Formula readPropositionalFormula(final String fileName, final FormulaFactory f) throws IOException, ParserException {
"""
Reads a given file and returns the contained propositional formula.
@param fileName the file name
@param f the formula factory
@return the parsed formula
@throws IOException if there was a problem reading the file
@throws ParserException if there was a problem parsing the formula
"""
return read(new File(fileName), new PropositionalParser(f));
} | java | public static Formula readPropositionalFormula(final String fileName, final FormulaFactory f) throws IOException, ParserException {
return read(new File(fileName), new PropositionalParser(f));
} | [
"public",
"static",
"Formula",
"readPropositionalFormula",
"(",
"final",
"String",
"fileName",
",",
"final",
"FormulaFactory",
"f",
")",
"throws",
"IOException",
",",
"ParserException",
"{",
"return",
"read",
"(",
"new",
"File",
"(",
"fileName",
")",
",",
"new",... | Reads a given file and returns the contained propositional formula.
@param fileName the file name
@param f the formula factory
@return the parsed formula
@throws IOException if there was a problem reading the file
@throws ParserException if there was a problem parsing the formula | [
"Reads",
"a",
"given",
"file",
"and",
"returns",
"the",
"contained",
"propositional",
"formula",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/io/readers/FormulaReader.java#L68-L70 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_resource_sw.java | xen_health_resource_sw.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception {
"""
<pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre>
"""
xen_health_resource_sw_responses result = (xen_health_resource_sw_responses) service.get_payload_formatter().string_to_resource(xen_health_resource_sw_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_resource_sw_response_array);
}
xen_health_resource_sw[] result_xen_health_resource_sw = new xen_health_resource_sw[result.xen_health_resource_sw_response_array.length];
for(int i = 0; i < result.xen_health_resource_sw_response_array.length; i++)
{
result_xen_health_resource_sw[i] = result.xen_health_resource_sw_response_array[i].xen_health_resource_sw[0];
}
return result_xen_health_resource_sw;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
xen_health_resource_sw_responses result = (xen_health_resource_sw_responses) service.get_payload_formatter().string_to_resource(xen_health_resource_sw_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_resource_sw_response_array);
}
xen_health_resource_sw[] result_xen_health_resource_sw = new xen_health_resource_sw[result.xen_health_resource_sw_response_array.length];
for(int i = 0; i < result.xen_health_resource_sw_response_array.length; i++)
{
result_xen_health_resource_sw[i] = result.xen_health_resource_sw_response_array[i].xen_health_resource_sw[0];
}
return result_xen_health_resource_sw;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"xen_health_resource_sw_responses",
"result",
"=",
"(",
"xen_health_resource_sw_responses",
")",
"service",
".",... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_resource_sw.java#L173-L190 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.updateCompositeEntity | public OperationStatus updateCompositeEntity(UUID appId, String versionId, UUID cEntityId, CompositeEntityModel compositeModelUpdateObject) {
"""
Updates the composite entity extractor.
@param appId The application ID.
@param versionId The version ID.
@param cEntityId The composite entity extractor ID.
@param compositeModelUpdateObject A model object containing the new entity extractor name and children.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful.
"""
return updateCompositeEntityWithServiceResponseAsync(appId, versionId, cEntityId, compositeModelUpdateObject).toBlocking().single().body();
} | java | public OperationStatus updateCompositeEntity(UUID appId, String versionId, UUID cEntityId, CompositeEntityModel compositeModelUpdateObject) {
return updateCompositeEntityWithServiceResponseAsync(appId, versionId, cEntityId, compositeModelUpdateObject).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"updateCompositeEntity",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"cEntityId",
",",
"CompositeEntityModel",
"compositeModelUpdateObject",
")",
"{",
"return",
"updateCompositeEntityWithServiceResponseAsync",
"(",
"appId",
",... | Updates the composite entity extractor.
@param appId The application ID.
@param versionId The version ID.
@param cEntityId The composite entity extractor ID.
@param compositeModelUpdateObject A model object containing the new entity extractor name and children.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful. | [
"Updates",
"the",
"composite",
"entity",
"extractor",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L4029-L4031 |
deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/base/Preconditions.java | Preconditions.checkState | public static void checkState(boolean b, String message, Object... args) {
"""
Check the specified boolean argument. Throws an IllegalStateException with the specified message if {@code b} is false.
Note that the message may specify argument locations using "%s" - for example,
{@code checkArgument(false, "Got %s values, expected %s", 3, "more"} would throw an IllegalStateException
with the message "Got 3 values, expected more"
@param b Argument to check
@param message Message for exception. May be null.
@param args Arguments to place in message
"""
if (!b) {
throwStateEx(message, args);
}
} | java | public static void checkState(boolean b, String message, Object... args) {
if (!b) {
throwStateEx(message, args);
}
} | [
"public",
"static",
"void",
"checkState",
"(",
"boolean",
"b",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"!",
"b",
")",
"{",
"throwStateEx",
"(",
"message",
",",
"args",
")",
";",
"}",
"}"
] | Check the specified boolean argument. Throws an IllegalStateException with the specified message if {@code b} is false.
Note that the message may specify argument locations using "%s" - for example,
{@code checkArgument(false, "Got %s values, expected %s", 3, "more"} would throw an IllegalStateException
with the message "Got 3 values, expected more"
@param b Argument to check
@param message Message for exception. May be null.
@param args Arguments to place in message | [
"Check",
"the",
"specified",
"boolean",
"argument",
".",
"Throws",
"an",
"IllegalStateException",
"with",
"the",
"specified",
"message",
"if",
"{",
"@code",
"b",
"}",
"is",
"false",
".",
"Note",
"that",
"the",
"message",
"may",
"specify",
"argument",
"location... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/base/Preconditions.java#L444-L448 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java | ConditionalFunctions.ifNaNOrInf | public static Expression ifNaNOrInf(Expression expression1, Expression expression2, Expression... others) {
"""
Returned expression results in first non-MISSING, non-Inf, or non-NaN number.
Returns MISSING or NULL if a non-number input is encountered first.
"""
return build("IFNANORINF", expression1, expression2, others);
} | java | public static Expression ifNaNOrInf(Expression expression1, Expression expression2, Expression... others) {
return build("IFNANORINF", expression1, expression2, others);
} | [
"public",
"static",
"Expression",
"ifNaNOrInf",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
",",
"Expression",
"...",
"others",
")",
"{",
"return",
"build",
"(",
"\"IFNANORINF\"",
",",
"expression1",
",",
"expression2",
",",
"others",
")",
... | Returned expression results in first non-MISSING, non-Inf, or non-NaN number.
Returns MISSING or NULL if a non-number input is encountered first. | [
"Returned",
"expression",
"results",
"in",
"first",
"non",
"-",
"MISSING",
"non",
"-",
"Inf",
"or",
"non",
"-",
"NaN",
"number",
".",
"Returns",
"MISSING",
"or",
"NULL",
"if",
"a",
"non",
"-",
"number",
"input",
"is",
"encountered",
"first",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L116-L118 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/reportv2/ReportClient.java | ReportClient.getGroupStatistic | public GroupStatListResult getGroupStatistic(String start, int duration)
throws APIConnectionException, APIRequestException {
"""
Get group statistic, time unit only supports DAY now.
@param start Format: yyyy-MM-dd
@param duration duration must between 0 and 60
@return {@link GroupStatListResult}
@throws APIConnectionException connect exception
@throws APIRequestException request exception
"""
Preconditions.checkArgument(verifyDateFormat("DAY", start), "Illegal date format");
Preconditions.checkArgument(0 <= duration && duration <= 60, " 0 <= duration <= 60");
String url = mBaseReportPath + mV2StatisticPath + "/groups?time_unit=DAY&start=" + start + "&duration=" + duration;
ResponseWrapper responseWrapper = _httpClient.sendGet(url);
return GroupStatListResult.fromResponse(responseWrapper);
} | java | public GroupStatListResult getGroupStatistic(String start, int duration)
throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(verifyDateFormat("DAY", start), "Illegal date format");
Preconditions.checkArgument(0 <= duration && duration <= 60, " 0 <= duration <= 60");
String url = mBaseReportPath + mV2StatisticPath + "/groups?time_unit=DAY&start=" + start + "&duration=" + duration;
ResponseWrapper responseWrapper = _httpClient.sendGet(url);
return GroupStatListResult.fromResponse(responseWrapper);
} | [
"public",
"GroupStatListResult",
"getGroupStatistic",
"(",
"String",
"start",
",",
"int",
"duration",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"verifyDateFormat",
"(",
"\"DAY\"",
",",
"start",
... | Get group statistic, time unit only supports DAY now.
@param start Format: yyyy-MM-dd
@param duration duration must between 0 and 60
@return {@link GroupStatListResult}
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"group",
"statistic",
"time",
"unit",
"only",
"supports",
"DAY",
"now",
"."
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/reportv2/ReportClient.java#L296-L303 |
TakahikoKawasaki/nv-websocket-client | src/main/java/com/neovisionaries/ws/client/WebSocket.java | WebSocket.sendContinuation | public WebSocket sendContinuation(String payload, boolean fin) {
"""
Send a continuation frame to the server.
<p>
This method is an alias of {@link #sendFrame(WebSocketFrame)
sendFrame}{@code (WebSocketFrame.}{@link
WebSocketFrame#createContinuationFrame(String)
createContinuationFrame}{@code (payload).}{@link
WebSocketFrame#setFin(boolean) setFin}{@code (fin))}.
</p>
@param payload
The payload of a continuation frame.
@param fin
The FIN bit value.
@return
{@code this} object.
"""
return sendFrame(WebSocketFrame.createContinuationFrame(payload).setFin(fin));
} | java | public WebSocket sendContinuation(String payload, boolean fin)
{
return sendFrame(WebSocketFrame.createContinuationFrame(payload).setFin(fin));
} | [
"public",
"WebSocket",
"sendContinuation",
"(",
"String",
"payload",
",",
"boolean",
"fin",
")",
"{",
"return",
"sendFrame",
"(",
"WebSocketFrame",
".",
"createContinuationFrame",
"(",
"payload",
")",
".",
"setFin",
"(",
"fin",
")",
")",
";",
"}"
] | Send a continuation frame to the server.
<p>
This method is an alias of {@link #sendFrame(WebSocketFrame)
sendFrame}{@code (WebSocketFrame.}{@link
WebSocketFrame#createContinuationFrame(String)
createContinuationFrame}{@code (payload).}{@link
WebSocketFrame#setFin(boolean) setFin}{@code (fin))}.
</p>
@param payload
The payload of a continuation frame.
@param fin
The FIN bit value.
@return
{@code this} object. | [
"Send",
"a",
"continuation",
"frame",
"to",
"the",
"server",
"."
] | train | https://github.com/TakahikoKawasaki/nv-websocket-client/blob/efaec21181d740ad3808313acf679313179e0825/src/main/java/com/neovisionaries/ws/client/WebSocket.java#L2859-L2862 |
Azure/azure-sdk-for-java | recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/BackupEnginesInner.java | BackupEnginesInner.getAsync | public Observable<Page<BackupEngineBaseResourceInner>> getAsync(final String vaultName, final String resourceGroupName, final String filter, final String skipToken) {
"""
The backup management servers registered to a Recovery Services vault. This returns a pageable list of servers.
@param vaultName The name of the Recovery Services vault.
@param resourceGroupName The name of the resource group associated with the Recovery Services vault.
@param filter Use this filter to choose the specific backup management server. backupManagementType { AzureIaasVM, MAB, DPM, AzureBackupServer, AzureSql }.
@param skipToken The Skip Token filter.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<BackupEngineBaseResourceInner> object
"""
return getWithServiceResponseAsync(vaultName, resourceGroupName, filter, skipToken)
.map(new Func1<ServiceResponse<Page<BackupEngineBaseResourceInner>>, Page<BackupEngineBaseResourceInner>>() {
@Override
public Page<BackupEngineBaseResourceInner> call(ServiceResponse<Page<BackupEngineBaseResourceInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<BackupEngineBaseResourceInner>> getAsync(final String vaultName, final String resourceGroupName, final String filter, final String skipToken) {
return getWithServiceResponseAsync(vaultName, resourceGroupName, filter, skipToken)
.map(new Func1<ServiceResponse<Page<BackupEngineBaseResourceInner>>, Page<BackupEngineBaseResourceInner>>() {
@Override
public Page<BackupEngineBaseResourceInner> call(ServiceResponse<Page<BackupEngineBaseResourceInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"BackupEngineBaseResourceInner",
">",
">",
"getAsync",
"(",
"final",
"String",
"vaultName",
",",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"filter",
",",
"final",
"String",
"skipToken",
")",
"{",
"r... | The backup management servers registered to a Recovery Services vault. This returns a pageable list of servers.
@param vaultName The name of the Recovery Services vault.
@param resourceGroupName The name of the resource group associated with the Recovery Services vault.
@param filter Use this filter to choose the specific backup management server. backupManagementType { AzureIaasVM, MAB, DPM, AzureBackupServer, AzureSql }.
@param skipToken The Skip Token filter.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<BackupEngineBaseResourceInner> object | [
"The",
"backup",
"management",
"servers",
"registered",
"to",
"a",
"Recovery",
"Services",
"vault",
".",
"This",
"returns",
"a",
"pageable",
"list",
"of",
"servers",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/BackupEnginesInner.java#L242-L250 |
jparsec/jparsec | jparsec/src/main/java/org/jparsec/SourceLocator.java | SourceLocator.scanTo | @Private Location scanTo(int index) {
"""
Scans from {@code nextIndex} to {@code ind} and saves all indices of line break characters
into {@code lineBreakIndices} and adjusts the current column number as it goes. The location of
the character on {@code ind} is returned.
<p> After this method returns, {@code nextIndex} and {@code nextColumnIndex} will point to the
next character to be scanned or the EOF if the end of input is encountered.
"""
boolean eof = false;
if (index == source.length()) { // The eof has index size() + 1
eof = true;
index--;
}
int columnIndex = nextColumnIndex;
for (int i = nextIndex; i <= index; i++) {
char c = source.charAt(i);
if (c == LINE_BREAK) {
lineBreakIndices.add(i);
columnIndex = 0;
}
else columnIndex++;
}
this.nextIndex = index + 1;
this.nextColumnIndex = columnIndex;
int lines = lineBreakIndices.size();
if (eof) return location(lines, columnIndex);
if (columnIndex == 0) return getLineBreakLocation(lines - 1);
return location(lines, columnIndex - 1);
} | java | @Private Location scanTo(int index) {
boolean eof = false;
if (index == source.length()) { // The eof has index size() + 1
eof = true;
index--;
}
int columnIndex = nextColumnIndex;
for (int i = nextIndex; i <= index; i++) {
char c = source.charAt(i);
if (c == LINE_BREAK) {
lineBreakIndices.add(i);
columnIndex = 0;
}
else columnIndex++;
}
this.nextIndex = index + 1;
this.nextColumnIndex = columnIndex;
int lines = lineBreakIndices.size();
if (eof) return location(lines, columnIndex);
if (columnIndex == 0) return getLineBreakLocation(lines - 1);
return location(lines, columnIndex - 1);
} | [
"@",
"Private",
"Location",
"scanTo",
"(",
"int",
"index",
")",
"{",
"boolean",
"eof",
"=",
"false",
";",
"if",
"(",
"index",
"==",
"source",
".",
"length",
"(",
")",
")",
"{",
"// The eof has index size() + 1",
"eof",
"=",
"true",
";",
"index",
"--",
... | Scans from {@code nextIndex} to {@code ind} and saves all indices of line break characters
into {@code lineBreakIndices} and adjusts the current column number as it goes. The location of
the character on {@code ind} is returned.
<p> After this method returns, {@code nextIndex} and {@code nextColumnIndex} will point to the
next character to be scanned or the EOF if the end of input is encountered. | [
"Scans",
"from",
"{",
"@code",
"nextIndex",
"}",
"to",
"{",
"@code",
"ind",
"}",
"and",
"saves",
"all",
"indices",
"of",
"line",
"break",
"characters",
"into",
"{",
"@code",
"lineBreakIndices",
"}",
"and",
"adjusts",
"the",
"current",
"column",
"number",
"... | train | https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/SourceLocator.java#L102-L123 |
nikolavp/approval | approval-core/src/main/java/com/github/approval/Pre.java | Pre.notNull | public static void notNull(@Nullable Object value, String name) {
"""
Verify that a value is not null.
@param value the value to verify
@param name the name of the value that will be used in the exception message.
"""
if (value == null) {
throw new IllegalArgumentException(name + " must not be null!");
}
} | java | public static void notNull(@Nullable Object value, String name) {
if (value == null) {
throw new IllegalArgumentException(name + " must not be null!");
}
} | [
"public",
"static",
"void",
"notNull",
"(",
"@",
"Nullable",
"Object",
"value",
",",
"String",
"name",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"name",
"+",
"\" must not be null!\"",
")",
";",
"... | Verify that a value is not null.
@param value the value to verify
@param name the name of the value that will be used in the exception message. | [
"Verify",
"that",
"a",
"value",
"is",
"not",
"null",
"."
] | train | https://github.com/nikolavp/approval/blob/5e32ecc3bc7f631e94a7049894fdd99a3aa5b1b8/approval-core/src/main/java/com/github/approval/Pre.java#L39-L43 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.callUninterruptibly | public static <T> T callUninterruptibly(final long timeoutInMillis, final Try.LongFunction<T, InterruptedException> cmd) {
"""
Note: Copied from Google Guava under Apache License v2.0
<br />
<br />
If a thread is interrupted during such a call, the call continues to block until the result is available or the
timeout elapses, and only then re-interrupts the thread.
@param timeoutInMillis
@param cmd
@return
"""
N.checkArgNotNull(cmd);
boolean interrupted = false;
try {
long remainingMillis = timeoutInMillis;
final long sysMillis = System.currentTimeMillis();
final long end = remainingMillis >= Long.MAX_VALUE - sysMillis ? Long.MAX_VALUE : sysMillis + remainingMillis;
while (true) {
try {
return cmd.apply(remainingMillis);
} catch (InterruptedException e) {
interrupted = true;
remainingMillis = end - System.currentTimeMillis();
}
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
} | java | public static <T> T callUninterruptibly(final long timeoutInMillis, final Try.LongFunction<T, InterruptedException> cmd) {
N.checkArgNotNull(cmd);
boolean interrupted = false;
try {
long remainingMillis = timeoutInMillis;
final long sysMillis = System.currentTimeMillis();
final long end = remainingMillis >= Long.MAX_VALUE - sysMillis ? Long.MAX_VALUE : sysMillis + remainingMillis;
while (true) {
try {
return cmd.apply(remainingMillis);
} catch (InterruptedException e) {
interrupted = true;
remainingMillis = end - System.currentTimeMillis();
}
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"callUninterruptibly",
"(",
"final",
"long",
"timeoutInMillis",
",",
"final",
"Try",
".",
"LongFunction",
"<",
"T",
",",
"InterruptedException",
">",
"cmd",
")",
"{",
"N",
".",
"checkArgNotNull",
"(",
"cmd",
")",
";"... | Note: Copied from Google Guava under Apache License v2.0
<br />
<br />
If a thread is interrupted during such a call, the call continues to block until the result is available or the
timeout elapses, and only then re-interrupts the thread.
@param timeoutInMillis
@param cmd
@return | [
"Note",
":",
"Copied",
"from",
"Google",
"Guava",
"under",
"Apache",
"License",
"v2",
".",
"0",
"<br",
"/",
">",
"<br",
"/",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L28069-L28092 |
bsblabs/embed-for-vaadin | com.bsb.common.vaadin.embed/src/main/java/com/bsb/common/vaadin/embed/EmbedVaadinConfig.java | EmbedVaadinConfig.buildUrl | static String buildUrl(int httpPort, String context) {
"""
Build a url for the specified port and context.
<p/>
If the <tt>httpPort</tt> is equal to {@link #PORT_AUTO}, the
returned url is not used as is because no http port has been
allocated yet.
@param httpPort the http port to use
@param context the context of the url
@return a <tt>localhost</tt> url for the specified port and context
"""
final StringBuilder sb = new StringBuilder();
sb.append("http://localhost:");
if (httpPort == PORT_AUTO) {
sb.append("[auto]");
} else {
sb.append(httpPort);
}
sb.append(context);
return sb.toString();
} | java | static String buildUrl(int httpPort, String context) {
final StringBuilder sb = new StringBuilder();
sb.append("http://localhost:");
if (httpPort == PORT_AUTO) {
sb.append("[auto]");
} else {
sb.append(httpPort);
}
sb.append(context);
return sb.toString();
} | [
"static",
"String",
"buildUrl",
"(",
"int",
"httpPort",
",",
"String",
"context",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"http://localhost:\"",
")",
";",
"if",
"(",
"httpPort",
"=="... | Build a url for the specified port and context.
<p/>
If the <tt>httpPort</tt> is equal to {@link #PORT_AUTO}, the
returned url is not used as is because no http port has been
allocated yet.
@param httpPort the http port to use
@param context the context of the url
@return a <tt>localhost</tt> url for the specified port and context | [
"Build",
"a",
"url",
"for",
"the",
"specified",
"port",
"and",
"context",
".",
"<p",
"/",
">",
"If",
"the",
"<tt",
">",
"httpPort<",
"/",
"tt",
">",
"is",
"equal",
"to",
"{",
"@link",
"#PORT_AUTO",
"}",
"the",
"returned",
"url",
"is",
"not",
"used",
... | train | https://github.com/bsblabs/embed-for-vaadin/blob/f902e70def56ab54d287d2600f9c6eef9e66c225/com.bsb.common.vaadin.embed/src/main/java/com/bsb/common/vaadin/embed/EmbedVaadinConfig.java#L417-L428 |
LearnLib/learnlib | algorithms/active/ttt/src/main/java/de/learnlib/algorithms/ttt/base/AbstractTTTLearner.java | AbstractTTTLearner.refineHypothesisSingle | protected boolean refineHypothesisSingle(DefaultQuery<I, D> ceQuery) {
"""
Performs a single refinement of the hypothesis, i.e., without repeated counterexample evaluation. The parameter
and return value have the same significance as in {@link #refineHypothesis(DefaultQuery)}.
@param ceQuery
the counterexample (query) to be used for refinement
@return {@code true} if the hypothesis was refined, {@code false} otherwise
"""
TTTState<I, D> state = getAnyState(ceQuery.getPrefix());
D out = computeHypothesisOutput(state, ceQuery.getSuffix());
if (Objects.equals(out, ceQuery.getOutput())) {
return false;
}
OutputInconsistency<I, D> outIncons =
new OutputInconsistency<>(state, ceQuery.getSuffix(), ceQuery.getOutput());
do {
splitState(outIncons);
closeTransitions();
while (finalizeAny()) {
closeTransitions();
}
outIncons = findOutputInconsistency();
} while (outIncons != null);
assert allNodesFinal();
return true;
} | java | protected boolean refineHypothesisSingle(DefaultQuery<I, D> ceQuery) {
TTTState<I, D> state = getAnyState(ceQuery.getPrefix());
D out = computeHypothesisOutput(state, ceQuery.getSuffix());
if (Objects.equals(out, ceQuery.getOutput())) {
return false;
}
OutputInconsistency<I, D> outIncons =
new OutputInconsistency<>(state, ceQuery.getSuffix(), ceQuery.getOutput());
do {
splitState(outIncons);
closeTransitions();
while (finalizeAny()) {
closeTransitions();
}
outIncons = findOutputInconsistency();
} while (outIncons != null);
assert allNodesFinal();
return true;
} | [
"protected",
"boolean",
"refineHypothesisSingle",
"(",
"DefaultQuery",
"<",
"I",
",",
"D",
">",
"ceQuery",
")",
"{",
"TTTState",
"<",
"I",
",",
"D",
">",
"state",
"=",
"getAnyState",
"(",
"ceQuery",
".",
"getPrefix",
"(",
")",
")",
";",
"D",
"out",
"="... | Performs a single refinement of the hypothesis, i.e., without repeated counterexample evaluation. The parameter
and return value have the same significance as in {@link #refineHypothesis(DefaultQuery)}.
@param ceQuery
the counterexample (query) to be used for refinement
@return {@code true} if the hypothesis was refined, {@code false} otherwise | [
"Performs",
"a",
"single",
"refinement",
"of",
"the",
"hypothesis",
"i",
".",
"e",
".",
"without",
"repeated",
"counterexample",
"evaluation",
".",
"The",
"parameter",
"and",
"return",
"value",
"have",
"the",
"same",
"significance",
"as",
"in",
"{",
"@link",
... | train | https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/algorithms/active/ttt/src/main/java/de/learnlib/algorithms/ttt/base/AbstractTTTLearner.java#L200-L223 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/common/lib/auth/AuthorizationHeaderProvider.java | AuthorizationHeaderProvider.getOAuth2Header | private String getOAuth2Header(OAuth2Compatible oAuth2Compatible) throws OAuthException {
"""
Gets the OAuth2 header.
@throws OAuthException if the OAuth2 token could not be refreshed.
"""
if (adsLibConfiguration.isAutoRefreshOAuth2TokenEnabled()) {
try {
oAuth2Helper.refreshCredential(oAuth2Compatible.getOAuth2Credential());
} catch (IOException e) {
throw new OAuthException("OAuth2 token could not be refreshed.", e);
}
}
return oAuth2AuthorizationHeaderProvider.getOAuth2AuthorizationHeader(oAuth2Compatible);
} | java | private String getOAuth2Header(OAuth2Compatible oAuth2Compatible) throws OAuthException {
if (adsLibConfiguration.isAutoRefreshOAuth2TokenEnabled()) {
try {
oAuth2Helper.refreshCredential(oAuth2Compatible.getOAuth2Credential());
} catch (IOException e) {
throw new OAuthException("OAuth2 token could not be refreshed.", e);
}
}
return oAuth2AuthorizationHeaderProvider.getOAuth2AuthorizationHeader(oAuth2Compatible);
} | [
"private",
"String",
"getOAuth2Header",
"(",
"OAuth2Compatible",
"oAuth2Compatible",
")",
"throws",
"OAuthException",
"{",
"if",
"(",
"adsLibConfiguration",
".",
"isAutoRefreshOAuth2TokenEnabled",
"(",
")",
")",
"{",
"try",
"{",
"oAuth2Helper",
".",
"refreshCredential",... | Gets the OAuth2 header.
@throws OAuthException if the OAuth2 token could not be refreshed. | [
"Gets",
"the",
"OAuth2",
"header",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/auth/AuthorizationHeaderProvider.java#L86-L96 |
SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/GroupWsRef.java | GroupWsRef.fromId | static GroupWsRef fromId(int id) {
"""
Creates a reference to a group by its id. Virtual groups "Anyone" can't be returned
as they can't be referenced by an id.
"""
checkArgument(id > -1, "Group id must be positive: %s", id);
return new GroupWsRef(id, null, null);
} | java | static GroupWsRef fromId(int id) {
checkArgument(id > -1, "Group id must be positive: %s", id);
return new GroupWsRef(id, null, null);
} | [
"static",
"GroupWsRef",
"fromId",
"(",
"int",
"id",
")",
"{",
"checkArgument",
"(",
"id",
">",
"-",
"1",
",",
"\"Group id must be positive: %s\"",
",",
"id",
")",
";",
"return",
"new",
"GroupWsRef",
"(",
"id",
",",
"null",
",",
"null",
")",
";",
"}"
] | Creates a reference to a group by its id. Virtual groups "Anyone" can't be returned
as they can't be referenced by an id. | [
"Creates",
"a",
"reference",
"to",
"a",
"group",
"by",
"its",
"id",
".",
"Virtual",
"groups",
"Anyone",
"can",
"t",
"be",
"returned",
"as",
"they",
"can",
"t",
"be",
"referenced",
"by",
"an",
"id",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/GroupWsRef.java#L98-L101 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CredentialsInner.java | CredentialsInner.createOrUpdate | public CredentialInner createOrUpdate(String resourceGroupName, String automationAccountName, String credentialName, CredentialCreateOrUpdateParameters parameters) {
"""
Create a credential.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param credentialName The parameters supplied to the create or update credential operation.
@param parameters The parameters supplied to the create or update credential operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the CredentialInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, credentialName, parameters).toBlocking().single().body();
} | java | public CredentialInner createOrUpdate(String resourceGroupName, String automationAccountName, String credentialName, CredentialCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, credentialName, parameters).toBlocking().single().body();
} | [
"public",
"CredentialInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"credentialName",
",",
"CredentialCreateOrUpdateParameters",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"("... | Create a credential.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param credentialName The parameters supplied to the create or update credential operation.
@param parameters The parameters supplied to the create or update credential operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the CredentialInner object if successful. | [
"Create",
"a",
"credential",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CredentialsInner.java#L287-L289 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java | OjbTagsHandler.originalClass | public void originalClass(String template, Properties attributes) throws XDocletException {
"""
Processes the original class rather than the current class definition.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block"
"""
pushCurrentClass(_curClassDef.getOriginalClass());
generate(template);
popCurrentClass();
} | java | public void originalClass(String template, Properties attributes) throws XDocletException
{
pushCurrentClass(_curClassDef.getOriginalClass());
generate(template);
popCurrentClass();
} | [
"public",
"void",
"originalClass",
"(",
"String",
"template",
",",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"pushCurrentClass",
"(",
"_curClassDef",
".",
"getOriginalClass",
"(",
")",
")",
";",
"generate",
"(",
"template",
")",
";",
"p... | Processes the original class rather than the current class definition.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block" | [
"Processes",
"the",
"original",
"class",
"rather",
"than",
"the",
"current",
"class",
"definition",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java#L192-L197 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/AirlineBoardingPassTemplateBuilder.java | AirlineBoardingPassTemplateBuilder.addQuickReply | public AirlineBoardingPassTemplateBuilder addQuickReply(String title,
String payload) {
"""
Adds a {@link QuickReply} to the current object.
@param title
the quick reply button label. It can't be empty.
@param payload
the payload sent back when the button is pressed. It can't be
empty.
@return this builder.
@see <a href=
"https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies"
> Facebook's Messenger Platform Quick Replies Documentation</a>
"""
this.messageBuilder.addQuickReply(title, payload);
return this;
} | java | public AirlineBoardingPassTemplateBuilder addQuickReply(String title,
String payload) {
this.messageBuilder.addQuickReply(title, payload);
return this;
} | [
"public",
"AirlineBoardingPassTemplateBuilder",
"addQuickReply",
"(",
"String",
"title",
",",
"String",
"payload",
")",
"{",
"this",
".",
"messageBuilder",
".",
"addQuickReply",
"(",
"title",
",",
"payload",
")",
";",
"return",
"this",
";",
"}"
] | Adds a {@link QuickReply} to the current object.
@param title
the quick reply button label. It can't be empty.
@param payload
the payload sent back when the button is pressed. It can't be
empty.
@return this builder.
@see <a href=
"https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies"
> Facebook's Messenger Platform Quick Replies Documentation</a> | [
"Adds",
"a",
"{",
"@link",
"QuickReply",
"}",
"to",
"the",
"current",
"object",
"."
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/AirlineBoardingPassTemplateBuilder.java#L140-L144 |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java | HttpUtil.getHeadersFromRequest | public static Header[] getHeadersFromRequest(HttpServletRequest request) {
"""
Extract headers from {@link HttpServletRequest}
@param request {@link HttpServletRequest} to extract headers from
@return Array with {@link Header}s
"""
List<Header> returnHeaderList = new ArrayList<>();
Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
Enumeration<String> headerValues = request.getHeaders(headerName);
while (headerValues.hasMoreElements()) {
String headerValue = headerValues.nextElement();
// as cookies are sent in headers, we'll also have to check for unsupported cookies here
if (headerName.toLowerCase().equals("cookie")) {
String[] cookies = headerValue.split(";");
List<String> newCookieList = new ArrayList<>();
for (int i = 0; i < cookies.length; i++) {
final String cookieFromArray = cookies[i];
newCookieList.add(cookieFromArray);
}
// rewrite the cookie value
headerValue = StringUtils.join(newCookieList, ";");
}
if (headerValue.isEmpty()) {
LOG.debug("Skipping request header '" + headerName + "' as it's value is empty (possibly an "
+ "unsupported cookie value has been removed)");
} else {
LOG.debug("Adding request header: " + headerName + "=" + headerValue);
returnHeaderList.add(new BasicHeader(headerName, headerValue));
}
}
}
Header[] headersArray = new Header[returnHeaderList.size()];
headersArray = returnHeaderList.toArray(headersArray);
return headersArray;
} | java | public static Header[] getHeadersFromRequest(HttpServletRequest request) {
List<Header> returnHeaderList = new ArrayList<>();
Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
Enumeration<String> headerValues = request.getHeaders(headerName);
while (headerValues.hasMoreElements()) {
String headerValue = headerValues.nextElement();
// as cookies are sent in headers, we'll also have to check for unsupported cookies here
if (headerName.toLowerCase().equals("cookie")) {
String[] cookies = headerValue.split(";");
List<String> newCookieList = new ArrayList<>();
for (int i = 0; i < cookies.length; i++) {
final String cookieFromArray = cookies[i];
newCookieList.add(cookieFromArray);
}
// rewrite the cookie value
headerValue = StringUtils.join(newCookieList, ";");
}
if (headerValue.isEmpty()) {
LOG.debug("Skipping request header '" + headerName + "' as it's value is empty (possibly an "
+ "unsupported cookie value has been removed)");
} else {
LOG.debug("Adding request header: " + headerName + "=" + headerValue);
returnHeaderList.add(new BasicHeader(headerName, headerValue));
}
}
}
Header[] headersArray = new Header[returnHeaderList.size()];
headersArray = returnHeaderList.toArray(headersArray);
return headersArray;
} | [
"public",
"static",
"Header",
"[",
"]",
"getHeadersFromRequest",
"(",
"HttpServletRequest",
"request",
")",
"{",
"List",
"<",
"Header",
">",
"returnHeaderList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Enumeration",
"<",
"String",
">",
"headerNames",
"="... | Extract headers from {@link HttpServletRequest}
@param request {@link HttpServletRequest} to extract headers from
@return Array with {@link Header}s | [
"Extract",
"headers",
"from",
"{",
"@link",
"HttpServletRequest",
"}"
] | train | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java#L2001-L2037 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/PathMappingResult.java | PathMappingResult.of | public static PathMappingResult of(String path, @Nullable String query,
Map<String, String> rawPathParams, int score) {
"""
Creates a new instance with the specified {@code path}, {@code query}, the extracted path parameters
and the score.
"""
requireNonNull(path, "path");
requireNonNull(rawPathParams, "rawPathParams");
return new PathMappingResult(path, query, rawPathParams, score);
} | java | public static PathMappingResult of(String path, @Nullable String query,
Map<String, String> rawPathParams, int score) {
requireNonNull(path, "path");
requireNonNull(rawPathParams, "rawPathParams");
return new PathMappingResult(path, query, rawPathParams, score);
} | [
"public",
"static",
"PathMappingResult",
"of",
"(",
"String",
"path",
",",
"@",
"Nullable",
"String",
"query",
",",
"Map",
"<",
"String",
",",
"String",
">",
"rawPathParams",
",",
"int",
"score",
")",
"{",
"requireNonNull",
"(",
"path",
",",
"\"path\"",
")... | Creates a new instance with the specified {@code path}, {@code query}, the extracted path parameters
and the score. | [
"Creates",
"a",
"new",
"instance",
"with",
"the",
"specified",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/PathMappingResult.java#L74-L79 |
pressgang-ccms/PressGangCCMSContentSpec | src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java | ContentSpecUtilities.getContentSpecRevisionsById | public static RevisionList getContentSpecRevisionsById(final ContentSpecProvider contentSpecProvider, final Integer csId) {
"""
/*
Gets a list of Revision's from the CSProcessor database for a specific content spec
"""
final List<Revision> results = new ArrayList<Revision>();
final CollectionWrapper<ContentSpecWrapper> contentSpecRevisions = contentSpecProvider.getContentSpec(csId).getRevisions();
// Create the unique array from the revisions
if (contentSpecRevisions != null && contentSpecRevisions.getItems() != null) {
final List<ContentSpecWrapper> contentSpecRevs = contentSpecRevisions.getItems();
for (final ContentSpecWrapper contentSpecRev : contentSpecRevs) {
Revision revision = new Revision();
revision.setRevision(contentSpecRev.getRevision());
revision.setDate(contentSpecRev.getLastModified());
results.add(revision);
}
Collections.sort(results, new EnversRevisionSort());
return new RevisionList(csId, "Content Specification", results);
} else {
return null;
}
} | java | public static RevisionList getContentSpecRevisionsById(final ContentSpecProvider contentSpecProvider, final Integer csId) {
final List<Revision> results = new ArrayList<Revision>();
final CollectionWrapper<ContentSpecWrapper> contentSpecRevisions = contentSpecProvider.getContentSpec(csId).getRevisions();
// Create the unique array from the revisions
if (contentSpecRevisions != null && contentSpecRevisions.getItems() != null) {
final List<ContentSpecWrapper> contentSpecRevs = contentSpecRevisions.getItems();
for (final ContentSpecWrapper contentSpecRev : contentSpecRevs) {
Revision revision = new Revision();
revision.setRevision(contentSpecRev.getRevision());
revision.setDate(contentSpecRev.getLastModified());
results.add(revision);
}
Collections.sort(results, new EnversRevisionSort());
return new RevisionList(csId, "Content Specification", results);
} else {
return null;
}
} | [
"public",
"static",
"RevisionList",
"getContentSpecRevisionsById",
"(",
"final",
"ContentSpecProvider",
"contentSpecProvider",
",",
"final",
"Integer",
"csId",
")",
"{",
"final",
"List",
"<",
"Revision",
">",
"results",
"=",
"new",
"ArrayList",
"<",
"Revision",
">",... | /*
Gets a list of Revision's from the CSProcessor database for a specific content spec | [
"/",
"*",
"Gets",
"a",
"list",
"of",
"Revision",
"s",
"from",
"the",
"CSProcessor",
"database",
"for",
"a",
"specific",
"content",
"spec"
] | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java#L320-L340 |
citrusframework/citrus | modules/citrus-vertx/src/main/java/com/consol/citrus/vertx/endpoint/VertxSyncConsumer.java | VertxSyncConsumer.saveReplyDestination | public void saveReplyDestination(Message receivedMessage, TestContext context) {
"""
Store the reply address either straight forward or with a given
message correlation key.
@param receivedMessage
@param context
"""
if (receivedMessage.getHeader(CitrusVertxMessageHeaders.VERTX_REPLY_ADDRESS) != null) {
String correlationKeyName = endpointConfiguration.getCorrelator().getCorrelationKeyName(getName());
String correlationKey = endpointConfiguration.getCorrelator().getCorrelationKey(receivedMessage);
correlationManager.saveCorrelationKey(correlationKeyName, correlationKey, context);
correlationManager.store(correlationKey, receivedMessage.getHeader(CitrusVertxMessageHeaders.VERTX_REPLY_ADDRESS).toString());
} else {
log.warn("Unable to retrieve reply address for message \n" +
receivedMessage + "\n - no reply address found in message headers!");
}
} | java | public void saveReplyDestination(Message receivedMessage, TestContext context) {
if (receivedMessage.getHeader(CitrusVertxMessageHeaders.VERTX_REPLY_ADDRESS) != null) {
String correlationKeyName = endpointConfiguration.getCorrelator().getCorrelationKeyName(getName());
String correlationKey = endpointConfiguration.getCorrelator().getCorrelationKey(receivedMessage);
correlationManager.saveCorrelationKey(correlationKeyName, correlationKey, context);
correlationManager.store(correlationKey, receivedMessage.getHeader(CitrusVertxMessageHeaders.VERTX_REPLY_ADDRESS).toString());
} else {
log.warn("Unable to retrieve reply address for message \n" +
receivedMessage + "\n - no reply address found in message headers!");
}
} | [
"public",
"void",
"saveReplyDestination",
"(",
"Message",
"receivedMessage",
",",
"TestContext",
"context",
")",
"{",
"if",
"(",
"receivedMessage",
".",
"getHeader",
"(",
"CitrusVertxMessageHeaders",
".",
"VERTX_REPLY_ADDRESS",
")",
"!=",
"null",
")",
"{",
"String",... | Store the reply address either straight forward or with a given
message correlation key.
@param receivedMessage
@param context | [
"Store",
"the",
"reply",
"address",
"either",
"straight",
"forward",
"or",
"with",
"a",
"given",
"message",
"correlation",
"key",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-vertx/src/main/java/com/consol/citrus/vertx/endpoint/VertxSyncConsumer.java#L97-L107 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java | PolicyStatesInner.summarizeForSubscriptionLevelPolicyAssignment | public SummarizeResultsInner summarizeForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) {
"""
Summarizes policy states for the subscription level policy assignment.
@param subscriptionId Microsoft Azure subscription ID.
@param policyAssignmentName Policy assignment name.
@param queryOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws QueryFailureException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the SummarizeResultsInner object if successful.
"""
return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).toBlocking().single().body();
} | java | public SummarizeResultsInner summarizeForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) {
return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).toBlocking().single().body();
} | [
"public",
"SummarizeResultsInner",
"summarizeForSubscriptionLevelPolicyAssignment",
"(",
"String",
"subscriptionId",
",",
"String",
"policyAssignmentName",
",",
"QueryOptions",
"queryOptions",
")",
"{",
"return",
"summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync",
... | Summarizes policy states for the subscription level policy assignment.
@param subscriptionId Microsoft Azure subscription ID.
@param policyAssignmentName Policy assignment name.
@param queryOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws QueryFailureException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the SummarizeResultsInner object if successful. | [
"Summarizes",
"policy",
"states",
"for",
"the",
"subscription",
"level",
"policy",
"assignment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L2773-L2775 |
hawkular/hawkular-commons | hawkular-inventory-parent/hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/model/Resource.java | Resource.fromRaw | public static Resource fromRaw(RawResource r, Function<String, Optional<ResourceType>> rtLoader) {
"""
Converts {@link RawResource} into {@link Resource} using loader for {@link ResourceType}.
The children are not loaded.
@param r the resource to convert
@param rtLoader loader for {@link ResourceType}
@return the node without its subtree
"""
return new Resource(r.getId(), r.getName(), r.getFeedId(), rtLoader.apply(r.getTypeId()).orElse(null),
r.getParentId(), r.getMetrics(), r.getProperties(), r.getConfig());
} | java | public static Resource fromRaw(RawResource r, Function<String, Optional<ResourceType>> rtLoader) {
return new Resource(r.getId(), r.getName(), r.getFeedId(), rtLoader.apply(r.getTypeId()).orElse(null),
r.getParentId(), r.getMetrics(), r.getProperties(), r.getConfig());
} | [
"public",
"static",
"Resource",
"fromRaw",
"(",
"RawResource",
"r",
",",
"Function",
"<",
"String",
",",
"Optional",
"<",
"ResourceType",
">",
">",
"rtLoader",
")",
"{",
"return",
"new",
"Resource",
"(",
"r",
".",
"getId",
"(",
")",
",",
"r",
".",
"get... | Converts {@link RawResource} into {@link Resource} using loader for {@link ResourceType}.
The children are not loaded.
@param r the resource to convert
@param rtLoader loader for {@link ResourceType}
@return the node without its subtree | [
"Converts",
"{"
] | train | https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-inventory-parent/hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/model/Resource.java#L112-L115 |
derari/cthul | objects/src/main/java/org/cthul/objects/reflection/Signatures.java | Signatures.bestConstructor | public static <T> Constructor<T> bestConstructor(Constructor<T>[] constructors, Object[] args) throws AmbiguousConstructorMatchException {
"""
Selects the best constructor for the given arguments.
@param <T>
@param constructors
@param args
@return constructor, or {@code null}
@throws AmbiguousSignatureMatchException if multiple constructors match equally
"""
return bestConstructor(constructors, collectArgTypes(args));
} | java | public static <T> Constructor<T> bestConstructor(Constructor<T>[] constructors, Object[] args) throws AmbiguousConstructorMatchException {
return bestConstructor(constructors, collectArgTypes(args));
} | [
"public",
"static",
"<",
"T",
">",
"Constructor",
"<",
"T",
">",
"bestConstructor",
"(",
"Constructor",
"<",
"T",
">",
"[",
"]",
"constructors",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"AmbiguousConstructorMatchException",
"{",
"return",
"bestConstruct... | Selects the best constructor for the given arguments.
@param <T>
@param constructors
@param args
@return constructor, or {@code null}
@throws AmbiguousSignatureMatchException if multiple constructors match equally | [
"Selects",
"the",
"best",
"constructor",
"for",
"the",
"given",
"arguments",
"."
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/reflection/Signatures.java#L55-L57 |
Azure/azure-sdk-for-java | batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/FileServersInner.java | FileServersInner.getAsync | public Observable<FileServerInner> getAsync(String resourceGroupName, String workspaceName, String fileServerName) {
"""
Gets information about a File Server.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param fileServerName The name of the file server within the specified resource group. File server names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the FileServerInner object
"""
return getWithServiceResponseAsync(resourceGroupName, workspaceName, fileServerName).map(new Func1<ServiceResponse<FileServerInner>, FileServerInner>() {
@Override
public FileServerInner call(ServiceResponse<FileServerInner> response) {
return response.body();
}
});
} | java | public Observable<FileServerInner> getAsync(String resourceGroupName, String workspaceName, String fileServerName) {
return getWithServiceResponseAsync(resourceGroupName, workspaceName, fileServerName).map(new Func1<ServiceResponse<FileServerInner>, FileServerInner>() {
@Override
public FileServerInner call(ServiceResponse<FileServerInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"FileServerInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"workspaceName",
",",
"String",
"fileServerName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"workspaceName",
",",
... | Gets information about a File Server.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param fileServerName The name of the file server within the specified resource group. File server names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the FileServerInner object | [
"Gets",
"information",
"about",
"a",
"File",
"Server",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/FileServersInner.java#L962-L969 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/converter/object/TabularDataConverter.java | TabularDataConverter.convertTabularDataFromFullRepresentation | private TabularData convertTabularDataFromFullRepresentation(JSONObject pValue, TabularType pType) {
"""
Convert complex representation containing "indexNames" and "values"
"""
JSONAware jsonVal;
jsonVal = (JSONAware) pValue.get("values");
if (!(jsonVal instanceof JSONArray)) {
throw new IllegalArgumentException("Values for tabular data of type " +
pType + " must given as JSON array, not " + jsonVal.getClass());
}
TabularDataSupport tabularData = new TabularDataSupport(pType);
for (Object val : (JSONArray) jsonVal) {
if (!(val instanceof JSONObject)) {
throw new IllegalArgumentException("Tabular-Data values must be given as JSON objects, not " + val.getClass());
}
tabularData.put((CompositeData) getDispatcher().convertToObject(pType.getRowType(), val));
}
return tabularData;
} | java | private TabularData convertTabularDataFromFullRepresentation(JSONObject pValue, TabularType pType) {
JSONAware jsonVal;
jsonVal = (JSONAware) pValue.get("values");
if (!(jsonVal instanceof JSONArray)) {
throw new IllegalArgumentException("Values for tabular data of type " +
pType + " must given as JSON array, not " + jsonVal.getClass());
}
TabularDataSupport tabularData = new TabularDataSupport(pType);
for (Object val : (JSONArray) jsonVal) {
if (!(val instanceof JSONObject)) {
throw new IllegalArgumentException("Tabular-Data values must be given as JSON objects, not " + val.getClass());
}
tabularData.put((CompositeData) getDispatcher().convertToObject(pType.getRowType(), val));
}
return tabularData;
} | [
"private",
"TabularData",
"convertTabularDataFromFullRepresentation",
"(",
"JSONObject",
"pValue",
",",
"TabularType",
"pType",
")",
"{",
"JSONAware",
"jsonVal",
";",
"jsonVal",
"=",
"(",
"JSONAware",
")",
"pValue",
".",
"get",
"(",
"\"values\"",
")",
";",
"if",
... | Convert complex representation containing "indexNames" and "values" | [
"Convert",
"complex",
"representation",
"containing",
"indexNames",
"and",
"values"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/converter/object/TabularDataConverter.java#L159-L175 |
fuinorg/utils4swing | src/main/java/org/fuin/utils4swing/common/Utils4Swing.java | Utils4Swing.createShowAndPosition | public static JFrame createShowAndPosition(final String title, final Container content,
final boolean exitOnClose, final FramePositioner positioner) {
"""
Create a new resizeable frame with a panel as it's content pane and
position the frame.
@param title
Frame title.
@param content
Content.
@param exitOnClose
Exit the program on closing the frame?
@param positioner
FramePositioner.
@return A visible frame at the preferred position.
"""
return createShowAndPosition(title, content, exitOnClose, true, positioner);
} | java | public static JFrame createShowAndPosition(final String title, final Container content,
final boolean exitOnClose, final FramePositioner positioner) {
return createShowAndPosition(title, content, exitOnClose, true, positioner);
} | [
"public",
"static",
"JFrame",
"createShowAndPosition",
"(",
"final",
"String",
"title",
",",
"final",
"Container",
"content",
",",
"final",
"boolean",
"exitOnClose",
",",
"final",
"FramePositioner",
"positioner",
")",
"{",
"return",
"createShowAndPosition",
"(",
"ti... | Create a new resizeable frame with a panel as it's content pane and
position the frame.
@param title
Frame title.
@param content
Content.
@param exitOnClose
Exit the program on closing the frame?
@param positioner
FramePositioner.
@return A visible frame at the preferred position. | [
"Create",
"a",
"new",
"resizeable",
"frame",
"with",
"a",
"panel",
"as",
"it",
"s",
"content",
"pane",
"and",
"position",
"the",
"frame",
"."
] | train | https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/common/Utils4Swing.java#L66-L69 |
protostuff/protostuff | protostuff-core/src/main/java/io/protostuff/GraphIOUtil.java | GraphIOUtil.mergeDelimitedFrom | public static <T> int mergeDelimitedFrom(InputStream in, T message, Schema<T> schema)
throws IOException {
"""
Merges the {@code message} (delimited) from the {@link InputStream} using the given {@code schema}.
@return the size of the message
"""
final int size = in.read();
if (size == -1)
throw ProtobufException.truncatedMessage();
final int len = size < 0x80 ? size : CodedInput.readRawVarint32(in, size);
if (len < 0)
throw ProtobufException.negativeSize();
if (len != 0)
{
// not an empty message
if (len > CodedInput.DEFAULT_BUFFER_SIZE)
{
// message too big
final CodedInput input = new CodedInput(new LimitedInputStream(in, len),
true);
final GraphCodedInput graphInput = new GraphCodedInput(input);
schema.mergeFrom(graphInput, message);
input.checkLastTagWas(0);
return len;
}
final byte[] buf = new byte[len];
IOUtil.fillBufferFrom(in, buf, 0, len);
final ByteArrayInput input = new ByteArrayInput(buf, 0, len,
true);
final GraphByteArrayInput graphInput = new GraphByteArrayInput(input);
try
{
schema.mergeFrom(graphInput, message);
}
catch (ArrayIndexOutOfBoundsException e)
{
throw ProtobufException.truncatedMessage(e);
}
input.checkLastTagWas(0);
}
return len;
} | java | public static <T> int mergeDelimitedFrom(InputStream in, T message, Schema<T> schema)
throws IOException
{
final int size = in.read();
if (size == -1)
throw ProtobufException.truncatedMessage();
final int len = size < 0x80 ? size : CodedInput.readRawVarint32(in, size);
if (len < 0)
throw ProtobufException.negativeSize();
if (len != 0)
{
// not an empty message
if (len > CodedInput.DEFAULT_BUFFER_SIZE)
{
// message too big
final CodedInput input = new CodedInput(new LimitedInputStream(in, len),
true);
final GraphCodedInput graphInput = new GraphCodedInput(input);
schema.mergeFrom(graphInput, message);
input.checkLastTagWas(0);
return len;
}
final byte[] buf = new byte[len];
IOUtil.fillBufferFrom(in, buf, 0, len);
final ByteArrayInput input = new ByteArrayInput(buf, 0, len,
true);
final GraphByteArrayInput graphInput = new GraphByteArrayInput(input);
try
{
schema.mergeFrom(graphInput, message);
}
catch (ArrayIndexOutOfBoundsException e)
{
throw ProtobufException.truncatedMessage(e);
}
input.checkLastTagWas(0);
}
return len;
} | [
"public",
"static",
"<",
"T",
">",
"int",
"mergeDelimitedFrom",
"(",
"InputStream",
"in",
",",
"T",
"message",
",",
"Schema",
"<",
"T",
">",
"schema",
")",
"throws",
"IOException",
"{",
"final",
"int",
"size",
"=",
"in",
".",
"read",
"(",
")",
";",
"... | Merges the {@code message} (delimited) from the {@link InputStream} using the given {@code schema}.
@return the size of the message | [
"Merges",
"the",
"{",
"@code",
"message",
"}",
"(",
"delimited",
")",
"from",
"the",
"{",
"@link",
"InputStream",
"}",
"using",
"the",
"given",
"{",
"@code",
"schema",
"}",
"."
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-core/src/main/java/io/protostuff/GraphIOUtil.java#L99-L142 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformFinder.java | WaveformFinder.deliverWaveformDetailUpdate | private void deliverWaveformDetailUpdate(final int player, final WaveformDetail detail) {
"""
Send a waveform detail update announcement to all registered listeners.
@param player the player whose waveform detail has changed
@param detail the new waveform detail, if any
"""
if (!getWaveformListeners().isEmpty()) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
final WaveformDetailUpdate update = new WaveformDetailUpdate(player, detail);
for (final WaveformListener listener : getWaveformListeners()) {
try {
listener.detailChanged(update);
} catch (Throwable t) {
logger.warn("Problem delivering waveform detail update to listener", t);
}
}
}
});
}
} | java | private void deliverWaveformDetailUpdate(final int player, final WaveformDetail detail) {
if (!getWaveformListeners().isEmpty()) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
final WaveformDetailUpdate update = new WaveformDetailUpdate(player, detail);
for (final WaveformListener listener : getWaveformListeners()) {
try {
listener.detailChanged(update);
} catch (Throwable t) {
logger.warn("Problem delivering waveform detail update to listener", t);
}
}
}
});
}
} | [
"private",
"void",
"deliverWaveformDetailUpdate",
"(",
"final",
"int",
"player",
",",
"final",
"WaveformDetail",
"detail",
")",
"{",
"if",
"(",
"!",
"getWaveformListeners",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"SwingUtilities",
".",
"invokeLater",
"("... | Send a waveform detail update announcement to all registered listeners.
@param player the player whose waveform detail has changed
@param detail the new waveform detail, if any | [
"Send",
"a",
"waveform",
"detail",
"update",
"announcement",
"to",
"all",
"registered",
"listeners",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformFinder.java#L697-L714 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/view/ActorToolbar.java | ActorToolbar.colorizeToolbar | public static void colorizeToolbar(Toolbar toolbarView, int toolbarIconsColor, Activity activity) {
"""
Use this method to colorize toolbar icons to the desired target color
@param toolbarView toolbar view being colored
@param toolbarIconsColor the target color of toolbar icons
@param activity reference to activity needed to register observers
"""
final PorterDuffColorFilter colorFilter
= new PorterDuffColorFilter(toolbarIconsColor, PorterDuff.Mode.SRC_IN);
for (int i = 0; i < toolbarView.getChildCount(); i++) {
final View v = toolbarView.getChildAt(i);
doColorizing(v, colorFilter, toolbarIconsColor);
}
//Step 3: Changing the color of title and subtitle.
toolbarView.setTitleTextColor(toolbarIconsColor);
toolbarView.setSubtitleTextColor(toolbarIconsColor);
} | java | public static void colorizeToolbar(Toolbar toolbarView, int toolbarIconsColor, Activity activity) {
final PorterDuffColorFilter colorFilter
= new PorterDuffColorFilter(toolbarIconsColor, PorterDuff.Mode.SRC_IN);
for (int i = 0; i < toolbarView.getChildCount(); i++) {
final View v = toolbarView.getChildAt(i);
doColorizing(v, colorFilter, toolbarIconsColor);
}
//Step 3: Changing the color of title and subtitle.
toolbarView.setTitleTextColor(toolbarIconsColor);
toolbarView.setSubtitleTextColor(toolbarIconsColor);
} | [
"public",
"static",
"void",
"colorizeToolbar",
"(",
"Toolbar",
"toolbarView",
",",
"int",
"toolbarIconsColor",
",",
"Activity",
"activity",
")",
"{",
"final",
"PorterDuffColorFilter",
"colorFilter",
"=",
"new",
"PorterDuffColorFilter",
"(",
"toolbarIconsColor",
",",
"... | Use this method to colorize toolbar icons to the desired target color
@param toolbarView toolbar view being colored
@param toolbarIconsColor the target color of toolbar icons
@param activity reference to activity needed to register observers | [
"Use",
"this",
"method",
"to",
"colorize",
"toolbar",
"icons",
"to",
"the",
"desired",
"target",
"color"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/view/ActorToolbar.java#L64-L77 |
UrielCh/ovh-java-sdk | ovh-java-sdk-core/src/main/java/net/minidev/ovh/core/ApiOvhUtils.java | ApiOvhUtils.convertTo | public static <T> T convertTo(String in, TypeReference<T> mapTo) throws IOException {
"""
Convert JSON String to a POJO java
@param in
@param mapTo
@return POJO Object
@throws IOException
"""
try {
return mapper.readValue(in, mapTo);
} catch (Exception e) {
log.error("Can not convert:{} to {}", in, mapTo, e);
throw new OvhServiceException("local", "conversion Error to " + mapTo);
}
} | java | public static <T> T convertTo(String in, TypeReference<T> mapTo) throws IOException {
try {
return mapper.readValue(in, mapTo);
} catch (Exception e) {
log.error("Can not convert:{} to {}", in, mapTo, e);
throw new OvhServiceException("local", "conversion Error to " + mapTo);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"convertTo",
"(",
"String",
"in",
",",
"TypeReference",
"<",
"T",
">",
"mapTo",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"mapper",
".",
"readValue",
"(",
"in",
",",
"mapTo",
")",
";",
"}",
"catc... | Convert JSON String to a POJO java
@param in
@param mapTo
@return POJO Object
@throws IOException | [
"Convert",
"JSON",
"String",
"to",
"a",
"POJO",
"java"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-core/src/main/java/net/minidev/ovh/core/ApiOvhUtils.java#L41-L48 |
carewebframework/carewebframework-core | org.carewebframework.help-parent/org.carewebframework.help.javahelp/src/main/java/org/carewebframework/help/javahelp/HelpView.java | HelpView.initTopicTree | private void initTopicTree(HelpTopicNode htnParent, TreeNode ttnParent) {
"""
Duplicates JavaHelp topic tree into HelpTopicNode-based tree.
@param htnParent Current parent for HelpTopicNode-based tree.
@param ttnParent Current parent for JavaHelp TreeNode-based tree.
"""
for (int i = 0; i < ttnParent.getChildCount(); i++) {
TreeNode ttnChild = ttnParent.getChildAt(i);
HelpTopic ht = getTopic(ttnChild);
HelpTopicNode htnChild = new HelpTopicNode(ht);
htnParent.addChild(htnChild);
initTopicTree(htnChild, ttnChild);
}
} | java | private void initTopicTree(HelpTopicNode htnParent, TreeNode ttnParent) {
for (int i = 0; i < ttnParent.getChildCount(); i++) {
TreeNode ttnChild = ttnParent.getChildAt(i);
HelpTopic ht = getTopic(ttnChild);
HelpTopicNode htnChild = new HelpTopicNode(ht);
htnParent.addChild(htnChild);
initTopicTree(htnChild, ttnChild);
}
} | [
"private",
"void",
"initTopicTree",
"(",
"HelpTopicNode",
"htnParent",
",",
"TreeNode",
"ttnParent",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ttnParent",
".",
"getChildCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"TreeNode",
"ttnChild",... | Duplicates JavaHelp topic tree into HelpTopicNode-based tree.
@param htnParent Current parent for HelpTopicNode-based tree.
@param ttnParent Current parent for JavaHelp TreeNode-based tree. | [
"Duplicates",
"JavaHelp",
"topic",
"tree",
"into",
"HelpTopicNode",
"-",
"based",
"tree",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.javahelp/src/main/java/org/carewebframework/help/javahelp/HelpView.java#L83-L93 |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/av/Muxer.java | Muxer.writeSampleData | public void writeSampleData(MediaCodec encoder, int trackIndex, int bufferIndex, ByteBuffer encodedData, MediaCodec.BufferInfo bufferInfo) {
"""
Write the MediaCodec output buffer. This method <b>must</b>
be overridden by subclasses to release encodedData, transferring
ownership back to encoder, by calling encoder.releaseOutputBuffer(bufferIndex, false);
@param trackIndex
@param encodedData
@param bufferInfo
"""
if ((bufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
signalEndOfTrack();
}
} | java | public void writeSampleData(MediaCodec encoder, int trackIndex, int bufferIndex, ByteBuffer encodedData, MediaCodec.BufferInfo bufferInfo){
if ((bufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
signalEndOfTrack();
}
} | [
"public",
"void",
"writeSampleData",
"(",
"MediaCodec",
"encoder",
",",
"int",
"trackIndex",
",",
"int",
"bufferIndex",
",",
"ByteBuffer",
"encodedData",
",",
"MediaCodec",
".",
"BufferInfo",
"bufferInfo",
")",
"{",
"if",
"(",
"(",
"bufferInfo",
".",
"flags",
... | Write the MediaCodec output buffer. This method <b>must</b>
be overridden by subclasses to release encodedData, transferring
ownership back to encoder, by calling encoder.releaseOutputBuffer(bufferIndex, false);
@param trackIndex
@param encodedData
@param bufferInfo | [
"Write",
"the",
"MediaCodec",
"output",
"buffer",
".",
"This",
"method",
"<b",
">",
"must<",
"/",
"b",
">",
"be",
"overridden",
"by",
"subclasses",
"to",
"release",
"encodedData",
"transferring",
"ownership",
"back",
"to",
"encoder",
"by",
"calling",
"encoder"... | train | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/Muxer.java#L103-L107 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/runtime/JCuda.java | JCuda.cudaMallocArray | public static int cudaMallocArray(cudaArray array, cudaChannelFormatDesc desc, long width, long height, int flags) {
"""
Allocate an array on the device.
<pre>
cudaError_t cudaMallocArray (
cudaArray_t* array,
const cudaChannelFormatDesc* desc,
size_t width,
size_t height = 0,
unsigned int flags = 0 )
</pre>
<div>
<p>Allocate an array on the device.
Allocates a CUDA array according to the cudaChannelFormatDesc structure
<tt>desc</tt> and returns a handle to the new CUDA array in <tt>*array</tt>.
</p>
<p>The cudaChannelFormatDesc is defined
as:
<pre> struct cudaChannelFormatDesc {
int x, y, z, w;
enum cudaChannelFormatKind
f;
};</pre>
where cudaChannelFormatKind is one of
cudaChannelFormatKindSigned, cudaChannelFormatKindUnsigned, or
cudaChannelFormatKindFloat.
</p>
<p>The <tt>flags</tt> parameter enables
different options to be specified that affect the allocation, as
follows.
<ul>
<li>
<p>cudaArrayDefault: This flag's
value is defined to be 0 and provides default array allocation
</p>
</li>
<li>
<p>cudaArraySurfaceLoadStore:
Allocates an array that can be read from or written to using a surface
reference
</p>
</li>
<li>
<p>cudaArrayTextureGather: This
flag indicates that texture gather operations will be performed on the
array.
</p>
</li>
</ul>
</p>
<p><tt>width</tt> and <tt>height</tt>
must meet certain size requirements. See cudaMalloc3DArray() for more
details.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param array Pointer to allocated array in device memory
@param desc Requested channel format
@param width Requested array allocation width
@param height Requested array allocation height
@param flags Requested properties of allocated array
@return cudaSuccess, cudaErrorMemoryAllocation
@see JCuda#cudaMalloc
@see JCuda#cudaMallocPitch
@see JCuda#cudaFree
@see JCuda#cudaFreeArray
@see JCuda#cudaMallocHost
@see JCuda#cudaFreeHost
@see JCuda#cudaMalloc3D
@see JCuda#cudaMalloc3DArray
@see JCuda#cudaHostAlloc
"""
return checkResult(cudaMallocArrayNative(array, desc, width, height, flags));
} | java | public static int cudaMallocArray(cudaArray array, cudaChannelFormatDesc desc, long width, long height, int flags)
{
return checkResult(cudaMallocArrayNative(array, desc, width, height, flags));
} | [
"public",
"static",
"int",
"cudaMallocArray",
"(",
"cudaArray",
"array",
",",
"cudaChannelFormatDesc",
"desc",
",",
"long",
"width",
",",
"long",
"height",
",",
"int",
"flags",
")",
"{",
"return",
"checkResult",
"(",
"cudaMallocArrayNative",
"(",
"array",
",",
... | Allocate an array on the device.
<pre>
cudaError_t cudaMallocArray (
cudaArray_t* array,
const cudaChannelFormatDesc* desc,
size_t width,
size_t height = 0,
unsigned int flags = 0 )
</pre>
<div>
<p>Allocate an array on the device.
Allocates a CUDA array according to the cudaChannelFormatDesc structure
<tt>desc</tt> and returns a handle to the new CUDA array in <tt>*array</tt>.
</p>
<p>The cudaChannelFormatDesc is defined
as:
<pre> struct cudaChannelFormatDesc {
int x, y, z, w;
enum cudaChannelFormatKind
f;
};</pre>
where cudaChannelFormatKind is one of
cudaChannelFormatKindSigned, cudaChannelFormatKindUnsigned, or
cudaChannelFormatKindFloat.
</p>
<p>The <tt>flags</tt> parameter enables
different options to be specified that affect the allocation, as
follows.
<ul>
<li>
<p>cudaArrayDefault: This flag's
value is defined to be 0 and provides default array allocation
</p>
</li>
<li>
<p>cudaArraySurfaceLoadStore:
Allocates an array that can be read from or written to using a surface
reference
</p>
</li>
<li>
<p>cudaArrayTextureGather: This
flag indicates that texture gather operations will be performed on the
array.
</p>
</li>
</ul>
</p>
<p><tt>width</tt> and <tt>height</tt>
must meet certain size requirements. See cudaMalloc3DArray() for more
details.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param array Pointer to allocated array in device memory
@param desc Requested channel format
@param width Requested array allocation width
@param height Requested array allocation height
@param flags Requested properties of allocated array
@return cudaSuccess, cudaErrorMemoryAllocation
@see JCuda#cudaMalloc
@see JCuda#cudaMallocPitch
@see JCuda#cudaFree
@see JCuda#cudaFreeArray
@see JCuda#cudaMallocHost
@see JCuda#cudaFreeHost
@see JCuda#cudaMalloc3D
@see JCuda#cudaMalloc3DArray
@see JCuda#cudaHostAlloc | [
"Allocate",
"an",
"array",
"on",
"the",
"device",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L4363-L4366 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/render/CoreMessageRenderer.java | CoreMessageRenderer.shouldBeRendered | protected boolean shouldBeRendered(FacesMessage message, UIMessagesBase uiMessagesBase) {
"""
Returns {@code true} if the provided message should be rendered in the provided base message component.
@param message Message to be checked for rendering.
@param uiMessagesBase Base message component message needs to be rendered in.
@return {@code true} if the provided message should be rendered in the provided base message component.
"""
return (!message.isRendered() || uiMessagesBase.isRedisplay())
&& uiMessagesBase.getSeverity().contains(getSeverityName(message.getSeverity()));
} | java | protected boolean shouldBeRendered(FacesMessage message, UIMessagesBase uiMessagesBase) {
return (!message.isRendered() || uiMessagesBase.isRedisplay())
&& uiMessagesBase.getSeverity().contains(getSeverityName(message.getSeverity()));
} | [
"protected",
"boolean",
"shouldBeRendered",
"(",
"FacesMessage",
"message",
",",
"UIMessagesBase",
"uiMessagesBase",
")",
"{",
"return",
"(",
"!",
"message",
".",
"isRendered",
"(",
")",
"||",
"uiMessagesBase",
".",
"isRedisplay",
"(",
")",
")",
"&&",
"uiMessage... | Returns {@code true} if the provided message should be rendered in the provided base message component.
@param message Message to be checked for rendering.
@param uiMessagesBase Base message component message needs to be rendered in.
@return {@code true} if the provided message should be rendered in the provided base message component. | [
"Returns",
"{",
"@code",
"true",
"}",
"if",
"the",
"provided",
"message",
"should",
"be",
"rendered",
"in",
"the",
"provided",
"base",
"message",
"component",
"."
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/CoreMessageRenderer.java#L39-L42 |
line/armeria | core/src/main/java/com/linecorp/armeria/common/metric/MoreMeters.java | MoreMeters.newTimer | public static Timer newTimer(MeterRegistry registry, String name, Iterable<Tag> tags) {
"""
Returns a newly-registered {@link Timer} configured by {@link #distributionStatisticConfig()}.
"""
requireNonNull(registry, "registry");
requireNonNull(name, "name");
requireNonNull(tags, "tags");
final Duration maxExpectedValue =
Optional.ofNullable(distStatCfg.getMaximumExpectedValue())
.map(Duration::ofNanos).orElse(null);
final Duration minExpectedValue =
Optional.ofNullable(distStatCfg.getMinimumExpectedValue())
.map(Duration::ofNanos).orElse(null);
return Timer.builder(name)
.tags(tags)
.maximumExpectedValue(maxExpectedValue)
.minimumExpectedValue(minExpectedValue)
.publishPercentiles(distStatCfg.getPercentiles())
.publishPercentileHistogram(distStatCfg.isPercentileHistogram())
.distributionStatisticBufferLength(distStatCfg.getBufferLength())
.distributionStatisticExpiry(distStatCfg.getExpiry())
.register(registry);
} | java | public static Timer newTimer(MeterRegistry registry, String name, Iterable<Tag> tags) {
requireNonNull(registry, "registry");
requireNonNull(name, "name");
requireNonNull(tags, "tags");
final Duration maxExpectedValue =
Optional.ofNullable(distStatCfg.getMaximumExpectedValue())
.map(Duration::ofNanos).orElse(null);
final Duration minExpectedValue =
Optional.ofNullable(distStatCfg.getMinimumExpectedValue())
.map(Duration::ofNanos).orElse(null);
return Timer.builder(name)
.tags(tags)
.maximumExpectedValue(maxExpectedValue)
.minimumExpectedValue(minExpectedValue)
.publishPercentiles(distStatCfg.getPercentiles())
.publishPercentileHistogram(distStatCfg.isPercentileHistogram())
.distributionStatisticBufferLength(distStatCfg.getBufferLength())
.distributionStatisticExpiry(distStatCfg.getExpiry())
.register(registry);
} | [
"public",
"static",
"Timer",
"newTimer",
"(",
"MeterRegistry",
"registry",
",",
"String",
"name",
",",
"Iterable",
"<",
"Tag",
">",
"tags",
")",
"{",
"requireNonNull",
"(",
"registry",
",",
"\"registry\"",
")",
";",
"requireNonNull",
"(",
"name",
",",
"\"nam... | Returns a newly-registered {@link Timer} configured by {@link #distributionStatisticConfig()}. | [
"Returns",
"a",
"newly",
"-",
"registered",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/metric/MoreMeters.java#L127-L148 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ScientificNumberFormatter.java | ScientificNumberFormatter.getMarkupInstance | public static ScientificNumberFormatter getMarkupInstance(
ULocale locale,
String beginMarkup,
String endMarkup) {
"""
Gets a ScientificNumberFormatter instance that uses
markup for exponents for this locale.
@param locale The locale
@param beginMarkup the markup to start superscript e.g {@code <sup>}
@param endMarkup the markup to end superscript e.g {@code </sup>}
@return The ScientificNumberFormatter instance.
"""
return getInstanceForLocale(
locale, new MarkupStyle(beginMarkup, endMarkup));
} | java | public static ScientificNumberFormatter getMarkupInstance(
ULocale locale,
String beginMarkup,
String endMarkup) {
return getInstanceForLocale(
locale, new MarkupStyle(beginMarkup, endMarkup));
} | [
"public",
"static",
"ScientificNumberFormatter",
"getMarkupInstance",
"(",
"ULocale",
"locale",
",",
"String",
"beginMarkup",
",",
"String",
"endMarkup",
")",
"{",
"return",
"getInstanceForLocale",
"(",
"locale",
",",
"new",
"MarkupStyle",
"(",
"beginMarkup",
",",
"... | Gets a ScientificNumberFormatter instance that uses
markup for exponents for this locale.
@param locale The locale
@param beginMarkup the markup to start superscript e.g {@code <sup>}
@param endMarkup the markup to end superscript e.g {@code </sup>}
@return The ScientificNumberFormatter instance. | [
"Gets",
"a",
"ScientificNumberFormatter",
"instance",
"that",
"uses",
"markup",
"for",
"exponents",
"for",
"this",
"locale",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ScientificNumberFormatter.java#L74-L80 |
google/truth | extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubject.java | MapWithProtoValuesSubject.usingFloatToleranceForFieldsForValues | public MapWithProtoValuesFluentAssertion<M> usingFloatToleranceForFieldsForValues(
float tolerance, Iterable<Integer> fieldNumbers) {
"""
Compares float fields with these explicitly specified top-level field numbers using the
provided absolute tolerance.
@param tolerance A finite, non-negative tolerance.
"""
return usingConfig(config.usingFloatToleranceForFields(tolerance, fieldNumbers));
} | java | public MapWithProtoValuesFluentAssertion<M> usingFloatToleranceForFieldsForValues(
float tolerance, Iterable<Integer> fieldNumbers) {
return usingConfig(config.usingFloatToleranceForFields(tolerance, fieldNumbers));
} | [
"public",
"MapWithProtoValuesFluentAssertion",
"<",
"M",
">",
"usingFloatToleranceForFieldsForValues",
"(",
"float",
"tolerance",
",",
"Iterable",
"<",
"Integer",
">",
"fieldNumbers",
")",
"{",
"return",
"usingConfig",
"(",
"config",
".",
"usingFloatToleranceForFields",
... | Compares float fields with these explicitly specified top-level field numbers using the
provided absolute tolerance.
@param tolerance A finite, non-negative tolerance. | [
"Compares",
"float",
"fields",
"with",
"these",
"explicitly",
"specified",
"top",
"-",
"level",
"field",
"numbers",
"using",
"the",
"provided",
"absolute",
"tolerance",
"."
] | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubject.java#L585-L588 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/support/ConnectionPoolSupport.java | ConnectionPoolSupport.createSoftReferenceObjectPool | public static <T extends StatefulConnection<?, ?>> SoftReferenceObjectPool<T> createSoftReferenceObjectPool(
Supplier<T> connectionSupplier) {
"""
Creates a new {@link SoftReferenceObjectPool} using the {@link Supplier}. Allocated instances are wrapped and must not be
returned with {@link ObjectPool#returnObject(Object)}.
@param connectionSupplier must not be {@literal null}.
@param <T> connection type.
@return the connection pool.
"""
return createSoftReferenceObjectPool(connectionSupplier, true);
} | java | public static <T extends StatefulConnection<?, ?>> SoftReferenceObjectPool<T> createSoftReferenceObjectPool(
Supplier<T> connectionSupplier) {
return createSoftReferenceObjectPool(connectionSupplier, true);
} | [
"public",
"static",
"<",
"T",
"extends",
"StatefulConnection",
"<",
"?",
",",
"?",
">",
">",
"SoftReferenceObjectPool",
"<",
"T",
">",
"createSoftReferenceObjectPool",
"(",
"Supplier",
"<",
"T",
">",
"connectionSupplier",
")",
"{",
"return",
"createSoftReferenceOb... | Creates a new {@link SoftReferenceObjectPool} using the {@link Supplier}. Allocated instances are wrapped and must not be
returned with {@link ObjectPool#returnObject(Object)}.
@param connectionSupplier must not be {@literal null}.
@param <T> connection type.
@return the connection pool. | [
"Creates",
"a",
"new",
"{",
"@link",
"SoftReferenceObjectPool",
"}",
"using",
"the",
"{",
"@link",
"Supplier",
"}",
".",
"Allocated",
"instances",
"are",
"wrapped",
"and",
"must",
"not",
"be",
"returned",
"with",
"{",
"@link",
"ObjectPool#returnObject",
"(",
"... | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/support/ConnectionPoolSupport.java#L149-L152 |
structr/structr | structr-ui/src/main/java/org/structr/web/servlet/HtmlServlet.java | HtmlServlet.notFound | private Page notFound(final HttpServletResponse response, final SecurityContext securityContext) throws IOException, FrameworkException {
"""
Handle 404 Not Found
First, search the first page which handles the 404.
If none found, issue the container's 404 error.
@param response
@param securityContext
@param renderContext
@throws IOException
@throws FrameworkException
"""
final List<Page> errorPages = StructrApp.getInstance(securityContext).nodeQuery(Page.class).and(StructrApp.key(Page.class, "showOnErrorCodes"), "404", false).getAsList();
for (final Page errorPage : errorPages) {
if (isVisibleForSite(securityContext.getRequest(), errorPage)) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
return errorPage;
}
}
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return null;
} | java | private Page notFound(final HttpServletResponse response, final SecurityContext securityContext) throws IOException, FrameworkException {
final List<Page> errorPages = StructrApp.getInstance(securityContext).nodeQuery(Page.class).and(StructrApp.key(Page.class, "showOnErrorCodes"), "404", false).getAsList();
for (final Page errorPage : errorPages) {
if (isVisibleForSite(securityContext.getRequest(), errorPage)) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
return errorPage;
}
}
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return null;
} | [
"private",
"Page",
"notFound",
"(",
"final",
"HttpServletResponse",
"response",
",",
"final",
"SecurityContext",
"securityContext",
")",
"throws",
"IOException",
",",
"FrameworkException",
"{",
"final",
"List",
"<",
"Page",
">",
"errorPages",
"=",
"StructrApp",
".",... | Handle 404 Not Found
First, search the first page which handles the 404.
If none found, issue the container's 404 error.
@param response
@param securityContext
@param renderContext
@throws IOException
@throws FrameworkException | [
"Handle",
"404",
"Not",
"Found"
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/servlet/HtmlServlet.java#L937-L954 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java | JobsImpl.patchAsync | public Observable<Void> patchAsync(String jobId, JobPatchParameter jobPatchParameter, JobPatchOptions jobPatchOptions) {
"""
Updates the properties of the specified job.
This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints.
@param jobId The ID of the job whose properties you want to update.
@param jobPatchParameter The parameters for the request.
@param jobPatchOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful.
"""
return patchWithServiceResponseAsync(jobId, jobPatchParameter, jobPatchOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobPatchHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, JobPatchHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> patchAsync(String jobId, JobPatchParameter jobPatchParameter, JobPatchOptions jobPatchOptions) {
return patchWithServiceResponseAsync(jobId, jobPatchParameter, jobPatchOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobPatchHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, JobPatchHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"patchAsync",
"(",
"String",
"jobId",
",",
"JobPatchParameter",
"jobPatchParameter",
",",
"JobPatchOptions",
"jobPatchOptions",
")",
"{",
"return",
"patchWithServiceResponseAsync",
"(",
"jobId",
",",
"jobPatchParameter",
",",
... | Updates the properties of the specified job.
This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints.
@param jobId The ID of the job whose properties you want to update.
@param jobPatchParameter The parameters for the request.
@param jobPatchOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Updates",
"the",
"properties",
"of",
"the",
"specified",
"job",
".",
"This",
"replaces",
"only",
"the",
"job",
"properties",
"specified",
"in",
"the",
"request",
".",
"For",
"example",
"if",
"the",
"job",
"has",
"constraints",
"and",
"a",
"request",
"does",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L961-L968 |
JoeKerouac/utils | src/main/java/com/joe/utils/common/DateUtil.java | DateUtil.getFormatDate | public static String getFormatDate(String format, Date date, String zoneId) {
"""
获取指定日期的指定格式的字符串,指定时区
@param format 日期格式
@param date 指定日期
@param zoneId 时区ID,例如GMT
@return 指定日期的指定格式的字符串
"""
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(format);
return dateTimeFormatter
.format(date.toInstant().atZone(ZoneId.of(zoneId)).toLocalDateTime());
} | java | public static String getFormatDate(String format, Date date, String zoneId) {
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(format);
return dateTimeFormatter
.format(date.toInstant().atZone(ZoneId.of(zoneId)).toLocalDateTime());
} | [
"public",
"static",
"String",
"getFormatDate",
"(",
"String",
"format",
",",
"Date",
"date",
",",
"String",
"zoneId",
")",
"{",
"DateTimeFormatter",
"dateTimeFormatter",
"=",
"DateTimeFormatter",
".",
"ofPattern",
"(",
"format",
")",
";",
"return",
"dateTimeFormat... | 获取指定日期的指定格式的字符串,指定时区
@param format 日期格式
@param date 指定日期
@param zoneId 时区ID,例如GMT
@return 指定日期的指定格式的字符串 | [
"获取指定日期的指定格式的字符串,指定时区"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/DateUtil.java#L204-L208 |
OpenLiberty/open-liberty | dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElementList.java | ConfigElementList.getBy | public E getBy(String attributeName, String attributeValue) {
"""
Returns the first element in this list with a matching attribute value.
@param attributeName the attribute for which to search (Example: jndiName)
@param attributeValue the value to match
@return the first element in this list with a matching attribute name/value, or null of no such element is found
"""
String methodName = "get" + Character.toUpperCase(attributeName.charAt(0)) + attributeName.substring(1);
for (E element : this)
if (element != null)
try {
Object value = element.getClass().getMethod(methodName).invoke(element);
if (value == attributeValue || value != null && value.equals(attributeValue))
return element;
} catch (Exception x) {
}
return null;
} | java | public E getBy(String attributeName, String attributeValue) {
String methodName = "get" + Character.toUpperCase(attributeName.charAt(0)) + attributeName.substring(1);
for (E element : this)
if (element != null)
try {
Object value = element.getClass().getMethod(methodName).invoke(element);
if (value == attributeValue || value != null && value.equals(attributeValue))
return element;
} catch (Exception x) {
}
return null;
} | [
"public",
"E",
"getBy",
"(",
"String",
"attributeName",
",",
"String",
"attributeValue",
")",
"{",
"String",
"methodName",
"=",
"\"get\"",
"+",
"Character",
".",
"toUpperCase",
"(",
"attributeName",
".",
"charAt",
"(",
"0",
")",
")",
"+",
"attributeName",
".... | Returns the first element in this list with a matching attribute value.
@param attributeName the attribute for which to search (Example: jndiName)
@param attributeValue the value to match
@return the first element in this list with a matching attribute name/value, or null of no such element is found | [
"Returns",
"the",
"first",
"element",
"in",
"this",
"list",
"with",
"a",
"matching",
"attribute",
"value",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElementList.java#L69-L80 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.serviceName_localSeo_emailAvailability_GET | public OvhEmailAvailability serviceName_localSeo_emailAvailability_GET(String serviceName, String email) throws IOException {
"""
Check email availability for a local SEO order
REST: GET /hosting/web/{serviceName}/localSeo/emailAvailability
@param email [required] The email address to check
@param serviceName [required] The internal name of your hosting
"""
String qPath = "/hosting/web/{serviceName}/localSeo/emailAvailability";
StringBuilder sb = path(qPath, serviceName);
query(sb, "email", email);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhEmailAvailability.class);
} | java | public OvhEmailAvailability serviceName_localSeo_emailAvailability_GET(String serviceName, String email) throws IOException {
String qPath = "/hosting/web/{serviceName}/localSeo/emailAvailability";
StringBuilder sb = path(qPath, serviceName);
query(sb, "email", email);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhEmailAvailability.class);
} | [
"public",
"OvhEmailAvailability",
"serviceName_localSeo_emailAvailability_GET",
"(",
"String",
"serviceName",
",",
"String",
"email",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/web/{serviceName}/localSeo/emailAvailability\"",
";",
"StringBuilder",
"s... | Check email availability for a local SEO order
REST: GET /hosting/web/{serviceName}/localSeo/emailAvailability
@param email [required] The email address to check
@param serviceName [required] The internal name of your hosting | [
"Check",
"email",
"availability",
"for",
"a",
"local",
"SEO",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L865-L871 |
riversun/finbin | src/main/java/org/riversun/finbin/BinaryUtil.java | BinaryUtil.memcopy | public static void memcopy(byte[] dest, byte[] src, int copyToIndex) {
"""
Copy src bytes[] into dest bytes[]
@param dest
@param src
@param copyToIndex
"""
System.arraycopy(src, 0, dest, copyToIndex, src.length);
} | java | public static void memcopy(byte[] dest, byte[] src, int copyToIndex) {
System.arraycopy(src, 0, dest, copyToIndex, src.length);
} | [
"public",
"static",
"void",
"memcopy",
"(",
"byte",
"[",
"]",
"dest",
",",
"byte",
"[",
"]",
"src",
",",
"int",
"copyToIndex",
")",
"{",
"System",
".",
"arraycopy",
"(",
"src",
",",
"0",
",",
"dest",
",",
"copyToIndex",
",",
"src",
".",
"length",
"... | Copy src bytes[] into dest bytes[]
@param dest
@param src
@param copyToIndex | [
"Copy",
"src",
"bytes",
"[]",
"into",
"dest",
"bytes",
"[]"
] | train | https://github.com/riversun/finbin/blob/d1db86a0d2966dcf47087340bbd0727a9d508b3e/src/main/java/org/riversun/finbin/BinaryUtil.java#L65-L67 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/parse/dep/ParentsArray.java | ParentsArray.isAncestor | public static boolean isAncestor(int idx1, int idx2, int[] parents) {
"""
Checks whether idx1 is the ancestor of idx2. If idx1 is the parent of
idx2 this will return true, but if idx1 == idx2, it will return false.
@param idx1 The ancestor position.
@param idx2 The descendent position.
@param parents The parents array.
@return Whether idx is the ancestor of idx2.
"""
int anc = parents[idx2];
while (anc != -1) {
if (anc == idx1) {
return true;
}
anc = parents[anc];
}
return false;
} | java | public static boolean isAncestor(int idx1, int idx2, int[] parents) {
int anc = parents[idx2];
while (anc != -1) {
if (anc == idx1) {
return true;
}
anc = parents[anc];
}
return false;
} | [
"public",
"static",
"boolean",
"isAncestor",
"(",
"int",
"idx1",
",",
"int",
"idx2",
",",
"int",
"[",
"]",
"parents",
")",
"{",
"int",
"anc",
"=",
"parents",
"[",
"idx2",
"]",
";",
"while",
"(",
"anc",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"anc",
... | Checks whether idx1 is the ancestor of idx2. If idx1 is the parent of
idx2 this will return true, but if idx1 == idx2, it will return false.
@param idx1 The ancestor position.
@param idx2 The descendent position.
@param parents The parents array.
@return Whether idx is the ancestor of idx2. | [
"Checks",
"whether",
"idx1",
"is",
"the",
"ancestor",
"of",
"idx2",
".",
"If",
"idx1",
"is",
"the",
"parent",
"of",
"idx2",
"this",
"will",
"return",
"true",
"but",
"if",
"idx1",
"==",
"idx2",
"it",
"will",
"return",
"false",
"."
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/parse/dep/ParentsArray.java#L219-L228 |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java | Jar.setAttribute | public final Jar setAttribute(String name, String value) {
"""
Sets an attribute in the main section of the manifest.
@param name the attribute's name
@param value the attribute's value
@return {@code this}
@throws IllegalStateException if entries have been added or the JAR has been written prior to calling this methods.
"""
verifyNotSealed();
if (jos != null)
throw new IllegalStateException("Manifest cannot be modified after entries are added.");
getManifest().getMainAttributes().putValue(name, value);
return this;
} | java | public final Jar setAttribute(String name, String value) {
verifyNotSealed();
if (jos != null)
throw new IllegalStateException("Manifest cannot be modified after entries are added.");
getManifest().getMainAttributes().putValue(name, value);
return this;
} | [
"public",
"final",
"Jar",
"setAttribute",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"verifyNotSealed",
"(",
")",
";",
"if",
"(",
"jos",
"!=",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Manifest cannot be modified after entries are... | Sets an attribute in the main section of the manifest.
@param name the attribute's name
@param value the attribute's value
@return {@code this}
@throws IllegalStateException if entries have been added or the JAR has been written prior to calling this methods. | [
"Sets",
"an",
"attribute",
"in",
"the",
"main",
"section",
"of",
"the",
"manifest",
"."
] | train | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L135-L141 |
aws/aws-sdk-java | aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/ModifyInstanceAttributeRequest.java | ModifyInstanceAttributeRequest.getBlockDeviceMappings | public java.util.List<InstanceBlockDeviceMappingSpecification> getBlockDeviceMappings() {
"""
<p>
Modifies the <code>DeleteOnTermination</code> attribute for volumes that are currently attached. The volume must
be owned by the caller. If no value is specified for <code>DeleteOnTermination</code>, the default is
<code>true</code> and the volume is deleted when the instance is terminated.
</p>
<p>
To add instance store volumes to an Amazon EBS-backed instance, you must add them when you launch the instance.
For more information, see <a href=
"https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html#Using_OverridingAMIBDM"
>Updating the Block Device Mapping when Launching an Instance</a> in the <i>Amazon Elastic Compute Cloud User
Guide</i>.
</p>
@return Modifies the <code>DeleteOnTermination</code> attribute for volumes that are currently attached. The
volume must be owned by the caller. If no value is specified for <code>DeleteOnTermination</code>, the
default is <code>true</code> and the volume is deleted when the instance is terminated.</p>
<p>
To add instance store volumes to an Amazon EBS-backed instance, you must add them when you launch the
instance. For more information, see <a href=
"https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html#Using_OverridingAMIBDM"
>Updating the Block Device Mapping when Launching an Instance</a> in the <i>Amazon Elastic Compute Cloud
User Guide</i>.
"""
if (blockDeviceMappings == null) {
blockDeviceMappings = new com.amazonaws.internal.SdkInternalList<InstanceBlockDeviceMappingSpecification>();
}
return blockDeviceMappings;
} | java | public java.util.List<InstanceBlockDeviceMappingSpecification> getBlockDeviceMappings() {
if (blockDeviceMappings == null) {
blockDeviceMappings = new com.amazonaws.internal.SdkInternalList<InstanceBlockDeviceMappingSpecification>();
}
return blockDeviceMappings;
} | [
"public",
"java",
".",
"util",
".",
"List",
"<",
"InstanceBlockDeviceMappingSpecification",
">",
"getBlockDeviceMappings",
"(",
")",
"{",
"if",
"(",
"blockDeviceMappings",
"==",
"null",
")",
"{",
"blockDeviceMappings",
"=",
"new",
"com",
".",
"amazonaws",
".",
"... | <p>
Modifies the <code>DeleteOnTermination</code> attribute for volumes that are currently attached. The volume must
be owned by the caller. If no value is specified for <code>DeleteOnTermination</code>, the default is
<code>true</code> and the volume is deleted when the instance is terminated.
</p>
<p>
To add instance store volumes to an Amazon EBS-backed instance, you must add them when you launch the instance.
For more information, see <a href=
"https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html#Using_OverridingAMIBDM"
>Updating the Block Device Mapping when Launching an Instance</a> in the <i>Amazon Elastic Compute Cloud User
Guide</i>.
</p>
@return Modifies the <code>DeleteOnTermination</code> attribute for volumes that are currently attached. The
volume must be owned by the caller. If no value is specified for <code>DeleteOnTermination</code>, the
default is <code>true</code> and the volume is deleted when the instance is terminated.</p>
<p>
To add instance store volumes to an Amazon EBS-backed instance, you must add them when you launch the
instance. For more information, see <a href=
"https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html#Using_OverridingAMIBDM"
>Updating the Block Device Mapping when Launching an Instance</a> in the <i>Amazon Elastic Compute Cloud
User Guide</i>. | [
"<p",
">",
"Modifies",
"the",
"<code",
">",
"DeleteOnTermination<",
"/",
"code",
">",
"attribute",
"for",
"volumes",
"that",
"are",
"currently",
"attached",
".",
"The",
"volume",
"must",
"be",
"owned",
"by",
"the",
"caller",
".",
"If",
"no",
"value",
"is",... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/ModifyInstanceAttributeRequest.java#L357-L362 |
alkacon/opencms-core | src/org/opencms/ui/apps/user/CmsUserTable.java | CmsUserTable.fillItem | protected void fillItem(Item item, CmsUser user) {
"""
Fills the container item for a user.<p>
@param item the item
@param user the user
"""
item.getItemProperty(TableProperty.Name).setValue(user.getSimpleName());
item.getItemProperty(TableProperty.FullName).setValue(user.getFullName());
item.getItemProperty(TableProperty.SystemName).setValue(user.getName());
boolean disabled = !user.isEnabled();
item.getItemProperty(TableProperty.DISABLED).setValue(new Boolean(disabled));
boolean newUser = user.getLastlogin() == 0L;
item.getItemProperty(TableProperty.NEWUSER).setValue(new Boolean(newUser));
try {
item.getItemProperty(TableProperty.OU).setValue(
OpenCms.getOrgUnitManager().readOrganizationalUnit(m_cms, user.getOuFqn()).getDisplayName(
A_CmsUI.get().getLocale()));
} catch (CmsException e) {
LOG.error("Can't read OU", e);
}
item.getItemProperty(TableProperty.LastLogin).setValue(new Long(user.getLastlogin()));
item.getItemProperty(TableProperty.Created).setValue(new Long(user.getDateCreated()));
item.getItemProperty(TableProperty.INDIRECT).setValue(new Boolean(m_indirects.contains(user)));
item.getItemProperty(TableProperty.FROMOTHEROU).setValue(new Boolean(!user.getOuFqn().equals(m_ou)));
item.getItemProperty(TableProperty.STATUS).setValue(getStatusInt(disabled, newUser));
} | java | protected void fillItem(Item item, CmsUser user) {
item.getItemProperty(TableProperty.Name).setValue(user.getSimpleName());
item.getItemProperty(TableProperty.FullName).setValue(user.getFullName());
item.getItemProperty(TableProperty.SystemName).setValue(user.getName());
boolean disabled = !user.isEnabled();
item.getItemProperty(TableProperty.DISABLED).setValue(new Boolean(disabled));
boolean newUser = user.getLastlogin() == 0L;
item.getItemProperty(TableProperty.NEWUSER).setValue(new Boolean(newUser));
try {
item.getItemProperty(TableProperty.OU).setValue(
OpenCms.getOrgUnitManager().readOrganizationalUnit(m_cms, user.getOuFqn()).getDisplayName(
A_CmsUI.get().getLocale()));
} catch (CmsException e) {
LOG.error("Can't read OU", e);
}
item.getItemProperty(TableProperty.LastLogin).setValue(new Long(user.getLastlogin()));
item.getItemProperty(TableProperty.Created).setValue(new Long(user.getDateCreated()));
item.getItemProperty(TableProperty.INDIRECT).setValue(new Boolean(m_indirects.contains(user)));
item.getItemProperty(TableProperty.FROMOTHEROU).setValue(new Boolean(!user.getOuFqn().equals(m_ou)));
item.getItemProperty(TableProperty.STATUS).setValue(getStatusInt(disabled, newUser));
} | [
"protected",
"void",
"fillItem",
"(",
"Item",
"item",
",",
"CmsUser",
"user",
")",
"{",
"item",
".",
"getItemProperty",
"(",
"TableProperty",
".",
"Name",
")",
".",
"setValue",
"(",
"user",
".",
"getSimpleName",
"(",
")",
")",
";",
"item",
".",
"getItemP... | Fills the container item for a user.<p>
@param item the item
@param user the user | [
"Fills",
"the",
"container",
"item",
"for",
"a",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsUserTable.java#L1050-L1071 |
tvesalainen/util | util/src/main/java/org/vesalainen/nio/file/attribute/UserAttrs.java | UserAttrs.setLongAttribute | public static final void setLongAttribute(Path path, String attribute, long value, LinkOption... options) throws IOException {
"""
Set user-defined-attribute
@param path
@param attribute user:attribute name. user: can be omitted.
@param value
@param options
@throws IOException
"""
attribute = attribute.startsWith("user:") ? attribute : "user:"+attribute;
Files.setAttribute(path, attribute, Primitives.writeLong(value), options);
} | java | public static final void setLongAttribute(Path path, String attribute, long value, LinkOption... options) throws IOException
{
attribute = attribute.startsWith("user:") ? attribute : "user:"+attribute;
Files.setAttribute(path, attribute, Primitives.writeLong(value), options);
} | [
"public",
"static",
"final",
"void",
"setLongAttribute",
"(",
"Path",
"path",
",",
"String",
"attribute",
",",
"long",
"value",
",",
"LinkOption",
"...",
"options",
")",
"throws",
"IOException",
"{",
"attribute",
"=",
"attribute",
".",
"startsWith",
"(",
"\"us... | Set user-defined-attribute
@param path
@param attribute user:attribute name. user: can be omitted.
@param value
@param options
@throws IOException | [
"Set",
"user",
"-",
"defined",
"-",
"attribute"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/UserAttrs.java#L66-L70 |
SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/webhook/WebhookDeliveryDao.java | WebhookDeliveryDao.selectOrderedByCeTaskUuid | public List<WebhookDeliveryLiteDto> selectOrderedByCeTaskUuid(DbSession dbSession, String ceTaskUuid, int offset, int limit) {
"""
All the deliveries for the specified CE task. Results are ordered by descending date.
"""
return mapper(dbSession).selectOrderedByCeTaskUuid(ceTaskUuid, new RowBounds(offset, limit));
} | java | public List<WebhookDeliveryLiteDto> selectOrderedByCeTaskUuid(DbSession dbSession, String ceTaskUuid, int offset, int limit) {
return mapper(dbSession).selectOrderedByCeTaskUuid(ceTaskUuid, new RowBounds(offset, limit));
} | [
"public",
"List",
"<",
"WebhookDeliveryLiteDto",
">",
"selectOrderedByCeTaskUuid",
"(",
"DbSession",
"dbSession",
",",
"String",
"ceTaskUuid",
",",
"int",
"offset",
",",
"int",
"limit",
")",
"{",
"return",
"mapper",
"(",
"dbSession",
")",
".",
"selectOrderedByCeTa... | All the deliveries for the specified CE task. Results are ordered by descending date. | [
"All",
"the",
"deliveries",
"for",
"the",
"specified",
"CE",
"task",
".",
"Results",
"are",
"ordered",
"by",
"descending",
"date",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/webhook/WebhookDeliveryDao.java#L67-L69 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java | AsyncMutateInBuilder.arrayAppend | public <T> AsyncMutateInBuilder arrayAppend(String path, T value) {
"""
Append to an existing array, pushing the value to the back/last position in
the array.
@param path the path of the array.
@param value the value to insert at the back of the array.
"""
this.mutationSpecs.add(new MutationSpec(Mutation.ARRAY_PUSH_LAST, path, value));
return this;
} | java | public <T> AsyncMutateInBuilder arrayAppend(String path, T value) {
this.mutationSpecs.add(new MutationSpec(Mutation.ARRAY_PUSH_LAST, path, value));
return this;
} | [
"public",
"<",
"T",
">",
"AsyncMutateInBuilder",
"arrayAppend",
"(",
"String",
"path",
",",
"T",
"value",
")",
"{",
"this",
".",
"mutationSpecs",
".",
"add",
"(",
"new",
"MutationSpec",
"(",
"Mutation",
".",
"ARRAY_PUSH_LAST",
",",
"path",
",",
"value",
")... | Append to an existing array, pushing the value to the back/last position in
the array.
@param path the path of the array.
@param value the value to insert at the back of the array. | [
"Append",
"to",
"an",
"existing",
"array",
"pushing",
"the",
"value",
"to",
"the",
"back",
"/",
"last",
"position",
"in",
"the",
"array",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java#L984-L987 |
gallandarakhneorg/afc | advanced/gis/gisroadinputoutput/src/main/java/org/arakhne/afc/gis/road/io/XMLRoadUtil.java | XMLRoadUtil.readRoadSegment | public static RoadSegment readRoadSegment(Element element, PathBuilder pathBuilder,
XMLResources resources) throws IOException {
"""
Read a road from the XML description.
@param element is the XML node to read.
@param pathBuilder is the tool to make paths absolute.
@param resources is the tool that permits to gather the resources.
@return the road.
@throws IOException in case of error.
"""
return readRoadPolyline(element, pathBuilder, resources);
} | java | public static RoadSegment readRoadSegment(Element element, PathBuilder pathBuilder,
XMLResources resources) throws IOException {
return readRoadPolyline(element, pathBuilder, resources);
} | [
"public",
"static",
"RoadSegment",
"readRoadSegment",
"(",
"Element",
"element",
",",
"PathBuilder",
"pathBuilder",
",",
"XMLResources",
"resources",
")",
"throws",
"IOException",
"{",
"return",
"readRoadPolyline",
"(",
"element",
",",
"pathBuilder",
",",
"resources",... | Read a road from the XML description.
@param element is the XML node to read.
@param pathBuilder is the tool to make paths absolute.
@param resources is the tool that permits to gather the resources.
@return the road.
@throws IOException in case of error. | [
"Read",
"a",
"road",
"from",
"the",
"XML",
"description",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroadinputoutput/src/main/java/org/arakhne/afc/gis/road/io/XMLRoadUtil.java#L129-L132 |
JodaOrg/joda-time | src/main/java/org/joda/time/base/AbstractPartial.java | AbstractPartial.toDateTime | public DateTime toDateTime(ReadableInstant baseInstant) {
"""
Resolves this partial against another complete instant to create a new
full instant. The combination is performed using the chronology of the
specified instant.
<p>
For example, if this partial represents a time, then the result of this
method will be the datetime from the specified base instant plus the
time from this partial.
@param baseInstant the instant that provides the missing fields, null means now
@return the combined datetime
"""
Chronology chrono = DateTimeUtils.getInstantChronology(baseInstant);
long instantMillis = DateTimeUtils.getInstantMillis(baseInstant);
long resolved = chrono.set(this, instantMillis);
return new DateTime(resolved, chrono);
} | java | public DateTime toDateTime(ReadableInstant baseInstant) {
Chronology chrono = DateTimeUtils.getInstantChronology(baseInstant);
long instantMillis = DateTimeUtils.getInstantMillis(baseInstant);
long resolved = chrono.set(this, instantMillis);
return new DateTime(resolved, chrono);
} | [
"public",
"DateTime",
"toDateTime",
"(",
"ReadableInstant",
"baseInstant",
")",
"{",
"Chronology",
"chrono",
"=",
"DateTimeUtils",
".",
"getInstantChronology",
"(",
"baseInstant",
")",
";",
"long",
"instantMillis",
"=",
"DateTimeUtils",
".",
"getInstantMillis",
"(",
... | Resolves this partial against another complete instant to create a new
full instant. The combination is performed using the chronology of the
specified instant.
<p>
For example, if this partial represents a time, then the result of this
method will be the datetime from the specified base instant plus the
time from this partial.
@param baseInstant the instant that provides the missing fields, null means now
@return the combined datetime | [
"Resolves",
"this",
"partial",
"against",
"another",
"complete",
"instant",
"to",
"create",
"a",
"new",
"full",
"instant",
".",
"The",
"combination",
"is",
"performed",
"using",
"the",
"chronology",
"of",
"the",
"specified",
"instant",
".",
"<p",
">",
"For",
... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/base/AbstractPartial.java#L239-L244 |
ops4j/org.ops4j.pax.wicket | service/src/main/java/org/ops4j/pax/wicket/internal/filter/FilterTrackerCustomizer.java | FilterTrackerCustomizer.createOsgiFilter | public org.osgi.framework.Filter createOsgiFilter()
throws IllegalArgumentException {
"""
<p>createOsgiFilter.</p>
@return a {@link org.osgi.framework.Filter} object.
@throws java.lang.IllegalArgumentException if any.
"""
org.osgi.framework.Filter filter;
try {
String filterString = String.format("(&(%s=%s)(%s=%s))", APPLICATION_NAME, applicationName,
OBJECTCLASS, FilterFactory.class.getName());
LOGGER.debug("createOsgiFilter={} for application {}", filterString, applicationName);
filter = bundleContext.createFilter(filterString);
} catch (InvalidSyntaxException e) {
throw new IllegalArgumentException("applicationName can not contain '*', '(' or ')' : " + applicationName,
e);
}
return filter;
} | java | public org.osgi.framework.Filter createOsgiFilter()
throws IllegalArgumentException {
org.osgi.framework.Filter filter;
try {
String filterString = String.format("(&(%s=%s)(%s=%s))", APPLICATION_NAME, applicationName,
OBJECTCLASS, FilterFactory.class.getName());
LOGGER.debug("createOsgiFilter={} for application {}", filterString, applicationName);
filter = bundleContext.createFilter(filterString);
} catch (InvalidSyntaxException e) {
throw new IllegalArgumentException("applicationName can not contain '*', '(' or ')' : " + applicationName,
e);
}
return filter;
} | [
"public",
"org",
".",
"osgi",
".",
"framework",
".",
"Filter",
"createOsgiFilter",
"(",
")",
"throws",
"IllegalArgumentException",
"{",
"org",
".",
"osgi",
".",
"framework",
".",
"Filter",
"filter",
";",
"try",
"{",
"String",
"filterString",
"=",
"String",
"... | <p>createOsgiFilter.</p>
@return a {@link org.osgi.framework.Filter} object.
@throws java.lang.IllegalArgumentException if any. | [
"<p",
">",
"createOsgiFilter",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ops4j/org.ops4j.pax.wicket/blob/ef7cb4bdf918e9e61ec69789b9c690567616faa9/service/src/main/java/org/ops4j/pax/wicket/internal/filter/FilterTrackerCustomizer.java#L104-L117 |
threerings/nenya | tools/src/main/java/com/threerings/media/tile/tools/MapFileTileSetIDBroker.java | MapFileTileSetIDBroker.renameTileSet | protected boolean renameTileSet (String oldName, String newName) {
"""
Copies the ID from the old tileset to the new tileset which is
useful when a tileset is renamed. This is called by the {@link
RenameTileSet} utility.
"""
Integer tsid = _map.get(oldName);
if (tsid != null) {
_map.put(newName, tsid);
// fudge our stored tileset ID so that we flush ourselves when
// the rename tool requests that we commit the changes
_storedTileSetID--;
return true;
} else {
return false;
}
} | java | protected boolean renameTileSet (String oldName, String newName)
{
Integer tsid = _map.get(oldName);
if (tsid != null) {
_map.put(newName, tsid);
// fudge our stored tileset ID so that we flush ourselves when
// the rename tool requests that we commit the changes
_storedTileSetID--;
return true;
} else {
return false;
}
} | [
"protected",
"boolean",
"renameTileSet",
"(",
"String",
"oldName",
",",
"String",
"newName",
")",
"{",
"Integer",
"tsid",
"=",
"_map",
".",
"get",
"(",
"oldName",
")",
";",
"if",
"(",
"tsid",
"!=",
"null",
")",
"{",
"_map",
".",
"put",
"(",
"newName",
... | Copies the ID from the old tileset to the new tileset which is
useful when a tileset is renamed. This is called by the {@link
RenameTileSet} utility. | [
"Copies",
"the",
"ID",
"from",
"the",
"old",
"tileset",
"to",
"the",
"new",
"tileset",
"which",
"is",
"useful",
"when",
"a",
"tileset",
"is",
"renamed",
".",
"This",
"is",
"called",
"by",
"the",
"{"
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/media/tile/tools/MapFileTileSetIDBroker.java#L185-L198 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.