repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
pmwmedia/tinylog | tinylog-impl/src/main/java/org/tinylog/writers/RollingFileWriter.java | RollingFileWriter.canBeContinued | private static boolean canBeContinued(final String fileName, final List<Policy> policies) {
boolean result = true;
for (Policy policy : policies) {
result &= policy.continueExistingFile(fileName);
}
return result;
} | java | private static boolean canBeContinued(final String fileName, final List<Policy> policies) {
boolean result = true;
for (Policy policy : policies) {
result &= policy.continueExistingFile(fileName);
}
return result;
} | [
"private",
"static",
"boolean",
"canBeContinued",
"(",
"final",
"String",
"fileName",
",",
"final",
"List",
"<",
"Policy",
">",
"policies",
")",
"{",
"boolean",
"result",
"=",
"true",
";",
"for",
"(",
"Policy",
"policy",
":",
"policies",
")",
"{",
"result"... | Checks if an already existing log file can be continued.
@param fileName
Log file
@param policies
Policies that should be applied
@return {@code true} if the passed log file can be continued, {@code false} if a new log file should be started | [
"Checks",
"if",
"an",
"already",
"existing",
"log",
"file",
"can",
"be",
"continued",
"."
] | train | https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/tinylog-impl/src/main/java/org/tinylog/writers/RollingFileWriter.java#L206-L212 |
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.deletePatternAnyEntityModel | public OperationStatus deletePatternAnyEntityModel(UUID appId, String versionId, UUID entityId) {
return deletePatternAnyEntityModelWithServiceResponseAsync(appId, versionId, entityId).toBlocking().single().body();
} | java | public OperationStatus deletePatternAnyEntityModel(UUID appId, String versionId, UUID entityId) {
return deletePatternAnyEntityModelWithServiceResponseAsync(appId, versionId, entityId).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"deletePatternAnyEntityModel",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
")",
"{",
"return",
"deletePatternAnyEntityModelWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"entityId",
")",
".",
... | Deletes a Pattern.Any entity extractor from the application.
@param appId The application ID.
@param versionId The version ID.
@param entityId The Pattern.Any entity extractor ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful. | [
"Deletes",
"a",
"Pattern",
".",
"Any",
"entity",
"extractor",
"from",
"the",
"application",
"."
] | 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#L10650-L10652 |
apiman/apiman | manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/AbstractJpaStorage.java | AbstractJpaStorage.executeCountQuery | protected <T> int executeCountQuery(SearchCriteriaBean criteria, EntityManager entityManager, Class<T> type) {
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<Long> countQuery = builder.createQuery(Long.class);
Root<T> from = countQuery.from(type);
countQuery.select(builder.count(from));
applySearchCriteriaToQuery(criteria, builder, countQuery, from, true);
TypedQuery<Long> query = entityManager.createQuery(countQuery);
return query.getSingleResult().intValue();
} | java | protected <T> int executeCountQuery(SearchCriteriaBean criteria, EntityManager entityManager, Class<T> type) {
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<Long> countQuery = builder.createQuery(Long.class);
Root<T> from = countQuery.from(type);
countQuery.select(builder.count(from));
applySearchCriteriaToQuery(criteria, builder, countQuery, from, true);
TypedQuery<Long> query = entityManager.createQuery(countQuery);
return query.getSingleResult().intValue();
} | [
"protected",
"<",
"T",
">",
"int",
"executeCountQuery",
"(",
"SearchCriteriaBean",
"criteria",
",",
"EntityManager",
"entityManager",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"CriteriaBuilder",
"builder",
"=",
"entityManager",
".",
"getCriteriaBuilder",
"(",... | Gets a count of the number of rows that would be returned by the search.
@param criteria
@param entityManager
@param type | [
"Gets",
"a",
"count",
"of",
"the",
"number",
"of",
"rows",
"that",
"would",
"be",
"returned",
"by",
"the",
"search",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/AbstractJpaStorage.java#L313-L321 |
VoltDB/voltdb | src/frontend/org/voltdb/sysprocs/SystemInformation.java | SystemInformation.run | public VoltTable[] run(SystemProcedureExecutionContext ctx,
String selector) throws VoltAbortException
{
VoltTable[] results;
// This selector provides the old @SystemInformation behavior
if (selector.toUpperCase().equals("OVERVIEW"))
{
results = getOverviewInfo();
}
else if (selector.toUpperCase().equals("DEPLOYMENT"))
{
results = getDeploymentInfo();
}
else
{
throw new VoltAbortException(String.format("Invalid @SystemInformation selector %s.", selector));
}
return results;
} | java | public VoltTable[] run(SystemProcedureExecutionContext ctx,
String selector) throws VoltAbortException
{
VoltTable[] results;
// This selector provides the old @SystemInformation behavior
if (selector.toUpperCase().equals("OVERVIEW"))
{
results = getOverviewInfo();
}
else if (selector.toUpperCase().equals("DEPLOYMENT"))
{
results = getDeploymentInfo();
}
else
{
throw new VoltAbortException(String.format("Invalid @SystemInformation selector %s.", selector));
}
return results;
} | [
"public",
"VoltTable",
"[",
"]",
"run",
"(",
"SystemProcedureExecutionContext",
"ctx",
",",
"String",
"selector",
")",
"throws",
"VoltAbortException",
"{",
"VoltTable",
"[",
"]",
"results",
";",
"// This selector provides the old @SystemInformation behavior",
"if",
"(",
... | Returns the cluster info requested by the provided selector
@param ctx Internal. Not exposed to the end-user.
@param selector Selector requested
@return The property/value table for the provided selector
@throws VoltAbortException | [
"Returns",
"the",
"cluster",
"info",
"requested",
"by",
"the",
"provided",
"selector"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/SystemInformation.java#L241-L261 |
apache/incubator-atlas | repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java | GraphBackedMetadataRepository.addTrait | @Override
@GraphTransaction
public void addTrait(List<String> entityGuids, ITypedStruct traitInstance) throws RepositoryException {
Preconditions.checkNotNull(entityGuids, "entityGuids list cannot be null");
Preconditions.checkNotNull(traitInstance, "Trait instance cannot be null");
if (LOG.isDebugEnabled()) {
LOG.debug("Adding a new trait={} for entities={}", traitInstance.getTypeName(), entityGuids);
}
GraphTransactionInterceptor.lockObjectAndReleasePostCommit(entityGuids);
for (String entityGuid : entityGuids) {
addTraitImpl(entityGuid, traitInstance);
}
} | java | @Override
@GraphTransaction
public void addTrait(List<String> entityGuids, ITypedStruct traitInstance) throws RepositoryException {
Preconditions.checkNotNull(entityGuids, "entityGuids list cannot be null");
Preconditions.checkNotNull(traitInstance, "Trait instance cannot be null");
if (LOG.isDebugEnabled()) {
LOG.debug("Adding a new trait={} for entities={}", traitInstance.getTypeName(), entityGuids);
}
GraphTransactionInterceptor.lockObjectAndReleasePostCommit(entityGuids);
for (String entityGuid : entityGuids) {
addTraitImpl(entityGuid, traitInstance);
}
} | [
"@",
"Override",
"@",
"GraphTransaction",
"public",
"void",
"addTrait",
"(",
"List",
"<",
"String",
">",
"entityGuids",
",",
"ITypedStruct",
"traitInstance",
")",
"throws",
"RepositoryException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"entityGuids",
",",
... | Adds a new trait to the list of entities represented by their respective guids
@param entityGuids list of globally unique identifier for the entities
@param traitInstance trait instance that needs to be added to entities
@throws RepositoryException | [
"Adds",
"a",
"new",
"trait",
"to",
"the",
"list",
"of",
"entities",
"represented",
"by",
"their",
"respective",
"guids"
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java#L306-L320 |
overturetool/overture | core/interpreter/src/main/java/org/overture/interpreter/runtime/Context.java | Context.deepCopy | public Context deepCopy()
{
Context below = null;
if (outer != null)
{
below = outer.deepCopy();
}
Context result = new Context(assistantFactory, location, title, below);
result.threadState = threadState;
for (ILexNameToken var : keySet())
{
Value v = get(var);
result.put(var, v.deepCopy());
}
return result;
} | java | public Context deepCopy()
{
Context below = null;
if (outer != null)
{
below = outer.deepCopy();
}
Context result = new Context(assistantFactory, location, title, below);
result.threadState = threadState;
for (ILexNameToken var : keySet())
{
Value v = get(var);
result.put(var, v.deepCopy());
}
return result;
} | [
"public",
"Context",
"deepCopy",
"(",
")",
"{",
"Context",
"below",
"=",
"null",
";",
"if",
"(",
"outer",
"!=",
"null",
")",
"{",
"below",
"=",
"outer",
".",
"deepCopy",
"(",
")",
";",
"}",
"Context",
"result",
"=",
"new",
"Context",
"(",
"assistantF... | Make a deep copy of the context, using Value.deepCopy. Every concrete subclass must implements its own version of
this method.
@return | [
"Make",
"a",
"deep",
"copy",
"of",
"the",
"context",
"using",
"Value",
".",
"deepCopy",
".",
"Every",
"concrete",
"subclass",
"must",
"implements",
"its",
"own",
"version",
"of",
"this",
"method",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/runtime/Context.java#L151-L170 |
google/closure-templates | java/src/com/google/template/soy/pysrc/internal/InternalPyExprUtils.java | InternalPyExprUtils.wrapAsSanitizedContent | static PyExpr wrapAsSanitizedContent(SanitizedContentKind contentKind, PyExpr pyExpr) {
String sanitizer = NodeContentKinds.toPySanitizedContentOrdainer(contentKind);
String approval =
"sanitize.IActuallyUnderstandSoyTypeSafetyAndHaveSecurityApproval("
+ "'Internally created Sanitization.')";
return new PyExpr(
sanitizer + "(" + pyExpr.getText() + ", approval=" + approval + ")", Integer.MAX_VALUE);
} | java | static PyExpr wrapAsSanitizedContent(SanitizedContentKind contentKind, PyExpr pyExpr) {
String sanitizer = NodeContentKinds.toPySanitizedContentOrdainer(contentKind);
String approval =
"sanitize.IActuallyUnderstandSoyTypeSafetyAndHaveSecurityApproval("
+ "'Internally created Sanitization.')";
return new PyExpr(
sanitizer + "(" + pyExpr.getText() + ", approval=" + approval + ")", Integer.MAX_VALUE);
} | [
"static",
"PyExpr",
"wrapAsSanitizedContent",
"(",
"SanitizedContentKind",
"contentKind",
",",
"PyExpr",
"pyExpr",
")",
"{",
"String",
"sanitizer",
"=",
"NodeContentKinds",
".",
"toPySanitizedContentOrdainer",
"(",
"contentKind",
")",
";",
"String",
"approval",
"=",
"... | Wraps an expression with the proper SanitizedContent constructor.
@param contentKind The kind of sanitized content.
@param pyExpr The expression to wrap. | [
"Wraps",
"an",
"expression",
"with",
"the",
"proper",
"SanitizedContent",
"constructor",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/internal/InternalPyExprUtils.java#L32-L39 |
jbundle/jbundle | model/base/src/main/java/org/jbundle/model/util/Util.java | Util.convertClassName | public static String convertClassName(String className, String stringToInsert)
{
return Util.convertClassName(className, stringToInsert, 2);
} | java | public static String convertClassName(String className, String stringToInsert)
{
return Util.convertClassName(className, stringToInsert, 2);
} | [
"public",
"static",
"String",
"convertClassName",
"(",
"String",
"className",
",",
"String",
"stringToInsert",
")",
"{",
"return",
"Util",
".",
"convertClassName",
"(",
"className",
",",
"stringToInsert",
",",
"2",
")",
";",
"}"
] | Convert this class name by inserting this package after the domain.
ie., com.xyz.abc.ClassName -> com.xyz.newpackage.abc.ClassName.
@param className
@param stringToInsert
@return Converted string | [
"Convert",
"this",
"class",
"name",
"by",
"inserting",
"this",
"package",
"after",
"the",
"domain",
".",
"ie",
".",
"com",
".",
"xyz",
".",
"abc",
".",
"ClassName",
"-",
">",
"com",
".",
"xyz",
".",
"newpackage",
".",
"abc",
".",
"ClassName",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/Util.java#L457-L460 |
google/closure-compiler | src/com/google/javascript/jscomp/DestructuringGlobalNameExtractor.java | DestructuringGlobalNameExtractor.makeNewRvalueForDestructuringKey | private static Node makeNewRvalueForDestructuringKey(
Node stringKey, Node rvalue, Set<AstChange> newNodes, Ref ref) {
if (stringKey.getOnlyChild().isDefaultValue()) {
Node defaultValue = stringKey.getFirstChild().getSecondChild().detach();
// Assume `rvalue` has no side effects since it's a qname, and we can create multiple
// references to it. This ignores getters/setters.
Node rvalueForSheq = rvalue.cloneTree();
if (newNodes != null) {
newNodes.add(new AstChange(ref.module, ref.scope, rvalueForSheq));
}
// `void 0 === rvalue ? defaultValue : rvalue`
rvalue =
IR.hook(IR.sheq(NodeUtil.newUndefinedNode(rvalue), rvalueForSheq), defaultValue, rvalue)
.srcrefTree(defaultValue);
}
return rvalue;
} | java | private static Node makeNewRvalueForDestructuringKey(
Node stringKey, Node rvalue, Set<AstChange> newNodes, Ref ref) {
if (stringKey.getOnlyChild().isDefaultValue()) {
Node defaultValue = stringKey.getFirstChild().getSecondChild().detach();
// Assume `rvalue` has no side effects since it's a qname, and we can create multiple
// references to it. This ignores getters/setters.
Node rvalueForSheq = rvalue.cloneTree();
if (newNodes != null) {
newNodes.add(new AstChange(ref.module, ref.scope, rvalueForSheq));
}
// `void 0 === rvalue ? defaultValue : rvalue`
rvalue =
IR.hook(IR.sheq(NodeUtil.newUndefinedNode(rvalue), rvalueForSheq), defaultValue, rvalue)
.srcrefTree(defaultValue);
}
return rvalue;
} | [
"private",
"static",
"Node",
"makeNewRvalueForDestructuringKey",
"(",
"Node",
"stringKey",
",",
"Node",
"rvalue",
",",
"Set",
"<",
"AstChange",
">",
"newNodes",
",",
"Ref",
"ref",
")",
"{",
"if",
"(",
"stringKey",
".",
"getOnlyChild",
"(",
")",
".",
"isDefau... | Makes a default value expression from the rvalue, or otherwise just returns it
<p>e.g. for `const {x = defaultValue} = y;`, and the new rvalue `rvalue`, returns `void 0 ===
rvalue ? defaultValue : rvalue` | [
"Makes",
"a",
"default",
"value",
"expression",
"from",
"the",
"rvalue",
"or",
"otherwise",
"just",
"returns",
"it"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DestructuringGlobalNameExtractor.java#L176-L192 |
Omertron/api-rottentomatoes | src/main/java/com/omertron/rottentomatoesapi/tools/ApiBuilder.java | ApiBuilder.validateProperty | public static boolean validateProperty(String key, String value) {
return !StringUtils.isBlank(key) && !StringUtils.isBlank(value);
} | java | public static boolean validateProperty(String key, String value) {
return !StringUtils.isBlank(key) && !StringUtils.isBlank(value);
} | [
"public",
"static",
"boolean",
"validateProperty",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"return",
"!",
"StringUtils",
".",
"isBlank",
"(",
"key",
")",
"&&",
"!",
"StringUtils",
".",
"isBlank",
"(",
"value",
")",
";",
"}"
] | Validate the key and value of a property
@param key
@param value
@return | [
"Validate",
"the",
"key",
"and",
"value",
"of",
"a",
"property"
] | train | https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/tools/ApiBuilder.java#L124-L126 |
opencb/biodata | biodata-formats/src/main/java/org/opencb/biodata/formats/sequence/fastq/FastQ.java | FastQ.transformQualityScoresArray | private void transformQualityScoresArray(int oldEncoding, int newEncoding) {
// If the score types of the encodings are different
if (FastQ.SCALE_SCORE[oldEncoding] != FastQ.SCALE_SCORE[newEncoding]) {
// Score Map selection
Map<Integer, Integer> scoreMap;
if (FastQ.SCALE_SCORE[oldEncoding] == FastQ.PHRED_SCORE_TYPE) {
scoreMap = FastQ.phredToSolexaMap;
} else {
scoreMap = FastQ.solexaToPhredMap;
}
// Transform each quality score in the quality scores array
for (int i = 0; i < this.qualityScoresArray.length; i++) {
if (qualityScoresArray[i] < 10) {
qualityScoresArray[i] = scoreMap.get(qualityScoresArray[i]);
}
}
}
} | java | private void transformQualityScoresArray(int oldEncoding, int newEncoding) {
// If the score types of the encodings are different
if (FastQ.SCALE_SCORE[oldEncoding] != FastQ.SCALE_SCORE[newEncoding]) {
// Score Map selection
Map<Integer, Integer> scoreMap;
if (FastQ.SCALE_SCORE[oldEncoding] == FastQ.PHRED_SCORE_TYPE) {
scoreMap = FastQ.phredToSolexaMap;
} else {
scoreMap = FastQ.solexaToPhredMap;
}
// Transform each quality score in the quality scores array
for (int i = 0; i < this.qualityScoresArray.length; i++) {
if (qualityScoresArray[i] < 10) {
qualityScoresArray[i] = scoreMap.get(qualityScoresArray[i]);
}
}
}
} | [
"private",
"void",
"transformQualityScoresArray",
"(",
"int",
"oldEncoding",
",",
"int",
"newEncoding",
")",
"{",
"// If the score types of the encodings are different",
"if",
"(",
"FastQ",
".",
"SCALE_SCORE",
"[",
"oldEncoding",
"]",
"!=",
"FastQ",
".",
"SCALE_SCORE",
... | Transform the quality scores array if the score types of the encodings are different
@param oldEncoding - old quality encoding type
@param newEncoding - new quality encoding type | [
"Transform",
"the",
"quality",
"scores",
"array",
"if",
"the",
"score",
"types",
"of",
"the",
"encodings",
"are",
"different"
] | train | https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-formats/src/main/java/org/opencb/biodata/formats/sequence/fastq/FastQ.java#L305-L322 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | ZipUtil.unzip | public static File unzip(String zipFilePath, String outFileDir) throws UtilException {
return unzip(zipFilePath, outFileDir, DEFAULT_CHARSET);
} | java | public static File unzip(String zipFilePath, String outFileDir) throws UtilException {
return unzip(zipFilePath, outFileDir, DEFAULT_CHARSET);
} | [
"public",
"static",
"File",
"unzip",
"(",
"String",
"zipFilePath",
",",
"String",
"outFileDir",
")",
"throws",
"UtilException",
"{",
"return",
"unzip",
"(",
"zipFilePath",
",",
"outFileDir",
",",
"DEFAULT_CHARSET",
")",
";",
"}"
] | 解压,默认UTF-8编码
@param zipFilePath 压缩文件的路径
@param outFileDir 解压到的目录
@return 解压的目录
@throws UtilException IO异常 | [
"解压,默认UTF",
"-",
"8编码"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L345-L347 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformprofile.java | transformprofile.get | public static transformprofile get(nitro_service service, String name) throws Exception{
transformprofile obj = new transformprofile();
obj.set_name(name);
transformprofile response = (transformprofile) obj.get_resource(service);
return response;
} | java | public static transformprofile get(nitro_service service, String name) throws Exception{
transformprofile obj = new transformprofile();
obj.set_name(name);
transformprofile response = (transformprofile) obj.get_resource(service);
return response;
} | [
"public",
"static",
"transformprofile",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"transformprofile",
"obj",
"=",
"new",
"transformprofile",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"... | Use this API to fetch transformprofile resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"transformprofile",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformprofile.java#L387-L392 |
undertow-io/undertow | core/src/main/java/io/undertow/util/FlexBase64.java | FlexBase64.encodeBytes | public static byte[] encodeBytes(byte[] source, int pos, int limit, boolean wrap) {
return Encoder.encodeBytes(source, pos, limit, wrap, false);
} | java | public static byte[] encodeBytes(byte[] source, int pos, int limit, boolean wrap) {
return Encoder.encodeBytes(source, pos, limit, wrap, false);
} | [
"public",
"static",
"byte",
"[",
"]",
"encodeBytes",
"(",
"byte",
"[",
"]",
"source",
",",
"int",
"pos",
",",
"int",
"limit",
",",
"boolean",
"wrap",
")",
"{",
"return",
"Encoder",
".",
"encodeBytes",
"(",
"source",
",",
"pos",
",",
"limit",
",",
"wr... | Encodes a fixed and complete byte buffer into a Base64 byte array.
<pre><code>
// Encodes "ell"
FlexBase64.encodeString("hello".getBytes("US-ASCII"), 1, 4, false);
</code></pre>
@param source the byte array to encode from
@param pos the position to start encoding at
@param limit the position to halt encoding at (exclusive)
@param wrap whether or not to wrap at 76 characters with CRLFs
@return a new byte array containing the encoded ASCII values | [
"Encodes",
"a",
"fixed",
"and",
"complete",
"byte",
"buffer",
"into",
"a",
"Base64",
"byte",
"array",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/FlexBase64.java#L271-L273 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_spam_GET | public ArrayList<String> ip_spam_GET(String ip, OvhSpamStateEnum state) throws IOException {
String qPath = "/ip/{ip}/spam";
StringBuilder sb = path(qPath, ip);
query(sb, "state", state);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<String> ip_spam_GET(String ip, OvhSpamStateEnum state) throws IOException {
String qPath = "/ip/{ip}/spam";
StringBuilder sb = path(qPath, ip);
query(sb, "state", state);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"ip_spam_GET",
"(",
"String",
"ip",
",",
"OvhSpamStateEnum",
"state",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/spam\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"ip",
... | Ip spamming
REST: GET /ip/{ip}/spam
@param state [required] Filter the value of state property (=)
@param ip [required] | [
"Ip",
"spamming"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L195-L201 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/docs/TypeSignature.java | TypeSignature.ofContainer | public static TypeSignature ofContainer(String containerTypeName, TypeSignature... elementTypeSignatures) {
requireNonNull(elementTypeSignatures, "elementTypeSignatures");
return ofContainer(containerTypeName, ImmutableList.copyOf(elementTypeSignatures));
} | java | public static TypeSignature ofContainer(String containerTypeName, TypeSignature... elementTypeSignatures) {
requireNonNull(elementTypeSignatures, "elementTypeSignatures");
return ofContainer(containerTypeName, ImmutableList.copyOf(elementTypeSignatures));
} | [
"public",
"static",
"TypeSignature",
"ofContainer",
"(",
"String",
"containerTypeName",
",",
"TypeSignature",
"...",
"elementTypeSignatures",
")",
"{",
"requireNonNull",
"(",
"elementTypeSignatures",
",",
"\"elementTypeSignatures\"",
")",
";",
"return",
"ofContainer",
"("... | Creates a new container type with the specified container type name and the type signatures of the
elements it contains.
@throws IllegalArgumentException if the specified type name is not valid or
{@code elementTypeSignatures} is empty. | [
"Creates",
"a",
"new",
"container",
"type",
"with",
"the",
"specified",
"container",
"type",
"name",
"and",
"the",
"type",
"signatures",
"of",
"the",
"elements",
"it",
"contains",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/docs/TypeSignature.java#L79-L82 |
alkacon/opencms-core | src/org/opencms/search/documents/CmsDocumentGeneric.java | CmsDocumentGeneric.extractContent | public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index)
throws CmsIndexException {
if (resource == null) {
throw new CmsIndexException(Messages.get().container(Messages.ERR_NO_RAW_CONTENT_1, index.getLocale()));
}
// just return an empty result set
return new CmsExtractionResult("");
} | java | public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index)
throws CmsIndexException {
if (resource == null) {
throw new CmsIndexException(Messages.get().container(Messages.ERR_NO_RAW_CONTENT_1, index.getLocale()));
}
// just return an empty result set
return new CmsExtractionResult("");
} | [
"public",
"I_CmsExtractionResult",
"extractContent",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
",",
"I_CmsSearchIndex",
"index",
")",
"throws",
"CmsIndexException",
"{",
"if",
"(",
"resource",
"==",
"null",
")",
"{",
"throw",
"new",
"CmsIndexException... | Just returns an empty extraction result since the content can't be extracted form a generic resource.<p>
@see org.opencms.search.documents.I_CmsSearchExtractor#extractContent(CmsObject, CmsResource, I_CmsSearchIndex) | [
"Just",
"returns",
"an",
"empty",
"extraction",
"result",
"since",
"the",
"content",
"can",
"t",
"be",
"extracted",
"form",
"a",
"generic",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/documents/CmsDocumentGeneric.java#L65-L73 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java | EmulatedFields.get | public boolean get(String name, boolean defaultValue) throws IllegalArgumentException {
ObjectSlot slot = findMandatorySlot(name, boolean.class);
return slot.defaulted ? defaultValue : ((Boolean) slot.fieldValue).booleanValue();
} | java | public boolean get(String name, boolean defaultValue) throws IllegalArgumentException {
ObjectSlot slot = findMandatorySlot(name, boolean.class);
return slot.defaulted ? defaultValue : ((Boolean) slot.fieldValue).booleanValue();
} | [
"public",
"boolean",
"get",
"(",
"String",
"name",
",",
"boolean",
"defaultValue",
")",
"throws",
"IllegalArgumentException",
"{",
"ObjectSlot",
"slot",
"=",
"findMandatorySlot",
"(",
"name",
",",
"boolean",
".",
"class",
")",
";",
"return",
"slot",
".",
"defa... | Finds and returns the boolean value of a given field named {@code name} in
the receiver. If the field has not been assigned any value yet, the
default value {@code defaultValue} is returned instead.
@param name
the name of the field to find.
@param defaultValue
return value in case the field has not been assigned to yet.
@return the value of the given field if it has been assigned, the default
value otherwise.
@throws IllegalArgumentException
if the corresponding field can not be found. | [
"Finds",
"and",
"returns",
"the",
"boolean",
"value",
"of",
"a",
"given",
"field",
"named",
"{",
"@code",
"name",
"}",
"in",
"the",
"receiver",
".",
"If",
"the",
"field",
"has",
"not",
"been",
"assigned",
"any",
"value",
"yet",
"the",
"default",
"value",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java#L368-L371 |
tvesalainen/util | util/src/main/java/org/vesalainen/util/concurrent/CachedScheduledThreadPool.java | CachedScheduledThreadPool.submitAfter | public <V> Future<V> submitAfter(Waiter waiter, Callable<V> callable)
{
return submitAfter(waiter, callable, Long.MAX_VALUE, TimeUnit.MILLISECONDS);
} | java | public <V> Future<V> submitAfter(Waiter waiter, Callable<V> callable)
{
return submitAfter(waiter, callable, Long.MAX_VALUE, TimeUnit.MILLISECONDS);
} | [
"public",
"<",
"V",
">",
"Future",
"<",
"V",
">",
"submitAfter",
"(",
"Waiter",
"waiter",
",",
"Callable",
"<",
"V",
">",
"callable",
")",
"{",
"return",
"submitAfter",
"(",
"waiter",
",",
"callable",
",",
"Long",
".",
"MAX_VALUE",
",",
"TimeUnit",
"."... | submits callable after waiting future to complete
@param <V>
@param waiter
@param callable
@return | [
"submits",
"callable",
"after",
"waiting",
"future",
"to",
"complete"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/CachedScheduledThreadPool.java#L265-L268 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/ArrowButtonPainter.java | ArrowButtonPainter.paintForegroundDisabled | private void paintForegroundDisabled(Graphics2D g, int width, int height) {
Shape s = decodeArrowPath(width, height);
g.setPaint(disabledColor);
g.fill(s);
} | java | private void paintForegroundDisabled(Graphics2D g, int width, int height) {
Shape s = decodeArrowPath(width, height);
g.setPaint(disabledColor);
g.fill(s);
} | [
"private",
"void",
"paintForegroundDisabled",
"(",
"Graphics2D",
"g",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"Shape",
"s",
"=",
"decodeArrowPath",
"(",
"width",
",",
"height",
")",
";",
"g",
".",
"setPaint",
"(",
"disabledColor",
")",
";",
... | Paint the arrow in disabled state.
@param g the Graphics2D context to paint with.
@param width the width.
@param height the height. | [
"Paint",
"the",
"arrow",
"in",
"disabled",
"state",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ArrowButtonPainter.java#L94-L100 |
landawn/AbacusUtil | src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java | PoolablePreparedStatement.setString | @Override
public void setString(int parameterIndex, String x) throws SQLException {
internalStmt.setString(parameterIndex, x);
} | java | @Override
public void setString(int parameterIndex, String x) throws SQLException {
internalStmt.setString(parameterIndex, x);
} | [
"@",
"Override",
"public",
"void",
"setString",
"(",
"int",
"parameterIndex",
",",
"String",
"x",
")",
"throws",
"SQLException",
"{",
"internalStmt",
".",
"setString",
"(",
"parameterIndex",
",",
"x",
")",
";",
"}"
] | Method setString.
@param parameterIndex
@param x
@throws SQLException
@see java.sql.PreparedStatement#setString(int, String) | [
"Method",
"setString",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java#L991-L994 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.order_orderId_status_GET | public OvhOrderStatusEnum order_orderId_status_GET(Long orderId) throws IOException {
String qPath = "/me/order/{orderId}/status";
StringBuilder sb = path(qPath, orderId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrderStatusEnum.class);
} | java | public OvhOrderStatusEnum order_orderId_status_GET(Long orderId) throws IOException {
String qPath = "/me/order/{orderId}/status";
StringBuilder sb = path(qPath, orderId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrderStatusEnum.class);
} | [
"public",
"OvhOrderStatusEnum",
"order_orderId_status_GET",
"(",
"Long",
"orderId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/order/{orderId}/status\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"orderId",
")",
";",
"String"... | Return status of order
REST: GET /me/order/{orderId}/status
@param orderId [required] | [
"Return",
"status",
"of",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1884-L1889 |
haifengl/smile | demo/src/main/java/smile/demo/SmileDemo.java | SmileDemo.createAndShowGUI | public static void createAndShowGUI(boolean exitOnClose) {
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception ex) {
try {
// If Nimbus is not available, try system look and feel.
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
System.err.println(e);
}
}
//Create and set up the window.
JFrame frame = new JFrame("Smile Demo");
frame.setSize(new Dimension(1000, 1000));
frame.setLocationRelativeTo(null);
if (exitOnClose)
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
else
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
//Add content to the window.
frame.add(new SmileDemo());
//Display the window.
frame.pack();
frame.setVisible(true);
} | java | public static void createAndShowGUI(boolean exitOnClose) {
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception ex) {
try {
// If Nimbus is not available, try system look and feel.
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
System.err.println(e);
}
}
//Create and set up the window.
JFrame frame = new JFrame("Smile Demo");
frame.setSize(new Dimension(1000, 1000));
frame.setLocationRelativeTo(null);
if (exitOnClose)
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
else
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
//Add content to the window.
frame.add(new SmileDemo());
//Display the window.
frame.pack();
frame.setVisible(true);
} | [
"public",
"static",
"void",
"createAndShowGUI",
"(",
"boolean",
"exitOnClose",
")",
"{",
"try",
"{",
"for",
"(",
"LookAndFeelInfo",
"info",
":",
"UIManager",
".",
"getInstalledLookAndFeels",
"(",
")",
")",
"{",
"if",
"(",
"\"Nimbus\"",
".",
"equals",
"(",
"i... | Create the GUI and show it. For thread safety,
this method should be invoked from the
event dispatch thread. | [
"Create",
"the",
"GUI",
"and",
"show",
"it",
".",
"For",
"thread",
"safety",
"this",
"method",
"should",
"be",
"invoked",
"from",
"the",
"event",
"dispatch",
"thread",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/demo/src/main/java/smile/demo/SmileDemo.java#L542-L575 |
azkaban/azkaban | az-core/src/main/java/azkaban/utils/Props.java | Props.getUri | public URI getUri(final String name, final URI defaultValue) {
if (containsKey(name)) {
return getUri(name);
} else {
return defaultValue;
}
} | java | public URI getUri(final String name, final URI defaultValue) {
if (containsKey(name)) {
return getUri(name);
} else {
return defaultValue;
}
} | [
"public",
"URI",
"getUri",
"(",
"final",
"String",
"name",
",",
"final",
"URI",
"defaultValue",
")",
"{",
"if",
"(",
"containsKey",
"(",
"name",
")",
")",
"{",
"return",
"getUri",
"(",
"name",
")",
";",
"}",
"else",
"{",
"return",
"defaultValue",
";",
... | Returns the double representation of the value. If the value is null, then the default value is
returned. If the value isn't a uri, then a IllegalArgumentException will be thrown. | [
"Returns",
"the",
"double",
"representation",
"of",
"the",
"value",
".",
"If",
"the",
"value",
"is",
"null",
"then",
"the",
"default",
"value",
"is",
"returned",
".",
"If",
"the",
"value",
"isn",
"t",
"a",
"uri",
"then",
"a",
"IllegalArgumentException",
"w... | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-core/src/main/java/azkaban/utils/Props.java#L629-L635 |
actframework/actframework | src/main/java/act/ws/WebSocketContext.java | WebSocketContext.sendToTagged | public WebSocketContext sendToTagged(String message, String tag) {
return sendToTagged(message, tag, false);
} | java | public WebSocketContext sendToTagged(String message, String tag) {
return sendToTagged(message, tag, false);
} | [
"public",
"WebSocketContext",
"sendToTagged",
"(",
"String",
"message",
",",
"String",
"tag",
")",
"{",
"return",
"sendToTagged",
"(",
"message",
",",
"tag",
",",
"false",
")",
";",
"}"
] | Send message to all connections labeled with tag specified
with self connection excluded
@param message the message to be sent
@param tag the string that tag the connections to be sent
@return this context | [
"Send",
"message",
"to",
"all",
"connections",
"labeled",
"with",
"tag",
"specified",
"with",
"self",
"connection",
"excluded"
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/ws/WebSocketContext.java#L220-L222 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java | OjbMemberTagsHandler.isMethod | public void isMethod(String template, Properties attributes) throws XDocletException
{
if (getCurrentMethod() != null) {
generate(template);
}
} | java | public void isMethod(String template, Properties attributes) throws XDocletException
{
if (getCurrentMethod() != null) {
generate(template);
}
} | [
"public",
"void",
"isMethod",
"(",
"String",
"template",
",",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"if",
"(",
"getCurrentMethod",
"(",
")",
"!=",
"null",
")",
"{",
"generate",
"(",
"template",
")",
";",
"}",
"}"
] | The <code>isMethod</code> processes the template body if the current member is a method.
@param template a <code>String</code> value
@param attributes a <code>Properties</code> value
@exception XDocletException if an error occurs
@doc:tag type="block" | [
"The",
"<code",
">",
"isMethod<",
"/",
"code",
">",
"processes",
"the",
"template",
"body",
"if",
"the",
"current",
"member",
"is",
"a",
"method",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java#L134-L139 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.binarySearch | public static int binarySearch(final char[] a, final int fromIndex, final int toIndex, final char key) {
return Array.binarySearch(a, fromIndex, toIndex, key);
} | java | public static int binarySearch(final char[] a, final int fromIndex, final int toIndex, final char key) {
return Array.binarySearch(a, fromIndex, toIndex, key);
} | [
"public",
"static",
"int",
"binarySearch",
"(",
"final",
"char",
"[",
"]",
"a",
",",
"final",
"int",
"fromIndex",
",",
"final",
"int",
"toIndex",
",",
"final",
"char",
"key",
")",
"{",
"return",
"Array",
".",
"binarySearch",
"(",
"a",
",",
"fromIndex",
... | {@link Arrays#binarySearch(char[], int, int, char)}
@param a
@param fromIndex
@param toIndex
@param key
@return | [
"{",
"@link",
"Arrays#binarySearch",
"(",
"char",
"[]",
"int",
"int",
"char",
")",
"}"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L12101-L12103 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns.java | ns.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
ns_responses result = (ns_responses) service.get_payload_formatter().string_to_resource(ns_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_response_array);
}
ns[] result_ns = new ns[result.ns_response_array.length];
for(int i = 0; i < result.ns_response_array.length; i++)
{
result_ns[i] = result.ns_response_array[i].ns[0];
}
return result_ns;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
ns_responses result = (ns_responses) service.get_payload_formatter().string_to_resource(ns_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_response_array);
}
ns[] result_ns = new ns[result.ns_response_array.length];
for(int i = 0; i < result.ns_response_array.length; i++)
{
result_ns[i] = result.ns_response_array[i].ns[0];
}
return result_ns;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"ns_responses",
"result",
"=",
"(",
"ns_responses",
")",
"service",
".",
"get_payload_formatter",
"(",
")"... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns.java#L1040-L1057 |
rzwitserloot/lombok | src/core/lombok/javac/apt/LombokProcessor.java | LombokProcessor.getJavacProcessingEnvironment | public JavacProcessingEnvironment getJavacProcessingEnvironment(Object procEnv) {
if (procEnv instanceof JavacProcessingEnvironment) return (JavacProcessingEnvironment) procEnv;
// try to find a "delegate" field in the object, and use this to try to obtain a JavacProcessingEnvironment
for (Class<?> procEnvClass = procEnv.getClass(); procEnvClass != null; procEnvClass = procEnvClass.getSuperclass()) {
try {
return getJavacProcessingEnvironment(tryGetDelegateField(procEnvClass, procEnv));
} catch (final Exception e) {
// delegate field was not found, try on superclass
}
}
processingEnv.getMessager().printMessage(Kind.WARNING,
"Can't get the delegate of the gradle IncrementalProcessingEnvironment. Lombok won't work.");
return null;
} | java | public JavacProcessingEnvironment getJavacProcessingEnvironment(Object procEnv) {
if (procEnv instanceof JavacProcessingEnvironment) return (JavacProcessingEnvironment) procEnv;
// try to find a "delegate" field in the object, and use this to try to obtain a JavacProcessingEnvironment
for (Class<?> procEnvClass = procEnv.getClass(); procEnvClass != null; procEnvClass = procEnvClass.getSuperclass()) {
try {
return getJavacProcessingEnvironment(tryGetDelegateField(procEnvClass, procEnv));
} catch (final Exception e) {
// delegate field was not found, try on superclass
}
}
processingEnv.getMessager().printMessage(Kind.WARNING,
"Can't get the delegate of the gradle IncrementalProcessingEnvironment. Lombok won't work.");
return null;
} | [
"public",
"JavacProcessingEnvironment",
"getJavacProcessingEnvironment",
"(",
"Object",
"procEnv",
")",
"{",
"if",
"(",
"procEnv",
"instanceof",
"JavacProcessingEnvironment",
")",
"return",
"(",
"JavacProcessingEnvironment",
")",
"procEnv",
";",
"// try to find a \"delegate\"... | This class casts the given processing environment to a JavacProcessingEnvironment. In case of
gradle incremental compilation, the delegate ProcessingEnvironment of the gradle wrapper is returned. | [
"This",
"class",
"casts",
"the",
"given",
"processing",
"environment",
"to",
"a",
"JavacProcessingEnvironment",
".",
"In",
"case",
"of",
"gradle",
"incremental",
"compilation",
"the",
"delegate",
"ProcessingEnvironment",
"of",
"the",
"gradle",
"wrapper",
"is",
"retu... | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/apt/LombokProcessor.java#L409-L424 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.deleteProject | public void deleteProject(CmsDbContext dbc, CmsProject deleteProject, boolean resetResources) throws CmsException {
CmsUUID projectId = deleteProject.getUuid();
if (resetResources) {
// changed/new/deleted files in the specified project
List<CmsResource> modifiedFiles = readChangedResourcesInsideProject(dbc, projectId, RCPRM_FILES_ONLY_MODE);
// changed/new/deleted folders in the specified project
List<CmsResource> modifiedFolders = readChangedResourcesInsideProject(
dbc,
projectId,
RCPRM_FOLDERS_ONLY_MODE);
resetResourcesInProject(dbc, projectId, modifiedFiles, modifiedFolders);
}
// unlock all resources in the project
m_lockManager.removeResourcesInProject(deleteProject.getUuid(), true);
m_monitor.clearAccessControlListCache();
m_monitor.clearResourceCache();
// set project to online project if current project is the one which will be deleted
if (projectId.equals(dbc.currentProject().getUuid())) {
dbc.getRequestContext().setCurrentProject(readProject(dbc, CmsProject.ONLINE_PROJECT_ID));
}
// delete the project itself
getProjectDriver(dbc).deleteProject(dbc, deleteProject);
m_monitor.uncacheProject(deleteProject);
// fire the corresponding event
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_PROJECT_MODIFIED,
Collections.<String, Object> singletonMap("project", deleteProject)));
} | java | public void deleteProject(CmsDbContext dbc, CmsProject deleteProject, boolean resetResources) throws CmsException {
CmsUUID projectId = deleteProject.getUuid();
if (resetResources) {
// changed/new/deleted files in the specified project
List<CmsResource> modifiedFiles = readChangedResourcesInsideProject(dbc, projectId, RCPRM_FILES_ONLY_MODE);
// changed/new/deleted folders in the specified project
List<CmsResource> modifiedFolders = readChangedResourcesInsideProject(
dbc,
projectId,
RCPRM_FOLDERS_ONLY_MODE);
resetResourcesInProject(dbc, projectId, modifiedFiles, modifiedFolders);
}
// unlock all resources in the project
m_lockManager.removeResourcesInProject(deleteProject.getUuid(), true);
m_monitor.clearAccessControlListCache();
m_monitor.clearResourceCache();
// set project to online project if current project is the one which will be deleted
if (projectId.equals(dbc.currentProject().getUuid())) {
dbc.getRequestContext().setCurrentProject(readProject(dbc, CmsProject.ONLINE_PROJECT_ID));
}
// delete the project itself
getProjectDriver(dbc).deleteProject(dbc, deleteProject);
m_monitor.uncacheProject(deleteProject);
// fire the corresponding event
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_PROJECT_MODIFIED,
Collections.<String, Object> singletonMap("project", deleteProject)));
} | [
"public",
"void",
"deleteProject",
"(",
"CmsDbContext",
"dbc",
",",
"CmsProject",
"deleteProject",
",",
"boolean",
"resetResources",
")",
"throws",
"CmsException",
"{",
"CmsUUID",
"projectId",
"=",
"deleteProject",
".",
"getUuid",
"(",
")",
";",
"if",
"(",
"rese... | Deletes a project.<p>
Only the admin or the owner of the project can do this.
@param dbc the current database context
@param deleteProject the project to be deleted
@param resetResources if true, the resources of the project to delete will be reset to their online state, or deleted if they have no online state
@throws CmsException if something goes wrong | [
"Deletes",
"a",
"project",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L2703-L2738 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/implicit/ConversionAnalyzer.java | ConversionAnalyzer.getConversionType | public static ConversionType getConversionType(final Field destination, final Field source){
return getConversionType(destination.getType(),source.getType());
} | java | public static ConversionType getConversionType(final Field destination, final Field source){
return getConversionType(destination.getType(),source.getType());
} | [
"public",
"static",
"ConversionType",
"getConversionType",
"(",
"final",
"Field",
"destination",
",",
"final",
"Field",
"source",
")",
"{",
"return",
"getConversionType",
"(",
"destination",
".",
"getType",
"(",
")",
",",
"source",
".",
"getType",
"(",
")",
")... | Analyzes Fields given as input and returns the type of conversion that has to be done.
@param destination Field to analyze
@param source Field to analyze
@return type of Conversion | [
"Analyzes",
"Fields",
"given",
"as",
"input",
"and",
"returns",
"the",
"type",
"of",
"conversion",
"that",
"has",
"to",
"be",
"done",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/implicit/ConversionAnalyzer.java#L39-L41 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/models/CDownloadRequest.java | CDownloadRequest.getHttpHeaders | public Headers getHttpHeaders()
{
Headers headers = new Headers();
if ( byteRange != null ) {
StringBuilder rangeBuilder = new StringBuilder( "bytes=" );
long start;
if ( byteRange.offset >= 0 ) {
rangeBuilder.append( byteRange.offset );
start = byteRange.offset;
} else {
start = 1;
}
rangeBuilder.append( "-" );
if ( byteRange.length > 0 ) {
rangeBuilder.append( start + byteRange.length - 1 );
}
Header rangeHeader = new BasicHeader( "Range", rangeBuilder.toString() );
headers.addHeader( rangeHeader );
}
return headers;
} | java | public Headers getHttpHeaders()
{
Headers headers = new Headers();
if ( byteRange != null ) {
StringBuilder rangeBuilder = new StringBuilder( "bytes=" );
long start;
if ( byteRange.offset >= 0 ) {
rangeBuilder.append( byteRange.offset );
start = byteRange.offset;
} else {
start = 1;
}
rangeBuilder.append( "-" );
if ( byteRange.length > 0 ) {
rangeBuilder.append( start + byteRange.length - 1 );
}
Header rangeHeader = new BasicHeader( "Range", rangeBuilder.toString() );
headers.addHeader( rangeHeader );
}
return headers;
} | [
"public",
"Headers",
"getHttpHeaders",
"(",
")",
"{",
"Headers",
"headers",
"=",
"new",
"Headers",
"(",
")",
";",
"if",
"(",
"byteRange",
"!=",
"null",
")",
"{",
"StringBuilder",
"rangeBuilder",
"=",
"new",
"StringBuilder",
"(",
"\"bytes=\"",
")",
";",
"lo... | Get the HTTP headers to be used for download request.
Default implementation only handles Range header.
@return The headers | [
"Get",
"the",
"HTTP",
"headers",
"to",
"be",
"used",
"for",
"download",
"request",
"."
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/models/CDownloadRequest.java#L62-L85 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/render/Responsive.java | Responsive.getSize | private static String getSize(IResponsiveLabel r, Sizes size) {
String colSize = "-1";
switch(size) {
case xs:
colSize = r.getLabelColXs();
if(colSize.equals("-1")) colSize = r.getLabelTinyScreen();
break;
case sm:
colSize = r.getLabelColSm();
if(colSize.equals("-1")) colSize = r.getLabelSmallScreen();
break;
case md:
colSize = r.getLabelColMd();
if(colSize.equals("-1")) colSize = r.getLabelMediumScreen();
break;
case lg:
colSize = r.getLabelColLg();
if(colSize.equals("-1")) colSize = r.getLabelLargeScreen();
break;
}
return colSize;
} | java | private static String getSize(IResponsiveLabel r, Sizes size) {
String colSize = "-1";
switch(size) {
case xs:
colSize = r.getLabelColXs();
if(colSize.equals("-1")) colSize = r.getLabelTinyScreen();
break;
case sm:
colSize = r.getLabelColSm();
if(colSize.equals("-1")) colSize = r.getLabelSmallScreen();
break;
case md:
colSize = r.getLabelColMd();
if(colSize.equals("-1")) colSize = r.getLabelMediumScreen();
break;
case lg:
colSize = r.getLabelColLg();
if(colSize.equals("-1")) colSize = r.getLabelLargeScreen();
break;
}
return colSize;
} | [
"private",
"static",
"String",
"getSize",
"(",
"IResponsiveLabel",
"r",
",",
"Sizes",
"size",
")",
"{",
"String",
"colSize",
"=",
"\"-1\"",
";",
"switch",
"(",
"size",
")",
"{",
"case",
"xs",
":",
"colSize",
"=",
"r",
".",
"getLabelColXs",
"(",
")",
";... | Decode col sizes between two way of definition
@param col
@param size
@return | [
"Decode",
"col",
"sizes",
"between",
"two",
"way",
"of",
"definition"
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/Responsive.java#L131-L152 |
bwkimmel/java-util | src/main/java/ca/eandb/util/sql/DbUtil.java | DbUtil.getTypeName | public static String getTypeName(int type, int length, DataSource ds) throws SQLException {
Connection con = null;
try {
con = ds.getConnection();
return getTypeName(type, length, con);
} finally {
close(con);
}
} | java | public static String getTypeName(int type, int length, DataSource ds) throws SQLException {
Connection con = null;
try {
con = ds.getConnection();
return getTypeName(type, length, con);
} finally {
close(con);
}
} | [
"public",
"static",
"String",
"getTypeName",
"(",
"int",
"type",
",",
"int",
"length",
",",
"DataSource",
"ds",
")",
"throws",
"SQLException",
"{",
"Connection",
"con",
"=",
"null",
";",
"try",
"{",
"con",
"=",
"ds",
".",
"getConnection",
"(",
")",
";",
... | Gets the <code>String</code> denoting the specified SQL data type.
@param type The data type to get the name of. Valid type values
consist of the static fields of {@link java.sql.Types}.
@param length The length to assign to data types for those types
that require a length (e.g., <code>VARCHAR(n)</code>), or zero
to indicate that no length is required.
@param ds The <code>DataSource</code> for which to get the type name.
@return The name of the type, or <code>null</code> if no such type
exists.
@throws SQLException If an error occurs while communicating with the
database.
@see java.sql.Types | [
"Gets",
"the",
"<code",
">",
"String<",
"/",
"code",
">",
"denoting",
"the",
"specified",
"SQL",
"data",
"type",
"."
] | train | https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/sql/DbUtil.java#L420-L428 |
dverstap/jsmiparser | jsmiparser-api/src/main/java/org/jsmiparser/phase/file/ModuleParser.java | ModuleParser.createIntegerType | public SmiType createIntegerType(IdToken idToken, IntKeywordToken intToken, Token applicationTagToken, List<SmiNamedNumber> namedNumbers, List<SmiRange> rangeConstraints) {
if (idToken == null && intToken.getPrimitiveType() == INTEGER && namedNumbers == null && rangeConstraints == null) {
return SmiConstants.INTEGER_TYPE;
} else if (idToken != null || namedNumbers != null || rangeConstraints != null) {
SmiType type = createPotentiallyTaggedType(idToken, applicationTagToken);
if (intToken.getPrimitiveType() == INTEGER) {
type.setBaseType(SmiConstants.INTEGER_TYPE);
} else {
type.setBaseType(new SmiReferencedType(intToken, m_module));
}
type.setEnumValues(namedNumbers);
type.setRangeConstraints(rangeConstraints);
return type;
}
return new SmiReferencedType(intToken, m_module);
} | java | public SmiType createIntegerType(IdToken idToken, IntKeywordToken intToken, Token applicationTagToken, List<SmiNamedNumber> namedNumbers, List<SmiRange> rangeConstraints) {
if (idToken == null && intToken.getPrimitiveType() == INTEGER && namedNumbers == null && rangeConstraints == null) {
return SmiConstants.INTEGER_TYPE;
} else if (idToken != null || namedNumbers != null || rangeConstraints != null) {
SmiType type = createPotentiallyTaggedType(idToken, applicationTagToken);
if (intToken.getPrimitiveType() == INTEGER) {
type.setBaseType(SmiConstants.INTEGER_TYPE);
} else {
type.setBaseType(new SmiReferencedType(intToken, m_module));
}
type.setEnumValues(namedNumbers);
type.setRangeConstraints(rangeConstraints);
return type;
}
return new SmiReferencedType(intToken, m_module);
} | [
"public",
"SmiType",
"createIntegerType",
"(",
"IdToken",
"idToken",
",",
"IntKeywordToken",
"intToken",
",",
"Token",
"applicationTagToken",
",",
"List",
"<",
"SmiNamedNumber",
">",
"namedNumbers",
",",
"List",
"<",
"SmiRange",
">",
"rangeConstraints",
")",
"{",
... | and resolve references to INTEGER, BITS, ... during the XRef phase | [
"and",
"resolve",
"references",
"to",
"INTEGER",
"BITS",
"...",
"during",
"the",
"XRef",
"phase"
] | train | https://github.com/dverstap/jsmiparser/blob/1ba26599e573682d17e34363a85cf3a42cc06383/jsmiparser-api/src/main/java/org/jsmiparser/phase/file/ModuleParser.java#L246-L261 |
netty/netty | common/src/main/java/io/netty/util/internal/SystemPropertyUtil.java | SystemPropertyUtil.getBoolean | public static boolean getBoolean(String key, boolean def) {
String value = get(key);
if (value == null) {
return def;
}
value = value.trim().toLowerCase();
if (value.isEmpty()) {
return def;
}
if ("true".equals(value) || "yes".equals(value) || "1".equals(value)) {
return true;
}
if ("false".equals(value) || "no".equals(value) || "0".equals(value)) {
return false;
}
logger.warn(
"Unable to parse the boolean system property '{}':{} - using the default value: {}",
key, value, def
);
return def;
} | java | public static boolean getBoolean(String key, boolean def) {
String value = get(key);
if (value == null) {
return def;
}
value = value.trim().toLowerCase();
if (value.isEmpty()) {
return def;
}
if ("true".equals(value) || "yes".equals(value) || "1".equals(value)) {
return true;
}
if ("false".equals(value) || "no".equals(value) || "0".equals(value)) {
return false;
}
logger.warn(
"Unable to parse the boolean system property '{}':{} - using the default value: {}",
key, value, def
);
return def;
} | [
"public",
"static",
"boolean",
"getBoolean",
"(",
"String",
"key",
",",
"boolean",
"def",
")",
"{",
"String",
"value",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"def",
";",
"}",
"value",
"=",
"value",
"... | Returns the value of the Java system property with the specified
{@code key}, while falling back to the specified default value if
the property access fails.
@return the property value.
{@code def} if there's no such property or if an access to the
specified property is not allowed. | [
"Returns",
"the",
"value",
"of",
"the",
"Java",
"system",
"property",
"with",
"the",
"specified",
"{",
"@code",
"key",
"}",
"while",
"falling",
"back",
"to",
"the",
"specified",
"default",
"value",
"if",
"the",
"property",
"access",
"fails",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/SystemPropertyUtil.java#L98-L123 |
tvesalainen/hoski-lib | src/main/java/fi/hoski/datastore/repository/DataObjectModel.java | DataObjectModel.view | public DataObjectModel view(int from, int to)
{
DataObjectModel view = clone();
view.propertyList = propertyList.subList(from, to);
return view;
} | java | public DataObjectModel view(int from, int to)
{
DataObjectModel view = clone();
view.propertyList = propertyList.subList(from, to);
return view;
} | [
"public",
"DataObjectModel",
"view",
"(",
"int",
"from",
",",
"int",
"to",
")",
"{",
"DataObjectModel",
"view",
"=",
"clone",
"(",
")",
";",
"view",
".",
"propertyList",
"=",
"propertyList",
".",
"subList",
"(",
"from",
",",
"to",
")",
";",
"return",
"... | Returns a clone of this model where only propertyList starting from from
ending to to (exclusive) are present.
@param from
@param to
@return | [
"Returns",
"a",
"clone",
"of",
"this",
"model",
"where",
"only",
"propertyList",
"starting",
"from",
"from",
"ending",
"to",
"to",
"(",
"exclusive",
")",
"are",
"present",
"."
] | train | https://github.com/tvesalainen/hoski-lib/blob/9b5bab44113e0adb74bf1ee436013e8a7c608d00/src/main/java/fi/hoski/datastore/repository/DataObjectModel.java#L173-L178 |
chhh/MSFTBX | MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java | JaxbUtils.createXmlStreamReader | public static XMLStreamReader createXmlStreamReader(InputStream is, boolean namespaceAware)
throws JAXBException {
XMLInputFactory xif = getXmlInputFactory(namespaceAware);
XMLStreamReader xsr = null;
try {
xsr = xif.createXMLStreamReader(is);
} catch (XMLStreamException e) {
throw new JAXBException(e);
}
return xsr;
} | java | public static XMLStreamReader createXmlStreamReader(InputStream is, boolean namespaceAware)
throws JAXBException {
XMLInputFactory xif = getXmlInputFactory(namespaceAware);
XMLStreamReader xsr = null;
try {
xsr = xif.createXMLStreamReader(is);
} catch (XMLStreamException e) {
throw new JAXBException(e);
}
return xsr;
} | [
"public",
"static",
"XMLStreamReader",
"createXmlStreamReader",
"(",
"InputStream",
"is",
",",
"boolean",
"namespaceAware",
")",
"throws",
"JAXBException",
"{",
"XMLInputFactory",
"xif",
"=",
"getXmlInputFactory",
"(",
"namespaceAware",
")",
";",
"XMLStreamReader",
"xsr... | Creates an XMLStreamReader based on an input stream.
@param is the input stream from which the data to be parsed will be taken
@param namespaceAware if {@code false} the XMLStreamReader will remove all namespaces from all
XML elements
@return platform-specific XMLStreamReader implementation
@throws JAXBException if the XMLStreamReader could not be created | [
"Creates",
"an",
"XMLStreamReader",
"based",
"on",
"an",
"input",
"stream",
"."
] | train | https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L134-L144 |
NessComputing/components-ness-httpclient | client/src/main/java/com/nesscomputing/httpclient/HttpClient.java | HttpClient.perform | public <T> HttpClientRequest.Builder<T> perform(final String methodName, final URI uri, final HttpClientResponseHandler<T> httpHandler) {
final HttpClientMethod method;
try {
method = HttpClientMethod.valueOf(methodName.toUpperCase(Locale.ENGLISH));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Unknown HTTP method type " + methodName, e);
}
return new HttpClientRequest.Builder<T>(httpClientFactory, method, uri, httpHandler);
} | java | public <T> HttpClientRequest.Builder<T> perform(final String methodName, final URI uri, final HttpClientResponseHandler<T> httpHandler) {
final HttpClientMethod method;
try {
method = HttpClientMethod.valueOf(methodName.toUpperCase(Locale.ENGLISH));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Unknown HTTP method type " + methodName, e);
}
return new HttpClientRequest.Builder<T>(httpClientFactory, method, uri, httpHandler);
} | [
"public",
"<",
"T",
">",
"HttpClientRequest",
".",
"Builder",
"<",
"T",
">",
"perform",
"(",
"final",
"String",
"methodName",
",",
"final",
"URI",
"uri",
",",
"final",
"HttpClientResponseHandler",
"<",
"T",
">",
"httpHandler",
")",
"{",
"final",
"HttpClientM... | Start building a request with a user-supplied HTTP method (of the standard HTTP verbs) | [
"Start",
"building",
"a",
"request",
"with",
"a",
"user",
"-",
"supplied",
"HTTP",
"method",
"(",
"of",
"the",
"standard",
"HTTP",
"verbs",
")"
] | train | https://github.com/NessComputing/components-ness-httpclient/blob/8e97e8576e470449672c81fa7890c60f9986966d/client/src/main/java/com/nesscomputing/httpclient/HttpClient.java#L271-L280 |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitWriter.java | Bzip2BitWriter.writeBits | void writeBits(ByteBuf out, final int count, final long value) {
if (count < 0 || count > 32) {
throw new IllegalArgumentException("count: " + count + " (expected: 0-32)");
}
int bitCount = this.bitCount;
long bitBuffer = this.bitBuffer | value << 64 - count >>> bitCount;
bitCount += count;
if (bitCount >= 32) {
out.writeInt((int) (bitBuffer >>> 32));
bitBuffer <<= 32;
bitCount -= 32;
}
this.bitBuffer = bitBuffer;
this.bitCount = bitCount;
} | java | void writeBits(ByteBuf out, final int count, final long value) {
if (count < 0 || count > 32) {
throw new IllegalArgumentException("count: " + count + " (expected: 0-32)");
}
int bitCount = this.bitCount;
long bitBuffer = this.bitBuffer | value << 64 - count >>> bitCount;
bitCount += count;
if (bitCount >= 32) {
out.writeInt((int) (bitBuffer >>> 32));
bitBuffer <<= 32;
bitCount -= 32;
}
this.bitBuffer = bitBuffer;
this.bitCount = bitCount;
} | [
"void",
"writeBits",
"(",
"ByteBuf",
"out",
",",
"final",
"int",
"count",
",",
"final",
"long",
"value",
")",
"{",
"if",
"(",
"count",
"<",
"0",
"||",
"count",
">",
"32",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"count: \"",
"+",
"c... | Writes up to 32 bits to the output {@link ByteBuf}.
@param count The number of bits to write (maximum {@code 32} as a size of {@code int})
@param value The bits to write | [
"Writes",
"up",
"to",
"32",
"bits",
"to",
"the",
"output",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitWriter.java#L41-L56 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/FavoriteResourcesImpl.java | FavoriteResourcesImpl.removeFavorites | public void removeFavorites(FavoriteType favoriteType, Set<Long> objectIds) throws SmartsheetException{
String path = "favorites/" + favoriteType.toString();
HashMap<String, Object> parameters = new HashMap<String, Object>();
if (objectIds != null) {
parameters.put("objectIds", QueryUtil.generateCommaSeparatedList(objectIds));
}
path += QueryUtil.generateUrl(null, parameters);
this.deleteResource(path, Favorite.class);
} | java | public void removeFavorites(FavoriteType favoriteType, Set<Long> objectIds) throws SmartsheetException{
String path = "favorites/" + favoriteType.toString();
HashMap<String, Object> parameters = new HashMap<String, Object>();
if (objectIds != null) {
parameters.put("objectIds", QueryUtil.generateCommaSeparatedList(objectIds));
}
path += QueryUtil.generateUrl(null, parameters);
this.deleteResource(path, Favorite.class);
} | [
"public",
"void",
"removeFavorites",
"(",
"FavoriteType",
"favoriteType",
",",
"Set",
"<",
"Long",
">",
"objectIds",
")",
"throws",
"SmartsheetException",
"{",
"String",
"path",
"=",
"\"favorites/\"",
"+",
"favoriteType",
".",
"toString",
"(",
")",
";",
"HashMap... | Deletes a list of favorites (all of the same type)
It mirrors to the following Smartsheet REST API method: DELETE /favorites
Exceptions:
IllegalArgumentException : if any argument is null
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ResourceNotFoundException : if the resource can not be found
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param favoriteType the favorite type
@param objectIds a single Favorite object or an array of Favorite objects
@throws SmartsheetException the smartsheet exception | [
"Deletes",
"a",
"list",
"of",
"favorites",
"(",
"all",
"of",
"the",
"same",
"type",
")"
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/FavoriteResourcesImpl.java#L122-L133 |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/tracer/Tracer.java | Tracer.pushCCMContext | public static synchronized void pushCCMContext(String key, Throwable callstack)
{
log.tracef("%s", new TraceEvent("CachedConnectionManager", "NONE", TraceEvent.PUSH_CCM_CONTEXT,
"NONE", key, callstack != null ? toString(callstack) : ""));
} | java | public static synchronized void pushCCMContext(String key, Throwable callstack)
{
log.tracef("%s", new TraceEvent("CachedConnectionManager", "NONE", TraceEvent.PUSH_CCM_CONTEXT,
"NONE", key, callstack != null ? toString(callstack) : ""));
} | [
"public",
"static",
"synchronized",
"void",
"pushCCMContext",
"(",
"String",
"key",
",",
"Throwable",
"callstack",
")",
"{",
"log",
".",
"tracef",
"(",
"\"%s\"",
",",
"new",
"TraceEvent",
"(",
"\"CachedConnectionManager\"",
",",
"\"NONE\"",
",",
"TraceEvent",
".... | Push CCM context
@param key The frame key
@param callstack The call stack | [
"Push",
"CCM",
"context"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tracer/Tracer.java#L584-L588 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/util/converters/DeployerResolverOverriderConverter.java | DeployerResolverOverriderConverter.overrideUseArtifactoryGradlePlugin | private void overrideUseArtifactoryGradlePlugin(T overrider, Class overriderClass) {
if (overriderClass.getSimpleName().equals(ArtifactoryGradleConfigurator.class.getSimpleName())) {
try {
Field useArtifactoryGradlePluginField = overriderClass.getDeclaredField("useArtifactoryGradlePlugin");
useArtifactoryGradlePluginField.setAccessible(true);
Object useArtifactoryGradlePlugin = useArtifactoryGradlePluginField.get(overrider);
if (useArtifactoryGradlePlugin == null) {
Field skipInjectInitScriptField = overriderClass.getDeclaredField("skipInjectInitScript");
skipInjectInitScriptField.setAccessible(true);
Object skipInjectInitScript = skipInjectInitScriptField.get(overrider);
if (skipInjectInitScript instanceof Boolean && skipInjectInitScript != null) {
useArtifactoryGradlePluginField.set(overrider, skipInjectInitScript);
}
}
} catch (NoSuchFieldException | IllegalAccessException e) {
converterErrors.add(getConversionErrorMessage(overrider, e));
}
}
} | java | private void overrideUseArtifactoryGradlePlugin(T overrider, Class overriderClass) {
if (overriderClass.getSimpleName().equals(ArtifactoryGradleConfigurator.class.getSimpleName())) {
try {
Field useArtifactoryGradlePluginField = overriderClass.getDeclaredField("useArtifactoryGradlePlugin");
useArtifactoryGradlePluginField.setAccessible(true);
Object useArtifactoryGradlePlugin = useArtifactoryGradlePluginField.get(overrider);
if (useArtifactoryGradlePlugin == null) {
Field skipInjectInitScriptField = overriderClass.getDeclaredField("skipInjectInitScript");
skipInjectInitScriptField.setAccessible(true);
Object skipInjectInitScript = skipInjectInitScriptField.get(overrider);
if (skipInjectInitScript instanceof Boolean && skipInjectInitScript != null) {
useArtifactoryGradlePluginField.set(overrider, skipInjectInitScript);
}
}
} catch (NoSuchFieldException | IllegalAccessException e) {
converterErrors.add(getConversionErrorMessage(overrider, e));
}
}
} | [
"private",
"void",
"overrideUseArtifactoryGradlePlugin",
"(",
"T",
"overrider",
",",
"Class",
"overriderClass",
")",
"{",
"if",
"(",
"overriderClass",
".",
"getSimpleName",
"(",
")",
".",
"equals",
"(",
"ArtifactoryGradleConfigurator",
".",
"class",
".",
"getSimpleN... | Convert the Boolean skipInjectInitScript parameter to Boolean useArtifactoryGradlePlugin
This convertion comes after a name change (skipInjectInitScript -> useArtifactoryGradlePlugin) | [
"Convert",
"the",
"Boolean",
"skipInjectInitScript",
"parameter",
"to",
"Boolean",
"useArtifactoryGradlePlugin",
"This",
"convertion",
"comes",
"after",
"a",
"name",
"change",
"(",
"skipInjectInitScript",
"-",
">",
"useArtifactoryGradlePlugin",
")"
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/converters/DeployerResolverOverriderConverter.java#L256-L275 |
alkacon/opencms-core | src/org/opencms/loader/CmsJspLoader.java | CmsJspLoader.processTaglibAttributes | @Deprecated
public String processTaglibAttributes(String content) {
// matches a whole page directive
final Pattern directivePattern = Pattern.compile("(?sm)<%@\\s*page.*?%>");
// matches a taglibs attribute and captures its values
final Pattern taglibPattern = Pattern.compile("(?sm)taglibs\\s*=\\s*\"(.*?)\"");
final Pattern commaPattern = Pattern.compile("(?sm)\\s*,\\s*");
final Set<String> taglibs = new LinkedHashSet<String>();
// we insert the marker after the first page directive
final String marker = ":::TAGLIBS:::";
I_CmsRegexSubstitution directiveSub = new I_CmsRegexSubstitution() {
private boolean m_first = true;
public String substituteMatch(String string, Matcher matcher) {
String match = string.substring(matcher.start(), matcher.end());
I_CmsRegexSubstitution taglibSub = new I_CmsRegexSubstitution() {
public String substituteMatch(String string1, Matcher matcher1) {
// values of the taglibs attribute
String match1 = string1.substring(matcher1.start(1), matcher1.end(1));
for (String taglibKey : Splitter.on(commaPattern).split(match1)) {
taglibs.add(taglibKey);
}
return "";
}
};
String result = CmsStringUtil.substitute(taglibPattern, match, taglibSub);
if (m_first) {
result += marker;
m_first = false;
}
return result;
}
};
String substituted = CmsStringUtil.substitute(directivePattern, content, directiveSub);
// insert taglib inclusion
substituted = substituted.replaceAll(marker, generateTaglibInclusions(taglibs));
// remove empty page directives
substituted = substituted.replaceAll("(?sm)<%@\\s*page\\s*%>", "");
return substituted;
} | java | @Deprecated
public String processTaglibAttributes(String content) {
// matches a whole page directive
final Pattern directivePattern = Pattern.compile("(?sm)<%@\\s*page.*?%>");
// matches a taglibs attribute and captures its values
final Pattern taglibPattern = Pattern.compile("(?sm)taglibs\\s*=\\s*\"(.*?)\"");
final Pattern commaPattern = Pattern.compile("(?sm)\\s*,\\s*");
final Set<String> taglibs = new LinkedHashSet<String>();
// we insert the marker after the first page directive
final String marker = ":::TAGLIBS:::";
I_CmsRegexSubstitution directiveSub = new I_CmsRegexSubstitution() {
private boolean m_first = true;
public String substituteMatch(String string, Matcher matcher) {
String match = string.substring(matcher.start(), matcher.end());
I_CmsRegexSubstitution taglibSub = new I_CmsRegexSubstitution() {
public String substituteMatch(String string1, Matcher matcher1) {
// values of the taglibs attribute
String match1 = string1.substring(matcher1.start(1), matcher1.end(1));
for (String taglibKey : Splitter.on(commaPattern).split(match1)) {
taglibs.add(taglibKey);
}
return "";
}
};
String result = CmsStringUtil.substitute(taglibPattern, match, taglibSub);
if (m_first) {
result += marker;
m_first = false;
}
return result;
}
};
String substituted = CmsStringUtil.substitute(directivePattern, content, directiveSub);
// insert taglib inclusion
substituted = substituted.replaceAll(marker, generateTaglibInclusions(taglibs));
// remove empty page directives
substituted = substituted.replaceAll("(?sm)<%@\\s*page\\s*%>", "");
return substituted;
} | [
"@",
"Deprecated",
"public",
"String",
"processTaglibAttributes",
"(",
"String",
"content",
")",
"{",
"// matches a whole page directive",
"final",
"Pattern",
"directivePattern",
"=",
"Pattern",
".",
"compile",
"(",
"\"(?sm)<%@\\\\s*page.*?%>\"",
")",
";",
"// matches a t... | Replaces taglib attributes in page directives with taglib directives.<p>
@param content the JSP source text
@return the transformed JSP text | [
"Replaces",
"taglib",
"attributes",
"in",
"page",
"directives",
"with",
"taglib",
"directives",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsJspLoader.java#L550-L594 |
op4j/op4j | src/main/java/org/op4j/functions/FnFunc.java | FnFunc.ifNullThen | public static final <T> Function<T,T> ifNullThen(final Type<T> targetType, final IFunction<? super T,? extends T> thenFunction) {
return ifTrueThen(targetType, FnObject.isNull(), thenFunction);
} | java | public static final <T> Function<T,T> ifNullThen(final Type<T> targetType, final IFunction<? super T,? extends T> thenFunction) {
return ifTrueThen(targetType, FnObject.isNull(), thenFunction);
} | [
"public",
"static",
"final",
"<",
"T",
">",
"Function",
"<",
"T",
",",
"T",
">",
"ifNullThen",
"(",
"final",
"Type",
"<",
"T",
">",
"targetType",
",",
"final",
"IFunction",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"T",
">",
"thenFunction",
")",
... | <p>
Builds a function that will execute the specified function <tt>thenFunction</tt>
only if the target object is null.
</p>
<p>
The built function cannot change the return type (receives <tt>T</tt> and returns <tt>T</tt>)
because the <tt>thenFunction</tt> could remain unexecuted, and so the type returned by
<tt>thenFunction</tt> must be the same as the type required as input, in order to keep
consistency.
</p>
@param targetType the target type.
@param thenFunction the function to be executed on the target object if it is null.
@return a function that executes the "thenFunction" if the target object is null. | [
"<p",
">",
"Builds",
"a",
"function",
"that",
"will",
"execute",
"the",
"specified",
"function",
"<tt",
">",
"thenFunction<",
"/",
"tt",
">",
"only",
"if",
"the",
"target",
"object",
"is",
"null",
".",
"<",
"/",
"p",
">",
"<p",
">",
"The",
"built",
"... | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnFunc.java#L176-L178 |
lucee/Lucee | core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java | XMLConfigWebFactory.reloadInstance | public static void reloadInstance(CFMLEngine engine, ConfigServerImpl cs, ConfigWebImpl cw, boolean force)
throws SAXException, ClassException, PageException, IOException, TagLibException, FunctionLibException, BundleException {
Resource configFile = cw.getConfigFile();
Resource configDir = cw.getConfigDir();
int iDoNew = doNew(engine, configDir, false).updateType;
boolean doNew = iDoNew != NEW_NONE;
if (configFile == null) return;
if (second(cw.getLoadTime()) > second(configFile.lastModified()) && !force) return;
Document doc = loadDocument(configFile);
createContextFiles(configDir, null, doNew);
cw.reset();
load(cs, cw, doc, true, doNew);
createContextFilesPost(configDir, cw, null, false, doNew);
((CFMLEngineImpl) ConfigWebUtil.getEngine(cw)).onStart(cw, true);
} | java | public static void reloadInstance(CFMLEngine engine, ConfigServerImpl cs, ConfigWebImpl cw, boolean force)
throws SAXException, ClassException, PageException, IOException, TagLibException, FunctionLibException, BundleException {
Resource configFile = cw.getConfigFile();
Resource configDir = cw.getConfigDir();
int iDoNew = doNew(engine, configDir, false).updateType;
boolean doNew = iDoNew != NEW_NONE;
if (configFile == null) return;
if (second(cw.getLoadTime()) > second(configFile.lastModified()) && !force) return;
Document doc = loadDocument(configFile);
createContextFiles(configDir, null, doNew);
cw.reset();
load(cs, cw, doc, true, doNew);
createContextFilesPost(configDir, cw, null, false, doNew);
((CFMLEngineImpl) ConfigWebUtil.getEngine(cw)).onStart(cw, true);
} | [
"public",
"static",
"void",
"reloadInstance",
"(",
"CFMLEngine",
"engine",
",",
"ConfigServerImpl",
"cs",
",",
"ConfigWebImpl",
"cw",
",",
"boolean",
"force",
")",
"throws",
"SAXException",
",",
"ClassException",
",",
"PageException",
",",
"IOException",
",",
"Tag... | reloads the Config Object
@param cs
@param force
@throws SAXException
@throws ClassNotFoundException
@throws PageException
@throws IOException
@throws TagLibException
@throws FunctionLibException
@throws BundleException
@throws NoSuchAlgorithmException | [
"reloads",
"the",
"Config",
"Object"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java#L321-L340 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/KMedoidsPark.java | KMedoidsPark.currentCluster | protected int currentCluster(List<? extends ModifiableDBIDs> clusters, DBIDRef id) {
for(int i = 0; i < k; i++) {
if(clusters.get(i).contains(id)) {
return i;
}
}
return -1;
} | java | protected int currentCluster(List<? extends ModifiableDBIDs> clusters, DBIDRef id) {
for(int i = 0; i < k; i++) {
if(clusters.get(i).contains(id)) {
return i;
}
}
return -1;
} | [
"protected",
"int",
"currentCluster",
"(",
"List",
"<",
"?",
"extends",
"ModifiableDBIDs",
">",
"clusters",
",",
"DBIDRef",
"id",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"k",
";",
"i",
"++",
")",
"{",
"if",
"(",
"clusters",
".",
... | Find the current cluster assignment.
@param clusters Clusters
@param id Current object
@return Current cluster assignment. | [
"Find",
"the",
"current",
"cluster",
"assignment",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/KMedoidsPark.java#L286-L293 |
trustathsh/ifmapj | src/main/java/de/hshannover/f4/trust/ifmapj/channel/AbstractCommunicationHandler.java | AbstractCommunicationHandler.getNewSocket | private SSLSocket getNewSocket() throws IOException {
String host = getUrl().getHost();
int port = getPort();
Socket socketConnection = new Socket();
InetSocketAddress mapServerAddress = new InetSocketAddress(host, port);
socketConnection.connect(mapServerAddress, mInitialConnectionTimeout);
SSLSocket ret = (SSLSocket) mSocketFactory.createSocket(socketConnection, host, port, true);
ret.setTcpNoDelay(true);
ret.setWantClientAuth(true);
// Check if all is good... Will throw IOException if we don't
// like the other end...
ret.getSession().getPeerCertificates();
if (!mHostnameVerifier.verify(mUrl.getHost(), ret.getSession())) {
throw new IOException("Hostname Verification failed! "
+ "Did you set ifmapj.communication.verifypeerhost?");
}
return ret;
} | java | private SSLSocket getNewSocket() throws IOException {
String host = getUrl().getHost();
int port = getPort();
Socket socketConnection = new Socket();
InetSocketAddress mapServerAddress = new InetSocketAddress(host, port);
socketConnection.connect(mapServerAddress, mInitialConnectionTimeout);
SSLSocket ret = (SSLSocket) mSocketFactory.createSocket(socketConnection, host, port, true);
ret.setTcpNoDelay(true);
ret.setWantClientAuth(true);
// Check if all is good... Will throw IOException if we don't
// like the other end...
ret.getSession().getPeerCertificates();
if (!mHostnameVerifier.verify(mUrl.getHost(), ret.getSession())) {
throw new IOException("Hostname Verification failed! "
+ "Did you set ifmapj.communication.verifypeerhost?");
}
return ret;
} | [
"private",
"SSLSocket",
"getNewSocket",
"(",
")",
"throws",
"IOException",
"{",
"String",
"host",
"=",
"getUrl",
"(",
")",
".",
"getHost",
"(",
")",
";",
"int",
"port",
"=",
"getPort",
"(",
")",
";",
"Socket",
"socketConnection",
"=",
"new",
"Socket",
"(... | Before we allocate a new socket, try to delete the old one.
closeTcpConnection() needs to be a nop for non-opened connections.
@return
@throws IOException | [
"Before",
"we",
"allocate",
"a",
"new",
"socket",
"try",
"to",
"delete",
"the",
"old",
"one",
".",
"closeTcpConnection",
"()",
"needs",
"to",
"be",
"a",
"nop",
"for",
"non",
"-",
"opened",
"connections",
"."
] | train | https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/channel/AbstractCommunicationHandler.java#L284-L305 |
raydac/java-comment-preprocessor | jcp/src/main/java/com/igormaznitsa/jcp/expression/ExpressionTree.java | ExpressionTree.addItem | public void addItem(@Nonnull final ExpressionItem item) {
if (item == null) {
throw new PreprocessorException("[Expression]Item is null", this.sources, this.includeStack, null);
}
if (last.isEmptySlot()) {
last = new ExpressionTreeElement(item, this.includeStack, this.sources);
} else {
last = last.addTreeElement(new ExpressionTreeElement(item, this.includeStack, this.sources));
}
} | java | public void addItem(@Nonnull final ExpressionItem item) {
if (item == null) {
throw new PreprocessorException("[Expression]Item is null", this.sources, this.includeStack, null);
}
if (last.isEmptySlot()) {
last = new ExpressionTreeElement(item, this.includeStack, this.sources);
} else {
last = last.addTreeElement(new ExpressionTreeElement(item, this.includeStack, this.sources));
}
} | [
"public",
"void",
"addItem",
"(",
"@",
"Nonnull",
"final",
"ExpressionItem",
"item",
")",
"{",
"if",
"(",
"item",
"==",
"null",
")",
"{",
"throw",
"new",
"PreprocessorException",
"(",
"\"[Expression]Item is null\"",
",",
"this",
".",
"sources",
",",
"this",
... | Add new expression item into tree
@param item an item to be added, must not be null | [
"Add",
"new",
"expression",
"item",
"into",
"tree"
] | train | https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/jcp/expression/ExpressionTree.java#L68-L78 |
otto-de/edison-microservice | edison-core/src/main/java/de/otto/edison/status/domain/StatusDetail.java | StatusDetail.withDetail | public StatusDetail withDetail(final String key, final String value) {
final LinkedHashMap<String, String> newDetails = new LinkedHashMap<>(details);
newDetails.put(key, value);
return statusDetail(name,status,message, newDetails);
} | java | public StatusDetail withDetail(final String key, final String value) {
final LinkedHashMap<String, String> newDetails = new LinkedHashMap<>(details);
newDetails.put(key, value);
return statusDetail(name,status,message, newDetails);
} | [
"public",
"StatusDetail",
"withDetail",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
")",
"{",
"final",
"LinkedHashMap",
"<",
"String",
",",
"String",
">",
"newDetails",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
"details",
")",
";",
"newDeta... | Create a copy of this StatusDetail, add a detail and return the new StatusDetail.
@param key the key of the additional detail
@param value the value of the additional detail
@return StatusDetail | [
"Create",
"a",
"copy",
"of",
"this",
"StatusDetail",
"add",
"a",
"detail",
"and",
"return",
"the",
"new",
"StatusDetail",
"."
] | train | https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-core/src/main/java/de/otto/edison/status/domain/StatusDetail.java#L132-L136 |
micrometer-metrics/micrometer | micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/ExecutorServiceMetrics.java | ExecutorServiceMetrics.monitor | public static ExecutorService monitor(MeterRegistry registry, ExecutorService executor, String executorServiceName, Tag... tags) {
return monitor(registry, executor, executorServiceName, asList(tags));
} | java | public static ExecutorService monitor(MeterRegistry registry, ExecutorService executor, String executorServiceName, Tag... tags) {
return monitor(registry, executor, executorServiceName, asList(tags));
} | [
"public",
"static",
"ExecutorService",
"monitor",
"(",
"MeterRegistry",
"registry",
",",
"ExecutorService",
"executor",
",",
"String",
"executorServiceName",
",",
"Tag",
"...",
"tags",
")",
"{",
"return",
"monitor",
"(",
"registry",
",",
"executor",
",",
"executor... | Record metrics on the use of an {@link ExecutorService}.
@param registry The registry to bind metrics to.
@param executor The executor to instrument.
@param executorServiceName Will be used to tag metrics with "name".
@param tags Tags to apply to all recorded metrics.
@return The instrumented executor, proxied. | [
"Record",
"metrics",
"on",
"the",
"use",
"of",
"an",
"{",
"@link",
"ExecutorService",
"}",
"."
] | train | https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/ExecutorServiceMetrics.java#L105-L107 |
Netflix/spectator | spectator-web-spring/src/main/java/com/netflix/spectator/controllers/MetricsController.java | MetricsController.getMetrics | @RequestMapping(method = RequestMethod.GET)
public ApplicationRegistry getMetrics(@RequestParam Map<String, String> filters)
throws IOException {
boolean all = filters.get("all") != null;
String filterMeterNameRegex = filters.getOrDefault("meterNameRegex", "");
String filterTagNameRegex = filters.getOrDefault("tagNameRegex", "");
String filterTagValueRegex = filters.getOrDefault("tagValueRegex", "");
TagMeasurementFilter queryFilter = new TagMeasurementFilter(
filterMeterNameRegex, filterTagNameRegex, filterTagValueRegex);
Predicate<Measurement> filter;
if (all) {
filter = queryFilter;
} else {
filter = queryFilter.and(getDefaultMeasurementFilter());
}
ApplicationRegistry response = new ApplicationRegistry();
response.setApplicationName(applicationName);
response.setApplicationVersion(applicationVersion);
response.setMetrics(encodeRegistry(registry, filter));
return response;
} | java | @RequestMapping(method = RequestMethod.GET)
public ApplicationRegistry getMetrics(@RequestParam Map<String, String> filters)
throws IOException {
boolean all = filters.get("all") != null;
String filterMeterNameRegex = filters.getOrDefault("meterNameRegex", "");
String filterTagNameRegex = filters.getOrDefault("tagNameRegex", "");
String filterTagValueRegex = filters.getOrDefault("tagValueRegex", "");
TagMeasurementFilter queryFilter = new TagMeasurementFilter(
filterMeterNameRegex, filterTagNameRegex, filterTagValueRegex);
Predicate<Measurement> filter;
if (all) {
filter = queryFilter;
} else {
filter = queryFilter.and(getDefaultMeasurementFilter());
}
ApplicationRegistry response = new ApplicationRegistry();
response.setApplicationName(applicationName);
response.setApplicationVersion(applicationVersion);
response.setMetrics(encodeRegistry(registry, filter));
return response;
} | [
"@",
"RequestMapping",
"(",
"method",
"=",
"RequestMethod",
".",
"GET",
")",
"public",
"ApplicationRegistry",
"getMetrics",
"(",
"@",
"RequestParam",
"Map",
"<",
"String",
",",
"String",
">",
"filters",
")",
"throws",
"IOException",
"{",
"boolean",
"all",
"=",... | Endpoint for querying current metric values.
The result is a JSON document describing the metrics and their values.
The result can be filtered using query parameters or configuring the
controller instance itself. | [
"Endpoint",
"for",
"querying",
"current",
"metric",
"values",
"."
] | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-web-spring/src/main/java/com/netflix/spectator/controllers/MetricsController.java#L99-L120 |
transloadit/java-sdk | src/main/java/com/transloadit/sdk/Assembly.java | Assembly.save | public AssemblyResponse save(boolean isResumable)
throws RequestException, LocalOperationException {
Request request = new Request(getClient());
options.put("steps", steps.toMap());
// only do tus uploads if files will be uploaded
if (isResumable && getFilesCount() > 0) {
Map<String, String> tusOptions = new HashMap<String, String>();
tusOptions.put("tus_num_expected_upload_files", Integer.toString(getFilesCount()));
AssemblyResponse response = new AssemblyResponse(
request.post("/assemblies", options, tusOptions, null, null), true);
// check if the assembly returned an error
if (response.hasError()) {
throw new RequestException("Request to Assembly failed: " + response.json().getString("error"));
}
try {
handleTusUpload(response);
} catch (IOException e) {
throw new LocalOperationException(e);
} catch (ProtocolException e) {
throw new RequestException(e);
}
return response;
} else {
return new AssemblyResponse(request.post("/assemblies", options, null, files, fileStreams));
}
} | java | public AssemblyResponse save(boolean isResumable)
throws RequestException, LocalOperationException {
Request request = new Request(getClient());
options.put("steps", steps.toMap());
// only do tus uploads if files will be uploaded
if (isResumable && getFilesCount() > 0) {
Map<String, String> tusOptions = new HashMap<String, String>();
tusOptions.put("tus_num_expected_upload_files", Integer.toString(getFilesCount()));
AssemblyResponse response = new AssemblyResponse(
request.post("/assemblies", options, tusOptions, null, null), true);
// check if the assembly returned an error
if (response.hasError()) {
throw new RequestException("Request to Assembly failed: " + response.json().getString("error"));
}
try {
handleTusUpload(response);
} catch (IOException e) {
throw new LocalOperationException(e);
} catch (ProtocolException e) {
throw new RequestException(e);
}
return response;
} else {
return new AssemblyResponse(request.post("/assemblies", options, null, files, fileStreams));
}
} | [
"public",
"AssemblyResponse",
"save",
"(",
"boolean",
"isResumable",
")",
"throws",
"RequestException",
",",
"LocalOperationException",
"{",
"Request",
"request",
"=",
"new",
"Request",
"(",
"getClient",
"(",
")",
")",
";",
"options",
".",
"put",
"(",
"\"steps\"... | Submits the configured assembly to Transloadit for processing.
@param isResumable boolean value that tells the assembly whether or not to use tus.
@return {@link AssemblyResponse} the response received from the Transloadit server.
@throws RequestException if request to Transloadit server fails.
@throws LocalOperationException if something goes wrong while running non-http operations. | [
"Submits",
"the",
"configured",
"assembly",
"to",
"Transloadit",
"for",
"processing",
"."
] | train | https://github.com/transloadit/java-sdk/blob/9326c540a66f77b3d907d0b2c05bff1145ca14f7/src/main/java/com/transloadit/sdk/Assembly.java#L155-L184 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/ModeUtils.java | ModeUtils.applyFileUMask | public static Mode applyFileUMask(Mode mode, String authUmask) {
mode = applyUMask(mode, getUMask(authUmask));
mode = applyUMask(mode, FILE_UMASK);
return mode;
} | java | public static Mode applyFileUMask(Mode mode, String authUmask) {
mode = applyUMask(mode, getUMask(authUmask));
mode = applyUMask(mode, FILE_UMASK);
return mode;
} | [
"public",
"static",
"Mode",
"applyFileUMask",
"(",
"Mode",
"mode",
",",
"String",
"authUmask",
")",
"{",
"mode",
"=",
"applyUMask",
"(",
"mode",
",",
"getUMask",
"(",
"authUmask",
")",
")",
";",
"mode",
"=",
"applyUMask",
"(",
"mode",
",",
"FILE_UMASK",
... | Applies the default umask for newly created files to this mode.
@param mode the mode to update
@param authUmask the umask to apply on the file
@return the updated object | [
"Applies",
"the",
"default",
"umask",
"for",
"newly",
"created",
"files",
"to",
"this",
"mode",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/ModeUtils.java#L39-L43 |
code4everything/util | src/main/java/com/zhazhapan/util/NetUtils.java | NetUtils.removeCookie | public static boolean removeCookie(Cookie cookie, HttpServletResponse response) {
if (Checker.isNotNull(cookie)) {
cookie.setMaxAge(0);
return addCookie(cookie, response);
}
return false;
} | java | public static boolean removeCookie(Cookie cookie, HttpServletResponse response) {
if (Checker.isNotNull(cookie)) {
cookie.setMaxAge(0);
return addCookie(cookie, response);
}
return false;
} | [
"public",
"static",
"boolean",
"removeCookie",
"(",
"Cookie",
"cookie",
",",
"HttpServletResponse",
"response",
")",
"{",
"if",
"(",
"Checker",
".",
"isNotNull",
"(",
"cookie",
")",
")",
"{",
"cookie",
".",
"setMaxAge",
"(",
"0",
")",
";",
"return",
"addCo... | 删除指定Cookie
@param cookie {@link Cookie}
@param response {@link HttpServletResponse}
@return {@link Boolean}
@since 1.0.8 | [
"删除指定Cookie"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/NetUtils.java#L554-L560 |
elki-project/elki | elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/AbstractRStarTree.java | AbstractRStarTree.getLeafNodes | private void getLeafNodes(N node, List<E> result, int currentLevel) {
// Level 1 are the leaf nodes, Level 2 is the one atop!
if(currentLevel == 2) {
for(int i = 0; i < node.getNumEntries(); i++) {
result.add(node.getEntry(i));
}
}
else {
for(int i = 0; i < node.getNumEntries(); i++) {
getLeafNodes(getNode(node.getEntry(i)), result, (currentLevel - 1));
}
}
} | java | private void getLeafNodes(N node, List<E> result, int currentLevel) {
// Level 1 are the leaf nodes, Level 2 is the one atop!
if(currentLevel == 2) {
for(int i = 0; i < node.getNumEntries(); i++) {
result.add(node.getEntry(i));
}
}
else {
for(int i = 0; i < node.getNumEntries(); i++) {
getLeafNodes(getNode(node.getEntry(i)), result, (currentLevel - 1));
}
}
} | [
"private",
"void",
"getLeafNodes",
"(",
"N",
"node",
",",
"List",
"<",
"E",
">",
"result",
",",
"int",
"currentLevel",
")",
"{",
"// Level 1 are the leaf nodes, Level 2 is the one atop!",
"if",
"(",
"currentLevel",
"==",
"2",
")",
"{",
"for",
"(",
"int",
"i",
... | Determines the entries pointing to the leaf nodes of the specified subtree.
@param node the subtree
@param result the result to store the ids in
@param currentLevel the level of the node in the R-Tree | [
"Determines",
"the",
"entries",
"pointing",
"to",
"the",
"leaf",
"nodes",
"of",
"the",
"specified",
"subtree",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/AbstractRStarTree.java#L786-L798 |
RestComm/sip-servlets | containers/sip-servlets-catalina-8/src/main/java/org/mobicents/servlet/sip/catalina/NodeCreateRule.java | NodeCreateRule.begin | @Override
public void begin(String namespaceURI, String name, Attributes attributes)
throws Exception {
XMLReader xmlReader = getDigester().getXMLReader();
Document doc = documentBuilder.newDocument();
NodeBuilder builder = null;
if (nodeType == Node.ELEMENT_NODE) {
Element element = null;
if (getDigester().getNamespaceAware()) {
element =
doc.createElementNS(namespaceURI, name);
for (int i = 0; i < attributes.getLength(); i++) {
element.setAttributeNS(attributes.getURI(i),
attributes.getLocalName(i),
attributes.getValue(i));
}
} else {
element = doc.createElement(name);
for (int i = 0; i < attributes.getLength(); i++) {
element.setAttribute(attributes.getQName(i),
attributes.getValue(i));
}
}
builder = new NodeBuilder(doc, element);
} else {
builder = new NodeBuilder(doc, doc.createDocumentFragment());
}
xmlReader.setContentHandler(builder);
} | java | @Override
public void begin(String namespaceURI, String name, Attributes attributes)
throws Exception {
XMLReader xmlReader = getDigester().getXMLReader();
Document doc = documentBuilder.newDocument();
NodeBuilder builder = null;
if (nodeType == Node.ELEMENT_NODE) {
Element element = null;
if (getDigester().getNamespaceAware()) {
element =
doc.createElementNS(namespaceURI, name);
for (int i = 0; i < attributes.getLength(); i++) {
element.setAttributeNS(attributes.getURI(i),
attributes.getLocalName(i),
attributes.getValue(i));
}
} else {
element = doc.createElement(name);
for (int i = 0; i < attributes.getLength(); i++) {
element.setAttribute(attributes.getQName(i),
attributes.getValue(i));
}
}
builder = new NodeBuilder(doc, element);
} else {
builder = new NodeBuilder(doc, doc.createDocumentFragment());
}
xmlReader.setContentHandler(builder);
} | [
"@",
"Override",
"public",
"void",
"begin",
"(",
"String",
"namespaceURI",
",",
"String",
"name",
",",
"Attributes",
"attributes",
")",
"throws",
"Exception",
"{",
"XMLReader",
"xmlReader",
"=",
"getDigester",
"(",
")",
".",
"getXMLReader",
"(",
")",
";",
"D... | Implemented to replace the content handler currently in use by a
NodeBuilder.
@param namespaceURI the namespace URI of the matching element, or an
empty string if the parser is not namespace aware or the element has
no namespace
@param name the local name if the parser is namespace aware, or just
the element name otherwise
@param attributes The attribute list of this element
@throws Exception indicates a JAXP configuration problem | [
"Implemented",
"to",
"replace",
"the",
"content",
"handler",
"currently",
"in",
"use",
"by",
"a",
"NodeBuilder",
"."
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/containers/sip-servlets-catalina-8/src/main/java/org/mobicents/servlet/sip/catalina/NodeCreateRule.java#L394-L424 |
graphql-java/java-dataloader | src/main/java/org/dataloader/DataLoader.java | DataLoader.newDataLoaderWithTry | public static <K, V> DataLoader<K, V> newDataLoaderWithTry(BatchLoader<K, Try<V>> batchLoadFunction) {
return newDataLoaderWithTry(batchLoadFunction, null);
} | java | public static <K, V> DataLoader<K, V> newDataLoaderWithTry(BatchLoader<K, Try<V>> batchLoadFunction) {
return newDataLoaderWithTry(batchLoadFunction, null);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"DataLoader",
"<",
"K",
",",
"V",
">",
"newDataLoaderWithTry",
"(",
"BatchLoader",
"<",
"K",
",",
"Try",
"<",
"V",
">",
">",
"batchLoadFunction",
")",
"{",
"return",
"newDataLoaderWithTry",
"(",
"batchLoadFuncti... | Creates new DataLoader with the specified batch loader function and default options
(batching, caching and unlimited batch size) where the batch loader function returns a list of
{@link org.dataloader.Try} objects.
<p>
If its important you to know the exact status of each item in a batch call and whether it threw exceptions then
you can use this form to create the data loader.
<p>
Using Try objects allows you to capture a value returned or an exception that might
have occurred trying to get a value. .
@param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects
@param <K> the key type
@param <V> the value type
@return a new DataLoader | [
"Creates",
"new",
"DataLoader",
"with",
"the",
"specified",
"batch",
"loader",
"function",
"and",
"default",
"options",
"(",
"batching",
"caching",
"and",
"unlimited",
"batch",
"size",
")",
"where",
"the",
"batch",
"loader",
"function",
"returns",
"a",
"list",
... | train | https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/DataLoader.java#L109-L111 |
lisicnu/droidUtil | src/main/java/com/github/lisicnu/libDroid/util/ShellUtils.java | ShellUtils.execCommand | public static CommandResult execCommand(String command, boolean isRoot, boolean isNeedResultMsg) {
return execCommand(new String[]{command}, isRoot, isNeedResultMsg);
} | java | public static CommandResult execCommand(String command, boolean isRoot, boolean isNeedResultMsg) {
return execCommand(new String[]{command}, isRoot, isNeedResultMsg);
} | [
"public",
"static",
"CommandResult",
"execCommand",
"(",
"String",
"command",
",",
"boolean",
"isRoot",
",",
"boolean",
"isNeedResultMsg",
")",
"{",
"return",
"execCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"command",
"}",
",",
"isRoot",
",",
"isNeedResult... | execute shell command
@param command command
@param isRoot whether need to run with root
@param isNeedResultMsg whether need result msg
@return
@see ShellUtils#execCommand(String[], boolean, boolean) | [
"execute",
"shell",
"command"
] | train | https://github.com/lisicnu/droidUtil/blob/e4d6cf3e3f60e5efb5a75672607ded94d1725519/src/main/java/com/github/lisicnu/libDroid/util/ShellUtils.java#L81-L83 |
Erudika/para | para-server/src/main/java/com/erudika/para/rest/RestUtils.java | RestUtils.returnStatusResponse | public static void returnStatusResponse(HttpServletResponse response, int status, String message) {
if (response == null) {
return;
}
PrintWriter out = null;
try {
response.setStatus(status);
response.setContentType(MediaType.APPLICATION_JSON);
out = response.getWriter();
ParaObjectUtils.getJsonWriter().writeValue(out, getStatusResponse(Response.Status.
fromStatusCode(status), message).getEntity());
} catch (Exception ex) {
logger.error(null, ex);
} finally {
if (out != null) {
out.close();
}
}
} | java | public static void returnStatusResponse(HttpServletResponse response, int status, String message) {
if (response == null) {
return;
}
PrintWriter out = null;
try {
response.setStatus(status);
response.setContentType(MediaType.APPLICATION_JSON);
out = response.getWriter();
ParaObjectUtils.getJsonWriter().writeValue(out, getStatusResponse(Response.Status.
fromStatusCode(status), message).getEntity());
} catch (Exception ex) {
logger.error(null, ex);
} finally {
if (out != null) {
out.close();
}
}
} | [
"public",
"static",
"void",
"returnStatusResponse",
"(",
"HttpServletResponse",
"response",
",",
"int",
"status",
",",
"String",
"message",
")",
"{",
"if",
"(",
"response",
"==",
"null",
")",
"{",
"return",
";",
"}",
"PrintWriter",
"out",
"=",
"null",
";",
... | A generic JSON response handler. Returns a message and response code.
@param response the response to write to
@param status status code
@param message error message | [
"A",
"generic",
"JSON",
"response",
"handler",
".",
"Returns",
"a",
"message",
"and",
"response",
"code",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/rest/RestUtils.java#L942-L960 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/ie/pascal/PascalTemplate.java | PascalTemplate.setValue | public void setValue(String fieldName, String value) {
int index = getFieldIndex(fieldName);
assert(index != -1);
values[index] = value;
} | java | public void setValue(String fieldName, String value) {
int index = getFieldIndex(fieldName);
assert(index != -1);
values[index] = value;
} | [
"public",
"void",
"setValue",
"(",
"String",
"fieldName",
",",
"String",
"value",
")",
"{",
"int",
"index",
"=",
"getFieldIndex",
"(",
"fieldName",
")",
";",
"assert",
"(",
"index",
"!=",
"-",
"1",
")",
";",
"values",
"[",
"index",
"]",
"=",
"value",
... | Sets template values.
@param fieldName (i.e. workshopname, workshopdate) | [
"Sets",
"template",
"values",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/pascal/PascalTemplate.java#L149-L153 |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java | DocumentSubscriptions.dropConnection | public void dropConnection(String name, String database) {
RequestExecutor requestExecutor = _store.getRequestExecutor(ObjectUtils.firstNonNull(database, _store.getDatabase()));
DropSubscriptionConnectionCommand command = new DropSubscriptionConnectionCommand(name);
requestExecutor.execute(command);
} | java | public void dropConnection(String name, String database) {
RequestExecutor requestExecutor = _store.getRequestExecutor(ObjectUtils.firstNonNull(database, _store.getDatabase()));
DropSubscriptionConnectionCommand command = new DropSubscriptionConnectionCommand(name);
requestExecutor.execute(command);
} | [
"public",
"void",
"dropConnection",
"(",
"String",
"name",
",",
"String",
"database",
")",
"{",
"RequestExecutor",
"requestExecutor",
"=",
"_store",
".",
"getRequestExecutor",
"(",
"ObjectUtils",
".",
"firstNonNull",
"(",
"database",
",",
"_store",
".",
"getDataba... | Force server to close current client subscription connection to the server
@param name Subscription name
@param database Database to use | [
"Force",
"server",
"to",
"close",
"current",
"client",
"subscription",
"connection",
"to",
"the",
"server"
] | train | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java#L436-L441 |
stephanrauh/AngularFaces | AngularFaces_2.0/incubator/AngularFaces-widgets/src/main/java/de/beyondjava/angularFaces/flavors/kendo/puiBody/PuiBody.java | PuiBody.getValueToRender | public static Object getValueToRender(FacesContext context, UIComponent component) {
if (component instanceof ValueHolder) {
if (component instanceof EditableValueHolder) {
EditableValueHolder input = (EditableValueHolder) component;
Object submittedValue = input.getSubmittedValue();
ConfigContainer config = RequestContext.getCurrentInstance().getApplicationContext().getConfig();
if (config.isInterpretEmptyStringAsNull() && submittedValue == null && context.isValidationFailed() && !input.isValid()) {
return null;
} else if (submittedValue != null) {
return submittedValue;
}
}
ValueHolder valueHolder = (ValueHolder) component;
Object value = valueHolder.getValue();
return value;
}
// component it not a value holder
return null;
} | java | public static Object getValueToRender(FacesContext context, UIComponent component) {
if (component instanceof ValueHolder) {
if (component instanceof EditableValueHolder) {
EditableValueHolder input = (EditableValueHolder) component;
Object submittedValue = input.getSubmittedValue();
ConfigContainer config = RequestContext.getCurrentInstance().getApplicationContext().getConfig();
if (config.isInterpretEmptyStringAsNull() && submittedValue == null && context.isValidationFailed() && !input.isValid()) {
return null;
} else if (submittedValue != null) {
return submittedValue;
}
}
ValueHolder valueHolder = (ValueHolder) component;
Object value = valueHolder.getValue();
return value;
}
// component it not a value holder
return null;
} | [
"public",
"static",
"Object",
"getValueToRender",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"{",
"if",
"(",
"component",
"instanceof",
"ValueHolder",
")",
"{",
"if",
"(",
"component",
"instanceof",
"EditableValueHolder",
")",
"{",
"Edit... | This method has been copied from the PrimeFaces 5 project.
Algorithm works as follows; - If it's an input component, submitted value is checked first since it'd be the value to be used in case
validation errors terminates jsf lifecycle - Finally the value of the component is retrieved from backing bean and if there's a
converter, converted value is returned
@param context
FacesContext instance
@param component
UIComponent instance whose value will be returned
@return End text | [
"This",
"method",
"has",
"been",
"copied",
"from",
"the",
"PrimeFaces",
"5",
"project",
"."
] | train | https://github.com/stephanrauh/AngularFaces/blob/43d915f004645b1bbbf2625214294dab0858ba01/AngularFaces_2.0/incubator/AngularFaces-widgets/src/main/java/de/beyondjava/angularFaces/flavors/kendo/puiBody/PuiBody.java#L141-L163 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/hpack/H2Headers.java | H2Headers.decodeFragment | private static String decodeFragment(WsByteBuffer buffer) throws CompressionException {
String decodedResult = null;
try {
byte currentByte = buffer.get();
//Reset back position to decode the integer length of this segment.
buffer.position(buffer.position() - 1);
boolean huffman = (HpackUtils.getBit(currentByte, 7) == 1);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Decoding using huffman encoding: " + huffman);
}
//HUFFMAN and NOHUFFMAN ByteFormatTypes have the same
//integer decoding bits (N=7). Therefore, either enum value
//is valid for the integer representation decoder.
int fragmentLength = IntegerRepresentation.decode(buffer, ByteFormatType.HUFFMAN);
byte[] bytes = new byte[fragmentLength];
//Transfer bytes from the buffer into byte array.
buffer.get(bytes);
if (huffman && bytes.length > 0) {
HuffmanDecoder decoder = new HuffmanDecoder();
bytes = decoder.convertHuffmanToAscii(bytes);
}
decodedResult = new String(bytes, Charset.forName(HpackConstants.HPACK_CHAR_SET));
} catch (Exception e) {
throw new CompressionException("Received an invalid header block fragment");
}
return decodedResult;
} | java | private static String decodeFragment(WsByteBuffer buffer) throws CompressionException {
String decodedResult = null;
try {
byte currentByte = buffer.get();
//Reset back position to decode the integer length of this segment.
buffer.position(buffer.position() - 1);
boolean huffman = (HpackUtils.getBit(currentByte, 7) == 1);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Decoding using huffman encoding: " + huffman);
}
//HUFFMAN and NOHUFFMAN ByteFormatTypes have the same
//integer decoding bits (N=7). Therefore, either enum value
//is valid for the integer representation decoder.
int fragmentLength = IntegerRepresentation.decode(buffer, ByteFormatType.HUFFMAN);
byte[] bytes = new byte[fragmentLength];
//Transfer bytes from the buffer into byte array.
buffer.get(bytes);
if (huffman && bytes.length > 0) {
HuffmanDecoder decoder = new HuffmanDecoder();
bytes = decoder.convertHuffmanToAscii(bytes);
}
decodedResult = new String(bytes, Charset.forName(HpackConstants.HPACK_CHAR_SET));
} catch (Exception e) {
throw new CompressionException("Received an invalid header block fragment");
}
return decodedResult;
} | [
"private",
"static",
"String",
"decodeFragment",
"(",
"WsByteBuffer",
"buffer",
")",
"throws",
"CompressionException",
"{",
"String",
"decodedResult",
"=",
"null",
";",
"try",
"{",
"byte",
"currentByte",
"=",
"buffer",
".",
"get",
"(",
")",
";",
"//Reset back po... | Decode a Fragment of the Header. Fragment in this case refers to the bytes that
represent the integer length and octets length of either the Name or Value of
a Header. For instance, in the case of the Name, the fragment is
+---+---+-----------------------+
| H | Name Length (7+) |
+---+---------------------------+
| Name String (Length octets) |
+---+---------------------------+
@param buffer Contains all bytes that will be decoded into this <HeaderField>
@return String representation of the fragment. Stored as either the key or value of this <HeaderField>
@throws CompressionException | [
"Decode",
"a",
"Fragment",
"of",
"the",
"Header",
".",
"Fragment",
"in",
"this",
"case",
"refers",
"to",
"the",
"bytes",
"that",
"represent",
"the",
"integer",
"length",
"and",
"octets",
"length",
"of",
"either",
"the",
"Name",
"or",
"Value",
"of",
"a",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/hpack/H2Headers.java#L283-L317 |
pwittchen/prefser | library/src/main/java/com/github/pwittchen/prefser/library/rx2/Prefser.java | Prefser.observe | public <T> Observable<T> observe(@NonNull String key, @NonNull Class<T> classOfT,
T defaultValue) {
Preconditions.checkNotNull(key, KEY_IS_NULL);
Preconditions.checkNotNull(classOfT, CLASS_OF_T_IS_NULL);
return observe(key, TypeToken.fromClass(classOfT), defaultValue);
} | java | public <T> Observable<T> observe(@NonNull String key, @NonNull Class<T> classOfT,
T defaultValue) {
Preconditions.checkNotNull(key, KEY_IS_NULL);
Preconditions.checkNotNull(classOfT, CLASS_OF_T_IS_NULL);
return observe(key, TypeToken.fromClass(classOfT), defaultValue);
} | [
"public",
"<",
"T",
">",
"Observable",
"<",
"T",
">",
"observe",
"(",
"@",
"NonNull",
"String",
"key",
",",
"@",
"NonNull",
"Class",
"<",
"T",
">",
"classOfT",
",",
"T",
"defaultValue",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"key",
",",
... | Gets value from SharedPreferences with a given key and type
as a RxJava Observable, which can be subscribed.
If value is not found, we can return defaultValue.
@param key key of the preference
@param classOfT class of T (e.g. String.class)
@param defaultValue default value of the preference (e.g. "" or "undefined")
@param <T> return type of the preference (e.g. String)
@return Observable value from SharedPreferences associated with given key or default value | [
"Gets",
"value",
"from",
"SharedPreferences",
"with",
"a",
"given",
"key",
"and",
"type",
"as",
"a",
"RxJava",
"Observable",
"which",
"can",
"be",
"subscribed",
".",
"If",
"value",
"is",
"not",
"found",
"we",
"can",
"return",
"defaultValue",
"."
] | train | https://github.com/pwittchen/prefser/blob/7dc7f980eeb71fd5617f8c749050c2400e4fbb2f/library/src/main/java/com/github/pwittchen/prefser/library/rx2/Prefser.java#L185-L191 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/Branch.java | Branch.initSession | public boolean initSession(BranchUniversalReferralInitListener callback, boolean isReferrable, Uri data) {
return initSession(callback, isReferrable, data, null);
} | java | public boolean initSession(BranchUniversalReferralInitListener callback, boolean isReferrable, Uri data) {
return initSession(callback, isReferrable, data, null);
} | [
"public",
"boolean",
"initSession",
"(",
"BranchUniversalReferralInitListener",
"callback",
",",
"boolean",
"isReferrable",
",",
"Uri",
"data",
")",
"{",
"return",
"initSession",
"(",
"callback",
",",
"isReferrable",
",",
"data",
",",
"null",
")",
";",
"}"
] | <p>Initialises a session with the Branch API.</p>
@param callback A {@link BranchUniversalReferralInitListener} instance that will be called
following successful (or unsuccessful) initialisation of the session
with the Branch API.
@param isReferrable A {@link Boolean} value indicating whether this initialisation
session should be considered as potentially referrable or not.
By default, a user is only referrable if initSession results in a
fresh install. Overriding this gives you control of who is referrable.
@param data A {@link Uri} variable containing the details of the source link that
led to this initialisation action.
@return A {@link Boolean} value that returns <i>false</i> if unsuccessful. | [
"<p",
">",
"Initialises",
"a",
"session",
"with",
"the",
"Branch",
"API",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/Branch.java#L1204-L1206 |
haifengl/smile | graph/src/main/java/smile/graph/AdjacencyMatrix.java | AdjacencyMatrix.bfs | private void bfs(int v, int[] cc, int id) {
cc[v] = id;
Queue<Integer> queue = new LinkedList<>();
queue.offer(v);
while (!queue.isEmpty()) {
int t = queue.poll();
for (int i = 0; i < n; i++) {
if (graph[t][i] != 0.0 && cc[i] == -1) {
queue.offer(i);
cc[i] = id;
}
}
}
} | java | private void bfs(int v, int[] cc, int id) {
cc[v] = id;
Queue<Integer> queue = new LinkedList<>();
queue.offer(v);
while (!queue.isEmpty()) {
int t = queue.poll();
for (int i = 0; i < n; i++) {
if (graph[t][i] != 0.0 && cc[i] == -1) {
queue.offer(i);
cc[i] = id;
}
}
}
} | [
"private",
"void",
"bfs",
"(",
"int",
"v",
",",
"int",
"[",
"]",
"cc",
",",
"int",
"id",
")",
"{",
"cc",
"[",
"v",
"]",
"=",
"id",
";",
"Queue",
"<",
"Integer",
">",
"queue",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"queue",
".",
"offer... | Breadth-first search connected components of graph.
@param v the start vertex.
@param cc the array to store the connected component id of vertices.
@param id the current component id. | [
"Breadth",
"-",
"first",
"search",
"connected",
"components",
"of",
"graph",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/graph/src/main/java/smile/graph/AdjacencyMatrix.java#L414-L427 |
overturetool/overture | ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java | CharOperation.lastIndexOf | public static final int lastIndexOf(char toBeFound, char[] array)
{
for (int i = array.length; --i >= 0;)
{
if (toBeFound == array[i])
{
return i;
}
}
return -1;
} | java | public static final int lastIndexOf(char toBeFound, char[] array)
{
for (int i = array.length; --i >= 0;)
{
if (toBeFound == array[i])
{
return i;
}
}
return -1;
} | [
"public",
"static",
"final",
"int",
"lastIndexOf",
"(",
"char",
"toBeFound",
",",
"char",
"[",
"]",
"array",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"array",
".",
"length",
";",
"--",
"i",
">=",
"0",
";",
")",
"{",
"if",
"(",
"toBeFound",
"==",
"a... | Answers the last index in the array for which the corresponding character is equal to toBeFound starting from the
end of the array. Answers -1 if no occurrence of this character is found. <br>
<br>
For example:
<ol>
<li>
<pre>
toBeFound = 'c'
array = { ' a', 'b', 'c', 'd' , 'c', 'e' }
result => 4
</pre>
</li>
<li>
<pre>
toBeFound = 'e'
array = { ' a', 'b', 'c', 'd' }
result => -1
</pre>
</li>
</ol>
@param toBeFound
the character to search
@param array
the array to be searched
@return the last index in the array for which the corresponding character is equal to toBeFound starting from the
end of the array, -1 otherwise
@throws NullPointerException
if array is null | [
"Answers",
"the",
"last",
"index",
"in",
"the",
"array",
"for",
"which",
"the",
"corresponding",
"character",
"is",
"equal",
"to",
"toBeFound",
"starting",
"from",
"the",
"end",
"of",
"the",
"array",
".",
"Answers",
"-",
"1",
"if",
"no",
"occurrence",
"of"... | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java#L2419-L2429 |
biojava/biojava | biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/AFPChainCoordManager.java | AFPChainCoordManager.getLegendPosition | public Point getLegendPosition(int lineNr, int chainNr) {
int x = DEFAULT_X_SPACE ;
int y = lineNr * DEFAULT_Y_STEP + DEFAULT_Y_SPACE;
y += chainNr * DEFAULT_LINE_SEPARATION;
Point p = new Point(x,y);
return p;
} | java | public Point getLegendPosition(int lineNr, int chainNr) {
int x = DEFAULT_X_SPACE ;
int y = lineNr * DEFAULT_Y_STEP + DEFAULT_Y_SPACE;
y += chainNr * DEFAULT_LINE_SEPARATION;
Point p = new Point(x,y);
return p;
} | [
"public",
"Point",
"getLegendPosition",
"(",
"int",
"lineNr",
",",
"int",
"chainNr",
")",
"{",
"int",
"x",
"=",
"DEFAULT_X_SPACE",
";",
"int",
"y",
"=",
"lineNr",
"*",
"DEFAULT_Y_STEP",
"+",
"DEFAULT_Y_SPACE",
";",
"y",
"+=",
"chainNr",
"*",
"DEFAULT_LINE_SE... | provide the coordinates for where to draw the legend for line X and if it is chain 1 or 2
@param lineNr which line is this for
@param chainNr is it chain 0 or 1
@return get the point where to draw the legend | [
"provide",
"the",
"coordinates",
"for",
"where",
"to",
"draw",
"the",
"legend",
"for",
"line",
"X",
"and",
"if",
"it",
"is",
"chain",
"1",
"or",
"2"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/AFPChainCoordManager.java#L192-L201 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/V1InstanceGetter.java | V1InstanceGetter.secondaryWorkitems | public Collection<SecondaryWorkitem> secondaryWorkitems(
SecondaryWorkitemFilter filter) {
return get(SecondaryWorkitem.class, (filter != null) ? filter : new SecondaryWorkitemFilter());
} | java | public Collection<SecondaryWorkitem> secondaryWorkitems(
SecondaryWorkitemFilter filter) {
return get(SecondaryWorkitem.class, (filter != null) ? filter : new SecondaryWorkitemFilter());
} | [
"public",
"Collection",
"<",
"SecondaryWorkitem",
">",
"secondaryWorkitems",
"(",
"SecondaryWorkitemFilter",
"filter",
")",
"{",
"return",
"get",
"(",
"SecondaryWorkitem",
".",
"class",
",",
"(",
"filter",
"!=",
"null",
")",
"?",
"filter",
":",
"new",
"Secondary... | Get secondary workitems (tasks and tests) filtered by the criteria
specified in the passed in filter.
@param filter Limit the items returned. If null, then all items returned.
@return Collection of items as specified in the filter. | [
"Get",
"secondary",
"workitems",
"(",
"tasks",
"and",
"tests",
")",
"filtered",
"by",
"the",
"criteria",
"specified",
"in",
"the",
"passed",
"in",
"filter",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceGetter.java#L169-L172 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/idemix/IdemixUtils.java | IdemixUtils.modSub | static BIG modSub(BIG a, BIG b, BIG m) {
return modAdd(a, BIG.modneg(b, m), m);
} | java | static BIG modSub(BIG a, BIG b, BIG m) {
return modAdd(a, BIG.modneg(b, m), m);
} | [
"static",
"BIG",
"modSub",
"(",
"BIG",
"a",
",",
"BIG",
"b",
",",
"BIG",
"m",
")",
"{",
"return",
"modAdd",
"(",
"a",
",",
"BIG",
".",
"modneg",
"(",
"b",
",",
"m",
")",
",",
"m",
")",
";",
"}"
] | Modsub takes input BIGs a, b, m and returns a-b modulo m
@param a the minuend of the modular subtraction
@param b the subtrahend of the modular subtraction
@param m the modulus
@return returns a-b (mod m) | [
"Modsub",
"takes",
"input",
"BIGs",
"a",
"b",
"m",
"and",
"returns",
"a",
"-",
"b",
"modulo",
"m"
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/idemix/IdemixUtils.java#L272-L274 |
couchbase/couchbase-lite-java-core | src/main/java/com/couchbase/lite/support/security/SymmetricKey.java | SymmetricKey.decryptData | public byte[] decryptData(byte[] data) throws SymmetricKeyException {
if (data.length < IV_SIZE)
throw new SymmetricKeyException("Invalid encrypted data, no IV prepended");
byte[] iv = ArrayUtils.subarray(data, 0, IV_SIZE);
Cipher cipher = getCipher(Cipher.DECRYPT_MODE, iv);
try {
return cipher.doFinal(data, iv.length, data.length - iv.length);
} catch (Exception e) {
throw new SymmetricKeyException(e);
}
} | java | public byte[] decryptData(byte[] data) throws SymmetricKeyException {
if (data.length < IV_SIZE)
throw new SymmetricKeyException("Invalid encrypted data, no IV prepended");
byte[] iv = ArrayUtils.subarray(data, 0, IV_SIZE);
Cipher cipher = getCipher(Cipher.DECRYPT_MODE, iv);
try {
return cipher.doFinal(data, iv.length, data.length - iv.length);
} catch (Exception e) {
throw new SymmetricKeyException(e);
}
} | [
"public",
"byte",
"[",
"]",
"decryptData",
"(",
"byte",
"[",
"]",
"data",
")",
"throws",
"SymmetricKeyException",
"{",
"if",
"(",
"data",
".",
"length",
"<",
"IV_SIZE",
")",
"throw",
"new",
"SymmetricKeyException",
"(",
"\"Invalid encrypted data, no IV prepended\"... | Decrypt the encrypted byte array data. The encrypted data must be prefixed with the
IV header (16 bytes) used when encrypting the data.
@param data Encrypted data
@return Decrypted data
@throws SymmetricKeyException | [
"Decrypt",
"the",
"encrypted",
"byte",
"array",
"data",
".",
"The",
"encrypted",
"data",
"must",
"be",
"prefixed",
"with",
"the",
"IV",
"header",
"(",
"16",
"bytes",
")",
"used",
"when",
"encrypting",
"the",
"data",
"."
] | train | https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/support/security/SymmetricKey.java#L131-L141 |
TNG/JGiven | jgiven-core/src/main/java/com/tngtech/jgiven/attachment/Attachment.java | Attachment.fromTextInputStream | @Deprecated
public static Attachment fromTextInputStream( InputStream inputStream, MediaType mediaType, Charset charset ) throws IOException {
return fromText( CharStreams.toString( new InputStreamReader( inputStream, charset ) ), mediaType );
} | java | @Deprecated
public static Attachment fromTextInputStream( InputStream inputStream, MediaType mediaType, Charset charset ) throws IOException {
return fromText( CharStreams.toString( new InputStreamReader( inputStream, charset ) ), mediaType );
} | [
"@",
"Deprecated",
"public",
"static",
"Attachment",
"fromTextInputStream",
"(",
"InputStream",
"inputStream",
",",
"MediaType",
"mediaType",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"return",
"fromText",
"(",
"CharStreams",
".",
"toString",
"("... | Creates a non-binary attachment from the given file.
@throws IOException if an I/O error occurs
@throws java.lang.IllegalArgumentException if mediaType is binary
@deprecated use fromTextInputStream without charSet with a mediaType that has a specified charSet | [
"Creates",
"a",
"non",
"-",
"binary",
"attachment",
"from",
"the",
"given",
"file",
"."
] | train | https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-core/src/main/java/com/tngtech/jgiven/attachment/Attachment.java#L221-L224 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/BloomFilter.java | BloomFilter.murmurHash3 | public static int murmurHash3(byte[] data, long nTweak, int hashNum, byte[] object) {
int h1 = (int)(hashNum * 0xFBA4C795L + nTweak);
final int c1 = 0xcc9e2d51;
final int c2 = 0x1b873593;
int numBlocks = (object.length / 4) * 4;
// body
for(int i = 0; i < numBlocks; i += 4) {
int k1 = (object[i] & 0xFF) |
((object[i+1] & 0xFF) << 8) |
((object[i+2] & 0xFF) << 16) |
((object[i+3] & 0xFF) << 24);
k1 *= c1;
k1 = rotateLeft32(k1, 15);
k1 *= c2;
h1 ^= k1;
h1 = rotateLeft32(h1, 13);
h1 = h1*5+0xe6546b64;
}
int k1 = 0;
switch(object.length & 3)
{
case 3:
k1 ^= (object[numBlocks + 2] & 0xff) << 16;
// Fall through.
case 2:
k1 ^= (object[numBlocks + 1] & 0xff) << 8;
// Fall through.
case 1:
k1 ^= (object[numBlocks] & 0xff);
k1 *= c1; k1 = rotateLeft32(k1, 15); k1 *= c2; h1 ^= k1;
// Fall through.
default:
// Do nothing.
break;
}
// finalization
h1 ^= object.length;
h1 ^= h1 >>> 16;
h1 *= 0x85ebca6b;
h1 ^= h1 >>> 13;
h1 *= 0xc2b2ae35;
h1 ^= h1 >>> 16;
return (int)((h1&0xFFFFFFFFL) % (data.length * 8));
} | java | public static int murmurHash3(byte[] data, long nTweak, int hashNum, byte[] object) {
int h1 = (int)(hashNum * 0xFBA4C795L + nTweak);
final int c1 = 0xcc9e2d51;
final int c2 = 0x1b873593;
int numBlocks = (object.length / 4) * 4;
// body
for(int i = 0; i < numBlocks; i += 4) {
int k1 = (object[i] & 0xFF) |
((object[i+1] & 0xFF) << 8) |
((object[i+2] & 0xFF) << 16) |
((object[i+3] & 0xFF) << 24);
k1 *= c1;
k1 = rotateLeft32(k1, 15);
k1 *= c2;
h1 ^= k1;
h1 = rotateLeft32(h1, 13);
h1 = h1*5+0xe6546b64;
}
int k1 = 0;
switch(object.length & 3)
{
case 3:
k1 ^= (object[numBlocks + 2] & 0xff) << 16;
// Fall through.
case 2:
k1 ^= (object[numBlocks + 1] & 0xff) << 8;
// Fall through.
case 1:
k1 ^= (object[numBlocks] & 0xff);
k1 *= c1; k1 = rotateLeft32(k1, 15); k1 *= c2; h1 ^= k1;
// Fall through.
default:
// Do nothing.
break;
}
// finalization
h1 ^= object.length;
h1 ^= h1 >>> 16;
h1 *= 0x85ebca6b;
h1 ^= h1 >>> 13;
h1 *= 0xc2b2ae35;
h1 ^= h1 >>> 16;
return (int)((h1&0xFFFFFFFFL) % (data.length * 8));
} | [
"public",
"static",
"int",
"murmurHash3",
"(",
"byte",
"[",
"]",
"data",
",",
"long",
"nTweak",
",",
"int",
"hashNum",
",",
"byte",
"[",
"]",
"object",
")",
"{",
"int",
"h1",
"=",
"(",
"int",
")",
"(",
"hashNum",
"*",
"0xFBA4C795",
"L",
"+",
"nTwea... | Applies the MurmurHash3 (x86_32) algorithm to the given data.
See this <a href="https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp">C++ code for the original.</a> | [
"Applies",
"the",
"MurmurHash3",
"(",
"x86_32",
")",
"algorithm",
"to",
"the",
"given",
"data",
".",
"See",
"this",
"<a",
"href",
"=",
"https",
":",
"//",
"github",
".",
"com",
"/",
"aappleby",
"/",
"smhasher",
"/",
"blob",
"/",
"master",
"/",
"src",
... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/BloomFilter.java#L175-L224 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.serviceName_attachedDomain_POST | public OvhTask serviceName_attachedDomain_POST(String serviceName, OvhCdnEnum cdn, String domain, OvhFirewallEnum firewall, String ownLog, String path, Long runtimeId, Boolean ssl) throws IOException {
String qPath = "/hosting/web/{serviceName}/attachedDomain";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "cdn", cdn);
addBody(o, "domain", domain);
addBody(o, "firewall", firewall);
addBody(o, "ownLog", ownLog);
addBody(o, "path", path);
addBody(o, "runtimeId", runtimeId);
addBody(o, "ssl", ssl);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask serviceName_attachedDomain_POST(String serviceName, OvhCdnEnum cdn, String domain, OvhFirewallEnum firewall, String ownLog, String path, Long runtimeId, Boolean ssl) throws IOException {
String qPath = "/hosting/web/{serviceName}/attachedDomain";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "cdn", cdn);
addBody(o, "domain", domain);
addBody(o, "firewall", firewall);
addBody(o, "ownLog", ownLog);
addBody(o, "path", path);
addBody(o, "runtimeId", runtimeId);
addBody(o, "ssl", ssl);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"serviceName_attachedDomain_POST",
"(",
"String",
"serviceName",
",",
"OvhCdnEnum",
"cdn",
",",
"String",
"domain",
",",
"OvhFirewallEnum",
"firewall",
",",
"String",
"ownLog",
",",
"String",
"path",
",",
"Long",
"runtimeId",
",",
"Boolean",
"... | Link a domain to this hosting
REST: POST /hosting/web/{serviceName}/attachedDomain
@param cdn [required] Is linked to the hosting cdn
@param runtimeId [required] The runtime configuration ID linked to this attached domain
@param ownLog [required] Put domain for separate the logs on logs.ovh.net
@param ssl [required] Put domain in ssl certificate
@param domain [required] Domain to link
@param path [required] Domain's path, relative to your home directory
@param firewall [required] Firewall state for this path
@param serviceName [required] The internal name of your hosting | [
"Link",
"a",
"domain",
"to",
"this",
"hosting"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L2027-L2040 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/GanttChartView14.java | GanttChartView14.getFontStyle | protected FontStyle getFontStyle(byte[] data, int offset, Map<Integer, FontBase> fontBases, boolean ignoreBackground)
{
//System.out.println(ByteArrayHelper.hexdump(data, offset, 32, false));
Integer index = Integer.valueOf(MPPUtility.getByte(data, offset));
FontBase fontBase = fontBases.get(index);
int style = MPPUtility.getByte(data, offset + 3);
Color color = MPPUtility.getColor(data, offset + 4);
Color backgroundColor;
BackgroundPattern backgroundPattern;
if (ignoreBackground)
{
backgroundColor = null;
backgroundPattern = BackgroundPattern.SOLID;
}
else
{
backgroundColor = MPPUtility.getColor(data, offset + 16);
backgroundPattern = BackgroundPattern.getInstance(MPPUtility.getShort(data, offset + 28));
}
boolean bold = ((style & 0x01) != 0);
boolean italic = ((style & 0x02) != 0);
boolean underline = ((style & 0x04) != 0);
boolean strikethrough = ((style & 0x08) != 0);
FontStyle fontStyle = new FontStyle(fontBase, italic, bold, underline, strikethrough, color, backgroundColor, backgroundPattern);
//System.out.println(fontStyle);
return fontStyle;
} | java | protected FontStyle getFontStyle(byte[] data, int offset, Map<Integer, FontBase> fontBases, boolean ignoreBackground)
{
//System.out.println(ByteArrayHelper.hexdump(data, offset, 32, false));
Integer index = Integer.valueOf(MPPUtility.getByte(data, offset));
FontBase fontBase = fontBases.get(index);
int style = MPPUtility.getByte(data, offset + 3);
Color color = MPPUtility.getColor(data, offset + 4);
Color backgroundColor;
BackgroundPattern backgroundPattern;
if (ignoreBackground)
{
backgroundColor = null;
backgroundPattern = BackgroundPattern.SOLID;
}
else
{
backgroundColor = MPPUtility.getColor(data, offset + 16);
backgroundPattern = BackgroundPattern.getInstance(MPPUtility.getShort(data, offset + 28));
}
boolean bold = ((style & 0x01) != 0);
boolean italic = ((style & 0x02) != 0);
boolean underline = ((style & 0x04) != 0);
boolean strikethrough = ((style & 0x08) != 0);
FontStyle fontStyle = new FontStyle(fontBase, italic, bold, underline, strikethrough, color, backgroundColor, backgroundPattern);
//System.out.println(fontStyle);
return fontStyle;
} | [
"protected",
"FontStyle",
"getFontStyle",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"Map",
"<",
"Integer",
",",
"FontBase",
">",
"fontBases",
",",
"boolean",
"ignoreBackground",
")",
"{",
"//System.out.println(ByteArrayHelper.hexdump(data, offset, 32, ... | Retrieve font details from a block of property data.
@param data property data
@param offset offset into property data
@param fontBases map of font bases
@param ignoreBackground set background to default values
@return FontStyle instance | [
"Retrieve",
"font",
"details",
"from",
"a",
"block",
"of",
"property",
"data",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/GanttChartView14.java#L251-L281 |
googlegenomics/utils-java | src/main/java/com/google/cloud/genomics/utils/GenomicsFactory.java | GenomicsFactory.fromServiceAccount | public Genomics fromServiceAccount(String serviceAccountId, File p12File)
throws GeneralSecurityException, IOException {
Preconditions.checkNotNull(serviceAccountId);
Preconditions.checkNotNull(p12File);
return fromServiceAccount(getGenomicsBuilder(), serviceAccountId, p12File).build();
} | java | public Genomics fromServiceAccount(String serviceAccountId, File p12File)
throws GeneralSecurityException, IOException {
Preconditions.checkNotNull(serviceAccountId);
Preconditions.checkNotNull(p12File);
return fromServiceAccount(getGenomicsBuilder(), serviceAccountId, p12File).build();
} | [
"public",
"Genomics",
"fromServiceAccount",
"(",
"String",
"serviceAccountId",
",",
"File",
"p12File",
")",
"throws",
"GeneralSecurityException",
",",
"IOException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"serviceAccountId",
")",
";",
"Preconditions",
".",
"c... | Create a new genomics stub from the given service account ID and private key {@link File}.
@param serviceAccountId The service account ID (typically an email address)
@param p12File The file on disk containing the private key
@return The new {@code Genomics} stub
@throws GeneralSecurityException
@throws IOException | [
"Create",
"a",
"new",
"genomics",
"stub",
"from",
"the",
"given",
"service",
"account",
"ID",
"and",
"private",
"key",
"{",
"@link",
"File",
"}",
"."
] | train | https://github.com/googlegenomics/utils-java/blob/7205d5b4e4f61fc6b93acb4bdd76b93df5b5f612/src/main/java/com/google/cloud/genomics/utils/GenomicsFactory.java#L440-L445 |
paypal/SeLion | client/src/main/java/com/paypal/selion/reports/services/ReporterConfigMetadata.java | ReporterConfigMetadata.addReporterMetadataItem | public static void addReporterMetadataItem(String key, String itemType, String value) {
logger.entering(new Object[] { key, itemType, value });
if (StringUtils.isNotBlank(value) && supportedMetaDataProperties.contains(itemType)) {
Map<String, String> subMap = reporterMetadata.get(key);
if (null == subMap) {
subMap = new HashMap<String, String>();
}
subMap.put(itemType, value);
reporterMetadata.put(key, subMap);
} else {
String message = "Key/value pair for '" + key + "' for '" + itemType
+ "' was not inserted into report metadata.";
logger.fine(message);
}
} | java | public static void addReporterMetadataItem(String key, String itemType, String value) {
logger.entering(new Object[] { key, itemType, value });
if (StringUtils.isNotBlank(value) && supportedMetaDataProperties.contains(itemType)) {
Map<String, String> subMap = reporterMetadata.get(key);
if (null == subMap) {
subMap = new HashMap<String, String>();
}
subMap.put(itemType, value);
reporterMetadata.put(key, subMap);
} else {
String message = "Key/value pair for '" + key + "' for '" + itemType
+ "' was not inserted into report metadata.";
logger.fine(message);
}
} | [
"public",
"static",
"void",
"addReporterMetadataItem",
"(",
"String",
"key",
",",
"String",
"itemType",
",",
"String",
"value",
")",
"{",
"logger",
".",
"entering",
"(",
"new",
"Object",
"[",
"]",
"{",
"key",
",",
"itemType",
",",
"value",
"}",
")",
";",... | Adds an new item to the reporter metadata.
@param key
- A {@link String} that represents the property name contained in JsonRuntimeReporter file.
@param itemType
- A {@link String} that represents the (supported) type of metadata.
@param value
- A {@link String} that represents the reader friendly value to be displayed in the SeLion HTML
Reports. | [
"Adds",
"an",
"new",
"item",
"to",
"the",
"reporter",
"metadata",
"."
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/reports/services/ReporterConfigMetadata.java#L68-L83 |
redbox-mint/redbox | plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java | CurationManager.reharvest | private void reharvest(JsonSimple response, JsonSimple message) {
String oid = message.getString(null, "oid");
try {
if (oid != null) {
setRenderFlag(oid);
// Transformer config
JsonSimple itemConfig = getConfigFromStorage(oid);
if (itemConfig == null) {
log.error("Error accessing item configuration!");
return;
}
itemConfig.getJsonObject().put("oid", oid);
// Tool chain
scheduleTransformers(itemConfig, response);
JsonObject order = newIndex(response, oid);
order.put("forceCommit", true);
createTask(response, oid, "clear-render-flag");
} else {
log.error("Cannot reharvest without an OID!");
}
} catch (Exception ex) {
log.error("Error during reharvest setup: ", ex);
}
} | java | private void reharvest(JsonSimple response, JsonSimple message) {
String oid = message.getString(null, "oid");
try {
if (oid != null) {
setRenderFlag(oid);
// Transformer config
JsonSimple itemConfig = getConfigFromStorage(oid);
if (itemConfig == null) {
log.error("Error accessing item configuration!");
return;
}
itemConfig.getJsonObject().put("oid", oid);
// Tool chain
scheduleTransformers(itemConfig, response);
JsonObject order = newIndex(response, oid);
order.put("forceCommit", true);
createTask(response, oid, "clear-render-flag");
} else {
log.error("Cannot reharvest without an OID!");
}
} catch (Exception ex) {
log.error("Error during reharvest setup: ", ex);
}
} | [
"private",
"void",
"reharvest",
"(",
"JsonSimple",
"response",
",",
"JsonSimple",
"message",
")",
"{",
"String",
"oid",
"=",
"message",
".",
"getString",
"(",
"null",
",",
"\"oid\"",
")",
";",
"try",
"{",
"if",
"(",
"oid",
"!=",
"null",
")",
"{",
"setR... | Generate a fairly common list of orders to transform and index an object.
This mirrors the traditional tool chain.
@param message
The response to modify
@param message
The message we received | [
"Generate",
"a",
"fairly",
"common",
"list",
"of",
"orders",
"to",
"transform",
"and",
"index",
"an",
"object",
".",
"This",
"mirrors",
"the",
"traditional",
"tool",
"chain",
"."
] | train | https://github.com/redbox-mint/redbox/blob/1db230f218031b85c48c8603cbb04fce7ac6de0c/plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java#L1526-L1552 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/ExceptionThrower.java | ExceptionThrower.createExceptionMessage | protected String createExceptionMessage(final String message, final Object... messageParameters) {
if (ArrayUtils.isEmpty(messageParameters)) {
return message;
} else {
return String.format(message, messageParameters);
}
} | java | protected String createExceptionMessage(final String message, final Object... messageParameters) {
if (ArrayUtils.isEmpty(messageParameters)) {
return message;
} else {
return String.format(message, messageParameters);
}
} | [
"protected",
"String",
"createExceptionMessage",
"(",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"messageParameters",
")",
"{",
"if",
"(",
"ArrayUtils",
".",
"isEmpty",
"(",
"messageParameters",
")",
")",
"{",
"return",
"message",
";",
"}",
"... | Create a string message by string format.
@param message
@param messageParameters
@return | [
"Create",
"a",
"string",
"message",
"by",
"string",
"format",
"."
] | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/ExceptionThrower.java#L65-L72 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/locale/LocaleFormatter.java | LocaleFormatter.getFormatted | @Nonnull
public static String getFormatted (final int nValue, @Nonnull final Locale aDisplayLocale)
{
ValueEnforcer.notNull (aDisplayLocale, "DisplayLocale");
return NumberFormat.getIntegerInstance (aDisplayLocale).format (nValue);
} | java | @Nonnull
public static String getFormatted (final int nValue, @Nonnull final Locale aDisplayLocale)
{
ValueEnforcer.notNull (aDisplayLocale, "DisplayLocale");
return NumberFormat.getIntegerInstance (aDisplayLocale).format (nValue);
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getFormatted",
"(",
"final",
"int",
"nValue",
",",
"@",
"Nonnull",
"final",
"Locale",
"aDisplayLocale",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aDisplayLocale",
",",
"\"DisplayLocale\"",
")",
";",
"return",... | Format the passed value according to the rules specified by the given
locale. All calls to {@link Integer#toString(int)} that are displayed to
the user should instead use this method.
@param nValue
The value to be formatted.
@param aDisplayLocale
The locale to be used. May not be <code>null</code>.
@return The formatted string. | [
"Format",
"the",
"passed",
"value",
"according",
"to",
"the",
"rules",
"specified",
"by",
"the",
"given",
"locale",
".",
"All",
"calls",
"to",
"{",
"@link",
"Integer#toString",
"(",
"int",
")",
"}",
"that",
"are",
"displayed",
"to",
"the",
"user",
"should"... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/locale/LocaleFormatter.java#L75-L81 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java | GeoJsonWriteDriver.write | private void write(LineString geom, JsonGenerator gen) throws IOException {
gen.writeStringField("type", "LineString");
gen.writeFieldName("coordinates");
writeCoordinates(geom.getCoordinates(), gen);
} | java | private void write(LineString geom, JsonGenerator gen) throws IOException {
gen.writeStringField("type", "LineString");
gen.writeFieldName("coordinates");
writeCoordinates(geom.getCoordinates(), gen);
} | [
"private",
"void",
"write",
"(",
"LineString",
"geom",
",",
"JsonGenerator",
"gen",
")",
"throws",
"IOException",
"{",
"gen",
".",
"writeStringField",
"(",
"\"type\"",
",",
"\"LineString\"",
")",
";",
"gen",
".",
"writeFieldName",
"(",
"\"coordinates\"",
")",
... | Coordinates of LineString are an array of positions :
{ "type": "LineString", "coordinates": [ [100.0, 0.0], [101.0, 1.0] ] }
@param geom
@param gen
@throws IOException | [
"Coordinates",
"of",
"LineString",
"are",
"an",
"array",
"of",
"positions",
":"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java#L397-L401 |
phax/ph-commons | ph-collection/src/main/java/com/helger/collection/map/MapHelper.java | MapHelper.arraySize | @Nonnegative
public static int arraySize (final int nExpected, final float fLoadFactor)
{
final long s = Math.max (2, nextPowerOfTwo ((long) Math.ceil (nExpected / fLoadFactor)));
if (s > (1 << 30))
throw new IllegalArgumentException ("Too large (" +
nExpected +
" expected elements with load factor " +
fLoadFactor +
")");
return (int) s;
} | java | @Nonnegative
public static int arraySize (final int nExpected, final float fLoadFactor)
{
final long s = Math.max (2, nextPowerOfTwo ((long) Math.ceil (nExpected / fLoadFactor)));
if (s > (1 << 30))
throw new IllegalArgumentException ("Too large (" +
nExpected +
" expected elements with load factor " +
fLoadFactor +
")");
return (int) s;
} | [
"@",
"Nonnegative",
"public",
"static",
"int",
"arraySize",
"(",
"final",
"int",
"nExpected",
",",
"final",
"float",
"fLoadFactor",
")",
"{",
"final",
"long",
"s",
"=",
"Math",
".",
"max",
"(",
"2",
",",
"nextPowerOfTwo",
"(",
"(",
"long",
")",
"Math",
... | Returns the least power of two smaller than or equal to 2<sup>30</sup> and
larger than or equal to <code>Math.ceil( expected / f )</code>.
@param nExpected
the expected number of elements in a hash table.
@param fLoadFactor
the load factor.
@return the minimum possible size for a backing array.
@throws IllegalArgumentException
if the necessary size is larger than 2<sup>30</sup>. | [
"Returns",
"the",
"least",
"power",
"of",
"two",
"smaller",
"than",
"or",
"equal",
"to",
"2<sup",
">",
"30<",
"/",
"sup",
">",
"and",
"larger",
"than",
"or",
"equal",
"to",
"<code",
">",
"Math",
".",
"ceil",
"(",
"expected",
"/",
"f",
")",
"<",
"/"... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-collection/src/main/java/com/helger/collection/map/MapHelper.java#L69-L80 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/cli/CliClient.java | CliClient.updateKsDefAttributes | private KsDef updateKsDefAttributes(Tree statement, KsDef ksDefToUpdate)
{
KsDef ksDef = new KsDef(ksDefToUpdate);
// removing all column definitions - thrift system_update_keyspace method requires that
ksDef.setCf_defs(new LinkedList<CfDef>());
for(int i = 1; i < statement.getChildCount(); i += 2)
{
String currentStatement = statement.getChild(i).getText().toUpperCase();
AddKeyspaceArgument mArgument = AddKeyspaceArgument.valueOf(currentStatement);
String mValue = statement.getChild(i + 1).getText();
switch(mArgument)
{
case PLACEMENT_STRATEGY:
ksDef.setStrategy_class(CliUtils.unescapeSQLString(mValue));
break;
case STRATEGY_OPTIONS:
ksDef.setStrategy_options(getStrategyOptionsFromTree(statement.getChild(i + 1)));
break;
case DURABLE_WRITES:
ksDef.setDurable_writes(Boolean.parseBoolean(mValue));
break;
default:
//must match one of the above or we'd throw an exception at the valueOf statement above.
assert(false);
}
}
// using default snitch options if strategy is NetworkTopologyStrategy and no options were set.
if (ksDef.getStrategy_class().contains(".NetworkTopologyStrategy"))
{
Map<String, String> currentStrategyOptions = ksDef.getStrategy_options();
// adding default data center from SimpleSnitch
if (currentStrategyOptions == null || currentStrategyOptions.isEmpty())
{
SimpleSnitch snitch = new SimpleSnitch();
Map<String, String> options = new HashMap<String, String>();
try
{
options.put(snitch.getDatacenter(InetAddress.getLocalHost()), "1");
}
catch (UnknownHostException e)
{
throw new RuntimeException(e);
}
ksDef.setStrategy_options(options);
}
}
return ksDef;
} | java | private KsDef updateKsDefAttributes(Tree statement, KsDef ksDefToUpdate)
{
KsDef ksDef = new KsDef(ksDefToUpdate);
// removing all column definitions - thrift system_update_keyspace method requires that
ksDef.setCf_defs(new LinkedList<CfDef>());
for(int i = 1; i < statement.getChildCount(); i += 2)
{
String currentStatement = statement.getChild(i).getText().toUpperCase();
AddKeyspaceArgument mArgument = AddKeyspaceArgument.valueOf(currentStatement);
String mValue = statement.getChild(i + 1).getText();
switch(mArgument)
{
case PLACEMENT_STRATEGY:
ksDef.setStrategy_class(CliUtils.unescapeSQLString(mValue));
break;
case STRATEGY_OPTIONS:
ksDef.setStrategy_options(getStrategyOptionsFromTree(statement.getChild(i + 1)));
break;
case DURABLE_WRITES:
ksDef.setDurable_writes(Boolean.parseBoolean(mValue));
break;
default:
//must match one of the above or we'd throw an exception at the valueOf statement above.
assert(false);
}
}
// using default snitch options if strategy is NetworkTopologyStrategy and no options were set.
if (ksDef.getStrategy_class().contains(".NetworkTopologyStrategy"))
{
Map<String, String> currentStrategyOptions = ksDef.getStrategy_options();
// adding default data center from SimpleSnitch
if (currentStrategyOptions == null || currentStrategyOptions.isEmpty())
{
SimpleSnitch snitch = new SimpleSnitch();
Map<String, String> options = new HashMap<String, String>();
try
{
options.put(snitch.getDatacenter(InetAddress.getLocalHost()), "1");
}
catch (UnknownHostException e)
{
throw new RuntimeException(e);
}
ksDef.setStrategy_options(options);
}
}
return ksDef;
} | [
"private",
"KsDef",
"updateKsDefAttributes",
"(",
"Tree",
"statement",
",",
"KsDef",
"ksDefToUpdate",
")",
"{",
"KsDef",
"ksDef",
"=",
"new",
"KsDef",
"(",
"ksDefToUpdate",
")",
";",
"// removing all column definitions - thrift system_update_keyspace method requires that",
... | Used to update keyspace definition attributes
@param statement - ANTRL tree representing current statement
@param ksDefToUpdate - keyspace definition to update
@return ksDef - updated keyspace definition | [
"Used",
"to",
"update",
"keyspace",
"definition",
"attributes"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cli/CliClient.java#L1201-L1254 |
jglobus/JGlobus | gridftp/src/main/java/org/globus/ftp/FTPClient.java | FTPClient.setProtectionBufferSize | public void setProtectionBufferSize(int size)
throws IOException, ServerException {
if (size <= 0) {
throw new IllegalArgumentException("size <= 0");
}
localServer.setProtectionBufferSize(size);
try {
Command cmd = new Command("PBSZ", Integer.toString(size));
controlChannel.execute(cmd);
} catch (FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
} catch (UnexpectedReplyCodeException urce) {
throw ServerException.embedUnexpectedReplyCodeException(
urce,
"Server refused setting protection buffer size");
}
this.session.protectionBufferSize = size;
} | java | public void setProtectionBufferSize(int size)
throws IOException, ServerException {
if (size <= 0) {
throw new IllegalArgumentException("size <= 0");
}
localServer.setProtectionBufferSize(size);
try {
Command cmd = new Command("PBSZ", Integer.toString(size));
controlChannel.execute(cmd);
} catch (FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
} catch (UnexpectedReplyCodeException urce) {
throw ServerException.embedUnexpectedReplyCodeException(
urce,
"Server refused setting protection buffer size");
}
this.session.protectionBufferSize = size;
} | [
"public",
"void",
"setProtectionBufferSize",
"(",
"int",
"size",
")",
"throws",
"IOException",
",",
"ServerException",
"{",
"if",
"(",
"size",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"size <= 0\"",
")",
";",
"}",
"localServer",
... | Sets protection buffer size (defined in RFC 2228)
@param size the size of buffer | [
"Sets",
"protection",
"buffer",
"size",
"(",
"defined",
"in",
"RFC",
"2228",
")"
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/FTPClient.java#L878-L897 |
javafxports/javafxmobile-plugin | src/main/java/org/javafxports/jfxmobile/plugin/android/task/ApkBuilder.java | ApkBuilder.addResourcesFromJar | public JarStatus addResourcesFromJar(File jarFile) throws ApkCreationException,
SealedApkException, DuplicateFileException {
if (mIsSealed) {
throw new SealedApkException("APK is already sealed");
}
try {
verbosePrintln("%s:", jarFile);
// reset the filter with this input.
mFilter.reset(jarFile);
// ask the builder to add the content of the file, filtered to only let through
// the java resources.
FileInputStream fis = new FileInputStream(jarFile);
mBuilder.writeZip(fis, mFilter);
fis.close();
// check if native libraries were found in the external library. This should
// constitutes an error or warning depending on if they are in lib/
return new JarStatusImpl(mFilter.getNativeLibs(), mFilter.getNativeLibsConflict());
} catch (DuplicateFileException e) {
mBuilder.cleanUp();
throw e;
} catch (Exception e) {
mBuilder.cleanUp();
throw new ApkCreationException(e, "Failed to add %s", jarFile);
}
} | java | public JarStatus addResourcesFromJar(File jarFile) throws ApkCreationException,
SealedApkException, DuplicateFileException {
if (mIsSealed) {
throw new SealedApkException("APK is already sealed");
}
try {
verbosePrintln("%s:", jarFile);
// reset the filter with this input.
mFilter.reset(jarFile);
// ask the builder to add the content of the file, filtered to only let through
// the java resources.
FileInputStream fis = new FileInputStream(jarFile);
mBuilder.writeZip(fis, mFilter);
fis.close();
// check if native libraries were found in the external library. This should
// constitutes an error or warning depending on if they are in lib/
return new JarStatusImpl(mFilter.getNativeLibs(), mFilter.getNativeLibsConflict());
} catch (DuplicateFileException e) {
mBuilder.cleanUp();
throw e;
} catch (Exception e) {
mBuilder.cleanUp();
throw new ApkCreationException(e, "Failed to add %s", jarFile);
}
} | [
"public",
"JarStatus",
"addResourcesFromJar",
"(",
"File",
"jarFile",
")",
"throws",
"ApkCreationException",
",",
"SealedApkException",
",",
"DuplicateFileException",
"{",
"if",
"(",
"mIsSealed",
")",
"{",
"throw",
"new",
"SealedApkException",
"(",
"\"APK is already sea... | Adds the resources from a jar file.
@param jarFile the jar File.
@return a {@link JarStatus} object indicating if native libraries where found in
the jar file.
@throws ApkCreationException if an error occurred
@throws SealedApkException if the APK is already sealed.
@throws DuplicateFileException if a file conflicts with another already added to the APK
at the same location inside the APK archive. | [
"Adds",
"the",
"resources",
"from",
"a",
"jar",
"file",
"."
] | train | https://github.com/javafxports/javafxmobile-plugin/blob/a9bef513b7e1bfa85f9a668226e6943c6d9f847f/src/main/java/org/javafxports/jfxmobile/plugin/android/task/ApkBuilder.java#L614-L642 |
jmurty/java-xmlbuilder | src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java | BaseXMLBuilder.instructionImpl | protected void instructionImpl(String target, String data) {
xmlNode.appendChild(getDocument().createProcessingInstruction(target, data));
} | java | protected void instructionImpl(String target, String data) {
xmlNode.appendChild(getDocument().createProcessingInstruction(target, data));
} | [
"protected",
"void",
"instructionImpl",
"(",
"String",
"target",
",",
"String",
"data",
")",
"{",
"xmlNode",
".",
"appendChild",
"(",
"getDocument",
"(",
")",
".",
"createProcessingInstruction",
"(",
"target",
",",
"data",
")",
")",
";",
"}"
] | Add an instruction to the element represented by this builder node.
@param target
the target value for the instruction.
@param data
the data value for the instruction | [
"Add",
"an",
"instruction",
"to",
"the",
"element",
"represented",
"by",
"this",
"builder",
"node",
"."
] | train | https://github.com/jmurty/java-xmlbuilder/blob/7c224b8e8ed79808509322cb141dab5a88dd3cec/src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java#L881-L883 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/FileLogSet.java | FileLogSet.addFile | private void addFile(int index, String file) {
if (maxFiles > 0) {
int numFiles = files.size();
int maxDateFiles = getMaxDateFiles();
// If there is no max or we have fewer than max, then we're done.
if (maxDateFiles <= 0 || numFiles < maxDateFiles) {
files.add(index, file);
} else {
// The file names we deal with (messages_xx.xx.xx_xx.xx.xx.log)
// have dates, and we want to always be using the "most recent",
// so delete everything "newer" (index and after), which might be
// present if the system clock goes backwards, and then delete
// the oldest files until only maxDateFiles-1 remain.
while (files.size() > index) {
removeFile(files.size() - 1);
}
while (files.size() >= maxDateFiles) {
removeFile(0);
}
files.add(file);
}
}
} | java | private void addFile(int index, String file) {
if (maxFiles > 0) {
int numFiles = files.size();
int maxDateFiles = getMaxDateFiles();
// If there is no max or we have fewer than max, then we're done.
if (maxDateFiles <= 0 || numFiles < maxDateFiles) {
files.add(index, file);
} else {
// The file names we deal with (messages_xx.xx.xx_xx.xx.xx.log)
// have dates, and we want to always be using the "most recent",
// so delete everything "newer" (index and after), which might be
// present if the system clock goes backwards, and then delete
// the oldest files until only maxDateFiles-1 remain.
while (files.size() > index) {
removeFile(files.size() - 1);
}
while (files.size() >= maxDateFiles) {
removeFile(0);
}
files.add(file);
}
}
} | [
"private",
"void",
"addFile",
"(",
"int",
"index",
",",
"String",
"file",
")",
"{",
"if",
"(",
"maxFiles",
">",
"0",
")",
"{",
"int",
"numFiles",
"=",
"files",
".",
"size",
"(",
")",
";",
"int",
"maxDateFiles",
"=",
"getMaxDateFiles",
"(",
")",
";",
... | Adds a file name to the files list at the specified index. If adding
this file would cause the number of files to exceed the maximum, remove
all files after the specified index, and then remove the oldest files
until the number is reduced to the maximum.
@param index the index in the files list to insert the file
@param file the file name | [
"Adds",
"a",
"file",
"name",
"to",
"the",
"files",
"list",
"at",
"the",
"specified",
"index",
".",
"If",
"adding",
"this",
"file",
"would",
"cause",
"the",
"number",
"of",
"files",
"to",
"exceed",
"the",
"maximum",
"remove",
"all",
"files",
"after",
"the... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/FileLogSet.java#L387-L411 |
bbossgroups/bboss-elasticsearch | bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/ElasticSearchHelper.java | ElasticSearchHelper.booter | public static void booter(String[] elasticsearchServerNames,GetProperties configContext,boolean forceBoot){
booter( elasticsearchServerNames, configContext, forceBoot,false);
} | java | public static void booter(String[] elasticsearchServerNames,GetProperties configContext,boolean forceBoot){
booter( elasticsearchServerNames, configContext, forceBoot,false);
} | [
"public",
"static",
"void",
"booter",
"(",
"String",
"[",
"]",
"elasticsearchServerNames",
",",
"GetProperties",
"configContext",
",",
"boolean",
"forceBoot",
")",
"{",
"booter",
"(",
"elasticsearchServerNames",
",",
"configContext",
",",
"forceBoot",
",",
"false",
... | <property name="elasticsearch.client" value="${elasticsearch.client:restful}">
<description> <![CDATA[ 客户端类型:transport,restful ]]></description>
</property>
<property name="elasticUser" value="${elasticUser:}">
<description> <![CDATA[ 认证用户 ]]></description>
</property>
<property name="elasticPassword" value="${elasticPassword:}">
<description> <![CDATA[ 认证口令 ]]></description>
</property>
<!--<property name="elasticsearch.hostNames" value="${elasticsearch.hostNames}">
<description> <![CDATA[ 指定序列化处理类,默认为kafka.serializer.DefaultEncoder,即byte[] ]]></description>
</property>-->
<property name="elasticsearch.rest.hostNames" value="${elasticsearch.rest.hostNames:127.0.0.1:9200}">
<description> <![CDATA[ rest协议地址 ]]></description>
</property>
<property name="elasticsearch.dateFormat" value="${elasticsearch.dateFormat:yyyy.MM.dd}">
<description> <![CDATA[ 索引日期格式]]></description>
</property>
<property name="elasticsearch.timeZone" value="${elasticsearch.timeZone:Asia/Shanghai}">
<description> <![CDATA[ 时区信息]]></description>
</property>
<property name="elasticsearch.ttl" value="${elasticsearch.ttl:2d}">
<description> <![CDATA[ ms(毫秒) s(秒) m(分钟) h(小时) d(天) w(星期)]]></description>
</property>
<property name="elasticsearch.showTemplate" value="${elasticsearch.showTemplate:false}">
<description> <![CDATA[ query dsl脚本日志调试开关,与log info级别日志结合使用]]></description>
</property>
<property name="elasticsearch.httpPool" value="${elasticsearch.httpPool:default}">
<description> <![CDATA[ http连接池逻辑名称,在conf/httpclient.xml中配置]]></description>
</property>
<property name="elasticsearch.discoverHost" value="${elasticsearch.discoverHost:false}">
<description> <![CDATA[ 是否启动节点自动发现功能,默认关闭,开启后每隔10秒探测新加或者移除的es节点,实时更新本地地址清单]]></description>
</property> | [
"<property",
"name",
"=",
"elasticsearch",
".",
"client",
"value",
"=",
"$",
"{",
"elasticsearch",
".",
"client",
":",
"restful",
"}",
">",
"<description",
">",
"<!",
"[",
"CDATA",
"[",
"客户端类型",
":",
"transport,restful",
"]]",
">",
"<",
"/",
"description",... | train | https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/ElasticSearchHelper.java#L97-L99 |
igniterealtime/REST-API-Client | src/main/java/org/igniterealtime/restclient/RestApiClient.java | RestApiClient.addOutcastGroup | public Response addOutcastGroup(String roomName, String groupName) {
return restClient.post("chatrooms/" + roomName + "/outcasts/group/" + groupName, null, new HashMap<String, String>());
} | java | public Response addOutcastGroup(String roomName, String groupName) {
return restClient.post("chatrooms/" + roomName + "/outcasts/group/" + groupName, null, new HashMap<String, String>());
} | [
"public",
"Response",
"addOutcastGroup",
"(",
"String",
"roomName",
",",
"String",
"groupName",
")",
"{",
"return",
"restClient",
".",
"post",
"(",
"\"chatrooms/\"",
"+",
"roomName",
"+",
"\"/outcasts/group/\"",
"+",
"groupName",
",",
"null",
",",
"new",
"HashMa... | Adds the group outcast.
@param roomName
the room name
@param groupName
the groupName
@return the response | [
"Adds",
"the",
"group",
"outcast",
"."
] | train | https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L437-L439 |
mbeiter/util | db/src/main/java/org/beiter/michael/db/ConnectionFactory.java | ConnectionFactory.getConnection | public static Connection getConnection(final ConnectionProperties poolSpec)
throws FactoryException {
Validate.notNull(poolSpec, "The validated object 'poolSpec' is null");
Validate.notBlank(poolSpec.getDriver(),
"The validated character sequence 'poolSpec.getDriver()' is null or empty");
Validate.notBlank(poolSpec.getUrl(), "The validated character sequence 'poolSpec.getUrl()' is null or empty");
// no need for defensive copies of Strings
try {
return DataSourceFactory.getDataSource(poolSpec).getConnection();
} catch (SQLException e) {
// a connection is identified by the URL, the username, and the password
final String key = String.format("%s:%s", poolSpec.getUrl(), poolSpec.getUsername());
final String error = "Error retrieving JDBC connection from pool: " + key;
LOG.warn(error);
throw new FactoryException(error, e);
}
} | java | public static Connection getConnection(final ConnectionProperties poolSpec)
throws FactoryException {
Validate.notNull(poolSpec, "The validated object 'poolSpec' is null");
Validate.notBlank(poolSpec.getDriver(),
"The validated character sequence 'poolSpec.getDriver()' is null or empty");
Validate.notBlank(poolSpec.getUrl(), "The validated character sequence 'poolSpec.getUrl()' is null or empty");
// no need for defensive copies of Strings
try {
return DataSourceFactory.getDataSource(poolSpec).getConnection();
} catch (SQLException e) {
// a connection is identified by the URL, the username, and the password
final String key = String.format("%s:%s", poolSpec.getUrl(), poolSpec.getUsername());
final String error = "Error retrieving JDBC connection from pool: " + key;
LOG.warn(error);
throw new FactoryException(error, e);
}
} | [
"public",
"static",
"Connection",
"getConnection",
"(",
"final",
"ConnectionProperties",
"poolSpec",
")",
"throws",
"FactoryException",
"{",
"Validate",
".",
"notNull",
"(",
"poolSpec",
",",
"\"The validated object 'poolSpec' is null\"",
")",
";",
"Validate",
".",
"notB... | Return a Connection instance from a pool that manages JDBC driver based connections.
<p>
The driver-based connection are managed in a connection pool. The pool is created using the provided properties
for both the connection and the pool spec. Once the pool has been created, it is cached (based on URL and
username), and can no longer be changed. Subsequent calls to this method will return a connection from the
cached pool, and changes in the pool spec (e.g. changes to the size of the pool) will be ignored.
@param poolSpec A connection pool spec that has the driver and url configured as non-empty strings
@return a JDBC connection
@throws FactoryException When the connection cannot be retrieved from the pool, or the pool cannot be
created
@throws NullPointerException When the {@code poolSpec}, {@code poolSpec.getDriver()}, or
{@code poolSpec.getUrl()} are {@code null}
@throws IllegalArgumentException When {@code poolSpec.getDriver()} or {@code poolSpec.getUrl()} are empty | [
"Return",
"a",
"Connection",
"instance",
"from",
"a",
"pool",
"that",
"manages",
"JDBC",
"driver",
"based",
"connections",
".",
"<p",
">",
"The",
"driver",
"-",
"based",
"connection",
"are",
"managed",
"in",
"a",
"connection",
"pool",
".",
"The",
"pool",
"... | train | https://github.com/mbeiter/util/blob/490fcebecb936e00c2f2ce2096b679b2fd10865e/db/src/main/java/org/beiter/michael/db/ConnectionFactory.java#L103-L122 |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/msg/ModbusRequestBuilder.java | ModbusRequestBuilder.buildChangeAsciiInputDelimiter | public ModbusRequest buildChangeAsciiInputDelimiter(int serverAddress, int delimiter) throws ModbusNumberException {
return buildDiagnostics(DiagnosticsSubFunctionCode.CHANGE_ASCII_INPUT_DELIMITER, serverAddress, delimiter);
} | java | public ModbusRequest buildChangeAsciiInputDelimiter(int serverAddress, int delimiter) throws ModbusNumberException {
return buildDiagnostics(DiagnosticsSubFunctionCode.CHANGE_ASCII_INPUT_DELIMITER, serverAddress, delimiter);
} | [
"public",
"ModbusRequest",
"buildChangeAsciiInputDelimiter",
"(",
"int",
"serverAddress",
",",
"int",
"delimiter",
")",
"throws",
"ModbusNumberException",
"{",
"return",
"buildDiagnostics",
"(",
"DiagnosticsSubFunctionCode",
".",
"CHANGE_ASCII_INPUT_DELIMITER",
",",
"serverAd... | The character passed in the request data field becomes the end of message delimiter
for future messages (replacing the default LF character). This function is useful in cases of a
Line Feed is not required at the end of ASCII messages.
@param serverAddress a slave address
@param delimiter request data field
@return DiagnosticsRequest instance
@throws ModbusNumberException if server address is in-valid | [
"The",
"character",
"passed",
"in",
"the",
"request",
"data",
"field",
"becomes",
"the",
"end",
"of",
"message",
"delimiter",
"for",
"future",
"messages",
"(",
"replacing",
"the",
"default",
"LF",
"character",
")",
".",
"This",
"function",
"is",
"useful",
"i... | train | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/msg/ModbusRequestBuilder.java#L247-L249 |
elki-project/elki | elki-database/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/RandomStableDistanceFunction.java | RandomStableDistanceFunction.pseudoRandom | private double pseudoRandom(final long seed, int input) {
// Default constants from "man drand48"
final long mult = 0x5DEECE66DL;
final long add = 0xBL;
final long mask = (1L << 48) - 1; // 48 bit
// Produce an initial seed each
final long i1 = (input ^ seed ^ mult) & mask;
final long i2 = (input ^ (seed >>> 16) ^ mult) & mask;
// Compute the first random each
final long l1 = (i1 * mult + add) & mask;
final long l2 = (i2 * mult + add) & mask;
// Use 53 bit total:
final int r1 = (int) (l1 >>> 22); // 48 - 22 = 26
final int r2 = (int) (l2 >>> 21); // 48 - 21 = 27
double random = ((((long) r1) << 27) + r2) / (double) (1L << 53);
return random;
} | java | private double pseudoRandom(final long seed, int input) {
// Default constants from "man drand48"
final long mult = 0x5DEECE66DL;
final long add = 0xBL;
final long mask = (1L << 48) - 1; // 48 bit
// Produce an initial seed each
final long i1 = (input ^ seed ^ mult) & mask;
final long i2 = (input ^ (seed >>> 16) ^ mult) & mask;
// Compute the first random each
final long l1 = (i1 * mult + add) & mask;
final long l2 = (i2 * mult + add) & mask;
// Use 53 bit total:
final int r1 = (int) (l1 >>> 22); // 48 - 22 = 26
final int r2 = (int) (l2 >>> 21); // 48 - 21 = 27
double random = ((((long) r1) << 27) + r2) / (double) (1L << 53);
return random;
} | [
"private",
"double",
"pseudoRandom",
"(",
"final",
"long",
"seed",
",",
"int",
"input",
")",
"{",
"// Default constants from \"man drand48\"",
"final",
"long",
"mult",
"=",
"0x5DEECE66D",
"",
"L",
";",
"final",
"long",
"add",
"=",
"0xB",
"L",
";",
"final",
"... | Pseudo random number generator, adaption of the common rand48 generator
which can be found in C (man drand48), Java and attributed to Donald Knuth.
@param seed Seed value
@param input Input code
@return Pseudo random double value | [
"Pseudo",
"random",
"number",
"generator",
"adaption",
"of",
"the",
"common",
"rand48",
"generator",
"which",
"can",
"be",
"found",
"in",
"C",
"(",
"man",
"drand48",
")",
"Java",
"and",
"attributed",
"to",
"Donald",
"Knuth",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-database/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/RandomStableDistanceFunction.java#L92-L108 |
prolificinteractive/material-calendarview | library/src/main/java/com/prolificinteractive/materialcalendarview/CalendarPagerAdapter.java | CalendarPagerAdapter.selectRange | public void selectRange(final CalendarDay first, final CalendarDay last) {
selectedDates.clear();
// Copy to start from the first day and increment
LocalDate temp = LocalDate.of(first.getYear(), first.getMonth(), first.getDay());
// for comparison
final LocalDate end = last.getDate();
while( temp.isBefore(end) || temp.equals(end) ) {
selectedDates.add(CalendarDay.from(temp));
temp = temp.plusDays(1);
}
invalidateSelectedDates();
} | java | public void selectRange(final CalendarDay first, final CalendarDay last) {
selectedDates.clear();
// Copy to start from the first day and increment
LocalDate temp = LocalDate.of(first.getYear(), first.getMonth(), first.getDay());
// for comparison
final LocalDate end = last.getDate();
while( temp.isBefore(end) || temp.equals(end) ) {
selectedDates.add(CalendarDay.from(temp));
temp = temp.plusDays(1);
}
invalidateSelectedDates();
} | [
"public",
"void",
"selectRange",
"(",
"final",
"CalendarDay",
"first",
",",
"final",
"CalendarDay",
"last",
")",
"{",
"selectedDates",
".",
"clear",
"(",
")",
";",
"// Copy to start from the first day and increment",
"LocalDate",
"temp",
"=",
"LocalDate",
".",
"of",... | Clear the previous selection, select the range of days from first to last, and finally
invalidate. First day should be before last day, otherwise the selection won't happen.
@param first The first day of the range.
@param last The last day in the range.
@see CalendarPagerAdapter#setDateSelected(CalendarDay, boolean) | [
"Clear",
"the",
"previous",
"selection",
"select",
"the",
"range",
"of",
"days",
"from",
"first",
"to",
"last",
"and",
"finally",
"invalidate",
".",
"First",
"day",
"should",
"be",
"before",
"last",
"day",
"otherwise",
"the",
"selection",
"won",
"t",
"happen... | train | https://github.com/prolificinteractive/material-calendarview/blob/04fae8175fd034d0a7131f8cb253cae883a88aa2/library/src/main/java/com/prolificinteractive/materialcalendarview/CalendarPagerAdapter.java#L325-L340 |
languagetool-org/languagetool | languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanSpellerRule.java | GermanSpellerRule.getPastTenseVerbSuggestion | @Nullable
private String getPastTenseVerbSuggestion(String word) {
if (word.endsWith("e")) {
// strip trailing "e"
String wordStem = word.substring(0, word.length()-1);
try {
String lemma = baseForThirdPersonSingularVerb(wordStem);
if (lemma != null) {
AnalyzedToken token = new AnalyzedToken(lemma, null, lemma);
String[] forms = synthesizer.synthesize(token, "VER:3:SIN:PRT:.*", true);
if (forms.length > 0) {
return forms[0];
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return null;
} | java | @Nullable
private String getPastTenseVerbSuggestion(String word) {
if (word.endsWith("e")) {
// strip trailing "e"
String wordStem = word.substring(0, word.length()-1);
try {
String lemma = baseForThirdPersonSingularVerb(wordStem);
if (lemma != null) {
AnalyzedToken token = new AnalyzedToken(lemma, null, lemma);
String[] forms = synthesizer.synthesize(token, "VER:3:SIN:PRT:.*", true);
if (forms.length > 0) {
return forms[0];
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return null;
} | [
"@",
"Nullable",
"private",
"String",
"getPastTenseVerbSuggestion",
"(",
"String",
"word",
")",
"{",
"if",
"(",
"word",
".",
"endsWith",
"(",
"\"e\"",
")",
")",
"{",
"// strip trailing \"e\"",
"String",
"wordStem",
"=",
"word",
".",
"substring",
"(",
"0",
",... | non-native speakers and cannot be found by just looking for similar words. | [
"non",
"-",
"native",
"speakers",
"and",
"cannot",
"be",
"found",
"by",
"just",
"looking",
"for",
"similar",
"words",
"."
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanSpellerRule.java#L1147-L1166 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/config/CommandLine.java | CommandLine.addSwitch | public void addSwitch(String option, String description) {
optionList.add(option);
optionDescriptionMap.put(option, description);
if (option.length() > maxWidth) {
maxWidth = option.length();
}
} | java | public void addSwitch(String option, String description) {
optionList.add(option);
optionDescriptionMap.put(option, description);
if (option.length() > maxWidth) {
maxWidth = option.length();
}
} | [
"public",
"void",
"addSwitch",
"(",
"String",
"option",
",",
"String",
"description",
")",
"{",
"optionList",
".",
"add",
"(",
"option",
")",
";",
"optionDescriptionMap",
".",
"put",
"(",
"option",
",",
"description",
")",
";",
"if",
"(",
"option",
".",
... | Add a command line switch. This method is for adding options that do not
require an argument.
@param option
the option, must start with "-"
@param description
single line description of the option | [
"Add",
"a",
"command",
"line",
"switch",
".",
"This",
"method",
"is",
"for",
"adding",
"options",
"that",
"do",
"not",
"require",
"an",
"argument",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/config/CommandLine.java#L94-L101 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WColumnRenderer.java | WColumnRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WColumn col = (WColumn) component;
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("ui:column");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
int width = col.getWidth();
xml.appendOptionalAttribute("width", width > 0, width);
switch (col.getAlignment()) {
case LEFT:
// left is assumed if omitted
break;
case RIGHT:
xml.appendAttribute("align", "right");
break;
case CENTER:
xml.appendAttribute("align", "center");
break;
default:
throw new IllegalArgumentException("Invalid alignment: " + col.getAlignment());
}
xml.appendClose();
// Paint column contents
paintChildren(col, renderContext);
xml.appendEndTag("ui:column");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WColumn col = (WColumn) component;
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("ui:column");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
int width = col.getWidth();
xml.appendOptionalAttribute("width", width > 0, width);
switch (col.getAlignment()) {
case LEFT:
// left is assumed if omitted
break;
case RIGHT:
xml.appendAttribute("align", "right");
break;
case CENTER:
xml.appendAttribute("align", "center");
break;
default:
throw new IllegalArgumentException("Invalid alignment: " + col.getAlignment());
}
xml.appendClose();
// Paint column contents
paintChildren(col, renderContext);
xml.appendEndTag("ui:column");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WColumn",
"col",
"=",
"(",
"WColumn",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
... | Paints the given WButton.
@param component the WColumn to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WButton",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WColumnRenderer.java#L23-L58 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.findLastIndexOf | public static int findLastIndexOf(Object self, int startIndex, Closure condition) {
return findLastIndexOf(InvokerHelper.asIterator(self), startIndex, condition);
} | java | public static int findLastIndexOf(Object self, int startIndex, Closure condition) {
return findLastIndexOf(InvokerHelper.asIterator(self), startIndex, condition);
} | [
"public",
"static",
"int",
"findLastIndexOf",
"(",
"Object",
"self",
",",
"int",
"startIndex",
",",
"Closure",
"condition",
")",
"{",
"return",
"findLastIndexOf",
"(",
"InvokerHelper",
".",
"asIterator",
"(",
"self",
")",
",",
"startIndex",
",",
"condition",
"... | Iterates over the elements of an aggregate of items, starting
from a specified startIndex, and returns the index of the last item that
matches the condition specified in the closure.
@param self the iteration object over which to iterate
@param startIndex start matching from this index
@param condition the matching condition
@return an integer that is the index of the last matched object or -1 if no match was found
@since 1.5.2 | [
"Iterates",
"over",
"the",
"elements",
"of",
"an",
"aggregate",
"of",
"items",
"starting",
"from",
"a",
"specified",
"startIndex",
"and",
"returns",
"the",
"index",
"of",
"the",
"last",
"item",
"that",
"matches",
"the",
"condition",
"specified",
"in",
"the",
... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16834-L16836 |
jlinn/quartz-redis-jobstore | src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java | RedisJobStore.storeJobAndTrigger | @Override
public void storeJobAndTrigger(final JobDetail newJob, final OperableTrigger newTrigger) throws ObjectAlreadyExistsException, JobPersistenceException {
try {
doWithLock(new LockCallbackWithoutResult() {
@Override
public Void doWithLock(JedisCommands jedis) throws JobPersistenceException {
storage.storeJob(newJob, false, jedis);
storage.storeTrigger(newTrigger, false, jedis);
return null;
}
});
} catch (ObjectAlreadyExistsException e) {
logger.info("Job and / or trigger already exist in storage.", e);
throw e;
} catch (Exception e) {
logger.error("Could not store job.", e);
throw new JobPersistenceException(e.getMessage(), e);
}
} | java | @Override
public void storeJobAndTrigger(final JobDetail newJob, final OperableTrigger newTrigger) throws ObjectAlreadyExistsException, JobPersistenceException {
try {
doWithLock(new LockCallbackWithoutResult() {
@Override
public Void doWithLock(JedisCommands jedis) throws JobPersistenceException {
storage.storeJob(newJob, false, jedis);
storage.storeTrigger(newTrigger, false, jedis);
return null;
}
});
} catch (ObjectAlreadyExistsException e) {
logger.info("Job and / or trigger already exist in storage.", e);
throw e;
} catch (Exception e) {
logger.error("Could not store job.", e);
throw new JobPersistenceException(e.getMessage(), e);
}
} | [
"@",
"Override",
"public",
"void",
"storeJobAndTrigger",
"(",
"final",
"JobDetail",
"newJob",
",",
"final",
"OperableTrigger",
"newTrigger",
")",
"throws",
"ObjectAlreadyExistsException",
",",
"JobPersistenceException",
"{",
"try",
"{",
"doWithLock",
"(",
"new",
"Lock... | Store the given <code>{@link org.quartz.JobDetail}</code> and <code>{@link org.quartz.Trigger}</code>.
@param newJob The <code>JobDetail</code> to be stored.
@param newTrigger The <code>Trigger</code> to be stored.
@throws org.quartz.ObjectAlreadyExistsException if a <code>Job</code> with the same name/group already
exists. | [
"Store",
"the",
"given",
"<code",
">",
"{",
"@link",
"org",
".",
"quartz",
".",
"JobDetail",
"}",
"<",
"/",
"code",
">",
"and",
"<code",
">",
"{",
"@link",
"org",
".",
"quartz",
".",
"Trigger",
"}",
"<",
"/",
"code",
">",
"."
] | train | https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java#L257-L275 |
ysc/HtmlExtractor | html-extractor/src/main/java/org/apdplat/extractor/html/impl/ExtractRegular.java | ExtractRegular.getInstance | public static ExtractRegular getInstance(String serverUrl, String redisHost, int redisPort) {
if (extractRegular != null) {
return extractRegular;
}
synchronized (ExtractRegular.class) {
if (extractRegular == null) {
extractRegular = new ExtractRegular();
//订阅Redis服务器Channel:pr,当规则改变的时候会收到通知消息CHANGE并重新初始化规则集合
extractRegular.subscribeRedis(redisHost, redisPort, serverUrl);
//初始化抽取规则
extractRegular.init(serverUrl);
}
}
return extractRegular;
} | java | public static ExtractRegular getInstance(String serverUrl, String redisHost, int redisPort) {
if (extractRegular != null) {
return extractRegular;
}
synchronized (ExtractRegular.class) {
if (extractRegular == null) {
extractRegular = new ExtractRegular();
//订阅Redis服务器Channel:pr,当规则改变的时候会收到通知消息CHANGE并重新初始化规则集合
extractRegular.subscribeRedis(redisHost, redisPort, serverUrl);
//初始化抽取规则
extractRegular.init(serverUrl);
}
}
return extractRegular;
} | [
"public",
"static",
"ExtractRegular",
"getInstance",
"(",
"String",
"serverUrl",
",",
"String",
"redisHost",
",",
"int",
"redisPort",
")",
"{",
"if",
"(",
"extractRegular",
"!=",
"null",
")",
"{",
"return",
"extractRegular",
";",
"}",
"synchronized",
"(",
"Ext... | 获取抽取规则实例
@param serverUrl 配置管理WEB服务器的抽取规则下载地址
@param redisHost Redis服务器主机
@param redisPort Redis服务器端口
@return 抽取规则实例 | [
"获取抽取规则实例"
] | train | https://github.com/ysc/HtmlExtractor/blob/5378bc5f94138562c55506cf81de1ffe72ab701e/html-extractor/src/main/java/org/apdplat/extractor/html/impl/ExtractRegular.java#L96-L110 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.