repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
wnameless/rubycollect4j | src/main/java/net/sf/rubycollect4j/RubyIO.java | RubyIO.foreach | public static void foreach(String path, Consumer<? super String> block) {
"""
Iterates a file line by line.
@param path
of a File
@param block
to process each line
"""
Ruby.Enumerator.of(new EachLineIterable(new File(path))).each(block);
} | java | public static void foreach(String path, Consumer<? super String> block) {
Ruby.Enumerator.of(new EachLineIterable(new File(path))).each(block);
} | [
"public",
"static",
"void",
"foreach",
"(",
"String",
"path",
",",
"Consumer",
"<",
"?",
"super",
"String",
">",
"block",
")",
"{",
"Ruby",
".",
"Enumerator",
".",
"of",
"(",
"new",
"EachLineIterable",
"(",
"new",
"File",
"(",
"path",
")",
")",
")",
... | Iterates a file line by line.
@param path
of a File
@param block
to process each line | [
"Iterates",
"a",
"file",
"line",
"by",
"line",
"."
] | train | https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/RubyIO.java#L297-L299 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java | ResourceUtil.getResource | public static URL getResource(String resource, Class<?> baseClass) {
"""
获得资源相对路径对应的URL
@param resource 资源相对路径
@param baseClass 基准Class,获得的相对路径相对于此Class所在路径,如果为{@code null}则相对ClassPath
@return {@link URL}
"""
return (null != baseClass) ? baseClass.getResource(resource) : ClassLoaderUtil.getClassLoader(... | java | public static URL getResource(String resource, Class<?> baseClass) {
return (null != baseClass) ? baseClass.getResource(resource) : ClassLoaderUtil.getClassLoader().getResource(resource);
} | [
"public",
"static",
"URL",
"getResource",
"(",
"String",
"resource",
",",
"Class",
"<",
"?",
">",
"baseClass",
")",
"{",
"return",
"(",
"null",
"!=",
"baseClass",
")",
"?",
"baseClass",
".",
"getResource",
"(",
"resource",
")",
":",
"ClassLoaderUtil",
".",... | 获得资源相对路径对应的URL
@param resource 资源相对路径
@param baseClass 基准Class,获得的相对路径相对于此Class所在路径,如果为{@code null}则相对ClassPath
@return {@link URL} | [
"获得资源相对路径对应的URL"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java#L159-L161 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java | Util.getBooleanProperty | public static Boolean getBooleanProperty(Map<String, Object> properties, String key, boolean defaultVal) {
"""
Get boolean type property value from a property map.
<p>
If {@code properties} is null or property value is null, default value is returned
@param properties map of properties
@param key prop... | java | public static Boolean getBooleanProperty(Map<String, Object> properties, String key, boolean defaultVal) {
if (properties == null) {
return defaultVal;
}
Object propertyVal = properties.get(key);
if (propertyVal == null) {
return defaultVal;
}
... | [
"public",
"static",
"Boolean",
"getBooleanProperty",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"String",
"key",
",",
"boolean",
"defaultVal",
")",
"{",
"if",
"(",
"properties",
"==",
"null",
")",
"{",
"return",
"defaultVal",
";",
"}... | Get boolean type property value from a property map.
<p>
If {@code properties} is null or property value is null, default value is returned
@param properties map of properties
@param key property name
@param defaultVal default value of the property
@return integer value of the property, | [
"Get",
"boolean",
"type",
"property",
"value",
"from",
"a",
"property",
"map",
".",
"<p",
">",
"If",
"{",
"@code",
"properties",
"}",
"is",
"null",
"or",
"property",
"value",
"is",
"null",
"default",
"value",
"is",
"returned"
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java#L467-L484 |
alkacon/opencms-core | src/org/opencms/ui/apps/sessions/CmsSessionsTable.java | CmsSessionsTable.showKillDialog | protected static void showKillDialog(Set<String> ids, String caption, final CmsSessionsTable table) {
"""
Shows the dialog to destroy given sessions.<p>
@param ids to kill session
@param caption of the window
@param table to be updated
"""
final Window window = CmsBasicDialog.prepareWindow();
... | java | protected static void showKillDialog(Set<String> ids, String caption, final CmsSessionsTable table) {
final Window window = CmsBasicDialog.prepareWindow();
window.setCaption(caption);
window.setContent(new CmsKillSessionDialog(ids, getCloseRunnable(window, table)));
A_CmsUI.get().addWin... | [
"protected",
"static",
"void",
"showKillDialog",
"(",
"Set",
"<",
"String",
">",
"ids",
",",
"String",
"caption",
",",
"final",
"CmsSessionsTable",
"table",
")",
"{",
"final",
"Window",
"window",
"=",
"CmsBasicDialog",
".",
"prepareWindow",
"(",
")",
";",
"w... | Shows the dialog to destroy given sessions.<p>
@param ids to kill session
@param caption of the window
@param table to be updated | [
"Shows",
"the",
"dialog",
"to",
"destroy",
"given",
"sessions",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sessions/CmsSessionsTable.java#L482-L488 |
infinispan/infinispan | extended-statistics/src/main/java/org/infinispan/stats/CacheStatisticManager.java | CacheStatisticManager.setTransactionOutcome | public final void setTransactionOutcome(boolean commit, GlobalTransaction globalTransaction, boolean local) {
"""
Sets the transaction outcome to commit or rollback, depending if the transaction has commit successfully or not
respectively.
@param commit {@code true} if the transaction has committed ... | java | public final void setTransactionOutcome(boolean commit, GlobalTransaction globalTransaction, boolean local) {
TransactionStatistics txs = getTransactionStatistic(globalTransaction, local);
if (txs == null) {
log.outcomeOnUnexistingTransaction(globalTransaction == null ? "null" : globalTransaction.g... | [
"public",
"final",
"void",
"setTransactionOutcome",
"(",
"boolean",
"commit",
",",
"GlobalTransaction",
"globalTransaction",
",",
"boolean",
"local",
")",
"{",
"TransactionStatistics",
"txs",
"=",
"getTransactionStatistic",
"(",
"globalTransaction",
",",
"local",
")",
... | Sets the transaction outcome to commit or rollback, depending if the transaction has commit successfully or not
respectively.
@param commit {@code true} if the transaction has committed successfully.
@param globalTransaction the terminated global transaction.
@param local {@code true} if measure... | [
"Sets",
"the",
"transaction",
"outcome",
"to",
"commit",
"or",
"rollback",
"depending",
"if",
"the",
"transaction",
"has",
"commit",
"successfully",
"or",
"not",
"respectively",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/extended-statistics/src/main/java/org/infinispan/stats/CacheStatisticManager.java#L123-L131 |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/builder/FindBugsWorker.java | FindBugsWorker.getFilterPath | public static IPath getFilterPath(String filePath, IProject project) {
"""
Checks the given path and convert it to absolute path if it is specified
relative to the given project or workspace
@param filePath
project relative OR workspace relative OR absolute OS file
path (1.3.8+ version)
@param project
migh... | java | public static IPath getFilterPath(String filePath, IProject project) {
IPath path = new Path(filePath);
if (path.isAbsolute()) {
return path;
}
if (project != null) {
// try first project relative location
IPath newPath = project.getLocation().append(p... | [
"public",
"static",
"IPath",
"getFilterPath",
"(",
"String",
"filePath",
",",
"IProject",
"project",
")",
"{",
"IPath",
"path",
"=",
"new",
"Path",
"(",
"filePath",
")",
";",
"if",
"(",
"path",
".",
"isAbsolute",
"(",
")",
")",
"{",
"return",
"path",
"... | Checks the given path and convert it to absolute path if it is specified
relative to the given project or workspace
@param filePath
project relative OR workspace relative OR absolute OS file
path (1.3.8+ version)
@param project
might be null (only for workspace relative or absolute paths)
@return absolute path which m... | [
"Checks",
"the",
"given",
"path",
"and",
"convert",
"it",
"to",
"absolute",
"path",
"if",
"it",
"is",
"specified",
"relative",
"to",
"the",
"given",
"project",
"or",
"workspace"
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/builder/FindBugsWorker.java#L403-L427 |
j256/ormlite-core | src/main/java/com/j256/ormlite/field/FieldType.java | FieldType.findForeignFieldType | private FieldType findForeignFieldType(Class<?> clazz, Class<?> foreignClass, Dao<?, ?> foreignDao)
throws SQLException {
"""
If we have a class Foo with a collection of Bar's then we go through Bar's DAO looking for a Foo field. We need
this field to build the query that is able to find all Bar's that have fo... | java | private FieldType findForeignFieldType(Class<?> clazz, Class<?> foreignClass, Dao<?, ?> foreignDao)
throws SQLException {
String foreignColumnName = fieldConfig.getForeignCollectionForeignFieldName();
for (FieldType fieldType : foreignDao.getTableInfo().getFieldTypes()) {
if (fieldType.getType() == foreignCla... | [
"private",
"FieldType",
"findForeignFieldType",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"?",
">",
"foreignClass",
",",
"Dao",
"<",
"?",
",",
"?",
">",
"foreignDao",
")",
"throws",
"SQLException",
"{",
"String",
"foreignColumnName",
"=",
"f... | If we have a class Foo with a collection of Bar's then we go through Bar's DAO looking for a Foo field. We need
this field to build the query that is able to find all Bar's that have foo_id that matches our id. | [
"If",
"we",
"have",
"a",
"class",
"Foo",
"with",
"a",
"collection",
"of",
"Bar",
"s",
"then",
"we",
"go",
"through",
"Bar",
"s",
"DAO",
"looking",
"for",
"a",
"Foo",
"field",
".",
"We",
"need",
"this",
"field",
"to",
"build",
"the",
"query",
"that",
... | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/field/FieldType.java#L1109-L1132 |
jmrozanec/cron-utils | src/main/java/com/cronutils/descriptor/CronDescriptor.java | CronDescriptor.describeMonth | public String describeMonth(final Map<CronFieldName, CronField> fields) {
"""
Provide description for month.
@param fields - fields to describe;
@return description - String
"""
final String description = DescriptionStrategyFactory.monthsInstance(
resourceBundle,
fie... | java | public String describeMonth(final Map<CronFieldName, CronField> fields) {
final String description = DescriptionStrategyFactory.monthsInstance(
resourceBundle,
fields.containsKey(CronFieldName.MONTH) ? fields.get(CronFieldName.MONTH).getExpression() : null
).describe();
... | [
"public",
"String",
"describeMonth",
"(",
"final",
"Map",
"<",
"CronFieldName",
",",
"CronField",
">",
"fields",
")",
"{",
"final",
"String",
"description",
"=",
"DescriptionStrategyFactory",
".",
"monthsInstance",
"(",
"resourceBundle",
",",
"fields",
".",
"conta... | Provide description for month.
@param fields - fields to describe;
@return description - String | [
"Provide",
"description",
"for",
"month",
"."
] | train | https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/descriptor/CronDescriptor.java#L108-L115 |
grandstaish/paperparcel | paperparcel-compiler/src/main/java/paperparcel/Utils.java | Utils.findCreator | @Nullable static VariableElement findCreator(Elements elements, Types types, TypeMirror type) {
"""
If {@code type} has a {@code Parcelable.Creator} field instance, return it.
"""
if (type.getKind() != TypeKind.DECLARED) {
return null;
}
DeclaredType declaredType = (DeclaredType) type;
Ty... | java | @Nullable static VariableElement findCreator(Elements elements, Types types, TypeMirror type) {
if (type.getKind() != TypeKind.DECLARED) {
return null;
}
DeclaredType declaredType = (DeclaredType) type;
TypeElement typeElement = (TypeElement) declaredType.asElement();
return findCreator(elemen... | [
"@",
"Nullable",
"static",
"VariableElement",
"findCreator",
"(",
"Elements",
"elements",
",",
"Types",
"types",
",",
"TypeMirror",
"type",
")",
"{",
"if",
"(",
"type",
".",
"getKind",
"(",
")",
"!=",
"TypeKind",
".",
"DECLARED",
")",
"{",
"return",
"null"... | If {@code type} has a {@code Parcelable.Creator} field instance, return it. | [
"If",
"{"
] | train | https://github.com/grandstaish/paperparcel/blob/917686ced81b335b6708d81d6cc0e3e496f7280d/paperparcel-compiler/src/main/java/paperparcel/Utils.java#L300-L307 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_vm_template.java | ns_vm_template.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception {
"""
<pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre>
"""
ns_vm_template_responses result = (ns_vm_template_responses) service.ge... | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
ns_vm_template_responses result = (ns_vm_template_responses) service.get_payload_formatter().string_to_resource(ns_vm_template_responses.class, response);
if(result.errorcode != 0)
{
if (result.er... | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"ns_vm_template_responses",
"result",
"=",
"(",
"ns_vm_template_responses",
")",
"service",
".",
"get_payload_... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_vm_template.java#L174-L191 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/UsersApi.java | UsersApi.supervisorRemoteMediaOperation | public ApiSuccessResponse supervisorRemoteMediaOperation(String dbid, String mediatype, String operationName, SupervisorPlaceData1 supervisorPlaceData) throws ApiException {
"""
Change the state of the agent specified by the dbid to operationName.
Change the state of the agent specified by the dbid to operationNa... | java | public ApiSuccessResponse supervisorRemoteMediaOperation(String dbid, String mediatype, String operationName, SupervisorPlaceData1 supervisorPlaceData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = supervisorRemoteMediaOperationWithHttpInfo(dbid, mediatype, operationName, supervisorPlaceData);
... | [
"public",
"ApiSuccessResponse",
"supervisorRemoteMediaOperation",
"(",
"String",
"dbid",
",",
"String",
"mediatype",
",",
"String",
"operationName",
",",
"SupervisorPlaceData1",
"supervisorPlaceData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessRespon... | Change the state of the agent specified by the dbid to operationName.
Change the state of the agent specified by the dbid to operationName.
@param dbid The dbid of the agent. (required)
@param mediatype The media channel. (required)
@param operationName Name of state to change to (required)
@param supervisorPlaceData R... | [
"Change",
"the",
"state",
"of",
"the",
"agent",
"specified",
"by",
"the",
"dbid",
"to",
"operationName",
".",
"Change",
"the",
"state",
"of",
"the",
"agent",
"specified",
"by",
"the",
"dbid",
"to",
"operationName",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/UsersApi.java#L305-L308 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/util/NodeLocatorHelper.java | NodeLocatorHelper.replicaNodeForId | public InetAddress replicaNodeForId(final String id, int replicaNum) {
"""
Returns the target replica node {@link InetAddress} for a given document ID and replica number on the bucket.
@param id the document id to convert.
@param replicaNum the replica number.
@return the node for the given document id.
"... | java | public InetAddress replicaNodeForId(final String id, int replicaNum) {
if (replicaNum < 1 || replicaNum > 3) {
throw new IllegalArgumentException("Replica number must be between 1 and 3.");
}
BucketConfig config = bucketConfig.get();
if (config instanceof CouchbaseBucketCon... | [
"public",
"InetAddress",
"replicaNodeForId",
"(",
"final",
"String",
"id",
",",
"int",
"replicaNum",
")",
"{",
"if",
"(",
"replicaNum",
"<",
"1",
"||",
"replicaNum",
">",
"3",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Replica number must be b... | Returns the target replica node {@link InetAddress} for a given document ID and replica number on the bucket.
@param id the document id to convert.
@param replicaNum the replica number.
@return the node for the given document id. | [
"Returns",
"the",
"target",
"replica",
"node",
"{",
"@link",
"InetAddress",
"}",
"for",
"a",
"given",
"document",
"ID",
"and",
"replica",
"number",
"on",
"the",
"bucket",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/util/NodeLocatorHelper.java#L141-L166 |
UrielCh/ovh-java-sdk | ovh-java-sdk-connectivity/src/main/java/net/minidev/ovh/api/ApiOvhConnectivity.java | ApiOvhConnectivity.eligibility_search_meetings_POST | public OvhAsyncTask<OvhMeetings> eligibility_search_meetings_POST(String eligibilityReference, String productCode) throws IOException {
"""
Search for available line creation meeting time slots, for copper only
REST: POST /connectivity/eligibility/search/meetings
@param productCode [required] Choosen offer pro... | java | public OvhAsyncTask<OvhMeetings> eligibility_search_meetings_POST(String eligibilityReference, String productCode) throws IOException {
String qPath = "/connectivity/eligibility/search/meetings";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "eligibilityRef... | [
"public",
"OvhAsyncTask",
"<",
"OvhMeetings",
">",
"eligibility_search_meetings_POST",
"(",
"String",
"eligibilityReference",
",",
"String",
"productCode",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/connectivity/eligibility/search/meetings\"",
";",
"Stri... | Search for available line creation meeting time slots, for copper only
REST: POST /connectivity/eligibility/search/meetings
@param productCode [required] Choosen offer product code
@param eligibilityReference [required] Eligibility test reference | [
"Search",
"for",
"available",
"line",
"creation",
"meeting",
"time",
"slots",
"for",
"copper",
"only"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-connectivity/src/main/java/net/minidev/ovh/api/ApiOvhConnectivity.java#L121-L129 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.drawTo | public SVGPath drawTo(double x, double y) {
"""
Draw a line given a series of coordinates.
Helper function that will use "move" for the first point, "lineto" for the
remaining.
@param x new coordinates
@param y new coordinates
@return path object, for compact syntax.
"""
return !isStarted() ? move... | java | public SVGPath drawTo(double x, double y) {
return !isStarted() ? moveTo(x, y) : lineTo(x, y);
} | [
"public",
"SVGPath",
"drawTo",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"return",
"!",
"isStarted",
"(",
")",
"?",
"moveTo",
"(",
"x",
",",
"y",
")",
":",
"lineTo",
"(",
"x",
",",
"y",
")",
";",
"}"
] | Draw a line given a series of coordinates.
Helper function that will use "move" for the first point, "lineto" for the
remaining.
@param x new coordinates
@param y new coordinates
@return path object, for compact syntax. | [
"Draw",
"a",
"line",
"given",
"a",
"series",
"of",
"coordinates",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L196-L198 |
landawn/AbacusUtil | src/com/landawn/abacus/util/FileSystemUtil.java | FileSystemUtil.performCommand | List<String> performCommand(final String[] cmdAttribs, final int max, final long timeout) throws IOException {
"""
Performs the os command.
@param cmdAttribs the command line parameters
@param max The maximum limit for the lines returned
@param timeout The timeout amount in milliseconds or no timeout if the ... | java | List<String> performCommand(final String[] cmdAttribs, final int max, final long timeout) throws IOException {
// this method does what it can to avoid the 'Too many open files' error
// based on trial and error and these links:
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4784692
... | [
"List",
"<",
"String",
">",
"performCommand",
"(",
"final",
"String",
"[",
"]",
"cmdAttribs",
",",
"final",
"int",
"max",
",",
"final",
"long",
"timeout",
")",
"throws",
"IOException",
"{",
"// this method does what it can to avoid the 'Too many open files' error\r",
... | Performs the os command.
@param cmdAttribs the command line parameters
@param max The maximum limit for the lines returned
@param timeout The timeout amount in milliseconds or no timeout if the value
is zero or less
@return the lines returned by the command, converted to lower-case
@throws IOException if an error occ... | [
"Performs",
"the",
"os",
"command",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/FileSystemUtil.java#L411-L468 |
knightliao/apollo | src/main/java/com/github/knightliao/apollo/utils/time/DateUtils.java | DateUtils.getDate | public static Date getDate(int year, int month, int day) {
"""
生成java.util.Date类型的对象
@param year int 年
@param month int 月
@param day int 日
@return Date java.util.Date类型的对象
"""
GregorianCalendar d = new GregorianCalendar(year, month - 1, day);
return d.getTime();
} | java | public static Date getDate(int year, int month, int day) {
GregorianCalendar d = new GregorianCalendar(year, month - 1, day);
return d.getTime();
} | [
"public",
"static",
"Date",
"getDate",
"(",
"int",
"year",
",",
"int",
"month",
",",
"int",
"day",
")",
"{",
"GregorianCalendar",
"d",
"=",
"new",
"GregorianCalendar",
"(",
"year",
",",
"month",
"-",
"1",
",",
"day",
")",
";",
"return",
"d",
".",
"ge... | 生成java.util.Date类型的对象
@param year int 年
@param month int 月
@param day int 日
@return Date java.util.Date类型的对象 | [
"生成java",
".",
"util",
".",
"Date类型的对象"
] | train | https://github.com/knightliao/apollo/blob/d7a283659fa3e67af6375db8969b2d065a8ce6eb/src/main/java/com/github/knightliao/apollo/utils/time/DateUtils.java#L438-L441 |
m-m-m/util | value/src/main/java/net/sf/mmm/util/value/impl/AbstractValueConverterToContainer.java | AbstractValueConverterToContainer.convertFromArray | protected <T extends CONTAINER> T convertFromArray(Object arrayValue, Object valueSource, GenericType<T> targetType) {
"""
This method performs the {@link #convert(Object, Object, GenericType) conversion} for array values.
@param <T> is the generic type of {@code targetType}.
@param arrayValue is the array val... | java | protected <T extends CONTAINER> T convertFromArray(Object arrayValue, Object valueSource, GenericType<T> targetType) {
int len = Array.getLength(arrayValue);
T container = createContainer(targetType, len);
for (int i = 0; i < len; i++) {
Object element = Array.get(arrayValue, i);
convertContain... | [
"protected",
"<",
"T",
"extends",
"CONTAINER",
">",
"T",
"convertFromArray",
"(",
"Object",
"arrayValue",
",",
"Object",
"valueSource",
",",
"GenericType",
"<",
"T",
">",
"targetType",
")",
"{",
"int",
"len",
"=",
"Array",
".",
"getLength",
"(",
"arrayValue"... | This method performs the {@link #convert(Object, Object, GenericType) conversion} for array values.
@param <T> is the generic type of {@code targetType}.
@param arrayValue is the array value to convert.
@param valueSource describes the source of the value or {@code null} if NOT available.
@param targetType is the {@li... | [
"This",
"method",
"performs",
"the",
"{",
"@link",
"#convert",
"(",
"Object",
"Object",
"GenericType",
")",
"conversion",
"}",
"for",
"array",
"values",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/value/src/main/java/net/sf/mmm/util/value/impl/AbstractValueConverterToContainer.java#L222-L231 |
ManfredTremmel/gwt-bean-validators | gwtp-dynamic-navigation/src/main/java/de/knightsoftnet/navigation/rebind/VersionInfoGenerator.java | VersionInfoGenerator.getSourceWriter | public final SourceWriter getSourceWriter(final JClassType pclassType,
final GeneratorContext pcontext, final TreeLogger plogger) {
"""
get source writer for the generator.
@param pclassType class type
@param pcontext generator context
@param plogger tree logger
@return SourceWriter to write the genera... | java | public final SourceWriter getSourceWriter(final JClassType pclassType,
final GeneratorContext pcontext, final TreeLogger plogger) {
final String packageName = pclassType.getPackage().getName();
final String simpleName = pclassType.getSimpleSourceName() + "Generated";
final ClassSourceFileComposerFacto... | [
"public",
"final",
"SourceWriter",
"getSourceWriter",
"(",
"final",
"JClassType",
"pclassType",
",",
"final",
"GeneratorContext",
"pcontext",
",",
"final",
"TreeLogger",
"plogger",
")",
"{",
"final",
"String",
"packageName",
"=",
"pclassType",
".",
"getPackage",
"("... | get source writer for the generator.
@param pclassType class type
@param pcontext generator context
@param plogger tree logger
@return SourceWriter to write the generated sources to | [
"get",
"source",
"writer",
"for",
"the",
"generator",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwtp-dynamic-navigation/src/main/java/de/knightsoftnet/navigation/rebind/VersionInfoGenerator.java#L94-L111 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Range.java | Range.just | public static <T extends Comparable<T>> Range<T> just(final T element) {
"""
<p>
Obtains a range using the specified element as both the minimum and maximum in this range.
</p>
<p>
The range uses the natural ordering of the elements to determine where values lie in the range.
</p>
@param <T>
the type of... | java | public static <T extends Comparable<T>> Range<T> just(final T element) {
return closed(element, element);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"Range",
"<",
"T",
">",
"just",
"(",
"final",
"T",
"element",
")",
"{",
"return",
"closed",
"(",
"element",
",",
"element",
")",
";",
"}"
] | <p>
Obtains a range using the specified element as both the minimum and maximum in this range.
</p>
<p>
The range uses the natural ordering of the elements to determine where values lie in the range.
</p>
@param <T>
the type of the elements in this range
@param element
the value to use for this range, not null
@retur... | [
"<p",
">",
"Obtains",
"a",
"range",
"using",
"the",
"specified",
"element",
"as",
"both",
"the",
"minimum",
"and",
"maximum",
"in",
"this",
"range",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Range.java#L79-L81 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.isOneOf | public boolean isOneOf( Type first,
Type... rest ) {
"""
Return true if this node's type matches one of the supplied types
@param first the type to compare
@param rest the additional types to compare
@return true if this node's type is one of those supplied, or false otherwise
... | java | public boolean isOneOf( Type first,
Type... rest ) {
return isOneOf(EnumSet.of(first, rest));
} | [
"public",
"boolean",
"isOneOf",
"(",
"Type",
"first",
",",
"Type",
"...",
"rest",
")",
"{",
"return",
"isOneOf",
"(",
"EnumSet",
".",
"of",
"(",
"first",
",",
"rest",
")",
")",
";",
"}"
] | Return true if this node's type matches one of the supplied types
@param first the type to compare
@param rest the additional types to compare
@return true if this node's type is one of those supplied, or false otherwise | [
"Return",
"true",
"if",
"this",
"node",
"s",
"type",
"matches",
"one",
"of",
"the",
"supplied",
"types"
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L375-L378 |
Stratio/stratio-cassandra | src/java/com/stratio/cassandra/index/service/ClusteringKeySorter.java | ClusteringKeySorter.compareValues | @Override
public int compareValues(BytesRef val1, BytesRef val2) {
"""
Compares its two field value arguments for order. Returns a negative integer, zero, or a positive integer as the
first argument is less than, equal to, or greater than the second.
@param val1 The first field value to be compared.
@para... | java | @Override
public int compareValues(BytesRef val1, BytesRef val2) {
if (val1 == null) {
if (val2 == null) {
return 0;
}
return -1;
} else if (val2 == null) {
return 1;
}
CellName bb1 = clusteringKeyMapper.clusteringKey(va... | [
"@",
"Override",
"public",
"int",
"compareValues",
"(",
"BytesRef",
"val1",
",",
"BytesRef",
"val2",
")",
"{",
"if",
"(",
"val1",
"==",
"null",
")",
"{",
"if",
"(",
"val2",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"return",
"-",
"1",
";",
... | Compares its two field value arguments for order. Returns a negative integer, zero, or a positive integer as the
first argument is less than, equal to, or greater than the second.
@param val1 The first field value to be compared.
@param val2 The second field value to be compared.
@return A negative integer, zero, or a... | [
"Compares",
"its",
"two",
"field",
"value",
"arguments",
"for",
"order",
".",
"Returns",
"a",
"negative",
"integer",
"zero",
"or",
"a",
"positive",
"integer",
"as",
"the",
"first",
"argument",
"is",
"less",
"than",
"equal",
"to",
"or",
"greater",
"than",
"... | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/index/service/ClusteringKeySorter.java#L55-L69 |
sinetja/sinetja | src/main/java/sinetja/Response.java | Response.respondJsonP | public ChannelFuture respondJsonP(Object ref, String function) throws Exception {
"""
Converts the given Java object to JSON object using Jackson ObjectMapper,
wraps it with the given JavaScript function name, and responds.
If you already have a JSON text, thus no conversion is needed, use respondJsonPText.
<p>... | java | public ChannelFuture respondJsonP(Object ref, String function) throws Exception {
final String json = jsonObjectMapper.writeValueAsString(ref);
final String text = function + "(" + json + ");\r\n";
return respondJs(text);
} | [
"public",
"ChannelFuture",
"respondJsonP",
"(",
"Object",
"ref",
",",
"String",
"function",
")",
"throws",
"Exception",
"{",
"final",
"String",
"json",
"=",
"jsonObjectMapper",
".",
"writeValueAsString",
"(",
"ref",
")",
";",
"final",
"String",
"text",
"=",
"f... | Converts the given Java object to JSON object using Jackson ObjectMapper,
wraps it with the given JavaScript function name, and responds.
If you already have a JSON text, thus no conversion is needed, use respondJsonPText.
<p>
Content-Type header is set to "application/javascript". | [
"Converts",
"the",
"given",
"Java",
"object",
"to",
"JSON",
"object",
"using",
"Jackson",
"ObjectMapper",
"wraps",
"it",
"with",
"the",
"given",
"JavaScript",
"function",
"name",
"and",
"responds",
".",
"If",
"you",
"already",
"have",
"a",
"JSON",
"text",
"t... | train | https://github.com/sinetja/sinetja/blob/eec94dba55ec28263e3503fcdb33532282134775/src/main/java/sinetja/Response.java#L234-L238 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java | MutateInBuilder.arrayAppendAll | public <T> MutateInBuilder arrayAppendAll(String path, T... values) {
"""
Append multiple values at once in an existing array, pushing all values to the back/end of the array.
This is provided as a convenience alternative to {@link #arrayAppendAll(String, Collection, boolean)}.
Note that parent nodes are not cre... | java | public <T> MutateInBuilder arrayAppendAll(String path, T... values) {
asyncBuilder.arrayAppendAll(path, values);
return this;
} | [
"public",
"<",
"T",
">",
"MutateInBuilder",
"arrayAppendAll",
"(",
"String",
"path",
",",
"T",
"...",
"values",
")",
"{",
"asyncBuilder",
".",
"arrayAppendAll",
"(",
"path",
",",
"values",
")",
";",
"return",
"this",
";",
"}"
] | Append multiple values at once in an existing array, pushing all values to the back/end of the array.
This is provided as a convenience alternative to {@link #arrayAppendAll(String, Collection, boolean)}.
Note that parent nodes are not created when using this method (ie. createPath = false).
Each item in the collectio... | [
"Append",
"multiple",
"values",
"at",
"once",
"in",
"an",
"existing",
"array",
"pushing",
"all",
"values",
"to",
"the",
"back",
"/",
"end",
"of",
"the",
"array",
".",
"This",
"is",
"provided",
"as",
"a",
"convenience",
"alternative",
"to",
"{",
"@link",
... | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java#L899-L902 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesInner.java | DatabaseThreatDetectionPoliciesInner.createOrUpdateAsync | public Observable<DatabaseSecurityAlertPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseSecurityAlertPolicyInner parameters) {
"""
Creates or updates a database's threat detection policy.
@param resourceGroupName The name of the resource group that conta... | java | public Observable<DatabaseSecurityAlertPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseSecurityAlertPolicyInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceRes... | [
"public",
"Observable",
"<",
"DatabaseSecurityAlertPolicyInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"DatabaseSecurityAlertPolicyInner",
"parameters",
")",
"{",
"return",
"createOrU... | Creates or updates a database's threat detection policy.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database for which data... | [
"Creates",
"or",
"updates",
"a",
"database",
"s",
"threat",
"detection",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesInner.java#L202-L209 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningsInner.java | DatabaseAutomaticTuningsInner.getAsync | public Observable<DatabaseAutomaticTuningInner> getAsync(String resourceGroupName, String serverName, String databaseName) {
"""
Gets a database's automatic tuning.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API o... | java | public Observable<DatabaseAutomaticTuningInner> getAsync(String resourceGroupName, String serverName, String databaseName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<DatabaseAutomaticTuningInner>, DatabaseAutomaticTuningInner>() {
... | [
"public",
"Observable",
"<",
"DatabaseAutomaticTuningInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
... | Gets a database's automatic tuning.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database.
@throws IllegalArgumentException t... | [
"Gets",
"a",
"database",
"s",
"automatic",
"tuning",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAutomaticTuningsInner.java#L105-L112 |
avaje-common/avaje-resteasy-guice | src/main/java/org/avaje/resteasy/Bootstrap.java | Bootstrap.registerWebSockets | private void registerWebSockets(Injector injector) {
"""
Find any Guice eager singletons that are WebSocket endpoints
and register them with the servlet container.
"""
Map<Key<?>, Binding<?>> allBindings = injector.getAllBindings();
// loop all the Guice bindings looking for @ServerEndpoint singleto... | java | private void registerWebSockets(Injector injector) {
Map<Key<?>, Binding<?>> allBindings = injector.getAllBindings();
// loop all the Guice bindings looking for @ServerEndpoint singletons
for (Map.Entry<Key<?>, Binding<?>> entry : allBindings.entrySet()) {
final Binding<?> binding = entry.getValue(... | [
"private",
"void",
"registerWebSockets",
"(",
"Injector",
"injector",
")",
"{",
"Map",
"<",
"Key",
"<",
"?",
">",
",",
"Binding",
"<",
"?",
">",
">",
"allBindings",
"=",
"injector",
".",
"getAllBindings",
"(",
")",
";",
"// loop all the Guice bindings looking ... | Find any Guice eager singletons that are WebSocket endpoints
and register them with the servlet container. | [
"Find",
"any",
"Guice",
"eager",
"singletons",
"that",
"are",
"WebSocket",
"endpoints",
"and",
"register",
"them",
"with",
"the",
"servlet",
"container",
"."
] | train | https://github.com/avaje-common/avaje-resteasy-guice/blob/a585d8c6b0a6d4fb5ffb679d8950e41a03795929/src/main/java/org/avaje/resteasy/Bootstrap.java#L67-L85 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/CFFFontSubset.java | CFFFontSubset.CalcBias | protected int CalcBias(int Offset,int Font) {
"""
Function calcs bias according to the CharString type and the count
of the subrs
@param Offset The offset to the relevant subrs index
@param Font the font
@return The calculated Bias
"""
seek(Offset);
int nSubrs = getCard16();
// If type==1 -> bias=0
... | java | protected int CalcBias(int Offset,int Font)
{
seek(Offset);
int nSubrs = getCard16();
// If type==1 -> bias=0
if (fonts[Font].CharstringType == 1)
return 0;
// else calc according to the count
else if (nSubrs < 1240)
return 107;
else if (nSubrs < 33900)
return 1131;
else
return 32768;
} | [
"protected",
"int",
"CalcBias",
"(",
"int",
"Offset",
",",
"int",
"Font",
")",
"{",
"seek",
"(",
"Offset",
")",
";",
"int",
"nSubrs",
"=",
"getCard16",
"(",
")",
";",
"// If type==1 -> bias=0 ",
"if",
"(",
"fonts",
"[",
"Font",
"]",
".",
"CharstringType"... | Function calcs bias according to the CharString type and the count
of the subrs
@param Offset The offset to the relevant subrs index
@param Font the font
@return The calculated Bias | [
"Function",
"calcs",
"bias",
"according",
"to",
"the",
"CharString",
"type",
"and",
"the",
"count",
"of",
"the",
"subrs"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/CFFFontSubset.java#L403-L417 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java | SerializedFormWriterImpl.getClassHeader | public Content getClassHeader(TypeElement typeElement) {
"""
Get the serializable class heading.
@param typeElement the class being processed
@return a content tree for the class header
"""
Content classLink = (isVisibleClass(typeElement))
? getLink(new LinkInfoImpl(configuration, L... | java | public Content getClassHeader(TypeElement typeElement) {
Content classLink = (isVisibleClass(typeElement))
? getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, typeElement)
.label(configuration.getClassName(typeElement)))
: new StringConten... | [
"public",
"Content",
"getClassHeader",
"(",
"TypeElement",
"typeElement",
")",
"{",
"Content",
"classLink",
"=",
"(",
"isVisibleClass",
"(",
"typeElement",
")",
")",
"?",
"getLink",
"(",
"new",
"LinkInfoImpl",
"(",
"configuration",
",",
"LinkInfoImpl",
".",
"Kin... | Get the serializable class heading.
@param typeElement the class being processed
@return a content tree for the class header | [
"Get",
"the",
"serializable",
"class",
"heading",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java#L168-L190 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/fieldprocessor/impl/HorizontalRecordsProcessor.java | HorizontalRecordsProcessor.correctMergedCell | private void correctMergedCell(final Sheet sheet, final RecordOperation recordOperation, final List<CellRangeAddress> mergedRegionList) {
"""
挿入・削除前の情報を元に結合を再設定する
@since 1.6
@param sheet シート
@param recordOperation 挿入・削除処理の情報
@param mergedRegionList 挿入・削除処理を行う前の結合情報
"""
if(recordOperation.isNot... | java | private void correctMergedCell(final Sheet sheet, final RecordOperation recordOperation, final List<CellRangeAddress> mergedRegionList) {
if(recordOperation.isNotExecuteRecordOperation()) {
return;
}
// 操作をしていないセルの範囲の取得
final CellRangeAddress notOperateRange = new Ce... | [
"private",
"void",
"correctMergedCell",
"(",
"final",
"Sheet",
"sheet",
",",
"final",
"RecordOperation",
"recordOperation",
",",
"final",
"List",
"<",
"CellRangeAddress",
">",
"mergedRegionList",
")",
"{",
"if",
"(",
"recordOperation",
".",
"isNotExecuteRecordOperatio... | 挿入・削除前の情報を元に結合を再設定する
@since 1.6
@param sheet シート
@param recordOperation 挿入・削除処理の情報
@param mergedRegionList 挿入・削除処理を行う前の結合情報 | [
"挿入・削除前の情報を元に結合を再設定する"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/fieldprocessor/impl/HorizontalRecordsProcessor.java#L1958-L2002 |
mapsforge/mapsforge | mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java | MercatorProjection.longitudeToTileX | public static int longitudeToTileX(double longitude, byte zoomLevel) {
"""
Converts a longitude coordinate (in degrees) to the tile X number at a certain zoom level.
@param longitude the longitude coordinate that should be converted.
@param zoomLevel the zoom level at which the coordinate should be converted.
... | java | public static int longitudeToTileX(double longitude, byte zoomLevel) {
return pixelXToTileX(longitudeToPixelX(longitude, zoomLevel, DUMMY_TILE_SIZE), zoomLevel, DUMMY_TILE_SIZE);
} | [
"public",
"static",
"int",
"longitudeToTileX",
"(",
"double",
"longitude",
",",
"byte",
"zoomLevel",
")",
"{",
"return",
"pixelXToTileX",
"(",
"longitudeToPixelX",
"(",
"longitude",
",",
"zoomLevel",
",",
"DUMMY_TILE_SIZE",
")",
",",
"zoomLevel",
",",
"DUMMY_TILE_... | Converts a longitude coordinate (in degrees) to the tile X number at a certain zoom level.
@param longitude the longitude coordinate that should be converted.
@param zoomLevel the zoom level at which the coordinate should be converted.
@return the tile X number of the longitude value. | [
"Converts",
"a",
"longitude",
"coordinate",
"(",
"in",
"degrees",
")",
"to",
"the",
"tile",
"X",
"number",
"at",
"a",
"certain",
"zoom",
"level",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L300-L302 |
nats-io/java-nats-streaming | src/main/java/io/nats/streaming/Message.java | Message.setData | public void setData(byte[] data, int offset, int length) {
"""
Sets the message payload data.
@param data the payload data
@param offset the beginning offset to copy from
@param length the length to copy
"""
if (immutable) {
throw new IllegalStateException(ERR_MSG_IMMUTABLE);
}... | java | public void setData(byte[] data, int offset, int length) {
if (immutable) {
throw new IllegalStateException(ERR_MSG_IMMUTABLE);
}
this.data = new byte[length];
System.arraycopy(data, offset, this.data, 0, length);
} | [
"public",
"void",
"setData",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"if",
"(",
"immutable",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"ERR_MSG_IMMUTABLE",
")",
";",
"}",
"this",
".",
"data",
"... | Sets the message payload data.
@param data the payload data
@param offset the beginning offset to copy from
@param length the length to copy | [
"Sets",
"the",
"message",
"payload",
"data",
"."
] | train | https://github.com/nats-io/java-nats-streaming/blob/72f964e9093622875d7f1c85ce60820e028863e7/src/main/java/io/nats/streaming/Message.java#L162-L168 |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2DivSufSort.java | Bzip2DivSufSort.bwt | public int bwt() {
"""
Performs a Burrows Wheeler Transform on the input array.
@return the index of the first character of the input array within the output array
"""
final int[] SA = this.SA;
final byte[] T = this.T;
final int n = this.n;
final int[] bucketA = new int[BUCKET... | java | public int bwt() {
final int[] SA = this.SA;
final byte[] T = this.T;
final int n = this.n;
final int[] bucketA = new int[BUCKET_A_SIZE];
final int[] bucketB = new int[BUCKET_B_SIZE];
if (n == 0) {
return 0;
}
if (n == 1) {
SA[0] ... | [
"public",
"int",
"bwt",
"(",
")",
"{",
"final",
"int",
"[",
"]",
"SA",
"=",
"this",
".",
"SA",
";",
"final",
"byte",
"[",
"]",
"T",
"=",
"this",
".",
"T",
";",
"final",
"int",
"n",
"=",
"this",
".",
"n",
";",
"final",
"int",
"[",
"]",
"buck... | Performs a Burrows Wheeler Transform on the input array.
@return the index of the first character of the input array within the output array | [
"Performs",
"a",
"Burrows",
"Wheeler",
"Transform",
"on",
"the",
"input",
"array",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2DivSufSort.java#L2095-L2116 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java | CertificateOperations.createCertificate | public void createCertificate(CertificateAddParameter certificate, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
"""
Adds a certificate to the Batch account.
@param certificate The certificate to be added.
@param additionalBehaviors A collection of {@link BatchCli... | java | public void createCertificate(CertificateAddParameter certificate, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
CertificateAddOptions options = new CertificateAddOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehav... | [
"public",
"void",
"createCertificate",
"(",
"CertificateAddParameter",
"certificate",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"CertificateAddOptions",
"options",
"=",
"new",
"C... | Adds a certificate to the Batch account.
@param certificate The certificate to be added.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service... | [
"Adds",
"a",
"certificate",
"to",
"the",
"Batch",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java#L147-L153 |
dlemmermann/CalendarFX | CalendarFXView/src/main/java/com/calendarfx/model/Entry.java | Entry.changeStartDate | public final void changeStartDate(LocalDate date, boolean keepDuration) {
"""
Changes the start date of the entry interval.
@param date the new start date
@param keepDuration if true then this method will also change the end date and time in such a way that the total duration
of the entry will not cha... | java | public final void changeStartDate(LocalDate date, boolean keepDuration) {
requireNonNull(date);
Interval interval = getInterval();
LocalDateTime newStartDateTime = getStartAsLocalDateTime().with(date);
LocalDateTime endDateTime = getEndAsLocalDateTime();
if (keepDuration) {
... | [
"public",
"final",
"void",
"changeStartDate",
"(",
"LocalDate",
"date",
",",
"boolean",
"keepDuration",
")",
"{",
"requireNonNull",
"(",
"date",
")",
";",
"Interval",
"interval",
"=",
"getInterval",
"(",
")",
";",
"LocalDateTime",
"newStartDateTime",
"=",
"getSt... | Changes the start date of the entry interval.
@param date the new start date
@param keepDuration if true then this method will also change the end date and time in such a way that the total duration
of the entry will not change. If false then this method will ensure that the entry's interval
stays valid, which... | [
"Changes",
"the",
"start",
"date",
"of",
"the",
"entry",
"interval",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/model/Entry.java#L397-L419 |
facebookarchive/hive-dwrf | hive-dwrf/src/main/java/com/facebook/hive/orc/InStream.java | InStream.create | public static InStream create(String name, ByteBuffer input, CompressionCodec codec,
int bufferSize) throws IOException {
"""
This should only be used if the data happens to already be in memory, e.g. for tests
"""
return create(name, input, codec, bufferSize, true);
} | java | public static InStream create(String name, ByteBuffer input, CompressionCodec codec,
int bufferSize) throws IOException {
return create(name, input, codec, bufferSize, true);
} | [
"public",
"static",
"InStream",
"create",
"(",
"String",
"name",
",",
"ByteBuffer",
"input",
",",
"CompressionCodec",
"codec",
",",
"int",
"bufferSize",
")",
"throws",
"IOException",
"{",
"return",
"create",
"(",
"name",
",",
"input",
",",
"codec",
",",
"buf... | This should only be used if the data happens to already be in memory, e.g. for tests | [
"This",
"should",
"only",
"be",
"used",
"if",
"the",
"data",
"happens",
"to",
"already",
"be",
"in",
"memory",
"e",
".",
"g",
".",
"for",
"tests"
] | train | https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/InStream.java#L481-L484 |
unbescape/unbescape | src/main/java/org/unbescape/uri/UriEscape.java | UriEscape.escapeUriPathSegment | public static void escapeUriPathSegment(final String text, final Writer writer, final String encoding)
throws IOException {
"""
<p>
Perform am URI path segment <strong>escape</strong> operation
on a <tt>String</tt> input, writing results to a <tt>Writer</tt>.
</p>
<p>
The following are the only al... | java | public static void escapeUriPathSegment(final String text, final Writer writer, final String encoding)
throws IOException {
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
if (encoding == null) {
throw new Ille... | [
"public",
"static",
"void",
"escapeUriPathSegment",
"(",
"final",
"String",
"text",
",",
"final",
"Writer",
"writer",
",",
"final",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"if",
"(",
"writer",
"==",
"null",
")",
"{",
"throw",
"new",
"Illegal... | <p>
Perform am URI path segment <strong>escape</strong> operation
on a <tt>String</tt> input, writing results to a <tt>Writer</tt>.
</p>
<p>
The following are the only allowed chars in an URI path segment (will not be escaped):
</p>
<ul>
<li><tt>A-Z a-z 0-9</tt></li>
<li><tt>- . _ ~</tt></li>
<li><tt>! $ & ' ( ) * ... | [
"<p",
">",
"Perform",
"am",
"URI",
"path",
"segment",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"String<",
"/",
"tt",
">",
"input",
"writing",
"results",
"to",
"a",
"<tt",
">",
"Writer<",
"/",
"tt",
">",
".",
... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L570-L583 |
MorphiaOrg/morphia | morphia/src/main/java/dev/morphia/Morphia.java | Morphia.fromDBObject | public <T> T fromDBObject(final Datastore datastore, final Class<T> entityClass, final DBObject dbObject) {
"""
Creates an entity and populates its state based on the dbObject given. This method is primarily an internal method. Reliance on
this method may break your application in future releases.
@param <T>... | java | public <T> T fromDBObject(final Datastore datastore, final Class<T> entityClass, final DBObject dbObject) {
return fromDBObject(datastore, entityClass, dbObject, mapper.createEntityCache());
} | [
"public",
"<",
"T",
">",
"T",
"fromDBObject",
"(",
"final",
"Datastore",
"datastore",
",",
"final",
"Class",
"<",
"T",
">",
"entityClass",
",",
"final",
"DBObject",
"dbObject",
")",
"{",
"return",
"fromDBObject",
"(",
"datastore",
",",
"entityClass",
",",
... | Creates an entity and populates its state based on the dbObject given. This method is primarily an internal method. Reliance on
this method may break your application in future releases.
@param <T> type of the entity
@param datastore the Datastore to use when fetching this reference
@param entityClass type... | [
"Creates",
"an",
"entity",
"and",
"populates",
"its",
"state",
"based",
"on",
"the",
"dbObject",
"given",
".",
"This",
"method",
"is",
"primarily",
"an",
"internal",
"method",
".",
"Reliance",
"on",
"this",
"method",
"may",
"break",
"your",
"application",
"i... | train | https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/Morphia.java#L116-L118 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/blogs/BlogsInterface.java | BlogsInterface.postPhoto | public void postPhoto(Photo photo, String blogId, String blogPassword) throws FlickrException {
"""
Post the specified photo to a blog. Note that the Photo.title and Photo.description are used for the blog entry title and body respectively.
@param photo
The photo metadata
@param blogId
The blog ID
@param bl... | java | public void postPhoto(Photo photo, String blogId, String blogPassword) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_POST_PHOTO);
parameters.put("blog_id", blogId);
parameters.put("photo_id", photo.getId());... | [
"public",
"void",
"postPhoto",
"(",
"Photo",
"photo",
",",
"String",
"blogId",
",",
"String",
"blogPassword",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
... | Post the specified photo to a blog. Note that the Photo.title and Photo.description are used for the blog entry title and body respectively.
@param photo
The photo metadata
@param blogId
The blog ID
@param blogPassword
The blog password
@throws FlickrException | [
"Post",
"the",
"specified",
"photo",
"to",
"a",
"blog",
".",
"Note",
"that",
"the",
"Photo",
".",
"title",
"and",
"Photo",
".",
"description",
"are",
"used",
"for",
"the",
"blog",
"entry",
"title",
"and",
"body",
"respectively",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/blogs/BlogsInterface.java#L85-L101 |
apereo/cas | core/cas-server-core-services-authentication/src/main/java/org/apereo/cas/authentication/principal/DefaultResponse.java | DefaultResponse.getHeaderResponse | public static Response getHeaderResponse(final String url, final Map<String, String> attributes) {
"""
Gets header response.
@param url the url
@param attributes the attributes
@return the header response
"""
return new DefaultResponse(ResponseType.HEADER, url, attributes);
} | java | public static Response getHeaderResponse(final String url, final Map<String, String> attributes) {
return new DefaultResponse(ResponseType.HEADER, url, attributes);
} | [
"public",
"static",
"Response",
"getHeaderResponse",
"(",
"final",
"String",
"url",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"return",
"new",
"DefaultResponse",
"(",
"ResponseType",
".",
"HEADER",
",",
"url",
",",
"attr... | Gets header response.
@param url the url
@param attributes the attributes
@return the header response | [
"Gets",
"header",
"response",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-authentication/src/main/java/org/apereo/cas/authentication/principal/DefaultResponse.java#L60-L62 |
OpenTSDB/opentsdb | src/tsd/HttpJsonSerializer.java | HttpJsonSerializer.parseSuggestV1 | @Override
public HashMap<String, String> parseSuggestV1() {
"""
Parses a suggestion query
@return a hash map of key/value pairs
@throws JSONException if parsing failed
@throws BadRequestException if the content was missing or parsing failed
"""
final String json = query.getContent();
if (json == n... | java | @Override
public HashMap<String, String> parseSuggestV1() {
final String json = query.getContent();
if (json == null || json.isEmpty()) {
throw new BadRequestException(HttpResponseStatus.BAD_REQUEST,
"Missing message content",
"Supply valid JSON formatted data in the body of your req... | [
"@",
"Override",
"public",
"HashMap",
"<",
"String",
",",
"String",
">",
"parseSuggestV1",
"(",
")",
"{",
"final",
"String",
"json",
"=",
"query",
".",
"getContent",
"(",
")",
";",
"if",
"(",
"json",
"==",
"null",
"||",
"json",
".",
"isEmpty",
"(",
"... | Parses a suggestion query
@return a hash map of key/value pairs
@throws JSONException if parsing failed
@throws BadRequestException if the content was missing or parsing failed | [
"Parses",
"a",
"suggestion",
"query"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpJsonSerializer.java#L202-L216 |
mistraltechnologies/smog | src/main/java/com/mistraltech/smog/core/util/PropertyDescriptorLocator.java | PropertyDescriptorLocator.getPropertyDescriptor | public PropertyDescriptor getPropertyDescriptor(String propertyName) {
"""
Get the property descriptor for the named property. Throws an exception if the property does not exist.
@param propertyName property name
@return the PropertyDescriptor for the named property
@throws PropertyNotFoundException if the na... | java | public PropertyDescriptor getPropertyDescriptor(String propertyName)
{
final PropertyDescriptor propertyDescriptor = findPropertyDescriptor(propertyName);
if (propertyDescriptor == null) {
throw new PropertyNotFoundException(beanClass, propertyName);
}
return propertyDe... | [
"public",
"PropertyDescriptor",
"getPropertyDescriptor",
"(",
"String",
"propertyName",
")",
"{",
"final",
"PropertyDescriptor",
"propertyDescriptor",
"=",
"findPropertyDescriptor",
"(",
"propertyName",
")",
";",
"if",
"(",
"propertyDescriptor",
"==",
"null",
")",
"{",
... | Get the property descriptor for the named property. Throws an exception if the property does not exist.
@param propertyName property name
@return the PropertyDescriptor for the named property
@throws PropertyNotFoundException if the named property does not exist on the bean
@see #findPropertyDescriptor(String) | [
"Get",
"the",
"property",
"descriptor",
"for",
"the",
"named",
"property",
".",
"Throws",
"an",
"exception",
"if",
"the",
"property",
"does",
"not",
"exist",
"."
] | train | https://github.com/mistraltechnologies/smog/blob/bd561520f79476b96467f554daa59e51875ce027/src/main/java/com/mistraltech/smog/core/util/PropertyDescriptorLocator.java#L44-L53 |
Stratio/stratio-cassandra | src/java/com/stratio/cassandra/index/service/FullKeyMapper.java | FullKeyMapper.byteBuffer | public ByteBuffer byteBuffer(DecoratedKey partitionKey, CellName cellName) {
"""
Returns the {@link ByteBuffer} representation of the full row key formed by the specified partition key and the
clustering key.
@param partitionKey A partition key.
@param cellName A clustering key.
@return The {@link ByteBu... | java | public ByteBuffer byteBuffer(DecoratedKey partitionKey, CellName cellName) {
return type.builder().add(partitionKey.getKey()).add(cellName.toByteBuffer()).build();
} | [
"public",
"ByteBuffer",
"byteBuffer",
"(",
"DecoratedKey",
"partitionKey",
",",
"CellName",
"cellName",
")",
"{",
"return",
"type",
".",
"builder",
"(",
")",
".",
"add",
"(",
"partitionKey",
".",
"getKey",
"(",
")",
")",
".",
"add",
"(",
"cellName",
".",
... | Returns the {@link ByteBuffer} representation of the full row key formed by the specified partition key and the
clustering key.
@param partitionKey A partition key.
@param cellName A clustering key.
@return The {@link ByteBuffer} representation of the full row key formed by the specified key pair. | [
"Returns",
"the",
"{",
"@link",
"ByteBuffer",
"}",
"representation",
"of",
"the",
"full",
"row",
"key",
"formed",
"by",
"the",
"specified",
"partition",
"key",
"and",
"the",
"clustering",
"key",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/index/service/FullKeyMapper.java#L77-L79 |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/image/VisualizeImageData.java | VisualizeImageData.colorizeSign | public static BufferedImage colorizeSign(ImageGray src, BufferedImage dst, double normalize) {
"""
<p>
Renders a colored image where the color indicates the sign and intensity its magnitude. The input is divided
by normalize to render it in the appropriate scale.
</p>
@param src Input single band ima... | java | public static BufferedImage colorizeSign(ImageGray src, BufferedImage dst, double normalize) {
dst = checkInputs(src, dst);
if (normalize <= 0) {
normalize = GImageStatistics.maxAbs(src);
}
if (normalize == 0) {
// sets the output to black
ConvertBufferedImage.convertTo(src,dst,true);
return dst;
... | [
"public",
"static",
"BufferedImage",
"colorizeSign",
"(",
"ImageGray",
"src",
",",
"BufferedImage",
"dst",
",",
"double",
"normalize",
")",
"{",
"dst",
"=",
"checkInputs",
"(",
"src",
",",
"dst",
")",
";",
"if",
"(",
"normalize",
"<=",
"0",
")",
"{",
"no... | <p>
Renders a colored image where the color indicates the sign and intensity its magnitude. The input is divided
by normalize to render it in the appropriate scale.
</p>
@param src Input single band image.
@param dst Where the image is rendered into. If null a new BufferedImage will be created and retur... | [
"<p",
">",
"Renders",
"a",
"colored",
"image",
"where",
"the",
"color",
"indicates",
"the",
"sign",
"and",
"intensity",
"its",
"magnitude",
".",
"The",
"input",
"is",
"divided",
"by",
"normalize",
"to",
"render",
"it",
"in",
"the",
"appropriate",
"scale",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/image/VisualizeImageData.java#L88-L106 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java | Math.floorMod | public static int floorMod(int x, int y) {
"""
Returns the floor modulus of the {@code int} arguments.
<p>
The floor modulus is {@code x - (floorDiv(x, y) * y)},
has the same sign as the divisor {@code y}, and
is in the range of {@code -abs(y) < r < +abs(y)}.
<p>
The relationship between {@code floorDiv} a... | java | public static int floorMod(int x, int y) {
int r = x - floorDiv(x, y) * y;
return r;
} | [
"public",
"static",
"int",
"floorMod",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"int",
"r",
"=",
"x",
"-",
"floorDiv",
"(",
"x",
",",
"y",
")",
"*",
"y",
";",
"return",
"r",
";",
"}"
] | Returns the floor modulus of the {@code int} arguments.
<p>
The floor modulus is {@code x - (floorDiv(x, y) * y)},
has the same sign as the divisor {@code y}, and
is in the range of {@code -abs(y) < r < +abs(y)}.
<p>
The relationship between {@code floorDiv} and {@code floorMod} is such that:
<ul>
<li>{@code floorDiv(... | [
"Returns",
"the",
"floor",
"modulus",
"of",
"the",
"{",
"@code",
"int",
"}",
"arguments",
".",
"<p",
">",
"The",
"floor",
"modulus",
"is",
"{",
"@code",
"x",
"-",
"(",
"floorDiv",
"(",
"x",
"y",
")",
"*",
"y",
")",
"}",
"has",
"the",
"same",
"sig... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java#L1143-L1146 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java | ConstantsSummaryBuilder.buildContents | public void buildContents(XMLNode node, Content contentTree) {
"""
Build the list of packages.
@param node the XML element that specifies which components to document
@param contentTree the content tree to which the content list will be added
"""
Content contentListTree = writer.getContentsHeader()... | java | public void buildContents(XMLNode node, Content contentTree) {
Content contentListTree = writer.getContentsHeader();
PackageDoc[] packages = configuration.packages;
printedPackageHeaders = new HashSet<String>();
for (int i = 0; i < packages.length; i++) {
if (hasConstantField... | [
"public",
"void",
"buildContents",
"(",
"XMLNode",
"node",
",",
"Content",
"contentTree",
")",
"{",
"Content",
"contentListTree",
"=",
"writer",
".",
"getContentsHeader",
"(",
")",
";",
"PackageDoc",
"[",
"]",
"packages",
"=",
"configuration",
".",
"packages",
... | Build the list of packages.
@param node the XML element that specifies which components to document
@param contentTree the content tree to which the content list will be added | [
"Build",
"the",
"list",
"of",
"packages",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java#L152-L164 |
headius/invokebinder | src/main/java/com/headius/invokebinder/Binder.java | Binder.foldVirtual | public Binder foldVirtual(MethodHandles.Lookup lookup, String method) {
"""
Process the incoming arguments by calling the given method on the first
argument, inserting the result as the first argument.
@param lookup the java.lang.invoke.MethodHandles.Lookup to use
@param method the method to invoke on the fir... | java | public Binder foldVirtual(MethodHandles.Lookup lookup, String method) {
return fold(Binder.from(type()).invokeVirtualQuiet(lookup, method));
} | [
"public",
"Binder",
"foldVirtual",
"(",
"MethodHandles",
".",
"Lookup",
"lookup",
",",
"String",
"method",
")",
"{",
"return",
"fold",
"(",
"Binder",
".",
"from",
"(",
"type",
"(",
")",
")",
".",
"invokeVirtualQuiet",
"(",
"lookup",
",",
"method",
")",
"... | Process the incoming arguments by calling the given method on the first
argument, inserting the result as the first argument.
@param lookup the java.lang.invoke.MethodHandles.Lookup to use
@param method the method to invoke on the first argument
@return a new Binder | [
"Process",
"the",
"incoming",
"arguments",
"by",
"calling",
"the",
"given",
"method",
"on",
"the",
"first",
"argument",
"inserting",
"the",
"result",
"as",
"the",
"first",
"argument",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L980-L982 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/sequencevectors/listeners/SerializingListener.java | SerializingListener.validateEvent | @Override
public boolean validateEvent(ListenerEvent event, long argument) {
"""
This method is called prior each processEvent call, to check if this specific VectorsListener implementation is viable for specific event
@param event
@param argument
@return TRUE, if this event can and should be processed wi... | java | @Override
public boolean validateEvent(ListenerEvent event, long argument) {
try {
/**
* please note, since sequence vectors are multithreaded we need to stop processed while model is being saved
*/
locker.acquire();
if (event == targetEvent && ... | [
"@",
"Override",
"public",
"boolean",
"validateEvent",
"(",
"ListenerEvent",
"event",
",",
"long",
"argument",
")",
"{",
"try",
"{",
"/**\n * please note, since sequence vectors are multithreaded we need to stop processed while model is being saved\n */",
"loc... | This method is called prior each processEvent call, to check if this specific VectorsListener implementation is viable for specific event
@param event
@param argument
@return TRUE, if this event can and should be processed with this listener, FALSE otherwise | [
"This",
"method",
"is",
"called",
"prior",
"each",
"processEvent",
"call",
"to",
"check",
"if",
"this",
"specific",
"VectorsListener",
"implementation",
"is",
"viable",
"for",
"specific",
"event"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/sequencevectors/listeners/SerializingListener.java#L55-L72 |
geomajas/geomajas-project-server | command/src/main/java/org/geomajas/command/dto/SearchByLocationRequest.java | SearchByLocationRequest.setFilter | @Deprecated
public void setFilter(String serverLayerId, String filter) {
"""
Set the filter expression which should be applied on the given server layer. If there has already been specified
a filter for that server layer, it will be overwritten.
<p/>
If the filter contains a geometry, then this needs to be in ... | java | @Deprecated
public void setFilter(String serverLayerId, String filter) {
addLayerWithFilter(serverLayerId, serverLayerId, filter);
} | [
"@",
"Deprecated",
"public",
"void",
"setFilter",
"(",
"String",
"serverLayerId",
",",
"String",
"filter",
")",
"{",
"addLayerWithFilter",
"(",
"serverLayerId",
",",
"serverLayerId",
",",
"filter",
")",
";",
"}"
] | Set the filter expression which should be applied on the given server layer. If there has already been specified
a filter for that server layer, it will be overwritten.
<p/>
If the filter contains a geometry, then this needs to be in layer CRS, it is not converted!
@param serverLayerId server layer to set this filter ... | [
"Set",
"the",
"filter",
"expression",
"which",
"should",
"be",
"applied",
"on",
"the",
"given",
"server",
"layer",
".",
"If",
"there",
"has",
"already",
"been",
"specified",
"a",
"filter",
"for",
"that",
"server",
"layer",
"it",
"will",
"be",
"overwritten",
... | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/command/src/main/java/org/geomajas/command/dto/SearchByLocationRequest.java#L296-L299 |
openengsb/openengsb | connector/userprojectsldap/src/main/java/org/openengsb/connector/userprojects/ldap/internal/ldap/EntryFactory.java | EntryFactory.namedObject | public static Entry namedObject(String name, Dn baseDn) {
"""
Returns an {@link Entry} whose {@link Dn} is baseDn followed by name as Rdn. The attribute type of the Rdn is
'common name'.
"""
Dn dn = Utils.concatDn(SchemaConstants.CN_ATTRIBUTE, name, baseDn);
return namedObject(dn);
} | java | public static Entry namedObject(String name, Dn baseDn) {
Dn dn = Utils.concatDn(SchemaConstants.CN_ATTRIBUTE, name, baseDn);
return namedObject(dn);
} | [
"public",
"static",
"Entry",
"namedObject",
"(",
"String",
"name",
",",
"Dn",
"baseDn",
")",
"{",
"Dn",
"dn",
"=",
"Utils",
".",
"concatDn",
"(",
"SchemaConstants",
".",
"CN_ATTRIBUTE",
",",
"name",
",",
"baseDn",
")",
";",
"return",
"namedObject",
"(",
... | Returns an {@link Entry} whose {@link Dn} is baseDn followed by name as Rdn. The attribute type of the Rdn is
'common name'. | [
"Returns",
"an",
"{"
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/connector/userprojectsldap/src/main/java/org/openengsb/connector/userprojects/ldap/internal/ldap/EntryFactory.java#L212-L215 |
hawkular/hawkular-apm | client/collector/src/main/java/org/hawkular/apm/client/collector/internal/FragmentBuilder.java | FragmentBuilder.writeOutData | public void writeOutData(int hashCode, byte[] b, int offset, int len) {
"""
This method writes data to the out buffer.
@param hashCode The hash code, or -1 to ignore the hash code
@param b The bytes
@param offset The offset
@param len The length
"""
if (outStream != null && (hashCode == -1 || has... | java | public void writeOutData(int hashCode, byte[] b, int offset, int len) {
if (outStream != null && (hashCode == -1 || hashCode == outHashCode)) {
outStream.write(b, offset, len);
}
} | [
"public",
"void",
"writeOutData",
"(",
"int",
"hashCode",
",",
"byte",
"[",
"]",
"b",
",",
"int",
"offset",
",",
"int",
"len",
")",
"{",
"if",
"(",
"outStream",
"!=",
"null",
"&&",
"(",
"hashCode",
"==",
"-",
"1",
"||",
"hashCode",
"==",
"outHashCode... | This method writes data to the out buffer.
@param hashCode The hash code, or -1 to ignore the hash code
@param b The bytes
@param offset The offset
@param len The length | [
"This",
"method",
"writes",
"data",
"to",
"the",
"out",
"buffer",
"."
] | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/collector/src/main/java/org/hawkular/apm/client/collector/internal/FragmentBuilder.java#L563-L567 |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/terminal/ansi/StreamBasedTerminal.java | StreamBasedTerminal.waitForCursorPositionReport | synchronized TerminalPosition waitForCursorPositionReport() throws IOException {
"""
Waits for up to 5 seconds for a terminal cursor position report to appear in the input stream. If the timeout
expires, it will return null. You should have sent the cursor position query already before
calling this method.
@ret... | java | synchronized TerminalPosition waitForCursorPositionReport() throws IOException {
long startTime = System.currentTimeMillis();
TerminalPosition cursorPosition = lastReportedCursorPosition;
while(cursorPosition == null) {
if(System.currentTimeMillis() - startTime > 5000) {
... | [
"synchronized",
"TerminalPosition",
"waitForCursorPositionReport",
"(",
")",
"throws",
"IOException",
"{",
"long",
"startTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"TerminalPosition",
"cursorPosition",
"=",
"lastReportedCursorPosition",
";",
"while",
... | Waits for up to 5 seconds for a terminal cursor position report to appear in the input stream. If the timeout
expires, it will return null. You should have sent the cursor position query already before
calling this method.
@return Current position of the cursor, or null if the terminal didn't report it in time.
@throws... | [
"Waits",
"for",
"up",
"to",
"5",
"seconds",
"for",
"a",
"terminal",
"cursor",
"position",
"report",
"to",
"appear",
"in",
"the",
"input",
"stream",
".",
"If",
"the",
"timeout",
"expires",
"it",
"will",
"return",
"null",
".",
"You",
"should",
"have",
"sen... | train | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/terminal/ansi/StreamBasedTerminal.java#L167-L185 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobClient.java | JobClient.validateNumberOfTasks | private void validateNumberOfTasks(int splits, int reduceTasks, JobConf conf)
throws IOException {
"""
JobTrcker applies this limit against the sum of mappers and reducers.
"""
int maxTasks = conf.getInt("mapred.jobtracker.maxtasks.per.job", -1);
int totalTasks = splits + reduceTasks;
if ((ma... | java | private void validateNumberOfTasks(int splits, int reduceTasks, JobConf conf)
throws IOException {
int maxTasks = conf.getInt("mapred.jobtracker.maxtasks.per.job", -1);
int totalTasks = splits + reduceTasks;
if ((maxTasks!= -1) && (totalTasks > maxTasks)) {
throw new IOException(
... | [
"private",
"void",
"validateNumberOfTasks",
"(",
"int",
"splits",
",",
"int",
"reduceTasks",
",",
"JobConf",
"conf",
")",
"throws",
"IOException",
"{",
"int",
"maxTasks",
"=",
"conf",
".",
"getInt",
"(",
"\"mapred.jobtracker.maxtasks.per.job\"",
",",
"-",
"1",
"... | JobTrcker applies this limit against the sum of mappers and reducers. | [
"JobTrcker",
"applies",
"this",
"limit",
"against",
"the",
"sum",
"of",
"mappers",
"and",
"reducers",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobClient.java#L1353-L1364 |
GoogleCloudPlatform/appengine-mapreduce | java/src/main/java/com/google/appengine/tools/mapreduce/impl/BigQueryDataMarshallerByType.java | BigQueryDataMarshallerByType.assertFieldValue | private void assertFieldValue(Field field, Object fieldValue) {
"""
Asserts that a field annotated as {@link BigQueryFieldMode#REPEATED} is not left null.
"""
if (fieldValue == null && isFieldRequired(field)) {
throw new IllegalArgumentException("Non-nullable field " + field.getName()
+ ". ... | java | private void assertFieldValue(Field field, Object fieldValue) {
if (fieldValue == null && isFieldRequired(field)) {
throw new IllegalArgumentException("Non-nullable field " + field.getName()
+ ". This field is either annotated as REQUIRED or is a primitive type.");
}
} | [
"private",
"void",
"assertFieldValue",
"(",
"Field",
"field",
",",
"Object",
"fieldValue",
")",
"{",
"if",
"(",
"fieldValue",
"==",
"null",
"&&",
"isFieldRequired",
"(",
"field",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Non-nullable fie... | Asserts that a field annotated as {@link BigQueryFieldMode#REPEATED} is not left null. | [
"Asserts",
"that",
"a",
"field",
"annotated",
"as",
"{"
] | train | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/java/src/main/java/com/google/appengine/tools/mapreduce/impl/BigQueryDataMarshallerByType.java#L84-L89 |
JOML-CI/JOML | src/org/joml/Matrix4x3f.java | Matrix4x3f.setColumn | public Matrix4x3f setColumn(int column, Vector3fc src) throws IndexOutOfBoundsException {
"""
Set the column at the given <code>column</code> index, starting with <code>0</code>.
@param column
the column index in <code>[0..3]</code>
@param src
the column components to set
@return this
@throws IndexOutOfBou... | java | public Matrix4x3f setColumn(int column, Vector3fc src) throws IndexOutOfBoundsException {
switch (column) {
case 0:
this.m00 = src.x();
this.m01 = src.y();
this.m02 = src.z();
break;
case 1:
this.m10 = src.x();
this.m11 = sr... | [
"public",
"Matrix4x3f",
"setColumn",
"(",
"int",
"column",
",",
"Vector3fc",
"src",
")",
"throws",
"IndexOutOfBoundsException",
"{",
"switch",
"(",
"column",
")",
"{",
"case",
"0",
":",
"this",
".",
"m00",
"=",
"src",
".",
"x",
"(",
")",
";",
"this",
"... | Set the column at the given <code>column</code> index, starting with <code>0</code>.
@param column
the column index in <code>[0..3]</code>
@param src
the column components to set
@return this
@throws IndexOutOfBoundsException if <code>column</code> is not in <code>[0..3]</code> | [
"Set",
"the",
"column",
"at",
"the",
"given",
"<code",
">",
"column<",
"/",
"code",
">",
"index",
"starting",
"with",
"<code",
">",
"0<",
"/",
"code",
">",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L7567-L7594 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java | TreeScanner.visitSynchronized | @Override
public R visitSynchronized(SynchronizedTree node, P p) {
"""
{@inheritDoc} This implementation scans the children in left to right order.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of scanning
"""
R r = scan(node.getExpression(), p);
r = scanAndRedu... | java | @Override
public R visitSynchronized(SynchronizedTree node, P p) {
R r = scan(node.getExpression(), p);
r = scanAndReduce(node.getBlock(), p, r);
return r;
} | [
"@",
"Override",
"public",
"R",
"visitSynchronized",
"(",
"SynchronizedTree",
"node",
",",
"P",
"p",
")",
"{",
"R",
"r",
"=",
"scan",
"(",
"node",
".",
"getExpression",
"(",
")",
",",
"p",
")",
";",
"r",
"=",
"scanAndReduce",
"(",
"node",
".",
"getBl... | {@inheritDoc} This implementation scans the children in left to right order.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of scanning | [
"{",
"@inheritDoc",
"}",
"This",
"implementation",
"scans",
"the",
"children",
"in",
"left",
"to",
"right",
"order",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java#L357-L362 |
beangle/beangle3 | ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java | BeanDefinitionParser.parseValueElement | public Object parseValueElement(Element ele, String defaultTypeName) {
"""
Return a typed String value Object for the given value element.
@param ele a {@link org.w3c.dom.Element} object.
@param defaultTypeName a {@link java.lang.String} object.
@return a {@link java.lang.Object} object.
"""
// It's a... | java | public Object parseValueElement(Element ele, String defaultTypeName) {
// It's a literal value.
String value = DomUtils.getTextValue(ele);
String specifiedTypeName = ele.getAttribute(TYPE_ATTRIBUTE);
String typeName = specifiedTypeName;
if (!StringUtils.hasText(typeName)) typeName = defaultTypeName;... | [
"public",
"Object",
"parseValueElement",
"(",
"Element",
"ele",
",",
"String",
"defaultTypeName",
")",
"{",
"// It's a literal value.",
"String",
"value",
"=",
"DomUtils",
".",
"getTextValue",
"(",
"ele",
")",
";",
"String",
"specifiedTypeName",
"=",
"ele",
".",
... | Return a typed String value Object for the given value element.
@param ele a {@link org.w3c.dom.Element} object.
@param defaultTypeName a {@link java.lang.String} object.
@return a {@link java.lang.Object} object. | [
"Return",
"a",
"typed",
"String",
"value",
"Object",
"for",
"the",
"given",
"value",
"element",
"."
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java#L756-L771 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/AirlineItineraryTemplateBuilder.java | AirlineItineraryTemplateBuilder.addPassengerInfo | public AirlineItineraryTemplateBuilder addPassengerInfo(String passengerId,
String name) {
"""
Adds a {@link PassengerInfo} object to this template. This field is
mandatory for this template. There must be at least one element.
@param passengerId
the passenger ID. It can't be empty.
@param name
the passe... | java | public AirlineItineraryTemplateBuilder addPassengerInfo(String passengerId,
String name) {
PassengerInfo passengerInfo = new PassengerInfo(passengerId, name);
this.payload.addPassengerInfo(passengerInfo);
return this;
} | [
"public",
"AirlineItineraryTemplateBuilder",
"addPassengerInfo",
"(",
"String",
"passengerId",
",",
"String",
"name",
")",
"{",
"PassengerInfo",
"passengerInfo",
"=",
"new",
"PassengerInfo",
"(",
"passengerId",
",",
"name",
")",
";",
"this",
".",
"payload",
".",
"... | Adds a {@link PassengerInfo} object to this template. This field is
mandatory for this template. There must be at least one element.
@param passengerId
the passenger ID. It can't be empty.
@param name
the passenger name. It can't be empty.
@return this builder. | [
"Adds",
"a",
"{",
"@link",
"PassengerInfo",
"}",
"object",
"to",
"this",
"template",
".",
"This",
"field",
"is",
"mandatory",
"for",
"this",
"template",
".",
"There",
"must",
"be",
"at",
"least",
"one",
"element",
"."
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/AirlineItineraryTemplateBuilder.java#L148-L153 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/CQLTranslator.java | CQLTranslator.buildSetClauseForCounters | public void buildSetClauseForCounters(StringBuilder builder, String field, Object value) {
"""
Builds set clause for a given counter field.
@param builder
the builder
@param field
the field
@param value
the value
"""
builder = ensureCase(builder, field, false);
builder.append(EQ_CLAUSE)... | java | public void buildSetClauseForCounters(StringBuilder builder, String field, Object value)
{
builder = ensureCase(builder, field, false);
builder.append(EQ_CLAUSE);
builder = ensureCase(builder, field, false);
builder.append(INCR_COUNTER);
appendValue(builder, value.getClass(),... | [
"public",
"void",
"buildSetClauseForCounters",
"(",
"StringBuilder",
"builder",
",",
"String",
"field",
",",
"Object",
"value",
")",
"{",
"builder",
"=",
"ensureCase",
"(",
"builder",
",",
"field",
",",
"false",
")",
";",
"builder",
".",
"append",
"(",
"EQ_C... | Builds set clause for a given counter field.
@param builder
the builder
@param field
the field
@param value
the value | [
"Builds",
"set",
"clause",
"for",
"a",
"given",
"counter",
"field",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/CQLTranslator.java#L951-L959 |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.printOnTaskManager | public DataSink<T> printOnTaskManager(String prefix) {
"""
Writes a DataSet to the standard output streams (stdout) of the TaskManagers that execute
the program (or more specifically, the data sink operators). On a typical cluster setup, the
data will appear in the TaskManagers' <i>.out</i> files.
<p>To print... | java | public DataSink<T> printOnTaskManager(String prefix) {
return output(new PrintingOutputFormat<T>(prefix, false));
} | [
"public",
"DataSink",
"<",
"T",
">",
"printOnTaskManager",
"(",
"String",
"prefix",
")",
"{",
"return",
"output",
"(",
"new",
"PrintingOutputFormat",
"<",
"T",
">",
"(",
"prefix",
",",
"false",
")",
")",
";",
"}"
] | Writes a DataSet to the standard output streams (stdout) of the TaskManagers that execute
the program (or more specifically, the data sink operators). On a typical cluster setup, the
data will appear in the TaskManagers' <i>.out</i> files.
<p>To print the data to the console or stdout stream of the client process inst... | [
"Writes",
"a",
"DataSet",
"to",
"the",
"standard",
"output",
"streams",
"(",
"stdout",
")",
"of",
"the",
"TaskManagers",
"that",
"execute",
"the",
"program",
"(",
"or",
"more",
"specifically",
"the",
"data",
"sink",
"operators",
")",
".",
"On",
"a",
"typic... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L1694-L1696 |
FedericoPecora/meta-csp-framework | src/main/java/org/metacsp/multi/spatioTemporal/paths/Trajectory.java | Trajectory.getTimeToEstimate | public double getTimeToEstimate(int sequenceNumNow, int sequenceNumTo) {
"""
Get an estimate of the time left to move on this {@link Trajectory}
between two path indices. The estimate is based on this {@link Trajectory}'s
temporal profile.
@param sequenceNumNow The path index from which the estimate should be c... | java | public double getTimeToEstimate(int sequenceNumNow, int sequenceNumTo) {
double timeCounter = 0.0;
for (int i = sequenceNumNow-this.sequenceNumberStart; i <= sequenceNumTo; i++) {
timeCounter += this.getDTs()[i];
}
return timeCounter;
} | [
"public",
"double",
"getTimeToEstimate",
"(",
"int",
"sequenceNumNow",
",",
"int",
"sequenceNumTo",
")",
"{",
"double",
"timeCounter",
"=",
"0.0",
";",
"for",
"(",
"int",
"i",
"=",
"sequenceNumNow",
"-",
"this",
".",
"sequenceNumberStart",
";",
"i",
"<=",
"s... | Get an estimate of the time left to move on this {@link Trajectory}
between two path indices. The estimate is based on this {@link Trajectory}'s
temporal profile.
@param sequenceNumNow The path index from which the estimate should be computed.
@param sequenceNumTo The path index to which the estimate should be computed... | [
"Get",
"an",
"estimate",
"of",
"the",
"time",
"left",
"to",
"move",
"on",
"this",
"{"
] | train | https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/multi/spatioTemporal/paths/Trajectory.java#L258-L264 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/BinaryLogRecordSerializerImpl.java | BinaryLogRecordSerializerImpl.writeString | private static void writeString(String str, DataOutput writer) throws IOException {
"""
/*
Serialize string. Need to take care of <code>null</code> value since
{@link DataOutput#writeUTF(String)} does not handle it.
"""
if (str == null) {
writer.writeInt(0);
} else {
int blocks = str.length() >> 15... | java | private static void writeString(String str, DataOutput writer) throws IOException {
if (str == null) {
writer.writeInt(0);
} else {
int blocks = str.length() >> 15;
writer.writeInt(blocks+1);
int end = 0;
for (int i=0; i<blocks; i++) {
int start = end;
end = (i+1)<<15;
writer.writeUTF(str... | [
"private",
"static",
"void",
"writeString",
"(",
"String",
"str",
",",
"DataOutput",
"writer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"writer",
".",
"writeInt",
"(",
"0",
")",
";",
"}",
"else",
"{",
"int",
"blocks"... | /*
Serialize string. Need to take care of <code>null</code> value since
{@link DataOutput#writeUTF(String)} does not handle it. | [
"/",
"*",
"Serialize",
"string",
".",
"Need",
"to",
"take",
"care",
"of",
"<code",
">",
"null<",
"/",
"code",
">",
"value",
"since",
"{"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/BinaryLogRecordSerializerImpl.java#L599-L613 |
paypal/SeLion | server/src/main/java/com/paypal/selion/utils/SauceLabsRestApi.java | SauceLabsRestApi.isAuthenticated | public synchronized boolean isAuthenticated(String username, String apiKey) {
"""
Determine if the account credentials specified are valid by calling the sauce rest api. Uses a local account
cache for credentials which have already been presented. Cached credentials expire when the cache reaches a size
of {@link... | java | public synchronized boolean isAuthenticated(String username, String apiKey) {
LOGGER.entering();
final String key = username + ":" + apiKey;
final String authKey = new String(Base64.encodeBase64(key.getBytes()));
if (accountCache.containsKey(md5(authKey))) {
final boolean a... | [
"public",
"synchronized",
"boolean",
"isAuthenticated",
"(",
"String",
"username",
",",
"String",
"apiKey",
")",
"{",
"LOGGER",
".",
"entering",
"(",
")",
";",
"final",
"String",
"key",
"=",
"username",
"+",
"\":\"",
"+",
"apiKey",
";",
"final",
"String",
... | Determine if the account credentials specified are valid by calling the sauce rest api. Uses a local account
cache for credentials which have already been presented. Cached credentials expire when the cache reaches a size
of {@link SauceLabsRestApi#MAX_CACHE}
@param username
the user name
@param apiKey
the sauce labs ... | [
"Determine",
"if",
"the",
"account",
"credentials",
"specified",
"are",
"valid",
"by",
"calling",
"the",
"sauce",
"rest",
"api",
".",
"Uses",
"a",
"local",
"account",
"cache",
"for",
"credentials",
"which",
"have",
"already",
"been",
"presented",
".",
"Cached"... | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/utils/SauceLabsRestApi.java#L217-L246 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/database/CursorUtils.java | CursorUtils.getType | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static int getType(Cursor cursor, String columnName) {
"""
Checks the type of the column.
@see android.database.Cursor#getType(int).
@see android.database.Cursor#getColumnIndex(String).
@param cursor the cursor.
@param columnName the column name.
@return th... | java | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static int getType(Cursor cursor, String columnName) {
if (cursor == null) {
return Cursor.FIELD_TYPE_NULL;
}
return cursor.getType(cursor.getColumnIndex(columnName));
} | [
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"HONEYCOMB",
")",
"public",
"static",
"int",
"getType",
"(",
"Cursor",
"cursor",
",",
"String",
"columnName",
")",
"{",
"if",
"(",
"cursor",
"==",
"null",
")",
"{",
"return",
"Cursor",
".",
"FIEL... | Checks the type of the column.
@see android.database.Cursor#getType(int).
@see android.database.Cursor#getColumnIndex(String).
@param cursor the cursor.
@param columnName the column name.
@return the type of the column. | [
"Checks",
"the",
"type",
"of",
"the",
"column",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L176-L183 |
fcrepo4-exts/fcrepo-camel-toolbox | fcrepo-ldpath/src/main/java/org/fcrepo/camel/ldpath/ClientFactory.java | ClientFactory.createClient | public static ClientConfiguration createClient(final AuthScope authScope, final Credentials credentials) {
"""
Configure a linked data client suitable for use with a Fedora Repository.
@param authScope the authentication scope
@param credentials the credentials
@return a configuration for use with an LDClient
... | java | public static ClientConfiguration createClient(final AuthScope authScope, final Credentials credentials) {
return createClient(authScope, credentials, emptyList(), emptyList());
} | [
"public",
"static",
"ClientConfiguration",
"createClient",
"(",
"final",
"AuthScope",
"authScope",
",",
"final",
"Credentials",
"credentials",
")",
"{",
"return",
"createClient",
"(",
"authScope",
",",
"credentials",
",",
"emptyList",
"(",
")",
",",
"emptyList",
"... | Configure a linked data client suitable for use with a Fedora Repository.
@param authScope the authentication scope
@param credentials the credentials
@return a configuration for use with an LDClient | [
"Configure",
"a",
"linked",
"data",
"client",
"suitable",
"for",
"use",
"with",
"a",
"Fedora",
"Repository",
"."
] | train | https://github.com/fcrepo4-exts/fcrepo-camel-toolbox/blob/9e0cf220937b2d5c050e0e071f0cdc4c7a084c0f/fcrepo-ldpath/src/main/java/org/fcrepo/camel/ldpath/ClientFactory.java#L92-L94 |
canoo/dolphin-platform | platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/gc/GarbageCollector.java | GarbageCollector.onRemovedFromList | public synchronized void onRemovedFromList(ObservableList list, Object value) {
"""
This method must be called for each item that is removed to a {@link ObservableList} that is part of a Dolphin bean (see {@link RemotingBean})
@param list the list
@param value the removed item
"""
if (!configurati... | java | public synchronized void onRemovedFromList(ObservableList list, Object value) {
if (!configuration.isUseGc()) {
return;
}
removeReferenceAndCheckForGC(list, value);
} | [
"public",
"synchronized",
"void",
"onRemovedFromList",
"(",
"ObservableList",
"list",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"!",
"configuration",
".",
"isUseGc",
"(",
")",
")",
"{",
"return",
";",
"}",
"removeReferenceAndCheckForGC",
"(",
"list",
",",
... | This method must be called for each item that is removed to a {@link ObservableList} that is part of a Dolphin bean (see {@link RemotingBean})
@param list the list
@param value the removed item | [
"This",
"method",
"must",
"be",
"called",
"for",
"each",
"item",
"that",
"is",
"removed",
"to",
"a",
"{",
"@link",
"ObservableList",
"}",
"that",
"is",
"part",
"of",
"a",
"Dolphin",
"bean",
"(",
"see",
"{",
"@link",
"RemotingBean",
"}",
")"
] | train | https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/gc/GarbageCollector.java#L193-L198 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java | UnicodeSet.applyPattern | public UnicodeSet applyPattern(String pattern, int options) {
"""
Modifies this set to represent the set specified by the given pattern,
optionally ignoring whitespace.
See the class description for the syntax of the pattern language.
@param pattern a string specifying what characters are in the set
@param opt... | java | public UnicodeSet applyPattern(String pattern, int options) {
checkFrozen();
return applyPattern(pattern, null, null, options);
} | [
"public",
"UnicodeSet",
"applyPattern",
"(",
"String",
"pattern",
",",
"int",
"options",
")",
"{",
"checkFrozen",
"(",
")",
";",
"return",
"applyPattern",
"(",
"pattern",
",",
"null",
",",
"null",
",",
"options",
")",
";",
"}"
] | Modifies this set to represent the set specified by the given pattern,
optionally ignoring whitespace.
See the class description for the syntax of the pattern language.
@param pattern a string specifying what characters are in the set
@param options a bitmask indicating which options to apply.
Valid options are IGNORE_... | [
"Modifies",
"this",
"set",
"to",
"represent",
"the",
"set",
"specified",
"by",
"the",
"given",
"pattern",
"optionally",
"ignoring",
"whitespace",
".",
"See",
"the",
"class",
"description",
"for",
"the",
"syntax",
"of",
"the",
"pattern",
"language",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L573-L576 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/alias/simple/CmsAliasErrorColumn.java | CmsAliasErrorColumn.getComparator | public static Comparator<CmsAliasTableRow> getComparator() {
"""
Gets the comparator which should be used for this column.<p>
@return the comparator used for this column
"""
return new Comparator<CmsAliasTableRow>() {
public int compare(CmsAliasTableRow o1, CmsAliasTableRow o2) {
... | java | public static Comparator<CmsAliasTableRow> getComparator() {
return new Comparator<CmsAliasTableRow>() {
public int compare(CmsAliasTableRow o1, CmsAliasTableRow o2) {
String err1 = getValueInternal(o1);
String err2 = getValueInternal(o2);
i... | [
"public",
"static",
"Comparator",
"<",
"CmsAliasTableRow",
">",
"getComparator",
"(",
")",
"{",
"return",
"new",
"Comparator",
"<",
"CmsAliasTableRow",
">",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"CmsAliasTableRow",
"o1",
",",
"CmsAliasTableRow",
"o2",
... | Gets the comparator which should be used for this column.<p>
@return the comparator used for this column | [
"Gets",
"the",
"comparator",
"which",
"should",
"be",
"used",
"for",
"this",
"column",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/alias/simple/CmsAliasErrorColumn.java#L62-L82 |
wigforss/Ka-Commons-Reflection | src/main/java/org/kasource/commons/reflection/util/AnnotationUtils.java | AnnotationUtils.isAnnotationPresent | public static boolean isAnnotationPresent(Class<?> target, Class<? extends Annotation> annotation) {
"""
Returns true if the supplied annotation is present on the target class
or any of its super classes.
@param annotation Annotation to find.
@return true if the supplied annotation is present on the target ... | java | public static boolean isAnnotationPresent(Class<?> target, Class<? extends Annotation> annotation) {
Class<?> clazz = target;
if (clazz.isAnnotationPresent(annotation)) {
return true;
}
while((clazz = clazz.getSuperclass()) != null) {
if (clazz.isAnnotationPresent... | [
"public",
"static",
"boolean",
"isAnnotationPresent",
"(",
"Class",
"<",
"?",
">",
"target",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"target",
";",
"if",
"(",
"clazz",
".",
"is... | Returns true if the supplied annotation is present on the target class
or any of its super classes.
@param annotation Annotation to find.
@return true if the supplied annotation is present on the target class
or any of its super classes. | [
"Returns",
"true",
"if",
"the",
"supplied",
"annotation",
"is",
"present",
"on",
"the",
"target",
"class",
"or",
"any",
"of",
"its",
"super",
"classes",
"."
] | train | https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/AnnotationUtils.java#L24-L35 |
biojava/biojava | biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java | Alignments.getProfileProfileAlignment | static <S extends Sequence<C>, C extends Compound> ProfilePair<S, C> getProfileProfileAlignment(
Profile<S, C> profile1, Profile<S, C> profile2, ProfileProfileAlignerType type, GapPenalty gapPenalty,
SubstitutionMatrix<C> subMatrix) {
"""
Factory method which computes a profile alignment for the given {@link... | java | static <S extends Sequence<C>, C extends Compound> ProfilePair<S, C> getProfileProfileAlignment(
Profile<S, C> profile1, Profile<S, C> profile2, ProfileProfileAlignerType type, GapPenalty gapPenalty,
SubstitutionMatrix<C> subMatrix) {
return getProfileProfileAligner(profile1, profile2, type, gapPenalty, subMatr... | [
"static",
"<",
"S",
"extends",
"Sequence",
"<",
"C",
">",
",",
"C",
"extends",
"Compound",
">",
"ProfilePair",
"<",
"S",
",",
"C",
">",
"getProfileProfileAlignment",
"(",
"Profile",
"<",
"S",
",",
"C",
">",
"profile1",
",",
"Profile",
"<",
"S",
",",
... | Factory method which computes a profile alignment for the given {@link Profile} pair.
@param <S> each {@link Sequence} of the {@link Profile} pair is of type S
@param <C> each element of an {@link AlignedSequence} is a {@link Compound} of type C
@param profile1 the first {@link Profile} to align
@param profile2 the se... | [
"Factory",
"method",
"which",
"computes",
"a",
"profile",
"alignment",
"for",
"the",
"given",
"{",
"@link",
"Profile",
"}",
"pair",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java#L530-L534 |
hgoebl/DavidWebb | src/main/java/com/goebl/david/WebbUtils.java | WebbUtils.queryString | public static String queryString(Map<String, Object> values) {
"""
Convert a Map to a query string.
@param values the map with the values
<code>null</code> will be encoded as empty string, all other objects are converted to
String by calling its <code>toString()</code> method.
@return e.g. "key1=value&key2... | java | public static String queryString(Map<String, Object> values) {
StringBuilder sbuf = new StringBuilder();
String separator = "";
for (Map.Entry<String, Object> entry : values.entrySet()) {
Object entryValue = entry.getValue();
if (entryValue instanceof Object[]) {
... | [
"public",
"static",
"String",
"queryString",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"values",
")",
"{",
"StringBuilder",
"sbuf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"separator",
"=",
"\"\"",
";",
"for",
"(",
"Map",
".",
"Entry",... | Convert a Map to a query string.
@param values the map with the values
<code>null</code> will be encoded as empty string, all other objects are converted to
String by calling its <code>toString()</code> method.
@return e.g. "key1=value&key2=&email=max%40example.com" | [
"Convert",
"a",
"Map",
"to",
"a",
"query",
"string",
"."
] | train | https://github.com/hgoebl/DavidWebb/blob/4f1532fbc3d817886d38de24eacc02b44b910b42/src/main/java/com/goebl/david/WebbUtils.java#L43-L66 |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java | TarHeader.getFileNameBytes | public static int getFileNameBytes(String newName, byte[] outbuf) throws InvalidHeaderException {
"""
This method, like getNameBytes(), is intended to place a name into a TarHeader's buffer. However, this method is
sophisticated enough to recognize long names (name.length() > NAMELEN). In these cases, the method ... | java | public static int getFileNameBytes(String newName, byte[] outbuf) throws InvalidHeaderException {
if (newName.length() > 100) {
// Locate a pathname "break" prior to the maximum name length...
int index = newName.indexOf("/", newName.length() - 100);
if (index == -1) {
... | [
"public",
"static",
"int",
"getFileNameBytes",
"(",
"String",
"newName",
",",
"byte",
"[",
"]",
"outbuf",
")",
"throws",
"InvalidHeaderException",
"{",
"if",
"(",
"newName",
".",
"length",
"(",
")",
">",
"100",
")",
"{",
"// Locate a pathname \"break\" prior to ... | This method, like getNameBytes(), is intended to place a name into a TarHeader's buffer. However, this method is
sophisticated enough to recognize long names (name.length() > NAMELEN). In these cases, the method will break the
name into a prefix and suffix and place the name in the header in 'ustar' format. It is up to... | [
"This",
"method",
"like",
"getNameBytes",
"()",
"is",
"intended",
"to",
"place",
"a",
"name",
"into",
"a",
"TarHeader",
"s",
"buffer",
".",
"However",
"this",
"method",
"is",
"sophisticated",
"enough",
"to",
"recognize",
"long",
"names",
"(",
"name",
".",
... | train | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java#L359-L387 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/RowColumnOps.java | RowColumnOps.divCol | public static void divCol(Matrix A, int j, double c) {
"""
Updates the values of column <tt>j</tt> in the given matrix to be A[:,j] = A[:,j]/c
@param A the matrix to perform he update on
@param j the row to update
@param c the constant to divide each element by
"""
divCol(A, j, 0, A.rows(), c);
... | java | public static void divCol(Matrix A, int j, double c)
{
divCol(A, j, 0, A.rows(), c);
} | [
"public",
"static",
"void",
"divCol",
"(",
"Matrix",
"A",
",",
"int",
"j",
",",
"double",
"c",
")",
"{",
"divCol",
"(",
"A",
",",
"j",
",",
"0",
",",
"A",
".",
"rows",
"(",
")",
",",
"c",
")",
";",
"}"
] | Updates the values of column <tt>j</tt> in the given matrix to be A[:,j] = A[:,j]/c
@param A the matrix to perform he update on
@param j the row to update
@param c the constant to divide each element by | [
"Updates",
"the",
"values",
"of",
"column",
"<tt",
">",
"j<",
"/",
"tt",
">",
"in",
"the",
"given",
"matrix",
"to",
"be",
"A",
"[",
":",
"j",
"]",
"=",
"A",
"[",
":",
"j",
"]",
"/",
"c"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/RowColumnOps.java#L244-L247 |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/Vertigo.java | Vertigo.deployNetwork | public Vertigo deployNetwork(String cluster, final String name, final Handler<AsyncResult<ActiveNetwork>> doneHandler) {
"""
Deploys a bare network to a specific cluster.<p>
The network will be deployed with no components and no connections. You
can add components and connections to the network with an {@link ... | java | public Vertigo deployNetwork(String cluster, final String name, final Handler<AsyncResult<ActiveNetwork>> doneHandler) {
getCluster(cluster, new Handler<AsyncResult<Cluster>>() {
@Override
public void handle(AsyncResult<Cluster> result) {
if (result.failed()) {
new DefaultFutureResult<... | [
"public",
"Vertigo",
"deployNetwork",
"(",
"String",
"cluster",
",",
"final",
"String",
"name",
",",
"final",
"Handler",
"<",
"AsyncResult",
"<",
"ActiveNetwork",
">",
">",
"doneHandler",
")",
"{",
"getCluster",
"(",
"cluster",
",",
"new",
"Handler",
"<",
"A... | Deploys a bare network to a specific cluster.<p>
The network will be deployed with no components and no connections. You
can add components and connections to the network with an {@link ActiveNetwork}
instance.
@param cluster The cluster to which to deploy the network.
@param name The name of the network to deploy.
@... | [
"Deploys",
"a",
"bare",
"network",
"to",
"a",
"specific",
"cluster",
".",
"<p",
">"
] | train | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/Vertigo.java#L474-L486 |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/collections/CollectionUtils.java | CollectionUtils.toStringLimited | public static String toStringLimited(ImmutableSet<?> items, int limit) {
"""
Acts like {@code items.toString()} unless {@code items} has more elements than {@code limit},
in which case it simply prints the number of excess items. This is useful for making toStrings
for objects which may contain large collections... | java | public static String toStringLimited(ImmutableSet<?> items, int limit) {
if (items.size() <= limit) {
return items.toString();
} else {
return items.asList().subList(0, limit).toString() + "... (" + (items.size() - limit) + " more)";
}
} | [
"public",
"static",
"String",
"toStringLimited",
"(",
"ImmutableSet",
"<",
"?",
">",
"items",
",",
"int",
"limit",
")",
"{",
"if",
"(",
"items",
".",
"size",
"(",
")",
"<=",
"limit",
")",
"{",
"return",
"items",
".",
"toString",
"(",
")",
";",
"}",
... | Acts like {@code items.toString()} unless {@code items} has more elements than {@code limit},
in which case it simply prints the number of excess items. This is useful for making toStrings
for objects which may contain large collections. | [
"Acts",
"like",
"{"
] | train | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/collections/CollectionUtils.java#L428-L434 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/ExecutionChain.java | ExecutionChain.runOnUIThread | public <T, U> ExecutionChain runOnUIThread(Task<T, U> task) {
"""
Add a {@link Task} to be run on Android's
{@link Activity#runOnUiThread(Runnable) UI thread}. It will be run after
all Tasks added prior to this call.
@param task
{@code Task} to run
@return Reference to the {@code ExecutionChain}.
@throws I... | java | public <T, U> ExecutionChain runOnUIThread(Task<T, U> task) {
runOnThread(Context.Type.UI, task);
return this;
} | [
"public",
"<",
"T",
",",
"U",
">",
"ExecutionChain",
"runOnUIThread",
"(",
"Task",
"<",
"T",
",",
"U",
">",
"task",
")",
"{",
"runOnThread",
"(",
"Context",
".",
"Type",
".",
"UI",
",",
"task",
")",
";",
"return",
"this",
";",
"}"
] | Add a {@link Task} to be run on Android's
{@link Activity#runOnUiThread(Runnable) UI thread}. It will be run after
all Tasks added prior to this call.
@param task
{@code Task} to run
@return Reference to the {@code ExecutionChain}.
@throws IllegalStateException
if the chain of execution has already been {@link #execut... | [
"Add",
"a",
"{",
"@link",
"Task",
"}",
"to",
"be",
"run",
"on",
"Android",
"s",
"{",
"@link",
"Activity#runOnUiThread",
"(",
"Runnable",
")",
"UI",
"thread",
"}",
".",
"It",
"will",
"be",
"run",
"after",
"all",
"Tasks",
"added",
"prior",
"to",
"this",
... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/ExecutionChain.java#L251-L254 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringParser.java | StringParser.parseBoolObj | @Nullable
public static Boolean parseBoolObj (@Nullable final Object aObject, @Nullable final Boolean aDefault) {
"""
Try to interpret the passed {@link Object} as {@link Boolean}.
@param aObject
The object to be interpreted. May be <code>null</code>.
@param aDefault
The default value to be returned, if th... | java | @Nullable
public static Boolean parseBoolObj (@Nullable final Object aObject, @Nullable final Boolean aDefault)
{
return aObject == null ? aDefault : parseBoolObj (aObject.toString ());
} | [
"@",
"Nullable",
"public",
"static",
"Boolean",
"parseBoolObj",
"(",
"@",
"Nullable",
"final",
"Object",
"aObject",
",",
"@",
"Nullable",
"final",
"Boolean",
"aDefault",
")",
"{",
"return",
"aObject",
"==",
"null",
"?",
"aDefault",
":",
"parseBoolObj",
"(",
... | Try to interpret the passed {@link Object} as {@link Boolean}.
@param aObject
The object to be interpreted. May be <code>null</code>.
@param aDefault
The default value to be returned, if the passed object is
<code>null</code>.
@return The passed default value if the passed object is <code>null</code>,
the matching {@l... | [
"Try",
"to",
"interpret",
"the",
"passed",
"{",
"@link",
"Object",
"}",
"as",
"{",
"@link",
"Boolean",
"}",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L176-L180 |
apereo/cas | core/cas-server-core-services-api/src/main/java/org/apereo/cas/authentication/principal/ShibbolethCompatiblePersistentIdGenerator.java | ShibbolethCompatiblePersistentIdGenerator.prepareMessageDigest | protected static MessageDigest prepareMessageDigest(final String principal, final String service) throws NoSuchAlgorithmException {
"""
Prepare message digest message digest.
@param principal the principal
@param service the service
@return the message digest
@throws NoSuchAlgorithmException the no such al... | java | protected static MessageDigest prepareMessageDigest(final String principal, final String service) throws NoSuchAlgorithmException {
val md = MessageDigest.getInstance("SHA");
if (StringUtils.isNotBlank(service)) {
md.update(service.getBytes(StandardCharsets.UTF_8));
md.update(CON... | [
"protected",
"static",
"MessageDigest",
"prepareMessageDigest",
"(",
"final",
"String",
"principal",
",",
"final",
"String",
"service",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"val",
"md",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"SHA\"",
")",
";",
... | Prepare message digest message digest.
@param principal the principal
@param service the service
@return the message digest
@throws NoSuchAlgorithmException the no such algorithm exception | [
"Prepare",
"message",
"digest",
"message",
"digest",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-api/src/main/java/org/apereo/cas/authentication/principal/ShibbolethCompatiblePersistentIdGenerator.java#L126-L135 |
apache/incubator-druid | processing/src/main/java/org/apache/druid/query/groupby/orderby/DefaultLimitSpec.java | DefaultLimitSpec.sortingOrderHasNonGroupingFields | public static boolean sortingOrderHasNonGroupingFields(DefaultLimitSpec limitSpec, List<DimensionSpec> dimensions) {
"""
Check if a limitSpec has columns in the sorting order that are not part of the grouping fields represented
by `dimensions`.
@param limitSpec LimitSpec, assumed to be non-null
@param dimensi... | java | public static boolean sortingOrderHasNonGroupingFields(DefaultLimitSpec limitSpec, List<DimensionSpec> dimensions)
{
for (OrderByColumnSpec orderSpec : limitSpec.getColumns()) {
int dimIndex = OrderByColumnSpec.getDimIndexForOrderBy(orderSpec, dimensions);
if (dimIndex < 0) {
return true;
... | [
"public",
"static",
"boolean",
"sortingOrderHasNonGroupingFields",
"(",
"DefaultLimitSpec",
"limitSpec",
",",
"List",
"<",
"DimensionSpec",
">",
"dimensions",
")",
"{",
"for",
"(",
"OrderByColumnSpec",
"orderSpec",
":",
"limitSpec",
".",
"getColumns",
"(",
")",
")",... | Check if a limitSpec has columns in the sorting order that are not part of the grouping fields represented
by `dimensions`.
@param limitSpec LimitSpec, assumed to be non-null
@param dimensions Grouping fields for a groupBy query
@return True if limitSpec has sorting columns not contained in dimensions | [
"Check",
"if",
"a",
"limitSpec",
"has",
"columns",
"in",
"the",
"sorting",
"order",
"that",
"are",
"not",
"part",
"of",
"the",
"grouping",
"fields",
"represented",
"by",
"dimensions",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/orderby/DefaultLimitSpec.java#L71-L80 |
CenturyLinkCloud/mdw | mdw-services/src/com/centurylink/mdw/service/rest/Rules.java | Rules.get | @Override
public JSONObject get(String path, Map<String,String> headers)
throws ServiceException, JSONException {
"""
Apply rules designated in asset path against incoming request parameters.
"""
Asset rules = getRulesAsset(path);
Operand input = new Operand();
input.se... | java | @Override
public JSONObject get(String path, Map<String,String> headers)
throws ServiceException, JSONException {
Asset rules = getRulesAsset(path);
Operand input = new Operand();
input.setContext(getContext(path));
Query query = getQuery(path, headers);
input.se... | [
"@",
"Override",
"public",
"JSONObject",
"get",
"(",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
")",
"throws",
"ServiceException",
",",
"JSONException",
"{",
"Asset",
"rules",
"=",
"getRulesAsset",
"(",
"path",
")",
";",
"O... | Apply rules designated in asset path against incoming request parameters. | [
"Apply",
"rules",
"designated",
"in",
"asset",
"path",
"against",
"incoming",
"request",
"parameters",
"."
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/service/rest/Rules.java#L66-L87 |
glyptodon/guacamole-client | extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ObjectQueryService.java | ObjectQueryService.getIdentifier | public String getIdentifier(LDAPEntry entry, Collection<String> attributes) {
"""
Returns the identifier of the object represented by the given LDAP
entry. Multiple attributes may be declared as containing the identifier
of the object when present on an LDAP entry. If multiple such attributes
are present on the... | java | public String getIdentifier(LDAPEntry entry, Collection<String> attributes) {
// Retrieve the first value of the highest priority identifier attribute
for (String identifierAttribute : attributes) {
LDAPAttribute identifier = entry.getAttribute(identifierAttribute);
if (identifi... | [
"public",
"String",
"getIdentifier",
"(",
"LDAPEntry",
"entry",
",",
"Collection",
"<",
"String",
">",
"attributes",
")",
"{",
"// Retrieve the first value of the highest priority identifier attribute",
"for",
"(",
"String",
"identifierAttribute",
":",
"attributes",
")",
... | Returns the identifier of the object represented by the given LDAP
entry. Multiple attributes may be declared as containing the identifier
of the object when present on an LDAP entry. If multiple such attributes
are present on the same LDAP entry, the value of the attribute with
highest priority is used. If multiple co... | [
"Returns",
"the",
"identifier",
"of",
"the",
"object",
"represented",
"by",
"the",
"given",
"LDAP",
"entry",
".",
"Multiple",
"attributes",
"may",
"be",
"declared",
"as",
"containing",
"the",
"identifier",
"of",
"the",
"object",
"when",
"present",
"on",
"an",
... | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ObjectQueryService.java#L90-L102 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJobTracker.java | CoronaJobTracker.processBadResource | public void processBadResource(int grant, boolean abandonHost) {
"""
Return this grant and request a different one.
This can happen because the task has failed, was killed
or the job tracker decided that the resource is bad
@param grant The grant identifier.
@param abandonHost - if true then this host will b... | java | public void processBadResource(int grant, boolean abandonHost) {
synchronized (lockObject) {
Set<String> excludedHosts = null;
TaskInProgress tip = requestToTipMap.get(grant);
if (!job.canLaunchJobCleanupTask() &&
(!tip.isRunnable() ||
(tip.isRunning() &&
!(specul... | [
"public",
"void",
"processBadResource",
"(",
"int",
"grant",
",",
"boolean",
"abandonHost",
")",
"{",
"synchronized",
"(",
"lockObject",
")",
"{",
"Set",
"<",
"String",
">",
"excludedHosts",
"=",
"null",
";",
"TaskInProgress",
"tip",
"=",
"requestToTipMap",
".... | Return this grant and request a different one.
This can happen because the task has failed, was killed
or the job tracker decided that the resource is bad
@param grant The grant identifier.
@param abandonHost - if true then this host will be excluded
from the list of possibilities for this request | [
"Return",
"this",
"grant",
"and",
"request",
"a",
"different",
"one",
".",
"This",
"can",
"happen",
"because",
"the",
"task",
"has",
"failed",
"was",
"killed",
"or",
"the",
"job",
"tracker",
"decided",
"that",
"the",
"resource",
"is",
"bad"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJobTracker.java#L1599-L1632 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java | LabAccountsInner.getByResourceGroupAsync | public Observable<LabAccountInner> getByResourceGroupAsync(String resourceGroupName, String labAccountName, String expand) {
"""
Get lab account.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param expand Specify the $expand query. Example: 'prope... | java | public Observable<LabAccountInner> getByResourceGroupAsync(String resourceGroupName, String labAccountName, String expand) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, labAccountName, expand).map(new Func1<ServiceResponse<LabAccountInner>, LabAccountInner>() {
@Override
... | [
"public",
"Observable",
"<",
"LabAccountInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"String",
"expand",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"... | Get lab account.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param expand Specify the $expand query. Example: 'properties($expand=sizeConfiguration)'
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ... | [
"Get",
"lab",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java#L713-L720 |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java | DocumentSubscriptions.getSubscriptionWorker | public <T> SubscriptionWorker<T> getSubscriptionWorker(Class<T> clazz, String subscriptionName, String database) {
"""
It opens a subscription and starts pulling documents since a last processed document for that subscription.
The connection options determine client and server cooperation rules like document batc... | java | public <T> SubscriptionWorker<T> getSubscriptionWorker(Class<T> clazz, String subscriptionName, String database) {
return getSubscriptionWorker(clazz, new SubscriptionWorkerOptions(subscriptionName), database);
} | [
"public",
"<",
"T",
">",
"SubscriptionWorker",
"<",
"T",
">",
"getSubscriptionWorker",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"subscriptionName",
",",
"String",
"database",
")",
"{",
"return",
"getSubscriptionWorker",
"(",
"clazz",
",",
"new",
... | It opens a subscription and starts pulling documents since a last processed document for that subscription.
The connection options determine client and server cooperation rules like document batch sizes or a timeout in a matter of which a client
needs to acknowledge that batch has been processed. The acknowledgment is ... | [
"It",
"opens",
"a",
"subscription",
"and",
"starts",
"pulling",
"documents",
"since",
"a",
"last",
"processed",
"document",
"for",
"that",
"subscription",
".",
"The",
"connection",
"options",
"determine",
"client",
"and",
"server",
"cooperation",
"rules",
"like",
... | train | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java#L266-L268 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/util/LayoutUtils.java | LayoutUtils.getJRDesignGroup | public static JRDesignGroup getJRDesignGroup(DynamicJasperDesign jd, LayoutManager layoutManager, DJGroup group) {
"""
Returns the JRDesignGroup for the DJGroup passed
@param jd
@param layoutManager
@param group
@return
"""
Map references = layoutManager.getReferencesMap();
for (Object o : references.k... | java | public static JRDesignGroup getJRDesignGroup(DynamicJasperDesign jd, LayoutManager layoutManager, DJGroup group) {
Map references = layoutManager.getReferencesMap();
for (Object o : references.keySet()) {
String groupName = (String) o;
DJGroup djGroup = (DJGroup) references.get(groupName);
if (group == djG... | [
"public",
"static",
"JRDesignGroup",
"getJRDesignGroup",
"(",
"DynamicJasperDesign",
"jd",
",",
"LayoutManager",
"layoutManager",
",",
"DJGroup",
"group",
")",
"{",
"Map",
"references",
"=",
"layoutManager",
".",
"getReferencesMap",
"(",
")",
";",
"for",
"(",
"Obj... | Returns the JRDesignGroup for the DJGroup passed
@param jd
@param layoutManager
@param group
@return | [
"Returns",
"the",
"JRDesignGroup",
"for",
"the",
"DJGroup",
"passed"
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/util/LayoutUtils.java#L122-L132 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/media/impl/ImageFileServlet.java | ImageFileServlet.getImageFileName | public static String getImageFileName(String originalFilename) {
"""
Get image filename to be used for the URL with file extension matching the image format which is produced by this
servlet.
@param originalFilename Original filename of the image to render.
@return Filename to be used for URL.
"""
Strin... | java | public static String getImageFileName(String originalFilename) {
String namePart = StringUtils.substringBeforeLast(originalFilename, ".");
String extensionPart = StringUtils.substringAfterLast(originalFilename, ".");
// use PNG format if original image is PNG, otherwise always use JPEG
if (StringUtils.... | [
"public",
"static",
"String",
"getImageFileName",
"(",
"String",
"originalFilename",
")",
"{",
"String",
"namePart",
"=",
"StringUtils",
".",
"substringBeforeLast",
"(",
"originalFilename",
",",
"\".\"",
")",
";",
"String",
"extensionPart",
"=",
"StringUtils",
".",
... | Get image filename to be used for the URL with file extension matching the image format which is produced by this
servlet.
@param originalFilename Original filename of the image to render.
@return Filename to be used for URL. | [
"Get",
"image",
"filename",
"to",
"be",
"used",
"for",
"the",
"URL",
"with",
"file",
"extension",
"matching",
"the",
"image",
"format",
"which",
"is",
"produced",
"by",
"this",
"servlet",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/impl/ImageFileServlet.java#L155-L167 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/QueryParameterValue.java | QueryParameterValue.of | public static <T> QueryParameterValue of(T value, StandardSQLTypeName type) {
"""
Creates a {@code QueryParameterValue} object with the given value and type.
"""
return QueryParameterValue.newBuilder()
.setValue(valueToStringOrNull(value, type))
.setType(type)
.build();
} | java | public static <T> QueryParameterValue of(T value, StandardSQLTypeName type) {
return QueryParameterValue.newBuilder()
.setValue(valueToStringOrNull(value, type))
.setType(type)
.build();
} | [
"public",
"static",
"<",
"T",
">",
"QueryParameterValue",
"of",
"(",
"T",
"value",
",",
"StandardSQLTypeName",
"type",
")",
"{",
"return",
"QueryParameterValue",
".",
"newBuilder",
"(",
")",
".",
"setValue",
"(",
"valueToStringOrNull",
"(",
"value",
",",
"type... | Creates a {@code QueryParameterValue} object with the given value and type. | [
"Creates",
"a",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/QueryParameterValue.java#L169-L174 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Matth.java | Matth.addExact | public static int addExact(int a, int b) {
"""
Returns the sum of {@code a} and {@code b}, provided it does not overflow.
@throws ArithmeticException if {@code a + b} overflows in signed {@code int} arithmetic
"""
long result = (long) a + b;
checkNoOverflow(result == (int) result);
... | java | public static int addExact(int a, int b) {
long result = (long) a + b;
checkNoOverflow(result == (int) result);
return (int) result;
} | [
"public",
"static",
"int",
"addExact",
"(",
"int",
"a",
",",
"int",
"b",
")",
"{",
"long",
"result",
"=",
"(",
"long",
")",
"a",
"+",
"b",
";",
"checkNoOverflow",
"(",
"result",
"==",
"(",
"int",
")",
"result",
")",
";",
"return",
"(",
"int",
")"... | Returns the sum of {@code a} and {@code b}, provided it does not overflow.
@throws ArithmeticException if {@code a + b} overflows in signed {@code int} arithmetic | [
"Returns",
"the",
"sum",
"of",
"{",
"@code",
"a",
"}",
"and",
"{",
"@code",
"b",
"}",
"provided",
"it",
"does",
"not",
"overflow",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Matth.java#L1371-L1375 |
git-commit-id/maven-git-commit-id-plugin | src/main/java/pl/project13/maven/git/GitCommitIdMojo.java | GitCommitIdMojo.handlePluginFailure | private void handlePluginFailure(Exception e) throws GitCommitIdExecutionException {
"""
Reacts to an exception based on the {@code failOnUnableToExtractRepoInfo} setting.
If it's true, an GitCommitIdExecutionException will be thrown, otherwise we just log an error message.
@throws GitCommitIdExecutionExceptio... | java | private void handlePluginFailure(Exception e) throws GitCommitIdExecutionException {
if (failOnUnableToExtractRepoInfo) {
throw new GitCommitIdExecutionException("Could not complete Mojo execution...", e);
} else {
log.error(e.getMessage(), e);
}
} | [
"private",
"void",
"handlePluginFailure",
"(",
"Exception",
"e",
")",
"throws",
"GitCommitIdExecutionException",
"{",
"if",
"(",
"failOnUnableToExtractRepoInfo",
")",
"{",
"throw",
"new",
"GitCommitIdExecutionException",
"(",
"\"Could not complete Mojo execution...\"",
",",
... | Reacts to an exception based on the {@code failOnUnableToExtractRepoInfo} setting.
If it's true, an GitCommitIdExecutionException will be thrown, otherwise we just log an error message.
@throws GitCommitIdExecutionException which will be thrown in case the
{@code failOnUnableToExtractRepoInfo} setting was set to true. | [
"Reacts",
"to",
"an",
"exception",
"based",
"on",
"the",
"{",
"@code",
"failOnUnableToExtractRepoInfo",
"}",
"setting",
".",
"If",
"it",
"s",
"true",
"an",
"GitCommitIdExecutionException",
"will",
"be",
"thrown",
"otherwise",
"we",
"just",
"log",
"an",
"error",
... | train | https://github.com/git-commit-id/maven-git-commit-id-plugin/blob/a276551fb043d1b7fc4c890603f6ea0c79dc729a/src/main/java/pl/project13/maven/git/GitCommitIdMojo.java#L480-L486 |
skyscreamer/JSONassert | src/main/java/org/skyscreamer/jsonassert/JSONAssert.java | JSONAssert.assertNotEquals | public static void assertNotEquals(JSONArray expected, JSONArray actual, JSONCompareMode compareMode)
throws JSONException {
"""
Asserts that the JSONArray provided does not match the expected JSONArray. If it is it throws an
{@link AssertionError}.
@param expected Expected JSONArray
@param actua... | java | public static void assertNotEquals(JSONArray expected, JSONArray actual, JSONCompareMode compareMode)
throws JSONException {
assertNotEquals("", expected, actual, compareMode);
} | [
"public",
"static",
"void",
"assertNotEquals",
"(",
"JSONArray",
"expected",
",",
"JSONArray",
"actual",
",",
"JSONCompareMode",
"compareMode",
")",
"throws",
"JSONException",
"{",
"assertNotEquals",
"(",
"\"\"",
",",
"expected",
",",
"actual",
",",
"compareMode",
... | Asserts that the JSONArray provided does not match the expected JSONArray. If it is it throws an
{@link AssertionError}.
@param expected Expected JSONArray
@param actual JSONArray to compare
@param compareMode Specifies which comparison mode to use
@throws JSONException JSON parsing error | [
"Asserts",
"that",
"the",
"JSONArray",
"provided",
"does",
"not",
"match",
"the",
"expected",
"JSONArray",
".",
"If",
"it",
"is",
"it",
"throws",
"an",
"{",
"@link",
"AssertionError",
"}",
"."
] | train | https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONAssert.java#L739-L742 |
codelibs/fess | src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java | FessMessages.addErrorsFailedToReadRequestFile | public FessMessages addErrorsFailedToReadRequestFile(String property, String arg0) {
"""
Add the created action message for the key 'errors.failed_to_read_request_file' with parameters.
<pre>
message: Failed to read request file: {0}
</pre>
@param property The property name for the message. (NotNull)
@param a... | java | public FessMessages addErrorsFailedToReadRequestFile(String property, String arg0) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_failed_to_read_request_file, arg0));
return this;
} | [
"public",
"FessMessages",
"addErrorsFailedToReadRequestFile",
"(",
"String",
"property",
",",
"String",
"arg0",
")",
"{",
"assertPropertyNotNull",
"(",
"property",
")",
";",
"add",
"(",
"property",
",",
"new",
"UserMessage",
"(",
"ERRORS_failed_to_read_request_file",
... | Add the created action message for the key 'errors.failed_to_read_request_file' with parameters.
<pre>
message: Failed to read request file: {0}
</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_read_request_file",
"with",
"parameters",
".",
"<pre",
">",
"message",
":",
"Failed",
"to",
"read",
"request",
"file",
":",
"{",
"0",
"}",
"<",
"/",
"pre",
">"
] | train | https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L1950-L1954 |
Netflix/astyanax | astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java | ShardedDistributedMessageQueue.getShardKey | private String getShardKey(long messageTime, int modShard) {
"""
Return the shard for this timestamp
@param messageTime
@param modShard
@return
"""
long timePartition;
if (metadata.getPartitionDuration() != null)
timePartition = (messageTime / metadata.getPartitionDuration()) % m... | java | private String getShardKey(long messageTime, int modShard) {
long timePartition;
if (metadata.getPartitionDuration() != null)
timePartition = (messageTime / metadata.getPartitionDuration()) % metadata.getPartitionCount();
else
timePartition = 0;
return getName() +... | [
"private",
"String",
"getShardKey",
"(",
"long",
"messageTime",
",",
"int",
"modShard",
")",
"{",
"long",
"timePartition",
";",
"if",
"(",
"metadata",
".",
"getPartitionDuration",
"(",
")",
"!=",
"null",
")",
"timePartition",
"=",
"(",
"messageTime",
"/",
"m... | Return the shard for this timestamp
@param messageTime
@param modShard
@return | [
"Return",
"the",
"shard",
"for",
"this",
"timestamp"
] | train | https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java#L430-L437 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.java | ConnectionFactory.createTables | private void createTables(Connection conn) throws DatabaseException {
"""
Creates the database structure (tables and indexes) to store the CVE
data.
@param conn the database connection
@throws DatabaseException thrown if there is a Database Exception
"""
LOGGER.debug("Creating database structure")... | java | private void createTables(Connection conn) throws DatabaseException {
LOGGER.debug("Creating database structure");
try (InputStream is = FileUtils.getResourceAsStream(DB_STRUCTURE_RESOURCE)) {
final String dbStructure = IOUtils.toString(is, StandardCharsets.UTF_8);
Statement st... | [
"private",
"void",
"createTables",
"(",
"Connection",
"conn",
")",
"throws",
"DatabaseException",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Creating database structure\"",
")",
";",
"try",
"(",
"InputStream",
"is",
"=",
"FileUtils",
".",
"getResourceAsStream",
"(",
"DB... | Creates the database structure (tables and indexes) to store the CVE
data.
@param conn the database connection
@throws DatabaseException thrown if there is a Database Exception | [
"Creates",
"the",
"database",
"structure",
"(",
"tables",
"and",
"indexes",
")",
"to",
"store",
"the",
"CVE",
"data",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.java#L317-L336 |
rythmengine/rythmengine | src/main/java/org/rythmengine/template/TemplateBase.java | TemplateBase.__invokeTag | protected void __invokeTag(int line, String name, ITag.__ParameterList params) {
"""
Invoke a tag. Usually should not used directly in user template
@param line
@param name
@param params
"""
__engine.invokeTemplate(line, name, this, params, null, null);
} | java | protected void __invokeTag(int line, String name, ITag.__ParameterList params) {
__engine.invokeTemplate(line, name, this, params, null, null);
} | [
"protected",
"void",
"__invokeTag",
"(",
"int",
"line",
",",
"String",
"name",
",",
"ITag",
".",
"__ParameterList",
"params",
")",
"{",
"__engine",
".",
"invokeTemplate",
"(",
"line",
",",
"name",
",",
"this",
",",
"params",
",",
"null",
",",
"null",
")"... | Invoke a tag. Usually should not used directly in user template
@param line
@param name
@param params | [
"Invoke",
"a",
"tag",
".",
"Usually",
"should",
"not",
"used",
"directly",
"in",
"user",
"template"
] | train | https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/template/TemplateBase.java#L177-L179 |
zaproxy/zaproxy | src/org/parosproxy/paros/network/GenericMethod.java | GenericMethod.addParameter | public void addParameter(String paramName, String paramValue)
throws IllegalArgumentException {
"""
Adds a new parameter to be used in the POST request body.
@param paramName The parameter name to add.
@param paramValue The parameter value to add.
@throws IllegalArgumentException if either argument is... | java | public void addParameter(String paramName, String paramValue)
throws IllegalArgumentException {
log.trace("enter PostMethod.addParameter(String, String)");
if ((paramName == null) || (paramValue == null)) {
throw new IllegalArgumentException(
"Arguments to addPara... | [
"public",
"void",
"addParameter",
"(",
"String",
"paramName",
",",
"String",
"paramValue",
")",
"throws",
"IllegalArgumentException",
"{",
"log",
".",
"trace",
"(",
"\"enter PostMethod.addParameter(String, String)\"",
")",
";",
"if",
"(",
"(",
"paramName",
"==",
"nu... | Adds a new parameter to be used in the POST request body.
@param paramName The parameter name to add.
@param paramValue The parameter value to add.
@throws IllegalArgumentException if either argument is null
@since 1.0 | [
"Adds",
"a",
"new",
"parameter",
"to",
"be",
"used",
"in",
"the",
"POST",
"request",
"body",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/network/GenericMethod.java#L224-L234 |
sinetja/sinetja | src/main/java/sinetja/Response.java | Response.respondJsonPText | public ChannelFuture respondJsonPText(Object text, String function) throws Exception {
"""
Wraps the text with the given JavaScript function name, and responds.
<p>
Content-Type header is set to "application/javascript".
"""
return respondJs(function + "(" + text + ");\r\n");
} | java | public ChannelFuture respondJsonPText(Object text, String function) throws Exception {
return respondJs(function + "(" + text + ");\r\n");
} | [
"public",
"ChannelFuture",
"respondJsonPText",
"(",
"Object",
"text",
",",
"String",
"function",
")",
"throws",
"Exception",
"{",
"return",
"respondJs",
"(",
"function",
"+",
"\"(\"",
"+",
"text",
"+",
"\");\\r\\n\"",
")",
";",
"}"
] | Wraps the text with the given JavaScript function name, and responds.
<p>
Content-Type header is set to "application/javascript". | [
"Wraps",
"the",
"text",
"with",
"the",
"given",
"JavaScript",
"function",
"name",
"and",
"responds",
".",
"<p",
">",
"Content",
"-",
"Type",
"header",
"is",
"set",
"to",
"application",
"/",
"javascript",
"."
] | train | https://github.com/sinetja/sinetja/blob/eec94dba55ec28263e3503fcdb33532282134775/src/main/java/sinetja/Response.java#L223-L225 |
lightbend/config | config/src/main/java/com/typesafe/config/parser/ConfigDocumentFactory.java | ConfigDocumentFactory.parseReader | public static ConfigDocument parseReader(Reader reader, ConfigParseOptions options) {
"""
Parses a Reader into a ConfigDocument instance.
@param reader
the reader to parse
@param options
parse options to control how the reader is interpreted
@return the parsed configuration
@throws com.typesafe.config.Conf... | java | public static ConfigDocument parseReader(Reader reader, ConfigParseOptions options) {
return Parseable.newReader(reader, options).parseConfigDocument();
} | [
"public",
"static",
"ConfigDocument",
"parseReader",
"(",
"Reader",
"reader",
",",
"ConfigParseOptions",
"options",
")",
"{",
"return",
"Parseable",
".",
"newReader",
"(",
"reader",
",",
"options",
")",
".",
"parseConfigDocument",
"(",
")",
";",
"}"
] | Parses a Reader into a ConfigDocument instance.
@param reader
the reader to parse
@param options
parse options to control how the reader is interpreted
@return the parsed configuration
@throws com.typesafe.config.ConfigException on IO or parse errors | [
"Parses",
"a",
"Reader",
"into",
"a",
"ConfigDocument",
"instance",
"."
] | train | https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/parser/ConfigDocumentFactory.java#L26-L28 |
apiman/apiman | manager/api/beans/src/main/java/io/apiman/manager/api/beans/audit/data/EntityUpdatedData.java | EntityUpdatedData.addChange | public void addChange(String name, Enum<?> before, Enum<?> after) {
"""
Adds a single change.
@param name the name
@param before the before state
@param after the after state
"""
String beforeStr = before != null ? before.name() : null;
String afterStr = after != null ? after.name() : null;
... | java | public void addChange(String name, Enum<?> before, Enum<?> after) {
String beforeStr = before != null ? before.name() : null;
String afterStr = after != null ? after.name() : null;
addChange(name, beforeStr, afterStr);
} | [
"public",
"void",
"addChange",
"(",
"String",
"name",
",",
"Enum",
"<",
"?",
">",
"before",
",",
"Enum",
"<",
"?",
">",
"after",
")",
"{",
"String",
"beforeStr",
"=",
"before",
"!=",
"null",
"?",
"before",
".",
"name",
"(",
")",
":",
"null",
";",
... | Adds a single change.
@param name the name
@param before the before state
@param after the after state | [
"Adds",
"a",
"single",
"change",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/beans/src/main/java/io/apiman/manager/api/beans/audit/data/EntityUpdatedData.java#L56-L60 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/evaluation/AutomaticEvaluation.java | AutomaticEvaluation.ensureClusteringResult | public static void ensureClusteringResult(final Database db, final Result result) {
"""
Ensure that the result contains at least one Clustering.
@param db Database to process
@param result result
"""
Collection<Clustering<?>> clusterings = ResultUtil.filterResults(db.getHierarchy(), result, Clustering.... | java | public static void ensureClusteringResult(final Database db, final Result result) {
Collection<Clustering<?>> clusterings = ResultUtil.filterResults(db.getHierarchy(), result, Clustering.class);
if(clusterings.isEmpty()) {
ResultUtil.addChildResult(db, new ByLabelOrAllInOneClustering().run(db));
}
} | [
"public",
"static",
"void",
"ensureClusteringResult",
"(",
"final",
"Database",
"db",
",",
"final",
"Result",
"result",
")",
"{",
"Collection",
"<",
"Clustering",
"<",
"?",
">",
">",
"clusterings",
"=",
"ResultUtil",
".",
"filterResults",
"(",
"db",
".",
"ge... | Ensure that the result contains at least one Clustering.
@param db Database to process
@param result result | [
"Ensure",
"that",
"the",
"result",
"contains",
"at",
"least",
"one",
"Clustering",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/evaluation/AutomaticEvaluation.java#L160-L165 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableModel.java | PathfindableModel.checkArrivedY | private boolean checkArrivedY(double extrp, double sy, double dy) {
"""
Check if the pathfindable is vertically arrived.
@param extrp The extrapolation value.
@param sy The vertical speed.
@param dy The vertical tile destination.
@return <code>true</code> if arrived, <code>false</code> else.
"""
... | java | private boolean checkArrivedY(double extrp, double sy, double dy)
{
final double y = transformable.getY();
if (sy < 0 && y <= dy || sy >= 0 && y >= dy)
{
transformable.moveLocation(extrp, 0, dy - y);
return true;
}
return false;
} | [
"private",
"boolean",
"checkArrivedY",
"(",
"double",
"extrp",
",",
"double",
"sy",
",",
"double",
"dy",
")",
"{",
"final",
"double",
"y",
"=",
"transformable",
".",
"getY",
"(",
")",
";",
"if",
"(",
"sy",
"<",
"0",
"&&",
"y",
"<=",
"dy",
"||",
"sy... | Check if the pathfindable is vertically arrived.
@param extrp The extrapolation value.
@param sy The vertical speed.
@param dy The vertical tile destination.
@return <code>true</code> if arrived, <code>false</code> else. | [
"Check",
"if",
"the",
"pathfindable",
"is",
"vertically",
"arrived",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableModel.java#L382-L391 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/sms_profile.java | sms_profile.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception {
"""
<pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre>
"""
sms_profile_responses result = (sms_profile_responses) service.get_payl... | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
sms_profile_responses result = (sms_profile_responses) service.get_payload_formatter().string_to_resource(sms_profile_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode =... | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"sms_profile_responses",
"result",
"=",
"(",
"sms_profile_responses",
")",
"service",
".",
"get_payload_format... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/sms_profile.java#L368-L385 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.