repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/MessageMLContext.java | MessageMLContext.parseMessageML | public void parseMessageML(String message, String entityJson, String version) throws InvalidInputException, IOException,
ProcessingException {
this.messageML = messageMLParser.parse(message, entityJson, version);
this.entityJson = messageMLParser.getEntityJson();
this.markdownRenderer = new MarkdownRenderer(messageML.asMarkdown());
} | java | public void parseMessageML(String message, String entityJson, String version) throws InvalidInputException, IOException,
ProcessingException {
this.messageML = messageMLParser.parse(message, entityJson, version);
this.entityJson = messageMLParser.getEntityJson();
this.markdownRenderer = new MarkdownRenderer(messageML.asMarkdown());
} | [
"public",
"void",
"parseMessageML",
"(",
"String",
"message",
",",
"String",
"entityJson",
",",
"String",
"version",
")",
"throws",
"InvalidInputException",
",",
"IOException",
",",
"ProcessingException",
"{",
"this",
".",
"messageML",
"=",
"messageMLParser",
".",
... | Parse the text contents of the message and optionally EntityJSON into a MessageMLV2 message. Expands
Freemarker templates and generates document tree structures for serialization into output formats with the
respective get() methods.
@param message string containing a MessageMLV2 message with optional Freemarker templates
@param entityJson string containing EntityJSON data
@param version string containing the version of the message format
@throws InvalidInputException thrown on invalid MessageMLV2 input
@throws ProcessingException thrown on errors generating the document tree
@throws IOException thrown on invalid EntityJSON input | [
"Parse",
"the",
"text",
"contents",
"of",
"the",
"message",
"and",
"optionally",
"EntityJSON",
"into",
"a",
"MessageMLV2",
"message",
".",
"Expands",
"Freemarker",
"templates",
"and",
"generates",
"document",
"tree",
"structures",
"for",
"serialization",
"into",
"... | train | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/MessageMLContext.java#L69-L75 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.indexOf | public static int indexOf(short[] array, short value) {
if (null != array) {
for (int i = 0; i < array.length; i++) {
if (value == array[i]) {
return i;
}
}
}
return INDEX_NOT_FOUND;
} | java | public static int indexOf(short[] array, short value) {
if (null != array) {
for (int i = 0; i < array.length; i++) {
if (value == array[i]) {
return i;
}
}
}
return INDEX_NOT_FOUND;
} | [
"public",
"static",
"int",
"indexOf",
"(",
"short",
"[",
"]",
"array",
",",
"short",
"value",
")",
"{",
"if",
"(",
"null",
"!=",
"array",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
... | 返回数组中指定元素所在位置,未找到返回{@link #INDEX_NOT_FOUND}
@param array 数组
@param value 被检查的元素
@return 数组中指定元素所在位置,未找到返回{@link #INDEX_NOT_FOUND}
@since 3.0.7 | [
"返回数组中指定元素所在位置,未找到返回",
"{",
"@link",
"#INDEX_NOT_FOUND",
"}"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L1100-L1109 |
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/view/ViewFactory.java | ViewFactory.assembleViewClassName | public String assembleViewClassName(String packageRoot, String packagePrefix, String modelClassName)
{
if (modelClassName.length() > 1)
if (Character.isUpperCase(modelClassName.charAt(1)))
if (modelClassName.charAt(0) == 'S')
modelClassName = modelClassName.substring(1);
String strViewDir = this.getViewSubpackage();
char chViewPrefix = this.getViewPrefix();
if (packagePrefix.length() > 0)
packagePrefix += '.';
modelClassName = packageRoot + strViewDir + '.' + packagePrefix + chViewPrefix + modelClassName;
return modelClassName;
} | java | public String assembleViewClassName(String packageRoot, String packagePrefix, String modelClassName)
{
if (modelClassName.length() > 1)
if (Character.isUpperCase(modelClassName.charAt(1)))
if (modelClassName.charAt(0) == 'S')
modelClassName = modelClassName.substring(1);
String strViewDir = this.getViewSubpackage();
char chViewPrefix = this.getViewPrefix();
if (packagePrefix.length() > 0)
packagePrefix += '.';
modelClassName = packageRoot + strViewDir + '.' + packagePrefix + chViewPrefix + modelClassName;
return modelClassName;
} | [
"public",
"String",
"assembleViewClassName",
"(",
"String",
"packageRoot",
",",
"String",
"packagePrefix",
",",
"String",
"modelClassName",
")",
"{",
"if",
"(",
"modelClassName",
".",
"length",
"(",
")",
">",
"1",
")",
"if",
"(",
"Character",
".",
"isUpperCase... | Give the model name, return the view name.
@param packagePrefix The prefix package to place before the class name (if any).
@param modelClassName The Model's class name.
@return The class name for the view. | [
"Give",
"the",
"model",
"name",
"return",
"the",
"view",
"name",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/view/ViewFactory.java#L178-L190 |
soi-toolkit/soi-toolkit-mule | commons/components/module-logger/src/main/java/org/soitoolkit/commons/module/logger/SoitoolkitLoggerModule.java | SoitoolkitLoggerModule.logTrace | @Processor
public Object logTrace(
String message,
@Optional String integrationScenario,
@Optional String contractId,
@Optional String correlationId,
@Optional Map<String, String> extra) {
return doLog(LogLevelType.TRACE, message, integrationScenario, contractId, correlationId, extra);
} | java | @Processor
public Object logTrace(
String message,
@Optional String integrationScenario,
@Optional String contractId,
@Optional String correlationId,
@Optional Map<String, String> extra) {
return doLog(LogLevelType.TRACE, message, integrationScenario, contractId, correlationId, extra);
} | [
"@",
"Processor",
"public",
"Object",
"logTrace",
"(",
"String",
"message",
",",
"@",
"Optional",
"String",
"integrationScenario",
",",
"@",
"Optional",
"String",
"contractId",
",",
"@",
"Optional",
"String",
"correlationId",
",",
"@",
"Optional",
"Map",
"<",
... | Log processor for level TRACE
{@sample.xml ../../../doc/SoitoolkitLogger-connector.xml.sample soitoolkitlogger:log}
@param message Log-message to be processed
@param integrationScenario Optional name of the integration scenario or business process
@param contractId Optional name of the contract in use
@param correlationId Optional correlation identity of the message
@param extra Optional extra info
@return The incoming payload | [
"Log",
"processor",
"for",
"level",
"TRACE"
] | train | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/module-logger/src/main/java/org/soitoolkit/commons/module/logger/SoitoolkitLoggerModule.java#L98-L107 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java | AbstractAsymmetricCrypto.decryptFromBcd | public byte[] decryptFromBcd(String data, KeyType keyType) {
return decryptFromBcd(data, keyType, CharsetUtil.CHARSET_UTF_8);
} | java | public byte[] decryptFromBcd(String data, KeyType keyType) {
return decryptFromBcd(data, keyType, CharsetUtil.CHARSET_UTF_8);
} | [
"public",
"byte",
"[",
"]",
"decryptFromBcd",
"(",
"String",
"data",
",",
"KeyType",
"keyType",
")",
"{",
"return",
"decryptFromBcd",
"(",
"data",
",",
"keyType",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
")",
";",
"}"
] | 解密BCD
@param data 数据
@param keyType 密钥类型
@return 解密后的密文
@since 4.1.0 | [
"解密BCD"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java#L283-L285 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.leftShift | public static OutputStream leftShift(OutputStream self, byte[] value) throws IOException {
self.write(value);
self.flush();
return self;
} | java | public static OutputStream leftShift(OutputStream self, byte[] value) throws IOException {
self.write(value);
self.flush();
return self;
} | [
"public",
"static",
"OutputStream",
"leftShift",
"(",
"OutputStream",
"self",
",",
"byte",
"[",
"]",
"value",
")",
"throws",
"IOException",
"{",
"self",
".",
"write",
"(",
"value",
")",
";",
"self",
".",
"flush",
"(",
")",
";",
"return",
"self",
";",
"... | Overloads the leftShift operator to provide an append mechanism to add bytes to a stream.
@param self an OutputStream
@param value a value to append
@return an OutputStream
@throws IOException if an I/O error occurs.
@since 1.0 | [
"Overloads",
"the",
"leftShift",
"operator",
"to",
"provide",
"an",
"append",
"mechanism",
"to",
"add",
"bytes",
"to",
"a",
"stream",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L225-L229 |
biojava/biojava | biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java | Alignments.getAllPairsScores | public static <S extends Sequence<C>, C extends Compound> double[] getAllPairsScores( List<S> sequences,
PairwiseSequenceScorerType type, GapPenalty gapPenalty, SubstitutionMatrix<C> subMatrix) {
return runPairwiseScorers(getAllPairsScorers(sequences, type, gapPenalty, subMatrix));
} | java | public static <S extends Sequence<C>, C extends Compound> double[] getAllPairsScores( List<S> sequences,
PairwiseSequenceScorerType type, GapPenalty gapPenalty, SubstitutionMatrix<C> subMatrix) {
return runPairwiseScorers(getAllPairsScorers(sequences, type, gapPenalty, subMatrix));
} | [
"public",
"static",
"<",
"S",
"extends",
"Sequence",
"<",
"C",
">",
",",
"C",
"extends",
"Compound",
">",
"double",
"[",
"]",
"getAllPairsScores",
"(",
"List",
"<",
"S",
">",
"sequences",
",",
"PairwiseSequenceScorerType",
"type",
",",
"GapPenalty",
"gapPena... | Factory method which computes a sequence pair score for all {@link Sequence} pairs in the given {@link List}.
This method runs the scorings in parallel by submitting all of the scorings to the shared thread pool of the
{@link ConcurrencyTools} utility.
@param <S> each {@link Sequence} of a pair is of type S
@param <C> each element of a {@link Sequence} is a {@link Compound} of type C
@param sequences the {@link List} of {@link Sequence}s to align
@param type chosen type from list of pairwise sequence scoring routines
@param gapPenalty the gap penalties used during alignment
@param subMatrix the set of substitution scores used during alignment
@return list of sequence pair scores | [
"Factory",
"method",
"which",
"computes",
"a",
"sequence",
"pair",
"score",
"for",
"all",
"{",
"@link",
"Sequence",
"}",
"pairs",
"in",
"the",
"given",
"{",
"@link",
"List",
"}",
".",
"This",
"method",
"runs",
"the",
"scorings",
"in",
"parallel",
"by",
"... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java#L281-L284 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java | ResourceUtils.doesResourceExist | public static boolean doesResourceExist(final String resource, final ResourceLoader resourceLoader) {
try {
if (StringUtils.isNotBlank(resource)) {
val res = resourceLoader.getResource(resource);
return doesResourceExist(res);
}
} catch (final Exception e) {
LOGGER.warn(e.getMessage(), e);
}
return false;
} | java | public static boolean doesResourceExist(final String resource, final ResourceLoader resourceLoader) {
try {
if (StringUtils.isNotBlank(resource)) {
val res = resourceLoader.getResource(resource);
return doesResourceExist(res);
}
} catch (final Exception e) {
LOGGER.warn(e.getMessage(), e);
}
return false;
} | [
"public",
"static",
"boolean",
"doesResourceExist",
"(",
"final",
"String",
"resource",
",",
"final",
"ResourceLoader",
"resourceLoader",
")",
"{",
"try",
"{",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"resource",
")",
")",
"{",
"val",
"res",
"=",
"r... | Does resource exist?
@param resource the resource
@param resourceLoader the resource loader
@return the boolean | [
"Does",
"resource",
"exist?"
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java#L68-L78 |
thelinmichael/spotify-web-api-java | src/main/java/com/wrapper/spotify/SpotifyApi.java | SpotifyApi.createPlaylist | public CreatePlaylistRequest.Builder createPlaylist(String user_id, String name) {
return new CreatePlaylistRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.user_id(user_id)
.name(name);
} | java | public CreatePlaylistRequest.Builder createPlaylist(String user_id, String name) {
return new CreatePlaylistRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.user_id(user_id)
.name(name);
} | [
"public",
"CreatePlaylistRequest",
".",
"Builder",
"createPlaylist",
"(",
"String",
"user_id",
",",
"String",
"name",
")",
"{",
"return",
"new",
"CreatePlaylistRequest",
".",
"Builder",
"(",
"accessToken",
")",
".",
"setDefaults",
"(",
"httpManager",
",",
"scheme"... | Create a playlist.
@param user_id The playlists owner.
@param name The name of the playlist.
@return A {@link CreatePlaylistRequest.Builder}.
@see <a href="https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids">Spotify: URLs & IDs</a> | [
"Create",
"a",
"playlist",
"."
] | train | https://github.com/thelinmichael/spotify-web-api-java/blob/c06b8512344c0310d0c1df362fa267879021da2e/src/main/java/com/wrapper/spotify/SpotifyApi.java#L1158-L1163 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/QuickSelect.java | QuickSelect.insertionSort | private static <T> void insertionSort(T data, Adapter<T> adapter, int start, int end) {
for(int i = start + 1; i < end; i++) {
for(int j = i; j > start && adapter.compare(data, j - 1, j) > 0; j--) {
adapter.swap(data, j, j - 1);
}
}
} | java | private static <T> void insertionSort(T data, Adapter<T> adapter, int start, int end) {
for(int i = start + 1; i < end; i++) {
for(int j = i; j > start && adapter.compare(data, j - 1, j) > 0; j--) {
adapter.swap(data, j, j - 1);
}
}
} | [
"private",
"static",
"<",
"T",
">",
"void",
"insertionSort",
"(",
"T",
"data",
",",
"Adapter",
"<",
"T",
">",
"adapter",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"start",
"+",
"1",
";",
"i",
"<",
"end",
";"... | Sort a small array using repetitive insertion sort.
@param data Data to sort
@param start Interval start
@param end Interval end | [
"Sort",
"a",
"small",
"array",
"using",
"repetitive",
"insertion",
"sort",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/QuickSelect.java#L196-L202 |
deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/conf/Configuration.java | Configuration.setPattern | public void setPattern(String name, Pattern pattern) {
if (null == pattern) {
set(name, null);
} else {
set(name, pattern.pattern());
}
} | java | public void setPattern(String name, Pattern pattern) {
if (null == pattern) {
set(name, null);
} else {
set(name, pattern.pattern());
}
} | [
"public",
"void",
"setPattern",
"(",
"String",
"name",
",",
"Pattern",
"pattern",
")",
"{",
"if",
"(",
"null",
"==",
"pattern",
")",
"{",
"set",
"(",
"name",
",",
"null",
")",
";",
"}",
"else",
"{",
"set",
"(",
"name",
",",
"pattern",
".",
"pattern... | Set the given property to <code>Pattern</code>.
If the pattern is passed as null, sets the empty pattern which results in
further calls to getPattern(...) returning the default value.
@param name property name
@param pattern new value | [
"Set",
"the",
"given",
"property",
"to",
"<code",
">",
"Pattern<",
"/",
"code",
">",
".",
"If",
"the",
"pattern",
"is",
"passed",
"as",
"null",
"sets",
"the",
"empty",
"pattern",
"which",
"results",
"in",
"further",
"calls",
"to",
"getPattern",
"(",
"...... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/conf/Configuration.java#L649-L655 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getCharacterSAB | public void getCharacterSAB(String API, String name, Callback<CharacterSAB> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name));
gw2API.getCharacterSAB(name, API).enqueue(callback);
} | java | public void getCharacterSAB(String API, String name, Callback<CharacterSAB> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name));
gw2API.getCharacterSAB(name, API).enqueue(callback);
} | [
"public",
"void",
"getCharacterSAB",
"(",
"String",
"API",
",",
"String",
"name",
",",
"Callback",
"<",
"CharacterSAB",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"Param... | For more info on Character SAB API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters#Super_Adventure_Box_.28sab.29">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param API API key
@param name character name
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception invalid API key | empty character name
@throws NullPointerException if given {@link Callback} is empty
@see CharacterSAB character SAB info | [
"For",
"more",
"info",
"on",
"Character",
"SAB",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"characters#Super_Adventure_Box_",
".",
"28sab",
".",
"29",
">",
"here<"... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L813-L816 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java | Gen.genStat | public void genStat(JCTree tree, Env<GenContext> env, int crtFlags) {
if (!genCrt) {
genStat(tree, env);
return;
}
int startpc = code.curCP();
genStat(tree, env);
if (tree.hasTag(Tag.BLOCK)) crtFlags |= CRT_BLOCK;
code.crt.put(tree, crtFlags, startpc, code.curCP());
} | java | public void genStat(JCTree tree, Env<GenContext> env, int crtFlags) {
if (!genCrt) {
genStat(tree, env);
return;
}
int startpc = code.curCP();
genStat(tree, env);
if (tree.hasTag(Tag.BLOCK)) crtFlags |= CRT_BLOCK;
code.crt.put(tree, crtFlags, startpc, code.curCP());
} | [
"public",
"void",
"genStat",
"(",
"JCTree",
"tree",
",",
"Env",
"<",
"GenContext",
">",
"env",
",",
"int",
"crtFlags",
")",
"{",
"if",
"(",
"!",
"genCrt",
")",
"{",
"genStat",
"(",
"tree",
",",
"env",
")",
";",
"return",
";",
"}",
"int",
"startpc",... | Derived visitor method: check whether CharacterRangeTable
should be emitted, if so, put a new entry into CRTable
and call method to generate bytecode.
If not, just call method to generate bytecode.
@see #genStat(JCTree, Env)
@param tree The tree to be visited.
@param env The environment to use.
@param crtFlags The CharacterRangeTable flags
indicating type of the entry. | [
"Derived",
"visitor",
"method",
":",
"check",
"whether",
"CharacterRangeTable",
"should",
"be",
"emitted",
"if",
"so",
"put",
"a",
"new",
"entry",
"into",
"CRTable",
"and",
"call",
"method",
"to",
"generate",
"bytecode",
".",
"If",
"not",
"just",
"call",
"me... | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L612-L621 |
kwon37xi/hibernate4-memcached | hibernate4-memcached-spymemcached-adapter/src/main/java/kr/pe/kwonnam/hibernate4memcached/spymemcached/SpyMemcachedAdapter.java | SpyMemcachedAdapter.getNamespacedKey | String getNamespacedKey(CacheNamespace cacheNamespace, String key) {
String namespaceIndicator = getNamespaceIndicator(cacheNamespace);
if (cacheNamespace.isNamespaceExpirationRequired() == false) {
return namespaceIndicator + ":" + key;
}
String namespaceIndicatorKey = namespaceIndicator + NAMESPACE_NAME_SQUENCE_SEPARATOR;
long namespaceSquence = memcachedClient.incr(namespaceIndicatorKey, 0L, System.currentTimeMillis(),
DEFAULT_NAMESPACE_SEQUENCE_EXPIRY_SECONDS);
return namespaceIndicatorKey + namespaceSquence + ":" + key;
} | java | String getNamespacedKey(CacheNamespace cacheNamespace, String key) {
String namespaceIndicator = getNamespaceIndicator(cacheNamespace);
if (cacheNamespace.isNamespaceExpirationRequired() == false) {
return namespaceIndicator + ":" + key;
}
String namespaceIndicatorKey = namespaceIndicator + NAMESPACE_NAME_SQUENCE_SEPARATOR;
long namespaceSquence = memcachedClient.incr(namespaceIndicatorKey, 0L, System.currentTimeMillis(),
DEFAULT_NAMESPACE_SEQUENCE_EXPIRY_SECONDS);
return namespaceIndicatorKey + namespaceSquence + ":" + key;
} | [
"String",
"getNamespacedKey",
"(",
"CacheNamespace",
"cacheNamespace",
",",
"String",
"key",
")",
"{",
"String",
"namespaceIndicator",
"=",
"getNamespaceIndicator",
"(",
"cacheNamespace",
")",
";",
"if",
"(",
"cacheNamespace",
".",
"isNamespaceExpirationRequired",
"(",
... | Return cache namespace decorated key.
@param cacheNamespace cache namespace
@param key cache key
@return namespace infomation prefixed cache key | [
"Return",
"cache",
"namespace",
"decorated",
"key",
"."
] | train | https://github.com/kwon37xi/hibernate4-memcached/blob/e0b2839ab257b2602344f54ca53c564044f3585d/hibernate4-memcached-spymemcached-adapter/src/main/java/kr/pe/kwonnam/hibernate4memcached/spymemcached/SpyMemcachedAdapter.java#L133-L145 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/internal/RandomAccessListIterate.java | RandomAccessListIterate.forEachInBoth | public static <T1, T2> void forEachInBoth(List<T1> list1, List<T2> list2, Procedure2<? super T1, ? super T2> procedure)
{
if (list1 != null && list2 != null)
{
int size1 = list1.size();
int size2 = list2.size();
if (size1 == size2)
{
for (int i = 0; i < size1; i++)
{
procedure.value(list1.get(i), list2.get(i));
}
}
else
{
throw new IllegalArgumentException("Attempt to call forEachInBoth with two Lists of different sizes :"
+ size1
+ ':'
+ size2);
}
}
} | java | public static <T1, T2> void forEachInBoth(List<T1> list1, List<T2> list2, Procedure2<? super T1, ? super T2> procedure)
{
if (list1 != null && list2 != null)
{
int size1 = list1.size();
int size2 = list2.size();
if (size1 == size2)
{
for (int i = 0; i < size1; i++)
{
procedure.value(list1.get(i), list2.get(i));
}
}
else
{
throw new IllegalArgumentException("Attempt to call forEachInBoth with two Lists of different sizes :"
+ size1
+ ':'
+ size2);
}
}
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"void",
"forEachInBoth",
"(",
"List",
"<",
"T1",
">",
"list1",
",",
"List",
"<",
"T2",
">",
"list2",
",",
"Procedure2",
"<",
"?",
"super",
"T1",
",",
"?",
"super",
"T2",
">",
"procedure",
")",
"{",
"... | For each element in both of the Lists, operation is evaluated with both elements as parameters. | [
"For",
"each",
"element",
"in",
"both",
"of",
"the",
"Lists",
"operation",
"is",
"evaluated",
"with",
"both",
"elements",
"as",
"parameters",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/internal/RandomAccessListIterate.java#L690-L711 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/PropertiesBuilder.java | PropertiesBuilder.fromXml | public static PropertiesBuilder fromXml(InputStream inputStream) {
try {
Properties defaults = new Properties();
defaults.loadFromXML(inputStream);
return from(defaults);
}
catch (IOException cause) {
throw new SystemException(String.format("Failed to load properties from input stream [%s]", inputStream), cause);
}
} | java | public static PropertiesBuilder fromXml(InputStream inputStream) {
try {
Properties defaults = new Properties();
defaults.loadFromXML(inputStream);
return from(defaults);
}
catch (IOException cause) {
throw new SystemException(String.format("Failed to load properties from input stream [%s]", inputStream), cause);
}
} | [
"public",
"static",
"PropertiesBuilder",
"fromXml",
"(",
"InputStream",
"inputStream",
")",
"{",
"try",
"{",
"Properties",
"defaults",
"=",
"new",
"Properties",
"(",
")",
";",
"defaults",
".",
"loadFromXML",
"(",
"inputStream",
")",
";",
"return",
"from",
"(",... | Factory method to load {@link Properties} from the given XML {@link InputStream}.
@param inputStream an XML input source containing the {@link Properties} to load.
@return an instance of the {@link PropertiesBuilder} class initialized with the properties
from the given XML input source.
@throws SystemException if the properties from the given XML {@link InputStream} could not be loaded.
@see java.util.Properties#loadFromXML(InputStream)
@see java.io.InputStream
@see #from(Properties) | [
"Factory",
"method",
"to",
"load",
"{",
"@link",
"Properties",
"}",
"from",
"the",
"given",
"XML",
"{",
"@link",
"InputStream",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/PropertiesBuilder.java#L181-L191 |
facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java | DancingLinks.addColumn | public void addColumn(ColumnName name, boolean primary) {
ColumnHeader<ColumnName> top = new ColumnHeader<ColumnName>(name, 0);
top.up = top;
top.down = top;
if (primary) {
Node<ColumnName> tail = head.left;
tail.right = top;
top.left = tail;
top.right = head;
head.left = top;
} else {
top.left = top;
top.right = top;
}
columns.add(top);
} | java | public void addColumn(ColumnName name, boolean primary) {
ColumnHeader<ColumnName> top = new ColumnHeader<ColumnName>(name, 0);
top.up = top;
top.down = top;
if (primary) {
Node<ColumnName> tail = head.left;
tail.right = top;
top.left = tail;
top.right = head;
head.left = top;
} else {
top.left = top;
top.right = top;
}
columns.add(top);
} | [
"public",
"void",
"addColumn",
"(",
"ColumnName",
"name",
",",
"boolean",
"primary",
")",
"{",
"ColumnHeader",
"<",
"ColumnName",
">",
"top",
"=",
"new",
"ColumnHeader",
"<",
"ColumnName",
">",
"(",
"name",
",",
"0",
")",
";",
"top",
".",
"up",
"=",
"t... | Add a column to the table
@param name The name of the column, which will be returned as part of
solutions
@param primary Is the column required for a solution? | [
"Add",
"a",
"column",
"to",
"the",
"table"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java#L114-L129 |
pmwmedia/tinylog | log4j1.2-api/src/main/java/org/apache/log4j/Category.java | Category.assertLog | public void assertLog(final boolean assertion, final String msg) {
if (!assertion && MINIMUM_LEVEL_COVERS_ERROR) {
provider.log(STACKTRACE_DEPTH, null, org.tinylog.Level.ERROR, null, msg, (Object[]) null);
}
} | java | public void assertLog(final boolean assertion, final String msg) {
if (!assertion && MINIMUM_LEVEL_COVERS_ERROR) {
provider.log(STACKTRACE_DEPTH, null, org.tinylog.Level.ERROR, null, msg, (Object[]) null);
}
} | [
"public",
"void",
"assertLog",
"(",
"final",
"boolean",
"assertion",
",",
"final",
"String",
"msg",
")",
"{",
"if",
"(",
"!",
"assertion",
"&&",
"MINIMUM_LEVEL_COVERS_ERROR",
")",
"{",
"provider",
".",
"log",
"(",
"STACKTRACE_DEPTH",
",",
"null",
",",
"org",... | If {@code assertion} parameter is {@code false}, then logs {@code msg} as an {@link #error(Object) error}
statement.
<p>
The {@code assert} method has been renamed to {@code assertLog} because {@code assert} is a language reserved
word in JDK 1.4.
</p>
@param assertion
{@code true} for dropping the passed message, {@code false} for outputting
@param msg
The message to print if {@code assertion} is false.
@since 1.2 | [
"If",
"{",
"@code",
"assertion",
"}",
"parameter",
"is",
"{",
"@code",
"false",
"}",
"then",
"logs",
"{",
"@code",
"msg",
"}",
"as",
"an",
"{",
"@link",
"#error",
"(",
"Object",
")",
"error",
"}",
"statement",
"."
] | train | https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/log4j1.2-api/src/main/java/org/apache/log4j/Category.java#L137-L141 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authentication.filter/src/com/ibm/ws/security/authentication/filter/internal/CommonFilter.java | CommonFilter.makeValue | private IValue makeValue(String value, boolean ipAddress) throws FilterException {
if (ipAddress)
return new ValueAddressRange(value);
return new ValueString(value);
} | java | private IValue makeValue(String value, boolean ipAddress) throws FilterException {
if (ipAddress)
return new ValueAddressRange(value);
return new ValueString(value);
} | [
"private",
"IValue",
"makeValue",
"(",
"String",
"value",
",",
"boolean",
"ipAddress",
")",
"throws",
"FilterException",
"{",
"if",
"(",
"ipAddress",
")",
"return",
"new",
"ValueAddressRange",
"(",
"value",
")",
";",
"return",
"new",
"ValueString",
"(",
"value... | Helper to make the value for the condition. It's either a IP address (ValueAddressRange) or a
string (ValueString).
@param value
@param ipAddress
@return
@throws FilterException | [
"Helper",
"to",
"make",
"the",
"value",
"for",
"the",
"condition",
".",
"It",
"s",
"either",
"a",
"IP",
"address",
"(",
"ValueAddressRange",
")",
"or",
"a",
"string",
"(",
"ValueString",
")",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.filter/src/com/ibm/ws/security/authentication/filter/internal/CommonFilter.java#L295-L299 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ssh/JschUtil.java | JschUtil.createSftp | public static Sftp createSftp(String sshHost, int sshPort, String sshUser, String sshPass) {
return new Sftp(sshHost, sshPort, sshUser, sshPass);
} | java | public static Sftp createSftp(String sshHost, int sshPort, String sshUser, String sshPass) {
return new Sftp(sshHost, sshPort, sshUser, sshPass);
} | [
"public",
"static",
"Sftp",
"createSftp",
"(",
"String",
"sshHost",
",",
"int",
"sshPort",
",",
"String",
"sshUser",
",",
"String",
"sshPass",
")",
"{",
"return",
"new",
"Sftp",
"(",
"sshHost",
",",
"sshPort",
",",
"sshUser",
",",
"sshPass",
")",
";",
"}... | 创建Sftp
@param sshHost 远程主机
@param sshPort 远程主机端口
@param sshUser 远程主机用户名
@param sshPass 远程主机密码
@return {@link Sftp}
@since 4.0.3 | [
"创建Sftp"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ssh/JschUtil.java#L184-L186 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java | CacheProviderWrapper.batchUpdate | @Override
public void batchUpdate(HashMap invalidateIdEvents, HashMap invalidateTemplateEvents, ArrayList pushEntryEvents) {
final String methodName = "batchUpdate()";
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it should not be called");
}
} | java | @Override
public void batchUpdate(HashMap invalidateIdEvents, HashMap invalidateTemplateEvents, ArrayList pushEntryEvents) {
final String methodName = "batchUpdate()";
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it should not be called");
}
} | [
"@",
"Override",
"public",
"void",
"batchUpdate",
"(",
"HashMap",
"invalidateIdEvents",
",",
"HashMap",
"invalidateTemplateEvents",
",",
"ArrayList",
"pushEntryEvents",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"batchUpdate()\"",
";",
"if",
"(",
"tc",
".",
... | This method is used only by default cache provider (cache.java). Do nothing. | [
"This",
"method",
"is",
"used",
"only",
"by",
"default",
"cache",
"provider",
"(",
"cache",
".",
"java",
")",
".",
"Do",
"nothing",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L1539-L1545 |
ontop/ontop | core/model/src/main/java/it/unibz/inf/ontop/substitution/impl/ImmutableUnificationTools.java | ImmutableUnificationTools.computeMGUS | public Optional<ImmutableSubstitution<ImmutableTerm>> computeMGUS(ImmutableSubstitution<? extends ImmutableTerm> substitution1,
ImmutableSubstitution<? extends ImmutableTerm> substitution2) {
ImmutableList.Builder<ImmutableTerm> firstArgListBuilder = ImmutableList.builder();
ImmutableList.Builder<ImmutableTerm> secondArgListBuilder = ImmutableList.builder();
for (Map.Entry<Variable, ? extends ImmutableTerm> entry : substitution1.getImmutableMap().entrySet()) {
firstArgListBuilder.add(entry.getKey());
secondArgListBuilder.add(entry.getValue());
}
for (Map.Entry<Variable, ? extends ImmutableTerm> entry : substitution2.getImmutableMap().entrySet()) {
firstArgListBuilder.add(entry.getKey());
secondArgListBuilder.add(entry.getValue());
}
ImmutableList<ImmutableTerm> firstArgList = firstArgListBuilder.build();
ImmutableList<ImmutableTerm> secondArgList = secondArgListBuilder.build();
return computeMGU(firstArgList, secondArgList);
} | java | public Optional<ImmutableSubstitution<ImmutableTerm>> computeMGUS(ImmutableSubstitution<? extends ImmutableTerm> substitution1,
ImmutableSubstitution<? extends ImmutableTerm> substitution2) {
ImmutableList.Builder<ImmutableTerm> firstArgListBuilder = ImmutableList.builder();
ImmutableList.Builder<ImmutableTerm> secondArgListBuilder = ImmutableList.builder();
for (Map.Entry<Variable, ? extends ImmutableTerm> entry : substitution1.getImmutableMap().entrySet()) {
firstArgListBuilder.add(entry.getKey());
secondArgListBuilder.add(entry.getValue());
}
for (Map.Entry<Variable, ? extends ImmutableTerm> entry : substitution2.getImmutableMap().entrySet()) {
firstArgListBuilder.add(entry.getKey());
secondArgListBuilder.add(entry.getValue());
}
ImmutableList<ImmutableTerm> firstArgList = firstArgListBuilder.build();
ImmutableList<ImmutableTerm> secondArgList = secondArgListBuilder.build();
return computeMGU(firstArgList, secondArgList);
} | [
"public",
"Optional",
"<",
"ImmutableSubstitution",
"<",
"ImmutableTerm",
">",
">",
"computeMGUS",
"(",
"ImmutableSubstitution",
"<",
"?",
"extends",
"ImmutableTerm",
">",
"substitution1",
",",
"ImmutableSubstitution",
"<",
"?",
"extends",
"ImmutableTerm",
">",
"subst... | Computes one Most General Unifier (MGU) of (two) substitutions. | [
"Computes",
"one",
"Most",
"General",
"Unifier",
"(",
"MGU",
")",
"of",
"(",
"two",
")",
"substitutions",
"."
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/core/model/src/main/java/it/unibz/inf/ontop/substitution/impl/ImmutableUnificationTools.java#L208-L228 |
VoltDB/voltdb | third_party/java/src/org/apache/commons_voltpatches/cli/Option.java | Option.processValue | private void processValue(String value)
{
// this Option has a separator character
if (hasValueSeparator())
{
// get the separator character
char sep = getValueSeparator();
// store the index for the value separator
int index = value.indexOf(sep);
// while there are more value separators
while (index != -1)
{
// next value to be added
if (values.size() == numberOfArgs - 1)
{
break;
}
// store
add(value.substring(0, index));
// parse
value = value.substring(index + 1);
// get new index
index = value.indexOf(sep);
}
}
// store the actual value or the last value that has been parsed
add(value);
} | java | private void processValue(String value)
{
// this Option has a separator character
if (hasValueSeparator())
{
// get the separator character
char sep = getValueSeparator();
// store the index for the value separator
int index = value.indexOf(sep);
// while there are more value separators
while (index != -1)
{
// next value to be added
if (values.size() == numberOfArgs - 1)
{
break;
}
// store
add(value.substring(0, index));
// parse
value = value.substring(index + 1);
// get new index
index = value.indexOf(sep);
}
}
// store the actual value or the last value that has been parsed
add(value);
} | [
"private",
"void",
"processValue",
"(",
"String",
"value",
")",
"{",
"// this Option has a separator character",
"if",
"(",
"hasValueSeparator",
"(",
")",
")",
"{",
"// get the separator character",
"char",
"sep",
"=",
"getValueSeparator",
"(",
")",
";",
"// store the... | Processes the value. If this Option has a value separator
the value will have to be parsed into individual tokens. When
n-1 tokens have been processed and there are more value separators
in the value, parsing is ceased and the remaining characters are
added as a single token.
@param value The String to be processed.
@since 1.0.1 | [
"Processes",
"the",
"value",
".",
"If",
"this",
"Option",
"has",
"a",
"value",
"separator",
"the",
"value",
"will",
"have",
"to",
"be",
"parsed",
"into",
"individual",
"tokens",
".",
"When",
"n",
"-",
"1",
"tokens",
"have",
"been",
"processed",
"and",
"t... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/Option.java#L451-L484 |
Impetus/Kundera | src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESClient.java | ESClient.addRelations | private void addRelations(List<RelationHolder> rlHolders, Map<String, Object> values)
{
if (rlHolders != null)
{
for (RelationHolder relation : rlHolders)
{
values.put(relation.getRelationName(), relation.getRelationValue());
}
}
} | java | private void addRelations(List<RelationHolder> rlHolders, Map<String, Object> values)
{
if (rlHolders != null)
{
for (RelationHolder relation : rlHolders)
{
values.put(relation.getRelationName(), relation.getRelationValue());
}
}
} | [
"private",
"void",
"addRelations",
"(",
"List",
"<",
"RelationHolder",
">",
"rlHolders",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"values",
")",
"{",
"if",
"(",
"rlHolders",
"!=",
"null",
")",
"{",
"for",
"(",
"RelationHolder",
"relation",
":",
"rl... | Adds the relations.
@param rlHolders
the rl holders
@param values
the values | [
"Adds",
"the",
"relations",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESClient.java#L214-L223 |
mailin-api/sendinblue-java-mvn | src/main/java/com/sendinblue/Sendinblue.java | Sendinblue.delete_user | public String delete_user(Map<String, String> data) {
String id = data.get("email");
return delete("user/" + id, EMPTY_STRING);
} | java | public String delete_user(Map<String, String> data) {
String id = data.get("email");
return delete("user/" + id, EMPTY_STRING);
} | [
"public",
"String",
"delete_user",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"data",
")",
"{",
"String",
"id",
"=",
"data",
".",
"get",
"(",
"\"email\"",
")",
";",
"return",
"delete",
"(",
"\"user/\"",
"+",
"id",
",",
"EMPTY_STRING",
")",
";",
"... | /*
Unlink existing user from all lists.
@param {Object} data contains json objects as a key value pair from HashMap.
@options data {String} email: Email address of the already existing user in the SendinBlue contacts to be unlinked from all lists [Mandatory] | [
"/",
"*",
"Unlink",
"existing",
"user",
"from",
"all",
"lists",
"."
] | train | https://github.com/mailin-api/sendinblue-java-mvn/blob/3a186b004003450f18d619aa084adc8d75086183/src/main/java/com/sendinblue/Sendinblue.java#L806-L809 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.order_orderId_availableRegisteredPaymentMean_GET | public ArrayList<OvhRegisteredPaymentMean> order_orderId_availableRegisteredPaymentMean_GET(Long orderId) throws IOException {
String qPath = "/me/order/{orderId}/availableRegisteredPaymentMean";
StringBuilder sb = path(qPath, orderId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t6);
} | java | public ArrayList<OvhRegisteredPaymentMean> order_orderId_availableRegisteredPaymentMean_GET(Long orderId) throws IOException {
String qPath = "/me/order/{orderId}/availableRegisteredPaymentMean";
StringBuilder sb = path(qPath, orderId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t6);
} | [
"public",
"ArrayList",
"<",
"OvhRegisteredPaymentMean",
">",
"order_orderId_availableRegisteredPaymentMean_GET",
"(",
"Long",
"orderId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/order/{orderId}/availableRegisteredPaymentMean\"",
";",
"StringBuilder",
"s... | List of registered payment mean you can use to pay this order
REST: GET /me/order/{orderId}/availableRegisteredPaymentMean
@param orderId [required] | [
"List",
"of",
"registered",
"payment",
"mean",
"you",
"can",
"use",
"to",
"pay",
"this",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2054-L2059 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java | AttributeDefinition.resolveValue | public ModelNode resolveValue(final OperationContext context, final ModelNode value) throws OperationFailedException {
return resolveValue(new ExpressionResolver() {
@Override
public ModelNode resolveExpressions(ModelNode node) throws OperationFailedException {
return context.resolveExpressions(node);
}
}, value);
} | java | public ModelNode resolveValue(final OperationContext context, final ModelNode value) throws OperationFailedException {
return resolveValue(new ExpressionResolver() {
@Override
public ModelNode resolveExpressions(ModelNode node) throws OperationFailedException {
return context.resolveExpressions(node);
}
}, value);
} | [
"public",
"ModelNode",
"resolveValue",
"(",
"final",
"OperationContext",
"context",
",",
"final",
"ModelNode",
"value",
")",
"throws",
"OperationFailedException",
"{",
"return",
"resolveValue",
"(",
"new",
"ExpressionResolver",
"(",
")",
"{",
"@",
"Override",
"publi... | Takes the given {@code value}, resolves it using the given {@code context}
and validates it using this attribute's {@link #getValidator() validator}. If the value is
undefined and a {@link #getDefaultValue() default value} is available, the default value is used.
@param context the context to use to {@link OperationContext#resolveExpressions(org.jboss.dmr.ModelNode) resolve} the value
@param value a node that is expected to be a valid value for an attribute defined by this definition
@return the resolved value, possibly the default value if {@code value} is not defined
@throws OperationFailedException if the value is not valid | [
"Takes",
"the",
"given",
"{",
"@code",
"value",
"}",
"resolves",
"it",
"using",
"the",
"given",
"{",
"@code",
"context",
"}",
"and",
"validates",
"it",
"using",
"this",
"attribute",
"s",
"{",
"@link",
"#getValidator",
"()",
"validator",
"}",
".",
"If",
"... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java#L641-L648 |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kraken/table/WatchTable.java | WatchTable.onPut | @Override
public void onPut(byte[] key, TypePut type)
{
//_watchKey.init(key);
WatchKey watchKey = new WatchKey(key);
switch (type) {
case LOCAL:
ArrayList<WatchEntry> listLocal = _entryMapLocal.get(watchKey);
onPut(listLocal, key);
break;
case REMOTE:
{
int hash = _table.getPodHash(key);
TablePodNodeAmp node = _table.getTablePod().getNode(hash);
if (node.isSelfCopy()) {
// copies are responsible for their own local watch events
onPut(key, TypePut.LOCAL);
}
if (node.isSelfOwner()) {
// only the owner sends remote watch events
/*
System.out.println("NSO: " + BartenderSystem.getCurrentSelfServer().getDisplayName()
+ " " + node.isSelfOwner() + " " + node + " " + Hex.toHex(key));
*/
ArrayList<WatchEntry> listRemote = _entryMapRemote.get(watchKey);
onPut(listRemote, key);
}
break;
}
default:
throw new IllegalArgumentException(String.valueOf(type));
}
} | java | @Override
public void onPut(byte[] key, TypePut type)
{
//_watchKey.init(key);
WatchKey watchKey = new WatchKey(key);
switch (type) {
case LOCAL:
ArrayList<WatchEntry> listLocal = _entryMapLocal.get(watchKey);
onPut(listLocal, key);
break;
case REMOTE:
{
int hash = _table.getPodHash(key);
TablePodNodeAmp node = _table.getTablePod().getNode(hash);
if (node.isSelfCopy()) {
// copies are responsible for their own local watch events
onPut(key, TypePut.LOCAL);
}
if (node.isSelfOwner()) {
// only the owner sends remote watch events
/*
System.out.println("NSO: " + BartenderSystem.getCurrentSelfServer().getDisplayName()
+ " " + node.isSelfOwner() + " " + node + " " + Hex.toHex(key));
*/
ArrayList<WatchEntry> listRemote = _entryMapRemote.get(watchKey);
onPut(listRemote, key);
}
break;
}
default:
throw new IllegalArgumentException(String.valueOf(type));
}
} | [
"@",
"Override",
"public",
"void",
"onPut",
"(",
"byte",
"[",
"]",
"key",
",",
"TypePut",
"type",
")",
"{",
"//_watchKey.init(key);",
"WatchKey",
"watchKey",
"=",
"new",
"WatchKey",
"(",
"key",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"LOCAL",
... | Notification on a table put.
@param key the key of the updated row
@param type the notification type (local/remote) | [
"Notification",
"on",
"a",
"table",
"put",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kraken/table/WatchTable.java#L151-L188 |
google/truth | extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java | IterableOfProtosSubject.ignoringFieldScope | public IterableOfProtosFluentAssertion<M> ignoringFieldScope(FieldScope fieldScope) {
return usingConfig(config.ignoringFieldScope(checkNotNull(fieldScope, "fieldScope")));
} | java | public IterableOfProtosFluentAssertion<M> ignoringFieldScope(FieldScope fieldScope) {
return usingConfig(config.ignoringFieldScope(checkNotNull(fieldScope, "fieldScope")));
} | [
"public",
"IterableOfProtosFluentAssertion",
"<",
"M",
">",
"ignoringFieldScope",
"(",
"FieldScope",
"fieldScope",
")",
"{",
"return",
"usingConfig",
"(",
"config",
".",
"ignoringFieldScope",
"(",
"checkNotNull",
"(",
"fieldScope",
",",
"\"fieldScope\"",
")",
")",
"... | Excludes all specific field paths under the argument {@link FieldScope} from the comparison.
<p>This method is additive and has well-defined ordering semantics. If the invoking {@link
ProtoFluentAssertion} is already scoped to a {@link FieldScope} {@code X}, and this method is
invoked with {@link FieldScope} {@code Y}, the resultant {@link ProtoFluentAssertion} is
constrained to the subtraction of {@code X - Y}.
<p>By default, {@link ProtoFluentAssertion} is constrained to {@link FieldScopes#all()}, that
is, no fields are excluded from comparison. | [
"Excludes",
"all",
"specific",
"field",
"paths",
"under",
"the",
"argument",
"{",
"@link",
"FieldScope",
"}",
"from",
"the",
"comparison",
"."
] | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java#L953-L955 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/tools/nio/NIOTool.java | NIOTool.getLastModifiedTime | public FileTime getLastModifiedTime(Path path, LinkOption... options)
{
try {
return Files.getLastModifiedTime(path, options);
} catch (IOException e) {
return null;
}
} | java | public FileTime getLastModifiedTime(Path path, LinkOption... options)
{
try {
return Files.getLastModifiedTime(path, options);
} catch (IOException e) {
return null;
}
} | [
"public",
"FileTime",
"getLastModifiedTime",
"(",
"Path",
"path",
",",
"LinkOption",
"...",
"options",
")",
"{",
"try",
"{",
"return",
"Files",
".",
"getLastModifiedTime",
"(",
"path",
",",
"options",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"... | See {@link Files#getLastModifiedTime(Path, LinkOption...)}.
@param path See {@link Files#getLastModifiedTime(Path, LinkOption...)}
@param options See {@link Files#getLastModifiedTime(Path, LinkOption...)}
@return See {@link Files#getLastModifiedTime(Path, LinkOption...)} | [
"See",
"{",
"@link",
"Files#getLastModifiedTime",
"(",
"Path",
"LinkOption",
"...",
")",
"}",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/tools/nio/NIOTool.java#L262-L269 |
app55/app55-java | src/support/java/com/googlecode/openbeans/beancontext/BeanContextSupport.java | BeanContextSupport.classEquals | protected static final boolean classEquals(Class clz1, Class clz2)
{
if (clz1 == null || clz2 == null)
{
throw new NullPointerException();
}
return clz1 == clz2 || clz1.getName().equals(clz2.getName());
} | java | protected static final boolean classEquals(Class clz1, Class clz2)
{
if (clz1 == null || clz2 == null)
{
throw new NullPointerException();
}
return clz1 == clz2 || clz1.getName().equals(clz2.getName());
} | [
"protected",
"static",
"final",
"boolean",
"classEquals",
"(",
"Class",
"clz1",
",",
"Class",
"clz2",
")",
"{",
"if",
"(",
"clz1",
"==",
"null",
"||",
"clz2",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"return",
... | Compares if two classes are equal or their class names are equal.
@param clz1
a class
@param clz2
another class
@return true if two class objects are equal or their class names are equal. | [
"Compares",
"if",
"two",
"classes",
"are",
"equal",
"or",
"their",
"class",
"names",
"are",
"equal",
"."
] | train | https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/beancontext/BeanContextSupport.java#L476-L483 |
dita-ot/dita-ot | src/main/java/org/dita/dost/module/DebugAndFilterModule.java | DebugAndFilterModule.generateScheme | private void generateScheme(final File filename, final Document root) throws DITAOTException {
final File p = filename.getParentFile();
if (!p.exists() && !p.mkdirs()) {
throw new DITAOTException("Failed to make directory " + p.getAbsolutePath());
}
Result res = null;
try {
res = new StreamResult(new FileOutputStream(filename));
final DOMSource ds = new DOMSource(root);
final TransformerFactory tff = TransformerFactory.newInstance();
final Transformer tf = tff.newTransformer();
tf.transform(ds, res);
} catch (final RuntimeException e) {
throw e;
} catch (final Exception e) {
logger.error(e.getMessage(), e) ;
throw new DITAOTException(e);
} finally {
try {
close(res);
} catch (IOException e) {
throw new DITAOTException(e);
}
}
} | java | private void generateScheme(final File filename, final Document root) throws DITAOTException {
final File p = filename.getParentFile();
if (!p.exists() && !p.mkdirs()) {
throw new DITAOTException("Failed to make directory " + p.getAbsolutePath());
}
Result res = null;
try {
res = new StreamResult(new FileOutputStream(filename));
final DOMSource ds = new DOMSource(root);
final TransformerFactory tff = TransformerFactory.newInstance();
final Transformer tf = tff.newTransformer();
tf.transform(ds, res);
} catch (final RuntimeException e) {
throw e;
} catch (final Exception e) {
logger.error(e.getMessage(), e) ;
throw new DITAOTException(e);
} finally {
try {
close(res);
} catch (IOException e) {
throw new DITAOTException(e);
}
}
} | [
"private",
"void",
"generateScheme",
"(",
"final",
"File",
"filename",
",",
"final",
"Document",
"root",
")",
"throws",
"DITAOTException",
"{",
"final",
"File",
"p",
"=",
"filename",
".",
"getParentFile",
"(",
")",
";",
"if",
"(",
"!",
"p",
".",
"exists",
... | Serialize subject scheme file.
@param filename output filepath
@param root subject scheme document
@throws DITAOTException if generation fails | [
"Serialize",
"subject",
"scheme",
"file",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/DebugAndFilterModule.java#L477-L501 |
eurekaclinical/eurekaclinical-common | src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java | EurekaClinicalClient.doPostMultipart | protected void doPostMultipart(String path, InputStream inputStream) throws ClientException {
doPostMultipart(path, inputStream, null);
} | java | protected void doPostMultipart(String path, InputStream inputStream) throws ClientException {
doPostMultipart(path, inputStream, null);
} | [
"protected",
"void",
"doPostMultipart",
"(",
"String",
"path",
",",
"InputStream",
"inputStream",
")",
"throws",
"ClientException",
"{",
"doPostMultipart",
"(",
"path",
",",
"inputStream",
",",
"null",
")",
";",
"}"
] | Submits a multi-part form in an input stream. Adds appropriate Accepts
and Content Type headers.
@param path the the API to call.
@param inputStream the multi-part form content.
@throws ClientException if a status code other than 200 (OK) and 204 (No
Content) is returned. | [
"Submits",
"a",
"multi",
"-",
"part",
"form",
"in",
"an",
"input",
"stream",
".",
"Adds",
"appropriate",
"Accepts",
"and",
"Content",
"Type",
"headers",
"."
] | train | https://github.com/eurekaclinical/eurekaclinical-common/blob/1867102ff43fe94e519f76a074d5f5923e9be61c/src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java#L693-L695 |
threerings/narya | core/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java | PresentsDObjectMgr.registerProxyObject | public void registerProxyObject (DObject object, DObjectManager omgr)
{
int origObjectId = object.getOid();
// register the object locally which will reassign its oid and set us as its manager
registerObject(object);
// and note a proxy reference for the object which we'll use to forward events back to its
// originating manager after converting them back to the original oid
_proxies.put(object.getOid(), new ProxyReference(origObjectId, omgr));
} | java | public void registerProxyObject (DObject object, DObjectManager omgr)
{
int origObjectId = object.getOid();
// register the object locally which will reassign its oid and set us as its manager
registerObject(object);
// and note a proxy reference for the object which we'll use to forward events back to its
// originating manager after converting them back to the original oid
_proxies.put(object.getOid(), new ProxyReference(origObjectId, omgr));
} | [
"public",
"void",
"registerProxyObject",
"(",
"DObject",
"object",
",",
"DObjectManager",
"omgr",
")",
"{",
"int",
"origObjectId",
"=",
"object",
".",
"getOid",
"(",
")",
";",
"// register the object locally which will reassign its oid and set us as its manager",
"registerO... | Registers an object managed by another distributed object manager (probably on another
server). The local server will assign the object a proxy oid, and any events that come in on
this object will be rewritten from their proxy oid to their original id before forwarding on
to the originating object manager. | [
"Registers",
"an",
"object",
"managed",
"by",
"another",
"distributed",
"object",
"manager",
"(",
"probably",
"on",
"another",
"server",
")",
".",
"The",
"local",
"server",
"will",
"assign",
"the",
"object",
"a",
"proxy",
"oid",
"and",
"any",
"events",
"that... | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java#L171-L179 |
ksoichiro/Android-ObservableScrollView | library/src/main/java/com/github/ksoichiro/android/observablescrollview/ScrollUtils.java | ScrollUtils.getColorWithAlpha | public static int getColorWithAlpha(float alpha, int baseColor) {
int a = Math.min(255, Math.max(0, (int) (alpha * 255))) << 24;
int rgb = 0x00ffffff & baseColor;
return a + rgb;
} | java | public static int getColorWithAlpha(float alpha, int baseColor) {
int a = Math.min(255, Math.max(0, (int) (alpha * 255))) << 24;
int rgb = 0x00ffffff & baseColor;
return a + rgb;
} | [
"public",
"static",
"int",
"getColorWithAlpha",
"(",
"float",
"alpha",
",",
"int",
"baseColor",
")",
"{",
"int",
"a",
"=",
"Math",
".",
"min",
"(",
"255",
",",
"Math",
".",
"max",
"(",
"0",
",",
"(",
"int",
")",
"(",
"alpha",
"*",
"255",
")",
")"... | Create a color integer value with specified alpha.
<p>This may be useful to change alpha value of background color.</p>
@param alpha Alpha value from 0.0f to 1.0f.
@param baseColor Base color. alpha value will be ignored.
@return A color with alpha made from base color. | [
"Create",
"a",
"color",
"integer",
"value",
"with",
"specified",
"alpha",
".",
"<p",
">",
"This",
"may",
"be",
"useful",
"to",
"change",
"alpha",
"value",
"of",
"background",
"color",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ksoichiro/Android-ObservableScrollView/blob/47a5fb2db5e93d923a8c6772cde48bbb7d932345/library/src/main/java/com/github/ksoichiro/android/observablescrollview/ScrollUtils.java#L53-L57 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/client/ClientResolver.java | ClientResolver.getClientFactory | public static ClientFactory getClientFactory(String persistenceUnit, Map<String, Object> puProperties,final KunderaMetadata kunderaMetadata)
{
ClientFactory clientFactory = instantiateClientFactory(persistenceUnit, puProperties, kunderaMetadata);
clientFactories.put(persistenceUnit, clientFactory);
return clientFactory;
} | java | public static ClientFactory getClientFactory(String persistenceUnit, Map<String, Object> puProperties,final KunderaMetadata kunderaMetadata)
{
ClientFactory clientFactory = instantiateClientFactory(persistenceUnit, puProperties, kunderaMetadata);
clientFactories.put(persistenceUnit, clientFactory);
return clientFactory;
} | [
"public",
"static",
"ClientFactory",
"getClientFactory",
"(",
"String",
"persistenceUnit",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"puProperties",
",",
"final",
"KunderaMetadata",
"kunderaMetadata",
")",
"{",
"ClientFactory",
"clientFactory",
"=",
"instantiateC... | Gets the client factory.
@param persistenceUnit
the persistence unit
@return the client factory | [
"Gets",
"the",
"client",
"factory",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/client/ClientResolver.java#L54-L59 |
code4everything/util | src/main/java/com/zhazhapan/config/JsonParser.java | JsonParser.arrayAdd | public void arrayAdd(String path, Object... values) {
jsonStore.clear();
JSONPath.arrayAdd(jsonObject, checkPath(path), values);
} | java | public void arrayAdd(String path, Object... values) {
jsonStore.clear();
JSONPath.arrayAdd(jsonObject, checkPath(path), values);
} | [
"public",
"void",
"arrayAdd",
"(",
"String",
"path",
",",
"Object",
"...",
"values",
")",
"{",
"jsonStore",
".",
"clear",
"(",
")",
";",
"JSONPath",
".",
"arrayAdd",
"(",
"jsonObject",
",",
"checkPath",
"(",
"path",
")",
",",
"values",
")",
";",
"}"
] | 数组追加数组
@param path <a href= "https://github.com/alibaba/fastjson/wiki/JSONPath">路径语法</a>
@param values 数组 | [
"数组追加数组"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/config/JsonParser.java#L180-L183 |
whitesource/agents | wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java | ZipUtils.writeChunkBytes | private static void writeChunkBytes(String text, File tempFileIn) throws IOException {
try (FileOutputStream writer = new FileOutputStream(tempFileIn)) {
int chunk = text.length();
if (text.length() > STRING_MAX_SIZE) {
chunk = text.length() / STRING_MAX_SIZE;
}
int startString = 0;
while (startString < text.length()) {
int endString = startString + chunk;
if (endString > text.length()) {
endString = text.length();
}
byte[] bytes = text.substring(startString, endString).getBytes(StandardCharsets.UTF_8);
writer.write(bytes);
startString = endString;
}
}
} | java | private static void writeChunkBytes(String text, File tempFileIn) throws IOException {
try (FileOutputStream writer = new FileOutputStream(tempFileIn)) {
int chunk = text.length();
if (text.length() > STRING_MAX_SIZE) {
chunk = text.length() / STRING_MAX_SIZE;
}
int startString = 0;
while (startString < text.length()) {
int endString = startString + chunk;
if (endString > text.length()) {
endString = text.length();
}
byte[] bytes = text.substring(startString, endString).getBytes(StandardCharsets.UTF_8);
writer.write(bytes);
startString = endString;
}
}
} | [
"private",
"static",
"void",
"writeChunkBytes",
"(",
"String",
"text",
",",
"File",
"tempFileIn",
")",
"throws",
"IOException",
"{",
"try",
"(",
"FileOutputStream",
"writer",
"=",
"new",
"FileOutputStream",
"(",
"tempFileIn",
")",
")",
"{",
"int",
"chunk",
"="... | Writes a string piece by piece to file
@param text to input
@param tempFileIn input
@throws IOException exception when writing | [
"Writes",
"a",
"string",
"piece",
"by",
"piece",
"to",
"file"
] | train | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java#L477-L495 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hllmap/HllMap.java | HllMap.findEmpty | private static final int findEmpty(final byte[] key, final int tableEntries, final byte[] stateArr) {
final long[] hash = MurmurHash3.hash(key, SEED);
int entryIndex = getIndex(hash[0], tableEntries);
final int stride = getStride(hash[1], tableEntries);
final int loopIndex = entryIndex;
do {
if (isBitClear(stateArr, entryIndex)) { //check if slot is empty
return entryIndex;
}
entryIndex = (entryIndex + stride) % tableEntries;
} while (entryIndex != loopIndex);
throw new SketchesArgumentException("No empty slots.");
} | java | private static final int findEmpty(final byte[] key, final int tableEntries, final byte[] stateArr) {
final long[] hash = MurmurHash3.hash(key, SEED);
int entryIndex = getIndex(hash[0], tableEntries);
final int stride = getStride(hash[1], tableEntries);
final int loopIndex = entryIndex;
do {
if (isBitClear(stateArr, entryIndex)) { //check if slot is empty
return entryIndex;
}
entryIndex = (entryIndex + stride) % tableEntries;
} while (entryIndex != loopIndex);
throw new SketchesArgumentException("No empty slots.");
} | [
"private",
"static",
"final",
"int",
"findEmpty",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"int",
"tableEntries",
",",
"final",
"byte",
"[",
"]",
"stateArr",
")",
"{",
"final",
"long",
"[",
"]",
"hash",
"=",
"MurmurHash3",
".",
"hash",
"(",... | Find the first empty slot for the given key.
Only used by resize, where it is known that the key does not exist in the table.
Throws an exception if no empty slots.
@param key the given key
@param tableEntries prime size of table
@param stateArr the valid bit array
@return the first empty slot for the given key | [
"Find",
"the",
"first",
"empty",
"slot",
"for",
"the",
"given",
"key",
".",
"Only",
"used",
"by",
"resize",
"where",
"it",
"is",
"known",
"that",
"the",
"key",
"does",
"not",
"exist",
"in",
"the",
"table",
".",
"Throws",
"an",
"exception",
"if",
"no",
... | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hllmap/HllMap.java#L236-L249 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java | FSDirectory.unprotectedMkdir | private void unprotectedMkdir(long inodeId, INode[] inodes, int pos,
byte[] name, PermissionStatus permission, boolean inheritPermission,
long timestamp) throws QuotaExceededException {
inodes[pos] = addChild(inodes, pos,
new INodeDirectory(inodeId, name, permission, timestamp),
-1, inheritPermission );
} | java | private void unprotectedMkdir(long inodeId, INode[] inodes, int pos,
byte[] name, PermissionStatus permission, boolean inheritPermission,
long timestamp) throws QuotaExceededException {
inodes[pos] = addChild(inodes, pos,
new INodeDirectory(inodeId, name, permission, timestamp),
-1, inheritPermission );
} | [
"private",
"void",
"unprotectedMkdir",
"(",
"long",
"inodeId",
",",
"INode",
"[",
"]",
"inodes",
",",
"int",
"pos",
",",
"byte",
"[",
"]",
"name",
",",
"PermissionStatus",
"permission",
",",
"boolean",
"inheritPermission",
",",
"long",
"timestamp",
")",
"thr... | create a directory at index pos.
The parent path to the directory is at [0, pos-1].
All ancestors exist. Newly created one stored at index pos. | [
"create",
"a",
"directory",
"at",
"index",
"pos",
".",
"The",
"parent",
"path",
"to",
"the",
"directory",
"is",
"at",
"[",
"0",
"pos",
"-",
"1",
"]",
".",
"All",
"ancestors",
"exist",
".",
"Newly",
"created",
"one",
"stored",
"at",
"index",
"pos",
".... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L2388-L2394 |
TNG/JGiven | jgiven-core/src/main/java/com/tngtech/jgiven/attachment/Attachment.java | Attachment.fromTextFile | public static Attachment fromTextFile( File file, MediaType mediaType ) throws IOException {
return fromText( Files.toString( file, mediaType.getCharset() ), mediaType );
} | java | public static Attachment fromTextFile( File file, MediaType mediaType ) throws IOException {
return fromText( Files.toString( file, mediaType.getCharset() ), mediaType );
} | [
"public",
"static",
"Attachment",
"fromTextFile",
"(",
"File",
"file",
",",
"MediaType",
"mediaType",
")",
"throws",
"IOException",
"{",
"return",
"fromText",
"(",
"Files",
".",
"toString",
"(",
"file",
",",
"mediaType",
".",
"getCharset",
"(",
")",
")",
","... | Creates a non-binary attachment from the given file.
@throws IOException if an I/O error occurs
@throws java.lang.IllegalArgumentException if mediaType is either binary or has no 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#L211-L213 |
foundation-runtime/configuration | configuration-api/src/main/java/com/cisco/oss/foundation/configuration/validation/params/ParamValidators.java | ParamValidators.getValidator | public static<E, T extends ParamValidator<E>> T getValidator(Class<T> clazz, Param<Boolean> param) {
// get if such validator was already initialized
List<ParamValidator> validators = validatorsMap.get(clazz);
if (validators == null) {
addValidators(validatorsMap, clazz, null, null);
}
// start searching from index 2 - from this index and on, the list preserves <ParamValidatorWrapper> specific instances
for (int i=2; i<validators.size(); i++) {
ParamValidator validator = validators.get(i);
if (validator.getClass() == ParamValidatorWrapper.class &&
((ParamValidatorWrapper)validator).ifParam == param) {
return (T)validator;
}
}
T validator = (T)new ParamValidatorWrapper<E>(clazz, param);
validators.add(validator);
return validator;
} | java | public static<E, T extends ParamValidator<E>> T getValidator(Class<T> clazz, Param<Boolean> param) {
// get if such validator was already initialized
List<ParamValidator> validators = validatorsMap.get(clazz);
if (validators == null) {
addValidators(validatorsMap, clazz, null, null);
}
// start searching from index 2 - from this index and on, the list preserves <ParamValidatorWrapper> specific instances
for (int i=2; i<validators.size(); i++) {
ParamValidator validator = validators.get(i);
if (validator.getClass() == ParamValidatorWrapper.class &&
((ParamValidatorWrapper)validator).ifParam == param) {
return (T)validator;
}
}
T validator = (T)new ParamValidatorWrapper<E>(clazz, param);
validators.add(validator);
return validator;
} | [
"public",
"static",
"<",
"E",
",",
"T",
"extends",
"ParamValidator",
"<",
"E",
">",
">",
"T",
"getValidator",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Param",
"<",
"Boolean",
">",
"param",
")",
"{",
"// get if such validator was already initialized",
"Lis... | wrap a validator for the given class type and according to the configured value og the given parameter.
Meaning, the relevant validator will be created according to the the current value of <param>. | [
"wrap",
"a",
"validator",
"for",
"the",
"given",
"class",
"type",
"and",
"according",
"to",
"the",
"configured",
"value",
"og",
"the",
"given",
"parameter",
".",
"Meaning",
"the",
"relevant",
"validator",
"will",
"be",
"created",
"according",
"to",
"the",
"t... | train | https://github.com/foundation-runtime/configuration/blob/c5bd171a2cca0dc1c8d568f987843ca47c6d1eed/configuration-api/src/main/java/com/cisco/oss/foundation/configuration/validation/params/ParamValidators.java#L428-L452 |
bazaarvoice/emodb | sor-api/src/main/java/com/bazaarvoice/emodb/sor/api/Coordinate.java | Coordinate.fromJson | public static Coordinate fromJson(Map<String, ?> json) {
return Coordinate.of(Intrinsic.getTable(json), Intrinsic.getId(json));
} | java | public static Coordinate fromJson(Map<String, ?> json) {
return Coordinate.of(Intrinsic.getTable(json), Intrinsic.getId(json));
} | [
"public",
"static",
"Coordinate",
"fromJson",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"json",
")",
"{",
"return",
"Coordinate",
".",
"of",
"(",
"Intrinsic",
".",
"getTable",
"(",
"json",
")",
",",
"Intrinsic",
".",
"getId",
"(",
"json",
")",
")",
"... | Creates a coordinate from a Json map with with "~table" and "~id". This is the inverse of {@link #asJson()}. | [
"Creates",
"a",
"coordinate",
"from",
"a",
"Json",
"map",
"with",
"with",
"~table",
"and",
"~id",
".",
"This",
"is",
"the",
"inverse",
"of",
"{"
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/sor-api/src/main/java/com/bazaarvoice/emodb/sor/api/Coordinate.java#L24-L26 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/streaming/JsonTextSequences.java | JsonTextSequences.fromPublisher | public static HttpResponse fromPublisher(HttpHeaders headers, Publisher<?> contentPublisher) {
return fromPublisher(headers, contentPublisher, HttpHeaders.EMPTY_HEADERS, defaultMapper);
} | java | public static HttpResponse fromPublisher(HttpHeaders headers, Publisher<?> contentPublisher) {
return fromPublisher(headers, contentPublisher, HttpHeaders.EMPTY_HEADERS, defaultMapper);
} | [
"public",
"static",
"HttpResponse",
"fromPublisher",
"(",
"HttpHeaders",
"headers",
",",
"Publisher",
"<",
"?",
">",
"contentPublisher",
")",
"{",
"return",
"fromPublisher",
"(",
"headers",
",",
"contentPublisher",
",",
"HttpHeaders",
".",
"EMPTY_HEADERS",
",",
"d... | Creates a new JSON Text Sequences from the specified {@link Publisher}.
@param headers the HTTP headers supposed to send
@param contentPublisher the {@link Publisher} which publishes the objects supposed to send as contents | [
"Creates",
"a",
"new",
"JSON",
"Text",
"Sequences",
"from",
"the",
"specified",
"{",
"@link",
"Publisher",
"}",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/streaming/JsonTextSequences.java#L118-L120 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java | Strs.indexAny | public static int indexAny(String target, String... indexWith) {
return indexAny(target, 0, Arrays.asList(indexWith));
} | java | public static int indexAny(String target, String... indexWith) {
return indexAny(target, 0, Arrays.asList(indexWith));
} | [
"public",
"static",
"int",
"indexAny",
"(",
"String",
"target",
",",
"String",
"...",
"indexWith",
")",
"{",
"return",
"indexAny",
"(",
"target",
",",
"0",
",",
"Arrays",
".",
"asList",
"(",
"indexWith",
")",
")",
";",
"}"
] | Search target string to find the first index of any string in the given string array
@param target
@param indexWith
@return | [
"Search",
"target",
"string",
"to",
"find",
"the",
"first",
"index",
"of",
"any",
"string",
"in",
"the",
"given",
"string",
"array"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java#L264-L266 |
cketti/ckChangeLog | ckChangeLog/src/main/java/de/cketti/library/changelog/ChangeLog.java | ChangeLog.parseReleaseTag | private boolean parseReleaseTag(XmlPullParser xml, boolean full,
SparseArray<ReleaseItem> changelog) throws XmlPullParserException, IOException {
String version = xml.getAttributeValue(null, ReleaseTag.ATTRIBUTE_VERSION);
int versionCode;
try {
String versionCodeStr = xml.getAttributeValue(null, ReleaseTag.ATTRIBUTE_VERSION_CODE);
versionCode = Integer.parseInt(versionCodeStr);
} catch (NumberFormatException e) {
versionCode = NO_VERSION;
}
if (!full && versionCode <= mLastVersionCode) {
return true;
}
int eventType = xml.getEventType();
List<String> changes = new ArrayList<String>();
while (eventType != XmlPullParser.END_TAG || xml.getName().equals(ChangeTag.NAME)) {
if (eventType == XmlPullParser.START_TAG && xml.getName().equals(ChangeTag.NAME)) {
eventType = xml.next();
changes.add(xml.getText());
}
eventType = xml.next();
}
ReleaseItem release = new ReleaseItem(versionCode, version, changes);
changelog.put(versionCode, release);
return false;
} | java | private boolean parseReleaseTag(XmlPullParser xml, boolean full,
SparseArray<ReleaseItem> changelog) throws XmlPullParserException, IOException {
String version = xml.getAttributeValue(null, ReleaseTag.ATTRIBUTE_VERSION);
int versionCode;
try {
String versionCodeStr = xml.getAttributeValue(null, ReleaseTag.ATTRIBUTE_VERSION_CODE);
versionCode = Integer.parseInt(versionCodeStr);
} catch (NumberFormatException e) {
versionCode = NO_VERSION;
}
if (!full && versionCode <= mLastVersionCode) {
return true;
}
int eventType = xml.getEventType();
List<String> changes = new ArrayList<String>();
while (eventType != XmlPullParser.END_TAG || xml.getName().equals(ChangeTag.NAME)) {
if (eventType == XmlPullParser.START_TAG && xml.getName().equals(ChangeTag.NAME)) {
eventType = xml.next();
changes.add(xml.getText());
}
eventType = xml.next();
}
ReleaseItem release = new ReleaseItem(versionCode, version, changes);
changelog.put(versionCode, release);
return false;
} | [
"private",
"boolean",
"parseReleaseTag",
"(",
"XmlPullParser",
"xml",
",",
"boolean",
"full",
",",
"SparseArray",
"<",
"ReleaseItem",
">",
"changelog",
")",
"throws",
"XmlPullParserException",
",",
"IOException",
"{",
"String",
"version",
"=",
"xml",
".",
"getAttr... | Parse the {@code release} tag of a change log XML file.
@param xml
The {@code XmlPullParser} instance used to read the change log.
@param full
If {@code true} the contents of the {@code release} tag are always added to
{@code changelog}. Otherwise only if the item's {@code versioncode} attribute is
higher than the last version code.
@param changelog
The {@code SparseArray} to add a new {@link ReleaseItem} instance to.
@return {@code true} if the {@code release} element is describing changes of a version older
or equal to the last version. In that case {@code changelog} won't be modified and
{@link #readChangeLog(XmlPullParser, boolean)} will stop reading more elements from
the change log file.
@throws XmlPullParserException
@throws IOException | [
"Parse",
"the",
"{",
"@code",
"release",
"}",
"tag",
"of",
"a",
"change",
"log",
"XML",
"file",
"."
] | train | https://github.com/cketti/ckChangeLog/blob/e9a81ad3e043357e80922aa7c149241af73223d3/ckChangeLog/src/main/java/de/cketti/library/changelog/ChangeLog.java#L519-L551 |
m-m-m/util | xml/src/main/java/net/sf/mmm/util/xml/base/jaxb/XmlBeanMapper.java | XmlBeanMapper.saveXml | public void saveXml(T jaxbBean, DataResource resource) {
OutputStream outputStream = resource.openOutputStream();
saveXml(jaxbBean, outputStream);
} | java | public void saveXml(T jaxbBean, DataResource resource) {
OutputStream outputStream = resource.openOutputStream();
saveXml(jaxbBean, outputStream);
} | [
"public",
"void",
"saveXml",
"(",
"T",
"jaxbBean",
",",
"DataResource",
"resource",
")",
"{",
"OutputStream",
"outputStream",
"=",
"resource",
".",
"openOutputStream",
"(",
")",
";",
"saveXml",
"(",
"jaxbBean",
",",
"outputStream",
")",
";",
"}"
] | This method saves the given {@code jaxbBean} as XML to the given {@code outputStream}. <br>
<b>ATTENTION:</b><br>
The caller of this method has to {@link OutputStream#close() close} the {@code outputStream}.
@param jaxbBean is the JAXB-bean to save as XML.
@param resource is the {@link DataResource} where to {@link DataResource#openOutputStream() write} to. | [
"This",
"method",
"saves",
"the",
"given",
"{",
"@code",
"jaxbBean",
"}",
"as",
"XML",
"to",
"the",
"given",
"{",
"@code",
"outputStream",
"}",
".",
"<br",
">",
"<b",
">",
"ATTENTION",
":",
"<",
"/",
"b",
">",
"<br",
">",
"The",
"caller",
"of",
"th... | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/xml/src/main/java/net/sf/mmm/util/xml/base/jaxb/XmlBeanMapper.java#L316-L320 |
ist-dresden/composum | sling/core/commons/src/main/java/com/composum/sling/core/CoreAdapterFactory.java | CoreAdapterFactory.getAdapter | protected static <AdapterType> AdapterType getAdapter(ResourceHandle resourceHandle, Class<AdapterType> type) {
if (type == ResourceHandle.class) {
return type.cast(resourceHandle);
}
log.info("Unable to adapt resource on {} to type {}", resourceHandle.getPath(), type.getName());
return null;
} | java | protected static <AdapterType> AdapterType getAdapter(ResourceHandle resourceHandle, Class<AdapterType> type) {
if (type == ResourceHandle.class) {
return type.cast(resourceHandle);
}
log.info("Unable to adapt resource on {} to type {}", resourceHandle.getPath(), type.getName());
return null;
} | [
"protected",
"static",
"<",
"AdapterType",
">",
"AdapterType",
"getAdapter",
"(",
"ResourceHandle",
"resourceHandle",
",",
"Class",
"<",
"AdapterType",
">",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"ResourceHandle",
".",
"class",
")",
"{",
"return",
"type",
... | Handles <code>resourceHandle.adaptTo(ResourceHandle.class)</code>.
@param resourceHandle Object to adapt
@param type target type
@return original Object | [
"Handles",
"<code",
">",
"resourceHandle",
".",
"adaptTo",
"(",
"ResourceHandle",
".",
"class",
")",
"<",
"/",
"code",
">",
"."
] | train | https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/CoreAdapterFactory.java#L56-L62 |
stackify/stackify-metrics | src/main/java/com/stackify/metric/impl/MetricMonitorService.java | MetricMonitorService.getMetricInfo | private int getMetricInfo(final MetricIdentity identity, final AppIdentity appIdentity) throws IOException, HttpException {
Preconditions.checkNotNull(identity);
Preconditions.checkNotNull(appIdentity);
// build the json objects
JsonGetMetricInfoRequest.Builder requestBuilder = JsonGetMetricInfoRequest.newBuilder();
requestBuilder.category(identity.getCategory());
requestBuilder.metricName(identity.getName());
requestBuilder.deviceId(appIdentity.getDeviceId());
requestBuilder.deviceAppId(appIdentity.getDeviceAppId());
requestBuilder.appNameId(appIdentity.getAppNameId());
requestBuilder.metricTypeId(identity.getType().getId());
JsonGetMetricInfoRequest request = requestBuilder.build();
// convert to json bytes
byte[] jsonBytes = objectMapper.writer().writeValueAsBytes(request);
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("GetMetricInfo Request: {}", new String(jsonBytes, "UTF-8"));
}
// post to stackify
HttpClient httpClient = new HttpClient(apiConfig);
String responseString = httpClient.post("/Metrics/GetMetricInfo", jsonBytes);
LOGGER.debug("GetMetricInfo Response: {}", responseString);
// deserialize the response and return the monitor id
ObjectReader jsonReader = objectMapper.reader(new TypeReference<JsonGetMetricInfoResponse>(){});
JsonGetMetricInfoResponse response = jsonReader.readValue(responseString);
if (response != null) {
return response.getMonitorId();
}
return 0;
} | java | private int getMetricInfo(final MetricIdentity identity, final AppIdentity appIdentity) throws IOException, HttpException {
Preconditions.checkNotNull(identity);
Preconditions.checkNotNull(appIdentity);
// build the json objects
JsonGetMetricInfoRequest.Builder requestBuilder = JsonGetMetricInfoRequest.newBuilder();
requestBuilder.category(identity.getCategory());
requestBuilder.metricName(identity.getName());
requestBuilder.deviceId(appIdentity.getDeviceId());
requestBuilder.deviceAppId(appIdentity.getDeviceAppId());
requestBuilder.appNameId(appIdentity.getAppNameId());
requestBuilder.metricTypeId(identity.getType().getId());
JsonGetMetricInfoRequest request = requestBuilder.build();
// convert to json bytes
byte[] jsonBytes = objectMapper.writer().writeValueAsBytes(request);
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("GetMetricInfo Request: {}", new String(jsonBytes, "UTF-8"));
}
// post to stackify
HttpClient httpClient = new HttpClient(apiConfig);
String responseString = httpClient.post("/Metrics/GetMetricInfo", jsonBytes);
LOGGER.debug("GetMetricInfo Response: {}", responseString);
// deserialize the response and return the monitor id
ObjectReader jsonReader = objectMapper.reader(new TypeReference<JsonGetMetricInfoResponse>(){});
JsonGetMetricInfoResponse response = jsonReader.readValue(responseString);
if (response != null) {
return response.getMonitorId();
}
return 0;
} | [
"private",
"int",
"getMetricInfo",
"(",
"final",
"MetricIdentity",
"identity",
",",
"final",
"AppIdentity",
"appIdentity",
")",
"throws",
"IOException",
",",
"HttpException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"identity",
")",
";",
"Preconditions",
".",... | Gets the monitor id for this metric
@param identity The metric identity
@return The monitor id (optional)
@throws IOException
@throws HttpException | [
"Gets",
"the",
"monitor",
"id",
"for",
"this",
"metric"
] | train | https://github.com/stackify/stackify-metrics/blob/6827d516085e4b29a3e54da963eebb2955822a5c/src/main/java/com/stackify/metric/impl/MetricMonitorService.java#L161-L203 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/DocumentTranslator.java | DocumentTranslator.isLocked | protected boolean isLocked( EditableDocument doc ) {
return hasProperty(doc, JcrLexicon.LOCK_OWNER) || hasProperty(doc, JcrLexicon.LOCK_IS_DEEP);
} | java | protected boolean isLocked( EditableDocument doc ) {
return hasProperty(doc, JcrLexicon.LOCK_OWNER) || hasProperty(doc, JcrLexicon.LOCK_IS_DEEP);
} | [
"protected",
"boolean",
"isLocked",
"(",
"EditableDocument",
"doc",
")",
"{",
"return",
"hasProperty",
"(",
"doc",
",",
"JcrLexicon",
".",
"LOCK_OWNER",
")",
"||",
"hasProperty",
"(",
"doc",
",",
"JcrLexicon",
".",
"LOCK_IS_DEEP",
")",
";",
"}"
] | Checks if the given document is already locked
@param doc the document
@return true if the change was made successfully, or false otherwise | [
"Checks",
"if",
"the",
"given",
"document",
"is",
"already",
"locked"
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/DocumentTranslator.java#L1449-L1451 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/date/DateCaster.java | DateCaster.toDateSimple | public static DateTime toDateSimple(String str, TimeZone timeZone) throws PageException {
DateTime dt = toDateSimple(str, CONVERTING_TYPE_OFFSET, true, timeZone, null);
if (dt == null) throw new ExpressionException("can't cast [" + str + "] to date value");
return dt;
} | java | public static DateTime toDateSimple(String str, TimeZone timeZone) throws PageException {
DateTime dt = toDateSimple(str, CONVERTING_TYPE_OFFSET, true, timeZone, null);
if (dt == null) throw new ExpressionException("can't cast [" + str + "] to date value");
return dt;
} | [
"public",
"static",
"DateTime",
"toDateSimple",
"(",
"String",
"str",
",",
"TimeZone",
"timeZone",
")",
"throws",
"PageException",
"{",
"DateTime",
"dt",
"=",
"toDateSimple",
"(",
"str",
",",
"CONVERTING_TYPE_OFFSET",
",",
"true",
",",
"timeZone",
",",
"null",
... | converts a Object to a DateTime Object, returns null if invalid string
@param str String to Convert
@param timeZone
@return coverted Date Time Object
@throws PageException | [
"converts",
"a",
"Object",
"to",
"a",
"DateTime",
"Object",
"returns",
"null",
"if",
"invalid",
"string"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/date/DateCaster.java#L423-L427 |
sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java | MarvinImage.drawRect | public void drawRect(int x, int y, int w, int h, Color c) {
int color = c.getRGB();
for (int i = x; i < x + w; i++) {
setIntColor(i, y, color);
setIntColor(i, y + (h - 1), color);
}
for (int i = y; i < y + h; i++) {
setIntColor(x, i, color);
setIntColor(x + (w - 1), i, color);
}
} | java | public void drawRect(int x, int y, int w, int h, Color c) {
int color = c.getRGB();
for (int i = x; i < x + w; i++) {
setIntColor(i, y, color);
setIntColor(i, y + (h - 1), color);
}
for (int i = y; i < y + h; i++) {
setIntColor(x, i, color);
setIntColor(x + (w - 1), i, color);
}
} | [
"public",
"void",
"drawRect",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"w",
",",
"int",
"h",
",",
"Color",
"c",
")",
"{",
"int",
"color",
"=",
"c",
".",
"getRGB",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"x",
";",
"i",
"<",
"x",
"... | Draws a rectangle in the image. It�s useful for debugging purposes.
@param x rect�s start position in x-axis
@param y rect�s start positioj in y-axis
@param w rect�s width
@param h rect�s height
@param c rect�s color | [
"Draws",
"a",
"rectangle",
"in",
"the",
"image",
".",
"It�s",
"useful",
"for",
"debugging",
"purposes",
"."
] | train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java#L685-L696 |
strator-dev/greenpepper | greenpepper/core/src/main/java/com/greenpepper/util/cli/CommandLine.java | CommandLine.buildOption | public OptionBuilder buildOption( String name, String... options )
{
OptionBuilder option = OptionBuilder.create( name );
parser.build( option, options );
return option;
} | java | public OptionBuilder buildOption( String name, String... options )
{
OptionBuilder option = OptionBuilder.create( name );
parser.build( option, options );
return option;
} | [
"public",
"OptionBuilder",
"buildOption",
"(",
"String",
"name",
",",
"String",
"...",
"options",
")",
"{",
"OptionBuilder",
"option",
"=",
"OptionBuilder",
".",
"create",
"(",
"name",
")",
";",
"parser",
".",
"build",
"(",
"option",
",",
"options",
")",
"... | <p>buildOption.</p>
@param name a {@link java.lang.String} object.
@param options a {@link java.lang.String} object.
@return a {@link com.greenpepper.util.cli.OptionBuilder} object. | [
"<p",
">",
"buildOption",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/util/cli/CommandLine.java#L116-L121 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgUtil.java | DwgUtil.getBitDouble | public static Vector getBitDouble(int[] data, int offset) throws Exception {
Vector v = new Vector();
int type = ((Integer)getBits(data, 2, offset)).intValue();
int read = 2;
double val = 0.0;
if (type==0x00) {
byte[] bytes = (byte[])getBits(data, 64, (offset+2));
ByteBuffer bb = ByteBuffer.wrap(bytes);
bb.order(ByteOrder.LITTLE_ENDIAN);
val = bb.getDouble();
read = 66;
} else if (type==0x01) {
val = 1.0;
} else if (type==0x02) {
val = 0.0;
} else {
System.out.println("Bad type at bit offset: " + offset);
}
v.add(new Integer(offset+read));
v.add(new Double(val));
return v;
} | java | public static Vector getBitDouble(int[] data, int offset) throws Exception {
Vector v = new Vector();
int type = ((Integer)getBits(data, 2, offset)).intValue();
int read = 2;
double val = 0.0;
if (type==0x00) {
byte[] bytes = (byte[])getBits(data, 64, (offset+2));
ByteBuffer bb = ByteBuffer.wrap(bytes);
bb.order(ByteOrder.LITTLE_ENDIAN);
val = bb.getDouble();
read = 66;
} else if (type==0x01) {
val = 1.0;
} else if (type==0x02) {
val = 0.0;
} else {
System.out.println("Bad type at bit offset: " + offset);
}
v.add(new Integer(offset+read));
v.add(new Double(val));
return v;
} | [
"public",
"static",
"Vector",
"getBitDouble",
"(",
"int",
"[",
"]",
"data",
",",
"int",
"offset",
")",
"throws",
"Exception",
"{",
"Vector",
"v",
"=",
"new",
"Vector",
"(",
")",
";",
"int",
"type",
"=",
"(",
"(",
"Integer",
")",
"getBits",
"(",
"data... | Read a double value from a group of unsigned bytes
@param data Array of unsigned bytes obtained from the DWG binary file
@param offset The current bit offset where the value begins
@throws Exception If an unexpected bit value is found in the DWG file. Occurs
when we are looking for LwPolylines.
@return Vector This vector has two parts. First is an int value that represents
the new offset, and second is the double value | [
"Read",
"a",
"double",
"value",
"from",
"a",
"group",
"of",
"unsigned",
"bytes"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgUtil.java#L250-L271 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/network/NetworkAddressUtils.java | NetworkAddressUtils.getRpcPortSocketAddress | public static InetSocketAddress getRpcPortSocketAddress(WorkerNetAddress netAddress) {
String host = netAddress.getHost();
int port = netAddress.getRpcPort();
return new InetSocketAddress(host, port);
} | java | public static InetSocketAddress getRpcPortSocketAddress(WorkerNetAddress netAddress) {
String host = netAddress.getHost();
int port = netAddress.getRpcPort();
return new InetSocketAddress(host, port);
} | [
"public",
"static",
"InetSocketAddress",
"getRpcPortSocketAddress",
"(",
"WorkerNetAddress",
"netAddress",
")",
"{",
"String",
"host",
"=",
"netAddress",
".",
"getHost",
"(",
")",
";",
"int",
"port",
"=",
"netAddress",
".",
"getRpcPort",
"(",
")",
";",
"return",... | Extracts rpcPort InetSocketAddress from Alluxio representation of network address.
@param netAddress the input network address representation
@return InetSocketAddress | [
"Extracts",
"rpcPort",
"InetSocketAddress",
"from",
"Alluxio",
"representation",
"of",
"network",
"address",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/network/NetworkAddressUtils.java#L611-L615 |
knowm/XChange | xchange-lakebtc/src/main/java/org/knowm/xchange/lakebtc/LakeBTCAdapters.java | LakeBTCAdapters.adaptAccountInfo | public static AccountInfo adaptAccountInfo(LakeBTCAccount lakeBTCAccount) {
// Adapt to XChange DTOs
LakeBTCProfile profile = lakeBTCAccount.getProfile();
LakeBTCBalance balance = lakeBTCAccount.getBalance();
Balance usdBalance = new Balance(Currency.USD, balance.getUSD());
Balance cnyWBalance = new Balance(Currency.CNY, balance.getCNY());
Balance btcBalance = new Balance(Currency.BTC, balance.getBTC());
return new AccountInfo(profile.getId(), new Wallet(usdBalance, btcBalance, cnyWBalance));
} | java | public static AccountInfo adaptAccountInfo(LakeBTCAccount lakeBTCAccount) {
// Adapt to XChange DTOs
LakeBTCProfile profile = lakeBTCAccount.getProfile();
LakeBTCBalance balance = lakeBTCAccount.getBalance();
Balance usdBalance = new Balance(Currency.USD, balance.getUSD());
Balance cnyWBalance = new Balance(Currency.CNY, balance.getCNY());
Balance btcBalance = new Balance(Currency.BTC, balance.getBTC());
return new AccountInfo(profile.getId(), new Wallet(usdBalance, btcBalance, cnyWBalance));
} | [
"public",
"static",
"AccountInfo",
"adaptAccountInfo",
"(",
"LakeBTCAccount",
"lakeBTCAccount",
")",
"{",
"// Adapt to XChange DTOs",
"LakeBTCProfile",
"profile",
"=",
"lakeBTCAccount",
".",
"getProfile",
"(",
")",
";",
"LakeBTCBalance",
"balance",
"=",
"lakeBTCAccount",
... | Adapts a LakeBTCAccount to an AccountInfo
@param lakeBTCAccount
@return Wallet | [
"Adapts",
"a",
"LakeBTCAccount",
"to",
"an",
"AccountInfo"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-lakebtc/src/main/java/org/knowm/xchange/lakebtc/LakeBTCAdapters.java#L159-L169 |
structr/structr | structr-core/src/main/java/org/structr/common/ValidationHelper.java | ValidationHelper.isValidStringMatchingRegex | public static boolean isValidStringMatchingRegex(final String value, final String expression) {
Pattern pattern = patterns.get(expression);
if (pattern == null) {
pattern = Pattern.compile(expression);
patterns.put(expression, pattern);
}
return (value != null && pattern.matcher(value).matches());
} | java | public static boolean isValidStringMatchingRegex(final String value, final String expression) {
Pattern pattern = patterns.get(expression);
if (pattern == null) {
pattern = Pattern.compile(expression);
patterns.put(expression, pattern);
}
return (value != null && pattern.matcher(value).matches());
} | [
"public",
"static",
"boolean",
"isValidStringMatchingRegex",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"expression",
")",
"{",
"Pattern",
"pattern",
"=",
"patterns",
".",
"get",
"(",
"expression",
")",
";",
"if",
"(",
"pattern",
"==",
"null",
... | Checks whether the value of the given property key of the given node
if not null and matches the given regular expression.
@param node
@param key
@param expression
@param errorBuffer
@return true if string matches expression | [
"Checks",
"whether",
"the",
"value",
"of",
"the",
"given",
"property",
"key",
"of",
"the",
"given",
"node",
"if",
"not",
"null",
"and",
"matches",
"the",
"given",
"regular",
"expression",
"."
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/common/ValidationHelper.java#L188-L199 |
hltcoe/annotated-nyt | src/main/java/com/nytlabs/corpus/NYTCorpusDocument.java | NYTCorpusDocument.ljust | private String ljust(String s, Integer length) {
if (s.length() >= length) {
return s;
}
length -= s.length();
StringBuffer sb = new StringBuffer();
for (Integer i = 0; i < length; i++) {
sb.append(" ");
}
return s + sb.toString();
} | java | private String ljust(String s, Integer length) {
if (s.length() >= length) {
return s;
}
length -= s.length();
StringBuffer sb = new StringBuffer();
for (Integer i = 0; i < length; i++) {
sb.append(" ");
}
return s + sb.toString();
} | [
"private",
"String",
"ljust",
"(",
"String",
"s",
",",
"Integer",
"length",
")",
"{",
"if",
"(",
"s",
".",
"length",
"(",
")",
">=",
"length",
")",
"{",
"return",
"s",
";",
"}",
"length",
"-=",
"s",
".",
"length",
"(",
")",
";",
"StringBuffer",
"... | Left justify a string by forcing it to be the specified length. This is
done by concatonating space characters to the end of the string until the
string is of the specified length. If, however, the string is initially
longer than the specified length then the original string is returned.
@param s
A string.
@param length
The target length for the string.
@return A left-justified string. | [
"Left",
"justify",
"a",
"string",
"by",
"forcing",
"it",
"to",
"be",
"the",
"specified",
"length",
".",
"This",
"is",
"done",
"by",
"concatonating",
"space",
"characters",
"to",
"the",
"end",
"of",
"the",
"string",
"until",
"the",
"string",
"is",
"of",
"... | train | https://github.com/hltcoe/annotated-nyt/blob/0a4daa97705591cefea9de61614770ae2665a48e/src/main/java/com/nytlabs/corpus/NYTCorpusDocument.java#L990-L1000 |
loldevs/riotapi | rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/PlayerStatsService.java | PlayerStatsService.getTeamEndOfGameStats | public EndOfGameStats getTeamEndOfGameStats(TeamId teamId, long gameId) {
return client.sendRpcAndWait(SERVICE, "getTeamEndOfGameStats", teamId, gameId);
} | java | public EndOfGameStats getTeamEndOfGameStats(TeamId teamId, long gameId) {
return client.sendRpcAndWait(SERVICE, "getTeamEndOfGameStats", teamId, gameId);
} | [
"public",
"EndOfGameStats",
"getTeamEndOfGameStats",
"(",
"TeamId",
"teamId",
",",
"long",
"gameId",
")",
"{",
"return",
"client",
".",
"sendRpcAndWait",
"(",
"SERVICE",
",",
"\"getTeamEndOfGameStats\"",
",",
"teamId",
",",
"gameId",
")",
";",
"}"
] | Retrieve post-game stats for a team
@param teamId The id of the team
@param gameId The if of the game
@return Post-game stats | [
"Retrieve",
"post",
"-",
"game",
"stats",
"for",
"a",
"team"
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/PlayerStatsService.java#L102-L104 |
pac4j/pac4j | pac4j-core/src/main/java/org/pac4j/core/authorization/authorizer/ProfileAuthorizer.java | ProfileAuthorizer.isAllAuthorized | public boolean isAllAuthorized(final WebContext context, final List<U> profiles) {
for (final U profile : profiles) {
if (!isProfileAuthorized(context, profile)) {
return handleError(context);
}
}
return true;
} | java | public boolean isAllAuthorized(final WebContext context, final List<U> profiles) {
for (final U profile : profiles) {
if (!isProfileAuthorized(context, profile)) {
return handleError(context);
}
}
return true;
} | [
"public",
"boolean",
"isAllAuthorized",
"(",
"final",
"WebContext",
"context",
",",
"final",
"List",
"<",
"U",
">",
"profiles",
")",
"{",
"for",
"(",
"final",
"U",
"profile",
":",
"profiles",
")",
"{",
"if",
"(",
"!",
"isProfileAuthorized",
"(",
"context",... | If all profiles are authorized.
@param context the web context
@param profiles the user profiles
@return whether all profiles are authorized | [
"If",
"all",
"profiles",
"are",
"authorized",
"."
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/authorization/authorizer/ProfileAuthorizer.java#L23-L30 |
line/armeria | core/src/main/java/com/linecorp/armeria/common/util/InetAddressPredicates.java | InetAddressPredicates.ofCidr | public static Predicate<InetAddress> ofCidr(InetAddress baseAddress, int maskBits) {
requireNonNull(baseAddress, "baseAddress");
checkArgument(maskBits >= 0, "maskBits: %s (expected: >= 0)", maskBits);
return ofCidr(baseAddress, maskBits, maskBits);
} | java | public static Predicate<InetAddress> ofCidr(InetAddress baseAddress, int maskBits) {
requireNonNull(baseAddress, "baseAddress");
checkArgument(maskBits >= 0, "maskBits: %s (expected: >= 0)", maskBits);
return ofCidr(baseAddress, maskBits, maskBits);
} | [
"public",
"static",
"Predicate",
"<",
"InetAddress",
">",
"ofCidr",
"(",
"InetAddress",
"baseAddress",
",",
"int",
"maskBits",
")",
"{",
"requireNonNull",
"(",
"baseAddress",
",",
"\"baseAddress\"",
")",
";",
"checkArgument",
"(",
"maskBits",
">=",
"0",
",",
"... | Returns a {@link Predicate} which returns {@code true} if the given {@link InetAddress} is in the
range of a <a href="https://tools.ietf.org/html/rfc4632">Classless Inter-domain Routing (CIDR)</a> block.
@param baseAddress the base {@link InetAddress} of a CIDR notation
@param maskBits the number of significant bits which describes its network portion | [
"Returns",
"a",
"{",
"@link",
"Predicate",
"}",
"which",
"returns",
"{",
"@code",
"true",
"}",
"if",
"the",
"given",
"{",
"@link",
"InetAddress",
"}",
"is",
"in",
"the",
"range",
"of",
"a",
"<a",
"href",
"=",
"https",
":",
"//",
"tools",
".",
"ietf",... | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/util/InetAddressPredicates.java#L101-L105 |
alipay/sofa-rpc | core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CommonUtils.java | CommonUtils.parseLong | public static long parseLong(String num, long defaultLong) {
if (num == null) {
return defaultLong;
} else {
try {
return Long.parseLong(num);
} catch (Exception e) {
return defaultLong;
}
}
} | java | public static long parseLong(String num, long defaultLong) {
if (num == null) {
return defaultLong;
} else {
try {
return Long.parseLong(num);
} catch (Exception e) {
return defaultLong;
}
}
} | [
"public",
"static",
"long",
"parseLong",
"(",
"String",
"num",
",",
"long",
"defaultLong",
")",
"{",
"if",
"(",
"num",
"==",
"null",
")",
"{",
"return",
"defaultLong",
";",
"}",
"else",
"{",
"try",
"{",
"return",
"Long",
".",
"parseLong",
"(",
"num",
... | String Long turn number.
@param num The number of strings.
@param defaultLong The default value
@return long | [
"String",
"Long",
"turn",
"number",
"."
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CommonUtils.java#L185-L195 |
UrielCh/ovh-java-sdk | ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java | ApiOvhXdsl.spare_spare_serviceInfos_PUT | public void spare_spare_serviceInfos_PUT(String spare, OvhService body) throws IOException {
String qPath = "/xdsl/spare/{spare}/serviceInfos";
StringBuilder sb = path(qPath, spare);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void spare_spare_serviceInfos_PUT(String spare, OvhService body) throws IOException {
String qPath = "/xdsl/spare/{spare}/serviceInfos";
StringBuilder sb = path(qPath, spare);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"spare_spare_serviceInfos_PUT",
"(",
"String",
"spare",
",",
"OvhService",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/xdsl/spare/{spare}/serviceInfos\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"spare... | Alter this object properties
REST: PUT /xdsl/spare/{spare}/serviceInfos
@param body [required] New object properties
@param spare [required] The internal name of your spare | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L2058-L2062 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/fdt/FdtSketch.java | FdtSketch.computeLgK | static int computeLgK(final double threshold, final double rse) {
final double v = Math.ceil(1.0 / (threshold * rse * rse));
final int lgK = (int) Math.ceil(Math.log(v) / Math.log(2));
if (lgK > MAX_LG_NOM_LONGS) {
throw new SketchesArgumentException("Requested Sketch (LgK = " + lgK + " > 2^26), "
+ "either increase the threshold, the rse or both.");
}
return lgK;
} | java | static int computeLgK(final double threshold, final double rse) {
final double v = Math.ceil(1.0 / (threshold * rse * rse));
final int lgK = (int) Math.ceil(Math.log(v) / Math.log(2));
if (lgK > MAX_LG_NOM_LONGS) {
throw new SketchesArgumentException("Requested Sketch (LgK = " + lgK + " > 2^26), "
+ "either increase the threshold, the rse or both.");
}
return lgK;
} | [
"static",
"int",
"computeLgK",
"(",
"final",
"double",
"threshold",
",",
"final",
"double",
"rse",
")",
"{",
"final",
"double",
"v",
"=",
"Math",
".",
"ceil",
"(",
"1.0",
"/",
"(",
"threshold",
"*",
"rse",
"*",
"rse",
")",
")",
";",
"final",
"int",
... | Computes LgK given the threshold and RSE.
@param threshold the fraction, between zero and 1.0, of the total stream length that defines
a "Frequent" (or heavy) tuple.
@param rse the maximum Relative Standard Error for the estimate of the distinct population of a
reported tuple (selected with a primary key) at the threshold.
@return LgK | [
"Computes",
"LgK",
"given",
"the",
"threshold",
"and",
"RSE",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/fdt/FdtSketch.java#L164-L172 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskClient.java | DiskClient.insertDisk | @BetaApi
public final Operation insertDisk(String zone, Disk diskResource) {
InsertDiskHttpRequest request =
InsertDiskHttpRequest.newBuilder().setZone(zone).setDiskResource(diskResource).build();
return insertDisk(request);
} | java | @BetaApi
public final Operation insertDisk(String zone, Disk diskResource) {
InsertDiskHttpRequest request =
InsertDiskHttpRequest.newBuilder().setZone(zone).setDiskResource(diskResource).build();
return insertDisk(request);
} | [
"@",
"BetaApi",
"public",
"final",
"Operation",
"insertDisk",
"(",
"String",
"zone",
",",
"Disk",
"diskResource",
")",
"{",
"InsertDiskHttpRequest",
"request",
"=",
"InsertDiskHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"setZone",
"(",
"zone",
")",
".",
"s... | Creates a persistent disk in the specified project using the data in the request. You can
create a disk with a sourceImage, a sourceSnapshot, or create an empty 500 GB data disk by
omitting all properties. You can also create a disk that is larger than the default size by
specifying the sizeGb property.
<p>Sample code:
<pre><code>
try (DiskClient diskClient = DiskClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
Disk diskResource = Disk.newBuilder().build();
Operation response = diskClient.insertDisk(zone.toString(), diskResource);
}
</code></pre>
@param zone The name of the zone for this request.
@param diskResource A Disk resource. (== resource_for beta.disks ==) (== resource_for v1.disks
==)
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"a",
"persistent",
"disk",
"in",
"the",
"specified",
"project",
"using",
"the",
"data",
"in",
"the",
"request",
".",
"You",
"can",
"create",
"a",
"disk",
"with",
"a",
"sourceImage",
"a",
"sourceSnapshot",
"or",
"create",
"an",
"empty",
"500",
"G... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskClient.java#L774-L780 |
thorntail/thorntail | fractions/microprofile/microprofile-jwt/src/main/java/org/wildfly/swarm/microprofile/jwtauth/deployment/auth/cdi/MPJWTExtension.java | MPJWTExtension.observeBeforeBeanDiscovery | public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd, BeanManager beanManager) {
log.debugf("MPJWTExtension(), adding producers");
String extensionName = MPJWTExtension.class.getName();
for (Class<?> clazz : new Class<?>[] {
JWTAuthContextInfoProvider.class,
CommonJwtProducer.class,
PrincipalProducer.class,
RawClaimTypeProducer.class,
ClaimValueProducer.class,
JsonValueProducer.class,
}) {
bbd.addAnnotatedType(beanManager.createAnnotatedType(clazz), extensionName + "_" + clazz.getName());
}
} | java | public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd, BeanManager beanManager) {
log.debugf("MPJWTExtension(), adding producers");
String extensionName = MPJWTExtension.class.getName();
for (Class<?> clazz : new Class<?>[] {
JWTAuthContextInfoProvider.class,
CommonJwtProducer.class,
PrincipalProducer.class,
RawClaimTypeProducer.class,
ClaimValueProducer.class,
JsonValueProducer.class,
}) {
bbd.addAnnotatedType(beanManager.createAnnotatedType(clazz), extensionName + "_" + clazz.getName());
}
} | [
"public",
"void",
"observeBeforeBeanDiscovery",
"(",
"@",
"Observes",
"BeforeBeanDiscovery",
"bbd",
",",
"BeanManager",
"beanManager",
")",
"{",
"log",
".",
"debugf",
"(",
"\"MPJWTExtension(), adding producers\"",
")",
";",
"String",
"extensionName",
"=",
"MPJWTExtensio... | Register the MPJWTProducer JsonWebToken producer bean
@param bbd before discovery event
@param beanManager cdi bean manager | [
"Register",
"the",
"MPJWTProducer",
"JsonWebToken",
"producer",
"bean"
] | train | https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/fractions/microprofile/microprofile-jwt/src/main/java/org/wildfly/swarm/microprofile/jwtauth/deployment/auth/cdi/MPJWTExtension.java#L75-L88 |
syphr42/prom | src/main/java/org/syphr/prom/PropertiesManager.java | PropertiesManager.setProperty | public <E extends Enum<E>> void setProperty(T property, E value) throws IllegalArgumentException
{
if (value == null)
{
throw new IllegalArgumentException("Cannot set a null value, use reset instead");
}
setProperty(property, value.name().toLowerCase());
} | java | public <E extends Enum<E>> void setProperty(T property, E value) throws IllegalArgumentException
{
if (value == null)
{
throw new IllegalArgumentException("Cannot set a null value, use reset instead");
}
setProperty(property, value.name().toLowerCase());
} | [
"public",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
">",
"void",
"setProperty",
"(",
"T",
"property",
",",
"E",
"value",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException... | Set the given property using an Enum constant. This will not write the
new value to the file system.<br>
<br>
Please note that the Enum value set here is case insensitive. See
{@link #getEnumProperty(Object, Class)} for additional details.
@see #saveProperty(Object, Enum)
@param <E>
the type of Enum value to set
@param property
the property whose value is being set
@param value
the value to set
@throws IllegalArgumentException
if a <code>null</code> value is given (see
{@link #resetProperty(Object)}) | [
"Set",
"the",
"given",
"property",
"using",
"an",
"Enum",
"constant",
".",
"This",
"will",
"not",
"write",
"the",
"new",
"value",
"to",
"the",
"file",
"system",
".",
"<br",
">",
"<br",
">",
"Please",
"note",
"that",
"the",
"Enum",
"value",
"set",
"here... | train | https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/PropertiesManager.java#L891-L899 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Waiter.java | Waiter.waitForAndGetView | public <T extends View> T waitForAndGetView(int index, Class<T> classToFilterBy){
long endTime = SystemClock.uptimeMillis() + Timeout.getSmallTimeout();
while (SystemClock.uptimeMillis() <= endTime && !waitForView(classToFilterBy, index, true, true));
int numberOfUniqueViews = searcher.getNumberOfUniqueViews();
ArrayList<T> views = RobotiumUtils.removeInvisibleViews(viewFetcher.getCurrentViews(classToFilterBy, true));
if(views.size() < numberOfUniqueViews){
int newIndex = index - (numberOfUniqueViews - views.size());
if(newIndex >= 0)
index = newIndex;
}
T view = null;
try{
view = views.get(index);
}catch (IndexOutOfBoundsException exception) {
int match = index + 1;
if(match > 1) {
Assert.fail(match + " " + classToFilterBy.getSimpleName() +"s" + " are not found!");
}
else {
Assert.fail(classToFilterBy.getSimpleName() + " is not found!");
}
}
views = null;
return view;
} | java | public <T extends View> T waitForAndGetView(int index, Class<T> classToFilterBy){
long endTime = SystemClock.uptimeMillis() + Timeout.getSmallTimeout();
while (SystemClock.uptimeMillis() <= endTime && !waitForView(classToFilterBy, index, true, true));
int numberOfUniqueViews = searcher.getNumberOfUniqueViews();
ArrayList<T> views = RobotiumUtils.removeInvisibleViews(viewFetcher.getCurrentViews(classToFilterBy, true));
if(views.size() < numberOfUniqueViews){
int newIndex = index - (numberOfUniqueViews - views.size());
if(newIndex >= 0)
index = newIndex;
}
T view = null;
try{
view = views.get(index);
}catch (IndexOutOfBoundsException exception) {
int match = index + 1;
if(match > 1) {
Assert.fail(match + " " + classToFilterBy.getSimpleName() +"s" + " are not found!");
}
else {
Assert.fail(classToFilterBy.getSimpleName() + " is not found!");
}
}
views = null;
return view;
} | [
"public",
"<",
"T",
"extends",
"View",
">",
"T",
"waitForAndGetView",
"(",
"int",
"index",
",",
"Class",
"<",
"T",
">",
"classToFilterBy",
")",
"{",
"long",
"endTime",
"=",
"SystemClock",
".",
"uptimeMillis",
"(",
")",
"+",
"Timeout",
".",
"getSmallTimeout... | Waits for and returns a View.
@param index the index of the view
@param classToFilterby the class to filter
@return the specified View | [
"Waits",
"for",
"and",
"returns",
"a",
"View",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Waiter.java#L645-L671 |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java | ColorHolder.applyToOr | public static void applyToOr(ColorHolder colorHolder, TextView textView, ColorStateList colorDefault) {
if (colorHolder != null && textView != null) {
colorHolder.applyToOr(textView, colorDefault);
} else if (textView != null) {
textView.setTextColor(colorDefault);
}
} | java | public static void applyToOr(ColorHolder colorHolder, TextView textView, ColorStateList colorDefault) {
if (colorHolder != null && textView != null) {
colorHolder.applyToOr(textView, colorDefault);
} else if (textView != null) {
textView.setTextColor(colorDefault);
}
} | [
"public",
"static",
"void",
"applyToOr",
"(",
"ColorHolder",
"colorHolder",
",",
"TextView",
"textView",
",",
"ColorStateList",
"colorDefault",
")",
"{",
"if",
"(",
"colorHolder",
"!=",
"null",
"&&",
"textView",
"!=",
"null",
")",
"{",
"colorHolder",
".",
"app... | a small static helper to set the text color to a textView null save
@param colorHolder
@param textView
@param colorDefault | [
"a",
"small",
"static",
"helper",
"to",
"set",
"the",
"text",
"color",
"to",
"a",
"textView",
"null",
"save"
] | train | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java#L169-L175 |
BioPAX/Paxtools | paxtools-core/src/main/java/org/biopax/paxtools/controller/AbstractPropertyEditor.java | AbstractPropertyEditor.isInstanceOfAtLeastOne | protected boolean isInstanceOfAtLeastOne(Set<Class<? extends BioPAXElement>> classes, Object value)
{
boolean check = false;
for (Class aClass : classes)
{
if (aClass.isInstance(value))
{
check = true;
break;
}
}
return check;
} | java | protected boolean isInstanceOfAtLeastOne(Set<Class<? extends BioPAXElement>> classes, Object value)
{
boolean check = false;
for (Class aClass : classes)
{
if (aClass.isInstance(value))
{
check = true;
break;
}
}
return check;
} | [
"protected",
"boolean",
"isInstanceOfAtLeastOne",
"(",
"Set",
"<",
"Class",
"<",
"?",
"extends",
"BioPAXElement",
">",
">",
"classes",
",",
"Object",
"value",
")",
"{",
"boolean",
"check",
"=",
"false",
";",
"for",
"(",
"Class",
"aClass",
":",
"classes",
"... | Checks if <em>value</em> is an instance of one of the classes given in a set. This method
becomes useful, when the restrictions have to be checked for a set of objects. e.g. check if the
value is in the range of the editor.
@param classes a set of classes to be checked
@param value value whose class will be checked
@return true if value belongs to one of the classes in the set | [
"Checks",
"if",
"<em",
">",
"value<",
"/",
"em",
">",
"is",
"an",
"instance",
"of",
"one",
"of",
"the",
"classes",
"given",
"in",
"a",
"set",
".",
"This",
"method",
"becomes",
"useful",
"when",
"the",
"restrictions",
"have",
"to",
"be",
"checked",
"for... | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/controller/AbstractPropertyEditor.java#L314-L326 |
actframework/actframework | src/main/java/act/data/ApacheMultipartParser.java | ApacheMultipartParser.parseEndOfLine | private int parseEndOfLine(String headerPart, int end) {
int index = end;
for (; ;) {
int offset = headerPart.indexOf('\r', index);
if (offset == -1 || offset + 1 >= headerPart.length()) {
throw new IllegalStateException("Expected headers to be terminated by an empty line.");
}
if (headerPart.charAt(offset + 1) == '\n') {
return offset;
}
index = offset + 1;
}
} | java | private int parseEndOfLine(String headerPart, int end) {
int index = end;
for (; ;) {
int offset = headerPart.indexOf('\r', index);
if (offset == -1 || offset + 1 >= headerPart.length()) {
throw new IllegalStateException("Expected headers to be terminated by an empty line.");
}
if (headerPart.charAt(offset + 1) == '\n') {
return offset;
}
index = offset + 1;
}
} | [
"private",
"int",
"parseEndOfLine",
"(",
"String",
"headerPart",
",",
"int",
"end",
")",
"{",
"int",
"index",
"=",
"end",
";",
"for",
"(",
";",
";",
")",
"{",
"int",
"offset",
"=",
"headerPart",
".",
"indexOf",
"(",
"'",
"'",
",",
"index",
")",
";"... | Skips bytes until the end of the current line.
@param headerPart The headers, which are being parsed.
@param end Index of the last byte, which has yet been processed.
@return Index of the \r\n sequence, which indicates end of line. | [
"Skips",
"bytes",
"until",
"the",
"end",
"of",
"the",
"current",
"line",
"."
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/data/ApacheMultipartParser.java#L276-L288 |
apache/reef | lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/driver/ResourceManager.java | ResourceManager.onResourceLaunchRequest | void onResourceLaunchRequest(
final ResourceLaunchEvent launchRequest) {
synchronized (this.theContainers) {
final Container c = this.theContainers.get(launchRequest.getIdentifier());
try (final LoggingScope lb = this.loggingScopeFactory
.getNewLoggingScope("ResourceManager.onResourceLaunchRequest:evaluatorConfigurationFile")) {
// Add the global files and libraries.
c.addGlobalFiles(this.fileNames.getGlobalFolder());
c.addLocalFiles(getLocalFiles(launchRequest));
// Make the configuration file of the evaluator.
final File evaluatorConfigurationFile = new File(c.getFolder(), fileNames.getEvaluatorConfigurationPath());
try {
this.configurationSerializer.toFile(launchRequest.getEvaluatorConf(), evaluatorConfigurationFile);
} catch (final IOException | BindException e) {
throw new RuntimeException("Unable to write configuration.", e);
}
}
try (final LoggingScope lc = this.loggingScopeFactory
.getNewLoggingScope("ResourceManager.onResourceLaunchRequest:runCommand")) {
final List<String> command = getLaunchCommand(launchRequest, c.getMemory());
LOG.log(Level.FINEST, "Launching container: {0}", c);
c.run(command);
}
}
} | java | void onResourceLaunchRequest(
final ResourceLaunchEvent launchRequest) {
synchronized (this.theContainers) {
final Container c = this.theContainers.get(launchRequest.getIdentifier());
try (final LoggingScope lb = this.loggingScopeFactory
.getNewLoggingScope("ResourceManager.onResourceLaunchRequest:evaluatorConfigurationFile")) {
// Add the global files and libraries.
c.addGlobalFiles(this.fileNames.getGlobalFolder());
c.addLocalFiles(getLocalFiles(launchRequest));
// Make the configuration file of the evaluator.
final File evaluatorConfigurationFile = new File(c.getFolder(), fileNames.getEvaluatorConfigurationPath());
try {
this.configurationSerializer.toFile(launchRequest.getEvaluatorConf(), evaluatorConfigurationFile);
} catch (final IOException | BindException e) {
throw new RuntimeException("Unable to write configuration.", e);
}
}
try (final LoggingScope lc = this.loggingScopeFactory
.getNewLoggingScope("ResourceManager.onResourceLaunchRequest:runCommand")) {
final List<String> command = getLaunchCommand(launchRequest, c.getMemory());
LOG.log(Level.FINEST, "Launching container: {0}", c);
c.run(command);
}
}
} | [
"void",
"onResourceLaunchRequest",
"(",
"final",
"ResourceLaunchEvent",
"launchRequest",
")",
"{",
"synchronized",
"(",
"this",
".",
"theContainers",
")",
"{",
"final",
"Container",
"c",
"=",
"this",
".",
"theContainers",
".",
"get",
"(",
"launchRequest",
".",
"... | Processes a resource launch request.
@param launchRequest the launch request to be processed. | [
"Processes",
"a",
"resource",
"launch",
"request",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/driver/ResourceManager.java#L157-L188 |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/AbstractJaxbMojo.java | AbstractJaxbMojo.warnAboutIncorrectPluginConfiguration | @SuppressWarnings("all")
protected void warnAboutIncorrectPluginConfiguration(final String propertyName, final String description) {
final StringBuilder builder = new StringBuilder();
builder.append("\n+=================== [Incorrect Plugin Configuration Detected]\n");
builder.append("|\n");
builder.append("| Property : " + propertyName + "\n");
builder.append("| Problem : " + description + "\n");
builder.append("|\n");
builder.append("+=================== [End Incorrect Plugin Configuration Detected]\n\n");
getLog().warn(builder.toString().replace("\n", NEWLINE));
} | java | @SuppressWarnings("all")
protected void warnAboutIncorrectPluginConfiguration(final String propertyName, final String description) {
final StringBuilder builder = new StringBuilder();
builder.append("\n+=================== [Incorrect Plugin Configuration Detected]\n");
builder.append("|\n");
builder.append("| Property : " + propertyName + "\n");
builder.append("| Problem : " + description + "\n");
builder.append("|\n");
builder.append("+=================== [End Incorrect Plugin Configuration Detected]\n\n");
getLog().warn(builder.toString().replace("\n", NEWLINE));
} | [
"@",
"SuppressWarnings",
"(",
"\"all\"",
")",
"protected",
"void",
"warnAboutIncorrectPluginConfiguration",
"(",
"final",
"String",
"propertyName",
",",
"final",
"String",
"description",
")",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
... | Convenience method to invoke when some plugin configuration is incorrect.
Will output the problem as a warning with some degree of log formatting.
@param propertyName The name of the problematic property.
@param description The problem description. | [
"Convenience",
"method",
"to",
"invoke",
"when",
"some",
"plugin",
"configuration",
"is",
"incorrect",
".",
"Will",
"output",
"the",
"problem",
"as",
"a",
"warning",
"with",
"some",
"degree",
"of",
"log",
"formatting",
"."
] | train | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/AbstractJaxbMojo.java#L417-L428 |
cubedtear/aritzh | aritzh-core/src/main/java/io/github/aritzhack/aritzh/util/IOUtil.java | IOUtil.getAppDir | public static File getAppDir(String name) throws IOException {
String s1 = System.getProperty("user.home", ".");
File file1;
switch (OSUtil.getOs()) {
case WINDOWS:
String s2 = System.getenv("APPDATA");
if (s2 != null) {
file1 = new File(s2, name + '/');
} else {
file1 = new File(s1, name + '/');
}
break;
case MACOS:
file1 = new File(s1, "Library/Application Support/" + name);
break;
default:
file1 = new File(s1, name + '/');
}
if (!file1.exists() && !file1.mkdirs()) {
throw new IOException("The working directory could not be created: " + file1);
} else {
return file1;
}
} | java | public static File getAppDir(String name) throws IOException {
String s1 = System.getProperty("user.home", ".");
File file1;
switch (OSUtil.getOs()) {
case WINDOWS:
String s2 = System.getenv("APPDATA");
if (s2 != null) {
file1 = new File(s2, name + '/');
} else {
file1 = new File(s1, name + '/');
}
break;
case MACOS:
file1 = new File(s1, "Library/Application Support/" + name);
break;
default:
file1 = new File(s1, name + '/');
}
if (!file1.exists() && !file1.mkdirs()) {
throw new IOException("The working directory could not be created: " + file1);
} else {
return file1;
}
} | [
"public",
"static",
"File",
"getAppDir",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"String",
"s1",
"=",
"System",
".",
"getProperty",
"(",
"\"user.home\"",
",",
"\".\"",
")",
";",
"File",
"file1",
";",
"switch",
"(",
"OSUtil",
".",
"getOs",... | Gets a folder to store application data, such as save or config files.
It will be located under:
<ul>
<li>In Windows: {@code %APPDATA%\name}, and if it fails, under {@code System.getProperty("user.home")\name}.</li>
<li>In OSX: under {@code System.getProperty("user.home")/Library/Application Support/name}.</li>
<li>In any other case: under {@code System.getProperty("user.home")/name}.</li>
</ul>
@param name The name of the folder (usually same as the name of the application).
@return A folder where you should save configs, saves, etc.
@throws java.io.IOException If folder did not exist, and could not be created. | [
"Gets",
"a",
"folder",
"to",
"store",
"application",
"data",
"such",
"as",
"save",
"or",
"config",
"files",
".",
"It",
"will",
"be",
"located",
"under",
":",
"<ul",
">",
"<li",
">",
"In",
"Windows",
":",
"{",
"@code",
"%APPDATA%",
"\\",
"name",
"}",
... | train | https://github.com/cubedtear/aritzh/blob/bc7493447a1a6088c4a7306ca4d0f0c20278364f/aritzh-core/src/main/java/io/github/aritzhack/aritzh/util/IOUtil.java#L140-L167 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/form/dropdown/OptGroupDropDownChoice.java | OptGroupDropDownChoice.appendOptGroupLabel | private void appendOptGroupLabel(final AppendingStringBuffer buffer, final T optGroup)
{
buffer.append("\n<optgroup label='")
.append(Strings.escapeMarkup(getOptGroupLabel(optGroup))).append("'>");
} | java | private void appendOptGroupLabel(final AppendingStringBuffer buffer, final T optGroup)
{
buffer.append("\n<optgroup label='")
.append(Strings.escapeMarkup(getOptGroupLabel(optGroup))).append("'>");
} | [
"private",
"void",
"appendOptGroupLabel",
"(",
"final",
"AppendingStringBuffer",
"buffer",
",",
"final",
"T",
"optGroup",
")",
"{",
"buffer",
".",
"append",
"(",
"\"\\n<optgroup label='\"",
")",
".",
"append",
"(",
"Strings",
".",
"escapeMarkup",
"(",
"getOptGroup... | Appends the label of the given opt group object to the given {@link AppendingStringBuffer}
object.
@param buffer
the buffer
@param optGroup
the opt group to append. | [
"Appends",
"the",
"label",
"of",
"the",
"given",
"opt",
"group",
"object",
"to",
"the",
"given",
"{",
"@link",
"AppendingStringBuffer",
"}",
"object",
"."
] | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/form/dropdown/OptGroupDropDownChoice.java#L193-L197 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/MapTileTransitionModel.java | MapTileTransitionModel.updateTile | private void updateTile(Collection<Tile> resolved,
Collection<Tile> toResolve,
Tile tile,
Tile neighbor,
Transition transition)
{
final Iterator<TileRef> iterator = getTiles(transition).iterator();
if (iterator.hasNext())
{
final TileRef ref = iterator.next();
final Tile newTile = map.createTile(ref.getSheet(), ref.getNumber(), neighbor.getX(), neighbor.getY());
map.setTile(newTile);
resolved.add(newTile);
}
else
{
final Tile newTile = map.createTile(tile.getSheet(), tile.getNumber(), neighbor.getX(), neighbor.getY());
final String groupA = mapGroup.getGroup(tile);
final String groupB = mapGroup.getGroup(neighbor);
// Used to fix transitions not found
if (!neighbor.equals(newTile)
&& (!isCenter(neighbor)
|| groupA.equals(groupB)
|| groupLinks.contains(new GroupTransition(groupA, groupB))))
{
map.setTile(newTile);
toResolve.add(newTile);
}
resolved.add(newTile);
}
} | java | private void updateTile(Collection<Tile> resolved,
Collection<Tile> toResolve,
Tile tile,
Tile neighbor,
Transition transition)
{
final Iterator<TileRef> iterator = getTiles(transition).iterator();
if (iterator.hasNext())
{
final TileRef ref = iterator.next();
final Tile newTile = map.createTile(ref.getSheet(), ref.getNumber(), neighbor.getX(), neighbor.getY());
map.setTile(newTile);
resolved.add(newTile);
}
else
{
final Tile newTile = map.createTile(tile.getSheet(), tile.getNumber(), neighbor.getX(), neighbor.getY());
final String groupA = mapGroup.getGroup(tile);
final String groupB = mapGroup.getGroup(neighbor);
// Used to fix transitions not found
if (!neighbor.equals(newTile)
&& (!isCenter(neighbor)
|| groupA.equals(groupB)
|| groupLinks.contains(new GroupTransition(groupA, groupB))))
{
map.setTile(newTile);
toResolve.add(newTile);
}
resolved.add(newTile);
}
} | [
"private",
"void",
"updateTile",
"(",
"Collection",
"<",
"Tile",
">",
"resolved",
",",
"Collection",
"<",
"Tile",
">",
"toResolve",
",",
"Tile",
"tile",
",",
"Tile",
"neighbor",
",",
"Transition",
"transition",
")",
"{",
"final",
"Iterator",
"<",
"TileRef",
... | Update tile.
@param resolved The resolved tiles.
@param toResolve Tiles to resolve after.
@param tile The tile placed.
@param neighbor The tile to update.
@param transition The transition to set. | [
"Update",
"tile",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/MapTileTransitionModel.java#L279-L310 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobInProgress.java | JobInProgress.obtainNewMapTask | public synchronized Task obtainNewMapTask(TaskTrackerStatus tts,
int clusterSize,
int numUniqueHosts
) throws IOException {
return obtainNewMapTask(tts, clusterSize, numUniqueHosts, anyCacheLevel);
} | java | public synchronized Task obtainNewMapTask(TaskTrackerStatus tts,
int clusterSize,
int numUniqueHosts
) throws IOException {
return obtainNewMapTask(tts, clusterSize, numUniqueHosts, anyCacheLevel);
} | [
"public",
"synchronized",
"Task",
"obtainNewMapTask",
"(",
"TaskTrackerStatus",
"tts",
",",
"int",
"clusterSize",
",",
"int",
"numUniqueHosts",
")",
"throws",
"IOException",
"{",
"return",
"obtainNewMapTask",
"(",
"tts",
",",
"clusterSize",
",",
"numUniqueHosts",
",... | Return a MapTask, if appropriate, to run on the given tasktracker | [
"Return",
"a",
"MapTask",
"if",
"appropriate",
"to",
"run",
"on",
"the",
"given",
"tasktracker"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobInProgress.java#L1390-L1395 |
ksclarke/freelib-utils | src/main/java/info/freelibrary/util/Logger.java | Logger.error | public void error(final Throwable aThrowable, final String aMessage) {
if (isErrorEnabled()) {
final MDCCloseable closeable = setLineNumber();
if (hasI18nKey(aMessage)) {
if (aThrowable != null) {
myLogger.error(getI18n(aMessage), aThrowable);
} else {
myLogger.error(getI18n(aMessage));
}
} else {
if (aThrowable != null) {
myLogger.error(aMessage, aThrowable);
} else {
myLogger.error(aMessage);
}
}
clearLineNumber(closeable);
}
} | java | public void error(final Throwable aThrowable, final String aMessage) {
if (isErrorEnabled()) {
final MDCCloseable closeable = setLineNumber();
if (hasI18nKey(aMessage)) {
if (aThrowable != null) {
myLogger.error(getI18n(aMessage), aThrowable);
} else {
myLogger.error(getI18n(aMessage));
}
} else {
if (aThrowable != null) {
myLogger.error(aMessage, aThrowable);
} else {
myLogger.error(aMessage);
}
}
clearLineNumber(closeable);
}
} | [
"public",
"void",
"error",
"(",
"final",
"Throwable",
"aThrowable",
",",
"final",
"String",
"aMessage",
")",
"{",
"if",
"(",
"isErrorEnabled",
"(",
")",
")",
"{",
"final",
"MDCCloseable",
"closeable",
"=",
"setLineNumber",
"(",
")",
";",
"if",
"(",
"hasI18... | A convenience method that uses an argument pattern with Throwable first.
@param aThrowable A throwable exception
@param aMessage A message with information about the exception | [
"A",
"convenience",
"method",
"that",
"uses",
"an",
"argument",
"pattern",
"with",
"Throwable",
"first",
"."
] | train | https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/Logger.java#L309-L329 |
vRallev/ECC-25519 | ECC-25519-Java/src/main/java/djb/Curve25519.java | Curve25519.divmod | private static final void divmod(byte[] q, byte[] r, int n, byte[] d, int t) {
int rn = 0;
int dt = ((d[t-1] & 0xFF) << 8);
if (t>1) {
dt |= (d[t-2] & 0xFF);
}
while (n-- >= t) {
int z = (rn << 16) | ((r[n] & 0xFF) << 8);
if (n>0) {
z |= (r[n-1] & 0xFF);
}
z/=dt;
rn += mula_small(r,r, n-t+1, d, t, -z);
q[n-t+1] = (byte)((z + rn) & 0xFF); /* rn is 0 or -1 (underflow) */
mula_small(r,r, n-t+1, d, t, -rn);
rn = (r[n] & 0xFF);
r[n] = 0;
}
r[t-1] = (byte)rn;
} | java | private static final void divmod(byte[] q, byte[] r, int n, byte[] d, int t) {
int rn = 0;
int dt = ((d[t-1] & 0xFF) << 8);
if (t>1) {
dt |= (d[t-2] & 0xFF);
}
while (n-- >= t) {
int z = (rn << 16) | ((r[n] & 0xFF) << 8);
if (n>0) {
z |= (r[n-1] & 0xFF);
}
z/=dt;
rn += mula_small(r,r, n-t+1, d, t, -z);
q[n-t+1] = (byte)((z + rn) & 0xFF); /* rn is 0 or -1 (underflow) */
mula_small(r,r, n-t+1, d, t, -rn);
rn = (r[n] & 0xFF);
r[n] = 0;
}
r[t-1] = (byte)rn;
} | [
"private",
"static",
"final",
"void",
"divmod",
"(",
"byte",
"[",
"]",
"q",
",",
"byte",
"[",
"]",
"r",
",",
"int",
"n",
",",
"byte",
"[",
"]",
"d",
",",
"int",
"t",
")",
"{",
"int",
"rn",
"=",
"0",
";",
"int",
"dt",
"=",
"(",
"(",
"d",
"... | /* divide r (size n) by d (size t), returning quotient q and remainder r
quotient is size n-t+1, remainder is size t
requires t > 0 && d[t-1] != 0
requires that r[-1] and d[-1] are valid memory locations
q may overlap with r+t | [
"/",
"*",
"divide",
"r",
"(",
"size",
"n",
")",
"by",
"d",
"(",
"size",
"t",
")",
"returning",
"quotient",
"q",
"and",
"remainder",
"r",
"quotient",
"is",
"size",
"n",
"-",
"t",
"+",
"1",
"remainder",
"is",
"size",
"t",
"requires",
"t",
">",
"0",... | train | https://github.com/vRallev/ECC-25519/blob/5c4297933aabfa4fbe7675e36d6d923ffd22e2cb/ECC-25519-Java/src/main/java/djb/Curve25519.java#L335-L354 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/interest/FactoryInterestPointAlgs.java | FactoryInterestPointAlgs.harrisPyramid | public static <T extends ImageGray<T>, D extends ImageGray<D>>
FeaturePyramid<T, D> harrisPyramid(int extractRadius,
float detectThreshold,
int maxFeatures,
Class<T> imageType,
Class<D> derivType) {
GradientCornerIntensity<D> harris = FactoryIntensityPointAlg.harris(extractRadius, 0.04f, false, derivType);
GeneralFeatureIntensity<T, D> intensity = new WrapperGradientCornerIntensity<>(harris);
NonMaxSuppression extractor = FactoryFeatureExtractor.nonmax(
new ConfigExtract(extractRadius, detectThreshold, extractRadius, true));
GeneralFeatureDetector<T, D> detector = new GeneralFeatureDetector<>(intensity, extractor);
detector.setMaxFeatures(maxFeatures);
AnyImageDerivative<T, D> deriv = GImageDerivativeOps.derivativeForScaleSpace(imageType, derivType);
return new FeaturePyramid<>(detector, deriv, 2);
} | java | public static <T extends ImageGray<T>, D extends ImageGray<D>>
FeaturePyramid<T, D> harrisPyramid(int extractRadius,
float detectThreshold,
int maxFeatures,
Class<T> imageType,
Class<D> derivType) {
GradientCornerIntensity<D> harris = FactoryIntensityPointAlg.harris(extractRadius, 0.04f, false, derivType);
GeneralFeatureIntensity<T, D> intensity = new WrapperGradientCornerIntensity<>(harris);
NonMaxSuppression extractor = FactoryFeatureExtractor.nonmax(
new ConfigExtract(extractRadius, detectThreshold, extractRadius, true));
GeneralFeatureDetector<T, D> detector = new GeneralFeatureDetector<>(intensity, extractor);
detector.setMaxFeatures(maxFeatures);
AnyImageDerivative<T, D> deriv = GImageDerivativeOps.derivativeForScaleSpace(imageType, derivType);
return new FeaturePyramid<>(detector, deriv, 2);
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
",",
"D",
"extends",
"ImageGray",
"<",
"D",
">",
">",
"FeaturePyramid",
"<",
"T",
",",
"D",
">",
"harrisPyramid",
"(",
"int",
"extractRadius",
",",
"float",
"detectThreshold",
",",
"int... | Creates a {@link FeaturePyramid} which is uses the Harris corner detector.
@param extractRadius Size of the feature used to detect the corners.
@param detectThreshold Minimum corner intensity required
@param maxFeatures Max number of features that can be found.
@param imageType Type of input image.
@param derivType Image derivative type.
@return CornerLaplaceScaleSpace | [
"Creates",
"a",
"{",
"@link",
"FeaturePyramid",
"}",
"which",
"is",
"uses",
"the",
"Harris",
"corner",
"detector",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/interest/FactoryInterestPointAlgs.java#L87-L103 |
getsentry/sentry-java | sentry/src/main/java/io/sentry/time/FixedClock.java | FixedClock.tick | public void tick(long duration, TimeUnit unit) {
this.date = new Date(date.getTime() + unit.toMillis(duration));
} | java | public void tick(long duration, TimeUnit unit) {
this.date = new Date(date.getTime() + unit.toMillis(duration));
} | [
"public",
"void",
"tick",
"(",
"long",
"duration",
",",
"TimeUnit",
"unit",
")",
"{",
"this",
".",
"date",
"=",
"new",
"Date",
"(",
"date",
".",
"getTime",
"(",
")",
"+",
"unit",
".",
"toMillis",
"(",
"duration",
")",
")",
";",
"}"
] | Adjust the FixedClock by the given amount.
@param duration Duration of time to adjust the clock by.
@param unit Unit of time to adjust the clock by. | [
"Adjust",
"the",
"FixedClock",
"by",
"the",
"given",
"amount",
"."
] | train | https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/time/FixedClock.java#L42-L44 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java | Activator.removeBean | public void removeBean(ContainerTx tx, BeanO bean)
{
bean.getActivationStrategy().atRemove(tx, bean);
} | java | public void removeBean(ContainerTx tx, BeanO bean)
{
bean.getActivationStrategy().atRemove(tx, bean);
} | [
"public",
"void",
"removeBean",
"(",
"ContainerTx",
"tx",
",",
"BeanO",
"bean",
")",
"{",
"bean",
".",
"getActivationStrategy",
"(",
")",
".",
"atRemove",
"(",
"tx",
",",
"bean",
")",
";",
"}"
] | Remove a bean from the cache. This method should be used to handle
situations where a bean goes bad.
<p>
@param tx The transaction from which to remove the bean
@param bean The bean to be removed | [
"Remove",
"a",
"bean",
"from",
"the",
"cache",
".",
"This",
"method",
"should",
"be",
"used",
"to",
"handle",
"situations",
"where",
"a",
"bean",
"goes",
"bad",
".",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java#L359-L362 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java | DiagnosticsInner.getSiteAnalysis | public DiagnosticAnalysisInner getSiteAnalysis(String resourceGroupName, String siteName, String diagnosticCategory, String analysisName) {
return getSiteAnalysisWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, analysisName).toBlocking().single().body();
} | java | public DiagnosticAnalysisInner getSiteAnalysis(String resourceGroupName, String siteName, String diagnosticCategory, String analysisName) {
return getSiteAnalysisWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, analysisName).toBlocking().single().body();
} | [
"public",
"DiagnosticAnalysisInner",
"getSiteAnalysis",
"(",
"String",
"resourceGroupName",
",",
"String",
"siteName",
",",
"String",
"diagnosticCategory",
",",
"String",
"analysisName",
")",
"{",
"return",
"getSiteAnalysisWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Get Site Analysis.
Get Site Analysis.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Site Name
@param diagnosticCategory Diagnostic Category
@param analysisName Analysis Name
@throws IllegalArgumentException thrown if parameters fail the validation
@throws DefaultErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DiagnosticAnalysisInner object if successful. | [
"Get",
"Site",
"Analysis",
".",
"Get",
"Site",
"Analysis",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L534-L536 |
michael-rapp/AndroidPreferenceActivity | library/src/main/java/de/mrapp/android/preference/activity/adapter/NavigationPreferenceAdapter.java | NavigationPreferenceAdapter.createAdapterDataObserver | @NonNull
private RecyclerView.AdapterDataObserver createAdapterDataObserver() {
return new RecyclerView.AdapterDataObserver() {
@Override
public void onChanged() {
super.onChanged();
updateNavigationPreferences();
}
@Override
public void onItemRangeChanged(final int positionStart, final int itemCount) {
super.onItemRangeChanged(positionStart, itemCount);
updateNavigationPreferences();
}
@Override
public void onItemRangeChanged(final int positionStart, final int itemCount,
@Nullable final Object payload) {
super.onItemRangeChanged(positionStart, itemCount, payload);
updateNavigationPreferences();
}
@Override
public void onItemRangeInserted(final int positionStart, final int itemCount) {
super.onItemRangeInserted(positionStart, itemCount);
updateNavigationPreferences();
}
@Override
public void onItemRangeRemoved(final int positionStart, final int itemCount) {
super.onItemRangeRemoved(positionStart, itemCount);
updateNavigationPreferences();
}
@Override
public void onItemRangeMoved(final int fromPosition, final int toPosition,
final int itemCount) {
super.onItemRangeMoved(fromPosition, toPosition, itemCount);
updateNavigationPreferences();
}
};
} | java | @NonNull
private RecyclerView.AdapterDataObserver createAdapterDataObserver() {
return new RecyclerView.AdapterDataObserver() {
@Override
public void onChanged() {
super.onChanged();
updateNavigationPreferences();
}
@Override
public void onItemRangeChanged(final int positionStart, final int itemCount) {
super.onItemRangeChanged(positionStart, itemCount);
updateNavigationPreferences();
}
@Override
public void onItemRangeChanged(final int positionStart, final int itemCount,
@Nullable final Object payload) {
super.onItemRangeChanged(positionStart, itemCount, payload);
updateNavigationPreferences();
}
@Override
public void onItemRangeInserted(final int positionStart, final int itemCount) {
super.onItemRangeInserted(positionStart, itemCount);
updateNavigationPreferences();
}
@Override
public void onItemRangeRemoved(final int positionStart, final int itemCount) {
super.onItemRangeRemoved(positionStart, itemCount);
updateNavigationPreferences();
}
@Override
public void onItemRangeMoved(final int fromPosition, final int toPosition,
final int itemCount) {
super.onItemRangeMoved(fromPosition, toPosition, itemCount);
updateNavigationPreferences();
}
};
} | [
"@",
"NonNull",
"private",
"RecyclerView",
".",
"AdapterDataObserver",
"createAdapterDataObserver",
"(",
")",
"{",
"return",
"new",
"RecyclerView",
".",
"AdapterDataObserver",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onChanged",
"(",
")",
"{",
"super",
... | Creates and returns a data observer, which allows to adapt the navigation preferences, when
the adapter's underlying data has been changed.
@return The data observer, which has been created, as an instance of the class {@link
RecyclerView.AdapterDataObserver}. The data observer may not be null | [
"Creates",
"and",
"returns",
"a",
"data",
"observer",
"which",
"allows",
"to",
"adapt",
"the",
"navigation",
"preferences",
"when",
"the",
"adapter",
"s",
"underlying",
"data",
"has",
"been",
"changed",
"."
] | train | https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/adapter/NavigationPreferenceAdapter.java#L254-L297 |
micronaut-projects/micronaut-core | runtime/src/main/java/io/micronaut/discovery/cloud/ComputeInstanceMetadataResolverUtils.java | ComputeInstanceMetadataResolverUtils.populateMetadata | public static void populateMetadata(AbstractComputeInstanceMetadata instanceMetadata, Map<?, ?> metadata) {
if (metadata != null) {
Map<String, String> finalMetadata = new HashMap<>(metadata.size());
for (Map.Entry<?, ?> entry : metadata.entrySet()) {
Object key = entry.getKey();
Object value = entry.getValue();
if (value instanceof String) {
finalMetadata.put(key.toString(), value.toString());
}
}
instanceMetadata.setMetadata(finalMetadata);
}
} | java | public static void populateMetadata(AbstractComputeInstanceMetadata instanceMetadata, Map<?, ?> metadata) {
if (metadata != null) {
Map<String, String> finalMetadata = new HashMap<>(metadata.size());
for (Map.Entry<?, ?> entry : metadata.entrySet()) {
Object key = entry.getKey();
Object value = entry.getValue();
if (value instanceof String) {
finalMetadata.put(key.toString(), value.toString());
}
}
instanceMetadata.setMetadata(finalMetadata);
}
} | [
"public",
"static",
"void",
"populateMetadata",
"(",
"AbstractComputeInstanceMetadata",
"instanceMetadata",
",",
"Map",
"<",
"?",
",",
"?",
">",
"metadata",
")",
"{",
"if",
"(",
"metadata",
"!=",
"null",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
... | Populates the instance instance metadata's {@link AbstractComputeInstanceMetadata#setMetadata(Map)} property.
@param instanceMetadata The instance metadata
@param metadata A map of metadata | [
"Populates",
"the",
"instance",
"instance",
"metadata",
"s",
"{"
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/runtime/src/main/java/io/micronaut/discovery/cloud/ComputeInstanceMetadataResolverUtils.java#L89-L101 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/OutputPropertyUtils.java | OutputPropertyUtils.getBooleanProperty | public static boolean getBooleanProperty(String key, Properties props)
{
String s = props.getProperty(key);
if (null == s || !s.equals("yes"))
return false;
else
return true;
} | java | public static boolean getBooleanProperty(String key, Properties props)
{
String s = props.getProperty(key);
if (null == s || !s.equals("yes"))
return false;
else
return true;
} | [
"public",
"static",
"boolean",
"getBooleanProperty",
"(",
"String",
"key",
",",
"Properties",
"props",
")",
"{",
"String",
"s",
"=",
"props",
".",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"null",
"==",
"s",
"||",
"!",
"s",
".",
"equals",
"(",
... | Searches for the boolean property with the specified key in the property list.
If the key is not found in this property list, the default property list,
and its defaults, recursively, are then checked. The method returns
<code>false</code> if the property is not found, or if the value is other
than "yes".
@param key the property key.
@param props the list of properties that will be searched.
@return the value in this property list as a boolean value, or false
if null or not "yes". | [
"Searches",
"for",
"the",
"boolean",
"property",
"with",
"the",
"specified",
"key",
"in",
"the",
"property",
"list",
".",
"If",
"the",
"key",
"is",
"not",
"found",
"in",
"this",
"property",
"list",
"the",
"default",
"property",
"list",
"and",
"its",
"defau... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/OutputPropertyUtils.java#L49-L58 |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/TaskTable.java | TaskTable.updatePattern | public boolean updatePattern(String id, CronPattern pattern) {
final Lock writeLock = lock.writeLock();
try {
writeLock.lock();
final int index = ids.indexOf(id);
if (index > -1) {
patterns.set(index, pattern);
return true;
}
} finally {
writeLock.unlock();
}
return false;
} | java | public boolean updatePattern(String id, CronPattern pattern) {
final Lock writeLock = lock.writeLock();
try {
writeLock.lock();
final int index = ids.indexOf(id);
if (index > -1) {
patterns.set(index, pattern);
return true;
}
} finally {
writeLock.unlock();
}
return false;
} | [
"public",
"boolean",
"updatePattern",
"(",
"String",
"id",
",",
"CronPattern",
"pattern",
")",
"{",
"final",
"Lock",
"writeLock",
"=",
"lock",
".",
"writeLock",
"(",
")",
";",
"try",
"{",
"writeLock",
".",
"lock",
"(",
")",
";",
"final",
"int",
"index",
... | 更新某个Task的定时规则
@param id Task的ID
@param pattern 新的表达式
@return 是否更新成功,如果id对应的规则不存在则不更新
@since 4.0.10 | [
"更新某个Task的定时规则"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/TaskTable.java#L96-L109 |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java | ResultInterpreter.addMediaTypes | private void addMediaTypes(final MethodResult methodResult, final ClassResult classResult, final ResourceMethod resourceMethod) {
// accept media types -> inherit
resourceMethod.getRequestMediaTypes().addAll(methodResult.getRequestMediaTypes());
if (resourceMethod.getRequestMediaTypes().isEmpty()) {
resourceMethod.getRequestMediaTypes().addAll(classResult.getRequestMediaTypes());
}
// response media types -> use annotations if not yet present
if (resourceMethod.getResponseMediaTypes().isEmpty())
resourceMethod.getResponseMediaTypes().addAll(methodResult.getResponseMediaTypes());
// -> inherit
if (resourceMethod.getResponseMediaTypes().isEmpty()) {
resourceMethod.getResponseMediaTypes().addAll(classResult.getResponseMediaTypes());
}
} | java | private void addMediaTypes(final MethodResult methodResult, final ClassResult classResult, final ResourceMethod resourceMethod) {
// accept media types -> inherit
resourceMethod.getRequestMediaTypes().addAll(methodResult.getRequestMediaTypes());
if (resourceMethod.getRequestMediaTypes().isEmpty()) {
resourceMethod.getRequestMediaTypes().addAll(classResult.getRequestMediaTypes());
}
// response media types -> use annotations if not yet present
if (resourceMethod.getResponseMediaTypes().isEmpty())
resourceMethod.getResponseMediaTypes().addAll(methodResult.getResponseMediaTypes());
// -> inherit
if (resourceMethod.getResponseMediaTypes().isEmpty()) {
resourceMethod.getResponseMediaTypes().addAll(classResult.getResponseMediaTypes());
}
} | [
"private",
"void",
"addMediaTypes",
"(",
"final",
"MethodResult",
"methodResult",
",",
"final",
"ClassResult",
"classResult",
",",
"final",
"ResourceMethod",
"resourceMethod",
")",
"{",
"// accept media types -> inherit",
"resourceMethod",
".",
"getRequestMediaTypes",
"(",
... | Adds the request and response media type information to the resource method.
@param methodResult The method result
@param classResult The class result
@param resourceMethod The resource method | [
"Adds",
"the",
"request",
"and",
"response",
"media",
"type",
"information",
"to",
"the",
"resource",
"method",
"."
] | train | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java#L240-L254 |
premium-minds/pm-wicket-utils | src/main/java/com/premiumminds/webapp/wicket/drawer/DrawerManager.java | DrawerManager.replaceLast | public void replaceLast(AbstractDrawer newDrawer, AjaxRequestTarget target) {
if (!drawers.isEmpty()) {
ListItem last = drawers.getFirst();
last.drawer.replaceWith(newDrawer);
last.drawer = newDrawer;
newDrawer.setManager(this);
target.add(newDrawer);
}
} | java | public void replaceLast(AbstractDrawer newDrawer, AjaxRequestTarget target) {
if (!drawers.isEmpty()) {
ListItem last = drawers.getFirst();
last.drawer.replaceWith(newDrawer);
last.drawer = newDrawer;
newDrawer.setManager(this);
target.add(newDrawer);
}
} | [
"public",
"void",
"replaceLast",
"(",
"AbstractDrawer",
"newDrawer",
",",
"AjaxRequestTarget",
"target",
")",
"{",
"if",
"(",
"!",
"drawers",
".",
"isEmpty",
"(",
")",
")",
"{",
"ListItem",
"last",
"=",
"drawers",
".",
"getFirst",
"(",
")",
";",
"last",
... | Replaces the topmost open drawer with a new one. If there is no open drawer, this method does nothing.
This method requires an AJAX request. DrawerManager does not support swapping drawers during page construction.
@param newDrawer
The new drawer to open. Cannot be null.
@param target
The current AJAX target. Cannot be null. | [
"Replaces",
"the",
"topmost",
"open",
"drawer",
"with",
"a",
"new",
"one",
".",
"If",
"there",
"is",
"no",
"open",
"drawer",
"this",
"method",
"does",
"nothing",
".",
"This",
"method",
"requires",
"an",
"AJAX",
"request",
".",
"DrawerManager",
"does",
"not... | train | https://github.com/premium-minds/pm-wicket-utils/blob/ed28f4bfb2084dfb2649d9fa283754cb76894d2d/src/main/java/com/premiumminds/webapp/wicket/drawer/DrawerManager.java#L220-L228 |
zeroturnaround/zt-exec | src/main/java/org/zeroturnaround/exec/stream/PumpStreamHandler.java | PumpStreamHandler.createPump | protected Thread createPump(InputStream is, OutputStream os) {
return createPump(is, os, false, false);
} | java | protected Thread createPump(InputStream is, OutputStream os) {
return createPump(is, os, false, false);
} | [
"protected",
"Thread",
"createPump",
"(",
"InputStream",
"is",
",",
"OutputStream",
"os",
")",
"{",
"return",
"createPump",
"(",
"is",
",",
"os",
",",
"false",
",",
"false",
")",
";",
"}"
] | Creates a stream pumper to copy the given input stream to the given
output stream.
@param is the input stream to copy from
@param os the output stream to copy into
@return the stream pumper thread | [
"Creates",
"a",
"stream",
"pumper",
"to",
"copy",
"the",
"given",
"input",
"stream",
"to",
"the",
"given",
"output",
"stream",
"."
] | train | https://github.com/zeroturnaround/zt-exec/blob/6c3b93b99bf3c69c9f41d6350bf7707005b6a4cd/src/main/java/org/zeroturnaround/exec/stream/PumpStreamHandler.java#L311-L313 |
rollbar/rollbar-java | rollbar-android/src/main/java/com/rollbar/android/Rollbar.java | Rollbar.setPersonData | public void setPersonData(final String id, final String username, final String email) {
this.rollbar.configure(new ConfigProvider() {
@Override
public Config provide(ConfigBuilder builder) {
return builder
.person(new PersonProvider(id, username, email))
.build();
}
});
} | java | public void setPersonData(final String id, final String username, final String email) {
this.rollbar.configure(new ConfigProvider() {
@Override
public Config provide(ConfigBuilder builder) {
return builder
.person(new PersonProvider(id, username, email))
.build();
}
});
} | [
"public",
"void",
"setPersonData",
"(",
"final",
"String",
"id",
",",
"final",
"String",
"username",
",",
"final",
"String",
"email",
")",
"{",
"this",
".",
"rollbar",
".",
"configure",
"(",
"new",
"ConfigProvider",
"(",
")",
"{",
"@",
"Override",
"public"... | Set the person data to include with future items.
@param id an identifier for this user.
@param username the username of the user.
@param email the email of this user. | [
"Set",
"the",
"person",
"data",
"to",
"include",
"with",
"future",
"items",
"."
] | train | https://github.com/rollbar/rollbar-java/blob/5eb4537d1363722b51cfcce55b427cbd8489f17b/rollbar-android/src/main/java/com/rollbar/android/Rollbar.java#L301-L310 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/server/smile/SmileCodec.java | SmileCodec.fromSmile | public T fromSmile(byte[] bytes)
throws IllegalArgumentException
{
try {
return mapper.readValue(bytes, javaType);
}
catch (IOException e) {
throw new IllegalArgumentException(format("Invalid SMILE bytes for %s", javaType), e);
}
} | java | public T fromSmile(byte[] bytes)
throws IllegalArgumentException
{
try {
return mapper.readValue(bytes, javaType);
}
catch (IOException e) {
throw new IllegalArgumentException(format("Invalid SMILE bytes for %s", javaType), e);
}
} | [
"public",
"T",
"fromSmile",
"(",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"IllegalArgumentException",
"{",
"try",
"{",
"return",
"mapper",
".",
"readValue",
"(",
"bytes",
",",
"javaType",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw... | Converts the specified smile bytes (UTF-8) into an instance of type T.
@param bytes the bytes (UTF-8) to parse
@return parsed response; never null
@throws IllegalArgumentException if the bytes bytes can not be converted to the type T | [
"Converts",
"the",
"specified",
"smile",
"bytes",
"(",
"UTF",
"-",
"8",
")",
"into",
"an",
"instance",
"of",
"type",
"T",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/server/smile/SmileCodec.java#L127-L136 |
paymill/paymill-java | src/main/java/com/paymill/services/PreauthorizationService.java | PreauthorizationService.createWithToken | public Preauthorization createWithToken( final String token, final Integer amount, final String currency ) {
return this.createWithToken( token, amount, currency, null );
} | java | public Preauthorization createWithToken( final String token, final Integer amount, final String currency ) {
return this.createWithToken( token, amount, currency, null );
} | [
"public",
"Preauthorization",
"createWithToken",
"(",
"final",
"String",
"token",
",",
"final",
"Integer",
"amount",
",",
"final",
"String",
"currency",
")",
"{",
"return",
"this",
".",
"createWithToken",
"(",
"token",
",",
"amount",
",",
"currency",
",",
"nul... | Creates Use either a token or an existing payment to Authorizes the given amount with the given token.
@param token
The identifier of a token.
@param amount
Amount (in cents) which will be charged.
@param currency
ISO 4217 formatted currency code.
@return {@link Transaction} object with the {@link Preauthorization} as sub object. | [
"Creates",
"Use",
"either",
"a",
"token",
"or",
"an",
"existing",
"payment",
"to",
"Authorizes",
"the",
"given",
"amount",
"with",
"the",
"given",
"token",
"."
] | train | https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/PreauthorizationService.java#L109-L111 |
netty/netty | common/src/main/java/io/netty/util/internal/PlatformDependent.java | PlatformDependent.hashCodeAsciiSanitizeShort | private static int hashCodeAsciiSanitizeShort(CharSequence value, int offset) {
if (BIG_ENDIAN_NATIVE_ORDER) {
// mimic a unsafe.getShort call on a big endian machine
return (value.charAt(offset + 1) & 0x1f) |
(value.charAt(offset) & 0x1f) << 8;
}
return (value.charAt(offset + 1) & 0x1f) << 8 |
(value.charAt(offset) & 0x1f);
} | java | private static int hashCodeAsciiSanitizeShort(CharSequence value, int offset) {
if (BIG_ENDIAN_NATIVE_ORDER) {
// mimic a unsafe.getShort call on a big endian machine
return (value.charAt(offset + 1) & 0x1f) |
(value.charAt(offset) & 0x1f) << 8;
}
return (value.charAt(offset + 1) & 0x1f) << 8 |
(value.charAt(offset) & 0x1f);
} | [
"private",
"static",
"int",
"hashCodeAsciiSanitizeShort",
"(",
"CharSequence",
"value",
",",
"int",
"offset",
")",
"{",
"if",
"(",
"BIG_ENDIAN_NATIVE_ORDER",
")",
"{",
"// mimic a unsafe.getShort call on a big endian machine",
"return",
"(",
"value",
".",
"charAt",
"(",... | Identical to {@link PlatformDependent0#hashCodeAsciiSanitize(short)} but for {@link CharSequence}. | [
"Identical",
"to",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/PlatformDependent.java#L538-L546 |
gsi-upm/Shanks | shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/movement/Location.java | Location.isNearTo | public boolean isNearTo(Double3D location, double distance) {
if (this.is3DLocation()) {
return this.getLocation3D().distance(location) < distance;
} else {
return false;
}
} | java | public boolean isNearTo(Double3D location, double distance) {
if (this.is3DLocation()) {
return this.getLocation3D().distance(location) < distance;
} else {
return false;
}
} | [
"public",
"boolean",
"isNearTo",
"(",
"Double3D",
"location",
",",
"double",
"distance",
")",
"{",
"if",
"(",
"this",
".",
"is3DLocation",
"(",
")",
")",
"{",
"return",
"this",
".",
"getLocation3D",
"(",
")",
".",
"distance",
"(",
"location",
")",
"<",
... | Compare two locations and return if the locations are near or not
@param location Location to compare with
@param distance The distance between two locations
@return true is the real distance is lower or equals than the distance parameter | [
"Compare",
"two",
"locations",
"and",
"return",
"if",
"the",
"locations",
"are",
"near",
"or",
"not"
] | train | https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/movement/Location.java#L168-L174 |
santhosh-tekuri/jlibs | core/src/main/java/jlibs/core/lang/BeanUtil.java | BeanUtil.getProperty | @SuppressWarnings({"unchecked"})
public static <T> T getProperty(Object bean, String property) throws InvocationTargetException{
try{
return (T)getGetterMethod(bean.getClass(), property).invoke(bean);
}catch(IllegalAccessException ex){
throw new ImpossibleException(ex); // because getter method is public
}
} | java | @SuppressWarnings({"unchecked"})
public static <T> T getProperty(Object bean, String property) throws InvocationTargetException{
try{
return (T)getGetterMethod(bean.getClass(), property).invoke(bean);
}catch(IllegalAccessException ex){
throw new ImpossibleException(ex); // because getter method is public
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
"}",
")",
"public",
"static",
"<",
"T",
">",
"T",
"getProperty",
"(",
"Object",
"bean",
",",
"String",
"property",
")",
"throws",
"InvocationTargetException",
"{",
"try",
"{",
"return",
"(",
"T",
")",
"ge... | Returns the value of the specified <code>property</code> in given <code>bean</code>
@param bean bean object
@param property property name whose value needs to be returned
@return value of the property.
@throws InvocationTargetException if method invocation fails
@throws NullPointerException if <code>property</code> is not found in <code>bean</code> | [
"Returns",
"the",
"value",
"of",
"the",
"specified",
"<code",
">",
"property<",
"/",
"code",
">",
"in",
"given",
"<code",
">",
"bean<",
"/",
"code",
">"
] | train | https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/BeanUtil.java#L205-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.listHierarchicalEntitiesWithServiceResponseAsync | public Observable<ServiceResponse<List<HierarchicalEntityExtractor>>> listHierarchicalEntitiesWithServiceResponseAsync(UUID appId, String versionId, ListHierarchicalEntitiesOptionalParameter listHierarchicalEntitiesOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
final Integer skip = listHierarchicalEntitiesOptionalParameter != null ? listHierarchicalEntitiesOptionalParameter.skip() : null;
final Integer take = listHierarchicalEntitiesOptionalParameter != null ? listHierarchicalEntitiesOptionalParameter.take() : null;
return listHierarchicalEntitiesWithServiceResponseAsync(appId, versionId, skip, take);
} | java | public Observable<ServiceResponse<List<HierarchicalEntityExtractor>>> listHierarchicalEntitiesWithServiceResponseAsync(UUID appId, String versionId, ListHierarchicalEntitiesOptionalParameter listHierarchicalEntitiesOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
final Integer skip = listHierarchicalEntitiesOptionalParameter != null ? listHierarchicalEntitiesOptionalParameter.skip() : null;
final Integer take = listHierarchicalEntitiesOptionalParameter != null ? listHierarchicalEntitiesOptionalParameter.take() : null;
return listHierarchicalEntitiesWithServiceResponseAsync(appId, versionId, skip, take);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"List",
"<",
"HierarchicalEntityExtractor",
">",
">",
">",
"listHierarchicalEntitiesWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"ListHierarchicalEntitiesOptionalParameter",
"listHierarc... | Gets information about the hierarchical entity models.
@param appId The application ID.
@param versionId The version ID.
@param listHierarchicalEntitiesOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<HierarchicalEntityExtractor> object | [
"Gets",
"information",
"about",
"the",
"hierarchical",
"entity",
"models",
"."
] | 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#L1418-L1432 |
JodaOrg/joda-time | src/main/java/org/joda/time/DateMidnight.java | DateMidnight.withZoneRetainFields | public DateMidnight withZoneRetainFields(DateTimeZone newZone) {
newZone = DateTimeUtils.getZone(newZone);
DateTimeZone originalZone = DateTimeUtils.getZone(getZone());
if (newZone == originalZone) {
return this;
}
long millis = originalZone.getMillisKeepLocal(newZone, getMillis());
return new DateMidnight(millis, getChronology().withZone(newZone));
} | java | public DateMidnight withZoneRetainFields(DateTimeZone newZone) {
newZone = DateTimeUtils.getZone(newZone);
DateTimeZone originalZone = DateTimeUtils.getZone(getZone());
if (newZone == originalZone) {
return this;
}
long millis = originalZone.getMillisKeepLocal(newZone, getMillis());
return new DateMidnight(millis, getChronology().withZone(newZone));
} | [
"public",
"DateMidnight",
"withZoneRetainFields",
"(",
"DateTimeZone",
"newZone",
")",
"{",
"newZone",
"=",
"DateTimeUtils",
".",
"getZone",
"(",
"newZone",
")",
";",
"DateTimeZone",
"originalZone",
"=",
"DateTimeUtils",
".",
"getZone",
"(",
"getZone",
"(",
")",
... | Returns a copy of this date with a different time zone, preserving the day
The returned object will have a local time of midnight in the new zone on
the same day as the original instant.
@param newZone the new time zone, null means default
@return a copy of this instant with a different time zone | [
"Returns",
"a",
"copy",
"of",
"this",
"date",
"with",
"a",
"different",
"time",
"zone",
"preserving",
"the",
"day",
"The",
"returned",
"object",
"will",
"have",
"a",
"local",
"time",
"of",
"midnight",
"in",
"the",
"new",
"zone",
"on",
"the",
"same",
"day... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/DateMidnight.java#L414-L423 |
Netflix/Nicobar | nicobar-core/src/main/java/com/netflix/nicobar/core/utils/ClassPathUtils.java | ClassPathUtils.scanClassPathWithIncludes | public static Set<String> scanClassPathWithIncludes(final String classPath, final Set<String> excludeJarSet, final Set<String> includePrefixes) {
final Set<String> pathSet = new HashSet<String>();
// Defer to JDKPaths to do the actual classpath scanning.
__JDKPaths.processClassPathItem(classPath, excludeJarSet, pathSet);
return filterPathSet(pathSet, Collections.<String>emptySet(), includePrefixes);
} | java | public static Set<String> scanClassPathWithIncludes(final String classPath, final Set<String> excludeJarSet, final Set<String> includePrefixes) {
final Set<String> pathSet = new HashSet<String>();
// Defer to JDKPaths to do the actual classpath scanning.
__JDKPaths.processClassPathItem(classPath, excludeJarSet, pathSet);
return filterPathSet(pathSet, Collections.<String>emptySet(), includePrefixes);
} | [
"public",
"static",
"Set",
"<",
"String",
">",
"scanClassPathWithIncludes",
"(",
"final",
"String",
"classPath",
",",
"final",
"Set",
"<",
"String",
">",
"excludeJarSet",
",",
"final",
"Set",
"<",
"String",
">",
"includePrefixes",
")",
"{",
"final",
"Set",
"... | Scan the classpath string provided, and collect a set of package paths found in jars and classes on the path,
including only those that match a set of include prefixes.
@param classPath the classpath string
@param excludeJarSet a set of jars to exclude from scanning
@param includePrefixes a set of path prefixes that determine what is included
@return the results of the scan, as a set of package paths (separated by '/'). | [
"Scan",
"the",
"classpath",
"string",
"provided",
"and",
"collect",
"a",
"set",
"of",
"package",
"paths",
"found",
"in",
"jars",
"and",
"classes",
"on",
"the",
"path",
"including",
"only",
"those",
"that",
"match",
"a",
"set",
"of",
"include",
"prefixes",
... | train | https://github.com/Netflix/Nicobar/blob/507173dcae4a86a955afc3df222a855862fab8d7/nicobar-core/src/main/java/com/netflix/nicobar/core/utils/ClassPathUtils.java#L233-L239 |
Harium/keel | src/main/java/com/harium/keel/catalano/statistics/HistogramStatistics.java | HistogramStatistics.Skewness | public static double Skewness(int[] values, double mean, double stdDeviation){
double n = 0;
for (int i = 0; i < values.length; i++)
n += values[i];
double part1 = n / (n - 1) * (n - 2);
double part2 = 0;
for (int i = 0; i < values.length; i++) {
part2 += Math.pow((i - mean) / stdDeviation, 3) * values[i];
}
return part1 * part2;
} | java | public static double Skewness(int[] values, double mean, double stdDeviation){
double n = 0;
for (int i = 0; i < values.length; i++)
n += values[i];
double part1 = n / (n - 1) * (n - 2);
double part2 = 0;
for (int i = 0; i < values.length; i++) {
part2 += Math.pow((i - mean) / stdDeviation, 3) * values[i];
}
return part1 * part2;
} | [
"public",
"static",
"double",
"Skewness",
"(",
"int",
"[",
"]",
"values",
",",
"double",
"mean",
",",
"double",
"stdDeviation",
")",
"{",
"double",
"n",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"values",
".",
"length",
";",
... | Calculate Skewness value.
@param values Values.
@param mean Specified mean.
@param stdDeviation Specified standard deviation.
@return Returns skewness value of the specified histogram array. | [
"Calculate",
"Skewness",
"value",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/statistics/HistogramStatistics.java#L233-L246 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.