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 |
|---|---|---|---|---|---|---|---|---|---|---|
spring-projects/spring-hateoas | src/main/java/org/springframework/hateoas/UriTemplate.java | UriTemplate.appendToBuilder | private static void appendToBuilder(UriComponentsBuilder builder, TemplateVariable variable, @Nullable Object value) {
"""
Appends the value for the given {@link TemplateVariable} to the given {@link UriComponentsBuilder}.
@param builder must not be {@literal null}.
@param variable must not be {@literal null}.... | java | private static void appendToBuilder(UriComponentsBuilder builder, TemplateVariable variable, @Nullable Object value) {
if (value == null) {
if (variable.isRequired()) {
throw new IllegalArgumentException(
String.format("Template variable %s is required but no value was given!", variable.getName()));
... | [
"private",
"static",
"void",
"appendToBuilder",
"(",
"UriComponentsBuilder",
"builder",
",",
"TemplateVariable",
"variable",
",",
"@",
"Nullable",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"if",
"(",
"variable",
".",
"isRequired"... | Appends the value for the given {@link TemplateVariable} to the given {@link UriComponentsBuilder}.
@param builder must not be {@literal null}.
@param variable must not be {@literal null}.
@param value can be {@literal null}. | [
"Appends",
"the",
"value",
"for",
"the",
"given",
"{",
"@link",
"TemplateVariable",
"}",
"to",
"the",
"given",
"{",
"@link",
"UriComponentsBuilder",
"}",
"."
] | train | https://github.com/spring-projects/spring-hateoas/blob/70ebff9309f086cd8d6a97daf67e0dc215c87d9c/src/main/java/org/springframework/hateoas/UriTemplate.java#L312-L340 |
vvakame/JsonPullParser | jsonpullparser-apt/src/main/java/net/vvakame/util/jsonpullparser/factory/JsonModelGenerator.java | JsonModelGenerator.from | public static JsonModelGenerator from(Element element, String classNamePostfix) {
"""
Process {@link Element} to generate.
@param element
@param classNamePostfix
@return {@link JsonModelGenerator}
@author vvakame
"""
JsonModelGenerator generator = new JsonModelGenerator(element, classNamePostfix);
gen... | java | public static JsonModelGenerator from(Element element, String classNamePostfix) {
JsonModelGenerator generator = new JsonModelGenerator(element, classNamePostfix);
generator.processJsonModel();
generator.processJsonKeys();
generator.processStoreJson();
if (generator.jsonModel.existsBase) {
JsonModelGener... | [
"public",
"static",
"JsonModelGenerator",
"from",
"(",
"Element",
"element",
",",
"String",
"classNamePostfix",
")",
"{",
"JsonModelGenerator",
"generator",
"=",
"new",
"JsonModelGenerator",
"(",
"element",
",",
"classNamePostfix",
")",
";",
"generator",
".",
"proce... | Process {@link Element} to generate.
@param element
@param classNamePostfix
@return {@link JsonModelGenerator}
@author vvakame | [
"Process",
"{"
] | train | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-apt/src/main/java/net/vvakame/util/jsonpullparser/factory/JsonModelGenerator.java#L92-L106 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/entity/GlobalInterlock.java | GlobalInterlock.releaseLock | public static void releaseLock(EntityManager em, long type, String key) {
"""
Releases a global lock of the indicated type if the supplied key is a match for the lock.
@param em The entity manager factory to use. Cannot be null.
@param type The type of key to release.
@param key The key value obta... | java | public static void releaseLock(EntityManager em, long type, String key) {
EntityTransaction tx = null;
/* remove the existing lock if it matches the key. */
try {
tx = em.getTransaction();
tx.begin();
GlobalInterlock lock = _findAndRefreshLock(em, type);
... | [
"public",
"static",
"void",
"releaseLock",
"(",
"EntityManager",
"em",
",",
"long",
"type",
",",
"String",
"key",
")",
"{",
"EntityTransaction",
"tx",
"=",
"null",
";",
"/* remove the existing lock if it matches the key. */",
"try",
"{",
"tx",
"=",
"em",
".",
"g... | Releases a global lock of the indicated type if the supplied key is a match for the lock.
@param em The entity manager factory to use. Cannot be null.
@param type The type of key to release.
@param key The key value obtained from the lock creation.
@throws GlobalInterlockException If the lock cannot be ... | [
"Releases",
"a",
"global",
"lock",
"of",
"the",
"indicated",
"type",
"if",
"the",
"supplied",
"key",
"is",
"a",
"match",
"for",
"the",
"lock",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/GlobalInterlock.java#L193-L221 |
adyliu/jafka | src/main/java/io/jafka/log/LogManager.java | LogManager.createLogs | public int createLogs(String topic, final int partitions, final boolean forceEnlarge) {
"""
create logs with given partition number
@param topic the topic name
@param partitions partition number
@param forceEnlarge enlarge the partition number of log if smaller than runtime
@return the partition num... | java | public int createLogs(String topic, final int partitions, final boolean forceEnlarge) {
TopicNameValidator.validate(topic);
synchronized (logCreationLock) {
final int configPartitions = getPartition(topic);
if (configPartitions >= partitions || !forceEnlarge) {
re... | [
"public",
"int",
"createLogs",
"(",
"String",
"topic",
",",
"final",
"int",
"partitions",
",",
"final",
"boolean",
"forceEnlarge",
")",
"{",
"TopicNameValidator",
".",
"validate",
"(",
"topic",
")",
";",
"synchronized",
"(",
"logCreationLock",
")",
"{",
"final... | create logs with given partition number
@param topic the topic name
@param partitions partition number
@param forceEnlarge enlarge the partition number of log if smaller than runtime
@return the partition number of the log after enlarging | [
"create",
"logs",
"with",
"given",
"partition",
"number"
] | train | https://github.com/adyliu/jafka/blob/cc14d2ed60c039b12d7b106bb5269ef21d0add7e/src/main/java/io/jafka/log/LogManager.java#L508-L525 |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/core/internal/utils/BeanUtils.java | BeanUtils.getProperty | public static String getProperty(Object bean, String field) {
"""
Get bean's property value and maps to String
@see io.katharsis.core.internal.utils.PropertyUtils#getProperty(Object, String)
@param bean bean to be accessed
@param field bean's field
@return bean's property value
"""
Object prop... | java | public static String getProperty(Object bean, String field) {
Object property = PropertyUtils.getProperty(bean, field);
if (property == null) {
return "null";
}
return property.toString();
} | [
"public",
"static",
"String",
"getProperty",
"(",
"Object",
"bean",
",",
"String",
"field",
")",
"{",
"Object",
"property",
"=",
"PropertyUtils",
".",
"getProperty",
"(",
"bean",
",",
"field",
")",
";",
"if",
"(",
"property",
"==",
"null",
")",
"{",
"ret... | Get bean's property value and maps to String
@see io.katharsis.core.internal.utils.PropertyUtils#getProperty(Object, String)
@param bean bean to be accessed
@param field bean's field
@return bean's property value | [
"Get",
"bean",
"s",
"property",
"value",
"and",
"maps",
"to",
"String"
] | train | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/utils/BeanUtils.java#L17-L24 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanO.java | BeanO.buildTempEJBMethodMetaData | private EJBMethodMetaData buildTempEJBMethodMetaData(int dispatchEventCode, BeanMetaData bmd) {
"""
Create a temporary EJBMethodMetaData object. This method is used by the callDispatchEventListeners method to
create a 'fake' EJBMethodMetaData object to report framework methods (activate/load/store/passivate) to t... | java | private EJBMethodMetaData buildTempEJBMethodMetaData(int dispatchEventCode, BeanMetaData bmd)
{
String methName = "";
String methSig = "";
switch (dispatchEventCode) {
case DispatchEventListener.BEFORE_EJBACTIVATE:
methName = "ejbActivate";
methSig... | [
"private",
"EJBMethodMetaData",
"buildTempEJBMethodMetaData",
"(",
"int",
"dispatchEventCode",
",",
"BeanMetaData",
"bmd",
")",
"{",
"String",
"methName",
"=",
"\"\"",
";",
"String",
"methSig",
"=",
"\"\"",
";",
"switch",
"(",
"dispatchEventCode",
")",
"{",
"case"... | Create a temporary EJBMethodMetaData object. This method is used by the callDispatchEventListeners method to
create a 'fake' EJBMethodMetaData object to report framework methods (activate/load/store/passivate) to the
DispatchEventListeners. | [
"Create",
"a",
"temporary",
"EJBMethodMetaData",
"object",
".",
"This",
"method",
"is",
"used",
"by",
"the",
"callDispatchEventListeners",
"method",
"to",
"create",
"a",
"fake",
"EJBMethodMetaData",
"object",
"to",
"report",
"framework",
"methods",
"(",
"activate",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanO.java#L1966-L1996 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/http/DefaultHttpClient.java | DefaultHttpClient.calcBackoff | public long calcBackoff(int previousAttempts, long totalElapsedTimeMillis, Error error) {
"""
The backoff calculation routine. Uses exponential backoff. If the maximum elapsed time
has expired, this calculation returns -1 causing the caller to fall out of the retry loop.
@param previousAttempts
@param totalEl... | java | public long calcBackoff(int previousAttempts, long totalElapsedTimeMillis, Error error) {
long backoffMillis = (long)(Math.pow(2, previousAttempts) * 1000) + new Random().nextInt(1000);
if(totalElapsedTimeMillis + backoffMillis > maxRetryTimeMillis) {
logger.info("Elapsed time " + totalEla... | [
"public",
"long",
"calcBackoff",
"(",
"int",
"previousAttempts",
",",
"long",
"totalElapsedTimeMillis",
",",
"Error",
"error",
")",
"{",
"long",
"backoffMillis",
"=",
"(",
"long",
")",
"(",
"Math",
".",
"pow",
"(",
"2",
",",
"previousAttempts",
")",
"*",
"... | The backoff calculation routine. Uses exponential backoff. If the maximum elapsed time
has expired, this calculation returns -1 causing the caller to fall out of the retry loop.
@param previousAttempts
@param totalElapsedTimeMillis
@param error
@return -1 to fall out of retry loop, positive number indicates backoff ti... | [
"The",
"backoff",
"calculation",
"routine",
".",
"Uses",
"exponential",
"backoff",
".",
"If",
"the",
"maximum",
"elapsed",
"time",
"has",
"expired",
"this",
"calculation",
"returns",
"-",
"1",
"causing",
"the",
"caller",
"to",
"fall",
"out",
"of",
"the",
"re... | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/http/DefaultHttpClient.java#L419-L429 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/carts/CartItemUrl.java | CartItemUrl.getCartItemUrl | public static MozuUrl getCartItemUrl(String cartItemId, String responseFields) {
"""
Get Resource Url for GetCartItem
@param cartItemId Identifier of the cart item to delete.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. T... | java | public static MozuUrl getCartItemUrl(String cartItemId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/carts/current/items/{cartItemId}?responseFields={responseFields}");
formatter.formatUrl("cartItemId", cartItemId);
formatter.formatUrl("responseFields", responseFields);
... | [
"public",
"static",
"MozuUrl",
"getCartItemUrl",
"(",
"String",
"cartItemId",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/carts/current/items/{cartItemId}?responseFields={responseFields}\"",
")",
";... | Get Resource Url for GetCartItem
@param cartItemId Identifier of the cart item to delete.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this par... | [
"Get",
"Resource",
"Url",
"for",
"GetCartItem"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/carts/CartItemUrl.java#L22-L28 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java | StrSpliter.split | public static List<String> split(String str, int limit) {
"""
使用空白符切分字符串<br>
切分后的字符串两边不包含空白符,空串或空白符串并不做为元素之一
@param str 被切分的字符串
@param limit 限制分片数
@return 切分后的集合
@since 3.0.8
"""
if(StrUtil.isEmpty(str)){
return new ArrayList<String>(0);
}
if(limit == 1){
return addToList(new ArrayList<... | java | public static List<String> split(String str, int limit){
if(StrUtil.isEmpty(str)){
return new ArrayList<String>(0);
}
if(limit == 1){
return addToList(new ArrayList<String>(1), str, true, true);
}
final ArrayList<String> list = new ArrayList<>();
int len = str.length();
int start = 0;//... | [
"public",
"static",
"List",
"<",
"String",
">",
"split",
"(",
"String",
"str",
",",
"int",
"limit",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isEmpty",
"(",
"str",
")",
")",
"{",
"return",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"0",
")",
";",
"... | 使用空白符切分字符串<br>
切分后的字符串两边不包含空白符,空串或空白符串并不做为元素之一
@param str 被切分的字符串
@param limit 限制分片数
@return 切分后的集合
@since 3.0.8 | [
"使用空白符切分字符串<br",
">",
"切分后的字符串两边不包含空白符,空串或空白符串并不做为元素之一"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java#L351-L374 |
BlueBrain/bluima | modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/maxent/GISModel.java | GISModel.convertToContexts | private static Context[] convertToContexts(TIntParamHashMap[] params) {
"""
/*
public GISModel (TIntParamHashMap[] _params,
String[] predLabels,
String[] _ocNames,
int _correctionConstant,
double _correctionParam) {
this(convertToContexts(_params),predLabels,_ocNames,_correctionConstant,_correctionParam);
}... | java | private static Context[] convertToContexts(TIntParamHashMap[] params) {
Context[] contexts = new Context[params.length];
for (int pi=0;pi<params.length;pi++) {
int[] activeOutcomes = params[pi].keys();
double[] activeParameters = new double[activeOutcomes.length];
for (int oi=0;oi<ac... | [
"private",
"static",
"Context",
"[",
"]",
"convertToContexts",
"(",
"TIntParamHashMap",
"[",
"]",
"params",
")",
"{",
"Context",
"[",
"]",
"contexts",
"=",
"new",
"Context",
"[",
"params",
".",
"length",
"]",
";",
"for",
"(",
"int",
"pi",
"=",
"0",
";"... | /*
public GISModel (TIntParamHashMap[] _params,
String[] predLabels,
String[] _ocNames,
int _correctionConstant,
double _correctionParam) {
this(convertToContexts(_params),predLabels,_ocNames,_correctionConstant,_correctionParam);
} | [
"/",
"*",
"public",
"GISModel",
"(",
"TIntParamHashMap",
"[]",
"_params",
"String",
"[]",
"predLabels",
"String",
"[]",
"_ocNames",
"int",
"_correctionConstant",
"double",
"_correctionParam",
")",
"{",
"this",
"(",
"convertToContexts",
"(",
"_params",
")",
"predLa... | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/maxent/GISModel.java#L78-L89 |
alkacon/opencms-core | src/org/opencms/main/OpenCms.java | OpenCms.fireCmsEvent | public static void fireCmsEvent(int type, Map<String, Object> data) {
"""
Notify all event listeners that a particular event has occurred.<p>
The event will be given to all registered <code>{@link I_CmsEventListener}</code> objects.<p>
@param type event type
@param data event data
"""
OpenCmsCo... | java | public static void fireCmsEvent(int type, Map<String, Object> data) {
OpenCmsCore.getInstance().getEventManager().fireEvent(type, data);
} | [
"public",
"static",
"void",
"fireCmsEvent",
"(",
"int",
"type",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
")",
"{",
"OpenCmsCore",
".",
"getInstance",
"(",
")",
".",
"getEventManager",
"(",
")",
".",
"fireEvent",
"(",
"type",
",",
"data",
... | Notify all event listeners that a particular event has occurred.<p>
The event will be given to all registered <code>{@link I_CmsEventListener}</code> objects.<p>
@param type event type
@param data event data | [
"Notify",
"all",
"event",
"listeners",
"that",
"a",
"particular",
"event",
"has",
"occurred",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCms.java#L170-L173 |
johncarl81/transfuse | transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java | Contract.atLength | public static void atLength(final Object[] array, final int length, final String arrayName) {
"""
Checks that an array is of a given length
@param array the array
@param length the desired length of the array
@param arrayName the name of the array
@throws IllegalArgumentException if the array is null or if the... | java | public static void atLength(final Object[] array, final int length, final String arrayName) {
notNull(array, arrayName);
notNegative(length, "length");
if (array.length != length) {
throw new IllegalArgumentException("expecting " + maskNullArgument(arrayName) + " to be of length " +... | [
"public",
"static",
"void",
"atLength",
"(",
"final",
"Object",
"[",
"]",
"array",
",",
"final",
"int",
"length",
",",
"final",
"String",
"arrayName",
")",
"{",
"notNull",
"(",
"array",
",",
"arrayName",
")",
";",
"notNegative",
"(",
"length",
",",
"\"le... | Checks that an array is of a given length
@param array the array
@param length the desired length of the array
@param arrayName the name of the array
@throws IllegalArgumentException if the array is null or if the array's length is not as expected | [
"Checks",
"that",
"an",
"array",
"is",
"of",
"a",
"given",
"length"
] | train | https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L128-L135 |
elastic/elasticsearch-hadoop | mr/src/main/java/org/elasticsearch/hadoop/rest/RestRepository.java | RestRepository.lazyInitWriting | private void lazyInitWriting() {
"""
postpone writing initialization since we can do only reading so there's no need to allocate buffers
"""
if (!writeInitialized) {
this.writeInitialized = true;
this.bulkProcessor = new BulkProcessor(client, resources.getResourceWrite(), settin... | java | private void lazyInitWriting() {
if (!writeInitialized) {
this.writeInitialized = true;
this.bulkProcessor = new BulkProcessor(client, resources.getResourceWrite(), settings);
this.trivialBytesRef = new BytesRef();
this.bulkEntryWriter = new BulkEntryWriter(settin... | [
"private",
"void",
"lazyInitWriting",
"(",
")",
"{",
"if",
"(",
"!",
"writeInitialized",
")",
"{",
"this",
".",
"writeInitialized",
"=",
"true",
";",
"this",
".",
"bulkProcessor",
"=",
"new",
"BulkProcessor",
"(",
"client",
",",
"resources",
".",
"getResourc... | postpone writing initialization since we can do only reading so there's no need to allocate buffers | [
"postpone",
"writing",
"initialization",
"since",
"we",
"can",
"do",
"only",
"reading",
"so",
"there",
"s",
"no",
"need",
"to",
"allocate",
"buffers"
] | train | https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/rest/RestRepository.java#L133-L140 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtensionRepository.java | DefaultInstalledExtensionRepository.removeInstalledExtension | private void removeInstalledExtension(DefaultInstalledExtension installedExtension, String namespace) {
"""
Uninstall provided extension.
@param installedExtension the extension to uninstall
@param namespace the namespace
@see #uninstallExtension(LocalExtension, String)
"""
removeInstalledFeature(... | java | private void removeInstalledExtension(DefaultInstalledExtension installedExtension, String namespace)
{
removeInstalledFeature(installedExtension.getId().getId(), namespace);
for (ExtensionId feature : installedExtension.getExtensionFeatures()) {
removeInstalledFeature(feature.getId(), ... | [
"private",
"void",
"removeInstalledExtension",
"(",
"DefaultInstalledExtension",
"installedExtension",
",",
"String",
"namespace",
")",
"{",
"removeInstalledFeature",
"(",
"installedExtension",
".",
"getId",
"(",
")",
".",
"getId",
"(",
")",
",",
"namespace",
")",
"... | Uninstall provided extension.
@param installedExtension the extension to uninstall
@param namespace the namespace
@see #uninstallExtension(LocalExtension, String) | [
"Uninstall",
"provided",
"extension",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtensionRepository.java#L430-L443 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicated_server_serviceName_ip_duration_POST | public OvhOrder dedicated_server_serviceName_ip_duration_POST(String serviceName, String duration, OvhIpBlockSizeEnum blockSize, OvhIpCountryEnum country, String organisationId, OvhIpTypeOrderableEnum type) throws IOException {
"""
Create order
REST: POST /order/dedicated/server/{serviceName}/ip/{duration}
@pa... | java | public OvhOrder dedicated_server_serviceName_ip_duration_POST(String serviceName, String duration, OvhIpBlockSizeEnum blockSize, OvhIpCountryEnum country, String organisationId, OvhIpTypeOrderableEnum type) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/ip/{duration}";
StringBuilder sb =... | [
"public",
"OvhOrder",
"dedicated_server_serviceName_ip_duration_POST",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"OvhIpBlockSizeEnum",
"blockSize",
",",
"OvhIpCountryEnum",
"country",
",",
"String",
"organisationId",
",",
"OvhIpTypeOrderableEnum",
"type",
... | Create order
REST: POST /order/dedicated/server/{serviceName}/ip/{duration}
@param blockSize [required] IP block size
@param organisationId [required] Your organisation id to add on block informations
@param country [required] IP localization
@param type [required] The type of IP
@param serviceName [required] The inte... | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2432-L2442 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java | Ftp.init | public Ftp init(String host, int port, String user, String password) {
"""
初始化连接
@param host 域名或IP
@param port 端口
@param user 用户名
@param password 密码
@return this
"""
return this.init(host,port,user,password,null);
} | java | public Ftp init(String host, int port, String user, String password) {
return this.init(host,port,user,password,null);
} | [
"public",
"Ftp",
"init",
"(",
"String",
"host",
",",
"int",
"port",
",",
"String",
"user",
",",
"String",
"password",
")",
"{",
"return",
"this",
".",
"init",
"(",
"host",
",",
"port",
",",
"user",
",",
"password",
",",
"null",
")",
";",
"}"
] | 初始化连接
@param host 域名或IP
@param port 端口
@param user 用户名
@param password 密码
@return this | [
"初始化连接"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java#L118-L120 |
google/closure-templates | java/src/com/google/template/soy/jssrc/internal/NullSafeAccumulator.java | NullSafeAccumulator.bracketAccess | NullSafeAccumulator bracketAccess(Expression arg, boolean nullSafe) {
"""
Extends the access chain with a bracket access to the given value.
@param nullSafe If true, code will be generated to ensure the chain is non-null before
dereferencing {@code arg}.
"""
chain.add(new Bracket(arg, nullSafe));
/... | java | NullSafeAccumulator bracketAccess(Expression arg, boolean nullSafe) {
chain.add(new Bracket(arg, nullSafe));
// With a bracket access we no longer need to unpack the entire list, just a singular object.
accessType = AccessType.SINGULAR;
return this;
} | [
"NullSafeAccumulator",
"bracketAccess",
"(",
"Expression",
"arg",
",",
"boolean",
"nullSafe",
")",
"{",
"chain",
".",
"add",
"(",
"new",
"Bracket",
"(",
"arg",
",",
"nullSafe",
")",
")",
";",
"// With a bracket access we no longer need to unpack the entire list, just a ... | Extends the access chain with a bracket access to the given value.
@param nullSafe If true, code will be generated to ensure the chain is non-null before
dereferencing {@code arg}. | [
"Extends",
"the",
"access",
"chain",
"with",
"a",
"bracket",
"access",
"to",
"the",
"given",
"value",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/NullSafeAccumulator.java#L113-L118 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/sequences/SequenceGibbsSampler.java | SequenceGibbsSampler.bestSequence | public int[] bestSequence(SequenceModel model) {
"""
Finds the best sequence by collecting numSamples samples, scoring them, and then choosing
the highest scoring sample.
@return the array of type int representing the highest scoring sequence
"""
int[] initialSequence = getRandomSequence(model);
re... | java | public int[] bestSequence(SequenceModel model) {
int[] initialSequence = getRandomSequence(model);
return findBestUsingSampling(model, numSamples, sampleInterval, initialSequence);
} | [
"public",
"int",
"[",
"]",
"bestSequence",
"(",
"SequenceModel",
"model",
")",
"{",
"int",
"[",
"]",
"initialSequence",
"=",
"getRandomSequence",
"(",
"model",
")",
";",
"return",
"findBestUsingSampling",
"(",
"model",
",",
"numSamples",
",",
"sampleInterval",
... | Finds the best sequence by collecting numSamples samples, scoring them, and then choosing
the highest scoring sample.
@return the array of type int representing the highest scoring sequence | [
"Finds",
"the",
"best",
"sequence",
"by",
"collecting",
"numSamples",
"samples",
"scoring",
"them",
"and",
"then",
"choosing",
"the",
"highest",
"scoring",
"sample",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/sequences/SequenceGibbsSampler.java#L55-L58 |
milosmns/circular-slider-android | slider/src/main/java/me/angrybyte/circularslider/CircularSlider.java | CircularSlider.updateSliderState | private void updateSliderState(int touchX, int touchY) {
"""
Invoked when slider starts moving or is currently moving. This method calculates and sets position and angle of the thumb.
@param touchX Where is the touch identifier now on X axis
@param touchY Where is the touch identifier now on Y axis
"""
... | java | private void updateSliderState(int touchX, int touchY) {
int distanceX = touchX - mCircleCenterX;
int distanceY = mCircleCenterY - touchY;
//noinspection SuspiciousNameCombination
double c = Math.sqrt(Math.pow(distanceX, 2) + Math.pow(distanceY, 2));
mAngle = Math.acos(distanceX ... | [
"private",
"void",
"updateSliderState",
"(",
"int",
"touchX",
",",
"int",
"touchY",
")",
"{",
"int",
"distanceX",
"=",
"touchX",
"-",
"mCircleCenterX",
";",
"int",
"distanceY",
"=",
"mCircleCenterY",
"-",
"touchY",
";",
"//noinspection SuspiciousNameCombination",
... | Invoked when slider starts moving or is currently moving. This method calculates and sets position and angle of the thumb.
@param touchX Where is the touch identifier now on X axis
@param touchY Where is the touch identifier now on Y axis | [
"Invoked",
"when",
"slider",
"starts",
"moving",
"or",
"is",
"currently",
"moving",
".",
"This",
"method",
"calculates",
"and",
"sets",
"position",
"and",
"angle",
"of",
"the",
"thumb",
"."
] | train | https://github.com/milosmns/circular-slider-android/blob/f255cac7fda0664a4f81ca1d4917938b53a76257/slider/src/main/java/me/angrybyte/circularslider/CircularSlider.java#L228-L242 |
auth0/Auth0.Android | auth0/src/main/java/com/auth0/android/provider/AuthProvider.java | AuthProvider.onRequestPermissionsResult | public void onRequestPermissionsResult(@NonNull Activity activity, int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
"""
Should be called from the activity that initiated the Android Manifest.permission request,
when the method #onRequestPermissionResult is called on that activity. If... | java | public void onRequestPermissionsResult(@NonNull Activity activity, int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
List<String> declinedPermissions = handler.parseRequestResult(requestCode, permissions, grantResults);
if (declinedPermissions.isEmpty()) {
Log.v... | [
"public",
"void",
"onRequestPermissionsResult",
"(",
"@",
"NonNull",
"Activity",
"activity",
",",
"int",
"requestCode",
",",
"@",
"NonNull",
"String",
"[",
"]",
"permissions",
",",
"@",
"NonNull",
"int",
"[",
"]",
"grantResults",
")",
"{",
"List",
"<",
"Stri... | Should be called from the activity that initiated the Android Manifest.permission request,
when the method #onRequestPermissionResult is called on that activity. If all the permissions
are now granted, the authentication flow will begin.
@param activity a valid activity context.
@param requestCode the request cod... | [
"Should",
"be",
"called",
"from",
"the",
"activity",
"that",
"initiated",
"the",
"Android",
"Manifest",
".",
"permission",
"request",
"when",
"the",
"method",
"#onRequestPermissionResult",
"is",
"called",
"on",
"that",
"activity",
".",
"If",
"all",
"the",
"permi... | train | https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/provider/AuthProvider.java#L219-L235 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelV1ClientState.java | PaymentChannelV1ClientState.provideRefundSignature | public synchronized void provideRefundSignature(byte[] theirSignature, @Nullable KeyParameter userKey)
throws SignatureDecodeException, VerificationException {
"""
<p>When the servers signature for the refund transaction is received, call this to verify it and sign the
complete refund ourselves.</p>
... | java | public synchronized void provideRefundSignature(byte[] theirSignature, @Nullable KeyParameter userKey)
throws SignatureDecodeException, VerificationException {
checkNotNull(theirSignature);
stateMachine.checkState(State.WAITING_FOR_SIGNED_REFUND);
TransactionSignature theirSig = Tran... | [
"public",
"synchronized",
"void",
"provideRefundSignature",
"(",
"byte",
"[",
"]",
"theirSignature",
",",
"@",
"Nullable",
"KeyParameter",
"userKey",
")",
"throws",
"SignatureDecodeException",
",",
"VerificationException",
"{",
"checkNotNull",
"(",
"theirSignature",
")"... | <p>When the servers signature for the refund transaction is received, call this to verify it and sign the
complete refund ourselves.</p>
<p>If this does not throw an exception, we are secure against the loss of funds and can safely provide the server
with the multi-sig contract to lock in the agreement. In this case, ... | [
"<p",
">",
"When",
"the",
"servers",
"signature",
"for",
"the",
"refund",
"transaction",
"is",
"received",
"call",
"this",
"to",
"verify",
"it",
"and",
"sign",
"the",
"complete",
"refund",
"ourselves",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelV1ClientState.java#L229-L254 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java | JSONConverter.writeServerNotificationRegistration | public void writeServerNotificationRegistration(OutputStream out, ServerNotificationRegistration value) throws IOException {
"""
Encode a ServerNotificationRegistration instance as JSON:
{
"operation" : ("Add" | "RemoveAll" | "RemoveSpecific")
"objectName" : ObjectName,
"listener" : ObjectName,
"filter" : Not... | java | public void writeServerNotificationRegistration(OutputStream out, ServerNotificationRegistration value) throws IOException {
writeStartObject(out);
boolean hasOperation = value.operation != null;
if (hasOperation) {
writeSimpleStringField(out, OM_OPERATION, value.operation.name());
... | [
"public",
"void",
"writeServerNotificationRegistration",
"(",
"OutputStream",
"out",
",",
"ServerNotificationRegistration",
"value",
")",
"throws",
"IOException",
"{",
"writeStartObject",
"(",
"out",
")",
";",
"boolean",
"hasOperation",
"=",
"value",
".",
"operation",
... | Encode a ServerNotificationRegistration instance as JSON:
{
"operation" : ("Add" | "RemoveAll" | "RemoveSpecific")
"objectName" : ObjectName,
"listener" : ObjectName,
"filter" : NotificationFilter,
"handback" : POJO,
"filterID" : Integer,
"handbackID" : Integer
}
@param out The stream to write JSON to
@param value The... | [
"Encode",
"a",
"ServerNotificationRegistration",
"instance",
"as",
"JSON",
":",
"{",
"operation",
":",
"(",
"Add",
"|",
"RemoveAll",
"|",
"RemoveSpecific",
")",
"objectName",
":",
"ObjectName",
"listener",
":",
"ObjectName",
"filter",
":",
"NotificationFilter",
"h... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java#L1526-L1541 |
gallandarakhneorg/afc | core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java | MathUtil.compareEpsilon | @Pure
public static int compareEpsilon(double v1, double v2) {
"""
Compares its two arguments for order.
Returns a negative integer,
zero, or a positive integer as the first argument is less than, equal
to, or greater than the second.
@param v1 first value.
@param v2 second value.
@return a negative integ... | java | @Pure
public static int compareEpsilon(double v1, double v2) {
final double v = v1 - v2;
if (Math.abs(v) < Math.ulp(v)) {
return 0;
}
if (v <= 0.) {
return -1;
}
return 1;
} | [
"@",
"Pure",
"public",
"static",
"int",
"compareEpsilon",
"(",
"double",
"v1",
",",
"double",
"v2",
")",
"{",
"final",
"double",
"v",
"=",
"v1",
"-",
"v2",
";",
"if",
"(",
"Math",
".",
"abs",
"(",
"v",
")",
"<",
"Math",
".",
"ulp",
"(",
"v",
")... | Compares its two arguments for order.
Returns a negative integer,
zero, or a positive integer as the first argument is less than, equal
to, or greater than the second.
@param v1 first value.
@param v2 second value.
@return a negative integer, zero, or a positive integer as the
first argument is less than, equal to, or... | [
"Compares",
"its",
"two",
"arguments",
"for",
"order",
".",
"Returns",
"a",
"negative",
"integer",
"zero",
"or",
"a",
"positive",
"integer",
"as",
"the",
"first",
"argument",
"is",
"less",
"than",
"equal",
"to",
"or",
"greater",
"than",
"the",
"second",
".... | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java#L189-L199 |
alkacon/opencms-core | src/org/opencms/acacia/shared/CmsEntity.java | CmsEntity.setAttributeValue | public void setAttributeValue(String attributeName, String value) {
"""
Sets the given attribute value. Will remove all previous attribute values.<p>
@param attributeName the attribute name
@param value the attribute value
"""
m_entityAttributes.remove(attributeName);
List<String> value... | java | public void setAttributeValue(String attributeName, String value) {
m_entityAttributes.remove(attributeName);
List<String> values = new ArrayList<String>();
values.add(value);
m_simpleAttributes.put(attributeName, values);
fireChange();
} | [
"public",
"void",
"setAttributeValue",
"(",
"String",
"attributeName",
",",
"String",
"value",
")",
"{",
"m_entityAttributes",
".",
"remove",
"(",
"attributeName",
")",
";",
"List",
"<",
"String",
">",
"values",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"... | Sets the given attribute value. Will remove all previous attribute values.<p>
@param attributeName the attribute name
@param value the attribute value | [
"Sets",
"the",
"given",
"attribute",
"value",
".",
"Will",
"remove",
"all",
"previous",
"attribute",
"values",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/CmsEntity.java#L624-L631 |
google/closure-compiler | src/com/google/javascript/jscomp/MustBeReachingVariableDef.java | MustBeReachingVariableDef.computeDependence | private void computeDependence(final Definition def, Node rValue) {
"""
Computes all the local variables that rValue reads from and store that
in the def's depends set.
"""
NodeTraversal.traverse(
compiler,
rValue,
new AbstractCfgNodeTraversalCallback() {
@Override
... | java | private void computeDependence(final Definition def, Node rValue) {
NodeTraversal.traverse(
compiler,
rValue,
new AbstractCfgNodeTraversalCallback() {
@Override
public void visit(NodeTraversal t, Node n, Node parent) {
if (n.isName()) {
Var dep =... | [
"private",
"void",
"computeDependence",
"(",
"final",
"Definition",
"def",
",",
"Node",
"rValue",
")",
"{",
"NodeTraversal",
".",
"traverse",
"(",
"compiler",
",",
"rValue",
",",
"new",
"AbstractCfgNodeTraversalCallback",
"(",
")",
"{",
"@",
"Override",
"public"... | Computes all the local variables that rValue reads from and store that
in the def's depends set. | [
"Computes",
"all",
"the",
"local",
"variables",
"that",
"rValue",
"reads",
"from",
"and",
"store",
"that",
"in",
"the",
"def",
"s",
"depends",
"set",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/MustBeReachingVariableDef.java#L442-L459 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java | PackageManagerUtils.getVersionName | public static String getVersionName(Context context) {
"""
Read version name from the manifest of the context.
@param context the context.
@return the version name.
@throws java.lang.IllegalStateException if the target package is not installed.
"""
try {
PackageManager manager = context.... | java | public static String getVersionName(Context context) {
try {
PackageManager manager = context.getPackageManager();
PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
return info.versionName;
} catch (NameNotFoundException e) {
throw ne... | [
"public",
"static",
"String",
"getVersionName",
"(",
"Context",
"context",
")",
"{",
"try",
"{",
"PackageManager",
"manager",
"=",
"context",
".",
"getPackageManager",
"(",
")",
";",
"PackageInfo",
"info",
"=",
"manager",
".",
"getPackageInfo",
"(",
"context",
... | Read version name from the manifest of the context.
@param context the context.
@return the version name.
@throws java.lang.IllegalStateException if the target package is not installed. | [
"Read",
"version",
"name",
"from",
"the",
"manifest",
"of",
"the",
"context",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java#L71-L79 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java | TasksImpl.addAsync | public Observable<Void> addAsync(String jobId, TaskAddParameter task, TaskAddOptions taskAddOptions) {
"""
Adds a task to the specified job.
The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service... | java | public Observable<Void> addAsync(String jobId, TaskAddParameter task, TaskAddOptions taskAddOptions) {
return addWithServiceResponseAsync(jobId, task, taskAddOptions).map(new Func1<ServiceResponseWithHeaders<Void, TaskAddHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithH... | [
"public",
"Observable",
"<",
"Void",
">",
"addAsync",
"(",
"String",
"jobId",
",",
"TaskAddParameter",
"task",
",",
"TaskAddOptions",
"taskAddOptions",
")",
"{",
"return",
"addWithServiceResponseAsync",
"(",
"jobId",
",",
"task",
",",
"taskAddOptions",
")",
".",
... | Adds a task to the specified job.
The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time.
@param jobId The ID of the job to which the task is to be ad... | [
"Adds",
"a",
"task",
"to",
"the",
"specified",
"job",
".",
"The",
"maximum",
"lifetime",
"of",
"a",
"task",
"from",
"addition",
"to",
"completion",
"is",
"180",
"days",
".",
"If",
"a",
"task",
"has",
"not",
"completed",
"within",
"180",
"days",
"of",
"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java#L268-L275 |
google/closure-compiler | src/com/google/javascript/jscomp/OptimizeParameters.java | OptimizeParameters.addVariableToFunction | private void addVariableToFunction(Node function, @Nullable Node lhs, Node value) {
"""
Adds a variable to the top of a function block.
@param function A function node.
@param lhs The lhs expression.
@param value The initial value of the variable.
"""
checkState(value.getParent() == null);
checkStat... | java | private void addVariableToFunction(Node function, @Nullable Node lhs, Node value) {
checkState(value.getParent() == null);
checkState(lhs == null || lhs.getParent() == null);
Node block = NodeUtil.getFunctionBody(function);
Node stmt;
if (lhs != null) {
stmt = NodeUtil.newVarNode(lhs, value);
... | [
"private",
"void",
"addVariableToFunction",
"(",
"Node",
"function",
",",
"@",
"Nullable",
"Node",
"lhs",
",",
"Node",
"value",
")",
"{",
"checkState",
"(",
"value",
".",
"getParent",
"(",
")",
"==",
"null",
")",
";",
"checkState",
"(",
"lhs",
"==",
"nul... | Adds a variable to the top of a function block.
@param function A function node.
@param lhs The lhs expression.
@param value The initial value of the variable. | [
"Adds",
"a",
"variable",
"to",
"the",
"top",
"of",
"a",
"function",
"block",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/OptimizeParameters.java#L908-L931 |
zxing/zxing | core/src/main/java/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java | DecodedBitStreamParser.numericCompaction | private static int numericCompaction(int[] codewords, int codeIndex, StringBuilder result) throws FormatException {
"""
Numeric Compaction mode (see 5.4.4) permits efficient encoding of numeric data strings.
@param codewords The array of codewords (data + error)
@param codeIndex The current index into the code... | java | private static int numericCompaction(int[] codewords, int codeIndex, StringBuilder result) throws FormatException {
int count = 0;
boolean end = false;
int[] numericCodewords = new int[MAX_NUMERIC_CODEWORDS];
while (codeIndex < codewords[0] && !end) {
int code = codewords[codeIndex++];
if ... | [
"private",
"static",
"int",
"numericCompaction",
"(",
"int",
"[",
"]",
"codewords",
",",
"int",
"codeIndex",
",",
"StringBuilder",
"result",
")",
"throws",
"FormatException",
"{",
"int",
"count",
"=",
"0",
";",
"boolean",
"end",
"=",
"false",
";",
"int",
"... | Numeric Compaction mode (see 5.4.4) permits efficient encoding of numeric data strings.
@param codewords The array of codewords (data + error)
@param codeIndex The current index into the codeword array.
@param result The decoded data is appended to the result.
@return The next index into the codeword array. | [
"Numeric",
"Compaction",
"mode",
"(",
"see",
"5",
".",
"4",
".",
"4",
")",
"permits",
"efficient",
"encoding",
"of",
"numeric",
"data",
"strings",
"."
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java#L623-L660 |
scaleset/scaleset-geo | src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java | GoogleMapsTileMath.tileBboxLngLat | public Envelope tileBboxLngLat(int tx, int ty, int zoomLevel) {
"""
Returns the EPSG:4326 bounding of the specified tile coordinate
@param tx The tile x coordinate
@param ty The tile y coordinate
@param zoomLevel The tile zoom level
@return the EPSG:4326 bounding box
"""
Coordinate ... | java | public Envelope tileBboxLngLat(int tx, int ty, int zoomLevel) {
Coordinate topLeft = metersToLngLat(tileTopLeft(tx, ty, zoomLevel));
Coordinate lowerRight = metersToLngLat(tileTopLeft(tx + 1, ty + 1, zoomLevel));
Envelope result = new Envelope(topLeft, lowerRight);
return result;
} | [
"public",
"Envelope",
"tileBboxLngLat",
"(",
"int",
"tx",
",",
"int",
"ty",
",",
"int",
"zoomLevel",
")",
"{",
"Coordinate",
"topLeft",
"=",
"metersToLngLat",
"(",
"tileTopLeft",
"(",
"tx",
",",
"ty",
",",
"zoomLevel",
")",
")",
";",
"Coordinate",
"lowerRi... | Returns the EPSG:4326 bounding of the specified tile coordinate
@param tx The tile x coordinate
@param ty The tile y coordinate
@param zoomLevel The tile zoom level
@return the EPSG:4326 bounding box | [
"Returns",
"the",
"EPSG",
":",
"4326",
"bounding",
"of",
"the",
"specified",
"tile",
"coordinate"
] | train | https://github.com/scaleset/scaleset-geo/blob/5cff2349668037dc287928a6c1a1f67c76d96b02/src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java#L301-L306 |
allure-framework/allure1 | allure-java-adaptor-api/src/main/java/ru/yandex/qatools/allure/utils/AllureResultsUtils.java | AllureResultsUtils.createMarshallerForClass | public static Marshaller createMarshallerForClass(Class<?> clazz) {
"""
Creates a new {@link javax.xml.bind.Marshaller} for given class.
@param clazz specified class
@return a created marshaller
@throws AllureException if can't create marshaller for given class.
"""
try {
return JAXBCo... | java | public static Marshaller createMarshallerForClass(Class<?> clazz) {
try {
return JAXBContext.newInstance(clazz).createMarshaller();
} catch (JAXBException e) {
throw new AllureException("Can't create marshaller for class " + clazz, e);
}
} | [
"public",
"static",
"Marshaller",
"createMarshallerForClass",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"try",
"{",
"return",
"JAXBContext",
".",
"newInstance",
"(",
"clazz",
")",
".",
"createMarshaller",
"(",
")",
";",
"}",
"catch",
"(",
"JAXBExceptio... | Creates a new {@link javax.xml.bind.Marshaller} for given class.
@param clazz specified class
@return a created marshaller
@throws AllureException if can't create marshaller for given class. | [
"Creates",
"a",
"new",
"{",
"@link",
"javax",
".",
"xml",
".",
"bind",
".",
"Marshaller",
"}",
"for",
"given",
"class",
"."
] | train | https://github.com/allure-framework/allure1/blob/9a816fa05d8b894a917b7ebb7fd1a4056dee4693/allure-java-adaptor-api/src/main/java/ru/yandex/qatools/allure/utils/AllureResultsUtils.java#L179-L185 |
Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClientAsync.java | ManagementClientAsync.getRulesAsync | public CompletableFuture<List<RuleDescription>> getRulesAsync(String topicName, String subscriptionName) {
"""
Retrieves the list of rules for a given topic-subscription in the namespace.
@param topicName - The name of the topic.
@param subscriptionName - The name of the subscription.
@return the first 100 rule... | java | public CompletableFuture<List<RuleDescription>> getRulesAsync(String topicName, String subscriptionName) {
return getRulesAsync(topicName, subscriptionName, 100, 0);
} | [
"public",
"CompletableFuture",
"<",
"List",
"<",
"RuleDescription",
">",
">",
"getRulesAsync",
"(",
"String",
"topicName",
",",
"String",
"subscriptionName",
")",
"{",
"return",
"getRulesAsync",
"(",
"topicName",
",",
"subscriptionName",
",",
"100",
",",
"0",
")... | Retrieves the list of rules for a given topic-subscription in the namespace.
@param topicName - The name of the topic.
@param subscriptionName - The name of the subscription.
@return the first 100 rules. | [
"Retrieves",
"the",
"list",
"of",
"rules",
"for",
"a",
"given",
"topic",
"-",
"subscription",
"in",
"the",
"namespace",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClientAsync.java#L431-L433 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MessageProcessor.java | MessageProcessor.createProxyHandler | private void createProxyHandler() throws MessageStoreException {
"""
In a cold start ME Environment, the proxy handler needs to be created.
"""
if (TraceComponent.isAnyTracingEnabled()
&& tc.isEntryEnabled())
SibTr.entry(tc, "createProxyHandler");
_multiMEProxyHandler =... | java | private void createProxyHandler() throws MessageStoreException {
if (TraceComponent.isAnyTracingEnabled()
&& tc.isEntryEnabled())
SibTr.entry(tc, "createProxyHandler");
_multiMEProxyHandler = new MultiMEProxyHandler(this, _txManager);
_persistentStore.addItemStream(_mult... | [
"private",
"void",
"createProxyHandler",
"(",
")",
"throws",
"MessageStoreException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createProx... | In a cold start ME Environment, the proxy handler needs to be created. | [
"In",
"a",
"cold",
"start",
"ME",
"Environment",
"the",
"proxy",
"handler",
"needs",
"to",
"be",
"created",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MessageProcessor.java#L2340-L2352 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/json/JsonArray.java | JsonArray.fromJson | public static JsonArray fromJson(String s) {
"""
Static method to create a {@link JsonArray} from a JSON {@link String}.
Not to be confused with {@link #from(Object...)} from(aString)} which will populate a new array with the string.
The string is expected to be a valid JSON array representation (eg. startin... | java | public static JsonArray fromJson(String s) {
try {
return CouchbaseAsyncBucket.JSON_ARRAY_TRANSCODER.stringToJsonArray(s);
} catch (Exception e) {
throw new IllegalArgumentException("Cannot convert string to JsonArray", e);
}
} | [
"public",
"static",
"JsonArray",
"fromJson",
"(",
"String",
"s",
")",
"{",
"try",
"{",
"return",
"CouchbaseAsyncBucket",
".",
"JSON_ARRAY_TRANSCODER",
".",
"stringToJsonArray",
"(",
"s",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new"... | Static method to create a {@link JsonArray} from a JSON {@link String}.
Not to be confused with {@link #from(Object...)} from(aString)} which will populate a new array with the string.
The string is expected to be a valid JSON array representation (eg. starting with a '[').
@param s the JSON String to convert to a {... | [
"Static",
"method",
"to",
"create",
"a",
"{",
"@link",
"JsonArray",
"}",
"from",
"a",
"JSON",
"{",
"@link",
"String",
"}",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonArray.java#L179-L185 |
jenkinsci/jenkins | core/src/main/java/jenkins/model/Jenkins.java | Jenkins.getRootUrl | public @Nullable String getRootUrl() throws IllegalStateException {
"""
Gets the absolute URL of Jenkins, such as {@code http://localhost/jenkins/}.
<p>
This method first tries to use the manually configured value, then
fall back to {@link #getRootUrlFromRequest}.
It is done in this order so that it can work... | java | public @Nullable String getRootUrl() throws IllegalStateException {
final JenkinsLocationConfiguration config = JenkinsLocationConfiguration.get();
if (config == null) {
// Try to get standard message if possible
final Jenkins j = Jenkins.getInstance();
throw new Ille... | [
"public",
"@",
"Nullable",
"String",
"getRootUrl",
"(",
")",
"throws",
"IllegalStateException",
"{",
"final",
"JenkinsLocationConfiguration",
"config",
"=",
"JenkinsLocationConfiguration",
".",
"get",
"(",
")",
";",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"... | Gets the absolute URL of Jenkins, such as {@code http://localhost/jenkins/}.
<p>
This method first tries to use the manually configured value, then
fall back to {@link #getRootUrlFromRequest}.
It is done in this order so that it can work correctly even in the face
of a reverse proxy.
@return {@code null} if this para... | [
"Gets",
"the",
"absolute",
"URL",
"of",
"Jenkins",
"such",
"as",
"{",
"@code",
"http",
":",
"//",
"localhost",
"/",
"jenkins",
"/",
"}",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/Jenkins.java#L2272-L2287 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java | AbstractMastersListener.handleFailover | public HandleErrorResult handleFailover(SQLException qe, Method method, Object[] args,
Protocol protocol) throws Throwable {
"""
Call when a failover is detected on master connection. Will : <ol>
<li> set fail variable</li>
<li> try to reconnect</li>
<li> relaunch query if possible</li>
</ol>
@param ... | java | public HandleErrorResult handleFailover(SQLException qe, Method method, Object[] args,
Protocol protocol) throws Throwable {
if (isExplicitClosed()) {
throw new SQLException("Connection has been closed !");
}
if (setMasterHostFail()) {
logger.warn(
"SQL Primary node [{}, conn={},... | [
"public",
"HandleErrorResult",
"handleFailover",
"(",
"SQLException",
"qe",
",",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
",",
"Protocol",
"protocol",
")",
"throws",
"Throwable",
"{",
"if",
"(",
"isExplicitClosed",
"(",
")",
")",
"{",
"throw",
"n... | Call when a failover is detected on master connection. Will : <ol>
<li> set fail variable</li>
<li> try to reconnect</li>
<li> relaunch query if possible</li>
</ol>
@param method called method
@param args methods parameters
@param protocol current protocol
@return a HandleErrorResult object to indicate if query... | [
"Call",
"when",
"a",
"failover",
"is",
"detected",
"on",
"master",
"connection",
".",
"Will",
":",
"<ol",
">",
"<li",
">",
"set",
"fail",
"variable<",
"/",
"li",
">",
"<li",
">",
"try",
"to",
"reconnect<",
"/",
"li",
">",
"<li",
">",
"relaunch",
"que... | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java#L181-L204 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsListItemWidget.java | CmsListItemWidget.truncateAdditionalInfo | public void truncateAdditionalInfo(final String textMetricsPrefix, final int widgetWidth) {
"""
Truncates the additional info items.<p>
@param textMetricsPrefix the text metrics prefix
@param widgetWidth the width to truncate to
"""
for (Widget addInfo : m_additionalInfo) {
((Additiona... | java | public void truncateAdditionalInfo(final String textMetricsPrefix, final int widgetWidth) {
for (Widget addInfo : m_additionalInfo) {
((AdditionalInfoItem)addInfo).truncate(textMetricsPrefix, widgetWidth - 10);
}
} | [
"public",
"void",
"truncateAdditionalInfo",
"(",
"final",
"String",
"textMetricsPrefix",
",",
"final",
"int",
"widgetWidth",
")",
"{",
"for",
"(",
"Widget",
"addInfo",
":",
"m_additionalInfo",
")",
"{",
"(",
"(",
"AdditionalInfoItem",
")",
"addInfo",
")",
".",
... | Truncates the additional info items.<p>
@param textMetricsPrefix the text metrics prefix
@param widgetWidth the width to truncate to | [
"Truncates",
"the",
"additional",
"info",
"items",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsListItemWidget.java#L985-L990 |
haraldk/TwelveMonkeys | servlet/src/main/java/com/twelvemonkeys/servlet/ServletUtil.java | ServletUtil.getFloatParameter | public static float getFloatParameter(final ServletRequest pReq, final String pName, final float pDefault) {
"""
Gets the value of the given parameter from the request converted to
a {@code float}. If the parameter is not set or not parseable, the default
value is returned.
@param pReq the servlet re... | java | public static float getFloatParameter(final ServletRequest pReq, final String pName, final float pDefault) {
String str = pReq.getParameter(pName);
try {
return str != null ? Float.parseFloat(str) : pDefault;
}
catch (NumberFormatException nfe) {
return pD... | [
"public",
"static",
"float",
"getFloatParameter",
"(",
"final",
"ServletRequest",
"pReq",
",",
"final",
"String",
"pName",
",",
"final",
"float",
"pDefault",
")",
"{",
"String",
"str",
"=",
"pReq",
".",
"getParameter",
"(",
"pName",
")",
";",
"try",
"{",
"... | Gets the value of the given parameter from the request converted to
a {@code float}. If the parameter is not set or not parseable, the default
value is returned.
@param pReq the servlet request
@param pName the parameter name
@param pDefault the default value
@return the value of the parameter converted to... | [
"Gets",
"the",
"value",
"of",
"the",
"given",
"parameter",
"from",
"the",
"request",
"converted",
"to",
"a",
"{",
"@code",
"float",
"}",
".",
" ",
";",
"If",
"the",
"parameter",
"is",
"not",
"set",
"or",
"not",
"parseable",
"the",
"default",
"value",... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/ServletUtil.java#L250-L259 |
google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.functionCallWithNumArgs | public static Matcher functionCallWithNumArgs(final String name, final int numArgs) {
"""
Returns a Matcher that matches any function call that has the given
number of arguments and the given name.
@param name The name of the function to match. For non-static functions,
this must be the fully qualified name tha... | java | public static Matcher functionCallWithNumArgs(final String name, final int numArgs) {
return allOf(functionCallWithNumArgs(numArgs), functionCall(name));
} | [
"public",
"static",
"Matcher",
"functionCallWithNumArgs",
"(",
"final",
"String",
"name",
",",
"final",
"int",
"numArgs",
")",
"{",
"return",
"allOf",
"(",
"functionCallWithNumArgs",
"(",
"numArgs",
")",
",",
"functionCall",
"(",
"name",
")",
")",
";",
"}"
] | Returns a Matcher that matches any function call that has the given
number of arguments and the given name.
@param name The name of the function to match. For non-static functions,
this must be the fully qualified name that includes the type of the
object. For instance: {@code ns.AppContext.prototype.get} will match
{@... | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"any",
"function",
"call",
"that",
"has",
"the",
"given",
"number",
"of",
"arguments",
"and",
"the",
"given",
"name",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L209-L211 |
rzwitserloot/lombok | src/core/lombok/javac/handlers/HandleWither.java | HandleWither.generateWitherForField | public void generateWitherForField(JavacNode fieldNode, DiagnosticPosition pos, AccessLevel level) {
"""
Generates a wither on the stated field.
Used by {@link HandleValue}.
The difference between this call and the handle method is as follows:
If there is a {@code lombok.experimental.Wither} annotation on... | java | public void generateWitherForField(JavacNode fieldNode, DiagnosticPosition pos, AccessLevel level) {
if (hasAnnotation(Wither.class, fieldNode)) {
//The annotation will make it happen, so we can skip it.
return;
}
createWitherForField(level, fieldNode, fieldNode, false, List.<JCAnnotation>nil(), List.<JC... | [
"public",
"void",
"generateWitherForField",
"(",
"JavacNode",
"fieldNode",
",",
"DiagnosticPosition",
"pos",
",",
"AccessLevel",
"level",
")",
"{",
"if",
"(",
"hasAnnotation",
"(",
"Wither",
".",
"class",
",",
"fieldNode",
")",
")",
"{",
"//The annotation will mak... | Generates a wither on the stated field.
Used by {@link HandleValue}.
The difference between this call and the handle method is as follows:
If there is a {@code lombok.experimental.Wither} annotation on the field, it is used and the
same rules apply (e.g. warning if the method already exists, stated access level appl... | [
"Generates",
"a",
"wither",
"on",
"the",
"stated",
"field",
"."
] | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/HandleWither.java#L113-L120 |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java | SarlLinkFactory.getLinkForWildcard | protected void getLinkForWildcard(Content link, LinkInfo linkInfo, Type type) {
"""
Build the link for the wildcard.
@param link the link.
@param linkInfo the information on the link.
@param type the type.
"""
linkInfo.isTypeBound = true;
link.addContent("?"); //$NON-NLS-1$
final WildcardType wildca... | java | protected void getLinkForWildcard(Content link, LinkInfo linkInfo, Type type) {
linkInfo.isTypeBound = true;
link.addContent("?"); //$NON-NLS-1$
final WildcardType wildcardType = type.asWildcardType();
final Type[] extendsBounds = wildcardType.extendsBounds();
final SARLFeatureAccess kw = Utils.getKeywords();... | [
"protected",
"void",
"getLinkForWildcard",
"(",
"Content",
"link",
",",
"LinkInfo",
"linkInfo",
",",
"Type",
"type",
")",
"{",
"linkInfo",
".",
"isTypeBound",
"=",
"true",
";",
"link",
".",
"addContent",
"(",
"\"?\"",
")",
";",
"//$NON-NLS-1$",
"final",
"Wil... | Build the link for the wildcard.
@param link the link.
@param linkInfo the information on the link.
@param type the type. | [
"Build",
"the",
"link",
"for",
"the",
"wildcard",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java#L87-L106 |
belaban/JGroups | src/org/jgroups/util/Headers.java | Headers.putHeader | public static Header[] putHeader(final Header[] headers, short id, Header hdr, boolean replace_if_present) {
"""
Adds hdr at the next available slot. If none is available, the headers array passed in will be copied and the copy
returned
@param headers The headers array
@param id The protocol ID of the header
@... | java | public static Header[] putHeader(final Header[] headers, short id, Header hdr, boolean replace_if_present) {
int i=0;
Header[] hdrs=headers;
boolean resized=false;
while(i < hdrs.length) {
if(hdrs[i] == null) {
hdrs[i]=hdr;
return resized? hdrs... | [
"public",
"static",
"Header",
"[",
"]",
"putHeader",
"(",
"final",
"Header",
"[",
"]",
"headers",
",",
"short",
"id",
",",
"Header",
"hdr",
",",
"boolean",
"replace_if_present",
")",
"{",
"int",
"i",
"=",
"0",
";",
"Header",
"[",
"]",
"hdrs",
"=",
"h... | Adds hdr at the next available slot. If none is available, the headers array passed in will be copied and the copy
returned
@param headers The headers array
@param id The protocol ID of the header
@param hdr The header
@param replace_if_present Whether or not to overwrite an existing header
@return A new copy of header... | [
"Adds",
"hdr",
"at",
"the",
"next",
"available",
"slot",
".",
"If",
"none",
"is",
"available",
"the",
"headers",
"array",
"passed",
"in",
"will",
"be",
"copied",
"and",
"the",
"copy",
"returned"
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Headers.java#L114-L136 |
jbundle/jbundle | base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XScreenField.java | XScreenField.printControlEndForm | public void printControlEndForm(PrintWriter out, int iPrintOptions) {
"""
Display the start form in input format.
@param out The out stream.
@param iPrintOptions The view specific attributes.
"""
out.println(Utility.endTag(XMLTags.CONTROLS));
} | java | public void printControlEndForm(PrintWriter out, int iPrintOptions)
{
out.println(Utility.endTag(XMLTags.CONTROLS));
} | [
"public",
"void",
"printControlEndForm",
"(",
"PrintWriter",
"out",
",",
"int",
"iPrintOptions",
")",
"{",
"out",
".",
"println",
"(",
"Utility",
".",
"endTag",
"(",
"XMLTags",
".",
"CONTROLS",
")",
")",
";",
"}"
] | Display the start form in input format.
@param out The out stream.
@param iPrintOptions The view specific attributes. | [
"Display",
"the",
"start",
"form",
"in",
"input",
"format",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XScreenField.java#L139-L142 |
apache/incubator-gobblin | gobblin-modules/gobblin-http/src/main/java/org/apache/gobblin/utils/HttpUtils.java | HttpUtils.updateStatusType | public static void updateStatusType(ResponseStatus status, int statusCode, Set<String> errorCodeWhitelist) {
"""
Update {@link StatusType} of a {@link ResponseStatus} based on statusCode and error code white list
@param status a status report after handling the a response
@param statusCode a status code in htt... | java | public static void updateStatusType(ResponseStatus status, int statusCode, Set<String> errorCodeWhitelist) {
if (statusCode >= 300 & statusCode < 500) {
List<String> whitelist = new ArrayList<>();
whitelist.add(Integer.toString(statusCode));
if (statusCode > 400) {
whitelist.add(HttpConsta... | [
"public",
"static",
"void",
"updateStatusType",
"(",
"ResponseStatus",
"status",
",",
"int",
"statusCode",
",",
"Set",
"<",
"String",
">",
"errorCodeWhitelist",
")",
"{",
"if",
"(",
"statusCode",
">=",
"300",
"&",
"statusCode",
"<",
"500",
")",
"{",
"List",
... | Update {@link StatusType} of a {@link ResponseStatus} based on statusCode and error code white list
@param status a status report after handling the a response
@param statusCode a status code in http domain
@param errorCodeWhitelist a whitelist specifies what http error codes are tolerable | [
"Update",
"{",
"@link",
"StatusType",
"}",
"of",
"a",
"{",
"@link",
"ResponseStatus",
"}",
"based",
"on",
"statusCode",
"and",
"error",
"code",
"white",
"list"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-http/src/main/java/org/apache/gobblin/utils/HttpUtils.java#L144-L166 |
michael-rapp/AndroidUtil | library/src/main/java/de/mrapp/android/util/view/ExpandableGridView.java | ExpandableGridView.getPackedPosition | private int getPackedPosition(final int position) {
"""
Returns the packed position of an item, which corresponds to a specific position.
@param position
The position of the item, whose packed position should be returned, as an {@link
Integer} value
@return The packed position, which corresponds to the given... | java | private int getPackedPosition(final int position) {
if (position < getHeaderViewsCount()) {
return position;
} else {
Pair<Integer, Integer> pair = getItemPosition(position - getHeaderViewsCount());
int groupIndex = pair.first;
int childIndex = pair.second... | [
"private",
"int",
"getPackedPosition",
"(",
"final",
"int",
"position",
")",
"{",
"if",
"(",
"position",
"<",
"getHeaderViewsCount",
"(",
")",
")",
"{",
"return",
"position",
";",
"}",
"else",
"{",
"Pair",
"<",
"Integer",
",",
"Integer",
">",
"pair",
"="... | Returns the packed position of an item, which corresponds to a specific position.
@param position
The position of the item, whose packed position should be returned, as an {@link
Integer} value
@return The packed position, which corresponds to the given position, as an {@link Integer}
value | [
"Returns",
"the",
"packed",
"position",
"of",
"an",
"item",
"which",
"corresponds",
"to",
"a",
"specific",
"position",
"."
] | train | https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/view/ExpandableGridView.java#L397-L420 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java | MithraManager.executeTransactionalCommandInSeparateThread | public <R> R executeTransactionalCommandInSeparateThread(final TransactionalCommand<R> command, final TransactionStyle txStyle)
throws MithraBusinessException {
"""
Use this method very carefully. It can easily lead to a deadlock.
executes the transactional command in a separate thread with a custom ... | java | public <R> R executeTransactionalCommandInSeparateThread(final TransactionalCommand<R> command, final TransactionStyle txStyle)
throws MithraBusinessException
{
final Object[] result = new Object[1];
ExceptionHandlingTask runnable = new ExceptionHandlingTask()
{
... | [
"public",
"<",
"R",
">",
"R",
"executeTransactionalCommandInSeparateThread",
"(",
"final",
"TransactionalCommand",
"<",
"R",
">",
"command",
",",
"final",
"TransactionStyle",
"txStyle",
")",
"throws",
"MithraBusinessException",
"{",
"final",
"Object",
"[",
"]",
"res... | Use this method very carefully. It can easily lead to a deadlock.
executes the transactional command in a separate thread with a custom number of retries. Using a separate thread
creates a brand new transactional context and therefore this transaction will not join
the context of any outer transactions. For example, if... | [
"Use",
"this",
"method",
"very",
"carefully",
".",
"It",
"can",
"easily",
"lead",
"to",
"a",
"deadlock",
".",
"executes",
"the",
"transactional",
"command",
"in",
"a",
"separate",
"thread",
"with",
"a",
"custom",
"number",
"of",
"retries",
".",
"Using",
"a... | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java#L490-L504 |
pinterest/secor | src/main/java/com/pinterest/secor/uploader/Uploader.java | Uploader.createReader | protected FileReader createReader(LogFilePath srcPath, CompressionCodec codec) throws Exception {
"""
This method is intended to be overwritten in tests.
@param srcPath source Path
@param codec compression codec
@return FileReader created file reader
@throws Exception on error
"""
return Reflection... | java | protected FileReader createReader(LogFilePath srcPath, CompressionCodec codec) throws Exception {
return ReflectionUtil.createFileReader(
mConfig.getFileReaderWriterFactory(),
srcPath,
codec,
mConfig
);
} | [
"protected",
"FileReader",
"createReader",
"(",
"LogFilePath",
"srcPath",
",",
"CompressionCodec",
"codec",
")",
"throws",
"Exception",
"{",
"return",
"ReflectionUtil",
".",
"createFileReader",
"(",
"mConfig",
".",
"getFileReaderWriterFactory",
"(",
")",
",",
"srcPath... | This method is intended to be overwritten in tests.
@param srcPath source Path
@param codec compression codec
@return FileReader created file reader
@throws Exception on error | [
"This",
"method",
"is",
"intended",
"to",
"be",
"overwritten",
"in",
"tests",
"."
] | train | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/uploader/Uploader.java#L162-L169 |
bmwcarit/joynr | java/core/libjoynr/src/main/java/io/joynr/runtime/JoynrRuntimeImpl.java | JoynrRuntimeImpl.registerProvider | @Override
public Future<Void> registerProvider(String domain,
Object provider,
ProviderQos providerQos,
boolean awaitGlobalRegistration) {
"""
Registers a provider in the joynr framework
... | java | @Override
public Future<Void> registerProvider(String domain,
Object provider,
ProviderQos providerQos,
boolean awaitGlobalRegistration) {
JoynrInterface joynrInterfaceAnnotatation = A... | [
"@",
"Override",
"public",
"Future",
"<",
"Void",
">",
"registerProvider",
"(",
"String",
"domain",
",",
"Object",
"provider",
",",
"ProviderQos",
"providerQos",
",",
"boolean",
"awaitGlobalRegistration",
")",
"{",
"JoynrInterface",
"joynrInterfaceAnnotatation",
"=",
... | Registers a provider in the joynr framework
@param domain
The domain the provider should be registered for. Has to be identical at the client to be able to find
the provider.
@param provider
Instance of the provider implementation (has to extend a generated ...AbstractProvider).
@param providerQos
the provider's quali... | [
"Registers",
"a",
"provider",
"in",
"the",
"joynr",
"framework"
] | train | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/runtime/JoynrRuntimeImpl.java#L180-L193 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/JMProgressiveManager.java | JMProgressiveManager.registerLastFailureChangeListener | public JMProgressiveManager<T, R> registerLastFailureChangeListener(
Consumer<Pair<T, Exception>> failureChangeListener) {
"""
Register last failure change listener jm progressive manager.
@param failureChangeListener the failure change listener
@return the jm progressive manager
"""
return registerLi... | java | public JMProgressiveManager<T, R> registerLastFailureChangeListener(
Consumer<Pair<T, Exception>> failureChangeListener) {
return registerListener(lastFailure, failureChangeListener);
} | [
"public",
"JMProgressiveManager",
"<",
"T",
",",
"R",
">",
"registerLastFailureChangeListener",
"(",
"Consumer",
"<",
"Pair",
"<",
"T",
",",
"Exception",
">",
">",
"failureChangeListener",
")",
"{",
"return",
"registerListener",
"(",
"lastFailure",
",",
"failureCh... | Register last failure change listener jm progressive manager.
@param failureChangeListener the failure change listener
@return the jm progressive manager | [
"Register",
"last",
"failure",
"change",
"listener",
"jm",
"progressive",
"manager",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/JMProgressiveManager.java#L213-L216 |
mapsforge/mapsforge | mapsforge-map/src/main/java/org/mapsforge/map/layer/renderer/TileRendererLayer.java | TileRendererLayer.isTileStale | @Override
protected boolean isTileStale(Tile tile, TileBitmap bitmap) {
"""
Whether the tile is stale and should be refreshed.
<p/>
This method is called from {@link #draw(org.mapsforge.core.model.BoundingBox, byte, org.mapsforge.core.graphics.Canvas, org.mapsforge.core.model.Point)} to determine whether the... | java | @Override
protected boolean isTileStale(Tile tile, TileBitmap bitmap) {
return this.mapDataStore.getDataTimestamp(tile) > bitmap.getTimestamp();
} | [
"@",
"Override",
"protected",
"boolean",
"isTileStale",
"(",
"Tile",
"tile",
",",
"TileBitmap",
"bitmap",
")",
"{",
"return",
"this",
".",
"mapDataStore",
".",
"getDataTimestamp",
"(",
"tile",
")",
">",
"bitmap",
".",
"getTimestamp",
"(",
")",
";",
"}"
] | Whether the tile is stale and should be refreshed.
<p/>
This method is called from {@link #draw(org.mapsforge.core.model.BoundingBox, byte, org.mapsforge.core.graphics.Canvas, org.mapsforge.core.model.Point)} to determine whether the tile needs to
be refreshed.
<p/>
A tile is considered stale if the timestamp of the la... | [
"Whether",
"the",
"tile",
"is",
"stale",
"and",
"should",
"be",
"refreshed",
".",
"<p",
"/",
">",
"This",
"method",
"is",
"called",
"from",
"{",
"@link",
"#draw",
"(",
"org",
".",
"mapsforge",
".",
"core",
".",
"model",
".",
"BoundingBox",
"byte",
"org... | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/layer/renderer/TileRendererLayer.java#L192-L195 |
CloudSlang/cs-actions | cs-commons/src/main/java/io/cloudslang/content/utils/StringEscapeUtilities.java | StringEscapeUtilities.unescapeChar | @NotNull
public static String unescapeChar(@NotNull final String string, final char toUnescape) {
"""
Unescape all the occurrences of the <toUnescape> character from the <string>
@param string the string from which to unescape the character
@param toUnescape the character to unescape
@return a new str... | java | @NotNull
public static String unescapeChar(@NotNull final String string, final char toUnescape) {
final String toUnescapeStr = String.valueOf(toUnescape);
return string.replaceAll("\\\\" + toUnescapeStr, toUnescapeStr);
} | [
"@",
"NotNull",
"public",
"static",
"String",
"unescapeChar",
"(",
"@",
"NotNull",
"final",
"String",
"string",
",",
"final",
"char",
"toUnescape",
")",
"{",
"final",
"String",
"toUnescapeStr",
"=",
"String",
".",
"valueOf",
"(",
"toUnescape",
")",
";",
"ret... | Unescape all the occurrences of the <toUnescape> character from the <string>
@param string the string from which to unescape the character
@param toUnescape the character to unescape
@return a new string with the unescaped <toUnescape> character | [
"Unescape",
"all",
"the",
"occurrences",
"of",
"the",
"<toUnescape",
">",
"character",
"from",
"the",
"<string",
">"
] | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-commons/src/main/java/io/cloudslang/content/utils/StringEscapeUtilities.java#L52-L56 |
shrinkwrap/resolver | maven/api-maven-embedded/src/main/java/org/jboss/shrinkwrap/resolver/api/maven/embedded/EmbeddedMaven.java | EmbeddedMaven.withMavenInvokerSet | public static MavenInvokerEquippedEmbeddedMaven withMavenInvokerSet(InvocationRequest request, Invoker invoker) {
"""
Specifies an {@link InvocationRequest} and an {@link Invoker} the EmbeddedMaven should be used with.
<p>
When you use this approach, it is expected that both instances are properly set by you and... | java | public static MavenInvokerEquippedEmbeddedMaven withMavenInvokerSet(InvocationRequest request, Invoker invoker) {
MavenInvokerUnequippedEmbeddedMaven embeddedMaven = Resolvers.use(MavenInvokerUnequippedEmbeddedMaven.class);
return embeddedMaven.setMavenInvoker(request, invoker);
} | [
"public",
"static",
"MavenInvokerEquippedEmbeddedMaven",
"withMavenInvokerSet",
"(",
"InvocationRequest",
"request",
",",
"Invoker",
"invoker",
")",
"{",
"MavenInvokerUnequippedEmbeddedMaven",
"embeddedMaven",
"=",
"Resolvers",
".",
"use",
"(",
"MavenInvokerUnequippedEmbeddedMa... | Specifies an {@link InvocationRequest} and an {@link Invoker} the EmbeddedMaven should be used with.
<p>
When you use this approach, it is expected that both instances are properly set by you and no additional
parameters (such as -DskipTests) is added by Resolver. You can also observe some limited functionality
provide... | [
"Specifies",
"an",
"{",
"@link",
"InvocationRequest",
"}",
"and",
"an",
"{",
"@link",
"Invoker",
"}",
"the",
"EmbeddedMaven",
"should",
"be",
"used",
"with",
".",
"<p",
">",
"When",
"you",
"use",
"this",
"approach",
"it",
"is",
"expected",
"that",
"both",
... | train | https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/api-maven-embedded/src/main/java/org/jboss/shrinkwrap/resolver/api/maven/embedded/EmbeddedMaven.java#L87-L91 |
junit-team/junit4 | src/main/java/org/junit/runners/model/FrameworkMethod.java | FrameworkMethod.invokeExplosively | public Object invokeExplosively(final Object target, final Object... params)
throws Throwable {
"""
Returns the result of invoking this method on {@code target} with
parameters {@code params}. {@link InvocationTargetException}s thrown are
unwrapped, and their causes rethrown.
"""
return n... | java | public Object invokeExplosively(final Object target, final Object... params)
throws Throwable {
return new ReflectiveCallable() {
@Override
protected Object runReflectiveCall() throws Throwable {
return method.invoke(target, params);
}
}.ru... | [
"public",
"Object",
"invokeExplosively",
"(",
"final",
"Object",
"target",
",",
"final",
"Object",
"...",
"params",
")",
"throws",
"Throwable",
"{",
"return",
"new",
"ReflectiveCallable",
"(",
")",
"{",
"@",
"Override",
"protected",
"Object",
"runReflectiveCall",
... | Returns the result of invoking this method on {@code target} with
parameters {@code params}. {@link InvocationTargetException}s thrown are
unwrapped, and their causes rethrown. | [
"Returns",
"the",
"result",
"of",
"invoking",
"this",
"method",
"on",
"{"
] | train | https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runners/model/FrameworkMethod.java#L54-L62 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.substring | public String substring(final int startIndex, int endIndex) {
"""
Extracts a portion of this string builder as a string.
<p>
Note: This method treats an endIndex greater than the length of the
builder as equal to the length of the builder, and continues
without error, unlike StringBuffer or String.
@param s... | java | public String substring(final int startIndex, int endIndex) {
endIndex = validateRange(startIndex, endIndex);
return new String(buffer, startIndex, endIndex - startIndex);
} | [
"public",
"String",
"substring",
"(",
"final",
"int",
"startIndex",
",",
"int",
"endIndex",
")",
"{",
"endIndex",
"=",
"validateRange",
"(",
"startIndex",
",",
"endIndex",
")",
";",
"return",
"new",
"String",
"(",
"buffer",
",",
"startIndex",
",",
"endIndex"... | Extracts a portion of this string builder as a string.
<p>
Note: This method treats an endIndex greater than the length of the
builder as equal to the length of the builder, and continues
without error, unlike StringBuffer or String.
@param startIndex the start index, inclusive, must be valid
@param endIndex the end... | [
"Extracts",
"a",
"portion",
"of",
"this",
"string",
"builder",
"as",
"a",
"string",
".",
"<p",
">",
"Note",
":",
"This",
"method",
"treats",
"an",
"endIndex",
"greater",
"than",
"the",
"length",
"of",
"the",
"builder",
"as",
"equal",
"to",
"the",
"length... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2279-L2282 |
wcm-io/wcm-io-wcm | commons/src/main/java/io/wcm/wcm/commons/util/RunMode.java | RunMode.disableIfNotAuthor | @Deprecated
public static boolean disableIfNotAuthor(Set<String> runModes, ComponentContext componentContext, Logger log) {
"""
Use this to disable a component if the runmode "author" is not active. Component activation status is logged
with DEBUG level.
This method is a replacement for the
<code>com.day.cq.c... | java | @Deprecated
public static boolean disableIfNotAuthor(Set<String> runModes, ComponentContext componentContext, Logger log) {
return disableIfNoRunModeActive(runModes, new String[] {
AUTHOR
}, componentContext, log);
} | [
"@",
"Deprecated",
"public",
"static",
"boolean",
"disableIfNotAuthor",
"(",
"Set",
"<",
"String",
">",
"runModes",
",",
"ComponentContext",
"componentContext",
",",
"Logger",
"log",
")",
"{",
"return",
"disableIfNoRunModeActive",
"(",
"runModes",
",",
"new",
"Str... | Use this to disable a component if the runmode "author" is not active. Component activation status is logged
with DEBUG level.
This method is a replacement for the
<code>com.day.cq.commons.RunModeUtil#disableIfNoRunModeActive(RunMode, String[], ComponentContext, Logger)</code>
method which is deprecated.
@param runMode... | [
"Use",
"this",
"to",
"disable",
"a",
"component",
"if",
"the",
"runmode",
"author",
"is",
"not",
"active",
".",
"Component",
"activation",
"status",
"is",
"logged",
"with",
"DEBUG",
"level",
".",
"This",
"method",
"is",
"a",
"replacement",
"for",
"the",
"<... | train | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/commons/src/main/java/io/wcm/wcm/commons/util/RunMode.java#L165-L170 |
knowm/XChange | xchange-core/src/main/java/org/knowm/xchange/currency/Currency.java | Currency.createCurrency | private static Currency createCurrency(
String commonCode, String name, String unicode, String... alternativeCodes) {
"""
Factory
@param commonCode commonly used code for this currency: "BTC"
@param name Name of the currency: "Bitcoin"
@param unicode Unicode symbol for the currency: "\u20BF" or "฿"
@pa... | java | private static Currency createCurrency(
String commonCode, String name, String unicode, String... alternativeCodes) {
CurrencyAttributes attributes =
new CurrencyAttributes(commonCode, name, unicode, alternativeCodes);
Currency currency = new Currency(commonCode, attributes);
for (String co... | [
"private",
"static",
"Currency",
"createCurrency",
"(",
"String",
"commonCode",
",",
"String",
"name",
",",
"String",
"unicode",
",",
"String",
"...",
"alternativeCodes",
")",
"{",
"CurrencyAttributes",
"attributes",
"=",
"new",
"CurrencyAttributes",
"(",
"commonCod... | Factory
@param commonCode commonly used code for this currency: "BTC"
@param name Name of the currency: "Bitcoin"
@param unicode Unicode symbol for the currency: "\u20BF" or "฿"
@param alternativeCodes Alternative codes for the currency: "XBT" | [
"Factory"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-core/src/main/java/org/knowm/xchange/currency/Currency.java#L355-L377 |
HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/CSSOMParser.java | CSSOMParser.parseStyleSheet | public CSSStyleSheetImpl parseStyleSheet(final InputSource source, final String href) throws IOException {
"""
Parses a SAC input source into a CSSOM style sheet.
@param source the SAC input source
@param href the href
@return the CSSOM style sheet
@throws IOException if the underlying SAC parser throws an I... | java | public CSSStyleSheetImpl parseStyleSheet(final InputSource source, final String href) throws IOException {
final CSSOMHandler handler = new CSSOMHandler();
handler.setHref(href);
parser_.setDocumentHandler(handler);
parser_.parseStyleSheet(source);
final Object o = handler.getRoo... | [
"public",
"CSSStyleSheetImpl",
"parseStyleSheet",
"(",
"final",
"InputSource",
"source",
",",
"final",
"String",
"href",
")",
"throws",
"IOException",
"{",
"final",
"CSSOMHandler",
"handler",
"=",
"new",
"CSSOMHandler",
"(",
")",
";",
"handler",
".",
"setHref",
... | Parses a SAC input source into a CSSOM style sheet.
@param source the SAC input source
@param href the href
@return the CSSOM style sheet
@throws IOException if the underlying SAC parser throws an IOException | [
"Parses",
"a",
"SAC",
"input",
"source",
"into",
"a",
"CSSOM",
"style",
"sheet",
"."
] | train | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/CSSOMParser.java#L79-L89 |
dadoonet/fscrawler | tika/src/main/java/fr/pilato/elasticsearch/crawler/fs/tika/XmlDocParser.java | XmlDocParser.generateMap | public static Map<String, Object> generateMap(InputStream inputStream) {
"""
Extracting XML content. See #185: https://github.com/dadoonet/fscrawler/issues/185
@param inputStream The XML Stream
@return The XML Content as a map
"""
logger.trace("Converting XML document [{}]");
Map<String, Obje... | java | public static Map<String, Object> generateMap(InputStream inputStream) {
logger.trace("Converting XML document [{}]");
Map<String, Object> map = asMap(inputStream);
logger.trace("Generated JSON: {}", map);
return map;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"generateMap",
"(",
"InputStream",
"inputStream",
")",
"{",
"logger",
".",
"trace",
"(",
"\"Converting XML document [{}]\"",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
"=",
"asMap"... | Extracting XML content. See #185: https://github.com/dadoonet/fscrawler/issues/185
@param inputStream The XML Stream
@return The XML Content as a map | [
"Extracting",
"XML",
"content",
".",
"See",
"#185",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"dadoonet",
"/",
"fscrawler",
"/",
"issues",
"/",
"185"
] | train | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/tika/src/main/java/fr/pilato/elasticsearch/crawler/fs/tika/XmlDocParser.java#L74-L80 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/scrollSpy/ScrollSpyRenderer.java | ScrollSpyRenderer.decodeAndEscapeSelectors | private String decodeAndEscapeSelectors(FacesContext context, UIComponent component, String selector) {
"""
Decode and escape selectors if necessary
@param context
@param component
@param selector
@return
"""
selector = ExpressionResolver.getComponentIDs(context, component, selector);
selector = BsfUti... | java | private String decodeAndEscapeSelectors(FacesContext context, UIComponent component, String selector) {
selector = ExpressionResolver.getComponentIDs(context, component, selector);
selector = BsfUtils.escapeJQuerySpecialCharsInSelector(selector);
return selector;
} | [
"private",
"String",
"decodeAndEscapeSelectors",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
",",
"String",
"selector",
")",
"{",
"selector",
"=",
"ExpressionResolver",
".",
"getComponentIDs",
"(",
"context",
",",
"component",
",",
"selector",
"... | Decode and escape selectors if necessary
@param context
@param component
@param selector
@return | [
"Decode",
"and",
"escape",
"selectors",
"if",
"necessary"
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/scrollSpy/ScrollSpyRenderer.java#L161-L166 |
igniterealtime/Smack | smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLightManager.java | MultiUserChatLightManager.blockRooms | public void blockRooms(DomainBareJid mucLightService, List<Jid> roomsJids)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
"""
Block rooms.
@param mucLightService
@param roomsJids
@throws NoResponseException
@throws XMPPErrorException
@throws NotConn... | java | public void blockRooms(DomainBareJid mucLightService, List<Jid> roomsJids)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
HashMap<Jid, Boolean> rooms = new HashMap<>();
for (Jid jid : roomsJids) {
rooms.put(jid, false);
}
... | [
"public",
"void",
"blockRooms",
"(",
"DomainBareJid",
"mucLightService",
",",
"List",
"<",
"Jid",
">",
"roomsJids",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"HashMap",
"<",
"Jid",
... | Block rooms.
@param mucLightService
@param roomsJids
@throws NoResponseException
@throws XMPPErrorException
@throws NotConnectedException
@throws InterruptedException | [
"Block",
"rooms",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLightManager.java#L269-L276 |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/interestrate/products/BermudanSwaption.java | BermudanSwaption.getConditionalExpectationEstimator | public ConditionalExpectationEstimator getConditionalExpectationEstimator(double fixingDate, LIBORModelMonteCarloSimulationModel model) throws CalculationException {
"""
Return the conditional expectation estimator suitable for this product.
@param fixingDate The condition time.
@param model The model
@return... | java | public ConditionalExpectationEstimator getConditionalExpectationEstimator(double fixingDate, LIBORModelMonteCarloSimulationModel model) throws CalculationException {
RandomVariable[] regressionBasisFunctions = regressionBasisFunctionsProvider != null ? regressionBasisFunctionsProvider.getBasisFunctions(fixingDate, ... | [
"public",
"ConditionalExpectationEstimator",
"getConditionalExpectationEstimator",
"(",
"double",
"fixingDate",
",",
"LIBORModelMonteCarloSimulationModel",
"model",
")",
"throws",
"CalculationException",
"{",
"RandomVariable",
"[",
"]",
"regressionBasisFunctions",
"=",
"regressio... | Return the conditional expectation estimator suitable for this product.
@param fixingDate The condition time.
@param model The model
@return The conditional expectation estimator suitable for this product
@throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available ... | [
"Return",
"the",
"conditional",
"expectation",
"estimator",
"suitable",
"for",
"this",
"product",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/BermudanSwaption.java#L181-L186 |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/img/ImageExtensions.java | ImageExtensions.concatenateImages | public static BufferedImage concatenateImages(final List<BufferedImage> imgCollection,
final int width, final int height, final int imageType,
final Direction concatenationDirection) {
"""
Concatenate the given list of BufferedImage objects to one image and returns the concatenated
BufferedImage object.
@p... | java | public static BufferedImage concatenateImages(final List<BufferedImage> imgCollection,
final int width, final int height, final int imageType,
final Direction concatenationDirection)
{
final BufferedImage img = new BufferedImage(width, height, imageType);
int x = 0;
int y = 0;
for (final BufferedImage bi :... | [
"public",
"static",
"BufferedImage",
"concatenateImages",
"(",
"final",
"List",
"<",
"BufferedImage",
">",
"imgCollection",
",",
"final",
"int",
"width",
",",
"final",
"int",
"height",
",",
"final",
"int",
"imageType",
",",
"final",
"Direction",
"concatenationDire... | Concatenate the given list of BufferedImage objects to one image and returns the concatenated
BufferedImage object.
@param imgCollection
the BufferedImage collection
@param width
the width of the image that will be returned.
@param height
the height of the image that will be returned.
@param imageType
type of the crea... | [
"Concatenate",
"the",
"given",
"list",
"of",
"BufferedImage",
"objects",
"to",
"one",
"image",
"and",
"returns",
"the",
"concatenated",
"BufferedImage",
"object",
"."
] | train | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/img/ImageExtensions.java#L90-L114 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/painter/ImagePainter.java | ImagePainter.deleteShape | public void deleteShape(Paintable paintable, Object group, MapContext context) {
"""
Delete a {@link Paintable} object from the given {@link MapContext}. It the object does not exist,
nothing will be done.
@param paintable
The object to be painted.
@param group
The group where the object resides in (optiona... | java | public void deleteShape(Paintable paintable, Object group, MapContext context) {
Image image = (Image) paintable;
context.getVectorContext().deleteElement(group, image.getId());
} | [
"public",
"void",
"deleteShape",
"(",
"Paintable",
"paintable",
",",
"Object",
"group",
",",
"MapContext",
"context",
")",
"{",
"Image",
"image",
"=",
"(",
"Image",
")",
"paintable",
";",
"context",
".",
"getVectorContext",
"(",
")",
".",
"deleteElement",
"(... | Delete a {@link Paintable} object from the given {@link MapContext}. It the object does not exist,
nothing will be done.
@param paintable
The object to be painted.
@param group
The group where the object resides in (optional).
@param context
The context to paint on. | [
"Delete",
"a",
"{",
"@link",
"Paintable",
"}",
"object",
"from",
"the",
"given",
"{",
"@link",
"MapContext",
"}",
".",
"It",
"the",
"object",
"does",
"not",
"exist",
"nothing",
"will",
"be",
"done",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/painter/ImagePainter.java#L65-L68 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/io/Files.java | Files.copy | public static void copy(File from, Charset charset, Appendable to) throws IOException {
"""
Copies all characters from a file to an appendable object, using the given character set.
@param from the source file
@param charset the charset used to decode the input stream; see {@link StandardCharsets} for
helpful... | java | public static void copy(File from, Charset charset, Appendable to) throws IOException {
asCharSource(from, charset).copyTo(to);
} | [
"public",
"static",
"void",
"copy",
"(",
"File",
"from",
",",
"Charset",
"charset",
",",
"Appendable",
"to",
")",
"throws",
"IOException",
"{",
"asCharSource",
"(",
"from",
",",
"charset",
")",
".",
"copyTo",
"(",
"to",
")",
";",
"}"
] | Copies all characters from a file to an appendable object, using the given character set.
@param from the source file
@param charset the charset used to decode the input stream; see {@link StandardCharsets} for
helpful predefined constants
@param to the appendable object
@throws IOException if an I/O error occurs | [
"Copies",
"all",
"characters",
"from",
"a",
"file",
"to",
"an",
"appendable",
"object",
"using",
"the",
"given",
"character",
"set",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/io/Files.java#L357-L359 |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpUtil.java | HttpUtil.getString | public static String getString(InputStream in, Charset charset, boolean isGetCharsetFromContent) throws IOException {
"""
从流中读取内容<br>
首先尝试使用charset编码读取内容(如果为空默认UTF-8),如果isGetCharsetFromContent为true,则通过正则在正文中获取编码信息,转换为指定编码;
@param in 输入流
@param charset 字符集
@param isGetCharsetFromContent 是否从返回内容中获得编码信息
@retur... | java | public static String getString(InputStream in, Charset charset, boolean isGetCharsetFromContent) throws IOException {
final byte[] contentBytes = IoUtil.readBytes(in);
return getString(contentBytes, charset, isGetCharsetFromContent);
} | [
"public",
"static",
"String",
"getString",
"(",
"InputStream",
"in",
",",
"Charset",
"charset",
",",
"boolean",
"isGetCharsetFromContent",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"[",
"]",
"contentBytes",
"=",
"IoUtil",
".",
"readBytes",
"(",
"in",
... | 从流中读取内容<br>
首先尝试使用charset编码读取内容(如果为空默认UTF-8),如果isGetCharsetFromContent为true,则通过正则在正文中获取编码信息,转换为指定编码;
@param in 输入流
@param charset 字符集
@param isGetCharsetFromContent 是否从返回内容中获得编码信息
@return 内容
@throws IOException IO异常 | [
"从流中读取内容<br",
">",
"首先尝试使用charset编码读取内容(如果为空默认UTF",
"-",
"8),如果isGetCharsetFromContent为true,则通过正则在正文中获取编码信息,转换为指定编码;"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L679-L682 |
NoraUi/NoraUi | src/main/java/com/github/noraui/application/steps/Step.java | Step.checkTextSelectedInList | protected boolean checkTextSelectedInList(PageElement pageElement, String text) throws FailureException {
"""
Check text selected in list (html select option).
@param pageElement
Is target element
@param text
is text searched
@return true or false
@throws FailureException
if the scenario encounters a func... | java | protected boolean checkTextSelectedInList(PageElement pageElement, String text) throws FailureException {
try {
final WebElement select = Context.waitUntil(ExpectedConditions.elementToBeClickable(Utilities.getLocator(pageElement)));
final Select dropDown = new Select(select);
... | [
"protected",
"boolean",
"checkTextSelectedInList",
"(",
"PageElement",
"pageElement",
",",
"String",
"text",
")",
"throws",
"FailureException",
"{",
"try",
"{",
"final",
"WebElement",
"select",
"=",
"Context",
".",
"waitUntil",
"(",
"ExpectedConditions",
".",
"eleme... | Check text selected in list (html select option).
@param pageElement
Is target element
@param text
is text searched
@return true or false
@throws FailureException
if the scenario encounters a functional error | [
"Check",
"text",
"selected",
"in",
"list",
"(",
"html",
"select",
"option",
")",
"."
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L478-L487 |
aws/aws-sdk-java | aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/CreateDeploymentJobResult.java | CreateDeploymentJobResult.withTags | public CreateDeploymentJobResult withTags(java.util.Map<String, String> tags) {
"""
<p>
The list of all tags added to the deployment job.
</p>
@param tags
The list of all tags added to the deployment job.
@return Returns a reference to this object so that method calls can be chained together.
"""
... | java | public CreateDeploymentJobResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"CreateDeploymentJobResult",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The list of all tags added to the deployment job.
</p>
@param tags
The list of all tags added to the deployment job.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"list",
"of",
"all",
"tags",
"added",
"to",
"the",
"deployment",
"job",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/CreateDeploymentJobResult.java#L1206-L1209 |
thinkaurelius/faunus | src/main/java/com/thinkaurelius/faunus/FaunusPipeline.java | FaunusPipeline.linkIn | public FaunusPipeline linkIn(final String label, final String step) {
"""
Have the elements for the named step previous project an edge to the current vertex with provided label.
@param step the name of the step where the source vertices were
@param label the label of the edge to project
@return the extended... | java | public FaunusPipeline linkIn(final String label, final String step) {
return this.link(IN, label, step, null);
} | [
"public",
"FaunusPipeline",
"linkIn",
"(",
"final",
"String",
"label",
",",
"final",
"String",
"step",
")",
"{",
"return",
"this",
".",
"link",
"(",
"IN",
",",
"label",
",",
"step",
",",
"null",
")",
";",
"}"
] | Have the elements for the named step previous project an edge to the current vertex with provided label.
@param step the name of the step where the source vertices were
@param label the label of the edge to project
@return the extended FaunusPipeline | [
"Have",
"the",
"elements",
"for",
"the",
"named",
"step",
"previous",
"project",
"an",
"edge",
"to",
"the",
"current",
"vertex",
"with",
"provided",
"label",
"."
] | train | https://github.com/thinkaurelius/faunus/blob/1eb8494eeb3fe3b84a98d810d304ba01d55b0d6e/src/main/java/com/thinkaurelius/faunus/FaunusPipeline.java#L842-L844 |
google/closure-compiler | src/com/google/javascript/jscomp/ExpressionDecomposer.java | ExpressionDecomposer.buildResultExpression | private static Node buildResultExpression(Node expr, boolean needResult, String tempName) {
"""
Create an expression tree for an expression.
<p>If the result of the expression is needed, then:
<pre>
ASSIGN
tempName
expr
</pre>
otherwise, simply: `expr`
"""
if (needResult) {
JSType type =... | java | private static Node buildResultExpression(Node expr, boolean needResult, String tempName) {
if (needResult) {
JSType type = expr.getJSType();
return withType(IR.assign(withType(IR.name(tempName), type), expr), type).srcrefTree(expr);
} else {
return expr;
}
} | [
"private",
"static",
"Node",
"buildResultExpression",
"(",
"Node",
"expr",
",",
"boolean",
"needResult",
",",
"String",
"tempName",
")",
"{",
"if",
"(",
"needResult",
")",
"{",
"JSType",
"type",
"=",
"expr",
".",
"getJSType",
"(",
")",
";",
"return",
"with... | Create an expression tree for an expression.
<p>If the result of the expression is needed, then:
<pre>
ASSIGN
tempName
expr
</pre>
otherwise, simply: `expr` | [
"Create",
"an",
"expression",
"tree",
"for",
"an",
"expression",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ExpressionDecomposer.java#L474-L481 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.packEntries | public static void packEntries(File[] filesToPack, File destZipFile, NameMapper mapper, int compressionLevel) {
"""
Compresses the given files into a ZIP file.
<p>
The ZIP file must not be a directory and its parent directory must exist.
@param filesToPack
files that needs to be zipped.
@param destZipFile
... | java | public static void packEntries(File[] filesToPack, File destZipFile, NameMapper mapper, int compressionLevel) {
log.debug("Compressing '{}' into '{}'.", filesToPack, destZipFile);
ZipOutputStream out = null;
FileOutputStream fos = null;
try {
fos = new FileOutputStream(destZipFile);
out = n... | [
"public",
"static",
"void",
"packEntries",
"(",
"File",
"[",
"]",
"filesToPack",
",",
"File",
"destZipFile",
",",
"NameMapper",
"mapper",
",",
"int",
"compressionLevel",
")",
"{",
"log",
".",
"debug",
"(",
"\"Compressing '{}' into '{}'.\"",
",",
"filesToPack",
"... | Compresses the given files into a ZIP file.
<p>
The ZIP file must not be a directory and its parent directory must exist.
@param filesToPack
files that needs to be zipped.
@param destZipFile
ZIP file that will be created or overwritten.
@param mapper
call-back for renaming the entries.
@param compressionLevel
ZIP file... | [
"Compresses",
"the",
"given",
"files",
"into",
"a",
"ZIP",
"file",
".",
"<p",
">",
"The",
"ZIP",
"file",
"must",
"not",
"be",
"a",
"directory",
"and",
"its",
"parent",
"directory",
"must",
"exist",
"."
] | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1545-L1571 |
deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/util/ReflectionUtils.java | ReflectionUtils.setJobConf | private static void setJobConf(Object theObject, Configuration conf) {
"""
This code is to support backward compatibility and break the compile
time dependency of core on mapred.
This should be made deprecated along with the mapred package HADOOP-1230.
Should be removed when mapred package is removed.
"""
... | java | private static void setJobConf(Object theObject, Configuration conf) {
//If JobConf and JobConfigurable are in classpath, AND
//theObject is of type JobConfigurable AND
//conf is of type JobConf then
//invoke configure on theObject
try {
Class<?> jobConfClass = conf.g... | [
"private",
"static",
"void",
"setJobConf",
"(",
"Object",
"theObject",
",",
"Configuration",
"conf",
")",
"{",
"//If JobConf and JobConfigurable are in classpath, AND",
"//theObject is of type JobConfigurable AND",
"//conf is of type JobConf then",
"//invoke configure on theObject",
... | This code is to support backward compatibility and break the compile
time dependency of core on mapred.
This should be made deprecated along with the mapred package HADOOP-1230.
Should be removed when mapred package is removed. | [
"This",
"code",
"is",
"to",
"support",
"backward",
"compatibility",
"and",
"break",
"the",
"compile",
"time",
"dependency",
"of",
"core",
"on",
"mapred",
".",
"This",
"should",
"be",
"made",
"deprecated",
"along",
"with",
"the",
"mapred",
"package",
"HADOOP",
... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/util/ReflectionUtils.java#L88-L106 |
Javacord/Javacord | javacord-api/src/main/java/org/javacord/api/entity/message/embed/EmbedBuilder.java | EmbedBuilder.setThumbnail | public EmbedBuilder setThumbnail(BufferedImage thumbnail, String fileType) {
"""
Sets the thumbnail of the embed.
@param thumbnail The thumbnail.
@param fileType The type of the file, e.g. "png" or "gif".
@return The current instance in order to chain call methods.
"""
delegate.setThumbnail(thumbn... | java | public EmbedBuilder setThumbnail(BufferedImage thumbnail, String fileType) {
delegate.setThumbnail(thumbnail, fileType);
return this;
} | [
"public",
"EmbedBuilder",
"setThumbnail",
"(",
"BufferedImage",
"thumbnail",
",",
"String",
"fileType",
")",
"{",
"delegate",
".",
"setThumbnail",
"(",
"thumbnail",
",",
"fileType",
")",
";",
"return",
"this",
";",
"}"
] | Sets the thumbnail of the embed.
@param thumbnail The thumbnail.
@param fileType The type of the file, e.g. "png" or "gif".
@return The current instance in order to chain call methods. | [
"Sets",
"the",
"thumbnail",
"of",
"the",
"embed",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/message/embed/EmbedBuilder.java#L587-L590 |
skuzzle/semantic-version | src/it/java/de/skuzzle/semantic/VersionRegEx.java | VersionRegEx.parseVersion | public static final VersionRegEx parseVersion(String versionString) {
"""
Tries to parse the provided String as a semantic version. If the string does not
conform to the semantic version specification, a {@link VersionFormatException}
will be thrown.
@param versionString The String to parse.
@return The pars... | java | public static final VersionRegEx parseVersion(String versionString) {
require(versionString != null, "versionString is null");
final Matcher m = VERSION_PATTERN.matcher(versionString);
if (!m.matches()) {
throw new VersionFormatException(versionString);
}
final int m... | [
"public",
"static",
"final",
"VersionRegEx",
"parseVersion",
"(",
"String",
"versionString",
")",
"{",
"require",
"(",
"versionString",
"!=",
"null",
",",
"\"versionString is null\"",
")",
";",
"final",
"Matcher",
"m",
"=",
"VERSION_PATTERN",
".",
"matcher",
"(",
... | Tries to parse the provided String as a semantic version. If the string does not
conform to the semantic version specification, a {@link VersionFormatException}
will be thrown.
@param versionString The String to parse.
@return The parsed version.
@throws VersionFormatException If the String is no valid version
@throws... | [
"Tries",
"to",
"parse",
"the",
"provided",
"String",
"as",
"a",
"semantic",
"version",
".",
"If",
"the",
"string",
"does",
"not",
"conform",
"to",
"the",
"semantic",
"version",
"specification",
"a",
"{",
"@link",
"VersionFormatException",
"}",
"will",
"be",
... | train | https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/it/java/de/skuzzle/semantic/VersionRegEx.java#L528-L556 |
stevespringett/Alpine | alpine/src/main/java/alpine/util/MapperUtil.java | MapperUtil.readAsObjectOf | public static <T> T readAsObjectOf(Class<T> clazz, String value) {
"""
Reads in a String value and returns the object for which it represents.
@param clazz The expected class of the value
@param value the value to parse
@param <T> The expected type to return
@return the mapped object
"""
final Obje... | java | public static <T> T readAsObjectOf(Class<T> clazz, String value) {
final ObjectMapper mapper = new ObjectMapper();
try {
return mapper.readValue(value, clazz);
} catch (IOException e) {
LOGGER.error(e.getMessage(), e.fillInStackTrace());
}
return null;
... | [
"public",
"static",
"<",
"T",
">",
"T",
"readAsObjectOf",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"value",
")",
"{",
"final",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"try",
"{",
"return",
"mapper",
".",
"readVa... | Reads in a String value and returns the object for which it represents.
@param clazz The expected class of the value
@param value the value to parse
@param <T> The expected type to return
@return the mapped object | [
"Reads",
"in",
"a",
"String",
"value",
"and",
"returns",
"the",
"object",
"for",
"which",
"it",
"represents",
"."
] | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/util/MapperUtil.java#L46-L54 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bos/BosClient.java | BosClient.appendObject | public AppendObjectResponse appendObject(String bucketName, String key, InputStream input) {
"""
Uploads the appendable input stream to Bos under the specified bucket and key name.
@param bucketName The name of an existing bucket, to which you have Write permission.
@param key The key under which to store the ... | java | public AppendObjectResponse appendObject(String bucketName, String key, InputStream input) {
return this.appendObject(new AppendObjectRequest(bucketName, key, input));
} | [
"public",
"AppendObjectResponse",
"appendObject",
"(",
"String",
"bucketName",
",",
"String",
"key",
",",
"InputStream",
"input",
")",
"{",
"return",
"this",
".",
"appendObject",
"(",
"new",
"AppendObjectRequest",
"(",
"bucketName",
",",
"key",
",",
"input",
")"... | Uploads the appendable input stream to Bos under the specified bucket and key name.
@param bucketName The name of an existing bucket, to which you have Write permission.
@param key The key under which to store the specified file.
@param input The input stream containing the value to be uploaded to Bos.
@return An Appe... | [
"Uploads",
"the",
"appendable",
"input",
"stream",
"to",
"Bos",
"under",
"the",
"specified",
"bucket",
"and",
"key",
"name",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L1765-L1767 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.sub | public static <T> List<T> sub(Collection<T> collection, int start, int end) {
"""
截取集合的部分
@param <T> 集合元素类型
@param collection 被截取的数组
@param start 开始位置(包含)
@param end 结束位置(不包含)
@return 截取后的数组,当开始位置超过最大时,返回null
"""
return sub(collection, start, end, 1);
} | java | public static <T> List<T> sub(Collection<T> collection, int start, int end) {
return sub(collection, start, end, 1);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"sub",
"(",
"Collection",
"<",
"T",
">",
"collection",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"sub",
"(",
"collection",
",",
"start",
",",
"end",
",",
"1",
")",
";",
... | 截取集合的部分
@param <T> 集合元素类型
@param collection 被截取的数组
@param start 开始位置(包含)
@param end 结束位置(不包含)
@return 截取后的数组,当开始位置超过最大时,返回null | [
"截取集合的部分"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L876-L878 |
grpc/grpc-java | netty/src/main/java/io/grpc/netty/WriteBufferingAndExceptionHandler.java | WriteBufferingAndExceptionHandler.close | @Override
public void close(ChannelHandlerContext ctx, ChannelPromise future) throws Exception {
"""
If we are still performing protocol negotiation, then this will propagate failures to all
buffered writes.
"""
Status status = Status.UNAVAILABLE.withDescription(
"Connection closing while perfor... | java | @Override
public void close(ChannelHandlerContext ctx, ChannelPromise future) throws Exception {
Status status = Status.UNAVAILABLE.withDescription(
"Connection closing while performing protocol negotiation for " + ctx.pipeline().names());
failWrites(status.asRuntimeException());
super.close(ctx, ... | [
"@",
"Override",
"public",
"void",
"close",
"(",
"ChannelHandlerContext",
"ctx",
",",
"ChannelPromise",
"future",
")",
"throws",
"Exception",
"{",
"Status",
"status",
"=",
"Status",
".",
"UNAVAILABLE",
".",
"withDescription",
"(",
"\"Connection closing while performin... | If we are still performing protocol negotiation, then this will propagate failures to all
buffered writes. | [
"If",
"we",
"are",
"still",
"performing",
"protocol",
"negotiation",
"then",
"this",
"will",
"propagate",
"failures",
"to",
"all",
"buffered",
"writes",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/WriteBufferingAndExceptionHandler.java#L160-L166 |
SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/component/ComponentUpdater.java | ComponentUpdater.removeDuplicatedProjects | private void removeDuplicatedProjects(DbSession session, String projectKey) {
"""
On MySQL, as PROJECTS.KEE is not unique, if the same project is provisioned multiple times, then it will be duplicated in the database.
So, after creating a project, we commit, and we search in the db if their are some duplications ... | java | private void removeDuplicatedProjects(DbSession session, String projectKey) {
List<ComponentDto> duplicated = dbClient.componentDao().selectComponentsHavingSameKeyOrderedById(session, projectKey);
for (int i = 1; i < duplicated.size(); i++) {
dbClient.componentDao().delete(session, duplicated.get(i).getId... | [
"private",
"void",
"removeDuplicatedProjects",
"(",
"DbSession",
"session",
",",
"String",
"projectKey",
")",
"{",
"List",
"<",
"ComponentDto",
">",
"duplicated",
"=",
"dbClient",
".",
"componentDao",
"(",
")",
".",
"selectComponentsHavingSameKeyOrderedById",
"(",
"... | On MySQL, as PROJECTS.KEE is not unique, if the same project is provisioned multiple times, then it will be duplicated in the database.
So, after creating a project, we commit, and we search in the db if their are some duplications and we remove them.
SONAR-6332 | [
"On",
"MySQL",
"as",
"PROJECTS",
".",
"KEE",
"is",
"not",
"unique",
"if",
"the",
"same",
"project",
"is",
"provisioned",
"multiple",
"times",
"then",
"it",
"will",
"be",
"duplicated",
"in",
"the",
"database",
".",
"So",
"after",
"creating",
"a",
"project",... | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/component/ComponentUpdater.java#L150-L155 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BytecodeScanner.java | BytecodeScanner.extractInt | private static int extractInt(byte[] arr, int offset) {
"""
Extract an int from bytes at the given offset in the array.
@param arr
the array
@param offset
the offset in the array
"""
return ((arr[offset] & 0xFF) << 24) | ((arr[offset + 1] & 0xFF) << 16) | ((arr[offset + 2] & 0xFF) << 8)
... | java | private static int extractInt(byte[] arr, int offset) {
return ((arr[offset] & 0xFF) << 24) | ((arr[offset + 1] & 0xFF) << 16) | ((arr[offset + 2] & 0xFF) << 8)
| (arr[offset + 3] & 0xFF);
} | [
"private",
"static",
"int",
"extractInt",
"(",
"byte",
"[",
"]",
"arr",
",",
"int",
"offset",
")",
"{",
"return",
"(",
"(",
"arr",
"[",
"offset",
"]",
"&",
"0xFF",
")",
"<<",
"24",
")",
"|",
"(",
"(",
"arr",
"[",
"offset",
"+",
"1",
"]",
"&",
... | Extract an int from bytes at the given offset in the array.
@param arr
the array
@param offset
the offset in the array | [
"Extract",
"an",
"int",
"from",
"bytes",
"at",
"the",
"given",
"offset",
"in",
"the",
"array",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BytecodeScanner.java#L76-L79 |
maestrano/maestrano-java | src/main/java/com/maestrano/net/AccountClient.java | AccountClient.retrieve | public T retrieve(String entityId, MnoHttpClient httpClient) throws AuthenticationException, ApiException, InvalidRequestException {
"""
Fetch an entity by id
@param entity
class
@param entity
id
@param httpClient
@return entity
@throws AuthenticationException
@throws ApiException
@throws InvalidRequest... | java | public T retrieve(String entityId, MnoHttpClient httpClient) throws AuthenticationException, ApiException, InvalidRequestException {
String jsonBody = httpClient.get(getInstanceUrl(entityId));
Type parsingType = new MnoAccountResponseParameterizedType(entitityClass);
MnoAccountResponse<T> resp = GSON.fromJson(js... | [
"public",
"T",
"retrieve",
"(",
"String",
"entityId",
",",
"MnoHttpClient",
"httpClient",
")",
"throws",
"AuthenticationException",
",",
"ApiException",
",",
"InvalidRequestException",
"{",
"String",
"jsonBody",
"=",
"httpClient",
".",
"get",
"(",
"getInstanceUrl",
... | Fetch an entity by id
@param entity
class
@param entity
id
@param httpClient
@return entity
@throws AuthenticationException
@throws ApiException
@throws InvalidRequestException | [
"Fetch",
"an",
"entity",
"by",
"id"
] | train | https://github.com/maestrano/maestrano-java/blob/e71c6d3172d7645529d678d1cb3ea9e0a59de314/src/main/java/com/maestrano/net/AccountClient.java#L233-L241 |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/scale/TaiInstant.java | TaiInstant.ofTaiSeconds | public static TaiInstant ofTaiSeconds(long taiSeconds, long nanoAdjustment) {
"""
Obtains an instance of {@code TaiInstant} from the number of seconds from
the TAI epoch of 1958-01-01T00:00:00(TAI) with a nanosecond fraction of second.
<p>
This method allows an arbitrary number of nanoseconds to be passed in.
... | java | public static TaiInstant ofTaiSeconds(long taiSeconds, long nanoAdjustment) {
long secs = Math.addExact(taiSeconds, Math.floorDiv(nanoAdjustment, NANOS_PER_SECOND));
int nos = (int) Math.floorMod(nanoAdjustment, NANOS_PER_SECOND); // safe cast
return new TaiInstant(secs, nos);
} | [
"public",
"static",
"TaiInstant",
"ofTaiSeconds",
"(",
"long",
"taiSeconds",
",",
"long",
"nanoAdjustment",
")",
"{",
"long",
"secs",
"=",
"Math",
".",
"addExact",
"(",
"taiSeconds",
",",
"Math",
".",
"floorDiv",
"(",
"nanoAdjustment",
",",
"NANOS_PER_SECOND",
... | Obtains an instance of {@code TaiInstant} from the number of seconds from
the TAI epoch of 1958-01-01T00:00:00(TAI) with a nanosecond fraction of second.
<p>
This method allows an arbitrary number of nanoseconds to be passed in.
The factory will alter the values of the second and nanosecond in order
to ensure that the ... | [
"Obtains",
"an",
"instance",
"of",
"{",
"@code",
"TaiInstant",
"}",
"from",
"the",
"number",
"of",
"seconds",
"from",
"the",
"TAI",
"epoch",
"of",
"1958",
"-",
"01",
"-",
"01T00",
":",
"00",
":",
"00",
"(",
"TAI",
")",
"with",
"a",
"nanosecond",
"fra... | train | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/scale/TaiInstant.java#L137-L141 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/LdapIdentityStore.java | LdapIdentityStore.getCallerSearchControls | private SearchControls getCallerSearchControls() {
"""
Get the {@link SearchControls} object for the caller search.
@return The {@link SearchControls} object to use when search LDAP for the user.
"""
String[] attrIds = { idStoreDefinition.getCallerNameAttribute() };
long limit = Long.valueOf... | java | private SearchControls getCallerSearchControls() {
String[] attrIds = { idStoreDefinition.getCallerNameAttribute() };
long limit = Long.valueOf(idStoreDefinition.getMaxResults());
int timeOut = idStoreDefinition.getReadTimeout();
int scope = getSearchScope(idStoreDefinition.getCallerSear... | [
"private",
"SearchControls",
"getCallerSearchControls",
"(",
")",
"{",
"String",
"[",
"]",
"attrIds",
"=",
"{",
"idStoreDefinition",
".",
"getCallerNameAttribute",
"(",
")",
"}",
";",
"long",
"limit",
"=",
"Long",
".",
"valueOf",
"(",
"idStoreDefinition",
".",
... | Get the {@link SearchControls} object for the caller search.
@return The {@link SearchControls} object to use when search LDAP for the user. | [
"Get",
"the",
"{",
"@link",
"SearchControls",
"}",
"object",
"for",
"the",
"caller",
"search",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/LdapIdentityStore.java#L511-L517 |
js-lib-com/commons | src/main/java/js/util/Classes.java | Classes.setFieldValue | public static void setFieldValue(Object object, Field field, Object value) throws IllegalArgumentException, BugError {
"""
Set field value for object instance, or class if given object instance is null. This setter takes care to enable
accessibility for private fields. Also it tries to adapt <code>value</code> to... | java | public static void setFieldValue(Object object, Field field, Object value) throws IllegalArgumentException, BugError
{
Params.notNull(field, "Field");
Class<?> type = field.getType();
if(!type.equals(String.class) && value instanceof String) {
value = ConverterRegistry.getConverter().asObject... | [
"public",
"static",
"void",
"setFieldValue",
"(",
"Object",
"object",
",",
"Field",
"field",
",",
"Object",
"value",
")",
"throws",
"IllegalArgumentException",
",",
"BugError",
"{",
"Params",
".",
"notNull",
"(",
"field",
",",
"\"Field\"",
")",
";",
"Class",
... | Set field value for object instance, or class if given object instance is null. This setter takes care to enable
accessibility for private fields. Also it tries to adapt <code>value</code> to field type: if <code>value</code> is
a string and field type is not, delegates {@link Converter#asObject(String, Class)}. Anyway... | [
"Set",
"field",
"value",
"for",
"object",
"instance",
"or",
"class",
"if",
"given",
"object",
"instance",
"is",
"null",
".",
"This",
"setter",
"takes",
"care",
"to",
"enable",
"accessibility",
"for",
"private",
"fields",
".",
"Also",
"it",
"tries",
"to",
"... | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L828-L847 |
google/closure-compiler | src/com/google/javascript/jscomp/PassFactory.java | PassFactory.createEmptyPass | public static PassFactory createEmptyPass(String name) {
"""
Create a no-op pass that can only run once. Used to break up loops.
"""
return new PassFactory(name, true) {
@Override
protected CompilerPass create(final AbstractCompiler compiler) {
return new CompilerPass() {
@Ove... | java | public static PassFactory createEmptyPass(String name) {
return new PassFactory(name, true) {
@Override
protected CompilerPass create(final AbstractCompiler compiler) {
return new CompilerPass() {
@Override
public void process(Node externs, Node root) {}
};
}
... | [
"public",
"static",
"PassFactory",
"createEmptyPass",
"(",
"String",
"name",
")",
"{",
"return",
"new",
"PassFactory",
"(",
"name",
",",
"true",
")",
"{",
"@",
"Override",
"protected",
"CompilerPass",
"create",
"(",
"final",
"AbstractCompiler",
"compiler",
")",
... | Create a no-op pass that can only run once. Used to break up loops. | [
"Create",
"a",
"no",
"-",
"op",
"pass",
"that",
"can",
"only",
"run",
"once",
".",
"Used",
"to",
"break",
"up",
"loops",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PassFactory.java#L93-L108 |
jMotif/SAX | src/main/java/net/seninp/jmotif/distance/EuclideanDistance.java | EuclideanDistance.normalizedDistance | public double normalizedDistance(double[] point1, double[] point2) throws Exception {
"""
Calculates the Normalized Euclidean distance between two points.
@param point1 The first point.
@param point2 The second point.
@return The Euclidean distance.
@throws Exception In the case of error.
"""
return... | java | public double normalizedDistance(double[] point1, double[] point2) throws Exception {
return Math.sqrt(distance2(point1, point2)) / point1.length;
} | [
"public",
"double",
"normalizedDistance",
"(",
"double",
"[",
"]",
"point1",
",",
"double",
"[",
"]",
"point2",
")",
"throws",
"Exception",
"{",
"return",
"Math",
".",
"sqrt",
"(",
"distance2",
"(",
"point1",
",",
"point2",
")",
")",
"/",
"point1",
".",
... | Calculates the Normalized Euclidean distance between two points.
@param point1 The first point.
@param point2 The second point.
@return The Euclidean distance.
@throws Exception In the case of error. | [
"Calculates",
"the",
"Normalized",
"Euclidean",
"distance",
"between",
"two",
"points",
"."
] | train | https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/distance/EuclideanDistance.java#L140-L142 |
geomajas/geomajas-project-client-gwt2 | common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java | StyleUtil.createSymbolizer | public static SymbolizerTypeInfo createSymbolizer(LayerType type, FeatureStyleInfo featureStyle) {
"""
Create a symbolizer from a feature style.
@param type the layer type
@param featureStyle the style
@return the symbolizer
"""
SymbolInfo symbol = featureStyle.getSymbol();
SymbolizerTypeInfo symboliz... | java | public static SymbolizerTypeInfo createSymbolizer(LayerType type, FeatureStyleInfo featureStyle) {
SymbolInfo symbol = featureStyle.getSymbol();
SymbolizerTypeInfo symbolizer = null;
StrokeInfo stroke = createStroke(featureStyle.getStrokeColor(), featureStyle.getStrokeWidth(),
featureStyle.getStrokeOpacity(),... | [
"public",
"static",
"SymbolizerTypeInfo",
"createSymbolizer",
"(",
"LayerType",
"type",
",",
"FeatureStyleInfo",
"featureStyle",
")",
"{",
"SymbolInfo",
"symbol",
"=",
"featureStyle",
".",
"getSymbol",
"(",
")",
";",
"SymbolizerTypeInfo",
"symbolizer",
"=",
"null",
... | Create a symbolizer from a feature style.
@param type the layer type
@param featureStyle the style
@return the symbolizer | [
"Create",
"a",
"symbolizer",
"from",
"a",
"feature",
"style",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java#L88-L124 |
tvesalainen/util | util/src/main/java/org/vesalainen/navi/LocalLongitude.java | LocalLongitude.getInstance | public static LocalLongitude getInstance(double longitude, double latitude) {
"""
Returns LocalLongitude instance which is usable about 60 NM around starting
point.
@param longitude
@param latitude
@return
"""
if (Math.abs(longitude) < 179)
{
return new LocalLongitude(latitud... | java | public static LocalLongitude getInstance(double longitude, double latitude)
{
if (Math.abs(longitude) < 179)
{
return new LocalLongitude(latitude);
}
else
{
return new PacificLongitude(latitude);
}
} | [
"public",
"static",
"LocalLongitude",
"getInstance",
"(",
"double",
"longitude",
",",
"double",
"latitude",
")",
"{",
"if",
"(",
"Math",
".",
"abs",
"(",
"longitude",
")",
"<",
"179",
")",
"{",
"return",
"new",
"LocalLongitude",
"(",
"latitude",
")",
";",
... | Returns LocalLongitude instance which is usable about 60 NM around starting
point.
@param longitude
@param latitude
@return | [
"Returns",
"LocalLongitude",
"instance",
"which",
"is",
"usable",
"about",
"60",
"NM",
"around",
"starting",
"point",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/navi/LocalLongitude.java#L46-L56 |
demidenko05/beigesoft-webstore | src/main/java/org/beigesoft/webstore/processor/PrcRefreshItemsInList.java | PrcRefreshItemsInList.findTemplate | protected final HtmlTemplate findTemplate(final List<HtmlTemplate> pHtmlTemplates, final Long pId) throws Exception {
"""
<p>Find Html Template with given ID.</p>
@param pHtmlTemplates Html Templates
@param pId ID
@return template with given ID
@throws Exception - if not found
"""
for (HtmlTemplate tmp... | java | protected final HtmlTemplate findTemplate(final List<HtmlTemplate> pHtmlTemplates, final Long pId) throws Exception {
for (HtmlTemplate tmpl : pHtmlTemplates) {
if (tmpl.getItsId().equals(pId)) {
return tmpl;
}
}
throw new Exception("Algorithm error/or template deleted: template not foun... | [
"protected",
"final",
"HtmlTemplate",
"findTemplate",
"(",
"final",
"List",
"<",
"HtmlTemplate",
">",
"pHtmlTemplates",
",",
"final",
"Long",
"pId",
")",
"throws",
"Exception",
"{",
"for",
"(",
"HtmlTemplate",
"tmpl",
":",
"pHtmlTemplates",
")",
"{",
"if",
"("... | <p>Find Html Template with given ID.</p>
@param pHtmlTemplates Html Templates
@param pId ID
@return template with given ID
@throws Exception - if not found | [
"<p",
">",
"Find",
"Html",
"Template",
"with",
"given",
"ID",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/demidenko05/beigesoft-webstore/blob/41ed2e2f1c640d37951d5fb235f26856008b87e1/src/main/java/org/beigesoft/webstore/processor/PrcRefreshItemsInList.java#L1185-L1192 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/VariablesInner.java | VariablesInner.listByAutomationAccountAsync | public Observable<Page<VariableInner>> listByAutomationAccountAsync(final String resourceGroupName, final String automationAccountName) {
"""
Retrieve a list of variables.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@throws Illegal... | java | public Observable<Page<VariableInner>> listByAutomationAccountAsync(final String resourceGroupName, final String automationAccountName) {
return listByAutomationAccountWithServiceResponseAsync(resourceGroupName, automationAccountName)
.map(new Func1<ServiceResponse<Page<VariableInner>>, Page<Variabl... | [
"public",
"Observable",
"<",
"Page",
"<",
"VariableInner",
">",
">",
"listByAutomationAccountAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"automationAccountName",
")",
"{",
"return",
"listByAutomationAccountWithServiceResponseAsync",
"(",
"... | Retrieve a list of variables.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<VariableInner> object | [
"Retrieve",
"a",
"list",
"of",
"variables",
"."
] | 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/VariablesInner.java#L522-L530 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/IntStream.java | IntStream.onClose | @NotNull
public IntStream onClose(@NotNull final Runnable closeHandler) {
"""
Adds close handler to the current stream.
<p>This is an intermediate operation.
@param closeHandler an action to execute when the stream is closed
@return the new stream with the close handler
@since 1.1.8
"""
Ob... | java | @NotNull
public IntStream onClose(@NotNull final Runnable closeHandler) {
Objects.requireNonNull(closeHandler);
final Params newParams = Params.wrapWithCloseHandler(params, closeHandler);
return new IntStream(newParams, iterator);
} | [
"@",
"NotNull",
"public",
"IntStream",
"onClose",
"(",
"@",
"NotNull",
"final",
"Runnable",
"closeHandler",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"closeHandler",
")",
";",
"final",
"Params",
"newParams",
"=",
"Params",
".",
"wrapWithCloseHandler",
"("... | Adds close handler to the current stream.
<p>This is an intermediate operation.
@param closeHandler an action to execute when the stream is closed
@return the new stream with the close handler
@since 1.1.8 | [
"Adds",
"close",
"handler",
"to",
"the",
"current",
"stream",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/IntStream.java#L1302-L1307 |
asterisk-java/asterisk-java | src/main/java/org/asteriskjava/manager/action/UpdateConfigAction.java | UpdateConfigAction.setAttributes | public void setAttributes(Map<String, String> actions) {
"""
You may use this field to directly, programmatically add your own Map of
key,value pairs that you would like to send for this command. Setting
your own map will reset the command index to the number of keys in the
Map
@see org.asteriskjava.manager.... | java | public void setAttributes(Map<String, String> actions)
{
this.actions = actions;
this.actionCounter = actions.keySet().size();
} | [
"public",
"void",
"setAttributes",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"actions",
")",
"{",
"this",
".",
"actions",
"=",
"actions",
";",
"this",
".",
"actionCounter",
"=",
"actions",
".",
"keySet",
"(",
")",
".",
"size",
"(",
")",
";",
"}"... | You may use this field to directly, programmatically add your own Map of
key,value pairs that you would like to send for this command. Setting
your own map will reset the command index to the number of keys in the
Map
@see org.asteriskjava.manager.action.UpdateConfigAction#addCommand
@param actions the actions to set | [
"You",
"may",
"use",
"this",
"field",
"to",
"directly",
"programmatically",
"add",
"your",
"own",
"Map",
"of",
"key",
"value",
"pairs",
"that",
"you",
"would",
"like",
"to",
"send",
"for",
"this",
"command",
".",
"Setting",
"your",
"own",
"map",
"will",
... | train | https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/manager/action/UpdateConfigAction.java#L238-L242 |
vvakame/JsonPullParser | jsonpullparser-apt/src/main/java/net/vvakame/util/jsonpullparser/factory/template/Template.java | Template.writeGen | public static void writeGen(JavaFileObject fileObject, JsonModelModel model)
throws IOException {
"""
Generates source code into the given file object from the given data model, utilizing the templating engine.
@param fileObject Target file object
@param model Data model for source code generation
@throws IO... | java | public static void writeGen(JavaFileObject fileObject, JsonModelModel model)
throws IOException {
MvelTemplate.writeGen(fileObject, model);
} | [
"public",
"static",
"void",
"writeGen",
"(",
"JavaFileObject",
"fileObject",
",",
"JsonModelModel",
"model",
")",
"throws",
"IOException",
"{",
"MvelTemplate",
".",
"writeGen",
"(",
"fileObject",
",",
"model",
")",
";",
"}"
] | Generates source code into the given file object from the given data model, utilizing the templating engine.
@param fileObject Target file object
@param model Data model for source code generation
@throws IOException
@author vvakame | [
"Generates",
"source",
"code",
"into",
"the",
"given",
"file",
"object",
"from",
"the",
"given",
"data",
"model",
"utilizing",
"the",
"templating",
"engine",
"."
] | train | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-apt/src/main/java/net/vvakame/util/jsonpullparser/factory/template/Template.java#L41-L44 |
cqframework/clinical_quality_language | Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java | ElmBaseVisitor.visitOperandDef | public T visitOperandDef(OperandDef elm, C context) {
"""
Visit a OperandDef. This method will be called for
every node in the tree that is a OperandDef.
@param elm the ELM tree
@param context the context passed to the visitor
@return the visitor result
"""
if (elm.getOperandTypeSpecifier() !... | java | public T visitOperandDef(OperandDef elm, C context) {
if (elm.getOperandTypeSpecifier() != null) {
visitElement(elm.getOperandTypeSpecifier(), context);
}
return null;
} | [
"public",
"T",
"visitOperandDef",
"(",
"OperandDef",
"elm",
",",
"C",
"context",
")",
"{",
"if",
"(",
"elm",
".",
"getOperandTypeSpecifier",
"(",
")",
"!=",
"null",
")",
"{",
"visitElement",
"(",
"elm",
".",
"getOperandTypeSpecifier",
"(",
")",
",",
"conte... | Visit a OperandDef. This method will be called for
every node in the tree that is a OperandDef.
@param elm the ELM tree
@param context the context passed to the visitor
@return the visitor result | [
"Visit",
"a",
"OperandDef",
".",
"This",
"method",
"will",
"be",
"called",
"for",
"every",
"node",
"in",
"the",
"tree",
"that",
"is",
"a",
"OperandDef",
"."
] | train | https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java#L404-L409 |
geomajas/geomajas-project-client-gwt2 | impl/src/main/java/org/geomajas/gwt2/client/service/DomService.java | DomService.setTop | public static void setTop(Element element, int top) {
"""
Apply the "top" style attribute on the given element.
@param element
The DOM element.
@param top
The top value.
"""
if (Dom.isIE()) { // Limitation in IE8...
while (top > 1000000) {
top -= 1000000;
}
while (top < -1000000) {
top... | java | public static void setTop(Element element, int top) {
if (Dom.isIE()) { // Limitation in IE8...
while (top > 1000000) {
top -= 1000000;
}
while (top < -1000000) {
top += 1000000;
}
}
Dom.setStyleAttribute(element, "top", top + "px");
} | [
"public",
"static",
"void",
"setTop",
"(",
"Element",
"element",
",",
"int",
"top",
")",
"{",
"if",
"(",
"Dom",
".",
"isIE",
"(",
")",
")",
"{",
"// Limitation in IE8...",
"while",
"(",
"top",
">",
"1000000",
")",
"{",
"top",
"-=",
"1000000",
";",
"}... | Apply the "top" style attribute on the given element.
@param element
The DOM element.
@param top
The top value. | [
"Apply",
"the",
"top",
"style",
"attribute",
"on",
"the",
"given",
"element",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/service/DomService.java#L48-L58 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.accessRestriction_u2f_id_PUT | public void accessRestriction_u2f_id_PUT(Long id, OvhU2FAccount body) throws IOException {
"""
Alter this object properties
REST: PUT /me/accessRestriction/u2f/{id}
@param body [required] New object properties
@param id [required] The Id of the restriction
"""
String qPath = "/me/accessRestriction/u2f/{... | java | public void accessRestriction_u2f_id_PUT(Long id, OvhU2FAccount body) throws IOException {
String qPath = "/me/accessRestriction/u2f/{id}";
StringBuilder sb = path(qPath, id);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"accessRestriction_u2f_id_PUT",
"(",
"Long",
"id",
",",
"OvhU2FAccount",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/accessRestriction/u2f/{id}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"id",
")... | Alter this object properties
REST: PUT /me/accessRestriction/u2f/{id}
@param body [required] New object properties
@param id [required] The Id of the restriction | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L4244-L4248 |
Waikato/moa | moa/src/main/java/moa/streams/generators/multilabel/MetaMultilabelGenerator.java | MetaMultilabelGenerator.getTopCombinations | private HashSet[] getTopCombinations(int n) {
"""
GetTopCombinations. Calculating the full joint probability distribution
is too complex. - sample from the approximate joint many times - record
the the n most commonly ocurring Y and their frequencies - create a map
based on these frequencies
@param n the num... | java | private HashSet[] getTopCombinations(int n) {
final HashMap<HashSet, Integer> count = new HashMap<HashSet, Integer>();
HashMap<HashSet, Integer> isets = new HashMap<HashSet, Integer>();
int N = 100000;
double lc = 0.0;
for (int i = 0; i < N; i++) {
HashSet Y = gener... | [
"private",
"HashSet",
"[",
"]",
"getTopCombinations",
"(",
"int",
"n",
")",
"{",
"final",
"HashMap",
"<",
"HashSet",
",",
"Integer",
">",
"count",
"=",
"new",
"HashMap",
"<",
"HashSet",
",",
"Integer",
">",
"(",
")",
";",
"HashMap",
"<",
"HashSet",
","... | GetTopCombinations. Calculating the full joint probability distribution
is too complex. - sample from the approximate joint many times - record
the the n most commonly ocurring Y and their frequencies - create a map
based on these frequencies
@param n the number of labelsets
@return n labelsts | [
"GetTopCombinations",
".",
"Calculating",
"the",
"full",
"joint",
"probability",
"distribution",
"is",
"too",
"complex",
".",
"-",
"sample",
"from",
"the",
"approximate",
"joint",
"many",
"times",
"-",
"record",
"the",
"the",
"n",
"most",
"commonly",
"ocurring",... | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/streams/generators/multilabel/MetaMultilabelGenerator.java#L420-L478 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java | ClassDocCatalog.addClass | private void addClass(ClassDoc classdoc, Map<String,Set<ClassDoc>> map) {
"""
Add the given class to the given map.
@param classdoc the ClassDoc to add to the catelog.
@param map the Map to add the ClassDoc to.
"""
PackageDoc pkg = classdoc.containingPackage();
if (pkg.isIncluded() || (c... | java | private void addClass(ClassDoc classdoc, Map<String,Set<ClassDoc>> map) {
PackageDoc pkg = classdoc.containingPackage();
if (pkg.isIncluded() || (configuration.nodeprecated && Util.isDeprecated(pkg))) {
//No need to catalog this class if it's package is
//included on the... | [
"private",
"void",
"addClass",
"(",
"ClassDoc",
"classdoc",
",",
"Map",
"<",
"String",
",",
"Set",
"<",
"ClassDoc",
">",
">",
"map",
")",
"{",
"PackageDoc",
"pkg",
"=",
"classdoc",
".",
"containingPackage",
"(",
")",
";",
"if",
"(",
"pkg",
".",
"isIncl... | Add the given class to the given map.
@param classdoc the ClassDoc to add to the catelog.
@param map the Map to add the ClassDoc to. | [
"Add",
"the",
"given",
"class",
"to",
"the",
"given",
"map",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java#L156-L174 |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/datetimepicker/TouchExplorationHelper.java | TouchExplorationHelper.sendEventForItem | @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public boolean sendEventForItem(T item, int eventType) {
"""
Populates an event of the specified type with information about an item
and attempts to send it up through the view hierarchy.
@param item The item for which to send an event.
@param eventT... | java | @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public boolean sendEventForItem(T item, int eventType) {
if (!mManager.isEnabled() || Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return false;
}
final AccessibilityEvent event = getEventForItem(item, event... | [
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"ICE_CREAM_SANDWICH",
")",
"public",
"boolean",
"sendEventForItem",
"(",
"T",
"item",
",",
"int",
"eventType",
")",
"{",
"if",
"(",
"!",
"mManager",
".",
"isEnabled",
"(",
")",
"||",
"Build",
".",
... | Populates an event of the specified type with information about an item
and attempts to send it up through the view hierarchy.
@param item The item for which to send an event.
@param eventType The type of event to send.
@return {@code true} if the event was sent successfully. | [
"Populates",
"an",
"event",
"of",
"the",
"specified",
"type",
"with",
"information",
"about",
"an",
"item",
"and",
"attempts",
"to",
"send",
"it",
"up",
"through",
"the",
"view",
"hierarchy",
"."
] | train | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/TouchExplorationHelper.java#L151-L161 |
aol/cyclops | cyclops/src/main/java/cyclops/companion/Functions.java | Functions.filterLongs | public static Function<? super ReactiveSeq<Long>, ? extends ReactiveSeq<Long>> filterLongs(LongPredicate b) {
"""
/*
Fluent filter operation using primitive types
e.g.
<pre>
{@code
import static cyclops.ReactiveSeq.filterInts;
ReactiveSeq.ofLongs(1l,2l,3l)
.to(filterLongs(i->i>2));
//[3l]
}
</pre>
... | java | public static Function<? super ReactiveSeq<Long>, ? extends ReactiveSeq<Long>> filterLongs(LongPredicate b){
return a->a.longs(i->i,s->s.filter(b));
} | [
"public",
"static",
"Function",
"<",
"?",
"super",
"ReactiveSeq",
"<",
"Long",
">",
",",
"?",
"extends",
"ReactiveSeq",
"<",
"Long",
">",
">",
"filterLongs",
"(",
"LongPredicate",
"b",
")",
"{",
"return",
"a",
"->",
"a",
".",
"longs",
"(",
"i",
"->",
... | /*
Fluent filter operation using primitive types
e.g.
<pre>
{@code
import static cyclops.ReactiveSeq.filterInts;
ReactiveSeq.ofLongs(1l,2l,3l)
.to(filterLongs(i->i>2));
//[3l]
}
</pre> | [
"/",
"*",
"Fluent",
"filter",
"operation",
"using",
"primitive",
"types",
"e",
".",
"g",
".",
"<pre",
">",
"{",
"@code",
"import",
"static",
"cyclops",
".",
"ReactiveSeq",
".",
"filterInts",
";"
] | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Functions.java#L395-L398 |
kaazing/gateway | server/src/main/java/org/kaazing/gateway/server/config/parse/GatewayConfigParser.java | GatewayConfigParser.countNewLines | private static int countNewLines(char[] ch, int start, int length) {
"""
Count the number of new lines
@param ch
@param start
@param length
"""
int newLineCount = 0;
// quite reliable, since only Commodore 8-bit machines, TRS-80, Apple II family, Mac OS up to version 9 and OS-9
// ... | java | private static int countNewLines(char[] ch, int start, int length) {
int newLineCount = 0;
// quite reliable, since only Commodore 8-bit machines, TRS-80, Apple II family, Mac OS up to version 9 and OS-9
// use only '\r'
for (int i = start; i < length; i++) {
newLineCount = n... | [
"private",
"static",
"int",
"countNewLines",
"(",
"char",
"[",
"]",
"ch",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"int",
"newLineCount",
"=",
"0",
";",
"// quite reliable, since only Commodore 8-bit machines, TRS-80, Apple II family, Mac OS up to version 9 an... | Count the number of new lines
@param ch
@param start
@param length | [
"Count",
"the",
"number",
"of",
"new",
"lines"
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/server/src/main/java/org/kaazing/gateway/server/config/parse/GatewayConfigParser.java#L461-L469 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.