repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/xml/xpath/XPathUtils.java | XPathUtils.evaluateExpression | public static Object evaluateExpression(Node node, String xPathExpression, NamespaceContext nsContext, QName returnType) {
try {
return buildExpression(xPathExpression, nsContext).evaluate(node, returnType);
} catch (XPathExpressionException e) {
throw new CitrusRuntimeException("Can not evaluate xpath expression '" + xPathExpression + "'", e);
}
} | java | public static Object evaluateExpression(Node node, String xPathExpression, NamespaceContext nsContext, QName returnType) {
try {
return buildExpression(xPathExpression, nsContext).evaluate(node, returnType);
} catch (XPathExpressionException e) {
throw new CitrusRuntimeException("Can not evaluate xpath expression '" + xPathExpression + "'", e);
}
} | [
"public",
"static",
"Object",
"evaluateExpression",
"(",
"Node",
"node",
",",
"String",
"xPathExpression",
",",
"NamespaceContext",
"nsContext",
",",
"QName",
"returnType",
")",
"{",
"try",
"{",
"return",
"buildExpression",
"(",
"xPathExpression",
",",
"nsContext",
... | Evaluates the expression.
@param node the node.
@param xPathExpression the expression.
@param nsContext the context.
@param returnType
@return the result. | [
"Evaluates",
"the",
"expression",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/xml/xpath/XPathUtils.java#L298-L304 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java | CommerceOrderPersistenceImpl.findByU_LtC_O | @Override
public List<CommerceOrder> findByU_LtC_O(long userId, Date createDate,
int orderStatus, int start, int end) {
return findByU_LtC_O(userId, createDate, orderStatus, start, end, null);
} | java | @Override
public List<CommerceOrder> findByU_LtC_O(long userId, Date createDate,
int orderStatus, int start, int end) {
return findByU_LtC_O(userId, createDate, orderStatus, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceOrder",
">",
"findByU_LtC_O",
"(",
"long",
"userId",
",",
"Date",
"createDate",
",",
"int",
"orderStatus",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByU_LtC_O",
"(",
"userId",
",",
"cr... | Returns a range of all the commerce orders where userId = ? and createDate < ? and orderStatus = ?.
<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 the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceOrderModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param userId the user ID
@param createDate the create date
@param orderStatus the order status
@param start the lower bound of the range of commerce orders
@param end the upper bound of the range of commerce orders (not inclusive)
@return the range of matching commerce orders | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"orders",
"where",
"userId",
"=",
"?",
";",
"and",
"createDate",
"<",
";",
"?",
";",
"and",
"orderStatus",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java#L5300-L5304 |
alipay/sofa-rpc | extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/transport/bolt/BoltClientTransport.java | BoltClientTransport.convertProviderToUrl | protected Url convertProviderToUrl(ClientTransportConfig transportConfig, ProviderInfo providerInfo) {
// Url的第一个参数,如果不用事件的话,其实无所谓
Url boltUrl = new Url(providerInfo.toString(), providerInfo.getHost(), providerInfo.getPort());
boltUrl.setConnectTimeout(transportConfig.getConnectTimeout());
// 默认初始化connNum个长连接,为了slb和vip的情况
final int connectionNum = transportConfig.getConnectionNum();
if (connectionNum > 0) {
boltUrl.setConnNum(connectionNum);
} else {
boltUrl.setConnNum(1);
}
boltUrl.setConnWarmup(false); // true的话
if (RpcConstants.PROTOCOL_TYPE_BOLT.equals(providerInfo.getProtocolType())) {
boltUrl.setProtocol(RemotingConstants.PROTOCOL_BOLT);
} else {
boltUrl.setProtocol(RemotingConstants.PROTOCOL_TR);
}
return boltUrl;
} | java | protected Url convertProviderToUrl(ClientTransportConfig transportConfig, ProviderInfo providerInfo) {
// Url的第一个参数,如果不用事件的话,其实无所谓
Url boltUrl = new Url(providerInfo.toString(), providerInfo.getHost(), providerInfo.getPort());
boltUrl.setConnectTimeout(transportConfig.getConnectTimeout());
// 默认初始化connNum个长连接,为了slb和vip的情况
final int connectionNum = transportConfig.getConnectionNum();
if (connectionNum > 0) {
boltUrl.setConnNum(connectionNum);
} else {
boltUrl.setConnNum(1);
}
boltUrl.setConnWarmup(false); // true的话
if (RpcConstants.PROTOCOL_TYPE_BOLT.equals(providerInfo.getProtocolType())) {
boltUrl.setProtocol(RemotingConstants.PROTOCOL_BOLT);
} else {
boltUrl.setProtocol(RemotingConstants.PROTOCOL_TR);
}
return boltUrl;
} | [
"protected",
"Url",
"convertProviderToUrl",
"(",
"ClientTransportConfig",
"transportConfig",
",",
"ProviderInfo",
"providerInfo",
")",
"{",
"// Url的第一个参数,如果不用事件的话,其实无所谓",
"Url",
"boltUrl",
"=",
"new",
"Url",
"(",
"providerInfo",
".",
"toString",
"(",
")",
",",
"provid... | For convert provider to bolt url.
@param transportConfig ClientTransportConfig
@param providerInfo ProviderInfo
@return Bolt Url | [
"For",
"convert",
"provider",
"to",
"bolt",
"url",
"."
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/transport/bolt/BoltClientTransport.java#L127-L146 |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ParameterUtil.java | ParameterUtil.getParameterValueFromStringWithPattern | public static Object getParameterValueFromStringWithPattern(String parameterClass, String value, String pattern) throws Exception {
if (pattern == null) {
return getParameterValueFromString(parameterClass, value);
} else {
if (QueryParameter.DATE_VALUE.equals(parameterClass) ||
QueryParameter.TIME_VALUE.equals(parameterClass) ||
QueryParameter.TIMESTAMP_VALUE.equals(parameterClass)) {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
return getParameterValueFromString(parameterClass, value, sdf);
} else {
return getParameterValueFromString(parameterClass, value);
}
}
} | java | public static Object getParameterValueFromStringWithPattern(String parameterClass, String value, String pattern) throws Exception {
if (pattern == null) {
return getParameterValueFromString(parameterClass, value);
} else {
if (QueryParameter.DATE_VALUE.equals(parameterClass) ||
QueryParameter.TIME_VALUE.equals(parameterClass) ||
QueryParameter.TIMESTAMP_VALUE.equals(parameterClass)) {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
return getParameterValueFromString(parameterClass, value, sdf);
} else {
return getParameterValueFromString(parameterClass, value);
}
}
} | [
"public",
"static",
"Object",
"getParameterValueFromStringWithPattern",
"(",
"String",
"parameterClass",
",",
"String",
"value",
",",
"String",
"pattern",
")",
"throws",
"Exception",
"{",
"if",
"(",
"pattern",
"==",
"null",
")",
"{",
"return",
"getParameterValueFrom... | Get parameter value from a string represenation using a pattern
@param parameterClass parameter class
@param value string value representation
@param pattern value pattern
@return parameter value from string representation using pattern
@throws Exception if string value cannot be parse | [
"Get",
"parameter",
"value",
"from",
"a",
"string",
"represenation",
"using",
"a",
"pattern"
] | train | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ParameterUtil.java#L1067-L1081 |
GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/AbstractBigQueryInputFormat.java | AbstractBigQueryInputFormat.cleanupJob | public static void cleanupJob(BigQueryHelper bigQueryHelper, Configuration config)
throws IOException {
logger.atFine().log("cleanupJob(Bigquery, Configuration)");
String gcsPath = ConfigurationUtil.getMandatoryConfig(
config, BigQueryConfiguration.TEMP_GCS_PATH_KEY);
Export export = constructExport(
config, getExportFileFormat(config), gcsPath, bigQueryHelper, null);
try {
export.cleanupExport();
} catch (IOException ioe) {
// Error is swallowed as job has completed successfully and the only failure is deleting
// temporary data.
// This matches the FileOutputCommitter pattern.
logger.atWarning().withCause(ioe).log(
"Could not delete intermediate data from BigQuery export");
}
} | java | public static void cleanupJob(BigQueryHelper bigQueryHelper, Configuration config)
throws IOException {
logger.atFine().log("cleanupJob(Bigquery, Configuration)");
String gcsPath = ConfigurationUtil.getMandatoryConfig(
config, BigQueryConfiguration.TEMP_GCS_PATH_KEY);
Export export = constructExport(
config, getExportFileFormat(config), gcsPath, bigQueryHelper, null);
try {
export.cleanupExport();
} catch (IOException ioe) {
// Error is swallowed as job has completed successfully and the only failure is deleting
// temporary data.
// This matches the FileOutputCommitter pattern.
logger.atWarning().withCause(ioe).log(
"Could not delete intermediate data from BigQuery export");
}
} | [
"public",
"static",
"void",
"cleanupJob",
"(",
"BigQueryHelper",
"bigQueryHelper",
",",
"Configuration",
"config",
")",
"throws",
"IOException",
"{",
"logger",
".",
"atFine",
"(",
")",
".",
"log",
"(",
"\"cleanupJob(Bigquery, Configuration)\"",
")",
";",
"String",
... | Similar to {@link #cleanupJob(Configuration, JobID)}, but allows specifying the Bigquery
instance to use.
@param bigQueryHelper The Bigquery API-client helper instance to use.
@param config The job Configuration object which contains settings such as whether sharded
export was enabled, which GCS directory the export was performed in, etc. | [
"Similar",
"to",
"{",
"@link",
"#cleanupJob",
"(",
"Configuration",
"JobID",
")",
"}",
"but",
"allows",
"specifying",
"the",
"Bigquery",
"instance",
"to",
"use",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/AbstractBigQueryInputFormat.java#L227-L246 |
biojava/biojava | biojava-alignment/src/main/java/org/biojava/nbio/phylo/Comparison.java | Comparison.PID | public final static float PID(String seq1, String seq2) {
return PID(seq1, seq2, 0, seq1.length());
} | java | public final static float PID(String seq1, String seq2) {
return PID(seq1, seq2, 0, seq1.length());
} | [
"public",
"final",
"static",
"float",
"PID",
"(",
"String",
"seq1",
",",
"String",
"seq2",
")",
"{",
"return",
"PID",
"(",
"seq1",
",",
"seq2",
",",
"0",
",",
"seq1",
".",
"length",
"(",
")",
")",
";",
"}"
] | this is a gapped PID calculation
@param s1
SequenceI
@param s2
SequenceI
@return float | [
"this",
"is",
"a",
"gapped",
"PID",
"calculation"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/phylo/Comparison.java#L47-L49 |
FlyingHe/UtilsMaven | src/main/java/com/github/flyinghe/tools/XLSReader.java | XLSReader.readExcel | public static XLSReader readExcel(File file, Integer scale) throws ReadExcelException {
POIFSFileSystem fs = null;
XLSReader reader = null;
try {
fs = new POIFSFileSystem(file);
reader = new XLSReader(fs, scale);
reader.process();
} catch (Exception e) {
throw new ReadExcelException(e.getMessage());
} finally {
if (fs != null) {
try {
fs.close();
} catch (IOException e) {
throw new ReadExcelException(e.getMessage());
}
}
}
return reader;
} | java | public static XLSReader readExcel(File file, Integer scale) throws ReadExcelException {
POIFSFileSystem fs = null;
XLSReader reader = null;
try {
fs = new POIFSFileSystem(file);
reader = new XLSReader(fs, scale);
reader.process();
} catch (Exception e) {
throw new ReadExcelException(e.getMessage());
} finally {
if (fs != null) {
try {
fs.close();
} catch (IOException e) {
throw new ReadExcelException(e.getMessage());
}
}
}
return reader;
} | [
"public",
"static",
"XLSReader",
"readExcel",
"(",
"File",
"file",
",",
"Integer",
"scale",
")",
"throws",
"ReadExcelException",
"{",
"POIFSFileSystem",
"fs",
"=",
"null",
";",
"XLSReader",
"reader",
"=",
"null",
";",
"try",
"{",
"fs",
"=",
"new",
"POIFSFile... | 读取整个Excel文件,并把读取的数据放入beanMap中,
可以通过返回的{@link XLSReader}对象调用{@link XLSReader#getDatas()}方法拿到数据
@param file Excel文件
@param scale 指定若数值中含有小数则保留几位小数,四舍五入,null或者<=0表示不四舍五入
@return 返回 {@link XLSReader}对象,你可以通过此对象获取你需要的数据
@throws ReadExcelException | [
"读取整个Excel文件",
"并把读取的数据放入beanMap中",
"可以通过返回的",
"{",
"@link",
"XLSReader",
"}",
"对象调用",
"{",
"@link",
"XLSReader#getDatas",
"()",
"}",
"方法拿到数据"
] | train | https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/XLSReader.java#L557-L576 |
apache/groovy | src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java | StaticTypeCheckingVisitor.extractPropertyNameFromMethodName | public static String extractPropertyNameFromMethodName(String prefix, String methodName) {
if (prefix == null || methodName == null) return null;
if (methodName.startsWith(prefix) && prefix.length() < methodName.length()) {
String result = methodName.substring(prefix.length());
String propertyName = decapitalize(result);
if (result.equals(capitalize(propertyName))) return propertyName;
}
return null;
} | java | public static String extractPropertyNameFromMethodName(String prefix, String methodName) {
if (prefix == null || methodName == null) return null;
if (methodName.startsWith(prefix) && prefix.length() < methodName.length()) {
String result = methodName.substring(prefix.length());
String propertyName = decapitalize(result);
if (result.equals(capitalize(propertyName))) return propertyName;
}
return null;
} | [
"public",
"static",
"String",
"extractPropertyNameFromMethodName",
"(",
"String",
"prefix",
",",
"String",
"methodName",
")",
"{",
"if",
"(",
"prefix",
"==",
"null",
"||",
"methodName",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"methodName",
".",
... | Given a method name and a prefix, returns the name of the property that should be looked up,
following the java beans rules. For example, "getName" would return "name", while
"getFullName" would return "fullName".
If the prefix is not found, returns null.
@param prefix the method name prefix ("get", "is", "set", ...)
@param methodName the method name
@return a property name if the prefix is found and the method matches the java beans rules, null otherwise | [
"Given",
"a",
"method",
"name",
"and",
"a",
"prefix",
"returns",
"the",
"name",
"of",
"the",
"property",
"that",
"should",
"be",
"looked",
"up",
"following",
"the",
"java",
"beans",
"rules",
".",
"For",
"example",
"getName",
"would",
"return",
"name",
"whi... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java#L4886-L4894 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskLog.java | TaskLog.getRealTaskLogFilePath | static String getRealTaskLogFilePath(String location, LogName filter)
throws IOException {
return FileUtil.makeShellPath(new File(getBaseDir(location),
filter.toString()));
} | java | static String getRealTaskLogFilePath(String location, LogName filter)
throws IOException {
return FileUtil.makeShellPath(new File(getBaseDir(location),
filter.toString()));
} | [
"static",
"String",
"getRealTaskLogFilePath",
"(",
"String",
"location",
",",
"LogName",
"filter",
")",
"throws",
"IOException",
"{",
"return",
"FileUtil",
".",
"makeShellPath",
"(",
"new",
"File",
"(",
"getBaseDir",
"(",
"location",
")",
",",
"filter",
".",
"... | Get the real task-log file-path
@param location Location of the log-file. This should point to an
attempt-directory.
@param filter
@return
@throws IOException | [
"Get",
"the",
"real",
"task",
"-",
"log",
"file",
"-",
"path"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskLog.java#L115-L119 |
alkacon/opencms-core | src/org/opencms/i18n/CmsEncoder.java | CmsEncoder.changeEncoding | public static byte[] changeEncoding(byte[] input, String oldEncoding, String newEncoding) {
if ((oldEncoding == null) || (newEncoding == null)) {
return input;
}
if (oldEncoding.trim().equalsIgnoreCase(newEncoding.trim())) {
return input;
}
byte[] result = input;
try {
result = (new String(input, oldEncoding)).getBytes(newEncoding);
} catch (UnsupportedEncodingException e) {
// return value will be input value
}
return result;
} | java | public static byte[] changeEncoding(byte[] input, String oldEncoding, String newEncoding) {
if ((oldEncoding == null) || (newEncoding == null)) {
return input;
}
if (oldEncoding.trim().equalsIgnoreCase(newEncoding.trim())) {
return input;
}
byte[] result = input;
try {
result = (new String(input, oldEncoding)).getBytes(newEncoding);
} catch (UnsupportedEncodingException e) {
// return value will be input value
}
return result;
} | [
"public",
"static",
"byte",
"[",
"]",
"changeEncoding",
"(",
"byte",
"[",
"]",
"input",
",",
"String",
"oldEncoding",
",",
"String",
"newEncoding",
")",
"{",
"if",
"(",
"(",
"oldEncoding",
"==",
"null",
")",
"||",
"(",
"newEncoding",
"==",
"null",
")",
... | Changes the encoding of a byte array that represents a String.<p>
@param input the byte array to convert
@param oldEncoding the current encoding of the byte array
@param newEncoding the new encoding of the byte array
@return the byte array encoded in the new encoding | [
"Changes",
"the",
"encoding",
"of",
"a",
"byte",
"array",
"that",
"represents",
"a",
"String",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsEncoder.java#L150-L165 |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/filters/FilterAdapter.java | FilterAdapter.throwIfUnsupportedFilter | public void throwIfUnsupportedFilter(Scan scan, Filter filter) {
List<FilterSupportStatus> filterSupportStatuses = new ArrayList<>();
FilterAdapterContext context = new FilterAdapterContext(scan, null);
collectUnsupportedStatuses(context, filter, filterSupportStatuses);
if (!filterSupportStatuses.isEmpty()) {
throw new UnsupportedFilterException(filterSupportStatuses);
}
} | java | public void throwIfUnsupportedFilter(Scan scan, Filter filter) {
List<FilterSupportStatus> filterSupportStatuses = new ArrayList<>();
FilterAdapterContext context = new FilterAdapterContext(scan, null);
collectUnsupportedStatuses(context, filter, filterSupportStatuses);
if (!filterSupportStatuses.isEmpty()) {
throw new UnsupportedFilterException(filterSupportStatuses);
}
} | [
"public",
"void",
"throwIfUnsupportedFilter",
"(",
"Scan",
"scan",
",",
"Filter",
"filter",
")",
"{",
"List",
"<",
"FilterSupportStatus",
">",
"filterSupportStatuses",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"FilterAdapterContext",
"context",
"=",
"new",
"... | Throw a new UnsupportedFilterException if the given filter cannot be adapted to bigtable
reader expressions.
@param scan a {@link org.apache.hadoop.hbase.client.Scan} object.
@param filter a {@link org.apache.hadoop.hbase.filter.Filter} object. | [
"Throw",
"a",
"new",
"UnsupportedFilterException",
"if",
"the",
"given",
"filter",
"cannot",
"be",
"adapted",
"to",
"bigtable",
"reader",
"expressions",
"."
] | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/filters/FilterAdapter.java#L181-L188 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ras/FormattedWriter.java | FormattedWriter.taggedValue | public final void taggedValue(String tag, Object value) throws IOException {
startTag(tag);
if (value == null) {
write("null");
} else {
write(value.toString());
}
endTag(tag);
} | java | public final void taggedValue(String tag, Object value) throws IOException {
startTag(tag);
if (value == null) {
write("null");
} else {
write(value.toString());
}
endTag(tag);
} | [
"public",
"final",
"void",
"taggedValue",
"(",
"String",
"tag",
",",
"Object",
"value",
")",
"throws",
"IOException",
"{",
"startTag",
"(",
"tag",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"write",
"(",
"\"null\"",
")",
";",
"}",
"else",
... | Write out a one-line XML tag with a Object datatype, for instance <tag>object</tag<
@param tag The name of the tag to be written
@param value The data value to be written
@throws IOException If an I/O error occurs while attempting to write the characters | [
"Write",
"out",
"a",
"one",
"-",
"line",
"XML",
"tag",
"with",
"a",
"Object",
"datatype",
"for",
"instance",
"<tag>object<",
"/",
"tag<"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ras/FormattedWriter.java#L228-L236 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getCertificateIssuersAsync | public Observable<Page<CertificateIssuerItem>> getCertificateIssuersAsync(final String vaultBaseUrl, final Integer maxresults) {
return getCertificateIssuersWithServiceResponseAsync(vaultBaseUrl, maxresults)
.map(new Func1<ServiceResponse<Page<CertificateIssuerItem>>, Page<CertificateIssuerItem>>() {
@Override
public Page<CertificateIssuerItem> call(ServiceResponse<Page<CertificateIssuerItem>> response) {
return response.body();
}
});
} | java | public Observable<Page<CertificateIssuerItem>> getCertificateIssuersAsync(final String vaultBaseUrl, final Integer maxresults) {
return getCertificateIssuersWithServiceResponseAsync(vaultBaseUrl, maxresults)
.map(new Func1<ServiceResponse<Page<CertificateIssuerItem>>, Page<CertificateIssuerItem>>() {
@Override
public Page<CertificateIssuerItem> call(ServiceResponse<Page<CertificateIssuerItem>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"CertificateIssuerItem",
">",
">",
"getCertificateIssuersAsync",
"(",
"final",
"String",
"vaultBaseUrl",
",",
"final",
"Integer",
"maxresults",
")",
"{",
"return",
"getCertificateIssuersWithServiceResponseAsync",
"(",
"vaultBaseUr... | List certificate issuers for a specified key vault.
The GetCertificateIssuers operation returns the set of certificate issuer resources in the specified key vault. This operation requires the certificates/manageissuers/getissuers permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<CertificateIssuerItem> object | [
"List",
"certificate",
"issuers",
"for",
"a",
"specified",
"key",
"vault",
".",
"The",
"GetCertificateIssuers",
"operation",
"returns",
"the",
"set",
"of",
"certificate",
"issuer",
"resources",
"in",
"the",
"specified",
"key",
"vault",
".",
"This",
"operation",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L5817-L5825 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/TableAppender.java | TableAppender.appendPreamble | public void appendPreamble(final XMLUtil util, final Appendable appendable) throws IOException {
if (this.preambleWritten)
return;
appendable.append("<table:table");
util.appendEAttribute(appendable, "table:name", this.builder.getName());
util.appendEAttribute(appendable, "table:style-name",
this.builder.getStyleName());
util.appendAttribute(appendable, "table:print", false);
appendable.append("><office:forms");
util.appendAttribute(appendable, "form:automatic-focus", false);
util.appendAttribute(appendable, "form:apply-design-mode", false);
appendable.append("/>");
this.appendColumnStyles(this.builder.getColumnStyles(), appendable, util);
this.preambleWritten = true;
} | java | public void appendPreamble(final XMLUtil util, final Appendable appendable) throws IOException {
if (this.preambleWritten)
return;
appendable.append("<table:table");
util.appendEAttribute(appendable, "table:name", this.builder.getName());
util.appendEAttribute(appendable, "table:style-name",
this.builder.getStyleName());
util.appendAttribute(appendable, "table:print", false);
appendable.append("><office:forms");
util.appendAttribute(appendable, "form:automatic-focus", false);
util.appendAttribute(appendable, "form:apply-design-mode", false);
appendable.append("/>");
this.appendColumnStyles(this.builder.getColumnStyles(), appendable, util);
this.preambleWritten = true;
} | [
"public",
"void",
"appendPreamble",
"(",
"final",
"XMLUtil",
"util",
",",
"final",
"Appendable",
"appendable",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"preambleWritten",
")",
"return",
";",
"appendable",
".",
"append",
"(",
"\"<table:table\"",... | Append the preamble
@param util an util
@param appendable the destination
@throws IOException if an I/O error occurs | [
"Append",
"the",
"preamble"
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/TableAppender.java#L68-L83 |
juebanlin/util4j | util4j/src/main/java/net/jueb/util4j/security/RsaUtil.java | RsaUtil.signVerify | public boolean signVerify(byte[] content,byte[] sign,PublicKey pubKey)
{
try
{
java.security.Signature signature = java.security.Signature.getInstance(SIGN_ALGORITHMS);
signature.initVerify(pubKey);
signature.update(content);
return signature.verify(sign);
}catch (Exception e)
{
log.error(e.getMessage(),e);
}
return false;
} | java | public boolean signVerify(byte[] content,byte[] sign,PublicKey pubKey)
{
try
{
java.security.Signature signature = java.security.Signature.getInstance(SIGN_ALGORITHMS);
signature.initVerify(pubKey);
signature.update(content);
return signature.verify(sign);
}catch (Exception e)
{
log.error(e.getMessage(),e);
}
return false;
} | [
"public",
"boolean",
"signVerify",
"(",
"byte",
"[",
"]",
"content",
",",
"byte",
"[",
"]",
"sign",
",",
"PublicKey",
"pubKey",
")",
"{",
"try",
"{",
"java",
".",
"security",
".",
"Signature",
"signature",
"=",
"java",
".",
"security",
".",
"Signature",
... | RSA验签名检查
@param content 待签名数据
@param sign 签名值
@param publicKey 分配给开发商公钥
@return 布尔值 | [
"RSA验签名检查"
] | train | https://github.com/juebanlin/util4j/blob/c404b2dbdedf7a8890533b351257fa8af4f1439f/util4j/src/main/java/net/jueb/util4j/security/RsaUtil.java#L303-L316 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/ComboBoxArrowButtonPainter.java | ComboBoxArrowButtonPainter.paintArrows | private void paintArrows(Graphics2D g, JComponent c, int width, int height) {
int xOffset = width / 2 - 5;
int yOffset = height / 2 - 3;
g.translate(xOffset, yOffset);
Shape s = shapeGenerator.createArrowLeft(0.5, 0.5, 3, 4);
g.setPaint(getCommonArrowPaint(s, type));
g.fill(s);
s = shapeGenerator.createArrowRight(6.5, 0.5, 3, 4);
g.setPaint(getCommonArrowPaint(s, type));
g.fill(s);
g.translate(-xOffset, -yOffset);
} | java | private void paintArrows(Graphics2D g, JComponent c, int width, int height) {
int xOffset = width / 2 - 5;
int yOffset = height / 2 - 3;
g.translate(xOffset, yOffset);
Shape s = shapeGenerator.createArrowLeft(0.5, 0.5, 3, 4);
g.setPaint(getCommonArrowPaint(s, type));
g.fill(s);
s = shapeGenerator.createArrowRight(6.5, 0.5, 3, 4);
g.setPaint(getCommonArrowPaint(s, type));
g.fill(s);
g.translate(-xOffset, -yOffset);
} | [
"private",
"void",
"paintArrows",
"(",
"Graphics2D",
"g",
",",
"JComponent",
"c",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"int",
"xOffset",
"=",
"width",
"/",
"2",
"-",
"5",
";",
"int",
"yOffset",
"=",
"height",
"/",
"2",
"-",
"3",
";"... | Paint the arrows (both up and down, or left and right).
@param g the Graphics2D context to paint with.
@param c the component to paint.
@param width the width.
@param height the height. | [
"Paint",
"the",
"arrows",
"(",
"both",
"up",
"and",
"down",
"or",
"left",
"and",
"right",
")",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ComboBoxArrowButtonPainter.java#L166-L182 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/birch/CFTree.java | CFTree.printDebug | protected StringBuilder printDebug(StringBuilder buf, ClusteringFeature n, int d) {
FormatUtil.appendSpace(buf, d).append(n.n);
for(int i = 0; i < n.getDimensionality(); i++) {
buf.append(' ').append(n.centroid(i));
}
buf.append(" - ").append(n.n).append('\n');
if(n instanceof TreeNode) {
ClusteringFeature[] children = ((TreeNode) n).children;
for(int i = 0; i < children.length; i++) {
ClusteringFeature c = children[i];
if(c != null) {
printDebug(buf, c, d + 1);
}
}
}
return buf;
} | java | protected StringBuilder printDebug(StringBuilder buf, ClusteringFeature n, int d) {
FormatUtil.appendSpace(buf, d).append(n.n);
for(int i = 0; i < n.getDimensionality(); i++) {
buf.append(' ').append(n.centroid(i));
}
buf.append(" - ").append(n.n).append('\n');
if(n instanceof TreeNode) {
ClusteringFeature[] children = ((TreeNode) n).children;
for(int i = 0; i < children.length; i++) {
ClusteringFeature c = children[i];
if(c != null) {
printDebug(buf, c, d + 1);
}
}
}
return buf;
} | [
"protected",
"StringBuilder",
"printDebug",
"(",
"StringBuilder",
"buf",
",",
"ClusteringFeature",
"n",
",",
"int",
"d",
")",
"{",
"FormatUtil",
".",
"appendSpace",
"(",
"buf",
",",
"d",
")",
".",
"append",
"(",
"n",
".",
"n",
")",
";",
"for",
"(",
"in... | Utility function for debugging.
@param buf Output buffer
@param n Current node
@param d Depth
@return Output buffer | [
"Utility",
"function",
"for",
"debugging",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/birch/CFTree.java#L577-L593 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java | JobSchedulesImpl.getAsync | public Observable<CloudJobSchedule> getAsync(String jobScheduleId, JobScheduleGetOptions jobScheduleGetOptions) {
return getWithServiceResponseAsync(jobScheduleId, jobScheduleGetOptions).map(new Func1<ServiceResponseWithHeaders<CloudJobSchedule, JobScheduleGetHeaders>, CloudJobSchedule>() {
@Override
public CloudJobSchedule call(ServiceResponseWithHeaders<CloudJobSchedule, JobScheduleGetHeaders> response) {
return response.body();
}
});
} | java | public Observable<CloudJobSchedule> getAsync(String jobScheduleId, JobScheduleGetOptions jobScheduleGetOptions) {
return getWithServiceResponseAsync(jobScheduleId, jobScheduleGetOptions).map(new Func1<ServiceResponseWithHeaders<CloudJobSchedule, JobScheduleGetHeaders>, CloudJobSchedule>() {
@Override
public CloudJobSchedule call(ServiceResponseWithHeaders<CloudJobSchedule, JobScheduleGetHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"CloudJobSchedule",
">",
"getAsync",
"(",
"String",
"jobScheduleId",
",",
"JobScheduleGetOptions",
"jobScheduleGetOptions",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"jobScheduleId",
",",
"jobScheduleGetOptions",
")",
".",
"map",... | Gets information about the specified job schedule.
@param jobScheduleId The ID of the job schedule to get.
@param jobScheduleGetOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CloudJobSchedule object | [
"Gets",
"information",
"about",
"the",
"specified",
"job",
"schedule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java#L724-L731 |
Alluxio/alluxio | core/server/worker/src/main/java/alluxio/worker/block/BlockLockManager.java | BlockLockManager.validateLock | public void validateLock(long sessionId, long blockId, long lockId)
throws BlockDoesNotExistException, InvalidWorkerStateException {
synchronized (mSharedMapsLock) {
LockRecord record = mLockIdToRecordMap.get(lockId);
if (record == null) {
throw new BlockDoesNotExistException(ExceptionMessage.LOCK_RECORD_NOT_FOUND_FOR_LOCK_ID,
lockId);
}
if (sessionId != record.getSessionId()) {
throw new InvalidWorkerStateException(ExceptionMessage.LOCK_ID_FOR_DIFFERENT_SESSION,
lockId, record.getSessionId(), sessionId);
}
if (blockId != record.getBlockId()) {
throw new InvalidWorkerStateException(ExceptionMessage.LOCK_ID_FOR_DIFFERENT_BLOCK, lockId,
record.getBlockId(), blockId);
}
}
} | java | public void validateLock(long sessionId, long blockId, long lockId)
throws BlockDoesNotExistException, InvalidWorkerStateException {
synchronized (mSharedMapsLock) {
LockRecord record = mLockIdToRecordMap.get(lockId);
if (record == null) {
throw new BlockDoesNotExistException(ExceptionMessage.LOCK_RECORD_NOT_FOUND_FOR_LOCK_ID,
lockId);
}
if (sessionId != record.getSessionId()) {
throw new InvalidWorkerStateException(ExceptionMessage.LOCK_ID_FOR_DIFFERENT_SESSION,
lockId, record.getSessionId(), sessionId);
}
if (blockId != record.getBlockId()) {
throw new InvalidWorkerStateException(ExceptionMessage.LOCK_ID_FOR_DIFFERENT_BLOCK, lockId,
record.getBlockId(), blockId);
}
}
} | [
"public",
"void",
"validateLock",
"(",
"long",
"sessionId",
",",
"long",
"blockId",
",",
"long",
"lockId",
")",
"throws",
"BlockDoesNotExistException",
",",
"InvalidWorkerStateException",
"{",
"synchronized",
"(",
"mSharedMapsLock",
")",
"{",
"LockRecord",
"record",
... | Validates the lock is hold by the given session for the given block.
@param sessionId the session id
@param blockId the block id
@param lockId the lock id
@throws BlockDoesNotExistException when no lock record can be found for lock id
@throws InvalidWorkerStateException when session id or block id is not consistent with that
in the lock record for lock id | [
"Validates",
"the",
"lock",
"is",
"hold",
"by",
"the",
"given",
"session",
"for",
"the",
"given",
"block",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/BlockLockManager.java#L282-L299 |
jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Db.java | Db.deleteByIds | public static boolean deleteByIds(String tableName, String primaryKey, Object... idValues) {
return MAIN.deleteByIds(tableName, primaryKey, idValues);
} | java | public static boolean deleteByIds(String tableName, String primaryKey, Object... idValues) {
return MAIN.deleteByIds(tableName, primaryKey, idValues);
} | [
"public",
"static",
"boolean",
"deleteByIds",
"(",
"String",
"tableName",
",",
"String",
"primaryKey",
",",
"Object",
"...",
"idValues",
")",
"{",
"return",
"MAIN",
".",
"deleteByIds",
"(",
"tableName",
",",
"primaryKey",
",",
"idValues",
")",
";",
"}"
] | Delete record by ids.
<pre>
Example:
Db.deleteByIds("user", "user_id", 15);
Db.deleteByIds("user_role", "user_id, role_id", 123, 456);
</pre>
@param tableName the table name of the table
@param primaryKey the primary key of the table, composite primary key is separated by comma character: ","
@param idValues the id value of the record, it can be composite id values
@return true if delete succeed otherwise false | [
"Delete",
"record",
"by",
"ids",
".",
"<pre",
">",
"Example",
":",
"Db",
".",
"deleteByIds",
"(",
"user",
"user_id",
"15",
")",
";",
"Db",
".",
"deleteByIds",
"(",
"user_role",
"user_id",
"role_id",
"123",
"456",
")",
";",
"<",
"/",
"pre",
">"
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Db.java#L366-L368 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java | SparkComputationGraph.doEvaluation | @SuppressWarnings("unchecked")
public <T extends IEvaluation> T doEvaluation(JavaRDD<DataSet> data, T emptyEvaluation, int evalBatchSize) {
IEvaluation[] arr = new IEvaluation[] {emptyEvaluation};
return (T) doEvaluation(data, evalBatchSize, arr)[0];
} | java | @SuppressWarnings("unchecked")
public <T extends IEvaluation> T doEvaluation(JavaRDD<DataSet> data, T emptyEvaluation, int evalBatchSize) {
IEvaluation[] arr = new IEvaluation[] {emptyEvaluation};
return (T) doEvaluation(data, evalBatchSize, arr)[0];
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"IEvaluation",
">",
"T",
"doEvaluation",
"(",
"JavaRDD",
"<",
"DataSet",
">",
"data",
",",
"T",
"emptyEvaluation",
",",
"int",
"evalBatchSize",
")",
"{",
"IEvaluation",
"[",
"... | Perform distributed evaluation of any type of {@link IEvaluation}. For example, {@link Evaluation}, {@link RegressionEvaluation},
{@link ROC}, {@link ROCMultiClass} etc.
@param data Data to evaluate on
@param emptyEvaluation Empty evaluation instance. This is the starting point (serialized/duplicated, then merged)
@param evalBatchSize Evaluation batch size
@param <T> Type of evaluation instance to return
@return IEvaluation instance | [
"Perform",
"distributed",
"evaluation",
"of",
"any",
"type",
"of",
"{",
"@link",
"IEvaluation",
"}",
".",
"For",
"example",
"{",
"@link",
"Evaluation",
"}",
"{",
"@link",
"RegressionEvaluation",
"}",
"{",
"@link",
"ROC",
"}",
"{",
"@link",
"ROCMultiClass",
"... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java#L793-L797 |
aws/aws-sdk-java | aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/ContentCryptoMaterial.java | ContentCryptoMaterial.toObjectMetadata | ObjectMetadata toObjectMetadata(ObjectMetadata metadata, CryptoMode mode) {
return mode == CryptoMode.EncryptionOnly && !usesKMSKey()
? toObjectMetadataEO(metadata)
: toObjectMetadata(metadata);
} | java | ObjectMetadata toObjectMetadata(ObjectMetadata metadata, CryptoMode mode) {
return mode == CryptoMode.EncryptionOnly && !usesKMSKey()
? toObjectMetadataEO(metadata)
: toObjectMetadata(metadata);
} | [
"ObjectMetadata",
"toObjectMetadata",
"(",
"ObjectMetadata",
"metadata",
",",
"CryptoMode",
"mode",
")",
"{",
"return",
"mode",
"==",
"CryptoMode",
".",
"EncryptionOnly",
"&&",
"!",
"usesKMSKey",
"(",
")",
"?",
"toObjectMetadataEO",
"(",
"metadata",
")",
":",
"t... | Returns the given metadata updated with this content crypto material. | [
"Returns",
"the",
"given",
"metadata",
"updated",
"with",
"this",
"content",
"crypto",
"material",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/ContentCryptoMaterial.java#L117-L121 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/slim/StringFixture.java | StringFixture.replaceAllInWith | public String replaceAllInWith(String regEx, String value, String replace) {
String result = null;
if (value != null) {
if (replace == null) {
// empty cell in table is sent as null
replace = "";
}
result = getMatcher(regEx, value).replaceAll(replace);
}
return result;
} | java | public String replaceAllInWith(String regEx, String value, String replace) {
String result = null;
if (value != null) {
if (replace == null) {
// empty cell in table is sent as null
replace = "";
}
result = getMatcher(regEx, value).replaceAll(replace);
}
return result;
} | [
"public",
"String",
"replaceAllInWith",
"(",
"String",
"regEx",
",",
"String",
"value",
",",
"String",
"replace",
")",
"{",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"if",
"(",
"replace",
"==",
"null",
")",
"{",
... | Replaces all occurrences of the regular expression in the value with the replacement value.
@param regEx regular expression to match.
@param value value to replace in.
@param replace replacement pattern.
@return result. | [
"Replaces",
"all",
"occurrences",
"of",
"the",
"regular",
"expression",
"in",
"the",
"value",
"with",
"the",
"replacement",
"value",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/StringFixture.java#L166-L176 |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java | PipelineBuilder.addLiteral | public void addLiteral(final INodeReadTrx pTrans, final AtomicValue pVal) {
getExpression().add(new LiteralExpr(pTrans, AbsAxis.addAtomicToItemList(pTrans, pVal)));
} | java | public void addLiteral(final INodeReadTrx pTrans, final AtomicValue pVal) {
getExpression().add(new LiteralExpr(pTrans, AbsAxis.addAtomicToItemList(pTrans, pVal)));
} | [
"public",
"void",
"addLiteral",
"(",
"final",
"INodeReadTrx",
"pTrans",
",",
"final",
"AtomicValue",
"pVal",
")",
"{",
"getExpression",
"(",
")",
".",
"add",
"(",
"new",
"LiteralExpr",
"(",
"pTrans",
",",
"AbsAxis",
".",
"addAtomicToItemList",
"(",
"pTrans",
... | Adds a literal expression to the pipeline.
@param pTrans
Transaction to operate with.
@param pVal
key of the literal expression. | [
"Adds",
"a",
"literal",
"expression",
"to",
"the",
"pipeline",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java#L485-L487 |
yanzhenjie/Album | album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java | AlbumUtils.getTintDrawable | @NonNull
public static Drawable getTintDrawable(@NonNull Drawable drawable, @ColorInt int color) {
drawable = DrawableCompat.wrap(drawable.mutate());
DrawableCompat.setTint(drawable, color);
return drawable;
} | java | @NonNull
public static Drawable getTintDrawable(@NonNull Drawable drawable, @ColorInt int color) {
drawable = DrawableCompat.wrap(drawable.mutate());
DrawableCompat.setTint(drawable, color);
return drawable;
} | [
"@",
"NonNull",
"public",
"static",
"Drawable",
"getTintDrawable",
"(",
"@",
"NonNull",
"Drawable",
"drawable",
",",
"@",
"ColorInt",
"int",
"color",
")",
"{",
"drawable",
"=",
"DrawableCompat",
".",
"wrap",
"(",
"drawable",
".",
"mutate",
"(",
")",
")",
"... | Specifies a tint for {@code drawable}.
@param drawable drawable target, mutate.
@param color color.
@return convert drawable. | [
"Specifies",
"a",
"tint",
"for",
"{",
"@code",
"drawable",
"}",
"."
] | train | https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java#L316-L321 |
alkacon/opencms-core | src/org/opencms/ugc/CmsUgcSession.java | CmsUgcSession.deleteResourceFromProject | private void deleteResourceFromProject(CmsObject cms, CmsResource res) throws CmsException {
CmsLock lock = cms.getLock(res);
if (lock.isUnlocked() || lock.isLockableBy(cms.getRequestContext().getCurrentUser())) {
cms.lockResourceTemporary(res);
} else {
cms.changeLock(res);
}
cms.deleteResource(cms.getSitePath(res), CmsResource.DELETE_PRESERVE_SIBLINGS);
} | java | private void deleteResourceFromProject(CmsObject cms, CmsResource res) throws CmsException {
CmsLock lock = cms.getLock(res);
if (lock.isUnlocked() || lock.isLockableBy(cms.getRequestContext().getCurrentUser())) {
cms.lockResourceTemporary(res);
} else {
cms.changeLock(res);
}
cms.deleteResource(cms.getSitePath(res), CmsResource.DELETE_PRESERVE_SIBLINGS);
} | [
"private",
"void",
"deleteResourceFromProject",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"res",
")",
"throws",
"CmsException",
"{",
"CmsLock",
"lock",
"=",
"cms",
".",
"getLock",
"(",
"res",
")",
";",
"if",
"(",
"lock",
".",
"isUnlocked",
"(",
")",
"||... | Deletes the given resource which is part of a form session project.<p>
@param cms the CMS context to use
@param res the resource to delete
@throws CmsException if something goes wrong | [
"Deletes",
"the",
"given",
"resource",
"which",
"is",
"part",
"of",
"a",
"form",
"session",
"project",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcSession.java#L766-L775 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/hadoop/ConfigHelper.java | ConfigHelper.setInputSlicePredicate | public static void setInputSlicePredicate(Configuration conf, SlicePredicate predicate)
{
conf.set(INPUT_PREDICATE_CONFIG, thriftToString(predicate));
} | java | public static void setInputSlicePredicate(Configuration conf, SlicePredicate predicate)
{
conf.set(INPUT_PREDICATE_CONFIG, thriftToString(predicate));
} | [
"public",
"static",
"void",
"setInputSlicePredicate",
"(",
"Configuration",
"conf",
",",
"SlicePredicate",
"predicate",
")",
"{",
"conf",
".",
"set",
"(",
"INPUT_PREDICATE_CONFIG",
",",
"thriftToString",
"(",
"predicate",
")",
")",
";",
"}"
] | Set the predicate that determines what columns will be selected from each row.
@param conf Job configuration you are about to run
@param predicate | [
"Set",
"the",
"predicate",
"that",
"determines",
"what",
"columns",
"will",
"be",
"selected",
"from",
"each",
"row",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/ConfigHelper.java#L198-L201 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftClient.java | ThriftClient.executeQuery | @Override
public List executeQuery(Class clazz, List<String> relationalField, boolean isNative, String cqlQuery)
{
if (clazz == null)
{
return super.executeScalarQuery(cqlQuery);
}
return super.executeSelectQuery(clazz, relationalField, dataHandler, isNative, cqlQuery);
} | java | @Override
public List executeQuery(Class clazz, List<String> relationalField, boolean isNative, String cqlQuery)
{
if (clazz == null)
{
return super.executeScalarQuery(cqlQuery);
}
return super.executeSelectQuery(clazz, relationalField, dataHandler, isNative, cqlQuery);
} | [
"@",
"Override",
"public",
"List",
"executeQuery",
"(",
"Class",
"clazz",
",",
"List",
"<",
"String",
">",
"relationalField",
",",
"boolean",
"isNative",
",",
"String",
"cqlQuery",
")",
"{",
"if",
"(",
"clazz",
"==",
"null",
")",
"{",
"return",
"super",
... | Query related methods.
@param clazz
the clazz
@param relationalField
the relational field
@param isNative
the is native
@param cqlQuery
the cql query
@return the list | [
"Query",
"related",
"methods",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftClient.java#L1055-L1063 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.findAll | public static Collection findAll(Object self, Closure closure) {
List answer = new ArrayList();
Iterator iter = InvokerHelper.asIterator(self);
return findAll(closure, answer, iter);
} | java | public static Collection findAll(Object self, Closure closure) {
List answer = new ArrayList();
Iterator iter = InvokerHelper.asIterator(self);
return findAll(closure, answer, iter);
} | [
"public",
"static",
"Collection",
"findAll",
"(",
"Object",
"self",
",",
"Closure",
"closure",
")",
"{",
"List",
"answer",
"=",
"new",
"ArrayList",
"(",
")",
";",
"Iterator",
"iter",
"=",
"InvokerHelper",
".",
"asIterator",
"(",
"self",
")",
";",
"return",... | Finds all items matching the closure condition.
@param self an Object with an Iterator returning its values
@param closure a closure condition
@return a List of the values found
@since 1.6.0 | [
"Finds",
"all",
"items",
"matching",
"the",
"closure",
"condition",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L4877-L4881 |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/Util.java | Util.cardinalityInBitmapRange | public static int cardinalityInBitmapRange(long[] bitmap, int start, int end) {
if (start >= end) {
return 0;
}
int firstword = start / 64;
int endword = (end - 1) / 64;
if (firstword == endword) {
return Long.bitCount(bitmap[firstword] & ( (~0L << start) & (~0L >>> -end) ));
}
int answer = Long.bitCount(bitmap[firstword] & (~0L << start));
for (int i = firstword + 1; i < endword; i++) {
answer += Long.bitCount(bitmap[i]);
}
answer += Long.bitCount(bitmap[endword] & (~0L >>> -end));
return answer;
} | java | public static int cardinalityInBitmapRange(long[] bitmap, int start, int end) {
if (start >= end) {
return 0;
}
int firstword = start / 64;
int endword = (end - 1) / 64;
if (firstword == endword) {
return Long.bitCount(bitmap[firstword] & ( (~0L << start) & (~0L >>> -end) ));
}
int answer = Long.bitCount(bitmap[firstword] & (~0L << start));
for (int i = firstword + 1; i < endword; i++) {
answer += Long.bitCount(bitmap[i]);
}
answer += Long.bitCount(bitmap[endword] & (~0L >>> -end));
return answer;
} | [
"public",
"static",
"int",
"cardinalityInBitmapRange",
"(",
"long",
"[",
"]",
"bitmap",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"if",
"(",
"start",
">=",
"end",
")",
"{",
"return",
"0",
";",
"}",
"int",
"firstword",
"=",
"start",
"/",
"64",... | Hamming weight of the bitset in the range
start, start+1,..., end-1
@param bitmap array of words representing a bitset
@param start first index (inclusive)
@param end last index (exclusive)
@return the hamming weight of the corresponding range | [
"Hamming",
"weight",
"of",
"the",
"bitset",
"in",
"the",
"range",
"start",
"start",
"+",
"1",
"...",
"end",
"-",
"1"
] | train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/Util.java#L337-L352 |
GwtMaterialDesign/gwt-material | gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java | MaterialListValueBox.setValueSelected | public void setValueSelected(T value, boolean selected) {
int idx = getIndex(value);
if (idx >= 0) {
setItemSelectedInternal(idx, selected);
}
} | java | public void setValueSelected(T value, boolean selected) {
int idx = getIndex(value);
if (idx >= 0) {
setItemSelectedInternal(idx, selected);
}
} | [
"public",
"void",
"setValueSelected",
"(",
"T",
"value",
",",
"boolean",
"selected",
")",
"{",
"int",
"idx",
"=",
"getIndex",
"(",
"value",
")",
";",
"if",
"(",
"idx",
">=",
"0",
")",
"{",
"setItemSelectedInternal",
"(",
"idx",
",",
"selected",
")",
";... | Sets whether an individual list value is selected.
@param value the value of the item to be selected or unselected
@param selected <code>true</code> to select the item | [
"Sets",
"whether",
"an",
"individual",
"list",
"value",
"is",
"selected",
"."
] | train | https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java#L1010-L1015 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/paintable/mapaddon/ScaleBar.java | ScaleBar.setMapSize | public void setMapSize(int mapWidth, int mapHeight) {
super.setMapSize(mapWidth, mapHeight);
if (null == unitType) {
throw new IllegalStateException("Please initialize scale bar before using");
}
backGround.getBounds().setX(getUpperLeftCorner().getX());
backGround.getBounds().setY(getUpperLeftCorner().getY());
bottomLine.getBounds().setX(getUpperLeftCorner().getX() + HORIZONTAL_PADDING);
bottomLine.getBounds().setY(getUpperLeftCorner().getY() + VERTICAL_PADDING + MARKER_HEIGHT);
leftMarker.getBounds().setX(getUpperLeftCorner().getX() + HORIZONTAL_PADDING);
leftMarker.getBounds().setY(getUpperLeftCorner().getY() + VERTICAL_PADDING);
rightMarker.getBounds().setY(getUpperLeftCorner().getY() + VERTICAL_PADDING);
distance.setPosition(new Coordinate(getUpperLeftCorner().getX() + HORIZONTAL_PADDING + 6,
getUpperLeftCorner().getY() + VERTICAL_PADDING));
} | java | public void setMapSize(int mapWidth, int mapHeight) {
super.setMapSize(mapWidth, mapHeight);
if (null == unitType) {
throw new IllegalStateException("Please initialize scale bar before using");
}
backGround.getBounds().setX(getUpperLeftCorner().getX());
backGround.getBounds().setY(getUpperLeftCorner().getY());
bottomLine.getBounds().setX(getUpperLeftCorner().getX() + HORIZONTAL_PADDING);
bottomLine.getBounds().setY(getUpperLeftCorner().getY() + VERTICAL_PADDING + MARKER_HEIGHT);
leftMarker.getBounds().setX(getUpperLeftCorner().getX() + HORIZONTAL_PADDING);
leftMarker.getBounds().setY(getUpperLeftCorner().getY() + VERTICAL_PADDING);
rightMarker.getBounds().setY(getUpperLeftCorner().getY() + VERTICAL_PADDING);
distance.setPosition(new Coordinate(getUpperLeftCorner().getX() + HORIZONTAL_PADDING + 6,
getUpperLeftCorner().getY() + VERTICAL_PADDING));
} | [
"public",
"void",
"setMapSize",
"(",
"int",
"mapWidth",
",",
"int",
"mapHeight",
")",
"{",
"super",
".",
"setMapSize",
"(",
"mapWidth",
",",
"mapHeight",
")",
";",
"if",
"(",
"null",
"==",
"unitType",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",... | Set map size.
@param mapWidth map width
@param mapHeight map height | [
"Set",
"map",
"size",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/paintable/mapaddon/ScaleBar.java#L212-L226 |
haifengl/smile | math/src/main/java/smile/sort/SortUtils.java | SortUtils.siftDown | public static void siftDown(float[] arr, int k, int n) {
while (2*k <= n) {
int j = 2 * k;
if (j < n && arr[j] < arr[j + 1]) {
j++;
}
if (arr[k] >= arr[j]) {
break;
}
swap(arr, k, j);
k = j;
}
} | java | public static void siftDown(float[] arr, int k, int n) {
while (2*k <= n) {
int j = 2 * k;
if (j < n && arr[j] < arr[j + 1]) {
j++;
}
if (arr[k] >= arr[j]) {
break;
}
swap(arr, k, j);
k = j;
}
} | [
"public",
"static",
"void",
"siftDown",
"(",
"float",
"[",
"]",
"arr",
",",
"int",
"k",
",",
"int",
"n",
")",
"{",
"while",
"(",
"2",
"*",
"k",
"<=",
"n",
")",
"{",
"int",
"j",
"=",
"2",
"*",
"k",
";",
"if",
"(",
"j",
"<",
"n",
"&&",
"arr... | To restore the max-heap condition when a node's priority is decreased.
We move down the heap, exchanging the node at position k with the larger
of that node's two children if necessary and stopping when the node at
k is not smaller than either child or the bottom is reached. Note that
if n is even and k is n/2, then the node at k has only one child -- this
case must be treated properly. | [
"To",
"restore",
"the",
"max",
"-",
"heap",
"condition",
"when",
"a",
"node",
"s",
"priority",
"is",
"decreased",
".",
"We",
"move",
"down",
"the",
"heap",
"exchanging",
"the",
"node",
"at",
"position",
"k",
"with",
"the",
"larger",
"of",
"that",
"node",... | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/sort/SortUtils.java#L151-L163 |
CleverTap/clevertap-android-sdk | clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/DBAdapter.java | DBAdapter.storeObject | synchronized int storeObject(JSONObject obj, Table table) {
if (!this.belowMemThreshold()) {
Logger.v("There is not enough space left on the device to store data, data discarded");
return DB_OUT_OF_MEMORY_ERROR;
}
final String tableName = table.getName();
Cursor cursor = null;
int count = DB_UPDATE_ERROR;
//noinspection TryFinallyCanBeTryWithResources
try {
final SQLiteDatabase db = dbHelper.getWritableDatabase();
final ContentValues cv = new ContentValues();
cv.put(KEY_DATA, obj.toString());
cv.put(KEY_CREATED_AT, System.currentTimeMillis());
db.insert(tableName, null, cv);
cursor = db.rawQuery("SELECT COUNT(*) FROM " + tableName, null);
cursor.moveToFirst();
count = cursor.getInt(0);
} catch (final SQLiteException e) {
getConfigLogger().verbose("Error adding data to table " + tableName + " Recreating DB");
if (cursor != null) {
cursor.close();
cursor = null;
}
dbHelper.deleteDatabase();
} finally {
if (cursor != null) {
cursor.close();
}
dbHelper.close();
}
return count;
} | java | synchronized int storeObject(JSONObject obj, Table table) {
if (!this.belowMemThreshold()) {
Logger.v("There is not enough space left on the device to store data, data discarded");
return DB_OUT_OF_MEMORY_ERROR;
}
final String tableName = table.getName();
Cursor cursor = null;
int count = DB_UPDATE_ERROR;
//noinspection TryFinallyCanBeTryWithResources
try {
final SQLiteDatabase db = dbHelper.getWritableDatabase();
final ContentValues cv = new ContentValues();
cv.put(KEY_DATA, obj.toString());
cv.put(KEY_CREATED_AT, System.currentTimeMillis());
db.insert(tableName, null, cv);
cursor = db.rawQuery("SELECT COUNT(*) FROM " + tableName, null);
cursor.moveToFirst();
count = cursor.getInt(0);
} catch (final SQLiteException e) {
getConfigLogger().verbose("Error adding data to table " + tableName + " Recreating DB");
if (cursor != null) {
cursor.close();
cursor = null;
}
dbHelper.deleteDatabase();
} finally {
if (cursor != null) {
cursor.close();
}
dbHelper.close();
}
return count;
} | [
"synchronized",
"int",
"storeObject",
"(",
"JSONObject",
"obj",
",",
"Table",
"table",
")",
"{",
"if",
"(",
"!",
"this",
".",
"belowMemThreshold",
"(",
")",
")",
"{",
"Logger",
".",
"v",
"(",
"\"There is not enough space left on the device to store data, data discar... | Adds a JSON string to the DB.
@param obj the JSON to record
@param table the table to insert into
@return the number of rows in the table, or DB_OUT_OF_MEMORY_ERROR/DB_UPDATE_ERROR | [
"Adds",
"a",
"JSON",
"string",
"to",
"the",
"DB",
"."
] | train | https://github.com/CleverTap/clevertap-android-sdk/blob/be134c06a4f07494c398335ad9ff4976633743e1/clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/DBAdapter.java#L209-L246 |
groovy/groovy-core | src/main/org/codehaus/groovy/classgen/asm/OperandStack.java | OperandStack.castToBool | public void castToBool(int mark, boolean emptyDefault) {
int size = stack.size();
MethodVisitor mv = controller.getMethodVisitor();
if (mark==size) {
// no element, so use emptyDefault
if (emptyDefault) {
mv.visitIntInsn(BIPUSH, 1);
} else {
mv.visitIntInsn(BIPUSH, 0);
}
stack.add(null);
} else if (mark==stack.size()-1) {
ClassNode last = stack.get(size-1);
// nothing to do in that case
if (last == ClassHelper.boolean_TYPE) return;
// not a primitive type, so call booleanUnbox
if (!ClassHelper.isPrimitiveType(last)) {
controller.getInvocationWriter().castNonPrimitiveToBool(last);
} else {
primitive2b(mv,last);
}
} else {
throw new GroovyBugError(
"operand stack contains "+stack.size()+
" elements, but we expected only "+mark
);
}
stack.set(mark,ClassHelper.boolean_TYPE);
} | java | public void castToBool(int mark, boolean emptyDefault) {
int size = stack.size();
MethodVisitor mv = controller.getMethodVisitor();
if (mark==size) {
// no element, so use emptyDefault
if (emptyDefault) {
mv.visitIntInsn(BIPUSH, 1);
} else {
mv.visitIntInsn(BIPUSH, 0);
}
stack.add(null);
} else if (mark==stack.size()-1) {
ClassNode last = stack.get(size-1);
// nothing to do in that case
if (last == ClassHelper.boolean_TYPE) return;
// not a primitive type, so call booleanUnbox
if (!ClassHelper.isPrimitiveType(last)) {
controller.getInvocationWriter().castNonPrimitiveToBool(last);
} else {
primitive2b(mv,last);
}
} else {
throw new GroovyBugError(
"operand stack contains "+stack.size()+
" elements, but we expected only "+mark
);
}
stack.set(mark,ClassHelper.boolean_TYPE);
} | [
"public",
"void",
"castToBool",
"(",
"int",
"mark",
",",
"boolean",
"emptyDefault",
")",
"{",
"int",
"size",
"=",
"stack",
".",
"size",
"(",
")",
";",
"MethodVisitor",
"mv",
"=",
"controller",
".",
"getMethodVisitor",
"(",
")",
";",
"if",
"(",
"mark",
... | ensure last marked parameter on the stack is a primitive boolean
if mark==stack size, we assume an empty expression or statement.
was used and we will use the value given in emptyDefault as boolean
if mark==stack.size()-1 the top element will be cast to boolean using
Groovy truth.
In other cases we throw a GroovyBugError | [
"ensure",
"last",
"marked",
"parameter",
"on",
"the",
"stack",
"is",
"a",
"primitive",
"boolean",
"if",
"mark",
"==",
"stack",
"size",
"we",
"assume",
"an",
"empty",
"expression",
"or",
"statement",
".",
"was",
"used",
"and",
"we",
"will",
"use",
"the",
... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/classgen/asm/OperandStack.java#L91-L119 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/core/ServerParams.java | ServerParams.getAllModuleParams | @SuppressWarnings("unchecked")
public static Map<String, Object> getAllModuleParams(String modulePackageName, Map<String, Object> paramMap) {
Map<String, Object> result = new HashMap<>();
try {
Class<?> moduleClass = Class.forName(modulePackageName);
while (!moduleClass.getSimpleName().equals("Object")) {
Map<String, Object> moduleParams =
(Map<String, Object>) paramMap.get(moduleClass.getSimpleName());
if (moduleParams != null) {
for (String paramName : moduleParams.keySet()) {
if (!result.containsKey(paramName)) {
result.put(paramName, moduleParams.get(paramName));
}
}
}
moduleClass = moduleClass.getSuperclass();
}
} catch (Exception e) {
throw new IllegalArgumentException("Could not locate class '" + modulePackageName + "'", e);
}
return result.size() == 0 ? null : result;
} | java | @SuppressWarnings("unchecked")
public static Map<String, Object> getAllModuleParams(String modulePackageName, Map<String, Object> paramMap) {
Map<String, Object> result = new HashMap<>();
try {
Class<?> moduleClass = Class.forName(modulePackageName);
while (!moduleClass.getSimpleName().equals("Object")) {
Map<String, Object> moduleParams =
(Map<String, Object>) paramMap.get(moduleClass.getSimpleName());
if (moduleParams != null) {
for (String paramName : moduleParams.keySet()) {
if (!result.containsKey(paramName)) {
result.put(paramName, moduleParams.get(paramName));
}
}
}
moduleClass = moduleClass.getSuperclass();
}
} catch (Exception e) {
throw new IllegalArgumentException("Could not locate class '" + modulePackageName + "'", e);
}
return result.size() == 0 ? null : result;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"getAllModuleParams",
"(",
"String",
"modulePackageName",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"paramMap",
")",
"{",
"Map",
"<",
"Stri... | Get the parameters defined for the given module in the given parameter map. This
method first attempts to load the class information for the given module. If it
cannot be loaded, an IllegalArgumentException is thrown. Otherwise, it searches the
given map for parameters defined for the module whose name matches the given class's
"simple name". It also searches for and adds "inherited" parameters belonging to its
superclasses. For example, assume the class hierarchy:
<pre>
ThriftService extends CassandraService extends DBService
</pre>
A method called for the ThriftService module searches the given paramMap for
parameters defined for ThriftService, CassandraService, or DBService and merges
them into a single map. If a parameter is defined at multiple levels, the
lowest-level value is used. If no parameters are found for the given module class
its superclasses, null is returned.
@param modulePackageName
Full module package name. Example: "com.dell.doradus.db.thrift.ThriftService".
@param paramMap
Parameter map to search. This map should use the same module/parameter format
as the ServerParams class.
@return
Module's direct and inherited parameters or null if none are found. | [
"Get",
"the",
"parameters",
"defined",
"for",
"the",
"given",
"module",
"in",
"the",
"given",
"parameter",
"map",
".",
"This",
"method",
"first",
"attempts",
"to",
"load",
"the",
"class",
"information",
"for",
"the",
"given",
"module",
".",
"If",
"it",
"ca... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/core/ServerParams.java#L262-L283 |
fuinorg/utils4j | src/main/java/org/fuin/utils4j/Utils4J.java | Utils4J.encryptPasswordBased | public static byte[] encryptPasswordBased(final String algorithm, final byte[] data, final char[] password, final byte[] salt,
final int count) {
checkNotNull("algorithm", algorithm);
checkNotNull("data", data);
checkNotNull("password", password);
checkNotNull("salt", salt);
try {
final Cipher cipher = createCipher(algorithm, Cipher.ENCRYPT_MODE, password, salt, count);
return cipher.doFinal(data);
} catch (final Exception ex) {
throw new RuntimeException("Error encrypting the password!", ex);
}
} | java | public static byte[] encryptPasswordBased(final String algorithm, final byte[] data, final char[] password, final byte[] salt,
final int count) {
checkNotNull("algorithm", algorithm);
checkNotNull("data", data);
checkNotNull("password", password);
checkNotNull("salt", salt);
try {
final Cipher cipher = createCipher(algorithm, Cipher.ENCRYPT_MODE, password, salt, count);
return cipher.doFinal(data);
} catch (final Exception ex) {
throw new RuntimeException("Error encrypting the password!", ex);
}
} | [
"public",
"static",
"byte",
"[",
"]",
"encryptPasswordBased",
"(",
"final",
"String",
"algorithm",
",",
"final",
"byte",
"[",
"]",
"data",
",",
"final",
"char",
"[",
"]",
"password",
",",
"final",
"byte",
"[",
"]",
"salt",
",",
"final",
"int",
"count",
... | Encrypts some data based on a password.
@param algorithm
PBE algorithm like "PBEWithMD5AndDES" or "PBEWithMD5AndTripleDES" - Cannot be <code>null</code>.
@param data
Data to encrypt - Cannot be <code>null</code>.
@param password
Password - Cannot be <code>null</code>.
@param salt
Salt usable with algorithm - Cannot be <code>null</code>.
@param count
Iterations.
@return Encrypted data. | [
"Encrypts",
"some",
"data",
"based",
"on",
"a",
"password",
"."
] | train | https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L412-L426 |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/installer/feature/jersey/AbstractJerseyInstaller.java | AbstractJerseyInstaller.bindInGuice | protected void bindInGuice(final Binder binder, final Class<?> type) {
final AnnotatedBindingBuilder<?> binding = binder.bind(type);
if (isForceSingleton(type, false)) {
// force singleton only if no explicit scope annotation present
binding.in(Singleton.class);
}
} | java | protected void bindInGuice(final Binder binder, final Class<?> type) {
final AnnotatedBindingBuilder<?> binding = binder.bind(type);
if (isForceSingleton(type, false)) {
// force singleton only if no explicit scope annotation present
binding.in(Singleton.class);
}
} | [
"protected",
"void",
"bindInGuice",
"(",
"final",
"Binder",
"binder",
",",
"final",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"final",
"AnnotatedBindingBuilder",
"<",
"?",
">",
"binding",
"=",
"binder",
".",
"bind",
"(",
"type",
")",
";",
"if",
"(",
"i... | Bind to guice context. Singleton scope will be forced if it's not disabled (
{@link ru.vyarus.dropwizard.guice.module.installer.InstallersOptions#ForceSingletonForJerseyExtensions}) and
if no explicit scope is declared with annotation on bean.
@param binder guice binder
@param type extension type | [
"Bind",
"to",
"guice",
"context",
".",
"Singleton",
"scope",
"will",
"be",
"forced",
"if",
"it",
"s",
"not",
"disabled",
"(",
"{",
"@link",
"ru",
".",
"vyarus",
".",
"dropwizard",
".",
"guice",
".",
"module",
".",
"installer",
".",
"InstallersOptions#Force... | train | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/installer/feature/jersey/AbstractJerseyInstaller.java#L65-L71 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/MutableArray.java | MutableArray.insertValue | @NonNull
@Override
public MutableArray insertValue(int index, Object value) {
synchronized (lock) {
if (!internalArray.insert(index, Fleece.toCBLObject(value))) { throwRangeException(index); }
return this;
}
} | java | @NonNull
@Override
public MutableArray insertValue(int index, Object value) {
synchronized (lock) {
if (!internalArray.insert(index, Fleece.toCBLObject(value))) { throwRangeException(index); }
return this;
}
} | [
"@",
"NonNull",
"@",
"Override",
"public",
"MutableArray",
"insertValue",
"(",
"int",
"index",
",",
"Object",
"value",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"!",
"internalArray",
".",
"insert",
"(",
"index",
",",
"Fleece",
".",
"toC... | Inserts an object at the given index.
@param index the index. This value must not exceed the bounds of the array.
@param value the object
@return The self object | [
"Inserts",
"an",
"object",
"at",
"the",
"given",
"index",
"."
] | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableArray.java#L407-L414 |
graphhopper/graphhopper | reader-gtfs/src/main/java/com/conveyal/gtfs/GTFSFeed.java | GTFSFeed.loadFromFile | public void loadFromFile(ZipFile zip, String fid) throws IOException {
if (this.loaded) throw new UnsupportedOperationException("Attempt to load GTFS into existing database");
// NB we don't have a single CRC for the file, so we combine all the CRCs of the component files. NB we are not
// simply summing the CRCs because CRCs are (I assume) uniformly randomly distributed throughout the width of a
// long, so summing them is a convolution which moves towards a Gaussian with mean 0 (i.e. more concentrated
// probability in the center), degrading the quality of the hash. Instead we XOR. Assuming each bit is independent,
// this will yield a nice uniformly distributed result, because when combining two bits there is an equal
// probability of any input, which means an equal probability of any output. At least I think that's all correct.
// Repeated XOR is not commutative but zip.stream returns files in the order they are in the central directory
// of the zip file, so that's not a problem.
checksum = zip.stream().mapToLong(ZipEntry::getCrc).reduce((l1, l2) -> l1 ^ l2).getAsLong();
db.getAtomicLong("checksum").set(checksum);
new FeedInfo.Loader(this).loadTable(zip);
// maybe we should just point to the feed object itself instead of its ID, and null out its stoptimes map after loading
if (fid != null) {
feedId = fid;
LOG.info("Feed ID is undefined, pester maintainers to include a feed ID. Using file name {}.", feedId); // TODO log an error, ideally feeds should include a feedID
}
else if (feedId == null || feedId.isEmpty()) {
feedId = new File(zip.getName()).getName().replaceAll("\\.zip$", "");
LOG.info("Feed ID is undefined, pester maintainers to include a feed ID. Using file name {}.", feedId); // TODO log an error, ideally feeds should include a feedID
}
else {
LOG.info("Feed ID is '{}'.", feedId);
}
db.getAtomicString("feed_id").set(feedId);
new Agency.Loader(this).loadTable(zip);
if (agency.isEmpty()) {
errors.add(new GeneralError("agency", 0, "agency_id", "Need at least one agency."));
}
// calendars and calendar dates are joined into services. This means a lot of manipulating service objects as
// they are loaded; since mapdb keys/values are immutable, load them in memory then copy them to MapDB once
// we're done loading them
Map<String, Service> serviceTable = new HashMap<>();
new Calendar.Loader(this, serviceTable).loadTable(zip);
new CalendarDate.Loader(this, serviceTable).loadTable(zip);
this.services.putAll(serviceTable);
serviceTable = null; // free memory
// Same deal
Map<String, Fare> fares = new HashMap<>();
new FareAttribute.Loader(this, fares).loadTable(zip);
new FareRule.Loader(this, fares).loadTable(zip);
this.fares.putAll(fares);
fares = null; // free memory
new Route.Loader(this).loadTable(zip);
new ShapePoint.Loader(this).loadTable(zip);
new Stop.Loader(this).loadTable(zip);
new Transfer.Loader(this).loadTable(zip);
new Trip.Loader(this).loadTable(zip);
new Frequency.Loader(this).loadTable(zip);
new StopTime.Loader(this).loadTable(zip); // comment out this line for quick testing using NL feed
loaded = true;
} | java | public void loadFromFile(ZipFile zip, String fid) throws IOException {
if (this.loaded) throw new UnsupportedOperationException("Attempt to load GTFS into existing database");
// NB we don't have a single CRC for the file, so we combine all the CRCs of the component files. NB we are not
// simply summing the CRCs because CRCs are (I assume) uniformly randomly distributed throughout the width of a
// long, so summing them is a convolution which moves towards a Gaussian with mean 0 (i.e. more concentrated
// probability in the center), degrading the quality of the hash. Instead we XOR. Assuming each bit is independent,
// this will yield a nice uniformly distributed result, because when combining two bits there is an equal
// probability of any input, which means an equal probability of any output. At least I think that's all correct.
// Repeated XOR is not commutative but zip.stream returns files in the order they are in the central directory
// of the zip file, so that's not a problem.
checksum = zip.stream().mapToLong(ZipEntry::getCrc).reduce((l1, l2) -> l1 ^ l2).getAsLong();
db.getAtomicLong("checksum").set(checksum);
new FeedInfo.Loader(this).loadTable(zip);
// maybe we should just point to the feed object itself instead of its ID, and null out its stoptimes map after loading
if (fid != null) {
feedId = fid;
LOG.info("Feed ID is undefined, pester maintainers to include a feed ID. Using file name {}.", feedId); // TODO log an error, ideally feeds should include a feedID
}
else if (feedId == null || feedId.isEmpty()) {
feedId = new File(zip.getName()).getName().replaceAll("\\.zip$", "");
LOG.info("Feed ID is undefined, pester maintainers to include a feed ID. Using file name {}.", feedId); // TODO log an error, ideally feeds should include a feedID
}
else {
LOG.info("Feed ID is '{}'.", feedId);
}
db.getAtomicString("feed_id").set(feedId);
new Agency.Loader(this).loadTable(zip);
if (agency.isEmpty()) {
errors.add(new GeneralError("agency", 0, "agency_id", "Need at least one agency."));
}
// calendars and calendar dates are joined into services. This means a lot of manipulating service objects as
// they are loaded; since mapdb keys/values are immutable, load them in memory then copy them to MapDB once
// we're done loading them
Map<String, Service> serviceTable = new HashMap<>();
new Calendar.Loader(this, serviceTable).loadTable(zip);
new CalendarDate.Loader(this, serviceTable).loadTable(zip);
this.services.putAll(serviceTable);
serviceTable = null; // free memory
// Same deal
Map<String, Fare> fares = new HashMap<>();
new FareAttribute.Loader(this, fares).loadTable(zip);
new FareRule.Loader(this, fares).loadTable(zip);
this.fares.putAll(fares);
fares = null; // free memory
new Route.Loader(this).loadTable(zip);
new ShapePoint.Loader(this).loadTable(zip);
new Stop.Loader(this).loadTable(zip);
new Transfer.Loader(this).loadTable(zip);
new Trip.Loader(this).loadTable(zip);
new Frequency.Loader(this).loadTable(zip);
new StopTime.Loader(this).loadTable(zip); // comment out this line for quick testing using NL feed
loaded = true;
} | [
"public",
"void",
"loadFromFile",
"(",
"ZipFile",
"zip",
",",
"String",
"fid",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"loaded",
")",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Attempt to load GTFS into existing database\"",
")",
";"... | The order in which we load the tables is important for two reasons.
1. We must load feed_info first so we know the feed ID before loading any other entities. This could be relaxed
by having entities point to the feed object rather than its ID String.
2. Referenced entities must be loaded before any entities that reference them. This is because we check
referential integrity while the files are being loaded. This is done on the fly during loading because it allows
us to associate a line number with errors in objects that don't have any other clear identifier.
Interestingly, all references are resolvable when tables are loaded in alphabetical order. | [
"The",
"order",
"in",
"which",
"we",
"load",
"the",
"tables",
"is",
"important",
"for",
"two",
"reasons",
".",
"1",
".",
"We",
"must",
"load",
"feed_info",
"first",
"so",
"we",
"know",
"the",
"feed",
"ID",
"before",
"loading",
"any",
"other",
"entities",... | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/reader-gtfs/src/main/java/com/conveyal/gtfs/GTFSFeed.java#L112-L172 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.toAsyncThrowing | public static <R> Func0<Observable<R>> toAsyncThrowing(final Callable<? extends R> func, final Scheduler scheduler) {
return new Func0<Observable<R>>() {
@Override
public Observable<R> call() {
return startCallable(func, scheduler);
}
};
} | java | public static <R> Func0<Observable<R>> toAsyncThrowing(final Callable<? extends R> func, final Scheduler scheduler) {
return new Func0<Observable<R>>() {
@Override
public Observable<R> call() {
return startCallable(func, scheduler);
}
};
} | [
"public",
"static",
"<",
"R",
">",
"Func0",
"<",
"Observable",
"<",
"R",
">",
">",
"toAsyncThrowing",
"(",
"final",
"Callable",
"<",
"?",
"extends",
"R",
">",
"func",
",",
"final",
"Scheduler",
"scheduler",
")",
"{",
"return",
"new",
"Func0",
"<",
"Obs... | Convert a synchronous callable call into an asynchronous function call through an Observable.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.s.png" alt="">
@param <R> the result type
@param func the callable to convert
@param scheduler the Scheduler used to call the {@code func}
@return a function that returns an Observable that executes the {@code func} and emits its returned value
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
@see <a href="http://msdn.microsoft.com/en-us/library/hh211792.aspx">MSDN: Observable.ToAsync</a> | [
"Convert",
"a",
"synchronous",
"callable",
"call",
"into",
"an",
"asynchronous",
"function",
"call",
"through",
"an",
"Observable",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki"... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L800-L807 |
voldemort/voldemort | src/java/voldemort/store/stats/ClientSocketStats.java | ClientSocketStats.recordConnectionEstablishmentTimeUs | public void recordConnectionEstablishmentTimeUs(SocketDestination dest, long connEstTimeUs) {
if(dest != null) {
getOrCreateNodeStats(dest).recordConnectionEstablishmentTimeUs(null, connEstTimeUs);
recordConnectionEstablishmentTimeUs(null, connEstTimeUs);
} else {
this.connectionEstablishmentRequestCounter.addRequest(connEstTimeUs * Time.NS_PER_US);
}
} | java | public void recordConnectionEstablishmentTimeUs(SocketDestination dest, long connEstTimeUs) {
if(dest != null) {
getOrCreateNodeStats(dest).recordConnectionEstablishmentTimeUs(null, connEstTimeUs);
recordConnectionEstablishmentTimeUs(null, connEstTimeUs);
} else {
this.connectionEstablishmentRequestCounter.addRequest(connEstTimeUs * Time.NS_PER_US);
}
} | [
"public",
"void",
"recordConnectionEstablishmentTimeUs",
"(",
"SocketDestination",
"dest",
",",
"long",
"connEstTimeUs",
")",
"{",
"if",
"(",
"dest",
"!=",
"null",
")",
"{",
"getOrCreateNodeStats",
"(",
"dest",
")",
".",
"recordConnectionEstablishmentTimeUs",
"(",
"... | Record the connection establishment time
@param dest Destination of the socket to connect to. Will actually record
if null. Otherwise will call this on self and corresponding child
with this param null.
@param connEstTimeUs The number of us to wait before establishing a
connection | [
"Record",
"the",
"connection",
"establishment",
"time"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/stats/ClientSocketStats.java#L248-L255 |
knowm/XChange | xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseMarketDataServiceRaw.java | CoinbaseMarketDataServiceRaw.getCoinbaseHistoricalSpotRate | public CoinbasePrice getCoinbaseHistoricalSpotRate(Currency base, Currency counter, Date date)
throws IOException {
String datespec = new SimpleDateFormat("yyyy-MM-dd").format(date);
return coinbase
.getHistoricalSpotRate(Coinbase.CB_VERSION_VALUE, base + "-" + counter, datespec)
.getData();
} | java | public CoinbasePrice getCoinbaseHistoricalSpotRate(Currency base, Currency counter, Date date)
throws IOException {
String datespec = new SimpleDateFormat("yyyy-MM-dd").format(date);
return coinbase
.getHistoricalSpotRate(Coinbase.CB_VERSION_VALUE, base + "-" + counter, datespec)
.getData();
} | [
"public",
"CoinbasePrice",
"getCoinbaseHistoricalSpotRate",
"(",
"Currency",
"base",
",",
"Currency",
"counter",
",",
"Date",
"date",
")",
"throws",
"IOException",
"{",
"String",
"datespec",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyy-MM-dd\"",
")",
".",
"format",
... | Unauthenticated resource that tells you the current price of one unit. This is usually
somewhere in between the buy and sell price, current to within a few minutes.
@param pair The currency pair.
@param date The given date.
@return The price in the desired {@code currency} ont the give {@code date} for one unit.
@throws IOException
@see <a
href="https://developers.coinbase.com/api/v2#get-spot-price">developers.coinbase.com/api/v2#get-spot-price</a> | [
"Unauthenticated",
"resource",
"that",
"tells",
"you",
"the",
"current",
"price",
"of",
"one",
"unit",
".",
"This",
"is",
"usually",
"somewhere",
"in",
"between",
"the",
"buy",
"and",
"sell",
"price",
"current",
"to",
"within",
"a",
"few",
"minutes",
"."
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseMarketDataServiceRaw.java#L89-L95 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateInstanceRequest.java | CreateInstanceRequest.addLabel | @SuppressWarnings("WeakerAccess")
public CreateInstanceRequest addLabel(@Nonnull String key, @Nonnull String value) {
Preconditions.checkNotNull(key, "Key can't be null");
Preconditions.checkNotNull(value, "Value can't be null");
builder.getInstanceBuilder().putLabels(key, value);
return this;
} | java | @SuppressWarnings("WeakerAccess")
public CreateInstanceRequest addLabel(@Nonnull String key, @Nonnull String value) {
Preconditions.checkNotNull(key, "Key can't be null");
Preconditions.checkNotNull(value, "Value can't be null");
builder.getInstanceBuilder().putLabels(key, value);
return this;
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"CreateInstanceRequest",
"addLabel",
"(",
"@",
"Nonnull",
"String",
"key",
",",
"@",
"Nonnull",
"String",
"value",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"key",
",",
"\"Key can't be nul... | Adds an arbitrary label to the instance.
<p>Labels are key-value pairs that you can use to group related instances and store metadata
about an instance.
@see <a href="https://cloud.google.com/bigtable/docs/creating-managing-labels">For more
details</a> | [
"Adds",
"an",
"arbitrary",
"label",
"to",
"the",
"instance",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateInstanceRequest.java#L112-L118 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java | BoxAuthentication.onLoggedOut | public void onLoggedOut(BoxAuthenticationInfo infoOriginal, Exception ex) {
BoxAuthenticationInfo info = BoxAuthenticationInfo.unmodifiableObject(infoOriginal);
Set<AuthListener> listeners = getListeners();
for (AuthListener listener : listeners) {
listener.onLoggedOut(info, ex);
}
} | java | public void onLoggedOut(BoxAuthenticationInfo infoOriginal, Exception ex) {
BoxAuthenticationInfo info = BoxAuthenticationInfo.unmodifiableObject(infoOriginal);
Set<AuthListener> listeners = getListeners();
for (AuthListener listener : listeners) {
listener.onLoggedOut(info, ex);
}
} | [
"public",
"void",
"onLoggedOut",
"(",
"BoxAuthenticationInfo",
"infoOriginal",
",",
"Exception",
"ex",
")",
"{",
"BoxAuthenticationInfo",
"info",
"=",
"BoxAuthenticationInfo",
".",
"unmodifiableObject",
"(",
"infoOriginal",
")",
";",
"Set",
"<",
"AuthListener",
">",
... | Callback method to be called on logout.
@param infoOriginal the authentication information associated with the user that was logged out.
@param ex the exception if appliable that caused the logout. | [
"Callback",
"method",
"to",
"be",
"called",
"on",
"logout",
"."
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L202-L208 |
qiujuer/Genius-Android | caprice/kit-handler/src/main/java/net/qiujuer/genius/kit/handler/ActionSyncTask.java | ActionSyncTask.waitRun | void waitRun(long waitMillis, int waitNanos, boolean cancelOnTimeOut) {
if (!mDone) {
synchronized (this) {
if (!mDone) {
try {
this.wait(waitMillis, waitNanos);
} catch (InterruptedException ignored) {
} finally {
if (!mDone && cancelOnTimeOut)
mDone = true;
}
}
}
}
} | java | void waitRun(long waitMillis, int waitNanos, boolean cancelOnTimeOut) {
if (!mDone) {
synchronized (this) {
if (!mDone) {
try {
this.wait(waitMillis, waitNanos);
} catch (InterruptedException ignored) {
} finally {
if (!mDone && cancelOnTimeOut)
mDone = true;
}
}
}
}
} | [
"void",
"waitRun",
"(",
"long",
"waitMillis",
",",
"int",
"waitNanos",
",",
"boolean",
"cancelOnTimeOut",
")",
"{",
"if",
"(",
"!",
"mDone",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"!",
"mDone",
")",
"{",
"try",
"{",
"this",
".",
... | Wait for a period of time to run end
@param waitMillis wait milliseconds time
@param waitNanos wait nanoseconds time
@param cancelOnTimeOut when wait end cancel the runner | [
"Wait",
"for",
"a",
"period",
"of",
"time",
"to",
"run",
"end"
] | train | https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/kit-handler/src/main/java/net/qiujuer/genius/kit/handler/ActionSyncTask.java#L93-L107 |
Activiti/Activiti | activiti-engine/src/main/java/org/activiti/engine/impl/util/ReflectUtil.java | ReflectUtil.getField | public static Field getField(String fieldName, Class<?> clazz) {
Field field = null;
try {
field = clazz.getDeclaredField(fieldName);
} catch (SecurityException e) {
throw new ActivitiException("not allowed to access field " + field + " on class " + clazz.getCanonicalName());
} catch (NoSuchFieldException e) {
// for some reason getDeclaredFields doesn't search superclasses
// (which getFields() does ... but that gives only public fields)
Class<?> superClass = clazz.getSuperclass();
if (superClass != null) {
return getField(fieldName, superClass);
}
}
return field;
} | java | public static Field getField(String fieldName, Class<?> clazz) {
Field field = null;
try {
field = clazz.getDeclaredField(fieldName);
} catch (SecurityException e) {
throw new ActivitiException("not allowed to access field " + field + " on class " + clazz.getCanonicalName());
} catch (NoSuchFieldException e) {
// for some reason getDeclaredFields doesn't search superclasses
// (which getFields() does ... but that gives only public fields)
Class<?> superClass = clazz.getSuperclass();
if (superClass != null) {
return getField(fieldName, superClass);
}
}
return field;
} | [
"public",
"static",
"Field",
"getField",
"(",
"String",
"fieldName",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Field",
"field",
"=",
"null",
";",
"try",
"{",
"field",
"=",
"clazz",
".",
"getDeclaredField",
"(",
"fieldName",
")",
";",
"}",
"catch... | Returns the field of the given class or null if it doesn't exist. | [
"Returns",
"the",
"field",
"of",
"the",
"given",
"class",
"or",
"null",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | train | https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/util/ReflectUtil.java#L162-L177 |
lessthanoptimal/ejml | main/ejml-experimental/benchmarks/src/org/ejml/dense/row/mult/BenchmarkMatrixMultAccessors.java | BenchmarkMatrixMultAccessors.wrapped | public static long wrapped(DMatrixRMaj a , DMatrixRMaj b , DMatrixRMaj c )
{
long timeBefore = System.currentTimeMillis();
double valA;
int indexCbase= 0;
int endOfKLoop = b.numRows*b.numCols;
for( int i = 0; i < a.numRows; i++ ) {
int indexA = i*a.numCols;
// need to assign dataC to a value initially
int indexB = 0;
int indexC = indexCbase;
int end = indexB + b.numCols;
valA = a.get(indexA++);
while( indexB < end ) {
c.set( indexC++ , valA*b.get(indexB++));
}
// now add to it
while( indexB != endOfKLoop ) { // k loop
indexC = indexCbase;
end = indexB + b.numCols;
valA = a.get(indexA++);
while( indexB < end ) { // j loop
c.plus( indexC++ , valA*b.get(indexB++));
}
}
indexCbase += c.numCols;
}
return System.currentTimeMillis() - timeBefore;
} | java | public static long wrapped(DMatrixRMaj a , DMatrixRMaj b , DMatrixRMaj c )
{
long timeBefore = System.currentTimeMillis();
double valA;
int indexCbase= 0;
int endOfKLoop = b.numRows*b.numCols;
for( int i = 0; i < a.numRows; i++ ) {
int indexA = i*a.numCols;
// need to assign dataC to a value initially
int indexB = 0;
int indexC = indexCbase;
int end = indexB + b.numCols;
valA = a.get(indexA++);
while( indexB < end ) {
c.set( indexC++ , valA*b.get(indexB++));
}
// now add to it
while( indexB != endOfKLoop ) { // k loop
indexC = indexCbase;
end = indexB + b.numCols;
valA = a.get(indexA++);
while( indexB < end ) { // j loop
c.plus( indexC++ , valA*b.get(indexB++));
}
}
indexCbase += c.numCols;
}
return System.currentTimeMillis() - timeBefore;
} | [
"public",
"static",
"long",
"wrapped",
"(",
"DMatrixRMaj",
"a",
",",
"DMatrixRMaj",
"b",
",",
"DMatrixRMaj",
"c",
")",
"{",
"long",
"timeBefore",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"double",
"valA",
";",
"int",
"indexCbase",
"=",
"0",
... | Wrapper functions with no bounds checking are used to access matrix internals | [
"Wrapper",
"functions",
"with",
"no",
"bounds",
"checking",
"are",
"used",
"to",
"access",
"matrix",
"internals"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-experimental/benchmarks/src/org/ejml/dense/row/mult/BenchmarkMatrixMultAccessors.java#L83-L119 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.countUsers | public long countUsers(CmsRequestContext requestContext, CmsUserSearchParameters searchParams) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(requestContext);
try {
return m_driverManager.countUsers(dbc, searchParams);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_COUNT_USERS_0), e);
return -1;
} finally {
dbc.clear();
}
} | java | public long countUsers(CmsRequestContext requestContext, CmsUserSearchParameters searchParams) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(requestContext);
try {
return m_driverManager.countUsers(dbc, searchParams);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_COUNT_USERS_0), e);
return -1;
} finally {
dbc.clear();
}
} | [
"public",
"long",
"countUsers",
"(",
"CmsRequestContext",
"requestContext",
",",
"CmsUserSearchParameters",
"searchParams",
")",
"throws",
"CmsException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"requestContext",
")",
";",
"try",... | Counts the total number of users which match the given search criteria.<p>
@param requestContext the request context
@param searchParams the search criteria object
@return the number of users which match the search criteria
@throws CmsException if something goes wrong | [
"Counts",
"the",
"total",
"number",
"of",
"users",
"which",
"match",
"the",
"given",
"search",
"criteria",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L888-L899 |
samskivert/samskivert | src/main/java/com/samskivert/swing/util/SwingUtil.java | SwingUtil.setEnabled | public static void setEnabled (Container comp, final boolean enabled)
{
applyToHierarchy(comp, new ComponentOp() {
public void apply (Component comp) {
comp.setEnabled(enabled);
}
});
} | java | public static void setEnabled (Container comp, final boolean enabled)
{
applyToHierarchy(comp, new ComponentOp() {
public void apply (Component comp) {
comp.setEnabled(enabled);
}
});
} | [
"public",
"static",
"void",
"setEnabled",
"(",
"Container",
"comp",
",",
"final",
"boolean",
"enabled",
")",
"{",
"applyToHierarchy",
"(",
"comp",
",",
"new",
"ComponentOp",
"(",
")",
"{",
"public",
"void",
"apply",
"(",
"Component",
"comp",
")",
"{",
"com... | Enables (or disables) the specified component, <em>and all of its children.</em> A simple
call to {@link Container#setEnabled} does not propagate the enabled state to the children of
a component, which is senseless in our opinion, but was surely done for some arguably good
reason. | [
"Enables",
"(",
"or",
"disables",
")",
"the",
"specified",
"component",
"<em",
">",
"and",
"all",
"of",
"its",
"children",
".",
"<",
"/",
"em",
">",
"A",
"simple",
"call",
"to",
"{"
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/SwingUtil.java#L250-L257 |
janus-project/guava.janusproject.io | guava/src/com/google/common/primitives/Ints.java | Ints.fromBytes | @GwtIncompatible("doesn't work")
public static int fromBytes(byte b1, byte b2, byte b3, byte b4) {
return b1 << 24 | (b2 & 0xFF) << 16 | (b3 & 0xFF) << 8 | (b4 & 0xFF);
} | java | @GwtIncompatible("doesn't work")
public static int fromBytes(byte b1, byte b2, byte b3, byte b4) {
return b1 << 24 | (b2 & 0xFF) << 16 | (b3 & 0xFF) << 8 | (b4 & 0xFF);
} | [
"@",
"GwtIncompatible",
"(",
"\"doesn't work\"",
")",
"public",
"static",
"int",
"fromBytes",
"(",
"byte",
"b1",
",",
"byte",
"b2",
",",
"byte",
"b3",
",",
"byte",
"b4",
")",
"{",
"return",
"b1",
"<<",
"24",
"|",
"(",
"b2",
"&",
"0xFF",
")",
"<<",
... | Returns the {@code int} value whose byte representation is the given 4
bytes, in big-endian order; equivalent to {@code Ints.fromByteArray(new
byte[] {b1, b2, b3, b4})}.
@since 7.0 | [
"Returns",
"the",
"{",
"@code",
"int",
"}",
"value",
"whose",
"byte",
"representation",
"is",
"the",
"given",
"4",
"bytes",
"in",
"big",
"-",
"endian",
"order",
";",
"equivalent",
"to",
"{",
"@code",
"Ints",
".",
"fromByteArray",
"(",
"new",
"byte",
"[]"... | train | https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/primitives/Ints.java#L333-L336 |
petergeneric/stdlib | service-manager/service-manager-api/src/main/java/com/peterphi/servicemanager/service/rest/resource/helper/ResourceInstanceHelper.java | ResourceInstanceHelper.countActiveInstances | public int countActiveInstances(ServiceManagerResourceRestService service, String templateName)
{
List<ResourceInstanceDTO> instances = activeInstances(service, templateName);
return instances.size();
} | java | public int countActiveInstances(ServiceManagerResourceRestService service, String templateName)
{
List<ResourceInstanceDTO> instances = activeInstances(service, templateName);
return instances.size();
} | [
"public",
"int",
"countActiveInstances",
"(",
"ServiceManagerResourceRestService",
"service",
",",
"String",
"templateName",
")",
"{",
"List",
"<",
"ResourceInstanceDTO",
">",
"instances",
"=",
"activeInstances",
"(",
"service",
",",
"templateName",
")",
";",
"return"... | Returns the number of active instances of the given template name
@param service
@param templateName
@return | [
"Returns",
"the",
"number",
"of",
"active",
"instances",
"of",
"the",
"given",
"template",
"name"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/service-manager/service-manager-api/src/main/java/com/peterphi/servicemanager/service/rest/resource/helper/ResourceInstanceHelper.java#L25-L30 |
VoltDB/voltdb | src/frontend/org/voltdb/utils/VoltTypeUtil.java | VoltTypeUtil.getObjectFromString | public static Object getObjectFromString(VoltType type, String value)
throws ParseException
{
Object ret = null;
switch (type) {
// NOTE: All runtime integer parameters are actually Longs,so we will have problems
// if we actually try to convert the object to one of the smaller numeric sizes
// --------------------------------
// INTEGERS
// --------------------------------
case TINYINT:
//ret = Byte.valueOf(value);
//break;
case SMALLINT:
//ret = Short.valueOf(value);
//break;
case INTEGER:
//ret = Integer.valueOf(value);
//break;
case BIGINT:
ret = Long.valueOf(value);
break;
// --------------------------------
// FLOATS
// --------------------------------
case FLOAT:
ret = Double.valueOf(value);
break;
// --------------------------------
// STRINGS
// --------------------------------
case STRING:
ret = value;
break;
case DECIMAL:
case VARBINARY:
if (value != null) {
throw new RuntimeException("Only NULL default values for DECIMAL " +
"and VARBINARY columns are supported right now");
}
break;
// --------------------------------
// TIMESTAMP
// --------------------------------
case TIMESTAMP: {
// Support either long values (microseconds since epoch) or timestamp strings.
try {
// Try to parse it as a long first.
ret = new TimestampType(Long.parseLong(value));
}
catch (NumberFormatException e) {
// It failed to parse as a long - parse it as a timestamp string.
Date date = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy").parse(value);
ret = new TimestampType(date.getTime() * 1000);
}
break;
}
// --------------------------------
// INVALID
// --------------------------------
default:
LOG.severe("ERROR: Unable to get object from string for invalid ValueType '" + type + "'");
}
return (ret);
} | java | public static Object getObjectFromString(VoltType type, String value)
throws ParseException
{
Object ret = null;
switch (type) {
// NOTE: All runtime integer parameters are actually Longs,so we will have problems
// if we actually try to convert the object to one of the smaller numeric sizes
// --------------------------------
// INTEGERS
// --------------------------------
case TINYINT:
//ret = Byte.valueOf(value);
//break;
case SMALLINT:
//ret = Short.valueOf(value);
//break;
case INTEGER:
//ret = Integer.valueOf(value);
//break;
case BIGINT:
ret = Long.valueOf(value);
break;
// --------------------------------
// FLOATS
// --------------------------------
case FLOAT:
ret = Double.valueOf(value);
break;
// --------------------------------
// STRINGS
// --------------------------------
case STRING:
ret = value;
break;
case DECIMAL:
case VARBINARY:
if (value != null) {
throw new RuntimeException("Only NULL default values for DECIMAL " +
"and VARBINARY columns are supported right now");
}
break;
// --------------------------------
// TIMESTAMP
// --------------------------------
case TIMESTAMP: {
// Support either long values (microseconds since epoch) or timestamp strings.
try {
// Try to parse it as a long first.
ret = new TimestampType(Long.parseLong(value));
}
catch (NumberFormatException e) {
// It failed to parse as a long - parse it as a timestamp string.
Date date = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy").parse(value);
ret = new TimestampType(date.getTime() * 1000);
}
break;
}
// --------------------------------
// INVALID
// --------------------------------
default:
LOG.severe("ERROR: Unable to get object from string for invalid ValueType '" + type + "'");
}
return (ret);
} | [
"public",
"static",
"Object",
"getObjectFromString",
"(",
"VoltType",
"type",
",",
"String",
"value",
")",
"throws",
"ParseException",
"{",
"Object",
"ret",
"=",
"null",
";",
"switch",
"(",
"type",
")",
"{",
"// NOTE: All runtime integer parameters are actually Longs,... | Returns a casted object of the input value string based on the given type
@throws ParseException | [
"Returns",
"a",
"casted",
"object",
"of",
"the",
"input",
"value",
"string",
"based",
"on",
"the",
"given",
"type"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/VoltTypeUtil.java#L220-L286 |
autermann/yaml | src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java | YamlMappingNode.put | public T put(YamlNode key, Float value) {
return put(key, getNodeFactory().floatNode(value));
} | java | public T put(YamlNode key, Float value) {
return put(key, getNodeFactory().floatNode(value));
} | [
"public",
"T",
"put",
"(",
"YamlNode",
"key",
",",
"Float",
"value",
")",
"{",
"return",
"put",
"(",
"key",
",",
"getNodeFactory",
"(",
")",
".",
"floatNode",
"(",
"value",
")",
")",
";",
"}"
] | Adds the specified {@code key}/{@code value} pair to this mapping.
@param key the key
@param value the value
@return {@code this} | [
"Adds",
"the",
"specified",
"{",
"@code",
"key",
"}",
"/",
"{",
"@code",
"value",
"}",
"pair",
"to",
"this",
"mapping",
"."
] | train | https://github.com/autermann/yaml/blob/5f8ab03e4fec3a2abe72c03561cdaa3a3936634d/src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java#L612-L614 |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java | WebAppParser.parseWelcomeFiles | private static void parseWelcomeFiles(final WelcomeFileListType welcomeFileList, final WebApp webApp) {
if (welcomeFileList != null && welcomeFileList.getWelcomeFile() != null
&& !welcomeFileList.getWelcomeFile().isEmpty()) {
welcomeFileList.getWelcomeFile().forEach(webApp::addWelcomeFile);
}
} | java | private static void parseWelcomeFiles(final WelcomeFileListType welcomeFileList, final WebApp webApp) {
if (welcomeFileList != null && welcomeFileList.getWelcomeFile() != null
&& !welcomeFileList.getWelcomeFile().isEmpty()) {
welcomeFileList.getWelcomeFile().forEach(webApp::addWelcomeFile);
}
} | [
"private",
"static",
"void",
"parseWelcomeFiles",
"(",
"final",
"WelcomeFileListType",
"welcomeFileList",
",",
"final",
"WebApp",
"webApp",
")",
"{",
"if",
"(",
"welcomeFileList",
"!=",
"null",
"&&",
"welcomeFileList",
".",
"getWelcomeFile",
"(",
")",
"!=",
"null"... | Parses welcome files out of web.xml.
@param welcomeFileList welcomeFileList element from web.xml
@param webApp model for web.xml | [
"Parses",
"welcome",
"files",
"out",
"of",
"web",
".",
"xml",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java#L778-L783 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_easyHunting_serviceName_timeConditions_conditions_POST | public OvhEasyHuntingTimeConditions billingAccount_easyHunting_serviceName_timeConditions_conditions_POST(String billingAccount, String serviceName, OvhTimeConditionsPolicyEnum policy, Date timeFrom, Date timeTo, OvhOvhPabxDialplanExtensionConditionTimeWeekDayEnum weekDay) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "policy", policy);
addBody(o, "timeFrom", timeFrom);
addBody(o, "timeTo", timeTo);
addBody(o, "weekDay", weekDay);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhEasyHuntingTimeConditions.class);
} | java | public OvhEasyHuntingTimeConditions billingAccount_easyHunting_serviceName_timeConditions_conditions_POST(String billingAccount, String serviceName, OvhTimeConditionsPolicyEnum policy, Date timeFrom, Date timeTo, OvhOvhPabxDialplanExtensionConditionTimeWeekDayEnum weekDay) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "policy", policy);
addBody(o, "timeFrom", timeFrom);
addBody(o, "timeTo", timeTo);
addBody(o, "weekDay", weekDay);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhEasyHuntingTimeConditions.class);
} | [
"public",
"OvhEasyHuntingTimeConditions",
"billingAccount_easyHunting_serviceName_timeConditions_conditions_POST",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"OvhTimeConditionsPolicyEnum",
"policy",
",",
"Date",
"timeFrom",
",",
"Date",
"timeTo",
",",
"... | Create a new time condition
REST: POST /telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions
@param timeFrom [required] The time of the day when the extension will start to be executed
@param weekDay [required] The day of the week when the extension will be executed
@param policy [required] The time condition's policy
@param timeTo [required] The time of the day when the extension will stop to be executed
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Create",
"a",
"new",
"time",
"condition"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3388-L3398 |
iipc/webarchive-commons | src/main/java/org/archive/util/LaxHttpParser.java | LaxHttpParser.parseHeaders | public static Header[] parseHeaders(InputStream is) throws IOException, HttpException {
LOG.trace("enter HeaderParser.parseHeaders(InputStream, String)");
return parseHeaders(is, "US-ASCII");
} | java | public static Header[] parseHeaders(InputStream is) throws IOException, HttpException {
LOG.trace("enter HeaderParser.parseHeaders(InputStream, String)");
return parseHeaders(is, "US-ASCII");
} | [
"public",
"static",
"Header",
"[",
"]",
"parseHeaders",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
",",
"HttpException",
"{",
"LOG",
".",
"trace",
"(",
"\"enter HeaderParser.parseHeaders(InputStream, String)\"",
")",
";",
"return",
"parseHeaders",
"(",
... | Parses headers from the given stream. Headers with the same name are not
combined.
@param is the stream to read headers from
@return an array of headers in the order in which they were parsed
@throws IOException if an IO error occurs while reading from the stream
@throws HttpException if there is an error parsing a header value
@deprecated use #parseHeaders(InputStream, String) | [
"Parses",
"headers",
"from",
"the",
"given",
"stream",
".",
"Headers",
"with",
"the",
"same",
"name",
"are",
"not",
"combined",
"."
] | train | https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/LaxHttpParser.java#L238-L241 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/BizwifiAPI.java | BizwifiAPI.qrcodeGet | public static QrcodeGetResult qrcodeGet(String accessToken, QrcodeGet qrcodeGet) {
return qrcodeGet(accessToken, JsonUtil.toJSONString(qrcodeGet));
} | java | public static QrcodeGetResult qrcodeGet(String accessToken, QrcodeGet qrcodeGet) {
return qrcodeGet(accessToken, JsonUtil.toJSONString(qrcodeGet));
} | [
"public",
"static",
"QrcodeGetResult",
"qrcodeGet",
"(",
"String",
"accessToken",
",",
"QrcodeGet",
"qrcodeGet",
")",
"{",
"return",
"qrcodeGet",
"(",
"accessToken",
",",
"JsonUtil",
".",
"toJSONString",
"(",
"qrcodeGet",
")",
")",
";",
"}"
] | 配置连网方式-获取物料二维码
添加设备后,通过此接口可以获取物料,包括二维码和桌贴两种样式。将物料铺设在线下门店里,可供用户扫码上网。
注:只有门店下已添加Wi-Fi网络信息,才能调用此接口获取二维码
@param accessToken accessToken
@param qrcodeGet qrcodeGet
@return QrcodeGetResult | [
"配置连网方式",
"-",
"获取物料二维码",
"添加设备后,通过此接口可以获取物料,包括二维码和桌贴两种样式。将物料铺设在线下门店里,可供用户扫码上网。",
"注:只有门店下已添加Wi",
"-",
"Fi网络信息,才能调用此接口获取二维码"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/BizwifiAPI.java#L444-L446 |
anotheria/moskito | moskito-integration/moskito-ehcache/src/main/java/net/anotheria/moskito/integration/ehcache/PeriodicStatsUpdater.java | PeriodicStatsUpdater.addTask | public static void addTask(final TimerTask task, final long delay, final long period) {
timer.scheduleAtFixedRate(task, delay, period);
} | java | public static void addTask(final TimerTask task, final long delay, final long period) {
timer.scheduleAtFixedRate(task, delay, period);
} | [
"public",
"static",
"void",
"addTask",
"(",
"final",
"TimerTask",
"task",
",",
"final",
"long",
"delay",
",",
"final",
"long",
"period",
")",
"{",
"timer",
".",
"scheduleAtFixedRate",
"(",
"task",
",",
"delay",
",",
"period",
")",
";",
"}"
] | Adds a new task.
@param task {@link java.util.TimerTask} to add
@param delay delay in milliseconds before task is to be executed.
@param period period of task execution starts in milliseconds. | [
"Adds",
"a",
"new",
"task",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-integration/moskito-ehcache/src/main/java/net/anotheria/moskito/integration/ehcache/PeriodicStatsUpdater.java#L47-L49 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/renderer/animation/transformation/Translation.java | Translation.doTransform | @Override
protected void doTransform(ITransformable.Translate transformable, float comp)
{
float fromX = reversed ? this.toX : this.fromX;
float toX = reversed ? this.fromX : this.toX;
float fromY = reversed ? this.toY : this.fromY;
float toY = reversed ? this.fromY : this.toY;
float fromZ = reversed ? this.toZ : this.fromZ;
float toZ = reversed ? this.fromZ : this.toZ;
transformable.translate(fromX + (toX - fromX) * comp, fromY + (toY - fromY) * comp, fromZ + (toZ - fromZ) * comp);
} | java | @Override
protected void doTransform(ITransformable.Translate transformable, float comp)
{
float fromX = reversed ? this.toX : this.fromX;
float toX = reversed ? this.fromX : this.toX;
float fromY = reversed ? this.toY : this.fromY;
float toY = reversed ? this.fromY : this.toY;
float fromZ = reversed ? this.toZ : this.fromZ;
float toZ = reversed ? this.fromZ : this.toZ;
transformable.translate(fromX + (toX - fromX) * comp, fromY + (toY - fromY) * comp, fromZ + (toZ - fromZ) * comp);
} | [
"@",
"Override",
"protected",
"void",
"doTransform",
"(",
"ITransformable",
".",
"Translate",
"transformable",
",",
"float",
"comp",
")",
"{",
"float",
"fromX",
"=",
"reversed",
"?",
"this",
".",
"toX",
":",
"this",
".",
"fromX",
";",
"float",
"toX",
"=",
... | Calculates the transformation.
@param transformable the transformable
@param comp the comp | [
"Calculates",
"the",
"transformation",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/animation/transformation/Translation.java#L111-L122 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/TreeItemUtil.java | TreeItemUtil.processJsonToTree | private static void processJsonToTree(final TreeItemIdNode parentNode, final JsonObject json) {
String id = json.getAsJsonPrimitive("id").getAsString();
JsonPrimitive expandableJson = json.getAsJsonPrimitive("expandable");
TreeItemIdNode node = new TreeItemIdNode(id);
if (expandableJson != null && expandableJson.getAsBoolean()) {
node.setHasChildren(true);
}
parentNode.addChild(node);
JsonArray children = json.getAsJsonArray("items");
if (children != null) {
for (int i = 0; i < children.size(); i++) {
JsonObject child = children.get(i).getAsJsonObject();
processJsonToTree(node, child);
}
}
} | java | private static void processJsonToTree(final TreeItemIdNode parentNode, final JsonObject json) {
String id = json.getAsJsonPrimitive("id").getAsString();
JsonPrimitive expandableJson = json.getAsJsonPrimitive("expandable");
TreeItemIdNode node = new TreeItemIdNode(id);
if (expandableJson != null && expandableJson.getAsBoolean()) {
node.setHasChildren(true);
}
parentNode.addChild(node);
JsonArray children = json.getAsJsonArray("items");
if (children != null) {
for (int i = 0; i < children.size(); i++) {
JsonObject child = children.get(i).getAsJsonObject();
processJsonToTree(node, child);
}
}
} | [
"private",
"static",
"void",
"processJsonToTree",
"(",
"final",
"TreeItemIdNode",
"parentNode",
",",
"final",
"JsonObject",
"json",
")",
"{",
"String",
"id",
"=",
"json",
".",
"getAsJsonPrimitive",
"(",
"\"id\"",
")",
".",
"getAsString",
"(",
")",
";",
"JsonPr... | Iterate over the JSON objects to create the tree structure.
@param parentNode the parent node
@param json the current JSON object | [
"Iterate",
"over",
"the",
"JSON",
"objects",
"to",
"create",
"the",
"tree",
"structure",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/TreeItemUtil.java#L247-L265 |
lastaflute/lastaflute | src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java | TypicalLoginAssist.saveRememberMeKeyToCookie | protected void saveRememberMeKeyToCookie(USER_ENTITY userEntity, USER_BEAN userBean) {
final int expireDays = getRememberMeAccessTokenExpireDays();
getCookieRememberMeKey().ifPresent(cookieKey -> {
doSaveRememberMeCookie(userEntity, userBean, expireDays, cookieKey);
});
} | java | protected void saveRememberMeKeyToCookie(USER_ENTITY userEntity, USER_BEAN userBean) {
final int expireDays = getRememberMeAccessTokenExpireDays();
getCookieRememberMeKey().ifPresent(cookieKey -> {
doSaveRememberMeCookie(userEntity, userBean, expireDays, cookieKey);
});
} | [
"protected",
"void",
"saveRememberMeKeyToCookie",
"(",
"USER_ENTITY",
"userEntity",
",",
"USER_BEAN",
"userBean",
")",
"{",
"final",
"int",
"expireDays",
"=",
"getRememberMeAccessTokenExpireDays",
"(",
")",
";",
"getCookieRememberMeKey",
"(",
")",
".",
"ifPresent",
"(... | Save remember-me key to cookie.
@param userEntity The selected entity of login user. (NotNull)
@param userBean The user bean saved in session. (NotNull) | [
"Save",
"remember",
"-",
"me",
"key",
"to",
"cookie",
"."
] | train | https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java#L407-L412 |
aws/aws-sdk-java | aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/UpdateSecurityProfileResult.java | UpdateSecurityProfileResult.withAlertTargets | public UpdateSecurityProfileResult withAlertTargets(java.util.Map<String, AlertTarget> alertTargets) {
setAlertTargets(alertTargets);
return this;
} | java | public UpdateSecurityProfileResult withAlertTargets(java.util.Map<String, AlertTarget> alertTargets) {
setAlertTargets(alertTargets);
return this;
} | [
"public",
"UpdateSecurityProfileResult",
"withAlertTargets",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"AlertTarget",
">",
"alertTargets",
")",
"{",
"setAlertTargets",
"(",
"alertTargets",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Where the alerts are sent. (Alerts are always sent to the console.)
</p>
@param alertTargets
Where the alerts are sent. (Alerts are always sent to the console.)
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Where",
"the",
"alerts",
"are",
"sent",
".",
"(",
"Alerts",
"are",
"always",
"sent",
"to",
"the",
"console",
".",
")",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/UpdateSecurityProfileResult.java#L302-L305 |
spotify/async-google-pubsub-client | src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java | Pubsub.createTopic | public PubsubFuture<Topic> createTopic(final String project,
final String topic) {
return createTopic(canonicalTopic(project, topic));
} | java | public PubsubFuture<Topic> createTopic(final String project,
final String topic) {
return createTopic(canonicalTopic(project, topic));
} | [
"public",
"PubsubFuture",
"<",
"Topic",
">",
"createTopic",
"(",
"final",
"String",
"project",
",",
"final",
"String",
"topic",
")",
"{",
"return",
"createTopic",
"(",
"canonicalTopic",
"(",
"project",
",",
"topic",
")",
")",
";",
"}"
] | Create a Pub/Sub topic.
@param project The Google Cloud project.
@param topic The name of the topic to create.
@return A future that is completed when this request is completed. | [
"Create",
"a",
"Pub",
"/",
"Sub",
"topic",
"."
] | train | https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L282-L285 |
kaichunlin/android-transition | core/src/main/java/com/kaichunlin/transition/util/TransitionUtil.java | TransitionUtil.getMenuItem | public static MenuItem getMenuItem(@NonNull Toolbar toolbar, @IdRes int menuId) {
View v;
int childCount;
View innerView;
MenuItem menuItem;
for (int i = 0; i < toolbar.getChildCount(); i++) {
v = toolbar.getChildAt(i);
if (v instanceof ActionMenuView) {
childCount = ((ActionMenuView) v).getChildCount();
for (int j = 0; j < childCount; j++) {
innerView = ((ActionMenuView) v).getChildAt(j);
if (innerView instanceof ActionMenuItemView) {
menuItem = ((ActionMenuItemView) innerView).getItemData();
if (menuItem.getItemId() == menuId) {
return menuItem;
}
}
}
}
}
return null;
} | java | public static MenuItem getMenuItem(@NonNull Toolbar toolbar, @IdRes int menuId) {
View v;
int childCount;
View innerView;
MenuItem menuItem;
for (int i = 0; i < toolbar.getChildCount(); i++) {
v = toolbar.getChildAt(i);
if (v instanceof ActionMenuView) {
childCount = ((ActionMenuView) v).getChildCount();
for (int j = 0; j < childCount; j++) {
innerView = ((ActionMenuView) v).getChildAt(j);
if (innerView instanceof ActionMenuItemView) {
menuItem = ((ActionMenuItemView) innerView).getItemData();
if (menuItem.getItemId() == menuId) {
return menuItem;
}
}
}
}
}
return null;
} | [
"public",
"static",
"MenuItem",
"getMenuItem",
"(",
"@",
"NonNull",
"Toolbar",
"toolbar",
",",
"@",
"IdRes",
"int",
"menuId",
")",
"{",
"View",
"v",
";",
"int",
"childCount",
";",
"View",
"innerView",
";",
"MenuItem",
"menuItem",
";",
"for",
"(",
"int",
... | Search for a particular menu
@param toolbar
@param menuId
@return the corresponding MenuItem, or null if not found | [
"Search",
"for",
"a",
"particular",
"menu"
] | train | https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/util/TransitionUtil.java#L52-L73 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/Record.java | Record.getSQLSeek | public String getSQLSeek(String strSeekSign, boolean bUseCurrentValues, Vector<BaseField> vParamList)
{
boolean bIsQueryRecord = this.isQueryRecord();
String strRecordset = this.makeTableNames(false);
String strFields = this.getSQLFields(DBConstants.SQL_SELECT_TYPE, bUseCurrentValues);
String strSortParams = this.addSortParams(bIsQueryRecord, false);
KeyArea keyArea = this.getKeyArea(-1); // Current index
keyArea.setupKeyBuffer(null, DBConstants.TEMP_KEY_AREA); // Move params
String sFilter = keyArea.addSelectParams(strSeekSign, DBConstants.TEMP_KEY_AREA, false, bIsQueryRecord, bUseCurrentValues, vParamList, false, false); // Always add!?
if (sFilter.length() > 0)
{
if (strRecordset.indexOf(" WHERE ") == -1)
sFilter = " WHERE " + sFilter;
else
sFilter = " AND " + sFilter;
}
strRecordset = "SELECT" + strFields + " FROM " + strRecordset + sFilter + strSortParams;
return strRecordset;
} | java | public String getSQLSeek(String strSeekSign, boolean bUseCurrentValues, Vector<BaseField> vParamList)
{
boolean bIsQueryRecord = this.isQueryRecord();
String strRecordset = this.makeTableNames(false);
String strFields = this.getSQLFields(DBConstants.SQL_SELECT_TYPE, bUseCurrentValues);
String strSortParams = this.addSortParams(bIsQueryRecord, false);
KeyArea keyArea = this.getKeyArea(-1); // Current index
keyArea.setupKeyBuffer(null, DBConstants.TEMP_KEY_AREA); // Move params
String sFilter = keyArea.addSelectParams(strSeekSign, DBConstants.TEMP_KEY_AREA, false, bIsQueryRecord, bUseCurrentValues, vParamList, false, false); // Always add!?
if (sFilter.length() > 0)
{
if (strRecordset.indexOf(" WHERE ") == -1)
sFilter = " WHERE " + sFilter;
else
sFilter = " AND " + sFilter;
}
strRecordset = "SELECT" + strFields + " FROM " + strRecordset + sFilter + strSortParams;
return strRecordset;
} | [
"public",
"String",
"getSQLSeek",
"(",
"String",
"strSeekSign",
",",
"boolean",
"bUseCurrentValues",
",",
"Vector",
"<",
"BaseField",
">",
"vParamList",
")",
"{",
"boolean",
"bIsQueryRecord",
"=",
"this",
".",
"isQueryRecord",
"(",
")",
";",
"String",
"strRecord... | Get the SQL 'Seek' string.
@param bUseCurrentValues If true, use the current field value, otherwise, use '?'.
@param vParamList The parameter list.
@return The SQL select string. | [
"Get",
"the",
"SQL",
"Seek",
"string",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/Record.java#L1455-L1476 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPoliciesInner.java | ServerTableAuditingPoliciesInner.getAsync | public Observable<ServerTableAuditingPolicyInner> getAsync(String resourceGroupName, String serverName) {
return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerTableAuditingPolicyInner>, ServerTableAuditingPolicyInner>() {
@Override
public ServerTableAuditingPolicyInner call(ServiceResponse<ServerTableAuditingPolicyInner> response) {
return response.body();
}
});
} | java | public Observable<ServerTableAuditingPolicyInner> getAsync(String resourceGroupName, String serverName) {
return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerTableAuditingPolicyInner>, ServerTableAuditingPolicyInner>() {
@Override
public ServerTableAuditingPolicyInner call(ServiceResponse<ServerTableAuditingPolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServerTableAuditingPolicyInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
")",
".",
"map",
"(",
"new"... | Gets a server's table auditing policy. Table auditing is deprecated, use blob auditing instead.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServerTableAuditingPolicyInner object | [
"Gets",
"a",
"server",
"s",
"table",
"auditing",
"policy",
".",
"Table",
"auditing",
"is",
"deprecated",
"use",
"blob",
"auditing",
"instead",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPoliciesInner.java#L106-L113 |
segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/internal/Utils.java | Utils.getIdentifier | private static int getIdentifier(Context context, String type, String key) {
return context.getResources().getIdentifier(key, type, context.getPackageName());
} | java | private static int getIdentifier(Context context, String type, String key) {
return context.getResources().getIdentifier(key, type, context.getPackageName());
} | [
"private",
"static",
"int",
"getIdentifier",
"(",
"Context",
"context",
",",
"String",
"type",
",",
"String",
"key",
")",
"{",
"return",
"context",
".",
"getResources",
"(",
")",
".",
"getIdentifier",
"(",
"key",
",",
"type",
",",
"context",
".",
"getPacka... | Get the identifier for the resource with a given type and key. | [
"Get",
"the",
"identifier",
"for",
"the",
"resource",
"with",
"a",
"given",
"type",
"and",
"key",
"."
] | train | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/internal/Utils.java#L299-L301 |
ngageoint/geopackage-java | src/main/java/mil/nga/geopackage/tiles/user/TileRow.java | TileRow.setTileData | public void setTileData(BufferedImage image, String imageFormat)
throws IOException {
byte[] bytes = ImageUtils.writeImageToBytes(image, imageFormat);
setTileData(bytes);
} | java | public void setTileData(BufferedImage image, String imageFormat)
throws IOException {
byte[] bytes = ImageUtils.writeImageToBytes(image, imageFormat);
setTileData(bytes);
} | [
"public",
"void",
"setTileData",
"(",
"BufferedImage",
"image",
",",
"String",
"imageFormat",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"ImageUtils",
".",
"writeImageToBytes",
"(",
"image",
",",
"imageFormat",
")",
";",
"setTileData",
... | Set the tile data from an image
@param image
image
@param imageFormat
image format
@throws IOException
upon failure | [
"Set",
"the",
"tile",
"data",
"from",
"an",
"image"
] | train | https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/tiles/user/TileRow.java#L217-L221 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WColumnLayout.java | WColumnLayout.setContent | private void setContent(final WColumn column, final WHeading heading, final WComponent content) {
column.removeAll();
if (heading != null) {
column.add(heading);
}
if (content != null) {
column.add(content);
}
// Update column widths & visibility
if (hasLeftContent() && hasRightContent()) {
// Set columns 50%
leftColumn.setWidth(50);
rightColumn.setWidth(50);
// Set both visible
leftColumn.setVisible(true);
rightColumn.setVisible(true);
} else {
// Set columns 100% (only one visible)
leftColumn.setWidth(100);
rightColumn.setWidth(100);
// Set visibility
leftColumn.setVisible(hasLeftContent());
rightColumn.setVisible(hasRightContent());
}
} | java | private void setContent(final WColumn column, final WHeading heading, final WComponent content) {
column.removeAll();
if (heading != null) {
column.add(heading);
}
if (content != null) {
column.add(content);
}
// Update column widths & visibility
if (hasLeftContent() && hasRightContent()) {
// Set columns 50%
leftColumn.setWidth(50);
rightColumn.setWidth(50);
// Set both visible
leftColumn.setVisible(true);
rightColumn.setVisible(true);
} else {
// Set columns 100% (only one visible)
leftColumn.setWidth(100);
rightColumn.setWidth(100);
// Set visibility
leftColumn.setVisible(hasLeftContent());
rightColumn.setVisible(hasRightContent());
}
} | [
"private",
"void",
"setContent",
"(",
"final",
"WColumn",
"column",
",",
"final",
"WHeading",
"heading",
",",
"final",
"WComponent",
"content",
")",
"{",
"column",
".",
"removeAll",
"(",
")",
";",
"if",
"(",
"heading",
"!=",
"null",
")",
"{",
"column",
"... | Sets the content of the given column and updates the column widths and visibilities.
@param column the column being updated.
@param heading the column heading.
@param content the content. | [
"Sets",
"the",
"content",
"of",
"the",
"given",
"column",
"and",
"updates",
"the",
"column",
"widths",
"and",
"visibilities",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WColumnLayout.java#L132-L159 |
spring-projects/spring-loaded | springloaded/src/main/java/org/springsource/loaded/Utils.java | Utils.collapseStackToArray | public static int collapseStackToArray(MethodVisitor mv, String desc) {
// Descriptor is of the format (Ljava/lang/String;IZZ)V
String descSequence = Utils.getParamSequence(desc);
if (descSequence == null) {
return 0; // nothing to do, there are no parameters
}
int count = descSequence.length();
// Create array to hold the params
mv.visitLdcInsn(count);
mv.visitTypeInsn(ANEWARRAY, "java/lang/Object");
// collapse the array with autoboxing where necessary
for (int dpos = count - 1; dpos >= 0; dpos--) {
char ch = descSequence.charAt(dpos);
switch (ch) {
case 'O':
mv.visitInsn(DUP_X1);
mv.visitInsn(SWAP);
mv.visitLdcInsn(dpos);
mv.visitInsn(SWAP);
mv.visitInsn(AASTORE);
break;
case 'I':
case 'Z':
case 'F':
case 'S':
case 'C':
case 'B':
// stack is: <paramvalue> <arrayref>
mv.visitInsn(DUP_X1);
// stack is <arrayref> <paramvalue> <arrayref>
mv.visitInsn(SWAP);
// stack is <arrayref> <arrayref> <paramvalue>
mv.visitLdcInsn(dpos);
// stack is <arrayref> <arrayref> <paramvalue> <index>
mv.visitInsn(SWAP);
// stack is <arrayref> <arrayref> <index> <paramvalue>
Utils.insertBoxInsns(mv, ch);
mv.visitInsn(AASTORE);
break;
case 'J': // long - double slot
case 'D': // double - double slot
// stack is: <paramvalue1> <paramvalue2> <arrayref>
mv.visitInsn(DUP_X2);
// stack is <arrayref> <paramvalue1> <paramvalue2> <arrayref>
mv.visitInsn(DUP_X2);
// stack is <arrayref> <arrayref> <paramvalue1> <paramvalue2> <arrayref>
mv.visitInsn(POP);
// stack is <arrayref> <arrayref> <paramvalue1> <paramvalue2>
Utils.insertBoxInsns(mv, ch);
// stack is <arrayref> <arrayref> <paramvalueBoxed>
mv.visitLdcInsn(dpos);
mv.visitInsn(SWAP);
// stack is <arrayref> <arrayref> <index> <paramvalueBoxed>
mv.visitInsn(AASTORE);
break;
default:
throw new IllegalStateException("Unexpected character: " + ch + " from " + desc + ":" + dpos);
}
}
return count;
} | java | public static int collapseStackToArray(MethodVisitor mv, String desc) {
// Descriptor is of the format (Ljava/lang/String;IZZ)V
String descSequence = Utils.getParamSequence(desc);
if (descSequence == null) {
return 0; // nothing to do, there are no parameters
}
int count = descSequence.length();
// Create array to hold the params
mv.visitLdcInsn(count);
mv.visitTypeInsn(ANEWARRAY, "java/lang/Object");
// collapse the array with autoboxing where necessary
for (int dpos = count - 1; dpos >= 0; dpos--) {
char ch = descSequence.charAt(dpos);
switch (ch) {
case 'O':
mv.visitInsn(DUP_X1);
mv.visitInsn(SWAP);
mv.visitLdcInsn(dpos);
mv.visitInsn(SWAP);
mv.visitInsn(AASTORE);
break;
case 'I':
case 'Z':
case 'F':
case 'S':
case 'C':
case 'B':
// stack is: <paramvalue> <arrayref>
mv.visitInsn(DUP_X1);
// stack is <arrayref> <paramvalue> <arrayref>
mv.visitInsn(SWAP);
// stack is <arrayref> <arrayref> <paramvalue>
mv.visitLdcInsn(dpos);
// stack is <arrayref> <arrayref> <paramvalue> <index>
mv.visitInsn(SWAP);
// stack is <arrayref> <arrayref> <index> <paramvalue>
Utils.insertBoxInsns(mv, ch);
mv.visitInsn(AASTORE);
break;
case 'J': // long - double slot
case 'D': // double - double slot
// stack is: <paramvalue1> <paramvalue2> <arrayref>
mv.visitInsn(DUP_X2);
// stack is <arrayref> <paramvalue1> <paramvalue2> <arrayref>
mv.visitInsn(DUP_X2);
// stack is <arrayref> <arrayref> <paramvalue1> <paramvalue2> <arrayref>
mv.visitInsn(POP);
// stack is <arrayref> <arrayref> <paramvalue1> <paramvalue2>
Utils.insertBoxInsns(mv, ch);
// stack is <arrayref> <arrayref> <paramvalueBoxed>
mv.visitLdcInsn(dpos);
mv.visitInsn(SWAP);
// stack is <arrayref> <arrayref> <index> <paramvalueBoxed>
mv.visitInsn(AASTORE);
break;
default:
throw new IllegalStateException("Unexpected character: " + ch + " from " + desc + ":" + dpos);
}
}
return count;
} | [
"public",
"static",
"int",
"collapseStackToArray",
"(",
"MethodVisitor",
"mv",
",",
"String",
"desc",
")",
"{",
"// Descriptor is of the format (Ljava/lang/String;IZZ)V",
"String",
"descSequence",
"=",
"Utils",
".",
"getParamSequence",
"(",
"desc",
")",
";",
"if",
"("... | /*
Produce the bytecode that will collapse the stack entries into an array - the descriptor describes what is being packed.
@param mv the method visitor to receive the instructions to package the data
@param desc the descriptor for the method that shows (through its parameters) the contents of the stack | [
"/",
"*",
"Produce",
"the",
"bytecode",
"that",
"will",
"collapse",
"the",
"stack",
"entries",
"into",
"an",
"array",
"-",
"the",
"descriptor",
"describes",
"what",
"is",
"being",
"packed",
"."
] | train | https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/Utils.java#L1689-L1750 |
sundrio/sundrio | codegen/src/main/java/io/sundr/codegen/processor/JavaGeneratingProcessor.java | JavaGeneratingProcessor.generateFromStringTemplate | public <T> void generateFromStringTemplate(T model, String outputPath, String content) throws IOException {
generateFromStringTemplate(model, new String[0], outputPath, content);
} | java | public <T> void generateFromStringTemplate(T model, String outputPath, String content) throws IOException {
generateFromStringTemplate(model, new String[0], outputPath, content);
} | [
"public",
"<",
"T",
">",
"void",
"generateFromStringTemplate",
"(",
"T",
"model",
",",
"String",
"outputPath",
",",
"String",
"content",
")",
"throws",
"IOException",
"{",
"generateFromStringTemplate",
"(",
"model",
",",
"new",
"String",
"[",
"0",
"]",
",",
... | Generates a source file from the specified {@link io.sundr.codegen.model.TypeDef}.
@param model The model of the class to generate.
@param outputPath Where to save the generated class.
@param content The template to use.
@throws IOException If it fails to create the source file. | [
"Generates",
"a",
"source",
"file",
"from",
"the",
"specified",
"{",
"@link",
"io",
".",
"sundr",
".",
"codegen",
".",
"model",
".",
"TypeDef",
"}",
"."
] | train | https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/codegen/src/main/java/io/sundr/codegen/processor/JavaGeneratingProcessor.java#L139-L141 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/MurmurHashUtil.java | MurmurHashUtil.hashUnsafeBytesByWords | public static int hashUnsafeBytesByWords(Object base, long offset, int lengthInBytes) {
return hashUnsafeBytesByWords(base, offset, lengthInBytes, DEFAULT_SEED);
} | java | public static int hashUnsafeBytesByWords(Object base, long offset, int lengthInBytes) {
return hashUnsafeBytesByWords(base, offset, lengthInBytes, DEFAULT_SEED);
} | [
"public",
"static",
"int",
"hashUnsafeBytesByWords",
"(",
"Object",
"base",
",",
"long",
"offset",
",",
"int",
"lengthInBytes",
")",
"{",
"return",
"hashUnsafeBytesByWords",
"(",
"base",
",",
"offset",
",",
"lengthInBytes",
",",
"DEFAULT_SEED",
")",
";",
"}"
] | Hash unsafe bytes, length must be aligned to 4 bytes.
@param base base unsafe object
@param offset offset for unsafe object
@param lengthInBytes length in bytes
@return hash code | [
"Hash",
"unsafe",
"bytes",
"length",
"must",
"be",
"aligned",
"to",
"4",
"bytes",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/MurmurHashUtil.java#L40-L42 |
MGunlogson/CuckooFilter4J | src/main/java/com/github/mgunlogson/cuckoofilter4j/FilterTable.java | FilterTable.deleteTag | void deleteTag(long bucketIndex, int posInBucket) {
long tagStartIdx = getTagOffset(bucketIndex, posInBucket);
memBlock.clear(tagStartIdx, tagStartIdx + bitsPerTag);
} | java | void deleteTag(long bucketIndex, int posInBucket) {
long tagStartIdx = getTagOffset(bucketIndex, posInBucket);
memBlock.clear(tagStartIdx, tagStartIdx + bitsPerTag);
} | [
"void",
"deleteTag",
"(",
"long",
"bucketIndex",
",",
"int",
"posInBucket",
")",
"{",
"long",
"tagStartIdx",
"=",
"getTagOffset",
"(",
"bucketIndex",
",",
"posInBucket",
")",
";",
"memBlock",
".",
"clear",
"(",
"tagStartIdx",
",",
"tagStartIdx",
"+",
"bitsPerT... | Deletes (clears) a tag at a specific bucket index and position
@param bucketIndex bucket index
@param posInBucket position in bucket | [
"Deletes",
"(",
"clears",
")",
"a",
"tag",
"at",
"a",
"specific",
"bucket",
"index",
"and",
"position"
] | train | https://github.com/MGunlogson/CuckooFilter4J/blob/e8472aa150b201f05046d1c81cac5a5ca4348db8/src/main/java/com/github/mgunlogson/cuckoofilter4j/FilterTable.java#L255-L258 |
brettonw/Bag | src/main/java/com/brettonw/bag/Bag.java | Bag.getBagArray | public BagArray getBagArray (String key, Supplier<BagArray> notFound) {
Object object = getObject (key);
return (object instanceof BagArray) ? (BagArray) object : notFound.get ();
} | java | public BagArray getBagArray (String key, Supplier<BagArray> notFound) {
Object object = getObject (key);
return (object instanceof BagArray) ? (BagArray) object : notFound.get ();
} | [
"public",
"BagArray",
"getBagArray",
"(",
"String",
"key",
",",
"Supplier",
"<",
"BagArray",
">",
"notFound",
")",
"{",
"Object",
"object",
"=",
"getObject",
"(",
"key",
")",
";",
"return",
"(",
"object",
"instanceof",
"BagArray",
")",
"?",
"(",
"BagArray"... | Retrieve a mapped element and return it as a BagArray.
@param key A string value used to index the element.
@param notFound A function to create a new BagArray if the requested key was not found
@return The element as a BagArray, or notFound if the element is not found. | [
"Retrieve",
"a",
"mapped",
"element",
"and",
"return",
"it",
"as",
"a",
"BagArray",
"."
] | train | https://github.com/brettonw/Bag/blob/25c0ff74893b6c9a2c61bf0f97189ab82e0b2f56/src/main/java/com/brettonw/bag/Bag.java#L130-L133 |
deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-client/src/main/java/org/nd4j/parameterserver/client/ParameterServerClient.java | ParameterServerClient.onNDArrayPartial | @Override
public void onNDArrayPartial(INDArray arr, long idx, int... dimensions) {
INDArray get = this.arr.get();
get.tensorAlongDimension((int) idx, dimensions).assign(arr);
} | java | @Override
public void onNDArrayPartial(INDArray arr, long idx, int... dimensions) {
INDArray get = this.arr.get();
get.tensorAlongDimension((int) idx, dimensions).assign(arr);
} | [
"@",
"Override",
"public",
"void",
"onNDArrayPartial",
"(",
"INDArray",
"arr",
",",
"long",
"idx",
",",
"int",
"...",
"dimensions",
")",
"{",
"INDArray",
"get",
"=",
"this",
".",
"arr",
".",
"get",
"(",
")",
";",
"get",
".",
"tensorAlongDimension",
"(",
... | Used for partial updates using tensor along
dimension
@param arr the array to count as an update
@param idx the index for the tensor along dimension
@param dimensions the dimensions to act on for the tensor along dimension | [
"Used",
"for",
"partial",
"updates",
"using",
"tensor",
"along",
"dimension"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-client/src/main/java/org/nd4j/parameterserver/client/ParameterServerClient.java#L320-L325 |
hibernate/hibernate-ogm | neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jAssociationQueries.java | BaseNeo4jAssociationQueries.initRemoveAssociationRowQuery | private static String initRemoveAssociationRowQuery(EntityKeyMetadata ownerEntityKeyMetadata, AssociationKeyMetadata associationKeyMetadata) {
StringBuilder queryBuilder = new StringBuilder( "MATCH " );
queryBuilder.append( "(n:" );
queryBuilder.append( ENTITY );
queryBuilder.append( ":" );
appendLabel( ownerEntityKeyMetadata, queryBuilder );
appendProperties( ownerEntityKeyMetadata, queryBuilder );
queryBuilder.append( ") - " );
queryBuilder.append( "[r" );
queryBuilder.append( ":" );
appendRelationshipType( queryBuilder, associationKeyMetadata );
int offset = ownerEntityKeyMetadata.getColumnNames().length;
boolean hasIndexColumns = associationKeyMetadata.getRowKeyIndexColumnNames().length > 0;
if ( hasIndexColumns ) {
appendProperties( queryBuilder, associationKeyMetadata.getRowKeyIndexColumnNames(), offset );
}
queryBuilder.append( "] - (e" );
if ( associationKeyMetadata.getAssociationKind() == AssociationKind.EMBEDDED_COLLECTION ) {
queryBuilder.append( ":" );
queryBuilder.append( EMBEDDED );
}
if ( !hasIndexColumns ) {
appendProperties( queryBuilder, associationKeyMetadata.getAssociatedEntityKeyMetadata().getEntityKeyMetadata().getColumnNames(), offset );
}
queryBuilder.append( ")" );
queryBuilder.append( " DELETE r" );
if ( associationKeyMetadata.getAssociationKind() == AssociationKind.EMBEDDED_COLLECTION ) {
queryBuilder.append( ", e" );
}
return queryBuilder.toString();
} | java | private static String initRemoveAssociationRowQuery(EntityKeyMetadata ownerEntityKeyMetadata, AssociationKeyMetadata associationKeyMetadata) {
StringBuilder queryBuilder = new StringBuilder( "MATCH " );
queryBuilder.append( "(n:" );
queryBuilder.append( ENTITY );
queryBuilder.append( ":" );
appendLabel( ownerEntityKeyMetadata, queryBuilder );
appendProperties( ownerEntityKeyMetadata, queryBuilder );
queryBuilder.append( ") - " );
queryBuilder.append( "[r" );
queryBuilder.append( ":" );
appendRelationshipType( queryBuilder, associationKeyMetadata );
int offset = ownerEntityKeyMetadata.getColumnNames().length;
boolean hasIndexColumns = associationKeyMetadata.getRowKeyIndexColumnNames().length > 0;
if ( hasIndexColumns ) {
appendProperties( queryBuilder, associationKeyMetadata.getRowKeyIndexColumnNames(), offset );
}
queryBuilder.append( "] - (e" );
if ( associationKeyMetadata.getAssociationKind() == AssociationKind.EMBEDDED_COLLECTION ) {
queryBuilder.append( ":" );
queryBuilder.append( EMBEDDED );
}
if ( !hasIndexColumns ) {
appendProperties( queryBuilder, associationKeyMetadata.getAssociatedEntityKeyMetadata().getEntityKeyMetadata().getColumnNames(), offset );
}
queryBuilder.append( ")" );
queryBuilder.append( " DELETE r" );
if ( associationKeyMetadata.getAssociationKind() == AssociationKind.EMBEDDED_COLLECTION ) {
queryBuilder.append( ", e" );
}
return queryBuilder.toString();
} | [
"private",
"static",
"String",
"initRemoveAssociationRowQuery",
"(",
"EntityKeyMetadata",
"ownerEntityKeyMetadata",
",",
"AssociationKeyMetadata",
"associationKeyMetadata",
")",
"{",
"StringBuilder",
"queryBuilder",
"=",
"new",
"StringBuilder",
"(",
"\"MATCH \"",
")",
";",
... | /*
Example with association:
MATCH (n:ENTITY:table {id: {0}}) -[r:role] - (e)
DELETE r
Example with embedded collection:
MATCH (n:ENTITY:table {id: {0}}) -[r:role] - (e:EMBEDDED)
DELETE r, e
Example with indexes:
MATCH (n:ENTITY:table {id: {0}}) -[r:role {index: {1}}] - (e)
DELETE r | [
"/",
"*",
"Example",
"with",
"association",
":"
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jAssociationQueries.java#L190-L220 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/UserAPI.java | UserAPI.userTagGet | public static UserTagGetResult userTagGet(String access_token,Integer tagid,String next_openid){
String json = String.format("{\"tagid\":%d,\"next_openid\":\"%s\"}",tagid,next_openid==null?"":next_openid);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(jsonHeader)
.setUri(BASE_URI+"/cgi-bin/user/tag/get")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.setEntity(new StringEntity(json,Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest,UserTagGetResult.class);
} | java | public static UserTagGetResult userTagGet(String access_token,Integer tagid,String next_openid){
String json = String.format("{\"tagid\":%d,\"next_openid\":\"%s\"}",tagid,next_openid==null?"":next_openid);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(jsonHeader)
.setUri(BASE_URI+"/cgi-bin/user/tag/get")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.setEntity(new StringEntity(json,Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest,UserTagGetResult.class);
} | [
"public",
"static",
"UserTagGetResult",
"userTagGet",
"(",
"String",
"access_token",
",",
"Integer",
"tagid",
",",
"String",
"next_openid",
")",
"{",
"String",
"json",
"=",
"String",
".",
"format",
"(",
"\"{\\\"tagid\\\":%d,\\\"next_openid\\\":\\\"%s\\\"}\"",
",",
"ta... | 标签管理 获取标签下粉丝列表
@since 2.8.1
@param access_token access_token
@param tagid tagid
@param next_openid 第一个拉取的OPENID,不填默认从头开始拉取
@return result | [
"标签管理",
"获取标签下粉丝列表"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/UserAPI.java#L355-L364 |
couchbase/couchbase-lite-java-core | src/main/java/com/couchbase/lite/support/action/Action.java | Action.moveFileToEmptyPath | public static Action moveFileToEmptyPath(final String srcPath, final String destPath) {
if (srcPath == null)
throw new IllegalArgumentException("The srcPath variable cannot be null");
if (destPath == null)
throw new IllegalArgumentException("The destPath variable cannot be null");
return new Action(
// Perform:
new ActionBlock() {
@Override
public void execute() throws ActionException {
File destFile = new File(destPath);
if (destFile.exists())
throw new ActionException("Cannot move file. " +
"The Destination file " + destPath + " already exists.");
boolean success = new File(srcPath).renameTo(destFile);
if (!success)
throw new ActionException("Cannot move file " + srcPath +
" to " + destPath);
}
},
// Backout:
new ActionBlock() {
@Override
public void execute() throws ActionException {
boolean success = new File(destPath).renameTo(new File(srcPath));
if (!success)
throw new ActionException("Cannot move file " + destPath +
" to " + srcPath);
}
},
// Cleanup:
null);
} | java | public static Action moveFileToEmptyPath(final String srcPath, final String destPath) {
if (srcPath == null)
throw new IllegalArgumentException("The srcPath variable cannot be null");
if (destPath == null)
throw new IllegalArgumentException("The destPath variable cannot be null");
return new Action(
// Perform:
new ActionBlock() {
@Override
public void execute() throws ActionException {
File destFile = new File(destPath);
if (destFile.exists())
throw new ActionException("Cannot move file. " +
"The Destination file " + destPath + " already exists.");
boolean success = new File(srcPath).renameTo(destFile);
if (!success)
throw new ActionException("Cannot move file " + srcPath +
" to " + destPath);
}
},
// Backout:
new ActionBlock() {
@Override
public void execute() throws ActionException {
boolean success = new File(destPath).renameTo(new File(srcPath));
if (!success)
throw new ActionException("Cannot move file " + destPath +
" to " + srcPath);
}
},
// Cleanup:
null);
} | [
"public",
"static",
"Action",
"moveFileToEmptyPath",
"(",
"final",
"String",
"srcPath",
",",
"final",
"String",
"destPath",
")",
"{",
"if",
"(",
"srcPath",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The srcPath variable cannot be null\"",
... | Moves the file/directory to a new location, which must not already exist.
@param srcPath Source path
@param destPath Destination path which must not exist
@return A moveFileToEmptyPath action | [
"Moves",
"the",
"file",
"/",
"directory",
"to",
"a",
"new",
"location",
"which",
"must",
"not",
"already",
"exist",
"."
] | train | https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/support/action/Action.java#L294-L327 |
Netflix/conductor | core/src/main/java/com/netflix/conductor/core/execution/mapper/DecisionTaskMapper.java | DecisionTaskMapper.getEvaluatedCaseValue | @VisibleForTesting
String getEvaluatedCaseValue(WorkflowTask taskToSchedule, Map<String, Object> taskInput) {
String expression = taskToSchedule.getCaseExpression();
String caseValue;
if (expression != null) {
logger.debug("Case being evaluated using decision expression: {}", expression);
try {
//Evaluate the expression by using the Nashhorn based script evaluator
Object returnValue = ScriptEvaluator.eval(expression, taskInput);
caseValue = (returnValue == null) ? "null" : returnValue.toString();
} catch (ScriptException e) {
String errorMsg = String.format("Error while evaluating script: %s", expression);
logger.error(errorMsg, e);
throw new TerminateWorkflowException(errorMsg);
}
} else {//In case of no case expression, get the caseValueParam and treat it as a string representation of caseValue
logger.debug("No Expression available on the decision task, case value being assigned as param name");
String paramName = taskToSchedule.getCaseValueParam();
caseValue = "" + taskInput.get(paramName);
}
return caseValue;
} | java | @VisibleForTesting
String getEvaluatedCaseValue(WorkflowTask taskToSchedule, Map<String, Object> taskInput) {
String expression = taskToSchedule.getCaseExpression();
String caseValue;
if (expression != null) {
logger.debug("Case being evaluated using decision expression: {}", expression);
try {
//Evaluate the expression by using the Nashhorn based script evaluator
Object returnValue = ScriptEvaluator.eval(expression, taskInput);
caseValue = (returnValue == null) ? "null" : returnValue.toString();
} catch (ScriptException e) {
String errorMsg = String.format("Error while evaluating script: %s", expression);
logger.error(errorMsg, e);
throw new TerminateWorkflowException(errorMsg);
}
} else {//In case of no case expression, get the caseValueParam and treat it as a string representation of caseValue
logger.debug("No Expression available on the decision task, case value being assigned as param name");
String paramName = taskToSchedule.getCaseValueParam();
caseValue = "" + taskInput.get(paramName);
}
return caseValue;
} | [
"@",
"VisibleForTesting",
"String",
"getEvaluatedCaseValue",
"(",
"WorkflowTask",
"taskToSchedule",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"taskInput",
")",
"{",
"String",
"expression",
"=",
"taskToSchedule",
".",
"getCaseExpression",
"(",
")",
";",
"Strin... | This method evaluates the case expression of a decision task and returns a string representation of the evaluated result.
@param taskToSchedule: The decision task that has the case expression to be evaluated.
@param taskInput: the input which has the values that will be used in evaluating the case expression.
@return A String representation of the evaluated result | [
"This",
"method",
"evaluates",
"the",
"case",
"expression",
"of",
"a",
"decision",
"task",
"and",
"returns",
"a",
"string",
"representation",
"of",
"the",
"evaluated",
"result",
"."
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/core/src/main/java/com/netflix/conductor/core/execution/mapper/DecisionTaskMapper.java#L119-L141 |
jaxio/celerio | celerio-engine/src/main/java/com/jaxio/celerio/util/IOUtil.java | IOUtil.stringToOutputStream | public void stringToOutputStream(String content, OutputStream out) throws IOException {
out.write(content.getBytes());
out.close();
} | java | public void stringToOutputStream(String content, OutputStream out) throws IOException {
out.write(content.getBytes());
out.close();
} | [
"public",
"void",
"stringToOutputStream",
"(",
"String",
"content",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"write",
"(",
"content",
".",
"getBytes",
"(",
")",
")",
";",
"out",
".",
"close",
"(",
")",
";",
"}"
] | Save a string to a file.
@param content the string to be written to file | [
"Save",
"a",
"string",
"to",
"a",
"file",
"."
] | train | https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/util/IOUtil.java#L82-L85 |
knightliao/disconf | disconf-web/src/main/java/com/baidu/unbiz/common/genericdao/dao/GenericDao.java | GenericDao.count | public int count(List<Match> matches) {
Query query = queryGenerator.getCountQuery(matches);
// 执行操作
String sql = query.getSql();
return countBySQL(sql, query.getParams());
} | java | public int count(List<Match> matches) {
Query query = queryGenerator.getCountQuery(matches);
// 执行操作
String sql = query.getSql();
return countBySQL(sql, query.getParams());
} | [
"public",
"int",
"count",
"(",
"List",
"<",
"Match",
">",
"matches",
")",
"{",
"Query",
"query",
"=",
"queryGenerator",
".",
"getCountQuery",
"(",
"matches",
")",
";",
"// 执行操作",
"String",
"sql",
"=",
"query",
".",
"getSql",
"(",
")",
";",
"return",
"c... | 查询符合条件组合的记录数
@param matches
@return 2013-8-26 下午3:04:02 created by wangchongjie | [
"查询符合条件组合的记录数"
] | train | https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-web/src/main/java/com/baidu/unbiz/common/genericdao/dao/GenericDao.java#L200-L206 |
hdbeukel/james-extensions | src/main/java/org/jamesframework/ext/problems/objectives/WeightedIndex.java | WeightedIndex.removeObjective | public boolean removeObjective(Objective<? super SolutionType, ? super DataType> objective){
if(weights.containsKey(objective)){
weights.remove(objective);
return true;
} else {
return false;
}
} | java | public boolean removeObjective(Objective<? super SolutionType, ? super DataType> objective){
if(weights.containsKey(objective)){
weights.remove(objective);
return true;
} else {
return false;
}
} | [
"public",
"boolean",
"removeObjective",
"(",
"Objective",
"<",
"?",
"super",
"SolutionType",
",",
"?",
"super",
"DataType",
">",
"objective",
")",
"{",
"if",
"(",
"weights",
".",
"containsKey",
"(",
"objective",
")",
")",
"{",
"weights",
".",
"remove",
"("... | Remove an objective, if present. Returns <code>true</code> if the objective has been successfully
removed, <code>false</code> if it was not contained in the index.
@param objective objective to remove
@return <code>true</code> if the objective has been successfully removed | [
"Remove",
"an",
"objective",
"if",
"present",
".",
"Returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"the",
"objective",
"has",
"been",
"successfully",
"removed",
"<code",
">",
"false<",
"/",
"code",
">",
"if",
"it",
"was",
"not",
"contained",
"i... | train | https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/problems/objectives/WeightedIndex.java#L75-L82 |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java | ZoomableGraphicsContext.drawImage | public void drawImage(Image img, double x, double y) {
this.gc.drawImage(img, doc2fxX(x), doc2fxY(y));
} | java | public void drawImage(Image img, double x, double y) {
this.gc.drawImage(img, doc2fxX(x), doc2fxY(y));
} | [
"public",
"void",
"drawImage",
"(",
"Image",
"img",
",",
"double",
"x",
",",
"double",
"y",
")",
"{",
"this",
".",
"gc",
".",
"drawImage",
"(",
"img",
",",
"doc2fxX",
"(",
"x",
")",
",",
"doc2fxY",
"(",
"y",
")",
")",
";",
"}"
] | Draws an image at the given x, y position using the width
and height of the given image.
A {@code null} image value or an image still in progress will be ignored.
<p>This method will be affected by any of the
global common attributes as specified in the
Rendering Attributes Table of {@link GraphicsContext}.
@param img the image to be drawn or null.
@param x the X coordinate on the destination for the upper left of the image.
@param y the Y coordinate on the destination for the upper left of the image. | [
"Draws",
"an",
"image",
"at",
"the",
"given",
"x",
"y",
"position",
"using",
"the",
"width",
"and",
"height",
"of",
"the",
"given",
"image",
".",
"A",
"{",
"@code",
"null",
"}",
"image",
"value",
"or",
"an",
"image",
"still",
"in",
"progress",
"will",
... | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L1660-L1662 |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/AbstractSubclassFactory.java | AbstractSubclassFactory.overrideMethod | protected boolean overrideMethod(ClassMethod method, MethodIdentifier identifier, MethodBodyCreator creator) {
if (!overriddenMethods.contains(identifier)) {
overriddenMethods.add(identifier);
creator.overrideMethod(method, null);
return true;
}
return false;
} | java | protected boolean overrideMethod(ClassMethod method, MethodIdentifier identifier, MethodBodyCreator creator) {
if (!overriddenMethods.contains(identifier)) {
overriddenMethods.add(identifier);
creator.overrideMethod(method, null);
return true;
}
return false;
} | [
"protected",
"boolean",
"overrideMethod",
"(",
"ClassMethod",
"method",
",",
"MethodIdentifier",
"identifier",
",",
"MethodBodyCreator",
"creator",
")",
"{",
"if",
"(",
"!",
"overriddenMethods",
".",
"contains",
"(",
"identifier",
")",
")",
"{",
"overriddenMethods",... | Creates a new method on the generated class that overrides the given methods, unless a method with the same signature has
already been overridden.
@param method The method to override
@param identifier The identifier of the method to override
@param creator The {@link MethodBodyCreator} used to create the method body
@return {@code false} if the method has already been overridden | [
"Creates",
"a",
"new",
"method",
"on",
"the",
"generated",
"class",
"that",
"overrides",
"the",
"given",
"methods",
"unless",
"a",
"method",
"with",
"the",
"same",
"signature",
"has",
"already",
"been",
"overridden",
"."
] | train | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/AbstractSubclassFactory.java#L134-L141 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java | TypeUtil.getTypeArgument | public static Type getTypeArgument(Type type, int index) {
final Type[] typeArguments = getTypeArguments(type);
if (null != typeArguments && typeArguments.length > index) {
return typeArguments[index];
}
return null;
} | java | public static Type getTypeArgument(Type type, int index) {
final Type[] typeArguments = getTypeArguments(type);
if (null != typeArguments && typeArguments.length > index) {
return typeArguments[index];
}
return null;
} | [
"public",
"static",
"Type",
"getTypeArgument",
"(",
"Type",
"type",
",",
"int",
"index",
")",
"{",
"final",
"Type",
"[",
"]",
"typeArguments",
"=",
"getTypeArguments",
"(",
"type",
")",
";",
"if",
"(",
"null",
"!=",
"typeArguments",
"&&",
"typeArguments",
... | 获得给定类的泛型参数
@param type 被检查的类型,必须是已经确定泛型类型的类
@param index 泛型类型的索引号,既第几个泛型类型
@return {@link Type} | [
"获得给定类的泛型参数"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java#L209-L215 |
streamsets/datacollector-api | src/main/java/com/streamsets/pipeline/api/impl/Utils.java | Utils.checkState | public static void checkState(boolean expression, @Nullable Object msg) {
if (!expression) {
throw new IllegalStateException(String.valueOf(msg));
}
} | java | public static void checkState(boolean expression, @Nullable Object msg) {
if (!expression) {
throw new IllegalStateException(String.valueOf(msg));
}
} | [
"public",
"static",
"void",
"checkState",
"(",
"boolean",
"expression",
",",
"@",
"Nullable",
"Object",
"msg",
")",
"{",
"if",
"(",
"!",
"expression",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"String",
".",
"valueOf",
"(",
"msg",
")",
")",
... | Ensures the truth of an expression involving the state of the calling instance, but not
involving any parameters to the calling method.
@param expression a boolean expression
@param msg the exception message to use if the check fails; will be converted to a
string using {@link String#valueOf(Object)}
@throws IllegalStateException if {@code expression} is false | [
"Ensures",
"the",
"truth",
"of",
"an",
"expression",
"involving",
"the",
"state",
"of",
"the",
"calling",
"instance",
"but",
"not",
"involving",
"any",
"parameters",
"to",
"the",
"calling",
"method",
"."
] | train | https://github.com/streamsets/datacollector-api/blob/ac832a97bea2fcef11f50fac6746e85019adad58/src/main/java/com/streamsets/pipeline/api/impl/Utils.java#L85-L89 |
google/error-prone-javac | src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java | Graph.pathExists | private boolean pathExists(T u, T v, boolean includeAdjacent) {
if (!nodes.contains(u) || !nodes.contains(v)) {
return false;
}
if (includeAdjacent && isAdjacent(u, v)) {
return true;
}
Deque<T> stack = new LinkedList<>();
Set<T> visited = new HashSet<>();
stack.push(u);
while (!stack.isEmpty()) {
T node = stack.pop();
if (node.equals(v)) {
return true;
}
if (!visited.contains(node)) {
visited.add(node);
edges.get(node).stream()
.filter(e -> includeAdjacent || !node.equals(u) || !e.equals(v))
.forEach(stack::push);
}
}
assert !visited.contains(v);
return false;
} | java | private boolean pathExists(T u, T v, boolean includeAdjacent) {
if (!nodes.contains(u) || !nodes.contains(v)) {
return false;
}
if (includeAdjacent && isAdjacent(u, v)) {
return true;
}
Deque<T> stack = new LinkedList<>();
Set<T> visited = new HashSet<>();
stack.push(u);
while (!stack.isEmpty()) {
T node = stack.pop();
if (node.equals(v)) {
return true;
}
if (!visited.contains(node)) {
visited.add(node);
edges.get(node).stream()
.filter(e -> includeAdjacent || !node.equals(u) || !e.equals(v))
.forEach(stack::push);
}
}
assert !visited.contains(v);
return false;
} | [
"private",
"boolean",
"pathExists",
"(",
"T",
"u",
",",
"T",
"v",
",",
"boolean",
"includeAdjacent",
")",
"{",
"if",
"(",
"!",
"nodes",
".",
"contains",
"(",
"u",
")",
"||",
"!",
"nodes",
".",
"contains",
"(",
"v",
")",
")",
"{",
"return",
"false",... | Returns true if there exists a path from u to v in this graph.
If includeAdjacent is false, it returns true if there exists
another path from u to v of distance > 1 | [
"Returns",
"true",
"if",
"there",
"exists",
"a",
"path",
"from",
"u",
"to",
"v",
"in",
"this",
"graph",
".",
"If",
"includeAdjacent",
"is",
"false",
"it",
"returns",
"true",
"if",
"there",
"exists",
"another",
"path",
"from",
"u",
"to",
"v",
"of",
"dis... | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java#L193-L217 |
op4j/op4j | src/main/java/org/op4j/functions/FnNumber.java | FnNumber.toStr | public static final Function<Number,String> toStr(Locale locale, boolean groupingUsed) {
return new ToString(locale, groupingUsed);
} | java | public static final Function<Number,String> toStr(Locale locale, boolean groupingUsed) {
return new ToString(locale, groupingUsed);
} | [
"public",
"static",
"final",
"Function",
"<",
"Number",
",",
"String",
">",
"toStr",
"(",
"Locale",
"locale",
",",
"boolean",
"groupingUsed",
")",
"{",
"return",
"new",
"ToString",
"(",
"locale",
",",
"groupingUsed",
")",
";",
"}"
] | <p>
It returns the {@link String} representation of the target number in the given {@link Locale}. Grouping
will be used depending on the value of the groupingUsed parameter
</p>
@param locale the {@link Locale} to be used
@param groupingUsed whether or not grouping will be used
@return the {@link String} representation of the input | [
"<p",
">",
"It",
"returns",
"the",
"{",
"@link",
"String",
"}",
"representation",
"of",
"the",
"target",
"number",
"in",
"the",
"given",
"{",
"@link",
"Locale",
"}",
".",
"Grouping",
"will",
"be",
"used",
"depending",
"on",
"the",
"value",
"of",
"the",
... | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnNumber.java#L381-L383 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.getCompositeEntityRoleAsync | public Observable<EntityRole> getCompositeEntityRoleAsync(UUID appId, String versionId, UUID cEntityId, UUID roleId) {
return getCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, roleId).map(new Func1<ServiceResponse<EntityRole>, EntityRole>() {
@Override
public EntityRole call(ServiceResponse<EntityRole> response) {
return response.body();
}
});
} | java | public Observable<EntityRole> getCompositeEntityRoleAsync(UUID appId, String versionId, UUID cEntityId, UUID roleId) {
return getCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, roleId).map(new Func1<ServiceResponse<EntityRole>, EntityRole>() {
@Override
public EntityRole call(ServiceResponse<EntityRole> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EntityRole",
">",
"getCompositeEntityRoleAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"cEntityId",
",",
"UUID",
"roleId",
")",
"{",
"return",
"getCompositeEntityRoleWithServiceResponseAsync",
"(",
"appId",
",",
... | Get one entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param cEntityId The composite entity extractor ID.
@param roleId entity role ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the EntityRole object | [
"Get",
"one",
"entity",
"role",
"for",
"a",
"given",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L12383-L12390 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/isomorphism/matchers/smarts/LogicalOperatorAtom.java | LogicalOperatorAtom.or | public static SMARTSAtom or(IQueryAtom left, IQueryAtom right) {
return new Disjunction(left.getBuilder(), left, right);
} | java | public static SMARTSAtom or(IQueryAtom left, IQueryAtom right) {
return new Disjunction(left.getBuilder(), left, right);
} | [
"public",
"static",
"SMARTSAtom",
"or",
"(",
"IQueryAtom",
"left",
",",
"IQueryAtom",
"right",
")",
"{",
"return",
"new",
"Disjunction",
"(",
"left",
".",
"getBuilder",
"(",
")",
",",
"left",
",",
"right",
")",
";",
"}"
] | Disjunction the provided expressions.
@param left expression
@param right expression
@return disjunction of the left and right expressions | [
"Disjunction",
"the",
"provided",
"expressions",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/isomorphism/matchers/smarts/LogicalOperatorAtom.java#L162-L164 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java | ResourceGroovyMethods.filterLine | public static Writable filterLine(URL self, @ClosureParams(value = SimpleType.class, options = "java.lang.String") Closure predicate) throws IOException {
return IOGroovyMethods.filterLine(newReader(self), predicate);
} | java | public static Writable filterLine(URL self, @ClosureParams(value = SimpleType.class, options = "java.lang.String") Closure predicate) throws IOException {
return IOGroovyMethods.filterLine(newReader(self), predicate);
} | [
"public",
"static",
"Writable",
"filterLine",
"(",
"URL",
"self",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.lang.String\"",
")",
"Closure",
"predicate",
")",
"throws",
"IOException",
"{",
"return",
"... | Filter lines from a URL using a closure predicate. The closure
will be passed each line as a String, and it should return
<code>true</code> if the line should be passed to the writer.
@param self a URL
@param predicate a closure which returns boolean and takes a line
@return a writable which writes out the filtered lines
@throws IOException if an IO exception occurs
@see IOGroovyMethods#filterLine(java.io.Reader, groovy.lang.Closure)
@since 1.6.8 | [
"Filter",
"lines",
"from",
"a",
"URL",
"using",
"a",
"closure",
"predicate",
".",
"The",
"closure",
"will",
"be",
"passed",
"each",
"line",
"as",
"a",
"String",
"and",
"it",
"should",
"return",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"the",
"lin... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L2437-L2439 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.checkRoleForResource | public void checkRoleForResource(CmsDbContext dbc, CmsRole role, CmsResource resource)
throws CmsRoleViolationException {
if (!hasRoleForResource(dbc, dbc.currentUser(), role, resource)) {
throw role.createRoleViolationExceptionForResource(dbc.getRequestContext(), resource);
}
} | java | public void checkRoleForResource(CmsDbContext dbc, CmsRole role, CmsResource resource)
throws CmsRoleViolationException {
if (!hasRoleForResource(dbc, dbc.currentUser(), role, resource)) {
throw role.createRoleViolationExceptionForResource(dbc.getRequestContext(), resource);
}
} | [
"public",
"void",
"checkRoleForResource",
"(",
"CmsDbContext",
"dbc",
",",
"CmsRole",
"role",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsRoleViolationException",
"{",
"if",
"(",
"!",
"hasRoleForResource",
"(",
"dbc",
",",
"dbc",
".",
"currentUser",
"(",
... | Checks if the user of the current database context has permissions to impersonate the given role
for the given resource.<p>
@param dbc the current OpenCms users database context
@param role the role to check
@param resource the resource to check the role for
@throws CmsRoleViolationException if the user does not have the required role permissions
@see org.opencms.security.CmsRoleManager#checkRole(CmsObject, CmsRole) | [
"Checks",
"if",
"the",
"user",
"of",
"the",
"current",
"database",
"context",
"has",
"permissions",
"to",
"impersonate",
"the",
"given",
"role",
"for",
"the",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L606-L612 |
apache/incubator-zipkin | zipkin-collector/core/src/main/java/zipkin2/collector/Collector.java | Collector.errorStoringSpans | RuntimeException errorStoringSpans(List<Span> spans, Throwable e) {
metrics.incrementSpansDropped(spans.size());
// The exception could be related to a span being huge. Instead of filling logs,
// print trace id, span id pairs
StringBuilder msg = appendSpanIds(spans, new StringBuilder("Cannot store spans "));
return doError(msg.toString(), e);
} | java | RuntimeException errorStoringSpans(List<Span> spans, Throwable e) {
metrics.incrementSpansDropped(spans.size());
// The exception could be related to a span being huge. Instead of filling logs,
// print trace id, span id pairs
StringBuilder msg = appendSpanIds(spans, new StringBuilder("Cannot store spans "));
return doError(msg.toString(), e);
} | [
"RuntimeException",
"errorStoringSpans",
"(",
"List",
"<",
"Span",
">",
"spans",
",",
"Throwable",
"e",
")",
"{",
"metrics",
".",
"incrementSpansDropped",
"(",
"spans",
".",
"size",
"(",
")",
")",
";",
"// The exception could be related to a span being huge. Instead o... | When storing spans, an exception can be raised before or after the fact. This adds context of
span ids to give logs more relevance. | [
"When",
"storing",
"spans",
"an",
"exception",
"can",
"be",
"raised",
"before",
"or",
"after",
"the",
"fact",
".",
"This",
"adds",
"context",
"of",
"span",
"ids",
"to",
"give",
"logs",
"more",
"relevance",
"."
] | train | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-collector/core/src/main/java/zipkin2/collector/Collector.java#L211-L217 |
theHilikus/Event-manager | src/main/java/com/github/thehilikus/events/event_manager/SubscriptionManager.java | SubscriptionManager.unsubscribe | public <T extends EventListener> void unsubscribe(EventPublisher source, T listener) {
log.debug("[unsubscribe] Removing {} --> {}", source.getClass().getName(), listener.getClass().getName());
GenericEventDispatcher<T> dispatcher = (GenericEventDispatcher<T>) dispatchers.get(source);
dispatcher.removeListener(listener);
} | java | public <T extends EventListener> void unsubscribe(EventPublisher source, T listener) {
log.debug("[unsubscribe] Removing {} --> {}", source.getClass().getName(), listener.getClass().getName());
GenericEventDispatcher<T> dispatcher = (GenericEventDispatcher<T>) dispatchers.get(source);
dispatcher.removeListener(listener);
} | [
"public",
"<",
"T",
"extends",
"EventListener",
">",
"void",
"unsubscribe",
"(",
"EventPublisher",
"source",
",",
"T",
"listener",
")",
"{",
"log",
".",
"debug",
"(",
"\"[unsubscribe] Removing {} --> {}\"",
",",
"source",
".",
"getClass",
"(",
")",
".",
"getNa... | Unbinds a listener to a publisher
@param source the event publisher
@param listener the event receiver | [
"Unbinds",
"a",
"listener",
"to",
"a",
"publisher"
] | train | https://github.com/theHilikus/Event-manager/blob/c3dabf5a145e57b2a6de89c1910851b8a8ae6064/src/main/java/com/github/thehilikus/events/event_manager/SubscriptionManager.java#L59-L63 |
neo4j-contrib/neo4j-apoc-procedures | src/main/java/apoc/algo/CoreGraphAlgorithms.java | CoreGraphAlgorithms.encode | private int encode(int x, int y, int r) {
int mask = (1 << r) - 1;
int hodd = 0;
int heven = x ^ y;
int notx = ~x & mask;
int noty = ~y & mask;
int temp = notx ^ y;
int v0 = 0, v1 = 0;
for (int k = 1; k < r; k++) {
v1 = ((v1 & heven) | ((v0 ^ noty) & temp)) >> 1;
v0 = ((v0 & (v1 ^ notx)) | (~v0 & (v1 ^ noty))) >> 1;
}
hodd = (~v0 & (v1 ^ x)) | (v0 & (v1 ^ noty));
return interleaveBits(hodd, heven);
} | java | private int encode(int x, int y, int r) {
int mask = (1 << r) - 1;
int hodd = 0;
int heven = x ^ y;
int notx = ~x & mask;
int noty = ~y & mask;
int temp = notx ^ y;
int v0 = 0, v1 = 0;
for (int k = 1; k < r; k++) {
v1 = ((v1 & heven) | ((v0 ^ noty) & temp)) >> 1;
v0 = ((v0 & (v1 ^ notx)) | (~v0 & (v1 ^ noty))) >> 1;
}
hodd = (~v0 & (v1 ^ x)) | (v0 & (v1 ^ noty));
return interleaveBits(hodd, heven);
} | [
"private",
"int",
"encode",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"r",
")",
"{",
"int",
"mask",
"=",
"(",
"1",
"<<",
"r",
")",
"-",
"1",
";",
"int",
"hodd",
"=",
"0",
";",
"int",
"heven",
"=",
"x",
"^",
"y",
";",
"int",
"notx",
"=... | java code adapted from C code in the paper "Encoding and decoding the Hilbert order" by Xian Lu and Gunther Schrack, published in Software: Practice and Experience Vol. 26 pp 1335-46 (1996). | [
"java",
"code",
"adapted",
"from",
"C",
"code",
"in",
"the",
"paper",
"Encoding",
"and",
"decoding",
"the",
"Hilbert",
"order",
"by",
"Xian",
"Lu",
"and",
"Gunther",
"Schrack",
"published",
"in",
"Software",
":",
"Practice",
"and",
"Experience",
"Vol",
".",
... | train | https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/e8386975d1c512c0e4388a1a61f5496121c04f86/src/main/java/apoc/algo/CoreGraphAlgorithms.java#L63-L80 |
duracloud/duracloud | chunk/src/main/java/org/duracloud/chunk/util/ChunksManifestVerifier.java | ChunksManifestVerifier.verifyAllChunks | public Results verifyAllChunks(String spaceId, ChunksManifest manifest) {
Results results = new Results();
for (ManifestEntry entry : manifest.getEntries()) {
String chunkId = entry.getChunkId();
String checksum = entry.getChunkMD5();
long byteSize = entry.getByteSize();
try {
Map<String, String> props =
this.contentStore.getContentProperties(spaceId,
entry.getChunkId());
String remoteChecksum = props.get(ContentStore.CONTENT_CHECKSUM);
long remoteByteSize = Long.valueOf(props.get(ContentStore.CONTENT_SIZE));
if (!checksum.equals(remoteChecksum)) {
results.add(chunkId,
"manifest checksum (" + checksum
+ ") does not match DuraCloud checksum ("
+ remoteChecksum
+ ")",
false);
} else if (byteSize != remoteByteSize) {
results.add(chunkId,
"manifest byte size (" + byteSize
+ ") does not match DuraCloud byte size ("
+ remoteByteSize
+ ")",
false);
} else {
results.add(chunkId, null, true);
}
} catch (Exception ex) {
results.add(chunkId, ex.getMessage(), false);
}
}
if (CollectionUtils.isNullOrEmpty(results.get())) {
throw new DuraCloudRuntimeException("failed to retrieve any chunks at list in chunk manifest: "
+ spaceId
+ "/"
+ manifest.getManifestId());
} else {
return results;
}
} | java | public Results verifyAllChunks(String spaceId, ChunksManifest manifest) {
Results results = new Results();
for (ManifestEntry entry : manifest.getEntries()) {
String chunkId = entry.getChunkId();
String checksum = entry.getChunkMD5();
long byteSize = entry.getByteSize();
try {
Map<String, String> props =
this.contentStore.getContentProperties(spaceId,
entry.getChunkId());
String remoteChecksum = props.get(ContentStore.CONTENT_CHECKSUM);
long remoteByteSize = Long.valueOf(props.get(ContentStore.CONTENT_SIZE));
if (!checksum.equals(remoteChecksum)) {
results.add(chunkId,
"manifest checksum (" + checksum
+ ") does not match DuraCloud checksum ("
+ remoteChecksum
+ ")",
false);
} else if (byteSize != remoteByteSize) {
results.add(chunkId,
"manifest byte size (" + byteSize
+ ") does not match DuraCloud byte size ("
+ remoteByteSize
+ ")",
false);
} else {
results.add(chunkId, null, true);
}
} catch (Exception ex) {
results.add(chunkId, ex.getMessage(), false);
}
}
if (CollectionUtils.isNullOrEmpty(results.get())) {
throw new DuraCloudRuntimeException("failed to retrieve any chunks at list in chunk manifest: "
+ spaceId
+ "/"
+ manifest.getManifestId());
} else {
return results;
}
} | [
"public",
"Results",
"verifyAllChunks",
"(",
"String",
"spaceId",
",",
"ChunksManifest",
"manifest",
")",
"{",
"Results",
"results",
"=",
"new",
"Results",
"(",
")",
";",
"for",
"(",
"ManifestEntry",
"entry",
":",
"manifest",
".",
"getEntries",
"(",
")",
")"... | Verifies the bytes and checksums of the chunks specified in the manifest
match what is in DuraCloud and returns a listing of the chunks with a flag
indicating whether the check was successful as well as an error message if it
was not. You can use the result.isSuccess() method as a shortcut for determining
whether all the items in the manifest matched on another.
@param spaceId
@param manifest
@return a list of results - one for each chunk.
@throws ContentStoreException | [
"Verifies",
"the",
"bytes",
"and",
"checksums",
"of",
"the",
"chunks",
"specified",
"in",
"the",
"manifest",
"match",
"what",
"is",
"in",
"DuraCloud",
"and",
"returns",
"a",
"listing",
"of",
"the",
"chunks",
"with",
"a",
"flag",
"indicating",
"whether",
"the... | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/chunk/src/main/java/org/duracloud/chunk/util/ChunksManifestVerifier.java#L50-L96 |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/EventHelper.java | EventHelper.addDelayedStyler | public void addDelayedStyler(String tag, Collection<Advanced> advanced, Chunk chunk, Image img) {
doOnGenericTag.put(tag, advanced);
if (chunk != null && chunk.getImage() != null) {
imageChunks.put(tag, chunk);
}
if (img != null) {
rectangles.put(tag, img);
}
} | java | public void addDelayedStyler(String tag, Collection<Advanced> advanced, Chunk chunk, Image img) {
doOnGenericTag.put(tag, advanced);
if (chunk != null && chunk.getImage() != null) {
imageChunks.put(tag, chunk);
}
if (img != null) {
rectangles.put(tag, img);
}
} | [
"public",
"void",
"addDelayedStyler",
"(",
"String",
"tag",
",",
"Collection",
"<",
"Advanced",
">",
"advanced",
",",
"Chunk",
"chunk",
",",
"Image",
"img",
")",
"{",
"doOnGenericTag",
".",
"put",
"(",
"tag",
",",
"advanced",
")",
";",
"if",
"(",
"chunk"... | add a styler that will do its styling in
{@link #onGenericTag(com.itextpdf.text.pdf.PdfWriter, com.itextpdf.text.Document, com.itextpdf.text.Rectangle, java.lang.String)}.
@param tag
@param advanced
@param chunk used when debugging, for placing debug info at the right position in the pdf
@param img the value of rect
@see Chunk#Chunk(com.itextpdf.text.Image, float, float, boolean) | [
"add",
"a",
"styler",
"that",
"will",
"do",
"its",
"styling",
"in",
"{",
"@link",
"#onGenericTag",
"(",
"com",
".",
"itextpdf",
".",
"text",
".",
"pdf",
".",
"PdfWriter",
"com",
".",
"itextpdf",
".",
"text",
".",
"Document",
"com",
".",
"itextpdf",
"."... | train | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/EventHelper.java#L586-L594 |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/AbstractBusPrimitive.java | AbstractBusPrimitive.firePrimitiveChanged | protected final void firePrimitiveChanged(String propertyName, Object oldValue, Object newValue) {
final BusChangeEvent event = new BusChangeEvent(
// source of the event
this,
// type of the event
BusChangeEventType.change(getClass()),
// subobject
this,
// index in parent
indexInParent(),
propertyName,
oldValue,
newValue);
firePrimitiveChanged(event);
} | java | protected final void firePrimitiveChanged(String propertyName, Object oldValue, Object newValue) {
final BusChangeEvent event = new BusChangeEvent(
// source of the event
this,
// type of the event
BusChangeEventType.change(getClass()),
// subobject
this,
// index in parent
indexInParent(),
propertyName,
oldValue,
newValue);
firePrimitiveChanged(event);
} | [
"protected",
"final",
"void",
"firePrimitiveChanged",
"(",
"String",
"propertyName",
",",
"Object",
"oldValue",
",",
"Object",
"newValue",
")",
"{",
"final",
"BusChangeEvent",
"event",
"=",
"new",
"BusChangeEvent",
"(",
"// source of the event",
"this",
",",
"// typ... | Fire the event that indicates this object has changed.
@param propertyName is the name of the graphical property.
@param oldValue is the old value of the property.
@param newValue is the new value of the property. | [
"Fire",
"the",
"event",
"that",
"indicates",
"this",
"object",
"has",
"changed",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/AbstractBusPrimitive.java#L225-L239 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.skipWhiteSpace | static public int skipWhiteSpace(byte[] data, int start) {
int index = start + 1;
while (index < data.length && BNFHeaders.SPACE == data[index]) {
index++;
}
return index;
} | java | static public int skipWhiteSpace(byte[] data, int start) {
int index = start + 1;
while (index < data.length && BNFHeaders.SPACE == data[index]) {
index++;
}
return index;
} | [
"static",
"public",
"int",
"skipWhiteSpace",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"start",
")",
"{",
"int",
"index",
"=",
"start",
"+",
"1",
";",
"while",
"(",
"index",
"<",
"data",
".",
"length",
"&&",
"BNFHeaders",
".",
"SPACE",
"==",
"data",... | Simple method to skip past any space characters from the starting
index onwards, until it finds a non-space character or the end of the
buffer. Returns the index it stopped on.
@param data
@param start
@return int | [
"Simple",
"method",
"to",
"skip",
"past",
"any",
"space",
"characters",
"from",
"the",
"starting",
"index",
"onwards",
"until",
"it",
"finds",
"a",
"non",
"-",
"space",
"character",
"or",
"the",
"end",
"of",
"the",
"buffer",
".",
"Returns",
"the",
"index",... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L1128-L1134 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.