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 |
|---|---|---|---|---|---|---|---|---|---|---|
joniles/mpxj | src/main/java/net/sf/mpxj/planner/PlannerReader.java | PlannerReader.getTime | private Date getTime(String value) throws MPXJException {
"""
Convert a Planner time into a Java date.
0800
@param value Planner time
@return Java Date instance
"""
try
{
Number hours = m_twoDigitFormat.parse(value.substring(0, 2));
Number minutes = m_twoDigitFormat.parse(v... | java | private Date getTime(String value) throws MPXJException
{
try
{
Number hours = m_twoDigitFormat.parse(value.substring(0, 2));
Number minutes = m_twoDigitFormat.parse(value.substring(2, 4));
Calendar cal = DateHelper.popCalendar();
cal.set(Calendar.HOUR_OF_DAY, hours.i... | [
"private",
"Date",
"getTime",
"(",
"String",
"value",
")",
"throws",
"MPXJException",
"{",
"try",
"{",
"Number",
"hours",
"=",
"m_twoDigitFormat",
".",
"parse",
"(",
"value",
".",
"substring",
"(",
"0",
",",
"2",
")",
")",
";",
"Number",
"minutes",
"=",
... | Convert a Planner time into a Java date.
0800
@param value Planner time
@return Java Date instance | [
"Convert",
"a",
"Planner",
"time",
"into",
"a",
"Java",
"date",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/planner/PlannerReader.java#L869-L891 |
milaboratory/milib | src/main/java/com/milaboratory/core/sequence/SequencesUtils.java | SequencesUtils.wildcardsToRandomBasic | public static <S extends Sequence<S>> S wildcardsToRandomBasic(S sequence, long seed) {
"""
Converts sequence with wildcards to a sequence without wildcards by converting wildcard letters to uniformly
distributed letters from the set of letters allowed by the wildcard. (see {@link
Wildcard#getUniformlyDistribute... | java | public static <S extends Sequence<S>> S wildcardsToRandomBasic(S sequence, long seed) {
Alphabet<S> alphabet = sequence.getAlphabet();
SequenceBuilder<S> sequenceBuilder = alphabet.createBuilder().ensureCapacity(sequence.size());
for (int i = 0; i < sequence.size(); ++i) {
byte code ... | [
"public",
"static",
"<",
"S",
"extends",
"Sequence",
"<",
"S",
">",
">",
"S",
"wildcardsToRandomBasic",
"(",
"S",
"sequence",
",",
"long",
"seed",
")",
"{",
"Alphabet",
"<",
"S",
">",
"alphabet",
"=",
"sequence",
".",
"getAlphabet",
"(",
")",
";",
"Seq... | Converts sequence with wildcards to a sequence without wildcards by converting wildcard letters to uniformly
distributed letters from the set of letters allowed by the wildcard. (see {@link
Wildcard#getUniformlyDistributedBasicCode(long)}.
<p>Returns same result for the same combination of sequence and seed.</p>
@par... | [
"Converts",
"sequence",
"with",
"wildcards",
"to",
"a",
"sequence",
"without",
"wildcards",
"by",
"converting",
"wildcard",
"letters",
"to",
"uniformly",
"distributed",
"letters",
"from",
"the",
"set",
"of",
"letters",
"allowed",
"by",
"the",
"wildcard",
".",
"(... | train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/sequence/SequencesUtils.java#L125-L137 |
jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/sql/SqlKit.java | SqlKit.getSqlParaByString | public SqlPara getSqlParaByString(String content, Object... paras) {
"""
通过 String 内容获取 SqlPara 对象
<pre>
例子:
String content = "select * from user where id = #para(0)";
SqlPara sqlPara = getSqlParaByString(content, 123);
特别注意:content 参数中不能包含 #sql 指令
</pre>
"""
Template template = engine.getTemplate... | java | public SqlPara getSqlParaByString(String content, Object... paras) {
Template template = engine.getTemplateByString(content);
SqlPara sqlPara = new SqlPara();
Map data = new HashMap();
data.put(SQL_PARA_KEY, sqlPara);
data.put(PARA_ARRAY_KEY, paras);
sqlPara.setSql(template.renderToString(data));
... | [
"public",
"SqlPara",
"getSqlParaByString",
"(",
"String",
"content",
",",
"Object",
"...",
"paras",
")",
"{",
"Template",
"template",
"=",
"engine",
".",
"getTemplateByString",
"(",
"content",
")",
";",
"SqlPara",
"sqlPara",
"=",
"new",
"SqlPara",
"(",
")",
... | 通过 String 内容获取 SqlPara 对象
<pre>
例子:
String content = "select * from user where id = #para(0)";
SqlPara sqlPara = getSqlParaByString(content, 123);
特别注意:content 参数中不能包含 #sql 指令
</pre> | [
"通过",
"String",
"内容获取",
"SqlPara",
"对象"
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/sql/SqlKit.java#L240-L250 |
alkacon/opencms-core | src-modules/org/opencms/workplace/help/CmsHelpTemplateBean.java | CmsHelpTemplateBean.buildHtmlHelpStart | public String buildHtmlHelpStart(String cssFile, boolean transitional) {
"""
Returns the HTML for the start of the page.<p>
@param cssFile the CSS file name to use
@param transitional if true, transitional doctype is used
@return the HTML for the start of the page
"""
StringBuffer result = new St... | java | public String buildHtmlHelpStart(String cssFile, boolean transitional) {
StringBuffer result = new StringBuffer(8);
if (transitional) {
result.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
} else {
result.append("<!DOCTYPE HTML PUBLIC \"-... | [
"public",
"String",
"buildHtmlHelpStart",
"(",
"String",
"cssFile",
",",
"boolean",
"transitional",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"8",
")",
";",
"if",
"(",
"transitional",
")",
"{",
"result",
".",
"append",
"(",
"\"<!DO... | Returns the HTML for the start of the page.<p>
@param cssFile the CSS file name to use
@param transitional if true, transitional doctype is used
@return the HTML for the start of the page | [
"Returns",
"the",
"HTML",
"for",
"the",
"start",
"of",
"the",
"page",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/help/CmsHelpTemplateBean.java#L216-L242 |
amzn/ion-java | src/com/amazon/ion/impl/_Private_Utils.java | _Private_Utils.readFully | public static int readFully(InputStream in, byte[] buf)
throws IOException {
"""
Calls {@link InputStream#read(byte[], int, int)} until the buffer is
filled or EOF is encountered.
This method will block until the request is satisfied.
@param in The stream to read from.
@param buf The buffer ... | java | public static int readFully(InputStream in, byte[] buf)
throws IOException
{
return readFully(in, buf, 0, buf.length);
} | [
"public",
"static",
"int",
"readFully",
"(",
"InputStream",
"in",
",",
"byte",
"[",
"]",
"buf",
")",
"throws",
"IOException",
"{",
"return",
"readFully",
"(",
"in",
",",
"buf",
",",
"0",
",",
"buf",
".",
"length",
")",
";",
"}"
] | Calls {@link InputStream#read(byte[], int, int)} until the buffer is
filled or EOF is encountered.
This method will block until the request is satisfied.
@param in The stream to read from.
@param buf The buffer to read to.
@return the number of bytes read from the stream. May be less than
{@code buf.len... | [
"Calls",
"{",
"@link",
"InputStream#read",
"(",
"byte",
"[]",
"int",
"int",
")",
"}",
"until",
"the",
"buffer",
"is",
"filled",
"or",
"EOF",
"is",
"encountered",
".",
"This",
"method",
"will",
"block",
"until",
"the",
"request",
"is",
"satisfied",
"."
] | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/_Private_Utils.java#L535-L539 |
zeroturnaround/zt-exec | src/main/java/org/zeroturnaround/exec/stream/PumpStreamHandler.java | PumpStreamHandler.wrapTask | protected Runnable wrapTask(Runnable task) {
"""
Override this to customize how the background task is created.
@param task the task to be run in the background
@return the runnable of the wrapped task
"""
// Preserve the MDC context of the caller thread.
Map contextMap = MDC.getCopyOfContextMap();... | java | protected Runnable wrapTask(Runnable task) {
// Preserve the MDC context of the caller thread.
Map contextMap = MDC.getCopyOfContextMap();
if (contextMap != null) {
return new MDCRunnableAdapter(task, contextMap);
}
return task;
} | [
"protected",
"Runnable",
"wrapTask",
"(",
"Runnable",
"task",
")",
"{",
"// Preserve the MDC context of the caller thread.",
"Map",
"contextMap",
"=",
"MDC",
".",
"getCopyOfContextMap",
"(",
")",
";",
"if",
"(",
"contextMap",
"!=",
"null",
")",
"{",
"return",
"new... | Override this to customize how the background task is created.
@param task the task to be run in the background
@return the runnable of the wrapped task | [
"Override",
"this",
"to",
"customize",
"how",
"the",
"background",
"task",
"is",
"created",
"."
] | train | https://github.com/zeroturnaround/zt-exec/blob/6c3b93b99bf3c69c9f41d6350bf7707005b6a4cd/src/main/java/org/zeroturnaround/exec/stream/PumpStreamHandler.java#L373-L380 |
apereo/cas | support/cas-server-support-aws/src/main/java/org/apereo/cas/aws/ChainingAWSCredentialsProvider.java | ChainingAWSCredentialsProvider.getInstance | public static AWSCredentialsProvider getInstance(final String credentialAccessKey, final String credentialSecretKey) {
"""
Gets instance.
@param credentialAccessKey the credential access key
@param credentialSecretKey the credential secret key
@return the instance
"""
return getInstance(credential... | java | public static AWSCredentialsProvider getInstance(final String credentialAccessKey, final String credentialSecretKey) {
return getInstance(credentialAccessKey, credentialSecretKey, null, null, null);
} | [
"public",
"static",
"AWSCredentialsProvider",
"getInstance",
"(",
"final",
"String",
"credentialAccessKey",
",",
"final",
"String",
"credentialSecretKey",
")",
"{",
"return",
"getInstance",
"(",
"credentialAccessKey",
",",
"credentialSecretKey",
",",
"null",
",",
"null"... | Gets instance.
@param credentialAccessKey the credential access key
@param credentialSecretKey the credential secret key
@return the instance | [
"Gets",
"instance",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-aws/src/main/java/org/apereo/cas/aws/ChainingAWSCredentialsProvider.java#L53-L55 |
apache/groovy | src/main/java/org/apache/groovy/ast/tools/ExpressionUtils.java | ExpressionUtils.transformListOfConstants | public static Expression transformListOfConstants(ListExpression origList, ClassNode attrType) {
"""
Given a list of constants, transform each item in the list.
@param origList the list to transform
@param attrType the target type
@return the transformed list or the original if nothing was changed
"""
... | java | public static Expression transformListOfConstants(ListExpression origList, ClassNode attrType) {
ListExpression newList = new ListExpression();
boolean changed = false;
for (Expression e : origList.getExpressions()) {
try {
Expression transformed = transformInlineCons... | [
"public",
"static",
"Expression",
"transformListOfConstants",
"(",
"ListExpression",
"origList",
",",
"ClassNode",
"attrType",
")",
"{",
"ListExpression",
"newList",
"=",
"new",
"ListExpression",
"(",
")",
";",
"boolean",
"changed",
"=",
"false",
";",
"for",
"(",
... | Given a list of constants, transform each item in the list.
@param origList the list to transform
@param attrType the target type
@return the transformed list or the original if nothing was changed | [
"Given",
"a",
"list",
"of",
"constants",
"transform",
"each",
"item",
"in",
"the",
"list",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ExpressionUtils.java#L276-L293 |
dynjs/dynjs | src/main/java/org/dynjs/ir/Scope.java | Scope.acquireLocalVariable | public Variable acquireLocalVariable(String name) {
"""
Return an existing variable or return a new one made in this scope.
"""
int depth = 0;
LocalVariable variable = findVariable(name, depth);
if (variable == null) {
variable = new LocalVariable(name, localVariablesIndex,... | java | public Variable acquireLocalVariable(String name) {
int depth = 0;
LocalVariable variable = findVariable(name, depth);
if (variable == null) {
variable = new LocalVariable(name, localVariablesIndex, 0);
localVariables.put(name, variable);
localVariablesIndex+... | [
"public",
"Variable",
"acquireLocalVariable",
"(",
"String",
"name",
")",
"{",
"int",
"depth",
"=",
"0",
";",
"LocalVariable",
"variable",
"=",
"findVariable",
"(",
"name",
",",
"depth",
")",
";",
"if",
"(",
"variable",
"==",
"null",
")",
"{",
"variable",
... | Return an existing variable or return a new one made in this scope. | [
"Return",
"an",
"existing",
"variable",
"or",
"return",
"a",
"new",
"one",
"made",
"in",
"this",
"scope",
"."
] | train | https://github.com/dynjs/dynjs/blob/4bc6715eff8768f8cd92c6a167d621bbfc1e1a91/src/main/java/org/dynjs/ir/Scope.java#L115-L126 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/cache/impl/CacheProxyUtil.java | CacheProxyUtil.validateConfiguredTypes | public static <K, V> void validateConfiguredTypes(CacheConfig cacheConfig, K key, V value) throws ClassCastException {
"""
Validates the configured key and value types matches the provided key, value types.
@param cacheConfig Cache configuration.
@param key the key to be validated.
@param <K> ... | java | public static <K, V> void validateConfiguredTypes(CacheConfig cacheConfig, K key, V value) throws ClassCastException {
Class keyType = cacheConfig.getKeyType();
Class valueType = cacheConfig.getValueType();
validateConfiguredKeyType(keyType, key);
validateConfiguredValueType(valueType, v... | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"void",
"validateConfiguredTypes",
"(",
"CacheConfig",
"cacheConfig",
",",
"K",
"key",
",",
"V",
"value",
")",
"throws",
"ClassCastException",
"{",
"Class",
"keyType",
"=",
"cacheConfig",
".",
"getKeyType",
"(",
"... | Validates the configured key and value types matches the provided key, value types.
@param cacheConfig Cache configuration.
@param key the key to be validated.
@param <K> the type of key.
@param value the value to be validated.
@param <V> the type of value.
@throws ClassCastException if t... | [
"Validates",
"the",
"configured",
"key",
"and",
"value",
"types",
"matches",
"the",
"provided",
"key",
"value",
"types",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cache/impl/CacheProxyUtil.java#L179-L184 |
tango-controls/JTango | dao/src/main/java/fr/esrf/TangoDs/TemplCommand.java | TemplCommand.find_method | protected Method find_method(Method[] meth_list,String meth_name) throws DevFailed {
"""
Retrieve a Method object from a Method list from its name.
@param meth_list The Method object list
@return The wanted method
@exception DevFailed If the method is not known or if two methods are found
with the same name
... | java | protected Method find_method(Method[] meth_list,String meth_name) throws DevFailed
{
int i;
Method meth_found = null;
for (i = 0;i < meth_list.length;i++)
{
if (meth_name.equals(meth_list[i].getName()))
{
for (int j = i + 1;j < meth_list.length;j++)
{
if (meth_name.equals(meth_list[j].get... | [
"protected",
"Method",
"find_method",
"(",
"Method",
"[",
"]",
"meth_list",
",",
"String",
"meth_name",
")",
"throws",
"DevFailed",
"{",
"int",
"i",
";",
"Method",
"meth_found",
"=",
"null",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"meth_list",
"... | Retrieve a Method object from a Method list from its name.
@param meth_list The Method object list
@return The wanted method
@exception DevFailed If the method is not known or if two methods are found
with the same name
Click <a href="../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read
<b>DevFailed</b> e... | [
"Retrieve",
"a",
"Method",
"object",
"from",
"a",
"Method",
"list",
"from",
"its",
"name",
"."
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/TemplCommand.java#L708-L747 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_monitor_voltage.java | xen_health_monitor_voltage.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception {
"""
<pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre>
"""
xen_health_monitor_voltage_responses result = (xen_health_monitor_volta... | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
xen_health_monitor_voltage_responses result = (xen_health_monitor_voltage_responses) service.get_payload_formatter().string_to_resource(xen_health_monitor_voltage_responses.class, response);
if(result.er... | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"xen_health_monitor_voltage_responses",
"result",
"=",
"(",
"xen_health_monitor_voltage_responses",
")",
"service"... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_monitor_voltage.java#L173-L190 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.canReadRoleInOu | private boolean canReadRoleInOu(CmsOrganizationalUnit ou, CmsRole role) {
"""
Helper method to check whether we should bother with reading the group for a given role in a given OU.<p>
This is important because webuser OUs don't have most role groups, and their absence is not cached, so we want to avoid reading ... | java | private boolean canReadRoleInOu(CmsOrganizationalUnit ou, CmsRole role) {
if (ou.hasFlagWebuser() && !role.getRoleName().equals(CmsRole.ACCOUNT_MANAGER.getRoleName())) {
return false;
}
return true;
} | [
"private",
"boolean",
"canReadRoleInOu",
"(",
"CmsOrganizationalUnit",
"ou",
",",
"CmsRole",
"role",
")",
"{",
"if",
"(",
"ou",
".",
"hasFlagWebuser",
"(",
")",
"&&",
"!",
"role",
".",
"getRoleName",
"(",
")",
".",
"equals",
"(",
"CmsRole",
".",
"ACCOUNT_M... | Helper method to check whether we should bother with reading the group for a given role in a given OU.<p>
This is important because webuser OUs don't have most role groups, and their absence is not cached, so we want to avoid reading them.
@param ou the OU
@param role the role
@return true if we should read the role ... | [
"Helper",
"method",
"to",
"check",
"whether",
"we",
"should",
"bother",
"with",
"reading",
"the",
"group",
"for",
"a",
"given",
"role",
"in",
"a",
"given",
"OU",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L10713-L10719 |
CloudSlang/cs-actions | cs-powershell/src/main/java/io/cloudslang/content/services/WSManRemoteShellService.java | WSManRemoteShellService.executionIsTimedOut | private boolean executionIsTimedOut(long aStartTime, int aTimeout) {
"""
Check whether or not the command execution reach the timeout value.
@param aStartTime A start time in seconds.
@param aTimeout A timeout value in seconds.
@return true if it reaches timeout.
"""
if (aTimeout != 0) {
... | java | private boolean executionIsTimedOut(long aStartTime, int aTimeout) {
if (aTimeout != 0) {
long now = System.currentTimeMillis() / 1000;
if ((now - aStartTime) >= aTimeout) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"executionIsTimedOut",
"(",
"long",
"aStartTime",
",",
"int",
"aTimeout",
")",
"{",
"if",
"(",
"aTimeout",
"!=",
"0",
")",
"{",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"/",
"1000",
";",
"if",
"(",
"(",
"n... | Check whether or not the command execution reach the timeout value.
@param aStartTime A start time in seconds.
@param aTimeout A timeout value in seconds.
@return true if it reaches timeout. | [
"Check",
"whether",
"or",
"not",
"the",
"command",
"execution",
"reach",
"the",
"timeout",
"value",
"."
] | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-powershell/src/main/java/io/cloudslang/content/services/WSManRemoteShellService.java#L381-L389 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.getInstance | public static BtcFormat getInstance(int scale, Locale locale, int minDecimals, int... groups) {
"""
Return a new fixed-denomination formatter for the given locale, with the specified
fractional decimal placing. The first argument specifies the denomination as the size
of the shift from coin-denomination in incr... | java | public static BtcFormat getInstance(int scale, Locale locale, int minDecimals, int... groups) {
return getInstance(scale, locale, minDecimals, boxAsList(groups));
} | [
"public",
"static",
"BtcFormat",
"getInstance",
"(",
"int",
"scale",
",",
"Locale",
"locale",
",",
"int",
"minDecimals",
",",
"int",
"...",
"groups",
")",
"{",
"return",
"getInstance",
"(",
"scale",
",",
"locale",
",",
"minDecimals",
",",
"boxAsList",
"(",
... | Return a new fixed-denomination formatter for the given locale, with the specified
fractional decimal placing. The first argument specifies the denomination as the size
of the shift from coin-denomination in increasingly-precise decimal places. The third
parameter is the minimum number of fractional decimal places to... | [
"Return",
"a",
"new",
"fixed",
"-",
"denomination",
"formatter",
"for",
"the",
"given",
"locale",
"with",
"the",
"specified",
"fractional",
"decimal",
"placing",
".",
"The",
"first",
"argument",
"specifies",
"the",
"denomination",
"as",
"the",
"size",
"of",
"t... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L1098-L1100 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/RequestIdTable.java | RequestIdTable.getSendListener | public synchronized SendListener getSendListener(int requestId) {
"""
Returns the semaphore assocaited with the specified request ID. The
request ID must be present in the table otherwise a runtime exception
is thrown.
@param requestId The request ID to retreive the semaphore for.
@return Semaphore The semaph... | java | public synchronized SendListener getSendListener(int requestId)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSendListener", ""+requestId);
if (!containsId(requestId))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) debugTrac... | [
"public",
"synchronized",
"SendListener",
"getSendListener",
"(",
"int",
"requestId",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc"... | Returns the semaphore assocaited with the specified request ID. The
request ID must be present in the table otherwise a runtime exception
is thrown.
@param requestId The request ID to retreive the semaphore for.
@return Semaphore The semaphore retrieved. | [
"Returns",
"the",
"semaphore",
"assocaited",
"with",
"the",
"specified",
"request",
"ID",
".",
"The",
"request",
"ID",
"must",
"be",
"present",
"in",
"the",
"table",
"otherwise",
"a",
"runtime",
"exception",
"is",
"thrown",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/RequestIdTable.java#L164-L179 |
dustin/java-memcached-client | src/main/java/net/spy/memcached/protocol/ascii/OperationImpl.java | OperationImpl.setArguments | protected final void setArguments(ByteBuffer bb, Object... args) {
"""
Set some arguments for an operation into the given byte buffer.
"""
boolean wasFirst = true;
for (Object o : args) {
if (wasFirst) {
wasFirst = false;
} else {
bb.put((byte) ' ');
}
bb.put(Key... | java | protected final void setArguments(ByteBuffer bb, Object... args) {
boolean wasFirst = true;
for (Object o : args) {
if (wasFirst) {
wasFirst = false;
} else {
bb.put((byte) ' ');
}
bb.put(KeyUtil.getKeyBytes(String.valueOf(o)));
}
bb.put(CRLF);
} | [
"protected",
"final",
"void",
"setArguments",
"(",
"ByteBuffer",
"bb",
",",
"Object",
"...",
"args",
")",
"{",
"boolean",
"wasFirst",
"=",
"true",
";",
"for",
"(",
"Object",
"o",
":",
"args",
")",
"{",
"if",
"(",
"wasFirst",
")",
"{",
"wasFirst",
"=",
... | Set some arguments for an operation into the given byte buffer. | [
"Set",
"some",
"arguments",
"for",
"an",
"operation",
"into",
"the",
"given",
"byte",
"buffer",
"."
] | train | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/protocol/ascii/OperationImpl.java#L99-L110 |
bignerdranch/expandable-recycler-view | expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java | ExpandableRecyclerAdapter.notifyChildInserted | @UiThread
public void notifyChildInserted(int parentPosition, int childPosition) {
"""
Notify any registered observers that the parent reflected at {@code parentPosition}
has a child list item that has been newly inserted at {@code childPosition}.
The child list item previously at {@code childPosition} is no... | java | @UiThread
public void notifyChildInserted(int parentPosition, int childPosition) {
int flatParentPosition = getFlatParentPosition(parentPosition);
ExpandableWrapper<P, C> parentWrapper = mFlatItemList.get(flatParentPosition);
parentWrapper.setParent(mParentList.get(parentPosition));
... | [
"@",
"UiThread",
"public",
"void",
"notifyChildInserted",
"(",
"int",
"parentPosition",
",",
"int",
"childPosition",
")",
"{",
"int",
"flatParentPosition",
"=",
"getFlatParentPosition",
"(",
"parentPosition",
")",
";",
"ExpandableWrapper",
"<",
"P",
",",
"C",
">",... | Notify any registered observers that the parent reflected at {@code parentPosition}
has a child list item that has been newly inserted at {@code childPosition}.
The child list item previously at {@code childPosition} is now at
position {@code childPosition + 1}.
<p>
This is a structural change event. Representations of... | [
"Notify",
"any",
"registered",
"observers",
"that",
"the",
"parent",
"reflected",
"at",
"{",
"@code",
"parentPosition",
"}",
"has",
"a",
"child",
"list",
"item",
"that",
"has",
"been",
"newly",
"inserted",
"at",
"{",
"@code",
"childPosition",
"}",
".",
"The"... | train | https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java#L1127-L1138 |
VoltDB/voltdb | src/frontend/org/voltdb/parser/SQLLexer.java | SQLLexer.matchToken | public static boolean matchToken(String buffer, int position, String token) {
"""
/* to match tokens like 'CASE', 'BEGIN', 'END'
the tokens should not be embedded in identifiers, like column names or table names
the tokens can be followed by operators with/without whitespaces
eg: emptycase, caseofbeer, suitcase... | java | public static boolean matchToken(String buffer, int position, String token) {
final int tokLength = token.length();
final int bufLength = buffer.length();
final char firstLo = Character.toLowerCase(token.charAt(0));
final char firstUp = Character.toUpperCase(token.charAt(0));
i... | [
"public",
"static",
"boolean",
"matchToken",
"(",
"String",
"buffer",
",",
"int",
"position",
",",
"String",
"token",
")",
"{",
"final",
"int",
"tokLength",
"=",
"token",
".",
"length",
"(",
")",
";",
"final",
"int",
"bufLength",
"=",
"buffer",
".",
"len... | /* to match tokens like 'CASE', 'BEGIN', 'END'
the tokens should not be embedded in identifiers, like column names or table names
the tokens can be followed by operators with/without whitespaces
eg: emptycase, caseofbeer, suitcaseofbeer,
(id+0)end+100, suit2case3ofbeer, 100+case | [
"/",
"*",
"to",
"match",
"tokens",
"like",
"CASE",
"BEGIN",
"END",
"the",
"tokens",
"should",
"not",
"be",
"embedded",
"in",
"identifiers",
"like",
"column",
"names",
"or",
"table",
"names",
"the",
"tokens",
"can",
"be",
"followed",
"by",
"operators",
"wit... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/parser/SQLLexer.java#L305-L326 |
respoke/respoke-sdk-android | respokeSDK/src/main/java/com/digium/respokesdk/RespokeDirectConnection.java | RespokeDirectConnection.sendMessage | public void sendMessage(String message, final Respoke.TaskCompletionListener completionListener) {
"""
Send a message to the remote client through the direct connection.
@param message The message to send
@param completionListener A listener to receive a notification on the success of the asynchro... | java | public void sendMessage(String message, final Respoke.TaskCompletionListener completionListener) {
if (isActive()) {
JSONObject jsonMessage = new JSONObject();
try {
jsonMessage.put("message", message);
byte[] rawMessage = jsonMessage.toString().getBytes(C... | [
"public",
"void",
"sendMessage",
"(",
"String",
"message",
",",
"final",
"Respoke",
".",
"TaskCompletionListener",
"completionListener",
")",
"{",
"if",
"(",
"isActive",
"(",
")",
")",
"{",
"JSONObject",
"jsonMessage",
"=",
"new",
"JSONObject",
"(",
")",
";",
... | Send a message to the remote client through the direct connection.
@param message The message to send
@param completionListener A listener to receive a notification on the success of the asynchronous operation | [
"Send",
"a",
"message",
"to",
"the",
"remote",
"client",
"through",
"the",
"direct",
"connection",
"."
] | train | https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeDirectConnection.java#L146-L168 |
Impetus/Kundera | src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClient.java | OracleNoSQLClient.onRelationalAttributes | private void onRelationalAttributes(List<RelationHolder> rlHolders, Row row, Table schemaTable) {
"""
Process relational attributes.
@param rlHolders
relation holders
@param row
kv row object
@param schemaTable
the schema table
"""
// Iterate over relations
if (rlHolders != null && !rlH... | java | private void onRelationalAttributes(List<RelationHolder> rlHolders, Row row, Table schemaTable)
{
// Iterate over relations
if (rlHolders != null && !rlHolders.isEmpty())
{
for (RelationHolder rh : rlHolders)
{
String relationName = rh.getRelationName(... | [
"private",
"void",
"onRelationalAttributes",
"(",
"List",
"<",
"RelationHolder",
">",
"rlHolders",
",",
"Row",
"row",
",",
"Table",
"schemaTable",
")",
"{",
"// Iterate over relations",
"if",
"(",
"rlHolders",
"!=",
"null",
"&&",
"!",
"rlHolders",
".",
"isEmpty"... | Process relational attributes.
@param rlHolders
relation holders
@param row
kv row object
@param schemaTable
the schema table | [
"Process",
"relational",
"attributes",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClient.java#L1109-L1131 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java | BoxApiFile.getAddToCollectionRequest | public BoxRequestsFile.AddFileToCollection getAddToCollectionRequest(String fileId, String collectionId) {
"""
Gets a request that adds a file to a collection
@param fileId id of file to add to collection
@param collectionId id of collection to add the file to
@return request to add a file to a... | java | public BoxRequestsFile.AddFileToCollection getAddToCollectionRequest(String fileId, String collectionId) {
BoxRequestsFile.AddFileToCollection request = new BoxRequestsFile.AddFileToCollection(fileId, collectionId, getFileInfoUrl(fileId), mSession);
return request;
} | [
"public",
"BoxRequestsFile",
".",
"AddFileToCollection",
"getAddToCollectionRequest",
"(",
"String",
"fileId",
",",
"String",
"collectionId",
")",
"{",
"BoxRequestsFile",
".",
"AddFileToCollection",
"request",
"=",
"new",
"BoxRequestsFile",
".",
"AddFileToCollection",
"("... | Gets a request that adds a file to a collection
@param fileId id of file to add to collection
@param collectionId id of collection to add the file to
@return request to add a file to a collection | [
"Gets",
"a",
"request",
"that",
"adds",
"a",
"file",
"to",
"a",
"collection"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java#L545-L548 |
LearnLib/automatalib | commons/util/src/main/java/net/automatalib/commons/util/UnionFind.java | UnionFind.link | @Override
public int link(int x, int y) {
"""
Unites two given sets. Note that the behavior of this method is not specified if the given parameters are normal
elements and no set identifiers.
@param x
the first set
@param y
the second set
@return the identifier of the resulting set (either {@code x} ... | java | @Override
public int link(int x, int y) {
int rx = rank[x], ry = rank[y];
if (rx > ry) {
p[y] = x;
return x;
}
p[x] = y;
if (rx == ry) {
rank[y] = ry + 1;
}
return y;
} | [
"@",
"Override",
"public",
"int",
"link",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"int",
"rx",
"=",
"rank",
"[",
"x",
"]",
",",
"ry",
"=",
"rank",
"[",
"y",
"]",
";",
"if",
"(",
"rx",
">",
"ry",
")",
"{",
"p",
"[",
"y",
"]",
"=",
"x... | Unites two given sets. Note that the behavior of this method is not specified if the given parameters are normal
elements and no set identifiers.
@param x
the first set
@param y
the second set
@return the identifier of the resulting set (either {@code x} or {@code y}) | [
"Unites",
"two",
"given",
"sets",
".",
"Note",
"that",
"the",
"behavior",
"of",
"this",
"method",
"is",
"not",
"specified",
"if",
"the",
"given",
"parameters",
"are",
"normal",
"elements",
"and",
"no",
"set",
"identifiers",
"."
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/UnionFind.java#L89-L101 |
jblas-project/jblas | src/main/java/org/jblas/ComplexFloat.java | ComplexFloat.addi | public ComplexFloat addi(float a, ComplexFloat result) {
"""
Add a real number to a complex number in-place.
@param a real number to add
@param result complex number to hold result
@return same as result
"""
if (this == result) {
r += a;
} else {
result.r = r + a;
result.i =... | java | public ComplexFloat addi(float a, ComplexFloat result) {
if (this == result) {
r += a;
} else {
result.r = r + a;
result.i = i;
}
return result;
} | [
"public",
"ComplexFloat",
"addi",
"(",
"float",
"a",
",",
"ComplexFloat",
"result",
")",
"{",
"if",
"(",
"this",
"==",
"result",
")",
"{",
"r",
"+=",
"a",
";",
"}",
"else",
"{",
"result",
".",
"r",
"=",
"r",
"+",
"a",
";",
"result",
".",
"i",
"... | Add a real number to a complex number in-place.
@param a real number to add
@param result complex number to hold result
@return same as result | [
"Add",
"a",
"real",
"number",
"to",
"a",
"complex",
"number",
"in",
"-",
"place",
"."
] | train | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/ComplexFloat.java#L139-L147 |
hudson3-plugins/warnings-plugin | src/main/java/hudson/plugins/warnings/parser/fxcop/FxCopRuleSet.java | FxCopRuleSet.getRule | public FxCopRule getRule(final String category, final String checkId) {
"""
Returns the specified rule if it exists
@param category the rule category
@param checkId the id of the rule
@return the rule; null otherwise
"""
String key = getRuleKey(category, checkId);
FxCopRule rule = null;
if (rules.cont... | java | public FxCopRule getRule(final String category, final String checkId) {
String key = getRuleKey(category, checkId);
FxCopRule rule = null;
if (rules.containsKey(key)) {
rule = rules.get(key);
}
return rule;
} | [
"public",
"FxCopRule",
"getRule",
"(",
"final",
"String",
"category",
",",
"final",
"String",
"checkId",
")",
"{",
"String",
"key",
"=",
"getRuleKey",
"(",
"category",
",",
"checkId",
")",
";",
"FxCopRule",
"rule",
"=",
"null",
";",
"if",
"(",
"rules",
"... | Returns the specified rule if it exists
@param category the rule category
@param checkId the id of the rule
@return the rule; null otherwise | [
"Returns",
"the",
"specified",
"rule",
"if",
"it",
"exists"
] | train | https://github.com/hudson3-plugins/warnings-plugin/blob/462c9f3dffede9120173935567392b22520b0966/src/main/java/hudson/plugins/warnings/parser/fxcop/FxCopRuleSet.java#L63-L70 |
pravega/pravega | shared/protocol/src/main/java/io/pravega/shared/segment/StreamSegmentNameUtils.java | StreamSegmentNameUtils.getQualifiedStreamSegmentName | public static String getQualifiedStreamSegmentName(String scope, String streamName, long segmentId) {
"""
Method to generate Fully Qualified StreamSegmentName using scope, stream and segment id.
@param scope scope to be used in the ScopedStreamSegment name
@param streamName stream name to be used in ScopedStre... | java | public static String getQualifiedStreamSegmentName(String scope, String streamName, long segmentId) {
int segmentNumber = getSegmentNumber(segmentId);
int epoch = getEpoch(segmentId);
StringBuffer sb = getScopedStreamNameInternal(scope, streamName);
sb.append('/');
sb.append(segm... | [
"public",
"static",
"String",
"getQualifiedStreamSegmentName",
"(",
"String",
"scope",
",",
"String",
"streamName",
",",
"long",
"segmentId",
")",
"{",
"int",
"segmentNumber",
"=",
"getSegmentNumber",
"(",
"segmentId",
")",
";",
"int",
"epoch",
"=",
"getEpoch",
... | Method to generate Fully Qualified StreamSegmentName using scope, stream and segment id.
@param scope scope to be used in the ScopedStreamSegment name
@param streamName stream name to be used in ScopedStreamSegment name.
@param segmentId segment id to be used in ScopedStreamSegment name.
@return fully qualified Stream... | [
"Method",
"to",
"generate",
"Fully",
"Qualified",
"StreamSegmentName",
"using",
"scope",
"stream",
"and",
"segment",
"id",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/shared/protocol/src/main/java/io/pravega/shared/segment/StreamSegmentNameUtils.java#L257-L266 |
onepf/OpenIAB | library/src/main/java/org/onepf/oms/OpenIabHelper.java | OpenIabHelper.getSku | @NotNull
public static String getSku(@NotNull final String appStoreName, @NotNull String storeSku) {
"""
Returns a mapped application internal SKU using the store name and a store SKU.
@see org.onepf.oms.SkuManager#mapSku(String, String, String)
@deprecated Use {@link org.onepf.oms.SkuManager#getSku(String... | java | @NotNull
public static String getSku(@NotNull final String appStoreName, @NotNull String storeSku) {
return SkuManager.getInstance().getSku(appStoreName, storeSku);
} | [
"@",
"NotNull",
"public",
"static",
"String",
"getSku",
"(",
"@",
"NotNull",
"final",
"String",
"appStoreName",
",",
"@",
"NotNull",
"String",
"storeSku",
")",
"{",
"return",
"SkuManager",
".",
"getInstance",
"(",
")",
".",
"getSku",
"(",
"appStoreName",
","... | Returns a mapped application internal SKU using the store name and a store SKU.
@see org.onepf.oms.SkuManager#mapSku(String, String, String)
@deprecated Use {@link org.onepf.oms.SkuManager#getSku(String, String)} | [
"Returns",
"a",
"mapped",
"application",
"internal",
"SKU",
"using",
"the",
"store",
"name",
"and",
"a",
"store",
"SKU",
"."
] | train | https://github.com/onepf/OpenIAB/blob/90552d53c5303b322940d96a0c4b7cb797d78760/library/src/main/java/org/onepf/oms/OpenIabHelper.java#L378-L381 |
mojohaus/xml-maven-plugin | src/main/java/org/codehaus/mojo/xml/format/IndentCheckSaxHandler.java | IndentCheckSaxHandler.ignorableWhitespace | @Override
public void ignorableWhitespace( char[] chars, int start, int length )
throws SAXException {
"""
Just delegates to {@link #characters(char[], int, int)}, since this method is not called in all situations where
it could be naively expected.
@see org.xml.sax.helpers.DefaultHandler#ignorable... | java | @Override
public void ignorableWhitespace( char[] chars, int start, int length )
throws SAXException
{
characters( chars, start, length );
} | [
"@",
"Override",
"public",
"void",
"ignorableWhitespace",
"(",
"char",
"[",
"]",
"chars",
",",
"int",
"start",
",",
"int",
"length",
")",
"throws",
"SAXException",
"{",
"characters",
"(",
"chars",
",",
"start",
",",
"length",
")",
";",
"}"
] | Just delegates to {@link #characters(char[], int, int)}, since this method is not called in all situations where
it could be naively expected.
@see org.xml.sax.helpers.DefaultHandler#ignorableWhitespace(char[], int, int) | [
"Just",
"delegates",
"to",
"{",
"@link",
"#characters",
"(",
"char",
"[]",
"int",
"int",
")",
"}",
"since",
"this",
"method",
"is",
"not",
"called",
"in",
"all",
"situations",
"where",
"it",
"could",
"be",
"naively",
"expected",
"."
] | train | https://github.com/mojohaus/xml-maven-plugin/blob/161edde37bbfe7a472369a9675c44d91ec24561d/src/main/java/org/codehaus/mojo/xml/format/IndentCheckSaxHandler.java#L213-L218 |
landawn/AbacusUtil | src/com/landawn/abacus/util/JdbcUtil.java | JdbcUtil.importData | public static int importData(final DataSet dataset, final Connection conn, final String insertSQL) throws UncheckedSQLException {
"""
Imports the data from <code>DataSet</code> to database.
@param dataset
@param conn
@param insertSQL the column order in the sql must be consistent with the column order in the ... | java | public static int importData(final DataSet dataset, final Connection conn, final String insertSQL) throws UncheckedSQLException {
return importData(dataset, dataset.columnNameList(), conn, insertSQL);
} | [
"public",
"static",
"int",
"importData",
"(",
"final",
"DataSet",
"dataset",
",",
"final",
"Connection",
"conn",
",",
"final",
"String",
"insertSQL",
")",
"throws",
"UncheckedSQLException",
"{",
"return",
"importData",
"(",
"dataset",
",",
"dataset",
".",
"colum... | Imports the data from <code>DataSet</code> to database.
@param dataset
@param conn
@param insertSQL the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql:
<pre><code>
List<String> columnNameList = new ArrayList<>(dataset.columnNameList());
colum... | [
"Imports",
"the",
"data",
"from",
"<code",
">",
"DataSet<",
"/",
"code",
">",
"to",
"database",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/JdbcUtil.java#L1854-L1856 |
igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java | OmemoService.createKeyTransportElement | OmemoMessage.Sent createKeyTransportElement(OmemoManager.LoggedInOmemoManager managerGuard,
Set<OmemoDevice> contactsDevices,
byte[] key,
byte[] iv)
throws Interrup... | java | OmemoMessage.Sent createKeyTransportElement(OmemoManager.LoggedInOmemoManager managerGuard,
Set<OmemoDevice> contactsDevices,
byte[] key,
byte[] iv)
throws Interrup... | [
"OmemoMessage",
".",
"Sent",
"createKeyTransportElement",
"(",
"OmemoManager",
".",
"LoggedInOmemoManager",
"managerGuard",
",",
"Set",
"<",
"OmemoDevice",
">",
"contactsDevices",
",",
"byte",
"[",
"]",
"key",
",",
"byte",
"[",
"]",
"iv",
")",
"throws",
"Interru... | Create an OMEMO KeyTransportElement.
@see <a href="https://xmpp.org/extensions/xep-0384.html#usecases-keysend">XEP-0384: Sending a key</a>.
@param managerGuard Initialized OmemoManager.
@param contactsDevices set of recipient devices.
@param key AES-Key to be transported.
@param iv initialization vector to be used wit... | [
"Create",
"an",
"OMEMO",
"KeyTransportElement",
".",
"@see",
"<a",
"href",
"=",
"https",
":",
"//",
"xmpp",
".",
"org",
"/",
"extensions",
"/",
"xep",
"-",
"0384",
".",
"html#usecases",
"-",
"keysend",
">",
"XEP",
"-",
"0384",
":",
"Sending",
"a",
"key... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java#L498-L505 |
atteo/classindex | classindex/src/main/java/org/atteo/classindex/ClassIndex.java | ClassIndex.getAnnotatedNames | public static Iterable<String> getAnnotatedNames(Class<? extends Annotation> annotation, ClassLoader classLoader) {
"""
Retrieves names of classes annotated by given annotation.
<p/>
<p>
The annotation must be annotated with {@link IndexAnnotated} for annotated classes
to be indexed at compile-time by {@link o... | java | public static Iterable<String> getAnnotatedNames(Class<? extends Annotation> annotation, ClassLoader classLoader) {
return readIndexFile(classLoader, ANNOTATED_INDEX_PREFIX + annotation.getCanonicalName());
} | [
"public",
"static",
"Iterable",
"<",
"String",
">",
"getAnnotatedNames",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
",",
"ClassLoader",
"classLoader",
")",
"{",
"return",
"readIndexFile",
"(",
"classLoader",
",",
"ANNOTATED_INDEX_PREFIX",
... | Retrieves names of classes annotated by given annotation.
<p/>
<p>
The annotation must be annotated with {@link IndexAnnotated} for annotated classes
to be indexed at compile-time by {@link org.atteo.classindex.processor.ClassIndexProcessor}.
</p>
<p>
Please note there is no verification if the class really exists. It ... | [
"Retrieves",
"names",
"of",
"classes",
"annotated",
"by",
"given",
"annotation",
".",
"<p",
"/",
">",
"<p",
">",
"The",
"annotation",
"must",
"be",
"annotated",
"with",
"{"
] | train | https://github.com/atteo/classindex/blob/ad76c6bd8b4e84c594d94e48f466a095ffe2306a/classindex/src/main/java/org/atteo/classindex/ClassIndex.java#L304-L306 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/privatejgoodies/common/base/Preconditions.java | Preconditions.checkArgument | public static void checkArgument(
boolean expression, String messageFormat, Object... messageArgs) {
"""
Checks the truth of the given expression and throws a customized
{@link IllegalArgumentException} if it is false. Intended for doing parameter validation in
methods and constructors, e.g.:
<block... | java | public static void checkArgument(
boolean expression, String messageFormat, Object... messageArgs) {
if (!expression) {
throw new IllegalArgumentException(format(messageFormat, messageArgs));
}
} | [
"public",
"static",
"void",
"checkArgument",
"(",
"boolean",
"expression",
",",
"String",
"messageFormat",
",",
"Object",
"...",
"messageArgs",
")",
"{",
"if",
"(",
"!",
"expression",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"format",
"(",
"m... | Checks the truth of the given expression and throws a customized
{@link IllegalArgumentException} if it is false. Intended for doing parameter validation in
methods and constructors, e.g.:
<blockquote><pre>
public void foo(int count) {
Preconditions.checkArgument(count > 0, "count must be positive: %s.", count);
}
</pr... | [
"Checks",
"the",
"truth",
"of",
"the",
"given",
"expression",
"and",
"throws",
"a",
"customized",
"{",
"@link",
"IllegalArgumentException",
"}",
"if",
"it",
"is",
"false",
".",
"Intended",
"for",
"doing",
"parameter",
"validation",
"in",
"methods",
"and",
"con... | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/common/base/Preconditions.java#L85-L90 |
fabric8io/ipaas-quickstarts | archetype-builder/src/main/java/io/fabric8/tooling/archetype/builder/ArchetypeBuilder.java | ArchetypeBuilder.generateArchetypesFromGithubOrganisation | public void generateArchetypesFromGithubOrganisation(String githubOrg, File outputDir, List<String> dirs) throws IOException {
"""
Iterates through all projects in the given github organisation and generates an archetype for it
"""
GitHub github = GitHub.connectAnonymously();
GHOrganization org... | java | public void generateArchetypesFromGithubOrganisation(String githubOrg, File outputDir, List<String> dirs) throws IOException {
GitHub github = GitHub.connectAnonymously();
GHOrganization organization = github.getOrganization(githubOrg);
Objects.notNull(organization, "No github organisation found... | [
"public",
"void",
"generateArchetypesFromGithubOrganisation",
"(",
"String",
"githubOrg",
",",
"File",
"outputDir",
",",
"List",
"<",
"String",
">",
"dirs",
")",
"throws",
"IOException",
"{",
"GitHub",
"github",
"=",
"GitHub",
".",
"connectAnonymously",
"(",
")",
... | Iterates through all projects in the given github organisation and generates an archetype for it | [
"Iterates",
"through",
"all",
"projects",
"in",
"the",
"given",
"github",
"organisation",
"and",
"generates",
"an",
"archetype",
"for",
"it"
] | train | https://github.com/fabric8io/ipaas-quickstarts/blob/cf9a9aa09204a82ac996304ab8c96791f7e5db22/archetype-builder/src/main/java/io/fabric8/tooling/archetype/builder/ArchetypeBuilder.java#L87-L105 |
minio/minio-java | api/src/main/java/io/minio/MinioClient.java | MinioClient.executePut | private HttpResponse executePut(String bucketName, String objectName, Map<String,String> headerMap,
Map<String,String> queryParamMap, Object data, int length)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyE... | java | private HttpResponse executePut(String bucketName, String objectName, Map<String,String> headerMap,
Map<String,String> queryParamMap, Object data, int length)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyE... | [
"private",
"HttpResponse",
"executePut",
"(",
"String",
"bucketName",
",",
"String",
"objectName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headerMap",
",",
"Map",
"<",
"String",
",",
"String",
">",
"queryParamMap",
",",
"Object",
"data",
",",
"int",
... | Executes PUT method for given request parameters.
@param bucketName Bucket name.
@param objectName Object name in the bucket.
@param headerMap Map of HTTP headers for the request.
@param queryParamMap Map of HTTP query parameters of the request.
@param data HTTP request body data.
@param length... | [
"Executes",
"PUT",
"method",
"for",
"given",
"request",
"parameters",
"."
] | train | https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L1422-L1428 |
jimmoores/quandl4j | tablesaw/src/main/java/com/jimmoores/quandl/processing/tablesaw/JSONTableSawRESTDataProvider.java | JSONTableSawRESTDataProvider.getTabularResponse | public Table getTabularResponse(final WebTarget target, Request request) {
"""
Invoke a GET call on the web target and return the result as a TabularResult (parsed CSV). Throws a QuandlUnprocessableEntityException
if Quandl returned a response code that indicates a nonsensical request Throws a QuandlTooManyReques... | java | public Table getTabularResponse(final WebTarget target, Request request) {
return getResponse(target, TABLE_SAW_RESPONSE_PROCESSOR, request);
} | [
"public",
"Table",
"getTabularResponse",
"(",
"final",
"WebTarget",
"target",
",",
"Request",
"request",
")",
"{",
"return",
"getResponse",
"(",
"target",
",",
"TABLE_SAW_RESPONSE_PROCESSOR",
",",
"request",
")",
";",
"}"
] | Invoke a GET call on the web target and return the result as a TabularResult (parsed CSV). Throws a QuandlUnprocessableEntityException
if Quandl returned a response code that indicates a nonsensical request Throws a QuandlTooManyRequestsException if Quandl returned a
response code indicating the client had made too man... | [
"Invoke",
"a",
"GET",
"call",
"on",
"the",
"web",
"target",
"and",
"return",
"the",
"result",
"as",
"a",
"TabularResult",
"(",
"parsed",
"CSV",
")",
".",
"Throws",
"a",
"QuandlUnprocessableEntityException",
"if",
"Quandl",
"returned",
"a",
"response",
"code",
... | train | https://github.com/jimmoores/quandl4j/blob/5d67ae60279d889da93ae7aa3bf6b7d536f88822/tablesaw/src/main/java/com/jimmoores/quandl/processing/tablesaw/JSONTableSawRESTDataProvider.java#L41-L43 |
phxql/argon2-jvm | src/main/java/de/mkammerer/argon2/Argon2Helper.java | Argon2Helper.warmup | private static void warmup(Argon2 argon2, char[] password) {
"""
Calls Argon2 a number of times to warm up the JIT
@param argon2 Argon2 instance.
@param password Some password.
"""
for (int i = 0; i < WARMUP_RUNS; i++) {
argon2.hash(MIN_ITERATIONS, MIN_MEMORY, MIN_PARALLELISM, passwor... | java | private static void warmup(Argon2 argon2, char[] password) {
for (int i = 0; i < WARMUP_RUNS; i++) {
argon2.hash(MIN_ITERATIONS, MIN_MEMORY, MIN_PARALLELISM, password);
}
} | [
"private",
"static",
"void",
"warmup",
"(",
"Argon2",
"argon2",
",",
"char",
"[",
"]",
"password",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"WARMUP_RUNS",
";",
"i",
"++",
")",
"{",
"argon2",
".",
"hash",
"(",
"MIN_ITERATIONS",
","... | Calls Argon2 a number of times to warm up the JIT
@param argon2 Argon2 instance.
@param password Some password. | [
"Calls",
"Argon2",
"a",
"number",
"of",
"times",
"to",
"warm",
"up",
"the",
"JIT"
] | train | https://github.com/phxql/argon2-jvm/blob/27a13907729e67e98cca53eba279e109b60f04f1/src/main/java/de/mkammerer/argon2/Argon2Helper.java#L83-L87 |
leancloud/java-sdk-all | realtime/src/main/java/cn/leancloud/session/AVDefaultConnectionListener.java | AVDefaultConnectionListener.processConversationDeliveredAt | private void processConversationDeliveredAt(String conversationId, int convType, long timestamp) {
"""
处理 v2 版本中 conversation 的 deliveredAt 事件
@param conversationId
@param timestamp
"""
AVConversationHolder conversation = session.getConversationHolder(conversationId, convType);
conversation.onConvers... | java | private void processConversationDeliveredAt(String conversationId, int convType, long timestamp) {
AVConversationHolder conversation = session.getConversationHolder(conversationId, convType);
conversation.onConversationDeliveredAtEvent(timestamp);
} | [
"private",
"void",
"processConversationDeliveredAt",
"(",
"String",
"conversationId",
",",
"int",
"convType",
",",
"long",
"timestamp",
")",
"{",
"AVConversationHolder",
"conversation",
"=",
"session",
".",
"getConversationHolder",
"(",
"conversationId",
",",
"convType"... | 处理 v2 版本中 conversation 的 deliveredAt 事件
@param conversationId
@param timestamp | [
"处理",
"v2",
"版本中",
"conversation",
"的",
"deliveredAt",
"事件"
] | train | https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/realtime/src/main/java/cn/leancloud/session/AVDefaultConnectionListener.java#L539-L542 |
jwtk/jjwt | api/src/main/java/io/jsonwebtoken/lang/Assert.java | Assert.noNullElements | public static void noNullElements(Object[] array, String message) {
"""
Assert that an array has no null elements.
Note: Does not complain if the array is empty!
<pre class="code">Assert.noNullElements(array, "The array must have non-null elements");</pre>
@param array the array to check
@param message the exc... | java | public static void noNullElements(Object[] array, String message) {
if (array != null) {
for (int i = 0; i < array.length; i++) {
if (array[i] == null) {
throw new IllegalArgumentException(message);
}
}
}
} | [
"public",
"static",
"void",
"noNullElements",
"(",
"Object",
"[",
"]",
"array",
",",
"String",
"message",
")",
"{",
"if",
"(",
"array",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++... | Assert that an array has no null elements.
Note: Does not complain if the array is empty!
<pre class="code">Assert.noNullElements(array, "The array must have non-null elements");</pre>
@param array the array to check
@param message the exception message to use if the assertion fails
@throws IllegalArgumentException if ... | [
"Assert",
"that",
"an",
"array",
"has",
"no",
"null",
"elements",
".",
"Note",
":",
"Does",
"not",
"complain",
"if",
"the",
"array",
"is",
"empty!",
"<pre",
"class",
"=",
"code",
">",
"Assert",
".",
"noNullElements",
"(",
"array",
"The",
"array",
"must",... | train | https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Assert.java#L213-L221 |
alkacon/opencms-core | src/org/opencms/i18n/CmsLocaleGroup.java | CmsLocaleGroup.getResourcesByLocale | public Map<Locale, CmsResource> getResourcesByLocale() {
"""
Gets a map which contains the resources of the locale group as keys, indexed by their locale.<p>
If the locale group contains more than one resource from the same locale,, which one is used a map value is undefined.
@return the map of resources by ... | java | public Map<Locale, CmsResource> getResourcesByLocale() {
List<CmsResource> resources = Lists.newArrayList();
resources.add(m_primaryResource);
resources.addAll(m_secondaryResources);
Collections.sort(resources, new Comparator<CmsResource>() {
public int compare(CmsResource ... | [
"public",
"Map",
"<",
"Locale",
",",
"CmsResource",
">",
"getResourcesByLocale",
"(",
")",
"{",
"List",
"<",
"CmsResource",
">",
"resources",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"resources",
".",
"add",
"(",
"m_primaryResource",
")",
";",
"re... | Gets a map which contains the resources of the locale group as keys, indexed by their locale.<p>
If the locale group contains more than one resource from the same locale,, which one is used a map value is undefined.
@return the map of resources by locale | [
"Gets",
"a",
"map",
"which",
"contains",
"the",
"resources",
"of",
"the",
"locale",
"group",
"as",
"keys",
"indexed",
"by",
"their",
"locale",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsLocaleGroup.java#L138-L159 |
openbase/jul | communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java | AbstractRemoteClient.callMethod | @Override
public <R, T extends Object> R callMethod(final String methodName, final T argument) throws CouldNotPerformException, InterruptedException {
"""
{@inheritDoc}
@throws org.openbase.jul.exception.CouldNotPerformException {@inheritDoc}
@throws java.lang.InterruptedException {@in... | java | @Override
public <R, T extends Object> R callMethod(final String methodName, final T argument) throws CouldNotPerformException, InterruptedException {
return callMethod(methodName, argument, -1);
} | [
"@",
"Override",
"public",
"<",
"R",
",",
"T",
"extends",
"Object",
">",
"R",
"callMethod",
"(",
"final",
"String",
"methodName",
",",
"final",
"T",
"argument",
")",
"throws",
"CouldNotPerformException",
",",
"InterruptedException",
"{",
"return",
"callMethod",
... | {@inheritDoc}
@throws org.openbase.jul.exception.CouldNotPerformException {@inheritDoc}
@throws java.lang.InterruptedException {@inheritDoc} | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java#L740-L743 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getImplodedMapped | @Nonnull
public static <ELEMENTTYPE> String getImplodedMapped (@Nonnull final String sSep,
@Nullable final ELEMENTTYPE [] aElements,
@Nonnull final Function <? super ELEMENTTYPE, String> aMapper) {
"""
... | java | @Nonnull
public static <ELEMENTTYPE> String getImplodedMapped (@Nonnull final String sSep,
@Nullable final ELEMENTTYPE [] aElements,
@Nonnull final Function <? super ELEMENTTYPE, String> aMapper)
{
Va... | [
"@",
"Nonnull",
"public",
"static",
"<",
"ELEMENTTYPE",
">",
"String",
"getImplodedMapped",
"(",
"@",
"Nonnull",
"final",
"String",
"sSep",
",",
"@",
"Nullable",
"final",
"ELEMENTTYPE",
"[",
"]",
"aElements",
",",
"@",
"Nonnull",
"final",
"Function",
"<",
"?... | Get a concatenated String from all elements of the passed array, separated by
the specified separator string.
@param sSep
The separator to use. May not be <code>null</code>.
@param aElements
The container to convert. May be <code>null</code> or empty.
@param aMapper
The mapping function to convert from ELEMENTTYPE to ... | [
"Get",
"a",
"concatenated",
"String",
"from",
"all",
"elements",
"of",
"the",
"passed",
"array",
"separated",
"by",
"the",
"specified",
"separator",
"string",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L1335-L1346 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/query/QueryImpl.java | QueryImpl.findUsingLucene | private List<Object> findUsingLucene(EntityMetadata m, Client client, Object[] primaryKeys) {
"""
find data using lucene.
@param m
the m
@param client
the client
@param primaryKeys
the primary keys
@return the list
"""
String idField = m.getIdAttribute().getName();
String equals = "="... | java | private List<Object> findUsingLucene(EntityMetadata m, Client client, Object[] primaryKeys)
{
String idField = m.getIdAttribute().getName();
String equals = "=";
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
m.getPersistence... | [
"private",
"List",
"<",
"Object",
">",
"findUsingLucene",
"(",
"EntityMetadata",
"m",
",",
"Client",
"client",
",",
"Object",
"[",
"]",
"primaryKeys",
")",
"{",
"String",
"idField",
"=",
"m",
".",
"getIdAttribute",
"(",
")",
".",
"getName",
"(",
")",
";"... | find data using lucene.
@param m
the m
@param client
the client
@param primaryKeys
the primary keys
@return the list | [
"find",
"data",
"using",
"lucene",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/query/QueryImpl.java#L375-L399 |
census-instrumentation/opencensus-java | contrib/zpages/src/main/java/io/opencensus/contrib/zpages/TracezZPageHandler.java | TracezZPageHandler.create | static TracezZPageHandler create(
@javax.annotation.Nullable RunningSpanStore runningSpanStore,
@javax.annotation.Nullable SampledSpanStore sampledSpanStore) {
"""
Constructs a new {@code TracezZPageHandler}.
@param runningSpanStore the instance of the {@code RunningSpanStore} to be used.
@param sa... | java | static TracezZPageHandler create(
@javax.annotation.Nullable RunningSpanStore runningSpanStore,
@javax.annotation.Nullable SampledSpanStore sampledSpanStore) {
return new TracezZPageHandler(runningSpanStore, sampledSpanStore);
} | [
"static",
"TracezZPageHandler",
"create",
"(",
"@",
"javax",
".",
"annotation",
".",
"Nullable",
"RunningSpanStore",
"runningSpanStore",
",",
"@",
"javax",
".",
"annotation",
".",
"Nullable",
"SampledSpanStore",
"sampledSpanStore",
")",
"{",
"return",
"new",
"Tracez... | Constructs a new {@code TracezZPageHandler}.
@param runningSpanStore the instance of the {@code RunningSpanStore} to be used.
@param sampledSpanStore the instance of the {@code SampledSpanStore} to be used.
@return a new {@code TracezZPageHandler}. | [
"Constructs",
"a",
"new",
"{",
"@code",
"TracezZPageHandler",
"}",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/zpages/src/main/java/io/opencensus/contrib/zpages/TracezZPageHandler.java#L145-L149 |
micrometer-metrics/micrometer | micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/ExecutorServiceMetrics.java | ExecutorServiceMetrics.monitor | public static Executor monitor(MeterRegistry registry, Executor executor, String executorName, Iterable<Tag> tags) {
"""
Record metrics on the use of an {@link Executor}.
@param registry The registry to bind metrics to.
@param executor The executor to instrument.
@param executorName Will be used to ta... | java | public static Executor monitor(MeterRegistry registry, Executor executor, String executorName, Iterable<Tag> tags) {
if (executor instanceof ExecutorService) {
return monitor(registry, (ExecutorService) executor, executorName, tags);
}
return new TimedExecutor(registry, executor, exe... | [
"public",
"static",
"Executor",
"monitor",
"(",
"MeterRegistry",
"registry",
",",
"Executor",
"executor",
",",
"String",
"executorName",
",",
"Iterable",
"<",
"Tag",
">",
"tags",
")",
"{",
"if",
"(",
"executor",
"instanceof",
"ExecutorService",
")",
"{",
"retu... | Record metrics on the use of an {@link Executor}.
@param registry The registry to bind metrics to.
@param executor The executor to instrument.
@param executorName Will be used to tag metrics with "name".
@param tags Tags to apply to all recorded metrics.
@return The instrumented executor, proxied. | [
"Record",
"metrics",
"on",
"the",
"use",
"of",
"an",
"{",
"@link",
"Executor",
"}",
"."
] | train | https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/ExecutorServiceMetrics.java#L62-L67 |
LableOrg/java-uniqueid | uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ClusterID.java | ClusterID.get | public static int get(ZooKeeper zookeeper, String znode) throws IOException {
"""
Retrieves the numeric cluster ID from the ZooKeeper quorum.
@param zookeeper ZooKeeper instance to work with.
@return The cluster ID, if configured in the quorum.
@throws IOException Thrown when retrieving the ID fails... | java | public static int get(ZooKeeper zookeeper, String znode) throws IOException {
try {
Stat stat = zookeeper.exists(znode + CLUSTER_ID_NODE, false);
if (stat == null) {
mkdirp(zookeeper, znode);
create(zookeeper, znode + CLUSTER_ID_NODE, String.valueOf(DEFAUL... | [
"public",
"static",
"int",
"get",
"(",
"ZooKeeper",
"zookeeper",
",",
"String",
"znode",
")",
"throws",
"IOException",
"{",
"try",
"{",
"Stat",
"stat",
"=",
"zookeeper",
".",
"exists",
"(",
"znode",
"+",
"CLUSTER_ID_NODE",
",",
"false",
")",
";",
"if",
"... | Retrieves the numeric cluster ID from the ZooKeeper quorum.
@param zookeeper ZooKeeper instance to work with.
@return The cluster ID, if configured in the quorum.
@throws IOException Thrown when retrieving the ID fails.
@throws NumberFormatException Thrown when the supposed ID found in the quorum could not b... | [
"Retrieves",
"the",
"numeric",
"cluster",
"ID",
"from",
"the",
"ZooKeeper",
"quorum",
"."
] | train | https://github.com/LableOrg/java-uniqueid/blob/554e30b2277765f365e7c7f598108de0ab5744f4/uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ClusterID.java#L43-L60 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/ui/CmsResultListItem.java | CmsResultListItem.createDeleteButton | public static CmsPushButton createDeleteButton() {
"""
Creates the delete button for this item.<p>
@return the delete button
"""
return createButton(I_CmsButton.TRASH_SMALL, Messages.get().key(Messages.GUI_RESULT_BUTTON_DELETE_0));
} | java | public static CmsPushButton createDeleteButton() {
return createButton(I_CmsButton.TRASH_SMALL, Messages.get().key(Messages.GUI_RESULT_BUTTON_DELETE_0));
} | [
"public",
"static",
"CmsPushButton",
"createDeleteButton",
"(",
")",
"{",
"return",
"createButton",
"(",
"I_CmsButton",
".",
"TRASH_SMALL",
",",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_RESULT_BUTTON_DELETE_0",
")",
")",
";",
"}... | Creates the delete button for this item.<p>
@return the delete button | [
"Creates",
"the",
"delete",
"button",
"for",
"this",
"item",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsResultListItem.java#L127-L130 |
KyoriPowered/text | api/src/main/java/net/kyori/text/event/ClickEvent.java | ClickEvent.suggestCommand | public static @NonNull ClickEvent suggestCommand(final @NonNull String command) {
"""
Creates a click event that suggests a command.
@param command the command to suggest
@return a click event
"""
return new ClickEvent(Action.SUGGEST_COMMAND, command);
} | java | public static @NonNull ClickEvent suggestCommand(final @NonNull String command) {
return new ClickEvent(Action.SUGGEST_COMMAND, command);
} | [
"public",
"static",
"@",
"NonNull",
"ClickEvent",
"suggestCommand",
"(",
"final",
"@",
"NonNull",
"String",
"command",
")",
"{",
"return",
"new",
"ClickEvent",
"(",
"Action",
".",
"SUGGEST_COMMAND",
",",
"command",
")",
";",
"}"
] | Creates a click event that suggests a command.
@param command the command to suggest
@return a click event | [
"Creates",
"a",
"click",
"event",
"that",
"suggests",
"a",
"command",
"."
] | train | https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/event/ClickEvent.java#L86-L88 |
h2oai/h2o-3 | h2o-core/src/main/java/hex/Distribution.java | Distribution.gammaNum | public double gammaNum(double w, double y, double z, double f) {
"""
Contribution to numerator for GBM's leaf node prediction
@param w weight
@param y response
@param z residual
@param f predicted value (including offset)
@return weighted contribution to numerator
"""
switch (distribution) {
cas... | java | public double gammaNum(double w, double y, double z, double f) {
switch (distribution) {
case gaussian:
case bernoulli:
case quasibinomial:
case multinomial:
return w * z;
case poisson:
return w * y;
case gamma:
return w * (z+1); //z+1 == y*exp(-f)
c... | [
"public",
"double",
"gammaNum",
"(",
"double",
"w",
",",
"double",
"y",
",",
"double",
"z",
",",
"double",
"f",
")",
"{",
"switch",
"(",
"distribution",
")",
"{",
"case",
"gaussian",
":",
"case",
"bernoulli",
":",
"case",
"quasibinomial",
":",
"case",
... | Contribution to numerator for GBM's leaf node prediction
@param w weight
@param y response
@param z residual
@param f predicted value (including offset)
@return weighted contribution to numerator | [
"Contribution",
"to",
"numerator",
"for",
"GBM",
"s",
"leaf",
"node",
"prediction"
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/hex/Distribution.java#L260-L281 |
beihaifeiwu/dolphin | dolphin-common/src/main/java/com/freetmp/common/type/ResolvableType.java | ResolvableType.forMethodParameter | public static ResolvableType forMethodParameter(MethodParameter methodParameter, ResolvableType implementationType) {
"""
Return a {@link ResolvableType} for the specified {@link MethodParameter} with a
given implementation type. Use this variant when the class that declares the method
includes generic parameter... | java | public static ResolvableType forMethodParameter(MethodParameter methodParameter, ResolvableType implementationType) {
Assert.notNull(methodParameter, "MethodParameter must not be null");
implementationType = (implementationType == null ? forType(methodParameter.getContainingClass()) : implementationType);
Resolva... | [
"public",
"static",
"ResolvableType",
"forMethodParameter",
"(",
"MethodParameter",
"methodParameter",
",",
"ResolvableType",
"implementationType",
")",
"{",
"Assert",
".",
"notNull",
"(",
"methodParameter",
",",
"\"MethodParameter must not be null\"",
")",
";",
"implementa... | Return a {@link ResolvableType} for the specified {@link MethodParameter} with a
given implementation type. Use this variant when the class that declares the method
includes generic parameter variables that are satisfied by the implementation type.
@param methodParameter the source method parameter (must not be {@code ... | [
"Return",
"a",
"{"
] | train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/type/ResolvableType.java#L1100-L1107 |
palaima/DebugDrawer | debugdrawer-commons/src/main/java/io/palaima/debugdrawer/commons/NetworkModule.java | NetworkModule.setMobileNetworkEnabled | private boolean setMobileNetworkEnabled(ConnectivityManager connectivityManager, boolean enabled) {
"""
http://stackoverflow.com/questions/11555366/enable-disable-data-connection-in-android-programmatically
Try to enabled/disable mobile network state using reflection.
Returns true if succeeded
@param enabled
... | java | private boolean setMobileNetworkEnabled(ConnectivityManager connectivityManager, boolean enabled) {
try {
final Class conmanClass = Class.forName(connectivityManager.getClass().getName());
final Field iConnectivityManagerField = conmanClass.getDeclaredField("mService");
iConn... | [
"private",
"boolean",
"setMobileNetworkEnabled",
"(",
"ConnectivityManager",
"connectivityManager",
",",
"boolean",
"enabled",
")",
"{",
"try",
"{",
"final",
"Class",
"conmanClass",
"=",
"Class",
".",
"forName",
"(",
"connectivityManager",
".",
"getClass",
"(",
")",... | http://stackoverflow.com/questions/11555366/enable-disable-data-connection-in-android-programmatically
Try to enabled/disable mobile network state using reflection.
Returns true if succeeded
@param enabled | [
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"11555366",
"/",
"enable",
"-",
"disable",
"-",
"data",
"-",
"connection",
"-",
"in",
"-",
"android",
"-",
"programmatically",
"Try",
"to",
"enabled",
"/",
"disable",
"mobile",
"network... | train | https://github.com/palaima/DebugDrawer/blob/49b5992a1148757bd740c4a0b7df10ef70ade6d8/debugdrawer-commons/src/main/java/io/palaima/debugdrawer/commons/NetworkModule.java#L132-L150 |
alkacon/opencms-core | src-gwt/org/opencms/ade/editprovider/client/CmsDirectEditButtons.java | CmsDirectEditButtons.setPosition | public void setPosition(CmsPositionBean position, CmsPositionBean buttonsPosition, Element containerElement) {
"""
Sets the position. Make sure the widget is attached to the DOM.<p>
@param position the absolute position
@param buttonsPosition the corrected position for the buttons
@param containerElement th... | java | public void setPosition(CmsPositionBean position, CmsPositionBean buttonsPosition, Element containerElement) {
m_position = position;
Element parent = CmsDomUtil.getPositioningParent(getElement());
Style style = getElement().getStyle();
style.setRight(
parent.getOffsetWidth(... | [
"public",
"void",
"setPosition",
"(",
"CmsPositionBean",
"position",
",",
"CmsPositionBean",
"buttonsPosition",
",",
"Element",
"containerElement",
")",
"{",
"m_position",
"=",
"position",
";",
"Element",
"parent",
"=",
"CmsDomUtil",
".",
"getPositioningParent",
"(",
... | Sets the position. Make sure the widget is attached to the DOM.<p>
@param position the absolute position
@param buttonsPosition the corrected position for the buttons
@param containerElement the parent container element | [
"Sets",
"the",
"position",
".",
"Make",
"sure",
"the",
"widget",
"is",
"attached",
"to",
"the",
"DOM",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/editprovider/client/CmsDirectEditButtons.java#L89-L103 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java | ReflectUtil.getSetter | public static Method getSetter(String fieldName, Class<?> clazz, Class<?> fieldType) {
"""
Returns the setter-method for the given field name or null if no setter exists.
"""
String setterName = buildSetterName(fieldName);
try {
// Using getMathods(), getMathod(...) expects exact parameter type
... | java | public static Method getSetter(String fieldName, Class<?> clazz, Class<?> fieldType) {
String setterName = buildSetterName(fieldName);
try {
// Using getMathods(), getMathod(...) expects exact parameter type
// matching and ignores inheritance-tree.
Method[] methods = clazz.getMethods();
... | [
"public",
"static",
"Method",
"getSetter",
"(",
"String",
"fieldName",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"?",
">",
"fieldType",
")",
"{",
"String",
"setterName",
"=",
"buildSetterName",
"(",
"fieldName",
")",
";",
"try",
"{",
"// U... | Returns the setter-method for the given field name or null if no setter exists. | [
"Returns",
"the",
"setter",
"-",
"method",
"for",
"the",
"given",
"field",
"name",
"or",
"null",
"if",
"no",
"setter",
"exists",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java#L254-L273 |
nextreports/nextreports-server | src/ro/nextreports/server/aop/MethodProfilerAdvice.java | MethodProfilerAdvice.profileMethod | @Around("isProfileAnnotation(profile)")
public Object profileMethod(ProceedingJoinPoint joinPoint, Profile profile) throws Throwable {
"""
Intercepts methods that declare Profile annotation and prints out the time it takes to complete/
@param joinPoint proceeding join point
@return the intercepted method retu... | java | @Around("isProfileAnnotation(profile)")
public Object profileMethod(ProceedingJoinPoint joinPoint, Profile profile) throws Throwable {
String logPrefix = null;
boolean debug = LOG.isDebugEnabled();
long time = System.currentTimeMillis();
// parse out the first arg
String arg1 = "";
Object[] args = joinPo... | [
"@",
"Around",
"(",
"\"isProfileAnnotation(profile)\"",
")",
"public",
"Object",
"profileMethod",
"(",
"ProceedingJoinPoint",
"joinPoint",
",",
"Profile",
"profile",
")",
"throws",
"Throwable",
"{",
"String",
"logPrefix",
"=",
"null",
";",
"boolean",
"debug",
"=",
... | Intercepts methods that declare Profile annotation and prints out the time it takes to complete/
@param joinPoint proceeding join point
@return the intercepted method returned object
@throws Throwable in case something goes wrong in the actual method call | [
"Intercepts",
"methods",
"that",
"declare",
"Profile",
"annotation",
"and",
"prints",
"out",
"the",
"time",
"it",
"takes",
"to",
"complete",
"/"
] | train | https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/aop/MethodProfilerAdvice.java#L45-L69 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/DateTimeFormatter.java | DateTimeFormatter.parseDateTime | public DateTime parseDateTime(String text) {
"""
Parses a date-time from the given text, returning a new DateTime.
<p>
The parse will use the zone and chronology specified on this formatter.
<p>
If the text contains a time zone string then that will be taken into
account in adjusting the time of day as follow... | java | public DateTime parseDateTime(String text) {
InternalParser parser = requireParser();
Chronology chrono = selectChronology(null);
DateTimeParserBucket bucket = new DateTimeParserBucket(0, chrono, iLocale, iPivotYear, iDefaultYear);
int newPos = parser.parseInto(bucket, text, 0);... | [
"public",
"DateTime",
"parseDateTime",
"(",
"String",
"text",
")",
"{",
"InternalParser",
"parser",
"=",
"requireParser",
"(",
")",
";",
"Chronology",
"chrono",
"=",
"selectChronology",
"(",
"null",
")",
";",
"DateTimeParserBucket",
"bucket",
"=",
"new",
"DateTi... | Parses a date-time from the given text, returning a new DateTime.
<p>
The parse will use the zone and chronology specified on this formatter.
<p>
If the text contains a time zone string then that will be taken into
account in adjusting the time of day as follows.
If the {@link #withOffsetParsed()} has been called, then... | [
"Parses",
"a",
"date",
"-",
"time",
"from",
"the",
"given",
"text",
"returning",
"a",
"new",
"DateTime",
".",
"<p",
">",
"The",
"parse",
"will",
"use",
"the",
"zone",
"and",
"chronology",
"specified",
"on",
"this",
"formatter",
".",
"<p",
">",
"If",
"t... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormatter.java#L920-L946 |
poetix/protonpack | src/main/java/com/codepoetics/protonpack/collectors/CollectorUtils.java | CollectorUtils.maxBy | public static <T, Y extends Comparable<Y>> Collector<T, ?, Optional<T>> maxBy(Function<T, Y> projection) {
"""
Find the item for which the supplied projection returns the maximum value.
@param projection The projection to apply to each item.
@param <T> The type of each item.
@param <Y> The type of the projected... | java | public static <T, Y extends Comparable<Y>> Collector<T, ?, Optional<T>> maxBy(Function<T, Y> projection) {
return maxBy(projection, Comparable::compareTo);
} | [
"public",
"static",
"<",
"T",
",",
"Y",
"extends",
"Comparable",
"<",
"Y",
">",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"Optional",
"<",
"T",
">",
">",
"maxBy",
"(",
"Function",
"<",
"T",
",",
"Y",
">",
"projection",
")",
"{",
"return",
"maxBy... | Find the item for which the supplied projection returns the maximum value.
@param projection The projection to apply to each item.
@param <T> The type of each item.
@param <Y> The type of the projected value to compare on.
@return The collector. | [
"Find",
"the",
"item",
"for",
"which",
"the",
"supplied",
"projection",
"returns",
"the",
"maximum",
"value",
"."
] | train | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/collectors/CollectorUtils.java#L26-L28 |
jbundle/webapp | base/src/main/java/org/jbundle/util/webapp/base/HttpServiceActivator.java | HttpServiceActivator.createServiceTracker | public HttpServiceTracker createServiceTracker(BundleContext context, HttpContext httpContext, Dictionary<String, String> dictionary) {
"""
Create the service tracker.
@param context
@param httpContext
@param dictionary
@return
"""
if (httpContext == null)
httpContext = getHttpContext()... | java | public HttpServiceTracker createServiceTracker(BundleContext context, HttpContext httpContext, Dictionary<String, String> dictionary)
{
if (httpContext == null)
httpContext = getHttpContext();
return new HttpServiceTracker(context, httpContext, dictionary);
} | [
"public",
"HttpServiceTracker",
"createServiceTracker",
"(",
"BundleContext",
"context",
",",
"HttpContext",
"httpContext",
",",
"Dictionary",
"<",
"String",
",",
"String",
">",
"dictionary",
")",
"{",
"if",
"(",
"httpContext",
"==",
"null",
")",
"httpContext",
"=... | Create the service tracker.
@param context
@param httpContext
@param dictionary
@return | [
"Create",
"the",
"service",
"tracker",
"."
] | train | https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/base/src/main/java/org/jbundle/util/webapp/base/HttpServiceActivator.java#L73-L78 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java | Error.xmlConversionTypeIncorrect | public static void xmlConversionTypeIncorrect(String conversionName,String xmlPath,String className,String type) {
"""
Thrown if conversion type is wrong.
@param conversionName conversion name
@param xmlPath xml path
@param className class name
@param type type
"""
throw new XmlConversionTypeException(M... | java | public static void xmlConversionTypeIncorrect(String conversionName,String xmlPath,String className,String type){
throw new XmlConversionTypeException(MSG.INSTANCE.message(xmlConversionTypeException,conversionName,xmlPath,className,type));
} | [
"public",
"static",
"void",
"xmlConversionTypeIncorrect",
"(",
"String",
"conversionName",
",",
"String",
"xmlPath",
",",
"String",
"className",
",",
"String",
"type",
")",
"{",
"throw",
"new",
"XmlConversionTypeException",
"(",
"MSG",
".",
"INSTANCE",
".",
"messa... | Thrown if conversion type is wrong.
@param conversionName conversion name
@param xmlPath xml path
@param className class name
@param type type | [
"Thrown",
"if",
"conversion",
"type",
"is",
"wrong",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L338-L340 |
Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/metastore/rocks/RocksUtils.java | RocksUtils.generateDbPath | public static String generateDbPath(String baseDir, String dbName) {
"""
Generates a path to use for a RocksDB database.
@param baseDir the base directory path
@param dbName a name for the database
@return the generated database path
"""
return PathUtils.concatPath(baseDir, dbName);
} | java | public static String generateDbPath(String baseDir, String dbName) {
return PathUtils.concatPath(baseDir, dbName);
} | [
"public",
"static",
"String",
"generateDbPath",
"(",
"String",
"baseDir",
",",
"String",
"dbName",
")",
"{",
"return",
"PathUtils",
".",
"concatPath",
"(",
"baseDir",
",",
"dbName",
")",
";",
"}"
] | Generates a path to use for a RocksDB database.
@param baseDir the base directory path
@param dbName a name for the database
@return the generated database path | [
"Generates",
"a",
"path",
"to",
"use",
"for",
"a",
"RocksDB",
"database",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/metastore/rocks/RocksUtils.java#L32-L34 |
couchbase/CouchbaseMock | src/main/java/com/couchbase/mock/httpio/HandlerUtil.java | HandlerUtil.bailResponse | public static void bailResponse(HttpContext cx, HttpResponse response) throws IOException, HttpException {
"""
Send and flush the response object over the current connection and close the connection
@param cx The context
@param response The response object
@throws IOException if an I/O error occurs
@throws Htt... | java | public static void bailResponse(HttpContext cx, HttpResponse response) throws IOException, HttpException {
HttpServerConnection conn = getConnection(cx);
conn.sendResponseHeader(response);
conn.sendResponseEntity(response);
conn.flush();
} | [
"public",
"static",
"void",
"bailResponse",
"(",
"HttpContext",
"cx",
",",
"HttpResponse",
"response",
")",
"throws",
"IOException",
",",
"HttpException",
"{",
"HttpServerConnection",
"conn",
"=",
"getConnection",
"(",
"cx",
")",
";",
"conn",
".",
"sendResponseHea... | Send and flush the response object over the current connection and close the connection
@param cx The context
@param response The response object
@throws IOException if an I/O error occurs
@throws HttpException if a http error occurs | [
"Send",
"and",
"flush",
"the",
"response",
"object",
"over",
"the",
"current",
"connection",
"and",
"close",
"the",
"connection"
] | train | https://github.com/couchbase/CouchbaseMock/blob/2085bbebade1d5b6356480e7bf335139d08383da/src/main/java/com/couchbase/mock/httpio/HandlerUtil.java#L191-L196 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RunnableUtils.java | RunnableUtils.runWithSleepThrowOnInterrupt | public static boolean runWithSleepThrowOnInterrupt(long milliseconds, Runnable runnable) {
"""
Runs the given {@link Runnable} object and then causes the current, calling {@link Thread} to sleep
for the given number of milliseconds.
This utility method can be used to simulate a long running, expensive operatio... | java | public static boolean runWithSleepThrowOnInterrupt(long milliseconds, Runnable runnable) {
Assert.isTrue(milliseconds > 0, "Milliseconds [%d] must be greater than 0", milliseconds);
runnable.run();
if (!ThreadUtils.sleep(milliseconds, 0)) {
throw new SleepDeprivedException(String.format("Failed to ... | [
"public",
"static",
"boolean",
"runWithSleepThrowOnInterrupt",
"(",
"long",
"milliseconds",
",",
"Runnable",
"runnable",
")",
"{",
"Assert",
".",
"isTrue",
"(",
"milliseconds",
">",
"0",
",",
"\"Milliseconds [%d] must be greater than 0\"",
",",
"milliseconds",
")",
";... | Runs the given {@link Runnable} object and then causes the current, calling {@link Thread} to sleep
for the given number of milliseconds.
This utility method can be used to simulate a long running, expensive operation.
@param milliseconds a long value with the number of milliseconds for the current {@link Thread} to ... | [
"Runs",
"the",
"given",
"{",
"@link",
"Runnable",
"}",
"object",
"and",
"then",
"causes",
"the",
"current",
"calling",
"{",
"@link",
"Thread",
"}",
"to",
"sleep",
"for",
"the",
"given",
"number",
"of",
"milliseconds",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RunnableUtils.java#L74-L85 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.takesArgument | public static <T extends MethodDescription> ElementMatcher.Junction<T> takesArgument(int index, TypeDescription type) {
"""
Matches {@link MethodDescription}s that define a given type erasure as a parameter at the given index.
@param index The index of the parameter.
@param type The erasure of the type the ma... | java | public static <T extends MethodDescription> ElementMatcher.Junction<T> takesArgument(int index, TypeDescription type) {
return takesArgument(index, is(type));
} | [
"public",
"static",
"<",
"T",
"extends",
"MethodDescription",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"takesArgument",
"(",
"int",
"index",
",",
"TypeDescription",
"type",
")",
"{",
"return",
"takesArgument",
"(",
"index",
",",
"is",
"(",
"typ... | Matches {@link MethodDescription}s that define a given type erasure as a parameter at the given index.
@param index The index of the parameter.
@param type The erasure of the type the matched method is expected to define as a parameter type.
@param <T> The type of the matched object.
@return An element matcher that... | [
"Matches",
"{",
"@link",
"MethodDescription",
"}",
"s",
"that",
"define",
"a",
"given",
"type",
"erasure",
"as",
"a",
"parameter",
"at",
"the",
"given",
"index",
"."
] | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L1254-L1256 |
elki-project/elki | elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/datasource/bundle/MultipleObjectsBundle.java | MultipleObjectsBundle.makeSimple | public static <V> MultipleObjectsBundle makeSimple(SimpleTypeInformation<? super V> type, List<? extends V> data) {
"""
Helper to add a single column to the bundle.
@param <V> Object type
@param type Type information
@param data Data to add
"""
MultipleObjectsBundle bundle = new MultipleObjectsBundle(... | java | public static <V> MultipleObjectsBundle makeSimple(SimpleTypeInformation<? super V> type, List<? extends V> data) {
MultipleObjectsBundle bundle = new MultipleObjectsBundle();
bundle.appendColumn(type, data);
return bundle;
} | [
"public",
"static",
"<",
"V",
">",
"MultipleObjectsBundle",
"makeSimple",
"(",
"SimpleTypeInformation",
"<",
"?",
"super",
"V",
">",
"type",
",",
"List",
"<",
"?",
"extends",
"V",
">",
"data",
")",
"{",
"MultipleObjectsBundle",
"bundle",
"=",
"new",
"Multipl... | Helper to add a single column to the bundle.
@param <V> Object type
@param type Type information
@param data Data to add | [
"Helper",
"to",
"add",
"a",
"single",
"column",
"to",
"the",
"bundle",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/datasource/bundle/MultipleObjectsBundle.java#L174-L178 |
mapcode-foundation/mapcode-java | src/main/java/com/mapcode/MapcodeCodec.java | MapcodeCodec.encodeRestrictToCountryISO3 | @Nonnull
public static List<Mapcode> encodeRestrictToCountryISO3(final double latDeg, final double lonDeg,
@Nonnull final String countryISO3)
throws IllegalArgumentException {
"""
Encode a lat/lon pair to a list of mapcodes, like {@link #e... | java | @Nonnull
public static List<Mapcode> encodeRestrictToCountryISO3(final double latDeg, final double lonDeg,
@Nonnull final String countryISO3)
throws IllegalArgumentException {
checkNonnull("countryISO3", countryISO3);
return enc... | [
"@",
"Nonnull",
"public",
"static",
"List",
"<",
"Mapcode",
">",
"encodeRestrictToCountryISO3",
"(",
"final",
"double",
"latDeg",
",",
"final",
"double",
"lonDeg",
",",
"@",
"Nonnull",
"final",
"String",
"countryISO3",
")",
"throws",
"IllegalArgumentException",
"{... | Encode a lat/lon pair to a list of mapcodes, like {@link #encode(double, double)}.
The result list is limited to those mapcodes that belong to the provided ISO 3166 country code, 3 characters.
For example, if you wish to restrict the list to Mexican mapcodes, use "MEX". This would
produce a result list of mapcodes with... | [
"Encode",
"a",
"lat",
"/",
"lon",
"pair",
"to",
"a",
"list",
"of",
"mapcodes",
"like",
"{",
"@link",
"#encode",
"(",
"double",
"double",
")",
"}",
".",
"The",
"result",
"list",
"is",
"limited",
"to",
"those",
"mapcodes",
"that",
"belong",
"to",
"the",
... | train | https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/MapcodeCodec.java#L173-L179 |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/util/StringUtilities.java | StringUtilities.removeControlCharacters | public static String removeControlCharacters(String s, boolean removeCR) {
"""
Remove any extraneous control characters from text fields.
@param s The string to have control characters removed
@param removeCR <CODE>true</CODE> if carriage returns should be removed
@return The given string with all control chara... | java | public static String removeControlCharacters(String s, boolean removeCR)
{
String ret = s;
if(ret != null)
{
ret = ret.replaceAll("_x000D_","");
if(removeCR)
ret = ret.replaceAll("\r","");
}
return ret;
} | [
"public",
"static",
"String",
"removeControlCharacters",
"(",
"String",
"s",
",",
"boolean",
"removeCR",
")",
"{",
"String",
"ret",
"=",
"s",
";",
"if",
"(",
"ret",
"!=",
"null",
")",
"{",
"ret",
"=",
"ret",
".",
"replaceAll",
"(",
"\"_x000D_\"",
",",
... | Remove any extraneous control characters from text fields.
@param s The string to have control characters removed
@param removeCR <CODE>true</CODE> if carriage returns should be removed
@return The given string with all control characters removed | [
"Remove",
"any",
"extraneous",
"control",
"characters",
"from",
"text",
"fields",
"."
] | train | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/StringUtilities.java#L538-L548 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/TokenizerHelper.java | TokenizerHelper.jsonToTokenizer | public static Tokenizer jsonToTokenizer(String json) {
"""
Convert serialized options into Tokenizer, or null if options not present
(this will be the case for JSON indexes)
@param json Serialized options, as stored in database
@return a {@link Tokenizer} representing these options, or null
"""
if... | java | public static Tokenizer jsonToTokenizer(String json) {
if (json != null) {
Map<String, Object> settingsMap = JSONUtils.deserialize(json.getBytes(Charset.forName
("UTF-8")));
if (settingsMap.containsKey(TOKENIZE) && settingsMap.get(TOKENIZE) instanceof String) {
... | [
"public",
"static",
"Tokenizer",
"jsonToTokenizer",
"(",
"String",
"json",
")",
"{",
"if",
"(",
"json",
"!=",
"null",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"settingsMap",
"=",
"JSONUtils",
".",
"deserialize",
"(",
"json",
".",
"getBytes",
"... | Convert serialized options into Tokenizer, or null if options not present
(this will be the case for JSON indexes)
@param json Serialized options, as stored in database
@return a {@link Tokenizer} representing these options, or null | [
"Convert",
"serialized",
"options",
"into",
"Tokenizer",
"or",
"null",
"if",
"options",
"not",
"present",
"(",
"this",
"will",
"be",
"the",
"case",
"for",
"JSON",
"indexes",
")"
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/TokenizerHelper.java#L56-L73 |
JRebirth/JRebirth | org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/service/impl/LoadEdtFileServiceImpl.java | LoadEdtFileServiceImpl.addEvent | private void addEvent(final List<JRebirthEvent> eventList, final String strLine) {
"""
Add an event to the event list.
@param eventList the list of events
@param strLine the string to use
"""
eventList.add(new JRebirthEventBase(strLine));
} | java | private void addEvent(final List<JRebirthEvent> eventList, final String strLine) {
eventList.add(new JRebirthEventBase(strLine));
} | [
"private",
"void",
"addEvent",
"(",
"final",
"List",
"<",
"JRebirthEvent",
">",
"eventList",
",",
"final",
"String",
"strLine",
")",
"{",
"eventList",
".",
"add",
"(",
"new",
"JRebirthEventBase",
"(",
"strLine",
")",
")",
";",
"}"
] | Add an event to the event list.
@param eventList the list of events
@param strLine the string to use | [
"Add",
"an",
"event",
"to",
"the",
"event",
"list",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/service/impl/LoadEdtFileServiceImpl.java#L108-L110 |
undertow-io/undertow | core/src/main/java/io/undertow/util/FlexBase64.java | FlexBase64.encodeStringURL | public static String encodeStringURL(byte[] source, int pos, int limit, boolean wrap) {
"""
Encodes a fixed and complete byte array into a Base64url String.
<p>This method is only useful for applications which require a String and have all data to be encoded up-front.
Note that byte arrays or buffers are almos... | java | public static String encodeStringURL(byte[] source, int pos, int limit, boolean wrap) {
return Encoder.encodeString(source, pos, limit, wrap, true);
} | [
"public",
"static",
"String",
"encodeStringURL",
"(",
"byte",
"[",
"]",
"source",
",",
"int",
"pos",
",",
"int",
"limit",
",",
"boolean",
"wrap",
")",
"{",
"return",
"Encoder",
".",
"encodeString",
"(",
"source",
",",
"pos",
",",
"limit",
",",
"wrap",
... | Encodes a fixed and complete byte array into a Base64url String.
<p>This method is only useful for applications which require a String and have all data to be encoded up-front.
Note that byte arrays or buffers are almost always a better storage choice. They consume half the memory and
can be reused (modified). In othe... | [
"Encodes",
"a",
"fixed",
"and",
"complete",
"byte",
"array",
"into",
"a",
"Base64url",
"String",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/FlexBase64.java#L212-L214 |
bramp/ffmpeg-cli-wrapper | src/main/java/net/bramp/ffmpeg/Preconditions.java | Preconditions.checkNotEmpty | public static String checkNotEmpty(String arg, @Nullable Object errorMessage) {
"""
Ensures the argument is not null, empty string, or just whitespace.
@param arg The argument
@param errorMessage The exception message to use if the check fails
@return The passed in argument if it is not blank
"""
bool... | java | public static String checkNotEmpty(String arg, @Nullable Object errorMessage) {
boolean empty = Strings.isNullOrEmpty(arg) || CharMatcher.whitespace().matchesAllOf(arg);
checkArgument(!empty, errorMessage);
return arg;
} | [
"public",
"static",
"String",
"checkNotEmpty",
"(",
"String",
"arg",
",",
"@",
"Nullable",
"Object",
"errorMessage",
")",
"{",
"boolean",
"empty",
"=",
"Strings",
".",
"isNullOrEmpty",
"(",
"arg",
")",
"||",
"CharMatcher",
".",
"whitespace",
"(",
")",
".",
... | Ensures the argument is not null, empty string, or just whitespace.
@param arg The argument
@param errorMessage The exception message to use if the check fails
@return The passed in argument if it is not blank | [
"Ensures",
"the",
"argument",
"is",
"not",
"null",
"empty",
"string",
"or",
"just",
"whitespace",
"."
] | train | https://github.com/bramp/ffmpeg-cli-wrapper/blob/3819b155edf9132acc75bb6af66dcef1b98c64b2/src/main/java/net/bramp/ffmpeg/Preconditions.java#L30-L34 |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/RdfSerializationExample.java | RdfSerializationExample.asynchronousOutputStream | public static OutputStream asynchronousOutputStream(
final OutputStream outputStream) throws IOException {
"""
Creates a separate thread for writing into the given output stream and
returns a pipe output stream that can be used to pass data to this
thread.
<p>
This code is inspired by
http://stackoverflow.... | java | public static OutputStream asynchronousOutputStream(
final OutputStream outputStream) throws IOException {
final int SIZE = 1024 * 1024 * 10;
final PipedOutputStream pos = new PipedOutputStream();
final PipedInputStream pis = new PipedInputStream(pos, SIZE);
new Thread(new Runnable() {
@Override
public... | [
"public",
"static",
"OutputStream",
"asynchronousOutputStream",
"(",
"final",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"final",
"int",
"SIZE",
"=",
"1024",
"*",
"1024",
"*",
"10",
";",
"final",
"PipedOutputStream",
"pos",
"=",
"new",
"P... | Creates a separate thread for writing into the given output stream and
returns a pipe output stream that can be used to pass data to this
thread.
<p>
This code is inspired by
http://stackoverflow.com/questions/12532073/gzipoutputstream
-that-does-its-compression-in-a-separate-thread
@param outputStream
the stream to w... | [
"Creates",
"a",
"separate",
"thread",
"for",
"writing",
"into",
"the",
"given",
"output",
"stream",
"and",
"returns",
"a",
"pipe",
"output",
"stream",
"that",
"can",
"be",
"used",
"to",
"pass",
"data",
"to",
"this",
"thread",
".",
"<p",
">",
"This",
"cod... | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/RdfSerializationExample.java#L130-L152 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.newHashSet | public static <T> HashSet<T> newHashSet(boolean isSorted, Enumeration<T> enumration) {
"""
新建一个HashSet
@param <T> 集合元素类型
@param isSorted 是否有序,有序返回 {@link LinkedHashSet},否则返回{@link HashSet}
@param enumration {@link Enumeration}
@return HashSet对象
@since 3.0.8
"""
if (null == enumration) {
return ne... | java | public static <T> HashSet<T> newHashSet(boolean isSorted, Enumeration<T> enumration) {
if (null == enumration) {
return newHashSet(isSorted, (T[]) null);
}
final HashSet<T> set = isSorted ? new LinkedHashSet<T>() : new HashSet<T>();
while (enumration.hasMoreElements()) {
set.add(enumration.nextEleme... | [
"public",
"static",
"<",
"T",
">",
"HashSet",
"<",
"T",
">",
"newHashSet",
"(",
"boolean",
"isSorted",
",",
"Enumeration",
"<",
"T",
">",
"enumration",
")",
"{",
"if",
"(",
"null",
"==",
"enumration",
")",
"{",
"return",
"newHashSet",
"(",
"isSorted",
... | 新建一个HashSet
@param <T> 集合元素类型
@param isSorted 是否有序,有序返回 {@link LinkedHashSet},否则返回{@link HashSet}
@param enumration {@link Enumeration}
@return HashSet对象
@since 3.0.8 | [
"新建一个HashSet"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L492-L501 |
xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.uncompressString | public static String uncompressString(byte[] input, int offset, int length)
throws IOException {
"""
Uncompress the input[offset, offset+length) as a String
@param input
@param offset
@param length
@return the uncompressed data
@throws IOException
"""
try {
return uncompr... | java | public static String uncompressString(byte[] input, int offset, int length)
throws IOException
{
try {
return uncompressString(input, offset, length, "UTF-8");
}
catch (UnsupportedEncodingException e) {
throw new IllegalStateException("UTF-8 decoder is not... | [
"public",
"static",
"String",
"uncompressString",
"(",
"byte",
"[",
"]",
"input",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"uncompressString",
"(",
"input",
",",
"offset",
",",
"length",
",",
"\"U... | Uncompress the input[offset, offset+length) as a String
@param input
@param offset
@param length
@return the uncompressed data
@throws IOException | [
"Uncompress",
"the",
"input",
"[",
"offset",
"offset",
"+",
"length",
")",
"as",
"a",
"String"
] | train | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L823-L832 |
mapsforge/mapsforge | mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java | MercatorProjection.latitudeToPixelYWithScaleFactor | public static double latitudeToPixelYWithScaleFactor(double latitude, double scaleFactor, int tileSize) {
"""
Converts a latitude coordinate (in degrees) to a pixel Y coordinate at a certain scale.
@param latitude the latitude coordinate that should be converted.
@param scaleFactor the scale factor at which... | java | public static double latitudeToPixelYWithScaleFactor(double latitude, double scaleFactor, int tileSize) {
double sinLatitude = Math.sin(latitude * (Math.PI / 180));
long mapSize = getMapSizeWithScaleFactor(scaleFactor, tileSize);
// FIXME improve this formula so that it works correctly without t... | [
"public",
"static",
"double",
"latitudeToPixelYWithScaleFactor",
"(",
"double",
"latitude",
",",
"double",
"scaleFactor",
",",
"int",
"tileSize",
")",
"{",
"double",
"sinLatitude",
"=",
"Math",
".",
"sin",
"(",
"latitude",
"*",
"(",
"Math",
".",
"PI",
"/",
"... | Converts a latitude coordinate (in degrees) to a pixel Y coordinate at a certain scale.
@param latitude the latitude coordinate that should be converted.
@param scaleFactor the scale factor at which the coordinate should be converted.
@return the pixel Y coordinate of the latitude value. | [
"Converts",
"a",
"latitude",
"coordinate",
"(",
"in",
"degrees",
")",
"to",
"a",
"pixel",
"Y",
"coordinate",
"at",
"a",
"certain",
"scale",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L186-L192 |
alkacon/opencms-core | src/org/opencms/ade/sitemap/CmsVfsSitemapService.java | CmsVfsSitemapService.generateInheritProperties | private List<CmsProperty> generateInheritProperties(CmsSitemapChange change, CmsResource entryFolder) {
"""
Generates a list of property object to save to the sitemap entry folder to apply the given change.<p>
@param change the change
@param entryFolder the entry folder
@return the property objects
"""
... | java | private List<CmsProperty> generateInheritProperties(CmsSitemapChange change, CmsResource entryFolder) {
List<CmsProperty> result = new ArrayList<CmsProperty>();
Map<String, CmsClientProperty> clientProps = change.getOwnInternalProperties();
boolean hasTitle = false;
if (clientProps != n... | [
"private",
"List",
"<",
"CmsProperty",
">",
"generateInheritProperties",
"(",
"CmsSitemapChange",
"change",
",",
"CmsResource",
"entryFolder",
")",
"{",
"List",
"<",
"CmsProperty",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"CmsProperty",
">",
"(",
")",
";",
... | Generates a list of property object to save to the sitemap entry folder to apply the given change.<p>
@param change the change
@param entryFolder the entry folder
@return the property objects | [
"Generates",
"a",
"list",
"of",
"property",
"object",
"to",
"save",
"to",
"the",
"sitemap",
"entry",
"folder",
"to",
"apply",
"the",
"given",
"change",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsVfsSitemapService.java#L2108-L2129 |
atomix/catalyst | serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java | Serializer.registerDefault | public Serializer registerDefault(Class<?> baseType, Class<? extends TypeSerializer> serializer) {
"""
Registers a default type serializer for the given base type.
<p>
Default serializers are used to serialize types for which no specific {@link TypeSerializer} is provided.
When a serializable type is {@link #re... | java | public Serializer registerDefault(Class<?> baseType, Class<? extends TypeSerializer> serializer) {
registry.registerDefault(baseType, serializer);
return this;
} | [
"public",
"Serializer",
"registerDefault",
"(",
"Class",
"<",
"?",
">",
"baseType",
",",
"Class",
"<",
"?",
"extends",
"TypeSerializer",
">",
"serializer",
")",
"{",
"registry",
".",
"registerDefault",
"(",
"baseType",
",",
"serializer",
")",
";",
"return",
... | Registers a default type serializer for the given base type.
<p>
Default serializers are used to serialize types for which no specific {@link TypeSerializer} is provided.
When a serializable type is {@link #register(Class) registered} without a {@link TypeSerializer}, the
first default serializer found for the given ty... | [
"Registers",
"a",
"default",
"type",
"serializer",
"for",
"the",
"given",
"base",
"type",
".",
"<p",
">",
"Default",
"serializers",
"are",
"used",
"to",
"serialize",
"types",
"for",
"which",
"no",
"specific",
"{",
"@link",
"TypeSerializer",
"}",
"is",
"provi... | train | https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java#L611-L614 |
JOML-CI/JOML | src/org/joml/Matrix4x3d.java | Matrix4x3d.translationRotateScaleMul | public Matrix4x3d translationRotateScaleMul(Vector3dc translation, Quaterniondc quat, Vector3dc scale, Matrix4x3dc m) {
"""
Set <code>this</code> matrix to <code>T * R * S * M</code>, where <code>T</code> is the given <code>translation</code>,
<code>R</code> is a rotation transformation specified by the given qua... | java | public Matrix4x3d translationRotateScaleMul(Vector3dc translation, Quaterniondc quat, Vector3dc scale, Matrix4x3dc m) {
return translationRotateScaleMul(translation.x(), translation.y(), translation.z(), quat.x(), quat.y(), quat.z(), quat.w(), scale.x(), scale.y(), scale.z(), m);
} | [
"public",
"Matrix4x3d",
"translationRotateScaleMul",
"(",
"Vector3dc",
"translation",
",",
"Quaterniondc",
"quat",
",",
"Vector3dc",
"scale",
",",
"Matrix4x3dc",
"m",
")",
"{",
"return",
"translationRotateScaleMul",
"(",
"translation",
".",
"x",
"(",
")",
",",
"tr... | Set <code>this</code> matrix to <code>T * R * S * M</code>, where <code>T</code> is the given <code>translation</code>,
<code>R</code> is a rotation transformation specified by the given quaternion, <code>S</code> is a scaling transformation
which scales the axes by <code>scale</code>.
<p>
When transforming a vector by... | [
"Set",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"to",
"<code",
">",
"T",
"*",
"R",
"*",
"S",
"*",
"M<",
"/",
"code",
">",
"where",
"<code",
">",
"T<",
"/",
"code",
">",
"is",
"the",
"given",
"<code",
">",
"translation<",
"/",
"code",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L5055-L5057 |
CenturyLinkCloud/clc-java-sdk | sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/GroupService.java | GroupService.findGroup | private GroupMetadata findGroup(GroupHierarchyConfig config, String parentGroupId) {
"""
Find group based on config instance and parent group identifier
@param config group hierarchy config
@param parentGroupId parent group id
@return GroupMetadata
"""
GroupMetadata parentGroup = findByRef(Gr... | java | private GroupMetadata findGroup(GroupHierarchyConfig config, String parentGroupId) {
GroupMetadata parentGroup = findByRef(Group.refById(parentGroupId));
return parentGroup.getGroups().stream()
.filter(group -> group.getName().equals(config.getName()))
.findFirst()
.... | [
"private",
"GroupMetadata",
"findGroup",
"(",
"GroupHierarchyConfig",
"config",
",",
"String",
"parentGroupId",
")",
"{",
"GroupMetadata",
"parentGroup",
"=",
"findByRef",
"(",
"Group",
".",
"refById",
"(",
"parentGroupId",
")",
")",
";",
"return",
"parentGroup",
... | Find group based on config instance and parent group identifier
@param config group hierarchy config
@param parentGroupId parent group id
@return GroupMetadata | [
"Find",
"group",
"based",
"on",
"config",
"instance",
"and",
"parent",
"group",
"identifier"
] | train | https://github.com/CenturyLinkCloud/clc-java-sdk/blob/c026322f077dea71b1acf9f2d665253d79d9bf85/sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/GroupService.java#L251-L258 |
hazelcast/hazelcast | hazelcast-client/src/main/java/com/hazelcast/client/config/ClientConfigXmlGenerator.java | ClientConfigXmlGenerator.generate | public static String generate(ClientConfig clientConfig, int indent) {
"""
Transforms the given {@link ClientConfig} to xml string
formatting the output with given {@code indent}, -1 means no
formatting.
"""
Preconditions.isNotNull(clientConfig, "ClientConfig");
StringBuilder xml = new Strin... | java | public static String generate(ClientConfig clientConfig, int indent) {
Preconditions.isNotNull(clientConfig, "ClientConfig");
StringBuilder xml = new StringBuilder();
xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
XmlGenerator gen = new XmlGenerator(xml);
gen.open("... | [
"public",
"static",
"String",
"generate",
"(",
"ClientConfig",
"clientConfig",
",",
"int",
"indent",
")",
"{",
"Preconditions",
".",
"isNotNull",
"(",
"clientConfig",
",",
"\"ClientConfig\"",
")",
";",
"StringBuilder",
"xml",
"=",
"new",
"StringBuilder",
"(",
")... | Transforms the given {@link ClientConfig} to xml string
formatting the output with given {@code indent}, -1 means no
formatting. | [
"Transforms",
"the",
"given",
"{"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/config/ClientConfigXmlGenerator.java#L86-L141 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/ViewFetcher.java | ViewFetcher.addChildren | private void addChildren(ArrayList<View> views, ViewGroup viewGroup, boolean onlySufficientlyVisible) {
"""
Adds all children of {@code viewGroup} (recursively) into {@code views}.
@param views an {@code ArrayList} of {@code View}s
@param viewGroup the {@code ViewGroup} to extract children from
@param onlySuf... | java | private void addChildren(ArrayList<View> views, ViewGroup viewGroup, boolean onlySufficientlyVisible) {
if(viewGroup != null){
for (int i = 0; i < viewGroup.getChildCount(); i++) {
final View child = viewGroup.getChildAt(i);
if(onlySufficientlyVisible && isViewSufficientlyShown(child)) {
views.add(ch... | [
"private",
"void",
"addChildren",
"(",
"ArrayList",
"<",
"View",
">",
"views",
",",
"ViewGroup",
"viewGroup",
",",
"boolean",
"onlySufficientlyVisible",
")",
"{",
"if",
"(",
"viewGroup",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",... | Adds all children of {@code viewGroup} (recursively) into {@code views}.
@param views an {@code ArrayList} of {@code View}s
@param viewGroup the {@code ViewGroup} to extract children from
@param onlySufficientlyVisible if only sufficiently visible views should be returned | [
"Adds",
"all",
"children",
"of",
"{",
"@code",
"viewGroup",
"}",
"(",
"recursively",
")",
"into",
"{",
"@code",
"views",
"}",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/ViewFetcher.java#L244-L262 |
alkacon/opencms-core | src/org/opencms/db/CmsLoginManager.java | CmsLoginManager.requiresUserDataCheck | public boolean requiresUserDataCheck(CmsObject cms, CmsUser user) {
"""
Checks if a user is required to change his password now.<p>
@param cms the current CMS context
@param user the user to check
@return true if the user should be asked to change his password
"""
if (user.isManaged()
... | java | public boolean requiresUserDataCheck(CmsObject cms, CmsUser user) {
if (user.isManaged()
|| user.isWebuser()
|| OpenCms.getDefaultUsers().isDefaultUser(user.getName())
|| OpenCms.getRoleManager().hasRole(cms, user.getName(), CmsRole.ROOT_ADMIN)) {
return false;
... | [
"public",
"boolean",
"requiresUserDataCheck",
"(",
"CmsObject",
"cms",
",",
"CmsUser",
"user",
")",
"{",
"if",
"(",
"user",
".",
"isManaged",
"(",
")",
"||",
"user",
".",
"isWebuser",
"(",
")",
"||",
"OpenCms",
".",
"getDefaultUsers",
"(",
")",
".",
"isD... | Checks if a user is required to change his password now.<p>
@param cms the current CMS context
@param user the user to check
@return true if the user should be asked to change his password | [
"Checks",
"if",
"a",
"user",
"is",
"required",
"to",
"change",
"his",
"password",
"now",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsLoginManager.java#L609-L627 |
CenturyLinkCloud/mdw | mdw-workflow/assets/com/centurylink/mdw/drools/RulesBasedStrategy.java | RulesBasedStrategy.getKnowledgeBase | protected KieBase getKnowledgeBase(String name, String modifier) throws StrategyException {
"""
Returns the latest version.
Modifier is sheet name.
Override to apply additional or non-standard attribute conditions.
@throws StrategyException
"""
KnowledgeBaseAsset kbrs = DroolsKnowledgeBaseCache.... | java | protected KieBase getKnowledgeBase(String name, String modifier) throws StrategyException {
KnowledgeBaseAsset kbrs = DroolsKnowledgeBaseCache.getKnowledgeBaseAsset(name, modifier, null, getClassLoader());
if (kbrs == null) {
return null;
}
else {
return kbrs.get... | [
"protected",
"KieBase",
"getKnowledgeBase",
"(",
"String",
"name",
",",
"String",
"modifier",
")",
"throws",
"StrategyException",
"{",
"KnowledgeBaseAsset",
"kbrs",
"=",
"DroolsKnowledgeBaseCache",
".",
"getKnowledgeBaseAsset",
"(",
"name",
",",
"modifier",
",",
"null... | Returns the latest version.
Modifier is sheet name.
Override to apply additional or non-standard attribute conditions.
@throws StrategyException | [
"Returns",
"the",
"latest",
"version",
"."
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-workflow/assets/com/centurylink/mdw/drools/RulesBasedStrategy.java#L54-L63 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/publisher/BaseDataPublisher.java | BaseDataPublisher.getIntermediateMetadataFromState | private String getIntermediateMetadataFromState(WorkUnitState state, int branchId) {
"""
/*
Retrieve intermediate metadata (eg the metadata stored by each writer) for a given state and branch id.
"""
return state.getProp(
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_METADATA... | java | private String getIntermediateMetadataFromState(WorkUnitState state, int branchId) {
return state.getProp(
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_METADATA_KEY, this.numBranches, branchId));
} | [
"private",
"String",
"getIntermediateMetadataFromState",
"(",
"WorkUnitState",
"state",
",",
"int",
"branchId",
")",
"{",
"return",
"state",
".",
"getProp",
"(",
"ForkOperatorUtils",
".",
"getPropertyNameForBranch",
"(",
"ConfigurationKeys",
".",
"WRITER_METADATA_KEY",
... | /*
Retrieve intermediate metadata (eg the metadata stored by each writer) for a given state and branch id. | [
"/",
"*",
"Retrieve",
"intermediate",
"metadata",
"(",
"eg",
"the",
"metadata",
"stored",
"by",
"each",
"writer",
")",
"for",
"a",
"given",
"state",
"and",
"branch",
"id",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/publisher/BaseDataPublisher.java#L743-L746 |
apache/incubator-heron | heron/schedulers/src/java/org/apache/heron/scheduler/yarn/HeronMasterDriver.java | HeronMasterDriver.scheduleHeronWorkers | void scheduleHeronWorkers(Set<ContainerPlan> containers) throws ContainerAllocationException {
"""
Container allocation is asynchronous. Requests all containers in the input set serially
to ensure allocated resources match the required resources.
"""
for (ContainerPlan containerPlan : containers) {
... | java | void scheduleHeronWorkers(Set<ContainerPlan> containers) throws ContainerAllocationException {
for (ContainerPlan containerPlan : containers) {
int id = containerPlan.getId();
if (containerPlans.containsKey(containerPlan.getId())) {
throw new ContainerAllocationException("Received duplicate allo... | [
"void",
"scheduleHeronWorkers",
"(",
"Set",
"<",
"ContainerPlan",
">",
"containers",
")",
"throws",
"ContainerAllocationException",
"{",
"for",
"(",
"ContainerPlan",
"containerPlan",
":",
"containers",
")",
"{",
"int",
"id",
"=",
"containerPlan",
".",
"getId",
"("... | Container allocation is asynchronous. Requests all containers in the input set serially
to ensure allocated resources match the required resources. | [
"Container",
"allocation",
"is",
"asynchronous",
".",
"Requests",
"all",
"containers",
"in",
"the",
"input",
"set",
"serially",
"to",
"ensure",
"allocated",
"resources",
"match",
"the",
"required",
"resources",
"."
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/schedulers/src/java/org/apache/heron/scheduler/yarn/HeronMasterDriver.java#L199-L209 |
ops4j/org.ops4j.base | ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java | StreamUtils.copyStream | public static void copyStream( InputStream src, OutputStream dest, boolean closeStreams )
throws IOException, NullArgumentException {
"""
Copy a stream.
@param src the source input stream
@param dest the destination output stream
@param closeStreams TRUE if the streams should be close... | java | public static void copyStream( InputStream src, OutputStream dest, boolean closeStreams )
throws IOException, NullArgumentException
{
copyStream( null, null, 0, src, dest, closeStreams );
} | [
"public",
"static",
"void",
"copyStream",
"(",
"InputStream",
"src",
",",
"OutputStream",
"dest",
",",
"boolean",
"closeStreams",
")",
"throws",
"IOException",
",",
"NullArgumentException",
"{",
"copyStream",
"(",
"null",
",",
"null",
",",
"0",
",",
"src",
","... | Copy a stream.
@param src the source input stream
@param dest the destination output stream
@param closeStreams TRUE if the streams should be closed on completion
@throws IOException if an IO error occurs
@throws NullArgumentException if either the src or dest arguments are null. | [
"Copy",
"a",
"stream",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java#L65-L69 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/ClientSidePreparedStatement.java | ClientSidePreparedStatement.setParameter | public void setParameter(final int parameterIndex, final ParameterHolder holder)
throws SQLException {
"""
Set parameter.
@param parameterIndex index
@param holder parameter holder
@throws SQLException if index position doesn't correspond to query parameters
"""
if (parameterIndex >= 1 &... | java | public void setParameter(final int parameterIndex, final ParameterHolder holder)
throws SQLException {
if (parameterIndex >= 1 && parameterIndex < prepareResult.getParamCount() + 1) {
parameters[parameterIndex - 1] = holder;
} else {
String error = "Could not set parameter at position " + para... | [
"public",
"void",
"setParameter",
"(",
"final",
"int",
"parameterIndex",
",",
"final",
"ParameterHolder",
"holder",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"parameterIndex",
">=",
"1",
"&&",
"parameterIndex",
"<",
"prepareResult",
".",
"getParamCount",
"(",... | Set parameter.
@param parameterIndex index
@param holder parameter holder
@throws SQLException if index position doesn't correspond to query parameters | [
"Set",
"parameter",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/ClientSidePreparedStatement.java#L442-L467 |
Bernardo-MG/maven-site-fixer | src/main/java/com/bernardomg/velocity/tool/SiteTool.java | SiteTool.fixReport | public final void fixReport(final Element root, final String report) {
"""
Fixes a Maven Site report.
<p>
This is prepared for the following reports:
<ul>
<li>Changes report</li>
<li>Checkstyle</li>
<li>CPD</li>
<li>Dependencies</li>
<li>Failsafe report</li>
<li>Findbugs</li>
<li>JDepend</li>
<li>Licens... | java | public final void fixReport(final Element root, final String report) {
checkNotNull(root, "Received a null pointer as root element");
checkNotNull(report, "Received a null pointer as report");
switch (report) {
case "plugins":
fixReportPlugins(root);
... | [
"public",
"final",
"void",
"fixReport",
"(",
"final",
"Element",
"root",
",",
"final",
"String",
"report",
")",
"{",
"checkNotNull",
"(",
"root",
",",
"\"Received a null pointer as root element\"",
")",
";",
"checkNotNull",
"(",
"report",
",",
"\"Received a null poi... | Fixes a Maven Site report.
<p>
This is prepared for the following reports:
<ul>
<li>Changes report</li>
<li>Checkstyle</li>
<li>CPD</li>
<li>Dependencies</li>
<li>Failsafe report</li>
<li>Findbugs</li>
<li>JDepend</li>
<li>License</li>
<li>Plugins</li>
<li>Plugin management</li>
<li>Project summary</li>
<li>PMD</li>
<l... | [
"Fixes",
"a",
"Maven",
"Site",
"report",
".",
"<p",
">",
"This",
"is",
"prepared",
"for",
"the",
"following",
"reports",
":",
"<ul",
">",
"<li",
">",
"Changes",
"report<",
"/",
"li",
">",
"<li",
">",
"Checkstyle<",
"/",
"li",
">",
"<li",
">",
"CPD<",... | train | https://github.com/Bernardo-MG/maven-site-fixer/blob/e064472faa7edb0fca11647a22d90ad72089baa3/src/main/java/com/bernardomg/velocity/tool/SiteTool.java#L182-L243 |
robocup-atan/atan | src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java | CommandFactory.addMoveBallCommand | public void addMoveBallCommand(double x, double y) {
"""
Trainer only command.
Moves the ball to the given coordinates.
@param x The x coordinate to move to.
@param y The y coordinate to move to.
"""
StringBuilder buf = new StringBuilder();
buf.append("(move ");
buf.append("ball");... | java | public void addMoveBallCommand(double x, double y) {
StringBuilder buf = new StringBuilder();
buf.append("(move ");
buf.append("ball"); // TODO Manual says the format...will implement this later.
buf.append(' ');
buf.append(x);
buf.append(' ');
buf.append(y);
... | [
"public",
"void",
"addMoveBallCommand",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"buf",
".",
"append",
"(",
"\"(move \"",
")",
";",
"buf",
".",
"append",
"(",
"\"ball\"",
")",
... | Trainer only command.
Moves the ball to the given coordinates.
@param x The x coordinate to move to.
@param y The y coordinate to move to. | [
"Trainer",
"only",
"command",
".",
"Moves",
"the",
"ball",
"to",
"the",
"given",
"coordinates",
"."
] | train | https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L316-L326 |
casmi/casmi | src/main/java/casmi/graphics/element/Quad.java | Quad.getConer | public Vector3D getConer(int index) {
"""
Gets coordinates of a corner.
@param index The index of a corner.
"""
Vector3D v = new Vector3D(0, 0, 0);
if (index <= 0) {
v.set(this.x1, this.y1);
} else if (index == 1) {
v.set(this.x2, this.y2);
} else if ... | java | public Vector3D getConer(int index) {
Vector3D v = new Vector3D(0, 0, 0);
if (index <= 0) {
v.set(this.x1, this.y1);
} else if (index == 1) {
v.set(this.x2, this.y2);
} else if (index == 2) {
v.set(this.x3, this.y3);
} else if (3 <= index) {
... | [
"public",
"Vector3D",
"getConer",
"(",
"int",
"index",
")",
"{",
"Vector3D",
"v",
"=",
"new",
"Vector3D",
"(",
"0",
",",
"0",
",",
"0",
")",
";",
"if",
"(",
"index",
"<=",
"0",
")",
"{",
"v",
".",
"set",
"(",
"this",
".",
"x1",
",",
"this",
"... | Gets coordinates of a corner.
@param index The index of a corner. | [
"Gets",
"coordinates",
"of",
"a",
"corner",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Quad.java#L221-L234 |
albfernandez/itext2 | src/main/java/com/lowagie/text/Document.java | Document.addCreator | public boolean addCreator(String creator) {
"""
Adds the creator to a Document.
@param creator
the name of the creator
@return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
"""
try {
return add(new Meta(Element.CREATOR, creator));
} catch (DocumentException de) {
... | java | public boolean addCreator(String creator) {
try {
return add(new Meta(Element.CREATOR, creator));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
} | [
"public",
"boolean",
"addCreator",
"(",
"String",
"creator",
")",
"{",
"try",
"{",
"return",
"add",
"(",
"new",
"Meta",
"(",
"Element",
".",
"CREATOR",
",",
"creator",
")",
")",
";",
"}",
"catch",
"(",
"DocumentException",
"de",
")",
"{",
"throw",
"new... | Adds the creator to a Document.
@param creator
the name of the creator
@return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise | [
"Adds",
"the",
"creator",
"to",
"a",
"Document",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Document.java#L592-L598 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/HashOperations.java | HashOperations.countPart | public static int countPart(final long[] srcArr, final int lgArrLongs, final long thetaLong) {
"""
Counts the cardinality of the first Log2 values of the given source array.
@param srcArr the given source array
@param lgArrLongs <a href="{@docRoot}/resources/dictionary.html#lgArrLongs">See lgArrLongs</a>
@param... | java | public static int countPart(final long[] srcArr, final int lgArrLongs, final long thetaLong) {
int cnt = 0;
final int len = 1 << lgArrLongs;
for (int i = len; i-- > 0;) {
final long hash = srcArr[i];
if (continueCondition(thetaLong, hash) ) {
continue;
}
cnt++ ;
}
ret... | [
"public",
"static",
"int",
"countPart",
"(",
"final",
"long",
"[",
"]",
"srcArr",
",",
"final",
"int",
"lgArrLongs",
",",
"final",
"long",
"thetaLong",
")",
"{",
"int",
"cnt",
"=",
"0",
";",
"final",
"int",
"len",
"=",
"1",
"<<",
"lgArrLongs",
";",
"... | Counts the cardinality of the first Log2 values of the given source array.
@param srcArr the given source array
@param lgArrLongs <a href="{@docRoot}/resources/dictionary.html#lgArrLongs">See lgArrLongs</a>
@param thetaLong <a href="{@docRoot}/resources/dictionary.html#thetaLong">See Theta Long</a>
@return the cardinal... | [
"Counts",
"the",
"cardinality",
"of",
"the",
"first",
"Log2",
"values",
"of",
"the",
"given",
"source",
"array",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/HashOperations.java#L36-L47 |
leadware/jpersistence-tools | jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java | DAOValidatorHelper.extractToken | public static String[] extractToken(String expression, String pattern) {
"""
Methode d'extraction de toutes les sous-chaines respectant le pattern donne
@param expression Expression mere
@param pattern Pattern a rechercher
@return Liste des sous-chaines respectant ce pattern
"""
// Si la chaine est v... | java | public static String[] extractToken(String expression, String pattern) {
// Si la chaine est vide
if(expression == null || expression.trim().length() == 0) {
// On retourne null;
return null;
}
// Si le pattern est null
if(pattern == null) {
// On retourne null;
return n... | [
"public",
"static",
"String",
"[",
"]",
"extractToken",
"(",
"String",
"expression",
",",
"String",
"pattern",
")",
"{",
"// Si la chaine est vide\r",
"if",
"(",
"expression",
"==",
"null",
"||",
"expression",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
... | Methode d'extraction de toutes les sous-chaines respectant le pattern donne
@param expression Expression mere
@param pattern Pattern a rechercher
@return Liste des sous-chaines respectant ce pattern | [
"Methode",
"d",
"extraction",
"de",
"toutes",
"les",
"sous",
"-",
"chaines",
"respectant",
"le",
"pattern",
"donne"
] | train | https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L660-L701 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassNameRewriterUtil.java | ClassNameRewriterUtil.rewriteSignature | public static String rewriteSignature(ClassNameRewriter classNameRewriter, String signature) {
"""
Rewrite a signature.
@param classNameRewriter
a ClassNameRewriter
@param signature
a signature (parameter, return type, or field)
@return rewritten signature with class name updated if required
"""
... | java | public static String rewriteSignature(ClassNameRewriter classNameRewriter, String signature) {
if (classNameRewriter != IdentityClassNameRewriter.instance() && signature.startsWith("L")) {
String className = signature.substring(1, signature.length() - 1).replace('/', '.');
className = c... | [
"public",
"static",
"String",
"rewriteSignature",
"(",
"ClassNameRewriter",
"classNameRewriter",
",",
"String",
"signature",
")",
"{",
"if",
"(",
"classNameRewriter",
"!=",
"IdentityClassNameRewriter",
".",
"instance",
"(",
")",
"&&",
"signature",
".",
"startsWith",
... | Rewrite a signature.
@param classNameRewriter
a ClassNameRewriter
@param signature
a signature (parameter, return type, or field)
@return rewritten signature with class name updated if required | [
"Rewrite",
"a",
"signature",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassNameRewriterUtil.java#L73-L83 |
wcm-io/wcm-io-handler | url/src/main/java/io/wcm/handler/url/suffix/SuffixBuilder.java | SuffixBuilder.putAll | public @NotNull SuffixBuilder putAll(@NotNull Map<String, Object> map) {
"""
Puts a map of key-value pairs into the suffix.
@param map map of key-value pairs
@return this
"""
for (Map.Entry<String, Object> entry : map.entrySet()) {
put(entry.getKey(), entry.getValue());
}
return this;
} | java | public @NotNull SuffixBuilder putAll(@NotNull Map<String, Object> map) {
for (Map.Entry<String, Object> entry : map.entrySet()) {
put(entry.getKey(), entry.getValue());
}
return this;
} | [
"public",
"@",
"NotNull",
"SuffixBuilder",
"putAll",
"(",
"@",
"NotNull",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",
"entry",
":",
"map",
".",
"entrySet",
"(",
")",
... | Puts a map of key-value pairs into the suffix.
@param map map of key-value pairs
@return this | [
"Puts",
"a",
"map",
"of",
"key",
"-",
"value",
"pairs",
"into",
"the",
"suffix",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/suffix/SuffixBuilder.java#L215-L220 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.scaleRow | public static void scaleRow( double alpha , DMatrixRMaj A , int row ) {
"""
In-place scaling of a row in A
@param alpha scale factor
@param A matrix
@param row which row in A
"""
int idx = row*A.numCols;
for (int col = 0; col < A.numCols; col++) {
A.data[idx++] *= alpha;
... | java | public static void scaleRow( double alpha , DMatrixRMaj A , int row ) {
int idx = row*A.numCols;
for (int col = 0; col < A.numCols; col++) {
A.data[idx++] *= alpha;
}
} | [
"public",
"static",
"void",
"scaleRow",
"(",
"double",
"alpha",
",",
"DMatrixRMaj",
"A",
",",
"int",
"row",
")",
"{",
"int",
"idx",
"=",
"row",
"*",
"A",
".",
"numCols",
";",
"for",
"(",
"int",
"col",
"=",
"0",
";",
"col",
"<",
"A",
".",
"numCols... | In-place scaling of a row in A
@param alpha scale factor
@param A matrix
@param row which row in A | [
"In",
"-",
"place",
"scaling",
"of",
"a",
"row",
"in",
"A"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L2398-L2403 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/type/GeometryTypeFromConstraint.java | GeometryTypeFromConstraint.geometryTypeFromConstraint | public static int geometryTypeFromConstraint(String constraint, int numericPrecision) {
"""
Convert H2 constraint string into a OGC geometry type index.
@param constraint SQL Constraint ex: ST_GeometryTypeCode(the_geom) = 5
@param numericPrecision This parameter is available if the user give domain
@return Geom... | java | public static int geometryTypeFromConstraint(String constraint, int numericPrecision) {
if(constraint.isEmpty() && numericPrecision > GeometryTypeCodes.GEOMETRYZM) {
return GeometryTypeCodes.GEOMETRY;
}
// Use Domain given parameters
if(numericPrecision <= GeometryTypeCodes.G... | [
"public",
"static",
"int",
"geometryTypeFromConstraint",
"(",
"String",
"constraint",
",",
"int",
"numericPrecision",
")",
"{",
"if",
"(",
"constraint",
".",
"isEmpty",
"(",
")",
"&&",
"numericPrecision",
">",
"GeometryTypeCodes",
".",
"GEOMETRYZM",
")",
"{",
"r... | Convert H2 constraint string into a OGC geometry type index.
@param constraint SQL Constraint ex: ST_GeometryTypeCode(the_geom) = 5
@param numericPrecision This parameter is available if the user give domain
@return Geometry type code {@link org.h2gis.utilities.GeometryTypeCodes} | [
"Convert",
"H2",
"constraint",
"string",
"into",
"a",
"OGC",
"geometry",
"type",
"index",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/type/GeometryTypeFromConstraint.java#L57-L72 |
datacleaner/DataCleaner | desktop/ui/src/main/java/org/datacleaner/panels/DCSplashPanel.java | DCSplashPanel.createTitleLabel | public JComponent createTitleLabel(final String text, final boolean includeBackButton) {
"""
Creates a label for the title of the screen
@param string
@return
"""
if (includeBackButton) {
final ActionListener actionListener = e -> _window.changePanel(AnalysisWindowPanelType.WELCOME);
... | java | public JComponent createTitleLabel(final String text, final boolean includeBackButton) {
if (includeBackButton) {
final ActionListener actionListener = e -> _window.changePanel(AnalysisWindowPanelType.WELCOME);
return createTitleLabel(text, actionListener);
}
return creat... | [
"public",
"JComponent",
"createTitleLabel",
"(",
"final",
"String",
"text",
",",
"final",
"boolean",
"includeBackButton",
")",
"{",
"if",
"(",
"includeBackButton",
")",
"{",
"final",
"ActionListener",
"actionListener",
"=",
"e",
"->",
"_window",
".",
"changePanel"... | Creates a label for the title of the screen
@param string
@return | [
"Creates",
"a",
"label",
"for",
"the",
"title",
"of",
"the",
"screen"
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/panels/DCSplashPanel.java#L132-L138 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.getMethodSignature | protected static String getMethodSignature(String methodName, Class<?>[] parameterTypes, Class<?> returnType) {
"""
Builds the signature of a method based on the method's name, parameter types and return type.
@param methodName a String indicating the name of the method.
@param parameterTypes an array of Class... | java | protected static String getMethodSignature(String methodName, Class<?>[] parameterTypes, Class<?> returnType) {
StringBuilder buffer = new StringBuilder(methodName);
buffer.append("(");
if (parameterTypes != null) {
int index = 0;
for (Class<?> parameterType : parameterTypes) {
buff... | [
"protected",
"static",
"String",
"getMethodSignature",
"(",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
",",
"Class",
"<",
"?",
">",
"returnType",
")",
"{",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
"me... | Builds the signature of a method based on the method's name, parameter types and return type.
@param methodName a String indicating the name of the method.
@param parameterTypes an array of Class objects indicating the type of each method parameter.
@param returnType a Class object indicating the methods return type.
... | [
"Builds",
"the",
"signature",
"of",
"a",
"method",
"based",
"on",
"the",
"method",
"s",
"name",
"parameter",
"types",
"and",
"return",
"type",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L449-L469 |
facebookarchive/hadoop-20 | src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/SMARTParser.java | SMARTParser.readColumns | private EventRecord readColumns(EventRecord er, StringBuffer sb) {
"""
Reads attributes in the following format:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
3 Spin_Up_Time 0x0027 180 177 063 Pre-fail Always - 10265
4 Start_... | java | private EventRecord readColumns(EventRecord er, StringBuffer sb) {
Pattern pattern = Pattern.compile("^\\s{0,2}(\\d{1,3}\\s+.*)$",
Pattern.MULTILINE);
Matcher matcher = pattern.matcher(sb);
while (matcher.find()) {
String[] tokens = matcher.group(1).split("\\s+");
boolean failed = fals... | [
"private",
"EventRecord",
"readColumns",
"(",
"EventRecord",
"er",
",",
"StringBuffer",
"sb",
")",
"{",
"Pattern",
"pattern",
"=",
"Pattern",
".",
"compile",
"(",
"\"^\\\\s{0,2}(\\\\d{1,3}\\\\s+.*)$\"",
",",
"Pattern",
".",
"MULTILINE",
")",
";",
"Matcher",
"match... | Reads attributes in the following format:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
3 Spin_Up_Time 0x0027 180 177 063 Pre-fail Always - 10265
4 Start_Stop_Count 0x0032 253 253 000 Old_age Always - 34... | [
"Reads",
"attributes",
"in",
"the",
"following",
"format",
":"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/SMARTParser.java#L153-L169 |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/internaleventdispatching/AgentInternalEventsDispatcher.java | AgentInternalEventsDispatcher.getRegisteredEventListeners | public <T> int getRegisteredEventListeners(Class<T> type, Collection<? super T> collection) {
"""
Extract the registered listeners with the given type.
@param <T> the type of the listeners.
@param type the type of the listeners.
@param collection the collection of listeners that is filled by this function.
@... | java | public <T> int getRegisteredEventListeners(Class<T> type, Collection<? super T> collection) {
synchronized (this.behaviorGuardEvaluatorRegistry) {
return this.behaviorGuardEvaluatorRegistry.getRegisteredEventListeners(type, collection);
}
} | [
"public",
"<",
"T",
">",
"int",
"getRegisteredEventListeners",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"Collection",
"<",
"?",
"super",
"T",
">",
"collection",
")",
"{",
"synchronized",
"(",
"this",
".",
"behaviorGuardEvaluatorRegistry",
")",
"{",
"return"... | Extract the registered listeners with the given type.
@param <T> the type of the listeners.
@param type the type of the listeners.
@param collection the collection of listeners that is filled by this function.
@return the number of listeners added to the collection.
@since 0.5 | [
"Extract",
"the",
"registered",
"listeners",
"with",
"the",
"given",
"type",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/internaleventdispatching/AgentInternalEventsDispatcher.java#L101-L105 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountAssembliesInner.java | IntegrationAccountAssembliesInner.listContentCallbackUrl | public WorkflowTriggerCallbackUrlInner listContentCallbackUrl(String resourceGroupName, String integrationAccountName, String assemblyArtifactName) {
"""
Get the content callback url for an integration account assembly.
@param resourceGroupName The resource group name.
@param integrationAccountName The integra... | java | public WorkflowTriggerCallbackUrlInner listContentCallbackUrl(String resourceGroupName, String integrationAccountName, String assemblyArtifactName) {
return listContentCallbackUrlWithServiceResponseAsync(resourceGroupName, integrationAccountName, assemblyArtifactName).toBlocking().single().body();
} | [
"public",
"WorkflowTriggerCallbackUrlInner",
"listContentCallbackUrl",
"(",
"String",
"resourceGroupName",
",",
"String",
"integrationAccountName",
",",
"String",
"assemblyArtifactName",
")",
"{",
"return",
"listContentCallbackUrlWithServiceResponseAsync",
"(",
"resourceGroupName",... | Get the content callback url for an integration account assembly.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@param assemblyArtifactName The assembly artifact name.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws Cloud... | [
"Get",
"the",
"content",
"callback",
"url",
"for",
"an",
"integration",
"account",
"assembly",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountAssembliesInner.java#L472-L474 |
zsoltk/overpasser | library/src/main/java/hu/supercluster/overpasser/library/query/OverpassFilterQuery.java | OverpassFilterQuery.tagRegex | public OverpassFilterQuery tagRegex(String name, String value) {
"""
Adds a <i>["name"~value]</i> filter tag to the current query.
@param name the filter name
@param value the filter value
@return the current query object
"""
builder.regexMatches(name, value);
return this;
} | java | public OverpassFilterQuery tagRegex(String name, String value) {
builder.regexMatches(name, value);
return this;
} | [
"public",
"OverpassFilterQuery",
"tagRegex",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"builder",
".",
"regexMatches",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds a <i>["name"~value]</i> filter tag to the current query.
@param name the filter name
@param value the filter value
@return the current query object | [
"Adds",
"a",
"<i",
">",
"[",
"name",
"~value",
"]",
"<",
"/",
"i",
">",
"filter",
"tag",
"to",
"the",
"current",
"query",
"."
] | train | https://github.com/zsoltk/overpasser/blob/0464d3844e75c5f9393d2458d3a3aedf3e40f30d/library/src/main/java/hu/supercluster/overpasser/library/query/OverpassFilterQuery.java#L191-L195 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.