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 |
|---|---|---|---|---|---|---|---|---|---|---|
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/LogQueryTool.java | LogQueryTool.exWithQuery | private String exWithQuery(String message, PrepareResult serverPrepareResult,
ParameterHolder[] parameters) {
"""
Return exception message with query.
@param message current exception message
@param serverPrepareResult prepare result
@param parameters query parameters
@return excep... | java | private String exWithQuery(String message, PrepareResult serverPrepareResult,
ParameterHolder[] parameters) {
if (options.dumpQueriesOnException) {
StringBuilder sql = new StringBuilder(serverPrepareResult.getSql());
if (serverPrepareResult.getParamCount() > 0) {
sql.append(", parameters [... | [
"private",
"String",
"exWithQuery",
"(",
"String",
"message",
",",
"PrepareResult",
"serverPrepareResult",
",",
"ParameterHolder",
"[",
"]",
"parameters",
")",
"{",
"if",
"(",
"options",
".",
"dumpQueriesOnException",
")",
"{",
"StringBuilder",
"sql",
"=",
"new",
... | Return exception message with query.
@param message current exception message
@param serverPrepareResult prepare result
@param parameters query parameters
@return exception message with query | [
"Return",
"exception",
"message",
"with",
"query",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/LogQueryTool.java#L198-L225 |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.queryBeanSQLKey | public static <T> T queryBeanSQLKey(String sqlKey, Class<T> beanType, Object[] params)
throws SQLStatementNotFoundException, YankSQLException {
"""
Return just one Bean given a SQL Key using an SQL statement matching the sqlKey String in a
properties file loaded via Yank.addSQLStatements(...). If more than ... | java | public static <T> T queryBeanSQLKey(String sqlKey, Class<T> beanType, Object[] params)
throws SQLStatementNotFoundException, YankSQLException {
return queryBeanSQLKey(YankPoolManager.DEFAULT_POOL_NAME, sqlKey, beanType, params);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"queryBeanSQLKey",
"(",
"String",
"sqlKey",
",",
"Class",
"<",
"T",
">",
"beanType",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"SQLStatementNotFoundException",
",",
"YankSQLException",
"{",
"return",
"queryBeanSQ... | Return just one Bean given a SQL Key using an SQL statement matching the sqlKey String in a
properties file loaded via Yank.addSQLStatements(...). If more than one row match the query,
only the first row is returned using the default connection pool.
@param sqlKey The SQL Key found in a properties file corresponding t... | [
"Return",
"just",
"one",
"Bean",
"given",
"a",
"SQL",
"Key",
"using",
"an",
"SQL",
"statement",
"matching",
"the",
"sqlKey",
"String",
"in",
"a",
"properties",
"file",
"loaded",
"via",
"Yank",
".",
"addSQLStatements",
"(",
"...",
")",
".",
"If",
"more",
... | train | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L338-L342 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java | Aggregations.integerSum | public static <Key, Value> Aggregation<Key, Integer, Integer> integerSum() {
"""
Returns an aggregation to calculate the integer sum of all supplied values.<br/>
This aggregation is similar to: <pre>SELECT SUM(value) FROM x</pre>
@param <Key> the input key type
@param <Value> the supplied value type
@retur... | java | public static <Key, Value> Aggregation<Key, Integer, Integer> integerSum() {
return new AggregationAdapter(new IntegerSumAggregation<Key, Value>());
} | [
"public",
"static",
"<",
"Key",
",",
"Value",
">",
"Aggregation",
"<",
"Key",
",",
"Integer",
",",
"Integer",
">",
"integerSum",
"(",
")",
"{",
"return",
"new",
"AggregationAdapter",
"(",
"new",
"IntegerSumAggregation",
"<",
"Key",
",",
"Value",
">",
"(",
... | Returns an aggregation to calculate the integer sum of all supplied values.<br/>
This aggregation is similar to: <pre>SELECT SUM(value) FROM x</pre>
@param <Key> the input key type
@param <Value> the supplied value type
@return the sum over all supplied values | [
"Returns",
"an",
"aggregation",
"to",
"calculate",
"the",
"integer",
"sum",
"of",
"all",
"supplied",
"values",
".",
"<br",
"/",
">",
"This",
"aggregation",
"is",
"similar",
"to",
":",
"<pre",
">",
"SELECT",
"SUM",
"(",
"value",
")",
"FROM",
"x<",
"/",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java#L114-L116 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.isModifed | public static boolean isModifed(File file, long lastModifyTime) {
"""
判断文件是否被改动<br>
如果文件对象为 null 或者文件不存在,被视为改动
@param file 文件对象
@param lastModifyTime 上次的改动时间
@return 是否被改动
"""
if (null == file || false == file.exists()) {
return true;
}
return file.lastModified() != lastModifyTime;
} | java | public static boolean isModifed(File file, long lastModifyTime) {
if (null == file || false == file.exists()) {
return true;
}
return file.lastModified() != lastModifyTime;
} | [
"public",
"static",
"boolean",
"isModifed",
"(",
"File",
"file",
",",
"long",
"lastModifyTime",
")",
"{",
"if",
"(",
"null",
"==",
"file",
"||",
"false",
"==",
"file",
".",
"exists",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"file",
"... | 判断文件是否被改动<br>
如果文件对象为 null 或者文件不存在,被视为改动
@param file 文件对象
@param lastModifyTime 上次的改动时间
@return 是否被改动 | [
"判断文件是否被改动<br",
">",
"如果文件对象为",
"null",
"或者文件不存在,被视为改动"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1487-L1492 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/reader/impl/BasicModelUtils.java | BasicModelUtils.wordsNearestSum | @Override
public Collection<String> wordsNearestSum(String word, int n) {
"""
Get the top n words most similar to the given word
@param word the word to compare
@param n the n to get
@return the top n words
"""
//INDArray vec = Transforms.unitVec(this.lookupTable.vector(word));
INDArray ... | java | @Override
public Collection<String> wordsNearestSum(String word, int n) {
//INDArray vec = Transforms.unitVec(this.lookupTable.vector(word));
INDArray vec = this.lookupTable.vector(word);
return wordsNearestSum(vec, n);
} | [
"@",
"Override",
"public",
"Collection",
"<",
"String",
">",
"wordsNearestSum",
"(",
"String",
"word",
",",
"int",
"n",
")",
"{",
"//INDArray vec = Transforms.unitVec(this.lookupTable.vector(word));",
"INDArray",
"vec",
"=",
"this",
".",
"lookupTable",
".",
"vector",
... | Get the top n words most similar to the given word
@param word the word to compare
@param n the n to get
@return the top n words | [
"Get",
"the",
"top",
"n",
"words",
"most",
"similar",
"to",
"the",
"given",
"word"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/reader/impl/BasicModelUtils.java#L228-L233 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractController.java | AbstractController.getTarget | protected <T> Optional<T> getTarget(Event event, Class<T> type) {
"""
Gets the target.
@param event the event
@param type the cls
@param <T> the generic type
@return the target
"""
return getValue(event, event::getTarget, type);
} | java | protected <T> Optional<T> getTarget(Event event, Class<T> type) {
return getValue(event, event::getTarget, type);
} | [
"protected",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"getTarget",
"(",
"Event",
"event",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"getValue",
"(",
"event",
",",
"event",
"::",
"getTarget",
",",
"type",
")",
";",
"}"
] | Gets the target.
@param event the event
@param type the cls
@param <T> the generic type
@return the target | [
"Gets",
"the",
"target",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractController.java#L347-L349 |
xqbase/util | util/src/main/java/com/xqbase/util/Bytes.java | Bytes.toLong | public static long toLong(byte[] b, int off, boolean littleEndian) {
"""
Retrieve a <b>long</b> from a byte array in a given byte order
"""
if (littleEndian) {
return (toInt(b, off, LITTLE_ENDIAN) & 0xFFFFFFFFL) |
((toInt(b, off + 4, LITTLE_ENDIAN) & 0xFFFFFFFFL) << 32);
}
return ((toInt(b, ... | java | public static long toLong(byte[] b, int off, boolean littleEndian) {
if (littleEndian) {
return (toInt(b, off, LITTLE_ENDIAN) & 0xFFFFFFFFL) |
((toInt(b, off + 4, LITTLE_ENDIAN) & 0xFFFFFFFFL) << 32);
}
return ((toInt(b, off, BIG_ENDIAN) & 0xFFFFFFFFL) << 32) |
(toInt(b, off + 4, BIG_ENDIAN) & 0... | [
"public",
"static",
"long",
"toLong",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"boolean",
"littleEndian",
")",
"{",
"if",
"(",
"littleEndian",
")",
"{",
"return",
"(",
"toInt",
"(",
"b",
",",
"off",
",",
"LITTLE_ENDIAN",
")",
"&",
"0xFFFFF... | Retrieve a <b>long</b> from a byte array in a given byte order | [
"Retrieve",
"a",
"<b",
">",
"long<",
"/",
"b",
">",
"from",
"a",
"byte",
"array",
"in",
"a",
"given",
"byte",
"order"
] | train | https://github.com/xqbase/util/blob/e7b9167b6c701b9eec988a9d1e68446cef5ef420/util/src/main/java/com/xqbase/util/Bytes.java#L242-L249 |
groupon/odo | proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java | PathOverrideService.setName | public void setName(int pathId, String pathName) {
"""
Sets the path name for this ID
@param pathId ID of path
@param pathName Name of path
"""
PreparedStatement statement = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStat... | java | public void setName(int pathId, String pathName) {
PreparedStatement statement = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStatement(
"UPDATE " + Constants.DB_TABLE_PATH +
" SET " + Constants.PATH_... | [
"public",
"void",
"setName",
"(",
"int",
"pathId",
",",
"String",
"pathName",
")",
"{",
"PreparedStatement",
"statement",
"=",
"null",
";",
"try",
"(",
"Connection",
"sqlConnection",
"=",
"sqlService",
".",
"getConnection",
"(",
")",
")",
"{",
"statement",
"... | Sets the path name for this ID
@param pathId ID of path
@param pathName Name of path | [
"Sets",
"the",
"path",
"name",
"for",
"this",
"ID"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java#L1117-L1139 |
OpenLiberty/open-liberty | dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java | PasswordUtil.convert_to_string | private static String convert_to_string(byte[] bytes) {
"""
Convert the byte[] data to a String using the UTF-8 encoding.
@param bytes
@return String - null if input is null or if UTF-8 is not supported
"""
if (null == bytes) {
return null;
}
if (0 == bytes.length) {
... | java | private static String convert_to_string(byte[] bytes) {
if (null == bytes) {
return null;
}
if (0 == bytes.length) {
return EMPTY_STRING;
}
try {
return new String(bytes, STRING_CONVERSION_CODE);
} catch (UnsupportedEncodingException e)... | [
"private",
"static",
"String",
"convert_to_string",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"if",
"(",
"null",
"==",
"bytes",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"0",
"==",
"bytes",
".",
"length",
")",
"{",
"return",
"EMPTY_STRING",
";... | Convert the byte[] data to a String using the UTF-8 encoding.
@param bytes
@return String - null if input is null or if UTF-8 is not supported | [
"Convert",
"the",
"byte",
"[]",
"data",
"to",
"a",
"String",
"using",
"the",
"UTF",
"-",
"8",
"encoding",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java#L530-L543 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_tcp_frontend_frontendId_PUT | public void serviceName_tcp_frontend_frontendId_PUT(String serviceName, Long frontendId, OvhFrontendTcp body) throws IOException {
"""
Alter this object properties
REST: PUT /ipLoadbalancing/{serviceName}/tcp/frontend/{frontendId}
@param body [required] New object properties
@param serviceName [required] The ... | java | public void serviceName_tcp_frontend_frontendId_PUT(String serviceName, Long frontendId, OvhFrontendTcp body) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/tcp/frontend/{frontendId}";
StringBuilder sb = path(qPath, serviceName, frontendId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_tcp_frontend_frontendId_PUT",
"(",
"String",
"serviceName",
",",
"Long",
"frontendId",
",",
"OvhFrontendTcp",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/tcp/frontend/{frontendId}\"",
";",... | Alter this object properties
REST: PUT /ipLoadbalancing/{serviceName}/tcp/frontend/{frontendId}
@param body [required] New object properties
@param serviceName [required] The internal name of your IP load balancing
@param frontendId [required] Id of your frontend | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1447-L1451 |
alkacon/opencms-core | src/org/opencms/ugc/CmsUgcSessionFactory.java | CmsUgcSessionFactory.getSession | public CmsUgcSession getSession(HttpServletRequest request, CmsUUID sessionId) {
"""
Returns the session, if already initialized.<p>
@param request the request
@param sessionId the form session id
@return the session
"""
return (CmsUgcSession)request.getSession(true).getAttribute("" + sessionId... | java | public CmsUgcSession getSession(HttpServletRequest request, CmsUUID sessionId) {
return (CmsUgcSession)request.getSession(true).getAttribute("" + sessionId);
} | [
"public",
"CmsUgcSession",
"getSession",
"(",
"HttpServletRequest",
"request",
",",
"CmsUUID",
"sessionId",
")",
"{",
"return",
"(",
"CmsUgcSession",
")",
"request",
".",
"getSession",
"(",
"true",
")",
".",
"getAttribute",
"(",
"\"\"",
"+",
"sessionId",
")",
... | Returns the session, if already initialized.<p>
@param request the request
@param sessionId the form session id
@return the session | [
"Returns",
"the",
"session",
"if",
"already",
"initialized",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcSessionFactory.java#L172-L175 |
Jasig/uPortal | uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/services/GroupService.java | GroupService.igetGroupMember | private IGroupMember igetGroupMember(String key, Class<?> type) throws GroupsException {
"""
Returns an <code>IGroupMember</code> representing either a group or a portal entity. If the
parm <code>type</code> is the group type, the <code>IGroupMember</code> is an <code>
IEntityGroup</code> else it is an <code>IEn... | java | private IGroupMember igetGroupMember(String key, Class<?> type) throws GroupsException {
return compositeGroupService.getGroupMember(key, type);
} | [
"private",
"IGroupMember",
"igetGroupMember",
"(",
"String",
"key",
",",
"Class",
"<",
"?",
">",
"type",
")",
"throws",
"GroupsException",
"{",
"return",
"compositeGroupService",
".",
"getGroupMember",
"(",
"key",
",",
"type",
")",
";",
"}"
] | Returns an <code>IGroupMember</code> representing either a group or a portal entity. If the
parm <code>type</code> is the group type, the <code>IGroupMember</code> is an <code>
IEntityGroup</code> else it is an <code>IEntity</code>. | [
"Returns",
"an",
"<code",
">",
"IGroupMember<",
"/",
"code",
">",
"representing",
"either",
"a",
"group",
"or",
"a",
"portal",
"entity",
".",
"If",
"the",
"parm",
"<code",
">",
"type<",
"/",
"code",
">",
"is",
"the",
"group",
"type",
"the",
"<code",
">... | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/services/GroupService.java#L295-L297 |
VoltDB/voltdb | third_party/java/src/org/apache/commons_voltpatches/cli/CommandLine.java | CommandLine.getOptionValue | public String getOptionValue(String opt, String defaultValue) {
"""
Retrieve the first argument, if any, of an option.
@param opt name of the option
@param defaultValue is the default value to be returned if the option
is not specified
@return Value of the argument if option is set, and has an argument,
oth... | java | public String getOptionValue(String opt, String defaultValue)
{
String answer = getOptionValue(opt);
return (answer != null) ? answer : defaultValue;
} | [
"public",
"String",
"getOptionValue",
"(",
"String",
"opt",
",",
"String",
"defaultValue",
")",
"{",
"String",
"answer",
"=",
"getOptionValue",
"(",
"opt",
")",
";",
"return",
"(",
"answer",
"!=",
"null",
")",
"?",
"answer",
":",
"defaultValue",
";",
"}"
] | Retrieve the first argument, if any, of an option.
@param opt name of the option
@param defaultValue is the default value to be returned if the option
is not specified
@return Value of the argument if option is set, and has an argument,
otherwise <code>defaultValue</code>. | [
"Retrieve",
"the",
"first",
"argument",
"if",
"any",
"of",
"an",
"option",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/CommandLine.java#L229-L234 |
alkacon/opencms-core | src/org/opencms/cmis/CmsCmisUtil.java | CmsCmisUtil.addPropertyBigInteger | public static void addPropertyBigInteger(
CmsCmisTypeManager typeManager,
PropertiesImpl props,
String typeId,
Set<String> filter,
String id,
BigInteger value) {
"""
Adds bigint property to a PropertiesImpl.<p>
@param typeManager the type manager
@param p... | java | public static void addPropertyBigInteger(
CmsCmisTypeManager typeManager,
PropertiesImpl props,
String typeId,
Set<String> filter,
String id,
BigInteger value) {
if (!checkAddProperty(typeManager, props, typeId, filter, id)) {
return;
... | [
"public",
"static",
"void",
"addPropertyBigInteger",
"(",
"CmsCmisTypeManager",
"typeManager",
",",
"PropertiesImpl",
"props",
",",
"String",
"typeId",
",",
"Set",
"<",
"String",
">",
"filter",
",",
"String",
"id",
",",
"BigInteger",
"value",
")",
"{",
"if",
"... | Adds bigint property to a PropertiesImpl.<p>
@param typeManager the type manager
@param props the properties
@param typeId the type id
@param filter the property filter string
@param id the property id
@param value the property value | [
"Adds",
"bigint",
"property",
"to",
"a",
"PropertiesImpl",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisUtil.java#L142-L155 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/seo/CmsAliasList.java | CmsAliasList.validateSingle | protected void validateSingle(
CmsUUID structureId,
Map<String, String> sitePaths,
String newSitePath,
final AsyncCallback<String> errorCallback) {
"""
Validation method used when adding a new alias.<p>
@param structureId the structure id
@param sitePaths the site paths
@pa... | java | protected void validateSingle(
CmsUUID structureId,
Map<String, String> sitePaths,
String newSitePath,
final AsyncCallback<String> errorCallback) {
Map<String, String> newMap = new HashMap<String, String>(sitePaths);
newMap.put("NEW", newSitePath); //$NON-NLS-1$
... | [
"protected",
"void",
"validateSingle",
"(",
"CmsUUID",
"structureId",
",",
"Map",
"<",
"String",
",",
"String",
">",
"sitePaths",
",",
"String",
"newSitePath",
",",
"final",
"AsyncCallback",
"<",
"String",
">",
"errorCallback",
")",
"{",
"Map",
"<",
"String",
... | Validation method used when adding a new alias.<p>
@param structureId the structure id
@param sitePaths the site paths
@param newSitePath the new site path
@param errorCallback on error callback | [
"Validation",
"method",
"used",
"when",
"adding",
"a",
"new",
"alias",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/seo/CmsAliasList.java#L582-L604 |
phax/ph-masterdata | ph-masterdata/src/main/java/com/helger/masterdata/postal/PostalCodeManager.java | PostalCodeManager.isValidPostalCodeDefaultNo | public boolean isValidPostalCodeDefaultNo (@Nullable final Locale aCountry, @Nullable final String sPostalCode) {
"""
Check if the passed postal code is valid for the passed country. If no
information for that specific country is defined, the postal code is
assumed invalid!
@param aCountry
The country to che... | java | public boolean isValidPostalCodeDefaultNo (@Nullable final Locale aCountry, @Nullable final String sPostalCode)
{
return isValidPostalCode (aCountry, sPostalCode).getAsBooleanValue (false);
} | [
"public",
"boolean",
"isValidPostalCodeDefaultNo",
"(",
"@",
"Nullable",
"final",
"Locale",
"aCountry",
",",
"@",
"Nullable",
"final",
"String",
"sPostalCode",
")",
"{",
"return",
"isValidPostalCode",
"(",
"aCountry",
",",
"sPostalCode",
")",
".",
"getAsBooleanValue... | Check if the passed postal code is valid for the passed country. If no
information for that specific country is defined, the postal code is
assumed invalid!
@param aCountry
The country to check. May be <code>null</code>.
@param sPostalCode
The postal code to check. May be <code>null</code>.
@return <code>true</code> i... | [
"Check",
"if",
"the",
"passed",
"postal",
"code",
"is",
"valid",
"for",
"the",
"passed",
"country",
".",
"If",
"no",
"information",
"for",
"that",
"specific",
"country",
"is",
"defined",
"the",
"postal",
"code",
"is",
"assumed",
"invalid!"
] | train | https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/postal/PostalCodeManager.java#L151-L154 |
jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/buff/BaseBuffer.java | BaseBuffer.bufferToFields | public int bufferToFields(FieldList record, boolean bDisplayOption, int iMoveMode) {
"""
Move the output buffer to all the fields.
This is a utility method that populates the record.
@param record The target record.
@param bDisplayOption The display option for the movetofield call.
@param iMoveMove The move mo... | java | public int bufferToFields(FieldList record, boolean bDisplayOption, int iMoveMode)
{
this.resetPosition(); // Start at the first field
int iFieldCount = record.getFieldCount(); // Number of fields to read in
int iErrorCode = Constants.NORMAL_RETURN;
int iTempError;
for (int... | [
"public",
"int",
"bufferToFields",
"(",
"FieldList",
"record",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"this",
".",
"resetPosition",
"(",
")",
";",
"// Start at the first field",
"int",
"iFieldCount",
"=",
"record",
".",
"getFieldCount... | Move the output buffer to all the fields.
This is a utility method that populates the record.
@param record The target record.
@param bDisplayOption The display option for the movetofield call.
@param iMoveMove The move mode for the movetofield call.
@return The error code. | [
"Move",
"the",
"output",
"buffer",
"to",
"all",
"the",
"fields",
".",
"This",
"is",
"a",
"utility",
"method",
"that",
"populates",
"the",
"record",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/buff/BaseBuffer.java#L171-L188 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/tools/ImageStatistics.java | ImageStatistics.Variance | public static float Variance(ImageSource fastBitmap, float mean) {
"""
Calculate Variance.
@param fastBitmap Image to be processed.
@param mean Mean.
@return Variance.
"""
return Variance(fastBitmap, mean, 0, 0, fastBitmap.getWidth(), fastBitmap.getHeight());
} | java | public static float Variance(ImageSource fastBitmap, float mean) {
return Variance(fastBitmap, mean, 0, 0, fastBitmap.getWidth(), fastBitmap.getHeight());
} | [
"public",
"static",
"float",
"Variance",
"(",
"ImageSource",
"fastBitmap",
",",
"float",
"mean",
")",
"{",
"return",
"Variance",
"(",
"fastBitmap",
",",
"mean",
",",
"0",
",",
"0",
",",
"fastBitmap",
".",
"getWidth",
"(",
")",
",",
"fastBitmap",
".",
"ge... | Calculate Variance.
@param fastBitmap Image to be processed.
@param mean Mean.
@return Variance. | [
"Calculate",
"Variance",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/tools/ImageStatistics.java#L213-L215 |
ops4j/org.ops4j.base | ops4j-base-lang/src/main/java/org/ops4j/lang/PostConditionException.java | PostConditionException.validateLesserThan | public static void validateLesserThan( Number value, Number limit, String identifier )
throws PostConditionException {
"""
Validates that the value is lesser than a limit.
This method ensures that <code>value < limit</code>.
@param identifier The name of the object.
@param limit The limit that ... | java | public static void validateLesserThan( Number value, Number limit, String identifier )
throws PostConditionException
{
if( value.doubleValue() < limit.doubleValue() )
{
return;
}
throw new PostConditionException( identifier + " was not lesser than " + limit + ". W... | [
"public",
"static",
"void",
"validateLesserThan",
"(",
"Number",
"value",
",",
"Number",
"limit",
",",
"String",
"identifier",
")",
"throws",
"PostConditionException",
"{",
"if",
"(",
"value",
".",
"doubleValue",
"(",
")",
"<",
"limit",
".",
"doubleValue",
"("... | Validates that the value is lesser than a limit.
This method ensures that <code>value < limit</code>.
@param identifier The name of the object.
@param limit The limit that the value must be smaller than.
@param value The value to be tested.
@throws PostConditionException if the condition is not met. | [
"Validates",
"that",
"the",
"value",
"is",
"lesser",
"than",
"a",
"limit",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/PostConditionException.java#L191-L199 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.createGroupViaSudo | public GitlabGroup createGroupViaSudo(String name, String path, GitlabUser sudoUser) throws IOException {
"""
Creates a Group
@param name The name of the group
@param path The path for the group
@param sudoUser The user to create the group on behalf of
@return The GitLab Group
@throws IOException on... | java | public GitlabGroup createGroupViaSudo(String name, String path, GitlabUser sudoUser) throws IOException {
return createGroup(name, path, null, null, sudoUser);
} | [
"public",
"GitlabGroup",
"createGroupViaSudo",
"(",
"String",
"name",
",",
"String",
"path",
",",
"GitlabUser",
"sudoUser",
")",
"throws",
"IOException",
"{",
"return",
"createGroup",
"(",
"name",
",",
"path",
",",
"null",
",",
"null",
",",
"sudoUser",
")",
... | Creates a Group
@param name The name of the group
@param path The path for the group
@param sudoUser The user to create the group on behalf of
@return The GitLab Group
@throws IOException on gitlab api call error | [
"Creates",
"a",
"Group"
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L573-L575 |
protostuff/protostuff | protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java | XmlIOUtil.parseListFrom | public static <T> List<T> parseListFrom(InputStream in, Schema<T> schema,
XMLInputFactory inFactory) throws IOException {
"""
Parses the {@code messages} from the {@link InputStream} using the given {@code schema}.
"""
XMLStreamReader parser = null;
try
{
pa... | java | public static <T> List<T> parseListFrom(InputStream in, Schema<T> schema,
XMLInputFactory inFactory) throws IOException
{
XMLStreamReader parser = null;
try
{
parser = inFactory.createXMLStreamReader(in);
return parseListFrom(parser, schema);
... | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"parseListFrom",
"(",
"InputStream",
"in",
",",
"Schema",
"<",
"T",
">",
"schema",
",",
"XMLInputFactory",
"inFactory",
")",
"throws",
"IOException",
"{",
"XMLStreamReader",
"parser",
"=",
"null",
"... | Parses the {@code messages} from the {@link InputStream} using the given {@code schema}. | [
"Parses",
"the",
"{"
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java#L539-L566 |
finmath/finmath-lib | src/main/java6/net/finmath/functions/AnalyticFormulas.java | AnalyticFormulas.blackScholesGeneralizedOptionValue | public static double blackScholesGeneralizedOptionValue(
double forward,
double volatility,
double optionMaturity,
double optionStrike,
double payoffUnit) {
"""
Calculates the Black-Scholes option value of a call, i.e., the payoff max(S(T)-K,0) P, where S follows a log-normal process with constant l... | java | public static double blackScholesGeneralizedOptionValue(
double forward,
double volatility,
double optionMaturity,
double optionStrike,
double payoffUnit)
{
if(optionMaturity < 0) {
return 0;
}
else if(forward < 0) {
// We use max(X,0) = X + max(-X,0)
return (forward - optionStrike) * pay... | [
"public",
"static",
"double",
"blackScholesGeneralizedOptionValue",
"(",
"double",
"forward",
",",
"double",
"volatility",
",",
"double",
"optionMaturity",
",",
"double",
"optionStrike",
",",
"double",
"payoffUnit",
")",
"{",
"if",
"(",
"optionMaturity",
"<",
"0",
... | Calculates the Black-Scholes option value of a call, i.e., the payoff max(S(T)-K,0) P, where S follows a log-normal process with constant log-volatility.
The method also handles cases where the forward and/or option strike is negative
and some limit cases where the forward and/or the option strike is zero.
@param for... | [
"Calculates",
"the",
"Black",
"-",
"Scholes",
"option",
"value",
"of",
"a",
"call",
"i",
".",
"e",
".",
"the",
"payoff",
"max",
"(",
"S",
"(",
"T",
")",
"-",
"K",
"0",
")",
"P",
"where",
"S",
"follows",
"a",
"log",
"-",
"normal",
"process",
"with... | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/functions/AnalyticFormulas.java#L54-L83 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.osgi/src/com/ibm/ws/logging/internal/osgi/WsTraceRouterImpl.java | WsTraceRouterImpl.setWsTraceHandler | public void setWsTraceHandler(String id, WsTraceHandler ref) {
"""
Add the wsTraceHandler ref. 1 or more LogHandlers may be set.
"""
if (id != null && ref != null) {
RERWLOCK.writeLock().lock();
try {
wsTraceHandlerServices.put(id, ref);
/*
... | java | public void setWsTraceHandler(String id, WsTraceHandler ref) {
if (id != null && ref != null) {
RERWLOCK.writeLock().lock();
try {
wsTraceHandlerServices.put(id, ref);
/*
* Route prev traces to the new LogHandler.
*
... | [
"public",
"void",
"setWsTraceHandler",
"(",
"String",
"id",
",",
"WsTraceHandler",
"ref",
")",
"{",
"if",
"(",
"id",
"!=",
"null",
"&&",
"ref",
"!=",
"null",
")",
"{",
"RERWLOCK",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
... | Add the wsTraceHandler ref. 1 or more LogHandlers may be set. | [
"Add",
"the",
"wsTraceHandler",
"ref",
".",
"1",
"or",
"more",
"LogHandlers",
"may",
"be",
"set",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.osgi/src/com/ibm/ws/logging/internal/osgi/WsTraceRouterImpl.java#L67-L93 |
bingoohuang/excel2javabeans | src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java | BeansToExcelOnTemplate.emptyCells | private void emptyCells(Row tmplRow, int rowOffset, Row row, int colStart, int colEnd) {
"""
置空非JavaBean属性字段关联的单元格。
@param tmplRow 模板行。
@param rowOffset 写入行偏移号。
@param row 需要创建新单元格所在的行。
@param colStart 开始列索引。
@param colEnd 结束列索引。
"""
for (int i = colStart; i <= colEnd; ++i) {
... | java | private void emptyCells(Row tmplRow, int rowOffset, Row row, int colStart, int colEnd) {
for (int i = colStart; i <= colEnd; ++i) {
newCell(tmplRow, i, rowOffset, row, "", 0);
}
} | [
"private",
"void",
"emptyCells",
"(",
"Row",
"tmplRow",
",",
"int",
"rowOffset",
",",
"Row",
"row",
",",
"int",
"colStart",
",",
"int",
"colEnd",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"colStart",
";",
"i",
"<=",
"colEnd",
";",
"++",
"i",
")",
"{",... | 置空非JavaBean属性字段关联的单元格。
@param tmplRow 模板行。
@param rowOffset 写入行偏移号。
@param row 需要创建新单元格所在的行。
@param colStart 开始列索引。
@param colEnd 结束列索引。 | [
"置空非JavaBean属性字段关联的单元格。"
] | train | https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java#L283-L287 |
FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocument.java | ReadOnlyStyledDocument.replaceParagraph | public Tuple3<ReadOnlyStyledDocument<PS, SEG, S>, RichTextChange<PS, SEG, S>, MaterializedListModification<Paragraph<PS, SEG, S>>> replaceParagraph(
int parIdx, UnaryOperator<Paragraph<PS, SEG, S>> mapper) {
"""
Maps the paragraph at the given index by calling {@link #replace(int, int, UnaryOperator)}.... | java | public Tuple3<ReadOnlyStyledDocument<PS, SEG, S>, RichTextChange<PS, SEG, S>, MaterializedListModification<Paragraph<PS, SEG, S>>> replaceParagraph(
int parIdx, UnaryOperator<Paragraph<PS, SEG, S>> mapper) {
ensureValidParagraphIndex(parIdx);
return replace(
new BiIndex(parId... | [
"public",
"Tuple3",
"<",
"ReadOnlyStyledDocument",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
",",
"RichTextChange",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
",",
"MaterializedListModification",
"<",
"Paragraph",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
">",
">",... | Maps the paragraph at the given index by calling {@link #replace(int, int, UnaryOperator)}. Returns
<ol>
<li>
the updated version of this document that includes the replacement,
</li>
<li>
the {@link RichTextChange} that represents the change from this document to the returned one, and
</li>
<li>
the modification used ... | [
"Maps",
"the",
"paragraph",
"at",
"the",
"given",
"index",
"by",
"calling",
"{"
] | train | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocument.java#L445-L452 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java | ListIterate.reverseForEach | public static <T> void reverseForEach(List<T> list, Procedure<? super T> procedure) {
"""
Iterates over the List in reverse order executing the Procedure for each element
"""
if (!list.isEmpty())
{
ListIterate.forEach(list, list.size() - 1, 0, procedure);
}
} | java | public static <T> void reverseForEach(List<T> list, Procedure<? super T> procedure)
{
if (!list.isEmpty())
{
ListIterate.forEach(list, list.size() - 1, 0, procedure);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"reverseForEach",
"(",
"List",
"<",
"T",
">",
"list",
",",
"Procedure",
"<",
"?",
"super",
"T",
">",
"procedure",
")",
"{",
"if",
"(",
"!",
"list",
".",
"isEmpty",
"(",
")",
")",
"{",
"ListIterate",
".",
... | Iterates over the List in reverse order executing the Procedure for each element | [
"Iterates",
"over",
"the",
"List",
"in",
"reverse",
"order",
"executing",
"the",
"Procedure",
"for",
"each",
"element"
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java#L668-L674 |
alibaba/jstorm | jstorm-hdfs/src/main/java/com/alibaba/jstorm/hdfs/common/security/AutoHDFS.java | AutoHDFS.getCredentials | @SuppressWarnings("unchecked")
protected Credentials getCredentials(Map<String, String> credentials) {
"""
/*
@param credentials map with creds.
@return instance of org.apache.hadoop.security.Credentials.
this class's populateCredentials must have been called before.
"""
Credentials credential... | java | @SuppressWarnings("unchecked")
protected Credentials getCredentials(Map<String, String> credentials) {
Credentials credential = null;
if (credentials != null && credentials.containsKey(getCredentialKey())) {
try {
byte[] credBytes = DatatypeConverter.parseBase64Binary(cre... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"Credentials",
"getCredentials",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"credentials",
")",
"{",
"Credentials",
"credential",
"=",
"null",
";",
"if",
"(",
"credentials",
"!=",
"null",
"&&... | /*
@param credentials map with creds.
@return instance of org.apache.hadoop.security.Credentials.
this class's populateCredentials must have been called before. | [
"/",
"*"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-hdfs/src/main/java/com/alibaba/jstorm/hdfs/common/security/AutoHDFS.java#L94-L109 |
jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/interceptor/JaxRsExceptionInterceptor.java | JaxRsExceptionInterceptor.convertExceptionIntoResponse | public Response convertExceptionIntoResponse(final JaxRsRequest theRequest, final JaxRsResponseException theException)
throws IOException {
"""
This method converts an exception into a response
@param theRequest the request
@param theException the thrown exception
@return the response describing the... | java | public Response convertExceptionIntoResponse(final JaxRsRequest theRequest, final JaxRsResponseException theException)
throws IOException {
return handleExceptionWithoutServletError(theRequest, theException);
} | [
"public",
"Response",
"convertExceptionIntoResponse",
"(",
"final",
"JaxRsRequest",
"theRequest",
",",
"final",
"JaxRsResponseException",
"theException",
")",
"throws",
"IOException",
"{",
"return",
"handleExceptionWithoutServletError",
"(",
"theRequest",
",",
"theException",... | This method converts an exception into a response
@param theRequest the request
@param theException the thrown exception
@return the response describing the error
@throws IOException | [
"This",
"method",
"converts",
"an",
"exception",
"into",
"a",
"response"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/interceptor/JaxRsExceptionInterceptor.java#L101-L104 |
sarl/sarl | main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java | MavenHelper.createArtifact | public Artifact createArtifact(String groupId, String artifactId) {
"""
Create an instance of artifact with a version range that corresponds to all versions.
@param groupId the group identifier.
@param artifactId the artifact identifier.
@return the artifact descriptor.
@since 0.8
"""
return this.repos... | java | public Artifact createArtifact(String groupId, String artifactId) {
return this.repositorySystem.createArtifact(groupId, artifactId, "RELEASE", "jar"); //$NON-NLS-1$ //$NON-NLS-2$
} | [
"public",
"Artifact",
"createArtifact",
"(",
"String",
"groupId",
",",
"String",
"artifactId",
")",
"{",
"return",
"this",
".",
"repositorySystem",
".",
"createArtifact",
"(",
"groupId",
",",
"artifactId",
",",
"\"RELEASE\"",
",",
"\"jar\"",
")",
";",
"//$NON-NL... | Create an instance of artifact with a version range that corresponds to all versions.
@param groupId the group identifier.
@param artifactId the artifact identifier.
@return the artifact descriptor.
@since 0.8 | [
"Create",
"an",
"instance",
"of",
"artifact",
"with",
"a",
"version",
"range",
"that",
"corresponds",
"to",
"all",
"versions",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java#L293-L295 |
blinkfox/zealot | src/main/java/com/blinkfox/zealot/core/ZealotKhala.java | ZealotKhala.notIn | public ZealotKhala notIn(String field, Collection<?> values) {
"""
生成" NOT IN "范围查询的SQL片段.
@param field 数据库字段
@param values 集合的值
@return ZealotKhala实例
"""
return this.doIn(ZealotConst.ONE_SPACE, field, values, true, false);
} | java | public ZealotKhala notIn(String field, Collection<?> values) {
return this.doIn(ZealotConst.ONE_SPACE, field, values, true, false);
} | [
"public",
"ZealotKhala",
"notIn",
"(",
"String",
"field",
",",
"Collection",
"<",
"?",
">",
"values",
")",
"{",
"return",
"this",
".",
"doIn",
"(",
"ZealotConst",
".",
"ONE_SPACE",
",",
"field",
",",
"values",
",",
"true",
",",
"false",
")",
";",
"}"
] | 生成" NOT IN "范围查询的SQL片段.
@param field 数据库字段
@param values 集合的值
@return ZealotKhala实例 | [
"生成",
"NOT",
"IN",
"范围查询的SQL片段",
"."
] | train | https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L1410-L1412 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/CheckSumUtils.java | CheckSumUtils.getChecksum | public static String getChecksum(String url, ResourceReaderHandler rsReader, JawrConfig jawrConfig)
throws IOException, ResourceNotFoundException {
"""
Return the checksum of the path given in parameter, if the resource is
not found, null will b returned.
@param url
the url path to the resource file
@para... | java | public static String getChecksum(String url, ResourceReaderHandler rsReader, JawrConfig jawrConfig)
throws IOException, ResourceNotFoundException {
String checksum = null;
InputStream is = null;
boolean generatedBinaryResource = jawrConfig.getGeneratorRegistry().isGeneratedBinaryResource(url);
try {
i... | [
"public",
"static",
"String",
"getChecksum",
"(",
"String",
"url",
",",
"ResourceReaderHandler",
"rsReader",
",",
"JawrConfig",
"jawrConfig",
")",
"throws",
"IOException",
",",
"ResourceNotFoundException",
"{",
"String",
"checksum",
"=",
"null",
";",
"InputStream",
... | Return the checksum of the path given in parameter, if the resource is
not found, null will b returned.
@param url
the url path to the resource file
@param rsReader
the resource reader handler
@param jawrConfig
the jawrConfig
@return checksum of the path given in parameter
@throws IOException
if an IO exception occurs... | [
"Return",
"the",
"checksum",
"of",
"the",
"path",
"given",
"in",
"parameter",
"if",
"the",
"resource",
"is",
"not",
"found",
"null",
"will",
"b",
"returned",
"."
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/CheckSumUtils.java#L59-L87 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/CanBeStaticAnalyzer.java | CanBeStaticAnalyzer.memberOfEnclosing | private static boolean memberOfEnclosing(Symbol owner, VisitorState state, Symbol sym) {
"""
Is sym a non-static member of an enclosing class of currentClass?
"""
if (sym == null || !sym.hasOuterInstance()) {
return false;
}
for (ClassSymbol encl = owner.owner.enclClass();
encl != nul... | java | private static boolean memberOfEnclosing(Symbol owner, VisitorState state, Symbol sym) {
if (sym == null || !sym.hasOuterInstance()) {
return false;
}
for (ClassSymbol encl = owner.owner.enclClass();
encl != null;
encl = encl.owner != null ? encl.owner.enclClass() : null) {
if (s... | [
"private",
"static",
"boolean",
"memberOfEnclosing",
"(",
"Symbol",
"owner",
",",
"VisitorState",
"state",
",",
"Symbol",
"sym",
")",
"{",
"if",
"(",
"sym",
"==",
"null",
"||",
"!",
"sym",
".",
"hasOuterInstance",
"(",
")",
")",
"{",
"return",
"false",
"... | Is sym a non-static member of an enclosing class of currentClass? | [
"Is",
"sym",
"a",
"non",
"-",
"static",
"member",
"of",
"an",
"enclosing",
"class",
"of",
"currentClass?"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/CanBeStaticAnalyzer.java#L180-L192 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java | InternalUtils.setCurrentActionResolver | public static void setCurrentActionResolver( ActionResolver resolver, HttpServletRequest request,
ServletContext servletContext ) {
"""
Set the current {@link ActionResolver} (or {@link PageFlowController}) in the user session.
@param resolver the {@link ActionRe... | java | public static void setCurrentActionResolver( ActionResolver resolver, HttpServletRequest request,
ServletContext servletContext )
{
StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
HttpServletRequest unwrappedRequest = PageFlowU... | [
"public",
"static",
"void",
"setCurrentActionResolver",
"(",
"ActionResolver",
"resolver",
",",
"HttpServletRequest",
"request",
",",
"ServletContext",
"servletContext",
")",
"{",
"StorageHandler",
"sh",
"=",
"Handlers",
".",
"get",
"(",
"servletContext",
")",
".",
... | Set the current {@link ActionResolver} (or {@link PageFlowController}) in the user session.
@param resolver the {@link ActionResolver} to set as the current one in the user session.
@deprecated Will be removed in the next version. | [
"Set",
"the",
"current",
"{",
"@link",
"ActionResolver",
"}",
"(",
"or",
"{",
"@link",
"PageFlowController",
"}",
")",
"in",
"the",
"user",
"session",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L694-L741 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.addOutgoingFor | public void addOutgoingFor(SDVariable[] variables, DifferentialFunction function) {
"""
Adds outgoing arguments to the graph for the specified DifferentialFunction
Also checks for input arguments and updates the graph adding an appropriate edge when the full graph is declared.
@param variables Variables - argu... | java | public void addOutgoingFor(SDVariable[] variables, DifferentialFunction function) {
String[] varNames = new String[variables.length];
for (int i = 0; i < varNames.length; i++) {
varNames[i] = variables[i].getVarName();
}
addOutgoingFor(varNames, function);
} | [
"public",
"void",
"addOutgoingFor",
"(",
"SDVariable",
"[",
"]",
"variables",
",",
"DifferentialFunction",
"function",
")",
"{",
"String",
"[",
"]",
"varNames",
"=",
"new",
"String",
"[",
"variables",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
... | Adds outgoing arguments to the graph for the specified DifferentialFunction
Also checks for input arguments and updates the graph adding an appropriate edge when the full graph is declared.
@param variables Variables - arguments for the specified differential function
@param function Differential function | [
"Adds",
"outgoing",
"arguments",
"to",
"the",
"graph",
"for",
"the",
"specified",
"DifferentialFunction",
"Also",
"checks",
"for",
"input",
"arguments",
"and",
"updates",
"the",
"graph",
"adding",
"an",
"appropriate",
"edge",
"when",
"the",
"full",
"graph",
"is"... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L1106-L1113 |
CleverTap/clevertap-android-sdk | clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/DBAdapter.java | DBAdapter.markReadMessageForId | synchronized boolean markReadMessageForId(String messageId, String userId) {
"""
Marks inbox message as read for given messageId
@param messageId String messageId
@return boolean value depending on success of operation
"""
if(messageId == null || userId == null) return false;
final String tN... | java | synchronized boolean markReadMessageForId(String messageId, String userId){
if(messageId == null || userId == null) return false;
final String tName = Table.INBOX_MESSAGES.getName();
try{
final SQLiteDatabase db = dbHelper.getWritableDatabase();
ContentValues cv = new Co... | [
"synchronized",
"boolean",
"markReadMessageForId",
"(",
"String",
"messageId",
",",
"String",
"userId",
")",
"{",
"if",
"(",
"messageId",
"==",
"null",
"||",
"userId",
"==",
"null",
")",
"return",
"false",
";",
"final",
"String",
"tName",
"=",
"Table",
".",
... | Marks inbox message as read for given messageId
@param messageId String messageId
@return boolean value depending on success of operation | [
"Marks",
"inbox",
"message",
"as",
"read",
"for",
"given",
"messageId"
] | train | https://github.com/CleverTap/clevertap-android-sdk/blob/be134c06a4f07494c398335ad9ff4976633743e1/clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/DBAdapter.java#L694-L710 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/nio/IOUtil.java | IOUtil.readFullyOrNothing | public static boolean readFullyOrNothing(InputStream in, byte[] buffer) throws IOException {
"""
Fills a buffer from an {@link InputStream}. If it doesn't contain any
more data, returns {@code false}. If it contains some data, but not
enough to fill the buffer, {@link EOFException} is thrown.
@param in th... | java | public static boolean readFullyOrNothing(InputStream in, byte[] buffer) throws IOException {
int bytesRead = 0;
do {
int count = in.read(buffer, bytesRead, buffer.length - bytesRead);
if (count < 0) {
if (bytesRead == 0) {
return false;
... | [
"public",
"static",
"boolean",
"readFullyOrNothing",
"(",
"InputStream",
"in",
",",
"byte",
"[",
"]",
"buffer",
")",
"throws",
"IOException",
"{",
"int",
"bytesRead",
"=",
"0",
";",
"do",
"{",
"int",
"count",
"=",
"in",
".",
"read",
"(",
"buffer",
",",
... | Fills a buffer from an {@link InputStream}. If it doesn't contain any
more data, returns {@code false}. If it contains some data, but not
enough to fill the buffer, {@link EOFException} is thrown.
@param in the {@link InputStream} to read from
@param buffer the buffer to fill
@return {@code true} if the buffer was... | [
"Fills",
"a",
"buffer",
"from",
"an",
"{",
"@link",
"InputStream",
"}",
".",
"If",
"it",
"doesn",
"t",
"contain",
"any",
"more",
"data",
"returns",
"{",
"@code",
"false",
"}",
".",
"If",
"it",
"contains",
"some",
"data",
"but",
"not",
"enough",
"to",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/nio/IOUtil.java#L147-L160 |
openengsb/openengsb | components/edb/src/main/java/org/openengsb/core/edb/jpa/internal/AbstractEDBService.java | AbstractEDBService.performCommitLogic | protected Long performCommitLogic(EDBCommit commit) throws EDBException {
"""
Performs the actual commit logic for the EDB, including the hooks and the revision checking.
"""
if (!(commit instanceof JPACommit)) {
throw new EDBException("The given commit type is not supported.");
}
... | java | protected Long performCommitLogic(EDBCommit commit) throws EDBException {
if (!(commit instanceof JPACommit)) {
throw new EDBException("The given commit type is not supported.");
}
if (commit.isCommitted()) {
throw new EDBException("EDBCommit is already commitet.");
... | [
"protected",
"Long",
"performCommitLogic",
"(",
"EDBCommit",
"commit",
")",
"throws",
"EDBException",
"{",
"if",
"(",
"!",
"(",
"commit",
"instanceof",
"JPACommit",
")",
")",
"{",
"throw",
"new",
"EDBException",
"(",
"\"The given commit type is not supported.\"",
")... | Performs the actual commit logic for the EDB, including the hooks and the revision checking. | [
"Performs",
"the",
"actual",
"commit",
"logic",
"for",
"the",
"EDB",
"including",
"the",
"hooks",
"and",
"the",
"revision",
"checking",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/edb/src/main/java/org/openengsb/core/edb/jpa/internal/AbstractEDBService.java#L64-L84 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/internal/provisioning/api/NotificationsApi.java | NotificationsApi.getHandshakeWithHttpInfo | public ApiResponse<Void> getHandshakeWithHttpInfo() throws ApiException {
"""
CometD handshake
CometD handshake, see https://docs.cometd.org/current/reference/#_bayeux_meta_handshake
@return ApiResponse<Void>
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the respons... | java | public ApiResponse<Void> getHandshakeWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = getHandshakeValidateBeforeCall(null, null);
return apiClient.execute(call);
} | [
"public",
"ApiResponse",
"<",
"Void",
">",
"getHandshakeWithHttpInfo",
"(",
")",
"throws",
"ApiException",
"{",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"call",
"=",
"getHandshakeValidateBeforeCall",
"(",
"null",
",",
"null",
")",
";",
"return",
"ap... | CometD handshake
CometD handshake, see https://docs.cometd.org/current/reference/#_bayeux_meta_handshake
@return ApiResponse<Void>
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"CometD",
"handshake",
"CometD",
"handshake",
"see",
"https",
":",
"//",
"docs",
".",
"cometd",
".",
"org",
"/",
"current",
"/",
"reference",
"/",
"#_bayeux_meta_handshake"
] | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/NotificationsApi.java#L346-L349 |
andriusvelykis/reflow-maven-skin | reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/SkinConfigTool.java | SkinConfigTool.getChild | private Xpp3Dom getChild(Xpp3Dom parentNode, String name) {
"""
Retrieves the child node. Tests both default name and with namespace.
@param parentNode
@param name
@return
"""
Xpp3Dom child = parentNode.getChild(name);
if (child != null) {
return child;
}
return parentNode.getChild(namespace... | java | private Xpp3Dom getChild(Xpp3Dom parentNode, String name) {
Xpp3Dom child = parentNode.getChild(name);
if (child != null) {
return child;
}
return parentNode.getChild(namespace + name);
} | [
"private",
"Xpp3Dom",
"getChild",
"(",
"Xpp3Dom",
"parentNode",
",",
"String",
"name",
")",
"{",
"Xpp3Dom",
"child",
"=",
"parentNode",
".",
"getChild",
"(",
"name",
")",
";",
"if",
"(",
"child",
"!=",
"null",
")",
"{",
"return",
"child",
";",
"}",
"re... | Retrieves the child node. Tests both default name and with namespace.
@param parentNode
@param name
@return | [
"Retrieves",
"the",
"child",
"node",
".",
"Tests",
"both",
"default",
"name",
"and",
"with",
"namespace",
"."
] | train | https://github.com/andriusvelykis/reflow-maven-skin/blob/01170ae1426a1adfe7cc9c199e77aaa2ecb37ef2/reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/SkinConfigTool.java#L220-L227 |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java | OSchemaHelper.oProperty | public OSchemaHelper oProperty(String propertyName, OType type) {
"""
Create {@link OProperty} if required
@param propertyName property name to create
@param type type of property to create
@return this helper
"""
checkOClass();
lastProperty = lastClass.getProperty(propertyName);
if(lastProperty==null... | java | public OSchemaHelper oProperty(String propertyName, OType type)
{
checkOClass();
lastProperty = lastClass.getProperty(propertyName);
if(lastProperty==null)
{
lastProperty = lastClass.createProperty(propertyName, type);
}
else
{
if(!type.equals(lastProperty.getType()))
{
lastProperty.setType(... | [
"public",
"OSchemaHelper",
"oProperty",
"(",
"String",
"propertyName",
",",
"OType",
"type",
")",
"{",
"checkOClass",
"(",
")",
";",
"lastProperty",
"=",
"lastClass",
".",
"getProperty",
"(",
"propertyName",
")",
";",
"if",
"(",
"lastProperty",
"==",
"null",
... | Create {@link OProperty} if required
@param propertyName property name to create
@param type type of property to create
@return this helper | [
"Create",
"{"
] | train | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java#L125-L141 |
comapi/comapi-chat-sdk-android | COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java | ChatController.getPreviousMessages | Observable<ChatResult> getPreviousMessages(final String conversationId) {
"""
Gets next page of messages and saves them using {@link ChatStore} implementation.
@param conversationId ID of a conversation in which participant is typing a message.
@return Observable with the result.
"""
return persis... | java | Observable<ChatResult> getPreviousMessages(final String conversationId) {
return persistenceController.getConversation(conversationId)
.map(conversation -> conversation != null ? conversation.getFirstLocalEventId() : null)
.flatMap(from -> {
final Long query... | [
"Observable",
"<",
"ChatResult",
">",
"getPreviousMessages",
"(",
"final",
"String",
"conversationId",
")",
"{",
"return",
"persistenceController",
".",
"getConversation",
"(",
"conversationId",
")",
".",
"map",
"(",
"conversation",
"->",
"conversation",
"!=",
"null... | Gets next page of messages and saves them using {@link ChatStore} implementation.
@param conversationId ID of a conversation in which participant is typing a message.
@return Observable with the result. | [
"Gets",
"next",
"page",
"of",
"messages",
"and",
"saves",
"them",
"using",
"{",
"@link",
"ChatStore",
"}",
"implementation",
"."
] | train | https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java#L287-L315 |
jenetics/jenetics | jenetics/src/main/java/io/jenetics/engine/Limits.java | Limits.byExecutionTime | public static Predicate<Object>
byExecutionTime(final Duration duration, final Clock clock) {
"""
Return a predicate, which will truncate the evolution stream if the GA
execution exceeds a given time duration. This predicate is (normally)
used as safety net, for guaranteed stream truncation.
<pre>{@code
fin... | java | public static Predicate<Object>
byExecutionTime(final Duration duration, final Clock clock) {
return new ExecutionTimeLimit(duration, clock);
} | [
"public",
"static",
"Predicate",
"<",
"Object",
">",
"byExecutionTime",
"(",
"final",
"Duration",
"duration",
",",
"final",
"Clock",
"clock",
")",
"{",
"return",
"new",
"ExecutionTimeLimit",
"(",
"duration",
",",
"clock",
")",
";",
"}"
] | Return a predicate, which will truncate the evolution stream if the GA
execution exceeds a given time duration. This predicate is (normally)
used as safety net, for guaranteed stream truncation.
<pre>{@code
final Phenotype<DoubleGene, Double> result = engine.stream()
// Truncate the evolution stream after 5 "steady" g... | [
"Return",
"a",
"predicate",
"which",
"will",
"truncate",
"the",
"evolution",
"stream",
"if",
"the",
"GA",
"execution",
"exceeds",
"a",
"given",
"time",
"duration",
".",
"This",
"predicate",
"is",
"(",
"normally",
")",
"used",
"as",
"safety",
"net",
"for",
... | train | https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/engine/Limits.java#L143-L146 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxFolder.java | BoxFolder.createWebLink | public BoxWebLink.Info createWebLink(URL linkURL, String description) {
"""
Uploads a new weblink to this folder.
@param linkURL the URL the weblink points to.
@param description the weblink's description.
@return the uploaded weblink's info.
"""
return this.createWebLink(null, linkURL, descri... | java | public BoxWebLink.Info createWebLink(URL linkURL, String description) {
return this.createWebLink(null, linkURL, description);
} | [
"public",
"BoxWebLink",
".",
"Info",
"createWebLink",
"(",
"URL",
"linkURL",
",",
"String",
"description",
")",
"{",
"return",
"this",
".",
"createWebLink",
"(",
"null",
",",
"linkURL",
",",
"description",
")",
";",
"}"
] | Uploads a new weblink to this folder.
@param linkURL the URL the weblink points to.
@param description the weblink's description.
@return the uploaded weblink's info. | [
"Uploads",
"a",
"new",
"weblink",
"to",
"this",
"folder",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFolder.java#L594-L596 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java | Activator.rollbackBean | public void rollbackBean(ContainerTx tx, BeanO bean) {
"""
Perform rollback-time processing for the specified transaction and
bean. This method should be called for each bean which was
participating in a transaction which was rolled back.
Removes the transaction-local instance from the cache.
@param tx The... | java | public void rollbackBean(ContainerTx tx, BeanO bean)
{
bean.getActivationStrategy().atRollback(tx, bean);
} | [
"public",
"void",
"rollbackBean",
"(",
"ContainerTx",
"tx",
",",
"BeanO",
"bean",
")",
"{",
"bean",
".",
"getActivationStrategy",
"(",
")",
".",
"atRollback",
"(",
"tx",
",",
"bean",
")",
";",
"}"
] | Perform rollback-time processing for the specified transaction and
bean. This method should be called for each bean which was
participating in a transaction which was rolled back.
Removes the transaction-local instance from the cache.
@param tx The transaction which was just rolled back
@param bean The bean for rollb... | [
"Perform",
"rollback",
"-",
"time",
"processing",
"for",
"the",
"specified",
"transaction",
"and",
"bean",
".",
"This",
"method",
"should",
"be",
"called",
"for",
"each",
"bean",
"which",
"was",
"participating",
"in",
"a",
"transaction",
"which",
"was",
"rolle... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java#L419-L422 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java | InternalService.sendMessage | public void sendMessage(@NonNull final String conversationId, @NonNull final MessageToSend message, @Nullable Callback<ComapiResult<MessageSentResponse>> callback) {
"""
Send message to the chanel.
@param conversationId ID of a conversation to send a message to.
@param message Message to be send.
@para... | java | public void sendMessage(@NonNull final String conversationId, @NonNull final MessageToSend message, @Nullable Callback<ComapiResult<MessageSentResponse>> callback) {
adapter.adapt(sendMessage(conversationId, message), callback);
} | [
"public",
"void",
"sendMessage",
"(",
"@",
"NonNull",
"final",
"String",
"conversationId",
",",
"@",
"NonNull",
"final",
"MessageToSend",
"message",
",",
"@",
"Nullable",
"Callback",
"<",
"ComapiResult",
"<",
"MessageSentResponse",
">",
">",
"callback",
")",
"{"... | Send message to the chanel.
@param conversationId ID of a conversation to send a message to.
@param message Message to be send.
@param callback Callback to deliver new session instance. | [
"Send",
"message",
"to",
"the",
"chanel",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L717-L719 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/TransformsInner.java | TransformsInner.updateAsync | public Observable<TransformInner> updateAsync(String resourceGroupName, String accountName, String transformName, TransformInner parameters) {
"""
Update Transform.
Updates a Transform.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services... | java | public Observable<TransformInner> updateAsync(String resourceGroupName, String accountName, String transformName, TransformInner parameters) {
return updateWithServiceResponseAsync(resourceGroupName, accountName, transformName, parameters).map(new Func1<ServiceResponse<TransformInner>, TransformInner>() {
... | [
"public",
"Observable",
"<",
"TransformInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"transformName",
",",
"TransformInner",
"parameters",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resource... | Update Transform.
Updates a Transform.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param transformName The Transform name.
@param parameters The request parameters
@throws IllegalArgumentException thrown if parameters fail ... | [
"Update",
"Transform",
".",
"Updates",
"a",
"Transform",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/TransformsInner.java#L703-L710 |
FrodeRanders/java-vopn | src/main/java/org/gautelis/vopn/io/FileIO.java | FileIO.writeToTempFile | public static File writeToTempFile(ByteBuffer byteBuffer, String prefix, String suffix) throws IOException {
"""
Writes a ByteBuffer (internally a series of byte[]) to a temporary file
"""
File tmpOutputFile = null;
try (RandomAccessFile outputRaf = new RandomAccessFile(tmpOutputFile, "rw")) {... | java | public static File writeToTempFile(ByteBuffer byteBuffer, String prefix, String suffix) throws IOException {
File tmpOutputFile = null;
try (RandomAccessFile outputRaf = new RandomAccessFile(tmpOutputFile, "rw")) {
// Create temporary file
tmpOutputFile = File.createTempFile(pre... | [
"public",
"static",
"File",
"writeToTempFile",
"(",
"ByteBuffer",
"byteBuffer",
",",
"String",
"prefix",
",",
"String",
"suffix",
")",
"throws",
"IOException",
"{",
"File",
"tmpOutputFile",
"=",
"null",
";",
"try",
"(",
"RandomAccessFile",
"outputRaf",
"=",
"new... | Writes a ByteBuffer (internally a series of byte[]) to a temporary file | [
"Writes",
"a",
"ByteBuffer",
"(",
"internally",
"a",
"series",
"of",
"byte",
"[]",
")",
"to",
"a",
"temporary",
"file"
] | train | https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/io/FileIO.java#L121-L136 |
dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/impl/Filename.java | Filename.setCurrentFile | public static boolean setCurrentFile(File databaseDir, long descriptorNumber)
throws IOException {
"""
Make the CURRENT file point to the descriptor file with the
specified number.
@return true if successful; false otherwise
"""
String manifest = descriptorFileName(descriptorNumber);
... | java | public static boolean setCurrentFile(File databaseDir, long descriptorNumber)
throws IOException
{
String manifest = descriptorFileName(descriptorNumber);
String temp = tempFileName(descriptorNumber);
File tempFile = new File(databaseDir, temp);
writeStringToFileSync(man... | [
"public",
"static",
"boolean",
"setCurrentFile",
"(",
"File",
"databaseDir",
",",
"long",
"descriptorNumber",
")",
"throws",
"IOException",
"{",
"String",
"manifest",
"=",
"descriptorFileName",
"(",
"descriptorNumber",
")",
";",
"String",
"temp",
"=",
"tempFileName"... | Make the CURRENT file point to the descriptor file with the
specified number.
@return true if successful; false otherwise | [
"Make",
"the",
"CURRENT",
"file",
"point",
"to",
"the",
"descriptor",
"file",
"with",
"the",
"specified",
"number",
"."
] | train | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/impl/Filename.java#L165-L181 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/Util.java | Util.pwrLawNextDouble | public static final double pwrLawNextDouble(final int ppo, final double curPoint,
final boolean roundToInt, final double logBase) {
"""
Computes the next larger double in the power series
<i>point = logBase<sup>( i / ppo )</sup></i> given the current point in the series.
For illustration, this can be used ... | java | public static final double pwrLawNextDouble(final int ppo, final double curPoint,
final boolean roundToInt, final double logBase) {
final double cur = (curPoint < 1.0) ? 1.0 : curPoint;
double gi = round((logB(logBase, cur) * ppo) ); //current generating index
double next;
do {
final double ... | [
"public",
"static",
"final",
"double",
"pwrLawNextDouble",
"(",
"final",
"int",
"ppo",
",",
"final",
"double",
"curPoint",
",",
"final",
"boolean",
"roundToInt",
",",
"final",
"double",
"logBase",
")",
"{",
"final",
"double",
"cur",
"=",
"(",
"curPoint",
"<"... | Computes the next larger double in the power series
<i>point = logBase<sup>( i / ppo )</sup></i> given the current point in the series.
For illustration, this can be used in a loop as follows:
<pre>{@code
double maxP = 1024.0;
double minP = 1.0;
int ppo = 2;
double logBase = 2.0;
for (double p = minP; p <= maxP; p = ... | [
"Computes",
"the",
"next",
"larger",
"double",
"in",
"the",
"power",
"series",
"<i",
">",
"point",
"=",
"logBase<sup",
">",
"(",
"i",
"/",
"ppo",
")",
"<",
"/",
"sup",
">",
"<",
"/",
"i",
">",
"given",
"the",
"current",
"point",
"in",
"the",
"serie... | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L633-L643 |
alkacon/opencms-core | src/org/opencms/i18n/CmsEncoder.java | CmsEncoder.encodeHtmlEntities | public static String encodeHtmlEntities(String input, String encoding) {
"""
Encodes all characters that are contained in the String which can not displayed
in the given encodings charset with HTML entity references
like <code>&#8364;</code>.<p>
This is required since a Java String is
internally always s... | java | public static String encodeHtmlEntities(String input, String encoding) {
StringBuffer result = new StringBuffer(input.length() * 2);
CharBuffer buffer = CharBuffer.wrap(input.toCharArray());
Charset charset = Charset.forName(encoding);
CharsetEncoder encoder = charset.newEncoder();
... | [
"public",
"static",
"String",
"encodeHtmlEntities",
"(",
"String",
"input",
",",
"String",
"encoding",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"input",
".",
"length",
"(",
")",
"*",
"2",
")",
";",
"CharBuffer",
"buffer",
"=",
"... | Encodes all characters that are contained in the String which can not displayed
in the given encodings charset with HTML entity references
like <code>&#8364;</code>.<p>
This is required since a Java String is
internally always stored as Unicode, meaning it can contain almost every character, but
the HTML charset u... | [
"Encodes",
"all",
"characters",
"that",
"are",
"contained",
"in",
"the",
"String",
"which",
"can",
"not",
"displayed",
"in",
"the",
"given",
"encodings",
"charset",
"with",
"HTML",
"entity",
"references",
"like",
"<code",
">",
"&",
";",
"#8364",
";",
"<",... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsEncoder.java#L431-L455 |
xiancloud/xian | xian-ruleengine/src/main/java/info/xiancloud/rules/RuleControllerRouter.java | RuleControllerRouter.getRule | private static RuleController getRule(String baseUri, UnitRequest controllerRequest, TransactionalNotifyHandler handler) {
"""
This method is in fact a factory method which produces the mapped rule controller.
@param baseUri the standard uri: /group/unit
@return the mapped rule controller or null if not mapped... | java | private static RuleController getRule(String baseUri, UnitRequest controllerRequest, TransactionalNotifyHandler handler) {
if (ruleMap == null) {
synchronized (LOCK_FOR_LAZY_INITIALIZATION) {
if (ruleMap == null) {
loadRules();
}
}
... | [
"private",
"static",
"RuleController",
"getRule",
"(",
"String",
"baseUri",
",",
"UnitRequest",
"controllerRequest",
",",
"TransactionalNotifyHandler",
"handler",
")",
"{",
"if",
"(",
"ruleMap",
"==",
"null",
")",
"{",
"synchronized",
"(",
"LOCK_FOR_LAZY_INITIALIZATIO... | This method is in fact a factory method which produces the mapped rule controller.
@param baseUri the standard uri: /group/unit
@return the mapped rule controller or null if not mapped. | [
"This",
"method",
"is",
"in",
"fact",
"a",
"factory",
"method",
"which",
"produces",
"the",
"mapped",
"rule",
"controller",
"."
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-ruleengine/src/main/java/info/xiancloud/rules/RuleControllerRouter.java#L46-L69 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/RaftLock.java | RaftLock.onSessionClose | @Override
protected void onSessionClose(long sessionId, Map<Long, Object> responses) {
"""
Releases the lock if the current lock holder's session is closed.
"""
removeInvocationRefUids(sessionId);
if (owner != null && owner.sessionId() == sessionId) {
ReleaseResult result = doR... | java | @Override
protected void onSessionClose(long sessionId, Map<Long, Object> responses) {
removeInvocationRefUids(sessionId);
if (owner != null && owner.sessionId() == sessionId) {
ReleaseResult result = doRelease(owner.endpoint(), newUnsecureUUID(), lockCount);
for (LockInvoca... | [
"@",
"Override",
"protected",
"void",
"onSessionClose",
"(",
"long",
"sessionId",
",",
"Map",
"<",
"Long",
",",
"Object",
">",
"responses",
")",
"{",
"removeInvocationRefUids",
"(",
"sessionId",
")",
";",
"if",
"(",
"owner",
"!=",
"null",
"&&",
"owner",
".... | Releases the lock if the current lock holder's session is closed. | [
"Releases",
"the",
"lock",
"if",
"the",
"current",
"lock",
"holder",
"s",
"session",
"is",
"closed",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/RaftLock.java#L234-L244 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/httpsessions/ExtensionHttpSessions.java | ExtensionHttpSessions.isSessionToken | public boolean isSessionToken(String site, String token) {
"""
Checks if a particular token is a session token name for a particular site.
@param site the site. This parameter has to be formed as defined in the
{@link ExtensionHttpSessions} class documentation. However, if the protocol is
missing, a default p... | java | public boolean isSessionToken(String site, String token) {
// Add a default port
if (!site.contains(":")) {
site = site + (":80");
}
HttpSessionTokensSet siteTokens = sessionTokens.get(site);
if (siteTokens == null)
return false;
return siteTokens.isSessionToken(token);
} | [
"public",
"boolean",
"isSessionToken",
"(",
"String",
"site",
",",
"String",
"token",
")",
"{",
"// Add a default port",
"if",
"(",
"!",
"site",
".",
"contains",
"(",
"\":\"",
")",
")",
"{",
"site",
"=",
"site",
"+",
"(",
"\":80\"",
")",
";",
"}",
"Htt... | Checks if a particular token is a session token name for a particular site.
@param site the site. This parameter has to be formed as defined in the
{@link ExtensionHttpSessions} class documentation. However, if the protocol is
missing, a default protocol of 80 is used.
@param token the token
@return true, if it is ses... | [
"Checks",
"if",
"a",
"particular",
"token",
"is",
"a",
"session",
"token",
"name",
"for",
"a",
"particular",
"site",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/httpsessions/ExtensionHttpSessions.java#L361-L370 |
neo4j-contrib/neo4j-apoc-procedures | src/main/java/apoc/schema/Schemas.java | Schemas.indexExists | private Boolean indexExists(String labelName, List<String> propertyNames) {
"""
Checks if an index exists for a given label and a list of properties
This method checks for index on nodes
@param labelName
@param propertyNames
@return true if the index exists otherwise it returns false
"""
Schema s... | java | private Boolean indexExists(String labelName, List<String> propertyNames) {
Schema schema = db.schema();
for (IndexDefinition indexDefinition : Iterables.asList(schema.getIndexes(Label.label(labelName)))) {
List<String> properties = Iterables.asList(indexDefinition.getPropertyKeys());
... | [
"private",
"Boolean",
"indexExists",
"(",
"String",
"labelName",
",",
"List",
"<",
"String",
">",
"propertyNames",
")",
"{",
"Schema",
"schema",
"=",
"db",
".",
"schema",
"(",
")",
";",
"for",
"(",
"IndexDefinition",
"indexDefinition",
":",
"Iterables",
".",... | Checks if an index exists for a given label and a list of properties
This method checks for index on nodes
@param labelName
@param propertyNames
@return true if the index exists otherwise it returns false | [
"Checks",
"if",
"an",
"index",
"exists",
"for",
"a",
"given",
"label",
"and",
"a",
"list",
"of",
"properties",
"This",
"method",
"checks",
"for",
"index",
"on",
"nodes"
] | train | https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/e8386975d1c512c0e4388a1a61f5496121c04f86/src/main/java/apoc/schema/Schemas.java#L210-L222 |
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/net/IpHelper.java | IpHelper.getLocalIpAddress | public static InetAddress getLocalIpAddress() throws RuntimeException {
"""
Returns the primary InetAddress of localhost
@return InetAddress The InetAddress of the local host
@throws RuntimeException
On any error
@since 1.0
"""
try
{
List<InetAddress> ips = getLocalIpAddresses(false, true);
... | java | public static InetAddress getLocalIpAddress() throws RuntimeException
{
try
{
List<InetAddress> ips = getLocalIpAddresses(false, true);
for (InetAddress ip : ips)
{
log.debug("[IpHelper] {getLocalIpAddress} Considering locality of " + ip.getHostAddress());
if (!ip.isAnyLocalAddress() && (ip insta... | [
"public",
"static",
"InetAddress",
"getLocalIpAddress",
"(",
")",
"throws",
"RuntimeException",
"{",
"try",
"{",
"List",
"<",
"InetAddress",
">",
"ips",
"=",
"getLocalIpAddresses",
"(",
"false",
",",
"true",
")",
";",
"for",
"(",
"InetAddress",
"ip",
":",
"i... | Returns the primary InetAddress of localhost
@return InetAddress The InetAddress of the local host
@throws RuntimeException
On any error
@since 1.0 | [
"Returns",
"the",
"primary",
"InetAddress",
"of",
"localhost"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/net/IpHelper.java#L113-L140 |
ACRA/acra | acra-core/src/main/java/org/acra/builder/ReportExecutor.java | ReportExecutor.sendReport | private void sendReport(@NonNull File report, boolean onlySendSilentReports) {
"""
Starts a Process to start sending outstanding error reports.
@param onlySendSilentReports If true then only send silent reports.
"""
if (enabled) {
schedulerStarter.scheduleReports(report, onlySendSilentRe... | java | private void sendReport(@NonNull File report, boolean onlySendSilentReports) {
if (enabled) {
schedulerStarter.scheduleReports(report, onlySendSilentReports);
} else {
ACRA.log.w(LOG_TAG, "Would be sending reports, but ACRA is disabled");
}
} | [
"private",
"void",
"sendReport",
"(",
"@",
"NonNull",
"File",
"report",
",",
"boolean",
"onlySendSilentReports",
")",
"{",
"if",
"(",
"enabled",
")",
"{",
"schedulerStarter",
".",
"scheduleReports",
"(",
"report",
",",
"onlySendSilentReports",
")",
";",
"}",
"... | Starts a Process to start sending outstanding error reports.
@param onlySendSilentReports If true then only send silent reports. | [
"Starts",
"a",
"Process",
"to",
"start",
"sending",
"outstanding",
"error",
"reports",
"."
] | train | https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/acra-core/src/main/java/org/acra/builder/ReportExecutor.java#L246-L252 |
Impetus/Kundera | src/kundera-kudu/src/main/java/com/impetus/client/kudu/KuduDBDataHandler.java | KuduDBDataHandler.hasColumn | public static boolean hasColumn(Schema schema, String columnName) {
"""
Checks for column.
@param schema
the schema
@param columnName
the column name
@return true, if successful
"""
try
{
schema.getColumn(columnName);
return true;
}
catch (IllegalA... | java | public static boolean hasColumn(Schema schema, String columnName)
{
try
{
schema.getColumn(columnName);
return true;
}
catch (IllegalArgumentException e)
{
return false;
}
} | [
"public",
"static",
"boolean",
"hasColumn",
"(",
"Schema",
"schema",
",",
"String",
"columnName",
")",
"{",
"try",
"{",
"schema",
".",
"getColumn",
"(",
"columnName",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
... | Checks for column.
@param schema
the schema
@param columnName
the column name
@return true, if successful | [
"Checks",
"for",
"column",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-kudu/src/main/java/com/impetus/client/kudu/KuduDBDataHandler.java#L268-L279 |
softindex/datakernel | cloud-dataflow/src/main/java/io/datakernel/dataflow/server/DatagraphEnvironment.java | DatagraphEnvironment.with | @SuppressWarnings("unchecked")
public DatagraphEnvironment with(Object key, Object value) {
"""
Sets the given value for the specified key.
@param key key
@param value value
@return this environment
"""
((Map<Object, Object>) instances).put(key, value);
return this;
} | java | @SuppressWarnings("unchecked")
public DatagraphEnvironment with(Object key, Object value) {
((Map<Object, Object>) instances).put(key, value);
return this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"DatagraphEnvironment",
"with",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"(",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
")",
"instances",
")",
".",
"put",
"(",
"key",
",",
... | Sets the given value for the specified key.
@param key key
@param value value
@return this environment | [
"Sets",
"the",
"given",
"value",
"for",
"the",
"specified",
"key",
"."
] | train | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/cloud-dataflow/src/main/java/io/datakernel/dataflow/server/DatagraphEnvironment.java#L66-L70 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.beanToMap | public static Map<String, Object> beanToMap(Object bean, Map<String, Object> targetMap, final boolean isToUnderlineCase, boolean ignoreNullValue) {
"""
对象转Map
@param bean bean对象
@param targetMap 目标的Map
@param isToUnderlineCase 是否转换为下划线模式
@param ignoreNullValue 是否忽略值为空的字段
@return Map
@since 3.2.3
"""
... | java | public static Map<String, Object> beanToMap(Object bean, Map<String, Object> targetMap, final boolean isToUnderlineCase, boolean ignoreNullValue) {
if (bean == null) {
return null;
}
return beanToMap(bean, targetMap, ignoreNullValue, new Editor<String>() {
@Override
public String edit(String ke... | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"beanToMap",
"(",
"Object",
"bean",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"targetMap",
",",
"final",
"boolean",
"isToUnderlineCase",
",",
"boolean",
"ignoreNullValue",
")",
"{",
"if",
"... | 对象转Map
@param bean bean对象
@param targetMap 目标的Map
@param isToUnderlineCase 是否转换为下划线模式
@param ignoreNullValue 是否忽略值为空的字段
@return Map
@since 3.2.3 | [
"对象转Map"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L511-L523 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/FeatureScopes.java | FeatureScopes.createFeatureCallScope | public IScope createFeatureCallScope(EObject context, EReference reference, IFeatureScopeSession session, IResolvedTypes resolvedTypes) {
"""
creates the feature scope for {@link XAbstractFeatureCall}, including the local variables in case it is a feature
call without receiver (XFeatureCall).
@param session the ... | java | public IScope createFeatureCallScope(EObject context, EReference reference, IFeatureScopeSession session, IResolvedTypes resolvedTypes) {
if (!isFeatureCallScope(reference)) {
throw new IllegalArgumentException(String.valueOf(reference));
}
if (!(context instanceof XAbstractFeatureCall)) {
return IScope.NUL... | [
"public",
"IScope",
"createFeatureCallScope",
"(",
"EObject",
"context",
",",
"EReference",
"reference",
",",
"IFeatureScopeSession",
"session",
",",
"IResolvedTypes",
"resolvedTypes",
")",
"{",
"if",
"(",
"!",
"isFeatureCallScope",
"(",
"reference",
")",
")",
"{",
... | creates the feature scope for {@link XAbstractFeatureCall}, including the local variables in case it is a feature
call without receiver (XFeatureCall).
@param session the currently available session data | [
"creates",
"the",
"feature",
"scope",
"for",
"{"
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/FeatureScopes.java#L79-L94 |
j-easy/easy-batch | easybatch-core/src/main/java/org/easybatch/core/job/JobExecutor.java | JobExecutor.submitAll | public List<Future<JobReport>> submitAll(List<Job> jobs) {
"""
Submit jobs for execution.
@param jobs to execute
@return the list of job reports in the same order of submission
"""
try {
return executorService.invokeAll(jobs);
} catch (InterruptedException e) {
throw... | java | public List<Future<JobReport>> submitAll(List<Job> jobs) {
try {
return executorService.invokeAll(jobs);
} catch (InterruptedException e) {
throw new RuntimeException("Unable to execute jobs", e);
}
} | [
"public",
"List",
"<",
"Future",
"<",
"JobReport",
">",
">",
"submitAll",
"(",
"List",
"<",
"Job",
">",
"jobs",
")",
"{",
"try",
"{",
"return",
"executorService",
".",
"invokeAll",
"(",
"jobs",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
... | Submit jobs for execution.
@param jobs to execute
@return the list of job reports in the same order of submission | [
"Submit",
"jobs",
"for",
"execution",
"."
] | train | https://github.com/j-easy/easy-batch/blob/46286e1091dae1206674e2a30e0609c31feae36c/easybatch-core/src/main/java/org/easybatch/core/job/JobExecutor.java#L115-L121 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/path/index/IndexReference.java | IndexReference.indexRef | public static final IndexReference indexRef(String indexName, IndexType type) {
"""
Constructs an {@link IndexReference} given an index name (which will be escaped) and an explicit
{@link IndexType} to use in a USING clause.
"""
if (type == null) {
return new IndexReference("`" + indexName... | java | public static final IndexReference indexRef(String indexName, IndexType type) {
if (type == null) {
return new IndexReference("`" + indexName + "`");
}
return new IndexReference("`" + indexName + "` USING " + type.toString());
} | [
"public",
"static",
"final",
"IndexReference",
"indexRef",
"(",
"String",
"indexName",
",",
"IndexType",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"new",
"IndexReference",
"(",
"\"`\"",
"+",
"indexName",
"+",
"\"`\"",
")",
";",... | Constructs an {@link IndexReference} given an index name (which will be escaped) and an explicit
{@link IndexType} to use in a USING clause. | [
"Constructs",
"an",
"{"
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/path/index/IndexReference.java#L57-L62 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FormatCache.java | FormatCache.getDateTimeInstance | F getDateTimeInstance(final int dateStyle, final int timeStyle, final TimeZone timeZone, final Locale locale) {
"""
package protected, for access from FastDateFormat; do not make public or protected
"""
return getDateTimeInstance(Integer.valueOf(dateStyle), Integer.valueOf(timeStyle), timeZone, locale);
} | java | F getDateTimeInstance(final int dateStyle, final int timeStyle, final TimeZone timeZone, final Locale locale) {
return getDateTimeInstance(Integer.valueOf(dateStyle), Integer.valueOf(timeStyle), timeZone, locale);
} | [
"F",
"getDateTimeInstance",
"(",
"final",
"int",
"dateStyle",
",",
"final",
"int",
"timeStyle",
",",
"final",
"TimeZone",
"timeZone",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"getDateTimeInstance",
"(",
"Integer",
".",
"valueOf",
"(",
"dateStyle",
... | package protected, for access from FastDateFormat; do not make public or protected | [
"package",
"protected",
"for",
"access",
"from",
"FastDateFormat",
";",
"do",
"not",
"make",
"public",
"or",
"protected"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FormatCache.java#L115-L117 |
sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/DimensionTools.java | DimensionTools.dimensionsToFit | public static Dimension dimensionsToFit(Dimension target, Dimension source) {
"""
Returns width and height that allow the given source width, height to fit inside the target width, height
without losing aspect ratio
"""
// if target width/height is zero then we have no preference for that, so set it ... | java | public static Dimension dimensionsToFit(Dimension target, Dimension source) {
// if target width/height is zero then we have no preference for that, so set it to the original value,
// since it cannot be any larger
int maxWidth;
if (target.getX() == 0) {
maxWidth = source.ge... | [
"public",
"static",
"Dimension",
"dimensionsToFit",
"(",
"Dimension",
"target",
",",
"Dimension",
"source",
")",
"{",
"// if target width/height is zero then we have no preference for that, so set it to the original value,",
"// since it cannot be any larger",
"int",
"maxWidth",
";",... | Returns width and height that allow the given source width, height to fit inside the target width, height
without losing aspect ratio | [
"Returns",
"width",
"and",
"height",
"that",
"allow",
"the",
"given",
"source",
"width",
"height",
"to",
"fit",
"inside",
"the",
"target",
"width",
"height",
"without",
"losing",
"aspect",
"ratio"
] | train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/DimensionTools.java#L42-L67 |
dvasilen/Hive-XML-SerDe | src/main/java/com/ibm/spss/hive/serde2/xml/objectinspector/XmlObjectInspectorFactory.java | XmlObjectInspectorFactory.getStandardStructObjectInspector | public static StructObjectInspector getStandardStructObjectInspector(List<String> structFieldNames,
List<ObjectInspector> structFieldObjectInspectors,
XmlProcessor xmlProcessor) {
"""
Returns the struct object inspector
@param structFieldNames
the field names
@param structFieldObjectInspectors... | java | public static StructObjectInspector getStandardStructObjectInspector(List<String> structFieldNames,
List<ObjectInspector> structFieldObjectInspectors,
XmlProcessor xmlProcessor) {
return new XmlStructObjectInspector(structFieldNames, structFieldObjectInspectors, xmlProcessor);
} | [
"public",
"static",
"StructObjectInspector",
"getStandardStructObjectInspector",
"(",
"List",
"<",
"String",
">",
"structFieldNames",
",",
"List",
"<",
"ObjectInspector",
">",
"structFieldObjectInspectors",
",",
"XmlProcessor",
"xmlProcessor",
")",
"{",
"return",
"new",
... | Returns the struct object inspector
@param structFieldNames
the field names
@param structFieldObjectInspectors
the object inspectors
@param xmlProcessor
the XML processor
@return the struct object inspector | [
"Returns",
"the",
"struct",
"object",
"inspector"
] | train | https://github.com/dvasilen/Hive-XML-SerDe/blob/2a7a184b2cfaeb63008529a9851cd72edb8025d9/src/main/java/com/ibm/spss/hive/serde2/xml/objectinspector/XmlObjectInspectorFactory.java#L98-L102 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsDetailNameCache.java | CmsDetailNameCache.checkIfUpdateIsNeeded | private void checkIfUpdateIsNeeded(CmsUUID structureId, String rootPath, int typeId) {
"""
Checks if the cache needs to be updated for the resource, and if so, marks the structure id for updating.<p>
@param structureId the structure id for the resource
@param rootPath the path of the resource
@param typeId th... | java | private void checkIfUpdateIsNeeded(CmsUUID structureId, String rootPath, int typeId) {
try {
I_CmsResourceType resType = OpenCms.getResourceManager().getResourceType(typeId);
if ((resType instanceof CmsResourceTypeXmlContent)
&& !OpenCms.getResourceManager().matchResourc... | [
"private",
"void",
"checkIfUpdateIsNeeded",
"(",
"CmsUUID",
"structureId",
",",
"String",
"rootPath",
",",
"int",
"typeId",
")",
"{",
"try",
"{",
"I_CmsResourceType",
"resType",
"=",
"OpenCms",
".",
"getResourceManager",
"(",
")",
".",
"getResourceType",
"(",
"t... | Checks if the cache needs to be updated for the resource, and if so, marks the structure id for updating.<p>
@param structureId the structure id for the resource
@param rootPath the path of the resource
@param typeId the resource type id | [
"Checks",
"if",
"the",
"cache",
"needs",
"to",
"be",
"updated",
"for",
"the",
"resource",
"and",
"if",
"so",
"marks",
"the",
"structure",
"id",
"for",
"updating",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsDetailNameCache.java#L188-L202 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/cluster/api/AsyncRestBuilder.java | AsyncRestBuilder.withHeader | public AsyncRestBuilder withHeader(String key, Object value) {
"""
Adds an HTTP header to the request. Using a key twice will result
in the last value being used for a given header.
@param key the header name (see "HttpHeaders.Names" for standard names).
@param value the header value (see "HttpHeaders.Values"... | java | public AsyncRestBuilder withHeader(String key, Object value) {
this.headers.put(key, value);
return this;
} | [
"public",
"AsyncRestBuilder",
"withHeader",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"this",
".",
"headers",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds an HTTP header to the request. Using a key twice will result
in the last value being used for a given header.
@param key the header name (see "HttpHeaders.Names" for standard names).
@param value the header value (see "HttpHeaders.Values" for standard values). | [
"Adds",
"an",
"HTTP",
"header",
"to",
"the",
"request",
".",
"Using",
"a",
"key",
"twice",
"will",
"result",
"in",
"the",
"last",
"value",
"being",
"used",
"for",
"a",
"given",
"header",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/cluster/api/AsyncRestBuilder.java#L103-L106 |
motown-io/motown | chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java | DomainService.getConnectorById | private Connector getConnectorById(Evse evse, Long id, boolean exceptionIfNotFound) {
"""
Gets a Connector by id.
@param evse evse which should contain the connector.
@param id connector id.
@param exceptionIfNotFound throw EntityNotFoundException if connector cannot be f... | java | private Connector getConnectorById(Evse evse, Long id, boolean exceptionIfNotFound) {
for (Connector connector:evse.getConnectors()) {
if (id.equals(connector.getId())) {
return connector;
}
}
if (exceptionIfNotFound) {
throw new EntityNotFound... | [
"private",
"Connector",
"getConnectorById",
"(",
"Evse",
"evse",
",",
"Long",
"id",
",",
"boolean",
"exceptionIfNotFound",
")",
"{",
"for",
"(",
"Connector",
"connector",
":",
"evse",
".",
"getConnectors",
"(",
")",
")",
"{",
"if",
"(",
"id",
".",
"equals"... | Gets a Connector by id.
@param evse evse which should contain the connector.
@param id connector id.
@param exceptionIfNotFound throw EntityNotFoundException if connector cannot be found.
@return connector or null if it cannot be found and exceptionIfNotFound is false.
@throws Ent... | [
"Gets",
"a",
"Connector",
"by",
"id",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java#L425-L436 |
zxing/zxing | core/src/main/java/com/google/zxing/common/BitMatrix.java | BitMatrix.setRegion | public void setRegion(int left, int top, int width, int height) {
"""
<p>Sets a square region of the bit matrix to true.</p>
@param left The horizontal position to begin at (inclusive)
@param top The vertical position to begin at (inclusive)
@param width The width of the region
@param height The height of th... | java | public void setRegion(int left, int top, int width, int height) {
if (top < 0 || left < 0) {
throw new IllegalArgumentException("Left and top must be nonnegative");
}
if (height < 1 || width < 1) {
throw new IllegalArgumentException("Height and width must be at least 1");
}
int right = l... | [
"public",
"void",
"setRegion",
"(",
"int",
"left",
",",
"int",
"top",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"if",
"(",
"top",
"<",
"0",
"||",
"left",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Left and top mu... | <p>Sets a square region of the bit matrix to true.</p>
@param left The horizontal position to begin at (inclusive)
@param top The vertical position to begin at (inclusive)
@param width The width of the region
@param height The height of the region | [
"<p",
">",
"Sets",
"a",
"square",
"region",
"of",
"the",
"bit",
"matrix",
"to",
"true",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/BitMatrix.java#L231-L249 |
JavaMoney/jsr354-ri-bp | src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryCurrenciesSingletonSpi.java | BaseMonetaryCurrenciesSingletonSpi.isCurrencyAvailable | public boolean isCurrencyAvailable(String code, String... providers) {
"""
Allows to check if a {@link javax.money.CurrencyUnit} instance is defined, i.e.
accessible from {@link BaseMonetaryCurrenciesSingletonSpi#getCurrency(String, String...)}.
@param code the currency code, not {@code null}.
@param pro... | java | public boolean isCurrencyAvailable(String code, String... providers) {
return !getCurrencies(CurrencyQueryBuilder.of().setCurrencyCodes(code).setProviderNames(providers).build())
.isEmpty();
} | [
"public",
"boolean",
"isCurrencyAvailable",
"(",
"String",
"code",
",",
"String",
"...",
"providers",
")",
"{",
"return",
"!",
"getCurrencies",
"(",
"CurrencyQueryBuilder",
".",
"of",
"(",
")",
".",
"setCurrencyCodes",
"(",
"code",
")",
".",
"setProviderNames",
... | Allows to check if a {@link javax.money.CurrencyUnit} instance is defined, i.e.
accessible from {@link BaseMonetaryCurrenciesSingletonSpi#getCurrency(String, String...)}.
@param code the currency code, not {@code null}.
@param providers the (optional) specification of providers to consider. If not set (empty) the... | [
"Allows",
"to",
"check",
"if",
"a",
"{",
"@link",
"javax",
".",
"money",
".",
"CurrencyUnit",
"}",
"instance",
"is",
"defined",
"i",
".",
"e",
".",
"accessible",
"from",
"{",
"@link",
"BaseMonetaryCurrenciesSingletonSpi#getCurrency",
"(",
"String",
"String",
"... | train | https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryCurrenciesSingletonSpi.java#L107-L110 |
SundeepK/CompactCalendarView | library/src/main/java/com/github/sundeepk/compactcalendarview/CompactCalendarController.java | CompactCalendarController.drawEventsWithPlus | private void drawEventsWithPlus(Canvas canvas, float xPosition, float yPosition, List<Event> eventsList) {
"""
draw 2 eventsByMonthAndYearMap followed by plus indicator to show there are more than 2 eventsByMonthAndYearMap
"""
// k = size() - 1, but since we don't want to draw more than 2 indicators, w... | java | private void drawEventsWithPlus(Canvas canvas, float xPosition, float yPosition, List<Event> eventsList) {
// k = size() - 1, but since we don't want to draw more than 2 indicators, we just stop after 2 iterations so we can just hard k = -2 instead
// we can use the below loop to draw arbitrary eventsBy... | [
"private",
"void",
"drawEventsWithPlus",
"(",
"Canvas",
"canvas",
",",
"float",
"xPosition",
",",
"float",
"yPosition",
",",
"List",
"<",
"Event",
">",
"eventsList",
")",
"{",
"// k = size() - 1, but since we don't want to draw more than 2 indicators, we just stop after 2 ite... | draw 2 eventsByMonthAndYearMap followed by plus indicator to show there are more than 2 eventsByMonthAndYearMap | [
"draw",
"2",
"eventsByMonthAndYearMap",
"followed",
"by",
"plus",
"indicator",
"to",
"show",
"there",
"are",
"more",
"than",
"2",
"eventsByMonthAndYearMap"
] | train | https://github.com/SundeepK/CompactCalendarView/blob/e74e0eeb913744bdcaea6e9df53268441f9dbf8d/library/src/main/java/com/github/sundeepk/compactcalendarview/CompactCalendarController.java#L845-L862 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/css/sass/ruby/JawrSassResolver.java | JawrSassResolver.getPath | public String getPath(String base, String uri) throws ResourceNotFoundException, IOException {
"""
Returns the path of the resource
@param base
the base path
@param uri
the relative URI
@return the resource path
@throws ResourceNotFoundException
if the resource is not found
@throws IOException
if an IOE... | java | public String getPath(String base, String uri) throws ResourceNotFoundException, IOException {
String fileName = uri;
if (!fileName.endsWith(".scss")) {
fileName += ".scss";
}
String parentPath = base.replace('\\', '/');
fileName = fileName.replace('\\', '/');
return PathNormalizer.concatWebPath(paren... | [
"public",
"String",
"getPath",
"(",
"String",
"base",
",",
"String",
"uri",
")",
"throws",
"ResourceNotFoundException",
",",
"IOException",
"{",
"String",
"fileName",
"=",
"uri",
";",
"if",
"(",
"!",
"fileName",
".",
"endsWith",
"(",
"\".scss\"",
")",
")",
... | Returns the path of the resource
@param base
the base path
@param uri
the relative URI
@return the resource path
@throws ResourceNotFoundException
if the resource is not found
@throws IOException
if an IOException occurs | [
"Returns",
"the",
"path",
"of",
"the",
"resource"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/css/sass/ruby/JawrSassResolver.java#L97-L108 |
liferay/com-liferay-commerce | commerce-tax-engine-fixed-service/src/main/java/com/liferay/commerce/tax/engine/fixed/service/persistence/impl/CommerceTaxFixedRateAddressRelPersistenceImpl.java | CommerceTaxFixedRateAddressRelPersistenceImpl.findByCPTaxCategoryId | @Override
public List<CommerceTaxFixedRateAddressRel> findByCPTaxCategoryId(
long CPTaxCategoryId, int start, int end) {
"""
Returns a range of all the commerce tax fixed rate address rels where CPTaxCategoryId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instan... | java | @Override
public List<CommerceTaxFixedRateAddressRel> findByCPTaxCategoryId(
long CPTaxCategoryId, int start, int end) {
return findByCPTaxCategoryId(CPTaxCategoryId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceTaxFixedRateAddressRel",
">",
"findByCPTaxCategoryId",
"(",
"long",
"CPTaxCategoryId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCPTaxCategoryId",
"(",
"CPTaxCategoryId",
",",
"start",
",",
... | Returns a range of all the commerce tax fixed rate address rels where CPTaxCategoryId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to th... | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"tax",
"fixed",
"rate",
"address",
"rels",
"where",
"CPTaxCategoryId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-tax-engine-fixed-service/src/main/java/com/liferay/commerce/tax/engine/fixed/service/persistence/impl/CommerceTaxFixedRateAddressRelPersistenceImpl.java#L675-L679 |
sundrio/sundrio | annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java | ToPojo.readArrayValue | private static String readArrayValue(String ref, TypeDef source, Property property) {
"""
Returns the string representation of the code that reads an array property.
@param ref The reference.
@param source The type of the reference.
@param property The property to read.
@return ... | java | private static String readArrayValue(String ref, TypeDef source, Property property) {
TypeRef typeRef = property.getTypeRef();
if (typeRef instanceof ClassRef) {
//TODO: This needs further breakdown, to cover edge cases.
return readObjectArrayValue(ref, source, property);
... | [
"private",
"static",
"String",
"readArrayValue",
"(",
"String",
"ref",
",",
"TypeDef",
"source",
",",
"Property",
"property",
")",
"{",
"TypeRef",
"typeRef",
"=",
"property",
".",
"getTypeRef",
"(",
")",
";",
"if",
"(",
"typeRef",
"instanceof",
"ClassRef",
"... | Returns the string representation of the code that reads an array property.
@param ref The reference.
@param source The type of the reference.
@param property The property to read.
@return The code. | [
"Returns",
"the",
"string",
"representation",
"of",
"the",
"code",
"that",
"reads",
"an",
"array",
"property",
"."
] | train | https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java#L768-L779 |
h2oai/h2o-3 | h2o-core/src/main/java/water/init/TimelineSnapshot.java | TimelineSnapshot.isSenderRecvPair | private boolean isSenderRecvPair(Event senderCnd, Event recvCnd) {
"""
Check whether two events can be put together in sender/recv relationship.
Events must match, also each sender can have only one receiver per node.
@param senderCnd
@param recvCnd
@return
"""
if (senderCnd.isSend() && recvCnd.isR... | java | private boolean isSenderRecvPair(Event senderCnd, Event recvCnd) {
if (senderCnd.isSend() && recvCnd.isRecv() && senderCnd.match(recvCnd)) {
ArrayList<Event> recvs = _sends.get(senderCnd);
if (recvs.isEmpty() || senderCnd.packH2O()==null ) {
for (Event e : recvs)
if (e._nodeId == recvC... | [
"private",
"boolean",
"isSenderRecvPair",
"(",
"Event",
"senderCnd",
",",
"Event",
"recvCnd",
")",
"{",
"if",
"(",
"senderCnd",
".",
"isSend",
"(",
")",
"&&",
"recvCnd",
".",
"isRecv",
"(",
")",
"&&",
"senderCnd",
".",
"match",
"(",
"recvCnd",
")",
")",
... | Check whether two events can be put together in sender/recv relationship.
Events must match, also each sender can have only one receiver per node.
@param senderCnd
@param recvCnd
@return | [
"Check",
"whether",
"two",
"events",
"can",
"be",
"put",
"together",
"in",
"sender",
"/",
"recv",
"relationship",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/init/TimelineSnapshot.java#L329-L340 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelUtils.java | KernelUtils.getProperties | public static Properties getProperties(final InputStream is) throws IOException {
"""
Read properties from input stream. Will close the input stream before
returning.
@param is
InputStream to read properties from
@return Properties object; will be empty if InputStream is null or empty.
@throws LaunchExcepti... | java | public static Properties getProperties(final InputStream is) throws IOException {
Properties p = new Properties();
try {
if (is != null) {
p.load(is);
// Look for "values" and strip the quotes to values
for (Entry<Object, Object> entry : p.en... | [
"public",
"static",
"Properties",
"getProperties",
"(",
"final",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"Properties",
"p",
"=",
"new",
"Properties",
"(",
")",
";",
"try",
"{",
"if",
"(",
"is",
"!=",
"null",
")",
"{",
"p",
".",
"load",
... | Read properties from input stream. Will close the input stream before
returning.
@param is
InputStream to read properties from
@return Properties object; will be empty if InputStream is null or empty.
@throws LaunchException | [
"Read",
"properties",
"from",
"input",
"stream",
".",
"Will",
"close",
"the",
"input",
"stream",
"before",
"returning",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/KernelUtils.java#L128-L149 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CollectScoresIterationListener.java | CollectScoresIterationListener.exportScores | public void exportScores(File file, String delimiter) throws IOException {
"""
Export the scores to the specified file in delimited (one per line) UTF-8 format, using the specified delimiter
@param file File to write to
@param delimiter Delimiter to use for writing scores
"""
try (FileOutputSt... | java | public void exportScores(File file, String delimiter) throws IOException {
try (FileOutputStream fos = new FileOutputStream(file)) {
exportScores(fos, delimiter);
}
} | [
"public",
"void",
"exportScores",
"(",
"File",
"file",
",",
"String",
"delimiter",
")",
"throws",
"IOException",
"{",
"try",
"(",
"FileOutputStream",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"file",
")",
")",
"{",
"exportScores",
"(",
"fos",
",",
"delimit... | Export the scores to the specified file in delimited (one per line) UTF-8 format, using the specified delimiter
@param file File to write to
@param delimiter Delimiter to use for writing scores | [
"Export",
"the",
"scores",
"to",
"the",
"specified",
"file",
"in",
"delimited",
"(",
"one",
"per",
"line",
")",
"UTF",
"-",
"8",
"format",
"using",
"the",
"specified",
"delimiter"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CollectScoresIterationListener.java#L108-L112 |
google/truth | extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java | IterableOfProtosSubject.ignoringRepeatedFieldOrderOfFields | public IterableOfProtosFluentAssertion<M> ignoringRepeatedFieldOrderOfFields(
int firstFieldNumber, int... rest) {
"""
Specifies that the ordering of repeated fields for these explicitly specified top-level field
numbers should be ignored when comparing for equality. Sub-fields must be specified explicitly
... | java | public IterableOfProtosFluentAssertion<M> ignoringRepeatedFieldOrderOfFields(
int firstFieldNumber, int... rest) {
return usingConfig(config.ignoringRepeatedFieldOrderOfFields(asList(firstFieldNumber, rest)));
} | [
"public",
"IterableOfProtosFluentAssertion",
"<",
"M",
">",
"ignoringRepeatedFieldOrderOfFields",
"(",
"int",
"firstFieldNumber",
",",
"int",
"...",
"rest",
")",
"{",
"return",
"usingConfig",
"(",
"config",
".",
"ignoringRepeatedFieldOrderOfFields",
"(",
"asList",
"(",
... | Specifies that the ordering of repeated fields for these explicitly specified top-level field
numbers should be ignored when comparing for equality. Sub-fields must be specified explicitly
(via {@link FieldDescriptor}) if their orders are to be ignored as well.
<p>Use {@link #ignoringRepeatedFieldOrder()} instead to i... | [
"Specifies",
"that",
"the",
"ordering",
"of",
"repeated",
"fields",
"for",
"these",
"explicitly",
"specified",
"top",
"-",
"level",
"field",
"numbers",
"should",
"be",
"ignored",
"when",
"comparing",
"for",
"equality",
".",
"Sub",
"-",
"fields",
"must",
"be",
... | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java#L611-L614 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ComparableExtensions.java | ComparableExtensions.operator_lessThan | @Pure /* not guaranteed, since compareTo() is invoked */
@Inline("($1.compareTo($2) < 0)")
public static <C> boolean operator_lessThan(Comparable<? super C> left, C right) {
"""
The comparison operator <code>less than</code>.
@param left
a comparable
@param right
the value to compare with
@return <code>le... | java | @Pure /* not guaranteed, since compareTo() is invoked */
@Inline("($1.compareTo($2) < 0)")
public static <C> boolean operator_lessThan(Comparable<? super C> left, C right) {
return left.compareTo(right) < 0;
} | [
"@",
"Pure",
"/* not guaranteed, since compareTo() is invoked */",
"@",
"Inline",
"(",
"\"($1.compareTo($2) < 0)\"",
")",
"public",
"static",
"<",
"C",
">",
"boolean",
"operator_lessThan",
"(",
"Comparable",
"<",
"?",
"super",
"C",
">",
"left",
",",
"C",
"right",
... | The comparison operator <code>less than</code>.
@param left
a comparable
@param right
the value to compare with
@return <code>left.compareTo(right) < 0</code> | [
"The",
"comparison",
"operator",
"<code",
">",
"less",
"than<",
"/",
"code",
">",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ComparableExtensions.java#L29-L33 |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/api/validation/helper/ByteBufferUtils.java | ByteBufferUtils.bytes | public static ByteBuffer bytes(String s, Charset charset) {
"""
Encode a String in a ByteBuffer using the provided charset.
@param s the string to encode
@param charset the String encoding charset to use
@return the encoded string
"""
return ByteBuffer.wrap(s.getBytes(charset));
} | java | public static ByteBuffer bytes(String s, Charset charset)
{
return ByteBuffer.wrap(s.getBytes(charset));
} | [
"public",
"static",
"ByteBuffer",
"bytes",
"(",
"String",
"s",
",",
"Charset",
"charset",
")",
"{",
"return",
"ByteBuffer",
".",
"wrap",
"(",
"s",
".",
"getBytes",
"(",
"charset",
")",
")",
";",
"}"
] | Encode a String in a ByteBuffer using the provided charset.
@param s the string to encode
@param charset the String encoding charset to use
@return the encoded string | [
"Encode",
"a",
"String",
"in",
"a",
"ByteBuffer",
"using",
"the",
"provided",
"charset",
"."
] | train | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/helper/ByteBufferUtils.java#L145-L148 |
unbescape/unbescape | src/main/java/org/unbescape/uri/UriEscape.java | UriEscape.unescapeUriPath | public static void unescapeUriPath(final Reader reader, final Writer writer)
throws IOException {
"""
<p>
Perform am URI path <strong>unescape</strong> operation
on a <tt>Reader</tt> input using <tt>UTF-8</tt> as encoding, writing results to a <tt>Writer</tt>.
</p>
<p>
This method will unescape ev... | java | public static void unescapeUriPath(final Reader reader, final Writer writer)
throws IOException {
unescapeUriPath(reader, writer, DEFAULT_ENCODING);
} | [
"public",
"static",
"void",
"unescapeUriPath",
"(",
"final",
"Reader",
"reader",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"unescapeUriPath",
"(",
"reader",
",",
"writer",
",",
"DEFAULT_ENCODING",
")",
";",
"}"
] | <p>
Perform am URI path <strong>unescape</strong> operation
on a <tt>Reader</tt> input using <tt>UTF-8</tt> as encoding, writing results to a <tt>Writer</tt>.
</p>
<p>
This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input,
even for those characters that do not need to be percent-enco... | [
"<p",
">",
"Perform",
"am",
"URI",
"path",
"<strong",
">",
"unescape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"Reader<",
"/",
"tt",
">",
"input",
"using",
"<tt",
">",
"UTF",
"-",
"8<",
"/",
"tt",
">",
"as",
"encoding",
"writing",
... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L2110-L2113 |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.notifications_sendEmailPlain | public String notifications_sendEmailPlain(Collection<Integer> recipientIds, CharSequence subject, CharSequence text)
throws FacebookException, IOException {
"""
Sends a notification email to the specified users, who must have added your application.
You can send five (5) emails to a user per day. Requires a ... | java | public String notifications_sendEmailPlain(Collection<Integer> recipientIds, CharSequence subject, CharSequence text)
throws FacebookException, IOException {
return notifications_sendEmail(recipientIds, subject, /*fbml*/null, text);
} | [
"public",
"String",
"notifications_sendEmailPlain",
"(",
"Collection",
"<",
"Integer",
">",
"recipientIds",
",",
"CharSequence",
"subject",
",",
"CharSequence",
"text",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"notifications_sendEmail",
"("... | Sends a notification email to the specified users, who must have added your application.
You can send five (5) emails to a user per day. Requires a session key for desktop applications, which may only
send email to the person whose session it is. This method does not require a session for Web applications.
@param reci... | [
"Sends",
"a",
"notification",
"email",
"to",
"the",
"specified",
"users",
"who",
"must",
"have",
"added",
"your",
"application",
".",
"You",
"can",
"send",
"five",
"(",
"5",
")",
"emails",
"to",
"a",
"user",
"per",
"day",
".",
"Requires",
"a",
"session",... | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1252-L1255 |
briandilley/jsonrpc4j | src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java | JsonRpcClient.writeAndFlushValue | private void writeAndFlushValue(OutputStream output, Object value) throws IOException {
"""
Writes and flushes a value to the given {@link OutputStream}
and prevents Jackson from closing it.
@param output the {@link OutputStream}
@param value the value to write
@throws IOException on error
"""
mapper.... | java | private void writeAndFlushValue(OutputStream output, Object value) throws IOException {
mapper.writeValue(new NoCloseOutputStream(output), value);
output.flush();
} | [
"private",
"void",
"writeAndFlushValue",
"(",
"OutputStream",
"output",
",",
"Object",
"value",
")",
"throws",
"IOException",
"{",
"mapper",
".",
"writeValue",
"(",
"new",
"NoCloseOutputStream",
"(",
"output",
")",
",",
"value",
")",
";",
"output",
".",
"flush... | Writes and flushes a value to the given {@link OutputStream}
and prevents Jackson from closing it.
@param output the {@link OutputStream}
@param value the value to write
@throws IOException on error | [
"Writes",
"and",
"flushes",
"a",
"value",
"to",
"the",
"given",
"{",
"@link",
"OutputStream",
"}",
"and",
"prevents",
"Jackson",
"from",
"closing",
"it",
"."
] | train | https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java#L357-L360 |
xcesco/kripton | kripton-arch-integration/src/main/java/android/arch/paging/PagedList.java | PagedList.addWeakCallback | @SuppressWarnings("WeakerAccess")
public void addWeakCallback(@Nullable List<T> previousSnapshot, @NonNull Callback callback) {
"""
Adds a callback, and issues updates since the previousSnapshot was created.
<p>
If previousSnapshot is passed, the callback will also immediately be dispatched any
differences ... | java | @SuppressWarnings("WeakerAccess")
public void addWeakCallback(@Nullable List<T> previousSnapshot, @NonNull Callback callback) {
if (previousSnapshot != null && previousSnapshot != this) {
if (previousSnapshot.isEmpty()) {
if (!mStorage.isEmpty()) {
// If snap... | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"void",
"addWeakCallback",
"(",
"@",
"Nullable",
"List",
"<",
"T",
">",
"previousSnapshot",
",",
"@",
"NonNull",
"Callback",
"callback",
")",
"{",
"if",
"(",
"previousSnapshot",
"!=",
"null",
"&&... | Adds a callback, and issues updates since the previousSnapshot was created.
<p>
If previousSnapshot is passed, the callback will also immediately be dispatched any
differences between the previous snapshot, and the current state. For example, if the
previousSnapshot was of 5 nulls, 10 items, 5 nulls, and the current st... | [
"Adds",
"a",
"callback",
"and",
"issues",
"updates",
"since",
"the",
"previousSnapshot",
"was",
"created",
".",
"<p",
">",
"If",
"previousSnapshot",
"is",
"passed",
"the",
"callback",
"will",
"also",
"immediately",
"be",
"dispatched",
"any",
"differences",
"betw... | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-arch-integration/src/main/java/android/arch/paging/PagedList.java#L645-L673 |
mediathekview/MServer | src/main/java/mServer/crawler/FilmeSuchen.java | FilmeSuchen.updateSender | public void updateSender(String[] nameSender, ListeFilme listeFilme) {
"""
es werden nur einige Sender aktualisiert
@param nameSender
@param listeFilme
"""
// nur für den Mauskontext "Sender aktualisieren"
boolean starten = false;
initStart(listeFilme);
for (MediathekReader reader : med... | java | public void updateSender(String[] nameSender, ListeFilme listeFilme) {
// nur für den Mauskontext "Sender aktualisieren"
boolean starten = false;
initStart(listeFilme);
for (MediathekReader reader : mediathekListe) {
for (String s : nameSender) {
if (reader.checkNameSenderFilmliste(s... | [
"public",
"void",
"updateSender",
"(",
"String",
"[",
"]",
"nameSender",
",",
"ListeFilme",
"listeFilme",
")",
"{",
"// nur für den Mauskontext \"Sender aktualisieren\"\r",
"boolean",
"starten",
"=",
"false",
";",
"initStart",
"(",
"listeFilme",
")",
";",
"for",
"("... | es werden nur einige Sender aktualisiert
@param nameSender
@param listeFilme | [
"es",
"werden",
"nur",
"einige",
"Sender",
"aktualisiert"
] | train | https://github.com/mediathekview/MServer/blob/ba8d03e6a1a303db3807a1327f553f1decd30388/src/main/java/mServer/crawler/FilmeSuchen.java#L137-L155 |
alkacon/opencms-core | src/org/opencms/workplace/explorer/CmsExplorerTypeSettings.java | CmsExplorerTypeSettings.setTypeAttributes | public void setTypeAttributes(String name, String key, String icon) {
"""
Sets the basic attributes of the type settings.<p>
@param name the name of the type setting
@param key the key name of the explorer type setting
@param icon the icon path and file name of the explorer type setting
"""
setNa... | java | public void setTypeAttributes(String name, String key, String icon) {
setName(name);
setKey(key);
setIcon(icon);
} | [
"public",
"void",
"setTypeAttributes",
"(",
"String",
"name",
",",
"String",
"key",
",",
"String",
"icon",
")",
"{",
"setName",
"(",
"name",
")",
";",
"setKey",
"(",
"key",
")",
";",
"setIcon",
"(",
"icon",
")",
";",
"}"
] | Sets the basic attributes of the type settings.<p>
@param name the name of the type setting
@param key the key name of the explorer type setting
@param icon the icon path and file name of the explorer type setting | [
"Sets",
"the",
"basic",
"attributes",
"of",
"the",
"type",
"settings",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/explorer/CmsExplorerTypeSettings.java#L891-L896 |
infinispan/infinispan | server/memcached/src/main/java/org/infinispan/server/memcached/TextProtocolUtil.java | TextProtocolUtil.readElement | static boolean readElement(ByteBuf buffer, OutputStream byteBuffer) throws IOException {
"""
In the particular case of Memcached, the end of operation/command
is signaled by "\r\n" characters. So, if end of operation is
found, this method would return true. On the contrary, if space was
found instead of end of ... | java | static boolean readElement(ByteBuf buffer, OutputStream byteBuffer) throws IOException {
for (; ; ) {
byte next = buffer.readByte();
if (next == SP) { // Space
return false;
} else if (next == CR) { // CR
next = buffer.readByte();
if (next == LF) { //... | [
"static",
"boolean",
"readElement",
"(",
"ByteBuf",
"buffer",
",",
"OutputStream",
"byteBuffer",
")",
"throws",
"IOException",
"{",
"for",
"(",
";",
";",
")",
"{",
"byte",
"next",
"=",
"buffer",
".",
"readByte",
"(",
")",
";",
"if",
"(",
"next",
"==",
... | In the particular case of Memcached, the end of operation/command
is signaled by "\r\n" characters. So, if end of operation is
found, this method would return true. On the contrary, if space was
found instead of end of operation character, then it'd return the element and false. | [
"In",
"the",
"particular",
"case",
"of",
"Memcached",
"the",
"end",
"of",
"operation",
"/",
"command",
"is",
"signaled",
"by",
"\\",
"r",
"\\",
"n",
"characters",
".",
"So",
"if",
"end",
"of",
"operation",
"is",
"found",
"this",
"method",
"would",
"retur... | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/memcached/src/main/java/org/infinispan/server/memcached/TextProtocolUtil.java#L60-L76 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java | SimpleTimeZone.setStartRule | public void setStartRule(int month, int dayOfMonth, int dayOfWeek, int time, boolean after) {
"""
Sets the DST start rule to a weekday before or after a give date within
a month, e.g., the first Monday on or after the 8th.
@param month The month in which this rule occurs (0-based).
@param dayOfMonth ... | java | public void setStartRule(int month, int dayOfMonth, int dayOfWeek, int time, boolean after) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify a frozen SimpleTimeZone instance.");
}
getSTZInfo().setStart(month, -1, dayOfWeek, time, dayOfMonth, after);
... | [
"public",
"void",
"setStartRule",
"(",
"int",
"month",
",",
"int",
"dayOfMonth",
",",
"int",
"dayOfWeek",
",",
"int",
"time",
",",
"boolean",
"after",
")",
"{",
"if",
"(",
"isFrozen",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"("... | Sets the DST start rule to a weekday before or after a give date within
a month, e.g., the first Monday on or after the 8th.
@param month The month in which this rule occurs (0-based).
@param dayOfMonth A date within that month (1-based).
@param dayOfWeek The day of the week on which this rule occurs.
@... | [
"Sets",
"the",
"DST",
"start",
"rule",
"to",
"a",
"weekday",
"before",
"or",
"after",
"a",
"give",
"date",
"within",
"a",
"month",
"e",
".",
"g",
".",
"the",
"first",
"Monday",
"on",
"or",
"after",
"the",
"8th",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java#L403-L411 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/message/ParameterFormatter.java | ParameterFormatter.handleLastChar | private static void handleLastChar(final StringBuilder buffer, final int escapeCounter, final char curChar) {
"""
28 bytes (allows immediate JVM inlining: < 35 bytes) LOG4J2-1096
"""
if (curChar == ESCAPE_CHAR) {
writeUnescapedEscapeChars(escapeCounter + 1, buffer);
} else {
... | java | private static void handleLastChar(final StringBuilder buffer, final int escapeCounter, final char curChar) {
if (curChar == ESCAPE_CHAR) {
writeUnescapedEscapeChars(escapeCounter + 1, buffer);
} else {
handleLiteralChar(buffer, escapeCounter, curChar);
}
} | [
"private",
"static",
"void",
"handleLastChar",
"(",
"final",
"StringBuilder",
"buffer",
",",
"final",
"int",
"escapeCounter",
",",
"final",
"char",
"curChar",
")",
"{",
"if",
"(",
"curChar",
"==",
"ESCAPE_CHAR",
")",
"{",
"writeUnescapedEscapeChars",
"(",
"escap... | 28 bytes (allows immediate JVM inlining: < 35 bytes) LOG4J2-1096 | [
"28",
"bytes",
"(",
"allows",
"immediate",
"JVM",
"inlining",
":",
"<",
"35",
"bytes",
")",
"LOG4J2",
"-",
"1096"
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/ParameterFormatter.java#L293-L299 |
alkacon/opencms-core | src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageHandler.java | CmsContainerpageHandler.updateClipboard | public void updateClipboard(Map<String, CmsContainerElementData> elements) {
"""
Updates the clip board elements is necessary.<p>
@param elements the elements data
"""
if (m_editor.getClipboard().isOpen()) {
for (CmsContainerElementData elementData : elements.values()) {
... | java | public void updateClipboard(Map<String, CmsContainerElementData> elements) {
if (m_editor.getClipboard().isOpen()) {
for (CmsContainerElementData elementData : elements.values()) {
m_editor.getClipboard().replaceFavoriteItem(
m_controller.getContainerpageUtil().c... | [
"public",
"void",
"updateClipboard",
"(",
"Map",
"<",
"String",
",",
"CmsContainerElementData",
">",
"elements",
")",
"{",
"if",
"(",
"m_editor",
".",
"getClipboard",
"(",
")",
".",
"isOpen",
"(",
")",
")",
"{",
"for",
"(",
"CmsContainerElementData",
"elemen... | Updates the clip board elements is necessary.<p>
@param elements the elements data | [
"Updates",
"the",
"clip",
"board",
"elements",
"is",
"necessary",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageHandler.java#L1189-L1199 |
windup/windup | config/api/src/main/java/org/jboss/windup/config/operation/Iteration.java | Iteration.getPayloadVariableName | public static String getPayloadVariableName(GraphRewrite event, EvaluationContext ctx) throws IllegalStateException {
"""
Return the current {@link Iteration} payload variable name.
@throws IllegalStateException if there is more than one variable in the {@link Variables} stack, and the payload name cannot be de... | java | public static String getPayloadVariableName(GraphRewrite event, EvaluationContext ctx) throws IllegalStateException
{
Variables variables = Variables.instance(event);
Map<String, Iterable<? extends WindupVertexFrame>> topLayer = variables.peek();
if (topLayer.keySet().size() != 1)
{
... | [
"public",
"static",
"String",
"getPayloadVariableName",
"(",
"GraphRewrite",
"event",
",",
"EvaluationContext",
"ctx",
")",
"throws",
"IllegalStateException",
"{",
"Variables",
"variables",
"=",
"Variables",
".",
"instance",
"(",
"event",
")",
";",
"Map",
"<",
"St... | Return the current {@link Iteration} payload variable name.
@throws IllegalStateException if there is more than one variable in the {@link Variables} stack, and the payload name cannot be determined. | [
"Return",
"the",
"current",
"{",
"@link",
"Iteration",
"}",
"payload",
"variable",
"name",
"."
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/operation/Iteration.java#L378-L390 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java | DomHelper.setController | public void setController(Object parent, String name, GraphicsController controller) {
"""
Set the controller on an element of this <code>GraphicsContext</code> so it can react to events.
@param parent
the parent of the element on which the controller should be set.
@param name
the name of the child element ... | java | public void setController(Object parent, String name, GraphicsController controller) {
// set them all
doSetController(getElement(parent, name), controller, Event.TOUCHEVENTS | Event.MOUSEEVENTS | Event.ONDBLCLICK
| Event.ONMOUSEWHEEL);
} | [
"public",
"void",
"setController",
"(",
"Object",
"parent",
",",
"String",
"name",
",",
"GraphicsController",
"controller",
")",
"{",
"// set them all",
"doSetController",
"(",
"getElement",
"(",
"parent",
",",
"name",
")",
",",
"controller",
",",
"Event",
".",
... | Set the controller on an element of this <code>GraphicsContext</code> so it can react to events.
@param parent
the parent of the element on which the controller should be set.
@param name
the name of the child element on which the controller should be set
@param controller
The new <code>GraphicsController</code> | [
"Set",
"the",
"controller",
"on",
"an",
"element",
"of",
"this",
"<code",
">",
"GraphicsContext<",
"/",
"code",
">",
"so",
"it",
"can",
"react",
"to",
"events",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L567-L571 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java | GrailsHibernateUtil.setObjectToReadWrite | public static void setObjectToReadWrite(final Object target, SessionFactory sessionFactory) {
"""
Sets the target object to read-write, allowing Hibernate to dirty check it and auto-flush changes.
@see #setObjectToReadyOnly(Object, org.hibernate.SessionFactory)
@param target The target object
@param session... | java | public static void setObjectToReadWrite(final Object target, SessionFactory sessionFactory) {
Session session = sessionFactory.getCurrentSession();
if (!canModifyReadWriteState(session, target)) {
return;
}
SessionImplementor sessionImpl = (SessionImplementor) session;
... | [
"public",
"static",
"void",
"setObjectToReadWrite",
"(",
"final",
"Object",
"target",
",",
"SessionFactory",
"sessionFactory",
")",
"{",
"Session",
"session",
"=",
"sessionFactory",
".",
"getCurrentSession",
"(",
")",
";",
"if",
"(",
"!",
"canModifyReadWriteState",
... | Sets the target object to read-write, allowing Hibernate to dirty check it and auto-flush changes.
@see #setObjectToReadyOnly(Object, org.hibernate.SessionFactory)
@param target The target object
@param sessionFactory The SessionFactory instance | [
"Sets",
"the",
"target",
"object",
"to",
"read",
"-",
"write",
"allowing",
"Hibernate",
"to",
"dirty",
"check",
"it",
"and",
"auto",
"-",
"flush",
"changes",
"."
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java#L319-L340 |
Chorus-bdd/Chorus | interpreter/chorus-config/src/main/java/org/chorusbdd/chorus/config/ConfigReader.java | ConfigReader.mergeProperties | private void mergeProperties(Map<ExecutionConfigSource, Map<ExecutionProperty, List<String>>> sourceToPropertiesMap) {
"""
deermine the final set of properties according to PropertySourceMode for each property
"""
for ( ExecutionConfigSource s : propertySources) {
Map<ExecutionProperty, Lis... | java | private void mergeProperties(Map<ExecutionConfigSource, Map<ExecutionProperty, List<String>>> sourceToPropertiesMap) {
for ( ExecutionConfigSource s : propertySources) {
Map<ExecutionProperty, List<String>> properties = sourceToPropertiesMap.get(s);
for ( ExecutionProperty p : properties... | [
"private",
"void",
"mergeProperties",
"(",
"Map",
"<",
"ExecutionConfigSource",
",",
"Map",
"<",
"ExecutionProperty",
",",
"List",
"<",
"String",
">",
">",
">",
"sourceToPropertiesMap",
")",
"{",
"for",
"(",
"ExecutionConfigSource",
"s",
":",
"propertySources",
... | deermine the final set of properties according to PropertySourceMode for each property | [
"deermine",
"the",
"final",
"set",
"of",
"properties",
"according",
"to",
"PropertySourceMode",
"for",
"each",
"property"
] | train | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-config/src/main/java/org/chorusbdd/chorus/config/ConfigReader.java#L104-L115 |
hawkular/hawkular-commons | hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/WsSessions.java | WsSessions.addSession | public boolean addSession(String key, Session newSession) {
"""
Stores the given {@code newSession} under the given {@code key}.
<p>
If there is already a session associated with the given {@code key}, the given {@code newSession} is closed;
it is not added or associated with the given key and an error will be ... | java | public boolean addSession(String key, Session newSession) {
SessionEntry newEntry = createSessionEntry(key, newSession);
SessionEntry oldEntry = null;
sessionsLockWrite.lock();
try {
oldEntry = this.sessions.putIfAbsent(key, newEntry);
} finally {
sessio... | [
"public",
"boolean",
"addSession",
"(",
"String",
"key",
",",
"Session",
"newSession",
")",
"{",
"SessionEntry",
"newEntry",
"=",
"createSessionEntry",
"(",
"key",
",",
"newSession",
")",
";",
"SessionEntry",
"oldEntry",
"=",
"null",
";",
"sessionsLockWrite",
".... | Stores the given {@code newSession} under the given {@code key}.
<p>
If there is already a session associated with the given {@code key}, the given {@code newSession} is closed;
it is not added or associated with the given key and an error will be logged. The original session remains
associated with the {@code key}.
<p... | [
"Stores",
"the",
"given",
"{",
"@code",
"newSession",
"}",
"under",
"the",
"given",
"{",
"@code",
"key",
"}",
".",
"<p",
">",
"If",
"there",
"is",
"already",
"a",
"session",
"associated",
"with",
"the",
"given",
"{",
"@code",
"key",
"}",
"the",
"given"... | train | https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/WsSessions.java#L115-L144 |
alipay/sofa-rpc | extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/client/aft/impl/ServiceHorizontalMeasureStrategy.java | ServiceHorizontalMeasureStrategy.calculateAverageExceptionRate | private double calculateAverageExceptionRate(List<InvocationStat> invocationStats, long leastWindowCount) {
"""
计算平均异常率,如果调用次数小于leastWindowCount则不参与计算。 如果所有调用次数均为0则返回-1
@param invocationStats List<InvocationStat>
@param leastWindowCount leastWindowCount
@return The average exception rate of all invocation sta... | java | private double calculateAverageExceptionRate(List<InvocationStat> invocationStats, long leastWindowCount) {
long sumException = 0;
long sumCall = 0;
for (InvocationStat invocationStat : invocationStats) {
long invocationLeastWindowCount = getInvocationLeastWindowCount(invocationStat... | [
"private",
"double",
"calculateAverageExceptionRate",
"(",
"List",
"<",
"InvocationStat",
">",
"invocationStats",
",",
"long",
"leastWindowCount",
")",
"{",
"long",
"sumException",
"=",
"0",
";",
"long",
"sumCall",
"=",
"0",
";",
"for",
"(",
"InvocationStat",
"i... | 计算平均异常率,如果调用次数小于leastWindowCount则不参与计算。 如果所有调用次数均为0则返回-1
@param invocationStats List<InvocationStat>
@param leastWindowCount leastWindowCount
@return The average exception rate of all invocation statics | [
"计算平均异常率,如果调用次数小于leastWindowCount则不参与计算。",
"如果所有调用次数均为0则返回",
"-",
"1"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/client/aft/impl/ServiceHorizontalMeasureStrategy.java#L265-L284 |
alkacon/opencms-core | src/org/opencms/file/wrapper/CmsResourceWrapperUtils.java | CmsResourceWrapperUtils.addFileExtension | public static String addFileExtension(CmsObject cms, String resourcename, String extension) {
"""
Adds a file extension to the resource name.<p>
If the file with the new extension already exists, an index count will be
added before the final extension.<p>
For example: <code>index.html.1.jsp</code>.<p>
@s... | java | public static String addFileExtension(CmsObject cms, String resourcename, String extension) {
if (!extension.startsWith(".")) {
extension = "." + extension;
}
if (!resourcename.endsWith(extension)) {
String name = resourcename + extension;
int count = 0;
... | [
"public",
"static",
"String",
"addFileExtension",
"(",
"CmsObject",
"cms",
",",
"String",
"resourcename",
",",
"String",
"extension",
")",
"{",
"if",
"(",
"!",
"extension",
".",
"startsWith",
"(",
"\".\"",
")",
")",
"{",
"extension",
"=",
"\".\"",
"+",
"ex... | Adds a file extension to the resource name.<p>
If the file with the new extension already exists, an index count will be
added before the final extension.<p>
For example: <code>index.html.1.jsp</code>.<p>
@see #removeFileExtension(CmsObject, String, String)
@param cms the actual CmsObject
@param resourcename the na... | [
"Adds",
"a",
"file",
"extension",
"to",
"the",
"resource",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/wrapper/CmsResourceWrapperUtils.java#L108-L126 |
unbescape/unbescape | src/main/java/org/unbescape/java/JavaEscape.java | JavaEscape.escapeJavaMinimal | public static void escapeJavaMinimal(final String text, final Writer writer)
throws IOException {
"""
<p>
Perform a Java level 1 (only basic set) <strong>escape</strong> operation
on a <tt>String</tt> input, writing results to a <tt>Writer</tt>.
</p>
<p>
<em>Level 1</em> means this method will onl... | java | public static void escapeJavaMinimal(final String text, final Writer writer)
throws IOException {
escapeJava(text, writer, JavaEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET);
} | [
"public",
"static",
"void",
"escapeJavaMinimal",
"(",
"final",
"String",
"text",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"escapeJava",
"(",
"text",
",",
"writer",
",",
"JavaEscapeLevel",
".",
"LEVEL_1_BASIC_ESCAPE_SET",
")",
";",
"}"... | <p>
Perform a Java level 1 (only basic set) <strong>escape</strong> operation
on a <tt>String</tt> input, writing results to a <tt>Writer</tt>.
</p>
<p>
<em>Level 1</em> means this method will only escape the Java basic escape set:
</p>
<ul>
<li>The <em>Single Escape Characters</em>:
<tt>\b</tt> (<tt>U+0008</tt>),
... | [
"<p",
">",
"Perform",
"a",
"Java",
"level",
"1",
"(",
"only",
"basic",
"set",
")",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"String<",
"/",
"tt",
">",
"input",
"writing",
"results",
"to",
"a",
"<tt",
">",
"... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/java/JavaEscape.java#L392-L395 |
ops4j/org.ops4j.base | ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java | StreamUtils.compareStreams | public static boolean compareStreams( InputStream in1, InputStream in2 )
throws IOException {
"""
Compares if two streams are identical in their contents.
@param in1 The first stream.
@param in2 The second stream.
@return true if both streams contains the same byte data, including having the same nu... | java | public static boolean compareStreams( InputStream in1, InputStream in2 )
throws IOException
{
boolean moreOnIn1;
do
{
int v1 = in1.read();
int v2 = in2.read();
if( v1 != v2 )
{
return false;
}
mor... | [
"public",
"static",
"boolean",
"compareStreams",
"(",
"InputStream",
"in1",
",",
"InputStream",
"in2",
")",
"throws",
"IOException",
"{",
"boolean",
"moreOnIn1",
";",
"do",
"{",
"int",
"v1",
"=",
"in1",
".",
"read",
"(",
")",
";",
"int",
"v2",
"=",
"in2"... | Compares if two streams are identical in their contents.
@param in1 The first stream.
@param in2 The second stream.
@return true if both streams contains the same byte data, including having the same number of characters in them.
@throws IOException If an underlying I/O problem occured. | [
"Compares",
"if",
"two",
"streams",
"are",
"identical",
"in",
"their",
"contents",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java#L176-L193 |
iig-uni-freiburg/SEWOL | src/de/uni/freiburg/iig/telematik/sewol/log/LogEntry.java | LogEntry.lockField | public void lockField(EntryField entryField, String reason) {
"""
Locks a field of the log entry.<br>
Locked fields cannot be altered anymore. If the originator field is
locked, then the originator candidates field is locked as well, since
changing the candidates also changes the originator (consistency).
@p... | java | public void lockField(EntryField entryField, String reason) {
locking.put(entryField, reason);
if (entryField == EntryField.ORIGINATOR) {
locking.put(EntryField.ORIGINATOR_CANDIDATES, reason);
}
} | [
"public",
"void",
"lockField",
"(",
"EntryField",
"entryField",
",",
"String",
"reason",
")",
"{",
"locking",
".",
"put",
"(",
"entryField",
",",
"reason",
")",
";",
"if",
"(",
"entryField",
"==",
"EntryField",
".",
"ORIGINATOR",
")",
"{",
"locking",
".",
... | Locks a field of the log entry.<br>
Locked fields cannot be altered anymore. If the originator field is
locked, then the originator candidates field is locked as well, since
changing the candidates also changes the originator (consistency).
@param entryField
@param reason | [
"Locks",
"a",
"field",
"of",
"the",
"log",
"entry",
".",
"<br",
">",
"Locked",
"fields",
"cannot",
"be",
"altered",
"anymore",
".",
"If",
"the",
"originator",
"field",
"is",
"locked",
"then",
"the",
"originator",
"candidates",
"field",
"is",
"locked",
"as"... | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/log/LogEntry.java#L404-L409 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.