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 |
|---|---|---|---|---|---|---|---|---|---|---|
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.rotate | public static void rotate(File imageFile, int degree, File outFile) throws IORuntimeException {
rotate(read(imageFile), degree, outFile);
} | java | public static void rotate(File imageFile, int degree, File outFile) throws IORuntimeException {
rotate(read(imageFile), degree, outFile);
} | [
"public",
"static",
"void",
"rotate",
"(",
"File",
"imageFile",
",",
"int",
"degree",
",",
"File",
"outFile",
")",
"throws",
"IORuntimeException",
"{",
"rotate",
"(",
"read",
"(",
"imageFile",
")",
",",
"degree",
",",
"outFile",
")",
";",
"}"
] | 旋转图片为指定角度<br>
此方法不会关闭输出流
@param imageFile 被旋转图像文件
@param degree 旋转角度
@param outFile 输出文件
@since 3.2.2
@throws IORuntimeException IO异常 | [
"旋转图片为指定角度<br",
">",
"此方法不会关闭输出流"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1002-L1004 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.BitArray | public JBBPDslBuilder BitArray(final String name, final JBBPBitNumber bits, final int size) {
return this.BitArray(name, bits, arraySizeToString(size));
} | java | public JBBPDslBuilder BitArray(final String name, final JBBPBitNumber bits, final int size) {
return this.BitArray(name, bits, arraySizeToString(size));
} | [
"public",
"JBBPDslBuilder",
"BitArray",
"(",
"final",
"String",
"name",
",",
"final",
"JBBPBitNumber",
"bits",
",",
"final",
"int",
"size",
")",
"{",
"return",
"this",
".",
"BitArray",
"(",
"name",
",",
"bits",
",",
"arraySizeToString",
"(",
"size",
")",
"... | Add named fixed length bit array.
@param name name of the array, if null then anonymous one
@param bits length of the field, must not be null
@param size number of elements in array, if negative then till the end of stream
@return the builder instance, must not be null | [
"Add",
"named",
"fixed",
"length",
"bit",
"array",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L676-L678 |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/AbstractProxyLogicHandler.java | AbstractProxyLogicHandler.enqueueWriteRequest | public synchronized void enqueueWriteRequest(final NextFilter nextFilter,
final WriteRequest writeRequest) {
if (writeRequestQueue == null) {
writeRequestQueue = new LinkedList<>();
}
writeRequestQueue.offer(new Event(nextFilter, writeRequest));
} | java | public synchronized void enqueueWriteRequest(final NextFilter nextFilter,
final WriteRequest writeRequest) {
if (writeRequestQueue == null) {
writeRequestQueue = new LinkedList<>();
}
writeRequestQueue.offer(new Event(nextFilter, writeRequest));
} | [
"public",
"synchronized",
"void",
"enqueueWriteRequest",
"(",
"final",
"NextFilter",
"nextFilter",
",",
"final",
"WriteRequest",
"writeRequest",
")",
"{",
"if",
"(",
"writeRequestQueue",
"==",
"null",
")",
"{",
"writeRequestQueue",
"=",
"new",
"LinkedList",
"<>",
... | Enqueue a message to be written once handshaking is complete. | [
"Enqueue",
"a",
"message",
"to",
"be",
"written",
"once",
"handshaking",
"is",
"complete",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/AbstractProxyLogicHandler.java#L173-L180 |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByCountry | public Iterable<DContact> queryByCountry(Object parent, java.lang.String country) {
return queryByField(parent, DContactMapper.Field.COUNTRY.getFieldName(), country);
} | java | public Iterable<DContact> queryByCountry(Object parent, java.lang.String country) {
return queryByField(parent, DContactMapper.Field.COUNTRY.getFieldName(), country);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByCountry",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"country",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"COUNTRY",
".",
"getFieldN... | query-by method for field country
@param country the specified attribute
@return an Iterable of DContacts for the specified country | [
"query",
"-",
"by",
"method",
"for",
"field",
"country"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L124-L126 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/UtilStream.java | UtilStream.getCopy | public static File getCopy(String name, InputStream input)
{
Check.notNull(name);
Check.notNull(input);
final String prefix;
final String suffix;
final int minimumPrefix = 3;
final int i = name.lastIndexOf(Constant.DOT);
if (i > minimumPrefix)
{
prefix = name.substring(0, i);
suffix = name.substring(i);
}
else
{
if (name.length() > minimumPrefix)
{
prefix = name;
}
else
{
prefix = PREFIX_TEMP;
}
suffix = null;
}
try
{
final File temp = File.createTempFile(prefix, suffix);
try (OutputStream output = new BufferedOutputStream(new FileOutputStream(temp)))
{
copy(input, output);
}
return temp;
}
catch (final IOException exception)
{
throw new LionEngineException(exception, ERROR_TEMP_FILE + name);
}
} | java | public static File getCopy(String name, InputStream input)
{
Check.notNull(name);
Check.notNull(input);
final String prefix;
final String suffix;
final int minimumPrefix = 3;
final int i = name.lastIndexOf(Constant.DOT);
if (i > minimumPrefix)
{
prefix = name.substring(0, i);
suffix = name.substring(i);
}
else
{
if (name.length() > minimumPrefix)
{
prefix = name;
}
else
{
prefix = PREFIX_TEMP;
}
suffix = null;
}
try
{
final File temp = File.createTempFile(prefix, suffix);
try (OutputStream output = new BufferedOutputStream(new FileOutputStream(temp)))
{
copy(input, output);
}
return temp;
}
catch (final IOException exception)
{
throw new LionEngineException(exception, ERROR_TEMP_FILE + name);
}
} | [
"public",
"static",
"File",
"getCopy",
"(",
"String",
"name",
",",
"InputStream",
"input",
")",
"{",
"Check",
".",
"notNull",
"(",
"name",
")",
";",
"Check",
".",
"notNull",
"(",
"input",
")",
";",
"final",
"String",
"prefix",
";",
"final",
"String",
"... | Get of full copy of the input stream stored in a temporary file.
@param name The file name reference, to have a similar temporary file name (must not be <code>null</code>).
@param input The input stream reference (must not be <code>null</code>).
@return The temporary file created with copied content from stream.
@throws LionEngineException If invalid arguments or invalid stream. | [
"Get",
"of",
"full",
"copy",
"of",
"the",
"input",
"stream",
"stored",
"in",
"a",
"temporary",
"file",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilStream.java#L75-L114 |
Alluxio/alluxio | core/common/src/main/java/alluxio/metrics/MetricsSystem.java | MetricsSystem.registerGaugeIfAbsent | public static synchronized <T> void registerGaugeIfAbsent(String name, Gauge<T> metric) {
if (!METRIC_REGISTRY.getGauges().containsKey(name)) {
METRIC_REGISTRY.register(name, metric);
}
} | java | public static synchronized <T> void registerGaugeIfAbsent(String name, Gauge<T> metric) {
if (!METRIC_REGISTRY.getGauges().containsKey(name)) {
METRIC_REGISTRY.register(name, metric);
}
} | [
"public",
"static",
"synchronized",
"<",
"T",
">",
"void",
"registerGaugeIfAbsent",
"(",
"String",
"name",
",",
"Gauge",
"<",
"T",
">",
"metric",
")",
"{",
"if",
"(",
"!",
"METRIC_REGISTRY",
".",
"getGauges",
"(",
")",
".",
"containsKey",
"(",
"name",
")... | Registers a gauge if it has not been registered.
@param name the gauge name
@param metric the gauge
@param <T> the type | [
"Registers",
"a",
"gauge",
"if",
"it",
"has",
"not",
"been",
"registered",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/metrics/MetricsSystem.java#L400-L404 |
eurekaclinical/protempa | protempa-framework/src/main/java/org/protempa/proposition/PropositionUtil.java | PropositionUtil.binarySearchMaxFinish | private static int binarySearchMaxFinish(
List<? extends TemporalProposition> params, long timestamp) {
/*
* The conditions for using index versus iterator are grabbed from the
* JDK source code.
*/
if (params.size() < 5000 || params instanceof RandomAccess) {
return maxFinishIndexedBinarySearch(params, timestamp);
} else {
return maxFinishIteratorBinarySearch(params, timestamp);
}
} | java | private static int binarySearchMaxFinish(
List<? extends TemporalProposition> params, long timestamp) {
/*
* The conditions for using index versus iterator are grabbed from the
* JDK source code.
*/
if (params.size() < 5000 || params instanceof RandomAccess) {
return maxFinishIndexedBinarySearch(params, timestamp);
} else {
return maxFinishIteratorBinarySearch(params, timestamp);
}
} | [
"private",
"static",
"int",
"binarySearchMaxFinish",
"(",
"List",
"<",
"?",
"extends",
"TemporalProposition",
">",
"params",
",",
"long",
"timestamp",
")",
"{",
"/*\n * The conditions for using index versus iterator are grabbed from the\n * JDK source code.\n ... | Binary search for a primitive parameter by timestamp.
@param list
a <code>List</code> of <code>PrimitiveParameter</code>
objects all with the same paramId, cannot be <code>null</code>.
@param tstamp
the timestamp we're interested in finding.
@return a <code>PrimitiveParameter</code>, or null if not found. | [
"Binary",
"search",
"for",
"a",
"primitive",
"parameter",
"by",
"timestamp",
"."
] | train | https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/PropositionUtil.java#L306-L317 |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java | DBaseFileAttributePool.getAccessor | @Pure
DBaseFileAttributeAccessor getAccessor(int recordNumber) {
DBaseFileAttributeAccessor accessor = this.accessors.get(recordNumber);
if (accessor == null) {
accessor = new DBaseFileAttributeAccessor(this, recordNumber);
this.accessors.put(recordNumber, accessor);
}
return accessor;
} | java | @Pure
DBaseFileAttributeAccessor getAccessor(int recordNumber) {
DBaseFileAttributeAccessor accessor = this.accessors.get(recordNumber);
if (accessor == null) {
accessor = new DBaseFileAttributeAccessor(this, recordNumber);
this.accessors.put(recordNumber, accessor);
}
return accessor;
} | [
"@",
"Pure",
"DBaseFileAttributeAccessor",
"getAccessor",
"(",
"int",
"recordNumber",
")",
"{",
"DBaseFileAttributeAccessor",
"accessor",
"=",
"this",
".",
"accessors",
".",
"get",
"(",
"recordNumber",
")",
";",
"if",
"(",
"accessor",
"==",
"null",
")",
"{",
"... | Replies the attribute accessor associated to the specified
record number.
@param recordNumber is the number of the record for which an accessor may be obtainable.
@return the accessor to the record at the given position. | [
"Replies",
"the",
"attribute",
"accessor",
"associated",
"to",
"the",
"specified",
"record",
"number",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java#L446-L454 |
alipay/sofa-rpc | extension-impl/remoting-http/src/main/java/com/alipay/sofa/rpc/server/http/AbstractHttpServerTask.java | AbstractHttpServerTask.cannotFoundService | private SofaRpcException cannotFoundService(String appName, String serviceName) {
String errorMsg = LogCodes
.getLog(LogCodes.ERROR_PROVIDER_SERVICE_CANNOT_FOUND, serviceName);
LOGGER.errorWithApp(appName, errorMsg);
return new SofaRpcException(RpcErrorType.SERVER_NOT_FOUND_INVOKER, errorMsg);
} | java | private SofaRpcException cannotFoundService(String appName, String serviceName) {
String errorMsg = LogCodes
.getLog(LogCodes.ERROR_PROVIDER_SERVICE_CANNOT_FOUND, serviceName);
LOGGER.errorWithApp(appName, errorMsg);
return new SofaRpcException(RpcErrorType.SERVER_NOT_FOUND_INVOKER, errorMsg);
} | [
"private",
"SofaRpcException",
"cannotFoundService",
"(",
"String",
"appName",
",",
"String",
"serviceName",
")",
"{",
"String",
"errorMsg",
"=",
"LogCodes",
".",
"getLog",
"(",
"LogCodes",
".",
"ERROR_PROVIDER_SERVICE_CANNOT_FOUND",
",",
"serviceName",
")",
";",
"L... | 找不到服务
@param appName 应用
@param serviceName 服务
@return 找不到服务的异常响应 | [
"找不到服务"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-http/src/main/java/com/alipay/sofa/rpc/server/http/AbstractHttpServerTask.java#L260-L265 |
alkacon/opencms-core | src/org/opencms/ade/contenteditor/CmsContentService.java | CmsContentService.validateContent | private CmsValidationResult validateContent(CmsObject cms, CmsUUID structureId, CmsXmlContent content) {
return validateContent(cms, structureId, content, null);
} | java | private CmsValidationResult validateContent(CmsObject cms, CmsUUID structureId, CmsXmlContent content) {
return validateContent(cms, structureId, content, null);
} | [
"private",
"CmsValidationResult",
"validateContent",
"(",
"CmsObject",
"cms",
",",
"CmsUUID",
"structureId",
",",
"CmsXmlContent",
"content",
")",
"{",
"return",
"validateContent",
"(",
"cms",
",",
"structureId",
",",
"content",
",",
"null",
")",
";",
"}"
] | Validates the given XML content.<p>
@param cms the cms context
@param structureId the structure id
@param content the XML content
@return the validation result | [
"Validates",
"the",
"given",
"XML",
"content",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/contenteditor/CmsContentService.java#L2465-L2468 |
opencb/biodata | biodata-tools/src/main/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedExacStatsCalculator.java | VariantAggregatedExacStatsCalculator.addReferenceGenotype | private static void addReferenceGenotype(Variant variant, VariantStats stats, int alleleNumber) {
int gtSum = 0;
for (Integer gtCounts : stats.getGenotypeCount().values()) {
gtSum += gtCounts;
}
Genotype genotype = new Genotype("0/0", variant.getReference(), variant.getAlternate());
stats.addGenotype(genotype, alleleNumber / 2 - gtSum); // assuming diploid sample! be careful if you copy this code!
} | java | private static void addReferenceGenotype(Variant variant, VariantStats stats, int alleleNumber) {
int gtSum = 0;
for (Integer gtCounts : stats.getGenotypeCount().values()) {
gtSum += gtCounts;
}
Genotype genotype = new Genotype("0/0", variant.getReference(), variant.getAlternate());
stats.addGenotype(genotype, alleleNumber / 2 - gtSum); // assuming diploid sample! be careful if you copy this code!
} | [
"private",
"static",
"void",
"addReferenceGenotype",
"(",
"Variant",
"variant",
",",
"VariantStats",
"stats",
",",
"int",
"alleleNumber",
")",
"{",
"int",
"gtSum",
"=",
"0",
";",
"for",
"(",
"Integer",
"gtCounts",
":",
"stats",
".",
"getGenotypeCount",
"(",
... | Infers the 0/0 genotype count, given that: sum(Heterozygous) + sum(Homozygous) + sum(Reference) = alleleNumber/2
@param variant to retrieve the alleles to construct the genotype
@param stats where to add the 0/0 genotype count
@param alleleNumber total sum of alleles. | [
"Infers",
"the",
"0",
"/",
"0",
"genotype",
"count",
"given",
"that",
":",
"sum",
"(",
"Heterozygous",
")",
"+",
"sum",
"(",
"Homozygous",
")",
"+",
"sum",
"(",
"Reference",
")",
"=",
"alleleNumber",
"/",
"2"
] | train | https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedExacStatsCalculator.java#L195-L202 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_ipCountryAvailable_GET | public ArrayList<OvhIpCountryEnum> serviceName_ipCountryAvailable_GET(String serviceName) throws IOException {
String qPath = "/dedicated/server/{serviceName}/ipCountryAvailable";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t14);
} | java | public ArrayList<OvhIpCountryEnum> serviceName_ipCountryAvailable_GET(String serviceName) throws IOException {
String qPath = "/dedicated/server/{serviceName}/ipCountryAvailable";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t14);
} | [
"public",
"ArrayList",
"<",
"OvhIpCountryEnum",
">",
"serviceName_ipCountryAvailable_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/server/{serviceName}/ipCountryAvailable\"",
";",
"StringBuilder",
"sb",
"=",
"pa... | Retrieve available country for IP order
REST: GET /dedicated/server/{serviceName}/ipCountryAvailable
@param serviceName [required] The internal name of your dedicated server | [
"Retrieve",
"available",
"country",
"for",
"IP",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1857-L1862 |
martint/jmxutils | src/main/java/org/weakref/jmx/ObjectNames.java | ObjectNames.generatedNameOf | public static String generatedNameOf(Class<?> clazz, Class<? extends Annotation> annotationClass)
{
return builder(clazz, annotationClass).build();
} | java | public static String generatedNameOf(Class<?> clazz, Class<? extends Annotation> annotationClass)
{
return builder(clazz, annotationClass).build();
} | [
"public",
"static",
"String",
"generatedNameOf",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationClass",
")",
"{",
"return",
"builder",
"(",
"clazz",
",",
"annotationClass",
")",
".",
"build",
"(",
")"... | Produce a generated JMX object name.
@return JMX object name of the form "[package_name]:type=[class_name],name=[ann_class_name]" | [
"Produce",
"a",
"generated",
"JMX",
"object",
"name",
"."
] | train | https://github.com/martint/jmxutils/blob/f2770ba1f3c126fb841c388d631456afd68dbf25/src/main/java/org/weakref/jmx/ObjectNames.java#L39-L42 |
jcuda/jcudnn | JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java | JCudnn.cudnnScaleTensor | public static int cudnnScaleTensor(
cudnnHandle handle,
cudnnTensorDescriptor yDesc,
Pointer y,
Pointer alpha)
{
return checkResult(cudnnScaleTensorNative(handle, yDesc, y, alpha));
} | java | public static int cudnnScaleTensor(
cudnnHandle handle,
cudnnTensorDescriptor yDesc,
Pointer y,
Pointer alpha)
{
return checkResult(cudnnScaleTensorNative(handle, yDesc, y, alpha));
} | [
"public",
"static",
"int",
"cudnnScaleTensor",
"(",
"cudnnHandle",
"handle",
",",
"cudnnTensorDescriptor",
"yDesc",
",",
"Pointer",
"y",
",",
"Pointer",
"alpha",
")",
"{",
"return",
"checkResult",
"(",
"cudnnScaleTensorNative",
"(",
"handle",
",",
"yDesc",
",",
... | Scale all values of a tensor by a given factor : y[i] = alpha * y[i] | [
"Scale",
"all",
"values",
"of",
"a",
"tensor",
"by",
"a",
"given",
"factor",
":",
"y",
"[",
"i",
"]",
"=",
"alpha",
"*",
"y",
"[",
"i",
"]"
] | train | https://github.com/jcuda/jcudnn/blob/ce71f2fc02817cecace51a80e6db5f0c7f10cffc/JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java#L706-L713 |
DDTH/ddth-tsc | ddth-tsc-core/src/main/java/com/github/ddth/tsc/cassandra/CassandraCounter.java | CassandraCounter._getRow | private Map<Long, DataPoint> _getRow(String counterName, int yyyymm, int dd) {
Map<Long, DataPoint> result = new HashMap<Long, DataPoint>();
ResultSet rs = CqlUtils.execute(sessionHelper.getSession(), cqlGetRow,
getConsistencyLevelForRead(), counterName, yyyymm, dd);
for (Iterator<Row> it = rs.iterator(); it.hasNext();) {
Row row = it.next();
long key = row.getLong(CqlTemplate.COL_COUNTER_TIMESTAMP);
long value = row.getLong(CqlTemplate.COL_COUNTER_VALUE);
DataPoint dp = new DataPoint(Type.SUM, key, value, RESOLUTION_MS);
result.put(key, dp);
}
return result;
} | java | private Map<Long, DataPoint> _getRow(String counterName, int yyyymm, int dd) {
Map<Long, DataPoint> result = new HashMap<Long, DataPoint>();
ResultSet rs = CqlUtils.execute(sessionHelper.getSession(), cqlGetRow,
getConsistencyLevelForRead(), counterName, yyyymm, dd);
for (Iterator<Row> it = rs.iterator(); it.hasNext();) {
Row row = it.next();
long key = row.getLong(CqlTemplate.COL_COUNTER_TIMESTAMP);
long value = row.getLong(CqlTemplate.COL_COUNTER_VALUE);
DataPoint dp = new DataPoint(Type.SUM, key, value, RESOLUTION_MS);
result.put(key, dp);
}
return result;
} | [
"private",
"Map",
"<",
"Long",
",",
"DataPoint",
">",
"_getRow",
"(",
"String",
"counterName",
",",
"int",
"yyyymm",
",",
"int",
"dd",
")",
"{",
"Map",
"<",
"Long",
",",
"DataPoint",
">",
"result",
"=",
"new",
"HashMap",
"<",
"Long",
",",
"DataPoint",
... | Gets all data points of a day.
@param counterName
@param yyyymm
@param dd
@return
@since 0.3.1.1 | [
"Gets",
"all",
"data",
"points",
"of",
"a",
"day",
"."
] | train | https://github.com/DDTH/ddth-tsc/blob/d233c304c8fed2f3c069de42a36b7bbd5c8be01b/ddth-tsc-core/src/main/java/com/github/ddth/tsc/cassandra/CassandraCounter.java#L278-L292 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java | GoogleMapShapeConverter.toPolyhedralSurfaceWithOptions | public PolyhedralSurface toPolyhedralSurfaceWithOptions(
MultiPolygonOptions multiPolygonOptions, boolean hasZ, boolean hasM) {
PolyhedralSurface polyhedralSurface = new PolyhedralSurface(hasZ, hasM);
for (PolygonOptions mapPolygon : multiPolygonOptions
.getPolygonOptions()) {
Polygon polygon = toPolygon(mapPolygon);
polyhedralSurface.addPolygon(polygon);
}
return polyhedralSurface;
} | java | public PolyhedralSurface toPolyhedralSurfaceWithOptions(
MultiPolygonOptions multiPolygonOptions, boolean hasZ, boolean hasM) {
PolyhedralSurface polyhedralSurface = new PolyhedralSurface(hasZ, hasM);
for (PolygonOptions mapPolygon : multiPolygonOptions
.getPolygonOptions()) {
Polygon polygon = toPolygon(mapPolygon);
polyhedralSurface.addPolygon(polygon);
}
return polyhedralSurface;
} | [
"public",
"PolyhedralSurface",
"toPolyhedralSurfaceWithOptions",
"(",
"MultiPolygonOptions",
"multiPolygonOptions",
",",
"boolean",
"hasZ",
",",
"boolean",
"hasM",
")",
"{",
"PolyhedralSurface",
"polyhedralSurface",
"=",
"new",
"PolyhedralSurface",
"(",
"hasZ",
",",
"hasM... | Convert a {@link MultiPolygonOptions} to a {@link PolyhedralSurface}
@param multiPolygonOptions multi polygon options
@param hasZ has z flag
@param hasM has m flag
@return polyhedral surface | [
"Convert",
"a",
"{",
"@link",
"MultiPolygonOptions",
"}",
"to",
"a",
"{",
"@link",
"PolyhedralSurface",
"}"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1253-L1265 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SignatureConverter.java | SignatureConverter.convertMethodSignature | public static String convertMethodSignature(XMethod xmethod) {
@DottedClassName
String className = xmethod.getClassName();
assert className.indexOf('/') == -1;
return convertMethodSignature(className, xmethod.getName(), xmethod.getSignature());
} | java | public static String convertMethodSignature(XMethod xmethod) {
@DottedClassName
String className = xmethod.getClassName();
assert className.indexOf('/') == -1;
return convertMethodSignature(className, xmethod.getName(), xmethod.getSignature());
} | [
"public",
"static",
"String",
"convertMethodSignature",
"(",
"XMethod",
"xmethod",
")",
"{",
"@",
"DottedClassName",
"String",
"className",
"=",
"xmethod",
".",
"getClassName",
"(",
")",
";",
"assert",
"className",
".",
"indexOf",
"(",
"'",
"'",
")",
"==",
"... | Convenience method for generating a method signature in human readable
form.
@param xmethod
an XMethod
@return the formatted version of that signature | [
"Convenience",
"method",
"for",
"generating",
"a",
"method",
"signature",
"in",
"human",
"readable",
"form",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SignatureConverter.java#L197-L202 |
JavaMoney/jsr354-api | src/main/java/javax/money/format/AmountFormatQueryBuilder.java | AmountFormatQueryBuilder.setMonetaryAmountFactory | public AmountFormatQueryBuilder setMonetaryAmountFactory(MonetaryAmountFactory<?> monetaryFactory) {
Objects.requireNonNull(monetaryFactory);
return set(MonetaryAmountFactory.class, monetaryFactory);
} | java | public AmountFormatQueryBuilder setMonetaryAmountFactory(MonetaryAmountFactory<?> monetaryFactory) {
Objects.requireNonNull(monetaryFactory);
return set(MonetaryAmountFactory.class, monetaryFactory);
} | [
"public",
"AmountFormatQueryBuilder",
"setMonetaryAmountFactory",
"(",
"MonetaryAmountFactory",
"<",
"?",
">",
"monetaryFactory",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"monetaryFactory",
")",
";",
"return",
"set",
"(",
"MonetaryAmountFactory",
".",
"class",
... | Sets the {@link javax.money.MonetaryAmountFactory} to be used to of amounts during parsing.
@param monetaryFactory the {@link javax.money.MonetaryAmountFactory} to be used, not null.
@return this builder for chaining. | [
"Sets",
"the",
"{",
"@link",
"javax",
".",
"money",
".",
"MonetaryAmountFactory",
"}",
"to",
"be",
"used",
"to",
"of",
"amounts",
"during",
"parsing",
"."
] | train | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/format/AmountFormatQueryBuilder.java#L105-L108 |
Crab2died/Excel4J | src/main/java/com/github/crab2died/ExcelUtils.java | ExcelUtils.mapSheet2Excel | public void mapSheet2Excel(List<MapSheetWrapper> sheetWrappers, String templatePath, String targetPath)
throws Excel4JException {
try (SheetTemplate sheetTemplate = exportExcelByMapHandler(sheetWrappers, templatePath)) {
sheetTemplate.write2File(targetPath);
} catch (IOException e) {
throw new Excel4JException(e);
}
} | java | public void mapSheet2Excel(List<MapSheetWrapper> sheetWrappers, String templatePath, String targetPath)
throws Excel4JException {
try (SheetTemplate sheetTemplate = exportExcelByMapHandler(sheetWrappers, templatePath)) {
sheetTemplate.write2File(targetPath);
} catch (IOException e) {
throw new Excel4JException(e);
}
} | [
"public",
"void",
"mapSheet2Excel",
"(",
"List",
"<",
"MapSheetWrapper",
">",
"sheetWrappers",
",",
"String",
"templatePath",
",",
"String",
"targetPath",
")",
"throws",
"Excel4JException",
"{",
"try",
"(",
"SheetTemplate",
"sheetTemplate",
"=",
"exportExcelByMapHandl... | 基于模板、注解的多sheet导出{@code Map[String, List[?]]}类型数据
模板定制详见定制说明
@param sheetWrappers sheet包装类
@param templatePath Excel模板
@param targetPath 导出Excel路径
@throws Excel4JException 异常 | [
"基于模板、注解的多sheet导出",
"{",
"@code",
"Map",
"[",
"String",
"List",
"[",
"?",
"]]",
"}",
"类型数据",
"模板定制详见定制说明"
] | train | https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L887-L895 |
huangp/entityunit | src/main/java/com/github/huangp/entityunit/entity/EntityMakerBuilder.java | EntityMakerBuilder.reuseEntities | public EntityMakerBuilder reuseEntities(Object first, Object second, Object... rest) {
List<Object> objects = ImmutableList.builder().add(first).add(second).add(rest).build();
return reuseEntities(objects);
} | java | public EntityMakerBuilder reuseEntities(Object first, Object second, Object... rest) {
List<Object> objects = ImmutableList.builder().add(first).add(second).add(rest).build();
return reuseEntities(objects);
} | [
"public",
"EntityMakerBuilder",
"reuseEntities",
"(",
"Object",
"first",
",",
"Object",
"second",
",",
"Object",
"...",
"rest",
")",
"{",
"List",
"<",
"Object",
">",
"objects",
"=",
"ImmutableList",
".",
"builder",
"(",
")",
".",
"add",
"(",
"first",
")",
... | Reuse entities.
@param first
first
@param second
second
@param rest
rest of reusable entities as var args
@return this | [
"Reuse",
"entities",
"."
] | train | https://github.com/huangp/entityunit/blob/1a09b530149d707dbff7ff46f5428d9db709a4b4/src/main/java/com/github/huangp/entityunit/entity/EntityMakerBuilder.java#L102-L105 |
dita-ot/dita-ot | src/main/java/org/dita/dost/module/GenMapAndTopicListModule.java | GenMapAndTopicListModule.writeListFile | private void writeListFile(final File inputfile, final String relativeRootFile) {
try (Writer bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(inputfile)))) {
bufferedWriter.write(relativeRootFile);
bufferedWriter.flush();
} catch (final IOException e) {
logger.error(e.getMessage(), e) ;
}
} | java | private void writeListFile(final File inputfile, final String relativeRootFile) {
try (Writer bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(inputfile)))) {
bufferedWriter.write(relativeRootFile);
bufferedWriter.flush();
} catch (final IOException e) {
logger.error(e.getMessage(), e) ;
}
} | [
"private",
"void",
"writeListFile",
"(",
"final",
"File",
"inputfile",
",",
"final",
"String",
"relativeRootFile",
")",
"{",
"try",
"(",
"Writer",
"bufferedWriter",
"=",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"new",
"FileOutputStream",
"("... | Write list file.
@param inputfile output list file
@param relativeRootFile list value | [
"Write",
"list",
"file",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/GenMapAndTopicListModule.java#L864-L871 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java | Unchecked.doubleSupplier | public static DoubleSupplier doubleSupplier(CheckedDoubleSupplier supplier, Consumer<Throwable> handler) {
return () -> {
try {
return supplier.getAsDouble();
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | java | public static DoubleSupplier doubleSupplier(CheckedDoubleSupplier supplier, Consumer<Throwable> handler) {
return () -> {
try {
return supplier.getAsDouble();
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | [
"public",
"static",
"DoubleSupplier",
"doubleSupplier",
"(",
"CheckedDoubleSupplier",
"supplier",
",",
"Consumer",
"<",
"Throwable",
">",
"handler",
")",
"{",
"return",
"(",
")",
"->",
"{",
"try",
"{",
"return",
"supplier",
".",
"getAsDouble",
"(",
")",
";",
... | Wrap a {@link CheckedDoubleSupplier} in a {@link DoubleSupplier} with a custom handler for checked exceptions.
<p>
Example:
<code><pre>
ResultSet rs = statement.executeQuery();
Stream.generate(Unchecked.doubleSupplier(
() -> rs.getDouble(1),
e -> {
throw new IllegalStateException(e);
}
));
</pre></code> | [
"Wrap",
"a",
"{",
"@link",
"CheckedDoubleSupplier",
"}",
"in",
"a",
"{",
"@link",
"DoubleSupplier",
"}",
"with",
"a",
"custom",
"handler",
"for",
"checked",
"exceptions",
".",
"<p",
">",
"Example",
":",
"<code",
">",
"<pre",
">",
"ResultSet",
"rs",
"=",
... | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L1815-L1826 |
mikepenz/MaterialDrawer | library/src/main/java/com/mikepenz/materialdrawer/Drawer.java | Drawer.setItems | private void setItems(@NonNull List<IDrawerItem> drawerItems, boolean switchedItems) {
//if we are currently at a switched list set the new reference
if (originalDrawerItems != null && !switchedItems) {
originalDrawerItems = drawerItems;
}
mDrawerBuilder.getItemAdapter().setNewList(drawerItems);
} | java | private void setItems(@NonNull List<IDrawerItem> drawerItems, boolean switchedItems) {
//if we are currently at a switched list set the new reference
if (originalDrawerItems != null && !switchedItems) {
originalDrawerItems = drawerItems;
}
mDrawerBuilder.getItemAdapter().setNewList(drawerItems);
} | [
"private",
"void",
"setItems",
"(",
"@",
"NonNull",
"List",
"<",
"IDrawerItem",
">",
"drawerItems",
",",
"boolean",
"switchedItems",
")",
"{",
"//if we are currently at a switched list set the new reference",
"if",
"(",
"originalDrawerItems",
"!=",
"null",
"&&",
"!",
... | replace the current DrawerItems with the new ArrayList.
@param drawerItems
@param switchedItems | [
"replace",
"the",
"current",
"DrawerItems",
"with",
"the",
"new",
"ArrayList",
"."
] | train | https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/Drawer.java#L821-L827 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/models/BoxUploadSession.java | BoxUploadSession.getChunkSize | public static int getChunkSize(BoxUploadSession uploadSession, int partNumber, long fileSize) {
if (partNumber == uploadSession.getTotalParts() - 1) {
return (int) (fileSize - partNumber * uploadSession.getPartSize());
}
return uploadSession.getPartSize();
} | java | public static int getChunkSize(BoxUploadSession uploadSession, int partNumber, long fileSize) {
if (partNumber == uploadSession.getTotalParts() - 1) {
return (int) (fileSize - partNumber * uploadSession.getPartSize());
}
return uploadSession.getPartSize();
} | [
"public",
"static",
"int",
"getChunkSize",
"(",
"BoxUploadSession",
"uploadSession",
",",
"int",
"partNumber",
",",
"long",
"fileSize",
")",
"{",
"if",
"(",
"partNumber",
"==",
"uploadSession",
".",
"getTotalParts",
"(",
")",
"-",
"1",
")",
"{",
"return",
"(... | Computes the actual bytes to be sent in a part, which equals the partsize for all parts
except the last.
@param uploadSession
@param partNumber
@param fileSize
@return | [
"Computes",
"the",
"actual",
"bytes",
"to",
"be",
"sent",
"in",
"a",
"part",
"which",
"equals",
"the",
"partsize",
"for",
"all",
"parts",
"except",
"the",
"last",
"."
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/models/BoxUploadSession.java#L160-L165 |
alkacon/opencms-core | src/org/opencms/search/CmsSearchIndex.java | CmsSearchIndex.extendPathFilter | protected void extendPathFilter(List<Term> terms, String searchRoot) {
if (!CmsResource.isFolder(searchRoot)) {
searchRoot += "/";
}
terms.add(new Term(CmsSearchField.FIELD_PARENT_FOLDERS, searchRoot));
} | java | protected void extendPathFilter(List<Term> terms, String searchRoot) {
if (!CmsResource.isFolder(searchRoot)) {
searchRoot += "/";
}
terms.add(new Term(CmsSearchField.FIELD_PARENT_FOLDERS, searchRoot));
} | [
"protected",
"void",
"extendPathFilter",
"(",
"List",
"<",
"Term",
">",
"terms",
",",
"String",
"searchRoot",
")",
"{",
"if",
"(",
"!",
"CmsResource",
".",
"isFolder",
"(",
"searchRoot",
")",
")",
"{",
"searchRoot",
"+=",
"\"/\"",
";",
"}",
"terms",
".",... | Extends the given path query with another term for the given search root element.<p>
@param terms the path filter to extend
@param searchRoot the search root to add to the path query | [
"Extends",
"the",
"given",
"path",
"query",
"with",
"another",
"term",
"for",
"the",
"given",
"search",
"root",
"element",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchIndex.java#L1593-L1599 |
landawn/AbacusUtil | src/com/landawn/abacus/android/util/SQLiteExecutor.java | SQLiteExecutor.exists | @SafeVarargs
public final boolean exists(String sql, Object... parameters) {
final Cursor cursor = rawQuery(sql, parameters);
try {
return cursor.moveToNext();
} finally {
cursor.close();
}
} | java | @SafeVarargs
public final boolean exists(String sql, Object... parameters) {
final Cursor cursor = rawQuery(sql, parameters);
try {
return cursor.moveToNext();
} finally {
cursor.close();
}
} | [
"@",
"SafeVarargs",
"public",
"final",
"boolean",
"exists",
"(",
"String",
"sql",
",",
"Object",
"...",
"parameters",
")",
"{",
"final",
"Cursor",
"cursor",
"=",
"rawQuery",
"(",
"sql",
",",
"parameters",
")",
";",
"try",
"{",
"return",
"cursor",
".",
"m... | Remember to add {@code limit} condition if big result will be returned by the query.
@param sql
@param parameters A Object Array/List, and Map/Entity with getter/setter methods for parameterized sql with named parameters
@return | [
"Remember",
"to",
"add",
"{",
"@code",
"limit",
"}",
"condition",
"if",
"big",
"result",
"will",
"be",
"returned",
"by",
"the",
"query",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/android/util/SQLiteExecutor.java#L1251-L1260 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/TraceNLSResolver.java | TraceNLSResolver.logEvent | protected final static void logEvent(String message, Object[] args) {
if (getInstance().makeNoise && tc.isEventEnabled()) {
if (args == null)
com.ibm.websphere.ras.Tr.event(tc, message);
else
com.ibm.websphere.ras.Tr.event(tc, MessageFormat.format(message, args));
}
} | java | protected final static void logEvent(String message, Object[] args) {
if (getInstance().makeNoise && tc.isEventEnabled()) {
if (args == null)
com.ibm.websphere.ras.Tr.event(tc, message);
else
com.ibm.websphere.ras.Tr.event(tc, MessageFormat.format(message, args));
}
} | [
"protected",
"final",
"static",
"void",
"logEvent",
"(",
"String",
"message",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"getInstance",
"(",
")",
".",
"makeNoise",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"if",
"(",
"args",
"... | Common method to use Tr to log that something above couldn't be resolved.
This method further checks whether or not the
<code>com.ibm.ejs.ras.debugTraceNLSResolver</code> property has been set
before calling Tr to log the event.
@param message
Event message
@param args
Parameters for message formatter | [
"Common",
"method",
"to",
"use",
"Tr",
"to",
"log",
"that",
"something",
"above",
"couldn",
"t",
"be",
"resolved",
".",
"This",
"method",
"further",
"checks",
"whether",
"or",
"not",
"the",
"<code",
">",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/TraceNLSResolver.java#L437-L444 |
datacleaner/DataCleaner | desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphMouseListener.java | JobGraphMouseListener.onComponentRightClicked | public void onComponentRightClicked(final ComponentBuilder componentBuilder, final MouseEvent me) {
final boolean isMultiStream = componentBuilder.getDescriptor().isMultiStreamComponent();
final JPopupMenu popup = new JPopupMenu();
final JMenuItem configureComponentMenuItem = new JMenuItem("Configure ...",
ImageManager.get().getImageIcon(IconUtils.MENU_OPTIONS, IconUtils.ICON_SIZE_SMALL));
configureComponentMenuItem.addActionListener(e -> _actions.showConfigurationDialog(componentBuilder));
popup.add(configureComponentMenuItem);
if (!isMultiStream && componentBuilder instanceof InputColumnSourceJob
|| componentBuilder instanceof HasFilterOutcomes) {
popup.add(createLinkMenuItem(componentBuilder));
}
for (final OutputDataStream dataStream : componentBuilder.getOutputDataStreams()) {
final JobGraphLinkPainter.VertexContext vertexContext =
new JobGraphLinkPainter.VertexContext(componentBuilder,
componentBuilder.getOutputDataStreamJobBuilder(dataStream), dataStream);
popup.add(createLinkMenuItem(vertexContext));
}
final Icon renameIcon = ImageManager.get().getImageIcon(IconUtils.ACTION_RENAME, IconUtils.ICON_SIZE_SMALL);
final JMenuItem renameMenuItem = WidgetFactory.createMenuItem("Rename component", renameIcon);
renameMenuItem.addActionListener(new DefaultRenameComponentActionListener(componentBuilder, _graphContext));
popup.add(renameMenuItem);
if (!isMultiStream && componentBuilder instanceof TransformerComponentBuilder) {
final TransformerComponentBuilder<?> tjb = (TransformerComponentBuilder<?>) componentBuilder;
final JMenuItem previewMenuItem = new JMenuItem("Preview data",
ImageManager.get().getImageIcon(IconUtils.ACTION_PREVIEW, IconUtils.ICON_SIZE_SMALL));
previewMenuItem.addActionListener(new PreviewTransformedDataActionListener(_windowContext, tjb));
previewMenuItem.setEnabled(componentBuilder.isConfigured());
popup.add(previewMenuItem);
}
if (ChangeRequirementMenu.isRelevant(componentBuilder)) {
popup.add(new ChangeRequirementMenu(componentBuilder));
}
popup.addSeparator();
popup.add(new RemoveComponentMenuItem(componentBuilder));
popup.show(_graphContext.getVisualizationViewer(), me.getX(), me.getY());
} | java | public void onComponentRightClicked(final ComponentBuilder componentBuilder, final MouseEvent me) {
final boolean isMultiStream = componentBuilder.getDescriptor().isMultiStreamComponent();
final JPopupMenu popup = new JPopupMenu();
final JMenuItem configureComponentMenuItem = new JMenuItem("Configure ...",
ImageManager.get().getImageIcon(IconUtils.MENU_OPTIONS, IconUtils.ICON_SIZE_SMALL));
configureComponentMenuItem.addActionListener(e -> _actions.showConfigurationDialog(componentBuilder));
popup.add(configureComponentMenuItem);
if (!isMultiStream && componentBuilder instanceof InputColumnSourceJob
|| componentBuilder instanceof HasFilterOutcomes) {
popup.add(createLinkMenuItem(componentBuilder));
}
for (final OutputDataStream dataStream : componentBuilder.getOutputDataStreams()) {
final JobGraphLinkPainter.VertexContext vertexContext =
new JobGraphLinkPainter.VertexContext(componentBuilder,
componentBuilder.getOutputDataStreamJobBuilder(dataStream), dataStream);
popup.add(createLinkMenuItem(vertexContext));
}
final Icon renameIcon = ImageManager.get().getImageIcon(IconUtils.ACTION_RENAME, IconUtils.ICON_SIZE_SMALL);
final JMenuItem renameMenuItem = WidgetFactory.createMenuItem("Rename component", renameIcon);
renameMenuItem.addActionListener(new DefaultRenameComponentActionListener(componentBuilder, _graphContext));
popup.add(renameMenuItem);
if (!isMultiStream && componentBuilder instanceof TransformerComponentBuilder) {
final TransformerComponentBuilder<?> tjb = (TransformerComponentBuilder<?>) componentBuilder;
final JMenuItem previewMenuItem = new JMenuItem("Preview data",
ImageManager.get().getImageIcon(IconUtils.ACTION_PREVIEW, IconUtils.ICON_SIZE_SMALL));
previewMenuItem.addActionListener(new PreviewTransformedDataActionListener(_windowContext, tjb));
previewMenuItem.setEnabled(componentBuilder.isConfigured());
popup.add(previewMenuItem);
}
if (ChangeRequirementMenu.isRelevant(componentBuilder)) {
popup.add(new ChangeRequirementMenu(componentBuilder));
}
popup.addSeparator();
popup.add(new RemoveComponentMenuItem(componentBuilder));
popup.show(_graphContext.getVisualizationViewer(), me.getX(), me.getY());
} | [
"public",
"void",
"onComponentRightClicked",
"(",
"final",
"ComponentBuilder",
"componentBuilder",
",",
"final",
"MouseEvent",
"me",
")",
"{",
"final",
"boolean",
"isMultiStream",
"=",
"componentBuilder",
".",
"getDescriptor",
"(",
")",
".",
"isMultiStreamComponent",
... | Invoked when a component is right-clicked
@param componentBuilder
@param me | [
"Invoked",
"when",
"a",
"component",
"is",
"right",
"-",
"clicked"
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphMouseListener.java#L144-L186 |
alkacon/opencms-core | src/org/opencms/widgets/CmsHtmlWidget.java | CmsHtmlWidget.getEditorWidget | private I_CmsWidget getEditorWidget(CmsObject cms, I_CmsWidgetDialog widgetDialog) {
if (m_editorWidget == null) {
// get HTML widget to use from editor manager
String widgetClassName = OpenCms.getWorkplaceManager().getWorkplaceEditorManager().getWidgetEditor(
cms.getRequestContext(),
widgetDialog.getUserAgent());
boolean foundWidget = true;
if (CmsStringUtil.isEmpty(widgetClassName)) {
// no installed widget found, use default text area to edit HTML value
widgetClassName = CmsTextareaWidget.class.getName();
foundWidget = false;
}
try {
if (foundWidget) {
// get widget instance and set the widget configuration
Class<?> widgetClass = Class.forName(widgetClassName);
A_CmsHtmlWidget editorWidget = (A_CmsHtmlWidget)widgetClass.newInstance();
editorWidget.setHtmlWidgetOption(getHtmlWidgetOption());
m_editorWidget = editorWidget;
} else {
// set the text area to display 15 rows for editing
Class<?> widgetClass = Class.forName(widgetClassName);
I_CmsWidget editorWidget = (I_CmsWidget)widgetClass.newInstance();
editorWidget.setConfiguration("15");
m_editorWidget = editorWidget;
}
} catch (Exception e) {
// failed to create widget instance
LOG.error(
Messages.get().container(Messages.LOG_CREATE_HTMLWIDGET_INSTANCE_FAILED_1, widgetClassName).key());
}
}
return m_editorWidget;
} | java | private I_CmsWidget getEditorWidget(CmsObject cms, I_CmsWidgetDialog widgetDialog) {
if (m_editorWidget == null) {
// get HTML widget to use from editor manager
String widgetClassName = OpenCms.getWorkplaceManager().getWorkplaceEditorManager().getWidgetEditor(
cms.getRequestContext(),
widgetDialog.getUserAgent());
boolean foundWidget = true;
if (CmsStringUtil.isEmpty(widgetClassName)) {
// no installed widget found, use default text area to edit HTML value
widgetClassName = CmsTextareaWidget.class.getName();
foundWidget = false;
}
try {
if (foundWidget) {
// get widget instance and set the widget configuration
Class<?> widgetClass = Class.forName(widgetClassName);
A_CmsHtmlWidget editorWidget = (A_CmsHtmlWidget)widgetClass.newInstance();
editorWidget.setHtmlWidgetOption(getHtmlWidgetOption());
m_editorWidget = editorWidget;
} else {
// set the text area to display 15 rows for editing
Class<?> widgetClass = Class.forName(widgetClassName);
I_CmsWidget editorWidget = (I_CmsWidget)widgetClass.newInstance();
editorWidget.setConfiguration("15");
m_editorWidget = editorWidget;
}
} catch (Exception e) {
// failed to create widget instance
LOG.error(
Messages.get().container(Messages.LOG_CREATE_HTMLWIDGET_INSTANCE_FAILED_1, widgetClassName).key());
}
}
return m_editorWidget;
} | [
"private",
"I_CmsWidget",
"getEditorWidget",
"(",
"CmsObject",
"cms",
",",
"I_CmsWidgetDialog",
"widgetDialog",
")",
"{",
"if",
"(",
"m_editorWidget",
"==",
"null",
")",
"{",
"// get HTML widget to use from editor manager",
"String",
"widgetClassName",
"=",
"OpenCms",
"... | Returns the editor widget to use depending on the current users settings, current browser and installed editors.<p>
@param cms the current CmsObject
@param widgetDialog the dialog where the widget is used on
@return the editor widget to use depending on the current users settings, current browser and installed editors | [
"Returns",
"the",
"editor",
"widget",
"to",
"use",
"depending",
"on",
"the",
"current",
"users",
"settings",
"current",
"browser",
"and",
"installed",
"editors",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/CmsHtmlWidget.java#L474-L509 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java | SDMath.cosineDistance | public SDVariable cosineDistance(String name, SDVariable x, SDVariable y, int... dimensions) {
validateNumerical("cosine distance", x, y);
SDVariable result = f().cosineDistance(x, y, dimensions);
return updateVariableNameAndReference(result, name);
} | java | public SDVariable cosineDistance(String name, SDVariable x, SDVariable y, int... dimensions) {
validateNumerical("cosine distance", x, y);
SDVariable result = f().cosineDistance(x, y, dimensions);
return updateVariableNameAndReference(result, name);
} | [
"public",
"SDVariable",
"cosineDistance",
"(",
"String",
"name",
",",
"SDVariable",
"x",
",",
"SDVariable",
"y",
",",
"int",
"...",
"dimensions",
")",
"{",
"validateNumerical",
"(",
"\"cosine distance\"",
",",
"x",
",",
"y",
")",
";",
"SDVariable",
"result",
... | Cosine distance reduction operation. The output contains the cosine distance for each
tensor/subset along the specified dimensions:<br>
out = 1.0 - cosineSimilarity(x,y)<br>
See {@link #cosineSimilarity(String, SDVariable, SDVariable, int...)}
@param name Name of the output variable
@param x Input variable x
@param y Input variable y
@param dimensions Dimensions to calculate cosine similarity over
@return Output variable | [
"Cosine",
"distance",
"reduction",
"operation",
".",
"The",
"output",
"contains",
"the",
"cosine",
"distance",
"for",
"each",
"tensor",
"/",
"subset",
"along",
"the",
"specified",
"dimensions",
":",
"<br",
">",
"out",
"=",
"1",
".",
"0",
"-",
"cosineSimilari... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L655-L659 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java | AppServicePlansInner.createOrUpdateAsync | public Observable<AppServicePlanInner> createOrUpdateAsync(String resourceGroupName, String name, AppServicePlanInner appServicePlan) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, appServicePlan).map(new Func1<ServiceResponse<AppServicePlanInner>, AppServicePlanInner>() {
@Override
public AppServicePlanInner call(ServiceResponse<AppServicePlanInner> response) {
return response.body();
}
});
} | java | public Observable<AppServicePlanInner> createOrUpdateAsync(String resourceGroupName, String name, AppServicePlanInner appServicePlan) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, appServicePlan).map(new Func1<ServiceResponse<AppServicePlanInner>, AppServicePlanInner>() {
@Override
public AppServicePlanInner call(ServiceResponse<AppServicePlanInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AppServicePlanInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"AppServicePlanInner",
"appServicePlan",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
"... | Creates or updates an App Service Plan.
Creates or updates an App Service Plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@param appServicePlan Details of the App Service plan.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"an",
"App",
"Service",
"Plan",
".",
"Creates",
"or",
"updates",
"an",
"App",
"Service",
"Plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L704-L711 |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/ngmf/util/cosu/Efficiencies.java | Efficiencies.nashSutcliffe | public static double nashSutcliffe(double[] obs, double[] sim, double pow) {
sameArrayLen(obs, sim);
int pre_size = sim.length;
int steps = pre_size;
double sum_td = 0;
double sum_vd = 0;
/**summing up both data sets */
for (int i = 0; i < steps; i++) {
sum_td = sum_td + sim[i];
sum_vd = sum_vd + obs[i];
}
/** calculating mean values for both data sets */
double mean_vd = sum_vd / steps;
/** calculating mean pow deviations */
double td_vd = 0;
double vd_mean = 0;
for (int i = 0; i < steps; i++) {
td_vd = td_vd + (Math.pow((Math.abs(obs[i] - sim[i])), pow));
vd_mean = vd_mean + (Math.pow((Math.abs(obs[i] - mean_vd)), pow));
}
return 1 - (td_vd / vd_mean);
} | java | public static double nashSutcliffe(double[] obs, double[] sim, double pow) {
sameArrayLen(obs, sim);
int pre_size = sim.length;
int steps = pre_size;
double sum_td = 0;
double sum_vd = 0;
/**summing up both data sets */
for (int i = 0; i < steps; i++) {
sum_td = sum_td + sim[i];
sum_vd = sum_vd + obs[i];
}
/** calculating mean values for both data sets */
double mean_vd = sum_vd / steps;
/** calculating mean pow deviations */
double td_vd = 0;
double vd_mean = 0;
for (int i = 0; i < steps; i++) {
td_vd = td_vd + (Math.pow((Math.abs(obs[i] - sim[i])), pow));
vd_mean = vd_mean + (Math.pow((Math.abs(obs[i] - mean_vd)), pow));
}
return 1 - (td_vd / vd_mean);
} | [
"public",
"static",
"double",
"nashSutcliffe",
"(",
"double",
"[",
"]",
"obs",
",",
"double",
"[",
"]",
"sim",
",",
"double",
"pow",
")",
"{",
"sameArrayLen",
"(",
"obs",
",",
"sim",
")",
";",
"int",
"pre_size",
"=",
"sim",
".",
"length",
";",
"int",... | Calculates the efficiency between a test data set and a verification data set
after Nash & Sutcliffe (1970). The efficiency is described as the proportion of
the cumulated cubic deviation between both data sets and the cumulated cubic
deviation between the verification data set and its mean value.
@param sim the simulation data set
@param obs the validation (observed) data set
@param pow the power for the deviation terms
@return the calculated efficiency or -9999 if an error occurs | [
"Calculates",
"the",
"efficiency",
"between",
"a",
"test",
"data",
"set",
"and",
"a",
"verification",
"data",
"set",
"after",
"Nash",
"&",
"Sutcliffe",
"(",
"1970",
")",
".",
"The",
"efficiency",
"is",
"described",
"as",
"the",
"proportion",
"of",
"the",
"... | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/ngmf/util/cosu/Efficiencies.java#L41-L67 |
plume-lib/options | src/main/java/org/plumelib/options/Options.java | Options.settings | public String settings(boolean showUnpublicized) {
StringJoiner out = new StringJoiner(lineSeparator);
// Determine the length of the longest name
int maxLength = maxOptionLength(options, showUnpublicized);
// Create the settings string
for (OptionInfo oi : options) {
@SuppressWarnings("formatter") // format string computed from maxLength
String use = String.format("%-" + maxLength + "s = ", oi.longName);
try {
use += oi.field.get(oi.obj);
} catch (Exception e) {
throw new Error("unexpected exception reading field " + oi.field, e);
}
out.add(use);
}
return out.toString();
} | java | public String settings(boolean showUnpublicized) {
StringJoiner out = new StringJoiner(lineSeparator);
// Determine the length of the longest name
int maxLength = maxOptionLength(options, showUnpublicized);
// Create the settings string
for (OptionInfo oi : options) {
@SuppressWarnings("formatter") // format string computed from maxLength
String use = String.format("%-" + maxLength + "s = ", oi.longName);
try {
use += oi.field.get(oi.obj);
} catch (Exception e) {
throw new Error("unexpected exception reading field " + oi.field, e);
}
out.add(use);
}
return out.toString();
} | [
"public",
"String",
"settings",
"(",
"boolean",
"showUnpublicized",
")",
"{",
"StringJoiner",
"out",
"=",
"new",
"StringJoiner",
"(",
"lineSeparator",
")",
";",
"// Determine the length of the longest name",
"int",
"maxLength",
"=",
"maxOptionLength",
"(",
"options",
... | Returns a string containing the current setting for each option, in command-line format that
can be parsed by Options. Contains every known option even if the option was not specified on
the command line. Never contains duplicates.
@param showUnpublicized if true, treat all unpublicized options and option groups as publicized
@return a command line that can be tokenized with {@link #tokenize}, containing the current
setting for each option | [
"Returns",
"a",
"string",
"containing",
"the",
"current",
"setting",
"for",
"each",
"option",
"in",
"command",
"-",
"line",
"format",
"that",
"can",
"be",
"parsed",
"by",
"Options",
".",
"Contains",
"every",
"known",
"option",
"even",
"if",
"the",
"option",
... | train | https://github.com/plume-lib/options/blob/1bdd0ac7a1794bdf9dd373e279f69d43395154f0/src/main/java/org/plumelib/options/Options.java#L1533-L1552 |
deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/base/Preconditions.java | Preconditions.checkArgument | public static void checkArgument(boolean b, String message, Object... args) {
if (!b) {
throwEx(message, args);
}
} | java | public static void checkArgument(boolean b, String message, Object... args) {
if (!b) {
throwEx(message, args);
}
} | [
"public",
"static",
"void",
"checkArgument",
"(",
"boolean",
"b",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"!",
"b",
")",
"{",
"throwEx",
"(",
"message",
",",
"args",
")",
";",
"}",
"}"
] | Check the specified boolean argument. Throws an IllegalArgumentException with the specified message if {@code b} is false.
Note that the message may specify argument locations using "%s" - for example,
{@code checkArgument(false, "Got %s values, expected %s", 3, "more"} would throw an IllegalArgumentException
with the message "Got 3 values, expected more"
@param b Argument to check
@param message Message for exception. May be null.
@param args Arguments to place in message | [
"Check",
"the",
"specified",
"boolean",
"argument",
".",
"Throws",
"an",
"IllegalArgumentException",
"with",
"the",
"specified",
"message",
"if",
"{",
"@code",
"b",
"}",
"is",
"false",
".",
"Note",
"that",
"the",
"message",
"may",
"specify",
"argument",
"locat... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/base/Preconditions.java#L242-L246 |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/style/stylers/AbstractStyler.java | AbstractStyler.shouldStyle | @Override
public boolean shouldStyle(Object data, Object element) {
for (StylingCondition sc : conditions) {
if (!sc.shouldStyle(data, null)) {
return false;
}
}
return true;
} | java | @Override
public boolean shouldStyle(Object data, Object element) {
for (StylingCondition sc : conditions) {
if (!sc.shouldStyle(data, null)) {
return false;
}
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"shouldStyle",
"(",
"Object",
"data",
",",
"Object",
"element",
")",
"{",
"for",
"(",
"StylingCondition",
"sc",
":",
"conditions",
")",
"{",
"if",
"(",
"!",
"sc",
".",
"shouldStyle",
"(",
"data",
",",
"null",
")",
... | returns false when a condition is present for which {@link StylingCondition#shouldStyle(java.lang.Object, java.lang.Object)
}
is false
@param data
@param element the value of element
@return | [
"returns",
"false",
"when",
"a",
"condition",
"is",
"present",
"for",
"which",
"{",
"@link",
"StylingCondition#shouldStyle",
"(",
"java",
".",
"lang",
".",
"Object",
"java",
".",
"lang",
".",
"Object",
")",
"}",
"is",
"false"
] | train | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/style/stylers/AbstractStyler.java#L170-L178 |
op4j/op4j | src/main/java/org/op4j/functions/FnNumber.java | FnNumber.toCurrencyStr | public static final Function<Number,String> toCurrencyStr(Locale locale) {
return new ToString(NumberFormatType.CURRENCY, locale);
} | java | public static final Function<Number,String> toCurrencyStr(Locale locale) {
return new ToString(NumberFormatType.CURRENCY, locale);
} | [
"public",
"static",
"final",
"Function",
"<",
"Number",
",",
"String",
">",
"toCurrencyStr",
"(",
"Locale",
"locale",
")",
"{",
"return",
"new",
"ToString",
"(",
"NumberFormatType",
".",
"CURRENCY",
",",
"locale",
")",
";",
"}"
] | <p>
It returns the {@link String} representation of the target as a currency in the
given {@link Locale}
</p>
@param locale the {@link Locale} to be used
@return the {@link String} representation of the input as a currency | [
"<p",
">",
"It",
"returns",
"the",
"{",
"@link",
"String",
"}",
"representation",
"of",
"the",
"target",
"as",
"a",
"currency",
"in",
"the",
"given",
"{",
"@link",
"Locale",
"}",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnNumber.java#L615-L617 |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/Controller.java | Controller.multipartFormItems | protected MultiList<FormItem> multipartFormItems(String encoding) {
if (!context.isRequestMultiPart())
throw new MediaTypeException("this is not a multipart request, be sure to add this attribute to the form: ... enctype=\"multipart/form-data\" ...");
MultiList<FormItem> parts = new MultiList<>();
try {
context.parseRequestMultiPartItems(encoding)
.ifPresent(items -> {
for (FormItem item : items) {
parts.put(item.getFieldName(), item);
}
});
} catch (Exception e) {
e.printStackTrace();
throw new ControllerException(e);
}
return parts;
} | java | protected MultiList<FormItem> multipartFormItems(String encoding) {
if (!context.isRequestMultiPart())
throw new MediaTypeException("this is not a multipart request, be sure to add this attribute to the form: ... enctype=\"multipart/form-data\" ...");
MultiList<FormItem> parts = new MultiList<>();
try {
context.parseRequestMultiPartItems(encoding)
.ifPresent(items -> {
for (FormItem item : items) {
parts.put(item.getFieldName(), item);
}
});
} catch (Exception e) {
e.printStackTrace();
throw new ControllerException(e);
}
return parts;
} | [
"protected",
"MultiList",
"<",
"FormItem",
">",
"multipartFormItems",
"(",
"String",
"encoding",
")",
"{",
"if",
"(",
"!",
"context",
".",
"isRequestMultiPart",
"(",
")",
")",
"throw",
"new",
"MediaTypeException",
"(",
"\"this is not a multipart request, be sure to ad... | Returns a collection of uploaded files and form fields from a multi-part request.
This method uses <a href="http://commons.apache.org/proper/commons-fileupload/apidocs/org/apache/commons/fileupload/disk/DiskFileItemFactory.html">DiskFileItemFactory</a>.
As a result, it is recommended to add the following to your web.xml file:
<pre>
<listener>
<listener-class>
org.apache.commons.fileupload.servlet.FileCleanerCleanup
</listener-class>
</listener>
</pre>
For more information, see: <a href="http://commons.apache.org/proper/commons-fileupload/using.html">Using FileUpload</a>
The size of upload defaults to max of 20mb. Files greater than that will be rejected. If you want to accept files
smaller of larger, create a file called <code>activeweb.properties</code>, add it to your classpath and
place this property to the file:
<pre>
#max upload size
maxUploadSize = 20000000
</pre>
MTD: changed to Map<String, List<FormItem>> instead of Map<String, FormItem>
@param encoding specifies the character encoding to be used when reading the headers of individual part.
When not specified, or null, the request encoding is used. If that is also not specified, or null,
the platform default encoding is used.
@return a collection of uploaded files from a multi-part request. | [
"Returns",
"a",
"collection",
"of",
"uploaded",
"files",
"and",
"form",
"fields",
"from",
"a",
"multi",
"-",
"part",
"request",
".",
"This",
"method",
"uses",
"<a",
"href",
"=",
"http",
":",
"//",
"commons",
".",
"apache",
".",
"org",
"/",
"proper",
"/... | train | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/Controller.java#L953-L971 |
tango-controls/JTango | server/src/main/java/org/tango/server/build/DevicePropertiesBuilder.java | DevicePropertiesBuilder.build | public void build(final Class<?> clazz, final Field field, final DeviceImpl device, final Object businessObject)
throws DevFailed {
xlogger.entry();
// Inject each device property
final String fieldName = field.getName();
logger.debug("Has a DeviceProperties : {}", fieldName);
BuilderUtils.checkStatic(field);
final String setterName = BuilderUtils.SET + fieldName.substring(0, 1).toUpperCase(Locale.ENGLISH)
+ fieldName.substring(1);
Method setter = null;
try {
setter = businessObject.getClass().getMethod(setterName, field.getType());
} catch (final NoSuchMethodException e) {
throw DevFailedUtils.newDevFailed(e);
}
final DevicePropertiesImpl property = new DevicePropertiesImpl(setter, businessObject, device.getName());
device.setDeviceProperties(property);
xlogger.exit();
} | java | public void build(final Class<?> clazz, final Field field, final DeviceImpl device, final Object businessObject)
throws DevFailed {
xlogger.entry();
// Inject each device property
final String fieldName = field.getName();
logger.debug("Has a DeviceProperties : {}", fieldName);
BuilderUtils.checkStatic(field);
final String setterName = BuilderUtils.SET + fieldName.substring(0, 1).toUpperCase(Locale.ENGLISH)
+ fieldName.substring(1);
Method setter = null;
try {
setter = businessObject.getClass().getMethod(setterName, field.getType());
} catch (final NoSuchMethodException e) {
throw DevFailedUtils.newDevFailed(e);
}
final DevicePropertiesImpl property = new DevicePropertiesImpl(setter, businessObject, device.getName());
device.setDeviceProperties(property);
xlogger.exit();
} | [
"public",
"void",
"build",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"Field",
"field",
",",
"final",
"DeviceImpl",
"device",
",",
"final",
"Object",
"businessObject",
")",
"throws",
"DevFailed",
"{",
"xlogger",
".",
"entry",
"(",
")",
... | Create class properties {@link DeviceProperties}
@param clazz
@param field
@param device
@param businessObject
@throws DevFailed | [
"Create",
"class",
"properties",
"{",
"@link",
"DeviceProperties",
"}"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/build/DevicePropertiesBuilder.java#L62-L81 |
drewwills/cernunnos | cernunnos-core/src/main/java/org/danann/cernunnos/runtime/ScriptRunner.java | ScriptRunner.evaluate | public Object evaluate(String location, TaskRequest req) {
// Assertions.
if (location == null) {
String msg = "Argument 'location' cannot be null.";
throw new IllegalArgumentException(msg);
}
return evaluate(compileTask(location), req);
} | java | public Object evaluate(String location, TaskRequest req) {
// Assertions.
if (location == null) {
String msg = "Argument 'location' cannot be null.";
throw new IllegalArgumentException(msg);
}
return evaluate(compileTask(location), req);
} | [
"public",
"Object",
"evaluate",
"(",
"String",
"location",
",",
"TaskRequest",
"req",
")",
"{",
"// Assertions.",
"if",
"(",
"location",
"==",
"null",
")",
"{",
"String",
"msg",
"=",
"\"Argument 'location' cannot be null.\"",
";",
"throw",
"new",
"IllegalArgumentE... | Invokes the script found at the specified location (file system or URL)
and returns the <code>RETURN_VALUE</code>.
@param location A file on the file system or a URL.
@param req A <code>TaskRequest</code> prepared externally.
@return The <code>RETURN_VALUE</code> of the specified task. | [
"Invokes",
"the",
"script",
"found",
"at",
"the",
"specified",
"location",
"(",
"file",
"system",
"or",
"URL",
")",
"and",
"returns",
"the",
"<code",
">",
"RETURN_VALUE<",
"/",
"code",
">",
"."
] | train | https://github.com/drewwills/cernunnos/blob/dc6848e0253775e22b6c869fd06506d4ddb6d728/cernunnos-core/src/main/java/org/danann/cernunnos/runtime/ScriptRunner.java#L312-L322 |
before/quality-check | modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/util/SourceCodeFormatter.java | SourceCodeFormatter.findDefaultProperties | @Nonnull
private static Properties findDefaultProperties() {
final InputStream in = SourceCodeFormatter.class.getClassLoader().getResourceAsStream(DEFAULT_PROPERTIES_PATH);
final Properties p = new Properties();
try {
p.load(in);
} catch (final IOException e) {
throw new RuntimeException(String.format("Can not load resource %s", DEFAULT_PROPERTIES_PATH));
}
return p;
} | java | @Nonnull
private static Properties findDefaultProperties() {
final InputStream in = SourceCodeFormatter.class.getClassLoader().getResourceAsStream(DEFAULT_PROPERTIES_PATH);
final Properties p = new Properties();
try {
p.load(in);
} catch (final IOException e) {
throw new RuntimeException(String.format("Can not load resource %s", DEFAULT_PROPERTIES_PATH));
}
return p;
} | [
"@",
"Nonnull",
"private",
"static",
"Properties",
"findDefaultProperties",
"(",
")",
"{",
"final",
"InputStream",
"in",
"=",
"SourceCodeFormatter",
".",
"class",
".",
"getClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"DEFAULT_PROPERTIES_PATH",
")",
";",
... | Gets the default options to be passed when no custom properties are given.
@return properties with formatter options | [
"Gets",
"the",
"default",
"options",
"to",
"be",
"passed",
"when",
"no",
"custom",
"properties",
"are",
"given",
"."
] | train | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/util/SourceCodeFormatter.java#L146-L156 |
lestard/advanced-bindings | src/main/java/eu/lestard/advanced_bindings/api/SwitchBindings.java | SwitchBindings.switchBinding | public static <T, R> SwitchBuilder<T, R> switchBinding(ObservableValue<T> observable, Class<R> bindingType) {
return new SwitchBuilder<>(observable);
} | java | public static <T, R> SwitchBuilder<T, R> switchBinding(ObservableValue<T> observable, Class<R> bindingType) {
return new SwitchBuilder<>(observable);
} | [
"public",
"static",
"<",
"T",
",",
"R",
">",
"SwitchBuilder",
"<",
"T",
",",
"R",
">",
"switchBinding",
"(",
"ObservableValue",
"<",
"T",
">",
"observable",
",",
"Class",
"<",
"R",
">",
"bindingType",
")",
"{",
"return",
"new",
"SwitchBuilder",
"<>",
"... | Creates builder for a binding that works like a switch-case in java.
Example:
```java
IntegerProperty base = new SimpleIntegerProperty();
ObservableValue<String> result = switchBinding(base, String.class)
.bindCase(3, i -> "three")
.bindCase(10, i -> "ten")
.bindCase(1, i -> "one")
.bindDefault(() -> "nothing")
.build();
```
this is the equivalent without observables:
```java
int base = ...;
switch(base) {
case 3 :
return "three";
case 10:
return "ten";
case 1:
return "one";
default:
return "nothing";
}
```
There are two differences between this switch binding and the switch statement in java:
1. In the java switch statement only a limited number of types can be used. This binding has no such limitation.
You can use every type in the observable that has a properly overwritten {@link Object#equals(Object)} and {@link Object#hashCode()} method.
2. There is no "fall through" and therefore no "break" is needed. Only the callback for the matching case is executed.
See [the switch documentation](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html) for more information.
@param observable the base observable that is used in the switch statement
@param bindingType the type of the created observable.
@param <T> the generic type of the base observable.
@param <R> the generic type of the returned observable.
@return a builder that is used to create the switch binding. | [
"Creates",
"builder",
"for",
"a",
"binding",
"that",
"works",
"like",
"a",
"switch",
"-",
"case",
"in",
"java",
"."
] | train | https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/SwitchBindings.java#L154-L156 |
jbundle/jbundle | thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageRecordDesc.java | BaseMessageRecordDesc.setNodeIndex | public Rec setNodeIndex(int iNodeIndex, Rec record)
{
if (END_OF_NODES == iNodeIndex)
iNodeIndex = 0;
m_iNodeIndex = iNodeIndex;
return record;
} | java | public Rec setNodeIndex(int iNodeIndex, Rec record)
{
if (END_OF_NODES == iNodeIndex)
iNodeIndex = 0;
m_iNodeIndex = iNodeIndex;
return record;
} | [
"public",
"Rec",
"setNodeIndex",
"(",
"int",
"iNodeIndex",
",",
"Rec",
"record",
")",
"{",
"if",
"(",
"END_OF_NODES",
"==",
"iNodeIndex",
")",
"iNodeIndex",
"=",
"0",
";",
"m_iNodeIndex",
"=",
"iNodeIndex",
";",
"return",
"record",
";",
"}"
] | Position to this node in the tree.
@param iNodeIndex The node to position to.
@param record The record I am moving data to. If this is null, don't position/setup the data.
@return An error code. | [
"Position",
"to",
"this",
"node",
"in",
"the",
"tree",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageRecordDesc.java#L315-L321 |
upwork/java-upwork | src/com/Upwork/api/Routers/Workdays.java | Workdays.getByCompany | public JSONObject getByCompany(String company, String fromDate, String tillDate, HashMap<String, String> params) throws JSONException {
return oClient.get("/team/v3/workdays/companies/" + company + "/" + fromDate + "," + tillDate, params);
} | java | public JSONObject getByCompany(String company, String fromDate, String tillDate, HashMap<String, String> params) throws JSONException {
return oClient.get("/team/v3/workdays/companies/" + company + "/" + fromDate + "," + tillDate, params);
} | [
"public",
"JSONObject",
"getByCompany",
"(",
"String",
"company",
",",
"String",
"fromDate",
",",
"String",
"tillDate",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\... | Get Workdays by Company
@param company Company ID
@param fromDate Start date
@param tillDate End date
@param params (Optional) Parameters
@throws JSONException If error occurred
@return {@link JSONObject} | [
"Get",
"Workdays",
"by",
"Company"
] | train | https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Workdays.java#L56-L58 |
killbill/killbill | invoice/src/main/java/org/killbill/billing/invoice/usage/ContiguousIntervalUsageInArrear.java | ContiguousIntervalUsageInArrear.computeUpdatedAmount | private Long computeUpdatedAmount(@Nullable Long currentAmount, @Nullable Long newAmount) {
currentAmount = currentAmount == null ? 0L : currentAmount;
newAmount = newAmount == null ? 0L : newAmount;
if (usage.getUsageType() == UsageType.CAPACITY) {
return Math.max(currentAmount, newAmount);
} else /* UsageType.CONSUMABLE */ {
return currentAmount + newAmount;
}
} | java | private Long computeUpdatedAmount(@Nullable Long currentAmount, @Nullable Long newAmount) {
currentAmount = currentAmount == null ? 0L : currentAmount;
newAmount = newAmount == null ? 0L : newAmount;
if (usage.getUsageType() == UsageType.CAPACITY) {
return Math.max(currentAmount, newAmount);
} else /* UsageType.CONSUMABLE */ {
return currentAmount + newAmount;
}
} | [
"private",
"Long",
"computeUpdatedAmount",
"(",
"@",
"Nullable",
"Long",
"currentAmount",
",",
"@",
"Nullable",
"Long",
"newAmount",
")",
"{",
"currentAmount",
"=",
"currentAmount",
"==",
"null",
"?",
"0L",
":",
"currentAmount",
";",
"newAmount",
"=",
"newAmount... | Based on usage type compute new amount
@param currentAmount
@param newAmount
@return | [
"Based",
"on",
"usage",
"type",
"compute",
"new",
"amount"
] | train | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/invoice/src/main/java/org/killbill/billing/invoice/usage/ContiguousIntervalUsageInArrear.java#L394-L404 |
czyzby/gdx-lml | kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/reflection/Reflection.java | Reflection.isAnnotationPresent | public static boolean isAnnotationPresent(final Field field, final Class<? extends Annotation> annotationType) {
return field != null && field.isAnnotationPresent(annotationType);
} | java | public static boolean isAnnotationPresent(final Field field, final Class<? extends Annotation> annotationType) {
return field != null && field.isAnnotationPresent(annotationType);
} | [
"public",
"static",
"boolean",
"isAnnotationPresent",
"(",
"final",
"Field",
"field",
",",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
")",
"{",
"return",
"field",
"!=",
"null",
"&&",
"field",
".",
"isAnnotationPresent",
"(",
"a... | Utility method kept for backwards compatibility. Annotation checking used to be problematic on GWT.
@param field might be annotated. Can be null.
@param annotationType class of the annotation that the field is checked against.
@return true if field is annotated with the specified annotation. | [
"Utility",
"method",
"kept",
"for",
"backwards",
"compatibility",
".",
"Annotation",
"checking",
"used",
"to",
"be",
"problematic",
"on",
"GWT",
"."
] | train | https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/reflection/Reflection.java#L80-L82 |
h2oai/h2o-3 | h2o-genmodel/src/main/java/water/util/ModelUtils.java | ModelUtils.sampleOOBRows | public static int[] sampleOOBRows(int nrows, float rate, Random sampler) {
return sampleOOBRows(nrows, rate, sampler, new int[2+Math.round((1f-rate)*nrows*1.2f+0.5f)]);
} | java | public static int[] sampleOOBRows(int nrows, float rate, Random sampler) {
return sampleOOBRows(nrows, rate, sampler, new int[2+Math.round((1f-rate)*nrows*1.2f+0.5f)]);
} | [
"public",
"static",
"int",
"[",
"]",
"sampleOOBRows",
"(",
"int",
"nrows",
",",
"float",
"rate",
",",
"Random",
"sampler",
")",
"{",
"return",
"sampleOOBRows",
"(",
"nrows",
",",
"rate",
",",
"sampler",
",",
"new",
"int",
"[",
"2",
"+",
"Math",
".",
... | Sample out-of-bag rows with given rate with help of given sampler.
It returns array of sampled rows. The first element of array contains a number
of sampled rows. The returned array can be larger than number of returned sampled
elements.
@param nrows number of rows to sample from.
@param rate sampling rate
@param sampler random "dice"
@return an array contains numbers of sampled rows. The first element holds a number of sampled rows. The array length
can be greater than number of sampled rows. | [
"Sample",
"out",
"-",
"of",
"-",
"bag",
"rows",
"with",
"given",
"rate",
"with",
"help",
"of",
"given",
"sampler",
".",
"It",
"returns",
"array",
"of",
"sampled",
"rows",
".",
"The",
"first",
"element",
"of",
"array",
"contains",
"a",
"number",
"of",
"... | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/water/util/ModelUtils.java#L30-L32 |
networknt/light-4j | metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutors.java | InstrumentedExecutors.newSingleThreadExecutor | public static InstrumentedExecutorService newSingleThreadExecutor(MetricRegistry registry, String name) {
return new InstrumentedExecutorService(Executors.newSingleThreadExecutor(), registry, name);
} | java | public static InstrumentedExecutorService newSingleThreadExecutor(MetricRegistry registry, String name) {
return new InstrumentedExecutorService(Executors.newSingleThreadExecutor(), registry, name);
} | [
"public",
"static",
"InstrumentedExecutorService",
"newSingleThreadExecutor",
"(",
"MetricRegistry",
"registry",
",",
"String",
"name",
")",
"{",
"return",
"new",
"InstrumentedExecutorService",
"(",
"Executors",
".",
"newSingleThreadExecutor",
"(",
")",
",",
"registry",
... | Creates an InstrumentedExecutor that uses a single worker thread operating
off an unbounded queue. (Note however that if this single
thread terminates due to a failure during execution prior to
shutdown, a new one will take its place if needed to execute
subsequent tasks.) Tasks are guaranteed to execute
sequentially, and no more than one task will be active at any
given time. Unlike the otherwise equivalent
{@code newFixedThreadPool(1)} the returned executor is
guaranteed not to be reconfigurable to use additional threads.
@param registry the {@link MetricRegistry} that will contain the metrics.
@param name the (metrics) name for this executor service, see {@link MetricRegistry#name(String, String...)}.
@return the newly created single-threaded Executor
@see Executors#newSingleThreadExecutor() | [
"Creates",
"an",
"InstrumentedExecutor",
"that",
"uses",
"a",
"single",
"worker",
"thread",
"operating",
"off",
"an",
"unbounded",
"queue",
".",
"(",
"Note",
"however",
"that",
"if",
"this",
"single",
"thread",
"terminates",
"due",
"to",
"a",
"failure",
"durin... | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutors.java#L154-L156 |
wildfly/wildfly-core | logging/src/main/java/org/jboss/as/logging/handlers/HandlerOperations.java | HandlerOperations.disableHandler | private static void disableHandler(final LogContextConfiguration configuration, final String handlerName) {
final HandlerConfiguration handlerConfiguration = configuration.getHandlerConfiguration(handlerName);
try {
handlerConfiguration.setPropertyValueString("enabled", "false");
return;
} catch (IllegalArgumentException e) {
// do nothing
}
final Logger root = configuration.getLogContext().getLogger(CommonAttributes.ROOT_LOGGER_NAME);
Map<String, String> disableHandlers = root.getAttachment(DISABLED_HANDLERS_KEY);
synchronized (HANDLER_LOCK) {
if (disableHandlers == null) {
disableHandlers = new HashMap<String, String>();
final Map<String, String> current = root.attachIfAbsent(DISABLED_HANDLERS_KEY, disableHandlers);
if (current != null) {
disableHandlers = current;
}
}
if (!disableHandlers.containsKey(handlerName)) {
disableHandlers.put(handlerName, handlerConfiguration.getFilter());
handlerConfiguration.setFilter(CommonAttributes.DENY.getName());
}
}
} | java | private static void disableHandler(final LogContextConfiguration configuration, final String handlerName) {
final HandlerConfiguration handlerConfiguration = configuration.getHandlerConfiguration(handlerName);
try {
handlerConfiguration.setPropertyValueString("enabled", "false");
return;
} catch (IllegalArgumentException e) {
// do nothing
}
final Logger root = configuration.getLogContext().getLogger(CommonAttributes.ROOT_LOGGER_NAME);
Map<String, String> disableHandlers = root.getAttachment(DISABLED_HANDLERS_KEY);
synchronized (HANDLER_LOCK) {
if (disableHandlers == null) {
disableHandlers = new HashMap<String, String>();
final Map<String, String> current = root.attachIfAbsent(DISABLED_HANDLERS_KEY, disableHandlers);
if (current != null) {
disableHandlers = current;
}
}
if (!disableHandlers.containsKey(handlerName)) {
disableHandlers.put(handlerName, handlerConfiguration.getFilter());
handlerConfiguration.setFilter(CommonAttributes.DENY.getName());
}
}
} | [
"private",
"static",
"void",
"disableHandler",
"(",
"final",
"LogContextConfiguration",
"configuration",
",",
"final",
"String",
"handlerName",
")",
"{",
"final",
"HandlerConfiguration",
"handlerConfiguration",
"=",
"configuration",
".",
"getHandlerConfiguration",
"(",
"h... | Disables the handler if the handler exists and is not already disabled.
<p/>
If the handler does not exist or is already disabled nothing happens.
@param configuration the log context configuration.
@param handlerName the handler name to disable. | [
"Disables",
"the",
"handler",
"if",
"the",
"handler",
"exists",
"and",
"is",
"not",
"already",
"disabled",
".",
"<p",
"/",
">",
"If",
"the",
"handler",
"does",
"not",
"exist",
"or",
"is",
"already",
"disabled",
"nothing",
"happens",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/handlers/HandlerOperations.java#L906-L929 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/LabelsApi.java | LabelsApi.createLabel | public Label createLabel(Object projectIdOrPath, String name, String color, String description) throws GitLabApiException {
return (createLabel(projectIdOrPath, name, color, description, null));
} | java | public Label createLabel(Object projectIdOrPath, String name, String color, String description) throws GitLabApiException {
return (createLabel(projectIdOrPath, name, color, description, null));
} | [
"public",
"Label",
"createLabel",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"name",
",",
"String",
"color",
",",
"String",
"description",
")",
"throws",
"GitLabApiException",
"{",
"return",
"(",
"createLabel",
"(",
"projectIdOrPath",
",",
"name",
",",
"co... | Create a label
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param name the name for the label
@param color the color for the label
@param description the description for the label
@return the created Label instance
@throws GitLabApiException if any exception occurs | [
"Create",
"a",
"label"
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/LabelsApi.java#L77-L79 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/zip/ZipUtils.java | ZipUtils.zipEntry | static ZipOutputStream zipEntry(File zipDirectory, File path, ZipOutputStream outputStream) {
return zipEntry(newZipEntry(zipDirectory, path), outputStream);
} | java | static ZipOutputStream zipEntry(File zipDirectory, File path, ZipOutputStream outputStream) {
return zipEntry(newZipEntry(zipDirectory, path), outputStream);
} | [
"static",
"ZipOutputStream",
"zipEntry",
"(",
"File",
"zipDirectory",
",",
"File",
"path",
",",
"ZipOutputStream",
"outputStream",
")",
"{",
"return",
"zipEntry",
"(",
"newZipEntry",
"(",
"zipDirectory",
",",
"path",
")",
",",
"outputStream",
")",
";",
"}"
] | Zips the contents of the individual {@link File file system path} to the supplied {@link ZipOutputStream}.
@param zipDirectory {@link File directory} being zipped.
@param path {@link File} to zip and add to the supplied {@link ZipOutputStream}.
@param outputStream {@link ZipOutputStream} used to zip the contents of the given {@link File path}.
@return the given {@link ZipOutputStream}.
@throws SystemException if {@link File path} could not be zipped and added to the supplied {@link ZipOutputStream}.
@see #zipEntry(ZipEntry, ZipOutputStream)
@see java.util.zip.ZipOutputStream
@see java.io.File | [
"Zips",
"the",
"contents",
"of",
"the",
"individual",
"{",
"@link",
"File",
"file",
"system",
"path",
"}",
"to",
"the",
"supplied",
"{",
"@link",
"ZipOutputStream",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/zip/ZipUtils.java#L240-L242 |
alkacon/opencms-core | src/org/opencms/relations/CmsCategoryService.java | CmsCategoryService.repairRelations | public void repairRelations(CmsObject cms, String resourceName) throws CmsException {
repairRelations(cms, cms.readResource(resourceName));
} | java | public void repairRelations(CmsObject cms, String resourceName) throws CmsException {
repairRelations(cms, cms.readResource(resourceName));
} | [
"public",
"void",
"repairRelations",
"(",
"CmsObject",
"cms",
",",
"String",
"resourceName",
")",
"throws",
"CmsException",
"{",
"repairRelations",
"(",
"cms",
",",
"cms",
".",
"readResource",
"(",
"resourceName",
")",
")",
";",
"}"
] | Repairs broken category relations.<p>
This could be caused by renaming/moving a category folder,
or changing the category repositories base folder name.<p>
Also repairs problems when creating/deleting conflicting
category folders across several repositories.<p>
The resource has to be previously locked.<p>
@param cms the cms context
@param resourceName the site relative path to the resource to repair
@throws CmsException if something goes wrong | [
"Repairs",
"broken",
"category",
"relations",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsCategoryService.java#L748-L751 |
CloudSlang/cs-actions | cs-ssh/src/main/java/io/cloudslang/content/ssh/utils/CacheUtils.java | CacheUtils.saveSshSessionAndChannel | public static boolean saveSshSessionAndChannel(Session session, Channel channel, GlobalSessionObject<Map<String, SSHConnection>> sessionParam, String sessionId) {
final SSHConnection sshConnection;
if (channel != null) {
sshConnection = new SSHConnection(session, channel);
} else {
sshConnection = new SSHConnection(session);
}
if (sessionParam != null) {
Map<String, SSHConnection> tempMap = sessionParam.get();
if (tempMap == null) {
tempMap = new HashMap<>();
}
tempMap.put(sessionId, sshConnection);
sessionParam.setResource(new SSHSessionResource(tempMap));
return true;
}
return false;
} | java | public static boolean saveSshSessionAndChannel(Session session, Channel channel, GlobalSessionObject<Map<String, SSHConnection>> sessionParam, String sessionId) {
final SSHConnection sshConnection;
if (channel != null) {
sshConnection = new SSHConnection(session, channel);
} else {
sshConnection = new SSHConnection(session);
}
if (sessionParam != null) {
Map<String, SSHConnection> tempMap = sessionParam.get();
if (tempMap == null) {
tempMap = new HashMap<>();
}
tempMap.put(sessionId, sshConnection);
sessionParam.setResource(new SSHSessionResource(tempMap));
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"saveSshSessionAndChannel",
"(",
"Session",
"session",
",",
"Channel",
"channel",
",",
"GlobalSessionObject",
"<",
"Map",
"<",
"String",
",",
"SSHConnection",
">",
">",
"sessionParam",
",",
"String",
"sessionId",
")",
"{",
"final",
... | Save the SSH session and the channel in the cache.
@param session The SSH session.
@param channel The SSH channel.
@param sessionParam The cache: GlobalSessionObject or SessionObject. | [
"Save",
"the",
"SSH",
"session",
"and",
"the",
"channel",
"in",
"the",
"cache",
"."
] | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-ssh/src/main/java/io/cloudslang/content/ssh/utils/CacheUtils.java#L79-L96 |
czyzby/gdx-lml | kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/scene2d/Actors.java | Actors.centerActor | public static void centerActor(final Actor actor, final Stage stage) {
if (actor != null && stage != null) {
actor.setPosition((int) (stage.getWidth() / 2f - actor.getWidth() / 2f),
(int) (stage.getHeight() / 2f - actor.getHeight() / 2f));
}
} | java | public static void centerActor(final Actor actor, final Stage stage) {
if (actor != null && stage != null) {
actor.setPosition((int) (stage.getWidth() / 2f - actor.getWidth() / 2f),
(int) (stage.getHeight() / 2f - actor.getHeight() / 2f));
}
} | [
"public",
"static",
"void",
"centerActor",
"(",
"final",
"Actor",
"actor",
",",
"final",
"Stage",
"stage",
")",
"{",
"if",
"(",
"actor",
"!=",
"null",
"&&",
"stage",
"!=",
"null",
")",
"{",
"actor",
".",
"setPosition",
"(",
"(",
"int",
")",
"(",
"sta... | Null-safe position update.
@param actor will be centered on the given stage according to their sizes. Can be null.
@param stage can be null. | [
"Null",
"-",
"safe",
"position",
"update",
"."
] | train | https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/scene2d/Actors.java#L60-L65 |
stratosphere/stratosphere | stratosphere-java/src/main/java/eu/stratosphere/api/java/ExecutionEnvironment.java | ExecutionEnvironment.createRemoteEnvironment | public static ExecutionEnvironment createRemoteEnvironment(String host, int port, int degreeOfParallelism, String... jarFiles) {
RemoteEnvironment rec = new RemoteEnvironment(host, port, jarFiles);
rec.setDegreeOfParallelism(degreeOfParallelism);
return rec;
} | java | public static ExecutionEnvironment createRemoteEnvironment(String host, int port, int degreeOfParallelism, String... jarFiles) {
RemoteEnvironment rec = new RemoteEnvironment(host, port, jarFiles);
rec.setDegreeOfParallelism(degreeOfParallelism);
return rec;
} | [
"public",
"static",
"ExecutionEnvironment",
"createRemoteEnvironment",
"(",
"String",
"host",
",",
"int",
"port",
",",
"int",
"degreeOfParallelism",
",",
"String",
"...",
"jarFiles",
")",
"{",
"RemoteEnvironment",
"rec",
"=",
"new",
"RemoteEnvironment",
"(",
"host",... | Creates a {@link RemoteEnvironment}. The remote environment sends (parts of) the program
to a cluster for execution. Note that all file paths used in the program must be accessible from the
cluster. The execution will use the specified degree of parallelism.
@param host The host name or address of the master (JobManager), where the program should be executed.
@param port The port of the master (JobManager), where the program should be executed.
@param degreeOfParallelism The degree of parallelism to use during the execution.
@param jarFiles The JAR files with code that needs to be shipped to the cluster. If the program uses
user-defined functions, user-defined input formats, or any libraries, those must be
provided in the JAR files.
@return A remote environment that executes the program on a cluster. | [
"Creates",
"a",
"{",
"@link",
"RemoteEnvironment",
"}",
".",
"The",
"remote",
"environment",
"sends",
"(",
"parts",
"of",
")",
"the",
"program",
"to",
"a",
"cluster",
"for",
"execution",
".",
"Note",
"that",
"all",
"file",
"paths",
"used",
"in",
"the",
"... | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-java/src/main/java/eu/stratosphere/api/java/ExecutionEnvironment.java#L712-L716 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ops/aggregates/Batch.java | Batch.getBatches | public static <U extends Aggregate> List<Batch<U>> getBatches(List<U> list) {
return getBatches(list, batchLimit);
} | java | public static <U extends Aggregate> List<Batch<U>> getBatches(List<U> list) {
return getBatches(list, batchLimit);
} | [
"public",
"static",
"<",
"U",
"extends",
"Aggregate",
">",
"List",
"<",
"Batch",
"<",
"U",
">",
">",
"getBatches",
"(",
"List",
"<",
"U",
">",
"list",
")",
"{",
"return",
"getBatches",
"(",
"list",
",",
"batchLimit",
")",
";",
"}"
] | Helper method to create batch from list of aggregates, for cases when list of aggregates is higher then batchLimit
@param list
@param <U>
@return | [
"Helper",
"method",
"to",
"create",
"batch",
"from",
"list",
"of",
"aggregates",
"for",
"cases",
"when",
"list",
"of",
"aggregates",
"is",
"higher",
"then",
"batchLimit"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ops/aggregates/Batch.java#L115-L117 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/parser/RtfParser.java | RtfParser.importRtfFragment | public void importRtfFragment(InputStream readerIn, RtfDocument rtfDoc, RtfImportMappings importMappings) throws IOException {
//public void importRtfFragment2(Reader readerIn, RtfDocument rtfDoc, RtfImportMappings importMappings) throws IOException {
if(readerIn == null || rtfDoc == null || importMappings==null) return;
this.init(TYPE_IMPORT_FRAGMENT, rtfDoc, readerIn, null, null);
this.handleImportMappings(importMappings);
this.setCurrentDestination(RtfDestinationMgr.DESTINATION_DOCUMENT);
this.groupLevel = 1;
setParserState(RtfParser.PARSER_IN_DOCUMENT);
this.tokenise();
} | java | public void importRtfFragment(InputStream readerIn, RtfDocument rtfDoc, RtfImportMappings importMappings) throws IOException {
//public void importRtfFragment2(Reader readerIn, RtfDocument rtfDoc, RtfImportMappings importMappings) throws IOException {
if(readerIn == null || rtfDoc == null || importMappings==null) return;
this.init(TYPE_IMPORT_FRAGMENT, rtfDoc, readerIn, null, null);
this.handleImportMappings(importMappings);
this.setCurrentDestination(RtfDestinationMgr.DESTINATION_DOCUMENT);
this.groupLevel = 1;
setParserState(RtfParser.PARSER_IN_DOCUMENT);
this.tokenise();
} | [
"public",
"void",
"importRtfFragment",
"(",
"InputStream",
"readerIn",
",",
"RtfDocument",
"rtfDoc",
",",
"RtfImportMappings",
"importMappings",
")",
"throws",
"IOException",
"{",
"//public void importRtfFragment2(Reader readerIn, RtfDocument rtfDoc, RtfImportMappings importMappings)... | Imports an RTF fragment.
@param readerIn
The Reader to read the RTF fragment from.
@param rtfDoc
The RTF document to add the RTF fragment to.
@param importMappings
The RtfImportMappings defining font and color mappings for the fragment.
@throws IOException
On I/O errors.
@since 2.1.3 | [
"Imports",
"an",
"RTF",
"fragment",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/parser/RtfParser.java#L559-L568 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/scatterplot/index/TreeSphereVisualization.java | TreeSphereVisualization.canVisualize | public static boolean canVisualize(Relation<?> rel, AbstractMTree<?, ?, ?, ?> tree) {
if(!TypeUtil.NUMBER_VECTOR_FIELD.isAssignableFromType(rel.getDataTypeInformation())) {
return false;
}
return getLPNormP(tree) > 0;
} | java | public static boolean canVisualize(Relation<?> rel, AbstractMTree<?, ?, ?, ?> tree) {
if(!TypeUtil.NUMBER_VECTOR_FIELD.isAssignableFromType(rel.getDataTypeInformation())) {
return false;
}
return getLPNormP(tree) > 0;
} | [
"public",
"static",
"boolean",
"canVisualize",
"(",
"Relation",
"<",
"?",
">",
"rel",
",",
"AbstractMTree",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
">",
"tree",
")",
"{",
"if",
"(",
"!",
"TypeUtil",
".",
"NUMBER_VECTOR_FIELD",
".",
"isAssignableFromType"... | Test for a visualizable index in the context's database.
@param rel Vector relation
@param tree Tree to visualize
@return whether the tree is visualizable | [
"Test",
"for",
"a",
"visualizable",
"index",
"in",
"the",
"context",
"s",
"database",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/scatterplot/index/TreeSphereVisualization.java#L146-L151 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_phishing_GET | public ArrayList<Long> ip_phishing_GET(String ip, String ipOnAntiphishing, OvhAntiphishingStateEnum state) throws IOException {
String qPath = "/ip/{ip}/phishing";
StringBuilder sb = path(qPath, ip);
query(sb, "ipOnAntiphishing", ipOnAntiphishing);
query(sb, "state", state);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<Long> ip_phishing_GET(String ip, String ipOnAntiphishing, OvhAntiphishingStateEnum state) throws IOException {
String qPath = "/ip/{ip}/phishing";
StringBuilder sb = path(qPath, ip);
query(sb, "ipOnAntiphishing", ipOnAntiphishing);
query(sb, "state", state);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"ip_phishing_GET",
"(",
"String",
"ip",
",",
"String",
"ipOnAntiphishing",
",",
"OvhAntiphishingStateEnum",
"state",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/phishing\"",
";",
"StringBuilder",
"s... | Ip under anti-phishing
REST: GET /ip/{ip}/phishing
@param state [required] Filter the value of state property (=)
@param ipOnAntiphishing [required] Filter the value of ipOnAntiphishing property (within or equals)
@param ip [required] | [
"Ip",
"under",
"anti",
"-",
"phishing"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L81-L88 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java | ApiOvhDbaaslogs.serviceName_input_inputId_allowedNetwork_allowedNetworkId_GET | public OvhAllowedNetwork serviceName_input_inputId_allowedNetwork_allowedNetworkId_GET(String serviceName, String inputId, String allowedNetworkId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/input/{inputId}/allowedNetwork/{allowedNetworkId}";
StringBuilder sb = path(qPath, serviceName, inputId, allowedNetworkId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhAllowedNetwork.class);
} | java | public OvhAllowedNetwork serviceName_input_inputId_allowedNetwork_allowedNetworkId_GET(String serviceName, String inputId, String allowedNetworkId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/input/{inputId}/allowedNetwork/{allowedNetworkId}";
StringBuilder sb = path(qPath, serviceName, inputId, allowedNetworkId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhAllowedNetwork.class);
} | [
"public",
"OvhAllowedNetwork",
"serviceName_input_inputId_allowedNetwork_allowedNetworkId_GET",
"(",
"String",
"serviceName",
",",
"String",
"inputId",
",",
"String",
"allowedNetworkId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dbaas/logs/{serviceName}/inp... | List all network UUID allowed to join input
REST: GET /dbaas/logs/{serviceName}/input/{inputId}/allowedNetwork/{allowedNetworkId}
@param serviceName [required] Service name
@param inputId [required] Input ID
@param allowedNetworkId [required] Allowed network ID | [
"List",
"all",
"network",
"UUID",
"allowed",
"to",
"join",
"input"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L529-L534 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataXceiver.java | DataXceiver.sendResponse | private void sendResponse(Socket s, short opStatus, long timeout)
throws IOException {
DataOutputStream reply =
new DataOutputStream(NetUtils.getOutputStream(s, timeout));
reply.writeShort(opStatus);
reply.flush();
} | java | private void sendResponse(Socket s, short opStatus, long timeout)
throws IOException {
DataOutputStream reply =
new DataOutputStream(NetUtils.getOutputStream(s, timeout));
reply.writeShort(opStatus);
reply.flush();
} | [
"private",
"void",
"sendResponse",
"(",
"Socket",
"s",
",",
"short",
"opStatus",
",",
"long",
"timeout",
")",
"throws",
"IOException",
"{",
"DataOutputStream",
"reply",
"=",
"new",
"DataOutputStream",
"(",
"NetUtils",
".",
"getOutputStream",
"(",
"s",
",",
"ti... | Utility function for sending a response.
@param s socket to write to
@param opStatus status message to write
@param timeout send timeout | [
"Utility",
"function",
"for",
"sending",
"a",
"response",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataXceiver.java#L1298-L1305 |
qatools/properties | src/main/java/ru/qatools/properties/PropertyLoader.java | PropertyLoader.convertValue | protected Object convertValue(AnnotatedElement element, String value) {
Class<?> type = getValueType(element);
Type genericType = getValueGenericType(element);
try {
if (element.isAnnotationPresent(Use.class)) {
Converter converter = getConverterForElementWithUseAnnotation(element);
return converter.convert(value);
}
if (Collection.class.isAssignableFrom(type)) {
return manager.convert(type, getCollectionElementType(genericType), value);
}
return manager.convert(type, value);
} catch (Exception e) {
throw new PropertyLoaderException(String.format(
"Can't convert value <%s> to type <%s>", value, type), e);
}
} | java | protected Object convertValue(AnnotatedElement element, String value) {
Class<?> type = getValueType(element);
Type genericType = getValueGenericType(element);
try {
if (element.isAnnotationPresent(Use.class)) {
Converter converter = getConverterForElementWithUseAnnotation(element);
return converter.convert(value);
}
if (Collection.class.isAssignableFrom(type)) {
return manager.convert(type, getCollectionElementType(genericType), value);
}
return manager.convert(type, value);
} catch (Exception e) {
throw new PropertyLoaderException(String.format(
"Can't convert value <%s> to type <%s>", value, type), e);
}
} | [
"protected",
"Object",
"convertValue",
"(",
"AnnotatedElement",
"element",
",",
"String",
"value",
")",
"{",
"Class",
"<",
"?",
">",
"type",
"=",
"getValueType",
"(",
"element",
")",
";",
"Type",
"genericType",
"=",
"getValueGenericType",
"(",
"element",
")",
... | Convert given value to specified type. If given element annotated with {@link Use} annotation
use {@link #getConverterForElementWithUseAnnotation(AnnotatedElement)} converter, otherwise
if element has collection type convert collection and finally try to convert element
using registered converters. | [
"Convert",
"given",
"value",
"to",
"specified",
"type",
".",
"If",
"given",
"element",
"annotated",
"with",
"{"
] | train | https://github.com/qatools/properties/blob/ae50b460a6bb4fcb21afe888b2e86a7613cd2115/src/main/java/ru/qatools/properties/PropertyLoader.java#L266-L284 |
cloudant/java-cloudant | cloudant-http/src/main/java/com/cloudant/http/internal/interceptors/UserAgentInterceptor.java | UserAgentInterceptor.loadUA | private static String loadUA(ClassLoader loader, String filename){
String ua = "cloudant-http";
String version = "unknown";
final InputStream propStream = loader.getResourceAsStream(filename);
final Properties properties = new Properties();
try {
if (propStream != null) {
try {
properties.load(propStream);
} finally {
propStream.close();
}
}
ua = properties.getProperty("user.agent.name", ua);
version = properties.getProperty("user.agent.version", version);
} catch (IOException e) {
// Swallow exception and use default values.
}
return String.format(Locale.ENGLISH, "%s/%s", ua,version);
} | java | private static String loadUA(ClassLoader loader, String filename){
String ua = "cloudant-http";
String version = "unknown";
final InputStream propStream = loader.getResourceAsStream(filename);
final Properties properties = new Properties();
try {
if (propStream != null) {
try {
properties.load(propStream);
} finally {
propStream.close();
}
}
ua = properties.getProperty("user.agent.name", ua);
version = properties.getProperty("user.agent.version", version);
} catch (IOException e) {
// Swallow exception and use default values.
}
return String.format(Locale.ENGLISH, "%s/%s", ua,version);
} | [
"private",
"static",
"String",
"loadUA",
"(",
"ClassLoader",
"loader",
",",
"String",
"filename",
")",
"{",
"String",
"ua",
"=",
"\"cloudant-http\"",
";",
"String",
"version",
"=",
"\"unknown\"",
";",
"final",
"InputStream",
"propStream",
"=",
"loader",
".",
"... | Loads the properties file using the classloader provided. Creating a string from the properties
"user.agent.name" and "user.agent.version".
@param loader The class loader to use to load the resource.
@param filename The name of the file to load.
@return A string that represents the first part of the UA string eg java-cloudant/2.6.1 | [
"Loads",
"the",
"properties",
"file",
"using",
"the",
"classloader",
"provided",
".",
"Creating",
"a",
"string",
"from",
"the",
"properties",
"user",
".",
"agent",
".",
"name",
"and",
"user",
".",
"agent",
".",
"version",
"."
] | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-http/src/main/java/com/cloudant/http/internal/interceptors/UserAgentInterceptor.java#L73-L93 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java | MetadataFinder.deliverMountUpdate | private void deliverMountUpdate(SlotReference slot, boolean mounted) {
if (mounted) {
logger.info("Reporting media mounted in " + slot);
} else {
logger.info("Reporting media removed from " + slot);
}
for (final MountListener listener : getMountListeners()) {
try {
if (mounted) {
listener.mediaMounted(slot);
} else {
listener.mediaUnmounted(slot);
}
} catch (Throwable t) {
logger.warn("Problem delivering mount update to listener", t);
}
}
if (mounted) {
MetadataCache.tryAutoAttaching(slot);
}
} | java | private void deliverMountUpdate(SlotReference slot, boolean mounted) {
if (mounted) {
logger.info("Reporting media mounted in " + slot);
} else {
logger.info("Reporting media removed from " + slot);
}
for (final MountListener listener : getMountListeners()) {
try {
if (mounted) {
listener.mediaMounted(slot);
} else {
listener.mediaUnmounted(slot);
}
} catch (Throwable t) {
logger.warn("Problem delivering mount update to listener", t);
}
}
if (mounted) {
MetadataCache.tryAutoAttaching(slot);
}
} | [
"private",
"void",
"deliverMountUpdate",
"(",
"SlotReference",
"slot",
",",
"boolean",
"mounted",
")",
"{",
"if",
"(",
"mounted",
")",
"{",
"logger",
".",
"info",
"(",
"\"Reporting media mounted in \"",
"+",
"slot",
")",
";",
"}",
"else",
"{",
"logger",
".",... | Send a mount update announcement to all registered listeners, and see if we can auto-attach a media cache file.
@param slot the slot in which media has been mounted or unmounted
@param mounted will be {@code true} if there is now media mounted in the specified slot | [
"Send",
"a",
"mount",
"update",
"announcement",
"to",
"all",
"registered",
"listeners",
"and",
"see",
"if",
"we",
"can",
"auto",
"-",
"attach",
"a",
"media",
"cache",
"file",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java#L870-L892 |
dbracewell/hermes | hermes-core/src/main/java/com/davidbracewell/hermes/preprocessing/TextNormalizer.java | TextNormalizer.apply | public final String apply(String input, Language inputLanguage) {
if (input != null && Config.get(this.getClass(), inputLanguage, "apply").asBoolean(true)) {
return performNormalization(input, inputLanguage);
}
return input;
} | java | public final String apply(String input, Language inputLanguage) {
if (input != null && Config.get(this.getClass(), inputLanguage, "apply").asBoolean(true)) {
return performNormalization(input, inputLanguage);
}
return input;
} | [
"public",
"final",
"String",
"apply",
"(",
"String",
"input",
",",
"Language",
"inputLanguage",
")",
"{",
"if",
"(",
"input",
"!=",
"null",
"&&",
"Config",
".",
"get",
"(",
"this",
".",
"getClass",
"(",
")",
",",
"inputLanguage",
",",
"\"apply\"",
")",
... | Performs a pre-processing operation on the input string in the given input language
@param input The input text
@param inputLanguage The language of the input
@return The post-processed text | [
"Performs",
"a",
"pre",
"-",
"processing",
"operation",
"on",
"the",
"input",
"string",
"in",
"the",
"given",
"input",
"language"
] | train | https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/preprocessing/TextNormalizer.java#L46-L51 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/NGAExtensions.java | NGAExtensions.getFeatureStyleExtension | private static FeatureCoreStyleExtension getFeatureStyleExtension(
GeoPackageCore geoPackage) {
RelatedTablesCoreExtension relatedTables = new RelatedTablesCoreExtension(
geoPackage) {
@Override
public String getPrimaryKeyColumnName(String tableName) {
return null;
}
};
return new FeatureCoreStyleExtension(geoPackage, relatedTables) {
};
} | java | private static FeatureCoreStyleExtension getFeatureStyleExtension(
GeoPackageCore geoPackage) {
RelatedTablesCoreExtension relatedTables = new RelatedTablesCoreExtension(
geoPackage) {
@Override
public String getPrimaryKeyColumnName(String tableName) {
return null;
}
};
return new FeatureCoreStyleExtension(geoPackage, relatedTables) {
};
} | [
"private",
"static",
"FeatureCoreStyleExtension",
"getFeatureStyleExtension",
"(",
"GeoPackageCore",
"geoPackage",
")",
"{",
"RelatedTablesCoreExtension",
"relatedTables",
"=",
"new",
"RelatedTablesCoreExtension",
"(",
"geoPackage",
")",
"{",
"@",
"Override",
"public",
"Str... | Get a Feature Style Extension used only for deletions
@param geoPackage
GeoPackage
@return Feature Style Extension | [
"Get",
"a",
"Feature",
"Style",
"Extension",
"used",
"only",
"for",
"deletions"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/NGAExtensions.java#L334-L347 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/code/McCodeGen.java | McCodeGen.writeMethod | private void writeMethod(Definition def, Writer out, int indent) throws IOException
{
if (def.getMcfDefs().get(getNumOfMcf()).isDefineMethodInConnection())
{
if (def.getMcfDefs().get(getNumOfMcf()).getMethods().size() > 0)
{
for (MethodForConnection method : def.getMcfDefs().get(getNumOfMcf()).getMethods())
{
writeMethodSignature(out, indent, method);
writeLeftCurlyBracket(out, indent);
writeLogging(def, out, indent + 1, "trace", method.getMethodName());
if (!method.getReturnType().equals("void"))
{
writeEol(out);
if (BasicType.isPrimitiveType(method.getReturnType()))
{
writeWithIndent(out, indent + 1, "return " + BasicType.defaultValue(method.getReturnType()) + ";");
}
else
{
writeWithIndent(out, indent + 1, "return null;");
}
}
writeRightCurlyBracket(out, indent);
}
}
}
else
{
writeSimpleMethodSignature(out, indent, " * Call me", "void callMe()");
writeLeftCurlyBracket(out, indent);
writeLogging(def, out, indent + 1, "trace", "callMe");
writeRightCurlyBracket(out, indent);
}
} | java | private void writeMethod(Definition def, Writer out, int indent) throws IOException
{
if (def.getMcfDefs().get(getNumOfMcf()).isDefineMethodInConnection())
{
if (def.getMcfDefs().get(getNumOfMcf()).getMethods().size() > 0)
{
for (MethodForConnection method : def.getMcfDefs().get(getNumOfMcf()).getMethods())
{
writeMethodSignature(out, indent, method);
writeLeftCurlyBracket(out, indent);
writeLogging(def, out, indent + 1, "trace", method.getMethodName());
if (!method.getReturnType().equals("void"))
{
writeEol(out);
if (BasicType.isPrimitiveType(method.getReturnType()))
{
writeWithIndent(out, indent + 1, "return " + BasicType.defaultValue(method.getReturnType()) + ";");
}
else
{
writeWithIndent(out, indent + 1, "return null;");
}
}
writeRightCurlyBracket(out, indent);
}
}
}
else
{
writeSimpleMethodSignature(out, indent, " * Call me", "void callMe()");
writeLeftCurlyBracket(out, indent);
writeLogging(def, out, indent + 1, "trace", "callMe");
writeRightCurlyBracket(out, indent);
}
} | [
"private",
"void",
"writeMethod",
"(",
"Definition",
"def",
",",
"Writer",
"out",
",",
"int",
"indent",
")",
"throws",
"IOException",
"{",
"if",
"(",
"def",
".",
"getMcfDefs",
"(",
")",
".",
"get",
"(",
"getNumOfMcf",
"(",
")",
")",
".",
"isDefineMethodI... | Output methods
@param def definition
@param out Writer
@param indent space number
@throws IOException ioException | [
"Output",
"methods"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/McCodeGen.java#L473-L509 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/selenium/CertificateCreator.java | CertificateCreator.createTypicalMasterCert | @SuppressWarnings("deprecation")
public static X509Certificate createTypicalMasterCert(final KeyPair keyPair)
throws SignatureException, InvalidKeyException, SecurityException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException
{
X509V3CertificateGenerator v3CertGen = new X509V3CertificateGenerator();
X509Principal issuer=new X509Principal("O=CyberVillians.com,OU=CyberVillians Certification Authority,C=US");
// Create
v3CertGen.setSerialNumber(BigInteger.valueOf(1));
v3CertGen.setIssuerDN(issuer);
v3CertGen.setSubjectDN(issuer);
//Set validity period
v3CertGen.setNotBefore(new Date(System.currentTimeMillis() - 12 /* months */ *(1000L * 60 * 60 * 24 * 30)));
v3CertGen.setNotAfter (new Date(System.currentTimeMillis() + 240 /* months */ *(1000L * 60 * 60 * 24 * 30)));
//Set signature algorithm & public key
v3CertGen.setPublicKey(keyPair.getPublic());
v3CertGen.setSignatureAlgorithm(CertificateCreator.SIGN_ALGO);
// Add typical extensions for signing cert
v3CertGen.addExtension(
X509Extensions.SubjectKeyIdentifier,
false,
new SubjectKeyIdentifierStructure(keyPair.getPublic()));
v3CertGen.addExtension(
X509Extensions.BasicConstraints,
true,
new BasicConstraints(0));
v3CertGen.addExtension(
X509Extensions.KeyUsage,
false,
new KeyUsage(KeyUsage.cRLSign | KeyUsage.keyCertSign) );
DEREncodableVector typicalCAExtendedKeyUsages = new DEREncodableVector();
typicalCAExtendedKeyUsages.add(new DERObjectIdentifier(ExtendedKeyUsageConstants.serverAuth));
typicalCAExtendedKeyUsages.add(new DERObjectIdentifier(ExtendedKeyUsageConstants.OCSPSigning));
typicalCAExtendedKeyUsages.add(new DERObjectIdentifier(ExtendedKeyUsageConstants.verisignUnknown));
v3CertGen.addExtension(
X509Extensions.ExtendedKeyUsage,
false,
new DERSequence(typicalCAExtendedKeyUsages));
X509Certificate cert = v3CertGen.generate(keyPair.getPrivate(), "BC");
cert.checkValidity(new Date());
cert.verify(keyPair.getPublic());
return cert;
} | java | @SuppressWarnings("deprecation")
public static X509Certificate createTypicalMasterCert(final KeyPair keyPair)
throws SignatureException, InvalidKeyException, SecurityException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException
{
X509V3CertificateGenerator v3CertGen = new X509V3CertificateGenerator();
X509Principal issuer=new X509Principal("O=CyberVillians.com,OU=CyberVillians Certification Authority,C=US");
// Create
v3CertGen.setSerialNumber(BigInteger.valueOf(1));
v3CertGen.setIssuerDN(issuer);
v3CertGen.setSubjectDN(issuer);
//Set validity period
v3CertGen.setNotBefore(new Date(System.currentTimeMillis() - 12 /* months */ *(1000L * 60 * 60 * 24 * 30)));
v3CertGen.setNotAfter (new Date(System.currentTimeMillis() + 240 /* months */ *(1000L * 60 * 60 * 24 * 30)));
//Set signature algorithm & public key
v3CertGen.setPublicKey(keyPair.getPublic());
v3CertGen.setSignatureAlgorithm(CertificateCreator.SIGN_ALGO);
// Add typical extensions for signing cert
v3CertGen.addExtension(
X509Extensions.SubjectKeyIdentifier,
false,
new SubjectKeyIdentifierStructure(keyPair.getPublic()));
v3CertGen.addExtension(
X509Extensions.BasicConstraints,
true,
new BasicConstraints(0));
v3CertGen.addExtension(
X509Extensions.KeyUsage,
false,
new KeyUsage(KeyUsage.cRLSign | KeyUsage.keyCertSign) );
DEREncodableVector typicalCAExtendedKeyUsages = new DEREncodableVector();
typicalCAExtendedKeyUsages.add(new DERObjectIdentifier(ExtendedKeyUsageConstants.serverAuth));
typicalCAExtendedKeyUsages.add(new DERObjectIdentifier(ExtendedKeyUsageConstants.OCSPSigning));
typicalCAExtendedKeyUsages.add(new DERObjectIdentifier(ExtendedKeyUsageConstants.verisignUnknown));
v3CertGen.addExtension(
X509Extensions.ExtendedKeyUsage,
false,
new DERSequence(typicalCAExtendedKeyUsages));
X509Certificate cert = v3CertGen.generate(keyPair.getPrivate(), "BC");
cert.checkValidity(new Date());
cert.verify(keyPair.getPublic());
return cert;
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"static",
"X509Certificate",
"createTypicalMasterCert",
"(",
"final",
"KeyPair",
"keyPair",
")",
"throws",
"SignatureException",
",",
"InvalidKeyException",
",",
"SecurityException",
",",
"CertificateException"... | Creates a typical Certification Authority (CA) certificate.
@param keyPair
@throws SecurityException
@throws InvalidKeyException
@throws NoSuchProviderException
@throws NoSuchAlgorithmException
@throws CertificateException | [
"Creates",
"a",
"typical",
"Certification",
"Authority",
"(",
"CA",
")",
"certificate",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/selenium/CertificateCreator.java#L351-L407 |
CODAIT/stocator | src/main/java/com/ibm/stocator/fs/swift/SwiftAPIDirect.java | SwiftAPIDirect.getObject | public static SwiftInputStreamWrapper getObject(Path path, JossAccount account,
SwiftConnectionManager scm)
throws IOException {
return getObject(path, account, 0, 0, scm);
} | java | public static SwiftInputStreamWrapper getObject(Path path, JossAccount account,
SwiftConnectionManager scm)
throws IOException {
return getObject(path, account, 0, 0, scm);
} | [
"public",
"static",
"SwiftInputStreamWrapper",
"getObject",
"(",
"Path",
"path",
",",
"JossAccount",
"account",
",",
"SwiftConnectionManager",
"scm",
")",
"throws",
"IOException",
"{",
"return",
"getObject",
"(",
"path",
",",
"account",
",",
"0",
",",
"0",
",",
... | Get object
@param path path to object
@param account Joss account wrapper object
@param scm Swift connection manager
@return SwiftGETResponse input stream and content length
@throws IOException if network issues | [
"Get",
"object"
] | train | https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/swift/SwiftAPIDirect.java#L62-L66 |
alkacon/opencms-core | src/org/opencms/ui/components/CmsResourceIcon.java | CmsResourceIcon.getDefaultFileOrDetailType | public static String getDefaultFileOrDetailType(CmsObject cms, CmsResource resource) {
String type = null;
if (resource.isFolder()
&& !(OpenCms.getResourceManager().getResourceType(resource) instanceof CmsResourceTypeFolderExtended)
&& !CmsJspNavBuilder.isNavLevelFolder(cms, resource)) {
try {
CmsResource defaultFile = cms.readDefaultFile(resource, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED);
if (defaultFile != null) {
type = getDetailType(cms, defaultFile, resource);
if (type == null) {
type = OpenCms.getResourceManager().getResourceType(defaultFile).getTypeName();
}
}
} catch (CmsSecurityException e) {
// ignore
}
} else if (CmsResourceTypeXmlContainerPage.isContainerPage(resource)) {
type = getDetailType(cms, resource, null);
}
return type;
} | java | public static String getDefaultFileOrDetailType(CmsObject cms, CmsResource resource) {
String type = null;
if (resource.isFolder()
&& !(OpenCms.getResourceManager().getResourceType(resource) instanceof CmsResourceTypeFolderExtended)
&& !CmsJspNavBuilder.isNavLevelFolder(cms, resource)) {
try {
CmsResource defaultFile = cms.readDefaultFile(resource, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED);
if (defaultFile != null) {
type = getDetailType(cms, defaultFile, resource);
if (type == null) {
type = OpenCms.getResourceManager().getResourceType(defaultFile).getTypeName();
}
}
} catch (CmsSecurityException e) {
// ignore
}
} else if (CmsResourceTypeXmlContainerPage.isContainerPage(resource)) {
type = getDetailType(cms, resource, null);
}
return type;
} | [
"public",
"static",
"String",
"getDefaultFileOrDetailType",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
")",
"{",
"String",
"type",
"=",
"null",
";",
"if",
"(",
"resource",
".",
"isFolder",
"(",
")",
"&&",
"!",
"(",
"OpenCms",
".",
"getResourceM... | Returns the default file type or detail type for the given resource.<p>
@param cms the cms context
@param resource the container page resource
@return the detail content type | [
"Returns",
"the",
"default",
"file",
"type",
"or",
"detail",
"type",
"for",
"the",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsResourceIcon.java#L132-L157 |
Bernardo-MG/maven-site-fixer | src/main/java/com/bernardomg/velocity/tool/SiteTool.java | SiteTool.fixHeadingIds | public final void fixHeadingIds(final Element root) {
final Collection<Element> headings; // Headings to fix
String idText; // Text to generate the id
checkNotNull(root, "Received a null pointer as root element");
// Table rows with <th> tags in a <tbody>
headings = root.select("h1,h2,h3,h4,h5,h6");
for (final Element heading : headings) {
if (heading.hasAttr("id")) {
// Contains an id
// The id text is taken from the attribute
idText = heading.attr("id");
} else {
// Doesn't contain an id
// The id text is taken from the heading text
idText = heading.text();
}
heading.attr("id",
idText.toLowerCase().replaceAll(ID_INVALID_REGEX, ""));
}
} | java | public final void fixHeadingIds(final Element root) {
final Collection<Element> headings; // Headings to fix
String idText; // Text to generate the id
checkNotNull(root, "Received a null pointer as root element");
// Table rows with <th> tags in a <tbody>
headings = root.select("h1,h2,h3,h4,h5,h6");
for (final Element heading : headings) {
if (heading.hasAttr("id")) {
// Contains an id
// The id text is taken from the attribute
idText = heading.attr("id");
} else {
// Doesn't contain an id
// The id text is taken from the heading text
idText = heading.text();
}
heading.attr("id",
idText.toLowerCase().replaceAll(ID_INVALID_REGEX, ""));
}
} | [
"public",
"final",
"void",
"fixHeadingIds",
"(",
"final",
"Element",
"root",
")",
"{",
"final",
"Collection",
"<",
"Element",
">",
"headings",
";",
"// Headings to fix",
"String",
"idText",
";",
"// Text to generate the id",
"checkNotNull",
"(",
"root",
",",
"\"Re... | Adds or fixes heading ids.
<p>
If a heading has an id it will be corrected if needed, otherwise it will
be created from the heading text.
<p>
The following operations are applied during this process:
<ul>
<li>Text will be set to lower case</li>
<li>Underscores will be removed</li>
<li>Points will be removed</li>
<li>Empty spaces will be removed</li>
</ul>
<p>
With this headings will end looking like
{@code <h1 id=\"aheading\">A heading</h1>}.
@param root
root element with headings where an id should be added | [
"Adds",
"or",
"fixes",
"heading",
"ids",
".",
"<p",
">",
"If",
"a",
"heading",
"has",
"an",
"id",
"it",
"will",
"be",
"corrected",
"if",
"needed",
"otherwise",
"it",
"will",
"be",
"created",
"from",
"the",
"heading",
"text",
".",
"<p",
">",
"The",
"f... | train | https://github.com/Bernardo-MG/maven-site-fixer/blob/e064472faa7edb0fca11647a22d90ad72089baa3/src/main/java/com/bernardomg/velocity/tool/SiteTool.java#L130-L151 |
VoltDB/voltdb | src/frontend/org/voltdb/ClientInterface.java | ClientInterface.callExecuteTask | public ClientResponse callExecuteTask(long timeoutMS, byte[] params) throws IOException, InterruptedException {
SimpleClientResponseAdapter.SyncCallback syncCb = new SimpleClientResponseAdapter.SyncCallback();
callExecuteTaskAsync(syncCb, params);
return syncCb.getResponse(timeoutMS);
} | java | public ClientResponse callExecuteTask(long timeoutMS, byte[] params) throws IOException, InterruptedException {
SimpleClientResponseAdapter.SyncCallback syncCb = new SimpleClientResponseAdapter.SyncCallback();
callExecuteTaskAsync(syncCb, params);
return syncCb.getResponse(timeoutMS);
} | [
"public",
"ClientResponse",
"callExecuteTask",
"(",
"long",
"timeoutMS",
",",
"byte",
"[",
"]",
"params",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"SimpleClientResponseAdapter",
".",
"SyncCallback",
"syncCb",
"=",
"new",
"SimpleClientResponseAdapt... | Call @ExecuteTask to generate a MP transaction.
@param timeoutMS timeout in milliseconds
@param params actual parameter(s) for sub task to run
@return
@throws IOException
@throws InterruptedException | [
"Call",
"@ExecuteTask",
"to",
"generate",
"a",
"MP",
"transaction",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/ClientInterface.java#L2076-L2080 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/geopaparazzi/geopap4/DaoNotes.java | DaoNotes.getEnvelope | public static ReferencedEnvelope getEnvelope( IHMConnection connection, String noteTypeName ) throws Exception {
String query = "SELECT min(" + //
NotesTableFields.COLUMN_LON.getFieldName() + "), max(" + //
NotesTableFields.COLUMN_LON.getFieldName() + "), min(" + //
NotesTableFields.COLUMN_LAT.getFieldName() + "), max(" + //
NotesTableFields.COLUMN_LAT.getFieldName() + ") " + //
" FROM " + TABLE_NOTES;
if (noteTypeName != null) {
query += " where " + NotesTableFields.COLUMN_TEXT.getFieldName() + "='" + noteTypeName + "'";
} else {
String formFN = NotesTableFields.COLUMN_FORM.getFieldName();
query += " where " + formFN + " is null OR " + formFN + "=''";
}
try (IHMStatement statement = connection.createStatement(); IHMResultSet rs = statement.executeQuery(query);) {
if (rs.next()) {
double minX = rs.getDouble(1);
double maxX = rs.getDouble(2);
double minY = rs.getDouble(3);
double maxY = rs.getDouble(4);
ReferencedEnvelope env = new ReferencedEnvelope(minX, maxX, minY, maxY, DefaultGeographicCRS.WGS84);
return env;
}
} catch (Exception e) {
// print trace but return null
e.printStackTrace();
}
return null;
} | java | public static ReferencedEnvelope getEnvelope( IHMConnection connection, String noteTypeName ) throws Exception {
String query = "SELECT min(" + //
NotesTableFields.COLUMN_LON.getFieldName() + "), max(" + //
NotesTableFields.COLUMN_LON.getFieldName() + "), min(" + //
NotesTableFields.COLUMN_LAT.getFieldName() + "), max(" + //
NotesTableFields.COLUMN_LAT.getFieldName() + ") " + //
" FROM " + TABLE_NOTES;
if (noteTypeName != null) {
query += " where " + NotesTableFields.COLUMN_TEXT.getFieldName() + "='" + noteTypeName + "'";
} else {
String formFN = NotesTableFields.COLUMN_FORM.getFieldName();
query += " where " + formFN + " is null OR " + formFN + "=''";
}
try (IHMStatement statement = connection.createStatement(); IHMResultSet rs = statement.executeQuery(query);) {
if (rs.next()) {
double minX = rs.getDouble(1);
double maxX = rs.getDouble(2);
double minY = rs.getDouble(3);
double maxY = rs.getDouble(4);
ReferencedEnvelope env = new ReferencedEnvelope(minX, maxX, minY, maxY, DefaultGeographicCRS.WGS84);
return env;
}
} catch (Exception e) {
// print trace but return null
e.printStackTrace();
}
return null;
} | [
"public",
"static",
"ReferencedEnvelope",
"getEnvelope",
"(",
"IHMConnection",
"connection",
",",
"String",
"noteTypeName",
")",
"throws",
"Exception",
"{",
"String",
"query",
"=",
"\"SELECT min(\"",
"+",
"//",
"NotesTableFields",
".",
"COLUMN_LON",
".",
"getFieldName... | Get the current data envelope.
@param connection the db connection.
@param noteTypeName if <code>null</code>, simple notes are handled. Else this
is taken as name for the note type.
@return the envelope.
@throws Exception | [
"Get",
"the",
"current",
"data",
"envelope",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/geopaparazzi/geopap4/DaoNotes.java#L199-L230 |
structurizr/java | structurizr-core/src/com/structurizr/view/View.java | View.setAutomaticLayout | public void setAutomaticLayout(AutomaticLayout.RankDirection rankDirection, int rankSeparation, int nodeSeparation, int edgeSeparation, boolean vertices) {
this.automaticLayout = new AutomaticLayout(rankDirection, rankSeparation, nodeSeparation, edgeSeparation, vertices);
} | java | public void setAutomaticLayout(AutomaticLayout.RankDirection rankDirection, int rankSeparation, int nodeSeparation, int edgeSeparation, boolean vertices) {
this.automaticLayout = new AutomaticLayout(rankDirection, rankSeparation, nodeSeparation, edgeSeparation, vertices);
} | [
"public",
"void",
"setAutomaticLayout",
"(",
"AutomaticLayout",
".",
"RankDirection",
"rankDirection",
",",
"int",
"rankSeparation",
",",
"int",
"nodeSeparation",
",",
"int",
"edgeSeparation",
",",
"boolean",
"vertices",
")",
"{",
"this",
".",
"automaticLayout",
"="... | Enables the automatic layout for this view, with the specified settings.
@param rankDirection the rank direction
@param rankSeparation the separation between ranks (in pixels, a positive integer)
@param nodeSeparation the separation between nodes within the same rank (in pixels, a positive integer)
@param edgeSeparation the separation between edges (in pixels, a positive integer)
@param vertices whether vertices should be created during automatic layout | [
"Enables",
"the",
"automatic",
"layout",
"for",
"this",
"view",
"with",
"the",
"specified",
"settings",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/View.java#L169-L171 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java | DataService.executeQueryAsync | public void executeQueryAsync(String query, CallbackHandler callbackHandler) throws FMSException {
IntuitMessage intuitMessage = prepareQuery(query);
//set callback handler
intuitMessage.getRequestElements().setCallbackHandler(callbackHandler);
//execute async interceptors
executeAsyncInterceptors(intuitMessage);
} | java | public void executeQueryAsync(String query, CallbackHandler callbackHandler) throws FMSException {
IntuitMessage intuitMessage = prepareQuery(query);
//set callback handler
intuitMessage.getRequestElements().setCallbackHandler(callbackHandler);
//execute async interceptors
executeAsyncInterceptors(intuitMessage);
} | [
"public",
"void",
"executeQueryAsync",
"(",
"String",
"query",
",",
"CallbackHandler",
"callbackHandler",
")",
"throws",
"FMSException",
"{",
"IntuitMessage",
"intuitMessage",
"=",
"prepareQuery",
"(",
"query",
")",
";",
"//set callback handler",
"intuitMessage",
".",
... | Method to retrieve records for the given list of query in asynchronous fashion
@param query
@param callbackHandler
the callback handler
@throws FMSException | [
"Method",
"to",
"retrieve",
"records",
"for",
"the",
"given",
"list",
"of",
"query",
"in",
"asynchronous",
"fashion"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java#L965-L973 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/util/WindowUtils.java | WindowUtils.centerOnParent | public static void centerOnParent(Window window, Component parent) {
if (parent == null || !parent.isShowing()) {
// call our own centerOnScreen so we work around bug in
// setLocationRelativeTo(null)
centerOnScreen(window);
}
else {
window.setLocationRelativeTo(parent);
}
} | java | public static void centerOnParent(Window window, Component parent) {
if (parent == null || !parent.isShowing()) {
// call our own centerOnScreen so we work around bug in
// setLocationRelativeTo(null)
centerOnScreen(window);
}
else {
window.setLocationRelativeTo(parent);
}
} | [
"public",
"static",
"void",
"centerOnParent",
"(",
"Window",
"window",
",",
"Component",
"parent",
")",
"{",
"if",
"(",
"parent",
"==",
"null",
"||",
"!",
"parent",
".",
"isShowing",
"(",
")",
")",
"{",
"// call our own centerOnScreen so we work around bug in",
... | Center the window relative to it's parent. If the parent is null, or not showing,
the window will be centered on the screen
@param window the window to center
@param parent the parent | [
"Center",
"the",
"window",
"relative",
"to",
"it",
"s",
"parent",
".",
"If",
"the",
"parent",
"is",
"null",
"or",
"not",
"showing",
"the",
"window",
"will",
"be",
"centered",
"on",
"the",
"screen"
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/WindowUtils.java#L114-L123 |
CenturyLinkCloud/mdw | mdw-services/src/com/centurylink/mdw/services/task/factory/TaskInstanceNotifierFactory.java | TaskInstanceNotifierFactory.getNotifierSpecs | public List<String> getNotifierSpecs(Long taskId, String outcome) throws ObserverException {
TaskTemplate taskVO = TaskTemplateCache.getTaskTemplate(taskId);
if (taskVO != null) {
String noticesAttr = taskVO.getAttribute(TaskAttributeConstant.NOTICES);
if (!StringHelper.isEmpty(noticesAttr) && !"$DefaultNotices".equals(noticesAttr)) {
return parseNoticiesAttr(noticesAttr, outcome);
}
}
return null;
} | java | public List<String> getNotifierSpecs(Long taskId, String outcome) throws ObserverException {
TaskTemplate taskVO = TaskTemplateCache.getTaskTemplate(taskId);
if (taskVO != null) {
String noticesAttr = taskVO.getAttribute(TaskAttributeConstant.NOTICES);
if (!StringHelper.isEmpty(noticesAttr) && !"$DefaultNotices".equals(noticesAttr)) {
return parseNoticiesAttr(noticesAttr, outcome);
}
}
return null;
} | [
"public",
"List",
"<",
"String",
">",
"getNotifierSpecs",
"(",
"Long",
"taskId",
",",
"String",
"outcome",
")",
"throws",
"ObserverException",
"{",
"TaskTemplate",
"taskVO",
"=",
"TaskTemplateCache",
".",
"getTaskTemplate",
"(",
"taskId",
")",
";",
"if",
"(",
... | Returns a list of notifier class name and template name pairs, delimited by colon
@param taskId
@param outcome
@return the registered notifier or null if not found | [
"Returns",
"a",
"list",
"of",
"notifier",
"class",
"name",
"and",
"template",
"name",
"pairs",
"delimited",
"by",
"colon"
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/services/task/factory/TaskInstanceNotifierFactory.java#L59-L68 |
apache/groovy | src/main/java/org/codehaus/groovy/transform/AnnotationCollectorTransform.java | AnnotationCollectorTransform.addError | protected void addError(String message, ASTNode node, SourceUnit source) {
source.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(new SyntaxException(
message, node.getLineNumber(), node.getColumnNumber(), node.getLastLineNumber(), node.getLastColumnNumber()
), source));
} | java | protected void addError(String message, ASTNode node, SourceUnit source) {
source.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(new SyntaxException(
message, node.getLineNumber(), node.getColumnNumber(), node.getLastLineNumber(), node.getLastColumnNumber()
), source));
} | [
"protected",
"void",
"addError",
"(",
"String",
"message",
",",
"ASTNode",
"node",
",",
"SourceUnit",
"source",
")",
"{",
"source",
".",
"getErrorCollector",
"(",
")",
".",
"addErrorAndContinue",
"(",
"new",
"SyntaxErrorMessage",
"(",
"new",
"SyntaxException",
"... | Adds a new syntax error to the source unit and then continues.
@param message the message
@param node the node for the error report
@param source the source unit for the error report | [
"Adds",
"a",
"new",
"syntax",
"error",
"to",
"the",
"source",
"unit",
"and",
"then",
"continues",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/AnnotationCollectorTransform.java#L196-L200 |
apptik/JustJson | json-core/src/main/java/io/apptik/json/JsonObject.java | JsonObject.optLong | public Long optLong(String name, Long fallback) {
return optLong(name, fallback, true);
} | java | public Long optLong(String name, Long fallback) {
return optLong(name, fallback, true);
} | [
"public",
"Long",
"optLong",
"(",
"String",
"name",
",",
"Long",
"fallback",
")",
"{",
"return",
"optLong",
"(",
"name",
",",
"fallback",
",",
"true",
")",
";",
"}"
] | Returns the value mapped by {@code name} if it exists and is a long or
can be coerced to a long, or {@code fallback} otherwise. Note that Util represents
numbers as doubles, so this is <a href="#lossy">lossy</a>; use strings to transfer
numbers via Util. | [
"Returns",
"the",
"value",
"mapped",
"by",
"{"
] | train | https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-core/src/main/java/io/apptik/json/JsonObject.java#L556-L558 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/cost/SemiJoinStatsCalculator.java | SemiJoinStatsCalculator.computeSemiJoin | public static PlanNodeStatsEstimate computeSemiJoin(PlanNodeStatsEstimate sourceStats, PlanNodeStatsEstimate filteringSourceStats, Symbol sourceJoinSymbol, Symbol filteringSourceJoinSymbol)
{
return compute(sourceStats, filteringSourceStats, sourceJoinSymbol, filteringSourceJoinSymbol,
(sourceJoinSymbolStats, filteringSourceJoinSymbolStats) ->
min(filteringSourceJoinSymbolStats.getDistinctValuesCount(), sourceJoinSymbolStats.getDistinctValuesCount()));
} | java | public static PlanNodeStatsEstimate computeSemiJoin(PlanNodeStatsEstimate sourceStats, PlanNodeStatsEstimate filteringSourceStats, Symbol sourceJoinSymbol, Symbol filteringSourceJoinSymbol)
{
return compute(sourceStats, filteringSourceStats, sourceJoinSymbol, filteringSourceJoinSymbol,
(sourceJoinSymbolStats, filteringSourceJoinSymbolStats) ->
min(filteringSourceJoinSymbolStats.getDistinctValuesCount(), sourceJoinSymbolStats.getDistinctValuesCount()));
} | [
"public",
"static",
"PlanNodeStatsEstimate",
"computeSemiJoin",
"(",
"PlanNodeStatsEstimate",
"sourceStats",
",",
"PlanNodeStatsEstimate",
"filteringSourceStats",
",",
"Symbol",
"sourceJoinSymbol",
",",
"Symbol",
"filteringSourceJoinSymbol",
")",
"{",
"return",
"compute",
"("... | Basically it works as low and high values were the same for source and filteringSource and just looks at NDVs. | [
"Basically",
"it",
"works",
"as",
"low",
"and",
"high",
"values",
"were",
"the",
"same",
"for",
"source",
"and",
"filteringSource",
"and",
"just",
"looks",
"at",
"NDVs",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/cost/SemiJoinStatsCalculator.java#L33-L38 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/database/CmsDatabaseImportFromServer.java | CmsDatabaseImportFromServer.getFileListFromServer | protected static List getFileListFromServer(boolean includeFolders) {
List result = new ArrayList();
// get the RFS package export path
String exportpath = OpenCms.getSystemInfo().getPackagesRfsPath();
File folder = new File(exportpath);
// get a list of all files of the packages folder
String[] files = folder.list();
for (int i = 0; i < files.length; i++) {
File diskFile = new File(exportpath, files[i]);
// check this is a file and ends with zip -> this is a database upload file
if (diskFile.isFile() && diskFile.getName().endsWith(".zip")) {
result.add(diskFile.getName());
} else if (diskFile.isDirectory()
&& includeFolders
&& (!diskFile.getName().equalsIgnoreCase(FOLDER_MODULES))
&& ((new File(diskFile + File.separator + FILE_MANIFEST)).exists())) {
// this is an unpacked package, add it to uploadable files
result.add(diskFile.getName());
}
}
return result;
} | java | protected static List getFileListFromServer(boolean includeFolders) {
List result = new ArrayList();
// get the RFS package export path
String exportpath = OpenCms.getSystemInfo().getPackagesRfsPath();
File folder = new File(exportpath);
// get a list of all files of the packages folder
String[] files = folder.list();
for (int i = 0; i < files.length; i++) {
File diskFile = new File(exportpath, files[i]);
// check this is a file and ends with zip -> this is a database upload file
if (diskFile.isFile() && diskFile.getName().endsWith(".zip")) {
result.add(diskFile.getName());
} else if (diskFile.isDirectory()
&& includeFolders
&& (!diskFile.getName().equalsIgnoreCase(FOLDER_MODULES))
&& ((new File(diskFile + File.separator + FILE_MANIFEST)).exists())) {
// this is an unpacked package, add it to uploadable files
result.add(diskFile.getName());
}
}
return result;
} | [
"protected",
"static",
"List",
"getFileListFromServer",
"(",
"boolean",
"includeFolders",
")",
"{",
"List",
"result",
"=",
"new",
"ArrayList",
"(",
")",
";",
"// get the RFS package export path",
"String",
"exportpath",
"=",
"OpenCms",
".",
"getSystemInfo",
"(",
")"... | Returns the list of all uploadable zip files and uploadable folders available on the server.<p>
@param includeFolders if true, the uploadable folders are included in the list
@return the list of all uploadable zip files and uploadable folders available on the server | [
"Returns",
"the",
"list",
"of",
"all",
"uploadable",
"zip",
"files",
"and",
"uploadable",
"folders",
"available",
"on",
"the",
"server",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/database/CmsDatabaseImportFromServer.java#L117-L142 |
drewnoakes/metadata-extractor | Source/com/drew/metadata/eps/EpsReader.java | EpsReader.extractIccData | private static void extractIccData(@NotNull final Metadata metadata, @NotNull SequentialReader reader) throws IOException
{
byte[] buffer = decodeHexCommentBlock(reader);
if (buffer != null)
new IccReader().extract(new ByteArrayReader(buffer), metadata);
} | java | private static void extractIccData(@NotNull final Metadata metadata, @NotNull SequentialReader reader) throws IOException
{
byte[] buffer = decodeHexCommentBlock(reader);
if (buffer != null)
new IccReader().extract(new ByteArrayReader(buffer), metadata);
} | [
"private",
"static",
"void",
"extractIccData",
"(",
"@",
"NotNull",
"final",
"Metadata",
"metadata",
",",
"@",
"NotNull",
"SequentialReader",
"reader",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"decodeHexCommentBlock",
"(",
"reader",
")... | Decodes a commented hex section, and uses {@link IccReader} to decode the resulting data. | [
"Decodes",
"a",
"commented",
"hex",
"section",
"and",
"uses",
"{"
] | train | https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/metadata/eps/EpsReader.java#L243-L249 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/SLINKHDBSCANLinearMemory.java | SLINKHDBSCANLinearMemory.step3 | private void step3(DBIDRef id, WritableDBIDDataStore pi, WritableDoubleDataStore lambda, DBIDs processedIDs, WritableDoubleDataStore m) {
DBIDVar p_i = DBIDUtil.newVar();
// for i = 1..n
for(DBIDIter it = processedIDs.iter(); it.valid(); it.advance()) {
double l_i = lambda.doubleValue(it);
double m_i = m.doubleValue(it);
pi.assignVar(it, p_i); // p_i = pi(it)
double mp_i = m.doubleValue(p_i);
// if L(i) >= M(i)
if(l_i >= m_i) {
// M(P(i)) = min { M(P(i)), L(i) }
if(l_i < mp_i) {
m.putDouble(p_i, l_i);
}
// L(i) = M(i)
lambda.putDouble(it, m_i);
// P(i) = n+1;
pi.put(it, id);
}
else {
// M(P(i)) = min { M(P(i)), M(i) }
if(m_i < mp_i) {
m.putDouble(p_i, m_i);
}
}
}
} | java | private void step3(DBIDRef id, WritableDBIDDataStore pi, WritableDoubleDataStore lambda, DBIDs processedIDs, WritableDoubleDataStore m) {
DBIDVar p_i = DBIDUtil.newVar();
// for i = 1..n
for(DBIDIter it = processedIDs.iter(); it.valid(); it.advance()) {
double l_i = lambda.doubleValue(it);
double m_i = m.doubleValue(it);
pi.assignVar(it, p_i); // p_i = pi(it)
double mp_i = m.doubleValue(p_i);
// if L(i) >= M(i)
if(l_i >= m_i) {
// M(P(i)) = min { M(P(i)), L(i) }
if(l_i < mp_i) {
m.putDouble(p_i, l_i);
}
// L(i) = M(i)
lambda.putDouble(it, m_i);
// P(i) = n+1;
pi.put(it, id);
}
else {
// M(P(i)) = min { M(P(i)), M(i) }
if(m_i < mp_i) {
m.putDouble(p_i, m_i);
}
}
}
} | [
"private",
"void",
"step3",
"(",
"DBIDRef",
"id",
",",
"WritableDBIDDataStore",
"pi",
",",
"WritableDoubleDataStore",
"lambda",
",",
"DBIDs",
"processedIDs",
",",
"WritableDoubleDataStore",
"m",
")",
"{",
"DBIDVar",
"p_i",
"=",
"DBIDUtil",
".",
"newVar",
"(",
")... | Third step: Determine the values for P and L
@param id the id of the object to be inserted into the pointer
representation
@param pi Pi data store
@param lambda Lambda data store
@param processedIDs the already processed ids
@param m Data store | [
"Third",
"step",
":",
"Determine",
"the",
"values",
"for",
"P",
"and",
"L"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/SLINKHDBSCANLinearMemory.java#L176-L205 |
threerings/narya | core/src/main/java/com/threerings/crowd/chat/client/ChatDirector.java | ChatDirector.displayInfo | public void displayInfo (String bundle, String message, String localtype)
{
displaySystem(bundle, message, SystemMessage.INFO, localtype);
} | java | public void displayInfo (String bundle, String message, String localtype)
{
displaySystem(bundle, message, SystemMessage.INFO, localtype);
} | [
"public",
"void",
"displayInfo",
"(",
"String",
"bundle",
",",
"String",
"message",
",",
"String",
"localtype",
")",
"{",
"displaySystem",
"(",
"bundle",
",",
"message",
",",
"SystemMessage",
".",
"INFO",
",",
"localtype",
")",
";",
"}"
] | Display a system INFO message as if it had come from the server.
Info messages are sent when something happens that was neither directly triggered by the
user, nor requires direct action. | [
"Display",
"a",
"system",
"INFO",
"message",
"as",
"if",
"it",
"had",
"come",
"from",
"the",
"server",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/chat/client/ChatDirector.java#L332-L335 |
JOML-CI/JOML | src/org/joml/Vector3d.java | Vector3d.rotateAxis | public Vector3d rotateAxis(double angle, double x, double y, double z) {
return rotateAxis(angle, x, y, z, thisOrNew());
} | java | public Vector3d rotateAxis(double angle, double x, double y, double z) {
return rotateAxis(angle, x, y, z, thisOrNew());
} | [
"public",
"Vector3d",
"rotateAxis",
"(",
"double",
"angle",
",",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
")",
"{",
"return",
"rotateAxis",
"(",
"angle",
",",
"x",
",",
"y",
",",
"z",
",",
"thisOrNew",
"(",
")",
")",
";",
"}"
] | Rotate this vector the specified radians around the given rotation axis.
@param angle
the angle in radians
@param x
the x component of the rotation axis
@param y
the y component of the rotation axis
@param z
the z component of the rotation axis
@return a vector holding the result | [
"Rotate",
"this",
"vector",
"the",
"specified",
"radians",
"around",
"the",
"given",
"rotation",
"axis",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector3d.java#L1517-L1519 |
line/armeria | core/src/main/java/com/linecorp/armeria/client/retry/RetryingClient.java | RetryingClient.getNextDelay | @SuppressWarnings("MethodMayBeStatic") // Intentionally left non-static for better user experience.
protected final long getNextDelay(ClientRequestContext ctx, Backoff backoff, long millisAfterFromServer) {
requireNonNull(ctx, "ctx");
requireNonNull(backoff, "backoff");
final State state = ctx.attr(STATE).get();
final int currentAttemptNo = state.currentAttemptNoWith(backoff);
if (currentAttemptNo < 0) {
logger.debug("Exceeded the default number of max attempt: {}", state.maxTotalAttempts);
return -1;
}
long nextDelay = backoff.nextDelayMillis(currentAttemptNo);
if (nextDelay < 0) {
logger.debug("Exceeded the number of max attempts in the backoff: {}", backoff);
return -1;
}
nextDelay = Math.max(nextDelay, millisAfterFromServer);
if (state.timeoutForWholeRetryEnabled() && nextDelay > state.actualResponseTimeoutMillis()) {
// The nextDelay will be after the moment which timeout will happen. So return just -1.
return -1;
}
return nextDelay;
} | java | @SuppressWarnings("MethodMayBeStatic") // Intentionally left non-static for better user experience.
protected final long getNextDelay(ClientRequestContext ctx, Backoff backoff, long millisAfterFromServer) {
requireNonNull(ctx, "ctx");
requireNonNull(backoff, "backoff");
final State state = ctx.attr(STATE).get();
final int currentAttemptNo = state.currentAttemptNoWith(backoff);
if (currentAttemptNo < 0) {
logger.debug("Exceeded the default number of max attempt: {}", state.maxTotalAttempts);
return -1;
}
long nextDelay = backoff.nextDelayMillis(currentAttemptNo);
if (nextDelay < 0) {
logger.debug("Exceeded the number of max attempts in the backoff: {}", backoff);
return -1;
}
nextDelay = Math.max(nextDelay, millisAfterFromServer);
if (state.timeoutForWholeRetryEnabled() && nextDelay > state.actualResponseTimeoutMillis()) {
// The nextDelay will be after the moment which timeout will happen. So return just -1.
return -1;
}
return nextDelay;
} | [
"@",
"SuppressWarnings",
"(",
"\"MethodMayBeStatic\"",
")",
"// Intentionally left non-static for better user experience.",
"protected",
"final",
"long",
"getNextDelay",
"(",
"ClientRequestContext",
"ctx",
",",
"Backoff",
"backoff",
",",
"long",
"millisAfterFromServer",
")",
... | Returns the next delay which retry will be made after. The delay will be:
<p>{@code Math.min(responseTimeoutMillis, Math.max(Backoff.nextDelayMillis(int),
millisAfterFromServer))}
@return the number of milliseconds to wait for before attempting a retry. -1 if the
{@code currentAttemptNo} exceeds the {@code maxAttempts} or the {@code nextDelay} is after
the moment which timeout happens. | [
"Returns",
"the",
"next",
"delay",
"which",
"retry",
"will",
"be",
"made",
"after",
".",
"The",
"delay",
"will",
"be",
":"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/retry/RetryingClient.java#L214-L239 |
codelibs/fess | src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java | FessMessages.addErrorsFailedToDeleteFile | public FessMessages addErrorsFailedToDeleteFile(String property, String arg0) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_failed_to_delete_file, arg0));
return this;
} | java | public FessMessages addErrorsFailedToDeleteFile(String property, String arg0) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_failed_to_delete_file, arg0));
return this;
} | [
"public",
"FessMessages",
"addErrorsFailedToDeleteFile",
"(",
"String",
"property",
",",
"String",
"arg0",
")",
"{",
"assertPropertyNotNull",
"(",
"property",
")",
";",
"add",
"(",
"property",
",",
"new",
"UserMessage",
"(",
"ERRORS_failed_to_delete_file",
",",
"arg... | Add the created action message for the key 'errors.failed_to_delete_file' with parameters.
<pre>
message: Failed to delete {0} file.
</pre>
@param property The property name for the message. (NotNull)
@param arg0 The parameter arg0 for message. (NotNull)
@return this. (NotNull) | [
"Add",
"the",
"created",
"action",
"message",
"for",
"the",
"key",
"errors",
".",
"failed_to_delete_file",
"with",
"parameters",
".",
"<pre",
">",
"message",
":",
"Failed",
"to",
"delete",
"{",
"0",
"}",
"file",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L1462-L1466 |
statefulj/statefulj | statefulj-persistence/statefulj-persistence-mongo/src/main/java/org/statefulj/persistence/mongo/MongoCascadeSupport.java | MongoCascadeSupport.onAfterSave | @Override
public void onAfterSave(Object source, DBObject dbo) {
this.persister.onAfterSave(source, dbo);
} | java | @Override
public void onAfterSave(Object source, DBObject dbo) {
this.persister.onAfterSave(source, dbo);
} | [
"@",
"Override",
"public",
"void",
"onAfterSave",
"(",
"Object",
"source",
",",
"DBObject",
"dbo",
")",
"{",
"this",
".",
"persister",
".",
"onAfterSave",
"(",
"source",
",",
"dbo",
")",
";",
"}"
] | Pass the Save event to the MongoPersister to cascade to the StateDocument
(non-Javadoc)
@see org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener#onBeforeConvert(java.lang.Object) | [
"Pass",
"the",
"Save",
"event",
"to",
"the",
"MongoPersister",
"to",
"cascade",
"to",
"the",
"StateDocument"
] | train | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-persistence/statefulj-persistence-mongo/src/main/java/org/statefulj/persistence/mongo/MongoCascadeSupport.java#L40-L43 |
mapsforge/mapsforge | mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/model/OSMTag.java | OSMTag.fromOSMTag | public static OSMTag fromOSMTag(OSMTag otherTag, short newID) {
return new OSMTag(newID, otherTag.getKey(), otherTag.getValue(), otherTag.getZoomAppear(),
otherTag.isRenderable(), otherTag.isForcePolygonLine(), otherTag.isLabelPosition());
} | java | public static OSMTag fromOSMTag(OSMTag otherTag, short newID) {
return new OSMTag(newID, otherTag.getKey(), otherTag.getValue(), otherTag.getZoomAppear(),
otherTag.isRenderable(), otherTag.isForcePolygonLine(), otherTag.isLabelPosition());
} | [
"public",
"static",
"OSMTag",
"fromOSMTag",
"(",
"OSMTag",
"otherTag",
",",
"short",
"newID",
")",
"{",
"return",
"new",
"OSMTag",
"(",
"newID",
",",
"otherTag",
".",
"getKey",
"(",
")",
",",
"otherTag",
".",
"getValue",
"(",
")",
",",
"otherTag",
".",
... | Convenience method that constructs a new OSMTag with a new id from another OSMTag.
@param otherTag the OSMTag to copy
@param newID the new id
@return a newly constructed OSMTag with the attributes of otherTag | [
"Convenience",
"method",
"that",
"constructs",
"a",
"new",
"OSMTag",
"with",
"a",
"new",
"id",
"from",
"another",
"OSMTag",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/model/OSMTag.java#L33-L36 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/helper/JMLambda.java | JMLambda.runAndReturn | public static <R> R runAndReturn(Runnable runnable, R returnObject) {
return runAndReturn(runnable, () -> returnObject);
} | java | public static <R> R runAndReturn(Runnable runnable, R returnObject) {
return runAndReturn(runnable, () -> returnObject);
} | [
"public",
"static",
"<",
"R",
">",
"R",
"runAndReturn",
"(",
"Runnable",
"runnable",
",",
"R",
"returnObject",
")",
"{",
"return",
"runAndReturn",
"(",
"runnable",
",",
"(",
")",
"->",
"returnObject",
")",
";",
"}"
] | Run and return r.
@param <R> the type parameter
@param runnable the runnable
@param returnObject the return object
@return the r | [
"Run",
"and",
"return",
"r",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMLambda.java#L463-L465 |
cdk/cdk | tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomTetrahedralLigandPlacer3D.java | AtomTetrahedralLigandPlacer3D.calculate3DCoordinates3 | public Point3d calculate3DCoordinates3(Point3d aPoint, Point3d bPoint, Point3d cPoint, Point3d dPoint, double length) {
//logger.debug("3DCoordinates3");
Vector3d bc = new Vector3d(bPoint);
bc.sub(cPoint);
Vector3d dc = new Vector3d(dPoint);
dc.sub(cPoint);
Vector3d ca = new Vector3d(cPoint);
ca.sub(aPoint);
Vector3d n1 = new Vector3d();
Vector3d n2 = new Vector3d();
n1.cross(bc, dc);
n1.normalize();
n1.scale(length);
Vector3d ax = new Vector3d(aPoint);
ax.add(n1);
ax.sub(aPoint);
Vector3d ax2 = new Vector3d(aPoint);
ax2.add(n2);
ax2.sub(aPoint);
Point3d point = new Point3d(aPoint);
double dotProduct = ca.dot(ax);
double angle = Math.acos((dotProduct) / (ax.length() * ca.length()));
if (angle < 1.5) {
n2.cross(dc, bc);
n2.normalize();
n2.scale(length);
point.add(n2);
} else {
point.add(n1);
}
bc = null;
dc = null;
ca = null;
n1 = null;
n2 = null;
return point;
} | java | public Point3d calculate3DCoordinates3(Point3d aPoint, Point3d bPoint, Point3d cPoint, Point3d dPoint, double length) {
//logger.debug("3DCoordinates3");
Vector3d bc = new Vector3d(bPoint);
bc.sub(cPoint);
Vector3d dc = new Vector3d(dPoint);
dc.sub(cPoint);
Vector3d ca = new Vector3d(cPoint);
ca.sub(aPoint);
Vector3d n1 = new Vector3d();
Vector3d n2 = new Vector3d();
n1.cross(bc, dc);
n1.normalize();
n1.scale(length);
Vector3d ax = new Vector3d(aPoint);
ax.add(n1);
ax.sub(aPoint);
Vector3d ax2 = new Vector3d(aPoint);
ax2.add(n2);
ax2.sub(aPoint);
Point3d point = new Point3d(aPoint);
double dotProduct = ca.dot(ax);
double angle = Math.acos((dotProduct) / (ax.length() * ca.length()));
if (angle < 1.5) {
n2.cross(dc, bc);
n2.normalize();
n2.scale(length);
point.add(n2);
} else {
point.add(n1);
}
bc = null;
dc = null;
ca = null;
n1 = null;
n2 = null;
return point;
} | [
"public",
"Point3d",
"calculate3DCoordinates3",
"(",
"Point3d",
"aPoint",
",",
"Point3d",
"bPoint",
",",
"Point3d",
"cPoint",
",",
"Point3d",
"dPoint",
",",
"double",
"length",
")",
"{",
"//logger.debug(\"3DCoordinates3\");",
"Vector3d",
"bc",
"=",
"new",
"Vector3d"... | Calculate new point X in a B-A(-D)-C system. It forms a B-A(-D)(-C)-X
system. (3) 3 ligands(B, C, D) of refAtom A (i) 1 points required; if A, B,
C, D coplanar, no points. else vector is resultant of BA, CA, DA
@param aPoint to which substituents are added
@param bPoint first ligand of A
@param cPoint second ligand of A
@param dPoint third ligand of A
@param length A-X length
@return Point3d nwanted points (or null if failed (coplanar)) | [
"Calculate",
"new",
"point",
"X",
"in",
"a",
"B",
"-",
"A",
"(",
"-",
"D",
")",
"-",
"C",
"system",
".",
"It",
"forms",
"a",
"B",
"-",
"A",
"(",
"-",
"D",
")",
"(",
"-",
"C",
")",
"-",
"X",
"system",
".",
"(",
"3",
")",
"3",
"ligands",
... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomTetrahedralLigandPlacer3D.java#L507-L551 |
kiegroup/jbpm | jbpm-bpmn2-emfextmodel/src/main/java/org/jboss/drools/util/DroolsSwitch.java | DroolsSwitch.doSwitch | protected T doSwitch(EClass theEClass, EObject theEObject) {
if (theEClass.eContainer() == modelPackage) {
return doSwitch(theEClass.getClassifierID(), theEObject);
}
else {
List<EClass> eSuperTypes = theEClass.getESuperTypes();
return
eSuperTypes.isEmpty() ?
defaultCase(theEObject) :
doSwitch(eSuperTypes.get(0), theEObject);
}
} | java | protected T doSwitch(EClass theEClass, EObject theEObject) {
if (theEClass.eContainer() == modelPackage) {
return doSwitch(theEClass.getClassifierID(), theEObject);
}
else {
List<EClass> eSuperTypes = theEClass.getESuperTypes();
return
eSuperTypes.isEmpty() ?
defaultCase(theEObject) :
doSwitch(eSuperTypes.get(0), theEObject);
}
} | [
"protected",
"T",
"doSwitch",
"(",
"EClass",
"theEClass",
",",
"EObject",
"theEObject",
")",
"{",
"if",
"(",
"theEClass",
".",
"eContainer",
"(",
")",
"==",
"modelPackage",
")",
"{",
"return",
"doSwitch",
"(",
"theEClass",
".",
"getClassifierID",
"(",
")",
... | Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
<!-- begin-user-doc -->
<!-- end-user-doc -->
@return the first non-null result returned by a <code>caseXXX</code> call.
@generated | [
"Calls",
"<code",
">",
"caseXXX<",
"/",
"code",
">",
"for",
"each",
"class",
"of",
"the",
"model",
"until",
"one",
"returns",
"a",
"non",
"null",
"result",
";",
"it",
"yields",
"that",
"result",
".",
"<!",
"--",
"begin",
"-",
"user",
"-",
"doc",
"--"... | train | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-bpmn2-emfextmodel/src/main/java/org/jboss/drools/util/DroolsSwitch.java#L80-L91 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java | ConditionalFunctions.missingIf | public static Expression missingIf(Expression expression1, Expression expression2) {
return x("MISSINGIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | java | public static Expression missingIf(Expression expression1, Expression expression2) {
return x("MISSINGIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | [
"public",
"static",
"Expression",
"missingIf",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
")",
"{",
"return",
"x",
"(",
"\"MISSINGIF(\"",
"+",
"expression1",
".",
"toString",
"(",
")",
"+",
"\", \"",
"+",
"expression2",
".",
"toString",
... | Returned expression results in MISSING if expression1 = expression2, otherwise returns expression1.
Returns MISSING or NULL if either input is MISSING or NULL.. | [
"Returned",
"expression",
"results",
"in",
"MISSING",
"if",
"expression1",
"=",
"expression2",
"otherwise",
"returns",
"expression1",
".",
"Returns",
"MISSING",
"or",
"NULL",
"if",
"either",
"input",
"is",
"MISSING",
"or",
"NULL",
".."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L83-L85 |
jtmelton/appsensor | analysis-engines/appsensor-analysis-rules/src/main/java/org/owasp/appsensor/analysis/AggregateEventAnalysisEngine.java | AggregateEventAnalysisEngine.generateAttack | public void generateAttack(Event triggerEvent, Rule rule) {
logger.info("Attack generated on rule: " + rule.getGuid() + ", by user: " + triggerEvent.getUser().getUsername());
Attack attack = new Attack().
setUser(new User(triggerEvent.getUser().getUsername())).
setRule(rule).
setTimestamp(triggerEvent.getTimestamp()).
setDetectionSystem(triggerEvent.getDetectionSystem()).
setResource(triggerEvent.getResource());
appSensorServer.getAttackStore().addAttack(attack);
} | java | public void generateAttack(Event triggerEvent, Rule rule) {
logger.info("Attack generated on rule: " + rule.getGuid() + ", by user: " + triggerEvent.getUser().getUsername());
Attack attack = new Attack().
setUser(new User(triggerEvent.getUser().getUsername())).
setRule(rule).
setTimestamp(triggerEvent.getTimestamp()).
setDetectionSystem(triggerEvent.getDetectionSystem()).
setResource(triggerEvent.getResource());
appSensorServer.getAttackStore().addAttack(attack);
} | [
"public",
"void",
"generateAttack",
"(",
"Event",
"triggerEvent",
",",
"Rule",
"rule",
")",
"{",
"logger",
".",
"info",
"(",
"\"Attack generated on rule: \"",
"+",
"rule",
".",
"getGuid",
"(",
")",
"+",
"\", by user: \"",
"+",
"triggerEvent",
".",
"getUser",
"... | Generates an attack from the given {@link Rule} and triggered {@link Event}
@param triggerEvent the {@link Event} that triggered the {@link Rule}
@param rule the {@link Rule} being evaluated | [
"Generates",
"an",
"attack",
"from",
"the",
"given",
"{",
"@link",
"Rule",
"}",
"and",
"triggered",
"{",
"@link",
"Event",
"}"
] | train | https://github.com/jtmelton/appsensor/blob/c3b4e9ada50fdee974e0d618ec4bdfabc2163798/analysis-engines/appsensor-analysis-rules/src/main/java/org/owasp/appsensor/analysis/AggregateEventAnalysisEngine.java#L254-L265 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/LocalTime.java | LocalTime.plus | @Override
public LocalTime plus(long amountToAdd, TemporalUnit unit) {
if (unit instanceof ChronoUnit) {
ChronoUnit f = (ChronoUnit) unit;
switch (f) {
case NANOS: return plusNanos(amountToAdd);
case MICROS: return plusNanos((amountToAdd % MICROS_PER_DAY) * 1000);
case MILLIS: return plusNanos((amountToAdd % MILLIS_PER_DAY) * 1000000);
case SECONDS: return plusSeconds(amountToAdd);
case MINUTES: return plusMinutes(amountToAdd);
case HOURS: return plusHours(amountToAdd);
case HALF_DAYS: return plusHours((amountToAdd % 2) * 12);
}
throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
return unit.addTo(this, amountToAdd);
} | java | @Override
public LocalTime plus(long amountToAdd, TemporalUnit unit) {
if (unit instanceof ChronoUnit) {
ChronoUnit f = (ChronoUnit) unit;
switch (f) {
case NANOS: return plusNanos(amountToAdd);
case MICROS: return plusNanos((amountToAdd % MICROS_PER_DAY) * 1000);
case MILLIS: return plusNanos((amountToAdd % MILLIS_PER_DAY) * 1000000);
case SECONDS: return plusSeconds(amountToAdd);
case MINUTES: return plusMinutes(amountToAdd);
case HOURS: return plusHours(amountToAdd);
case HALF_DAYS: return plusHours((amountToAdd % 2) * 12);
}
throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
return unit.addTo(this, amountToAdd);
} | [
"@",
"Override",
"public",
"LocalTime",
"plus",
"(",
"long",
"amountToAdd",
",",
"TemporalUnit",
"unit",
")",
"{",
"if",
"(",
"unit",
"instanceof",
"ChronoUnit",
")",
"{",
"ChronoUnit",
"f",
"=",
"(",
"ChronoUnit",
")",
"unit",
";",
"switch",
"(",
"f",
"... | Returns a copy of this time with the specified period added.
<p>
This method returns a new time based on this time with the specified period added.
This can be used to add any period that is defined by a unit, for example to add hours, minutes or seconds.
The unit is responsible for the details of the calculation, including the resolution
of any edge cases in the calculation.
<p>
This instance is immutable and unaffected by this method call.
@param amountToAdd the amount of the unit to add to the result, may be negative
@param unit the unit of the period to add, not null
@return a {@code LocalTime} based on this time with the specified period added, not null
@throws DateTimeException if the unit cannot be added to this type | [
"Returns",
"a",
"copy",
"of",
"this",
"time",
"with",
"the",
"specified",
"period",
"added",
".",
"<p",
">",
"This",
"method",
"returns",
"a",
"new",
"time",
"based",
"on",
"this",
"time",
"with",
"the",
"specified",
"period",
"added",
".",
"This",
"can"... | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/LocalTime.java#L961-L977 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/xml/bind/AnnotationInfo.java | AnnotationInfo.addAttribute | public void addAttribute(final String name, final String value) {
ArgUtils.notEmpty(name, "name");
removeAttribute(name);
this.attributes.add(AttributeInfo.create(name, value));
} | java | public void addAttribute(final String name, final String value) {
ArgUtils.notEmpty(name, "name");
removeAttribute(name);
this.attributes.add(AttributeInfo.create(name, value));
} | [
"public",
"void",
"addAttribute",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"value",
")",
"{",
"ArgUtils",
".",
"notEmpty",
"(",
"name",
",",
"\"name\"",
")",
";",
"removeAttribute",
"(",
"name",
")",
";",
"this",
".",
"attributes",
".",
"a... | アノテーションの属性を追加する。
<p>ただし、既に同じ属性名が存在する場合は、それと入れ替えされます。</p>
@param name 属性名。必須です。
@param value 値。
<a href="http://s2container.seasar.org/2.4/ja/ognl.html" target="_blank">OGNL形式</a>で指定します。
@throws IllegalArgumentException name is empty. | [
"アノテーションの属性を追加する。",
"<p",
">",
"ただし、既に同じ属性名が存在する場合は、それと入れ替えされます。<",
"/",
"p",
">"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/xml/bind/AnnotationInfo.java#L120-L124 |
Azure/azure-sdk-for-java | mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java | SpatialAnchorsAccountsInner.create | public SpatialAnchorsAccountInner create(String resourceGroupName, String spatialAnchorsAccountName, SpatialAnchorsAccountInner spatialAnchorsAccount) {
return createWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName, spatialAnchorsAccount).toBlocking().single().body();
} | java | public SpatialAnchorsAccountInner create(String resourceGroupName, String spatialAnchorsAccountName, SpatialAnchorsAccountInner spatialAnchorsAccount) {
return createWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName, spatialAnchorsAccount).toBlocking().single().body();
} | [
"public",
"SpatialAnchorsAccountInner",
"create",
"(",
"String",
"resourceGroupName",
",",
"String",
"spatialAnchorsAccountName",
",",
"SpatialAnchorsAccountInner",
"spatialAnchorsAccount",
")",
"{",
"return",
"createWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"sp... | Creating or Updating a Spatial Anchors Account.
@param resourceGroupName Name of an Azure resource group.
@param spatialAnchorsAccountName Name of an Mixed Reality Spatial Anchors Account.
@param spatialAnchorsAccount Spatial Anchors Account parameter.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the SpatialAnchorsAccountInner object if successful. | [
"Creating",
"or",
"Updating",
"a",
"Spatial",
"Anchors",
"Account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java#L611-L613 |
apereo/cas | core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/DefaultRegisteredServiceAccessStrategy.java | DefaultRegisteredServiceAccessStrategy.enoughAttributesAvailableToProcess | protected boolean enoughAttributesAvailableToProcess(final String principal, final Map<String, Object> principalAttributes) {
if (!enoughRequiredAttributesAvailableToProcess(principalAttributes, this.requiredAttributes)) {
return false;
}
if (principalAttributes.size() < this.rejectedAttributes.size()) {
LOGGER.debug("The size of the principal attributes that are [{}] does not match defined rejected attributes, "
+ "which means the principal is not carrying enough data to grant authorization", principalAttributes);
return false;
}
return true;
} | java | protected boolean enoughAttributesAvailableToProcess(final String principal, final Map<String, Object> principalAttributes) {
if (!enoughRequiredAttributesAvailableToProcess(principalAttributes, this.requiredAttributes)) {
return false;
}
if (principalAttributes.size() < this.rejectedAttributes.size()) {
LOGGER.debug("The size of the principal attributes that are [{}] does not match defined rejected attributes, "
+ "which means the principal is not carrying enough data to grant authorization", principalAttributes);
return false;
}
return true;
} | [
"protected",
"boolean",
"enoughAttributesAvailableToProcess",
"(",
"final",
"String",
"principal",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"principalAttributes",
")",
"{",
"if",
"(",
"!",
"enoughRequiredAttributesAvailableToProcess",
"(",
"principalAttri... | Enough attributes available to process? Check collection sizes and determine
if we have enough data to move on.
@param principal the principal
@param principalAttributes the principal attributes
@return true /false | [
"Enough",
"attributes",
"available",
"to",
"process?",
"Check",
"collection",
"sizes",
"and",
"determine",
"if",
"we",
"have",
"enough",
"data",
"to",
"move",
"on",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/DefaultRegisteredServiceAccessStrategy.java#L222-L232 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/Utils.java | Utils.standardSocket | public static Socket standardSocket(UrlParser urlParser, String host) throws IOException {
SocketFactory socketFactory;
String socketFactoryName = urlParser.getOptions().socketFactory;
if (socketFactoryName != null) {
try {
@SuppressWarnings("unchecked")
Class<? extends SocketFactory> socketFactoryClass = (Class<? extends SocketFactory>) Class
.forName(socketFactoryName);
if (socketFactoryClass != null) {
Constructor<? extends SocketFactory> constructor = socketFactoryClass.getConstructor();
socketFactory = constructor.newInstance();
return socketFactory.createSocket();
}
} catch (Exception exp) {
throw new IOException(
"Socket factory failed to initialized with option \"socketFactory\" set to \""
+ urlParser.getOptions().socketFactory + "\"", exp);
}
}
socketFactory = SocketFactory.getDefault();
return socketFactory.createSocket();
} | java | public static Socket standardSocket(UrlParser urlParser, String host) throws IOException {
SocketFactory socketFactory;
String socketFactoryName = urlParser.getOptions().socketFactory;
if (socketFactoryName != null) {
try {
@SuppressWarnings("unchecked")
Class<? extends SocketFactory> socketFactoryClass = (Class<? extends SocketFactory>) Class
.forName(socketFactoryName);
if (socketFactoryClass != null) {
Constructor<? extends SocketFactory> constructor = socketFactoryClass.getConstructor();
socketFactory = constructor.newInstance();
return socketFactory.createSocket();
}
} catch (Exception exp) {
throw new IOException(
"Socket factory failed to initialized with option \"socketFactory\" set to \""
+ urlParser.getOptions().socketFactory + "\"", exp);
}
}
socketFactory = SocketFactory.getDefault();
return socketFactory.createSocket();
} | [
"public",
"static",
"Socket",
"standardSocket",
"(",
"UrlParser",
"urlParser",
",",
"String",
"host",
")",
"throws",
"IOException",
"{",
"SocketFactory",
"socketFactory",
";",
"String",
"socketFactoryName",
"=",
"urlParser",
".",
"getOptions",
"(",
")",
".",
"sock... | Use standard socket implementation.
@param urlParser url parser
@param host host to connect
@return socket
@throws IOException in case of error establishing socket. | [
"Use",
"standard",
"socket",
"implementation",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/Utils.java#L119-L140 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuStringUtil.java | GosuStringUtil.indexOf | public static int indexOf(String str, String searchStr) {
if (str == null || searchStr == null) {
return -1;
}
return str.indexOf(searchStr);
} | java | public static int indexOf(String str, String searchStr) {
if (str == null || searchStr == null) {
return -1;
}
return str.indexOf(searchStr);
} | [
"public",
"static",
"int",
"indexOf",
"(",
"String",
"str",
",",
"String",
"searchStr",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"searchStr",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"str",
".",
"indexOf",
"(",
"searchSt... | <p>Finds the first index within a String, handling <code>null</code>.
This method uses {@link String#indexOf(String)}.</p>
<p>A <code>null</code> String will return <code>-1</code>.</p>
<pre>
GosuStringUtil.indexOf(null, *) = -1
GosuStringUtil.indexOf(*, null) = -1
GosuStringUtil.indexOf("", "") = 0
GosuStringUtil.indexOf("aabaabaa", "a") = 0
GosuStringUtil.indexOf("aabaabaa", "b") = 2
GosuStringUtil.indexOf("aabaabaa", "ab") = 1
GosuStringUtil.indexOf("aabaabaa", "") = 0
</pre>
@param str the String to check, may be null
@param searchStr the String to find, may be null
@return the first index of the search String,
-1 if no match or <code>null</code> string input
@since 2.0 | [
"<p",
">",
"Finds",
"the",
"first",
"index",
"within",
"a",
"String",
"handling",
"<code",
">",
"null<",
"/",
"code",
">",
".",
"This",
"method",
"uses",
"{",
"@link",
"String#indexOf",
"(",
"String",
")",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuStringUtil.java#L736-L741 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java | BoundedOverlay.setBoundingBox | public void setBoundingBox(BoundingBox boundingBox, Projection projection) {
ProjectionTransform projectionToWebMercator = projection
.getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR);
webMercatorBoundingBox = boundingBox
.transform(projectionToWebMercator);
} | java | public void setBoundingBox(BoundingBox boundingBox, Projection projection) {
ProjectionTransform projectionToWebMercator = projection
.getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR);
webMercatorBoundingBox = boundingBox
.transform(projectionToWebMercator);
} | [
"public",
"void",
"setBoundingBox",
"(",
"BoundingBox",
"boundingBox",
",",
"Projection",
"projection",
")",
"{",
"ProjectionTransform",
"projectionToWebMercator",
"=",
"projection",
".",
"getTransformation",
"(",
"ProjectionConstants",
".",
"EPSG_WEB_MERCATOR",
")",
";",... | Set the bounding box, provided as the indicated projection
@param boundingBox bounding box
@param projection projection | [
"Set",
"the",
"bounding",
"box",
"provided",
"as",
"the",
"indicated",
"projection"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java#L85-L90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.