repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.readLines | public static List<String> readLines(String path, String charset) throws IORuntimeException {
return readLines(path, charset, new ArrayList<String>());
} | java | public static List<String> readLines(String path, String charset) throws IORuntimeException {
return readLines(path, charset, new ArrayList<String>());
} | [
"public",
"static",
"List",
"<",
"String",
">",
"readLines",
"(",
"String",
"path",
",",
"String",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"return",
"readLines",
"(",
"path",
",",
"charset",
",",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")... | 从文件中读取每一行数据
@param path 文件路径
@param charset 字符集
@return 文件中的每行内容的集合List
@throws IORuntimeException IO异常 | [
"从文件中读取每一行数据"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2343-L2345 |
astrapi69/jaulp-wicket | jaulp-wicket-dropdownchoices/src/main/java/de/alpharogroup/wicket/components/i18n/dropdownchoice/panels/DropdownAutocompleteTextFieldPanel.java | DropdownAutocompleteTextFieldPanel.newRootLabel | protected Label newRootLabel(final String forId, final IModel<String> model) {
return ComponentFactory.newLabel("rootLabel", forId, model);
} | java | protected Label newRootLabel(final String forId, final IModel<String> model) {
return ComponentFactory.newLabel("rootLabel", forId, model);
} | [
"protected",
"Label",
"newRootLabel",
"(",
"final",
"String",
"forId",
",",
"final",
"IModel",
"<",
"String",
">",
"model",
")",
"{",
"return",
"ComponentFactory",
".",
"newLabel",
"(",
"\"rootLabel\"",
",",
"forId",
",",
"model",
")",
";",
"}"
] | Factory method for creating the root Label. This method is invoked in the
constructor from the derived classes and can be overridden so users can
provide their own version of a Label.
@param forId
the for id
@param model
the model
@return the label | [
"Factory",
"method",
"for",
"creating",
"the",
"root",
"Label",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"provide",
"their",
"own",
"versi... | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-dropdownchoices/src/main/java/de/alpharogroup/wicket/components/i18n/dropdownchoice/panels/DropdownAutocompleteTextFieldPanel.java#L237-L239 |
biojava/biojava | biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericInsdcHeaderFormat.java | GenericInsdcHeaderFormat._write_feature | protected String _write_feature(FeatureInterface<AbstractSequence<C>, C> feature, int record_length) {
String location = _insdc_feature_location_string(feature, record_length);
String f_type = feature.getType().replace(" ", "_");
StringBuilder sb = new StringBuilder();
Formatter formatter = new Formatter(sb,Locale.US);
formatter.format(QUALIFIER_INDENT_TMP, f_type);
String line = formatter.toString().substring(0, QUALIFIER_INDENT) + _wrap_location(location) + lineSep;
formatter.close();
//Now the qualifiers...
for(List<Qualifier> qualifiers : feature.getQualifiers().values()) {
for(Qualifier q : qualifiers){
line += _write_feature_qualifier(q.getName(), q.getValue(), q.needsQuotes());
}
}
return line;
/*
self.handle.write(line)
#Now the qualifiers...
for key, values in feature.qualifiers.items():
if isinstance(values, list) or isinstance(values, tuple):
for value in values:
self._write_feature_qualifier(key, value)
elif values:
#String, int, etc
self._write_feature_qualifier(key, values)
else:
#e.g. a /psuedo entry
self._write_feature_qualifier(key)
*/
} | java | protected String _write_feature(FeatureInterface<AbstractSequence<C>, C> feature, int record_length) {
String location = _insdc_feature_location_string(feature, record_length);
String f_type = feature.getType().replace(" ", "_");
StringBuilder sb = new StringBuilder();
Formatter formatter = new Formatter(sb,Locale.US);
formatter.format(QUALIFIER_INDENT_TMP, f_type);
String line = formatter.toString().substring(0, QUALIFIER_INDENT) + _wrap_location(location) + lineSep;
formatter.close();
//Now the qualifiers...
for(List<Qualifier> qualifiers : feature.getQualifiers().values()) {
for(Qualifier q : qualifiers){
line += _write_feature_qualifier(q.getName(), q.getValue(), q.needsQuotes());
}
}
return line;
/*
self.handle.write(line)
#Now the qualifiers...
for key, values in feature.qualifiers.items():
if isinstance(values, list) or isinstance(values, tuple):
for value in values:
self._write_feature_qualifier(key, value)
elif values:
#String, int, etc
self._write_feature_qualifier(key, values)
else:
#e.g. a /psuedo entry
self._write_feature_qualifier(key)
*/
} | [
"protected",
"String",
"_write_feature",
"(",
"FeatureInterface",
"<",
"AbstractSequence",
"<",
"C",
">",
",",
"C",
">",
"feature",
",",
"int",
"record_length",
")",
"{",
"String",
"location",
"=",
"_insdc_feature_location_string",
"(",
"feature",
",",
"record_len... | Write a single SeqFeature object to features table.
@param feature
@param record_length | [
"Write",
"a",
"single",
"SeqFeature",
"object",
"to",
"features",
"table",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericInsdcHeaderFormat.java#L116-L146 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2017_03_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_03_01/implementation/RegistriesInner.java | RegistriesInner.updateAsync | public Observable<RegistryInner> updateAsync(String resourceGroupName, String registryName, RegistryUpdateParameters registryUpdateParameters) {
return updateWithServiceResponseAsync(resourceGroupName, registryName, registryUpdateParameters).map(new Func1<ServiceResponse<RegistryInner>, RegistryInner>() {
@Override
public RegistryInner call(ServiceResponse<RegistryInner> response) {
return response.body();
}
});
} | java | public Observable<RegistryInner> updateAsync(String resourceGroupName, String registryName, RegistryUpdateParameters registryUpdateParameters) {
return updateWithServiceResponseAsync(resourceGroupName, registryName, registryUpdateParameters).map(new Func1<ServiceResponse<RegistryInner>, RegistryInner>() {
@Override
public RegistryInner call(ServiceResponse<RegistryInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RegistryInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"RegistryUpdateParameters",
"registryUpdateParameters",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Updates a container registry with the specified parameters.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param registryUpdateParameters The parameters for updating a container registry.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RegistryInner object | [
"Updates",
"a",
"container",
"registry",
"with",
"the",
"specified",
"parameters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_03_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_03_01/implementation/RegistriesInner.java#L587-L594 |
knowm/XChange | xchange-dsx/src/main/java/org/knowm/xchange/dsx/service/core/DSXMarketDataServiceRawCore.java | DSXMarketDataServiceRawCore.getDSXOrderbook | public DSXOrderbookWrapper getDSXOrderbook(String pairs, String type) throws IOException {
return dsx.getOrderbook(pairs.toLowerCase(), 1, type);
} | java | public DSXOrderbookWrapper getDSXOrderbook(String pairs, String type) throws IOException {
return dsx.getOrderbook(pairs.toLowerCase(), 1, type);
} | [
"public",
"DSXOrderbookWrapper",
"getDSXOrderbook",
"(",
"String",
"pairs",
",",
"String",
"type",
")",
"throws",
"IOException",
"{",
"return",
"dsx",
".",
"getOrderbook",
"(",
"pairs",
".",
"toLowerCase",
"(",
")",
",",
"1",
",",
"type",
")",
";",
"}"
] | Get market depth from exchange
@param pairs String of currency pairs to retrieve (e.g. "btcusd-btceur")
@return DSXOrderbookWrapper object
@throws IOException | [
"Get",
"market",
"depth",
"from",
"exchange"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-dsx/src/main/java/org/knowm/xchange/dsx/service/core/DSXMarketDataServiceRawCore.java#L45-L48 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/ThreadContext.java | ThreadContext.setOutboundConnectionInfoInternal | public void setOutboundConnectionInfoInternal(Map<String, Object> connectionInfo) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "setOutboundConnectionInfoInternal :" + connectionInfo);
this.outboundConnectionInfoInternal = connectionInfo;
} | java | public void setOutboundConnectionInfoInternal(Map<String, Object> connectionInfo) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "setOutboundConnectionInfoInternal :" + connectionInfo);
this.outboundConnectionInfoInternal = connectionInfo;
} | [
"public",
"void",
"setOutboundConnectionInfoInternal",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"connectionInfo",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
... | Set the internal outbound connection info object for this context.
@param connectionInfo | [
"Set",
"the",
"internal",
"outbound",
"connection",
"info",
"object",
"for",
"this",
"context",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/ThreadContext.java#L224-L228 |
knowm/XChange | xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseAccountServiceRaw.java | CoinbaseAccountServiceRaw.getCoinbasePaymentMethods | public List<CoinbasePaymentMethod> getCoinbasePaymentMethods() throws IOException {
String apiKey = exchange.getExchangeSpecification().getApiKey();
BigDecimal timestamp = coinbase.getTime(Coinbase.CB_VERSION_VALUE).getData().getEpoch();
return coinbase
.getPaymentMethods(Coinbase.CB_VERSION_VALUE, apiKey, signatureCreator2, timestamp)
.getData();
} | java | public List<CoinbasePaymentMethod> getCoinbasePaymentMethods() throws IOException {
String apiKey = exchange.getExchangeSpecification().getApiKey();
BigDecimal timestamp = coinbase.getTime(Coinbase.CB_VERSION_VALUE).getData().getEpoch();
return coinbase
.getPaymentMethods(Coinbase.CB_VERSION_VALUE, apiKey, signatureCreator2, timestamp)
.getData();
} | [
"public",
"List",
"<",
"CoinbasePaymentMethod",
">",
"getCoinbasePaymentMethods",
"(",
")",
"throws",
"IOException",
"{",
"String",
"apiKey",
"=",
"exchange",
".",
"getExchangeSpecification",
"(",
")",
".",
"getApiKey",
"(",
")",
";",
"BigDecimal",
"timestamp",
"=... | Authenticated resource that shows the current user payment methods.
@see <a
href="https://developers.coinbase.com/api/v2#list-payment-methods">developers.coinbase.com/api/v2?shell#list-payment-methods</a> | [
"Authenticated",
"resource",
"that",
"shows",
"the",
"current",
"user",
"payment",
"methods",
"."
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseAccountServiceRaw.java#L115-L122 |
johnkil/Android-ProgressFragment | sherlockprogressfragment/src/com/devspark/progressfragment/SherlockProgressListFragment.java | SherlockProgressListFragment.setListShown | private void setListShown(boolean shown, boolean animate) {
ensureList();
if (mProgressContainer == null) {
throw new IllegalStateException("Can't be used with a custom content view");
}
if (mListShown == shown) {
return;
}
mListShown = shown;
if (shown) {
if (animate) {
mProgressContainer.startAnimation(AnimationUtils.loadAnimation(
getActivity(), android.R.anim.fade_out));
mListContainer.startAnimation(AnimationUtils.loadAnimation(
getActivity(), android.R.anim.fade_in));
} else {
mProgressContainer.clearAnimation();
mListContainer.clearAnimation();
}
mProgressContainer.setVisibility(View.GONE);
mListContainer.setVisibility(View.VISIBLE);
} else {
if (animate) {
mProgressContainer.startAnimation(AnimationUtils.loadAnimation(
getActivity(), android.R.anim.fade_in));
mListContainer.startAnimation(AnimationUtils.loadAnimation(
getActivity(), android.R.anim.fade_out));
} else {
mProgressContainer.clearAnimation();
mListContainer.clearAnimation();
}
mProgressContainer.setVisibility(View.VISIBLE);
mListContainer.setVisibility(View.GONE);
}
} | java | private void setListShown(boolean shown, boolean animate) {
ensureList();
if (mProgressContainer == null) {
throw new IllegalStateException("Can't be used with a custom content view");
}
if (mListShown == shown) {
return;
}
mListShown = shown;
if (shown) {
if (animate) {
mProgressContainer.startAnimation(AnimationUtils.loadAnimation(
getActivity(), android.R.anim.fade_out));
mListContainer.startAnimation(AnimationUtils.loadAnimation(
getActivity(), android.R.anim.fade_in));
} else {
mProgressContainer.clearAnimation();
mListContainer.clearAnimation();
}
mProgressContainer.setVisibility(View.GONE);
mListContainer.setVisibility(View.VISIBLE);
} else {
if (animate) {
mProgressContainer.startAnimation(AnimationUtils.loadAnimation(
getActivity(), android.R.anim.fade_in));
mListContainer.startAnimation(AnimationUtils.loadAnimation(
getActivity(), android.R.anim.fade_out));
} else {
mProgressContainer.clearAnimation();
mListContainer.clearAnimation();
}
mProgressContainer.setVisibility(View.VISIBLE);
mListContainer.setVisibility(View.GONE);
}
} | [
"private",
"void",
"setListShown",
"(",
"boolean",
"shown",
",",
"boolean",
"animate",
")",
"{",
"ensureList",
"(",
")",
";",
"if",
"(",
"mProgressContainer",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Can't be used with a custom cont... | Control whether the list is being displayed. You can make it not
displayed if you are waiting for the initial data to show in it. During
this time an indeterminant progress indicator will be shown instead.
@param shown If true, the list view is shown; if false, the progress
indicator. The initial value is true.
@param animate If true, an animation will be used to transition to the
new state. | [
"Control",
"whether",
"the",
"list",
"is",
"being",
"displayed",
".",
"You",
"can",
"make",
"it",
"not",
"displayed",
"if",
"you",
"are",
"waiting",
"for",
"the",
"initial",
"data",
"to",
"show",
"in",
"it",
".",
"During",
"this",
"time",
"an",
"indeterm... | train | https://github.com/johnkil/Android-ProgressFragment/blob/f4b3b969f36f3ac9598c662722630f9ffb151bd6/sherlockprogressfragment/src/com/devspark/progressfragment/SherlockProgressListFragment.java#L223-L257 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/processor/PdfConfigurationProcessor.java | PdfConfigurationProcessor.setUpdates | public void setUpdates(final Map<String, Object> updates) {
Map<String, Update> finalUpdatesMap = new HashMap<>();
for (Map.Entry<String, Object> entry: updates.entrySet()) {
String property = entry.getKey();
Update update;
if (entry.getValue() instanceof Update) {
update = (Update) entry.getValue();
update.property = property;
} else if (entry.getValue() instanceof String) {
String value = (String) entry.getValue();
update = new Update();
update.property = property;
update.setValueKey(value);
} else {
throw new IllegalArgumentException(
"Update property " + property + " has a non-string and non-!updatePdfConfigUpdate " +
"value: " + entry.getValue() + "(" + entry.getValue().getClass() + ")");
}
finalUpdatesMap.put(property, update);
}
this.updates = finalUpdatesMap;
} | java | public void setUpdates(final Map<String, Object> updates) {
Map<String, Update> finalUpdatesMap = new HashMap<>();
for (Map.Entry<String, Object> entry: updates.entrySet()) {
String property = entry.getKey();
Update update;
if (entry.getValue() instanceof Update) {
update = (Update) entry.getValue();
update.property = property;
} else if (entry.getValue() instanceof String) {
String value = (String) entry.getValue();
update = new Update();
update.property = property;
update.setValueKey(value);
} else {
throw new IllegalArgumentException(
"Update property " + property + " has a non-string and non-!updatePdfConfigUpdate " +
"value: " + entry.getValue() + "(" + entry.getValue().getClass() + ")");
}
finalUpdatesMap.put(property, update);
}
this.updates = finalUpdatesMap;
} | [
"public",
"void",
"setUpdates",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"updates",
")",
"{",
"Map",
"<",
"String",
",",
"Update",
">",
"finalUpdatesMap",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<"... | The pdf metadata property -> attribute name map. The keys must be one of the values in {@link
org.mapfish.print.config.PDFConfig} and the values must be the name of the attribute to obtain the the
data from. Example Configuration:
<p></p>
<pre><code>
processors:
- !updatePdfConfig
updates:
title: "titleAttribute"
subject: "subjectAttribute"
</code></pre>
<p></p>
The type of the attribute must be of the correct type, for example title mus be a string, keywords must
be an array of strings, compress must be a boolean.
<p></p>
If the value is within the attribute output object then you can use dot separators for each level. For
example suppose there is a custom attribute: myconfig, if and it has a property title then the
configuration would be:
<pre><code>
processors:
- updatePdfConfig
updates: {title: :myconfig.title"}
</code></pre>
<p></p>
For more power a "format" can be defined. The format is a printf style format string which will be
called with a single value that is identified by the value key/path. In this case the short hand key:
value can't be used instead it is as follows:
<pre><code>
- updatePdfConfig
updates:
title: !updatePdfConfigUpdate
valueKey: "myconfig.title"
format: "Print Report %s"
</code></pre>
@param updates the attribute map | [
"The",
"pdf",
"metadata",
"property",
"-",
">",
";",
"attribute",
"name",
"map",
".",
"The",
"keys",
"must",
"be",
"one",
"of",
"the",
"values",
"in",
"{",
"@link",
"org",
".",
"mapfish",
".",
"print",
".",
"config",
".",
"PDFConfig",
"}",
"and",
"... | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/PdfConfigurationProcessor.java#L82-L104 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/stats/Counters.java | Counters.toComparatorDescending | public static <E> Comparator<E> toComparatorDescending(final Counter<E> counter) {
return new Comparator<E>() {
public int compare(E o1, E o2) {
return Double.compare(counter.getCount(o2), counter.getCount(o1));
}
};
} | java | public static <E> Comparator<E> toComparatorDescending(final Counter<E> counter) {
return new Comparator<E>() {
public int compare(E o1, E o2) {
return Double.compare(counter.getCount(o2), counter.getCount(o1));
}
};
} | [
"public",
"static",
"<",
"E",
">",
"Comparator",
"<",
"E",
">",
"toComparatorDescending",
"(",
"final",
"Counter",
"<",
"E",
">",
"counter",
")",
"{",
"return",
"new",
"Comparator",
"<",
"E",
">",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"E",
... | Returns a comparator backed by this counter: two objects are compared by
their associated values stored in the counter. This comparator returns keys
by descending numeric value. Note that this ordering is not fixed, but
depends on the mutable values stored in the Counter. Doing this comparison
does not depend on the type of the key, since it uses the numeric value,
which is always Comparable.
@param counter
The Counter whose values are used for ordering the keys
@return A Comparator using this ordering | [
"Returns",
"a",
"comparator",
"backed",
"by",
"this",
"counter",
":",
"two",
"objects",
"are",
"compared",
"by",
"their",
"associated",
"values",
"stored",
"in",
"the",
"counter",
".",
"This",
"comparator",
"returns",
"keys",
"by",
"descending",
"numeric",
"va... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L812-L818 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java | ModuleIndexWriter.addIndexContents | protected void addIndexContents(Collection<ModuleElement> modules, String title, String tableSummary, Content body) {
HtmlTree htmltree = (configuration.allowTag(HtmlTag.NAV))
? HtmlTree.NAV()
: new HtmlTree(HtmlTag.DIV);
htmltree.addStyle(HtmlStyle.indexNav);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
addAllClassesLink(ul);
if (configuration.showModules) {
addAllModulesLink(ul);
}
htmltree.addContent(ul);
body.addContent(htmltree);
addModulesList(modules, title, tableSummary, body);
} | java | protected void addIndexContents(Collection<ModuleElement> modules, String title, String tableSummary, Content body) {
HtmlTree htmltree = (configuration.allowTag(HtmlTag.NAV))
? HtmlTree.NAV()
: new HtmlTree(HtmlTag.DIV);
htmltree.addStyle(HtmlStyle.indexNav);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
addAllClassesLink(ul);
if (configuration.showModules) {
addAllModulesLink(ul);
}
htmltree.addContent(ul);
body.addContent(htmltree);
addModulesList(modules, title, tableSummary, body);
} | [
"protected",
"void",
"addIndexContents",
"(",
"Collection",
"<",
"ModuleElement",
">",
"modules",
",",
"String",
"title",
",",
"String",
"tableSummary",
",",
"Content",
"body",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"(",
"configuration",
".",
"allowTag",
"(",
... | Adds module index contents.
@param title the title of the section
@param tableSummary summary for the table
@param body the document tree to which the index contents will be added | [
"Adds",
"module",
"index",
"contents",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java#L122-L135 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/Table.java | Table.checkColumnsMatch | void checkColumnsMatch(int[] col, Table other, int[] othercol) {
for (int i = 0; i < col.length; i++) {
Type type = colTypes[col[i]];
Type otherType = other.colTypes[othercol[i]];
if (type.typeComparisonGroup != otherType.typeComparisonGroup) {
throw Error.error(ErrorCode.X_42562);
}
}
} | java | void checkColumnsMatch(int[] col, Table other, int[] othercol) {
for (int i = 0; i < col.length; i++) {
Type type = colTypes[col[i]];
Type otherType = other.colTypes[othercol[i]];
if (type.typeComparisonGroup != otherType.typeComparisonGroup) {
throw Error.error(ErrorCode.X_42562);
}
}
} | [
"void",
"checkColumnsMatch",
"(",
"int",
"[",
"]",
"col",
",",
"Table",
"other",
",",
"int",
"[",
"]",
"othercol",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"col",
".",
"length",
";",
"i",
"++",
")",
"{",
"Type",
"type",
"=",
... | Match two valid, equal length, columns arrays for type of columns
@param col column array from this Table
@param other the other Table object
@param othercol column array from the other Table | [
"Match",
"two",
"valid",
"equal",
"length",
"columns",
"arrays",
"for",
"type",
"of",
"columns"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/Table.java#L963-L973 |
casmi/casmi | src/main/java/casmi/graphics/object/Camera.java | Camera.setEye | public void setEye(double eyeX, double eyeY, double eyeZ) {
this.eyeX = eyeX;
this.eyeY = eyeY;
this.eyeZ = eyeZ;
} | java | public void setEye(double eyeX, double eyeY, double eyeZ) {
this.eyeX = eyeX;
this.eyeY = eyeY;
this.eyeZ = eyeZ;
} | [
"public",
"void",
"setEye",
"(",
"double",
"eyeX",
",",
"double",
"eyeY",
",",
"double",
"eyeZ",
")",
"{",
"this",
".",
"eyeX",
"=",
"eyeX",
";",
"this",
".",
"eyeY",
"=",
"eyeY",
";",
"this",
".",
"eyeZ",
"=",
"eyeZ",
";",
"}"
] | Sets the eye position of this Camera.
@param eyeX
The x-coordinate for the eye.
@param eyeY
The y-coordinate for the eye.
@param eyeZ
The z-coordinate for the eye. | [
"Sets",
"the",
"eye",
"position",
"of",
"this",
"Camera",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/object/Camera.java#L147-L151 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/io/sstable/Descriptor.java | Descriptor.fromFilename | public static Pair<Descriptor,String> fromFilename(File directory, String name, boolean skipComponent)
{
// tokenize the filename
StringTokenizer st = new StringTokenizer(name, String.valueOf(separator));
String nexttok;
// all filenames must start with keyspace and column family
String ksname = st.nextToken();
String cfname = st.nextToken();
// optional temporary marker
nexttok = st.nextToken();
Type type = Type.FINAL;
if (nexttok.equals(Type.TEMP.marker))
{
type = Type.TEMP;
nexttok = st.nextToken();
}
else if (nexttok.equals(Type.TEMPLINK.marker))
{
type = Type.TEMPLINK;
nexttok = st.nextToken();
}
if (!Version.validate(nexttok))
throw new UnsupportedOperationException("SSTable " + name + " is too old to open. Upgrade to 2.0 first, and run upgradesstables");
Version version = new Version(nexttok);
nexttok = st.nextToken();
int generation = Integer.parseInt(nexttok);
// component suffix
String component = null;
if (!skipComponent)
component = st.nextToken();
directory = directory != null ? directory : new File(".");
return Pair.create(new Descriptor(version, directory, ksname, cfname, generation, type), component);
} | java | public static Pair<Descriptor,String> fromFilename(File directory, String name, boolean skipComponent)
{
// tokenize the filename
StringTokenizer st = new StringTokenizer(name, String.valueOf(separator));
String nexttok;
// all filenames must start with keyspace and column family
String ksname = st.nextToken();
String cfname = st.nextToken();
// optional temporary marker
nexttok = st.nextToken();
Type type = Type.FINAL;
if (nexttok.equals(Type.TEMP.marker))
{
type = Type.TEMP;
nexttok = st.nextToken();
}
else if (nexttok.equals(Type.TEMPLINK.marker))
{
type = Type.TEMPLINK;
nexttok = st.nextToken();
}
if (!Version.validate(nexttok))
throw new UnsupportedOperationException("SSTable " + name + " is too old to open. Upgrade to 2.0 first, and run upgradesstables");
Version version = new Version(nexttok);
nexttok = st.nextToken();
int generation = Integer.parseInt(nexttok);
// component suffix
String component = null;
if (!skipComponent)
component = st.nextToken();
directory = directory != null ? directory : new File(".");
return Pair.create(new Descriptor(version, directory, ksname, cfname, generation, type), component);
} | [
"public",
"static",
"Pair",
"<",
"Descriptor",
",",
"String",
">",
"fromFilename",
"(",
"File",
"directory",
",",
"String",
"name",
",",
"boolean",
"skipComponent",
")",
"{",
"// tokenize the filename",
"StringTokenizer",
"st",
"=",
"new",
"StringTokenizer",
"(",
... | Filename of the form "<ksname>-<cfname>-[tmp-][<version>-]<gen>-<component>"
@param directory The directory of the SSTable files
@param name The name of the SSTable file
@param skipComponent true if the name param should not be parsed for a component tag
@return A Descriptor for the SSTable, and the Component remainder. | [
"Filename",
"of",
"the",
"form",
"<ksname",
">",
"-",
"<cfname",
">",
"-",
"[",
"tmp",
"-",
"]",
"[",
"<version",
">",
"-",
"]",
"<gen",
">",
"-",
"<component",
">"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/sstable/Descriptor.java#L247-L284 |
Red5/red5-io | src/main/java/org/red5/io/object/Serializer.java | Serializer.writeArrayType | @SuppressWarnings("all")
protected static boolean writeArrayType(Output out, Object arrType) {
log.trace("writeArrayType");
if (arrType instanceof Collection) {
out.writeArray((Collection<Object>) arrType);
} else if (arrType instanceof Iterator) {
writeIterator(out, (Iterator<Object>) arrType);
} else if (arrType.getClass().isArray() && arrType.getClass().getComponentType().isPrimitive()) {
out.writeArray(arrType);
} else if (arrType instanceof Object[]) {
out.writeArray((Object[]) arrType);
} else {
return false;
}
return true;
} | java | @SuppressWarnings("all")
protected static boolean writeArrayType(Output out, Object arrType) {
log.trace("writeArrayType");
if (arrType instanceof Collection) {
out.writeArray((Collection<Object>) arrType);
} else if (arrType instanceof Iterator) {
writeIterator(out, (Iterator<Object>) arrType);
} else if (arrType.getClass().isArray() && arrType.getClass().getComponentType().isPrimitive()) {
out.writeArray(arrType);
} else if (arrType instanceof Object[]) {
out.writeArray((Object[]) arrType);
} else {
return false;
}
return true;
} | [
"@",
"SuppressWarnings",
"(",
"\"all\"",
")",
"protected",
"static",
"boolean",
"writeArrayType",
"(",
"Output",
"out",
",",
"Object",
"arrType",
")",
"{",
"log",
".",
"trace",
"(",
"\"writeArrayType\"",
")",
";",
"if",
"(",
"arrType",
"instanceof",
"Collectio... | Writes array (or collection) out as output Arrays, Collections, etc
@param out
Output object
@param arrType
Array or collection type
@return <tt>true</tt> if the object has been written, otherwise <tt>false</tt> | [
"Writes",
"array",
"(",
"or",
"collection",
")",
"out",
"as",
"output",
"Arrays",
"Collections",
"etc"
] | train | https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/Serializer.java#L253-L268 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlUtilities.java | XmlUtilities.decodeDateTime | public static int decodeDateTime(DateTimeField field, String strValue)
{
Date date = null;
try {
if (strValue != null)
{
if (field instanceof TimeField)
date = timeFormat.parse(strValue);
else if (field instanceof DateField)
date = dateFormat.parse(strValue);
else // if (field instanceof DateTimeField)
date = dateTimeFormat.parse(strValue);
}
} catch (ParseException e) {
e.printStackTrace();
return DBConstants.ERROR_RETURN;
}
return field.setDateTime(date, Constants.DISPLAY, Constants.SCREEN_MOVE);
} | java | public static int decodeDateTime(DateTimeField field, String strValue)
{
Date date = null;
try {
if (strValue != null)
{
if (field instanceof TimeField)
date = timeFormat.parse(strValue);
else if (field instanceof DateField)
date = dateFormat.parse(strValue);
else // if (field instanceof DateTimeField)
date = dateTimeFormat.parse(strValue);
}
} catch (ParseException e) {
e.printStackTrace();
return DBConstants.ERROR_RETURN;
}
return field.setDateTime(date, Constants.DISPLAY, Constants.SCREEN_MOVE);
} | [
"public",
"static",
"int",
"decodeDateTime",
"(",
"DateTimeField",
"field",
",",
"String",
"strValue",
")",
"{",
"Date",
"date",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"strValue",
"!=",
"null",
")",
"{",
"if",
"(",
"field",
"instanceof",
"TimeField",
"... | Decode date time value and set the field value.
@param field
@return | [
"Decode",
"date",
"time",
"value",
"and",
"set",
"the",
"field",
"value",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlUtilities.java#L291-L309 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/conformance/TypeConformanceComputer.java | TypeConformanceComputer.isRecursiveRequest | @Deprecated
protected final boolean isRecursiveRequest(List<LightweightTypeReference> types, Set<String> allNames, List<LightweightTypeReference> initiallyRequested) {
CommonSuperTypeFinder typeFinder = newCommonSuperTypeFinder(types.get(0).getOwner());
typeFinder.requestsInProgress = Lists.newArrayList();
typeFinder.requestsInProgress.add(initiallyRequested);
return typeFinder.isRecursiveRequest(types, allNames);
} | java | @Deprecated
protected final boolean isRecursiveRequest(List<LightweightTypeReference> types, Set<String> allNames, List<LightweightTypeReference> initiallyRequested) {
CommonSuperTypeFinder typeFinder = newCommonSuperTypeFinder(types.get(0).getOwner());
typeFinder.requestsInProgress = Lists.newArrayList();
typeFinder.requestsInProgress.add(initiallyRequested);
return typeFinder.isRecursiveRequest(types, allNames);
} | [
"@",
"Deprecated",
"protected",
"final",
"boolean",
"isRecursiveRequest",
"(",
"List",
"<",
"LightweightTypeReference",
">",
"types",
",",
"Set",
"<",
"String",
">",
"allNames",
",",
"List",
"<",
"LightweightTypeReference",
">",
"initiallyRequested",
")",
"{",
"Co... | Logic was moved to inner class CommonSuperTypeFinder in the context of bug 495314.
This method is scheduled for deletion in Xtext 2.15
@deprecated see {@link CommonSuperTypeFinder#isRecursiveRequest(List, Set)} | [
"Logic",
"was",
"moved",
"to",
"inner",
"class",
"CommonSuperTypeFinder",
"in",
"the",
"context",
"of",
"bug",
"495314",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/conformance/TypeConformanceComputer.java#L829-L835 |
lucee/Lucee | core/src/main/java/lucee/runtime/cache/CacheUtil.java | CacheUtil.getPassword | public static Password getPassword(PageContext pc, String password, boolean server) throws lucee.runtime.exp.SecurityException { // TODO: move this to a utility class in a more
// generic package?
// no password passed
if (StringUtil.isEmpty(password, true)) {
ApplicationContext appContext = pc.getApplicationContext();
if (appContext instanceof ModernApplicationContext) password = Caster.toString(((ModernApplicationContext) appContext).getCustom(KeyConstants._webAdminPassword), "");
}
else password = password.trim();
if (StringUtil.isEmpty(password, true)) throw new lucee.runtime.exp.SecurityException(
"A Web Admin Password is required to manipulate Cache connections. " + "You can either pass the password as an argument to this function, or set it in "
+ (pc.getRequestDialect() == CFMLEngine.DIALECT_CFML ? Constants.CFML_APPLICATION_EVENT_HANDLER : Constants.LUCEE_APPLICATION_EVENT_HANDLER)
+ " with the variable [this.webAdminPassword].");
return PasswordImpl.passwordToCompare(pc.getConfig(), server, password);
} | java | public static Password getPassword(PageContext pc, String password, boolean server) throws lucee.runtime.exp.SecurityException { // TODO: move this to a utility class in a more
// generic package?
// no password passed
if (StringUtil.isEmpty(password, true)) {
ApplicationContext appContext = pc.getApplicationContext();
if (appContext instanceof ModernApplicationContext) password = Caster.toString(((ModernApplicationContext) appContext).getCustom(KeyConstants._webAdminPassword), "");
}
else password = password.trim();
if (StringUtil.isEmpty(password, true)) throw new lucee.runtime.exp.SecurityException(
"A Web Admin Password is required to manipulate Cache connections. " + "You can either pass the password as an argument to this function, or set it in "
+ (pc.getRequestDialect() == CFMLEngine.DIALECT_CFML ? Constants.CFML_APPLICATION_EVENT_HANDLER : Constants.LUCEE_APPLICATION_EVENT_HANDLER)
+ " with the variable [this.webAdminPassword].");
return PasswordImpl.passwordToCompare(pc.getConfig(), server, password);
} | [
"public",
"static",
"Password",
"getPassword",
"(",
"PageContext",
"pc",
",",
"String",
"password",
",",
"boolean",
"server",
")",
"throws",
"lucee",
".",
"runtime",
".",
"exp",
".",
"SecurityException",
"{",
"// TODO: move this to a utility class in a more",
"// gene... | returns true if the webAdminPassword matches the passed password if one is passed, or a password
defined in Application . cfc as this.webAdminPassword if null or empty-string is passed for
password
@param pc
@param password
@return
@throws lucee.runtime.exp.SecurityException | [
"returns",
"true",
"if",
"the",
"webAdminPassword",
"matches",
"the",
"passed",
"password",
"if",
"one",
"is",
"passed",
"or",
"a",
"password",
"defined",
"in",
"Application",
".",
"cfc",
"as",
"this",
".",
"webAdminPassword",
"if",
"null",
"or",
"empty",
"-... | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/cache/CacheUtil.java#L382-L397 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlUtilities.java | XmlUtilities.decodeFieldData | public static void decodeFieldData(BaseField field, String string)
{
if ((string == null) || (string.length() == 0))
return;
byte[] ba = Base64.decode(string.toCharArray());
InputStream is = new ByteArrayInputStream(ba);
DataInputStream daIn = new DataInputStream(is);
field.read(daIn, false);
} | java | public static void decodeFieldData(BaseField field, String string)
{
if ((string == null) || (string.length() == 0))
return;
byte[] ba = Base64.decode(string.toCharArray());
InputStream is = new ByteArrayInputStream(ba);
DataInputStream daIn = new DataInputStream(is);
field.read(daIn, false);
} | [
"public",
"static",
"void",
"decodeFieldData",
"(",
"BaseField",
"field",
",",
"String",
"string",
")",
"{",
"if",
"(",
"(",
"string",
"==",
"null",
")",
"||",
"(",
"string",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"return",
";",
"byte",
"[",
... | Change this base64 string to raw data and set the value in this field.
WARNING - This requires 64bit encoding found in javax.mail!
@param field The field containing the binary data to decode.
@param The string to decode using base64. | [
"Change",
"this",
"base64",
"string",
"to",
"raw",
"data",
"and",
"set",
"the",
"value",
"in",
"this",
"field",
".",
"WARNING",
"-",
"This",
"requires",
"64bit",
"encoding",
"found",
"in",
"javax",
".",
"mail!"
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlUtilities.java#L400-L408 |
wisdom-framework/wisdom-jcr | wisdom-modeshape-web-jcr-rest/src/main/java/org/modeshape/web/jcr/rest/handler/RestQueryHandlerImpl.java | RestQueryHandlerImpl.planQuery | @Override
public RestQueryPlanResult planQuery(Request request,
String repositoryName,
String workspaceName,
String language,
String statement,
long offset,
long limit) throws RepositoryException {
assert repositoryName != null;
assert workspaceName != null;
assert language != null;
assert statement != null;
Session session = getSession(request, repositoryName, workspaceName);
org.modeshape.jcr.api.query.Query query = createQuery(language, statement, session);
bindExtraVariables(request, session.getValueFactory(), query);
org.modeshape.jcr.api.query.QueryResult result = query.explain();
String plan = result.getPlan();
return new RestQueryPlanResult(plan, statement, language, query.getAbstractQueryModelRepresentation());
} | java | @Override
public RestQueryPlanResult planQuery(Request request,
String repositoryName,
String workspaceName,
String language,
String statement,
long offset,
long limit) throws RepositoryException {
assert repositoryName != null;
assert workspaceName != null;
assert language != null;
assert statement != null;
Session session = getSession(request, repositoryName, workspaceName);
org.modeshape.jcr.api.query.Query query = createQuery(language, statement, session);
bindExtraVariables(request, session.getValueFactory(), query);
org.modeshape.jcr.api.query.QueryResult result = query.explain();
String plan = result.getPlan();
return new RestQueryPlanResult(plan, statement, language, query.getAbstractQueryModelRepresentation());
} | [
"@",
"Override",
"public",
"RestQueryPlanResult",
"planQuery",
"(",
"Request",
"request",
",",
"String",
"repositoryName",
",",
"String",
"workspaceName",
",",
"String",
"language",
",",
"String",
"statement",
",",
"long",
"offset",
",",
"long",
"limit",
")",
"t... | Executes a the given query string (based on the language information) against a JCR repository, returning a rest model
based result.
@param request a non-null {@link Request}
@param repositoryName a non-null, URL encoded {@link String} representing the name of a repository
@param workspaceName a non-null, URL encoded {@link String} representing the name of a workspace
@param language a non-null String which should be a valid query language, as recognized by the
{@link javax.jcr.query.QueryManager}
@param statement a non-null String which should be a valid query string in the above language.
@param offset a numeric value which indicates the index in the result set from where results should be returned.
@param limit a numeric value indicating the maximum number of rows to return.
@return a response containing the string representation of the query plan
@throws javax.jcr.RepositoryException if any operation fails at the JCR level | [
"Executes",
"a",
"the",
"given",
"query",
"string",
"(",
"based",
"on",
"the",
"language",
"information",
")",
"against",
"a",
"JCR",
"repository",
"returning",
"a",
"rest",
"model",
"based",
"result",
"."
] | train | https://github.com/wisdom-framework/wisdom-jcr/blob/2711383dde2239a19b90c226b3fd2aecab5715e4/wisdom-modeshape-web-jcr-rest/src/main/java/org/modeshape/web/jcr/rest/handler/RestQueryHandlerImpl.java#L124-L144 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/GroovyCategorySupport.java | GroovyCategorySupport.use | public static <T> T use(Class categoryClass, Closure<T> closure) {
return THREAD_INFO.getInfo().use(categoryClass, closure);
} | java | public static <T> T use(Class categoryClass, Closure<T> closure) {
return THREAD_INFO.getInfo().use(categoryClass, closure);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"use",
"(",
"Class",
"categoryClass",
",",
"Closure",
"<",
"T",
">",
"closure",
")",
"{",
"return",
"THREAD_INFO",
".",
"getInfo",
"(",
")",
".",
"use",
"(",
"categoryClass",
",",
"closure",
")",
";",
"}"
] | Create a scope based on given categoryClass and invoke closure within that scope.
@param categoryClass the class containing category methods
@param closure the closure during which to make the category class methods available
@return the value returned from the closure | [
"Create",
"a",
"scope",
"based",
"on",
"given",
"categoryClass",
"and",
"invoke",
"closure",
"within",
"that",
"scope",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/GroovyCategorySupport.java#L261-L263 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java | TasksImpl.addCollectionAsync | public Observable<TaskAddCollectionResult> addCollectionAsync(String jobId, List<TaskAddParameter> value) {
return addCollectionWithServiceResponseAsync(jobId, value).map(new Func1<ServiceResponseWithHeaders<TaskAddCollectionResult, TaskAddCollectionHeaders>, TaskAddCollectionResult>() {
@Override
public TaskAddCollectionResult call(ServiceResponseWithHeaders<TaskAddCollectionResult, TaskAddCollectionHeaders> response) {
return response.body();
}
});
} | java | public Observable<TaskAddCollectionResult> addCollectionAsync(String jobId, List<TaskAddParameter> value) {
return addCollectionWithServiceResponseAsync(jobId, value).map(new Func1<ServiceResponseWithHeaders<TaskAddCollectionResult, TaskAddCollectionHeaders>, TaskAddCollectionResult>() {
@Override
public TaskAddCollectionResult call(ServiceResponseWithHeaders<TaskAddCollectionResult, TaskAddCollectionHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"TaskAddCollectionResult",
">",
"addCollectionAsync",
"(",
"String",
"jobId",
",",
"List",
"<",
"TaskAddParameter",
">",
"value",
")",
"{",
"return",
"addCollectionWithServiceResponseAsync",
"(",
"jobId",
",",
"value",
")",
".",
"map",
... | Adds a collection of tasks to the specified job.
Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time.
@param jobId The ID of the job to which the task collection is to be added.
@param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the TaskAddCollectionResult object | [
"Adds",
"a",
"collection",
"of",
"tasks",
"to",
"the",
"specified",
"job",
".",
"Note",
"that",
"each",
"task",
"must",
"have",
"a",
"unique",
"ID",
".",
"The",
"Batch",
"service",
"may",
"not",
"return",
"the",
"results",
"for",
"each",
"task",
"in",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java#L693-L700 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.metrics/src/com/ibm/ws/microprofile/metrics/impl/MetricRegistryImpl.java | MetricRegistryImpl.getCounters | @Override
public SortedMap<String, Counter> getCounters(MetricFilter filter) {
return getMetrics(Counter.class, filter);
} | java | @Override
public SortedMap<String, Counter> getCounters(MetricFilter filter) {
return getMetrics(Counter.class, filter);
} | [
"@",
"Override",
"public",
"SortedMap",
"<",
"String",
",",
"Counter",
">",
"getCounters",
"(",
"MetricFilter",
"filter",
")",
"{",
"return",
"getMetrics",
"(",
"Counter",
".",
"class",
",",
"filter",
")",
";",
"}"
] | Returns a map of all the counters in the registry and their names which match the given
filter.
@param filter the metric filter to match
@return all the counters in the registry | [
"Returns",
"a",
"map",
"of",
"all",
"the",
"counters",
"in",
"the",
"registry",
"and",
"their",
"names",
"which",
"match",
"the",
"given",
"filter",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.metrics/src/com/ibm/ws/microprofile/metrics/impl/MetricRegistryImpl.java#L362-L365 |
modelmapper/modelmapper | core/src/main/java/org/modelmapper/internal/ImplicitMappingBuilder.java | ImplicitMappingBuilder.mergeMappings | private void mergeMappings(TypeMap<?, ?> destinationMap) {
for (Mapping mapping : destinationMap.getMappings()) {
InternalMapping internalMapping = (InternalMapping) mapping;
mergedMappings.add(internalMapping.createMergedCopy(
propertyNameInfo.getSourceProperties(), propertyNameInfo.getDestinationProperties()));
}
} | java | private void mergeMappings(TypeMap<?, ?> destinationMap) {
for (Mapping mapping : destinationMap.getMappings()) {
InternalMapping internalMapping = (InternalMapping) mapping;
mergedMappings.add(internalMapping.createMergedCopy(
propertyNameInfo.getSourceProperties(), propertyNameInfo.getDestinationProperties()));
}
} | [
"private",
"void",
"mergeMappings",
"(",
"TypeMap",
"<",
"?",
",",
"?",
">",
"destinationMap",
")",
"{",
"for",
"(",
"Mapping",
"mapping",
":",
"destinationMap",
".",
"getMappings",
"(",
")",
")",
"{",
"InternalMapping",
"internalMapping",
"=",
"(",
"Interna... | Merges mappings from an existing TypeMap into the type map under construction. | [
"Merges",
"mappings",
"from",
"an",
"existing",
"TypeMap",
"into",
"the",
"type",
"map",
"under",
"construction",
"."
] | train | https://github.com/modelmapper/modelmapper/blob/491d165ded9dc9aba7ce8b56984249e1a1363204/core/src/main/java/org/modelmapper/internal/ImplicitMappingBuilder.java#L389-L395 |
apache/groovy | subprojects/groovy-json/src/main/java/groovy/json/DefaultJsonGenerator.java | DefaultJsonGenerator.writeRaw | protected void writeRaw(CharSequence seq, CharBuf buffer) {
if (seq != null) {
buffer.add(seq.toString());
}
} | java | protected void writeRaw(CharSequence seq, CharBuf buffer) {
if (seq != null) {
buffer.add(seq.toString());
}
} | [
"protected",
"void",
"writeRaw",
"(",
"CharSequence",
"seq",
",",
"CharBuf",
"buffer",
")",
"{",
"if",
"(",
"seq",
"!=",
"null",
")",
"{",
"buffer",
".",
"add",
"(",
"seq",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
] | Serializes any char sequence and writes it into specified buffer
without performing any manipulation of the given text. | [
"Serializes",
"any",
"char",
"sequence",
"and",
"writes",
"it",
"into",
"specified",
"buffer",
"without",
"performing",
"any",
"manipulation",
"of",
"the",
"given",
"text",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-json/src/main/java/groovy/json/DefaultJsonGenerator.java#L264-L268 |
onepf/OpenIAB | library/src/main/java/org/onepf/oms/OpenIabHelper.java | OpenIabHelper.mapSku | public static void mapSku(String sku, String storeName, @NotNull String storeSku) {
SkuManager.getInstance().mapSku(sku, storeName, storeSku);
} | java | public static void mapSku(String sku, String storeName, @NotNull String storeSku) {
SkuManager.getInstance().mapSku(sku, storeName, storeSku);
} | [
"public",
"static",
"void",
"mapSku",
"(",
"String",
"sku",
",",
"String",
"storeName",
",",
"@",
"NotNull",
"String",
"storeSku",
")",
"{",
"SkuManager",
".",
"getInstance",
"(",
")",
".",
"mapSku",
"(",
"sku",
",",
"storeName",
",",
"storeSku",
")",
";... | Maps the sku and the storeSku for a particular store.
The best practice is to use SKU like <code>com.companyname.application.item</code>.
Such SKU fits most of stores so it doesn't need to be mapped.
If the recommended approach is not applicable, use application internal SKU in the code (usually it is a SKU for Google Play)
and map SKU of other stores using this method. OpenIAB will map SKU in both directions,
so you can use only your inner SKU to purchase, consume and check.
@param sku The logical internal SKU. E.g. redhat
@param storeSku The store-specific SKU. Shouldn't duplicate already mapped values. E.g. appland.redhat
@param storeName The name of a store. @see {@link IOpenAppstore#getAppstoreName()} or {@link #NAME_AMAZON}, {@link #NAME_GOOGLE}
@throws java.lang.IllegalArgumentException If one of the arguments is null or empty.
@deprecated Use {@link org.onepf.oms.SkuManager#mapSku(String, String, String)} | [
"Maps",
"the",
"sku",
"and",
"the",
"storeSku",
"for",
"a",
"particular",
"store",
".",
"The",
"best",
"practice",
"is",
"to",
"use",
"SKU",
"like",
"<code",
">",
"com",
".",
"companyname",
".",
"application",
".",
"item<",
"/",
"code",
">",
".",
"Such... | train | https://github.com/onepf/OpenIAB/blob/90552d53c5303b322940d96a0c4b7cb797d78760/library/src/main/java/org/onepf/oms/OpenIabHelper.java#L353-L355 |
mgm-tp/jfunk | jfunk-common/src/main/java/com/mgmtp/jfunk/common/util/ExtendedProperties.java | ExtendedProperties.store | public void store(final OutputStream os, final String comments, final boolean sorted, final boolean process)
throws IOException {
store(new OutputStreamWriter(os), comments, sorted, process);
} | java | public void store(final OutputStream os, final String comments, final boolean sorted, final boolean process)
throws IOException {
store(new OutputStreamWriter(os), comments, sorted, process);
} | [
"public",
"void",
"store",
"(",
"final",
"OutputStream",
"os",
",",
"final",
"String",
"comments",
",",
"final",
"boolean",
"sorted",
",",
"final",
"boolean",
"process",
")",
"throws",
"IOException",
"{",
"store",
"(",
"new",
"OutputStreamWriter",
"(",
"os",
... | Writes the properties to the specified stream using the default encoding, including defaults.
@param os
The output stream
@param comments
Header comment that is written to the stream
@param sorted
If {@code true}, the properties are written sorted by key
@param process
If {@code true}, place holders are resolved | [
"Writes",
"the",
"properties",
"to",
"the",
"specified",
"stream",
"using",
"the",
"default",
"encoding",
"including",
"defaults",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/util/ExtendedProperties.java#L606-L609 |
xdcrafts/flower | flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java | MapApi.getMap | public static <A, B> Optional<Map<A, B>> getMap(final Map map, final Object... path) {
return get(map, Map.class, path).map(m -> (Map<A, B>) m);
} | java | public static <A, B> Optional<Map<A, B>> getMap(final Map map, final Object... path) {
return get(map, Map.class, path).map(m -> (Map<A, B>) m);
} | [
"public",
"static",
"<",
"A",
",",
"B",
">",
"Optional",
"<",
"Map",
"<",
"A",
",",
"B",
">",
">",
"getMap",
"(",
"final",
"Map",
"map",
",",
"final",
"Object",
"...",
"path",
")",
"{",
"return",
"get",
"(",
"map",
",",
"Map",
".",
"class",
","... | Get map value by path.
@param <A> map key type
@param <B> map value type
@param map subject
@param path nodes to walk in map
@return value | [
"Get",
"map",
"value",
"by",
"path",
"."
] | train | https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java#L199-L201 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeHelpers.java | TreeHelpers.changeSelected | public static TreeElement changeSelected(TreeElement root, TreeElement selectedNode, String selectNode, ServletRequest request)
{
assert(root != null) : "parameter 'root' must not be null";
assert(selectNode != null) : "parameter 'selectNode' must not be null";
assert(request != null) : "parameter 'request' must not be null";
// if there is a selectedNode then we need to raise the onSelect
// event on that node indicating it will soon not be selected
TreeElement n = root.findNode(selectNode);
if (n == null) {
logger.warn("The tree element '" + selectNode + "' was not found. Selection failed");
return null;
}
// change the node that was selected so it is no longer selected
if (selectedNode != null) {
selectedNode.onSelect(request);
selectedNode.setSelected(false);
}
// change the node that is to be selected
n.onSelect(request);
n.setSelected(true);
return n;
} | java | public static TreeElement changeSelected(TreeElement root, TreeElement selectedNode, String selectNode, ServletRequest request)
{
assert(root != null) : "parameter 'root' must not be null";
assert(selectNode != null) : "parameter 'selectNode' must not be null";
assert(request != null) : "parameter 'request' must not be null";
// if there is a selectedNode then we need to raise the onSelect
// event on that node indicating it will soon not be selected
TreeElement n = root.findNode(selectNode);
if (n == null) {
logger.warn("The tree element '" + selectNode + "' was not found. Selection failed");
return null;
}
// change the node that was selected so it is no longer selected
if (selectedNode != null) {
selectedNode.onSelect(request);
selectedNode.setSelected(false);
}
// change the node that is to be selected
n.onSelect(request);
n.setSelected(true);
return n;
} | [
"public",
"static",
"TreeElement",
"changeSelected",
"(",
"TreeElement",
"root",
",",
"TreeElement",
"selectedNode",
",",
"String",
"selectNode",
",",
"ServletRequest",
"request",
")",
"{",
"assert",
"(",
"root",
"!=",
"null",
")",
":",
"\"parameter 'root' must not ... | This is a helper method that will change the selected node. This is provided to
make implementation of ITreeRootElement easier. This is called by the <code>changeSelected</code>
method there to do the work of changing the selected node.
@param root The root of the tree
@param selectedNode The node that is currently selected, it may be null
@param selectNode The String name of the node that will be selected
@param request The ServletRequest
@return a TreeElement representing the new node selected. | [
"This",
"is",
"a",
"helper",
"method",
"that",
"will",
"change",
"the",
"selected",
"node",
".",
"This",
"is",
"provided",
"to",
"make",
"implementation",
"of",
"ITreeRootElement",
"easier",
".",
"This",
"is",
"called",
"by",
"the",
"<code",
">",
"changeSele... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeHelpers.java#L160-L184 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java | Logger.getLogger | @CallerSensitive
public static Logger getLogger(String name, String resourceBundleName) {
// Android-changed: Use VMStack.getStackClass1.
/* J2ObjC modified.
Class<?> callerClass = VMStack.getStackClass1();
*/
Class<?> callerClass = null;
Logger result = demandLogger(name, resourceBundleName, callerClass);
if (result.resourceBundleName == null) {
// We haven't set a bundle name yet on the Logger, so it's ok to proceed.
// We have to set the callers ClassLoader here in case demandLogger
// above found a previously created Logger. This can happen, for
// example, if Logger.getLogger(name) is called and subsequently
// Logger.getLogger(name, resourceBundleName) is called. In this case
// we won't necessarily have the correct classloader saved away, so
// we need to set it here, too.
// Note: we may get a MissingResourceException here.
result.setupResourceInfo(resourceBundleName, callerClass);
} else if (!result.resourceBundleName.equals(resourceBundleName)) {
// We already had a bundle name on the Logger and we're trying
// to change it here which is not allowed.
throw new IllegalArgumentException(result.resourceBundleName +
" != " + resourceBundleName);
}
return result;
} | java | @CallerSensitive
public static Logger getLogger(String name, String resourceBundleName) {
// Android-changed: Use VMStack.getStackClass1.
/* J2ObjC modified.
Class<?> callerClass = VMStack.getStackClass1();
*/
Class<?> callerClass = null;
Logger result = demandLogger(name, resourceBundleName, callerClass);
if (result.resourceBundleName == null) {
// We haven't set a bundle name yet on the Logger, so it's ok to proceed.
// We have to set the callers ClassLoader here in case demandLogger
// above found a previously created Logger. This can happen, for
// example, if Logger.getLogger(name) is called and subsequently
// Logger.getLogger(name, resourceBundleName) is called. In this case
// we won't necessarily have the correct classloader saved away, so
// we need to set it here, too.
// Note: we may get a MissingResourceException here.
result.setupResourceInfo(resourceBundleName, callerClass);
} else if (!result.resourceBundleName.equals(resourceBundleName)) {
// We already had a bundle name on the Logger and we're trying
// to change it here which is not allowed.
throw new IllegalArgumentException(result.resourceBundleName +
" != " + resourceBundleName);
}
return result;
} | [
"@",
"CallerSensitive",
"public",
"static",
"Logger",
"getLogger",
"(",
"String",
"name",
",",
"String",
"resourceBundleName",
")",
"{",
"// Android-changed: Use VMStack.getStackClass1.",
"/* J2ObjC modified.\n Class<?> callerClass = VMStack.getStackClass1();\n */",
"Cl... | adding a new Logger object is handled by LogManager.addLogger(). | [
"adding",
"a",
"new",
"Logger",
"object",
"is",
"handled",
"by",
"LogManager",
".",
"addLogger",
"()",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java#L456-L484 |
wcm-io-caravan/caravan-commons | httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java | CertificateLoader.getTrustManagerFactory | public static TrustManagerFactory getTrustManagerFactory(String trustStoreFilename, StoreProperties storeProperties)
throws IOException, GeneralSecurityException {
InputStream is = getResourceAsStream(trustStoreFilename);
if (is == null) {
throw new FileNotFoundException("Certificate file not found: " + getFilenameInfo(trustStoreFilename));
}
try {
return getTrustManagerFactory(is, storeProperties);
}
finally {
try {
is.close();
}
catch (IOException ex) {
// ignore
}
}
} | java | public static TrustManagerFactory getTrustManagerFactory(String trustStoreFilename, StoreProperties storeProperties)
throws IOException, GeneralSecurityException {
InputStream is = getResourceAsStream(trustStoreFilename);
if (is == null) {
throw new FileNotFoundException("Certificate file not found: " + getFilenameInfo(trustStoreFilename));
}
try {
return getTrustManagerFactory(is, storeProperties);
}
finally {
try {
is.close();
}
catch (IOException ex) {
// ignore
}
}
} | [
"public",
"static",
"TrustManagerFactory",
"getTrustManagerFactory",
"(",
"String",
"trustStoreFilename",
",",
"StoreProperties",
"storeProperties",
")",
"throws",
"IOException",
",",
"GeneralSecurityException",
"{",
"InputStream",
"is",
"=",
"getResourceAsStream",
"(",
"tr... | Build TrustManagerFactory.
@param trustStoreFilename Truststore file name
@param storeProperties store properties
@return TrustManagerFactory
@throws IOException
@throws GeneralSecurityException | [
"Build",
"TrustManagerFactory",
"."
] | train | https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java#L164-L181 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/factory/filter/binary/FactoryThresholdBinary.java | FactoryThresholdBinary.localNick | public static <T extends ImageGray<T>>
InputToBinary<T> localNick(ConfigLength width, boolean down, float k, Class<T> inputType)
{
// if( BOverrideFactoryThresholdBinary.localNick != null )
// return BOverrideFactoryThresholdBinary.localNick.handle(width, k, down, inputType);
return new InputToBinarySwitch<>(new ThresholdNick(width, k, down),inputType);
} | java | public static <T extends ImageGray<T>>
InputToBinary<T> localNick(ConfigLength width, boolean down, float k, Class<T> inputType)
{
// if( BOverrideFactoryThresholdBinary.localNick != null )
// return BOverrideFactoryThresholdBinary.localNick.handle(width, k, down, inputType);
return new InputToBinarySwitch<>(new ThresholdNick(width, k, down),inputType);
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
">",
"InputToBinary",
"<",
"T",
">",
"localNick",
"(",
"ConfigLength",
"width",
",",
"boolean",
"down",
",",
"float",
"k",
",",
"Class",
"<",
"T",
">",
"inputType",
")",
"{",
"//\t\ti... | @see ThresholdNick
@param width size of local region. Try 31
@param down Should it threshold up or down.
@param k The Niblack factor. Recommend -0.1 to -0.2
@param inputType Type of input image
@return Filter to binary | [
"@see",
"ThresholdNick"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/binary/FactoryThresholdBinary.java#L92-L98 |
ontop/ontop | engine/system/core/src/main/java/it/unibz/inf/ontop/utils/querymanager/QueryController.java | QueryController.addQuery | public QueryControllerQuery addQuery(String queryStr, String queryId) {
int position = getElementPosition(queryId);
QueryControllerQuery query = new QueryControllerQuery(queryId);
query.setQuery(queryStr);
if (position == -1) { // add to the collection for a new query.
entities.add(query);
fireElementAdded(query);
} else {
entities.set(position, query);
fireElementChanged(query);
}
return query;
} | java | public QueryControllerQuery addQuery(String queryStr, String queryId) {
int position = getElementPosition(queryId);
QueryControllerQuery query = new QueryControllerQuery(queryId);
query.setQuery(queryStr);
if (position == -1) { // add to the collection for a new query.
entities.add(query);
fireElementAdded(query);
} else {
entities.set(position, query);
fireElementChanged(query);
}
return query;
} | [
"public",
"QueryControllerQuery",
"addQuery",
"(",
"String",
"queryStr",
",",
"String",
"queryId",
")",
"{",
"int",
"position",
"=",
"getElementPosition",
"(",
"queryId",
")",
";",
"QueryControllerQuery",
"query",
"=",
"new",
"QueryControllerQuery",
"(",
"queryId",
... | Creates a new query and adds it to the vector QueryControllerEntity.
@param queryStr
The new query string, replacing any existing string.
@param queryId
The query id associated to the string.
@return The query object. | [
"Creates",
"a",
"new",
"query",
"and",
"adds",
"it",
"to",
"the",
"vector",
"QueryControllerEntity",
"."
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/engine/system/core/src/main/java/it/unibz/inf/ontop/utils/querymanager/QueryController.java#L130-L144 |
alkacon/opencms-core | src/org/opencms/search/CmsSearchUtil.java | CmsSearchUtil.getSolrRangeString | public static String getSolrRangeString(String from, String to) {
// If a parameter is not initialized, use the asterisk '*' operator
if (CmsStringUtil.isEmptyOrWhitespaceOnly(from)) {
from = "*";
}
if (CmsStringUtil.isEmptyOrWhitespaceOnly(to)) {
to = "*";
}
return String.format("[%s TO %s]", from, to);
} | java | public static String getSolrRangeString(String from, String to) {
// If a parameter is not initialized, use the asterisk '*' operator
if (CmsStringUtil.isEmptyOrWhitespaceOnly(from)) {
from = "*";
}
if (CmsStringUtil.isEmptyOrWhitespaceOnly(to)) {
to = "*";
}
return String.format("[%s TO %s]", from, to);
} | [
"public",
"static",
"String",
"getSolrRangeString",
"(",
"String",
"from",
",",
"String",
"to",
")",
"{",
"// If a parameter is not initialized, use the asterisk '*' operator",
"if",
"(",
"CmsStringUtil",
".",
"isEmptyOrWhitespaceOnly",
"(",
"from",
")",
")",
"{",
"from... | Returns a string that represents a valid Solr query range.
@param from Lower bound of the query range.
@param to Upper bound of the query range.
@return String that represents a Solr query range. | [
"Returns",
"a",
"string",
"that",
"represents",
"a",
"valid",
"Solr",
"query",
"range",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchUtil.java#L277-L289 |
alkacon/opencms-core | src/org/opencms/jsp/util/CmsJspContentAccessValueWrapper.java | CmsJspContentAccessValueWrapper.createWrapper | public static CmsJspContentAccessValueWrapper createWrapper(
CmsObject cms,
I_CmsXmlContentValue value,
I_CmsXmlContentValue parentValue,
String valueName) {
if ((value != null) && (cms != null)) {
return new CmsJspContentAccessValueWrapper(cms, value);
}
if ((parentValue != null) && (valueName != null) && (cms != null)) {
CmsJspContentAccessValueWrapper wrapper = new CmsJspContentAccessValueWrapper();
wrapper.m_nullValueInfo = new NullValueInfo(parentValue, valueName);
wrapper.m_cms = cms;
return wrapper;
}
// if no value is available,
return NULL_VALUE_WRAPPER;
} | java | public static CmsJspContentAccessValueWrapper createWrapper(
CmsObject cms,
I_CmsXmlContentValue value,
I_CmsXmlContentValue parentValue,
String valueName) {
if ((value != null) && (cms != null)) {
return new CmsJspContentAccessValueWrapper(cms, value);
}
if ((parentValue != null) && (valueName != null) && (cms != null)) {
CmsJspContentAccessValueWrapper wrapper = new CmsJspContentAccessValueWrapper();
wrapper.m_nullValueInfo = new NullValueInfo(parentValue, valueName);
wrapper.m_cms = cms;
return wrapper;
}
// if no value is available,
return NULL_VALUE_WRAPPER;
} | [
"public",
"static",
"CmsJspContentAccessValueWrapper",
"createWrapper",
"(",
"CmsObject",
"cms",
",",
"I_CmsXmlContentValue",
"value",
",",
"I_CmsXmlContentValue",
"parentValue",
",",
"String",
"valueName",
")",
"{",
"if",
"(",
"(",
"value",
"!=",
"null",
")",
"&&",... | Factory method to create a new XML content value wrapper.<p>
In case either parameter is <code>null</code>, the {@link #NULL_VALUE_WRAPPER} is returned.<p>
@param cms the current users OpenCms context
@param value the value to warp
@param parentValue the parent value, required to set the null value info
@param valueName the value path name
@return a new content value wrapper instance, or <code>null</code> if any parameter is <code>null</code> | [
"Factory",
"method",
"to",
"create",
"a",
"new",
"XML",
"content",
"value",
"wrapper",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspContentAccessValueWrapper.java#L387-L404 |
kaazing/gateway | service/http.proxy/src/main/java/org/kaazing/gateway/service/http/proxy/HttpProxyServiceHandler.java | HttpProxyServiceHandler.processRequestHeaders | private void processRequestHeaders(HttpAcceptSession acceptSession, HttpConnectSession connectSession) {
boolean upgrade = processHopByHopHeaders(acceptSession, connectSession);
// Add Connection: upgrade or Connection: close header
if (upgrade) {
connectSession.setWriteHeader(HEADER_CONNECTION, HEADER_UPGRADE);
} else {
ResourceAddress address = connectSession.getRemoteAddress();
// If keep-alive is disabled, add Connection: close header
if (!address.getOption(HttpResourceAddress.KEEP_ALIVE)) {
connectSession.setWriteHeader(HEADER_CONNECTION, "close");
}
}
// Add Via: 1.1 kaazing + uuid header
connectSession.addWriteHeader(HEADER_VIA, viaHeader);
// Add forwarded headers
setupForwardedHeaders(acceptSession, connectSession);
} | java | private void processRequestHeaders(HttpAcceptSession acceptSession, HttpConnectSession connectSession) {
boolean upgrade = processHopByHopHeaders(acceptSession, connectSession);
// Add Connection: upgrade or Connection: close header
if (upgrade) {
connectSession.setWriteHeader(HEADER_CONNECTION, HEADER_UPGRADE);
} else {
ResourceAddress address = connectSession.getRemoteAddress();
// If keep-alive is disabled, add Connection: close header
if (!address.getOption(HttpResourceAddress.KEEP_ALIVE)) {
connectSession.setWriteHeader(HEADER_CONNECTION, "close");
}
}
// Add Via: 1.1 kaazing + uuid header
connectSession.addWriteHeader(HEADER_VIA, viaHeader);
// Add forwarded headers
setupForwardedHeaders(acceptSession, connectSession);
} | [
"private",
"void",
"processRequestHeaders",
"(",
"HttpAcceptSession",
"acceptSession",
",",
"HttpConnectSession",
"connectSession",
")",
"{",
"boolean",
"upgrade",
"=",
"processHopByHopHeaders",
"(",
"acceptSession",
",",
"connectSession",
")",
";",
"// Add Connection: upgr... | /*
Write all (except hop-by-hop) request headers from accept session to connect session. If the request is an
upgrade one, let the Upgrade header go through as this service supports upgrade | [
"/",
"*",
"Write",
"all",
"(",
"except",
"hop",
"-",
"by",
"-",
"hop",
")",
"request",
"headers",
"from",
"accept",
"session",
"to",
"connect",
"session",
".",
"If",
"the",
"request",
"is",
"an",
"upgrade",
"one",
"let",
"the",
"Upgrade",
"header",
"go... | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.proxy/src/main/java/org/kaazing/gateway/service/http/proxy/HttpProxyServiceHandler.java#L468-L488 |
OpenTSDB/opentsdb | src/tsd/client/QueryUi.java | QueryUi.setOffsetWidth | private static void setOffsetWidth(final Widget widget, int width) {
widget.setWidth(width + "px");
final int offset = widget.getOffsetWidth();
if (offset > 0) {
width -= offset - width;
if (width > 0) {
widget.setWidth(width + "px");
}
}
} | java | private static void setOffsetWidth(final Widget widget, int width) {
widget.setWidth(width + "px");
final int offset = widget.getOffsetWidth();
if (offset > 0) {
width -= offset - width;
if (width > 0) {
widget.setWidth(width + "px");
}
}
} | [
"private",
"static",
"void",
"setOffsetWidth",
"(",
"final",
"Widget",
"widget",
",",
"int",
"width",
")",
"{",
"widget",
".",
"setWidth",
"(",
"width",
"+",
"\"px\"",
")",
";",
"final",
"int",
"offset",
"=",
"widget",
".",
"getOffsetWidth",
"(",
")",
";... | Properly sets the total width of a widget.
This takes into account decorations such as border, margin, and padding. | [
"Properly",
"sets",
"the",
"total",
"width",
"of",
"a",
"widget",
".",
"This",
"takes",
"into",
"account",
"decorations",
"such",
"as",
"border",
"margin",
"and",
"padding",
"."
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/client/QueryUi.java#L1413-L1422 |
vvakame/JsonPullParser | jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java | JsonUtil.putStringList | public static void putStringList(Writer writer, List<String> values) throws IOException {
if (values == null) {
writer.write("null");
} else {
startArray(writer);
for (int i = 0; i < values.size(); i++) {
put(writer, values.get(i));
if (i != values.size() - 1) {
addSeparator(writer);
}
}
endArray(writer);
}
} | java | public static void putStringList(Writer writer, List<String> values) throws IOException {
if (values == null) {
writer.write("null");
} else {
startArray(writer);
for (int i = 0; i < values.size(); i++) {
put(writer, values.get(i));
if (i != values.size() - 1) {
addSeparator(writer);
}
}
endArray(writer);
}
} | [
"public",
"static",
"void",
"putStringList",
"(",
"Writer",
"writer",
",",
"List",
"<",
"String",
">",
"values",
")",
"throws",
"IOException",
"{",
"if",
"(",
"values",
"==",
"null",
")",
"{",
"writer",
".",
"write",
"(",
"\"null\"",
")",
";",
"}",
"el... | Writes the given value with the given writer, sanitizing with {@link #sanitize(String)} as a valid JSON-formatted data.
@param writer
@param values
@throws IOException
@author vvakame | [
"Writes",
"the",
"given",
"value",
"with",
"the",
"given",
"writer",
"sanitizing",
"with",
"{"
] | train | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java#L160-L173 |
geomajas/geomajas-project-server | plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/PdfContext.java | PdfContext.translateRectangle | public void translateRectangle(Rectangle rect, float dx, float dy) {
float width = rect.getWidth();
float height = rect.getHeight();
rect.setLeft(rect.getLeft() + dx);
rect.setBottom(rect.getBottom() + dy);
rect.setRight(rect.getLeft() + dx + width);
rect.setTop(rect.getBottom() + dy + height);
} | java | public void translateRectangle(Rectangle rect, float dx, float dy) {
float width = rect.getWidth();
float height = rect.getHeight();
rect.setLeft(rect.getLeft() + dx);
rect.setBottom(rect.getBottom() + dy);
rect.setRight(rect.getLeft() + dx + width);
rect.setTop(rect.getBottom() + dy + height);
} | [
"public",
"void",
"translateRectangle",
"(",
"Rectangle",
"rect",
",",
"float",
"dx",
",",
"float",
"dy",
")",
"{",
"float",
"width",
"=",
"rect",
".",
"getWidth",
"(",
")",
";",
"float",
"height",
"=",
"rect",
".",
"getHeight",
"(",
")",
";",
"rect",
... | Translate this rectangle over the specified following distances.
@param rect rectangle to move
@param dx delta x
@param dy delta y | [
"Translate",
"this",
"rectangle",
"over",
"the",
"specified",
"following",
"distances",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/PdfContext.java#L318-L325 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/protocol/CommandArgsAccessor.java | CommandArgsAccessor.encodeFirstKey | @SuppressWarnings("unchecked")
public static <K, V> ByteBuffer encodeFirstKey(CommandArgs<K, V> commandArgs) {
for (SingularArgument singularArgument : commandArgs.singularArguments) {
if (singularArgument instanceof CommandArgs.KeyArgument) {
return commandArgs.codec.encodeKey(((CommandArgs.KeyArgument<K, V>) singularArgument).key);
}
}
return null;
} | java | @SuppressWarnings("unchecked")
public static <K, V> ByteBuffer encodeFirstKey(CommandArgs<K, V> commandArgs) {
for (SingularArgument singularArgument : commandArgs.singularArguments) {
if (singularArgument instanceof CommandArgs.KeyArgument) {
return commandArgs.codec.encodeKey(((CommandArgs.KeyArgument<K, V>) singularArgument).key);
}
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"K",
",",
"V",
">",
"ByteBuffer",
"encodeFirstKey",
"(",
"CommandArgs",
"<",
"K",
",",
"V",
">",
"commandArgs",
")",
"{",
"for",
"(",
"SingularArgument",
"singularArgument",
":",
"c... | Get the first encoded key for cluster command routing.
@param commandArgs must not be null.
@return the first encoded key or {@literal null}. | [
"Get",
"the",
"first",
"encoded",
"key",
"for",
"cluster",
"command",
"routing",
"."
] | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/protocol/CommandArgsAccessor.java#L39-L50 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/tenant/TenantService.java | TenantService.modifyTenantProperties | private void modifyTenantProperties(TenantDefinition oldTenantDef, TenantDefinition newTenantDef) {
// _CreatedOn must be the same. _ModifiedOn must be updated.
newTenantDef.setProperty(CREATED_ON_PROP, oldTenantDef.getProperty(CREATED_ON_PROP));
newTenantDef.setProperty(MODIFIED_ON_PROP, Utils.formatDate(new Date().getTime()));
} | java | private void modifyTenantProperties(TenantDefinition oldTenantDef, TenantDefinition newTenantDef) {
// _CreatedOn must be the same. _ModifiedOn must be updated.
newTenantDef.setProperty(CREATED_ON_PROP, oldTenantDef.getProperty(CREATED_ON_PROP));
newTenantDef.setProperty(MODIFIED_ON_PROP, Utils.formatDate(new Date().getTime()));
} | [
"private",
"void",
"modifyTenantProperties",
"(",
"TenantDefinition",
"oldTenantDef",
",",
"TenantDefinition",
"newTenantDef",
")",
"{",
"// _CreatedOn must be the same. _ModifiedOn must be updated.",
"newTenantDef",
".",
"setProperty",
"(",
"CREATED_ON_PROP",
",",
"oldTenantDef"... | Set required properties in a new Tenant Definition.
@param oldTenantDef Old {@link TenantDefinition}.
@param newTenantDef New {@link TenantDefinition}. | [
"Set",
"required",
"properties",
"in",
"a",
"new",
"Tenant",
"Definition",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/tenant/TenantService.java#L396-L400 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/HBCIUtils.java | HBCIUtils.checkAccountCRC | public static boolean checkAccountCRC(String blz, String number) {
BankInfo info = getBankInfo(blz);
String alg = info != null ? info.getChecksumMethod() : null;
// Im Zweifel lassen wir die Bankverbindung lieber durch
if (alg == null || alg.length() != 2) {
LoggerFactory.getLogger(HBCIUtils.class).warn("no crc information about " + blz + " in database");
return true;
}
LoggerFactory.getLogger(HBCIUtils.class).debug("crc-checking " + blz + "/" + number);
return checkAccountCRCByAlg(alg, blz, number);
} | java | public static boolean checkAccountCRC(String blz, String number) {
BankInfo info = getBankInfo(blz);
String alg = info != null ? info.getChecksumMethod() : null;
// Im Zweifel lassen wir die Bankverbindung lieber durch
if (alg == null || alg.length() != 2) {
LoggerFactory.getLogger(HBCIUtils.class).warn("no crc information about " + blz + " in database");
return true;
}
LoggerFactory.getLogger(HBCIUtils.class).debug("crc-checking " + blz + "/" + number);
return checkAccountCRCByAlg(alg, blz, number);
} | [
"public",
"static",
"boolean",
"checkAccountCRC",
"(",
"String",
"blz",
",",
"String",
"number",
")",
"{",
"BankInfo",
"info",
"=",
"getBankInfo",
"(",
"blz",
")",
";",
"String",
"alg",
"=",
"info",
"!=",
"null",
"?",
"info",
".",
"getChecksumMethod",
"(",... | <p>Überprüft, ob gegebene BLZ und Kontonummer zueinander passen.
Bei diesem Test wird wird die in die Kontonummer "eingebaute"
Prüziffer verifiziert. Anhand der BLZ wird ermittelt, welches
Prüfzifferverfahren zur Überprüfung eingesetzt werden muss.</p>
<p>Ein positives Ergebnis dieser Routine bedeutet <em>nicht</em>, dass das
entsprechende Konto bei der Bank <em>existiert</em>, sondern nur, dass
die Kontonummer bei der entsprechenden Bank prinzipiell gültig ist.</p>
@param blz die Bankleitzahl der Bank, bei der das Konto geführt wird
@param number die zu überprüfende Kontonummer
@return <code>true</code> wenn die Kontonummer nicht verifiziert werden kann (z.B.
weil das jeweilige Prüfzifferverfahren noch nicht in <em>HBCI4Java</em>
implementiert ist) oder wenn die Prüfung erfolgreich verläuft; <code>false</code>
wird immer nur dann zurückgegeben, wenn tatsächlich ein Prüfzifferverfahren
zum Überprüfen verwendet wurde und die Prüfung einen Fehler ergab | [
"<p",
">",
"Überprüft",
"ob",
"gegebene",
"BLZ",
"und",
"Kontonummer",
"zueinander",
"passen",
".",
"Bei",
"diesem",
"Test",
"wird",
"wird",
"die",
"in",
"die",
"Kontonummer",
"eingebaute",
"Prüziffer",
"verifiziert",
".",
"Anhand",
"der",
"BLZ",
"wird",
"ermi... | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/HBCIUtils.java#L550-L562 |
hawkular/hawkular-apm | client/collector/src/main/java/org/hawkular/apm/client/collector/internal/FragmentBuilder.java | FragmentBuilder.popNode | protected Node popNode(Stack<Node> stack, Class<? extends Node> cls, String uri) {
Node top = stack.isEmpty() ? null : stack.peek();
if (top != null) {
if (nodeMatches(top, cls, uri)) {
Node node = stack.pop();
poppedNodes.push(node);
return node;
} else {
// Scan for potential match, from -2 so don't repeat
// check of top node
for (int i = stack.size() - 2; i >= 0; i--) {
if (nodeMatches(stack.get(i), cls, uri)) {
Node node = stack.remove(i);
poppedNodes.push(node);
return node;
}
}
}
}
return null;
} | java | protected Node popNode(Stack<Node> stack, Class<? extends Node> cls, String uri) {
Node top = stack.isEmpty() ? null : stack.peek();
if (top != null) {
if (nodeMatches(top, cls, uri)) {
Node node = stack.pop();
poppedNodes.push(node);
return node;
} else {
// Scan for potential match, from -2 so don't repeat
// check of top node
for (int i = stack.size() - 2; i >= 0; i--) {
if (nodeMatches(stack.get(i), cls, uri)) {
Node node = stack.remove(i);
poppedNodes.push(node);
return node;
}
}
}
}
return null;
} | [
"protected",
"Node",
"popNode",
"(",
"Stack",
"<",
"Node",
">",
"stack",
",",
"Class",
"<",
"?",
"extends",
"Node",
">",
"cls",
",",
"String",
"uri",
")",
"{",
"Node",
"top",
"=",
"stack",
".",
"isEmpty",
"(",
")",
"?",
"null",
":",
"stack",
".",
... | This method pops a node of the defined class and optional uri from the stack.
If the uri is not defined, then the latest node of the approach class will
be chosen.
@param stack The stack
@param cls The node type
@param uri The optional uri to match
@return The node, or null if no suitable candidate is found | [
"This",
"method",
"pops",
"a",
"node",
"of",
"the",
"defined",
"class",
"and",
"optional",
"uri",
"from",
"the",
"stack",
".",
"If",
"the",
"uri",
"is",
"not",
"defined",
"then",
"the",
"latest",
"node",
"of",
"the",
"approach",
"class",
"will",
"be",
... | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/collector/src/main/java/org/hawkular/apm/client/collector/internal/FragmentBuilder.java#L315-L337 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/util/StringUtils.java | StringUtils.addEnd | public static String addEnd(String str, String add) {
if (isNullOrEmpty(add)) {
return str;
}
if (isNullOrEmpty(str)) {
return add;
}
if (!str.endsWith(add)) {
return str + add;
}
return str;
} | java | public static String addEnd(String str, String add) {
if (isNullOrEmpty(add)) {
return str;
}
if (isNullOrEmpty(str)) {
return add;
}
if (!str.endsWith(add)) {
return str + add;
}
return str;
} | [
"public",
"static",
"String",
"addEnd",
"(",
"String",
"str",
",",
"String",
"add",
")",
"{",
"if",
"(",
"isNullOrEmpty",
"(",
"add",
")",
")",
"{",
"return",
"str",
";",
"}",
"if",
"(",
"isNullOrEmpty",
"(",
"str",
")",
")",
"{",
"return",
"add",
... | <p>Adds a substring only if the source string does not already end with the substring,
otherwise returns the source string.</p>
<p/>
<p>A {@code null} source string will return {@code null}.
An empty ("") source string will return the empty string.
A {@code null} search string will return the source string.</p>
<p/>
<pre>
StringUtils.addEnd(null, *) = *
StringUtils.addEnd("", *) = *
StringUtils.addEnd(*, null) = *
StringUtils.addEnd("www.", "domain.com") = "www.domain.com"
StringUtils.addEnd("123abc", "abc") = "123abc"
</pre>
@param str the source String to search, may be null
@param add the String to search for and add, may be null
@return the substring with the string added if required | [
"<p",
">",
"Adds",
"a",
"substring",
"only",
"if",
"the",
"source",
"string",
"does",
"not",
"already",
"end",
"with",
"the",
"substring",
"otherwise",
"returns",
"the",
"source",
"string",
".",
"<",
"/",
"p",
">",
"<p",
"/",
">",
"<p",
">",
"A",
"{"... | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/util/StringUtils.java#L179-L193 |
chrisjenx/Calligraphy | calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java | CalligraphyUtils.pullFontPathFromTextAppearance | static String pullFontPathFromTextAppearance(final Context context, AttributeSet attrs, int[] attributeId) {
if (attributeId == null || attrs == null) {
return null;
}
int textAppearanceId = -1;
final TypedArray typedArrayAttr = context.obtainStyledAttributes(attrs, ANDROID_ATTR_TEXT_APPEARANCE);
if (typedArrayAttr != null) {
try {
textAppearanceId = typedArrayAttr.getResourceId(0, -1);
} catch (Exception ignored) {
// Failed for some reason
return null;
} finally {
typedArrayAttr.recycle();
}
}
final TypedArray textAppearanceAttrs = context.obtainStyledAttributes(textAppearanceId, attributeId);
if (textAppearanceAttrs != null) {
try {
return textAppearanceAttrs.getString(0);
} catch (Exception ignore) {
// Failed for some reason.
return null;
} finally {
textAppearanceAttrs.recycle();
}
}
return null;
} | java | static String pullFontPathFromTextAppearance(final Context context, AttributeSet attrs, int[] attributeId) {
if (attributeId == null || attrs == null) {
return null;
}
int textAppearanceId = -1;
final TypedArray typedArrayAttr = context.obtainStyledAttributes(attrs, ANDROID_ATTR_TEXT_APPEARANCE);
if (typedArrayAttr != null) {
try {
textAppearanceId = typedArrayAttr.getResourceId(0, -1);
} catch (Exception ignored) {
// Failed for some reason
return null;
} finally {
typedArrayAttr.recycle();
}
}
final TypedArray textAppearanceAttrs = context.obtainStyledAttributes(textAppearanceId, attributeId);
if (textAppearanceAttrs != null) {
try {
return textAppearanceAttrs.getString(0);
} catch (Exception ignore) {
// Failed for some reason.
return null;
} finally {
textAppearanceAttrs.recycle();
}
}
return null;
} | [
"static",
"String",
"pullFontPathFromTextAppearance",
"(",
"final",
"Context",
"context",
",",
"AttributeSet",
"attrs",
",",
"int",
"[",
"]",
"attributeId",
")",
"{",
"if",
"(",
"attributeId",
"==",
"null",
"||",
"attrs",
"==",
"null",
")",
"{",
"return",
"n... | Tries to pull the Font Path from the Text Appearance.
@param context Activity Context
@param attrs View Attributes
@param attributeId if -1 returns null.
@return returns null if attribute is not defined or if no TextAppearance is found. | [
"Tries",
"to",
"pull",
"the",
"Font",
"Path",
"from",
"the",
"Text",
"Appearance",
"."
] | train | https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java#L212-L242 |
dita-ot/dita-ot | src/main/java/org/dita/dost/writer/KeyrefPaser.java | KeyrefPaser.normalizeHrefValue | private static URI normalizeHrefValue(final URI keyName, final String tail) {
if (keyName.getFragment() == null) {
return toURI(keyName + tail.replaceAll(SLASH, SHARP));
}
return toURI(keyName + tail);
} | java | private static URI normalizeHrefValue(final URI keyName, final String tail) {
if (keyName.getFragment() == null) {
return toURI(keyName + tail.replaceAll(SLASH, SHARP));
}
return toURI(keyName + tail);
} | [
"private",
"static",
"URI",
"normalizeHrefValue",
"(",
"final",
"URI",
"keyName",
",",
"final",
"String",
"tail",
")",
"{",
"if",
"(",
"keyName",
".",
"getFragment",
"(",
")",
"==",
"null",
")",
"{",
"return",
"toURI",
"(",
"keyName",
"+",
"tail",
".",
... | change elementId into topicId if there is no topicId in key definition. | [
"change",
"elementId",
"into",
"topicId",
"if",
"there",
"is",
"no",
"topicId",
"in",
"key",
"definition",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/writer/KeyrefPaser.java#L735-L740 |
jboss/jboss-jstl-api_spec | src/main/java/javax/servlet/jsp/jstl/fmt/LocaleSupport.java | LocaleSupport.getLocalizedMessage | public static String getLocalizedMessage(PageContext pageContext,
String key) {
return getLocalizedMessage(pageContext, key, null, null);
} | java | public static String getLocalizedMessage(PageContext pageContext,
String key) {
return getLocalizedMessage(pageContext, key, null, null);
} | [
"public",
"static",
"String",
"getLocalizedMessage",
"(",
"PageContext",
"pageContext",
",",
"String",
"key",
")",
"{",
"return",
"getLocalizedMessage",
"(",
"pageContext",
",",
"key",
",",
"null",
",",
"null",
")",
";",
"}"
] | Retrieves the localized message corresponding to the given key.
<p> The given key is looked up in the resource bundle of the default
I18N localization context, which is retrieved from the
<tt>javax.servlet.jsp.jstl.fmt.localizationContext</tt> configuration
setting.
<p> If the configuration setting is empty, or the default I18N
localization context does not contain any resource bundle, or the given
key is undefined in its resource bundle, the string "???<key>???" is
returned, where "<key>" is replaced with the given key.
@param pageContext the page in which to get the localized message
corresponding to the given key
@param key the message key
@return the localized message corresponding to the given key | [
"Retrieves",
"the",
"localized",
"message",
"corresponding",
"to",
"the",
"given",
"key",
".",
"<p",
">",
"The",
"given",
"key",
"is",
"looked",
"up",
"in",
"the",
"resource",
"bundle",
"of",
"the",
"default",
"I18N",
"localization",
"context",
"which",
"is"... | train | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/javax/servlet/jsp/jstl/fmt/LocaleSupport.java#L55-L58 |
google/jimfs | jimfs/src/main/java/com/google/common/jimfs/AttributeProvider.java | AttributeProvider.unsettable | protected static RuntimeException unsettable(String view, String attribute, boolean create) {
// This matches the behavior of the real file system implementations: if the attempt to set the
// attribute is being made during file creation, throw UOE even though the attribute is one
// that cannot be set under any circumstances
checkNotCreate(view, attribute, create);
throw new IllegalArgumentException("cannot set attribute '" + view + ":" + attribute + "'");
} | java | protected static RuntimeException unsettable(String view, String attribute, boolean create) {
// This matches the behavior of the real file system implementations: if the attempt to set the
// attribute is being made during file creation, throw UOE even though the attribute is one
// that cannot be set under any circumstances
checkNotCreate(view, attribute, create);
throw new IllegalArgumentException("cannot set attribute '" + view + ":" + attribute + "'");
} | [
"protected",
"static",
"RuntimeException",
"unsettable",
"(",
"String",
"view",
",",
"String",
"attribute",
",",
"boolean",
"create",
")",
"{",
"// This matches the behavior of the real file system implementations: if the attempt to set the",
"// attribute is being made during file c... | Throws a runtime exception indicating that the given attribute cannot be set. | [
"Throws",
"a",
"runtime",
"exception",
"indicating",
"that",
"the",
"given",
"attribute",
"cannot",
"be",
"set",
"."
] | train | https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/AttributeProvider.java#L129-L135 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/LocaleData.java | LocaleData.getInteger | public static final Integer getInteger(Locale locale, String key)
{
ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale);
return ((Integer) bundle.getObject(key));
} | java | public static final Integer getInteger(Locale locale, String key)
{
ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale);
return ((Integer) bundle.getObject(key));
} | [
"public",
"static",
"final",
"Integer",
"getInteger",
"(",
"Locale",
"locale",
",",
"String",
"key",
")",
"{",
"ResourceBundle",
"bundle",
"=",
"ResourceBundle",
".",
"getBundle",
"(",
"LocaleData",
".",
"class",
".",
"getName",
"(",
")",
",",
"locale",
")",... | Convenience method for retrieving an Integer resource.
@param locale locale identifier
@param key resource key
@return resource value | [
"Convenience",
"method",
"for",
"retrieving",
"an",
"Integer",
"resource",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/LocaleData.java#L125-L129 |
anotheria/moskito | moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/parser/StatusData.java | StatusData.put | public void put(T key, Object value) {
data.put(key, ensureValueCorrectness(key, value));
} | java | public void put(T key, Object value) {
data.put(key, ensureValueCorrectness(key, value));
} | [
"public",
"void",
"put",
"(",
"T",
"key",
",",
"Object",
"value",
")",
"{",
"data",
".",
"put",
"(",
"key",
",",
"ensureValueCorrectness",
"(",
"key",
",",
"value",
")",
")",
";",
"}"
] | Stores given key-value mapping if no restrictions are violated by them.
@param key mapping key.
@param value mapping value.
@throws IllegalArgumentException if the given key is {@code null} or if value is neither of correct type nor of String type. | [
"Stores",
"given",
"key",
"-",
"value",
"mapping",
"if",
"no",
"restrictions",
"are",
"violated",
"by",
"them",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/parser/StatusData.java#L31-L33 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/CompositeDialogPage.java | CompositeDialogPage.decoratePageTitle | protected String decoratePageTitle(DialogPage page, String title) {
return LabelUtils.htmlBlock("<center>" + title + "<sup><font size=-3 color=red>"
+ (page.isPageComplete() ? "" : "*"));
} | java | protected String decoratePageTitle(DialogPage page, String title) {
return LabelUtils.htmlBlock("<center>" + title + "<sup><font size=-3 color=red>"
+ (page.isPageComplete() ? "" : "*"));
} | [
"protected",
"String",
"decoratePageTitle",
"(",
"DialogPage",
"page",
",",
"String",
"title",
")",
"{",
"return",
"LabelUtils",
".",
"htmlBlock",
"(",
"\"<center>\"",
"+",
"title",
"+",
"\"<sup><font size=-3 color=red>\"",
"+",
"(",
"page",
".",
"isPageComplete",
... | Decorates the page title of the given <code>DialogPage</code>.
<p>
Can be overridden to provide additional decorations.
<p>
The default implementation returns a html with an indication whether the
page is complete or incomplete
@param page the page
@param title the title
@return the decorated page title | [
"Decorates",
"the",
"page",
"title",
"of",
"the",
"given",
"<code",
">",
"DialogPage<",
"/",
"code",
">",
".",
"<p",
">",
"Can",
"be",
"overridden",
"to",
"provide",
"additional",
"decorations",
".",
"<p",
">",
"The",
"default",
"implementation",
"returns",
... | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/CompositeDialogPage.java#L285-L288 |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getSummonerSpellListDro | public Future<SummonerSpellList> getSummonerSpellListDro(SpellData data, String version, String locale, boolean dataById) {
return new DummyFuture<>(handler.getSummonerSpellListDro(data, version, locale, dataById));
} | java | public Future<SummonerSpellList> getSummonerSpellListDro(SpellData data, String version, String locale, boolean dataById) {
return new DummyFuture<>(handler.getSummonerSpellListDro(data, version, locale, dataById));
} | [
"public",
"Future",
"<",
"SummonerSpellList",
">",
"getSummonerSpellListDro",
"(",
"SpellData",
"data",
",",
"String",
"version",
",",
"String",
"locale",
",",
"boolean",
"dataById",
")",
"{",
"return",
"new",
"DummyFuture",
"<>",
"(",
"handler",
".",
"getSummon... | <p>
Get a list of all summoner spells as returned by the API
</p>
This method does not count towards the rate limit and is not affected by the throttle
@param data Additional information to retrieve
@param version Data dragon version for returned data
@param locale Locale code for returned data
@param dataById If specified as true, the returned data map will use the spells' IDs as the keys.
@return The summoner spells
@see <a href=https://developer.riotgames.com/api/methods#!/649/2174>Official API documentation</a> | [
"<p",
">",
"Get",
"a",
"list",
"of",
"all",
"summoner",
"spells",
"as",
"returned",
"by",
"the",
"API",
"<",
"/",
"p",
">",
"This",
"method",
"does",
"not",
"count",
"towards",
"the",
"rate",
"limit",
"and",
"is",
"not",
"affected",
"by",
"the",
"thr... | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L741-L743 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java | Client.buildRMST | @SuppressWarnings("WeakerAccess")
public NumberField buildRMST(Message.MenuIdentifier targetMenu, CdjStatus.TrackSourceSlot slot,
CdjStatus.TrackType trackType) {
return buildRMST(posingAsPlayer, targetMenu, slot, trackType);
} | java | @SuppressWarnings("WeakerAccess")
public NumberField buildRMST(Message.MenuIdentifier targetMenu, CdjStatus.TrackSourceSlot slot,
CdjStatus.TrackType trackType) {
return buildRMST(posingAsPlayer, targetMenu, slot, trackType);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"NumberField",
"buildRMST",
"(",
"Message",
".",
"MenuIdentifier",
"targetMenu",
",",
"CdjStatus",
".",
"TrackSourceSlot",
"slot",
",",
"CdjStatus",
".",
"TrackType",
"trackType",
")",
"{",
"return",
... | <p>Build the <em>R:M:S:T</em> parameter that begins many queries.</p>
<p>Many request messages take, as their first argument, a 4-byte value where each byte has a special meaning.
The first byte is the player number of the requesting player. The second identifies the menu into which
the response is being loaded, as described by {@link Message.MenuIdentifier}. The third specifies the media
slot from which information is desired, as described by {@link CdjStatus.TrackSourceSlot}, and the fourth
byte identifies the type of track about which information is being requested; in most requests this has the
value 1, which corresponds to rekordbox tracks.</p>
@param targetMenu the destination for the response to this query
@param slot the media library of interest for this query
@param trackType the type of track about which information is being requested
@return the first argument to send with the query in order to obtain the desired information | [
"<p",
">",
"Build",
"the",
"<em",
">",
"R",
":",
"M",
":",
"S",
":",
"T<",
"/",
"em",
">",
"parameter",
"that",
"begins",
"many",
"queries",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java#L328-L332 |
netplex/json-smart-v2 | json-smart/src/main/java/net/minidev/json/JSONObject.java | JSONObject.toJSONString | public static String toJSONString(Map<String, ? extends Object> map, JSONStyle compression) {
StringBuilder sb = new StringBuilder();
try {
writeJSON(map, sb, compression);
} catch (IOException e) {
// can not append on a StringBuilder
}
return sb.toString();
} | java | public static String toJSONString(Map<String, ? extends Object> map, JSONStyle compression) {
StringBuilder sb = new StringBuilder();
try {
writeJSON(map, sb, compression);
} catch (IOException e) {
// can not append on a StringBuilder
}
return sb.toString();
} | [
"public",
"static",
"String",
"toJSONString",
"(",
"Map",
"<",
"String",
",",
"?",
"extends",
"Object",
">",
"map",
",",
"JSONStyle",
"compression",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"try",
"{",
"writeJSON",
"(",
... | Convert a map to JSON text. The result is a JSON object. If this map is
also a JSONAware, JSONAware specific behaviours will be omitted at this
top level.
@see net.minidev.json.JSONValue#toJSONString(Object)
@param map
@return JSON text, or "null" if map is null. | [
"Convert",
"a",
"map",
"to",
"JSON",
"text",
".",
"The",
"result",
"is",
"a",
"JSON",
"object",
".",
"If",
"this",
"map",
"is",
"also",
"a",
"JSONAware",
"JSONAware",
"specific",
"behaviours",
"will",
"be",
"omitted",
"at",
"this",
"top",
"level",
"."
] | train | https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/JSONObject.java#L71-L79 |
Netflix/Nicobar | nicobar-core/src/main/java/com/netflix/nicobar/core/utils/ClassPathUtils.java | ClassPathUtils.getJarPathFromUrl | public static Path getJarPathFromUrl(URL jarUrl) {
try {
String pathString = jarUrl.getPath();
// for Jar URL, the path is in the form of: file:/path/to/groovy/myJar.jar!/path/to/resource/myResource.txt
int endIndex = pathString.lastIndexOf("!");
return Paths.get(new URI(pathString.substring(0, endIndex)));
} catch (URISyntaxException e) {
throw new IllegalStateException("Unsupported URL syntax: " + jarUrl.getPath(), e);
}
} | java | public static Path getJarPathFromUrl(URL jarUrl) {
try {
String pathString = jarUrl.getPath();
// for Jar URL, the path is in the form of: file:/path/to/groovy/myJar.jar!/path/to/resource/myResource.txt
int endIndex = pathString.lastIndexOf("!");
return Paths.get(new URI(pathString.substring(0, endIndex)));
} catch (URISyntaxException e) {
throw new IllegalStateException("Unsupported URL syntax: " + jarUrl.getPath(), e);
}
} | [
"public",
"static",
"Path",
"getJarPathFromUrl",
"(",
"URL",
"jarUrl",
")",
"{",
"try",
"{",
"String",
"pathString",
"=",
"jarUrl",
".",
"getPath",
"(",
")",
";",
"// for Jar URL, the path is in the form of: file:/path/to/groovy/myJar.jar!/path/to/resource/myResource.txt",
... | Find the jar containing the given resource.
@param jarUrl URL that came from a jar that needs to be parsed
@return {@link Path} to the Jar containing the resource. | [
"Find",
"the",
"jar",
"containing",
"the",
"given",
"resource",
"."
] | train | https://github.com/Netflix/Nicobar/blob/507173dcae4a86a955afc3df222a855862fab8d7/nicobar-core/src/main/java/com/netflix/nicobar/core/utils/ClassPathUtils.java#L120-L129 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/BidiLine.java | BidiLine.getSingleRun | static void getSingleRun(Bidi bidi, byte level) {
/* simple, single-run case */
bidi.runs = bidi.simpleRuns;
bidi.runCount = 1;
/* fill and reorder the single run */
bidi.runs[0] = new BidiRun(0, bidi.length, level);
} | java | static void getSingleRun(Bidi bidi, byte level) {
/* simple, single-run case */
bidi.runs = bidi.simpleRuns;
bidi.runCount = 1;
/* fill and reorder the single run */
bidi.runs[0] = new BidiRun(0, bidi.length, level);
} | [
"static",
"void",
"getSingleRun",
"(",
"Bidi",
"bidi",
",",
"byte",
"level",
")",
"{",
"/* simple, single-run case */",
"bidi",
".",
"runs",
"=",
"bidi",
".",
"simpleRuns",
";",
"bidi",
".",
"runCount",
"=",
"1",
";",
"/* fill and reorder the single run */",
"bi... | /* in trivial cases there is only one trivial run; called by getRuns() | [
"/",
"*",
"in",
"trivial",
"cases",
"there",
"is",
"only",
"one",
"trivial",
"run",
";",
"called",
"by",
"getRuns",
"()"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/BidiLine.java#L322-L329 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java | CmsCheckableDatePanel.setDatesWithCheckState | public void setDatesWithCheckState(Collection<CmsPair<Date, Boolean>> datesWithCheckInfo) {
SortedSet<Date> dates = new TreeSet<>();
m_checkBoxes.clear();
for (CmsPair<Date, Boolean> p : datesWithCheckInfo) {
addCheckBox(p.getFirst(), p.getSecond().booleanValue());
dates.add(p.getFirst());
}
reInitLayoutElements();
setDatesInternal(dates);
} | java | public void setDatesWithCheckState(Collection<CmsPair<Date, Boolean>> datesWithCheckInfo) {
SortedSet<Date> dates = new TreeSet<>();
m_checkBoxes.clear();
for (CmsPair<Date, Boolean> p : datesWithCheckInfo) {
addCheckBox(p.getFirst(), p.getSecond().booleanValue());
dates.add(p.getFirst());
}
reInitLayoutElements();
setDatesInternal(dates);
} | [
"public",
"void",
"setDatesWithCheckState",
"(",
"Collection",
"<",
"CmsPair",
"<",
"Date",
",",
"Boolean",
">",
">",
"datesWithCheckInfo",
")",
"{",
"SortedSet",
"<",
"Date",
">",
"dates",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"m_checkBoxes",
".",
"... | Set dates with the provided check states.
@param datesWithCheckInfo the dates to set, accompanied with the check state to set. | [
"Set",
"dates",
"with",
"the",
"provided",
"check",
"states",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java#L255-L265 |
classgraph/classgraph | src/main/java/nonapi/io/github/classgraph/utils/FileUtils.java | FileUtils.closeDirectByteBuffer | public static boolean closeDirectByteBuffer(final ByteBuffer byteBuffer, final LogNode log) {
if (byteBuffer != null && byteBuffer.isDirect()) {
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
@Override
public Boolean run() {
return closeDirectByteBufferPrivileged(byteBuffer, log);
}
});
} else {
// Nothing to unmap
return false;
}
} | java | public static boolean closeDirectByteBuffer(final ByteBuffer byteBuffer, final LogNode log) {
if (byteBuffer != null && byteBuffer.isDirect()) {
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
@Override
public Boolean run() {
return closeDirectByteBufferPrivileged(byteBuffer, log);
}
});
} else {
// Nothing to unmap
return false;
}
} | [
"public",
"static",
"boolean",
"closeDirectByteBuffer",
"(",
"final",
"ByteBuffer",
"byteBuffer",
",",
"final",
"LogNode",
"log",
")",
"{",
"if",
"(",
"byteBuffer",
"!=",
"null",
"&&",
"byteBuffer",
".",
"isDirect",
"(",
")",
")",
"{",
"return",
"AccessControl... | Close a {@code DirectByteBuffer} -- in particular, will unmap a {@link MappedByteBuffer}.
@param byteBuffer
The {@link ByteBuffer} to close/unmap.
@param log
The log.
@return True if the byteBuffer was closed/unmapped. | [
"Close",
"a",
"{",
"@code",
"DirectByteBuffer",
"}",
"--",
"in",
"particular",
"will",
"unmap",
"a",
"{",
"@link",
"MappedByteBuffer",
"}",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/utils/FileUtils.java#L606-L618 |
grails/grails-core | grails-core/src/main/groovy/grails/core/DefaultGrailsApplication.java | DefaultGrailsApplication.getArtefact | public GrailsClass getArtefact(String artefactType, String name) {
ArtefactInfo info = getArtefactInfo(artefactType);
return info == null ? null : info.getGrailsClass(name);
} | java | public GrailsClass getArtefact(String artefactType, String name) {
ArtefactInfo info = getArtefactInfo(artefactType);
return info == null ? null : info.getGrailsClass(name);
} | [
"public",
"GrailsClass",
"getArtefact",
"(",
"String",
"artefactType",
",",
"String",
"name",
")",
"{",
"ArtefactInfo",
"info",
"=",
"getArtefactInfo",
"(",
"artefactType",
")",
";",
"return",
"info",
"==",
"null",
"?",
"null",
":",
"info",
".",
"getGrailsClas... | Retrieves an artefact for the given type and name.
@param artefactType The artefact type as defined by a registered ArtefactHandler
@param name The name of the class
@return A GrailsClass instance or null if none could be found for the given artefactType and name | [
"Retrieves",
"an",
"artefact",
"for",
"the",
"given",
"type",
"and",
"name",
"."
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/core/DefaultGrailsApplication.java#L464-L467 |
powermock/powermock | powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java | PowerMock.createNiceMock | public static synchronized <T> T createNiceMock(Class<T> type) {
return doMock(type, false, new NiceMockStrategy(), null, (Method[]) null);
} | java | public static synchronized <T> T createNiceMock(Class<T> type) {
return doMock(type, false, new NiceMockStrategy(), null, (Method[]) null);
} | [
"public",
"static",
"synchronized",
"<",
"T",
">",
"T",
"createNiceMock",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"doMock",
"(",
"type",
",",
"false",
",",
"new",
"NiceMockStrategy",
"(",
")",
",",
"null",
",",
"(",
"Method",
"[",
"]... | Creates a nice mock object that supports mocking of final and native
methods.
@param <T> the type of the mock object
@param type the type of the mock object
@return the mock object. | [
"Creates",
"a",
"nice",
"mock",
"object",
"that",
"supports",
"mocking",
"of",
"final",
"and",
"native",
"methods",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L175-L177 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/query/QueryImpl.java | QueryImpl.getEntityFieldValue | private Object getEntityFieldValue(EntityMetadata entityMetadata, Object entity, String field)
{
Class clazz = entityMetadata.getEntityClazz();
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
entityMetadata.getPersistenceUnit());
EntityType entityType = metaModel.entity(clazz);
if (field.indexOf(".") > 0 && entityMetadata.getEntityClazz().equals(entity.getClass()))
{
String fieldName = field.substring(field.indexOf(".") + 1, field.length());
Attribute attribute = entityType.getAttribute(fieldName);
return PropertyAccessorHelper.getObject(entity, (Field) attribute.getJavaMember());
}
else
{
// for hbase v2 client (sends arraylist for specific fields)
if (entity instanceof ArrayList)
{
Object element = ((ArrayList) entity).get(0);
((ArrayList) entity).remove(0);
return element;
}
else
{
return entity;
}
}
} | java | private Object getEntityFieldValue(EntityMetadata entityMetadata, Object entity, String field)
{
Class clazz = entityMetadata.getEntityClazz();
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
entityMetadata.getPersistenceUnit());
EntityType entityType = metaModel.entity(clazz);
if (field.indexOf(".") > 0 && entityMetadata.getEntityClazz().equals(entity.getClass()))
{
String fieldName = field.substring(field.indexOf(".") + 1, field.length());
Attribute attribute = entityType.getAttribute(fieldName);
return PropertyAccessorHelper.getObject(entity, (Field) attribute.getJavaMember());
}
else
{
// for hbase v2 client (sends arraylist for specific fields)
if (entity instanceof ArrayList)
{
Object element = ((ArrayList) entity).get(0);
((ArrayList) entity).remove(0);
return element;
}
else
{
return entity;
}
}
} | [
"private",
"Object",
"getEntityFieldValue",
"(",
"EntityMetadata",
"entityMetadata",
",",
"Object",
"entity",
",",
"String",
"field",
")",
"{",
"Class",
"clazz",
"=",
"entityMetadata",
".",
"getEntityClazz",
"(",
")",
";",
"MetamodelImpl",
"metaModel",
"=",
"(",
... | Gets the entity field value.
@param entityMetadata
the entity metadata
@param entity
the entity
@param field
the field
@return the entity field value | [
"Gets",
"the",
"entity",
"field",
"value",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/query/QueryImpl.java#L568-L595 |
vorburger/MariaDB4j | mariaDB4j-core/src/main/java/ch/vorburger/mariadb4j/DB.java | DB.unpackEmbeddedDb | protected void unpackEmbeddedDb() {
if (configuration.getBinariesClassPathLocation() == null) {
logger.info("Not unpacking any embedded database (as BinariesClassPathLocation configuration is null)");
return;
}
try {
Util.extractFromClasspathToFile(configuration.getBinariesClassPathLocation(), baseDir);
if (!configuration.isWindows()) {
Util.forceExecutable(newExecutableFile("bin", "my_print_defaults"));
Util.forceExecutable(newExecutableFile("bin", "mysql_install_db"));
Util.forceExecutable(newExecutableFile("scripts", "mysql_install_db"));
Util.forceExecutable(newExecutableFile("bin", "mysqld"));
Util.forceExecutable(newExecutableFile("bin", "mysqldump"));
Util.forceExecutable(newExecutableFile("bin", "mysql"));
}
} catch (IOException e) {
throw new RuntimeException("Error unpacking embedded DB", e);
}
} | java | protected void unpackEmbeddedDb() {
if (configuration.getBinariesClassPathLocation() == null) {
logger.info("Not unpacking any embedded database (as BinariesClassPathLocation configuration is null)");
return;
}
try {
Util.extractFromClasspathToFile(configuration.getBinariesClassPathLocation(), baseDir);
if (!configuration.isWindows()) {
Util.forceExecutable(newExecutableFile("bin", "my_print_defaults"));
Util.forceExecutable(newExecutableFile("bin", "mysql_install_db"));
Util.forceExecutable(newExecutableFile("scripts", "mysql_install_db"));
Util.forceExecutable(newExecutableFile("bin", "mysqld"));
Util.forceExecutable(newExecutableFile("bin", "mysqldump"));
Util.forceExecutable(newExecutableFile("bin", "mysql"));
}
} catch (IOException e) {
throw new RuntimeException("Error unpacking embedded DB", e);
}
} | [
"protected",
"void",
"unpackEmbeddedDb",
"(",
")",
"{",
"if",
"(",
"configuration",
".",
"getBinariesClassPathLocation",
"(",
")",
"==",
"null",
")",
"{",
"logger",
".",
"info",
"(",
"\"Not unpacking any embedded database (as BinariesClassPathLocation configuration is null)... | Based on the current OS, unpacks the appropriate version of MariaDB to the file system based
on the configuration. | [
"Based",
"on",
"the",
"current",
"OS",
"unpacks",
"the",
"appropriate",
"version",
"of",
"MariaDB",
"to",
"the",
"file",
"system",
"based",
"on",
"the",
"configuration",
"."
] | train | https://github.com/vorburger/MariaDB4j/blob/ddc7aa2a3294c9c56b1127de11949fb33a81ad7b/mariaDB4j-core/src/main/java/ch/vorburger/mariadb4j/DB.java#L349-L368 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java | ArgumentAttr.processArg | @SuppressWarnings("unchecked")
<T extends JCExpression, Z extends ArgumentType<T>> void processArg(T that, Supplier<Z> argumentTypeFactory) {
UniquePos pos = new UniquePos(that);
Z cached = (Z)argumentTypeCache.get(pos);
if (cached != null) {
//dup existing speculative type
setResult(that, cached.dup(that, env));
} else {
Z res = argumentTypeFactory.get();
argumentTypeCache.put(pos, res);
setResult(that, res);
}
} | java | @SuppressWarnings("unchecked")
<T extends JCExpression, Z extends ArgumentType<T>> void processArg(T that, Supplier<Z> argumentTypeFactory) {
UniquePos pos = new UniquePos(that);
Z cached = (Z)argumentTypeCache.get(pos);
if (cached != null) {
//dup existing speculative type
setResult(that, cached.dup(that, env));
} else {
Z res = argumentTypeFactory.get();
argumentTypeCache.put(pos, res);
setResult(that, res);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"<",
"T",
"extends",
"JCExpression",
",",
"Z",
"extends",
"ArgumentType",
"<",
"T",
">",
">",
"void",
"processArg",
"(",
"T",
"that",
",",
"Supplier",
"<",
"Z",
">",
"argumentTypeFactory",
")",
"{",
"Uniq... | Process a method argument; this method allows the caller to specify a custom speculative attribution
logic (this is used e.g. for lambdas). | [
"Process",
"a",
"method",
"argument",
";",
"this",
"method",
"allows",
"the",
"caller",
"to",
"specify",
"a",
"custom",
"speculative",
"attribution",
"logic",
"(",
"this",
"is",
"used",
"e",
".",
"g",
".",
"for",
"lambdas",
")",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java#L230-L242 |
JavaMoney/jsr354-api | src/main/java/javax/money/convert/MonetaryConversions.java | MonetaryConversions.getConversion | public static CurrencyConversion getConversion(String termCurrencyCode, String... providers){
Objects.requireNonNull(termCurrencyCode, "Term currency code may not be null");
return getConversion(Monetary.getCurrency(termCurrencyCode), providers);
} | java | public static CurrencyConversion getConversion(String termCurrencyCode, String... providers){
Objects.requireNonNull(termCurrencyCode, "Term currency code may not be null");
return getConversion(Monetary.getCurrency(termCurrencyCode), providers);
} | [
"public",
"static",
"CurrencyConversion",
"getConversion",
"(",
"String",
"termCurrencyCode",
",",
"String",
"...",
"providers",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"termCurrencyCode",
",",
"\"Term currency code may not be null\"",
")",
";",
"return",
"getC... | Access an instance of {@link CurrencyConversion} for the given providers.
Use {@link #getConversionProviderNames()}} to check, which are available.
@param termCurrencyCode the terminating or target currency code, not {@code null}
@param providers Additional providers, for building a provider chain
@return the exchange rate type if this instance.
@throws MonetaryException if no such {@link ExchangeRateProvider} is available or if no {@link CurrencyUnit} was
matching the given currency code. | [
"Access",
"an",
"instance",
"of",
"{",
"@link",
"CurrencyConversion",
"}",
"for",
"the",
"given",
"providers",
".",
"Use",
"{",
"@link",
"#getConversionProviderNames",
"()",
"}}",
"to",
"check",
"which",
"are",
"available",
"."
] | train | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/convert/MonetaryConversions.java#L109-L112 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/ORCLUS.java | ORCLUS.projectedEnergy | private ProjectedEnergy projectedEnergy(Relation<V> relation, ORCLUSCluster c_i, ORCLUSCluster c_j, int i, int j, int dim) {
NumberVectorDistanceFunction<? super V> distFunc = SquaredEuclideanDistanceFunction.STATIC;
// union of cluster c_i and c_j
ORCLUSCluster c_ij = union(relation, c_i, c_j, dim);
double sum = 0.;
NumberVector c_proj = DoubleVector.wrap(project(c_ij, c_ij.centroid));
for(DBIDIter iter = c_ij.objectIDs.iter(); iter.valid(); iter.advance()) {
NumberVector o_proj = DoubleVector.wrap(project(c_ij, relation.get(iter).toArray()));
sum += distFunc.distance(o_proj, c_proj);
}
sum /= c_ij.objectIDs.size();
return new ProjectedEnergy(i, j, c_ij, sum);
} | java | private ProjectedEnergy projectedEnergy(Relation<V> relation, ORCLUSCluster c_i, ORCLUSCluster c_j, int i, int j, int dim) {
NumberVectorDistanceFunction<? super V> distFunc = SquaredEuclideanDistanceFunction.STATIC;
// union of cluster c_i and c_j
ORCLUSCluster c_ij = union(relation, c_i, c_j, dim);
double sum = 0.;
NumberVector c_proj = DoubleVector.wrap(project(c_ij, c_ij.centroid));
for(DBIDIter iter = c_ij.objectIDs.iter(); iter.valid(); iter.advance()) {
NumberVector o_proj = DoubleVector.wrap(project(c_ij, relation.get(iter).toArray()));
sum += distFunc.distance(o_proj, c_proj);
}
sum /= c_ij.objectIDs.size();
return new ProjectedEnergy(i, j, c_ij, sum);
} | [
"private",
"ProjectedEnergy",
"projectedEnergy",
"(",
"Relation",
"<",
"V",
">",
"relation",
",",
"ORCLUSCluster",
"c_i",
",",
"ORCLUSCluster",
"c_j",
",",
"int",
"i",
",",
"int",
"j",
",",
"int",
"dim",
")",
"{",
"NumberVectorDistanceFunction",
"<",
"?",
"s... | Computes the projected energy of the specified clusters. The projected
energy is given by the mean square distance of the points to the centroid
of the union cluster c, when all points in c are projected to the subspace
of c.
@param relation the relation holding the objects
@param c_i the first cluster
@param c_j the second cluster
@param i the index of cluster c_i in the cluster list
@param j the index of cluster c_j in the cluster list
@param dim the dimensionality of the clusters
@return the projected energy of the specified cluster | [
"Computes",
"the",
"projected",
"energy",
"of",
"the",
"specified",
"clusters",
".",
"The",
"projected",
"energy",
"is",
"given",
"by",
"the",
"mean",
"square",
"distance",
"of",
"the",
"points",
"to",
"the",
"centroid",
"of",
"the",
"union",
"cluster",
"c",... | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/ORCLUS.java#L343-L357 |
ksclarke/freelib-utils | src/main/java/info/freelibrary/util/FileUtils.java | FileUtils.toElement | public static Element toElement(final String aFilePath, final String aPattern, final boolean aDeepTransformation)
throws FileNotFoundException {
final RegexFileFilter filter = new RegexFileFilter(aPattern);
final File file = new File(aFilePath);
if (file.exists() && file.canRead()) {
return add(file, null, filter, aDeepTransformation);
}
throw new FileNotFoundException(aFilePath);
} | java | public static Element toElement(final String aFilePath, final String aPattern, final boolean aDeepTransformation)
throws FileNotFoundException {
final RegexFileFilter filter = new RegexFileFilter(aPattern);
final File file = new File(aFilePath);
if (file.exists() && file.canRead()) {
return add(file, null, filter, aDeepTransformation);
}
throw new FileNotFoundException(aFilePath);
} | [
"public",
"static",
"Element",
"toElement",
"(",
"final",
"String",
"aFilePath",
",",
"final",
"String",
"aPattern",
",",
"final",
"boolean",
"aDeepTransformation",
")",
"throws",
"FileNotFoundException",
"{",
"final",
"RegexFileFilter",
"filter",
"=",
"new",
"Regex... | Returns an XML Element representing the file structure found at the supplied file system path. Files included
in the representation will match the supplied regular expression pattern. This method doesn't descend through
the directory structure.
@param aFilePath The directory from which the structural representation should be built
@param aPattern A regular expression pattern which files included in the Element should match
@param aDeepTransformation Whether the conversion should descend through subdirectories
@return An XML Element representation of the directory structure
@throws FileNotFoundException If the supplied directory isn't found | [
"Returns",
"an",
"XML",
"Element",
"representing",
"the",
"file",
"structure",
"found",
"at",
"the",
"supplied",
"file",
"system",
"path",
".",
"Files",
"included",
"in",
"the",
"representation",
"will",
"match",
"the",
"supplied",
"regular",
"expression",
"patt... | train | https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/FileUtils.java#L270-L280 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/code/RaMetaCodeGen.java | RaMetaCodeGen.writeInfo | private void writeInfo(Definition def, Writer out, int indent) throws IOException
{
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Gets the version of the resource adapter.\n");
writeWithIndent(out, indent, " *\n");
writeWithIndent(out, indent, " * @return String representing version of the resource adapter\n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "@Override\n");
writeWithIndent(out, indent, "public String getAdapterVersion()");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1, "return null; //TODO");
writeRightCurlyBracket(out, indent);
writeEol(out);
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Gets the name of the vendor that has provided the resource adapter.\n");
writeWithIndent(out, indent, " *\n");
writeWithIndent(out, indent, " * @return String representing name of the vendor \n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "@Override\n");
writeWithIndent(out, indent, "public String getAdapterVendorName()");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1, "return null; //TODO");
writeRightCurlyBracket(out, indent);
writeEol(out);
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Gets a tool displayable name of the resource adapter.\n");
writeWithIndent(out, indent, " *\n");
writeWithIndent(out, indent, " * @return String representing the name of the resource adapter\n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "@Override\n");
writeWithIndent(out, indent, "public String getAdapterName()");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1, "return null; //TODO");
writeRightCurlyBracket(out, indent);
writeEol(out);
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Gets a tool displayable short desription of the resource adapter.\n");
writeWithIndent(out, indent, " *\n");
writeWithIndent(out, indent, " * @return String describing the resource adapter\n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "@Override\n");
writeWithIndent(out, indent, "public String getAdapterShortDescription()");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1, "return null; //TODO");
writeRightCurlyBracket(out, indent);
writeEol(out);
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Returns a string representation of the version\n");
writeWithIndent(out, indent, " *\n");
writeWithIndent(out, indent,
" * @return String representing the supported version of the connector architecture\n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "@Override\n");
writeWithIndent(out, indent, "public String getSpecVersion()");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1, "return null; //TODO");
writeRightCurlyBracket(out, indent);
writeEol(out);
} | java | private void writeInfo(Definition def, Writer out, int indent) throws IOException
{
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Gets the version of the resource adapter.\n");
writeWithIndent(out, indent, " *\n");
writeWithIndent(out, indent, " * @return String representing version of the resource adapter\n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "@Override\n");
writeWithIndent(out, indent, "public String getAdapterVersion()");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1, "return null; //TODO");
writeRightCurlyBracket(out, indent);
writeEol(out);
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Gets the name of the vendor that has provided the resource adapter.\n");
writeWithIndent(out, indent, " *\n");
writeWithIndent(out, indent, " * @return String representing name of the vendor \n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "@Override\n");
writeWithIndent(out, indent, "public String getAdapterVendorName()");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1, "return null; //TODO");
writeRightCurlyBracket(out, indent);
writeEol(out);
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Gets a tool displayable name of the resource adapter.\n");
writeWithIndent(out, indent, " *\n");
writeWithIndent(out, indent, " * @return String representing the name of the resource adapter\n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "@Override\n");
writeWithIndent(out, indent, "public String getAdapterName()");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1, "return null; //TODO");
writeRightCurlyBracket(out, indent);
writeEol(out);
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Gets a tool displayable short desription of the resource adapter.\n");
writeWithIndent(out, indent, " *\n");
writeWithIndent(out, indent, " * @return String describing the resource adapter\n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "@Override\n");
writeWithIndent(out, indent, "public String getAdapterShortDescription()");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1, "return null; //TODO");
writeRightCurlyBracket(out, indent);
writeEol(out);
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Returns a string representation of the version\n");
writeWithIndent(out, indent, " *\n");
writeWithIndent(out, indent,
" * @return String representing the supported version of the connector architecture\n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "@Override\n");
writeWithIndent(out, indent, "public String getSpecVersion()");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1, "return null; //TODO");
writeRightCurlyBracket(out, indent);
writeEol(out);
} | [
"private",
"void",
"writeInfo",
"(",
"Definition",
"def",
",",
"Writer",
"out",
",",
"int",
"indent",
")",
"throws",
"IOException",
"{",
"writeWithIndent",
"(",
"out",
",",
"indent",
",",
"\"/**\\n\"",
")",
";",
"writeWithIndent",
"(",
"out",
",",
"indent",
... | Output info method
@param def definition
@param out Writer
@param indent space number
@throws IOException ioException | [
"Output",
"info",
"method"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/RaMetaCodeGen.java#L93-L160 |
alkacon/opencms-core | src/org/opencms/ui/contextmenu/CmsContextMenu.java | CmsContextMenu.openForTable | public void openForTable(ItemClickEvent event, Table table) {
fireEvent(new ContextMenuOpenedOnTableRowEvent(this, table, event.getItemId(), event.getPropertyId()));
open(event.getClientX(), event.getClientY());
} | java | public void openForTable(ItemClickEvent event, Table table) {
fireEvent(new ContextMenuOpenedOnTableRowEvent(this, table, event.getItemId(), event.getPropertyId()));
open(event.getClientX(), event.getClientY());
} | [
"public",
"void",
"openForTable",
"(",
"ItemClickEvent",
"event",
",",
"Table",
"table",
")",
"{",
"fireEvent",
"(",
"new",
"ContextMenuOpenedOnTableRowEvent",
"(",
"this",
",",
"table",
",",
"event",
".",
"getItemId",
"(",
")",
",",
"event",
".",
"getProperty... | Opens the context menu of the given table.<p>
@param event the click event
@param table the table | [
"Opens",
"the",
"context",
"menu",
"of",
"the",
"given",
"table",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/contextmenu/CmsContextMenu.java#L1148-L1153 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.cart_cartId_coupon_POST | public ArrayList<String> cart_cartId_coupon_POST(String cartId, String coupon) throws IOException {
String qPath = "/order/cart/{cartId}/coupon";
StringBuilder sb = path(qPath, cartId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "coupon", coupon);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, t1);
} | java | public ArrayList<String> cart_cartId_coupon_POST(String cartId, String coupon) throws IOException {
String qPath = "/order/cart/{cartId}/coupon";
StringBuilder sb = path(qPath, cartId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "coupon", coupon);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"cart_cartId_coupon_POST",
"(",
"String",
"cartId",
",",
"String",
"coupon",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/cart/{cartId}/coupon\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPa... | Add a new coupon to cart
REST: POST /order/cart/{cartId}/coupon
@param cartId [required] Cart identifier
@param coupon [required] Coupon identifier | [
"Add",
"a",
"new",
"coupon",
"to",
"cart"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L10002-L10009 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java | Calc.scaleEquals | public static Atom scaleEquals(Atom a, double s) {
double x = a.getX();
double y = a.getY();
double z = a.getZ();
x *= s;
y *= s;
z *= s;
//Atom b = new AtomImpl();
a.setX(x);
a.setY(y);
a.setZ(z);
return a;
} | java | public static Atom scaleEquals(Atom a, double s) {
double x = a.getX();
double y = a.getY();
double z = a.getZ();
x *= s;
y *= s;
z *= s;
//Atom b = new AtomImpl();
a.setX(x);
a.setY(y);
a.setZ(z);
return a;
} | [
"public",
"static",
"Atom",
"scaleEquals",
"(",
"Atom",
"a",
",",
"double",
"s",
")",
"{",
"double",
"x",
"=",
"a",
".",
"getX",
"(",
")",
";",
"double",
"y",
"=",
"a",
".",
"getY",
"(",
")",
";",
"double",
"z",
"=",
"a",
".",
"getZ",
"(",
")... | Multiply elements of a by s (in place)
@param a
@param s
@return the modified a | [
"Multiply",
"elements",
"of",
"a",
"by",
"s",
"(",
"in",
"place",
")"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L830-L845 |
perwendel/spark | src/main/java/spark/route/Routes.java | Routes.findMultiple | public List<RouteMatch> findMultiple(HttpMethod httpMethod, String path, String acceptType) {
List<RouteMatch> matchSet = new ArrayList<>();
List<RouteEntry> routeEntries = findTargetsForRequestedRoute(httpMethod, path);
for (RouteEntry routeEntry : routeEntries) {
if (acceptType != null) {
String bestMatch = MimeParse.bestMatch(Arrays.asList(routeEntry.acceptedType), acceptType);
if (routeWithGivenAcceptType(bestMatch)) {
matchSet.add(new RouteMatch(routeEntry.target, routeEntry.path, path, acceptType));
}
} else {
matchSet.add(new RouteMatch(routeEntry.target, routeEntry.path, path, acceptType));
}
}
return matchSet;
} | java | public List<RouteMatch> findMultiple(HttpMethod httpMethod, String path, String acceptType) {
List<RouteMatch> matchSet = new ArrayList<>();
List<RouteEntry> routeEntries = findTargetsForRequestedRoute(httpMethod, path);
for (RouteEntry routeEntry : routeEntries) {
if (acceptType != null) {
String bestMatch = MimeParse.bestMatch(Arrays.asList(routeEntry.acceptedType), acceptType);
if (routeWithGivenAcceptType(bestMatch)) {
matchSet.add(new RouteMatch(routeEntry.target, routeEntry.path, path, acceptType));
}
} else {
matchSet.add(new RouteMatch(routeEntry.target, routeEntry.path, path, acceptType));
}
}
return matchSet;
} | [
"public",
"List",
"<",
"RouteMatch",
">",
"findMultiple",
"(",
"HttpMethod",
"httpMethod",
",",
"String",
"path",
",",
"String",
"acceptType",
")",
"{",
"List",
"<",
"RouteMatch",
">",
"matchSet",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
... | Finds multiple targets for a requested route.
@param httpMethod the http method
@param path the route path
@param acceptType the accept type
@return the targets | [
"Finds",
"multiple",
"targets",
"for",
"a",
"requested",
"route",
"."
] | train | https://github.com/perwendel/spark/blob/080fb1f9d6e580f6742e9589044c7420d3157b8b/src/main/java/spark/route/Routes.java#L97-L114 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java | TheMovieDbApi.addToWatchList | public StatusCode addToWatchList(String sessionId, int accountId, MediaType mediaType, Integer mediaId) throws MovieDbException {
return tmdbAccount.modifyWatchList(sessionId, accountId, mediaType, mediaId, true);
} | java | public StatusCode addToWatchList(String sessionId, int accountId, MediaType mediaType, Integer mediaId) throws MovieDbException {
return tmdbAccount.modifyWatchList(sessionId, accountId, mediaType, mediaId, true);
} | [
"public",
"StatusCode",
"addToWatchList",
"(",
"String",
"sessionId",
",",
"int",
"accountId",
",",
"MediaType",
"mediaType",
",",
"Integer",
"mediaId",
")",
"throws",
"MovieDbException",
"{",
"return",
"tmdbAccount",
".",
"modifyWatchList",
"(",
"sessionId",
",",
... | Add a movie to an accounts watch list.
@param sessionId sessionId
@param accountId accountId
@param mediaId mediaId
@param mediaType mediaType
@return StatusCode
@throws MovieDbException exception | [
"Add",
"a",
"movie",
"to",
"an",
"accounts",
"watch",
"list",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L308-L310 |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java | BitfinexSymbols.candlesticks | public static BitfinexCandlestickSymbol candlesticks(final BitfinexCurrencyPair currencyPair,
final BitfinexCandleTimeFrame timeframe) {
return new BitfinexCandlestickSymbol(currencyPair, Objects.requireNonNull(timeframe));
} | java | public static BitfinexCandlestickSymbol candlesticks(final BitfinexCurrencyPair currencyPair,
final BitfinexCandleTimeFrame timeframe) {
return new BitfinexCandlestickSymbol(currencyPair, Objects.requireNonNull(timeframe));
} | [
"public",
"static",
"BitfinexCandlestickSymbol",
"candlesticks",
"(",
"final",
"BitfinexCurrencyPair",
"currencyPair",
",",
"final",
"BitfinexCandleTimeFrame",
"timeframe",
")",
"{",
"return",
"new",
"BitfinexCandlestickSymbol",
"(",
"currencyPair",
",",
"Objects",
".",
"... | Returns symbol for candlestick channel
@param currencyPair of candles
@param timeframe configuration of candles
@return symbol | [
"Returns",
"symbol",
"for",
"candlestick",
"channel"
] | train | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java#L52-L56 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AbstractAddStepHandler.java | AbstractAddStepHandler.populateModel | protected void populateModel(final OperationContext context, final ModelNode operation, final Resource resource) throws OperationFailedException {
populateModel(operation, resource);
} | java | protected void populateModel(final OperationContext context, final ModelNode operation, final Resource resource) throws OperationFailedException {
populateModel(operation, resource);
} | [
"protected",
"void",
"populateModel",
"(",
"final",
"OperationContext",
"context",
",",
"final",
"ModelNode",
"operation",
",",
"final",
"Resource",
"resource",
")",
"throws",
"OperationFailedException",
"{",
"populateModel",
"(",
"operation",
",",
"resource",
")",
... | Populate the given resource in the persistent configuration model based on the values in the given operation.
This method isinvoked during {@link org.jboss.as.controller.OperationContext.Stage#MODEL}.
<p>
This default implementation simply calls {@link #populateModel(ModelNode, org.jboss.as.controller.registry.Resource)}.
@param context the operation context
@param operation the operation
@param resource the resource that corresponds to the address of {@code operation}
@throws OperationFailedException if {@code operation} is invalid or populating the model otherwise fails | [
"Populate",
"the",
"given",
"resource",
"in",
"the",
"persistent",
"configuration",
"model",
"based",
"on",
"the",
"values",
"in",
"the",
"given",
"operation",
".",
"This",
"method",
"isinvoked",
"during",
"{",
"@link",
"org",
".",
"jboss",
".",
"as",
".",
... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AbstractAddStepHandler.java#L221-L223 |
mfornos/humanize | humanize-slim/src/main/java/humanize/Humanize.java | Humanize.wordWrap | public static String wordWrap(final String value, final int len)
{
if (len < 0 || value.length() <= len)
return value;
BreakIterator bi = BreakIterator.getWordInstance(currentLocale());
bi.setText(value);
return value.substring(0, bi.following(len));
} | java | public static String wordWrap(final String value, final int len)
{
if (len < 0 || value.length() <= len)
return value;
BreakIterator bi = BreakIterator.getWordInstance(currentLocale());
bi.setText(value);
return value.substring(0, bi.following(len));
} | [
"public",
"static",
"String",
"wordWrap",
"(",
"final",
"String",
"value",
",",
"final",
"int",
"len",
")",
"{",
"if",
"(",
"len",
"<",
"0",
"||",
"value",
".",
"length",
"(",
")",
"<=",
"len",
")",
"return",
"value",
";",
"BreakIterator",
"bi",
"=",... | <p>
Truncate a string to the closest word boundary after a number of
characters.
</p>
@param value
Text to be truncated
@param len
Number of characters
@return String truncated to the closes word boundary | [
"<p",
">",
"Truncate",
"a",
"string",
"to",
"the",
"closest",
"word",
"boundary",
"after",
"a",
"number",
"of",
"characters",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L2896-L2905 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/firefox/FirefoxProfile.java | FirefoxProfile.layoutOnDisk | public File layoutOnDisk() {
try {
File profileDir = TemporaryFilesystem.getDefaultTmpFS()
.createTempDir("anonymous", "webdriver-profile");
File userPrefs = new File(profileDir, "user.js");
copyModel(model, profileDir);
installExtensions(profileDir);
deleteLockFiles(profileDir);
deleteExtensionsCacheIfItExists(profileDir);
updateUserPrefs(userPrefs);
return profileDir;
} catch (IOException e) {
throw new UnableToCreateProfileException(e);
}
} | java | public File layoutOnDisk() {
try {
File profileDir = TemporaryFilesystem.getDefaultTmpFS()
.createTempDir("anonymous", "webdriver-profile");
File userPrefs = new File(profileDir, "user.js");
copyModel(model, profileDir);
installExtensions(profileDir);
deleteLockFiles(profileDir);
deleteExtensionsCacheIfItExists(profileDir);
updateUserPrefs(userPrefs);
return profileDir;
} catch (IOException e) {
throw new UnableToCreateProfileException(e);
}
} | [
"public",
"File",
"layoutOnDisk",
"(",
")",
"{",
"try",
"{",
"File",
"profileDir",
"=",
"TemporaryFilesystem",
".",
"getDefaultTmpFS",
"(",
")",
".",
"createTempDir",
"(",
"\"anonymous\"",
",",
"\"webdriver-profile\"",
")",
";",
"File",
"userPrefs",
"=",
"new",
... | Call this to cause the current profile to be written to disk. The profile directory is
returned. Note that this profile directory is a temporary one and will be deleted when the JVM
exists (at the latest)
This method should be called immediately before starting to use the profile and should only be
called once per instance of the {@link org.openqa.selenium.firefox.FirefoxDriver}.
@return The directory containing the profile. | [
"Call",
"this",
"to",
"cause",
"the",
"current",
"profile",
"to",
"be",
"written",
"to",
"disk",
".",
"The",
"profile",
"directory",
"is",
"returned",
".",
"Note",
"that",
"this",
"profile",
"directory",
"is",
"a",
"temporary",
"one",
"and",
"will",
"be",
... | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/firefox/FirefoxProfile.java#L393-L408 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/chrono/ChronoLocalDateImpl.java | ChronoLocalDateImpl.ensureValid | static <D extends ChronoLocalDate> D ensureValid(Chronology chrono, Temporal temporal) {
@SuppressWarnings("unchecked")
D other = (D) temporal;
if (chrono.equals(other.getChronology()) == false) {
throw new ClassCastException("Chronology mismatch, expected: " + chrono.getId() + ", actual: " + other.getChronology().getId());
}
return other;
} | java | static <D extends ChronoLocalDate> D ensureValid(Chronology chrono, Temporal temporal) {
@SuppressWarnings("unchecked")
D other = (D) temporal;
if (chrono.equals(other.getChronology()) == false) {
throw new ClassCastException("Chronology mismatch, expected: " + chrono.getId() + ", actual: " + other.getChronology().getId());
}
return other;
} | [
"static",
"<",
"D",
"extends",
"ChronoLocalDate",
">",
"D",
"ensureValid",
"(",
"Chronology",
"chrono",
",",
"Temporal",
"temporal",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"D",
"other",
"=",
"(",
"D",
")",
"temporal",
";",
"if",
"(",... | Casts the {@code Temporal} to {@code ChronoLocalDate} ensuring it bas the specified chronology.
@param chrono the chronology to check for, not null
@param temporal a date-time to cast, not null
@return the date-time checked and cast to {@code ChronoLocalDate}, not null
@throws ClassCastException if the date-time cannot be cast to ChronoLocalDate
or the chronology is not equal this Chronology | [
"Casts",
"the",
"{",
"@code",
"Temporal",
"}",
"to",
"{",
"@code",
"ChronoLocalDate",
"}",
"ensuring",
"it",
"bas",
"the",
"specified",
"chronology",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/chrono/ChronoLocalDateImpl.java#L160-L167 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RuntimeExceptionsFactory.java | RuntimeExceptionsFactory.newTypeNotPresentException | public static TypeNotPresentException newTypeNotPresentException(Throwable cause, String message, Object... args) {
return new TypeNotPresentException(format(message, args), cause);
} | java | public static TypeNotPresentException newTypeNotPresentException(Throwable cause, String message, Object... args) {
return new TypeNotPresentException(format(message, args), cause);
} | [
"public",
"static",
"TypeNotPresentException",
"newTypeNotPresentException",
"(",
"Throwable",
"cause",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"TypeNotPresentException",
"(",
"format",
"(",
"message",
",",
"args",
")",
"... | Constructs and initializes a new {@link TypeNotPresentException} with the given {@link Throwable cause}
and {@link String message} formatted with the given {@link Object[] arguments}.
@param cause {@link Throwable} identified as the reason this {@link TypeNotPresentException} was thrown.
@param message {@link String} describing the {@link TypeNotPresentException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link TypeNotPresentException} with the given {@link Throwable cause} and {@link String message}.
@see java.lang.TypeNotPresentException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"TypeNotPresentException",
"}",
"with",
"the",
"given",
"{",
"@link",
"Throwable",
"cause",
"}",
"and",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RuntimeExceptionsFactory.java#L239-L241 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/util/StringUtil.java | StringUtil.fromBytes | public static String fromBytes(byte[] bytes, ProcessEngine processEngine) {
ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration();
Charset charset = processEngineConfiguration.getDefaultCharset();
return new String(bytes, charset);
} | java | public static String fromBytes(byte[] bytes, ProcessEngine processEngine) {
ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration();
Charset charset = processEngineConfiguration.getDefaultCharset();
return new String(bytes, charset);
} | [
"public",
"static",
"String",
"fromBytes",
"(",
"byte",
"[",
"]",
"bytes",
",",
"ProcessEngine",
"processEngine",
")",
"{",
"ProcessEngineConfigurationImpl",
"processEngineConfiguration",
"=",
"(",
"(",
"ProcessEngineImpl",
")",
"processEngine",
")",
".",
"getProcessE... | converts a byte array into a string using the provided process engine's default charset as
returned by {@link ProcessEngineConfigurationImpl#getDefaultCharset()}
@param bytes the byte array
@param processEngine the process engine
@return a string representing the bytes | [
"converts",
"a",
"byte",
"array",
"into",
"a",
"string",
"using",
"the",
"provided",
"process",
"engine",
"s",
"default",
"charset",
"as",
"returned",
"by",
"{",
"@link",
"ProcessEngineConfigurationImpl#getDefaultCharset",
"()",
"}"
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/StringUtil.java#L123-L127 |
fullcontact/hadoop-sstable | sstable-core/src/main/java/com/fullcontact/sstable/util/CQLUtil.java | CQLUtil.parseCreateStatement | public static CFMetaData parseCreateStatement(String cql) throws RequestValidationException {
final CreateColumnFamilyStatement statement =
(CreateColumnFamilyStatement) QueryProcessor.parseStatement(cql).prepare().statement;
final CFMetaData cfm =
new CFMetaData("assess", "kvs_strict", ColumnFamilyType.Standard, statement.comparator, null);
statement.applyPropertiesTo(cfm);
return cfm;
} | java | public static CFMetaData parseCreateStatement(String cql) throws RequestValidationException {
final CreateColumnFamilyStatement statement =
(CreateColumnFamilyStatement) QueryProcessor.parseStatement(cql).prepare().statement;
final CFMetaData cfm =
new CFMetaData("assess", "kvs_strict", ColumnFamilyType.Standard, statement.comparator, null);
statement.applyPropertiesTo(cfm);
return cfm;
} | [
"public",
"static",
"CFMetaData",
"parseCreateStatement",
"(",
"String",
"cql",
")",
"throws",
"RequestValidationException",
"{",
"final",
"CreateColumnFamilyStatement",
"statement",
"=",
"(",
"CreateColumnFamilyStatement",
")",
"QueryProcessor",
".",
"parseStatement",
"(",... | Parses a CQL CREATE statement into its CFMetaData object
@param cql
@return CFMetaData
@throws RequestValidationException if CQL is invalid | [
"Parses",
"a",
"CQL",
"CREATE",
"statement",
"into",
"its",
"CFMetaData",
"object"
] | train | https://github.com/fullcontact/hadoop-sstable/blob/1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2/sstable-core/src/main/java/com/fullcontact/sstable/util/CQLUtil.java#L22-L31 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/spi/impl/proxyservice/impl/ProxyRegistry.java | ProxyRegistry.createProxy | public DistributedObjectFuture createProxy(String name, boolean publishEvent, boolean initialize) {
if (proxies.containsKey(name)) {
return null;
}
if (!proxyService.nodeEngine.isRunning()) {
throw new HazelcastInstanceNotActiveException();
}
DistributedObjectFuture proxyFuture = new DistributedObjectFuture();
if (proxies.putIfAbsent(name, proxyFuture) != null) {
return null;
}
return doCreateProxy(name, publishEvent, initialize, proxyFuture);
} | java | public DistributedObjectFuture createProxy(String name, boolean publishEvent, boolean initialize) {
if (proxies.containsKey(name)) {
return null;
}
if (!proxyService.nodeEngine.isRunning()) {
throw new HazelcastInstanceNotActiveException();
}
DistributedObjectFuture proxyFuture = new DistributedObjectFuture();
if (proxies.putIfAbsent(name, proxyFuture) != null) {
return null;
}
return doCreateProxy(name, publishEvent, initialize, proxyFuture);
} | [
"public",
"DistributedObjectFuture",
"createProxy",
"(",
"String",
"name",
",",
"boolean",
"publishEvent",
",",
"boolean",
"initialize",
")",
"{",
"if",
"(",
"proxies",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
... | Creates a DistributedObject proxy if it is not created yet
@param name The name of the distributedObject proxy object.
@param publishEvent true if a DistributedObjectEvent should be fired.
@param initialize true if he DistributedObject proxy object should be initialized.
@return The DistributedObject instance if it is created by this method, null otherwise. | [
"Creates",
"a",
"DistributedObject",
"proxy",
"if",
"it",
"is",
"not",
"created",
"yet"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/impl/proxyservice/impl/ProxyRegistry.java#L195-L210 |
dmurph/jgoogleanalyticstracker | src/main/java/com/dmurph/tracking/JGoogleAnalyticsTracker.java | JGoogleAnalyticsTracker.makeCustomRequest | public synchronized void makeCustomRequest(AnalyticsRequestData argData) {
if (!enabled) {
logger.debug("Ignoring tracking request, enabled is false");
return;
}
if (argData == null) {
throw new NullPointerException("Data cannot be null");
}
if (builder == null) {
throw new NullPointerException("Class was not initialized");
}
final String url = builder.buildURL(argData);
switch(mode){
case MULTI_THREAD:
Thread t = new Thread(asyncThreadGroup, "AnalyticsThread-" + asyncThreadGroup.activeCount()) {
public void run() {
synchronized (JGoogleAnalyticsTracker.class) {
asyncThreadsRunning++;
}
try {
dispatchRequest(url);
} finally {
synchronized (JGoogleAnalyticsTracker.class) {
asyncThreadsRunning--;
}
}
}
};
t.setDaemon(true);
t.start();
break;
case SYNCHRONOUS:
dispatchRequest(url);
break;
default: // in case it's null, we default to the single-thread
synchronized (fifo) {
fifo.addLast(url);
fifo.notify();
}
if(!backgroundThreadMayRun){
logger.error("A tracker request has been added to the queue but the background thread isn't running.", url);
}
break;
}
} | java | public synchronized void makeCustomRequest(AnalyticsRequestData argData) {
if (!enabled) {
logger.debug("Ignoring tracking request, enabled is false");
return;
}
if (argData == null) {
throw new NullPointerException("Data cannot be null");
}
if (builder == null) {
throw new NullPointerException("Class was not initialized");
}
final String url = builder.buildURL(argData);
switch(mode){
case MULTI_THREAD:
Thread t = new Thread(asyncThreadGroup, "AnalyticsThread-" + asyncThreadGroup.activeCount()) {
public void run() {
synchronized (JGoogleAnalyticsTracker.class) {
asyncThreadsRunning++;
}
try {
dispatchRequest(url);
} finally {
synchronized (JGoogleAnalyticsTracker.class) {
asyncThreadsRunning--;
}
}
}
};
t.setDaemon(true);
t.start();
break;
case SYNCHRONOUS:
dispatchRequest(url);
break;
default: // in case it's null, we default to the single-thread
synchronized (fifo) {
fifo.addLast(url);
fifo.notify();
}
if(!backgroundThreadMayRun){
logger.error("A tracker request has been added to the queue but the background thread isn't running.", url);
}
break;
}
} | [
"public",
"synchronized",
"void",
"makeCustomRequest",
"(",
"AnalyticsRequestData",
"argData",
")",
"{",
"if",
"(",
"!",
"enabled",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Ignoring tracking request, enabled is false\"",
")",
";",
"return",
";",
"}",
"if",
"(",
... | Makes a custom tracking request based from the given data.
@param argData
@throws NullPointerException
if argData is null or if the URL builder is null | [
"Makes",
"a",
"custom",
"tracking",
"request",
"based",
"from",
"the",
"given",
"data",
"."
] | train | https://github.com/dmurph/jgoogleanalyticstracker/blob/69f68caf8e09a53e6f6076477bf05b84bc80e386/src/main/java/com/dmurph/tracking/JGoogleAnalyticsTracker.java#L410-L455 |
synchronoss/cpo-api | cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java | JdbcCpoAdapter.processExecuteGroup | protected <T, C> T processExecuteGroup(String name, C criteria, T result) throws CpoException {
Connection c = null;
T obj = null;
try {
c = getWriteConnection();
obj = processExecuteGroup(name, criteria, result, c);
commitLocalConnection(c);
} catch (Exception e) {
// Any exception has to try to rollback the work;
rollbackLocalConnection(c);
ExceptionHelper.reThrowCpoException(e, "processExecuteGroup(String name, Object criteria, Object result) failed");
} finally {
closeLocalConnection(c);
}
return obj;
} | java | protected <T, C> T processExecuteGroup(String name, C criteria, T result) throws CpoException {
Connection c = null;
T obj = null;
try {
c = getWriteConnection();
obj = processExecuteGroup(name, criteria, result, c);
commitLocalConnection(c);
} catch (Exception e) {
// Any exception has to try to rollback the work;
rollbackLocalConnection(c);
ExceptionHelper.reThrowCpoException(e, "processExecuteGroup(String name, Object criteria, Object result) failed");
} finally {
closeLocalConnection(c);
}
return obj;
} | [
"protected",
"<",
"T",
",",
"C",
">",
"T",
"processExecuteGroup",
"(",
"String",
"name",
",",
"C",
"criteria",
",",
"T",
"result",
")",
"throws",
"CpoException",
"{",
"Connection",
"c",
"=",
"null",
";",
"T",
"obj",
"=",
"null",
";",
"try",
"{",
"c",... | Executes an Object whose MetaData contains a stored procedure. An assumption is that the object exists in the
datasource.
@param name The filter name which tells the datasource which objects should be returned. The name also signifies
what data in the object will be populated.
@param criteria This is an object that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown.
This object is used to populate the IN arguments used to retrieve the collection of objects.
@param result This is an object that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown.
This object defines the object type that will be returned in the
@return A result object populate with the OUT arguments
@throws CpoException DOCUMENT ME! | [
"Executes",
"an",
"Object",
"whose",
"MetaData",
"contains",
"a",
"stored",
"procedure",
".",
"An",
"assumption",
"is",
"that",
"the",
"object",
"exists",
"in",
"the",
"datasource",
"."
] | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java#L2160-L2177 |
EsotericSoftware/yamlbeans | src/com/esotericsoftware/yamlbeans/YamlConfig.java | YamlConfig.setClassTag | public void setClassTag (String tag, Class type) {
if (tag == null) throw new IllegalArgumentException("tag cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
classNameToTag.put(type.getName(), tag);
tagToClass.put(tag, type);
} | java | public void setClassTag (String tag, Class type) {
if (tag == null) throw new IllegalArgumentException("tag cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
classNameToTag.put(type.getName(), tag);
tagToClass.put(tag, type);
} | [
"public",
"void",
"setClassTag",
"(",
"String",
"tag",
",",
"Class",
"type",
")",
"{",
"if",
"(",
"tag",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"tag cannot be null.\"",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"throw",... | Allows the specified tag to be used in YAML instead of the full class name. | [
"Allows",
"the",
"specified",
"tag",
"to",
"be",
"used",
"in",
"YAML",
"instead",
"of",
"the",
"full",
"class",
"name",
"."
] | train | https://github.com/EsotericSoftware/yamlbeans/blob/f5610997edbc5534fc7e9f0a91654d14742345ca/src/com/esotericsoftware/yamlbeans/YamlConfig.java#L69-L74 |
deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-nlp/src/main/java/org/datavec/nlp/movingwindow/Windows.java | Windows.windowForWordInPosition | public static Window windowForWordInPosition(int windowSize, int wordPos, List<String> sentence) {
List<String> window = new ArrayList<>();
List<String> onlyTokens = new ArrayList<>();
int contextSize = (int) Math.floor((windowSize - 1) / 2);
for (int i = wordPos - contextSize; i <= wordPos + contextSize; i++) {
if (i < 0)
window.add("<s>");
else if (i >= sentence.size())
window.add("</s>");
else {
onlyTokens.add(sentence.get(i));
window.add(sentence.get(i));
}
}
String wholeSentence = StringUtils.join(sentence);
String window2 = StringUtils.join(onlyTokens);
int begin = wholeSentence.indexOf(window2);
int end = begin + window2.length();
return new Window(window, begin, end);
} | java | public static Window windowForWordInPosition(int windowSize, int wordPos, List<String> sentence) {
List<String> window = new ArrayList<>();
List<String> onlyTokens = new ArrayList<>();
int contextSize = (int) Math.floor((windowSize - 1) / 2);
for (int i = wordPos - contextSize; i <= wordPos + contextSize; i++) {
if (i < 0)
window.add("<s>");
else if (i >= sentence.size())
window.add("</s>");
else {
onlyTokens.add(sentence.get(i));
window.add(sentence.get(i));
}
}
String wholeSentence = StringUtils.join(sentence);
String window2 = StringUtils.join(onlyTokens);
int begin = wholeSentence.indexOf(window2);
int end = begin + window2.length();
return new Window(window, begin, end);
} | [
"public",
"static",
"Window",
"windowForWordInPosition",
"(",
"int",
"windowSize",
",",
"int",
"wordPos",
",",
"List",
"<",
"String",
">",
"sentence",
")",
"{",
"List",
"<",
"String",
">",
"window",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"... | Creates a sliding window from text
@param windowSize the window size to use
@param wordPos the position of the word to center
@param sentence the sentence to createComplex a window for
@return a window based on the given sentence | [
"Creates",
"a",
"sliding",
"window",
"from",
"text"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-nlp/src/main/java/org/datavec/nlp/movingwindow/Windows.java#L146-L169 |
nlalevee/jsourcemap | jsourcemap/src/java/org/hibnet/jsourcemap/SourceNode.java | SourceNode.replaceRight | public void replaceRight(Pattern aPattern, String aReplacement) {
Object lastChild = this.children.get(this.children.size() - 1);
if (lastChild instanceof SourceNode) {
((SourceNode) lastChild).replaceRight(aPattern, aReplacement);
} else if (lastChild instanceof String) {
this.children.set(this.children.size() - 1, aPattern.matcher(((String) lastChild)).replaceFirst(aReplacement));
} else {
this.children.add(aPattern.matcher("").replaceFirst(aReplacement));
}
} | java | public void replaceRight(Pattern aPattern, String aReplacement) {
Object lastChild = this.children.get(this.children.size() - 1);
if (lastChild instanceof SourceNode) {
((SourceNode) lastChild).replaceRight(aPattern, aReplacement);
} else if (lastChild instanceof String) {
this.children.set(this.children.size() - 1, aPattern.matcher(((String) lastChild)).replaceFirst(aReplacement));
} else {
this.children.add(aPattern.matcher("").replaceFirst(aReplacement));
}
} | [
"public",
"void",
"replaceRight",
"(",
"Pattern",
"aPattern",
",",
"String",
"aReplacement",
")",
"{",
"Object",
"lastChild",
"=",
"this",
".",
"children",
".",
"get",
"(",
"this",
".",
"children",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"if",
"(",
... | Call String.prototype.replace on the very right-most source snippet. Useful for trimming whitespace from the end of a source node, etc.
@param aPattern
The pattern to replace.
@param aReplacement
The thing to replace the pattern with. | [
"Call",
"String",
".",
"prototype",
".",
"replace",
"on",
"the",
"very",
"right",
"-",
"most",
"source",
"snippet",
".",
"Useful",
"for",
"trimming",
"whitespace",
"from",
"the",
"end",
"of",
"a",
"source",
"node",
"etc",
"."
] | train | https://github.com/nlalevee/jsourcemap/blob/361a99c73d51c11afa5579dd83d477c4d0345599/jsourcemap/src/java/org/hibnet/jsourcemap/SourceNode.java#L307-L316 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountsInner.java | IntegrationAccountsInner.regenerateAccessKey | public IntegrationAccountInner regenerateAccessKey(String resourceGroupName, String integrationAccountName, KeyType keyType) {
return regenerateAccessKeyWithServiceResponseAsync(resourceGroupName, integrationAccountName, keyType).toBlocking().single().body();
} | java | public IntegrationAccountInner regenerateAccessKey(String resourceGroupName, String integrationAccountName, KeyType keyType) {
return regenerateAccessKeyWithServiceResponseAsync(resourceGroupName, integrationAccountName, keyType).toBlocking().single().body();
} | [
"public",
"IntegrationAccountInner",
"regenerateAccessKey",
"(",
"String",
"resourceGroupName",
",",
"String",
"integrationAccountName",
",",
"KeyType",
"keyType",
")",
"{",
"return",
"regenerateAccessKeyWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"integrationAcco... | Regenerates the integration account access key.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@param keyType The key type. Possible values include: 'NotSpecified', 'Primary', 'Secondary'
@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 IntegrationAccountInner object if successful. | [
"Regenerates",
"the",
"integration",
"account",
"access",
"key",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountsInner.java#L1306-L1308 |
allcolor/YaHP-Converter | YaHPConverter/src/org/allcolor/yahp/cl/converter/CDocumentCut.java | CDocumentCut.getPbDocs | private static PbDocument [] getPbDocs(final NodeList nl) {
List list = new ArrayList();
Element prevpb = null;
for (int i = 0; i < nl.getLength(); i++) {
Element pb = (Element) nl.item(i);
PbDocument pbdoc = new PbDocument(prevpb, pb);
list.add(pbdoc);
prevpb = pb;
if (i == (nl.getLength() - 1)) {
pbdoc = new PbDocument(pb, null);
list.add(pbdoc);
} // end if
} // end for
PbDocument array[] = new PbDocument[list.size()];
for (int i = 0; i < list.size(); i++) {
array[i] = (PbDocument) list.get(i);
} // end for
return array;
} | java | private static PbDocument [] getPbDocs(final NodeList nl) {
List list = new ArrayList();
Element prevpb = null;
for (int i = 0; i < nl.getLength(); i++) {
Element pb = (Element) nl.item(i);
PbDocument pbdoc = new PbDocument(prevpb, pb);
list.add(pbdoc);
prevpb = pb;
if (i == (nl.getLength() - 1)) {
pbdoc = new PbDocument(pb, null);
list.add(pbdoc);
} // end if
} // end for
PbDocument array[] = new PbDocument[list.size()];
for (int i = 0; i < list.size(); i++) {
array[i] = (PbDocument) list.get(i);
} // end for
return array;
} | [
"private",
"static",
"PbDocument",
"[",
"]",
"getPbDocs",
"(",
"final",
"NodeList",
"nl",
")",
"{",
"List",
"list",
"=",
"new",
"ArrayList",
"(",
")",
";",
"Element",
"prevpb",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nl"... | Return the pagebreaks
@param nl pagebreaks nodelist
@return an array of subdoc composed of space between pb. | [
"Return",
"the",
"pagebreaks"
] | train | https://github.com/allcolor/YaHP-Converter/blob/d72745281766a784a6b319f3787aa1d8de7cd0fe/YaHPConverter/src/org/allcolor/yahp/cl/converter/CDocumentCut.java#L443-L466 |
JOML-CI/JOML | src/org/joml/Vector2i.java | Vector2i.setComponent | public Vector2i setComponent(int component, int value) throws IllegalArgumentException {
switch (component) {
case 0:
x = value;
break;
case 1:
y = value;
break;
default:
throw new IllegalArgumentException();
}
return this;
} | java | public Vector2i setComponent(int component, int value) throws IllegalArgumentException {
switch (component) {
case 0:
x = value;
break;
case 1:
y = value;
break;
default:
throw new IllegalArgumentException();
}
return this;
} | [
"public",
"Vector2i",
"setComponent",
"(",
"int",
"component",
",",
"int",
"value",
")",
"throws",
"IllegalArgumentException",
"{",
"switch",
"(",
"component",
")",
"{",
"case",
"0",
":",
"x",
"=",
"value",
";",
"break",
";",
"case",
"1",
":",
"y",
"=",
... | Set the value of the specified component of this vector.
@param component
the component whose value to set, within <code>[0..1]</code>
@param value
the value to set
@return this
@throws IllegalArgumentException if <code>component</code> is not within <code>[0..1]</code> | [
"Set",
"the",
"value",
"of",
"the",
"specified",
"component",
"of",
"this",
"vector",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector2i.java#L370-L382 |
drewnoakes/metadata-extractor | Source/com/drew/metadata/exif/ExifSubIFDDirectory.java | ExifSubIFDDirectory.getDateOriginal | @Nullable
public Date getDateOriginal(@Nullable TimeZone timeZone)
{
TimeZone timeZoneOriginal = getTimeZone(TAG_OFFSET_TIME_ORIGINAL);
return getDate(TAG_DATETIME_ORIGINAL, getString(TAG_SUBSECOND_TIME_ORIGINAL),
(timeZoneOriginal != null) ? timeZoneOriginal : timeZone);
} | java | @Nullable
public Date getDateOriginal(@Nullable TimeZone timeZone)
{
TimeZone timeZoneOriginal = getTimeZone(TAG_OFFSET_TIME_ORIGINAL);
return getDate(TAG_DATETIME_ORIGINAL, getString(TAG_SUBSECOND_TIME_ORIGINAL),
(timeZoneOriginal != null) ? timeZoneOriginal : timeZone);
} | [
"@",
"Nullable",
"public",
"Date",
"getDateOriginal",
"(",
"@",
"Nullable",
"TimeZone",
"timeZone",
")",
"{",
"TimeZone",
"timeZoneOriginal",
"=",
"getTimeZone",
"(",
"TAG_OFFSET_TIME_ORIGINAL",
")",
";",
"return",
"getDate",
"(",
"TAG_DATETIME_ORIGINAL",
",",
"getS... | Parses the date/time tag, the subsecond tag and the time offset tag to obtain a single Date
object with milliseconds representing the date and time when this image was captured. If
the time offset tag does not exist, attempts will be made to parse the values as though it is
in the {@link TimeZone} represented by the {@code timeZone} parameter (if it is non-null).
@param timeZone the time zone to use
@return A Date object representing when this image was captured, if possible, otherwise null | [
"Parses",
"the",
"date",
"/",
"time",
"tag",
"the",
"subsecond",
"tag",
"and",
"the",
"time",
"offset",
"tag",
"to",
"obtain",
"a",
"single",
"Date",
"object",
"with",
"milliseconds",
"representing",
"the",
"date",
"and",
"time",
"when",
"this",
"image",
"... | train | https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/metadata/exif/ExifSubIFDDirectory.java#L128-L134 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java | GlobalUsersInner.getEnvironment | public GetEnvironmentResponseInner getEnvironment(String userName, String environmentId) {
return getEnvironmentWithServiceResponseAsync(userName, environmentId).toBlocking().single().body();
} | java | public GetEnvironmentResponseInner getEnvironment(String userName, String environmentId) {
return getEnvironmentWithServiceResponseAsync(userName, environmentId).toBlocking().single().body();
} | [
"public",
"GetEnvironmentResponseInner",
"getEnvironment",
"(",
"String",
"userName",
",",
"String",
"environmentId",
")",
"{",
"return",
"getEnvironmentWithServiceResponseAsync",
"(",
"userName",
",",
"environmentId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
... | Gets the virtual machine details.
@param userName The name of the user.
@param environmentId The resourceId of the environment
@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 GetEnvironmentResponseInner object if successful. | [
"Gets",
"the",
"virtual",
"machine",
"details",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java#L128-L130 |
threerings/nenya | core/src/main/java/com/threerings/openal/Stream.java | Stream.fadeOut | public void fadeOut (float interval, boolean dispose)
{
_fadeMode = dispose ? FadeMode.OUT_DISPOSE : FadeMode.OUT;
_fadeInterval = interval;
_fadeElapsed = 0f;
} | java | public void fadeOut (float interval, boolean dispose)
{
_fadeMode = dispose ? FadeMode.OUT_DISPOSE : FadeMode.OUT;
_fadeInterval = interval;
_fadeElapsed = 0f;
} | [
"public",
"void",
"fadeOut",
"(",
"float",
"interval",
",",
"boolean",
"dispose",
")",
"{",
"_fadeMode",
"=",
"dispose",
"?",
"FadeMode",
".",
"OUT_DISPOSE",
":",
"FadeMode",
".",
"OUT",
";",
"_fadeInterval",
"=",
"interval",
";",
"_fadeElapsed",
"=",
"0f",
... | Fades this stream out over the specified interval.
@param dispose if true, dispose of the stream when done fading out | [
"Fades",
"this",
"stream",
"out",
"over",
"the",
"specified",
"interval",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Stream.java#L146-L151 |
bujiio/buji-pac4j | src/main/java/io/buji/pac4j/util/ShiroHelper.java | ShiroHelper.populateSubject | public static void populateSubject(final LinkedHashMap<String, CommonProfile> profiles) {
if (profiles != null && profiles.size() > 0) {
final List<CommonProfile> listProfiles = ProfileHelper.flatIntoAProfileList(profiles);
try {
if (IS_FULLY_AUTHENTICATED_AUTHORIZER.isAuthorized(null, listProfiles)) {
SecurityUtils.getSubject().login(new Pac4jToken(listProfiles, false));
} else if (IS_REMEMBERED_AUTHORIZER.isAuthorized(null, listProfiles)) {
SecurityUtils.getSubject().login(new Pac4jToken(listProfiles, true));
}
} catch (final HttpAction e) {
throw new TechnicalException(e);
}
}
} | java | public static void populateSubject(final LinkedHashMap<String, CommonProfile> profiles) {
if (profiles != null && profiles.size() > 0) {
final List<CommonProfile> listProfiles = ProfileHelper.flatIntoAProfileList(profiles);
try {
if (IS_FULLY_AUTHENTICATED_AUTHORIZER.isAuthorized(null, listProfiles)) {
SecurityUtils.getSubject().login(new Pac4jToken(listProfiles, false));
} else if (IS_REMEMBERED_AUTHORIZER.isAuthorized(null, listProfiles)) {
SecurityUtils.getSubject().login(new Pac4jToken(listProfiles, true));
}
} catch (final HttpAction e) {
throw new TechnicalException(e);
}
}
} | [
"public",
"static",
"void",
"populateSubject",
"(",
"final",
"LinkedHashMap",
"<",
"String",
",",
"CommonProfile",
">",
"profiles",
")",
"{",
"if",
"(",
"profiles",
"!=",
"null",
"&&",
"profiles",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"final",
"List... | Populate the authenticated user profiles in the Shiro subject.
@param profiles the linked hashmap of profiles | [
"Populate",
"the",
"authenticated",
"user",
"profiles",
"in",
"the",
"Shiro",
"subject",
"."
] | train | https://github.com/bujiio/buji-pac4j/blob/5ce149161f359074df09bc47b9f2aed8e17141a2/src/main/java/io/buji/pac4j/util/ShiroHelper.java#L51-L64 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalCell.java | CrystalCell.transfToOriginCell | public void transfToOriginCell(Tuple3d[] points, Tuple3d reference) {
reference = new Point3d(reference);//clone
transfToCrystal(reference);
int x = (int)Math.floor(reference.x);
int y = (int)Math.floor(reference.y);
int z = (int)Math.floor(reference.z);
for( Tuple3d point: points ) {
transfToCrystal(point);
point.x -= x;
point.y -= y;
point.z -= z;
transfToOrthonormal(point);
}
} | java | public void transfToOriginCell(Tuple3d[] points, Tuple3d reference) {
reference = new Point3d(reference);//clone
transfToCrystal(reference);
int x = (int)Math.floor(reference.x);
int y = (int)Math.floor(reference.y);
int z = (int)Math.floor(reference.z);
for( Tuple3d point: points ) {
transfToCrystal(point);
point.x -= x;
point.y -= y;
point.z -= z;
transfToOrthonormal(point);
}
} | [
"public",
"void",
"transfToOriginCell",
"(",
"Tuple3d",
"[",
"]",
"points",
",",
"Tuple3d",
"reference",
")",
"{",
"reference",
"=",
"new",
"Point3d",
"(",
"reference",
")",
";",
"//clone",
"transfToCrystal",
"(",
"reference",
")",
";",
"int",
"x",
"=",
"(... | Converts a set of points so that the reference point falls in the unit cell.
This is useful to transform a whole chain at once, allowing some of the
atoms to be outside the unit cell, but forcing the centroid to be within it.
@param points A set of points to transform (in orthonormal coordinates)
@param reference The reference point, which is unmodified but which would
be in the unit cell were it to have been transformed. It is safe to
use a member of the points array here. | [
"Converts",
"a",
"set",
"of",
"points",
"so",
"that",
"the",
"reference",
"point",
"falls",
"in",
"the",
"unit",
"cell",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalCell.java#L191-L206 |
Azure/azure-sdk-for-java | mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ConfigurationsInner.java | ConfigurationsInner.listByServerAsync | public Observable<List<ConfigurationInner>> listByServerAsync(String resourceGroupName, String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<ConfigurationInner>>, List<ConfigurationInner>>() {
@Override
public List<ConfigurationInner> call(ServiceResponse<List<ConfigurationInner>> response) {
return response.body();
}
});
} | java | public Observable<List<ConfigurationInner>> listByServerAsync(String resourceGroupName, String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<ConfigurationInner>>, List<ConfigurationInner>>() {
@Override
public List<ConfigurationInner> call(ServiceResponse<List<ConfigurationInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"ConfigurationInner",
">",
">",
"listByServerAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
")",
"{",
"return",
"listByServerWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
")",
... | List all the configurations in a given server.
@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.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<ConfigurationInner> object | [
"List",
"all",
"the",
"configurations",
"in",
"a",
"given",
"server",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ConfigurationsInner.java#L390-L397 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java | DatabasesInner.beginPauseAsync | public Observable<DatabaseInner> beginPauseAsync(String resourceGroupName, String serverName, String databaseName) {
return beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<DatabaseInner>, DatabaseInner>() {
@Override
public DatabaseInner call(ServiceResponse<DatabaseInner> response) {
return response.body();
}
});
} | java | public Observable<DatabaseInner> beginPauseAsync(String resourceGroupName, String serverName, String databaseName) {
return beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<DatabaseInner>, DatabaseInner>() {
@Override
public DatabaseInner call(ServiceResponse<DatabaseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DatabaseInner",
">",
"beginPauseAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
")",
"{",
"return",
"beginPauseWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
"... | Pauses a database.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database to be paused.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DatabaseInner object | [
"Pauses",
"a",
"database",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java#L1201-L1208 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.arrayStartsWith | public static boolean arrayStartsWith(final byte[] array, final byte[] str) {
boolean result = false;
if (array.length >= str.length) {
result = true;
int index = str.length;
while (--index >= 0) {
if (array[index] != str[index]) {
result = false;
break;
}
}
}
return result;
} | java | public static boolean arrayStartsWith(final byte[] array, final byte[] str) {
boolean result = false;
if (array.length >= str.length) {
result = true;
int index = str.length;
while (--index >= 0) {
if (array[index] != str[index]) {
result = false;
break;
}
}
}
return result;
} | [
"public",
"static",
"boolean",
"arrayStartsWith",
"(",
"final",
"byte",
"[",
"]",
"array",
",",
"final",
"byte",
"[",
"]",
"str",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"array",
".",
"length",
">=",
"str",
".",
"length",
")",
"{... | Check that a byte array starts with some byte values.
@param array array to be checked, must not be null
@param str a byte string which will be checked as the start sequence of the
array, must not be null
@return true if the string is the start sequence of the array, false
otherwise
@throws NullPointerException if any argument is null
@since 1.1 | [
"Check",
"that",
"a",
"byte",
"array",
"starts",
"with",
"some",
"byte",
"values",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L915-L928 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java | MappingUtils.objectImplements | public static boolean objectImplements(Object object, String interfaceClass) {
AssertUtils.assertNotNull(object);
boolean result = false;
Class[] interfaces = object.getClass().getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
if (interfaces[i].getName().equals(interfaceClass) == true) {
result = true;
break;
}
}
return result;
} | java | public static boolean objectImplements(Object object, String interfaceClass) {
AssertUtils.assertNotNull(object);
boolean result = false;
Class[] interfaces = object.getClass().getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
if (interfaces[i].getName().equals(interfaceClass) == true) {
result = true;
break;
}
}
return result;
} | [
"public",
"static",
"boolean",
"objectImplements",
"(",
"Object",
"object",
",",
"String",
"interfaceClass",
")",
"{",
"AssertUtils",
".",
"assertNotNull",
"(",
"object",
")",
";",
"boolean",
"result",
"=",
"false",
";",
"Class",
"[",
"]",
"interfaces",
"=",
... | Checks if Instance implements specified Interface
{@link Class#isAssignableFrom(Class)} is not used as Interface might not be available
and String representation can only be used
@param object Instance which would be checked
@param interfaceClass Interface with which it would be checked
@return true if Instance implements specified Interface | [
"Checks",
"if",
"Instance",
"implements",
"specified",
"Interface",
"{",
"@link",
"Class#isAssignableFrom",
"(",
"Class",
")",
"}",
"is",
"not",
"used",
"as",
"Interface",
"might",
"not",
"be",
"available",
"and",
"String",
"representation",
"can",
"only",
"be",... | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java#L332-L346 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/storage/lowlevel/akubra/HashPathIdMapper.java | HashPathIdMapper.getPath | private void getPath(String uri, StringBuilder builder) {
if (pattern.length() == 0) {
return;
}
String hash = getHash(uri);
int hashPos = 0;
for (int i = 0; i < pattern.length(); i++) {
char c = pattern.charAt(i);
if (c == '#') {
builder.append(hash.charAt(hashPos++));
} else {
builder.append(c);
}
}
builder.append('/');
} | java | private void getPath(String uri, StringBuilder builder) {
if (pattern.length() == 0) {
return;
}
String hash = getHash(uri);
int hashPos = 0;
for (int i = 0; i < pattern.length(); i++) {
char c = pattern.charAt(i);
if (c == '#') {
builder.append(hash.charAt(hashPos++));
} else {
builder.append(c);
}
}
builder.append('/');
} | [
"private",
"void",
"getPath",
"(",
"String",
"uri",
",",
"StringBuilder",
"builder",
")",
"{",
"if",
"(",
"pattern",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"String",
"hash",
"=",
"getHash",
"(",
"uri",
")",
";",
"int",
"h... | gets the path based on the hash of the uri, or "" if the pattern is empty | [
"gets",
"the",
"path",
"based",
"on",
"the",
"hash",
"of",
"the",
"uri",
"or",
"if",
"the",
"pattern",
"is",
"empty"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/storage/lowlevel/akubra/HashPathIdMapper.java#L130-L145 |
Azure/azure-sdk-for-java | containerinstance/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_10_01/implementation/ContainersInner.java | ContainersInner.executeCommand | public ContainerExecResponseInner executeCommand(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequest containerExecRequest) {
return executeCommandWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest).toBlocking().single().body();
} | java | public ContainerExecResponseInner executeCommand(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequest containerExecRequest) {
return executeCommandWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest).toBlocking().single().body();
} | [
"public",
"ContainerExecResponseInner",
"executeCommand",
"(",
"String",
"resourceGroupName",
",",
"String",
"containerGroupName",
",",
"String",
"containerName",
",",
"ContainerExecRequest",
"containerExecRequest",
")",
"{",
"return",
"executeCommandWithServiceResponseAsync",
... | Executes a command in a specific container instance.
Executes a command for a specific container instance in a specified resource group and container group.
@param resourceGroupName The name of the resource group.
@param containerGroupName The name of the container group.
@param containerName The name of the container instance.
@param containerExecRequest The request for the exec command.
@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 ContainerExecResponseInner object if successful. | [
"Executes",
"a",
"command",
"in",
"a",
"specific",
"container",
"instance",
".",
"Executes",
"a",
"command",
"for",
"a",
"specific",
"container",
"instance",
"in",
"a",
"specified",
"resource",
"group",
"and",
"container",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_10_01/implementation/ContainersInner.java#L273-L275 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.