repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
resilience4j/resilience4j | resilience4j-metrics/src/main/java/io/github/resilience4j/metrics/RateLimiterMetrics.java | RateLimiterMetrics.ofRateLimiterRegistry | public static RateLimiterMetrics ofRateLimiterRegistry(String prefix, RateLimiterRegistry rateLimiterRegistry) {
"""
Creates a new instance {@link RateLimiterMetrics} with specified metrics names prefix and
a {@link RateLimiterRegistry} as a source.
@param prefix the prefix of metrics names
@param rateLimiterRegistry the registry of rate limiters
"""
return new RateLimiterMetrics(prefix, rateLimiterRegistry.getAllRateLimiters());
} | java | public static RateLimiterMetrics ofRateLimiterRegistry(String prefix, RateLimiterRegistry rateLimiterRegistry) {
return new RateLimiterMetrics(prefix, rateLimiterRegistry.getAllRateLimiters());
} | [
"public",
"static",
"RateLimiterMetrics",
"ofRateLimiterRegistry",
"(",
"String",
"prefix",
",",
"RateLimiterRegistry",
"rateLimiterRegistry",
")",
"{",
"return",
"new",
"RateLimiterMetrics",
"(",
"prefix",
",",
"rateLimiterRegistry",
".",
"getAllRateLimiters",
"(",
")",
")",
";",
"}"
] | Creates a new instance {@link RateLimiterMetrics} with specified metrics names prefix and
a {@link RateLimiterRegistry} as a source.
@param prefix the prefix of metrics names
@param rateLimiterRegistry the registry of rate limiters | [
"Creates",
"a",
"new",
"instance",
"{",
"@link",
"RateLimiterMetrics",
"}",
"with",
"specified",
"metrics",
"names",
"prefix",
"and",
"a",
"{",
"@link",
"RateLimiterRegistry",
"}",
"as",
"a",
"source",
"."
] | train | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-metrics/src/main/java/io/github/resilience4j/metrics/RateLimiterMetrics.java#L72-L74 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/db/DBService.java | DBService.getColumnSlice | public Iterable<DColumn> getColumnSlice(String storeName, String rowKey, String startCol, String endCol) {
"""
Get columns for the row with the given key in the given store. Columns range
is defined by an interval [startCol, endCol]. Columns are returned
as an Iterator of {@link DColumn}s. Empty iterator is returned if no row
is found with the given key or no columns in the given interval found.
@param storeName Name of store to query.
@param rowKey Key of row to fetch.
@param startCol First name in the column names interval.
@param endCol Last name in the column names interval.
@return Iterator of {@link DColumn}s. If there is no such row, the
iterator's hasNext() will be false.
"""
DRow row = new DRow(m_tenant, storeName, rowKey);
return row.getColumns(startCol, endCol, 1024);
} | java | public Iterable<DColumn> getColumnSlice(String storeName, String rowKey, String startCol, String endCol) {
DRow row = new DRow(m_tenant, storeName, rowKey);
return row.getColumns(startCol, endCol, 1024);
} | [
"public",
"Iterable",
"<",
"DColumn",
">",
"getColumnSlice",
"(",
"String",
"storeName",
",",
"String",
"rowKey",
",",
"String",
"startCol",
",",
"String",
"endCol",
")",
"{",
"DRow",
"row",
"=",
"new",
"DRow",
"(",
"m_tenant",
",",
"storeName",
",",
"rowKey",
")",
";",
"return",
"row",
".",
"getColumns",
"(",
"startCol",
",",
"endCol",
",",
"1024",
")",
";",
"}"
] | Get columns for the row with the given key in the given store. Columns range
is defined by an interval [startCol, endCol]. Columns are returned
as an Iterator of {@link DColumn}s. Empty iterator is returned if no row
is found with the given key or no columns in the given interval found.
@param storeName Name of store to query.
@param rowKey Key of row to fetch.
@param startCol First name in the column names interval.
@param endCol Last name in the column names interval.
@return Iterator of {@link DColumn}s. If there is no such row, the
iterator's hasNext() will be false. | [
"Get",
"columns",
"for",
"the",
"row",
"with",
"the",
"given",
"key",
"in",
"the",
"given",
"store",
".",
"Columns",
"range",
"is",
"defined",
"by",
"an",
"interval",
"[",
"startCol",
"endCol",
"]",
".",
"Columns",
"are",
"returned",
"as",
"an",
"Iterator",
"of",
"{",
"@link",
"DColumn",
"}",
"s",
".",
"Empty",
"iterator",
"is",
"returned",
"if",
"no",
"row",
"is",
"found",
"with",
"the",
"given",
"key",
"or",
"no",
"columns",
"in",
"the",
"given",
"interval",
"found",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/DBService.java#L258-L261 |
apptik/JustJson | json-core/src/main/java/io/apptik/json/JsonObject.java | JsonObject.put | public JsonObject put(String name, boolean value) throws JsonException {
"""
Maps {@code name} to {@code value}, clobbering any existing name/value
mapping with the same name.
@return this object.
"""
return put(name, new JsonBoolean(value));
} | java | public JsonObject put(String name, boolean value) throws JsonException {
return put(name, new JsonBoolean(value));
} | [
"public",
"JsonObject",
"put",
"(",
"String",
"name",
",",
"boolean",
"value",
")",
"throws",
"JsonException",
"{",
"return",
"put",
"(",
"name",
",",
"new",
"JsonBoolean",
"(",
"value",
")",
")",
";",
"}"
] | Maps {@code name} to {@code value}, clobbering any existing name/value
mapping with the same name.
@return this object. | [
"Maps",
"{",
"@code",
"name",
"}",
"to",
"{",
"@code",
"value",
"}",
"clobbering",
"any",
"existing",
"name",
"/",
"value",
"mapping",
"with",
"the",
"same",
"name",
"."
] | train | https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-core/src/main/java/io/apptik/json/JsonObject.java#L143-L145 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnclientlessaccesspolicy_binding.java | vpnclientlessaccesspolicy_binding.get | public static vpnclientlessaccesspolicy_binding get(nitro_service service, String name) throws Exception {
"""
Use this API to fetch vpnclientlessaccesspolicy_binding resource of given name .
"""
vpnclientlessaccesspolicy_binding obj = new vpnclientlessaccesspolicy_binding();
obj.set_name(name);
vpnclientlessaccesspolicy_binding response = (vpnclientlessaccesspolicy_binding) obj.get_resource(service);
return response;
} | java | public static vpnclientlessaccesspolicy_binding get(nitro_service service, String name) throws Exception{
vpnclientlessaccesspolicy_binding obj = new vpnclientlessaccesspolicy_binding();
obj.set_name(name);
vpnclientlessaccesspolicy_binding response = (vpnclientlessaccesspolicy_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"vpnclientlessaccesspolicy_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"vpnclientlessaccesspolicy_binding",
"obj",
"=",
"new",
"vpnclientlessaccesspolicy_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"vpnclientlessaccesspolicy_binding",
"response",
"=",
"(",
"vpnclientlessaccesspolicy_binding",
")",
"obj",
".",
"get_resource",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch vpnclientlessaccesspolicy_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"vpnclientlessaccesspolicy_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnclientlessaccesspolicy_binding.java#L114-L119 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/TokenizerBase.java | TokenizerBase.debugLattice | public void debugLattice(OutputStream outputStream, String text) throws IOException {
"""
Writes the Viterbi lattice for the provided text to an output stream
<p>
The output is written in <a href="https://en.wikipedia.org/wiki/DOT_(graph_description_language)">DOT</a> format.
<p>
This method is not thread safe
@param outputStream output stream to write to
@param text text to create lattice for
@throws IOException if an error occurs when writing the lattice
"""
ViterbiLattice lattice = viterbiBuilder.build(text);
outputStream.write(viterbiFormatter.format(lattice).getBytes(StandardCharsets.UTF_8));
outputStream.flush();
} | java | public void debugLattice(OutputStream outputStream, String text) throws IOException {
ViterbiLattice lattice = viterbiBuilder.build(text);
outputStream.write(viterbiFormatter.format(lattice).getBytes(StandardCharsets.UTF_8));
outputStream.flush();
} | [
"public",
"void",
"debugLattice",
"(",
"OutputStream",
"outputStream",
",",
"String",
"text",
")",
"throws",
"IOException",
"{",
"ViterbiLattice",
"lattice",
"=",
"viterbiBuilder",
".",
"build",
"(",
"text",
")",
";",
"outputStream",
".",
"write",
"(",
"viterbiFormatter",
".",
"format",
"(",
"lattice",
")",
".",
"getBytes",
"(",
"StandardCharsets",
".",
"UTF_8",
")",
")",
";",
"outputStream",
".",
"flush",
"(",
")",
";",
"}"
] | Writes the Viterbi lattice for the provided text to an output stream
<p>
The output is written in <a href="https://en.wikipedia.org/wiki/DOT_(graph_description_language)">DOT</a> format.
<p>
This method is not thread safe
@param outputStream output stream to write to
@param text text to create lattice for
@throws IOException if an error occurs when writing the lattice | [
"Writes",
"the",
"Viterbi",
"lattice",
"for",
"the",
"provided",
"text",
"to",
"an",
"output",
"stream",
"<p",
">",
"The",
"output",
"is",
"written",
"in",
"<a",
"href",
"=",
"https",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"DOT_",
"(",
"graph_description_language",
")",
">",
"DOT<",
"/",
"a",
">",
"format",
".",
"<p",
">",
"This",
"method",
"is",
"not",
"thread",
"safe"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/TokenizerBase.java#L162-L167 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java | Collections.binarySearch | public static <T>
int binarySearch(List<? extends Comparable<? super T>> list, T key) {
"""
Searches the specified list for the specified object using the binary
search algorithm. The list must be sorted into ascending order
according to the {@linkplain Comparable natural ordering} of its
elements (as by the {@link #sort(List)} method) prior to making this
call. If it is not sorted, the results are undefined. If the list
contains multiple elements equal to the specified object, there is no
guarantee which one will be found.
<p>This method runs in log(n) time for a "random access" list (which
provides near-constant-time positional access). If the specified list
does not implement the {@link RandomAccess} interface and is large,
this method will do an iterator-based binary search that performs
O(n) link traversals and O(log n) element comparisons.
@param <T> the class of the objects in the list
@param list the list to be searched.
@param key the key to be searched for.
@return the index of the search key, if it is contained in the list;
otherwise, <tt>(-(<i>insertion point</i>) - 1)</tt>. The
<i>insertion point</i> is defined as the point at which the
key would be inserted into the list: the index of the first
element greater than the key, or <tt>list.size()</tt> if all
elements in the list are less than the specified key. Note
that this guarantees that the return value will be >= 0 if
and only if the key is found.
@throws ClassCastException if the list contains elements that are not
<i>mutually comparable</i> (for example, strings and
integers), or the search key is not mutually comparable
with the elements of the list.
"""
if (list instanceof RandomAccess || list.size()<BINARYSEARCH_THRESHOLD)
return Collections.indexedBinarySearch(list, key);
else
return Collections.iteratorBinarySearch(list, key);
} | java | public static <T>
int binarySearch(List<? extends Comparable<? super T>> list, T key) {
if (list instanceof RandomAccess || list.size()<BINARYSEARCH_THRESHOLD)
return Collections.indexedBinarySearch(list, key);
else
return Collections.iteratorBinarySearch(list, key);
} | [
"public",
"static",
"<",
"T",
">",
"int",
"binarySearch",
"(",
"List",
"<",
"?",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"list",
",",
"T",
"key",
")",
"{",
"if",
"(",
"list",
"instanceof",
"RandomAccess",
"||",
"list",
".",
"size",
"(",
")",
"<",
"BINARYSEARCH_THRESHOLD",
")",
"return",
"Collections",
".",
"indexedBinarySearch",
"(",
"list",
",",
"key",
")",
";",
"else",
"return",
"Collections",
".",
"iteratorBinarySearch",
"(",
"list",
",",
"key",
")",
";",
"}"
] | Searches the specified list for the specified object using the binary
search algorithm. The list must be sorted into ascending order
according to the {@linkplain Comparable natural ordering} of its
elements (as by the {@link #sort(List)} method) prior to making this
call. If it is not sorted, the results are undefined. If the list
contains multiple elements equal to the specified object, there is no
guarantee which one will be found.
<p>This method runs in log(n) time for a "random access" list (which
provides near-constant-time positional access). If the specified list
does not implement the {@link RandomAccess} interface and is large,
this method will do an iterator-based binary search that performs
O(n) link traversals and O(log n) element comparisons.
@param <T> the class of the objects in the list
@param list the list to be searched.
@param key the key to be searched for.
@return the index of the search key, if it is contained in the list;
otherwise, <tt>(-(<i>insertion point</i>) - 1)</tt>. The
<i>insertion point</i> is defined as the point at which the
key would be inserted into the list: the index of the first
element greater than the key, or <tt>list.size()</tt> if all
elements in the list are less than the specified key. Note
that this guarantees that the return value will be >= 0 if
and only if the key is found.
@throws ClassCastException if the list contains elements that are not
<i>mutually comparable</i> (for example, strings and
integers), or the search key is not mutually comparable
with the elements of the list. | [
"Searches",
"the",
"specified",
"list",
"for",
"the",
"specified",
"object",
"using",
"the",
"binary",
"search",
"algorithm",
".",
"The",
"list",
"must",
"be",
"sorted",
"into",
"ascending",
"order",
"according",
"to",
"the",
"{",
"@linkplain",
"Comparable",
"natural",
"ordering",
"}",
"of",
"its",
"elements",
"(",
"as",
"by",
"the",
"{",
"@link",
"#sort",
"(",
"List",
")",
"}",
"method",
")",
"prior",
"to",
"making",
"this",
"call",
".",
"If",
"it",
"is",
"not",
"sorted",
"the",
"results",
"are",
"undefined",
".",
"If",
"the",
"list",
"contains",
"multiple",
"elements",
"equal",
"to",
"the",
"specified",
"object",
"there",
"is",
"no",
"guarantee",
"which",
"one",
"will",
"be",
"found",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java#L242-L248 |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5DeleteFile.java | FineUploader5DeleteFile.addCustomHeader | @Nonnull
public FineUploader5DeleteFile addCustomHeader (@Nonnull @Nonempty final String sKey, @Nonnull final String sValue) {
"""
Any additional headers to attach to all delete file requests.
@param sKey
Custom header name
@param sValue
Custom header value
@return this
"""
ValueEnforcer.notEmpty (sKey, "Key");
ValueEnforcer.notNull (sValue, "Value");
m_aDeleteFileCustomHeaders.put (sKey, sValue);
return this;
} | java | @Nonnull
public FineUploader5DeleteFile addCustomHeader (@Nonnull @Nonempty final String sKey, @Nonnull final String sValue)
{
ValueEnforcer.notEmpty (sKey, "Key");
ValueEnforcer.notNull (sValue, "Value");
m_aDeleteFileCustomHeaders.put (sKey, sValue);
return this;
} | [
"@",
"Nonnull",
"public",
"FineUploader5DeleteFile",
"addCustomHeader",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sKey",
",",
"@",
"Nonnull",
"final",
"String",
"sValue",
")",
"{",
"ValueEnforcer",
".",
"notEmpty",
"(",
"sKey",
",",
"\"Key\"",
")",
";",
"ValueEnforcer",
".",
"notNull",
"(",
"sValue",
",",
"\"Value\"",
")",
";",
"m_aDeleteFileCustomHeaders",
".",
"put",
"(",
"sKey",
",",
"sValue",
")",
";",
"return",
"this",
";",
"}"
] | Any additional headers to attach to all delete file requests.
@param sKey
Custom header name
@param sValue
Custom header value
@return this | [
"Any",
"additional",
"headers",
"to",
"attach",
"to",
"all",
"delete",
"file",
"requests",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5DeleteFile.java#L98-L106 |
landawn/AbacusUtil | src/com/landawn/abacus/util/AnyDelete.java | AnyDelete.addColumn | public AnyDelete addColumn(String family, String qualifier) {
"""
Delete the latest version of the specified column.
This is an expensive call in that on the server-side, it first does a
get to find the latest versions timestamp. Then it adds a delete using
the fetched cells timestamp.
@param family
@param qualifier
@return
"""
delete.addColumn(toFamilyQualifierBytes(family), toFamilyQualifierBytes(qualifier));
return this;
} | java | public AnyDelete addColumn(String family, String qualifier) {
delete.addColumn(toFamilyQualifierBytes(family), toFamilyQualifierBytes(qualifier));
return this;
} | [
"public",
"AnyDelete",
"addColumn",
"(",
"String",
"family",
",",
"String",
"qualifier",
")",
"{",
"delete",
".",
"addColumn",
"(",
"toFamilyQualifierBytes",
"(",
"family",
")",
",",
"toFamilyQualifierBytes",
"(",
"qualifier",
")",
")",
";",
"return",
"this",
";",
"}"
] | Delete the latest version of the specified column.
This is an expensive call in that on the server-side, it first does a
get to find the latest versions timestamp. Then it adds a delete using
the fetched cells timestamp.
@param family
@param qualifier
@return | [
"Delete",
"the",
"latest",
"version",
"of",
"the",
"specified",
"column",
".",
"This",
"is",
"an",
"expensive",
"call",
"in",
"that",
"on",
"the",
"server",
"-",
"side",
"it",
"first",
"does",
"a",
"get",
"to",
"find",
"the",
"latest",
"versions",
"timestamp",
".",
"Then",
"it",
"adds",
"a",
"delete",
"using",
"the",
"fetched",
"cells",
"timestamp",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/AnyDelete.java#L140-L144 |
ManuelPeinado/MultiChoiceAdapter | samples/actionbarsherlock/src/com/tjeannin/provigen/ProviGenProvider.java | ProviGenProvider.onUpgradeDatabase | public void onUpgradeDatabase(SQLiteDatabase database, int oldVersion, int newVersion) {
"""
Called when the database needs to be upgraded. </br></br>
Call {@code super.onUpgradeDatabase(database, oldVersion, newVersion)} to:
<ul>
<li>Automatically add columns if some are missing.</li>
<li>Automatically create tables and needed columns for new added {@link Contract}s.</li>
</ul>
Anything else related to database upgrade should be done here.
<p>
This method executes within a transaction. If an exception is thrown, all changes
will automatically be rolled back.
</p>
@param database The database.
@param oldVersion The old database version (same as contract old version).
@param newVersion The new database version (same as contract new version).
"""
for (ContractHolder contract : contracts) {
if (!openHelper.hasTableInDatabase(database, contract)) {
openHelper.createTable(database, contract);
} else {
openHelper.addMissingColumnsInTable(database, contract);
}
}
} | java | public void onUpgradeDatabase(SQLiteDatabase database, int oldVersion, int newVersion) {
for (ContractHolder contract : contracts) {
if (!openHelper.hasTableInDatabase(database, contract)) {
openHelper.createTable(database, contract);
} else {
openHelper.addMissingColumnsInTable(database, contract);
}
}
} | [
"public",
"void",
"onUpgradeDatabase",
"(",
"SQLiteDatabase",
"database",
",",
"int",
"oldVersion",
",",
"int",
"newVersion",
")",
"{",
"for",
"(",
"ContractHolder",
"contract",
":",
"contracts",
")",
"{",
"if",
"(",
"!",
"openHelper",
".",
"hasTableInDatabase",
"(",
"database",
",",
"contract",
")",
")",
"{",
"openHelper",
".",
"createTable",
"(",
"database",
",",
"contract",
")",
";",
"}",
"else",
"{",
"openHelper",
".",
"addMissingColumnsInTable",
"(",
"database",
",",
"contract",
")",
";",
"}",
"}",
"}"
] | Called when the database needs to be upgraded. </br></br>
Call {@code super.onUpgradeDatabase(database, oldVersion, newVersion)} to:
<ul>
<li>Automatically add columns if some are missing.</li>
<li>Automatically create tables and needed columns for new added {@link Contract}s.</li>
</ul>
Anything else related to database upgrade should be done here.
<p>
This method executes within a transaction. If an exception is thrown, all changes
will automatically be rolled back.
</p>
@param database The database.
@param oldVersion The old database version (same as contract old version).
@param newVersion The new database version (same as contract new version). | [
"Called",
"when",
"the",
"database",
"needs",
"to",
"be",
"upgraded",
".",
"<",
"/",
"br",
">",
"<",
"/",
"br",
">",
"Call",
"{"
] | train | https://github.com/ManuelPeinado/MultiChoiceAdapter/blob/c733879f93b67ecf920f80bf7971af38d7212c9b/samples/actionbarsherlock/src/com/tjeannin/provigen/ProviGenProvider.java#L132-L140 |
nmorel/gwt-jackson | gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/AbstractCreator.java | AbstractCreator.getKeyDeserializerFromType | protected final JDeserializerType getKeyDeserializerFromType( JType type ) throws UnsupportedTypeException, UnableToCompleteException {
"""
Build the {@link JDeserializerType} that instantiate a {@link KeyDeserializer} for the given type.
@param type type
@return the {@link JDeserializerType}.
@throws com.github.nmorel.gwtjackson.rebind.exception.UnsupportedTypeException if any.
"""
return getKeyDeserializerFromType( type, false, false );
} | java | protected final JDeserializerType getKeyDeserializerFromType( JType type ) throws UnsupportedTypeException, UnableToCompleteException {
return getKeyDeserializerFromType( type, false, false );
} | [
"protected",
"final",
"JDeserializerType",
"getKeyDeserializerFromType",
"(",
"JType",
"type",
")",
"throws",
"UnsupportedTypeException",
",",
"UnableToCompleteException",
"{",
"return",
"getKeyDeserializerFromType",
"(",
"type",
",",
"false",
",",
"false",
")",
";",
"}"
] | Build the {@link JDeserializerType} that instantiate a {@link KeyDeserializer} for the given type.
@param type type
@return the {@link JDeserializerType}.
@throws com.github.nmorel.gwtjackson.rebind.exception.UnsupportedTypeException if any. | [
"Build",
"the",
"{",
"@link",
"JDeserializerType",
"}",
"that",
"instantiate",
"a",
"{",
"@link",
"KeyDeserializer",
"}",
"for",
"the",
"given",
"type",
"."
] | train | https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/AbstractCreator.java#L694-L696 |
foundation-runtime/logging | logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/TransactionLogger.java | TransactionLogger.writePropertiesToLog | protected void writePropertiesToLog(Logger logger, Level level) {
"""
Write 'properties' map to given log in given level - with pipe separator between each entry
Write exception stack trace to 'logger' in 'error' level, if not empty
@param logger
@param level - of logging
"""
writeToLog(logger, level, getMapAsString(this.properties, separator), null);
if (this.exception != null) {
writeToLog(this.logger, Level.ERROR, "Error:", this.exception);
}
} | java | protected void writePropertiesToLog(Logger logger, Level level) {
writeToLog(logger, level, getMapAsString(this.properties, separator), null);
if (this.exception != null) {
writeToLog(this.logger, Level.ERROR, "Error:", this.exception);
}
} | [
"protected",
"void",
"writePropertiesToLog",
"(",
"Logger",
"logger",
",",
"Level",
"level",
")",
"{",
"writeToLog",
"(",
"logger",
",",
"level",
",",
"getMapAsString",
"(",
"this",
".",
"properties",
",",
"separator",
")",
",",
"null",
")",
";",
"if",
"(",
"this",
".",
"exception",
"!=",
"null",
")",
"{",
"writeToLog",
"(",
"this",
".",
"logger",
",",
"Level",
".",
"ERROR",
",",
"\"Error:\"",
",",
"this",
".",
"exception",
")",
";",
"}",
"}"
] | Write 'properties' map to given log in given level - with pipe separator between each entry
Write exception stack trace to 'logger' in 'error' level, if not empty
@param logger
@param level - of logging | [
"Write",
"properties",
"map",
"to",
"given",
"log",
"in",
"given",
"level",
"-",
"with",
"pipe",
"separator",
"between",
"each",
"entry",
"Write",
"exception",
"stack",
"trace",
"to",
"logger",
"in",
"error",
"level",
"if",
"not",
"empty"
] | train | https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/TransactionLogger.java#L363-L369 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/DateUtils.java | DateUtils.handleException | private static <E extends RuntimeException> E handleException(E ex) {
"""
Returns the original runtime exception iff the joda-time being used
at runtime behaves as expected.
@throws IllegalStateException if the joda-time being used at runtime
doens't appear to be of the right version.
"""
if (JodaTime.hasExpectedBehavior())
return ex;
throw new IllegalStateException("Joda-time 2.2 or later version is required, but found version: " + JodaTime.getVersion(), ex);
} | java | private static <E extends RuntimeException> E handleException(E ex) {
if (JodaTime.hasExpectedBehavior())
return ex;
throw new IllegalStateException("Joda-time 2.2 or later version is required, but found version: " + JodaTime.getVersion(), ex);
} | [
"private",
"static",
"<",
"E",
"extends",
"RuntimeException",
">",
"E",
"handleException",
"(",
"E",
"ex",
")",
"{",
"if",
"(",
"JodaTime",
".",
"hasExpectedBehavior",
"(",
")",
")",
"return",
"ex",
";",
"throw",
"new",
"IllegalStateException",
"(",
"\"Joda-time 2.2 or later version is required, but found version: \"",
"+",
"JodaTime",
".",
"getVersion",
"(",
")",
",",
"ex",
")",
";",
"}"
] | Returns the original runtime exception iff the joda-time being used
at runtime behaves as expected.
@throws IllegalStateException if the joda-time being used at runtime
doens't appear to be of the right version. | [
"Returns",
"the",
"original",
"runtime",
"exception",
"iff",
"the",
"joda",
"-",
"time",
"being",
"used",
"at",
"runtime",
"behaves",
"as",
"expected",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/DateUtils.java#L146-L150 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/OffsetDateTime.java | OffsetDateTime.now | public static OffsetDateTime now(Clock clock) {
"""
Obtains the current date-time from the specified clock.
<p>
This will query the specified clock to obtain the current date-time.
The offset will be calculated from the time-zone in the clock.
<p>
Using this method allows the use of an alternate clock for testing.
The alternate clock may be introduced using {@link Clock dependency injection}.
@param clock the clock to use, not null
@return the current date-time, not null
"""
Objects.requireNonNull(clock, "clock");
final Instant now = clock.instant(); // called once
return ofInstant(now, clock.getZone().getRules().getOffset(now));
} | java | public static OffsetDateTime now(Clock clock) {
Objects.requireNonNull(clock, "clock");
final Instant now = clock.instant(); // called once
return ofInstant(now, clock.getZone().getRules().getOffset(now));
} | [
"public",
"static",
"OffsetDateTime",
"now",
"(",
"Clock",
"clock",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"clock",
",",
"\"clock\"",
")",
";",
"final",
"Instant",
"now",
"=",
"clock",
".",
"instant",
"(",
")",
";",
"// called once",
"return",
"ofInstant",
"(",
"now",
",",
"clock",
".",
"getZone",
"(",
")",
".",
"getRules",
"(",
")",
".",
"getOffset",
"(",
"now",
")",
")",
";",
"}"
] | Obtains the current date-time from the specified clock.
<p>
This will query the specified clock to obtain the current date-time.
The offset will be calculated from the time-zone in the clock.
<p>
Using this method allows the use of an alternate clock for testing.
The alternate clock may be introduced using {@link Clock dependency injection}.
@param clock the clock to use, not null
@return the current date-time, not null | [
"Obtains",
"the",
"current",
"date",
"-",
"time",
"from",
"the",
"specified",
"clock",
".",
"<p",
">",
"This",
"will",
"query",
"the",
"specified",
"clock",
"to",
"obtain",
"the",
"current",
"date",
"-",
"time",
".",
"The",
"offset",
"will",
"be",
"calculated",
"from",
"the",
"time",
"-",
"zone",
"in",
"the",
"clock",
".",
"<p",
">",
"Using",
"this",
"method",
"allows",
"the",
"use",
"of",
"an",
"alternate",
"clock",
"for",
"testing",
".",
"The",
"alternate",
"clock",
"may",
"be",
"introduced",
"using",
"{",
"@link",
"Clock",
"dependency",
"injection",
"}",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/OffsetDateTime.java#L238-L242 |
apache/flink | flink-yarn/src/main/java/org/apache/flink/yarn/AbstractYarnClusterDescriptor.java | AbstractYarnClusterDescriptor.getYarnFilesDir | private Path getYarnFilesDir(final ApplicationId appId) throws IOException {
"""
Returns the Path where the YARN application files should be uploaded to.
@param appId YARN application id
"""
final FileSystem fileSystem = FileSystem.get(yarnConfiguration);
final Path homeDir = fileSystem.getHomeDirectory();
return new Path(homeDir, ".flink/" + appId + '/');
} | java | private Path getYarnFilesDir(final ApplicationId appId) throws IOException {
final FileSystem fileSystem = FileSystem.get(yarnConfiguration);
final Path homeDir = fileSystem.getHomeDirectory();
return new Path(homeDir, ".flink/" + appId + '/');
} | [
"private",
"Path",
"getYarnFilesDir",
"(",
"final",
"ApplicationId",
"appId",
")",
"throws",
"IOException",
"{",
"final",
"FileSystem",
"fileSystem",
"=",
"FileSystem",
".",
"get",
"(",
"yarnConfiguration",
")",
";",
"final",
"Path",
"homeDir",
"=",
"fileSystem",
".",
"getHomeDirectory",
"(",
")",
";",
"return",
"new",
"Path",
"(",
"homeDir",
",",
"\".flink/\"",
"+",
"appId",
"+",
"'",
"'",
")",
";",
"}"
] | Returns the Path where the YARN application files should be uploaded to.
@param appId YARN application id | [
"Returns",
"the",
"Path",
"where",
"the",
"YARN",
"application",
"files",
"should",
"be",
"uploaded",
"to",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-yarn/src/main/java/org/apache/flink/yarn/AbstractYarnClusterDescriptor.java#L1059-L1063 |
mgm-tp/jfunk | jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailService.java | MailService.findMessages | public List<MailMessage> findMessages(final MailAccount mailAccount, final Predicate<MailMessage> condition,
final long timeoutSeconds, final long sleepMillis) {
"""
<p>
Tries to find messages for the specified mail account applying the specified
{@code condition} until it times out using the specified {@code timeout} and and
{@code sleepMillis}.
</p>
<p>
<b>Note:</b><br />
This method uses the specified mail account independently without reservation. If, however,
the specified mail account has been reserved by any thread (including the current one), an
{@link IllegalStateException} is thrown.
</p>
@param mailAccount
the mail account
@param condition
the condition a message must meet
@param timeoutSeconds
the timeout in seconds
@param sleepMillis
the time in milliseconds to sleep between polls
@return an immutable list of mail messages
"""
return findMessages(mailAccount, condition, timeoutSeconds, sleepMillis, true, -1);
} | java | public List<MailMessage> findMessages(final MailAccount mailAccount, final Predicate<MailMessage> condition,
final long timeoutSeconds, final long sleepMillis) {
return findMessages(mailAccount, condition, timeoutSeconds, sleepMillis, true, -1);
} | [
"public",
"List",
"<",
"MailMessage",
">",
"findMessages",
"(",
"final",
"MailAccount",
"mailAccount",
",",
"final",
"Predicate",
"<",
"MailMessage",
">",
"condition",
",",
"final",
"long",
"timeoutSeconds",
",",
"final",
"long",
"sleepMillis",
")",
"{",
"return",
"findMessages",
"(",
"mailAccount",
",",
"condition",
",",
"timeoutSeconds",
",",
"sleepMillis",
",",
"true",
",",
"-",
"1",
")",
";",
"}"
] | <p>
Tries to find messages for the specified mail account applying the specified
{@code condition} until it times out using the specified {@code timeout} and and
{@code sleepMillis}.
</p>
<p>
<b>Note:</b><br />
This method uses the specified mail account independently without reservation. If, however,
the specified mail account has been reserved by any thread (including the current one), an
{@link IllegalStateException} is thrown.
</p>
@param mailAccount
the mail account
@param condition
the condition a message must meet
@param timeoutSeconds
the timeout in seconds
@param sleepMillis
the time in milliseconds to sleep between polls
@return an immutable list of mail messages | [
"<p",
">",
"Tries",
"to",
"find",
"messages",
"for",
"the",
"specified",
"mail",
"account",
"applying",
"the",
"specified",
"{",
"@code",
"condition",
"}",
"until",
"it",
"times",
"out",
"using",
"the",
"specified",
"{",
"@code",
"timeout",
"}",
"and",
"and",
"{",
"@code",
"sleepMillis",
"}",
".",
"<",
"/",
"p",
">",
"<p",
">",
"<b",
">",
"Note",
":",
"<",
"/",
"b",
">",
"<br",
"/",
">",
"This",
"method",
"uses",
"the",
"specified",
"mail",
"account",
"independently",
"without",
"reservation",
".",
"If",
"however",
"the",
"specified",
"mail",
"account",
"has",
"been",
"reserved",
"by",
"any",
"thread",
"(",
"including",
"the",
"current",
"one",
")",
"an",
"{",
"@link",
"IllegalStateException",
"}",
"is",
"thrown",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailService.java#L446-L449 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnonymousIndividualImpl_CustomFieldSerializer.java | OWLAnonymousIndividualImpl_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLAnonymousIndividualImpl instance) throws SerializationException {
"""
Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful
"""
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLAnonymousIndividualImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"OWLAnonymousIndividualImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"
] | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{"
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnonymousIndividualImpl_CustomFieldSerializer.java#L83-L86 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/subordinate/SubordinateControlMandatoryExample.java | SubordinateControlMandatoryExample.build | private static WComponent build() {
"""
Creates the component to be added to the validation container. This is doen in a static method because the
component is passed into the superclass constructor.
@return the component to be added to the validation container.
"""
WContainer root = new WContainer();
WSubordinateControl control = new WSubordinateControl();
root.add(control);
WFieldLayout layout = new WFieldLayout();
layout.setLabelWidth(25);
layout.setMargin(new com.github.bordertech.wcomponents.Margin(0, 0, 12, 0));
WCheckBox checkBox = new WCheckBox();
layout.addField("Set Mandatory", checkBox);
WTextField text = new WTextField();
layout.addField("Might need this field", text);
WTextField mandatoryField = new WTextField();
layout.addField("Another field always mandatory", mandatoryField);
mandatoryField.setMandatory(true);
final WRadioButtonSelect rbSelect = new WRadioButtonSelect("australian_state");
layout.addField("Select a state", rbSelect);
root.add(layout);
Rule rule = new Rule();
rule.setCondition(new Equal(checkBox, Boolean.TRUE.toString()));
rule.addActionOnTrue(new Mandatory(text));
rule.addActionOnFalse(new Optional(text));
rule.addActionOnTrue(new Mandatory(rbSelect));
rule.addActionOnFalse(new Optional(rbSelect));
control.addRule(rule);
return root;
} | java | private static WComponent build() {
WContainer root = new WContainer();
WSubordinateControl control = new WSubordinateControl();
root.add(control);
WFieldLayout layout = new WFieldLayout();
layout.setLabelWidth(25);
layout.setMargin(new com.github.bordertech.wcomponents.Margin(0, 0, 12, 0));
WCheckBox checkBox = new WCheckBox();
layout.addField("Set Mandatory", checkBox);
WTextField text = new WTextField();
layout.addField("Might need this field", text);
WTextField mandatoryField = new WTextField();
layout.addField("Another field always mandatory", mandatoryField);
mandatoryField.setMandatory(true);
final WRadioButtonSelect rbSelect = new WRadioButtonSelect("australian_state");
layout.addField("Select a state", rbSelect);
root.add(layout);
Rule rule = new Rule();
rule.setCondition(new Equal(checkBox, Boolean.TRUE.toString()));
rule.addActionOnTrue(new Mandatory(text));
rule.addActionOnFalse(new Optional(text));
rule.addActionOnTrue(new Mandatory(rbSelect));
rule.addActionOnFalse(new Optional(rbSelect));
control.addRule(rule);
return root;
} | [
"private",
"static",
"WComponent",
"build",
"(",
")",
"{",
"WContainer",
"root",
"=",
"new",
"WContainer",
"(",
")",
";",
"WSubordinateControl",
"control",
"=",
"new",
"WSubordinateControl",
"(",
")",
";",
"root",
".",
"add",
"(",
"control",
")",
";",
"WFieldLayout",
"layout",
"=",
"new",
"WFieldLayout",
"(",
")",
";",
"layout",
".",
"setLabelWidth",
"(",
"25",
")",
";",
"layout",
".",
"setMargin",
"(",
"new",
"com",
".",
"github",
".",
"bordertech",
".",
"wcomponents",
".",
"Margin",
"(",
"0",
",",
"0",
",",
"12",
",",
"0",
")",
")",
";",
"WCheckBox",
"checkBox",
"=",
"new",
"WCheckBox",
"(",
")",
";",
"layout",
".",
"addField",
"(",
"\"Set Mandatory\"",
",",
"checkBox",
")",
";",
"WTextField",
"text",
"=",
"new",
"WTextField",
"(",
")",
";",
"layout",
".",
"addField",
"(",
"\"Might need this field\"",
",",
"text",
")",
";",
"WTextField",
"mandatoryField",
"=",
"new",
"WTextField",
"(",
")",
";",
"layout",
".",
"addField",
"(",
"\"Another field always mandatory\"",
",",
"mandatoryField",
")",
";",
"mandatoryField",
".",
"setMandatory",
"(",
"true",
")",
";",
"final",
"WRadioButtonSelect",
"rbSelect",
"=",
"new",
"WRadioButtonSelect",
"(",
"\"australian_state\"",
")",
";",
"layout",
".",
"addField",
"(",
"\"Select a state\"",
",",
"rbSelect",
")",
";",
"root",
".",
"add",
"(",
"layout",
")",
";",
"Rule",
"rule",
"=",
"new",
"Rule",
"(",
")",
";",
"rule",
".",
"setCondition",
"(",
"new",
"Equal",
"(",
"checkBox",
",",
"Boolean",
".",
"TRUE",
".",
"toString",
"(",
")",
")",
")",
";",
"rule",
".",
"addActionOnTrue",
"(",
"new",
"Mandatory",
"(",
"text",
")",
")",
";",
"rule",
".",
"addActionOnFalse",
"(",
"new",
"Optional",
"(",
"text",
")",
")",
";",
"rule",
".",
"addActionOnTrue",
"(",
"new",
"Mandatory",
"(",
"rbSelect",
")",
")",
";",
"rule",
".",
"addActionOnFalse",
"(",
"new",
"Optional",
"(",
"rbSelect",
")",
")",
";",
"control",
".",
"addRule",
"(",
"rule",
")",
";",
"return",
"root",
";",
"}"
] | Creates the component to be added to the validation container. This is doen in a static method because the
component is passed into the superclass constructor.
@return the component to be added to the validation container. | [
"Creates",
"the",
"component",
"to",
"be",
"added",
"to",
"the",
"validation",
"container",
".",
"This",
"is",
"doen",
"in",
"a",
"static",
"method",
"because",
"the",
"component",
"is",
"passed",
"into",
"the",
"superclass",
"constructor",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/subordinate/SubordinateControlMandatoryExample.java#L37-L71 |
alkacon/opencms-core | src/org/opencms/main/CmsEventManager.java | CmsEventManager.addCmsEventListener | public void addCmsEventListener(I_CmsEventListener listener, int[] eventTypes) {
"""
Add an OpenCms event listener.<p>
@param listener the listener to add
@param eventTypes the events to listen for
"""
synchronized (m_eventListeners) {
if (eventTypes == null) {
// no event types given - register the listener for all event types
eventTypes = new int[] {I_CmsEventListener.LISTENERS_FOR_ALL_EVENTS.intValue()};
}
for (int i = 0; i < eventTypes.length; i++) {
// register the listener for all configured event types
Integer eventType = new Integer(eventTypes[i]);
List<I_CmsEventListener> listeners = m_eventListeners.get(eventType);
if (listeners == null) {
listeners = new ArrayList<I_CmsEventListener>();
m_eventListeners.put(eventType, listeners);
}
if (!listeners.contains(listener)) {
// add listerner only if it is not already registered
listeners.add(listener);
}
}
}
} | java | public void addCmsEventListener(I_CmsEventListener listener, int[] eventTypes) {
synchronized (m_eventListeners) {
if (eventTypes == null) {
// no event types given - register the listener for all event types
eventTypes = new int[] {I_CmsEventListener.LISTENERS_FOR_ALL_EVENTS.intValue()};
}
for (int i = 0; i < eventTypes.length; i++) {
// register the listener for all configured event types
Integer eventType = new Integer(eventTypes[i]);
List<I_CmsEventListener> listeners = m_eventListeners.get(eventType);
if (listeners == null) {
listeners = new ArrayList<I_CmsEventListener>();
m_eventListeners.put(eventType, listeners);
}
if (!listeners.contains(listener)) {
// add listerner only if it is not already registered
listeners.add(listener);
}
}
}
} | [
"public",
"void",
"addCmsEventListener",
"(",
"I_CmsEventListener",
"listener",
",",
"int",
"[",
"]",
"eventTypes",
")",
"{",
"synchronized",
"(",
"m_eventListeners",
")",
"{",
"if",
"(",
"eventTypes",
"==",
"null",
")",
"{",
"// no event types given - register the listener for all event types",
"eventTypes",
"=",
"new",
"int",
"[",
"]",
"{",
"I_CmsEventListener",
".",
"LISTENERS_FOR_ALL_EVENTS",
".",
"intValue",
"(",
")",
"}",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"eventTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"// register the listener for all configured event types",
"Integer",
"eventType",
"=",
"new",
"Integer",
"(",
"eventTypes",
"[",
"i",
"]",
")",
";",
"List",
"<",
"I_CmsEventListener",
">",
"listeners",
"=",
"m_eventListeners",
".",
"get",
"(",
"eventType",
")",
";",
"if",
"(",
"listeners",
"==",
"null",
")",
"{",
"listeners",
"=",
"new",
"ArrayList",
"<",
"I_CmsEventListener",
">",
"(",
")",
";",
"m_eventListeners",
".",
"put",
"(",
"eventType",
",",
"listeners",
")",
";",
"}",
"if",
"(",
"!",
"listeners",
".",
"contains",
"(",
"listener",
")",
")",
"{",
"// add listerner only if it is not already registered",
"listeners",
".",
"add",
"(",
"listener",
")",
";",
"}",
"}",
"}",
"}"
] | Add an OpenCms event listener.<p>
@param listener the listener to add
@param eventTypes the events to listen for | [
"Add",
"an",
"OpenCms",
"event",
"listener",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsEventManager.java#L87-L108 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.zone_zoneName_history_GET | public ArrayList<Date> zone_zoneName_history_GET(String zoneName, Date creationDate_from, Date creationDate_to) throws IOException {
"""
Zone restore points
REST: GET /domain/zone/{zoneName}/history
@param creationDate_to [required] Filter the value of creationDate property (<=)
@param creationDate_from [required] Filter the value of creationDate property (>=)
@param zoneName [required] The internal name of your zone
API beta
"""
String qPath = "/domain/zone/{zoneName}/history";
StringBuilder sb = path(qPath, zoneName);
query(sb, "creationDate.from", creationDate_from);
query(sb, "creationDate.to", creationDate_to);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | java | public ArrayList<Date> zone_zoneName_history_GET(String zoneName, Date creationDate_from, Date creationDate_to) throws IOException {
String qPath = "/domain/zone/{zoneName}/history";
StringBuilder sb = path(qPath, zoneName);
query(sb, "creationDate.from", creationDate_from);
query(sb, "creationDate.to", creationDate_to);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | [
"public",
"ArrayList",
"<",
"Date",
">",
"zone_zoneName_history_GET",
"(",
"String",
"zoneName",
",",
"Date",
"creationDate_from",
",",
"Date",
"creationDate_to",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/zone/{zoneName}/history\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"zoneName",
")",
";",
"query",
"(",
"sb",
",",
"\"creationDate.from\"",
",",
"creationDate_from",
")",
";",
"query",
"(",
"sb",
",",
"\"creationDate.to\"",
",",
"creationDate_to",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t3",
")",
";",
"}"
] | Zone restore points
REST: GET /domain/zone/{zoneName}/history
@param creationDate_to [required] Filter the value of creationDate property (<=)
@param creationDate_from [required] Filter the value of creationDate property (>=)
@param zoneName [required] The internal name of your zone
API beta | [
"Zone",
"restore",
"points"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L585-L592 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/ns/nsacl6_stats.java | nsacl6_stats.get | public static nsacl6_stats get(nitro_service service, String acl6name) throws Exception {
"""
Use this API to fetch statistics of nsacl6_stats resource of given name .
"""
nsacl6_stats obj = new nsacl6_stats();
obj.set_acl6name(acl6name);
nsacl6_stats response = (nsacl6_stats) obj.stat_resource(service);
return response;
} | java | public static nsacl6_stats get(nitro_service service, String acl6name) throws Exception{
nsacl6_stats obj = new nsacl6_stats();
obj.set_acl6name(acl6name);
nsacl6_stats response = (nsacl6_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"nsacl6_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"acl6name",
")",
"throws",
"Exception",
"{",
"nsacl6_stats",
"obj",
"=",
"new",
"nsacl6_stats",
"(",
")",
";",
"obj",
".",
"set_acl6name",
"(",
"acl6name",
")",
";",
"nsacl6_stats",
"response",
"=",
"(",
"nsacl6_stats",
")",
"obj",
".",
"stat_resource",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch statistics of nsacl6_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"nsacl6_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/ns/nsacl6_stats.java#L299-L304 |
protostuff/protostuff | protostuff-json/src/main/java/io/protostuff/JsonIOUtil.java | JsonIOUtil.writeTo | public static <T> void writeTo(JsonGenerator generator, T message, Schema<T> schema,
boolean numeric) throws IOException {
"""
Serializes the {@code message} into a JsonGenerator using the given {@code schema}.
"""
generator.writeStartObject();
final JsonOutput output = new JsonOutput(generator, numeric, schema);
schema.writeTo(output, message);
if (output.isLastRepeated())
generator.writeEndArray();
generator.writeEndObject();
} | java | public static <T> void writeTo(JsonGenerator generator, T message, Schema<T> schema,
boolean numeric) throws IOException
{
generator.writeStartObject();
final JsonOutput output = new JsonOutput(generator, numeric, schema);
schema.writeTo(output, message);
if (output.isLastRepeated())
generator.writeEndArray();
generator.writeEndObject();
} | [
"public",
"static",
"<",
"T",
">",
"void",
"writeTo",
"(",
"JsonGenerator",
"generator",
",",
"T",
"message",
",",
"Schema",
"<",
"T",
">",
"schema",
",",
"boolean",
"numeric",
")",
"throws",
"IOException",
"{",
"generator",
".",
"writeStartObject",
"(",
")",
";",
"final",
"JsonOutput",
"output",
"=",
"new",
"JsonOutput",
"(",
"generator",
",",
"numeric",
",",
"schema",
")",
";",
"schema",
".",
"writeTo",
"(",
"output",
",",
"message",
")",
";",
"if",
"(",
"output",
".",
"isLastRepeated",
"(",
")",
")",
"generator",
".",
"writeEndArray",
"(",
")",
";",
"generator",
".",
"writeEndObject",
"(",
")",
";",
"}"
] | Serializes the {@code message} into a JsonGenerator using the given {@code schema}. | [
"Serializes",
"the",
"{"
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-json/src/main/java/io/protostuff/JsonIOUtil.java#L454-L465 |
fuinorg/utils4j | src/main/java/org/fuin/utils4j/PropertiesUtils.java | PropertiesUtils.loadProperties | public static Properties loadProperties(final String baseUrl, final String filename) {
"""
Load a file from an directory. Wraps a possible <code>MalformedURLException</code> exception into a <code>RuntimeException</code>.
@param baseUrl
Directory URL as <code>String</code> - Cannot be <code>null</code>.
@param filename
Filename without path - Cannot be <code>null</code>.
@return Properties.
"""
checkNotNull("baseUrl", baseUrl);
checkNotNull("filename", filename);
try {
final URL url = new URL(baseUrl);
return loadProperties(url, filename);
} catch (final MalformedURLException ex) {
throw new IllegalArgumentException("The argument 'srcUrl' is not a valid URL [" + baseUrl + "]!", ex);
}
} | java | public static Properties loadProperties(final String baseUrl, final String filename) {
checkNotNull("baseUrl", baseUrl);
checkNotNull("filename", filename);
try {
final URL url = new URL(baseUrl);
return loadProperties(url, filename);
} catch (final MalformedURLException ex) {
throw new IllegalArgumentException("The argument 'srcUrl' is not a valid URL [" + baseUrl + "]!", ex);
}
} | [
"public",
"static",
"Properties",
"loadProperties",
"(",
"final",
"String",
"baseUrl",
",",
"final",
"String",
"filename",
")",
"{",
"checkNotNull",
"(",
"\"baseUrl\"",
",",
"baseUrl",
")",
";",
"checkNotNull",
"(",
"\"filename\"",
",",
"filename",
")",
";",
"try",
"{",
"final",
"URL",
"url",
"=",
"new",
"URL",
"(",
"baseUrl",
")",
";",
"return",
"loadProperties",
"(",
"url",
",",
"filename",
")",
";",
"}",
"catch",
"(",
"final",
"MalformedURLException",
"ex",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The argument 'srcUrl' is not a valid URL [\"",
"+",
"baseUrl",
"+",
"\"]!\"",
",",
"ex",
")",
";",
"}",
"}"
] | Load a file from an directory. Wraps a possible <code>MalformedURLException</code> exception into a <code>RuntimeException</code>.
@param baseUrl
Directory URL as <code>String</code> - Cannot be <code>null</code>.
@param filename
Filename without path - Cannot be <code>null</code>.
@return Properties. | [
"Load",
"a",
"file",
"from",
"an",
"directory",
".",
"Wraps",
"a",
"possible",
"<code",
">",
"MalformedURLException<",
"/",
"code",
">",
"exception",
"into",
"a",
"<code",
">",
"RuntimeException<",
"/",
"code",
">",
"."
] | train | https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/PropertiesUtils.java#L180-L191 |
eclipse/xtext-extras | org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/impl/IndexedJvmTypeAccess.java | IndexedJvmTypeAccess.getAccessibleType | protected EObject getAccessibleType(IEObjectDescription description, String fragment, ResourceSet resourceSet) throws UnknownNestedTypeException {
"""
Read and resolve the EObject from the given description and navigate to its children according
to the given fragment.
@since 2.8
"""
EObject typeProxy = description.getEObjectOrProxy();
if (typeProxy.eIsProxy()) {
typeProxy = EcoreUtil.resolve(typeProxy, resourceSet);
}
if (!typeProxy.eIsProxy() && typeProxy instanceof JvmType) {
if (fragment != null) {
EObject result = resolveJavaObject((JvmType) typeProxy, fragment);
if (result != null)
return result;
} else
return typeProxy;
}
return null;
} | java | protected EObject getAccessibleType(IEObjectDescription description, String fragment, ResourceSet resourceSet) throws UnknownNestedTypeException {
EObject typeProxy = description.getEObjectOrProxy();
if (typeProxy.eIsProxy()) {
typeProxy = EcoreUtil.resolve(typeProxy, resourceSet);
}
if (!typeProxy.eIsProxy() && typeProxy instanceof JvmType) {
if (fragment != null) {
EObject result = resolveJavaObject((JvmType) typeProxy, fragment);
if (result != null)
return result;
} else
return typeProxy;
}
return null;
} | [
"protected",
"EObject",
"getAccessibleType",
"(",
"IEObjectDescription",
"description",
",",
"String",
"fragment",
",",
"ResourceSet",
"resourceSet",
")",
"throws",
"UnknownNestedTypeException",
"{",
"EObject",
"typeProxy",
"=",
"description",
".",
"getEObjectOrProxy",
"(",
")",
";",
"if",
"(",
"typeProxy",
".",
"eIsProxy",
"(",
")",
")",
"{",
"typeProxy",
"=",
"EcoreUtil",
".",
"resolve",
"(",
"typeProxy",
",",
"resourceSet",
")",
";",
"}",
"if",
"(",
"!",
"typeProxy",
".",
"eIsProxy",
"(",
")",
"&&",
"typeProxy",
"instanceof",
"JvmType",
")",
"{",
"if",
"(",
"fragment",
"!=",
"null",
")",
"{",
"EObject",
"result",
"=",
"resolveJavaObject",
"(",
"(",
"JvmType",
")",
"typeProxy",
",",
"fragment",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"return",
"result",
";",
"}",
"else",
"return",
"typeProxy",
";",
"}",
"return",
"null",
";",
"}"
] | Read and resolve the EObject from the given description and navigate to its children according
to the given fragment.
@since 2.8 | [
"Read",
"and",
"resolve",
"the",
"EObject",
"from",
"the",
"given",
"description",
"and",
"navigate",
"to",
"its",
"children",
"according",
"to",
"the",
"given",
"fragment",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/impl/IndexedJvmTypeAccess.java#L139-L153 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/collect/AbstractMapBasedMultimap.java | AbstractMapBasedMultimap.wrapCollection | Collection<V> wrapCollection(@Nullable K key, Collection<V> collection) {
"""
Generates a decorated collection that remains consistent with the values in
the multimap for the provided key. Changes to the multimap may alter the
returned collection, and vice versa.
"""
// We don't deal with NavigableSet here yet for GWT reasons -- instead,
// non-GWT TreeMultimap explicitly overrides this and uses NavigableSet.
if (collection instanceof SortedSet) {
return new WrappedSortedSet(key, (SortedSet<V>) collection, null);
} else if (collection instanceof Set) {
return new WrappedSet(key, (Set<V>) collection);
} else if (collection instanceof List) {
return wrapList(key, (List<V>) collection, null);
} else {
return new WrappedCollection(key, collection, null);
}
} | java | Collection<V> wrapCollection(@Nullable K key, Collection<V> collection) {
// We don't deal with NavigableSet here yet for GWT reasons -- instead,
// non-GWT TreeMultimap explicitly overrides this and uses NavigableSet.
if (collection instanceof SortedSet) {
return new WrappedSortedSet(key, (SortedSet<V>) collection, null);
} else if (collection instanceof Set) {
return new WrappedSet(key, (Set<V>) collection);
} else if (collection instanceof List) {
return wrapList(key, (List<V>) collection, null);
} else {
return new WrappedCollection(key, collection, null);
}
} | [
"Collection",
"<",
"V",
">",
"wrapCollection",
"(",
"@",
"Nullable",
"K",
"key",
",",
"Collection",
"<",
"V",
">",
"collection",
")",
"{",
"// We don't deal with NavigableSet here yet for GWT reasons -- instead,",
"// non-GWT TreeMultimap explicitly overrides this and uses NavigableSet.",
"if",
"(",
"collection",
"instanceof",
"SortedSet",
")",
"{",
"return",
"new",
"WrappedSortedSet",
"(",
"key",
",",
"(",
"SortedSet",
"<",
"V",
">",
")",
"collection",
",",
"null",
")",
";",
"}",
"else",
"if",
"(",
"collection",
"instanceof",
"Set",
")",
"{",
"return",
"new",
"WrappedSet",
"(",
"key",
",",
"(",
"Set",
"<",
"V",
">",
")",
"collection",
")",
";",
"}",
"else",
"if",
"(",
"collection",
"instanceof",
"List",
")",
"{",
"return",
"wrapList",
"(",
"key",
",",
"(",
"List",
"<",
"V",
">",
")",
"collection",
",",
"null",
")",
";",
"}",
"else",
"{",
"return",
"new",
"WrappedCollection",
"(",
"key",
",",
"collection",
",",
"null",
")",
";",
"}",
"}"
] | Generates a decorated collection that remains consistent with the values in
the multimap for the provided key. Changes to the multimap may alter the
returned collection, and vice versa. | [
"Generates",
"a",
"decorated",
"collection",
"that",
"remains",
"consistent",
"with",
"the",
"values",
"in",
"the",
"multimap",
"for",
"the",
"provided",
"key",
".",
"Changes",
"to",
"the",
"multimap",
"may",
"alter",
"the",
"returned",
"collection",
"and",
"vice",
"versa",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/AbstractMapBasedMultimap.java#L315-L327 |
baratine/baratine | framework/src/main/java/com/caucho/v5/config/types/Period.java | Period.periodEnd | private static long periodEnd(long now, long period, QDate cal) {
"""
Calculates the next period end. The calculation is in local time.
@param now the current time in GMT ms since the epoch
@return the time of the next period in GMT ms since the epoch
"""
if (period < 0)
return Long.MAX_VALUE;
else if (period == 0)
return now;
if (period < 30 * DAY) {
cal.setGMTTime(now);
long localTime = cal.getLocalTime();
localTime = localTime + (period - (localTime + 4 * DAY) % period);
cal.setLocalTime(localTime);
return cal.getGMTTime();
}
if (period % (30 * DAY) == 0) {
int months = (int) (period / (30 * DAY));
cal.setGMTTime(now);
long year = cal.getYear();
int month = cal.getMonth();
cal.setLocalTime(0);
cal.setDate(year, month + months, 1);
return cal.getGMTTime();
}
if (period % (365 * DAY) == 0) {
long years = (period / (365 * DAY));
cal.setGMTTime(now);
long year = cal.getYear();
cal.setLocalTime(0);
long newYear = year + (years - year % years);
cal.setDate(newYear, 0, 1);
return cal.getGMTTime();
}
cal.setGMTTime(now);
long localTime = cal.getLocalTime();
localTime = localTime + (period - (localTime + 4 * DAY) % period);
cal.setLocalTime(localTime);
return cal.getGMTTime();
} | java | private static long periodEnd(long now, long period, QDate cal)
{
if (period < 0)
return Long.MAX_VALUE;
else if (period == 0)
return now;
if (period < 30 * DAY) {
cal.setGMTTime(now);
long localTime = cal.getLocalTime();
localTime = localTime + (period - (localTime + 4 * DAY) % period);
cal.setLocalTime(localTime);
return cal.getGMTTime();
}
if (period % (30 * DAY) == 0) {
int months = (int) (period / (30 * DAY));
cal.setGMTTime(now);
long year = cal.getYear();
int month = cal.getMonth();
cal.setLocalTime(0);
cal.setDate(year, month + months, 1);
return cal.getGMTTime();
}
if (period % (365 * DAY) == 0) {
long years = (period / (365 * DAY));
cal.setGMTTime(now);
long year = cal.getYear();
cal.setLocalTime(0);
long newYear = year + (years - year % years);
cal.setDate(newYear, 0, 1);
return cal.getGMTTime();
}
cal.setGMTTime(now);
long localTime = cal.getLocalTime();
localTime = localTime + (period - (localTime + 4 * DAY) % period);
cal.setLocalTime(localTime);
return cal.getGMTTime();
} | [
"private",
"static",
"long",
"periodEnd",
"(",
"long",
"now",
",",
"long",
"period",
",",
"QDate",
"cal",
")",
"{",
"if",
"(",
"period",
"<",
"0",
")",
"return",
"Long",
".",
"MAX_VALUE",
";",
"else",
"if",
"(",
"period",
"==",
"0",
")",
"return",
"now",
";",
"if",
"(",
"period",
"<",
"30",
"*",
"DAY",
")",
"{",
"cal",
".",
"setGMTTime",
"(",
"now",
")",
";",
"long",
"localTime",
"=",
"cal",
".",
"getLocalTime",
"(",
")",
";",
"localTime",
"=",
"localTime",
"+",
"(",
"period",
"-",
"(",
"localTime",
"+",
"4",
"*",
"DAY",
")",
"%",
"period",
")",
";",
"cal",
".",
"setLocalTime",
"(",
"localTime",
")",
";",
"return",
"cal",
".",
"getGMTTime",
"(",
")",
";",
"}",
"if",
"(",
"period",
"%",
"(",
"30",
"*",
"DAY",
")",
"==",
"0",
")",
"{",
"int",
"months",
"=",
"(",
"int",
")",
"(",
"period",
"/",
"(",
"30",
"*",
"DAY",
")",
")",
";",
"cal",
".",
"setGMTTime",
"(",
"now",
")",
";",
"long",
"year",
"=",
"cal",
".",
"getYear",
"(",
")",
";",
"int",
"month",
"=",
"cal",
".",
"getMonth",
"(",
")",
";",
"cal",
".",
"setLocalTime",
"(",
"0",
")",
";",
"cal",
".",
"setDate",
"(",
"year",
",",
"month",
"+",
"months",
",",
"1",
")",
";",
"return",
"cal",
".",
"getGMTTime",
"(",
")",
";",
"}",
"if",
"(",
"period",
"%",
"(",
"365",
"*",
"DAY",
")",
"==",
"0",
")",
"{",
"long",
"years",
"=",
"(",
"period",
"/",
"(",
"365",
"*",
"DAY",
")",
")",
";",
"cal",
".",
"setGMTTime",
"(",
"now",
")",
";",
"long",
"year",
"=",
"cal",
".",
"getYear",
"(",
")",
";",
"cal",
".",
"setLocalTime",
"(",
"0",
")",
";",
"long",
"newYear",
"=",
"year",
"+",
"(",
"years",
"-",
"year",
"%",
"years",
")",
";",
"cal",
".",
"setDate",
"(",
"newYear",
",",
"0",
",",
"1",
")",
";",
"return",
"cal",
".",
"getGMTTime",
"(",
")",
";",
"}",
"cal",
".",
"setGMTTime",
"(",
"now",
")",
";",
"long",
"localTime",
"=",
"cal",
".",
"getLocalTime",
"(",
")",
";",
"localTime",
"=",
"localTime",
"+",
"(",
"period",
"-",
"(",
"localTime",
"+",
"4",
"*",
"DAY",
")",
"%",
"period",
")",
";",
"cal",
".",
"setLocalTime",
"(",
"localTime",
")",
";",
"return",
"cal",
".",
"getGMTTime",
"(",
")",
";",
"}"
] | Calculates the next period end. The calculation is in local time.
@param now the current time in GMT ms since the epoch
@return the time of the next period in GMT ms since the epoch | [
"Calculates",
"the",
"next",
"period",
"end",
".",
"The",
"calculation",
"is",
"in",
"local",
"time",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/config/types/Period.java#L235-L292 |
MenoData/Time4J | base/src/main/java/net/time4j/range/MomentInterval.java | MomentInterval.until | public static MomentInterval until(Moment end) {
"""
/*[deutsch]
<p>Erzeugt ein unbegrenztes offenes Intervall bis zum angegebenen
Endzeitpunkt. </p>
@param end moment of upper boundary (exclusive)
@return new moment interval
@since 2.0
"""
Boundary<Moment> past = Boundary.infinitePast();
return new MomentInterval(past, Boundary.of(OPEN, end));
} | java | public static MomentInterval until(Moment end) {
Boundary<Moment> past = Boundary.infinitePast();
return new MomentInterval(past, Boundary.of(OPEN, end));
} | [
"public",
"static",
"MomentInterval",
"until",
"(",
"Moment",
"end",
")",
"{",
"Boundary",
"<",
"Moment",
">",
"past",
"=",
"Boundary",
".",
"infinitePast",
"(",
")",
";",
"return",
"new",
"MomentInterval",
"(",
"past",
",",
"Boundary",
".",
"of",
"(",
"OPEN",
",",
"end",
")",
")",
";",
"}"
] | /*[deutsch]
<p>Erzeugt ein unbegrenztes offenes Intervall bis zum angegebenen
Endzeitpunkt. </p>
@param end moment of upper boundary (exclusive)
@return new moment interval
@since 2.0 | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Erzeugt",
"ein",
"unbegrenztes",
"offenes",
"Intervall",
"bis",
"zum",
"angegebenen",
"Endzeitpunkt",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/MomentInterval.java#L310-L315 |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/hc/html/metadata/HCHead.java | HCHead.addCSSAt | @Nonnull
public final HCHead addCSSAt (@Nonnegative final int nIndex, @Nonnull final IHCNode aCSS) {
"""
Add a CSS node at the specified index.
@param nIndex
The index to add. Should be ≥ 0.
@param aCSS
The CSS node to be added. May not be <code>null</code>.
@return this for chaining
"""
ValueEnforcer.notNull (aCSS, "CSS");
if (!HCCSSNodeDetector.isCSSNode (aCSS))
throw new IllegalArgumentException (aCSS + " is not a valid CSS node!");
m_aCSS.add (nIndex, aCSS);
return this;
} | java | @Nonnull
public final HCHead addCSSAt (@Nonnegative final int nIndex, @Nonnull final IHCNode aCSS)
{
ValueEnforcer.notNull (aCSS, "CSS");
if (!HCCSSNodeDetector.isCSSNode (aCSS))
throw new IllegalArgumentException (aCSS + " is not a valid CSS node!");
m_aCSS.add (nIndex, aCSS);
return this;
} | [
"@",
"Nonnull",
"public",
"final",
"HCHead",
"addCSSAt",
"(",
"@",
"Nonnegative",
"final",
"int",
"nIndex",
",",
"@",
"Nonnull",
"final",
"IHCNode",
"aCSS",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aCSS",
",",
"\"CSS\"",
")",
";",
"if",
"(",
"!",
"HCCSSNodeDetector",
".",
"isCSSNode",
"(",
"aCSS",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"aCSS",
"+",
"\" is not a valid CSS node!\"",
")",
";",
"m_aCSS",
".",
"add",
"(",
"nIndex",
",",
"aCSS",
")",
";",
"return",
"this",
";",
"}"
] | Add a CSS node at the specified index.
@param nIndex
The index to add. Should be ≥ 0.
@param aCSS
The CSS node to be added. May not be <code>null</code>.
@return this for chaining | [
"Add",
"a",
"CSS",
"node",
"at",
"the",
"specified",
"index",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/html/metadata/HCHead.java#L200-L208 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionImagesInner.java | VirtualMachineExtensionImagesInner.listTypesAsync | public Observable<List<VirtualMachineExtensionImageInner>> listTypesAsync(String location, String publisherName) {
"""
Gets a list of virtual machine extension image types.
@param location The name of a supported Azure region.
@param publisherName the String value
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<VirtualMachineExtensionImageInner> object
"""
return listTypesWithServiceResponseAsync(location, publisherName).map(new Func1<ServiceResponse<List<VirtualMachineExtensionImageInner>>, List<VirtualMachineExtensionImageInner>>() {
@Override
public List<VirtualMachineExtensionImageInner> call(ServiceResponse<List<VirtualMachineExtensionImageInner>> response) {
return response.body();
}
});
} | java | public Observable<List<VirtualMachineExtensionImageInner>> listTypesAsync(String location, String publisherName) {
return listTypesWithServiceResponseAsync(location, publisherName).map(new Func1<ServiceResponse<List<VirtualMachineExtensionImageInner>>, List<VirtualMachineExtensionImageInner>>() {
@Override
public List<VirtualMachineExtensionImageInner> call(ServiceResponse<List<VirtualMachineExtensionImageInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"VirtualMachineExtensionImageInner",
">",
">",
"listTypesAsync",
"(",
"String",
"location",
",",
"String",
"publisherName",
")",
"{",
"return",
"listTypesWithServiceResponseAsync",
"(",
"location",
",",
"publisherName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"List",
"<",
"VirtualMachineExtensionImageInner",
">",
">",
",",
"List",
"<",
"VirtualMachineExtensionImageInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"List",
"<",
"VirtualMachineExtensionImageInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"List",
"<",
"VirtualMachineExtensionImageInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets a list of virtual machine extension image types.
@param location The name of a supported Azure region.
@param publisherName the String value
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<VirtualMachineExtensionImageInner> object | [
"Gets",
"a",
"list",
"of",
"virtual",
"machine",
"extension",
"image",
"types",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionImagesInner.java#L204-L211 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/CopyDataHandler.java | CopyDataHandler.moveSourceToDest | public int moveSourceToDest(boolean bDisplayOption, int iMoveMode) {
"""
Do the physical move operation.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay).
"""
if (m_objValue instanceof String)
return m_fldDest.setString((String)m_objValue, bDisplayOption, iMoveMode);
else
return m_fldDest.setData(m_objValue, bDisplayOption, iMoveMode);
} | java | public int moveSourceToDest(boolean bDisplayOption, int iMoveMode)
{
if (m_objValue instanceof String)
return m_fldDest.setString((String)m_objValue, bDisplayOption, iMoveMode);
else
return m_fldDest.setData(m_objValue, bDisplayOption, iMoveMode);
} | [
"public",
"int",
"moveSourceToDest",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"if",
"(",
"m_objValue",
"instanceof",
"String",
")",
"return",
"m_fldDest",
".",
"setString",
"(",
"(",
"String",
")",
"m_objValue",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"else",
"return",
"m_fldDest",
".",
"setData",
"(",
"m_objValue",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"}"
] | Do the physical move operation.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay). | [
"Do",
"the",
"physical",
"move",
"operation",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/CopyDataHandler.java#L70-L76 |
Azure/azure-sdk-for-java | postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/VirtualNetworkRulesInner.java | VirtualNetworkRulesInner.beginCreateOrUpdate | public VirtualNetworkRuleInner beginCreateOrUpdate(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) {
"""
Creates or updates an existing virtual network rule.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param virtualNetworkRuleName The name of the virtual network rule.
@param parameters The requested virtual Network Rule Resource state.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VirtualNetworkRuleInner object if successful.
"""
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).toBlocking().single().body();
} | java | public VirtualNetworkRuleInner beginCreateOrUpdate(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).toBlocking().single().body();
} | [
"public",
"VirtualNetworkRuleInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"virtualNetworkRuleName",
",",
"VirtualNetworkRuleInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"virtualNetworkRuleName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates or updates an existing virtual network rule.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param virtualNetworkRuleName The name of the virtual network rule.
@param parameters The requested virtual Network Rule Resource state.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VirtualNetworkRuleInner object if successful. | [
"Creates",
"or",
"updates",
"an",
"existing",
"virtual",
"network",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/VirtualNetworkRulesInner.java#L283-L285 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/JobApi.java | JobApi.downloadArtifactsFile | public File downloadArtifactsFile(Object projectIdOrPath, Integer jobId, File directory) throws GitLabApiException {
"""
Download the job artifacts file for the specified job ID. The artifacts file will be saved in the
specified directory with the following name pattern: job-{jobid}-artifacts.zip. If the file already
exists in the directory it will be overwritten.
<pre><code>GitLab Endpoint: GET /projects/:id/jobs/:job_id/artifacts</code></pre>
@param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
@param jobId the job ID to get the artifacts for
@param directory the File instance of the directory to save the file to, if null will use "java.io.tmpdir"
@return a File instance pointing to the download of the specified job artifacts file
@throws GitLabApiException if any exception occurs
"""
Response response = getWithAccepts(Response.Status.OK, null, MediaType.MEDIA_TYPE_WILDCARD,
"projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts");
try {
if (directory == null)
directory = new File(System.getProperty("java.io.tmpdir"));
String filename = "job-" + jobId + "-artifacts.zip";
File file = new File(directory, filename);
InputStream in = response.readEntity(InputStream.class);
Files.copy(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
return (file);
} catch (IOException ioe) {
throw new GitLabApiException(ioe);
}
} | java | public File downloadArtifactsFile(Object projectIdOrPath, Integer jobId, File directory) throws GitLabApiException {
Response response = getWithAccepts(Response.Status.OK, null, MediaType.MEDIA_TYPE_WILDCARD,
"projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts");
try {
if (directory == null)
directory = new File(System.getProperty("java.io.tmpdir"));
String filename = "job-" + jobId + "-artifacts.zip";
File file = new File(directory, filename);
InputStream in = response.readEntity(InputStream.class);
Files.copy(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
return (file);
} catch (IOException ioe) {
throw new GitLabApiException(ioe);
}
} | [
"public",
"File",
"downloadArtifactsFile",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"jobId",
",",
"File",
"directory",
")",
"throws",
"GitLabApiException",
"{",
"Response",
"response",
"=",
"getWithAccepts",
"(",
"Response",
".",
"Status",
".",
"OK",
",",
"null",
",",
"MediaType",
".",
"MEDIA_TYPE_WILDCARD",
",",
"\"projects\"",
",",
"getProjectIdOrPath",
"(",
"projectIdOrPath",
")",
",",
"\"jobs\"",
",",
"jobId",
",",
"\"artifacts\"",
")",
";",
"try",
"{",
"if",
"(",
"directory",
"==",
"null",
")",
"directory",
"=",
"new",
"File",
"(",
"System",
".",
"getProperty",
"(",
"\"java.io.tmpdir\"",
")",
")",
";",
"String",
"filename",
"=",
"\"job-\"",
"+",
"jobId",
"+",
"\"-artifacts.zip\"",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"directory",
",",
"filename",
")",
";",
"InputStream",
"in",
"=",
"response",
".",
"readEntity",
"(",
"InputStream",
".",
"class",
")",
";",
"Files",
".",
"copy",
"(",
"in",
",",
"file",
".",
"toPath",
"(",
")",
",",
"StandardCopyOption",
".",
"REPLACE_EXISTING",
")",
";",
"return",
"(",
"file",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"GitLabApiException",
"(",
"ioe",
")",
";",
"}",
"}"
] | Download the job artifacts file for the specified job ID. The artifacts file will be saved in the
specified directory with the following name pattern: job-{jobid}-artifacts.zip. If the file already
exists in the directory it will be overwritten.
<pre><code>GitLab Endpoint: GET /projects/:id/jobs/:job_id/artifacts</code></pre>
@param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
@param jobId the job ID to get the artifacts for
@param directory the File instance of the directory to save the file to, if null will use "java.io.tmpdir"
@return a File instance pointing to the download of the specified job artifacts file
@throws GitLabApiException if any exception occurs | [
"Download",
"the",
"job",
"artifacts",
"file",
"for",
"the",
"specified",
"job",
"ID",
".",
"The",
"artifacts",
"file",
"will",
"be",
"saved",
"in",
"the",
"specified",
"directory",
"with",
"the",
"following",
"name",
"pattern",
":",
"job",
"-",
"{",
"jobid",
"}",
"-",
"artifacts",
".",
"zip",
".",
"If",
"the",
"file",
"already",
"exists",
"in",
"the",
"directory",
"it",
"will",
"be",
"overwritten",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/JobApi.java#L267-L286 |
Javacord/Javacord | javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java | ServerUpdater.removeRoleFromUser | public ServerUpdater removeRoleFromUser(User user, Role role) {
"""
Queues a role to be removed from the user.
@param user The server member the role should be removed from.
@param role The role which should be removed from the user.
@return The current instance in order to chain call methods.
"""
delegate.removeRoleFromUser(user, role);
return this;
} | java | public ServerUpdater removeRoleFromUser(User user, Role role) {
delegate.removeRoleFromUser(user, role);
return this;
} | [
"public",
"ServerUpdater",
"removeRoleFromUser",
"(",
"User",
"user",
",",
"Role",
"role",
")",
"{",
"delegate",
".",
"removeRoleFromUser",
"(",
"user",
",",
"role",
")",
";",
"return",
"this",
";",
"}"
] | Queues a role to be removed from the user.
@param user The server member the role should be removed from.
@param role The role which should be removed from the user.
@return The current instance in order to chain call methods. | [
"Queues",
"a",
"role",
"to",
"be",
"removed",
"from",
"the",
"user",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java#L491-L494 |
tvesalainen/util | util/src/main/java/org/vesalainen/math/CircleFitter.java | CircleFitter.limitDistance | public static void limitDistance(DenseMatrix64F p0, DenseMatrix64F pr, double min, double max) {
"""
Changes pr so that distance from p0 is in range min - max. Slope of (p0,pr)
remains the same.
@param p0
@param pr
@param min
@param max
"""
double x0 = p0.data[0];
double y0 = p0.data[1];
double xr = pr.data[0];
double yr = pr.data[1];
double dx = xr-x0;
double dy = yr-y0;
double r = Math.sqrt(dx*dx+dy*dy);
if (r < min || r > max)
{
if (r < min)
{
r = min;
}
else
{
r = max;
}
double m = dy/dx;
if (Double.isInfinite(m))
{
if (m > 0)
{
pr.data[1] = y0 + r;
}
else
{
pr.data[1] = y0 - r;
}
}
else
{
double x = Math.sqrt((r*r)/(m*m+1));
double y = m*x;
pr.data[0] = x0 + x;
pr.data[1] = y0 + y;
}
}
} | java | public static void limitDistance(DenseMatrix64F p0, DenseMatrix64F pr, double min, double max)
{
double x0 = p0.data[0];
double y0 = p0.data[1];
double xr = pr.data[0];
double yr = pr.data[1];
double dx = xr-x0;
double dy = yr-y0;
double r = Math.sqrt(dx*dx+dy*dy);
if (r < min || r > max)
{
if (r < min)
{
r = min;
}
else
{
r = max;
}
double m = dy/dx;
if (Double.isInfinite(m))
{
if (m > 0)
{
pr.data[1] = y0 + r;
}
else
{
pr.data[1] = y0 - r;
}
}
else
{
double x = Math.sqrt((r*r)/(m*m+1));
double y = m*x;
pr.data[0] = x0 + x;
pr.data[1] = y0 + y;
}
}
} | [
"public",
"static",
"void",
"limitDistance",
"(",
"DenseMatrix64F",
"p0",
",",
"DenseMatrix64F",
"pr",
",",
"double",
"min",
",",
"double",
"max",
")",
"{",
"double",
"x0",
"=",
"p0",
".",
"data",
"[",
"0",
"]",
";",
"double",
"y0",
"=",
"p0",
".",
"data",
"[",
"1",
"]",
";",
"double",
"xr",
"=",
"pr",
".",
"data",
"[",
"0",
"]",
";",
"double",
"yr",
"=",
"pr",
".",
"data",
"[",
"1",
"]",
";",
"double",
"dx",
"=",
"xr",
"-",
"x0",
";",
"double",
"dy",
"=",
"yr",
"-",
"y0",
";",
"double",
"r",
"=",
"Math",
".",
"sqrt",
"(",
"dx",
"*",
"dx",
"+",
"dy",
"*",
"dy",
")",
";",
"if",
"(",
"r",
"<",
"min",
"||",
"r",
">",
"max",
")",
"{",
"if",
"(",
"r",
"<",
"min",
")",
"{",
"r",
"=",
"min",
";",
"}",
"else",
"{",
"r",
"=",
"max",
";",
"}",
"double",
"m",
"=",
"dy",
"/",
"dx",
";",
"if",
"(",
"Double",
".",
"isInfinite",
"(",
"m",
")",
")",
"{",
"if",
"(",
"m",
">",
"0",
")",
"{",
"pr",
".",
"data",
"[",
"1",
"]",
"=",
"y0",
"+",
"r",
";",
"}",
"else",
"{",
"pr",
".",
"data",
"[",
"1",
"]",
"=",
"y0",
"-",
"r",
";",
"}",
"}",
"else",
"{",
"double",
"x",
"=",
"Math",
".",
"sqrt",
"(",
"(",
"r",
"*",
"r",
")",
"/",
"(",
"m",
"*",
"m",
"+",
"1",
")",
")",
";",
"double",
"y",
"=",
"m",
"*",
"x",
";",
"pr",
".",
"data",
"[",
"0",
"]",
"=",
"x0",
"+",
"x",
";",
"pr",
".",
"data",
"[",
"1",
"]",
"=",
"y0",
"+",
"y",
";",
"}",
"}",
"}"
] | Changes pr so that distance from p0 is in range min - max. Slope of (p0,pr)
remains the same.
@param p0
@param pr
@param min
@param max | [
"Changes",
"pr",
"so",
"that",
"distance",
"from",
"p0",
"is",
"in",
"range",
"min",
"-",
"max",
".",
"Slope",
"of",
"(",
"p0",
"pr",
")",
"remains",
"the",
"same",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/CircleFitter.java#L147-L186 |
aoindustries/semanticcms-core-taglib | src/main/java/com/semanticcms/core/taglib/ElementTag.java | ElementTag.evaluateAttributes | protected void evaluateAttributes(E element, ELContext elContext) throws JspTagException, IOException {
"""
Resolves all attributes, setting into the created element as appropriate,
This is only called for captureLevel >= META.
Attributes are resolved before the element is added to any parent node.
Typically, deferred expressions will be evaluated here.
Overriding methods must call this implementation.
"""
String idStr = nullIfEmpty(resolveValue(id, String.class, elContext));
if(idStr != null) element.setId(idStr);
} | java | protected void evaluateAttributes(E element, ELContext elContext) throws JspTagException, IOException {
String idStr = nullIfEmpty(resolveValue(id, String.class, elContext));
if(idStr != null) element.setId(idStr);
} | [
"protected",
"void",
"evaluateAttributes",
"(",
"E",
"element",
",",
"ELContext",
"elContext",
")",
"throws",
"JspTagException",
",",
"IOException",
"{",
"String",
"idStr",
"=",
"nullIfEmpty",
"(",
"resolveValue",
"(",
"id",
",",
"String",
".",
"class",
",",
"elContext",
")",
")",
";",
"if",
"(",
"idStr",
"!=",
"null",
")",
"element",
".",
"setId",
"(",
"idStr",
")",
";",
"}"
] | Resolves all attributes, setting into the created element as appropriate,
This is only called for captureLevel >= META.
Attributes are resolved before the element is added to any parent node.
Typically, deferred expressions will be evaluated here.
Overriding methods must call this implementation. | [
"Resolves",
"all",
"attributes",
"setting",
"into",
"the",
"created",
"element",
"as",
"appropriate",
"This",
"is",
"only",
"called",
"for",
"captureLevel",
">",
"=",
"META",
".",
"Attributes",
"are",
"resolved",
"before",
"the",
"element",
"is",
"added",
"to",
"any",
"parent",
"node",
".",
"Typically",
"deferred",
"expressions",
"will",
"be",
"evaluated",
"here",
".",
"Overriding",
"methods",
"must",
"call",
"this",
"implementation",
"."
] | train | https://github.com/aoindustries/semanticcms-core-taglib/blob/2e6c5dd3b1299c6cc6a87a335302460c5c69c539/src/main/java/com/semanticcms/core/taglib/ElementTag.java#L179-L182 |
foundation-runtime/service-directory | 1.1/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java | DirectoryServiceClient.updateInstanceUri | public void updateInstanceUri(String serviceName, String instanceId, String uri, boolean isOwned) {
"""
Update the ServiceInstance attribute "uri".
@param serviceName
the service name.
@param instanceId
the instance id.
@param uri
the ServiceInstance URI.
@param isOwned
whether the DirectoryAPI owns this ServiceProvider.
"""
String serviceUri = toInstanceUri(serviceName, instanceId) + "/uri" ;
String body = null;
try {
body = "uri=" + URLEncoder.encode(uri, "UTF-8") + "&isOwned=" + isOwned;
} catch (UnsupportedEncodingException e) {
LOGGER.error("UTF-8 not supported. ", e);
}
Map<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/x-www-form-urlencoded");
HttpResponse result = invoker.invoke(serviceUri, body,
HttpMethod.PUT, headers);
if (result.getHttpCode() != HTTP_OK) {
throw new ServiceException(ErrorCode.REMOTE_DIRECTORY_SERVER_ERROR,
"HTTP Code is not OK, code=%s", result.getHttpCode());
}
} | java | public void updateInstanceUri(String serviceName, String instanceId, String uri, boolean isOwned){
String serviceUri = toInstanceUri(serviceName, instanceId) + "/uri" ;
String body = null;
try {
body = "uri=" + URLEncoder.encode(uri, "UTF-8") + "&isOwned=" + isOwned;
} catch (UnsupportedEncodingException e) {
LOGGER.error("UTF-8 not supported. ", e);
}
Map<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/x-www-form-urlencoded");
HttpResponse result = invoker.invoke(serviceUri, body,
HttpMethod.PUT, headers);
if (result.getHttpCode() != HTTP_OK) {
throw new ServiceException(ErrorCode.REMOTE_DIRECTORY_SERVER_ERROR,
"HTTP Code is not OK, code=%s", result.getHttpCode());
}
} | [
"public",
"void",
"updateInstanceUri",
"(",
"String",
"serviceName",
",",
"String",
"instanceId",
",",
"String",
"uri",
",",
"boolean",
"isOwned",
")",
"{",
"String",
"serviceUri",
"=",
"toInstanceUri",
"(",
"serviceName",
",",
"instanceId",
")",
"+",
"\"/uri\"",
";",
"String",
"body",
"=",
"null",
";",
"try",
"{",
"body",
"=",
"\"uri=\"",
"+",
"URLEncoder",
".",
"encode",
"(",
"uri",
",",
"\"UTF-8\"",
")",
"+",
"\"&isOwned=\"",
"+",
"isOwned",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"UTF-8 not supported. \"",
",",
"e",
")",
";",
"}",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"headers",
".",
"put",
"(",
"\"Content-Type\"",
",",
"\"application/x-www-form-urlencoded\"",
")",
";",
"HttpResponse",
"result",
"=",
"invoker",
".",
"invoke",
"(",
"serviceUri",
",",
"body",
",",
"HttpMethod",
".",
"PUT",
",",
"headers",
")",
";",
"if",
"(",
"result",
".",
"getHttpCode",
"(",
")",
"!=",
"HTTP_OK",
")",
"{",
"throw",
"new",
"ServiceException",
"(",
"ErrorCode",
".",
"REMOTE_DIRECTORY_SERVER_ERROR",
",",
"\"HTTP Code is not OK, code=%s\"",
",",
"result",
".",
"getHttpCode",
"(",
")",
")",
";",
"}",
"}"
] | Update the ServiceInstance attribute "uri".
@param serviceName
the service name.
@param instanceId
the instance id.
@param uri
the ServiceInstance URI.
@param isOwned
whether the DirectoryAPI owns this ServiceProvider. | [
"Update",
"the",
"ServiceInstance",
"attribute",
"uri",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.1/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L196-L214 |
samskivert/samskivert | src/main/java/com/samskivert/swing/util/ButtonUtil.java | ButtonUtil.bindToProperty | public static void bindToProperty (
String property, PrefsConfig config, AbstractButton button, boolean defval) {
"""
Binds the supplied button to the named boolean property in the supplied config repository.
When the button is pressed, it will update the config property and when the config property
is changed (by the button or by other means) it will update the selected state of the
button. When the button is made non-visible, it will be unbound to the config's property and
rebound again if it is once again visible.
"""
// create a config binding which will take care of everything
new ButtonConfigBinding(property, config, button, defval);
} | java | public static void bindToProperty (
String property, PrefsConfig config, AbstractButton button, boolean defval)
{
// create a config binding which will take care of everything
new ButtonConfigBinding(property, config, button, defval);
} | [
"public",
"static",
"void",
"bindToProperty",
"(",
"String",
"property",
",",
"PrefsConfig",
"config",
",",
"AbstractButton",
"button",
",",
"boolean",
"defval",
")",
"{",
"// create a config binding which will take care of everything",
"new",
"ButtonConfigBinding",
"(",
"property",
",",
"config",
",",
"button",
",",
"defval",
")",
";",
"}"
] | Binds the supplied button to the named boolean property in the supplied config repository.
When the button is pressed, it will update the config property and when the config property
is changed (by the button or by other means) it will update the selected state of the
button. When the button is made non-visible, it will be unbound to the config's property and
rebound again if it is once again visible. | [
"Binds",
"the",
"supplied",
"button",
"to",
"the",
"named",
"boolean",
"property",
"in",
"the",
"supplied",
"config",
"repository",
".",
"When",
"the",
"button",
"is",
"pressed",
"it",
"will",
"update",
"the",
"config",
"property",
"and",
"when",
"the",
"config",
"property",
"is",
"changed",
"(",
"by",
"the",
"button",
"or",
"by",
"other",
"means",
")",
"it",
"will",
"update",
"the",
"selected",
"state",
"of",
"the",
"button",
".",
"When",
"the",
"button",
"is",
"made",
"non",
"-",
"visible",
"it",
"will",
"be",
"unbound",
"to",
"the",
"config",
"s",
"property",
"and",
"rebound",
"again",
"if",
"it",
"is",
"once",
"again",
"visible",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/ButtonUtil.java#L55-L60 |
alibaba/jstorm | example/sequence-split-merge/src/main/java/org/apache/storm/starter/trident/TridentMinMaxOfDevicesTopology.java | TridentMinMaxOfDevicesTopology.buildDevicesTopology | public static StormTopology buildDevicesTopology() {
"""
Creates a topology with device-id and count (which are whole numbers) as
tuple fields in a stream and it finally generates result stream based on
min amd max with device-id and count values.
"""
String deviceID = "device-id";
String count = "count";
Fields allFields = new Fields(deviceID, count);
RandomNumberGeneratorSpout spout = new RandomNumberGeneratorSpout(allFields, 10, 1000);
TridentTopology topology = new TridentTopology();
Stream devicesStream = topology.newStream("devicegen-spout", spout).each(allFields, new Debug("##### devices"));
devicesStream.minBy(deviceID).each(allFields, new Debug("#### device with min id"));
devicesStream.maxBy(count).each(allFields, new Debug("#### device with max count"));
return topology.build();
} | java | public static StormTopology buildDevicesTopology() {
String deviceID = "device-id";
String count = "count";
Fields allFields = new Fields(deviceID, count);
RandomNumberGeneratorSpout spout = new RandomNumberGeneratorSpout(allFields, 10, 1000);
TridentTopology topology = new TridentTopology();
Stream devicesStream = topology.newStream("devicegen-spout", spout).each(allFields, new Debug("##### devices"));
devicesStream.minBy(deviceID).each(allFields, new Debug("#### device with min id"));
devicesStream.maxBy(count).each(allFields, new Debug("#### device with max count"));
return topology.build();
} | [
"public",
"static",
"StormTopology",
"buildDevicesTopology",
"(",
")",
"{",
"String",
"deviceID",
"=",
"\"device-id\"",
";",
"String",
"count",
"=",
"\"count\"",
";",
"Fields",
"allFields",
"=",
"new",
"Fields",
"(",
"deviceID",
",",
"count",
")",
";",
"RandomNumberGeneratorSpout",
"spout",
"=",
"new",
"RandomNumberGeneratorSpout",
"(",
"allFields",
",",
"10",
",",
"1000",
")",
";",
"TridentTopology",
"topology",
"=",
"new",
"TridentTopology",
"(",
")",
";",
"Stream",
"devicesStream",
"=",
"topology",
".",
"newStream",
"(",
"\"devicegen-spout\"",
",",
"spout",
")",
".",
"each",
"(",
"allFields",
",",
"new",
"Debug",
"(",
"\"##### devices\"",
")",
")",
";",
"devicesStream",
".",
"minBy",
"(",
"deviceID",
")",
".",
"each",
"(",
"allFields",
",",
"new",
"Debug",
"(",
"\"#### device with min id\"",
")",
")",
";",
"devicesStream",
".",
"maxBy",
"(",
"count",
")",
".",
"each",
"(",
"allFields",
",",
"new",
"Debug",
"(",
"\"#### device with max count\"",
")",
")",
";",
"return",
"topology",
".",
"build",
"(",
")",
";",
"}"
] | Creates a topology with device-id and count (which are whole numbers) as
tuple fields in a stream and it finally generates result stream based on
min amd max with device-id and count values. | [
"Creates",
"a",
"topology",
"with",
"device",
"-",
"id",
"and",
"count",
"(",
"which",
"are",
"whole",
"numbers",
")",
"as",
"tuple",
"fields",
"in",
"a",
"stream",
"and",
"it",
"finally",
"generates",
"result",
"stream",
"based",
"on",
"min",
"amd",
"max",
"with",
"device",
"-",
"id",
"and",
"count",
"values",
"."
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/example/sequence-split-merge/src/main/java/org/apache/storm/starter/trident/TridentMinMaxOfDevicesTopology.java#L55-L70 |
spockframework/spock | spock-core/src/main/java/org/spockframework/gentyref/GenericTypeReflector.java | GenericTypeReflector.buildUpperBoundClassAndInterfaces | private static void buildUpperBoundClassAndInterfaces(Type type, Set<Class<?>> result) {
"""
Helper method for getUpperBoundClassAndInterfaces, adding the result to the given set.
"""
if (type instanceof ParameterizedType || type instanceof Class<?>) {
result.add(erase(type));
return;
}
for (Type superType: getExactDirectSuperTypes(type)) {
buildUpperBoundClassAndInterfaces(superType, result);
}
} | java | private static void buildUpperBoundClassAndInterfaces(Type type, Set<Class<?>> result) {
if (type instanceof ParameterizedType || type instanceof Class<?>) {
result.add(erase(type));
return;
}
for (Type superType: getExactDirectSuperTypes(type)) {
buildUpperBoundClassAndInterfaces(superType, result);
}
} | [
"private",
"static",
"void",
"buildUpperBoundClassAndInterfaces",
"(",
"Type",
"type",
",",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"result",
")",
"{",
"if",
"(",
"type",
"instanceof",
"ParameterizedType",
"||",
"type",
"instanceof",
"Class",
"<",
"?",
">",
")",
"{",
"result",
".",
"add",
"(",
"erase",
"(",
"type",
")",
")",
";",
"return",
";",
"}",
"for",
"(",
"Type",
"superType",
":",
"getExactDirectSuperTypes",
"(",
"type",
")",
")",
"{",
"buildUpperBoundClassAndInterfaces",
"(",
"superType",
",",
"result",
")",
";",
"}",
"}"
] | Helper method for getUpperBoundClassAndInterfaces, adding the result to the given set. | [
"Helper",
"method",
"for",
"getUpperBoundClassAndInterfaces",
"adding",
"the",
"result",
"to",
"the",
"given",
"set",
"."
] | train | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/gentyref/GenericTypeReflector.java#L431-L440 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.writeHistoryProject | public void writeHistoryProject(CmsRequestContext context, int publishTag, long publishDate) throws CmsException {
"""
Creates a historical entry of the current project.<p>
@param context the current request context
@param publishTag the correlative publish tag
@param publishDate the date of publishing
@throws CmsException if operation was not successful
"""
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
m_driverManager.writeHistoryProject(dbc, publishTag, publishDate);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(
Messages.ERR_HISTORY_PROJECT_4,
new Object[] {
new Integer(publishTag),
dbc.currentProject().getName(),
dbc.currentProject().getUuid(),
new Long(publishDate)}),
e);
} finally {
dbc.clear();
}
} | java | public void writeHistoryProject(CmsRequestContext context, int publishTag, long publishDate) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
m_driverManager.writeHistoryProject(dbc, publishTag, publishDate);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(
Messages.ERR_HISTORY_PROJECT_4,
new Object[] {
new Integer(publishTag),
dbc.currentProject().getName(),
dbc.currentProject().getUuid(),
new Long(publishDate)}),
e);
} finally {
dbc.clear();
}
} | [
"public",
"void",
"writeHistoryProject",
"(",
"CmsRequestContext",
"context",
",",
"int",
"publishTag",
",",
"long",
"publishDate",
")",
"throws",
"CmsException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")",
";",
"try",
"{",
"m_driverManager",
".",
"writeHistoryProject",
"(",
"dbc",
",",
"publishTag",
",",
"publishDate",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"dbc",
".",
"report",
"(",
"null",
",",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"ERR_HISTORY_PROJECT_4",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Integer",
"(",
"publishTag",
")",
",",
"dbc",
".",
"currentProject",
"(",
")",
".",
"getName",
"(",
")",
",",
"dbc",
".",
"currentProject",
"(",
")",
".",
"getUuid",
"(",
")",
",",
"new",
"Long",
"(",
"publishDate",
")",
"}",
")",
",",
"e",
")",
";",
"}",
"finally",
"{",
"dbc",
".",
"clear",
"(",
")",
";",
"}",
"}"
] | Creates a historical entry of the current project.<p>
@param context the current request context
@param publishTag the correlative publish tag
@param publishDate the date of publishing
@throws CmsException if operation was not successful | [
"Creates",
"a",
"historical",
"entry",
"of",
"the",
"current",
"project",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L6688-L6707 |
rythmengine/rythmengine | src/main/java/org/rythmengine/toString/ToStringStyle.java | ToStringStyle.appendDetail | protected void appendDetail(StringBuilder buffer, String fieldName, Object value) {
"""
<p>Append to the <code>toString</code> an <code>Object</code>
value, printing the full detail of the <code>Object</code>.</p>
@param buffer the <code>StringBuilder</code> to populate
@param fieldName the field name, typically not used as already appended
@param value the value to add to the <code>toString</code>,
not <code>null</code>
"""
buffer.append(value);
} | java | protected void appendDetail(StringBuilder buffer, String fieldName, Object value) {
buffer.append(value);
} | [
"protected",
"void",
"appendDetail",
"(",
"StringBuilder",
"buffer",
",",
"String",
"fieldName",
",",
"Object",
"value",
")",
"{",
"buffer",
".",
"append",
"(",
"value",
")",
";",
"}"
] | <p>Append to the <code>toString</code> an <code>Object</code>
value, printing the full detail of the <code>Object</code>.</p>
@param buffer the <code>StringBuilder</code> to populate
@param fieldName the field name, typically not used as already appended
@param value the value to add to the <code>toString</code>,
not <code>null</code> | [
"<p",
">",
"Append",
"to",
"the",
"<code",
">",
"toString<",
"/",
"code",
">",
"an",
"<code",
">",
"Object<",
"/",
"code",
">",
"value",
"printing",
"the",
"full",
"detail",
"of",
"the",
"<code",
">",
"Object<",
"/",
"code",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/toString/ToStringStyle.java#L591-L593 |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java | AbsSetting.getLong | public Long getLong(String key, String group, Long defaultValue) {
"""
获取long类型属性值
@param key 属性名
@param group 分组名
@param defaultValue 默认值
@return 属性值
"""
return Convert.toLong(getByGroup(key, group), defaultValue);
} | java | public Long getLong(String key, String group, Long defaultValue) {
return Convert.toLong(getByGroup(key, group), defaultValue);
} | [
"public",
"Long",
"getLong",
"(",
"String",
"key",
",",
"String",
"group",
",",
"Long",
"defaultValue",
")",
"{",
"return",
"Convert",
".",
"toLong",
"(",
"getByGroup",
"(",
"key",
",",
"group",
")",
",",
"defaultValue",
")",
";",
"}"
] | 获取long类型属性值
@param key 属性名
@param group 分组名
@param defaultValue 默认值
@return 属性值 | [
"获取long类型属性值"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java#L212-L214 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/NotificationChannelServiceClient.java | NotificationChannelServiceClient.deleteNotificationChannel | public final void deleteNotificationChannel(NotificationChannelName name, boolean force) {
"""
Deletes a notification channel.
<p>Sample code:
<pre><code>
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
boolean force = false;
notificationChannelServiceClient.deleteNotificationChannel(name, force);
}
</code></pre>
@param name The channel for which to execute the request. The format is
`projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`.
@param force If true, the notification channel will be deleted regardless of its use in alert
policies (the policies will be updated to remove the channel). If false, channels that are
still referenced by an existing alerting policy will fail to be deleted in a delete
operation.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
"""
DeleteNotificationChannelRequest request =
DeleteNotificationChannelRequest.newBuilder()
.setName(name == null ? null : name.toString())
.setForce(force)
.build();
deleteNotificationChannel(request);
} | java | public final void deleteNotificationChannel(NotificationChannelName name, boolean force) {
DeleteNotificationChannelRequest request =
DeleteNotificationChannelRequest.newBuilder()
.setName(name == null ? null : name.toString())
.setForce(force)
.build();
deleteNotificationChannel(request);
} | [
"public",
"final",
"void",
"deleteNotificationChannel",
"(",
"NotificationChannelName",
"name",
",",
"boolean",
"force",
")",
"{",
"DeleteNotificationChannelRequest",
"request",
"=",
"DeleteNotificationChannelRequest",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"name",
"==",
"null",
"?",
"null",
":",
"name",
".",
"toString",
"(",
")",
")",
".",
"setForce",
"(",
"force",
")",
".",
"build",
"(",
")",
";",
"deleteNotificationChannel",
"(",
"request",
")",
";",
"}"
] | Deletes a notification channel.
<p>Sample code:
<pre><code>
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
boolean force = false;
notificationChannelServiceClient.deleteNotificationChannel(name, force);
}
</code></pre>
@param name The channel for which to execute the request. The format is
`projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`.
@param force If true, the notification channel will be deleted regardless of its use in alert
policies (the policies will be updated to remove the channel). If false, channels that are
still referenced by an existing alerting policy will fail to be deleted in a delete
operation.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Deletes",
"a",
"notification",
"channel",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/NotificationChannelServiceClient.java#L904-L912 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/StrictMath.java | StrictMath.copySign | public static double copySign(double magnitude, double sign) {
"""
Returns the first floating-point argument with the sign of the
second floating-point argument. For this method, a NaN
{@code sign} argument is always treated as if it were
positive.
@param magnitude the parameter providing the magnitude of the result
@param sign the parameter providing the sign of the result
@return a value with the magnitude of {@code magnitude}
and the sign of {@code sign}.
@since 1.6
"""
return Math.copySign(magnitude, (Double.isNaN(sign)?1.0d:sign));
} | java | public static double copySign(double magnitude, double sign) {
return Math.copySign(magnitude, (Double.isNaN(sign)?1.0d:sign));
} | [
"public",
"static",
"double",
"copySign",
"(",
"double",
"magnitude",
",",
"double",
"sign",
")",
"{",
"return",
"Math",
".",
"copySign",
"(",
"magnitude",
",",
"(",
"Double",
".",
"isNaN",
"(",
"sign",
")",
"?",
"1.0d",
":",
"sign",
")",
")",
";",
"}"
] | Returns the first floating-point argument with the sign of the
second floating-point argument. For this method, a NaN
{@code sign} argument is always treated as if it were
positive.
@param magnitude the parameter providing the magnitude of the result
@param sign the parameter providing the sign of the result
@return a value with the magnitude of {@code magnitude}
and the sign of {@code sign}.
@since 1.6 | [
"Returns",
"the",
"first",
"floating",
"-",
"point",
"argument",
"with",
"the",
"sign",
"of",
"the",
"second",
"floating",
"-",
"point",
"argument",
".",
"For",
"this",
"method",
"a",
"NaN",
"{",
"@code",
"sign",
"}",
"argument",
"is",
"always",
"treated",
"as",
"if",
"it",
"were",
"positive",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/StrictMath.java#L1387-L1389 |
alibaba/jstorm | jstorm-core/src/main/java/backtype/storm/ConfigValidation.java | ConfigValidation.listFv | public static NestableFieldValidator listFv(Class cls, boolean nullAllowed) {
"""
Returns a new NestableFieldValidator for a List of the given Class.
@param cls the Class of elements composing the list
@param nullAllowed whether or not a value of null is valid
@return a NestableFieldValidator for a list of the given class
"""
return listFv(fv(cls, false), nullAllowed);
} | java | public static NestableFieldValidator listFv(Class cls, boolean nullAllowed) {
return listFv(fv(cls, false), nullAllowed);
} | [
"public",
"static",
"NestableFieldValidator",
"listFv",
"(",
"Class",
"cls",
",",
"boolean",
"nullAllowed",
")",
"{",
"return",
"listFv",
"(",
"fv",
"(",
"cls",
",",
"false",
")",
",",
"nullAllowed",
")",
";",
"}"
] | Returns a new NestableFieldValidator for a List of the given Class.
@param cls the Class of elements composing the list
@param nullAllowed whether or not a value of null is valid
@return a NestableFieldValidator for a list of the given class | [
"Returns",
"a",
"new",
"NestableFieldValidator",
"for",
"a",
"List",
"of",
"the",
"given",
"Class",
"."
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/ConfigValidation.java#L89-L91 |
Alluxio/alluxio | core/common/src/main/java/alluxio/underfs/UnderFileSystemConfiguration.java | UnderFileSystemConfiguration.createMountSpecificConf | public UnderFileSystemConfiguration createMountSpecificConf(Map<String, String> mountConf) {
"""
Creates a new instance from the current configuration and adds in new properties.
@param mountConf the mount specific configuration map
@return the updated configuration object
"""
UnderFileSystemConfiguration ufsConf = new UnderFileSystemConfiguration(mProperties.copy());
ufsConf.mProperties.merge(mountConf, Source.MOUNT_OPTION);
ufsConf.mReadOnly = mReadOnly;
ufsConf.mShared = mShared;
return ufsConf;
} | java | public UnderFileSystemConfiguration createMountSpecificConf(Map<String, String> mountConf) {
UnderFileSystemConfiguration ufsConf = new UnderFileSystemConfiguration(mProperties.copy());
ufsConf.mProperties.merge(mountConf, Source.MOUNT_OPTION);
ufsConf.mReadOnly = mReadOnly;
ufsConf.mShared = mShared;
return ufsConf;
} | [
"public",
"UnderFileSystemConfiguration",
"createMountSpecificConf",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"mountConf",
")",
"{",
"UnderFileSystemConfiguration",
"ufsConf",
"=",
"new",
"UnderFileSystemConfiguration",
"(",
"mProperties",
".",
"copy",
"(",
")",
")",
";",
"ufsConf",
".",
"mProperties",
".",
"merge",
"(",
"mountConf",
",",
"Source",
".",
"MOUNT_OPTION",
")",
";",
"ufsConf",
".",
"mReadOnly",
"=",
"mReadOnly",
";",
"ufsConf",
".",
"mShared",
"=",
"mShared",
";",
"return",
"ufsConf",
";",
"}"
] | Creates a new instance from the current configuration and adds in new properties.
@param mountConf the mount specific configuration map
@return the updated configuration object | [
"Creates",
"a",
"new",
"instance",
"from",
"the",
"current",
"configuration",
"and",
"adds",
"in",
"new",
"properties",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/underfs/UnderFileSystemConfiguration.java#L121-L127 |
opsmatters/newrelic-api | src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java | HttpContext.executePatchRequest | protected <T> Optional<T> executePatchRequest(URI uri, Object obj, Map<String, Object> headers,
List<String> queryParams, GenericType<T> returnType) {
"""
Execute a PATCH request with a return object.
@param <T> The type parameter used for the return object
@param uri The URI to call
@param obj The object to use for the PATCH
@param headers A set of headers to add to the request
@param queryParams A set of query parameters to add to the request
@param returnType The type to marshall the result back into
@return The return type
"""
WebTarget target = this.client.target(uri);
target = applyQueryParams(target, queryParams);
Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON);
applyHeaders(invocation, headers);
if(obj == null)
obj = Entity.text("");
Response response = invocation.method("PATCH", Entity.entity(obj, MediaType.APPLICATION_JSON));
handleResponseError("PATCH", uri, response);
logResponse(uri, response);
return extractEntityFromResponse(response, returnType);
} | java | protected <T> Optional<T> executePatchRequest(URI uri, Object obj, Map<String, Object> headers,
List<String> queryParams, GenericType<T> returnType)
{
WebTarget target = this.client.target(uri);
target = applyQueryParams(target, queryParams);
Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON);
applyHeaders(invocation, headers);
if(obj == null)
obj = Entity.text("");
Response response = invocation.method("PATCH", Entity.entity(obj, MediaType.APPLICATION_JSON));
handleResponseError("PATCH", uri, response);
logResponse(uri, response);
return extractEntityFromResponse(response, returnType);
} | [
"protected",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"executePatchRequest",
"(",
"URI",
"uri",
",",
"Object",
"obj",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"headers",
",",
"List",
"<",
"String",
">",
"queryParams",
",",
"GenericType",
"<",
"T",
">",
"returnType",
")",
"{",
"WebTarget",
"target",
"=",
"this",
".",
"client",
".",
"target",
"(",
"uri",
")",
";",
"target",
"=",
"applyQueryParams",
"(",
"target",
",",
"queryParams",
")",
";",
"Invocation",
".",
"Builder",
"invocation",
"=",
"target",
".",
"request",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
";",
"applyHeaders",
"(",
"invocation",
",",
"headers",
")",
";",
"if",
"(",
"obj",
"==",
"null",
")",
"obj",
"=",
"Entity",
".",
"text",
"(",
"\"\"",
")",
";",
"Response",
"response",
"=",
"invocation",
".",
"method",
"(",
"\"PATCH\"",
",",
"Entity",
".",
"entity",
"(",
"obj",
",",
"MediaType",
".",
"APPLICATION_JSON",
")",
")",
";",
"handleResponseError",
"(",
"\"PATCH\"",
",",
"uri",
",",
"response",
")",
";",
"logResponse",
"(",
"uri",
",",
"response",
")",
";",
"return",
"extractEntityFromResponse",
"(",
"response",
",",
"returnType",
")",
";",
"}"
] | Execute a PATCH request with a return object.
@param <T> The type parameter used for the return object
@param uri The URI to call
@param obj The object to use for the PATCH
@param headers A set of headers to add to the request
@param queryParams A set of query parameters to add to the request
@param returnType The type to marshall the result back into
@return The return type | [
"Execute",
"a",
"PATCH",
"request",
"with",
"a",
"return",
"object",
"."
] | train | https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L512-L525 |
citrusframework/citrus | modules/citrus-zookeeper/src/main/java/com/consol/citrus/zookeeper/server/ZooServer.java | ZooServer.getZooKeeperServer | public ZooKeeperServer getZooKeeperServer() {
"""
Gets the value of the zooKeeperServer property.
@return the zooKeeperServer
"""
if (zooKeeperServer == null) {
String dataDirectory = System.getProperty("java.io.tmpdir");
File dir = new File(dataDirectory, "zookeeper").getAbsoluteFile();
try {
zooKeeperServer = new ZooKeeperServer(dir, dir, 2000);
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to create default zookeeper server", e);
}
}
return zooKeeperServer;
} | java | public ZooKeeperServer getZooKeeperServer() {
if (zooKeeperServer == null) {
String dataDirectory = System.getProperty("java.io.tmpdir");
File dir = new File(dataDirectory, "zookeeper").getAbsoluteFile();
try {
zooKeeperServer = new ZooKeeperServer(dir, dir, 2000);
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to create default zookeeper server", e);
}
}
return zooKeeperServer;
} | [
"public",
"ZooKeeperServer",
"getZooKeeperServer",
"(",
")",
"{",
"if",
"(",
"zooKeeperServer",
"==",
"null",
")",
"{",
"String",
"dataDirectory",
"=",
"System",
".",
"getProperty",
"(",
"\"java.io.tmpdir\"",
")",
";",
"File",
"dir",
"=",
"new",
"File",
"(",
"dataDirectory",
",",
"\"zookeeper\"",
")",
".",
"getAbsoluteFile",
"(",
")",
";",
"try",
"{",
"zooKeeperServer",
"=",
"new",
"ZooKeeperServer",
"(",
"dir",
",",
"dir",
",",
"2000",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"CitrusRuntimeException",
"(",
"\"Failed to create default zookeeper server\"",
",",
"e",
")",
";",
"}",
"}",
"return",
"zooKeeperServer",
";",
"}"
] | Gets the value of the zooKeeperServer property.
@return the zooKeeperServer | [
"Gets",
"the",
"value",
"of",
"the",
"zooKeeperServer",
"property",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-zookeeper/src/main/java/com/consol/citrus/zookeeper/server/ZooServer.java#L85-L97 |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetTable.java | TargetTable.toggleTagAssignment | public TargetTagAssignmentResult toggleTagAssignment(final Collection<Long> targetIds, final String targTagName) {
"""
Toggles {@link TargetTag} assignment to given target ids by means that if
some (or all) of the targets in the list have the {@link Tag} not yet
assigned, they will be. If all of theme have the tag already assigned
they will be removed instead. Additionally a success popup is shown.
@param targetIds
to toggle for
@param targTagName
to toggle
@return TagAssigmentResult with all meta data of the assignment outcome.
"""
final List<String> controllerIds = targetManagement.get(targetIds).stream().map(Target::getControllerId)
.collect(Collectors.toList());
if (controllerIds.isEmpty()) {
getNotification().displayWarning(getI18n().getMessage("targets.not.exists"));
return new TargetTagAssignmentResult(0, 0, 0, Lists.newArrayListWithCapacity(0),
Lists.newArrayListWithCapacity(0), null);
}
final Optional<TargetTag> tag = tagManagement.getByName(targTagName);
if (!tag.isPresent()) {
getNotification().displayWarning(getI18n().getMessage("targettag.not.exists", targTagName));
return new TargetTagAssignmentResult(0, 0, 0, Lists.newArrayListWithCapacity(0),
Lists.newArrayListWithCapacity(0), null);
}
final TargetTagAssignmentResult result = targetManagement.toggleTagAssignment(controllerIds, targTagName);
getNotification().displaySuccess(HawkbitCommonUtil.createAssignmentMessage(targTagName, result, getI18n()));
return result;
} | java | public TargetTagAssignmentResult toggleTagAssignment(final Collection<Long> targetIds, final String targTagName) {
final List<String> controllerIds = targetManagement.get(targetIds).stream().map(Target::getControllerId)
.collect(Collectors.toList());
if (controllerIds.isEmpty()) {
getNotification().displayWarning(getI18n().getMessage("targets.not.exists"));
return new TargetTagAssignmentResult(0, 0, 0, Lists.newArrayListWithCapacity(0),
Lists.newArrayListWithCapacity(0), null);
}
final Optional<TargetTag> tag = tagManagement.getByName(targTagName);
if (!tag.isPresent()) {
getNotification().displayWarning(getI18n().getMessage("targettag.not.exists", targTagName));
return new TargetTagAssignmentResult(0, 0, 0, Lists.newArrayListWithCapacity(0),
Lists.newArrayListWithCapacity(0), null);
}
final TargetTagAssignmentResult result = targetManagement.toggleTagAssignment(controllerIds, targTagName);
getNotification().displaySuccess(HawkbitCommonUtil.createAssignmentMessage(targTagName, result, getI18n()));
return result;
} | [
"public",
"TargetTagAssignmentResult",
"toggleTagAssignment",
"(",
"final",
"Collection",
"<",
"Long",
">",
"targetIds",
",",
"final",
"String",
"targTagName",
")",
"{",
"final",
"List",
"<",
"String",
">",
"controllerIds",
"=",
"targetManagement",
".",
"get",
"(",
"targetIds",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"Target",
"::",
"getControllerId",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
";",
"if",
"(",
"controllerIds",
".",
"isEmpty",
"(",
")",
")",
"{",
"getNotification",
"(",
")",
".",
"displayWarning",
"(",
"getI18n",
"(",
")",
".",
"getMessage",
"(",
"\"targets.not.exists\"",
")",
")",
";",
"return",
"new",
"TargetTagAssignmentResult",
"(",
"0",
",",
"0",
",",
"0",
",",
"Lists",
".",
"newArrayListWithCapacity",
"(",
"0",
")",
",",
"Lists",
".",
"newArrayListWithCapacity",
"(",
"0",
")",
",",
"null",
")",
";",
"}",
"final",
"Optional",
"<",
"TargetTag",
">",
"tag",
"=",
"tagManagement",
".",
"getByName",
"(",
"targTagName",
")",
";",
"if",
"(",
"!",
"tag",
".",
"isPresent",
"(",
")",
")",
"{",
"getNotification",
"(",
")",
".",
"displayWarning",
"(",
"getI18n",
"(",
")",
".",
"getMessage",
"(",
"\"targettag.not.exists\"",
",",
"targTagName",
")",
")",
";",
"return",
"new",
"TargetTagAssignmentResult",
"(",
"0",
",",
"0",
",",
"0",
",",
"Lists",
".",
"newArrayListWithCapacity",
"(",
"0",
")",
",",
"Lists",
".",
"newArrayListWithCapacity",
"(",
"0",
")",
",",
"null",
")",
";",
"}",
"final",
"TargetTagAssignmentResult",
"result",
"=",
"targetManagement",
".",
"toggleTagAssignment",
"(",
"controllerIds",
",",
"targTagName",
")",
";",
"getNotification",
"(",
")",
".",
"displaySuccess",
"(",
"HawkbitCommonUtil",
".",
"createAssignmentMessage",
"(",
"targTagName",
",",
"result",
",",
"getI18n",
"(",
")",
")",
")",
";",
"return",
"result",
";",
"}"
] | Toggles {@link TargetTag} assignment to given target ids by means that if
some (or all) of the targets in the list have the {@link Tag} not yet
assigned, they will be. If all of theme have the tag already assigned
they will be removed instead. Additionally a success popup is shown.
@param targetIds
to toggle for
@param targTagName
to toggle
@return TagAssigmentResult with all meta data of the assignment outcome. | [
"Toggles",
"{",
"@link",
"TargetTag",
"}",
"assignment",
"to",
"given",
"target",
"ids",
"by",
"means",
"that",
"if",
"some",
"(",
"or",
"all",
")",
"of",
"the",
"targets",
"in",
"the",
"list",
"have",
"the",
"{",
"@link",
"Tag",
"}",
"not",
"yet",
"assigned",
"they",
"will",
"be",
".",
"If",
"all",
"of",
"theme",
"have",
"the",
"tag",
"already",
"assigned",
"they",
"will",
"be",
"removed",
"instead",
".",
"Additionally",
"a",
"success",
"popup",
"is",
"shown",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetTable.java#L549-L570 |
igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java | OmemoManager.getDevicesOf | public Set<OmemoDevice> getDevicesOf(BareJid contact) {
"""
Return a set of all OMEMO capable devices of a contact.
Note, that this method does not explicitly refresh the device list of the contact, so it might be outdated.
@see #requestDeviceListUpdateFor(BareJid)
@param contact contact we want to get a set of device of.
@return set of known devices of that contact.
"""
OmemoCachedDeviceList list = getOmemoService().getOmemoStoreBackend().loadCachedDeviceList(getOwnDevice(), contact);
HashSet<OmemoDevice> devices = new HashSet<>();
for (int deviceId : list.getActiveDevices()) {
devices.add(new OmemoDevice(contact, deviceId));
}
return devices;
} | java | public Set<OmemoDevice> getDevicesOf(BareJid contact) {
OmemoCachedDeviceList list = getOmemoService().getOmemoStoreBackend().loadCachedDeviceList(getOwnDevice(), contact);
HashSet<OmemoDevice> devices = new HashSet<>();
for (int deviceId : list.getActiveDevices()) {
devices.add(new OmemoDevice(contact, deviceId));
}
return devices;
} | [
"public",
"Set",
"<",
"OmemoDevice",
">",
"getDevicesOf",
"(",
"BareJid",
"contact",
")",
"{",
"OmemoCachedDeviceList",
"list",
"=",
"getOmemoService",
"(",
")",
".",
"getOmemoStoreBackend",
"(",
")",
".",
"loadCachedDeviceList",
"(",
"getOwnDevice",
"(",
")",
",",
"contact",
")",
";",
"HashSet",
"<",
"OmemoDevice",
">",
"devices",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"deviceId",
":",
"list",
".",
"getActiveDevices",
"(",
")",
")",
"{",
"devices",
".",
"add",
"(",
"new",
"OmemoDevice",
"(",
"contact",
",",
"deviceId",
")",
")",
";",
"}",
"return",
"devices",
";",
"}"
] | Return a set of all OMEMO capable devices of a contact.
Note, that this method does not explicitly refresh the device list of the contact, so it might be outdated.
@see #requestDeviceListUpdateFor(BareJid)
@param contact contact we want to get a set of device of.
@return set of known devices of that contact. | [
"Return",
"a",
"set",
"of",
"all",
"OMEMO",
"capable",
"devices",
"of",
"a",
"contact",
".",
"Note",
"that",
"this",
"method",
"does",
"not",
"explicitly",
"refresh",
"the",
"device",
"list",
"of",
"the",
"contact",
"so",
"it",
"might",
"be",
"outdated",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java#L282-L291 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java | TreeInfo.setSymbol | public static void setSymbol(JCTree tree, Symbol sym) {
"""
If this tree is an identifier or a field, set its symbol, otherwise skip.
"""
tree = skipParens(tree);
switch (tree.getTag()) {
case IDENT:
((JCIdent) tree).sym = sym; break;
case SELECT:
((JCFieldAccess) tree).sym = sym; break;
default:
}
} | java | public static void setSymbol(JCTree tree, Symbol sym) {
tree = skipParens(tree);
switch (tree.getTag()) {
case IDENT:
((JCIdent) tree).sym = sym; break;
case SELECT:
((JCFieldAccess) tree).sym = sym; break;
default:
}
} | [
"public",
"static",
"void",
"setSymbol",
"(",
"JCTree",
"tree",
",",
"Symbol",
"sym",
")",
"{",
"tree",
"=",
"skipParens",
"(",
"tree",
")",
";",
"switch",
"(",
"tree",
".",
"getTag",
"(",
")",
")",
"{",
"case",
"IDENT",
":",
"(",
"(",
"JCIdent",
")",
"tree",
")",
".",
"sym",
"=",
"sym",
";",
"break",
";",
"case",
"SELECT",
":",
"(",
"(",
"JCFieldAccess",
")",
"tree",
")",
".",
"sym",
"=",
"sym",
";",
"break",
";",
"default",
":",
"}",
"}"
] | If this tree is an identifier or a field, set its symbol, otherwise skip. | [
"If",
"this",
"tree",
"is",
"an",
"identifier",
"or",
"a",
"field",
"set",
"its",
"symbol",
"otherwise",
"skip",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L859-L868 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java | BoxApiFile.getDownloadRequest | public BoxRequestsFile.DownloadFile getDownloadRequest(OutputStream outputStream, String fileId) {
"""
Gets a request that downloads the given file to the provided outputStream. Developer is responsible for closing the outputStream provided.
@param outputStream outputStream to write file contents to.
@param fileId the file id to download.
@return request to download a file to an output stream
"""
BoxRequestsFile.DownloadFile request = new BoxRequestsFile.DownloadFile(fileId, outputStream, getFileDownloadUrl(fileId),mSession);
return request;
} | java | public BoxRequestsFile.DownloadFile getDownloadRequest(OutputStream outputStream, String fileId) {
BoxRequestsFile.DownloadFile request = new BoxRequestsFile.DownloadFile(fileId, outputStream, getFileDownloadUrl(fileId),mSession);
return request;
} | [
"public",
"BoxRequestsFile",
".",
"DownloadFile",
"getDownloadRequest",
"(",
"OutputStream",
"outputStream",
",",
"String",
"fileId",
")",
"{",
"BoxRequestsFile",
".",
"DownloadFile",
"request",
"=",
"new",
"BoxRequestsFile",
".",
"DownloadFile",
"(",
"fileId",
",",
"outputStream",
",",
"getFileDownloadUrl",
"(",
"fileId",
")",
",",
"mSession",
")",
";",
"return",
"request",
";",
"}"
] | Gets a request that downloads the given file to the provided outputStream. Developer is responsible for closing the outputStream provided.
@param outputStream outputStream to write file contents to.
@param fileId the file id to download.
@return request to download a file to an output stream | [
"Gets",
"a",
"request",
"that",
"downloads",
"the",
"given",
"file",
"to",
"the",
"provided",
"outputStream",
".",
"Developer",
"is",
"responsible",
"for",
"closing",
"the",
"outputStream",
"provided",
"."
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java#L398-L401 |
maxirosson/jdroid-android | jdroid-android-google-maps/src/main/java/com/jdroid/android/google/maps/MapUtils.java | MapUtils.vectorToBitmap | public static BitmapDescriptor vectorToBitmap(@DrawableRes int drawableRes, @ColorRes int colorRes) {
"""
Convert a {@link Drawable} to a {@link BitmapDescriptor}, for use as a marker icon.
"""
Drawable vectorDrawable = VectorDrawableCompat.create(AbstractApplication.get().getResources(), drawableRes, null);
Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(), vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
DrawableCompat.setTint(vectorDrawable, AbstractApplication.get().getResources().getColor(colorRes));
vectorDrawable.draw(canvas);
return BitmapDescriptorFactory.fromBitmap(bitmap);
} | java | public static BitmapDescriptor vectorToBitmap(@DrawableRes int drawableRes, @ColorRes int colorRes) {
Drawable vectorDrawable = VectorDrawableCompat.create(AbstractApplication.get().getResources(), drawableRes, null);
Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(), vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
DrawableCompat.setTint(vectorDrawable, AbstractApplication.get().getResources().getColor(colorRes));
vectorDrawable.draw(canvas);
return BitmapDescriptorFactory.fromBitmap(bitmap);
} | [
"public",
"static",
"BitmapDescriptor",
"vectorToBitmap",
"(",
"@",
"DrawableRes",
"int",
"drawableRes",
",",
"@",
"ColorRes",
"int",
"colorRes",
")",
"{",
"Drawable",
"vectorDrawable",
"=",
"VectorDrawableCompat",
".",
"create",
"(",
"AbstractApplication",
".",
"get",
"(",
")",
".",
"getResources",
"(",
")",
",",
"drawableRes",
",",
"null",
")",
";",
"Bitmap",
"bitmap",
"=",
"Bitmap",
".",
"createBitmap",
"(",
"vectorDrawable",
".",
"getIntrinsicWidth",
"(",
")",
",",
"vectorDrawable",
".",
"getIntrinsicHeight",
"(",
")",
",",
"Bitmap",
".",
"Config",
".",
"ARGB_8888",
")",
";",
"Canvas",
"canvas",
"=",
"new",
"Canvas",
"(",
"bitmap",
")",
";",
"vectorDrawable",
".",
"setBounds",
"(",
"0",
",",
"0",
",",
"canvas",
".",
"getWidth",
"(",
")",
",",
"canvas",
".",
"getHeight",
"(",
")",
")",
";",
"DrawableCompat",
".",
"setTint",
"(",
"vectorDrawable",
",",
"AbstractApplication",
".",
"get",
"(",
")",
".",
"getResources",
"(",
")",
".",
"getColor",
"(",
"colorRes",
")",
")",
";",
"vectorDrawable",
".",
"draw",
"(",
"canvas",
")",
";",
"return",
"BitmapDescriptorFactory",
".",
"fromBitmap",
"(",
"bitmap",
")",
";",
"}"
] | Convert a {@link Drawable} to a {@link BitmapDescriptor}, for use as a marker icon. | [
"Convert",
"a",
"{"
] | train | https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-google-maps/src/main/java/com/jdroid/android/google/maps/MapUtils.java#L31-L39 |
UrielCh/ovh-java-sdk | ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java | ApiOvhVps.serviceName_automatedBackup_restore_POST | public OvhTask serviceName_automatedBackup_restore_POST(String serviceName, Boolean changePassword, Date restorePoint, OvhRestoreTypeEnum type) throws IOException {
"""
Creates a VPS.Task that will restore the given restorePoint
REST: POST /vps/{serviceName}/automatedBackup/restore
@param changePassword [required] [default=0] Only with restore full on VPS Cloud 2014
@param type [required] [default=file] file: Attach/export restored disk to your current VPS - full: Replace your current VPS by the given restorePoint
@param restorePoint [required] Restore Point fetched in /automatedBackup/restorePoints
@param serviceName [required] The internal name of your VPS offer
"""
String qPath = "/vps/{serviceName}/automatedBackup/restore";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "changePassword", changePassword);
addBody(o, "restorePoint", restorePoint);
addBody(o, "type", type);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask serviceName_automatedBackup_restore_POST(String serviceName, Boolean changePassword, Date restorePoint, OvhRestoreTypeEnum type) throws IOException {
String qPath = "/vps/{serviceName}/automatedBackup/restore";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "changePassword", changePassword);
addBody(o, "restorePoint", restorePoint);
addBody(o, "type", type);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"serviceName_automatedBackup_restore_POST",
"(",
"String",
"serviceName",
",",
"Boolean",
"changePassword",
",",
"Date",
"restorePoint",
",",
"OvhRestoreTypeEnum",
"type",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/vps/{serviceName}/automatedBackup/restore\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"changePassword\"",
",",
"changePassword",
")",
";",
"addBody",
"(",
"o",
",",
"\"restorePoint\"",
",",
"restorePoint",
")",
";",
"addBody",
"(",
"o",
",",
"\"type\"",
",",
"type",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhTask",
".",
"class",
")",
";",
"}"
] | Creates a VPS.Task that will restore the given restorePoint
REST: POST /vps/{serviceName}/automatedBackup/restore
@param changePassword [required] [default=0] Only with restore full on VPS Cloud 2014
@param type [required] [default=file] file: Attach/export restored disk to your current VPS - full: Replace your current VPS by the given restorePoint
@param restorePoint [required] Restore Point fetched in /automatedBackup/restorePoints
@param serviceName [required] The internal name of your VPS offer | [
"Creates",
"a",
"VPS",
".",
"Task",
"that",
"will",
"restore",
"the",
"given",
"restorePoint"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java#L122-L131 |
calimero-project/calimero-core | src/tuwien/auto/calimero/mgmt/PropertyClient.java | PropertyClient.scanProperties | public void scanProperties(final boolean allProperties, final Consumer<Description> consumer)
throws KNXException, InterruptedException {
"""
Does a property description scan of the properties in all interface objects.
@param allProperties <code>true</code> to scan all property descriptions in the interface
objects, <code>false</code> to only scan the object type descriptions, i.e.,
{@link PropertyAccess.PID#OBJECT_TYPE}
@param consumer invoked on every property read during the scan, taking a property
{@link Description} argument
@throws KNXException on adapter errors while querying the descriptions
@throws InterruptedException on thread interrupt
"""
for (int index = 0; scan(index, allProperties, consumer) > 0; ++index);
} | java | public void scanProperties(final boolean allProperties, final Consumer<Description> consumer)
throws KNXException, InterruptedException
{
for (int index = 0; scan(index, allProperties, consumer) > 0; ++index);
} | [
"public",
"void",
"scanProperties",
"(",
"final",
"boolean",
"allProperties",
",",
"final",
"Consumer",
"<",
"Description",
">",
"consumer",
")",
"throws",
"KNXException",
",",
"InterruptedException",
"{",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"scan",
"(",
"index",
",",
"allProperties",
",",
"consumer",
")",
">",
"0",
";",
"++",
"index",
")",
";",
"}"
] | Does a property description scan of the properties in all interface objects.
@param allProperties <code>true</code> to scan all property descriptions in the interface
objects, <code>false</code> to only scan the object type descriptions, i.e.,
{@link PropertyAccess.PID#OBJECT_TYPE}
@param consumer invoked on every property read during the scan, taking a property
{@link Description} argument
@throws KNXException on adapter errors while querying the descriptions
@throws InterruptedException on thread interrupt | [
"Does",
"a",
"property",
"description",
"scan",
"of",
"the",
"properties",
"in",
"all",
"interface",
"objects",
"."
] | train | https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/mgmt/PropertyClient.java#L619-L623 |
centic9/commons-dost | src/main/java/org/dstadler/commons/net/UrlUtils.java | UrlUtils.retrieveData | public static String retrieveData(String sUrl, int timeout) throws IOException {
"""
Download data from an URL.
@param sUrl The full URL used to download the content.
@param timeout The timeout in milliseconds that is used for both
connection timeout and read timeout.
@return The resulting data, e.g. a HTML string.
@throws IOException If accessing the resource fails.
"""
return retrieveData(sUrl, null, timeout);
} | java | public static String retrieveData(String sUrl, int timeout) throws IOException {
return retrieveData(sUrl, null, timeout);
} | [
"public",
"static",
"String",
"retrieveData",
"(",
"String",
"sUrl",
",",
"int",
"timeout",
")",
"throws",
"IOException",
"{",
"return",
"retrieveData",
"(",
"sUrl",
",",
"null",
",",
"timeout",
")",
";",
"}"
] | Download data from an URL.
@param sUrl The full URL used to download the content.
@param timeout The timeout in milliseconds that is used for both
connection timeout and read timeout.
@return The resulting data, e.g. a HTML string.
@throws IOException If accessing the resource fails. | [
"Download",
"data",
"from",
"an",
"URL",
"."
] | train | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/net/UrlUtils.java#L48-L50 |
alibaba/otter | shared/common/src/main/java/com/alibaba/otter/shared/common/utils/sizeof/ObjectProfiler.java | ObjectProfiler.sizeof | public static long sizeof(final Object obj) {
"""
Estimates the full size of the object graph rooted at 'obj'. Duplicate data instances are correctly accounted
for. The implementation is not recursive.
@param obj input object instance to be measured
@return 'obj' size [0 if 'obj' is null']
"""
if (null == obj || isSharedFlyweight(obj)) {
return 0;
}
final IdentityHashMap visited = new IdentityHashMap(80000);
try {
return computeSizeof(obj, visited, CLASS_METADATA_CACHE);
} catch (RuntimeException re) {
// re.printStackTrace();//DEBUG
return -1;
} catch (NoClassDefFoundError ncdfe) {
// BUG: throws "java.lang.NoClassDefFoundError: org.eclipse.core.resources.IWorkspaceRoot" when run in WSAD
// 5
// see
// http://www.javaworld.com/javaforums/showflat.php?Cat=&Board=958763&Number=15235&page=0&view=collapsed&sb=5&o=
// System.err.println(ncdfe);//DEBUG
return -1;
}
} | java | public static long sizeof(final Object obj) {
if (null == obj || isSharedFlyweight(obj)) {
return 0;
}
final IdentityHashMap visited = new IdentityHashMap(80000);
try {
return computeSizeof(obj, visited, CLASS_METADATA_CACHE);
} catch (RuntimeException re) {
// re.printStackTrace();//DEBUG
return -1;
} catch (NoClassDefFoundError ncdfe) {
// BUG: throws "java.lang.NoClassDefFoundError: org.eclipse.core.resources.IWorkspaceRoot" when run in WSAD
// 5
// see
// http://www.javaworld.com/javaforums/showflat.php?Cat=&Board=958763&Number=15235&page=0&view=collapsed&sb=5&o=
// System.err.println(ncdfe);//DEBUG
return -1;
}
} | [
"public",
"static",
"long",
"sizeof",
"(",
"final",
"Object",
"obj",
")",
"{",
"if",
"(",
"null",
"==",
"obj",
"||",
"isSharedFlyweight",
"(",
"obj",
")",
")",
"{",
"return",
"0",
";",
"}",
"final",
"IdentityHashMap",
"visited",
"=",
"new",
"IdentityHashMap",
"(",
"80000",
")",
";",
"try",
"{",
"return",
"computeSizeof",
"(",
"obj",
",",
"visited",
",",
"CLASS_METADATA_CACHE",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"re",
")",
"{",
"// re.printStackTrace();//DEBUG",
"return",
"-",
"1",
";",
"}",
"catch",
"(",
"NoClassDefFoundError",
"ncdfe",
")",
"{",
"// BUG: throws \"java.lang.NoClassDefFoundError: org.eclipse.core.resources.IWorkspaceRoot\" when run in WSAD",
"// 5",
"// see",
"// http://www.javaworld.com/javaforums/showflat.php?Cat=&Board=958763&Number=15235&page=0&view=collapsed&sb=5&o=",
"// System.err.println(ncdfe);//DEBUG",
"return",
"-",
"1",
";",
"}",
"}"
] | Estimates the full size of the object graph rooted at 'obj'. Duplicate data instances are correctly accounted
for. The implementation is not recursive.
@param obj input object instance to be measured
@return 'obj' size [0 if 'obj' is null'] | [
"Estimates",
"the",
"full",
"size",
"of",
"the",
"object",
"graph",
"rooted",
"at",
"obj",
".",
"Duplicate",
"data",
"instances",
"are",
"correctly",
"accounted",
"for",
".",
"The",
"implementation",
"is",
"not",
"recursive",
"."
] | train | https://github.com/alibaba/otter/blob/c7b5f94a0dd162e01ddffaf3a63cade7d23fca55/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/sizeof/ObjectProfiler.java#L85-L105 |
cryptomator/cryptofs | src/main/java/org/cryptomator/cryptofs/CryptoFileSystemProvider.java | CryptoFileSystemProvider.containsVault | public static boolean containsVault(Path pathToVault, String masterkeyFilename) {
"""
Checks if the folder represented by the given path exists and contains a valid vault structure.
@param pathToVault A directory path
@param masterkeyFilename Name of the masterkey file
@return <code>true</code> if the directory seems to contain a vault.
@since 1.1.0
"""
Path masterKeyPath = pathToVault.resolve(masterkeyFilename);
Path dataDirPath = pathToVault.resolve(Constants.DATA_DIR_NAME);
return Files.isReadable(masterKeyPath) && Files.isDirectory(dataDirPath);
} | java | public static boolean containsVault(Path pathToVault, String masterkeyFilename) {
Path masterKeyPath = pathToVault.resolve(masterkeyFilename);
Path dataDirPath = pathToVault.resolve(Constants.DATA_DIR_NAME);
return Files.isReadable(masterKeyPath) && Files.isDirectory(dataDirPath);
} | [
"public",
"static",
"boolean",
"containsVault",
"(",
"Path",
"pathToVault",
",",
"String",
"masterkeyFilename",
")",
"{",
"Path",
"masterKeyPath",
"=",
"pathToVault",
".",
"resolve",
"(",
"masterkeyFilename",
")",
";",
"Path",
"dataDirPath",
"=",
"pathToVault",
".",
"resolve",
"(",
"Constants",
".",
"DATA_DIR_NAME",
")",
";",
"return",
"Files",
".",
"isReadable",
"(",
"masterKeyPath",
")",
"&&",
"Files",
".",
"isDirectory",
"(",
"dataDirPath",
")",
";",
"}"
] | Checks if the folder represented by the given path exists and contains a valid vault structure.
@param pathToVault A directory path
@param masterkeyFilename Name of the masterkey file
@return <code>true</code> if the directory seems to contain a vault.
@since 1.1.0 | [
"Checks",
"if",
"the",
"folder",
"represented",
"by",
"the",
"given",
"path",
"exists",
"and",
"contains",
"a",
"valid",
"vault",
"structure",
"."
] | train | https://github.com/cryptomator/cryptofs/blob/67fc1a4950dd1c150cd2e2c75bcabbeb7c9ac82e/src/main/java/org/cryptomator/cryptofs/CryptoFileSystemProvider.java#L183-L187 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/converters/UserConverter.java | UserConverter.getType | @Trivial
private static Type getType(Converter<?> converter) {
"""
Reflectively work out the Type of a Converter
@param converter
@return
"""
Type type = null;
Type[] itypes = converter.getClass().getGenericInterfaces();
for (Type itype : itypes) {
ParameterizedType ptype = (ParameterizedType) itype;
if (ptype.getRawType() == Converter.class) {
Type[] atypes = ptype.getActualTypeArguments();
if (atypes.length == 1) {
type = atypes[0];
break;
} else {
throw new ConfigException(Tr.formatMessage(tc, "unable.to.determine.conversion.type.CWMCG0009E", converter.getClass().getName()));
}
}
}
if (type == null) {
throw new ConfigException(Tr.formatMessage(tc, "unable.to.determine.conversion.type.CWMCG0009E", converter.getClass().getName()));
}
return type;
} | java | @Trivial
private static Type getType(Converter<?> converter) {
Type type = null;
Type[] itypes = converter.getClass().getGenericInterfaces();
for (Type itype : itypes) {
ParameterizedType ptype = (ParameterizedType) itype;
if (ptype.getRawType() == Converter.class) {
Type[] atypes = ptype.getActualTypeArguments();
if (atypes.length == 1) {
type = atypes[0];
break;
} else {
throw new ConfigException(Tr.formatMessage(tc, "unable.to.determine.conversion.type.CWMCG0009E", converter.getClass().getName()));
}
}
}
if (type == null) {
throw new ConfigException(Tr.formatMessage(tc, "unable.to.determine.conversion.type.CWMCG0009E", converter.getClass().getName()));
}
return type;
} | [
"@",
"Trivial",
"private",
"static",
"Type",
"getType",
"(",
"Converter",
"<",
"?",
">",
"converter",
")",
"{",
"Type",
"type",
"=",
"null",
";",
"Type",
"[",
"]",
"itypes",
"=",
"converter",
".",
"getClass",
"(",
")",
".",
"getGenericInterfaces",
"(",
")",
";",
"for",
"(",
"Type",
"itype",
":",
"itypes",
")",
"{",
"ParameterizedType",
"ptype",
"=",
"(",
"ParameterizedType",
")",
"itype",
";",
"if",
"(",
"ptype",
".",
"getRawType",
"(",
")",
"==",
"Converter",
".",
"class",
")",
"{",
"Type",
"[",
"]",
"atypes",
"=",
"ptype",
".",
"getActualTypeArguments",
"(",
")",
";",
"if",
"(",
"atypes",
".",
"length",
"==",
"1",
")",
"{",
"type",
"=",
"atypes",
"[",
"0",
"]",
";",
"break",
";",
"}",
"else",
"{",
"throw",
"new",
"ConfigException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"unable.to.determine.conversion.type.CWMCG0009E\"",
",",
"converter",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"}",
"}",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"throw",
"new",
"ConfigException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"unable.to.determine.conversion.type.CWMCG0009E\"",
",",
"converter",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"return",
"type",
";",
"}"
] | Reflectively work out the Type of a Converter
@param converter
@return | [
"Reflectively",
"work",
"out",
"the",
"Type",
"of",
"a",
"Converter"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/converters/UserConverter.java#L103-L125 |
wmdietl/jsr308-langtools | src/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java | SimpleTypeVisitor7.visitUnion | @Override
public R visitUnion(UnionType t, P p) {
"""
This implementation visits a {@code UnionType} by calling
{@code defaultAction}.
@param t {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code defaultAction}
"""
return defaultAction(t, p);
} | java | @Override
public R visitUnion(UnionType t, P p) {
return defaultAction(t, p);
} | [
"@",
"Override",
"public",
"R",
"visitUnion",
"(",
"UnionType",
"t",
",",
"P",
"p",
")",
"{",
"return",
"defaultAction",
"(",
"t",
",",
"p",
")",
";",
"}"
] | This implementation visits a {@code UnionType} by calling
{@code defaultAction}.
@param t {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code defaultAction} | [
"This",
"implementation",
"visits",
"a",
"{",
"@code",
"UnionType",
"}",
"by",
"calling",
"{",
"@code",
"defaultAction",
"}",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java#L111-L114 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/cli/CliClient.java | CliClient.subColumnNameAsBytes | private ByteBuffer subColumnNameAsBytes(String superColumn, CfDef columnFamilyDef) {
"""
Converts column name into ByteBuffer according to comparator type
@param superColumn - sub-column name from parser
@param columnFamilyDef - column family from parser
@return ByteBuffer bytes - into which column name was converted according to comparator type
"""
String comparatorClass = columnFamilyDef.subcomparator_type;
if (comparatorClass == null)
{
sessionState.out.println(String.format("Notice: defaulting to BytesType subcomparator for '%s'", columnFamilyDef.getName()));
comparatorClass = "BytesType";
}
return getBytesAccordingToType(superColumn, getFormatType(comparatorClass));
} | java | private ByteBuffer subColumnNameAsBytes(String superColumn, CfDef columnFamilyDef)
{
String comparatorClass = columnFamilyDef.subcomparator_type;
if (comparatorClass == null)
{
sessionState.out.println(String.format("Notice: defaulting to BytesType subcomparator for '%s'", columnFamilyDef.getName()));
comparatorClass = "BytesType";
}
return getBytesAccordingToType(superColumn, getFormatType(comparatorClass));
} | [
"private",
"ByteBuffer",
"subColumnNameAsBytes",
"(",
"String",
"superColumn",
",",
"CfDef",
"columnFamilyDef",
")",
"{",
"String",
"comparatorClass",
"=",
"columnFamilyDef",
".",
"subcomparator_type",
";",
"if",
"(",
"comparatorClass",
"==",
"null",
")",
"{",
"sessionState",
".",
"out",
".",
"println",
"(",
"String",
".",
"format",
"(",
"\"Notice: defaulting to BytesType subcomparator for '%s'\"",
",",
"columnFamilyDef",
".",
"getName",
"(",
")",
")",
")",
";",
"comparatorClass",
"=",
"\"BytesType\"",
";",
"}",
"return",
"getBytesAccordingToType",
"(",
"superColumn",
",",
"getFormatType",
"(",
"comparatorClass",
")",
")",
";",
"}"
] | Converts column name into ByteBuffer according to comparator type
@param superColumn - sub-column name from parser
@param columnFamilyDef - column family from parser
@return ByteBuffer bytes - into which column name was converted according to comparator type | [
"Converts",
"column",
"name",
"into",
"ByteBuffer",
"according",
"to",
"comparator",
"type"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cli/CliClient.java#L2629-L2640 |
Azure/azure-sdk-for-java | redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java | RedisInner.getByResourceGroupAsync | public Observable<RedisResourceInner> getByResourceGroupAsync(String resourceGroupName, String name) {
"""
Gets a Redis cache (resource description).
@param resourceGroupName The name of the resource group.
@param name The name of the Redis cache.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RedisResourceInner object
"""
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<RedisResourceInner>, RedisResourceInner>() {
@Override
public RedisResourceInner call(ServiceResponse<RedisResourceInner> response) {
return response.body();
}
});
} | java | public Observable<RedisResourceInner> getByResourceGroupAsync(String resourceGroupName, String name) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<RedisResourceInner>, RedisResourceInner>() {
@Override
public RedisResourceInner call(ServiceResponse<RedisResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RedisResourceInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"RedisResourceInner",
">",
",",
"RedisResourceInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"RedisResourceInner",
"call",
"(",
"ServiceResponse",
"<",
"RedisResourceInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets a Redis cache (resource description).
@param resourceGroupName The name of the resource group.
@param name The name of the Redis cache.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RedisResourceInner object | [
"Gets",
"a",
"Redis",
"cache",
"(",
"resource",
"description",
")",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java#L779-L786 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.readOwner | public CmsUser readOwner(CmsDbContext dbc, CmsProject project) throws CmsException {
"""
Reads the owner of a project.<p>
@param dbc the current database context
@param project the project to get the owner from
@return the owner of a resource
@throws CmsException if something goes wrong
"""
return readUser(dbc, project.getOwnerId());
} | java | public CmsUser readOwner(CmsDbContext dbc, CmsProject project) throws CmsException {
return readUser(dbc, project.getOwnerId());
} | [
"public",
"CmsUser",
"readOwner",
"(",
"CmsDbContext",
"dbc",
",",
"CmsProject",
"project",
")",
"throws",
"CmsException",
"{",
"return",
"readUser",
"(",
"dbc",
",",
"project",
".",
"getOwnerId",
"(",
")",
")",
";",
"}"
] | Reads the owner of a project.<p>
@param dbc the current database context
@param project the project to get the owner from
@return the owner of a resource
@throws CmsException if something goes wrong | [
"Reads",
"the",
"owner",
"of",
"a",
"project",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L7117-L7120 |
fullcontact/hadoop-sstable | sstable-core/src/main/java/com/fullcontact/cassandra/io/util/RandomAccessReader.java | RandomAccessReader.reBuffer | protected void reBuffer() {
"""
Read data from file starting from current currentOffset to populate buffer.
"""
resetBuffer();
try {
if (bufferOffset >= fs.getFileStatus(inputPath).getLen()) // TODO: is this equivalent?
return;
input.seek(bufferOffset);
int read = 0;
while (read < buffer.length) {
int n = input.read(buffer, read, buffer.length - read);
if (n < 0)
break;
read += n;
}
validBufferBytes = read;
bytesSinceCacheFlush += read;
} catch (IOException e) {
throw new FSReadError(e, filePath);
}
} | java | protected void reBuffer() {
resetBuffer();
try {
if (bufferOffset >= fs.getFileStatus(inputPath).getLen()) // TODO: is this equivalent?
return;
input.seek(bufferOffset);
int read = 0;
while (read < buffer.length) {
int n = input.read(buffer, read, buffer.length - read);
if (n < 0)
break;
read += n;
}
validBufferBytes = read;
bytesSinceCacheFlush += read;
} catch (IOException e) {
throw new FSReadError(e, filePath);
}
} | [
"protected",
"void",
"reBuffer",
"(",
")",
"{",
"resetBuffer",
"(",
")",
";",
"try",
"{",
"if",
"(",
"bufferOffset",
">=",
"fs",
".",
"getFileStatus",
"(",
"inputPath",
")",
".",
"getLen",
"(",
")",
")",
"// TODO: is this equivalent?",
"return",
";",
"input",
".",
"seek",
"(",
"bufferOffset",
")",
";",
"int",
"read",
"=",
"0",
";",
"while",
"(",
"read",
"<",
"buffer",
".",
"length",
")",
"{",
"int",
"n",
"=",
"input",
".",
"read",
"(",
"buffer",
",",
"read",
",",
"buffer",
".",
"length",
"-",
"read",
")",
";",
"if",
"(",
"n",
"<",
"0",
")",
"break",
";",
"read",
"+=",
"n",
";",
"}",
"validBufferBytes",
"=",
"read",
";",
"bytesSinceCacheFlush",
"+=",
"read",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"FSReadError",
"(",
"e",
",",
"filePath",
")",
";",
"}",
"}"
] | Read data from file starting from current currentOffset to populate buffer. | [
"Read",
"data",
"from",
"file",
"starting",
"from",
"current",
"currentOffset",
"to",
"populate",
"buffer",
"."
] | train | https://github.com/fullcontact/hadoop-sstable/blob/1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2/sstable-core/src/main/java/com/fullcontact/cassandra/io/util/RandomAccessReader.java#L138-L161 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/Entity.java | Entity.getRelation | <T extends Entity> T getRelation(Class<T> valuesClass, String name) {
"""
Get a relation by name for this entity.
@param valuesClass Class type of T.
@param name Name of the relation attribute.
@return The related asset.
"""
return getRelation(valuesClass, name, true);
} | java | <T extends Entity> T getRelation(Class<T> valuesClass, String name) {
return getRelation(valuesClass, name, true);
} | [
"<",
"T",
"extends",
"Entity",
">",
"T",
"getRelation",
"(",
"Class",
"<",
"T",
">",
"valuesClass",
",",
"String",
"name",
")",
"{",
"return",
"getRelation",
"(",
"valuesClass",
",",
"name",
",",
"true",
")",
";",
"}"
] | Get a relation by name for this entity.
@param valuesClass Class type of T.
@param name Name of the relation attribute.
@return The related asset. | [
"Get",
"a",
"relation",
"by",
"name",
"for",
"this",
"entity",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Entity.java#L206-L208 |
wiibaker/robotframework-rest-java | src/main/java/org/wuokko/robot/restlib/JsonPathLibrary.java | JsonPathLibrary.jsonShouldBeEqual | @RobotKeyword
public boolean jsonShouldBeEqual(String from, String to) throws Exception {
"""
Checks if the given JSON contents are equal. See `Json Should Be Equal`
for more details
`from` and `to` can be either URI or the actual JSON content.
You can add optional method (ie GET, POST, PUT), data or content type as parameters.
Method defaults to GET.
Example:
| Json Should Be Equal | http://example.com/test.json | http://foobar.com/test.json |
| Json Should Be Equal | { element: { param:hello } } | { element: { param:hello } } |
| Json Should Be Equal | { element: { param:hello } } | { element: { param:hello } } | POST | {hello: world} | application/json |
"""
return jsonShouldBeEqual(from, to, false);
} | java | @RobotKeyword
public boolean jsonShouldBeEqual(String from, String to) throws Exception {
return jsonShouldBeEqual(from, to, false);
} | [
"@",
"RobotKeyword",
"public",
"boolean",
"jsonShouldBeEqual",
"(",
"String",
"from",
",",
"String",
"to",
")",
"throws",
"Exception",
"{",
"return",
"jsonShouldBeEqual",
"(",
"from",
",",
"to",
",",
"false",
")",
";",
"}"
] | Checks if the given JSON contents are equal. See `Json Should Be Equal`
for more details
`from` and `to` can be either URI or the actual JSON content.
You can add optional method (ie GET, POST, PUT), data or content type as parameters.
Method defaults to GET.
Example:
| Json Should Be Equal | http://example.com/test.json | http://foobar.com/test.json |
| Json Should Be Equal | { element: { param:hello } } | { element: { param:hello } } |
| Json Should Be Equal | { element: { param:hello } } | { element: { param:hello } } | POST | {hello: world} | application/json | | [
"Checks",
"if",
"the",
"given",
"JSON",
"contents",
"are",
"equal",
".",
"See",
"Json",
"Should",
"Be",
"Equal",
"for",
"more",
"details"
] | train | https://github.com/wiibaker/robotframework-rest-java/blob/e30a7e494c143b644ee4282137a5a38e75d9d97b/src/main/java/org/wuokko/robot/restlib/JsonPathLibrary.java#L145-L148 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java | PathNormalizer.determineRelativePath | private static String determineRelativePath(String filename, String separator) {
"""
Determines the relative path of a filename. For each separator within the
filename (except the leading if present), append the "../" string to the
return value.
@param filename
The filename to parse.
@param separator
The separator used within the filename.
@return The relative path of the filename. This value is not terminated
with a forward slash. A zero-length string is returned if: the
filename is zero-length.
"""
if (filename.length() == 0) {
return "";
}
/*
* Count the slashes in the relative filename, but exclude the leading
* slash. If the path has no slashes, then the filename is relative to
* the current directory.
*/
int slashCount = StringUtils.countMatches(filename, separator) - 1;
if (slashCount <= 0) {
return ".";
}
/*
* The relative filename contains one or more slashes indicating that
* the file is within one or more directories. Thus, each slash
* represents a "../" in the relative path.
*/
StringBuilder sb = new StringBuilder();
for (int i = 0; i < slashCount; i++) {
sb.append("../");
}
/*
* Finally, return the relative path but strip the trailing slash to
* mimic Anakia's behavior.
*/
return StringUtils.chop(sb.toString());
} | java | private static String determineRelativePath(String filename, String separator) {
if (filename.length() == 0) {
return "";
}
/*
* Count the slashes in the relative filename, but exclude the leading
* slash. If the path has no slashes, then the filename is relative to
* the current directory.
*/
int slashCount = StringUtils.countMatches(filename, separator) - 1;
if (slashCount <= 0) {
return ".";
}
/*
* The relative filename contains one or more slashes indicating that
* the file is within one or more directories. Thus, each slash
* represents a "../" in the relative path.
*/
StringBuilder sb = new StringBuilder();
for (int i = 0; i < slashCount; i++) {
sb.append("../");
}
/*
* Finally, return the relative path but strip the trailing slash to
* mimic Anakia's behavior.
*/
return StringUtils.chop(sb.toString());
} | [
"private",
"static",
"String",
"determineRelativePath",
"(",
"String",
"filename",
",",
"String",
"separator",
")",
"{",
"if",
"(",
"filename",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"\"\"",
";",
"}",
"/*\n\t\t * Count the slashes in the relative filename, but exclude the leading\n\t\t * slash. If the path has no slashes, then the filename is relative to\n\t\t * the current directory.\n\t\t */",
"int",
"slashCount",
"=",
"StringUtils",
".",
"countMatches",
"(",
"filename",
",",
"separator",
")",
"-",
"1",
";",
"if",
"(",
"slashCount",
"<=",
"0",
")",
"{",
"return",
"\".\"",
";",
"}",
"/*\n\t\t * The relative filename contains one or more slashes indicating that\n\t\t * the file is within one or more directories. Thus, each slash\n\t\t * represents a \"../\" in the relative path.\n\t\t */",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"slashCount",
";",
"i",
"++",
")",
"{",
"sb",
".",
"append",
"(",
"\"../\"",
")",
";",
"}",
"/*\n\t\t * Finally, return the relative path but strip the trailing slash to\n\t\t * mimic Anakia's behavior.\n\t\t */",
"return",
"StringUtils",
".",
"chop",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Determines the relative path of a filename. For each separator within the
filename (except the leading if present), append the "../" string to the
return value.
@param filename
The filename to parse.
@param separator
The separator used within the filename.
@return The relative path of the filename. This value is not terminated
with a forward slash. A zero-length string is returned if: the
filename is zero-length. | [
"Determines",
"the",
"relative",
"path",
"of",
"a",
"filename",
".",
"For",
"each",
"separator",
"within",
"the",
"filename",
"(",
"except",
"the",
"leading",
"if",
"present",
")",
"append",
"the",
"..",
"/",
"string",
"to",
"the",
"return",
"value",
"."
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java#L866-L896 |
NLPchina/elasticsearch-sql | src/main/java/org/nlpcn/es4sql/query/maker/AggMaker.java | AggMaker.makeCountAgg | private ValuesSourceAggregationBuilder makeCountAgg(MethodField field) {
"""
Create count aggregation.
@param field The count function
@return AggregationBuilder use to count result
"""
// Cardinality is approximate DISTINCT.
if ("DISTINCT".equals(field.getOption())) {
if (field.getParams().size() == 1) {
return AggregationBuilders.cardinality(field.getAlias()).field(field.getParams().get(0).value.toString());
} else {
Integer precision_threshold = (Integer) (field.getParams().get(1).value);
return AggregationBuilders.cardinality(field.getAlias()).precisionThreshold(precision_threshold).field(field.getParams().get(0).value.toString());
}
}
String fieldName = field.getParams().get(0).value.toString();
/*
zhongshu-comment count(1) count(0)这种应该是查不到东西的,除非你的字段名就叫做1、0这样
es的count是针对某个字段做count的,见下面的dsl,对os这个字段做count
"aggregations": {
"COUNT(os)": {
"value_count": {
"field": "os"
}
}
}
假如你是写count(*),那es-sql就帮你转成对"_index"字段做count,每一条数据都会有"_index"字段,该字段存储的是索引的名字
*/
// In case of count(*) we use '_index' as field parameter to count all documents
if ("*".equals(fieldName)) {
KVValue kvValue = new KVValue(null, "_index");
field.getParams().set(0, kvValue);
/*
zhongshu-comment 这个看起来有点多此一举:先将"_index"字符串封装到KVValue中,然后再kv.toString()得到"_index"字符串,还不如直接将"_index"传进去AggregationBuilders.count(field.getAlias()).field("_index");
其实目的是为了改变形参MethodField field的params参数中的值,由"*"改为"_index"
*/
return AggregationBuilders.count(field.getAlias()).field(kvValue.toString());
} else {
return AggregationBuilders.count(field.getAlias()).field(fieldName);
}
} | java | private ValuesSourceAggregationBuilder makeCountAgg(MethodField field) {
// Cardinality is approximate DISTINCT.
if ("DISTINCT".equals(field.getOption())) {
if (field.getParams().size() == 1) {
return AggregationBuilders.cardinality(field.getAlias()).field(field.getParams().get(0).value.toString());
} else {
Integer precision_threshold = (Integer) (field.getParams().get(1).value);
return AggregationBuilders.cardinality(field.getAlias()).precisionThreshold(precision_threshold).field(field.getParams().get(0).value.toString());
}
}
String fieldName = field.getParams().get(0).value.toString();
/*
zhongshu-comment count(1) count(0)这种应该是查不到东西的,除非你的字段名就叫做1、0这样
es的count是针对某个字段做count的,见下面的dsl,对os这个字段做count
"aggregations": {
"COUNT(os)": {
"value_count": {
"field": "os"
}
}
}
假如你是写count(*),那es-sql就帮你转成对"_index"字段做count,每一条数据都会有"_index"字段,该字段存储的是索引的名字
*/
// In case of count(*) we use '_index' as field parameter to count all documents
if ("*".equals(fieldName)) {
KVValue kvValue = new KVValue(null, "_index");
field.getParams().set(0, kvValue);
/*
zhongshu-comment 这个看起来有点多此一举:先将"_index"字符串封装到KVValue中,然后再kv.toString()得到"_index"字符串,还不如直接将"_index"传进去AggregationBuilders.count(field.getAlias()).field("_index");
其实目的是为了改变形参MethodField field的params参数中的值,由"*"改为"_index"
*/
return AggregationBuilders.count(field.getAlias()).field(kvValue.toString());
} else {
return AggregationBuilders.count(field.getAlias()).field(fieldName);
}
} | [
"private",
"ValuesSourceAggregationBuilder",
"makeCountAgg",
"(",
"MethodField",
"field",
")",
"{",
"// Cardinality is approximate DISTINCT.",
"if",
"(",
"\"DISTINCT\"",
".",
"equals",
"(",
"field",
".",
"getOption",
"(",
")",
")",
")",
"{",
"if",
"(",
"field",
".",
"getParams",
"(",
")",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"return",
"AggregationBuilders",
".",
"cardinality",
"(",
"field",
".",
"getAlias",
"(",
")",
")",
".",
"field",
"(",
"field",
".",
"getParams",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"value",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"{",
"Integer",
"precision_threshold",
"=",
"(",
"Integer",
")",
"(",
"field",
".",
"getParams",
"(",
")",
".",
"get",
"(",
"1",
")",
".",
"value",
")",
";",
"return",
"AggregationBuilders",
".",
"cardinality",
"(",
"field",
".",
"getAlias",
"(",
")",
")",
".",
"precisionThreshold",
"(",
"precision_threshold",
")",
".",
"field",
"(",
"field",
".",
"getParams",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"value",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"String",
"fieldName",
"=",
"field",
".",
"getParams",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"value",
".",
"toString",
"(",
")",
";",
"/*\n zhongshu-comment count(1) count(0)这种应该是查不到东西的,除非你的字段名就叫做1、0这样\n es的count是针对某个字段做count的,见下面的dsl,对os这个字段做count\n \"aggregations\": {\n \"COUNT(os)\": {\n \"value_count\": {\n \"field\": \"os\"\n }\n }\n }\n\n 假如你是写count(*),那es-sql就帮你转成对\"_index\"字段做count,每一条数据都会有\"_index\"字段,该字段存储的是索引的名字\n */",
"// In case of count(*) we use '_index' as field parameter to count all documents",
"if",
"(",
"\"*\"",
".",
"equals",
"(",
"fieldName",
")",
")",
"{",
"KVValue",
"kvValue",
"=",
"new",
"KVValue",
"(",
"null",
",",
"\"_index\"",
")",
";",
"field",
".",
"getParams",
"(",
")",
".",
"set",
"(",
"0",
",",
"kvValue",
")",
";",
"/*\n zhongshu-comment 这个看起来有点多此一举:先将\"_index\"字符串封装到KVValue中,然后再kv.toString()得到\"_index\"字符串,还不如直接将\"_index\"传进去AggregationBuilders.count(field.getAlias()).field(\"_index\");\n 其实目的是为了改变形参MethodField field的params参数中的值,由\"*\"改为\"_index\"\n */",
"return",
"AggregationBuilders",
".",
"count",
"(",
"field",
".",
"getAlias",
"(",
")",
")",
".",
"field",
"(",
"kvValue",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"AggregationBuilders",
".",
"count",
"(",
"field",
".",
"getAlias",
"(",
")",
")",
".",
"field",
"(",
"fieldName",
")",
";",
"}",
"}"
] | Create count aggregation.
@param field The count function
@return AggregationBuilder use to count result | [
"Create",
"count",
"aggregation",
"."
] | train | https://github.com/NLPchina/elasticsearch-sql/blob/eaab70b4bf1729978911b83eb96e816ebcfe6e7f/src/main/java/org/nlpcn/es4sql/query/maker/AggMaker.java#L686-L727 |
line/armeria | core/src/main/java/com/linecorp/armeria/client/encoding/HttpDecodingClient.java | HttpDecodingClient.newDecorator | public static Function<Client<HttpRequest, HttpResponse>, HttpDecodingClient> newDecorator(
Iterable<? extends StreamDecoderFactory> decoderFactories) {
"""
Creates a new {@link HttpDecodingClient} decorator with the specified {@link StreamDecoderFactory}s.
"""
return client -> new HttpDecodingClient(client, decoderFactories);
} | java | public static Function<Client<HttpRequest, HttpResponse>, HttpDecodingClient> newDecorator(
Iterable<? extends StreamDecoderFactory> decoderFactories) {
return client -> new HttpDecodingClient(client, decoderFactories);
} | [
"public",
"static",
"Function",
"<",
"Client",
"<",
"HttpRequest",
",",
"HttpResponse",
">",
",",
"HttpDecodingClient",
">",
"newDecorator",
"(",
"Iterable",
"<",
"?",
"extends",
"StreamDecoderFactory",
">",
"decoderFactories",
")",
"{",
"return",
"client",
"->",
"new",
"HttpDecodingClient",
"(",
"client",
",",
"decoderFactories",
")",
";",
"}"
] | Creates a new {@link HttpDecodingClient} decorator with the specified {@link StreamDecoderFactory}s. | [
"Creates",
"a",
"new",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/encoding/HttpDecodingClient.java#L60-L63 |
canoo/dolphin-platform | platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerModelStore.java | ServerModelStore.deleteCommand | @Deprecated
public static void deleteCommand(final List<Command> response, final String pmId) {
"""
Convenience method to let Dolphin delete a presentation model on the client side
"""
if (response == null || Assert.isBlank(pmId)) {
return;
}
response.add(new DeletePresentationModelCommand(pmId));
} | java | @Deprecated
public static void deleteCommand(final List<Command> response, final String pmId) {
if (response == null || Assert.isBlank(pmId)) {
return;
}
response.add(new DeletePresentationModelCommand(pmId));
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"deleteCommand",
"(",
"final",
"List",
"<",
"Command",
">",
"response",
",",
"final",
"String",
"pmId",
")",
"{",
"if",
"(",
"response",
"==",
"null",
"||",
"Assert",
".",
"isBlank",
"(",
"pmId",
")",
")",
"{",
"return",
";",
"}",
"response",
".",
"add",
"(",
"new",
"DeletePresentationModelCommand",
"(",
"pmId",
")",
")",
";",
"}"
] | Convenience method to let Dolphin delete a presentation model on the client side | [
"Convenience",
"method",
"to",
"let",
"Dolphin",
"delete",
"a",
"presentation",
"model",
"on",
"the",
"client",
"side"
] | train | https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerModelStore.java#L144-L150 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/DefaultPriorityProvider.java | DefaultPriorityProvider.getProcessDefinedPriority | protected Long getProcessDefinedPriority(ProcessDefinitionImpl processDefinition, String propertyKey, ExecutionEntity execution, String errorMsgHead) {
"""
Returns the priority which is defined in the given process definition.
The priority value is identified with the given propertyKey.
Returns null if the process definition is null or no priority was defined.
@param processDefinition the process definition that should contains the priority
@param propertyKey the key which identifies the property
@param execution the current execution
@param errorMsgHead the error message header which is used if the evaluation fails
@return the priority defined in the given process
"""
if (processDefinition != null) {
ParameterValueProvider priorityProvider = (ParameterValueProvider) processDefinition.getProperty(propertyKey);
if (priorityProvider != null) {
return evaluateValueProvider(priorityProvider, execution, errorMsgHead);
}
}
return null;
} | java | protected Long getProcessDefinedPriority(ProcessDefinitionImpl processDefinition, String propertyKey, ExecutionEntity execution, String errorMsgHead) {
if (processDefinition != null) {
ParameterValueProvider priorityProvider = (ParameterValueProvider) processDefinition.getProperty(propertyKey);
if (priorityProvider != null) {
return evaluateValueProvider(priorityProvider, execution, errorMsgHead);
}
}
return null;
} | [
"protected",
"Long",
"getProcessDefinedPriority",
"(",
"ProcessDefinitionImpl",
"processDefinition",
",",
"String",
"propertyKey",
",",
"ExecutionEntity",
"execution",
",",
"String",
"errorMsgHead",
")",
"{",
"if",
"(",
"processDefinition",
"!=",
"null",
")",
"{",
"ParameterValueProvider",
"priorityProvider",
"=",
"(",
"ParameterValueProvider",
")",
"processDefinition",
".",
"getProperty",
"(",
"propertyKey",
")",
";",
"if",
"(",
"priorityProvider",
"!=",
"null",
")",
"{",
"return",
"evaluateValueProvider",
"(",
"priorityProvider",
",",
"execution",
",",
"errorMsgHead",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Returns the priority which is defined in the given process definition.
The priority value is identified with the given propertyKey.
Returns null if the process definition is null or no priority was defined.
@param processDefinition the process definition that should contains the priority
@param propertyKey the key which identifies the property
@param execution the current execution
@param errorMsgHead the error message header which is used if the evaluation fails
@return the priority defined in the given process | [
"Returns",
"the",
"priority",
"which",
"is",
"defined",
"in",
"the",
"given",
"process",
"definition",
".",
"The",
"priority",
"value",
"is",
"identified",
"with",
"the",
"given",
"propertyKey",
".",
"Returns",
"null",
"if",
"the",
"process",
"definition",
"is",
"null",
"or",
"no",
"priority",
"was",
"defined",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/DefaultPriorityProvider.java#L154-L162 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaTaskLauncher.java | CoronaTaskLauncher.killTasks | public void killTasks(
String trackerName, InetAddress addr, List<KillTaskAction> killActions) {
"""
Enqueue kill tasks actions.
@param trackerName The name of the tracker to send the kill actions to.
@param addr The address of the tracker to send the kill actions to.
@param killActions The kill actions to send.
"""
for (KillTaskAction killAction : killActions) {
String description = "KillTaskAction " + killAction.getTaskID();
LOG.info("Queueing " + description + " to worker " +
trackerName + "(" + addr.host + ":" + addr.port + ")");
allWorkQueues.enqueueAction(
new ActionToSend(trackerName, addr, killAction, description));
}
} | java | public void killTasks(
String trackerName, InetAddress addr, List<KillTaskAction> killActions) {
for (KillTaskAction killAction : killActions) {
String description = "KillTaskAction " + killAction.getTaskID();
LOG.info("Queueing " + description + " to worker " +
trackerName + "(" + addr.host + ":" + addr.port + ")");
allWorkQueues.enqueueAction(
new ActionToSend(trackerName, addr, killAction, description));
}
} | [
"public",
"void",
"killTasks",
"(",
"String",
"trackerName",
",",
"InetAddress",
"addr",
",",
"List",
"<",
"KillTaskAction",
">",
"killActions",
")",
"{",
"for",
"(",
"KillTaskAction",
"killAction",
":",
"killActions",
")",
"{",
"String",
"description",
"=",
"\"KillTaskAction \"",
"+",
"killAction",
".",
"getTaskID",
"(",
")",
";",
"LOG",
".",
"info",
"(",
"\"Queueing \"",
"+",
"description",
"+",
"\" to worker \"",
"+",
"trackerName",
"+",
"\"(\"",
"+",
"addr",
".",
"host",
"+",
"\":\"",
"+",
"addr",
".",
"port",
"+",
"\")\"",
")",
";",
"allWorkQueues",
".",
"enqueueAction",
"(",
"new",
"ActionToSend",
"(",
"trackerName",
",",
"addr",
",",
"killAction",
",",
"description",
")",
")",
";",
"}",
"}"
] | Enqueue kill tasks actions.
@param trackerName The name of the tracker to send the kill actions to.
@param addr The address of the tracker to send the kill actions to.
@param killActions The kill actions to send. | [
"Enqueue",
"kill",
"tasks",
"actions",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaTaskLauncher.java#L112-L121 |
killbill/killbill | util/src/main/java/org/killbill/billing/util/callcontext/InternalCallContextFactory.java | InternalCallContextFactory.createInternalCallContext | public InternalCallContext createInternalCallContext(@Nullable final Long tenantRecordId, @Nullable final Long accountRecordId, final String userName,
final CallOrigin callOrigin, final UserType userType, @Nullable final UUID userToken) {
"""
Create an internal call callcontext
<p/>
This is used by notification queue and persistent bus - accountRecordId is expected to be non null
@param tenantRecordId tenant record id - if null, the default tenant record id value will be used
@param accountRecordId account record id (can be null in specific use-cases, e.g. config change events in BeatrixListener)
@param userName user name
@param callOrigin call origin
@param userType user type
@param userToken user token, if any
@return internal call callcontext
"""
return createInternalCallContext(tenantRecordId, accountRecordId, userName, callOrigin, userType, userToken, null, null, null, null);
} | java | public InternalCallContext createInternalCallContext(@Nullable final Long tenantRecordId, @Nullable final Long accountRecordId, final String userName,
final CallOrigin callOrigin, final UserType userType, @Nullable final UUID userToken) {
return createInternalCallContext(tenantRecordId, accountRecordId, userName, callOrigin, userType, userToken, null, null, null, null);
} | [
"public",
"InternalCallContext",
"createInternalCallContext",
"(",
"@",
"Nullable",
"final",
"Long",
"tenantRecordId",
",",
"@",
"Nullable",
"final",
"Long",
"accountRecordId",
",",
"final",
"String",
"userName",
",",
"final",
"CallOrigin",
"callOrigin",
",",
"final",
"UserType",
"userType",
",",
"@",
"Nullable",
"final",
"UUID",
"userToken",
")",
"{",
"return",
"createInternalCallContext",
"(",
"tenantRecordId",
",",
"accountRecordId",
",",
"userName",
",",
"callOrigin",
",",
"userType",
",",
"userToken",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}"
] | Create an internal call callcontext
<p/>
This is used by notification queue and persistent bus - accountRecordId is expected to be non null
@param tenantRecordId tenant record id - if null, the default tenant record id value will be used
@param accountRecordId account record id (can be null in specific use-cases, e.g. config change events in BeatrixListener)
@param userName user name
@param callOrigin call origin
@param userType user type
@param userToken user token, if any
@return internal call callcontext | [
"Create",
"an",
"internal",
"call",
"callcontext",
"<p",
"/",
">",
"This",
"is",
"used",
"by",
"notification",
"queue",
"and",
"persistent",
"bus",
"-",
"accountRecordId",
"is",
"expected",
"to",
"be",
"non",
"null"
] | train | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/util/src/main/java/org/killbill/billing/util/callcontext/InternalCallContextFactory.java#L235-L238 |
VoltDB/voltdb | third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java | Util.isValidSnapshot | public static boolean isValidSnapshot(File f) throws IOException {
"""
Verifies that the file is a valid snapshot. Snapshot may be invalid if
it's incomplete as in a situation when the server dies while in the process
of storing a snapshot. Any file that is not a snapshot is also
an invalid snapshot.
@param f file to verify
@return true if the snapshot is valid
@throws IOException
"""
if (f==null || Util.getZxidFromName(f.getName(), "snapshot") == -1)
return false;
// Check for a valid snapshot
RandomAccessFile raf = new RandomAccessFile(f, "r");
// including the header and the last / bytes
// the snapshot should be atleast 10 bytes
if (raf.length() < 10) {
return false;
}
try {
raf.seek(raf.length() - 5);
byte bytes[] = new byte[5];
int readlen = 0;
int l;
while(readlen < 5 &&
(l = raf.read(bytes, readlen, bytes.length - readlen)) >= 0) {
readlen += l;
}
if (readlen != bytes.length) {
LOG.info("Invalid snapshot " + f
+ " too short, len = " + readlen);
return false;
}
ByteBuffer bb = ByteBuffer.wrap(bytes);
int len = bb.getInt();
byte b = bb.get();
if (len != 1 || b != '/') {
LOG.info("Invalid snapshot " + f + " len = " + len
+ " byte = " + (b & 0xff));
return false;
}
} finally {
raf.close();
}
return true;
} | java | public static boolean isValidSnapshot(File f) throws IOException {
if (f==null || Util.getZxidFromName(f.getName(), "snapshot") == -1)
return false;
// Check for a valid snapshot
RandomAccessFile raf = new RandomAccessFile(f, "r");
// including the header and the last / bytes
// the snapshot should be atleast 10 bytes
if (raf.length() < 10) {
return false;
}
try {
raf.seek(raf.length() - 5);
byte bytes[] = new byte[5];
int readlen = 0;
int l;
while(readlen < 5 &&
(l = raf.read(bytes, readlen, bytes.length - readlen)) >= 0) {
readlen += l;
}
if (readlen != bytes.length) {
LOG.info("Invalid snapshot " + f
+ " too short, len = " + readlen);
return false;
}
ByteBuffer bb = ByteBuffer.wrap(bytes);
int len = bb.getInt();
byte b = bb.get();
if (len != 1 || b != '/') {
LOG.info("Invalid snapshot " + f + " len = " + len
+ " byte = " + (b & 0xff));
return false;
}
} finally {
raf.close();
}
return true;
} | [
"public",
"static",
"boolean",
"isValidSnapshot",
"(",
"File",
"f",
")",
"throws",
"IOException",
"{",
"if",
"(",
"f",
"==",
"null",
"||",
"Util",
".",
"getZxidFromName",
"(",
"f",
".",
"getName",
"(",
")",
",",
"\"snapshot\"",
")",
"==",
"-",
"1",
")",
"return",
"false",
";",
"// Check for a valid snapshot",
"RandomAccessFile",
"raf",
"=",
"new",
"RandomAccessFile",
"(",
"f",
",",
"\"r\"",
")",
";",
"// including the header and the last / bytes",
"// the snapshot should be atleast 10 bytes",
"if",
"(",
"raf",
".",
"length",
"(",
")",
"<",
"10",
")",
"{",
"return",
"false",
";",
"}",
"try",
"{",
"raf",
".",
"seek",
"(",
"raf",
".",
"length",
"(",
")",
"-",
"5",
")",
";",
"byte",
"bytes",
"[",
"]",
"=",
"new",
"byte",
"[",
"5",
"]",
";",
"int",
"readlen",
"=",
"0",
";",
"int",
"l",
";",
"while",
"(",
"readlen",
"<",
"5",
"&&",
"(",
"l",
"=",
"raf",
".",
"read",
"(",
"bytes",
",",
"readlen",
",",
"bytes",
".",
"length",
"-",
"readlen",
")",
")",
">=",
"0",
")",
"{",
"readlen",
"+=",
"l",
";",
"}",
"if",
"(",
"readlen",
"!=",
"bytes",
".",
"length",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Invalid snapshot \"",
"+",
"f",
"+",
"\" too short, len = \"",
"+",
"readlen",
")",
";",
"return",
"false",
";",
"}",
"ByteBuffer",
"bb",
"=",
"ByteBuffer",
".",
"wrap",
"(",
"bytes",
")",
";",
"int",
"len",
"=",
"bb",
".",
"getInt",
"(",
")",
";",
"byte",
"b",
"=",
"bb",
".",
"get",
"(",
")",
";",
"if",
"(",
"len",
"!=",
"1",
"||",
"b",
"!=",
"'",
"'",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Invalid snapshot \"",
"+",
"f",
"+",
"\" len = \"",
"+",
"len",
"+",
"\" byte = \"",
"+",
"(",
"b",
"&",
"0xff",
")",
")",
";",
"return",
"false",
";",
"}",
"}",
"finally",
"{",
"raf",
".",
"close",
"(",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Verifies that the file is a valid snapshot. Snapshot may be invalid if
it's incomplete as in a situation when the server dies while in the process
of storing a snapshot. Any file that is not a snapshot is also
an invalid snapshot.
@param f file to verify
@return true if the snapshot is valid
@throws IOException | [
"Verifies",
"that",
"the",
"file",
"is",
"a",
"valid",
"snapshot",
".",
"Snapshot",
"may",
"be",
"invalid",
"if",
"it",
"s",
"incomplete",
"as",
"in",
"a",
"situation",
"when",
"the",
"server",
"dies",
"while",
"in",
"the",
"process",
"of",
"storing",
"a",
"snapshot",
".",
"Any",
"file",
"that",
"is",
"not",
"a",
"snapshot",
"is",
"also",
"an",
"invalid",
"snapshot",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java#L161-L199 |
xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/thread_pool/ThreadPoolManager.java | ThreadPoolManager.scheduleAtFixedRate | public static ScheduledFuture scheduleAtFixedRate(Runnable runnable, long periodInMilli) {
"""
轻量级的定时任务执行器。 任务之间不会并行执行,任何时刻都至多只会有一个任务在执行。
如果下一个任务执行时间已经到了,但是前一个还没有执行完毕,那么下个任务等待直到前一个执行完,然后再马上开始.
@param runnable 执行的任务
@param periodInMilli 任务启动固定间隔,单位毫秒
"""
/** 我们默认设定一个runnable生命周期与一个msgId一一对应 */
Runnable proxied = wrapRunnable(runnable, null);
return newSingleThreadScheduler().scheduleAtFixedRate(proxied, 0, periodInMilli, TimeUnit.MILLISECONDS);
} | java | public static ScheduledFuture scheduleAtFixedRate(Runnable runnable, long periodInMilli) {
/** 我们默认设定一个runnable生命周期与一个msgId一一对应 */
Runnable proxied = wrapRunnable(runnable, null);
return newSingleThreadScheduler().scheduleAtFixedRate(proxied, 0, periodInMilli, TimeUnit.MILLISECONDS);
} | [
"public",
"static",
"ScheduledFuture",
"scheduleAtFixedRate",
"(",
"Runnable",
"runnable",
",",
"long",
"periodInMilli",
")",
"{",
"/** 我们默认设定一个runnable生命周期与一个msgId一一对应 */",
"Runnable",
"proxied",
"=",
"wrapRunnable",
"(",
"runnable",
",",
"null",
")",
";",
"return",
"newSingleThreadScheduler",
"(",
")",
".",
"scheduleAtFixedRate",
"(",
"proxied",
",",
"0",
",",
"periodInMilli",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"}"
] | 轻量级的定时任务执行器。 任务之间不会并行执行,任何时刻都至多只会有一个任务在执行。
如果下一个任务执行时间已经到了,但是前一个还没有执行完毕,那么下个任务等待直到前一个执行完,然后再马上开始.
@param runnable 执行的任务
@param periodInMilli 任务启动固定间隔,单位毫秒 | [
"轻量级的定时任务执行器。",
"任务之间不会并行执行,任何时刻都至多只会有一个任务在执行。",
"如果下一个任务执行时间已经到了,但是前一个还没有执行完毕,那么下个任务等待直到前一个执行完,然后再马上开始",
"."
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/thread_pool/ThreadPoolManager.java#L253-L257 |
dadoonet/elasticsearch-beyonder | src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java | IndexElasticsearchUpdater.removeIndexInElasticsearch | @Deprecated
private static void removeIndexInElasticsearch(Client client, String index) throws Exception {
"""
Remove a new index in Elasticsearch
@param client Elasticsearch client
@param index Index name
@throws Exception if the elasticsearch API call is failing
"""
logger.trace("removeIndex([{}])", index);
assert client != null;
assert index != null;
AcknowledgedResponse response = client.admin().indices().prepareDelete(index).get();
if (!response.isAcknowledged()) {
logger.warn("Could not delete index [{}]", index);
throw new Exception("Could not delete index ["+index+"].");
}
logger.trace("/removeIndex([{}])", index);
} | java | @Deprecated
private static void removeIndexInElasticsearch(Client client, String index) throws Exception {
logger.trace("removeIndex([{}])", index);
assert client != null;
assert index != null;
AcknowledgedResponse response = client.admin().indices().prepareDelete(index).get();
if (!response.isAcknowledged()) {
logger.warn("Could not delete index [{}]", index);
throw new Exception("Could not delete index ["+index+"].");
}
logger.trace("/removeIndex([{}])", index);
} | [
"@",
"Deprecated",
"private",
"static",
"void",
"removeIndexInElasticsearch",
"(",
"Client",
"client",
",",
"String",
"index",
")",
"throws",
"Exception",
"{",
"logger",
".",
"trace",
"(",
"\"removeIndex([{}])\"",
",",
"index",
")",
";",
"assert",
"client",
"!=",
"null",
";",
"assert",
"index",
"!=",
"null",
";",
"AcknowledgedResponse",
"response",
"=",
"client",
".",
"admin",
"(",
")",
".",
"indices",
"(",
")",
".",
"prepareDelete",
"(",
"index",
")",
".",
"get",
"(",
")",
";",
"if",
"(",
"!",
"response",
".",
"isAcknowledged",
"(",
")",
")",
"{",
"logger",
".",
"warn",
"(",
"\"Could not delete index [{}]\"",
",",
"index",
")",
";",
"throw",
"new",
"Exception",
"(",
"\"Could not delete index [\"",
"+",
"index",
"+",
"\"].\"",
")",
";",
"}",
"logger",
".",
"trace",
"(",
"\"/removeIndex([{}])\"",
",",
"index",
")",
";",
"}"
] | Remove a new index in Elasticsearch
@param client Elasticsearch client
@param index Index name
@throws Exception if the elasticsearch API call is failing | [
"Remove",
"a",
"new",
"index",
"in",
"Elasticsearch"
] | train | https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java#L96-L110 |
alkacon/opencms-core | src/org/opencms/workplace/editors/CmsDefaultPageEditor.java | CmsDefaultPageEditor.actionPreview | public void actionPreview() throws IOException, JspException {
"""
Performs the preview page action in a new browser window.<p>
@throws IOException if redirect fails
@throws JspException if inclusion of error page fails
"""
try {
// save content of the editor to the temporary file
performSaveContent(getParamElementname(), getElementLocale());
} catch (CmsException e) {
// show error page
showErrorPage(this, e);
}
// redirect to the temporary file with current active element language
String param = "?" + org.opencms.i18n.CmsLocaleManager.PARAMETER_LOCALE + "=" + getParamElementlanguage();
sendCmsRedirect(getParamTempfile() + param);
} | java | public void actionPreview() throws IOException, JspException {
try {
// save content of the editor to the temporary file
performSaveContent(getParamElementname(), getElementLocale());
} catch (CmsException e) {
// show error page
showErrorPage(this, e);
}
// redirect to the temporary file with current active element language
String param = "?" + org.opencms.i18n.CmsLocaleManager.PARAMETER_LOCALE + "=" + getParamElementlanguage();
sendCmsRedirect(getParamTempfile() + param);
} | [
"public",
"void",
"actionPreview",
"(",
")",
"throws",
"IOException",
",",
"JspException",
"{",
"try",
"{",
"// save content of the editor to the temporary file",
"performSaveContent",
"(",
"getParamElementname",
"(",
")",
",",
"getElementLocale",
"(",
")",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"// show error page",
"showErrorPage",
"(",
"this",
",",
"e",
")",
";",
"}",
"// redirect to the temporary file with current active element language",
"String",
"param",
"=",
"\"?\"",
"+",
"org",
".",
"opencms",
".",
"i18n",
".",
"CmsLocaleManager",
".",
"PARAMETER_LOCALE",
"+",
"\"=\"",
"+",
"getParamElementlanguage",
"(",
")",
";",
"sendCmsRedirect",
"(",
"getParamTempfile",
"(",
")",
"+",
"param",
")",
";",
"}"
] | Performs the preview page action in a new browser window.<p>
@throws IOException if redirect fails
@throws JspException if inclusion of error page fails | [
"Performs",
"the",
"preview",
"page",
"action",
"in",
"a",
"new",
"browser",
"window",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsDefaultPageEditor.java#L273-L286 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/thumbnail/ThumbnailRenderer.java | ThumbnailRenderer.encodeBegin | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
"""
This methods generates the HTML code of the current b:thumbnail.
<code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code>
to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component
the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called
to generate the rest of the HTML code.
@param context the FacesContext.
@param component the current b:thumbnail.
@throws IOException thrown if something goes wrong when writing the HTML code.
"""
if (!component.isRendered()) {
return;
}
Thumbnail thumbnail = (Thumbnail) component;
ResponseWriter rw = context.getResponseWriter();
String clientId = thumbnail.getClientId();
Tooltip.generateTooltip(context, thumbnail, rw);
beginResponsiveWrapper(component, rw);
rw.startElement("div", thumbnail);
rw.writeAttribute("id", clientId, "id");
Tooltip.generateTooltip(context, thumbnail, rw);
String style = thumbnail.getStyle();
if (null != style) {
rw.writeAttribute("style", style, null);
}
String styleClass = thumbnail.getStyleClass();
if (null == styleClass)
styleClass = "thumbnail";
else
styleClass = "thumbnail " + styleClass;
rw.writeAttribute("class", styleClass, "class");
} | java | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
Thumbnail thumbnail = (Thumbnail) component;
ResponseWriter rw = context.getResponseWriter();
String clientId = thumbnail.getClientId();
Tooltip.generateTooltip(context, thumbnail, rw);
beginResponsiveWrapper(component, rw);
rw.startElement("div", thumbnail);
rw.writeAttribute("id", clientId, "id");
Tooltip.generateTooltip(context, thumbnail, rw);
String style = thumbnail.getStyle();
if (null != style) {
rw.writeAttribute("style", style, null);
}
String styleClass = thumbnail.getStyleClass();
if (null == styleClass)
styleClass = "thumbnail";
else
styleClass = "thumbnail " + styleClass;
rw.writeAttribute("class", styleClass, "class");
} | [
"@",
"Override",
"public",
"void",
"encodeBegin",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"Thumbnail",
"thumbnail",
"=",
"(",
"Thumbnail",
")",
"component",
";",
"ResponseWriter",
"rw",
"=",
"context",
".",
"getResponseWriter",
"(",
")",
";",
"String",
"clientId",
"=",
"thumbnail",
".",
"getClientId",
"(",
")",
";",
"Tooltip",
".",
"generateTooltip",
"(",
"context",
",",
"thumbnail",
",",
"rw",
")",
";",
"beginResponsiveWrapper",
"(",
"component",
",",
"rw",
")",
";",
"rw",
".",
"startElement",
"(",
"\"div\"",
",",
"thumbnail",
")",
";",
"rw",
".",
"writeAttribute",
"(",
"\"id\"",
",",
"clientId",
",",
"\"id\"",
")",
";",
"Tooltip",
".",
"generateTooltip",
"(",
"context",
",",
"thumbnail",
",",
"rw",
")",
";",
"String",
"style",
"=",
"thumbnail",
".",
"getStyle",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"style",
")",
"{",
"rw",
".",
"writeAttribute",
"(",
"\"style\"",
",",
"style",
",",
"null",
")",
";",
"}",
"String",
"styleClass",
"=",
"thumbnail",
".",
"getStyleClass",
"(",
")",
";",
"if",
"(",
"null",
"==",
"styleClass",
")",
"styleClass",
"=",
"\"thumbnail\"",
";",
"else",
"styleClass",
"=",
"\"thumbnail \"",
"+",
"styleClass",
";",
"rw",
".",
"writeAttribute",
"(",
"\"class\"",
",",
"styleClass",
",",
"\"class\"",
")",
";",
"}"
] | This methods generates the HTML code of the current b:thumbnail.
<code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code>
to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component
the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called
to generate the rest of the HTML code.
@param context the FacesContext.
@param component the current b:thumbnail.
@throws IOException thrown if something goes wrong when writing the HTML code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"thumbnail",
".",
"<code",
">",
"encodeBegin<",
"/",
"code",
">",
"generates",
"the",
"start",
"of",
"the",
"component",
".",
"After",
"the",
"the",
"JSF",
"framework",
"calls",
"<code",
">",
"encodeChildren",
"()",
"<",
"/",
"code",
">",
"to",
"generate",
"the",
"HTML",
"code",
"between",
"the",
"beginning",
"and",
"the",
"end",
"of",
"the",
"component",
".",
"For",
"instance",
"in",
"the",
"case",
"of",
"a",
"panel",
"component",
"the",
"content",
"of",
"the",
"panel",
"is",
"generated",
"by",
"<code",
">",
"encodeChildren",
"()",
"<",
"/",
"code",
">",
".",
"After",
"that",
"<code",
">",
"encodeEnd",
"()",
"<",
"/",
"code",
">",
"is",
"called",
"to",
"generate",
"the",
"rest",
"of",
"the",
"HTML",
"code",
"."
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/thumbnail/ThumbnailRenderer.java#L45-L72 |
netty/netty | common/src/main/java/io/netty/util/internal/PromiseNotificationUtil.java | PromiseNotificationUtil.trySuccess | public static <V> void trySuccess(Promise<? super V> p, V result, InternalLogger logger) {
"""
Try to mark the {@link Promise} as success and log if {@code logger} is not {@code null} in case this fails.
"""
if (!p.trySuccess(result) && logger != null) {
Throwable err = p.cause();
if (err == null) {
logger.warn("Failed to mark a promise as success because it has succeeded already: {}", p);
} else {
logger.warn(
"Failed to mark a promise as success because it has failed already: {}, unnotified cause:",
p, err);
}
}
} | java | public static <V> void trySuccess(Promise<? super V> p, V result, InternalLogger logger) {
if (!p.trySuccess(result) && logger != null) {
Throwable err = p.cause();
if (err == null) {
logger.warn("Failed to mark a promise as success because it has succeeded already: {}", p);
} else {
logger.warn(
"Failed to mark a promise as success because it has failed already: {}, unnotified cause:",
p, err);
}
}
} | [
"public",
"static",
"<",
"V",
">",
"void",
"trySuccess",
"(",
"Promise",
"<",
"?",
"super",
"V",
">",
"p",
",",
"V",
"result",
",",
"InternalLogger",
"logger",
")",
"{",
"if",
"(",
"!",
"p",
".",
"trySuccess",
"(",
"result",
")",
"&&",
"logger",
"!=",
"null",
")",
"{",
"Throwable",
"err",
"=",
"p",
".",
"cause",
"(",
")",
";",
"if",
"(",
"err",
"==",
"null",
")",
"{",
"logger",
".",
"warn",
"(",
"\"Failed to mark a promise as success because it has succeeded already: {}\"",
",",
"p",
")",
";",
"}",
"else",
"{",
"logger",
".",
"warn",
"(",
"\"Failed to mark a promise as success because it has failed already: {}, unnotified cause:\"",
",",
"p",
",",
"err",
")",
";",
"}",
"}",
"}"
] | Try to mark the {@link Promise} as success and log if {@code logger} is not {@code null} in case this fails. | [
"Try",
"to",
"mark",
"the",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/PromiseNotificationUtil.java#L47-L58 |
lionsoul2014/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/SegKit.java | SegKit.appendSynonyms | public final static void appendSynonyms(LinkedList<IWord> wordPool, IWord wd) {
"""
quick interface to do the synonyms append word
You got check if the specified has any synonyms first
@param wordPool
@param wd
"""
List<IWord> synList = wd.getSyn().getList();
synchronized (synList) {
for ( int j = 0; j < synList.size(); j++ ) {
IWord curWord = synList.get(j);
if ( curWord.getValue()
.equals(wd.getValue()) ) {
continue;
}
IWord synWord = synList.get(j).clone();
synWord.setPosition(wd.getPosition());
wordPool.add(synWord);
}
}
} | java | public final static void appendSynonyms(LinkedList<IWord> wordPool, IWord wd)
{
List<IWord> synList = wd.getSyn().getList();
synchronized (synList) {
for ( int j = 0; j < synList.size(); j++ ) {
IWord curWord = synList.get(j);
if ( curWord.getValue()
.equals(wd.getValue()) ) {
continue;
}
IWord synWord = synList.get(j).clone();
synWord.setPosition(wd.getPosition());
wordPool.add(synWord);
}
}
} | [
"public",
"final",
"static",
"void",
"appendSynonyms",
"(",
"LinkedList",
"<",
"IWord",
">",
"wordPool",
",",
"IWord",
"wd",
")",
"{",
"List",
"<",
"IWord",
">",
"synList",
"=",
"wd",
".",
"getSyn",
"(",
")",
".",
"getList",
"(",
")",
";",
"synchronized",
"(",
"synList",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"synList",
".",
"size",
"(",
")",
";",
"j",
"++",
")",
"{",
"IWord",
"curWord",
"=",
"synList",
".",
"get",
"(",
"j",
")",
";",
"if",
"(",
"curWord",
".",
"getValue",
"(",
")",
".",
"equals",
"(",
"wd",
".",
"getValue",
"(",
")",
")",
")",
"{",
"continue",
";",
"}",
"IWord",
"synWord",
"=",
"synList",
".",
"get",
"(",
"j",
")",
".",
"clone",
"(",
")",
";",
"synWord",
".",
"setPosition",
"(",
"wd",
".",
"getPosition",
"(",
")",
")",
";",
"wordPool",
".",
"add",
"(",
"synWord",
")",
";",
"}",
"}",
"}"
] | quick interface to do the synonyms append word
You got check if the specified has any synonyms first
@param wordPool
@param wd | [
"quick",
"interface",
"to",
"do",
"the",
"synonyms",
"append",
"word",
"You",
"got",
"check",
"if",
"the",
"specified",
"has",
"any",
"synonyms",
"first"
] | train | https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/SegKit.java#L20-L36 |
apache/incubator-druid | processing/src/main/java/org/apache/druid/segment/serde/ComplexMetricSerde.java | ComplexMetricSerde.fromBytes | public Object fromBytes(byte[] data, int start, int numBytes) {
"""
Converts byte[] to intermediate representation of the aggregate.
@param data array
@param start offset in the byte array where to start reading
@param numBytes number of bytes to read in given array
@return intermediate representation of the aggregate
"""
ByteBuffer bb = ByteBuffer.wrap(data);
if (start > 0) {
bb.position(start);
}
return getObjectStrategy().fromByteBuffer(bb, numBytes);
} | java | public Object fromBytes(byte[] data, int start, int numBytes)
{
ByteBuffer bb = ByteBuffer.wrap(data);
if (start > 0) {
bb.position(start);
}
return getObjectStrategy().fromByteBuffer(bb, numBytes);
} | [
"public",
"Object",
"fromBytes",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"start",
",",
"int",
"numBytes",
")",
"{",
"ByteBuffer",
"bb",
"=",
"ByteBuffer",
".",
"wrap",
"(",
"data",
")",
";",
"if",
"(",
"start",
">",
"0",
")",
"{",
"bb",
".",
"position",
"(",
"start",
")",
";",
"}",
"return",
"getObjectStrategy",
"(",
")",
".",
"fromByteBuffer",
"(",
"bb",
",",
"numBytes",
")",
";",
"}"
] | Converts byte[] to intermediate representation of the aggregate.
@param data array
@param start offset in the byte array where to start reading
@param numBytes number of bytes to read in given array
@return intermediate representation of the aggregate | [
"Converts",
"byte",
"[]",
"to",
"intermediate",
"representation",
"of",
"the",
"aggregate",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/serde/ComplexMetricSerde.java#L104-L111 |
stripe/stripe-java | src/main/java/com/stripe/model/Order.java | Order.returnOrder | public OrderReturn returnOrder(Map<String, Object> params) throws StripeException {
"""
Return all or part of an order. The order must have a status of <code>paid</code> or <code>
fulfilled</code> before it can be returned. Once all items have been returned, the order will
become <code>canceled</code> or <code>returned</code> depending on which status the order
started in.
"""
return returnOrder(params, (RequestOptions) null);
} | java | public OrderReturn returnOrder(Map<String, Object> params) throws StripeException {
return returnOrder(params, (RequestOptions) null);
} | [
"public",
"OrderReturn",
"returnOrder",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
")",
"throws",
"StripeException",
"{",
"return",
"returnOrder",
"(",
"params",
",",
"(",
"RequestOptions",
")",
"null",
")",
";",
"}"
] | Return all or part of an order. The order must have a status of <code>paid</code> or <code>
fulfilled</code> before it can be returned. Once all items have been returned, the order will
become <code>canceled</code> or <code>returned</code> depending on which status the order
started in. | [
"Return",
"all",
"or",
"part",
"of",
"an",
"order",
".",
"The",
"order",
"must",
"have",
"a",
"status",
"of",
"<code",
">",
"paid<",
"/",
"code",
">",
"or",
"<code",
">",
"fulfilled<",
"/",
"code",
">",
"before",
"it",
"can",
"be",
"returned",
".",
"Once",
"all",
"items",
"have",
"been",
"returned",
"the",
"order",
"will",
"become",
"<code",
">",
"canceled<",
"/",
"code",
">",
"or",
"<code",
">",
"returned<",
"/",
"code",
">",
"depending",
"on",
"which",
"status",
"the",
"order",
"started",
"in",
"."
] | train | https://github.com/stripe/stripe-java/blob/acfa8becef3e73bfe3e9d8880bea3f3f30dadeac/src/main/java/com/stripe/model/Order.java#L394-L396 |
Appendium/objectlabkit | datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ExcelDateUtil.java | ExcelDateUtil.getJavaCalendar | public static Calendar getJavaCalendar(final double excelDate, final boolean use1904windowing) {
"""
Given an Excel date with either 1900 or 1904 date windowing, converts it
to a java.util.Date.
@param excelDate
The Excel date.
@param use1904windowing
true if date uses 1904 windowing, or false if using 1900 date
windowing.
@return Java representation of the date without any time.
@see java.util.TimeZone
"""
if (isValidExcelDate(excelDate)) {
int startYear = EXCEL_BASE_YEAR;
int dayAdjust = -1; // Excel thinks 2/29/1900 is a valid date, which
// it isn't
final int wholeDays = (int) Math.floor(excelDate);
if (use1904windowing) {
startYear = EXCEL_WINDOWING_1904;
dayAdjust = 1; // 1904 date windowing uses 1/2/1904 as the
// first day
} else if (wholeDays < EXCEL_FUDGE_19000229) {
// Date is prior to 3/1/1900, so adjust because Excel thinks
// 2/29/1900 exists
// If Excel date == 2/29/1900, will become 3/1/1900 in Java
// representation
dayAdjust = 0;
}
final GregorianCalendar calendar = new GregorianCalendar(startYear, 0, wholeDays + dayAdjust);
final int millisecondsInDay = (int) ((excelDate - Math.floor(excelDate)) * DAY_MILLISECONDS + HALF_MILLISEC);
calendar.set(Calendar.MILLISECOND, millisecondsInDay);
return calendar;
} else {
return null;
}
} | java | public static Calendar getJavaCalendar(final double excelDate, final boolean use1904windowing) {
if (isValidExcelDate(excelDate)) {
int startYear = EXCEL_BASE_YEAR;
int dayAdjust = -1; // Excel thinks 2/29/1900 is a valid date, which
// it isn't
final int wholeDays = (int) Math.floor(excelDate);
if (use1904windowing) {
startYear = EXCEL_WINDOWING_1904;
dayAdjust = 1; // 1904 date windowing uses 1/2/1904 as the
// first day
} else if (wholeDays < EXCEL_FUDGE_19000229) {
// Date is prior to 3/1/1900, so adjust because Excel thinks
// 2/29/1900 exists
// If Excel date == 2/29/1900, will become 3/1/1900 in Java
// representation
dayAdjust = 0;
}
final GregorianCalendar calendar = new GregorianCalendar(startYear, 0, wholeDays + dayAdjust);
final int millisecondsInDay = (int) ((excelDate - Math.floor(excelDate)) * DAY_MILLISECONDS + HALF_MILLISEC);
calendar.set(Calendar.MILLISECOND, millisecondsInDay);
return calendar;
} else {
return null;
}
} | [
"public",
"static",
"Calendar",
"getJavaCalendar",
"(",
"final",
"double",
"excelDate",
",",
"final",
"boolean",
"use1904windowing",
")",
"{",
"if",
"(",
"isValidExcelDate",
"(",
"excelDate",
")",
")",
"{",
"int",
"startYear",
"=",
"EXCEL_BASE_YEAR",
";",
"int",
"dayAdjust",
"=",
"-",
"1",
";",
"// Excel thinks 2/29/1900 is a valid date, which\r",
"// it isn't\r",
"final",
"int",
"wholeDays",
"=",
"(",
"int",
")",
"Math",
".",
"floor",
"(",
"excelDate",
")",
";",
"if",
"(",
"use1904windowing",
")",
"{",
"startYear",
"=",
"EXCEL_WINDOWING_1904",
";",
"dayAdjust",
"=",
"1",
";",
"// 1904 date windowing uses 1/2/1904 as the\r",
"// first day\r",
"}",
"else",
"if",
"(",
"wholeDays",
"<",
"EXCEL_FUDGE_19000229",
")",
"{",
"// Date is prior to 3/1/1900, so adjust because Excel thinks\r",
"// 2/29/1900 exists\r",
"// If Excel date == 2/29/1900, will become 3/1/1900 in Java\r",
"// representation\r",
"dayAdjust",
"=",
"0",
";",
"}",
"final",
"GregorianCalendar",
"calendar",
"=",
"new",
"GregorianCalendar",
"(",
"startYear",
",",
"0",
",",
"wholeDays",
"+",
"dayAdjust",
")",
";",
"final",
"int",
"millisecondsInDay",
"=",
"(",
"int",
")",
"(",
"(",
"excelDate",
"-",
"Math",
".",
"floor",
"(",
"excelDate",
")",
")",
"*",
"DAY_MILLISECONDS",
"+",
"HALF_MILLISEC",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"MILLISECOND",
",",
"millisecondsInDay",
")",
";",
"return",
"calendar",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | Given an Excel date with either 1900 or 1904 date windowing, converts it
to a java.util.Date.
@param excelDate
The Excel date.
@param use1904windowing
true if date uses 1904 windowing, or false if using 1900 date
windowing.
@return Java representation of the date without any time.
@see java.util.TimeZone | [
"Given",
"an",
"Excel",
"date",
"with",
"either",
"1900",
"or",
"1904",
"date",
"windowing",
"converts",
"it",
"to",
"a",
"java",
".",
"util",
".",
"Date",
"."
] | train | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ExcelDateUtil.java#L72-L97 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbEpisodes.java | TmdbEpisodes.getEpisodeChanges | public ResultList<ChangeKeyItem> getEpisodeChanges(int episodeID, String startDate, String endDate) throws MovieDbException {
"""
Look up a TV episode's changes by episode ID
@param episodeID
@param startDate
@param endDate
@return
@throws MovieDbException
"""
return getMediaChanges(episodeID, startDate, endDate);
} | java | public ResultList<ChangeKeyItem> getEpisodeChanges(int episodeID, String startDate, String endDate) throws MovieDbException {
return getMediaChanges(episodeID, startDate, endDate);
} | [
"public",
"ResultList",
"<",
"ChangeKeyItem",
">",
"getEpisodeChanges",
"(",
"int",
"episodeID",
",",
"String",
"startDate",
",",
"String",
"endDate",
")",
"throws",
"MovieDbException",
"{",
"return",
"getMediaChanges",
"(",
"episodeID",
",",
"startDate",
",",
"endDate",
")",
";",
"}"
] | Look up a TV episode's changes by episode ID
@param episodeID
@param startDate
@param endDate
@return
@throws MovieDbException | [
"Look",
"up",
"a",
"TV",
"episode",
"s",
"changes",
"by",
"episode",
"ID"
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbEpisodes.java#L105-L107 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/AccountsApi.java | AccountsApi.updateSharedAccess | public AccountSharedAccess updateSharedAccess(String accountId, AccountSharedAccess accountSharedAccess, AccountsApi.UpdateSharedAccessOptions options) throws ApiException {
"""
Reserved: Sets the shared access information for users.
Reserved: Sets the shared access information for one or more users.
@param accountId The external account number (int) or account ID Guid. (required)
@param accountSharedAccess (optional)
@param options for modifying the method behavior.
@return AccountSharedAccess
@throws ApiException if fails to make API call
"""
Object localVarPostBody = accountSharedAccess;
// verify the required parameter 'accountId' is set
if (accountId == null) {
throw new ApiException(400, "Missing the required parameter 'accountId' when calling updateSharedAccess");
}
// create path and map variables
String localVarPath = "/v2/accounts/{accountId}/shared_access".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));
// query params
java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>();
java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>();
java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>();
if (options != null) {
localVarQueryParams.addAll(apiClient.parameterToPairs("", "item_type", options.itemType));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "user_ids", options.userIds));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ };
GenericType<AccountSharedAccess> localVarReturnType = new GenericType<AccountSharedAccess>() {};
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | java | public AccountSharedAccess updateSharedAccess(String accountId, AccountSharedAccess accountSharedAccess, AccountsApi.UpdateSharedAccessOptions options) throws ApiException {
Object localVarPostBody = accountSharedAccess;
// verify the required parameter 'accountId' is set
if (accountId == null) {
throw new ApiException(400, "Missing the required parameter 'accountId' when calling updateSharedAccess");
}
// create path and map variables
String localVarPath = "/v2/accounts/{accountId}/shared_access".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));
// query params
java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>();
java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>();
java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>();
if (options != null) {
localVarQueryParams.addAll(apiClient.parameterToPairs("", "item_type", options.itemType));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "user_ids", options.userIds));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ };
GenericType<AccountSharedAccess> localVarReturnType = new GenericType<AccountSharedAccess>() {};
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | [
"public",
"AccountSharedAccess",
"updateSharedAccess",
"(",
"String",
"accountId",
",",
"AccountSharedAccess",
"accountSharedAccess",
",",
"AccountsApi",
".",
"UpdateSharedAccessOptions",
"options",
")",
"throws",
"ApiException",
"{",
"Object",
"localVarPostBody",
"=",
"accountSharedAccess",
";",
"// verify the required parameter 'accountId' is set",
"if",
"(",
"accountId",
"==",
"null",
")",
"{",
"throw",
"new",
"ApiException",
"(",
"400",
",",
"\"Missing the required parameter 'accountId' when calling updateSharedAccess\"",
")",
";",
"}",
"// create path and map variables",
"String",
"localVarPath",
"=",
"\"/v2/accounts/{accountId}/shared_access\"",
".",
"replaceAll",
"(",
"\"\\\\{format\\\\}\"",
",",
"\"json\"",
")",
".",
"replaceAll",
"(",
"\"\\\\{\"",
"+",
"\"accountId\"",
"+",
"\"\\\\}\"",
",",
"apiClient",
".",
"escapeString",
"(",
"accountId",
".",
"toString",
"(",
")",
")",
")",
";",
"// query params",
"java",
".",
"util",
".",
"List",
"<",
"Pair",
">",
"localVarQueryParams",
"=",
"new",
"java",
".",
"util",
".",
"ArrayList",
"<",
"Pair",
">",
"(",
")",
";",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"localVarHeaderParams",
"=",
"new",
"java",
".",
"util",
".",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"Object",
">",
"localVarFormParams",
"=",
"new",
"java",
".",
"util",
".",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"if",
"(",
"options",
"!=",
"null",
")",
"{",
"localVarQueryParams",
".",
"addAll",
"(",
"apiClient",
".",
"parameterToPairs",
"(",
"\"\"",
",",
"\"item_type\"",
",",
"options",
".",
"itemType",
")",
")",
";",
"localVarQueryParams",
".",
"addAll",
"(",
"apiClient",
".",
"parameterToPairs",
"(",
"\"\"",
",",
"\"user_ids\"",
",",
"options",
".",
"userIds",
")",
")",
";",
"}",
"final",
"String",
"[",
"]",
"localVarAccepts",
"=",
"{",
"\"application/json\"",
"}",
";",
"final",
"String",
"localVarAccept",
"=",
"apiClient",
".",
"selectHeaderAccept",
"(",
"localVarAccepts",
")",
";",
"final",
"String",
"[",
"]",
"localVarContentTypes",
"=",
"{",
"}",
";",
"final",
"String",
"localVarContentType",
"=",
"apiClient",
".",
"selectHeaderContentType",
"(",
"localVarContentTypes",
")",
";",
"String",
"[",
"]",
"localVarAuthNames",
"=",
"new",
"String",
"[",
"]",
"{",
"\"docusignAccessCode\"",
"}",
";",
"//{ };",
"GenericType",
"<",
"AccountSharedAccess",
">",
"localVarReturnType",
"=",
"new",
"GenericType",
"<",
"AccountSharedAccess",
">",
"(",
")",
"{",
"}",
";",
"return",
"apiClient",
".",
"invokeAPI",
"(",
"localVarPath",
",",
"\"PUT\"",
",",
"localVarQueryParams",
",",
"localVarPostBody",
",",
"localVarHeaderParams",
",",
"localVarFormParams",
",",
"localVarAccept",
",",
"localVarContentType",
",",
"localVarAuthNames",
",",
"localVarReturnType",
")",
";",
"}"
] | Reserved: Sets the shared access information for users.
Reserved: Sets the shared access information for one or more users.
@param accountId The external account number (int) or account ID Guid. (required)
@param accountSharedAccess (optional)
@param options for modifying the method behavior.
@return AccountSharedAccess
@throws ApiException if fails to make API call | [
"Reserved",
":",
"Sets",
"the",
"shared",
"access",
"information",
"for",
"users",
".",
"Reserved",
":",
"Sets",
"the",
"shared",
"access",
"information",
"for",
"one",
"or",
"more",
"users",
"."
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L3056-L3093 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/types/parser/FloatParser.java | FloatParser.parseField | public static final float parseField(byte[] bytes, int startPos, int length, char delimiter) {
"""
Static utility to parse a field of type float from a byte sequence that represents text characters
(such as when read from a file stream).
@param bytes The bytes containing the text data that should be parsed.
@param startPos The offset to start the parsing.
@param length The length of the byte sequence (counting from the offset).
@param delimiter The delimiter that terminates the field.
@return The parsed value.
@throws NumberFormatException Thrown when the value cannot be parsed because the text represents not a correct number.
"""
if (length <= 0) {
throw new NumberFormatException("Invalid input: Empty string");
}
int i = 0;
final byte delByte = (byte) delimiter;
while (i < length && bytes[i] != delByte) {
i++;
}
String str = new String(bytes, startPos, i);
return Float.parseFloat(str);
} | java | public static final float parseField(byte[] bytes, int startPos, int length, char delimiter) {
if (length <= 0) {
throw new NumberFormatException("Invalid input: Empty string");
}
int i = 0;
final byte delByte = (byte) delimiter;
while (i < length && bytes[i] != delByte) {
i++;
}
String str = new String(bytes, startPos, i);
return Float.parseFloat(str);
} | [
"public",
"static",
"final",
"float",
"parseField",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"startPos",
",",
"int",
"length",
",",
"char",
"delimiter",
")",
"{",
"if",
"(",
"length",
"<=",
"0",
")",
"{",
"throw",
"new",
"NumberFormatException",
"(",
"\"Invalid input: Empty string\"",
")",
";",
"}",
"int",
"i",
"=",
"0",
";",
"final",
"byte",
"delByte",
"=",
"(",
"byte",
")",
"delimiter",
";",
"while",
"(",
"i",
"<",
"length",
"&&",
"bytes",
"[",
"i",
"]",
"!=",
"delByte",
")",
"{",
"i",
"++",
";",
"}",
"String",
"str",
"=",
"new",
"String",
"(",
"bytes",
",",
"startPos",
",",
"i",
")",
";",
"return",
"Float",
".",
"parseFloat",
"(",
"str",
")",
";",
"}"
] | Static utility to parse a field of type float from a byte sequence that represents text characters
(such as when read from a file stream).
@param bytes The bytes containing the text data that should be parsed.
@param startPos The offset to start the parsing.
@param length The length of the byte sequence (counting from the offset).
@param delimiter The delimiter that terminates the field.
@return The parsed value.
@throws NumberFormatException Thrown when the value cannot be parsed because the text represents not a correct number. | [
"Static",
"utility",
"to",
"parse",
"a",
"field",
"of",
"type",
"float",
"from",
"a",
"byte",
"sequence",
"that",
"represents",
"text",
"characters",
"(",
"such",
"as",
"when",
"read",
"from",
"a",
"file",
"stream",
")",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/types/parser/FloatParser.java#L83-L96 |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/Config.java | Config.getURIString | private static String getURIString(Properties props, String key, String def) {
"""
This method is used to load path to .ekstazi when the path is
given as URI string. We need to use URI to make sure that we
support paths (given to javaagent) even if they contain spaces.
"""
try {
URI uri = new URI(props.getProperty(key, def));
return new File(uri).getAbsolutePath();
} catch (Exception ex) {
return getString(props, key, def);
}
} | java | private static String getURIString(Properties props, String key, String def) {
try {
URI uri = new URI(props.getProperty(key, def));
return new File(uri).getAbsolutePath();
} catch (Exception ex) {
return getString(props, key, def);
}
} | [
"private",
"static",
"String",
"getURIString",
"(",
"Properties",
"props",
",",
"String",
"key",
",",
"String",
"def",
")",
"{",
"try",
"{",
"URI",
"uri",
"=",
"new",
"URI",
"(",
"props",
".",
"getProperty",
"(",
"key",
",",
"def",
")",
")",
";",
"return",
"new",
"File",
"(",
"uri",
")",
".",
"getAbsolutePath",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"return",
"getString",
"(",
"props",
",",
"key",
",",
"def",
")",
";",
"}",
"}"
] | This method is used to load path to .ekstazi when the path is
given as URI string. We need to use URI to make sure that we
support paths (given to javaagent) even if they contain spaces. | [
"This",
"method",
"is",
"used",
"to",
"load",
"path",
"to",
".",
"ekstazi",
"when",
"the",
"path",
"is",
"given",
"as",
"URI",
"string",
".",
"We",
"need",
"to",
"use",
"URI",
"to",
"make",
"sure",
"that",
"we",
"support",
"paths",
"(",
"given",
"to",
"javaagent",
")",
"even",
"if",
"they",
"contain",
"spaces",
"."
] | train | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/Config.java#L419-L426 |
ArcBees/gwtquery | gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/MousePlugin.java | MousePlugin.mouseUp | protected boolean mouseUp(Element element, GqEvent event) {
"""
Method called when mouse is released..
You should not override this method. Instead, override {@link #mouseStop(Element, GqEvent)}
method.
"""
unbindOtherEvents();
if (started) {
started = false;
preventClickEvent = event.getCurrentEventTarget() == startEvent.getCurrentEventTarget();
mouseStop(element, event);
}
return true;
} | java | protected boolean mouseUp(Element element, GqEvent event) {
unbindOtherEvents();
if (started) {
started = false;
preventClickEvent = event.getCurrentEventTarget() == startEvent.getCurrentEventTarget();
mouseStop(element, event);
}
return true;
} | [
"protected",
"boolean",
"mouseUp",
"(",
"Element",
"element",
",",
"GqEvent",
"event",
")",
"{",
"unbindOtherEvents",
"(",
")",
";",
"if",
"(",
"started",
")",
"{",
"started",
"=",
"false",
";",
"preventClickEvent",
"=",
"event",
".",
"getCurrentEventTarget",
"(",
")",
"==",
"startEvent",
".",
"getCurrentEventTarget",
"(",
")",
";",
"mouseStop",
"(",
"element",
",",
"event",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Method called when mouse is released..
You should not override this method. Instead, override {@link #mouseStop(Element, GqEvent)}
method. | [
"Method",
"called",
"when",
"mouse",
"is",
"released",
".."
] | train | https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/MousePlugin.java#L204-L214 |
vdmeer/skb-java-base | src/main/java/de/vandermeer/skb/base/console/NonBlockingReader.java | NonBlockingReader.getNbReader | public static BufferedReader getNbReader(String logID, int tries, int timeout, HasPrompt emptyPrint) {
"""
Returns a new BufferedReader that uses tries and timeout for readline() for a UTF-8 StdIn.
@param logID a string for logging in case StdIn cannot be opened with UTF-8 encoding
@param tries number of tries for read calls, use one as default
@param timeout milliseconds for read timeout
@param emptyPrint a printout to realize on an empty readline string, for prompts, set null if not required
@return new reader with parameterized readline() method
"""
return NonBlockingReader.getNbReader(MessageConsole.getStdIn(logID), tries, timeout, emptyPrint);
} | java | public static BufferedReader getNbReader(String logID, int tries, int timeout, HasPrompt emptyPrint){
return NonBlockingReader.getNbReader(MessageConsole.getStdIn(logID), tries, timeout, emptyPrint);
} | [
"public",
"static",
"BufferedReader",
"getNbReader",
"(",
"String",
"logID",
",",
"int",
"tries",
",",
"int",
"timeout",
",",
"HasPrompt",
"emptyPrint",
")",
"{",
"return",
"NonBlockingReader",
".",
"getNbReader",
"(",
"MessageConsole",
".",
"getStdIn",
"(",
"logID",
")",
",",
"tries",
",",
"timeout",
",",
"emptyPrint",
")",
";",
"}"
] | Returns a new BufferedReader that uses tries and timeout for readline() for a UTF-8 StdIn.
@param logID a string for logging in case StdIn cannot be opened with UTF-8 encoding
@param tries number of tries for read calls, use one as default
@param timeout milliseconds for read timeout
@param emptyPrint a printout to realize on an empty readline string, for prompts, set null if not required
@return new reader with parameterized readline() method | [
"Returns",
"a",
"new",
"BufferedReader",
"that",
"uses",
"tries",
"and",
"timeout",
"for",
"readline",
"()",
"for",
"a",
"UTF",
"-",
"8",
"StdIn",
"."
] | train | https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/console/NonBlockingReader.java#L89-L91 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java | CommerceCountryPersistenceImpl.countByG_Tw | @Override
public int countByG_Tw(long groupId, String twoLettersISOCode) {
"""
Returns the number of commerce countries where groupId = ? and twoLettersISOCode = ?.
@param groupId the group ID
@param twoLettersISOCode the two letters iso code
@return the number of matching commerce countries
"""
FinderPath finderPath = FINDER_PATH_COUNT_BY_G_TW;
Object[] finderArgs = new Object[] { groupId, twoLettersISOCode };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_COMMERCECOUNTRY_WHERE);
query.append(_FINDER_COLUMN_G_TW_GROUPID_2);
boolean bindTwoLettersISOCode = false;
if (twoLettersISOCode == null) {
query.append(_FINDER_COLUMN_G_TW_TWOLETTERSISOCODE_1);
}
else if (twoLettersISOCode.equals("")) {
query.append(_FINDER_COLUMN_G_TW_TWOLETTERSISOCODE_3);
}
else {
bindTwoLettersISOCode = true;
query.append(_FINDER_COLUMN_G_TW_TWOLETTERSISOCODE_2);
}
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(groupId);
if (bindTwoLettersISOCode) {
qPos.add(twoLettersISOCode);
}
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | java | @Override
public int countByG_Tw(long groupId, String twoLettersISOCode) {
FinderPath finderPath = FINDER_PATH_COUNT_BY_G_TW;
Object[] finderArgs = new Object[] { groupId, twoLettersISOCode };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_COMMERCECOUNTRY_WHERE);
query.append(_FINDER_COLUMN_G_TW_GROUPID_2);
boolean bindTwoLettersISOCode = false;
if (twoLettersISOCode == null) {
query.append(_FINDER_COLUMN_G_TW_TWOLETTERSISOCODE_1);
}
else if (twoLettersISOCode.equals("")) {
query.append(_FINDER_COLUMN_G_TW_TWOLETTERSISOCODE_3);
}
else {
bindTwoLettersISOCode = true;
query.append(_FINDER_COLUMN_G_TW_TWOLETTERSISOCODE_2);
}
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(groupId);
if (bindTwoLettersISOCode) {
qPos.add(twoLettersISOCode);
}
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | [
"@",
"Override",
"public",
"int",
"countByG_Tw",
"(",
"long",
"groupId",
",",
"String",
"twoLettersISOCode",
")",
"{",
"FinderPath",
"finderPath",
"=",
"FINDER_PATH_COUNT_BY_G_TW",
";",
"Object",
"[",
"]",
"finderArgs",
"=",
"new",
"Object",
"[",
"]",
"{",
"groupId",
",",
"twoLettersISOCode",
"}",
";",
"Long",
"count",
"=",
"(",
"Long",
")",
"finderCache",
".",
"getResult",
"(",
"finderPath",
",",
"finderArgs",
",",
"this",
")",
";",
"if",
"(",
"count",
"==",
"null",
")",
"{",
"StringBundler",
"query",
"=",
"new",
"StringBundler",
"(",
"3",
")",
";",
"query",
".",
"append",
"(",
"_SQL_COUNT_COMMERCECOUNTRY_WHERE",
")",
";",
"query",
".",
"append",
"(",
"_FINDER_COLUMN_G_TW_GROUPID_2",
")",
";",
"boolean",
"bindTwoLettersISOCode",
"=",
"false",
";",
"if",
"(",
"twoLettersISOCode",
"==",
"null",
")",
"{",
"query",
".",
"append",
"(",
"_FINDER_COLUMN_G_TW_TWOLETTERSISOCODE_1",
")",
";",
"}",
"else",
"if",
"(",
"twoLettersISOCode",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"query",
".",
"append",
"(",
"_FINDER_COLUMN_G_TW_TWOLETTERSISOCODE_3",
")",
";",
"}",
"else",
"{",
"bindTwoLettersISOCode",
"=",
"true",
";",
"query",
".",
"append",
"(",
"_FINDER_COLUMN_G_TW_TWOLETTERSISOCODE_2",
")",
";",
"}",
"String",
"sql",
"=",
"query",
".",
"toString",
"(",
")",
";",
"Session",
"session",
"=",
"null",
";",
"try",
"{",
"session",
"=",
"openSession",
"(",
")",
";",
"Query",
"q",
"=",
"session",
".",
"createQuery",
"(",
"sql",
")",
";",
"QueryPos",
"qPos",
"=",
"QueryPos",
".",
"getInstance",
"(",
"q",
")",
";",
"qPos",
".",
"add",
"(",
"groupId",
")",
";",
"if",
"(",
"bindTwoLettersISOCode",
")",
"{",
"qPos",
".",
"add",
"(",
"twoLettersISOCode",
")",
";",
"}",
"count",
"=",
"(",
"Long",
")",
"q",
".",
"uniqueResult",
"(",
")",
";",
"finderCache",
".",
"putResult",
"(",
"finderPath",
",",
"finderArgs",
",",
"count",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"finderCache",
".",
"removeResult",
"(",
"finderPath",
",",
"finderArgs",
")",
";",
"throw",
"processException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"closeSession",
"(",
"session",
")",
";",
"}",
"}",
"return",
"count",
".",
"intValue",
"(",
")",
";",
"}"
] | Returns the number of commerce countries where groupId = ? and twoLettersISOCode = ?.
@param groupId the group ID
@param twoLettersISOCode the two letters iso code
@return the number of matching commerce countries | [
"Returns",
"the",
"number",
"of",
"commerce",
"countries",
"where",
"groupId",
"=",
"?",
";",
"and",
"twoLettersISOCode",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L2171-L2232 |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/FileServlet.java | FileServlet.findFile | public File findFile( String path ) throws IOException {
"""
Returns the file object for the given path, including welcome file lookup. If the file cannot be found, a
FileNotFoundException is returned.
@param path the path to look up.
@return the file object for that path.
@throws FileNotFoundException if the file could not be found.
@throws IOException if any other problem prevented the locating of the file.
"""
File base = new File(getBasePath());
File pathFile = new File(base, "."+path);
if( !pathFile.exists()) throw new FileNotFoundException("No file or directory at "+pathFile.getCanonicalPath());
if( pathFile.isFile()) return pathFile;
pathFile = new File(pathFile, "index.html");
if( !pathFile.exists() ) throw new FileNotFoundException("No welcome file at "+pathFile.getCanonicalPath());
return pathFile;
} | java | public File findFile( String path ) throws IOException {
File base = new File(getBasePath());
File pathFile = new File(base, "."+path);
if( !pathFile.exists()) throw new FileNotFoundException("No file or directory at "+pathFile.getCanonicalPath());
if( pathFile.isFile()) return pathFile;
pathFile = new File(pathFile, "index.html");
if( !pathFile.exists() ) throw new FileNotFoundException("No welcome file at "+pathFile.getCanonicalPath());
return pathFile;
} | [
"public",
"File",
"findFile",
"(",
"String",
"path",
")",
"throws",
"IOException",
"{",
"File",
"base",
"=",
"new",
"File",
"(",
"getBasePath",
"(",
")",
")",
";",
"File",
"pathFile",
"=",
"new",
"File",
"(",
"base",
",",
"\".\"",
"+",
"path",
")",
";",
"if",
"(",
"!",
"pathFile",
".",
"exists",
"(",
")",
")",
"throw",
"new",
"FileNotFoundException",
"(",
"\"No file or directory at \"",
"+",
"pathFile",
".",
"getCanonicalPath",
"(",
")",
")",
";",
"if",
"(",
"pathFile",
".",
"isFile",
"(",
")",
")",
"return",
"pathFile",
";",
"pathFile",
"=",
"new",
"File",
"(",
"pathFile",
",",
"\"index.html\"",
")",
";",
"if",
"(",
"!",
"pathFile",
".",
"exists",
"(",
")",
")",
"throw",
"new",
"FileNotFoundException",
"(",
"\"No welcome file at \"",
"+",
"pathFile",
".",
"getCanonicalPath",
"(",
")",
")",
";",
"return",
"pathFile",
";",
"}"
] | Returns the file object for the given path, including welcome file lookup. If the file cannot be found, a
FileNotFoundException is returned.
@param path the path to look up.
@return the file object for that path.
@throws FileNotFoundException if the file could not be found.
@throws IOException if any other problem prevented the locating of the file. | [
"Returns",
"the",
"file",
"object",
"for",
"the",
"given",
"path",
"including",
"welcome",
"file",
"lookup",
".",
"If",
"the",
"file",
"cannot",
"be",
"found",
"a",
"FileNotFoundException",
"is",
"returned",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/FileServlet.java#L106-L114 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.appendPadding | public StrBuilder appendPadding(final int length, final char padChar) {
"""
Appends the pad character to the builder the specified number of times.
@param length the length to append, negative means no append
@param padChar the character to append
@return this, to enable chaining
"""
if (length >= 0) {
ensureCapacity(size + length);
for (int i = 0; i < length; i++) {
buffer[size++] = padChar;
}
}
return this;
} | java | public StrBuilder appendPadding(final int length, final char padChar) {
if (length >= 0) {
ensureCapacity(size + length);
for (int i = 0; i < length; i++) {
buffer[size++] = padChar;
}
}
return this;
} | [
"public",
"StrBuilder",
"appendPadding",
"(",
"final",
"int",
"length",
",",
"final",
"char",
"padChar",
")",
"{",
"if",
"(",
"length",
">=",
"0",
")",
"{",
"ensureCapacity",
"(",
"size",
"+",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"buffer",
"[",
"size",
"++",
"]",
"=",
"padChar",
";",
"}",
"}",
"return",
"this",
";",
"}"
] | Appends the pad character to the builder the specified number of times.
@param length the length to append, negative means no append
@param padChar the character to append
@return this, to enable chaining | [
"Appends",
"the",
"pad",
"character",
"to",
"the",
"builder",
"the",
"specified",
"number",
"of",
"times",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1480-L1488 |
spotify/helios | helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java | ZooKeeperMasterModel.rollingUpdateUndeploy | private RollingUpdateOp rollingUpdateUndeploy(final ZooKeeperClient client,
final RollingUpdateOpFactory opFactory,
final DeploymentGroup deploymentGroup,
final String host) {
"""
rollingUpdateUndeploy is used to undeploy jobs during a rolling update. It enables the
'skipRedundantUndeploys' flag, which enables the redundantDeployment() check.
"""
return rollingUpdateUndeploy(client, opFactory, deploymentGroup, host, true);
} | java | private RollingUpdateOp rollingUpdateUndeploy(final ZooKeeperClient client,
final RollingUpdateOpFactory opFactory,
final DeploymentGroup deploymentGroup,
final String host) {
return rollingUpdateUndeploy(client, opFactory, deploymentGroup, host, true);
} | [
"private",
"RollingUpdateOp",
"rollingUpdateUndeploy",
"(",
"final",
"ZooKeeperClient",
"client",
",",
"final",
"RollingUpdateOpFactory",
"opFactory",
",",
"final",
"DeploymentGroup",
"deploymentGroup",
",",
"final",
"String",
"host",
")",
"{",
"return",
"rollingUpdateUndeploy",
"(",
"client",
",",
"opFactory",
",",
"deploymentGroup",
",",
"host",
",",
"true",
")",
";",
"}"
] | rollingUpdateUndeploy is used to undeploy jobs during a rolling update. It enables the
'skipRedundantUndeploys' flag, which enables the redundantDeployment() check. | [
"rollingUpdateUndeploy",
"is",
"used",
"to",
"undeploy",
"jobs",
"during",
"a",
"rolling",
"update",
".",
"It",
"enables",
"the",
"skipRedundantUndeploys",
"flag",
"which",
"enables",
"the",
"redundantDeployment",
"()",
"check",
"."
] | train | https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L1077-L1082 |
phax/ph-oton | ph-oton-jscode/src/main/java/com/helger/html/jscode/AbstractJSBlock.java | AbstractJSBlock._if | @Nonnull
public JSConditional _if (@Nonnull final IJSExpression aTest, @Nullable final IHasJSCode aThen) {
"""
Create an If statement and add it to this block
@param aTest
{@link IJSExpression} to be tested to determine branching
@param aThen
"then" block content. May be <code>null</code>.
@return Newly generated conditional statement
"""
return addStatement (new JSConditional (aTest, aThen));
} | java | @Nonnull
public JSConditional _if (@Nonnull final IJSExpression aTest, @Nullable final IHasJSCode aThen)
{
return addStatement (new JSConditional (aTest, aThen));
} | [
"@",
"Nonnull",
"public",
"JSConditional",
"_if",
"(",
"@",
"Nonnull",
"final",
"IJSExpression",
"aTest",
",",
"@",
"Nullable",
"final",
"IHasJSCode",
"aThen",
")",
"{",
"return",
"addStatement",
"(",
"new",
"JSConditional",
"(",
"aTest",
",",
"aThen",
")",
")",
";",
"}"
] | Create an If statement and add it to this block
@param aTest
{@link IJSExpression} to be tested to determine branching
@param aThen
"then" block content. May be <code>null</code>.
@return Newly generated conditional statement | [
"Create",
"an",
"If",
"statement",
"and",
"add",
"it",
"to",
"this",
"block"
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-jscode/src/main/java/com/helger/html/jscode/AbstractJSBlock.java#L999-L1003 |
f2prateek/rx-preferences | rx-preferences/src/main/java/com/f2prateek/rx/preferences2/RxSharedPreferences.java | RxSharedPreferences.getBoolean | @CheckResult @NonNull
public Preference<Boolean> getBoolean(@NonNull String key) {
"""
Create a boolean preference for {@code key}. Default is {@code false}.
"""
return getBoolean(key, DEFAULT_BOOLEAN);
} | java | @CheckResult @NonNull
public Preference<Boolean> getBoolean(@NonNull String key) {
return getBoolean(key, DEFAULT_BOOLEAN);
} | [
"@",
"CheckResult",
"@",
"NonNull",
"public",
"Preference",
"<",
"Boolean",
">",
"getBoolean",
"(",
"@",
"NonNull",
"String",
"key",
")",
"{",
"return",
"getBoolean",
"(",
"key",
",",
"DEFAULT_BOOLEAN",
")",
";",
"}"
] | Create a boolean preference for {@code key}. Default is {@code false}. | [
"Create",
"a",
"boolean",
"preference",
"for",
"{"
] | train | https://github.com/f2prateek/rx-preferences/blob/e338b4e6cee9c0c7b850be86ab41ed7b39a3637e/rx-preferences/src/main/java/com/f2prateek/rx/preferences2/RxSharedPreferences.java#L62-L65 |
aws/aws-sdk-java | aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java | AmazonS3Client.setObjectAcl | public void setObjectAcl(String bucketName, String key, String versionId,
AccessControlList acl, RequestMetricCollector requestMetricCollector)
throws SdkClientException, AmazonServiceException {
"""
Same as {@link #setObjectAcl(String, String, String, AccessControlList)}
but allows specifying a request metric collector.
"""
setObjectAcl(new SetObjectAclRequest(bucketName, key, versionId, acl)
.<SetObjectAclRequest> withRequestMetricCollector(requestMetricCollector));
} | java | public void setObjectAcl(String bucketName, String key, String versionId,
AccessControlList acl, RequestMetricCollector requestMetricCollector)
throws SdkClientException, AmazonServiceException {
setObjectAcl(new SetObjectAclRequest(bucketName, key, versionId, acl)
.<SetObjectAclRequest> withRequestMetricCollector(requestMetricCollector));
} | [
"public",
"void",
"setObjectAcl",
"(",
"String",
"bucketName",
",",
"String",
"key",
",",
"String",
"versionId",
",",
"AccessControlList",
"acl",
",",
"RequestMetricCollector",
"requestMetricCollector",
")",
"throws",
"SdkClientException",
",",
"AmazonServiceException",
"{",
"setObjectAcl",
"(",
"new",
"SetObjectAclRequest",
"(",
"bucketName",
",",
"key",
",",
"versionId",
",",
"acl",
")",
".",
"<",
"SetObjectAclRequest",
">",
"withRequestMetricCollector",
"(",
"requestMetricCollector",
")",
")",
";",
"}"
] | Same as {@link #setObjectAcl(String, String, String, AccessControlList)}
but allows specifying a request metric collector. | [
"Same",
"as",
"{"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java#L1147-L1152 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_instance_instanceId_PUT | public void project_serviceName_instance_instanceId_PUT(String serviceName, String instanceId, String instanceName) throws IOException {
"""
Alter an instance
REST: PUT /cloud/project/{serviceName}/instance/{instanceId}
@param instanceId [required] Instance id
@param instanceName [required] Instance new name
@param serviceName [required] Service name
"""
String qPath = "/cloud/project/{serviceName}/instance/{instanceId}";
StringBuilder sb = path(qPath, serviceName, instanceId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "instanceName", instanceName);
exec(qPath, "PUT", sb.toString(), o);
} | java | public void project_serviceName_instance_instanceId_PUT(String serviceName, String instanceId, String instanceName) throws IOException {
String qPath = "/cloud/project/{serviceName}/instance/{instanceId}";
StringBuilder sb = path(qPath, serviceName, instanceId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "instanceName", instanceName);
exec(qPath, "PUT", sb.toString(), o);
} | [
"public",
"void",
"project_serviceName_instance_instanceId_PUT",
"(",
"String",
"serviceName",
",",
"String",
"instanceId",
",",
"String",
"instanceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/instance/{instanceId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"instanceId",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"instanceName\"",
",",
"instanceName",
")",
";",
"exec",
"(",
"qPath",
",",
"\"PUT\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"}"
] | Alter an instance
REST: PUT /cloud/project/{serviceName}/instance/{instanceId}
@param instanceId [required] Instance id
@param instanceName [required] Instance new name
@param serviceName [required] Service name | [
"Alter",
"an",
"instance"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1863-L1869 |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/LombokPropertyDescriptor.java | LombokPropertyDescriptor.hasLombokPublicAccessor | private boolean hasLombokPublicAccessor(MetadataGenerationEnvironment env,
boolean getter) {
"""
Determine if the current {@link #getField() field} defines a public accessor using
lombok annotations.
@param env the {@link MetadataGenerationEnvironment}
@param getter {@code true} to look for the read accessor, {@code false} for the
write accessor
@return {@code true} if this field has a public accessor of the specified type
"""
String annotation = (getter ? LOMBOK_GETTER_ANNOTATION
: LOMBOK_SETTER_ANNOTATION);
AnnotationMirror lombokMethodAnnotationOnField = env.getAnnotation(getField(),
annotation);
if (lombokMethodAnnotationOnField != null) {
return isAccessLevelPublic(env, lombokMethodAnnotationOnField);
}
AnnotationMirror lombokMethodAnnotationOnElement = env
.getAnnotation(getOwnerElement(), annotation);
if (lombokMethodAnnotationOnElement != null) {
return isAccessLevelPublic(env, lombokMethodAnnotationOnElement);
}
return (env.getAnnotation(getOwnerElement(), LOMBOK_DATA_ANNOTATION) != null);
} | java | private boolean hasLombokPublicAccessor(MetadataGenerationEnvironment env,
boolean getter) {
String annotation = (getter ? LOMBOK_GETTER_ANNOTATION
: LOMBOK_SETTER_ANNOTATION);
AnnotationMirror lombokMethodAnnotationOnField = env.getAnnotation(getField(),
annotation);
if (lombokMethodAnnotationOnField != null) {
return isAccessLevelPublic(env, lombokMethodAnnotationOnField);
}
AnnotationMirror lombokMethodAnnotationOnElement = env
.getAnnotation(getOwnerElement(), annotation);
if (lombokMethodAnnotationOnElement != null) {
return isAccessLevelPublic(env, lombokMethodAnnotationOnElement);
}
return (env.getAnnotation(getOwnerElement(), LOMBOK_DATA_ANNOTATION) != null);
} | [
"private",
"boolean",
"hasLombokPublicAccessor",
"(",
"MetadataGenerationEnvironment",
"env",
",",
"boolean",
"getter",
")",
"{",
"String",
"annotation",
"=",
"(",
"getter",
"?",
"LOMBOK_GETTER_ANNOTATION",
":",
"LOMBOK_SETTER_ANNOTATION",
")",
";",
"AnnotationMirror",
"lombokMethodAnnotationOnField",
"=",
"env",
".",
"getAnnotation",
"(",
"getField",
"(",
")",
",",
"annotation",
")",
";",
"if",
"(",
"lombokMethodAnnotationOnField",
"!=",
"null",
")",
"{",
"return",
"isAccessLevelPublic",
"(",
"env",
",",
"lombokMethodAnnotationOnField",
")",
";",
"}",
"AnnotationMirror",
"lombokMethodAnnotationOnElement",
"=",
"env",
".",
"getAnnotation",
"(",
"getOwnerElement",
"(",
")",
",",
"annotation",
")",
";",
"if",
"(",
"lombokMethodAnnotationOnElement",
"!=",
"null",
")",
"{",
"return",
"isAccessLevelPublic",
"(",
"env",
",",
"lombokMethodAnnotationOnElement",
")",
";",
"}",
"return",
"(",
"env",
".",
"getAnnotation",
"(",
"getOwnerElement",
"(",
")",
",",
"LOMBOK_DATA_ANNOTATION",
")",
"!=",
"null",
")",
";",
"}"
] | Determine if the current {@link #getField() field} defines a public accessor using
lombok annotations.
@param env the {@link MetadataGenerationEnvironment}
@param getter {@code true} to look for the read accessor, {@code false} for the
write accessor
@return {@code true} if this field has a public accessor of the specified type | [
"Determine",
"if",
"the",
"current",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/LombokPropertyDescriptor.java#L96-L111 |
UrielCh/ovh-java-sdk | ovh-java-sdk-connectivity/src/main/java/net/minidev/ovh/api/ApiOvhConnectivity.java | ApiOvhConnectivity.eligibility_search_lines_POST | public OvhAsyncTaskArray<OvhLine> eligibility_search_lines_POST(String ownerName, String streetCode, String streetNumber) throws IOException {
"""
Search for active and inactive lines at an address. It will search for active lines only if the owner name is specified
REST: POST /connectivity/eligibility/search/lines
@param ownerName [required] Owner name, at least the first three chars
@param streetNumber [required] Street number, that can be found using /connectivity/eligibility/search/streetNumbers method
@param streetCode [required] Street code, that can be found using /connectivity/eligibility/search/streets method
"""
String qPath = "/connectivity/eligibility/search/lines";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ownerName", ownerName);
addBody(o, "streetCode", streetCode);
addBody(o, "streetNumber", streetNumber);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, t2);
} | java | public OvhAsyncTaskArray<OvhLine> eligibility_search_lines_POST(String ownerName, String streetCode, String streetNumber) throws IOException {
String qPath = "/connectivity/eligibility/search/lines";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ownerName", ownerName);
addBody(o, "streetCode", streetCode);
addBody(o, "streetNumber", streetNumber);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, t2);
} | [
"public",
"OvhAsyncTaskArray",
"<",
"OvhLine",
">",
"eligibility_search_lines_POST",
"(",
"String",
"ownerName",
",",
"String",
"streetCode",
",",
"String",
"streetNumber",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/connectivity/eligibility/search/lines\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"ownerName\"",
",",
"ownerName",
")",
";",
"addBody",
"(",
"o",
",",
"\"streetCode\"",
",",
"streetCode",
")",
";",
"addBody",
"(",
"o",
",",
"\"streetNumber\"",
",",
"streetNumber",
")",
";",
"String",
"resp",
"=",
"execN",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t2",
")",
";",
"}"
] | Search for active and inactive lines at an address. It will search for active lines only if the owner name is specified
REST: POST /connectivity/eligibility/search/lines
@param ownerName [required] Owner name, at least the first three chars
@param streetNumber [required] Street number, that can be found using /connectivity/eligibility/search/streetNumbers method
@param streetCode [required] Street code, that can be found using /connectivity/eligibility/search/streets method | [
"Search",
"for",
"active",
"and",
"inactive",
"lines",
"at",
"an",
"address",
".",
"It",
"will",
"search",
"for",
"active",
"lines",
"only",
"if",
"the",
"owner",
"name",
"is",
"specified"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-connectivity/src/main/java/net/minidev/ovh/api/ApiOvhConnectivity.java#L54-L63 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/jmx/JMX.java | JMX.registerMemoryNotifications | public void registerMemoryNotifications(NotificationListener notificationListener, Object handback) {
"""
Allows a listener to be registered within the MemoryMXBean as a notification listener
usage threshold exceeded notification - for notifying that the memory usage of a memory pool is increased
and has reached or exceeded its usage threshold value.
collection usage threshold exceeded notification - for notifying that the memory usage
of a memory pool is greater than or equal to its collection usage threshold
after the Java virtual machine has expended effort in recycling unused objects in that memory pool.
The notification emitted is a Notification instance whose user data is set to a CompositeData that
represents a MemoryNotificationInfo object containing information about the memory pool when the
notification was constructed. The CompositeData contains the attributes as described in MemoryNotificationInfo.
@param notificationListener listener to be alerted
@param handback object to be passed back to notification listener when notification occurs
"""
NotificationEmitter emitter = (NotificationEmitter) this.getMemory();
emitter.addNotificationListener(notificationListener, null, handback);
} | java | public void registerMemoryNotifications(NotificationListener notificationListener, Object handback)
{
NotificationEmitter emitter = (NotificationEmitter) this.getMemory();
emitter.addNotificationListener(notificationListener, null, handback);
} | [
"public",
"void",
"registerMemoryNotifications",
"(",
"NotificationListener",
"notificationListener",
",",
"Object",
"handback",
")",
"{",
"NotificationEmitter",
"emitter",
"=",
"(",
"NotificationEmitter",
")",
"this",
".",
"getMemory",
"(",
")",
";",
"emitter",
".",
"addNotificationListener",
"(",
"notificationListener",
",",
"null",
",",
"handback",
")",
";",
"}"
] | Allows a listener to be registered within the MemoryMXBean as a notification listener
usage threshold exceeded notification - for notifying that the memory usage of a memory pool is increased
and has reached or exceeded its usage threshold value.
collection usage threshold exceeded notification - for notifying that the memory usage
of a memory pool is greater than or equal to its collection usage threshold
after the Java virtual machine has expended effort in recycling unused objects in that memory pool.
The notification emitted is a Notification instance whose user data is set to a CompositeData that
represents a MemoryNotificationInfo object containing information about the memory pool when the
notification was constructed. The CompositeData contains the attributes as described in MemoryNotificationInfo.
@param notificationListener listener to be alerted
@param handback object to be passed back to notification listener when notification occurs | [
"Allows",
"a",
"listener",
"to",
"be",
"registered",
"within",
"the",
"MemoryMXBean",
"as",
"a",
"notification",
"listener",
"usage",
"threshold",
"exceeded",
"notification",
"-",
"for",
"notifying",
"that",
"the",
"memory",
"usage",
"of",
"a",
"memory",
"pool",
"is",
"increased",
"and",
"has",
"reached",
"or",
"exceeded",
"its",
"usage",
"threshold",
"value",
"."
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/jmx/JMX.java#L530-L535 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getRecipeInfo | public void getRecipeInfo(int[] ids, Callback<List<Recipe>> callback) throws GuildWars2Exception, NullPointerException {
"""
For more info on Recipes API go <a href="https://wiki.guildwars2.com/wiki/API:2/recipes">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of recipe id
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception empty ID list
@throws NullPointerException if given {@link Callback} is empty
@see Recipe recipe info
"""
isParamValid(new ParamChecker(ids));
gw2API.getRecipeInfo(processIds(ids)).enqueue(callback);
} | java | public void getRecipeInfo(int[] ids, Callback<List<Recipe>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getRecipeInfo(processIds(ids)).enqueue(callback);
} | [
"public",
"void",
"getRecipeInfo",
"(",
"int",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"Recipe",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"ids",
")",
")",
";",
"gw2API",
".",
"getRecipeInfo",
"(",
"processIds",
"(",
"ids",
")",
")",
".",
"enqueue",
"(",
"callback",
")",
";",
"}"
] | For more info on Recipes API go <a href="https://wiki.guildwars2.com/wiki/API:2/recipes">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of recipe id
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception empty ID list
@throws NullPointerException if given {@link Callback} is empty
@see Recipe recipe info | [
"For",
"more",
"info",
"on",
"Recipes",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"recipes",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"user",
"the",
"access",
"to",
"{",
"@link",
"Callback#onResponse",
"(",
"Call",
"Response",
")",
"}",
"and",
"{",
"@link",
"Callback#onFailure",
"(",
"Call",
"Throwable",
")",
"}",
"methods",
"for",
"custom",
"interactions"
] | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2306-L2309 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.