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 |
|---|---|---|---|---|---|---|---|---|---|---|
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/related/RelatedTablesCoreExtension.java | RelatedTablesCoreExtension.addTilesRelationship | public ExtendedRelation addTilesRelationship(String baseTableName,
TileTable tileTable, String mappingTableName) {
"""
Adds a tiles relationship between the base table and user tiles related
table. Creates a default user mapping table and the tile table if needed.
@param baseTableName
base table name
@par... | java | public ExtendedRelation addTilesRelationship(String baseTableName,
TileTable tileTable, String mappingTableName) {
return addRelationship(baseTableName, tileTable, mappingTableName);
} | [
"public",
"ExtendedRelation",
"addTilesRelationship",
"(",
"String",
"baseTableName",
",",
"TileTable",
"tileTable",
",",
"String",
"mappingTableName",
")",
"{",
"return",
"addRelationship",
"(",
"baseTableName",
",",
"tileTable",
",",
"mappingTableName",
")",
";",
"}... | Adds a tiles relationship between the base table and user tiles related
table. Creates a default user mapping table and the tile table if needed.
@param baseTableName
base table name
@param tileTable
user tile table
@param mappingTableName
user mapping table name
@return The relationship that was added
@since 3.2.0 | [
"Adds",
"a",
"tiles",
"relationship",
"between",
"the",
"base",
"table",
"and",
"user",
"tiles",
"related",
"table",
".",
"Creates",
"a",
"default",
"user",
"mapping",
"table",
"and",
"the",
"tile",
"table",
"if",
"needed",
"."
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/related/RelatedTablesCoreExtension.java#L716-L719 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/TextModerationsImpl.java | TextModerationsImpl.screenTextAsync | public Observable<Screen> screenTextAsync(String textContentType, byte[] textContent, ScreenTextOptionalParameter screenTextOptionalParameter) {
"""
Detect profanity and match against custom and shared blacklists.
Detects profanity in more than 100 languages and match against custom and shared blacklists.
@par... | java | public Observable<Screen> screenTextAsync(String textContentType, byte[] textContent, ScreenTextOptionalParameter screenTextOptionalParameter) {
return screenTextWithServiceResponseAsync(textContentType, textContent, screenTextOptionalParameter).map(new Func1<ServiceResponse<Screen>, Screen>() {
@Ov... | [
"public",
"Observable",
"<",
"Screen",
">",
"screenTextAsync",
"(",
"String",
"textContentType",
",",
"byte",
"[",
"]",
"textContent",
",",
"ScreenTextOptionalParameter",
"screenTextOptionalParameter",
")",
"{",
"return",
"screenTextWithServiceResponseAsync",
"(",
"textCo... | Detect profanity and match against custom and shared blacklists.
Detects profanity in more than 100 languages and match against custom and shared blacklists.
@param textContentType The content type. Possible values include: 'text/plain', 'text/html', 'text/xml', 'text/markdown'
@param textContent Content to screen.
@p... | [
"Detect",
"profanity",
"and",
"match",
"against",
"custom",
"and",
"shared",
"blacklists",
".",
"Detects",
"profanity",
"in",
"more",
"than",
"100",
"languages",
"and",
"match",
"against",
"custom",
"and",
"shared",
"blacklists",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/TextModerationsImpl.java#L113-L120 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/ProjectApi.java | ProjectApi.forkProject | public Project forkProject(Object projectIdOrPath, String namespace) throws GitLabApiException {
"""
Forks a project into the user namespace of the authenticated user or the one provided.
The forking operation for a project is asynchronous and is completed in a background job.
The request will return immediately... | java | public Project forkProject(Object projectIdOrPath, String namespace) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("namespace", namespace, true);
Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.CREATED);
Re... | [
"public",
"Project",
"forkProject",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"namespace",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withParam",
"(",
"\"namespace\"",
",",
"namespace",
... | Forks a project into the user namespace of the authenticated user or the one provided.
The forking operation for a project is asynchronous and is completed in a background job.
The request will return immediately.
<pre><code>POST /projects/:id/fork</code></pre>
@param projectIdOrPath the project in the form of an Int... | [
"Forks",
"a",
"project",
"into",
"the",
"user",
"namespace",
"of",
"the",
"authenticated",
"user",
"or",
"the",
"one",
"provided",
".",
"The",
"forking",
"operation",
"for",
"a",
"project",
"is",
"asynchronous",
"and",
"is",
"completed",
"in",
"a",
"backgrou... | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L1104-L1109 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/StatementManager.java | StatementManager.getUpdateStatement | public PreparedStatement getUpdateStatement(ClassDescriptor cds) throws PersistenceBrokerSQLException, PersistenceBrokerException {
"""
return a prepared Update Statement fitting to the given ClassDescriptor
"""
try
{
return cds.getStatementsForClass(m_conMan).getUpdateStmt(m_con... | java | public PreparedStatement getUpdateStatement(ClassDescriptor cds) throws PersistenceBrokerSQLException, PersistenceBrokerException
{
try
{
return cds.getStatementsForClass(m_conMan).getUpdateStmt(m_conMan.getConnection());
}
catch (SQLException e)
{
... | [
"public",
"PreparedStatement",
"getUpdateStatement",
"(",
"ClassDescriptor",
"cds",
")",
"throws",
"PersistenceBrokerSQLException",
",",
"PersistenceBrokerException",
"{",
"try",
"{",
"return",
"cds",
".",
"getStatementsForClass",
"(",
"m_conMan",
")",
".",
"getUpdateStmt... | return a prepared Update Statement fitting to the given ClassDescriptor | [
"return",
"a",
"prepared",
"Update",
"Statement",
"fitting",
"to",
"the",
"given",
"ClassDescriptor"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/StatementManager.java#L639-L653 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Key.java | Key.toUrlSafe | public String toUrlSafe() {
"""
Returns the key in an encoded form that can be used as part of a URL.
"""
try {
return URLEncoder.encode(TextFormat.printToString(toPb()), UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("Unexpected encoding exception... | java | public String toUrlSafe() {
try {
return URLEncoder.encode(TextFormat.printToString(toPb()), UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("Unexpected encoding exception", e);
}
} | [
"public",
"String",
"toUrlSafe",
"(",
")",
"{",
"try",
"{",
"return",
"URLEncoder",
".",
"encode",
"(",
"TextFormat",
".",
"printToString",
"(",
"toPb",
"(",
")",
")",
",",
"UTF_8",
".",
"name",
"(",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodi... | Returns the key in an encoded form that can be used as part of a URL. | [
"Returns",
"the",
"key",
"in",
"an",
"encoded",
"form",
"that",
"can",
"be",
"used",
"as",
"part",
"of",
"a",
"URL",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Key.java#L129-L135 |
Impetus/Kundera | src/kundera-rethinkdb/src/main/java/com/impetus/client/rethink/query/RethinkDBQuery.java | RethinkDBQuery.buildFunction | public static ReqlFunction1 buildFunction(final String colName, final Object obj, final String identifier) {
"""
Builds the function.
@param colName
the col name
@param obj
the obj
@param identifier
the identifier
@return the reql function1
"""
return new ReqlFunction1()
{
... | java | public static ReqlFunction1 buildFunction(final String colName, final Object obj, final String identifier)
{
return new ReqlFunction1()
{
@Override
public Object apply(ReqlExpr row)
{
switch (identifier)
{
case "<... | [
"public",
"static",
"ReqlFunction1",
"buildFunction",
"(",
"final",
"String",
"colName",
",",
"final",
"Object",
"obj",
",",
"final",
"String",
"identifier",
")",
"{",
"return",
"new",
"ReqlFunction1",
"(",
")",
"{",
"@",
"Override",
"public",
"Object",
"apply... | Builds the function.
@param colName
the col name
@param obj
the obj
@param identifier
the identifier
@return the reql function1 | [
"Builds",
"the",
"function",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-rethinkdb/src/main/java/com/impetus/client/rethink/query/RethinkDBQuery.java#L233-L266 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/util/ScriptUtil.java | ScriptUtil.getScriptFromSource | public static ExecutableScript getScriptFromSource(String language, String source, ScriptFactory scriptFactory) {
"""
Creates a new {@link ExecutableScript} from a static source.
@param language the language of the script
@param source the source code of the script
@param scriptFactory the script factory used... | java | public static ExecutableScript getScriptFromSource(String language, String source, ScriptFactory scriptFactory) {
ensureNotEmpty(NotValidException.class, "Script language", language);
ensureNotNull(NotValidException.class, "Script source", source);
return scriptFactory.createScriptFromSource(language, sourc... | [
"public",
"static",
"ExecutableScript",
"getScriptFromSource",
"(",
"String",
"language",
",",
"String",
"source",
",",
"ScriptFactory",
"scriptFactory",
")",
"{",
"ensureNotEmpty",
"(",
"NotValidException",
".",
"class",
",",
"\"Script language\"",
",",
"language",
"... | Creates a new {@link ExecutableScript} from a static source.
@param language the language of the script
@param source the source code of the script
@param scriptFactory the script factory used to create the script
@return the newly created script
@throws NotValidException if language is null or empty or source is null | [
"Creates",
"a",
"new",
"{",
"@link",
"ExecutableScript",
"}",
"from",
"a",
"static",
"source",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/ScriptUtil.java#L109-L113 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/BeanBox.java | BeanBox.addMethodAop | public synchronized BeanBox addMethodAop(Object aop, String methodName, Class<?>... paramTypes) {
"""
This is Java configuration method equal to put a AOP annotation on method. a
AOP annotation is a kind of annotation be binded to an AOP alliance
interceptor like ctx.bind(Tx.class, MyInterceptor.class); then you... | java | public synchronized BeanBox addMethodAop(Object aop, String methodName, Class<?>... paramTypes) {
checkOrCreateMethodAops();
Method m = ReflectionUtils.findMethod(beanClass, methodName, paramTypes);
BeanBoxException.assureNotNull(m, "Not found method: '" + methodName + "'");
addMethodAop(aop, m);
return this;... | [
"public",
"synchronized",
"BeanBox",
"addMethodAop",
"(",
"Object",
"aop",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"paramTypes",
")",
"{",
"checkOrCreateMethodAops",
"(",
")",
";",
"Method",
"m",
"=",
"ReflectionUtils",
".",
"findMetho... | This is Java configuration method equal to put a AOP annotation on method. a
AOP annotation is a kind of annotation be binded to an AOP alliance
interceptor like ctx.bind(Tx.class, MyInterceptor.class); then you can put
a @Tx annotation on method. But this method allow aop can be annotation class
or interceptor class f... | [
"This",
"is",
"Java",
"configuration",
"method",
"equal",
"to",
"put",
"a",
"AOP",
"annotation",
"on",
"method",
".",
"a",
"AOP",
"annotation",
"is",
"a",
"kind",
"of",
"annotation",
"be",
"binded",
"to",
"an",
"AOP",
"alliance",
"interceptor",
"like",
"ct... | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/BeanBox.java#L251-L257 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java | ElementBase.removeChild | public void removeChild(ElementBase child, boolean destroy) {
"""
Removes the specified element as a child of this parent.
@param child Child element to remove.
@param destroy If true the child is explicitly destroyed.
"""
if (!children.contains(child)) {
return;
}
... | java | public void removeChild(ElementBase child, boolean destroy) {
if (!children.contains(child)) {
return;
}
boolean isLocked = child.isLocked() || child.getDefinition().isInternal();
if (destroy) {
child.removeChildren();
if... | [
"public",
"void",
"removeChild",
"(",
"ElementBase",
"child",
",",
"boolean",
"destroy",
")",
"{",
"if",
"(",
"!",
"children",
".",
"contains",
"(",
"child",
")",
")",
"{",
"return",
";",
"}",
"boolean",
"isLocked",
"=",
"child",
".",
"isLocked",
"(",
... | Removes the specified element as a child of this parent.
@param child Child element to remove.
@param destroy If true the child is explicitly destroyed. | [
"Removes",
"the",
"specified",
"element",
"as",
"a",
"child",
"of",
"this",
"parent",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L202-L223 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java | ResourceUtil.readStr | public static String readStr(String resource, Charset charset) {
"""
读取Classpath下的资源为字符串
@param resource 资源路径,使用相对ClassPath的路径
@param charset 编码
@return 资源内容
@since 3.1.1
"""
return getResourceObj(resource).readStr(charset);
} | java | public static String readStr(String resource, Charset charset) {
return getResourceObj(resource).readStr(charset);
} | [
"public",
"static",
"String",
"readStr",
"(",
"String",
"resource",
",",
"Charset",
"charset",
")",
"{",
"return",
"getResourceObj",
"(",
"resource",
")",
".",
"readStr",
"(",
"charset",
")",
";",
"}"
] | 读取Classpath下的资源为字符串
@param resource 资源路径,使用相对ClassPath的路径
@param charset 编码
@return 资源内容
@since 3.1.1 | [
"读取Classpath下的资源为字符串"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java#L47-L49 |
likethecolor/Alchemy-API | src/main/java/com/likethecolor/alchemy/api/parser/json/TaxonomiesParser.java | TaxonomiesParser.getTaxonomy | private JSONObject getTaxonomy(final JSONArray taxonomies, final int index) {
"""
Return a json object from the provided array. Return an empty object if
there is any problems fetching the taxonomy data.
@param taxonomies array of taxonomy data
@param index of the object to fetch
@return json object from ... | java | private JSONObject getTaxonomy(final JSONArray taxonomies, final int index) {
JSONObject object = new JSONObject();
try {
object = (JSONObject) taxonomies.get(index);
}
catch(JSONException e) {
e.printStackTrace();
}
return object;
} | [
"private",
"JSONObject",
"getTaxonomy",
"(",
"final",
"JSONArray",
"taxonomies",
",",
"final",
"int",
"index",
")",
"{",
"JSONObject",
"object",
"=",
"new",
"JSONObject",
"(",
")",
";",
"try",
"{",
"object",
"=",
"(",
"JSONObject",
")",
"taxonomies",
".",
... | Return a json object from the provided array. Return an empty object if
there is any problems fetching the taxonomy data.
@param taxonomies array of taxonomy data
@param index of the object to fetch
@return json object from the provided array | [
"Return",
"a",
"json",
"object",
"from",
"the",
"provided",
"array",
".",
"Return",
"an",
"empty",
"object",
"if",
"there",
"is",
"any",
"problems",
"fetching",
"the",
"taxonomy",
"data",
"."
] | train | https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/TaxonomiesParser.java#L61-L70 |
oasp/oasp4j | modules/jpa-envers/src/main/java/io/oasp/module/jpa/dataaccess/base/AbstractGenericRevisionedDao.java | AbstractGenericRevisionedDao.loadRevision | protected ENTITY loadRevision(Object id, Number revision) {
"""
This method gets a historic revision of the {@link net.sf.mmm.util.entity.api.GenericEntity} with the given
<code>id</code>.
@param id is the {@link net.sf.mmm.util.entity.api.GenericEntity#getId() ID} of the requested
{@link net.sf.mmm.util.enti... | java | protected ENTITY loadRevision(Object id, Number revision) {
Class<? extends ENTITY> entityClassImplementation = getEntityClass();
ENTITY entity = getAuditReader().find(entityClassImplementation, id, revision);
if (entity != null) {
entity.setRevision(revision);
}
return entity;
} | [
"protected",
"ENTITY",
"loadRevision",
"(",
"Object",
"id",
",",
"Number",
"revision",
")",
"{",
"Class",
"<",
"?",
"extends",
"ENTITY",
">",
"entityClassImplementation",
"=",
"getEntityClass",
"(",
")",
";",
"ENTITY",
"entity",
"=",
"getAuditReader",
"(",
")"... | This method gets a historic revision of the {@link net.sf.mmm.util.entity.api.GenericEntity} with the given
<code>id</code>.
@param id is the {@link net.sf.mmm.util.entity.api.GenericEntity#getId() ID} of the requested
{@link net.sf.mmm.util.entity.api.GenericEntity entity}.
@param revision is the {@link MutablePersis... | [
"This",
"method",
"gets",
"a",
"historic",
"revision",
"of",
"the",
"{",
"@link",
"net",
".",
"sf",
".",
"mmm",
".",
"util",
".",
"entity",
".",
"api",
".",
"GenericEntity",
"}",
"with",
"the",
"given",
"<code",
">",
"id<",
"/",
"code",
">",
"."
] | train | https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/jpa-envers/src/main/java/io/oasp/module/jpa/dataaccess/base/AbstractGenericRevisionedDao.java#L64-L72 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.updateHierarchicalEntityChildAsync | public Observable<OperationStatus> updateHierarchicalEntityChildAsync(UUID appId, String versionId, UUID hEntityId, UUID hChildId, UpdateHierarchicalEntityChildOptionalParameter updateHierarchicalEntityChildOptionalParameter) {
"""
Renames a single child in an existing hierarchical entity model.
@param appId Th... | java | public Observable<OperationStatus> updateHierarchicalEntityChildAsync(UUID appId, String versionId, UUID hEntityId, UUID hChildId, UpdateHierarchicalEntityChildOptionalParameter updateHierarchicalEntityChildOptionalParameter) {
return updateHierarchicalEntityChildWithServiceResponseAsync(appId, versionId, hEnti... | [
"public",
"Observable",
"<",
"OperationStatus",
">",
"updateHierarchicalEntityChildAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"hEntityId",
",",
"UUID",
"hChildId",
",",
"UpdateHierarchicalEntityChildOptionalParameter",
"updateHierarchicalEntityChil... | Renames a single child in an existing hierarchical entity model.
@param appId The application ID.
@param versionId The version ID.
@param hEntityId The hierarchical entity extractor ID.
@param hChildId The hierarchical entity extractor child ID.
@param updateHierarchicalEntityChildOptionalParameter the object represen... | [
"Renames",
"a",
"single",
"child",
"in",
"an",
"existing",
"hierarchical",
"entity",
"model",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L6372-L6379 |
fcrepo4/fcrepo4 | fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACFilter.java | WebACFilter.getHasMemberFromResource | private URI getHasMemberFromResource(final HttpServletRequest request, final FedoraResource resource) {
"""
Get ldp:membershipResource from an existing resource
@param request the request
@param resource the FedoraResource
@return URI of the ldp:membershipResource triple or null if not found.
"""
... | java | private URI getHasMemberFromResource(final HttpServletRequest request, final FedoraResource resource) {
return resource.getTriples(translator(request), of(PROPERTIES))
.filter(triple -> triple.getPredicate().equals(MEMBERSHIP_RESOURCE.asNode()) && triple.getObject()
.isUR... | [
"private",
"URI",
"getHasMemberFromResource",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"FedoraResource",
"resource",
")",
"{",
"return",
"resource",
".",
"getTriples",
"(",
"translator",
"(",
"request",
")",
",",
"of",
"(",
"PROPERTIES",
")",
... | Get ldp:membershipResource from an existing resource
@param request the request
@param resource the FedoraResource
@return URI of the ldp:membershipResource triple or null if not found. | [
"Get",
"ldp",
":",
"membershipResource",
"from",
"an",
"existing",
"resource"
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACFilter.java#L693-L699 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PatternsImpl.java | PatternsImpl.deletePatternAsync | public Observable<OperationStatus> deletePatternAsync(UUID appId, String versionId, UUID patternId) {
"""
Deletes the pattern with the specified ID.
@param appId The application ID.
@param versionId The version ID.
@param patternId The pattern ID.
@throws IllegalArgumentException thrown if parameters fail th... | java | public Observable<OperationStatus> deletePatternAsync(UUID appId, String versionId, UUID patternId) {
return deletePatternWithServiceResponseAsync(appId, versionId, patternId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(Servi... | [
"public",
"Observable",
"<",
"OperationStatus",
">",
"deletePatternAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"patternId",
")",
"{",
"return",
"deletePatternWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"patternId",
")",... | Deletes the pattern with the specified ID.
@param appId The application ID.
@param versionId The version ID.
@param patternId The pattern ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatus object | [
"Deletes",
"the",
"pattern",
"with",
"the",
"specified",
"ID",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PatternsImpl.java#L786-L793 |
alkacon/opencms-core | src-gwt/org/opencms/ui/client/contextmenu/CmsContextMenuWidget.java | CmsContextMenuWidget.createEmptyItemWidget | private CmsContextMenuItemWidget createEmptyItemWidget(
String id,
String caption,
String description,
CmsContextMenuConnector contextMenuConnector) {
"""
Creates new empty menu item.<p>
@param id the id
@param caption the caption
@param description the item description use... | java | private CmsContextMenuItemWidget createEmptyItemWidget(
String id,
String caption,
String description,
CmsContextMenuConnector contextMenuConnector) {
CmsContextMenuItemWidget widget = GWT.create(CmsContextMenuItemWidget.class);
widget.setId(id);
widget.s... | [
"private",
"CmsContextMenuItemWidget",
"createEmptyItemWidget",
"(",
"String",
"id",
",",
"String",
"caption",
",",
"String",
"description",
",",
"CmsContextMenuConnector",
"contextMenuConnector",
")",
"{",
"CmsContextMenuItemWidget",
"widget",
"=",
"GWT",
".",
"create",
... | Creates new empty menu item.<p>
@param id the id
@param caption the caption
@param description the item description used as tool-tip
@param contextMenuConnector the connector
@return the menu item | [
"Creates",
"new",
"empty",
"menu",
"item",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ui/client/contextmenu/CmsContextMenuWidget.java#L233-L253 |
openengsb/openengsb | ui/admin/src/main/java/org/openengsb/ui/admin/wiringPage/WiringPage.java | WiringPage.setLocation | private boolean setLocation(String global, String context, Map<String, Object> properties) {
"""
returns true if location is not already set in the properties, otherwise false
"""
String locationKey = "location." + context;
Object propvalue = properties.get(locationKey);
if (propvalue =... | java | private boolean setLocation(String global, String context, Map<String, Object> properties) {
String locationKey = "location." + context;
Object propvalue = properties.get(locationKey);
if (propvalue == null) {
properties.put(locationKey, global);
} else if (propvalue.getClass... | [
"private",
"boolean",
"setLocation",
"(",
"String",
"global",
",",
"String",
"context",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"String",
"locationKey",
"=",
"\"location.\"",
"+",
"context",
";",
"Object",
"propvalue",
"=",
"pr... | returns true if location is not already set in the properties, otherwise false | [
"returns",
"true",
"if",
"location",
"is",
"not",
"already",
"set",
"in",
"the",
"properties",
"otherwise",
"false"
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/ui/admin/src/main/java/org/openengsb/ui/admin/wiringPage/WiringPage.java#L259-L282 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/RootDocImpl.java | RootDocImpl.setClasses | private void setClasses(DocEnv env, List<JCClassDecl> classes) {
"""
Initialize classes information. Those classes are input from
command line.
@param env the compilation environment
@param classes a list of ClassDeclaration
"""
ListBuffer<ClassDocImpl> result = new ListBuffer<>();
for (JC... | java | private void setClasses(DocEnv env, List<JCClassDecl> classes) {
ListBuffer<ClassDocImpl> result = new ListBuffer<>();
for (JCClassDecl def : classes) {
//### Do we want modifier check here?
if (env.shouldDocument(def.sym)) {
ClassDocImpl cd = env.getClassDoc(def.... | [
"private",
"void",
"setClasses",
"(",
"DocEnv",
"env",
",",
"List",
"<",
"JCClassDecl",
">",
"classes",
")",
"{",
"ListBuffer",
"<",
"ClassDocImpl",
">",
"result",
"=",
"new",
"ListBuffer",
"<>",
"(",
")",
";",
"for",
"(",
"JCClassDecl",
"def",
":",
"cla... | Initialize classes information. Those classes are input from
command line.
@param env the compilation environment
@param classes a list of ClassDeclaration | [
"Initialize",
"classes",
"information",
".",
"Those",
"classes",
"are",
"input",
"from",
"command",
"line",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/RootDocImpl.java#L119-L132 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/AbstractResources.java | AbstractResources.deleteResource | protected <T> void deleteResource(String path, Class<T> objectClass) throws SmartsheetException {
"""
Delete a resource from Smartsheet REST API.
Exceptions:
IllegalArgumentException : if any argument is null, or path is empty string
InvalidRequestException : if there is any problem with the REST API request
... | java | protected <T> void deleteResource(String path, Class<T> objectClass) throws SmartsheetException {
Util.throwIfNull(path, objectClass);
Util.throwIfEmpty(path);
HttpRequest request;
request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.DELETE);
try {
... | [
"protected",
"<",
"T",
">",
"void",
"deleteResource",
"(",
"String",
"path",
",",
"Class",
"<",
"T",
">",
"objectClass",
")",
"throws",
"SmartsheetException",
"{",
"Util",
".",
"throwIfNull",
"(",
"path",
",",
"objectClass",
")",
";",
"Util",
".",
"throwIf... | Delete a resource from Smartsheet REST API.
Exceptions:
IllegalArgumentException : if any argument is null, or path is empty string
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ResourceNotFound... | [
"Delete",
"a",
"resource",
"from",
"Smartsheet",
"REST",
"API",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/AbstractResources.java#L529-L549 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/MetamodelImpl.java | MetamodelImpl.addEntityMetadata | public void addEntityMetadata(Class<?> clazz, EntityMetadata entityMetadata) {
"""
Adds the entity metadata.
@param clazz
the clazz
@param entityMetadata
the entity metadata
"""
getEntityMetadataMap().put(clazz.getName(), entityMetadata);
} | java | public void addEntityMetadata(Class<?> clazz, EntityMetadata entityMetadata)
{
getEntityMetadataMap().put(clazz.getName(), entityMetadata);
} | [
"public",
"void",
"addEntityMetadata",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"EntityMetadata",
"entityMetadata",
")",
"{",
"getEntityMetadataMap",
"(",
")",
".",
"put",
"(",
"clazz",
".",
"getName",
"(",
")",
",",
"entityMetadata",
")",
";",
"}"
] | Adds the entity metadata.
@param clazz
the clazz
@param entityMetadata
the entity metadata | [
"Adds",
"the",
"entity",
"metadata",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/MetamodelImpl.java#L224-L227 |
mapsforge/mapsforge | mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java | MercatorProjection.pixelXToLongitude | public static double pixelXToLongitude(double pixelX, long mapSize) {
"""
Converts a pixel X coordinate at a certain map size to a longitude coordinate.
@param pixelX the pixel X coordinate that should be converted.
@param mapSize precomputed size of map.
@return the longitude value of the pixel X coordinate... | java | public static double pixelXToLongitude(double pixelX, long mapSize) {
if (pixelX < 0 || pixelX > mapSize) {
throw new IllegalArgumentException("invalid pixelX coordinate " + mapSize + ": " + pixelX);
}
return 360 * ((pixelX / mapSize) - 0.5);
} | [
"public",
"static",
"double",
"pixelXToLongitude",
"(",
"double",
"pixelX",
",",
"long",
"mapSize",
")",
"{",
"if",
"(",
"pixelX",
"<",
"0",
"||",
"pixelX",
">",
"mapSize",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"invalid pixelX coordinate \... | Converts a pixel X coordinate at a certain map size to a longitude coordinate.
@param pixelX the pixel X coordinate that should be converted.
@param mapSize precomputed size of map.
@return the longitude value of the pixel X coordinate.
@throws IllegalArgumentException if the given pixelX coordinate is invalid. | [
"Converts",
"a",
"pixel",
"X",
"coordinate",
"at",
"a",
"certain",
"map",
"size",
"to",
"a",
"longitude",
"coordinate",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L353-L358 |
aws/aws-sdk-java | aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/CreateRobotRequest.java | CreateRobotRequest.withTags | public CreateRobotRequest withTags(java.util.Map<String, String> tags) {
"""
<p>
A map that contains tag keys and tag values that are attached to the robot.
</p>
@param tags
A map that contains tag keys and tag values that are attached to the robot.
@return Returns a reference to this object so that method ... | java | public CreateRobotRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"CreateRobotRequest",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A map that contains tag keys and tag values that are attached to the robot.
</p>
@param tags
A map that contains tag keys and tag values that are attached to the robot.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"map",
"that",
"contains",
"tag",
"keys",
"and",
"tag",
"values",
"that",
"are",
"attached",
"to",
"the",
"robot",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/CreateRobotRequest.java#L227-L230 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/common/SystemConfiguration.java | SystemConfiguration.getAttributeValueAsEncryptedProperties | public Properties getAttributeValueAsEncryptedProperties(final String _key,
final boolean _concatenate)
throws EFapsException {
"""
Returns for given <code>_key</code> the related value as Properties. If
no attribute is found an empty Properties... | java | public Properties getAttributeValueAsEncryptedProperties(final String _key,
final boolean _concatenate)
throws EFapsException
{
final Properties properties = getAttributeValueAsProperties(_key, _concatenate);
final StandardPBEStrin... | [
"public",
"Properties",
"getAttributeValueAsEncryptedProperties",
"(",
"final",
"String",
"_key",
",",
"final",
"boolean",
"_concatenate",
")",
"throws",
"EFapsException",
"{",
"final",
"Properties",
"properties",
"=",
"getAttributeValueAsProperties",
"(",
"_key",
",",
... | Returns for given <code>_key</code> the related value as Properties. If
no attribute is found an empty Properties is returned.
@param _key key of searched attribute
@param _concatenate is concatenate or not
@return Properties
@throws EFapsException on error
@see #attributes | [
"Returns",
"for",
"given",
"<code",
">",
"_key<",
"/",
"code",
">",
"the",
"related",
"value",
"as",
"Properties",
".",
"If",
"no",
"attribute",
"is",
"found",
"an",
"empty",
"Properties",
"is",
"returned",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/common/SystemConfiguration.java#L453-L462 |
zaproxy/zaproxy | src/org/apache/commons/httpclient/HttpMethodBase.java | HttpMethodBase.putAllCookiesInASingleHeader | private void putAllCookiesInASingleHeader(String host, CookieSpec matcher,
Cookie[] cookies) {
"""
Put all the cookies in a single header line.
Merge the cookies already present in the request
with the cookies coming from the state.
@param host the host used with this cookies
@param matcher the... | java | private void putAllCookiesInASingleHeader(String host, CookieSpec matcher,
Cookie[] cookies) {
LOG.trace("enter putAllCookiesInASingleHeader(String host, CookieSpec matcher, Cookie[] cookies)" );
//use a map to make sure we only have one cookie per name
HashMap<String, Cooki... | [
"private",
"void",
"putAllCookiesInASingleHeader",
"(",
"String",
"host",
",",
"CookieSpec",
"matcher",
",",
"Cookie",
"[",
"]",
"cookies",
")",
"{",
"LOG",
".",
"trace",
"(",
"\"enter putAllCookiesInASingleHeader(String host, CookieSpec matcher, Cookie[] cookies)\"",
")",
... | Put all the cookies in a single header line.
Merge the cookies already present in the request
with the cookies coming from the state.
@param host the host used with this cookies
@param matcher the {@link CookieSpec matcher} used in this context
@param cookies associated with the {@link HttpState state} | [
"Put",
"all",
"the",
"cookies",
"in",
"a",
"single",
"header",
"line",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/apache/commons/httpclient/HttpMethodBase.java#L1390-L1414 |
apache/incubator-gobblin | gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/InnerMetricContext.java | InnerMetricContext.getCounters | @Override
public SortedMap<String, Counter> getCounters(MetricFilter filter) {
"""
See {@link com.codahale.metrics.MetricRegistry#getCounters(com.codahale.metrics.MetricFilter)}.
<p>
This method will return fully-qualified metric names if the {@link MetricContext} is configured
to report fully-qualified met... | java | @Override
public SortedMap<String, Counter> getCounters(MetricFilter filter) {
return getSimplyNamedMetrics(Counter.class, Optional.of(filter));
} | [
"@",
"Override",
"public",
"SortedMap",
"<",
"String",
",",
"Counter",
">",
"getCounters",
"(",
"MetricFilter",
"filter",
")",
"{",
"return",
"getSimplyNamedMetrics",
"(",
"Counter",
".",
"class",
",",
"Optional",
".",
"of",
"(",
"filter",
")",
")",
";",
"... | See {@link com.codahale.metrics.MetricRegistry#getCounters(com.codahale.metrics.MetricFilter)}.
<p>
This method will return fully-qualified metric names if the {@link MetricContext} is configured
to report fully-qualified metric names.
</p> | [
"See",
"{",
"@link",
"com",
".",
"codahale",
".",
"metrics",
".",
"MetricRegistry#getCounters",
"(",
"com",
".",
"codahale",
".",
"metrics",
".",
"MetricFilter",
")",
"}",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/InnerMetricContext.java#L203-L206 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/AnnotationsInner.java | AnnotationsInner.deleteAsync | public Observable<Object> deleteAsync(String resourceGroupName, String resourceName, String annotationId) {
"""
Delete an Annotation of an Application Insights component.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@para... | java | public Observable<Object> deleteAsync(String resourceGroupName, String resourceName, String annotationId) {
return deleteWithServiceResponseAsync(resourceGroupName, resourceName, annotationId).map(new Func1<ServiceResponse<Object>, Object>() {
@Override
public Object call(ServiceResponse... | [
"public",
"Observable",
"<",
"Object",
">",
"deleteAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"String",
"annotationId",
")",
"{",
"return",
"deleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
",",
"anno... | Delete an Annotation of an Application Insights component.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param annotationId The unique annotation ID. This is unique within a Application Insights component.
@throws IllegalArgumentE... | [
"Delete",
"an",
"Annotation",
"of",
"an",
"Application",
"Insights",
"component",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/AnnotationsInner.java#L315-L322 |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/utils/LongPacker.java | LongPacker.unpackLong | static public long unpackLong(byte[] ba, int index) {
"""
Unpack positive long value from the byte array.
<p>
The index value indicates the index in the given byte array.
@param ba byte array
@param index index in ba
@return the long value
"""
long result = 0;
for (int offset = 0; offset < 64; o... | java | static public long unpackLong(byte[] ba, int index) {
long result = 0;
for (int offset = 0; offset < 64; offset += 7) {
long b = ba[index++];
result |= (b & 0x7F) << offset;
if ((b & 0x80) == 0) {
return result;
}
}
throw new Error("Malformed long.");
} | [
"static",
"public",
"long",
"unpackLong",
"(",
"byte",
"[",
"]",
"ba",
",",
"int",
"index",
")",
"{",
"long",
"result",
"=",
"0",
";",
"for",
"(",
"int",
"offset",
"=",
"0",
";",
"offset",
"<",
"64",
";",
"offset",
"+=",
"7",
")",
"{",
"long",
... | Unpack positive long value from the byte array.
<p>
The index value indicates the index in the given byte array.
@param ba byte array
@param index index in ba
@return the long value | [
"Unpack",
"positive",
"long",
"value",
"from",
"the",
"byte",
"array",
".",
"<p",
">",
"The",
"index",
"value",
"indicates",
"the",
"index",
"in",
"the",
"given",
"byte",
"array",
"."
] | train | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/utils/LongPacker.java#L128-L138 |
facebookarchive/hadoop-20 | src/tools/org/apache/hadoop/tools/HadoopArchives.java | HadoopArchives.relPathToRoot | private Path relPathToRoot(Path fullPath, Path root) {
"""
truncate the prefix root from the full path
@param fullPath the full path
@param root the prefix root to be truncated
@return the relative path
"""
// just take some effort to do it
// rather than just using substring
// so that we do ... | java | private Path relPathToRoot(Path fullPath, Path root) {
// just take some effort to do it
// rather than just using substring
// so that we do not break sometime later
Path justRoot = new Path(Path.SEPARATOR);
if (fullPath.depth() == root.depth()) {
return justRoot;
}
else if (fullPat... | [
"private",
"Path",
"relPathToRoot",
"(",
"Path",
"fullPath",
",",
"Path",
"root",
")",
"{",
"// just take some effort to do it ",
"// rather than just using substring ",
"// so that we do not break sometime later",
"Path",
"justRoot",
"=",
"new",
"Path",
"(",
"Path",
".",
... | truncate the prefix root from the full path
@param fullPath the full path
@param root the prefix root to be truncated
@return the relative path | [
"truncate",
"the",
"prefix",
"root",
"from",
"the",
"full",
"path"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/tools/org/apache/hadoop/tools/HadoopArchives.java#L276-L294 |
bazaarvoice/emodb | sor-client-common/src/main/java/com/bazaarvoice/emodb/sor/client/DataStoreStash.java | DataStoreStash.getSplit | public StashRowIterable getSplit(String table, String split) {
"""
Gets the split content from a previous call to {@link #getSplits(String)}. Note that this method is less
flexible than its DataStore counterpart in that, since the splits are pre-computed, the split always begins at
the first record.
The spli... | java | public StashRowIterable getSplit(String table, String split) {
final StashSplit stashSplit = StashSplit.fromString(split);
checkArgument(stashSplit.getTable().equals(table));
return new StashRowIterable() {
@Override
protected StashRowIterator createStashRowIterator() {
... | [
"public",
"StashRowIterable",
"getSplit",
"(",
"String",
"table",
",",
"String",
"split",
")",
"{",
"final",
"StashSplit",
"stashSplit",
"=",
"StashSplit",
".",
"fromString",
"(",
"split",
")",
";",
"checkArgument",
"(",
"stashSplit",
".",
"getTable",
"(",
")"... | Gets the split content from a previous call to {@link #getSplits(String)}. Note that this method is less
flexible than its DataStore counterpart in that, since the splits are pre-computed, the split always begins at
the first record.
The splits returned will always match the Stash state from when the splits were orig... | [
"Gets",
"the",
"split",
"content",
"from",
"a",
"previous",
"call",
"to",
"{",
"@link",
"#getSplits",
"(",
"String",
")",
"}",
".",
"Note",
"that",
"this",
"method",
"is",
"less",
"flexible",
"than",
"its",
"DataStore",
"counterpart",
"in",
"that",
"since"... | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/sor-client-common/src/main/java/com/bazaarvoice/emodb/sor/client/DataStoreStash.java#L243-L253 |
headius/invokebinder | src/main/java/com/headius/invokebinder/Binder.java | Binder.foldStatic | public Binder foldStatic(MethodHandles.Lookup lookup, Class<?> target, String method) {
"""
Process the incoming arguments by calling the given static method on the
given class, inserting the result as the first argument.
@param lookup the java.lang.invoke.MethodHandles.Lookup to use
@param target the class o... | java | public Binder foldStatic(MethodHandles.Lookup lookup, Class<?> target, String method) {
return fold(Binder.from(type()).invokeStaticQuiet(lookup, target, method));
} | [
"public",
"Binder",
"foldStatic",
"(",
"MethodHandles",
".",
"Lookup",
"lookup",
",",
"Class",
"<",
"?",
">",
"target",
",",
"String",
"method",
")",
"{",
"return",
"fold",
"(",
"Binder",
".",
"from",
"(",
"type",
"(",
")",
")",
".",
"invokeStaticQuiet",... | Process the incoming arguments by calling the given static method on the
given class, inserting the result as the first argument.
@param lookup the java.lang.invoke.MethodHandles.Lookup to use
@param target the class on which the method is defined
@param method the method to invoke on the first argument
@return a new ... | [
"Process",
"the",
"incoming",
"arguments",
"by",
"calling",
"the",
"given",
"static",
"method",
"on",
"the",
"given",
"class",
"inserting",
"the",
"result",
"as",
"the",
"first",
"argument",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L956-L958 |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlHelper.java | RamlHelper.getFirstAuthorizationGrant | public static String getFirstAuthorizationGrant(RamlAction action, RamlRoot document) {
"""
Returns authorization grant for provided action. It searches for
authorization grants defined for provided action, some of parent
resources or the root of the document. If authorization grants found is a
list - the metho... | java | public static String getFirstAuthorizationGrant(RamlAction action, RamlRoot document) {
List<String> grants = getAuthorizationGrants(action, document);
if (grants.isEmpty()) {
return null;
}
return grants.get(0);
} | [
"public",
"static",
"String",
"getFirstAuthorizationGrant",
"(",
"RamlAction",
"action",
",",
"RamlRoot",
"document",
")",
"{",
"List",
"<",
"String",
">",
"grants",
"=",
"getAuthorizationGrants",
"(",
"action",
",",
"document",
")",
";",
"if",
"(",
"grants",
... | Returns authorization grant for provided action. It searches for
authorization grants defined for provided action, some of parent
resources or the root of the document. If authorization grants found is a
list - the method will return the first grant in the list.
@param action
action to find grant for
@param document
r... | [
"Returns",
"authorization",
"grant",
"for",
"provided",
"action",
".",
"It",
"searches",
"for",
"authorization",
"grants",
"defined",
"for",
"provided",
"action",
"some",
"of",
"parent",
"resources",
"or",
"the",
"root",
"of",
"the",
"document",
".",
"If",
"au... | train | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlHelper.java#L63-L69 |
Azure/azure-sdk-for-java | streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/FunctionsInner.java | FunctionsInner.updateAsync | public Observable<FunctionInner> updateAsync(String resourceGroupName, String jobName, String functionName, FunctionInner function, String ifMatch) {
"""
Updates an existing function under an existing streaming job. This can be used to partially update (ie. update one or two properties) a function without affectin... | java | public Observable<FunctionInner> updateAsync(String resourceGroupName, String jobName, String functionName, FunctionInner function, String ifMatch) {
return updateWithServiceResponseAsync(resourceGroupName, jobName, functionName, function, ifMatch).map(new Func1<ServiceResponseWithHeaders<FunctionInner, Functio... | [
"public",
"Observable",
"<",
"FunctionInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"jobName",
",",
"String",
"functionName",
",",
"FunctionInner",
"function",
",",
"String",
"ifMatch",
")",
"{",
"return",
"updateWithServiceResponseAsy... | Updates an existing function under an existing streaming job. This can be used to partially update (ie. update one or two properties) a function without affecting the rest the job or function definition.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from ... | [
"Updates",
"an",
"existing",
"function",
"under",
"an",
"existing",
"streaming",
"job",
".",
"This",
"can",
"be",
"used",
"to",
"partially",
"update",
"(",
"ie",
".",
"update",
"one",
"or",
"two",
"properties",
")",
"a",
"function",
"without",
"affecting",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/FunctionsInner.java#L454-L461 |
protostuff/protostuff | protostuff-msgpack/src/main/java/io/protostuff/MsgpackOutput.java | MsgpackOutput.use | public MsgpackOutput use(MsgpackGenerator generator, Schema<?> schema) {
"""
Before serializing a message/object tied to a schema, this should be called. This also resets the internal state
of this output.
"""
this.schema = schema;
this.generator = generator;
return this;
} | java | public MsgpackOutput use(MsgpackGenerator generator, Schema<?> schema)
{
this.schema = schema;
this.generator = generator;
return this;
} | [
"public",
"MsgpackOutput",
"use",
"(",
"MsgpackGenerator",
"generator",
",",
"Schema",
"<",
"?",
">",
"schema",
")",
"{",
"this",
".",
"schema",
"=",
"schema",
";",
"this",
".",
"generator",
"=",
"generator",
";",
"return",
"this",
";",
"}"
] | Before serializing a message/object tied to a schema, this should be called. This also resets the internal state
of this output. | [
"Before",
"serializing",
"a",
"message",
"/",
"object",
"tied",
"to",
"a",
"schema",
"this",
"should",
"be",
"called",
".",
"This",
"also",
"resets",
"the",
"internal",
"state",
"of",
"this",
"output",
"."
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-msgpack/src/main/java/io/protostuff/MsgpackOutput.java#L61-L66 |
resilience4j/resilience4j | resilience4j-micrometer/src/main/java/io/github/resilience4j/micrometer/CircuitBreakerMetrics.java | CircuitBreakerMetrics.ofIterable | public static CircuitBreakerMetrics ofIterable(String prefix, Iterable<CircuitBreaker> circuitBreakers) {
"""
Creates a new instance CircuitBreakerMetrics {@link CircuitBreakerMetrics} with
an {@link Iterable} of circuit breakers as a source.
@param prefix The prefix.
@param circuitBreakers the circuit
@retu... | java | public static CircuitBreakerMetrics ofIterable(String prefix, Iterable<CircuitBreaker> circuitBreakers) {
return new CircuitBreakerMetrics(circuitBreakers, prefix);
} | [
"public",
"static",
"CircuitBreakerMetrics",
"ofIterable",
"(",
"String",
"prefix",
",",
"Iterable",
"<",
"CircuitBreaker",
">",
"circuitBreakers",
")",
"{",
"return",
"new",
"CircuitBreakerMetrics",
"(",
"circuitBreakers",
",",
"prefix",
")",
";",
"}"
] | Creates a new instance CircuitBreakerMetrics {@link CircuitBreakerMetrics} with
an {@link Iterable} of circuit breakers as a source.
@param prefix The prefix.
@param circuitBreakers the circuit
@return The CircuitBreakerMetrics {@link CircuitBreakerMetrics}. | [
"Creates",
"a",
"new",
"instance",
"CircuitBreakerMetrics",
"{",
"@link",
"CircuitBreakerMetrics",
"}",
"with",
"an",
"{",
"@link",
"Iterable",
"}",
"of",
"circuit",
"breakers",
"as",
"a",
"source",
"."
] | train | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-micrometer/src/main/java/io/github/resilience4j/micrometer/CircuitBreakerMetrics.java#L77-L79 |
google/auto | value/src/main/java/com/google/auto/value/processor/AnnotationOutput.java | AnnotationOutput.sourceFormForInitializer | static String sourceFormForInitializer(
AnnotationValue annotationValue,
ProcessingEnvironment processingEnv,
String memberName,
Element context) {
"""
Returns a string representation of the given annotation value, suitable for inclusion in a Java
source file as the initializer of a variab... | java | static String sourceFormForInitializer(
AnnotationValue annotationValue,
ProcessingEnvironment processingEnv,
String memberName,
Element context) {
SourceFormVisitor visitor =
new InitializerSourceFormVisitor(processingEnv, memberName, context);
StringBuilder sb = new StringBuild... | [
"static",
"String",
"sourceFormForInitializer",
"(",
"AnnotationValue",
"annotationValue",
",",
"ProcessingEnvironment",
"processingEnv",
",",
"String",
"memberName",
",",
"Element",
"context",
")",
"{",
"SourceFormVisitor",
"visitor",
"=",
"new",
"InitializerSourceFormVisi... | Returns a string representation of the given annotation value, suitable for inclusion in a Java
source file as the initializer of a variable of the appropriate type. | [
"Returns",
"a",
"string",
"representation",
"of",
"the",
"given",
"annotation",
"value",
"suitable",
"for",
"inclusion",
"in",
"a",
"Java",
"source",
"file",
"as",
"the",
"initializer",
"of",
"a",
"variable",
"of",
"the",
"appropriate",
"type",
"."
] | train | https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/value/src/main/java/com/google/auto/value/processor/AnnotationOutput.java#L179-L189 |
Bearded-Hen/Android-Bootstrap | AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapDrawableFactory.java | BootstrapDrawableFactory.createArrowIcon | private static Drawable createArrowIcon(Context context, int width, int height, int color, ExpandDirection expandDirection) {
"""
Creates arrow icon that depends on ExpandDirection
@param context context
@param width width of icon in pixels
@param height height of icon in pixels
@param color arrow color
@p... | java | private static Drawable createArrowIcon(Context context, int width, int height, int color, ExpandDirection expandDirection) {
Bitmap canvasBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(canvasBitmap);
Paint paint = new Paint();
paint.setS... | [
"private",
"static",
"Drawable",
"createArrowIcon",
"(",
"Context",
"context",
",",
"int",
"width",
",",
"int",
"height",
",",
"int",
"color",
",",
"ExpandDirection",
"expandDirection",
")",
"{",
"Bitmap",
"canvasBitmap",
"=",
"Bitmap",
".",
"createBitmap",
"(",... | Creates arrow icon that depends on ExpandDirection
@param context context
@param width width of icon in pixels
@param height height of icon in pixels
@param color arrow color
@param expandDirection arrow direction
@return icon drawable | [
"Creates",
"arrow",
"icon",
"that",
"depends",
"on",
"ExpandDirection"
] | train | https://github.com/Bearded-Hen/Android-Bootstrap/blob/b3d62cc1847e26d420c53c92665a4fe1e6ee7ecf/AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapDrawableFactory.java#L390-L417 |
hawkular/hawkular-apm | client/opentracing/src/main/java/io/opentracing/impl/APMSpan.java | APMSpan.initFollowsFrom | protected void initFollowsFrom(APMSpanBuilder builder, TraceRecorder recorder, Reference ref, ContextSampler sampler) {
"""
This method initialises the span based on a 'follows-from' relationship.
@param builder The span builder
@param recorder The trace recorder
@param ref The 'follows-from' relationsh... | java | protected void initFollowsFrom(APMSpanBuilder builder, TraceRecorder recorder, Reference ref, ContextSampler sampler) {
APMSpan referenced = (APMSpan) ref.getReferredTo();
initTopLevelState(referenced.getTraceContext().getTopSpan(), recorder, sampler);
// Top level node in spawned fragment sho... | [
"protected",
"void",
"initFollowsFrom",
"(",
"APMSpanBuilder",
"builder",
",",
"TraceRecorder",
"recorder",
",",
"Reference",
"ref",
",",
"ContextSampler",
"sampler",
")",
"{",
"APMSpan",
"referenced",
"=",
"(",
"APMSpan",
")",
"ref",
".",
"getReferredTo",
"(",
... | This method initialises the span based on a 'follows-from' relationship.
@param builder The span builder
@param recorder The trace recorder
@param ref The 'follows-from' relationship
@param sampler The sampler | [
"This",
"method",
"initialises",
"the",
"span",
"based",
"on",
"a",
"follows",
"-",
"from",
"relationship",
"."
] | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/opentracing/src/main/java/io/opentracing/impl/APMSpan.java#L235-L250 |
schallee/alib4j | core/src/main/java/net/darkmist/alib/res/PkgRes.java | PkgRes.getFor | public static InputStream getFor(String name, Class<?> cls) {
"""
Gets a InputStream for a class's package.
@param name The name of the resource.
@param cls The class to use for the package name
@return InputStream for the resource.
@throws NullPointerException if name or cls are null.
ResourceException if th... | java | public static InputStream getFor(String name, Class<?> cls)
{
InputStream ret;
if(cls == null)
throw new NullPointerException("cls is null");
if((ret = cls.getResourceAsStream(getResourcePathFor(name,cls)))==null)
throw new ResourceException("Unable to find resource for " + name + " and " + cls);
return... | [
"public",
"static",
"InputStream",
"getFor",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"cls",
")",
"{",
"InputStream",
"ret",
";",
"if",
"(",
"cls",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"cls is null\"",
")",
";",
"i... | Gets a InputStream for a class's package.
@param name The name of the resource.
@param cls The class to use for the package name
@return InputStream for the resource.
@throws NullPointerException if name or cls are null.
ResourceException if the resource cannot be found. | [
"Gets",
"a",
"InputStream",
"for",
"a",
"class",
"s",
"package",
"."
] | train | https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/core/src/main/java/net/darkmist/alib/res/PkgRes.java#L231-L240 |
b3dgs/lionengine | lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ScreenBaseAwt.java | ScreenBaseAwt.initMainFrame | private JFrame initMainFrame() {
"""
Initialize the main frame.
@return The created main frame.
@throws LionEngineException If the engine has not been started.
"""
final String title = getTitle();
final JFrame jframe = new JFrame(title, conf);
jframe.setDefaultCloseOperation(WindowC... | java | private JFrame initMainFrame()
{
final String title = getTitle();
final JFrame jframe = new JFrame(title, conf);
jframe.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
jframe.addWindowListener(new WindowAdapter()
{
@Override
public void ... | [
"private",
"JFrame",
"initMainFrame",
"(",
")",
"{",
"final",
"String",
"title",
"=",
"getTitle",
"(",
")",
";",
"final",
"JFrame",
"jframe",
"=",
"new",
"JFrame",
"(",
"title",
",",
"conf",
")",
";",
"jframe",
".",
"setDefaultCloseOperation",
"(",
"Window... | Initialize the main frame.
@return The created main frame.
@throws LionEngineException If the engine has not been started. | [
"Initialize",
"the",
"main",
"frame",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ScreenBaseAwt.java#L75-L93 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/analyzer/AbstractNpmAnalyzer.java | AbstractNpmAnalyzer.shouldProcess | protected boolean shouldProcess(File pathname) throws AnalysisException {
"""
Determines if the path contains "/node_modules/" or "/bower_components/"
(i.e. it is a child module). This analyzer does not scan child modules.
@param pathname the path to test
@return <code>true</code> if the path does not contain... | java | protected boolean shouldProcess(File pathname) throws AnalysisException {
try {
// Do not scan the node_modules (or bower_components) directory
final String canonicalPath = pathname.getCanonicalPath();
if (canonicalPath.contains(File.separator + "node_modules" + File.separato... | [
"protected",
"boolean",
"shouldProcess",
"(",
"File",
"pathname",
")",
"throws",
"AnalysisException",
"{",
"try",
"{",
"// Do not scan the node_modules (or bower_components) directory",
"final",
"String",
"canonicalPath",
"=",
"pathname",
".",
"getCanonicalPath",
"(",
")",
... | Determines if the path contains "/node_modules/" or "/bower_components/"
(i.e. it is a child module). This analyzer does not scan child modules.
@param pathname the path to test
@return <code>true</code> if the path does not contain "/node_modules/"
or "/bower_components/"
@throws AnalysisException thrown if the canon... | [
"Determines",
"if",
"the",
"path",
"contains",
"/",
"node_modules",
"/",
"or",
"/",
"bower_components",
"/",
"(",
"i",
".",
"e",
".",
"it",
"is",
"a",
"child",
"module",
")",
".",
"This",
"analyzer",
"does",
"not",
"scan",
"child",
"modules",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/AbstractNpmAnalyzer.java#L103-L116 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/impl/internal/statistics/DefaultTierStatistics.java | DefaultTierStatistics.addIfPresent | private static <T extends Number> void addIfPresent(Map<String, ValueStatistic<?>> knownStatistics, String name, OperationStatistic<?> reference, Supplier<T> valueSupplier) {
"""
Add the statistic as a known statistic only if the reference statistic is available. We consider that the reference statistic can only b... | java | private static <T extends Number> void addIfPresent(Map<String, ValueStatistic<?>> knownStatistics, String name, OperationStatistic<?> reference, Supplier<T> valueSupplier) {
if(!(reference instanceof ZeroOperationStatistic)) {
knownStatistics.put(name, counter(valueSupplier));
}
} | [
"private",
"static",
"<",
"T",
"extends",
"Number",
">",
"void",
"addIfPresent",
"(",
"Map",
"<",
"String",
",",
"ValueStatistic",
"<",
"?",
">",
">",
"knownStatistics",
",",
"String",
"name",
",",
"OperationStatistic",
"<",
"?",
">",
"reference",
",",
"Su... | Add the statistic as a known statistic only if the reference statistic is available. We consider that the reference statistic can only be
an instance of {@code ZeroOperationStatistic} when statistics are disabled.
@param knownStatistics map of known statistics
@param name the name of the statistic to add
@param refere... | [
"Add",
"the",
"statistic",
"as",
"a",
"known",
"statistic",
"only",
"if",
"the",
"reference",
"statistic",
"is",
"available",
".",
"We",
"consider",
"that",
"the",
"reference",
"statistic",
"can",
"only",
"be",
"an",
"instance",
"of",
"{",
"@code",
"ZeroOper... | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/statistics/DefaultTierStatistics.java#L114-L118 |
xm-online/xm-commons | xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/MdcUtils.java | MdcUtils.generateRid | public static String generateRid() {
"""
Generates request id based on UID and SHA-256.
@return request identity
"""
byte[] encode = Base64.getEncoder().encode(DigestUtils.sha256(UUID.randomUUID().toString()));
try {
String rid = new String(encode, StandardCharsets.UTF_8.name());... | java | public static String generateRid() {
byte[] encode = Base64.getEncoder().encode(DigestUtils.sha256(UUID.randomUUID().toString()));
try {
String rid = new String(encode, StandardCharsets.UTF_8.name());
rid = StringUtils.replaceChars(rid, "+/=", "");
return StringUtils.... | [
"public",
"static",
"String",
"generateRid",
"(",
")",
"{",
"byte",
"[",
"]",
"encode",
"=",
"Base64",
".",
"getEncoder",
"(",
")",
".",
"encode",
"(",
"DigestUtils",
".",
"sha256",
"(",
"UUID",
".",
"randomUUID",
"(",
")",
".",
"toString",
"(",
")",
... | Generates request id based on UID and SHA-256.
@return request identity | [
"Generates",
"request",
"id",
"based",
"on",
"UID",
"and",
"SHA",
"-",
"256",
"."
] | train | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/MdcUtils.java#L82-L91 |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/GenderRatioProcessor.java | GenderRatioProcessor.containsValue | private boolean containsValue(StatementGroup statementGroup, Value value) {
"""
Checks if the given group of statements contains the given value as the
value of a main snak of some statement.
@param statementGroup
the statement group to scan
@param value
the value to scan for
@return true if value was foun... | java | private boolean containsValue(StatementGroup statementGroup, Value value) {
for (Statement s : statementGroup) {
if (value.equals(s.getValue())) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"containsValue",
"(",
"StatementGroup",
"statementGroup",
",",
"Value",
"value",
")",
"{",
"for",
"(",
"Statement",
"s",
":",
"statementGroup",
")",
"{",
"if",
"(",
"value",
".",
"equals",
"(",
"s",
".",
"getValue",
"(",
")",
")",
"... | Checks if the given group of statements contains the given value as the
value of a main snak of some statement.
@param statementGroup
the statement group to scan
@param value
the value to scan for
@return true if value was found | [
"Checks",
"if",
"the",
"given",
"group",
"of",
"statements",
"contains",
"the",
"given",
"value",
"as",
"the",
"value",
"of",
"a",
"main",
"snak",
"of",
"some",
"statement",
"."
] | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/GenderRatioProcessor.java#L397-L405 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Exceptions.java | Exceptions.RuntimeAssertion | public static RuntimeAssertion RuntimeAssertion(Throwable cause,
String pattern, Object... parameters) {
"""
Generate a {@link RuntimeAssertion}
@param cause
Existing {@link Throwable} to wrap in a new
{@code IllegalArgumentException}
@param pattern
{@link String#format(String, Object...) String... | java | public static RuntimeAssertion RuntimeAssertion(Throwable cause,
String pattern, Object... parameters) {
return strip(new RuntimeAssertion(String.format(pattern, parameters),
cause));
} | [
"public",
"static",
"RuntimeAssertion",
"RuntimeAssertion",
"(",
"Throwable",
"cause",
",",
"String",
"pattern",
",",
"Object",
"...",
"parameters",
")",
"{",
"return",
"strip",
"(",
"new",
"RuntimeAssertion",
"(",
"String",
".",
"format",
"(",
"pattern",
",",
... | Generate a {@link RuntimeAssertion}
@param cause
Existing {@link Throwable} to wrap in a new
{@code IllegalArgumentException}
@param pattern
{@link String#format(String, Object...) String.format()}
pattern
@param parameters
{@code String.format()} parameters
@return A new {@code IllegalArgumentException} | [
"Generate",
"a",
"{",
"@link",
"RuntimeAssertion",
"}"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Exceptions.java#L89-L93 |
paypal/SeLion | server/src/main/java/com/paypal/selion/grid/FileDownloader.java | FileDownloader.checkForDownloads | static void checkForDownloads(InstanceType instanceType, boolean checkTimeStamp, boolean cleanup) {
"""
Check download.json and download files based on {@link InstanceType}
@param instanceType
the {@link InstanceType} to process downlaods for
@param checkTimeStamp
whether to check the last modified time stam... | java | static void checkForDownloads(InstanceType instanceType, boolean checkTimeStamp, boolean cleanup) {
LOGGER.entering();
if (checkTimeStamp && (lastModifiedTime == DOWNLOAD_FILE.lastModified())) {
return;
}
lastModifiedTime = DOWNLOAD_FILE.lastModified();
if (cleanup)... | [
"static",
"void",
"checkForDownloads",
"(",
"InstanceType",
"instanceType",
",",
"boolean",
"checkTimeStamp",
",",
"boolean",
"cleanup",
")",
"{",
"LOGGER",
".",
"entering",
"(",
")",
";",
"if",
"(",
"checkTimeStamp",
"&&",
"(",
"lastModifiedTime",
"==",
"DOWNLO... | Check download.json and download files based on {@link InstanceType}
@param instanceType
the {@link InstanceType} to process downlaods for
@param checkTimeStamp
whether to check the last modified time stamp of the downlaod.json file. Returns immediately on
subsequent calls if <code>true</code> and last modified is unc... | [
"Check",
"download",
".",
"json",
"and",
"download",
"files",
"based",
"on",
"{",
"@link",
"InstanceType",
"}"
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/grid/FileDownloader.java#L173-L196 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java | HtmlTree.HEADING | public static HtmlTree HEADING(HtmlTag headingTag, HtmlStyle styleClass, Content body) {
"""
Generates a heading tag (h1 to h6) with style class attribute. It also encloses
a content.
@param headingTag the heading tag to be generated
@param styleClass stylesheet class for the tag
@param body content for the ... | java | public static HtmlTree HEADING(HtmlTag headingTag, HtmlStyle styleClass, Content body) {
return HEADING(headingTag, false, styleClass, body);
} | [
"public",
"static",
"HtmlTree",
"HEADING",
"(",
"HtmlTag",
"headingTag",
",",
"HtmlStyle",
"styleClass",
",",
"Content",
"body",
")",
"{",
"return",
"HEADING",
"(",
"headingTag",
",",
"false",
",",
"styleClass",
",",
"body",
")",
";",
"}"
] | Generates a heading tag (h1 to h6) with style class attribute. It also encloses
a content.
@param headingTag the heading tag to be generated
@param styleClass stylesheet class for the tag
@param body content for the tag
@return an HtmlTree object for the tag | [
"Generates",
"a",
"heading",
"tag",
"(",
"h1",
"to",
"h6",
")",
"with",
"style",
"class",
"attribute",
".",
"It",
"also",
"encloses",
"a",
"content",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L413-L415 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/wrapper/json/PJsonArray.java | PJsonArray.getBool | @Override
public final boolean getBool(final int i) {
"""
Get the element as a boolean.
@param i the index of the element to access
"""
try {
return this.array.getBoolean(i);
} catch (JSONException e) {
throw new ObjectMissingException(this, "[" + i + "]");
... | java | @Override
public final boolean getBool(final int i) {
try {
return this.array.getBoolean(i);
} catch (JSONException e) {
throw new ObjectMissingException(this, "[" + i + "]");
}
} | [
"@",
"Override",
"public",
"final",
"boolean",
"getBool",
"(",
"final",
"int",
"i",
")",
"{",
"try",
"{",
"return",
"this",
".",
"array",
".",
"getBoolean",
"(",
"i",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
")",
"{",
"throw",
"new",
"Objec... | Get the element as a boolean.
@param i the index of the element to access | [
"Get",
"the",
"element",
"as",
"a",
"boolean",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/json/PJsonArray.java#L162-L169 |
Chorus-bdd/Chorus | interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/StepProcessor.java | StepProcessor.runSteps | public StepEndState runSteps(ExecutionToken executionToken, StepInvokerProvider stepInvokerProvider, List<StepToken> stepList, StepCatalogue stepCatalogue, boolean skip) {
"""
Process all steps in stepList
@param skip, do not actually execute (but mark as skipped if not unimplemented)
@return a StepEndState ... | java | public StepEndState runSteps(ExecutionToken executionToken, StepInvokerProvider stepInvokerProvider, List<StepToken> stepList, StepCatalogue stepCatalogue, boolean skip) {
for (StepToken step : stepList) {
StepEndState endState = processStep(executionToken, stepInvokerProvider, step, stepCatalogue,... | [
"public",
"StepEndState",
"runSteps",
"(",
"ExecutionToken",
"executionToken",
",",
"StepInvokerProvider",
"stepInvokerProvider",
",",
"List",
"<",
"StepToken",
">",
"stepList",
",",
"StepCatalogue",
"stepCatalogue",
",",
"boolean",
"skip",
")",
"{",
"for",
"(",
"St... | Process all steps in stepList
@param skip, do not actually execute (but mark as skipped if not unimplemented)
@return a StepEndState is the StepMacro step's end state, if these steps are executed as part of a StepMacro rather than scenario | [
"Process",
"all",
"steps",
"in",
"stepList"
] | train | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/StepProcessor.java#L84-L114 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/run/Parameters.java | Parameters.setDefaults | public Parameters setDefaults(Parameters defaultParameters, boolean recursive) {
"""
Set default values from specified Parameters and returns a new Parameters
object.
@param defaultParameters Parameters with default parameter values.
@param recursive (optional) true to perform deep copy, and false for... | java | public Parameters setDefaults(Parameters defaultParameters, boolean recursive) {
Parameters result = new Parameters();
if (recursive) {
RecursiveObjectWriter.copyProperties(result, defaultParameters);
RecursiveObjectWriter.copyProperties(result, this);
} else {
ObjectWriter.setProperties(result, defaultP... | [
"public",
"Parameters",
"setDefaults",
"(",
"Parameters",
"defaultParameters",
",",
"boolean",
"recursive",
")",
"{",
"Parameters",
"result",
"=",
"new",
"Parameters",
"(",
")",
";",
"if",
"(",
"recursive",
")",
"{",
"RecursiveObjectWriter",
".",
"copyProperties",... | Set default values from specified Parameters and returns a new Parameters
object.
@param defaultParameters Parameters with default parameter values.
@param recursive (optional) true to perform deep copy, and false for
shallow copy. Default: false
@return a new Parameters object. | [
"Set",
"default",
"values",
"from",
"specified",
"Parameters",
"and",
"returns",
"a",
"new",
"Parameters",
"object",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/run/Parameters.java#L189-L199 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/AnalyticsItemsInner.java | AnalyticsItemsInner.getAsync | public Observable<ApplicationInsightsComponentAnalyticsItemInner> getAsync(String resourceGroupName, String resourceName, ItemScopePath scopePath, String id, String name) {
"""
Gets a specific Analytics Items defined within an Application Insights component.
@param resourceGroupName The name of the resource gro... | java | public Observable<ApplicationInsightsComponentAnalyticsItemInner> getAsync(String resourceGroupName, String resourceName, ItemScopePath scopePath, String id, String name) {
return getWithServiceResponseAsync(resourceGroupName, resourceName, scopePath, id, name).map(new Func1<ServiceResponse<ApplicationInsightsC... | [
"public",
"Observable",
"<",
"ApplicationInsightsComponentAnalyticsItemInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"ItemScopePath",
"scopePath",
",",
"String",
"id",
",",
"String",
"name",
")",
"{",
"return",
"getWi... | Gets a specific Analytics Items defined within an Application Insights component.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param scopePath Enum indicating if this item definition is owned by a specific user or is shared betwe... | [
"Gets",
"a",
"specific",
"Analytics",
"Items",
"defined",
"within",
"an",
"Application",
"Insights",
"component",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/AnalyticsItemsInner.java#L406-L413 |
apache/incubator-gobblin | gobblin-compaction/src/main/java/org/apache/gobblin/compaction/verify/CompactionThresholdVerifier.java | CompactionThresholdVerifier.verify | public Result verify (FileSystemDataset dataset) {
"""
There are two record count we are comparing here
1) The new record count in the input folder
2) The record count we compacted previously from last run
Calculate two numbers difference and compare with a predefined threshold.
(Alternatively we can save th... | java | public Result verify (FileSystemDataset dataset) {
Map<String, Double> thresholdMap = RecompactionConditionBasedOnRatio.
getDatasetRegexAndRecompactThreshold (state.getProp(MRCompactor.COMPACTION_LATEDATA_THRESHOLD_FOR_RECOMPACT_PER_DATASET,
StringUtils.EMPTY));
CompactionPathP... | [
"public",
"Result",
"verify",
"(",
"FileSystemDataset",
"dataset",
")",
"{",
"Map",
"<",
"String",
",",
"Double",
">",
"thresholdMap",
"=",
"RecompactionConditionBasedOnRatio",
".",
"getDatasetRegexAndRecompactThreshold",
"(",
"state",
".",
"getProp",
"(",
"MRCompacto... | There are two record count we are comparing here
1) The new record count in the input folder
2) The record count we compacted previously from last run
Calculate two numbers difference and compare with a predefined threshold.
(Alternatively we can save the previous record count to a state store. However each input
fold... | [
"There",
"are",
"two",
"record",
"count",
"we",
"are",
"comparing",
"here",
"1",
")",
"The",
"new",
"record",
"count",
"in",
"the",
"input",
"folder",
"2",
")",
"The",
"record",
"count",
"we",
"compacted",
"previously",
"from",
"last",
"run",
"Calculate",
... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/verify/CompactionThresholdVerifier.java#L64-L92 |
GII/broccoli | broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owl/OWLValueObject.java | OWLValueObject.buildFromOWLValueAndClass | private static OWLValueObject buildFromOWLValueAndClass(OWLModel model, OWLValue value, Class clas) throws NotYetImplementedException, OWLTranslationException {
"""
Builds an instance
@param model
@param value
@param clas
@return
@throws NotYetImplementedException
@throws OWLTranslationException
"""
... | java | private static OWLValueObject buildFromOWLValueAndClass(OWLModel model, OWLValue value, Class clas) throws NotYetImplementedException, OWLTranslationException {
Object objectValue = ObjectOWLSTranslator.jenaResourceToBean(
model,
(ResourceImpl) value.getImplementation(),
... | [
"private",
"static",
"OWLValueObject",
"buildFromOWLValueAndClass",
"(",
"OWLModel",
"model",
",",
"OWLValue",
"value",
",",
"Class",
"clas",
")",
"throws",
"NotYetImplementedException",
",",
"OWLTranslationException",
"{",
"Object",
"objectValue",
"=",
"ObjectOWLSTransla... | Builds an instance
@param model
@param value
@param clas
@return
@throws NotYetImplementedException
@throws OWLTranslationException | [
"Builds",
"an",
"instance"
] | train | https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owl/OWLValueObject.java#L231-L237 |
bushidowallet/bushido-java-service | bushido-wallet-service/src/main/java/com/bitcoin/blockchain/api/service/v2wallet/V2Wallet.java | V2Wallet.newTransactionHandler | public void newTransactionHandler(PersistedTransaction tx, PersistedV2Key key) throws Exception {
"""
New transaction handler, incoming funds only based on BIP32 derived key
@param tx - incoming funds transaction
@param key - related V2Key
@throws Exception
"""
listenForUpdates(tx);
tx.key... | java | public void newTransactionHandler(PersistedTransaction tx, PersistedV2Key key) throws Exception {
listenForUpdates(tx);
tx.keyId = key.getId();
tx.walletId = this.descriptor.getKey();
tx.account = key.account;
System.out.println("Incoming transaction captured in API service: " + ... | [
"public",
"void",
"newTransactionHandler",
"(",
"PersistedTransaction",
"tx",
",",
"PersistedV2Key",
"key",
")",
"throws",
"Exception",
"{",
"listenForUpdates",
"(",
"tx",
")",
";",
"tx",
".",
"keyId",
"=",
"key",
".",
"getId",
"(",
")",
";",
"tx",
".",
"w... | New transaction handler, incoming funds only based on BIP32 derived key
@param tx - incoming funds transaction
@param key - related V2Key
@throws Exception | [
"New",
"transaction",
"handler",
"incoming",
"funds",
"only",
"based",
"on",
"BIP32",
"derived",
"key"
] | train | https://github.com/bushidowallet/bushido-java-service/blob/e1a0157527e57459b509718044d2df44084876a2/bushido-wallet-service/src/main/java/com/bitcoin/blockchain/api/service/v2wallet/V2Wallet.java#L206-L219 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.installationTemplate_templateName_partitionScheme_schemeName_hardwareRaid_POST | public void installationTemplate_templateName_partitionScheme_schemeName_hardwareRaid_POST(String templateName, String schemeName, String[] disks, OvhTemplateOsHardwareRaidEnum mode, String name, Long step) throws IOException {
"""
Add an hardware RAID in this partitioning scheme
REST: POST /me/installationTemp... | java | public void installationTemplate_templateName_partitionScheme_schemeName_hardwareRaid_POST(String templateName, String schemeName, String[] disks, OvhTemplateOsHardwareRaidEnum mode, String name, Long step) throws IOException {
String qPath = "/me/installationTemplate/{templateName}/partitionScheme/{schemeName}/hardw... | [
"public",
"void",
"installationTemplate_templateName_partitionScheme_schemeName_hardwareRaid_POST",
"(",
"String",
"templateName",
",",
"String",
"schemeName",
",",
"String",
"[",
"]",
"disks",
",",
"OvhTemplateOsHardwareRaidEnum",
"mode",
",",
"String",
"name",
",",
"Long"... | Add an hardware RAID in this partitioning scheme
REST: POST /me/installationTemplate/{templateName}/partitionScheme/{schemeName}/hardwareRaid
@param step [required] Specifies the creation order of the hardware RAID
@param disks [required] Disk list. Syntax is cX:dY for disks and [cX:dY, cX:dY] for groups. With X and Y... | [
"Add",
"an",
"hardware",
"RAID",
"in",
"this",
"partitioning",
"scheme"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L3569-L3578 |
threerings/nenya | core/src/main/java/com/threerings/media/animation/FloatingTextAnimation.java | FloatingTextAnimation.paintLabels | protected void paintLabels (Graphics2D gfx, int x, int y) {
"""
Derived classes may wish to extend score animation and render more than just the standard
single label.
@param x the upper left coordinate of the animation.
@param y the upper left coordinate of the animation.
"""
_label.render(gfx, x... | java | protected void paintLabels (Graphics2D gfx, int x, int y)
{
_label.render(gfx, x, y);
} | [
"protected",
"void",
"paintLabels",
"(",
"Graphics2D",
"gfx",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"_label",
".",
"render",
"(",
"gfx",
",",
"x",
",",
"y",
")",
";",
"}"
] | Derived classes may wish to extend score animation and render more than just the standard
single label.
@param x the upper left coordinate of the animation.
@param y the upper left coordinate of the animation. | [
"Derived",
"classes",
"may",
"wish",
"to",
"extend",
"score",
"animation",
"and",
"render",
"more",
"than",
"just",
"the",
"standard",
"single",
"label",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/animation/FloatingTextAnimation.java#L195-L198 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/AbstractRedisClient.java | AbstractRedisClient.shutdownAsync | @SuppressWarnings("rawtypes")
public CompletableFuture<Void> shutdownAsync(long quietPeriod, long timeout, TimeUnit timeUnit) {
"""
Shutdown this client and close all open connections asynchronously. The client should be discarded after calling
shutdown.
@param quietPeriod the quiet period as described in ... | java | @SuppressWarnings("rawtypes")
public CompletableFuture<Void> shutdownAsync(long quietPeriod, long timeout, TimeUnit timeUnit) {
if (shutdown.compareAndSet(false, true)) {
logger.debug("Initiate shutdown ({}, {}, {})", quietPeriod, timeout, timeUnit);
return closeResources().thenCom... | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"CompletableFuture",
"<",
"Void",
">",
"shutdownAsync",
"(",
"long",
"quietPeriod",
",",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"if",
"(",
"shutdown",
".",
"compareAndSet",
"(",
"f... | Shutdown this client and close all open connections asynchronously. The client should be discarded after calling
shutdown.
@param quietPeriod the quiet period as described in the documentation
@param timeout the maximum amount of time to wait until the executor is shutdown regardless if a task was submitted
during the... | [
"Shutdown",
"this",
"client",
"and",
"close",
"all",
"open",
"connections",
"asynchronously",
".",
"The",
"client",
"should",
"be",
"discarded",
"after",
"calling",
"shutdown",
"."
] | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/AbstractRedisClient.java#L431-L441 |
beanshell/beanshell | src/main/java/bsh/org/objectweb/asm/SymbolTable.java | SymbolTable.addConstantLong | private void addConstantLong(final int index, final int tag, final long value) {
"""
Adds a new CONSTANT_Double_info to the constant pool of this symbol table.
@param index the constant pool index of the new Symbol.
@param tag one of {@link Symbol#CONSTANT_LONG_TAG} or {@link Symbol#CONSTANT_DOUBLE_TAG}.
@par... | java | private void addConstantLong(final int index, final int tag, final long value) {
add(new Entry(index, tag, value, hash(tag, value)));
} | [
"private",
"void",
"addConstantLong",
"(",
"final",
"int",
"index",
",",
"final",
"int",
"tag",
",",
"final",
"long",
"value",
")",
"{",
"add",
"(",
"new",
"Entry",
"(",
"index",
",",
"tag",
",",
"value",
",",
"hash",
"(",
"tag",
",",
"value",
")",
... | Adds a new CONSTANT_Double_info to the constant pool of this symbol table.
@param index the constant pool index of the new Symbol.
@param tag one of {@link Symbol#CONSTANT_LONG_TAG} or {@link Symbol#CONSTANT_DOUBLE_TAG}.
@param value a long or double. | [
"Adds",
"a",
"new",
"CONSTANT_Double_info",
"to",
"the",
"constant",
"pool",
"of",
"this",
"symbol",
"table",
"."
] | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/org/objectweb/asm/SymbolTable.java#L572-L574 |
Cleveroad/AdaptiveTableLayout | sample/src/main/java/com/cleveroad/sample/utils/FileUtils.java | FileUtils.createTempFile | @SuppressWarnings("ResultOfMethodCallIgnored, unused")
public static File createTempFile(Context context) {
"""
Create temp file file.
@param context the context
@return the file
"""
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmssSSS", Locale.US).format(new Date());
String temp... | java | @SuppressWarnings("ResultOfMethodCallIgnored, unused")
public static File createTempFile(Context context) {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmssSSS", Locale.US).format(new Date());
String tempFileName = PREFIX + timeStamp + "_";
File cacheDir = context.getCacheDir();
... | [
"@",
"SuppressWarnings",
"(",
"\"ResultOfMethodCallIgnored, unused\"",
")",
"public",
"static",
"File",
"createTempFile",
"(",
"Context",
"context",
")",
"{",
"String",
"timeStamp",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyyMMdd_HHmmssSSS\"",
",",
"Locale",
".",
"US... | Create temp file file.
@param context the context
@return the file | [
"Create",
"temp",
"file",
"file",
"."
] | train | https://github.com/Cleveroad/AdaptiveTableLayout/blob/188213b35e05e635497b03fe741799782dde7208/sample/src/main/java/com/cleveroad/sample/utils/FileUtils.java#L52-L61 |
uber/tchannel-java | tchannel-core/src/main/java/com/uber/tchannel/api/SubChannel.java | SubChannel.register | public @NotNull SubChannel register(@NotNull String endpoint, @NotNull RequestHandler requestHandler) {
"""
Add a handler for a named endpoint. None of the parameters can be null.
@param endpoint name of endpoint
@param requestHandler request handler
@return same object (this)
"""
requestHandlers.pu... | java | public @NotNull SubChannel register(@NotNull String endpoint, @NotNull RequestHandler requestHandler) {
requestHandlers.put(endpoint, requestHandler);
return this;
} | [
"public",
"@",
"NotNull",
"SubChannel",
"register",
"(",
"@",
"NotNull",
"String",
"endpoint",
",",
"@",
"NotNull",
"RequestHandler",
"requestHandler",
")",
"{",
"requestHandlers",
".",
"put",
"(",
"endpoint",
",",
"requestHandler",
")",
";",
"return",
"this",
... | Add a handler for a named endpoint. None of the parameters can be null.
@param endpoint name of endpoint
@param requestHandler request handler
@return same object (this) | [
"Add",
"a",
"handler",
"for",
"a",
"named",
"endpoint",
".",
"None",
"of",
"the",
"parameters",
"can",
"be",
"null",
"."
] | train | https://github.com/uber/tchannel-java/blob/009cf1e6decc9bbd2daf90eb3401b13c03bfc7e1/tchannel-core/src/main/java/com/uber/tchannel/api/SubChannel.java#L102-L105 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/spatial/geometry/LineString.java | LineString.getCentroid | public Coordinate getCentroid() {
"""
The centroid is also known as the "center of gravity" or the "center of mass".
@return Return the center point.
"""
if (isEmpty()) {
return null;
}
double sumX = 0;
double sumY = 0;
double totalLength = 0;
for (int i = 0; i < coordinates.length - 1; i++) ... | java | public Coordinate getCentroid() {
if (isEmpty()) {
return null;
}
double sumX = 0;
double sumY = 0;
double totalLength = 0;
for (int i = 0; i < coordinates.length - 1; i++) {
double length = coordinates[i].distance(coordinates[i + 1]);
totalLength += length;
double midx = (coordinates[i].getX() ... | [
"public",
"Coordinate",
"getCentroid",
"(",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"double",
"sumX",
"=",
"0",
";",
"double",
"sumY",
"=",
"0",
";",
"double",
"totalLength",
"=",
"0",
";",
"for",
"(",
"int",... | The centroid is also known as the "center of gravity" or the "center of mass".
@return Return the center point. | [
"The",
"centroid",
"is",
"also",
"known",
"as",
"the",
"center",
"of",
"gravity",
"or",
"the",
"center",
"of",
"mass",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/LineString.java#L168-L184 |
codegist/crest | integration/server/src/main/java/org/codegist/crest/server/utils/AuthException.java | AuthException.toResponse | public static Response toResponse(Response.Status status, String wwwAuthHeader) {
"""
Maps this exception to a response object.
@return Response this exception maps to.
"""
Response.ResponseBuilder rb = Response.status(status);
if (wwwAuthHeader != null) {
rb.header("WWW-Authenti... | java | public static Response toResponse(Response.Status status, String wwwAuthHeader) {
Response.ResponseBuilder rb = Response.status(status);
if (wwwAuthHeader != null) {
rb.header("WWW-Authenticate", wwwAuthHeader);
}
return rb.build();
} | [
"public",
"static",
"Response",
"toResponse",
"(",
"Response",
".",
"Status",
"status",
",",
"String",
"wwwAuthHeader",
")",
"{",
"Response",
".",
"ResponseBuilder",
"rb",
"=",
"Response",
".",
"status",
"(",
"status",
")",
";",
"if",
"(",
"wwwAuthHeader",
"... | Maps this exception to a response object.
@return Response this exception maps to. | [
"Maps",
"this",
"exception",
"to",
"a",
"response",
"object",
"."
] | train | https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/integration/server/src/main/java/org/codegist/crest/server/utils/AuthException.java#L41-L47 |
alkacon/opencms-core | src/org/opencms/i18n/CmsResourceBundleLoader.java | CmsResourceBundleLoader.tryBundle | private static ResourceBundle tryBundle(String baseName, Locale locale, boolean wantBase) {
"""
Tries to load a the bundle for a given locale, also loads the backup
locales with the same language.
@param baseName the raw bundle name, without locale qualifiers
@param locale the locale
@param wantBase whether ... | java | private static ResourceBundle tryBundle(String baseName, Locale locale, boolean wantBase) {
I_CmsResourceBundle first = null; // The most specialized bundle.
I_CmsResourceBundle last = null; // The least specialized bundle.
List<String> bundleNames = CmsLocaleManager.getLocaleVariants(baseName... | [
"private",
"static",
"ResourceBundle",
"tryBundle",
"(",
"String",
"baseName",
",",
"Locale",
"locale",
",",
"boolean",
"wantBase",
")",
"{",
"I_CmsResourceBundle",
"first",
"=",
"null",
";",
"// The most specialized bundle.",
"I_CmsResourceBundle",
"last",
"=",
"null... | Tries to load a the bundle for a given locale, also loads the backup
locales with the same language.
@param baseName the raw bundle name, without locale qualifiers
@param locale the locale
@param wantBase whether a resource bundle made only from the base name
(with no locale information attached) should be returned.
@... | [
"Tries",
"to",
"load",
"a",
"the",
"bundle",
"for",
"a",
"given",
"locale",
"also",
"loads",
"the",
"backup",
"locales",
"with",
"the",
"same",
"language",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsResourceBundleLoader.java#L424-L450 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/word/TfIdf.java | TfIdf.tfIdf | public static <TERM> Map<TERM, Double> tfIdf(Map<TERM, Double> tf, Map<TERM, Double> idf) {
"""
计算文档的tf-idf(不正规化)
@param tf 词频
@param idf 倒排频率
@param <TERM> 词语类型
@return 一个词语->tf-idf的Map
"""
return tfIdf(tf, idf, Normalization.NONE);
} | java | public static <TERM> Map<TERM, Double> tfIdf(Map<TERM, Double> tf, Map<TERM, Double> idf)
{
return tfIdf(tf, idf, Normalization.NONE);
} | [
"public",
"static",
"<",
"TERM",
">",
"Map",
"<",
"TERM",
",",
"Double",
">",
"tfIdf",
"(",
"Map",
"<",
"TERM",
",",
"Double",
">",
"tf",
",",
"Map",
"<",
"TERM",
",",
"Double",
">",
"idf",
")",
"{",
"return",
"tfIdf",
"(",
"tf",
",",
"idf",
",... | 计算文档的tf-idf(不正规化)
@param tf 词频
@param idf 倒排频率
@param <TERM> 词语类型
@return 一个词语->tf-idf的Map | [
"计算文档的tf",
"-",
"idf(不正规化)"
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word/TfIdf.java#L217-L220 |
citrusframework/citrus | modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java | SeleniumBrowser.storeFile | public String storeFile(Resource file) {
"""
Deploy resource object from resource folder and return path of deployed
file
@param file Resource to deploy to temporary storage
@return String containing the filename to which the file is uploaded to.
"""
try {
File newFile = new File(tempo... | java | public String storeFile(Resource file) {
try {
File newFile = new File(temporaryStorage.toFile(), file.getFilename());
log.info("Store file " + file + " to " + newFile);
FileUtils.copyFile(file.getFile(), newFile);
return newFile.getCanonicalPath();
} c... | [
"public",
"String",
"storeFile",
"(",
"Resource",
"file",
")",
"{",
"try",
"{",
"File",
"newFile",
"=",
"new",
"File",
"(",
"temporaryStorage",
".",
"toFile",
"(",
")",
",",
"file",
".",
"getFilename",
"(",
")",
")",
";",
"log",
".",
"info",
"(",
"\"... | Deploy resource object from resource folder and return path of deployed
file
@param file Resource to deploy to temporary storage
@return String containing the filename to which the file is uploaded to. | [
"Deploy",
"resource",
"object",
"from",
"resource",
"folder",
"and",
"return",
"path",
"of",
"deployed",
"file"
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java#L161-L173 |
marklogic/java-client-api | marklogic-client-api/src/main/java/com/marklogic/client/datamovement/impl/QueryBatcherImpl.java | QueryBatcherImpl.retryListener | @Override
public void retryListener(QueryBatch batch, QueryBatchListener queryBatchListener) {
"""
/*
Accepts a QueryBatch which was successfully retrieved from the server and a
QueryBatchListener which was failed to apply and retry that listener on the batch.
"""
// We get the batch and modify the cli... | java | @Override
public void retryListener(QueryBatch batch, QueryBatchListener queryBatchListener) {
// We get the batch and modify the client alone in order to make use
// of the new forest client in case if the original host is unavailable.
DatabaseClient client = null;
Forest[] forests = batch.getBatcher... | [
"@",
"Override",
"public",
"void",
"retryListener",
"(",
"QueryBatch",
"batch",
",",
"QueryBatchListener",
"queryBatchListener",
")",
"{",
"// We get the batch and modify the client alone in order to make use",
"// of the new forest client in case if the original host is unavailable.",
... | /*
Accepts a QueryBatch which was successfully retrieved from the server and a
QueryBatchListener which was failed to apply and retry that listener on the batch. | [
"/",
"*",
"Accepts",
"a",
"QueryBatch",
"which",
"was",
"successfully",
"retrieved",
"from",
"the",
"server",
"and",
"a",
"QueryBatchListener",
"which",
"was",
"failed",
"to",
"apply",
"and",
"retry",
"that",
"listener",
"on",
"the",
"batch",
"."
] | train | https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/datamovement/impl/QueryBatcherImpl.java#L201-L225 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.sortPageAll | @SafeVarargs
public static <T> List<T> sortPageAll(int pageNo, int pageSize, Comparator<T> comparator, Collection<T>... colls) {
"""
将多个集合排序并显示不同的段落(分页)<br>
采用{@link BoundedPriorityQueue}实现分页取局部
@param <T> 集合元素类型
@param pageNo 页码,从1开始计数,0和1效果相同
@param pageSize 每页的条目数
@param comparator 比较器
@param colls 集合... | java | @SafeVarargs
public static <T> List<T> sortPageAll(int pageNo, int pageSize, Comparator<T> comparator, Collection<T>... colls) {
final List<T> list = new ArrayList<>(pageNo * pageSize);
for (Collection<T> coll : colls) {
list.addAll(coll);
}
if (null != comparator) {
Collections.sort(list, compara... | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"sortPageAll",
"(",
"int",
"pageNo",
",",
"int",
"pageSize",
",",
"Comparator",
"<",
"T",
">",
"comparator",
",",
"Collection",
"<",
"T",
">",
"...",
"colls",
")",
"{",
"fi... | 将多个集合排序并显示不同的段落(分页)<br>
采用{@link BoundedPriorityQueue}实现分页取局部
@param <T> 集合元素类型
@param pageNo 页码,从1开始计数,0和1效果相同
@param pageSize 每页的条目数
@param comparator 比较器
@param colls 集合数组
@return 分页后的段落内容 | [
"将多个集合排序并显示不同的段落(分页)<br",
">",
"采用",
"{",
"@link",
"BoundedPriorityQueue",
"}",
"实现分页取局部"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L2030-L2041 |
ist-dresden/composum | sling/core/commons/src/main/java/com/composum/sling/core/util/ResponseUtil.java | ResponseUtil.writeJsonProperty | public static void writeJsonProperty(SlingHttpServletResponse response, Node node, String name)
throws RepositoryException, IOException {
"""
Write one JCR property as JSON object back using the writer of the response (used for GET and PUT).
@param response the HTTP response with the writer
@param ... | java | public static void writeJsonProperty(SlingHttpServletResponse response, Node node, String name)
throws RepositoryException, IOException {
JsonWriter jsonWriter = getJsonWriter(response);
javax.jcr.Property property = node.getProperty(name);
if (property != null) {
JsonU... | [
"public",
"static",
"void",
"writeJsonProperty",
"(",
"SlingHttpServletResponse",
"response",
",",
"Node",
"node",
",",
"String",
"name",
")",
"throws",
"RepositoryException",
",",
"IOException",
"{",
"JsonWriter",
"jsonWriter",
"=",
"getJsonWriter",
"(",
"response",
... | Write one JCR property as JSON object back using the writer of the response (used for GET and PUT).
@param response the HTTP response with the writer
@param node the JCR node of the referenced resource
@param name the name of the property requested
@throws RepositoryException error on accessing JCR
@throws IOE... | [
"Write",
"one",
"JCR",
"property",
"as",
"JSON",
"object",
"back",
"using",
"the",
"writer",
"of",
"the",
"response",
"(",
"used",
"for",
"GET",
"and",
"PUT",
")",
"."
] | train | https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/ResponseUtil.java#L90-L99 |
tempodb/tempodb-java | src/main/java/com/tempodb/Client.java | Client.writeDataPoints | public Result<Void> writeDataPoints(Series series, List<DataPoint> data) {
"""
Writes datapoints to single Series.
@param series The series to write to.
@param data A list of datapoints
@return {@link Void}
@see DataPoint
@see Void
@since 1.0.0
"""
checkNotNull(series);
checkNotNull(data);
... | java | public Result<Void> writeDataPoints(Series series, List<DataPoint> data) {
checkNotNull(series);
checkNotNull(data);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/data/", API_VERSION, urlencode(series.getKey())));
uri = builder.build();
} cat... | [
"public",
"Result",
"<",
"Void",
">",
"writeDataPoints",
"(",
"Series",
"series",
",",
"List",
"<",
"DataPoint",
">",
"data",
")",
"{",
"checkNotNull",
"(",
"series",
")",
";",
"checkNotNull",
"(",
"data",
")",
";",
"URI",
"uri",
"=",
"null",
";",
"try... | Writes datapoints to single Series.
@param series The series to write to.
@param data A list of datapoints
@return {@link Void}
@see DataPoint
@see Void
@since 1.0.0 | [
"Writes",
"datapoints",
"to",
"single",
"Series",
"."
] | train | https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L1002-L1028 |
apereo/cas | support/cas-server-support-couchdb-service-registry/src/main/java/org/apereo/cas/couchdb/services/RegisteredServiceCouchDbRepository.java | RegisteredServiceCouchDbRepository.findByServiceName | @View(name = "by_serviceName", map = "function(doc) {
"""
Implements search by service name.
@param serviceName The service name of the service to find.
@return The service found or +null+.
""" if (doc.service) { emit(doc.service.name, doc._id) }}")
public RegisteredServiceDocument findByServiceName(fi... | java | @View(name = "by_serviceName", map = "function(doc) { if (doc.service) { emit(doc.service.name, doc._id) }}")
public RegisteredServiceDocument findByServiceName(final String serviceName) {
try {
return queryView("by_serviceName", serviceName).stream().findFirst().orElse(null);
} catch (f... | [
"@",
"View",
"(",
"name",
"=",
"\"by_serviceName\"",
",",
"map",
"=",
"\"function(doc) { if (doc.service) { emit(doc.service.name, doc._id) }}\"",
")",
"public",
"RegisteredServiceDocument",
"findByServiceName",
"(",
"final",
"String",
"serviceName",
")",
"{",
"try",
"{",
... | Implements search by service name.
@param serviceName The service name of the service to find.
@return The service found or +null+. | [
"Implements",
"search",
"by",
"service",
"name",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-couchdb-service-registry/src/main/java/org/apereo/cas/couchdb/services/RegisteredServiceCouchDbRepository.java#L47-L55 |
facebook/fresco | samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/util/PipelineUtil.java | PipelineUtil.addOptionalFeatures | public static void addOptionalFeatures(ImageRequestBuilder imageRequestBuilder, Config config) {
"""
Utility method which adds optional configuration to ImageRequest
@param imageRequestBuilder The Builder for ImageRequest
@param config The Config
"""
if (config.usePostprocessor) {
fi... | java | public static void addOptionalFeatures(ImageRequestBuilder imageRequestBuilder, Config config) {
if (config.usePostprocessor) {
final Postprocessor postprocessor;
switch (config.postprocessorType) {
case "use_slow_postprocessor":
postprocessor = DelayPostprocessor.getMediumPostprocesso... | [
"public",
"static",
"void",
"addOptionalFeatures",
"(",
"ImageRequestBuilder",
"imageRequestBuilder",
",",
"Config",
"config",
")",
"{",
"if",
"(",
"config",
".",
"usePostprocessor",
")",
"{",
"final",
"Postprocessor",
"postprocessor",
";",
"switch",
"(",
"config",
... | Utility method which adds optional configuration to ImageRequest
@param imageRequestBuilder The Builder for ImageRequest
@param config The Config | [
"Utility",
"method",
"which",
"adds",
"optional",
"configuration",
"to",
"ImageRequest"
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/util/PipelineUtil.java#L31-L52 |
ixa-ehu/ixa-pipe-nerc | src/main/java/eus/ixa/ixa/pipe/nerc/NERTaggerServer.java | NERTaggerServer.sendDataToClient | private void sendDataToClient(BufferedWriter outToClient, String kafToString)
throws IOException {
"""
Send data back to server after annotation.
@param outToClient
the outputstream to the client
@param kafToString
the string to be processed
@throws IOException
if io error
"""
outToClient.wri... | java | private void sendDataToClient(BufferedWriter outToClient, String kafToString)
throws IOException {
outToClient.write(kafToString);
outToClient.close();
} | [
"private",
"void",
"sendDataToClient",
"(",
"BufferedWriter",
"outToClient",
",",
"String",
"kafToString",
")",
"throws",
"IOException",
"{",
"outToClient",
".",
"write",
"(",
"kafToString",
")",
";",
"outToClient",
".",
"close",
"(",
")",
";",
"}"
] | Send data back to server after annotation.
@param outToClient
the outputstream to the client
@param kafToString
the string to be processed
@throws IOException
if io error | [
"Send",
"data",
"back",
"to",
"server",
"after",
"annotation",
"."
] | train | https://github.com/ixa-ehu/ixa-pipe-nerc/blob/299cb49348eb7650fef2ae47c73f6d3384b43c34/src/main/java/eus/ixa/ixa/pipe/nerc/NERTaggerServer.java#L168-L172 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javadoc/DocLocale.java | DocLocale.htmlSentenceTerminatorFound | private boolean htmlSentenceTerminatorFound(String str, int index) {
"""
Find out if there is any HTML tag in the given string. If found
return true else return false.
"""
for (int i = 0; i < sentenceTerminators.length; i++) {
String terminator = sentenceTerminators[i];
if (str... | java | private boolean htmlSentenceTerminatorFound(String str, int index) {
for (int i = 0; i < sentenceTerminators.length; i++) {
String terminator = sentenceTerminators[i];
if (str.regionMatches(true, index, terminator,
0, terminator.length())) {
... | [
"private",
"boolean",
"htmlSentenceTerminatorFound",
"(",
"String",
"str",
",",
"int",
"index",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"sentenceTerminators",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"terminator",
"=",
"sente... | Find out if there is any HTML tag in the given string. If found
return true else return false. | [
"Find",
"out",
"if",
"there",
"is",
"any",
"HTML",
"tag",
"in",
"the",
"given",
"string",
".",
"If",
"found",
"return",
"true",
"else",
"return",
"false",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javadoc/DocLocale.java#L233-L242 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/converter/json/JsonStringToJsonIntermediateConverter.java | JsonStringToJsonIntermediateConverter.parseEnumType | private JsonElement parseEnumType(JsonSchema schema, JsonElement value)
throws DataConversionException {
"""
Parses Enum type values
@param schema
@param value
@return
@throws DataConversionException
"""
if (schema.getSymbols().contains(value)) {
return value;
}
throw new DataConver... | java | private JsonElement parseEnumType(JsonSchema schema, JsonElement value)
throws DataConversionException {
if (schema.getSymbols().contains(value)) {
return value;
}
throw new DataConversionException(
"Invalid symbol: " + value.getAsString() + " allowed values: " + schema.getSymbols().toSt... | [
"private",
"JsonElement",
"parseEnumType",
"(",
"JsonSchema",
"schema",
",",
"JsonElement",
"value",
")",
"throws",
"DataConversionException",
"{",
"if",
"(",
"schema",
".",
"getSymbols",
"(",
")",
".",
"contains",
"(",
"value",
")",
")",
"{",
"return",
"value... | Parses Enum type values
@param schema
@param value
@return
@throws DataConversionException | [
"Parses",
"Enum",
"type",
"values"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/converter/json/JsonStringToJsonIntermediateConverter.java#L167-L174 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java | BytecodeUtils.doIsAssignableFrom | private static boolean doIsAssignableFrom(Type left, Type right, boolean failOpen) {
"""
Checks if {@code left} is assignable from {@code right}, however if we don't have information
about one of the types then this returns {@code failOpen}.
"""
if (left.equals(right)) {
return true;
}
if (l... | java | private static boolean doIsAssignableFrom(Type left, Type right, boolean failOpen) {
if (left.equals(right)) {
return true;
}
if (left.getSort() != right.getSort()) {
return false;
}
if (left.getSort() != Type.OBJECT) {
return false; // all other sorts require exact equality (even ... | [
"private",
"static",
"boolean",
"doIsAssignableFrom",
"(",
"Type",
"left",
",",
"Type",
"right",
",",
"boolean",
"failOpen",
")",
"{",
"if",
"(",
"left",
".",
"equals",
"(",
"right",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"left",
".",
... | Checks if {@code left} is assignable from {@code right}, however if we don't have information
about one of the types then this returns {@code failOpen}. | [
"Checks",
"if",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java#L192-L212 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java | PixelMath.boundImage | public static void boundImage( GrayU8 img , int min , int max ) {
"""
Bounds image pixels to be between these two values
@param img Image
@param min minimum value.
@param max maximum value.
"""
ImplPixelMath.boundImage(img,min,max);
} | java | public static void boundImage( GrayU8 img , int min , int max ) {
ImplPixelMath.boundImage(img,min,max);
} | [
"public",
"static",
"void",
"boundImage",
"(",
"GrayU8",
"img",
",",
"int",
"min",
",",
"int",
"max",
")",
"{",
"ImplPixelMath",
".",
"boundImage",
"(",
"img",
",",
"min",
",",
"max",
")",
";",
"}"
] | Bounds image pixels to be between these two values
@param img Image
@param min minimum value.
@param max maximum value. | [
"Bounds",
"image",
"pixels",
"to",
"be",
"between",
"these",
"two",
"values"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java#L4298-L4300 |
redisson/redisson | redisson/src/main/java/org/redisson/spring/cache/RedissonCacheMetrics.java | RedissonCacheMetrics.monitor | public static RedissonCache monitor(MeterRegistry registry, RedissonCache cache, Iterable<Tag> tags) {
"""
Record metrics on a Redisson cache.
@param registry - registry to bind metrics to
@param cache - cache to instrument
@param tags - tags to apply to all recorded metrics
@return cache
"""
new... | java | public static RedissonCache monitor(MeterRegistry registry, RedissonCache cache, Iterable<Tag> tags) {
new RedissonCacheMetrics(cache, tags).bindTo(registry);
return cache;
} | [
"public",
"static",
"RedissonCache",
"monitor",
"(",
"MeterRegistry",
"registry",
",",
"RedissonCache",
"cache",
",",
"Iterable",
"<",
"Tag",
">",
"tags",
")",
"{",
"new",
"RedissonCacheMetrics",
"(",
"cache",
",",
"tags",
")",
".",
"bindTo",
"(",
"registry",
... | Record metrics on a Redisson cache.
@param registry - registry to bind metrics to
@param cache - cache to instrument
@param tags - tags to apply to all recorded metrics
@return cache | [
"Record",
"metrics",
"on",
"a",
"Redisson",
"cache",
"."
] | train | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/spring/cache/RedissonCacheMetrics.java#L44-L47 |
JodaOrg/joda-beans | src/main/java/org/joda/beans/impl/flexi/FlexiBean.java | FlexiBean.getDouble | public double getDouble(String propertyName, double defaultValue) {
"""
Gets the value of the property as a {@code double} using a default value.
@param propertyName the property name, not empty
@param defaultValue the default value for null or invalid property
@return the value of the property
@throws Cla... | java | public double getDouble(String propertyName, double defaultValue) {
Object obj = get(propertyName);
return obj != null ? ((Number) get(propertyName)).doubleValue() : defaultValue;
} | [
"public",
"double",
"getDouble",
"(",
"String",
"propertyName",
",",
"double",
"defaultValue",
")",
"{",
"Object",
"obj",
"=",
"get",
"(",
"propertyName",
")",
";",
"return",
"obj",
"!=",
"null",
"?",
"(",
"(",
"Number",
")",
"get",
"(",
"propertyName",
... | Gets the value of the property as a {@code double} using a default value.
@param propertyName the property name, not empty
@param defaultValue the default value for null or invalid property
@return the value of the property
@throws ClassCastException if the value is not compatible | [
"Gets",
"the",
"value",
"of",
"the",
"property",
"as",
"a",
"{",
"@code",
"double",
"}",
"using",
"a",
"default",
"value",
"."
] | train | https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/impl/flexi/FlexiBean.java#L247-L250 |
osglworks/java-tool | src/main/java/org/osgl/util/E.java | E.invalidState | public static InvalidStateException invalidState(String msg, Object... args) {
"""
Throws out an {@link InvalidStateException} with message specified.
"""
throw new InvalidStateException(S.fmt(msg, args));
} | java | public static InvalidStateException invalidState(String msg, Object... args) {
throw new InvalidStateException(S.fmt(msg, args));
} | [
"public",
"static",
"InvalidStateException",
"invalidState",
"(",
"String",
"msg",
",",
"Object",
"...",
"args",
")",
"{",
"throw",
"new",
"InvalidStateException",
"(",
"S",
".",
"fmt",
"(",
"msg",
",",
"args",
")",
")",
";",
"}"
] | Throws out an {@link InvalidStateException} with message specified. | [
"Throws",
"out",
"an",
"{"
] | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/E.java#L66-L68 |
aoindustries/aocode-public | src/main/java/com/aoindustries/util/StringUtility.java | StringUtility.indexOf | public static int indexOf(String S, char[] chars, int start) {
"""
Finds the first occurrence of any of the supplied characters starting at the specified index.
@param S the <code>String</code> to search
@param chars the characters to look for
@param start the starting index.
@return the index of th... | java | public static int indexOf(String S, char[] chars, int start) {
int Slen=S.length();
int clen=chars.length;
for(int c=start;c<Slen;c++) {
char ch=S.charAt(c);
for(int d=0;d<clen;d++) if(ch==chars[d]) return c;
}
return -1;
} | [
"public",
"static",
"int",
"indexOf",
"(",
"String",
"S",
",",
"char",
"[",
"]",
"chars",
",",
"int",
"start",
")",
"{",
"int",
"Slen",
"=",
"S",
".",
"length",
"(",
")",
";",
"int",
"clen",
"=",
"chars",
".",
"length",
";",
"for",
"(",
"int",
... | Finds the first occurrence of any of the supplied characters starting at the specified index.
@param S the <code>String</code> to search
@param chars the characters to look for
@param start the starting index.
@return the index of the first occurrence of <code>-1</code> if none found | [
"Finds",
"the",
"first",
"occurrence",
"of",
"any",
"of",
"the",
"supplied",
"characters",
"starting",
"at",
"the",
"specified",
"index",
"."
] | train | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/StringUtility.java#L633-L641 |
devnied/EMV-NFC-Paycard-Enrollment | library/src/main/java/com/github/devnied/emvnfccard/utils/TrackUtils.java | TrackUtils.extractTrack1Data | public static EmvTrack1 extractTrack1Data(final byte[] pRawTrack1) {
"""
Extract track 1 data
@param pRawTrack1
track1 raw data
@return EmvTrack1 object
"""
EmvTrack1 ret = null;
if (pRawTrack1 != null) {
EmvTrack1 track1 = new EmvTrack1();
track1.setRaw(pRawTrack1);
Matcher m = TRACK1_PATTE... | java | public static EmvTrack1 extractTrack1Data(final byte[] pRawTrack1) {
EmvTrack1 ret = null;
if (pRawTrack1 != null) {
EmvTrack1 track1 = new EmvTrack1();
track1.setRaw(pRawTrack1);
Matcher m = TRACK1_PATTERN.matcher(new String(pRawTrack1));
// Check pattern
if (m.find()) {
// Set format code
... | [
"public",
"static",
"EmvTrack1",
"extractTrack1Data",
"(",
"final",
"byte",
"[",
"]",
"pRawTrack1",
")",
"{",
"EmvTrack1",
"ret",
"=",
"null",
";",
"if",
"(",
"pRawTrack1",
"!=",
"null",
")",
"{",
"EmvTrack1",
"track1",
"=",
"new",
"EmvTrack1",
"(",
")",
... | Extract track 1 data
@param pRawTrack1
track1 raw data
@return EmvTrack1 object | [
"Extract",
"track",
"1",
"data"
] | train | https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/bfbd3960708689154a7a75c8a9a934197d738a5b/library/src/main/java/com/github/devnied/emvnfccard/utils/TrackUtils.java#L105-L138 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java | AbstractManagedType.isMapAttribute | private boolean isMapAttribute(PluralAttribute<? super X, ?, ?> attribute) {
"""
Checks if is map attribute.
@param attribute
the attribute
@return true, if is map attribute
"""
return attribute != null && attribute.getCollectionType().equals(CollectionType.MAP);
} | java | private boolean isMapAttribute(PluralAttribute<? super X, ?, ?> attribute)
{
return attribute != null && attribute.getCollectionType().equals(CollectionType.MAP);
} | [
"private",
"boolean",
"isMapAttribute",
"(",
"PluralAttribute",
"<",
"?",
"super",
"X",
",",
"?",
",",
"?",
">",
"attribute",
")",
"{",
"return",
"attribute",
"!=",
"null",
"&&",
"attribute",
".",
"getCollectionType",
"(",
")",
".",
"equals",
"(",
"Collect... | Checks if is map attribute.
@param attribute
the attribute
@return true, if is map attribute | [
"Checks",
"if",
"is",
"map",
"attribute",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java#L1063-L1066 |
adamfisk/littleshoot-util | src/main/java/org/littleshoot/util/xml/XPathUtils.java | XPathUtils.newXPath | public static XPathUtils newXPath(final Document doc) {
"""
Creates a new {@link XPathUtils} instance.
@param doc The XML data.
@return A new {@link XPathUtils} instance.
"""
final XPathFactory xpfactory = XPathFactory.newInstance();
final XPath xPath = xpfactory.newXPath();
return ... | java | public static XPathUtils newXPath(final Document doc) {
final XPathFactory xpfactory = XPathFactory.newInstance();
final XPath xPath = xpfactory.newXPath();
return new XPathUtils(xPath, doc);
} | [
"public",
"static",
"XPathUtils",
"newXPath",
"(",
"final",
"Document",
"doc",
")",
"{",
"final",
"XPathFactory",
"xpfactory",
"=",
"XPathFactory",
".",
"newInstance",
"(",
")",
";",
"final",
"XPath",
"xPath",
"=",
"xpfactory",
".",
"newXPath",
"(",
")",
";"... | Creates a new {@link XPathUtils} instance.
@param doc The XML data.
@return A new {@link XPathUtils} instance. | [
"Creates",
"a",
"new",
"{",
"@link",
"XPathUtils",
"}",
"instance",
"."
] | train | https://github.com/adamfisk/littleshoot-util/blob/3c0dc4955116b3382d6b0575d2f164b7508a4f73/src/main/java/org/littleshoot/util/xml/XPathUtils.java#L116-L120 |
julianhyde/sqlline | src/main/java/sqlline/Commands.java | Commands.record | public void record(String line, DispatchCallback callback) {
"""
Starts or stops saving all output to a file.
@param line Command line
@param callback Callback for command status
"""
if (sqlLine.getRecordOutputFile() == null) {
startRecording(line, callback);
} else {
stopRecording(line... | java | public void record(String line, DispatchCallback callback) {
if (sqlLine.getRecordOutputFile() == null) {
startRecording(line, callback);
} else {
stopRecording(line, callback);
}
} | [
"public",
"void",
"record",
"(",
"String",
"line",
",",
"DispatchCallback",
"callback",
")",
"{",
"if",
"(",
"sqlLine",
".",
"getRecordOutputFile",
"(",
")",
"==",
"null",
")",
"{",
"startRecording",
"(",
"line",
",",
"callback",
")",
";",
"}",
"else",
"... | Starts or stops saving all output to a file.
@param line Command line
@param callback Callback for command status | [
"Starts",
"or",
"stops",
"saving",
"all",
"output",
"to",
"a",
"file",
"."
] | train | https://github.com/julianhyde/sqlline/blob/7577f3ebaca0897a9ff01d1553d4576487e1d2c3/src/main/java/sqlline/Commands.java#L1555-L1561 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java | DerInputBuffer.getUTCTime | public Date getUTCTime(int len) throws IOException {
"""
Returns the UTC Time value that takes up the specified number
of bytes in this buffer.
@param len the number of bytes to use
"""
if (len > available())
throw new IOException("short read of DER UTC Time");
if (len < 11 || le... | java | public Date getUTCTime(int len) throws IOException {
if (len > available())
throw new IOException("short read of DER UTC Time");
if (len < 11 || len > 17)
throw new IOException("DER UTC Time length error");
return getTime(len, false);
} | [
"public",
"Date",
"getUTCTime",
"(",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"len",
">",
"available",
"(",
")",
")",
"throw",
"new",
"IOException",
"(",
"\"short read of DER UTC Time\"",
")",
";",
"if",
"(",
"len",
"<",
"11",
"||",
"l... | Returns the UTC Time value that takes up the specified number
of bytes in this buffer.
@param len the number of bytes to use | [
"Returns",
"the",
"UTC",
"Time",
"value",
"that",
"takes",
"up",
"the",
"specified",
"number",
"of",
"bytes",
"in",
"this",
"buffer",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java#L261-L269 |
brettwooldridge/NuProcess | src/main/java/com/zaxxer/nuprocess/codec/NuAbstractCharsetHandler.java | NuAbstractCharsetHandler.onStdoutChars | protected void onStdoutChars(CharBuffer buffer, boolean closed, CoderResult coderResult) {
"""
Override this to receive decoded Unicode Java string data read from
stdout.
<p>
Make sure to set the {@link CharBuffer#position() position} of
{@code buffer} to indicate how much data you have read before returning.
... | java | protected void onStdoutChars(CharBuffer buffer, boolean closed, CoderResult coderResult)
{
// Consume the entire buffer by default.
buffer.position(buffer.limit());
} | [
"protected",
"void",
"onStdoutChars",
"(",
"CharBuffer",
"buffer",
",",
"boolean",
"closed",
",",
"CoderResult",
"coderResult",
")",
"{",
"// Consume the entire buffer by default.",
"buffer",
".",
"position",
"(",
"buffer",
".",
"limit",
"(",
")",
")",
";",
"}"
] | Override this to receive decoded Unicode Java string data read from
stdout.
<p>
Make sure to set the {@link CharBuffer#position() position} of
{@code buffer} to indicate how much data you have read before returning.
@param buffer The {@link CharBuffer} receiving Unicode string data. | [
"Override",
"this",
"to",
"receive",
"decoded",
"Unicode",
"Java",
"string",
"data",
"read",
"from",
"stdout",
".",
"<p",
">",
"Make",
"sure",
"to",
"set",
"the",
"{",
"@link",
"CharBuffer#position",
"()",
"position",
"}",
"of",
"{",
"@code",
"buffer",
"}"... | train | https://github.com/brettwooldridge/NuProcess/blob/d4abdd195367fce7375a0b45cb2f5eeff1c74d03/src/main/java/com/zaxxer/nuprocess/codec/NuAbstractCharsetHandler.java#L149-L153 |
apache/flink | flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/utils/ParquetSchemaConverter.java | ParquetSchemaConverter.toParquetType | public static MessageType toParquetType(TypeInformation<?> typeInformation, boolean legacyMode) {
"""
Converts Flink Internal Type to Parquet schema.
@param typeInformation Flink type information
@param legacyMode is standard LIST and MAP schema or back-compatible schema
@return Parquet schema
"""
retu... | java | public static MessageType toParquetType(TypeInformation<?> typeInformation, boolean legacyMode) {
return (MessageType) convertField(null, typeInformation, Type.Repetition.OPTIONAL, legacyMode);
} | [
"public",
"static",
"MessageType",
"toParquetType",
"(",
"TypeInformation",
"<",
"?",
">",
"typeInformation",
",",
"boolean",
"legacyMode",
")",
"{",
"return",
"(",
"MessageType",
")",
"convertField",
"(",
"null",
",",
"typeInformation",
",",
"Type",
".",
"Repet... | Converts Flink Internal Type to Parquet schema.
@param typeInformation Flink type information
@param legacyMode is standard LIST and MAP schema or back-compatible schema
@return Parquet schema | [
"Converts",
"Flink",
"Internal",
"Type",
"to",
"Parquet",
"schema",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/utils/ParquetSchemaConverter.java#L70-L72 |
lessthanoptimal/ddogleg | src/org/ddogleg/optimization/FactoryOptimization.java | FactoryOptimization.doglegBFGS | public static UnconstrainedMinimization doglegBFGS( @Nullable ConfigTrustRegion config ) {
"""
Dense trust-region unconstrained minimization using Dogleg steps and BFGS to estimate the Hessian.
@param config Trust region configuration
@return The new optimization routine
"""
if( config == null )
config ... | java | public static UnconstrainedMinimization doglegBFGS( @Nullable ConfigTrustRegion config ) {
if( config == null )
config = new ConfigTrustRegion();
HessianBFGS hessian = new HessianBFGS_DDRM(true);
TrustRegionUpdateDogleg_F64<DMatrixRMaj> update = new TrustRegionUpdateDogleg_F64<>();
UnconMinTrustRegionBFGS_F... | [
"public",
"static",
"UnconstrainedMinimization",
"doglegBFGS",
"(",
"@",
"Nullable",
"ConfigTrustRegion",
"config",
")",
"{",
"if",
"(",
"config",
"==",
"null",
")",
"config",
"=",
"new",
"ConfigTrustRegion",
"(",
")",
";",
"HessianBFGS",
"hessian",
"=",
"new",
... | Dense trust-region unconstrained minimization using Dogleg steps and BFGS to estimate the Hessian.
@param config Trust region configuration
@return The new optimization routine | [
"Dense",
"trust",
"-",
"region",
"unconstrained",
"minimization",
"using",
"Dogleg",
"steps",
"and",
"BFGS",
"to",
"estimate",
"the",
"Hessian",
"."
] | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/FactoryOptimization.java#L158-L167 |
UrielCh/ovh-java-sdk | ovh-java-sdk-licenseoffice/src/main/java/net/minidev/ovh/api/ApiOvhLicenseoffice.java | ApiOvhLicenseoffice.serviceName_user_activationEmail_DELETE | public OvhOfficeTask serviceName_user_activationEmail_DELETE(String serviceName, String activationEmail) throws IOException {
"""
Delete existing office user
REST: DELETE /license/office/{serviceName}/user/{activationEmail}
@param serviceName [required] The unique identifier of your Office service
@param acti... | java | public OvhOfficeTask serviceName_user_activationEmail_DELETE(String serviceName, String activationEmail) throws IOException {
String qPath = "/license/office/{serviceName}/user/{activationEmail}";
StringBuilder sb = path(qPath, serviceName, activationEmail);
String resp = exec(qPath, "DELETE", sb.toString(), null... | [
"public",
"OvhOfficeTask",
"serviceName_user_activationEmail_DELETE",
"(",
"String",
"serviceName",
",",
"String",
"activationEmail",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/license/office/{serviceName}/user/{activationEmail}\"",
";",
"StringBuilder",
"sb... | Delete existing office user
REST: DELETE /license/office/{serviceName}/user/{activationEmail}
@param serviceName [required] The unique identifier of your Office service
@param activationEmail [required] Email used to activate Microsoft Office | [
"Delete",
"existing",
"office",
"user"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-licenseoffice/src/main/java/net/minidev/ovh/api/ApiOvhLicenseoffice.java#L178-L183 |
gilberto-torrezan/gwt-views | src/main/java/com/github/gilbertotorrezan/gwtviews/client/URLToken.java | URLToken.setParameter | public String setParameter(String name, String value) {
"""
Sets a new value to a parameter, or put a new parameter if not existant.
If the value is <code>null</code>, the parameter is removed (same as calling the {@link #removeParameter(String)} method).
@param name The name of the parameter
@param value The... | java | public String setParameter(String name, String value) {
if (value == null){
return removeParameter(name);
}
return parameters.put(name, value);
} | [
"public",
"String",
"setParameter",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"removeParameter",
"(",
"name",
")",
";",
"}",
"return",
"parameters",
".",
"put",
"(",
"name",
",",
"val... | Sets a new value to a parameter, or put a new parameter if not existant.
If the value is <code>null</code>, the parameter is removed (same as calling the {@link #removeParameter(String)} method).
@param name The name of the parameter
@param value The value of the parameter
@return the previous value associated with <c... | [
"Sets",
"a",
"new",
"value",
"to",
"a",
"parameter",
"or",
"put",
"a",
"new",
"parameter",
"if",
"not",
"existant",
".",
"If",
"the",
"value",
"is",
"<code",
">",
"null<",
"/",
"code",
">",
"the",
"parameter",
"is",
"removed",
"(",
"same",
"as",
"cal... | train | https://github.com/gilberto-torrezan/gwt-views/blob/c6511435d14b5aa93a722b0e861230d0ae2159e5/src/main/java/com/github/gilbertotorrezan/gwtviews/client/URLToken.java#L272-L277 |
clanie/clanie-core | src/main/java/dk/clanie/collections/NumberMap.java | NumberMap.newFloatMap | public static <K> NumberMap<K, Float> newFloatMap() {
"""
Creates a NumberMap for Floats.
@param <K>
@return NumberMap<K, Float>
"""
return new NumberMap<K, Float>() {
@Override
public void add(K key, Float addend) {
put(key, containsKey(key) ? (get(key) + addend) : addend);
}
@Over... | java | public static <K> NumberMap<K, Float> newFloatMap() {
return new NumberMap<K, Float>() {
@Override
public void add(K key, Float addend) {
put(key, containsKey(key) ? (get(key) + addend) : addend);
}
@Override
public void sub(K key, Float subtrahend) {
put(key, (containsKey(key) ? get(key) : 0f)... | [
"public",
"static",
"<",
"K",
">",
"NumberMap",
"<",
"K",
",",
"Float",
">",
"newFloatMap",
"(",
")",
"{",
"return",
"new",
"NumberMap",
"<",
"K",
",",
"Float",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"add",
"(",
"K",
"key",
",",
"... | Creates a NumberMap for Floats.
@param <K>
@return NumberMap<K, Float> | [
"Creates",
"a",
"NumberMap",
"for",
"Floats",
"."
] | train | https://github.com/clanie/clanie-core/blob/ac8a655b93127f0e281b741c4d53f429be2816ad/src/main/java/dk/clanie/collections/NumberMap.java#L152-L163 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/renderer/animation/transformation/SizeTransform.java | SizeTransform.doTransform | @Override
protected void doTransform(Size<T> transformable, float comp) {
"""
Calculates the transformation
@param transformable the transformable
@param comp the comp
"""
int fromWidth = reversed ? this.toWidth : this.fromWidth;
int toWidth = reversed ? this.fromWidth : this.toWidth;
int fromHeight... | java | @Override
protected void doTransform(Size<T> transformable, float comp)
{
int fromWidth = reversed ? this.toWidth : this.fromWidth;
int toWidth = reversed ? this.fromWidth : this.toWidth;
int fromHeight = reversed ? this.toHeight : this.fromHeight;
int toHeight = reversed ? this.fromHeight : this.toHeight;
... | [
"@",
"Override",
"protected",
"void",
"doTransform",
"(",
"Size",
"<",
"T",
">",
"transformable",
",",
"float",
"comp",
")",
"{",
"int",
"fromWidth",
"=",
"reversed",
"?",
"this",
".",
"toWidth",
":",
"this",
".",
"fromWidth",
";",
"int",
"toWidth",
"=",... | Calculates the transformation
@param transformable the transformable
@param comp the comp | [
"Calculates",
"the",
"transformation"
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/animation/transformation/SizeTransform.java#L111-L120 |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/terminal/ansi/TelnetTerminalServer.java | TelnetTerminalServer.acceptConnection | public TelnetTerminal acceptConnection() throws IOException {
"""
Waits for the next client to connect in to our server and returns a Terminal implementation, TelnetTerminal, that
represents the remote terminal this client is running. The terminal can be used just like any other Terminal, but
keep in mind that a... | java | public TelnetTerminal acceptConnection() throws IOException {
Socket clientSocket = serverSocket.accept();
clientSocket.setTcpNoDelay(true);
return new TelnetTerminal(clientSocket, charset);
} | [
"public",
"TelnetTerminal",
"acceptConnection",
"(",
")",
"throws",
"IOException",
"{",
"Socket",
"clientSocket",
"=",
"serverSocket",
".",
"accept",
"(",
")",
";",
"clientSocket",
".",
"setTcpNoDelay",
"(",
"true",
")",
";",
"return",
"new",
"TelnetTerminal",
"... | Waits for the next client to connect in to our server and returns a Terminal implementation, TelnetTerminal, that
represents the remote terminal this client is running. The terminal can be used just like any other Terminal, but
keep in mind that all operations are sent over the network.
@return TelnetTerminal for the r... | [
"Waits",
"for",
"the",
"next",
"client",
"to",
"connect",
"in",
"to",
"our",
"server",
"and",
"returns",
"a",
"Terminal",
"implementation",
"TelnetTerminal",
"that",
"represents",
"the",
"remote",
"terminal",
"this",
"client",
"is",
"running",
".",
"The",
"ter... | train | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/terminal/ansi/TelnetTerminalServer.java#L100-L104 |
actframework/actframework | src/main/java/act/ws/WebSocketConnectionManager.java | WebSocketConnectionManager.sendToTagged | public void sendToTagged(String message, String ... labels) {
"""
Send message to all connections tagged with all given tags
@param message the message
@param labels the tag labels
"""
for (String label : labels) {
sendToTagged(message, label);
}
} | java | public void sendToTagged(String message, String ... labels) {
for (String label : labels) {
sendToTagged(message, label);
}
} | [
"public",
"void",
"sendToTagged",
"(",
"String",
"message",
",",
"String",
"...",
"labels",
")",
"{",
"for",
"(",
"String",
"label",
":",
"labels",
")",
"{",
"sendToTagged",
"(",
"message",
",",
"label",
")",
";",
"}",
"}"
] | Send message to all connections tagged with all given tags
@param message the message
@param labels the tag labels | [
"Send",
"message",
"to",
"all",
"connections",
"tagged",
"with",
"all",
"given",
"tags"
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/ws/WebSocketConnectionManager.java#L147-L151 |
apiman/apiman | common/es/src/main/java/io/apiman/common/es/util/ESUtils.java | ESUtils.queryWithEscapedArgs | public static String queryWithEscapedArgs(String query, String... args) {
"""
An ES query with escaped arguments:
<p>
Use the SQL convention of ? (e.g. "foo": ?, "bar": ?).
<p>
A {@link Number} instance will be unquoted, all other types will be quoted.
@param query ES query
@param args the corresponding po... | java | public static String queryWithEscapedArgs(String query, String... args) {
Object[] sanitisedArgs = Arrays.stream(args)
.parallel()
.map(ESUtils::escape)
.toArray();
return replaceQMark(query, sanitisedArgs);
} | [
"public",
"static",
"String",
"queryWithEscapedArgs",
"(",
"String",
"query",
",",
"String",
"...",
"args",
")",
"{",
"Object",
"[",
"]",
"sanitisedArgs",
"=",
"Arrays",
".",
"stream",
"(",
"args",
")",
".",
"parallel",
"(",
")",
".",
"map",
"(",
"ESUtil... | An ES query with escaped arguments:
<p>
Use the SQL convention of ? (e.g. "foo": ?, "bar": ?).
<p>
A {@link Number} instance will be unquoted, all other types will be quoted.
@param query ES query
@param args the corresponding positional arguments {0} ... {n-1}
@return query with escaped variables substituted in | [
"An",
"ES",
"query",
"with",
"escaped",
"arguments",
":",
"<p",
">",
"Use",
"the",
"SQL",
"convention",
"of",
"?",
"(",
"e",
".",
"g",
".",
"foo",
":",
"?",
"bar",
":",
"?",
")",
".",
"<p",
">",
"A",
"{",
"@link",
"Number",
"}",
"instance",
"wi... | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/es/src/main/java/io/apiman/common/es/util/ESUtils.java#L55-L61 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/cdn/CdnClient.java | CdnClient.setHttpsConfig | public SetHttpsConfigResponse setHttpsConfig(SetHttpsConfigRequest request) {
"""
Set HTTPS with certain configuration.
@param request The request containing all of the options related to the update request.
@return Result of the setHTTPSAcceleration operation returned by the service.
"""
checkNotN... | java | public SetHttpsConfigResponse setHttpsConfig(SetHttpsConfigRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
InternalRequest internalRequest =
createRequest(request, HttpMethodName.PUT, DOMAIN, request.getDomain(), "config");
internalRequest.... | [
"public",
"SetHttpsConfigResponse",
"setHttpsConfig",
"(",
"SetHttpsConfigRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"InternalRequest",
"internalRequest",
"=",
"createRequest",
"(",
"request",... | Set HTTPS with certain configuration.
@param request The request containing all of the options related to the update request.
@return Result of the setHTTPSAcceleration operation returned by the service. | [
"Set",
"HTTPS",
"with",
"certain",
"configuration",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/cdn/CdnClient.java#L466-L473 |
jhy/jsoup | src/main/java/org/jsoup/nodes/TextNode.java | TextNode.createFromEncoded | public static TextNode createFromEncoded(String encodedText, String baseUri) {
"""
Create a new TextNode from HTML encoded (aka escaped) data.
@param encodedText Text containing encoded HTML (e.g. &lt;)
@param baseUri Base uri
@return TextNode containing unencoded data (e.g. <)
@deprecated use {@link Te... | java | public static TextNode createFromEncoded(String encodedText, String baseUri) {
String text = Entities.unescape(encodedText);
return new TextNode(text);
} | [
"public",
"static",
"TextNode",
"createFromEncoded",
"(",
"String",
"encodedText",
",",
"String",
"baseUri",
")",
"{",
"String",
"text",
"=",
"Entities",
".",
"unescape",
"(",
"encodedText",
")",
";",
"return",
"new",
"TextNode",
"(",
"text",
")",
";",
"}"
] | Create a new TextNode from HTML encoded (aka escaped) data.
@param encodedText Text containing encoded HTML (e.g. &lt;)
@param baseUri Base uri
@return TextNode containing unencoded data (e.g. <)
@deprecated use {@link TextNode#createFromEncoded(String)} instead, as LeafNodes don't carry base URIs. | [
"Create",
"a",
"new",
"TextNode",
"from",
"HTML",
"encoded",
"(",
"aka",
"escaped",
")",
"data",
"."
] | train | https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/TextNode.java#L119-L122 |
martinwithaar/Encryptor4j | src/main/java/org/encryptor4j/Encryptor.java | Encryptor.wrapOutputStream | public CipherOutputStream wrapOutputStream(OutputStream os, byte[] iv) throws GeneralSecurityException, IOException {
"""
<p>Wraps an <code>OutputStream</code> with a <code>CipherOutputStream</code> using this encryptor's cipher.</p>
<p>If an <code>ivLength</code> has been specified or an explicit IV has been set... | java | public CipherOutputStream wrapOutputStream(OutputStream os, byte[] iv) throws GeneralSecurityException, IOException {
Cipher cipher = getCipher(true);
if(iv == null && generateIV && ivLength > 0) {
iv = generateIV();
}
if(iv != null) {
cipher.init(Cipher.ENCRYPT_MODE, getKey(), getAlgorithmParameterSpec(i... | [
"public",
"CipherOutputStream",
"wrapOutputStream",
"(",
"OutputStream",
"os",
",",
"byte",
"[",
"]",
"iv",
")",
"throws",
"GeneralSecurityException",
",",
"IOException",
"{",
"Cipher",
"cipher",
"=",
"getCipher",
"(",
"true",
")",
";",
"if",
"(",
"iv",
"==",
... | <p>Wraps an <code>OutputStream</code> with a <code>CipherOutputStream</code> using this encryptor's cipher.</p>
<p>If an <code>ivLength</code> has been specified or an explicit IV has been set during construction
and <code>prependIV</code> is set to <code>true</code> this method will write an IV to the <code>OutputStre... | [
"<p",
">",
"Wraps",
"an",
"<code",
">",
"OutputStream<",
"/",
"code",
">",
"with",
"a",
"<code",
">",
"CipherOutputStream<",
"/",
"code",
">",
"using",
"this",
"encryptor",
"s",
"cipher",
".",
"<",
"/",
"p",
">",
"<p",
">",
"If",
"an",
"<code",
">",
... | train | https://github.com/martinwithaar/Encryptor4j/blob/8c31d84d9136309f59d810323ed68d902b9bac55/src/main/java/org/encryptor4j/Encryptor.java#L387-L403 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/StandardAnnotationMaps.java | StandardAnnotationMaps.of | static final <T> FieldMap<T> of(Method getter, String defaultName) {
"""
Gets all the DynamoDB annotations; method annotations override field
level annotations which override class/type level annotations.
"""
final Class<T> targetType = (Class<T>)getter.getReturnType();
final String fieldName ... | java | static final <T> FieldMap<T> of(Method getter, String defaultName) {
final Class<T> targetType = (Class<T>)getter.getReturnType();
final String fieldName = StandardBeanProperties.fieldNameOf(getter);
Field declaredField = null;
try {
declaredField = getter.getDeclaringClass(... | [
"static",
"final",
"<",
"T",
">",
"FieldMap",
"<",
"T",
">",
"of",
"(",
"Method",
"getter",
",",
"String",
"defaultName",
")",
"{",
"final",
"Class",
"<",
"T",
">",
"targetType",
"=",
"(",
"Class",
"<",
"T",
">",
")",
"getter",
".",
"getReturnType",
... | Gets all the DynamoDB annotations; method annotations override field
level annotations which override class/type level annotations. | [
"Gets",
"all",
"the",
"DynamoDB",
"annotations",
";",
"method",
"annotations",
"override",
"field",
"level",
"annotations",
"which",
"override",
"class",
"/",
"type",
"level",
"annotations",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/StandardAnnotationMaps.java#L57-L77 |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/statistics/EffectSize.java | EffectSize.getCohenD | public static <V> double getCohenD(final Map<V, Double> baselineMetricPerDimension, final Map<V, Double> testMetricPerDimension, final boolean doLeastSquares) {
"""
Computes Cohen's d, either the classical formulation (dividing the pooled
standard deviation by the sum of the number of samples) or using the
least... | java | public static <V> double getCohenD(final Map<V, Double> baselineMetricPerDimension, final Map<V, Double> testMetricPerDimension, final boolean doLeastSquares) {
SummaryStatistics statsBaseline = new SummaryStatistics();
for (double d : baselineMetricPerDimension.values()) {
statsBaseline.add... | [
"public",
"static",
"<",
"V",
">",
"double",
"getCohenD",
"(",
"final",
"Map",
"<",
"V",
",",
"Double",
">",
"baselineMetricPerDimension",
",",
"final",
"Map",
"<",
"V",
",",
"Double",
">",
"testMetricPerDimension",
",",
"final",
"boolean",
"doLeastSquares",
... | Computes Cohen's d, either the classical formulation (dividing the pooled
standard deviation by the sum of the number of samples) or using the
least squares estimation (substracting 2 to the sum of the number of
samples when normalizing the pooled standard deviation).
@param <V> type of the keys of each map.
@param ba... | [
"Computes",
"Cohen",
"s",
"d",
"either",
"the",
"classical",
"formulation",
"(",
"dividing",
"the",
"pooled",
"standard",
"deviation",
"by",
"the",
"sum",
"of",
"the",
"number",
"of",
"samples",
")",
"or",
"using",
"the",
"least",
"squares",
"estimation",
"(... | train | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/statistics/EffectSize.java#L90-L107 |
ironjacamar/ironjacamar | doc/src/dist/resources/samples/helloworld/src/main/java/org/ironjacamar/samples/helloworld/HelloWorldManagedConnection.java | HelloWorldManagedConnection.getConnection | public Object getConnection(Subject subject,
ConnectionRequestInfo cxRequestInfo)
throws ResourceException {
"""
Creates a new connection handle for the underlying physical connection
represented by the ManagedConnection instance.
@param subject Security context as JAAS su... | java | public Object getConnection(Subject subject,
ConnectionRequestInfo cxRequestInfo)
throws ResourceException
{
HelloWorldConnectionImpl connection = new HelloWorldConnectionImpl(this, mcf);
connections.add(connection);
return connection;
} | [
"public",
"Object",
"getConnection",
"(",
"Subject",
"subject",
",",
"ConnectionRequestInfo",
"cxRequestInfo",
")",
"throws",
"ResourceException",
"{",
"HelloWorldConnectionImpl",
"connection",
"=",
"new",
"HelloWorldConnectionImpl",
"(",
"this",
",",
"mcf",
")",
";",
... | Creates a new connection handle for the underlying physical connection
represented by the ManagedConnection instance.
@param subject Security context as JAAS subject
@param cxRequestInfo ConnectionRequestInfo instance
@return generic Object instance representing the connection handle.
@throws ResourceException generic... | [
"Creates",
"a",
"new",
"connection",
"handle",
"for",
"the",
"underlying",
"physical",
"connection",
"represented",
"by",
"the",
"ManagedConnection",
"instance",
"."
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/doc/src/dist/resources/samples/helloworld/src/main/java/org/ironjacamar/samples/helloworld/HelloWorldManagedConnection.java#L84-L93 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.