repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java | ClusteredRoadPath.removeRoadSegmentAt | private RoadSegment removeRoadSegmentAt(RoadPath path, int index, PathIterator iterator) {
final int pathIndex = this.paths.indexOf(path);
assert pathIndex >= 0 && pathIndex < this.paths.size();
assert index >= 0 && index < path.size();
final RoadPath syncPath;
final RoadSegment sgmt;
if (index == 0 || index == path.size() - 1) {
// Remove one of the bounds of the path. if cause
// minimal insertion changes in the clustered road-path
sgmt = path.remove(index);
} else {
// Split the path somewhere between the first and last positions
sgmt = path.get(index);
assert sgmt != null;
final RoadPath rest = path.splitAfter(sgmt);
path.remove(sgmt);
if (rest != null && !rest.isEmpty()) {
// put back the rest of the segments
this.paths.add(pathIndex + 1, rest);
}
}
--this.segmentCount;
if (path.isEmpty()) {
this.paths.remove(path);
if (pathIndex > 0) {
syncPath = this.paths.get(pathIndex - 1);
} else {
syncPath = null;
}
} else {
syncPath = path;
}
if (iterator != null) {
iterator.reset(syncPath);
}
return sgmt;
} | java | private RoadSegment removeRoadSegmentAt(RoadPath path, int index, PathIterator iterator) {
final int pathIndex = this.paths.indexOf(path);
assert pathIndex >= 0 && pathIndex < this.paths.size();
assert index >= 0 && index < path.size();
final RoadPath syncPath;
final RoadSegment sgmt;
if (index == 0 || index == path.size() - 1) {
// Remove one of the bounds of the path. if cause
// minimal insertion changes in the clustered road-path
sgmt = path.remove(index);
} else {
// Split the path somewhere between the first and last positions
sgmt = path.get(index);
assert sgmt != null;
final RoadPath rest = path.splitAfter(sgmt);
path.remove(sgmt);
if (rest != null && !rest.isEmpty()) {
// put back the rest of the segments
this.paths.add(pathIndex + 1, rest);
}
}
--this.segmentCount;
if (path.isEmpty()) {
this.paths.remove(path);
if (pathIndex > 0) {
syncPath = this.paths.get(pathIndex - 1);
} else {
syncPath = null;
}
} else {
syncPath = path;
}
if (iterator != null) {
iterator.reset(syncPath);
}
return sgmt;
} | [
"private",
"RoadSegment",
"removeRoadSegmentAt",
"(",
"RoadPath",
"path",
",",
"int",
"index",
",",
"PathIterator",
"iterator",
")",
"{",
"final",
"int",
"pathIndex",
"=",
"this",
".",
"paths",
".",
"indexOf",
"(",
"path",
")",
";",
"assert",
"pathIndex",
">... | Remove the road segment at the given index in the given path.
<p>The given path must be inside the clustered road-path.
The given index is inside the path's segments.
@param path a path.
@param index an index.
@param iterator an iterator.
@return the removed segment, never <code>null</code>. | [
"Remove",
"the",
"road",
"segment",
"at",
"the",
"given",
"index",
"in",
"the",
"given",
"path",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java#L280-L316 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/FloatField.java | FloatField.setValue | public int setValue(double value, boolean bDisplayOption, int iMoveMode)
{ // Set this field's value
double dRoundAt = Math.pow(10, m_ibScale);
Float tempfloat = new Float((float)(Math.floor(value * dRoundAt + 0.5) / dRoundAt));
int iErrorCode = this.setData(tempfloat, bDisplayOption, iMoveMode);
return iErrorCode;
} | java | public int setValue(double value, boolean bDisplayOption, int iMoveMode)
{ // Set this field's value
double dRoundAt = Math.pow(10, m_ibScale);
Float tempfloat = new Float((float)(Math.floor(value * dRoundAt + 0.5) / dRoundAt));
int iErrorCode = this.setData(tempfloat, bDisplayOption, iMoveMode);
return iErrorCode;
} | [
"public",
"int",
"setValue",
"(",
"double",
"value",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"// Set this field's value",
"double",
"dRoundAt",
"=",
"Math",
".",
"pow",
"(",
"10",
",",
"m_ibScale",
")",
";",
"Float",
"tempfloat",
... | /*
Set the Value of this field as a double.
Note The value is rounded at the scale position.
@param value The value of this field.
@param iDisplayOption If true, display the new field.
@param iMoveMove The move mode.
@return An error code (NORMAL_RETURN for success). | [
"/",
"*",
"Set",
"the",
"Value",
"of",
"this",
"field",
"as",
"a",
"double",
".",
"Note",
"The",
"value",
"is",
"rounded",
"at",
"the",
"scale",
"position",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/FloatField.java#L202-L208 |
forge/furnace | container-api/src/main/java/org/jboss/forge/furnace/util/Strings.java | Strings.rangeOf | public static Range rangeOf(final String beginToken, final String endToken,
final String string, final int fromIndex)
{
int begin = string.indexOf(beginToken, fromIndex);
if (begin != -1)
{
int end = string.indexOf(endToken, begin + 1);
if (end != -1)
{
return new Range(begin, end);
}
}
return null;
} | java | public static Range rangeOf(final String beginToken, final String endToken,
final String string, final int fromIndex)
{
int begin = string.indexOf(beginToken, fromIndex);
if (begin != -1)
{
int end = string.indexOf(endToken, begin + 1);
if (end != -1)
{
return new Range(begin, end);
}
}
return null;
} | [
"public",
"static",
"Range",
"rangeOf",
"(",
"final",
"String",
"beginToken",
",",
"final",
"String",
"endToken",
",",
"final",
"String",
"string",
",",
"final",
"int",
"fromIndex",
")",
"{",
"int",
"begin",
"=",
"string",
".",
"indexOf",
"(",
"beginToken",
... | Return the range from a begining token to an ending token.
@param beginToken String to indicate begining of range.
@param endToken String to indicate ending of range.
@param string String to look for range in.
@param fromIndex Beginning index.
@return (begin index, end index) or <i>null</i>. | [
"Return",
"the",
"range",
"from",
"a",
"begining",
"token",
"to",
"an",
"ending",
"token",
"."
] | train | https://github.com/forge/furnace/blob/bbe6deaa3c0d85ba43daa3e2f7d486f2dad21e0a/container-api/src/main/java/org/jboss/forge/furnace/util/Strings.java#L359-L374 |
alibaba/jstorm | jstorm-core/src/main/java/backtype/storm/command/blobstore.java | blobstore.setupStormCode | private static void setupStormCode(Map conf, String topologyId, String topologyRoot, Set<String> activeKeys)
throws Exception {
Map<String, String> blobKeysToLocation = getBlobKeysToLocation(topologyRoot, topologyId);
for (Map.Entry<String, String> entry : blobKeysToLocation.entrySet()) {
String key = entry.getKey();
String location = entry.getValue();
if (!activeKeys.contains(key)) {
blobStore.createBlob(key, new FileInputStream(location), new SettableBlobMeta());
if (isLocalBlobStore) {
int versionInfo = BlobStoreUtils.getVersionForKey(key, nimbusInfo, conf);
clusterState.setup_blobstore(key, nimbusInfo, versionInfo);
}
}
}
System.out.println("Successfully create blobstore for topology " + topologyId);
} | java | private static void setupStormCode(Map conf, String topologyId, String topologyRoot, Set<String> activeKeys)
throws Exception {
Map<String, String> blobKeysToLocation = getBlobKeysToLocation(topologyRoot, topologyId);
for (Map.Entry<String, String> entry : blobKeysToLocation.entrySet()) {
String key = entry.getKey();
String location = entry.getValue();
if (!activeKeys.contains(key)) {
blobStore.createBlob(key, new FileInputStream(location), new SettableBlobMeta());
if (isLocalBlobStore) {
int versionInfo = BlobStoreUtils.getVersionForKey(key, nimbusInfo, conf);
clusterState.setup_blobstore(key, nimbusInfo, versionInfo);
}
}
}
System.out.println("Successfully create blobstore for topology " + topologyId);
} | [
"private",
"static",
"void",
"setupStormCode",
"(",
"Map",
"conf",
",",
"String",
"topologyId",
",",
"String",
"topologyRoot",
",",
"Set",
"<",
"String",
">",
"activeKeys",
")",
"throws",
"Exception",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"blobKeysT... | create local topology files in blobstore and sync metadata to zk | [
"create",
"local",
"topology",
"files",
"in",
"blobstore",
"and",
"sync",
"metadata",
"to",
"zk"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/command/blobstore.java#L84-L100 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java | GeneratedDConnectionDaoImpl.queryByProfileUrl | public Iterable<DConnection> queryByProfileUrl(java.lang.String profileUrl) {
return queryByField(null, DConnectionMapper.Field.PROFILEURL.getFieldName(), profileUrl);
} | java | public Iterable<DConnection> queryByProfileUrl(java.lang.String profileUrl) {
return queryByField(null, DConnectionMapper.Field.PROFILEURL.getFieldName(), profileUrl);
} | [
"public",
"Iterable",
"<",
"DConnection",
">",
"queryByProfileUrl",
"(",
"java",
".",
"lang",
".",
"String",
"profileUrl",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DConnectionMapper",
".",
"Field",
".",
"PROFILEURL",
".",
"getFieldName",
"(",
")"... | query-by method for field profileUrl
@param profileUrl the specified attribute
@return an Iterable of DConnections for the specified profileUrl | [
"query",
"-",
"by",
"method",
"for",
"field",
"profileUrl"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L106-L108 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WLink.java | WLink.handleRequest | @Override
public void handleRequest(final Request request) {
// Check if this link was the AJAX Trigger
AjaxOperation operation = AjaxHelper.getCurrentOperation();
boolean pressed = (operation != null && getId().equals(operation.getTriggerId()));
// Protect against client-side tampering of disabled/read-only fields.
if (isDisabled() && pressed) {
LOG.warn("A disabled link has been triggered. " + getText() + ". " + getId());
return;
}
// If an action has been supplied then execute it, but only after
// handle request has been performed on the entire component tree.
final Action action = getAction();
if (pressed && action != null) {
final ActionEvent event = new ActionEvent(this, getActionCommand(), getActionObject());
Runnable later = new Runnable() {
@Override
public void run() {
action.execute(event);
}
};
invokeLater(later);
}
} | java | @Override
public void handleRequest(final Request request) {
// Check if this link was the AJAX Trigger
AjaxOperation operation = AjaxHelper.getCurrentOperation();
boolean pressed = (operation != null && getId().equals(operation.getTriggerId()));
// Protect against client-side tampering of disabled/read-only fields.
if (isDisabled() && pressed) {
LOG.warn("A disabled link has been triggered. " + getText() + ". " + getId());
return;
}
// If an action has been supplied then execute it, but only after
// handle request has been performed on the entire component tree.
final Action action = getAction();
if (pressed && action != null) {
final ActionEvent event = new ActionEvent(this, getActionCommand(), getActionObject());
Runnable later = new Runnable() {
@Override
public void run() {
action.execute(event);
}
};
invokeLater(later);
}
} | [
"@",
"Override",
"public",
"void",
"handleRequest",
"(",
"final",
"Request",
"request",
")",
"{",
"// Check if this link was the AJAX Trigger",
"AjaxOperation",
"operation",
"=",
"AjaxHelper",
".",
"getCurrentOperation",
"(",
")",
";",
"boolean",
"pressed",
"=",
"(",
... | Override handleRequest in order to perform processing for this component. This implementation checks whether the
link has been pressed via the current ajax operation.
@param request the request being responded to. | [
"Override",
"handleRequest",
"in",
"order",
"to",
"perform",
"processing",
"for",
"this",
"component",
".",
"This",
"implementation",
"checks",
"whether",
"the",
"link",
"has",
"been",
"pressed",
"via",
"the",
"current",
"ajax",
"operation",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WLink.java#L377-L405 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/db/compaction/DateTieredCompactionStrategy.java | DateTieredCompactionStrategy.getNow | private long getNow()
{
return Collections.max(cfs.getSSTables(), new Comparator<SSTableReader>()
{
public int compare(SSTableReader o1, SSTableReader o2)
{
return Long.compare(o1.getMaxTimestamp(), o2.getMaxTimestamp());
}
}).getMaxTimestamp();
} | java | private long getNow()
{
return Collections.max(cfs.getSSTables(), new Comparator<SSTableReader>()
{
public int compare(SSTableReader o1, SSTableReader o2)
{
return Long.compare(o1.getMaxTimestamp(), o2.getMaxTimestamp());
}
}).getMaxTimestamp();
} | [
"private",
"long",
"getNow",
"(",
")",
"{",
"return",
"Collections",
".",
"max",
"(",
"cfs",
".",
"getSSTables",
"(",
")",
",",
"new",
"Comparator",
"<",
"SSTableReader",
">",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"SSTableReader",
"o1",
",",
... | Gets the timestamp that DateTieredCompactionStrategy considers to be the "current time".
@return the maximum timestamp across all SSTables.
@throws java.util.NoSuchElementException if there are no SSTables. | [
"Gets",
"the",
"timestamp",
"that",
"DateTieredCompactionStrategy",
"considers",
"to",
"be",
"the",
"current",
"time",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/compaction/DateTieredCompactionStrategy.java#L138-L147 |
paymill/paymill-java | src/main/java/com/paymill/services/PaymentService.java | PaymentService.createWithTokenAndClient | public Payment createWithTokenAndClient( String token, Client client ) {
if( client == null )
throw new IllegalArgumentException( "Client can not be null" );
return this.createWithTokenAndClient( token, client.getId() );
} | java | public Payment createWithTokenAndClient( String token, Client client ) {
if( client == null )
throw new IllegalArgumentException( "Client can not be null" );
return this.createWithTokenAndClient( token, client.getId() );
} | [
"public",
"Payment",
"createWithTokenAndClient",
"(",
"String",
"token",
",",
"Client",
"client",
")",
"{",
"if",
"(",
"client",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Client can not be null\"",
")",
";",
"return",
"this",
".",
"c... | Creates a credit card or direct debit {@link Payment} from a given token. With the provided {@link Client}, the
{@link Payment} will be created and subsequently be added to the given {@link Client}.
@param token
Token generated by PAYMILL Bridge, which represents a credit card or direct debit.
@param client
A {@link Client}, which is already stored in PAYMILL.
@return New PAYMILL {@link Payment}. | [
"Creates",
"a",
"credit",
"card",
"or",
"direct",
"debit",
"{"
] | train | https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/PaymentService.java#L119-L123 |
virgo47/javasimon | javaee/src/main/java/org/javasimon/javaee/SimonServletFilterUtils.java | SimonServletFilterUtils.getSimonName | public static String getSimonName(String uri, Replacer unallowedCharacterReplacer) {
if (uri.startsWith("/")) {
uri = uri.substring(1);
}
String name = unallowedCharacterReplacer.process(uri);
name = TO_DOT_PATTERN.process(name);
return name;
} | java | public static String getSimonName(String uri, Replacer unallowedCharacterReplacer) {
if (uri.startsWith("/")) {
uri = uri.substring(1);
}
String name = unallowedCharacterReplacer.process(uri);
name = TO_DOT_PATTERN.process(name);
return name;
} | [
"public",
"static",
"String",
"getSimonName",
"(",
"String",
"uri",
",",
"Replacer",
"unallowedCharacterReplacer",
")",
"{",
"if",
"(",
"uri",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"uri",
"=",
"uri",
".",
"substring",
"(",
"1",
")",
";",
"}",
... | Returns Simon name for the specified request (local name without any configured prefix). By default dots and all non-simon-name
compliant characters are removed first, then all slashes are switched to dots (repeating slashes make one dot).
@param uri request URI
@param unallowedCharacterReplacer replacer for characters that are not allowed in Simon name
@return local part of the Simon name for the request URI (without prefix) | [
"Returns",
"Simon",
"name",
"for",
"the",
"specified",
"request",
"(",
"local",
"name",
"without",
"any",
"configured",
"prefix",
")",
".",
"By",
"default",
"dots",
"and",
"all",
"non",
"-",
"simon",
"-",
"name",
"compliant",
"characters",
"are",
"removed",
... | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/javaee/src/main/java/org/javasimon/javaee/SimonServletFilterUtils.java#L47-L54 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java | StorageAccountsInner.listAccountSAS | public ListAccountSasResponseInner listAccountSAS(String resourceGroupName, String accountName, AccountSasParameters parameters) {
return listAccountSASWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body();
} | java | public ListAccountSasResponseInner listAccountSAS(String resourceGroupName, String accountName, AccountSasParameters parameters) {
return listAccountSASWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body();
} | [
"public",
"ListAccountSasResponseInner",
"listAccountSAS",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"AccountSasParameters",
"parameters",
")",
"{",
"return",
"listAccountSASWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
... | List SAS credentials of a storage account.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param parameters The parameters to provide to list SAS credentials for the storage account.
@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 ListAccountSasResponseInner object if successful. | [
"List",
"SAS",
"credentials",
"of",
"a",
"storage",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java#L1015-L1017 |
neoremind/fluent-validator | fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/ValidatorContext.java | ValidatorContext.getAttribute | public <T> T getAttribute(String key, Class<T> clazz) {
return (T) getAttribute(key);
} | java | public <T> T getAttribute(String key, Class<T> clazz) {
return (T) getAttribute(key);
} | [
"public",
"<",
"T",
">",
"T",
"getAttribute",
"(",
"String",
"key",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"(",
"T",
")",
"getAttribute",
"(",
"key",
")",
";",
"}"
] | 根据类型<t>T</t>直接获取属性值
@param key 键
@param clazz 值类型
@return 值 | [
"根据类型<t",
">",
"T<",
"/",
"t",
">",
"直接获取属性值"
] | train | https://github.com/neoremind/fluent-validator/blob/b516970591aa9468b44ba63938b98ec341fd6ead/fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/ValidatorContext.java#L79-L81 |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/DataSetUtils.java | DataSetUtils.countElementsPerPartition | public static <T> DataSet<Tuple2<Integer, Long>> countElementsPerPartition(DataSet<T> input) {
return input.mapPartition(new RichMapPartitionFunction<T, Tuple2<Integer, Long>>() {
@Override
public void mapPartition(Iterable<T> values, Collector<Tuple2<Integer, Long>> out) throws Exception {
long counter = 0;
for (T value : values) {
counter++;
}
out.collect(new Tuple2<>(getRuntimeContext().getIndexOfThisSubtask(), counter));
}
});
} | java | public static <T> DataSet<Tuple2<Integer, Long>> countElementsPerPartition(DataSet<T> input) {
return input.mapPartition(new RichMapPartitionFunction<T, Tuple2<Integer, Long>>() {
@Override
public void mapPartition(Iterable<T> values, Collector<Tuple2<Integer, Long>> out) throws Exception {
long counter = 0;
for (T value : values) {
counter++;
}
out.collect(new Tuple2<>(getRuntimeContext().getIndexOfThisSubtask(), counter));
}
});
} | [
"public",
"static",
"<",
"T",
">",
"DataSet",
"<",
"Tuple2",
"<",
"Integer",
",",
"Long",
">",
">",
"countElementsPerPartition",
"(",
"DataSet",
"<",
"T",
">",
"input",
")",
"{",
"return",
"input",
".",
"mapPartition",
"(",
"new",
"RichMapPartitionFunction",... | Method that goes over all the elements in each partition in order to retrieve
the total number of elements.
@param input the DataSet received as input
@return a data set containing tuples of subtask index, number of elements mappings. | [
"Method",
"that",
"goes",
"over",
"all",
"the",
"elements",
"in",
"each",
"partition",
"in",
"order",
"to",
"retrieve",
"the",
"total",
"number",
"of",
"elements",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/DataSetUtils.java#L69-L80 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java | SeaGlassLookAndFeel.defineInternalFrameIconifyButtons | private void defineInternalFrameIconifyButtons(UIDefaults d) {
String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.iconifyButton\"";
String c = PAINTER_PREFIX + "TitlePaneIconifyButtonPainter";
d.put(p + ".States", "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,WindowNotFocused,WindowMinimized");
d.put(p + ".WindowNotFocused", new TitlePaneIconifyButtonWindowNotFocusedState());
d.put(p + ".WindowMinimized", new TitlePaneIconifyButtonWindowMinimizedState());
d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
// Set the iconify button states.
d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_ENABLED));
d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_DISABLED));
d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MOUSEOVER));
d.put(p + "[Pressed].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_PRESSED));
d.put(p + "[Enabled+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_ENABLED_WINDOWNOTFOCUSED));
d.put(p + "[MouseOver+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MOUSEOVER_WINDOWNOTFOCUSED));
d.put(p + "[Pressed+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_PRESSED_WINDOWNOTFOCUSED));
// Set the restore button states.
d.put(p + "[Disabled+WindowMinimized].backgroundPainter",
new LazyPainter(c,
TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_DISABLED));
d.put(p + "[Enabled+WindowMinimized].backgroundPainter",
new LazyPainter(c,
TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_ENABLED));
d.put(p + "[MouseOver+WindowMinimized].backgroundPainter",
new LazyPainter(c,
TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_MOUSEOVER));
d.put(p + "[Pressed+WindowMinimized].backgroundPainter",
new LazyPainter(c,
TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_PRESSED));
d.put(p + "[Enabled+WindowMinimized+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_ENABLED_WINDOWNOTFOCUSED));
d.put(p + "[MouseOver+WindowMinimized+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_MOUSEOVER_WINDOWNOTFOCUSED));
d.put(p + "[Pressed+WindowMinimized+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_PRESSED_WINDOWNOTFOCUSED));
d.put(p + ".icon", new SeaGlassIcon(p, "iconPainter", 26, 18));
} | java | private void defineInternalFrameIconifyButtons(UIDefaults d) {
String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.iconifyButton\"";
String c = PAINTER_PREFIX + "TitlePaneIconifyButtonPainter";
d.put(p + ".States", "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,WindowNotFocused,WindowMinimized");
d.put(p + ".WindowNotFocused", new TitlePaneIconifyButtonWindowNotFocusedState());
d.put(p + ".WindowMinimized", new TitlePaneIconifyButtonWindowMinimizedState());
d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
// Set the iconify button states.
d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_ENABLED));
d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_DISABLED));
d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MOUSEOVER));
d.put(p + "[Pressed].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_PRESSED));
d.put(p + "[Enabled+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_ENABLED_WINDOWNOTFOCUSED));
d.put(p + "[MouseOver+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MOUSEOVER_WINDOWNOTFOCUSED));
d.put(p + "[Pressed+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_PRESSED_WINDOWNOTFOCUSED));
// Set the restore button states.
d.put(p + "[Disabled+WindowMinimized].backgroundPainter",
new LazyPainter(c,
TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_DISABLED));
d.put(p + "[Enabled+WindowMinimized].backgroundPainter",
new LazyPainter(c,
TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_ENABLED));
d.put(p + "[MouseOver+WindowMinimized].backgroundPainter",
new LazyPainter(c,
TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_MOUSEOVER));
d.put(p + "[Pressed+WindowMinimized].backgroundPainter",
new LazyPainter(c,
TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_PRESSED));
d.put(p + "[Enabled+WindowMinimized+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_ENABLED_WINDOWNOTFOCUSED));
d.put(p + "[MouseOver+WindowMinimized+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_MOUSEOVER_WINDOWNOTFOCUSED));
d.put(p + "[Pressed+WindowMinimized+WindowNotFocused].backgroundPainter",
new LazyPainter(c,
TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_PRESSED_WINDOWNOTFOCUSED));
d.put(p + ".icon", new SeaGlassIcon(p, "iconPainter", 26, 18));
} | [
"private",
"void",
"defineInternalFrameIconifyButtons",
"(",
"UIDefaults",
"d",
")",
"{",
"String",
"p",
"=",
"\"InternalFrame:InternalFrameTitlePane:\\\"InternalFrameTitlePane.iconifyButton\\\"\"",
";",
"String",
"c",
"=",
"PAINTER_PREFIX",
"+",
"\"TitlePaneIconifyButtonPainter\... | Initialize the internal frame iconify button settings.
@param d the UI defaults map. | [
"Initialize",
"the",
"internal",
"frame",
"iconify",
"button",
"settings",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1259-L1301 |
salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/NamespaceResources.java | NamespaceResources.updateUsersForNamespace | @PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{namespaceId}/users")
@Description("Update users allowed to use this namespace.")
public NamespaceDto updateUsersForNamespace(@Context HttpServletRequest req,
@PathParam("namespaceId") final BigInteger namespaceId, final Set<String> usernames) {
PrincipalUser remoteUser = getRemoteUser(req);
if (namespaceId == null || namespaceId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Namespace Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
if (usernames == null) {
throw new WebApplicationException("Cannot update with null users.", Status.BAD_REQUEST);
}
Namespace namespace = _namespaceService.findNamespaceByPrimaryKey(namespaceId);
if (namespace == null) {
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
}
validateResourceAuthorization(req, namespace.getCreatedBy(), remoteUser);
namespace.setUsers(_getPrincipalUserByUserName(usernames));
namespace = _namespaceService.updateNamespace(namespace);
return NamespaceDto.transformToDto(namespace);
} | java | @PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{namespaceId}/users")
@Description("Update users allowed to use this namespace.")
public NamespaceDto updateUsersForNamespace(@Context HttpServletRequest req,
@PathParam("namespaceId") final BigInteger namespaceId, final Set<String> usernames) {
PrincipalUser remoteUser = getRemoteUser(req);
if (namespaceId == null || namespaceId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Namespace Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
if (usernames == null) {
throw new WebApplicationException("Cannot update with null users.", Status.BAD_REQUEST);
}
Namespace namespace = _namespaceService.findNamespaceByPrimaryKey(namespaceId);
if (namespace == null) {
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
}
validateResourceAuthorization(req, namespace.getCreatedBy(), remoteUser);
namespace.setUsers(_getPrincipalUserByUserName(usernames));
namespace = _namespaceService.updateNamespace(namespace);
return NamespaceDto.transformToDto(namespace);
} | [
"@",
"PUT",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Consumes",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Path",
"(",
"\"/{namespaceId}/users\"",
")",
"@",
"Description",
"(",
"\"Update users allowed to use this namespace.\"",... | Update users allowed to use this namespace.
@param req The HTTP request.
@param namespaceId The namespace ID to update.
@param usernames The list of authorized users.
@return The updated namespace.
@throws WebApplicationException If an error occurs. | [
"Update",
"users",
"allowed",
"to",
"use",
"this",
"namespace",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/NamespaceResources.java#L129-L154 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/inventory.java | inventory.get | public static inventory get(nitro_service client, inventory resource) throws Exception
{
resource.validate("get");
return ((inventory[]) resource.get_resources(client))[0];
} | java | public static inventory get(nitro_service client, inventory resource) throws Exception
{
resource.validate("get");
return ((inventory[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"inventory",
"get",
"(",
"nitro_service",
"client",
",",
"inventory",
"resource",
")",
"throws",
"Exception",
"{",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",
"return",
"(",
"(",
"inventory",
"[",
"]",
")",
"resource",
".",
"... | Use this operation to start inventory of a given device. All devices if device IP Address is not specified.. | [
"Use",
"this",
"operation",
"to",
"start",
"inventory",
"of",
"a",
"given",
"device",
".",
"All",
"devices",
"if",
"device",
"IP",
"Address",
"is",
"not",
"specified",
".."
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/inventory.java#L107-L111 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslcertkey_service_binding.java | sslcertkey_service_binding.count_filtered | public static long count_filtered(nitro_service service, String certkey, String filter) throws Exception{
sslcertkey_service_binding obj = new sslcertkey_service_binding();
obj.set_certkey(certkey);
options option = new options();
option.set_count(true);
option.set_filter(filter);
sslcertkey_service_binding[] response = (sslcertkey_service_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | java | public static long count_filtered(nitro_service service, String certkey, String filter) throws Exception{
sslcertkey_service_binding obj = new sslcertkey_service_binding();
obj.set_certkey(certkey);
options option = new options();
option.set_count(true);
option.set_filter(filter);
sslcertkey_service_binding[] response = (sslcertkey_service_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | [
"public",
"static",
"long",
"count_filtered",
"(",
"nitro_service",
"service",
",",
"String",
"certkey",
",",
"String",
"filter",
")",
"throws",
"Exception",
"{",
"sslcertkey_service_binding",
"obj",
"=",
"new",
"sslcertkey_service_binding",
"(",
")",
";",
"obj",
... | Use this API to count the filtered set of sslcertkey_service_binding resources.
filter string should be in JSON format.eg: "port:80,servicetype:HTTP". | [
"Use",
"this",
"API",
"to",
"count",
"the",
"filtered",
"set",
"of",
"sslcertkey_service_binding",
"resources",
".",
"filter",
"string",
"should",
"be",
"in",
"JSON",
"format",
".",
"eg",
":",
"port",
":",
"80",
"servicetype",
":",
"HTTP",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslcertkey_service_binding.java#L284-L295 |
voldemort/voldemort | src/java/voldemort/tools/Repartitioner.java | Repartitioner.randomShufflePartitions | public static Cluster randomShufflePartitions(final Cluster nextCandidateCluster,
final int randomSwapAttempts,
final int randomSwapSuccesses,
final List<Integer> randomSwapZoneIds,
List<StoreDefinition> storeDefs) {
List<Integer> zoneIds = null;
if(randomSwapZoneIds.isEmpty()) {
zoneIds = new ArrayList<Integer>(nextCandidateCluster.getZoneIds());
} else {
zoneIds = new ArrayList<Integer>(randomSwapZoneIds);
}
List<Integer> nodeIds = new ArrayList<Integer>();
Cluster returnCluster = Cluster.cloneCluster(nextCandidateCluster);
double currentUtility = new PartitionBalance(returnCluster, storeDefs).getUtility();
int successes = 0;
for(int i = 0; i < randomSwapAttempts; i++) {
// Iterate over zone ids to decide which node ids to include for
// intra-zone swapping.
// In future, if there is a need to support inter-zone swapping,
// then just remove the
// zone specific logic that populates nodeIdSet and add all nodes
// from across all zones.
int zoneIdOffset = i % zoneIds.size();
Set<Integer> nodeIdSet = nextCandidateCluster.getNodeIdsInZone(zoneIds.get(zoneIdOffset));
nodeIds = new ArrayList<Integer>(nodeIdSet);
Collections.shuffle(zoneIds, new Random(System.currentTimeMillis()));
Cluster shuffleResults = swapRandomPartitionsAmongNodes(returnCluster, nodeIds);
double nextUtility = new PartitionBalance(shuffleResults, storeDefs).getUtility();
if(nextUtility < currentUtility) {
System.out.println("Swap improved max-min ratio: " + currentUtility + " -> "
+ nextUtility + " (improvement " + successes
+ " on swap attempt " + i + ")");
successes++;
returnCluster = shuffleResults;
currentUtility = nextUtility;
}
if(successes >= randomSwapSuccesses) {
// Enough successes, move on.
break;
}
}
return returnCluster;
} | java | public static Cluster randomShufflePartitions(final Cluster nextCandidateCluster,
final int randomSwapAttempts,
final int randomSwapSuccesses,
final List<Integer> randomSwapZoneIds,
List<StoreDefinition> storeDefs) {
List<Integer> zoneIds = null;
if(randomSwapZoneIds.isEmpty()) {
zoneIds = new ArrayList<Integer>(nextCandidateCluster.getZoneIds());
} else {
zoneIds = new ArrayList<Integer>(randomSwapZoneIds);
}
List<Integer> nodeIds = new ArrayList<Integer>();
Cluster returnCluster = Cluster.cloneCluster(nextCandidateCluster);
double currentUtility = new PartitionBalance(returnCluster, storeDefs).getUtility();
int successes = 0;
for(int i = 0; i < randomSwapAttempts; i++) {
// Iterate over zone ids to decide which node ids to include for
// intra-zone swapping.
// In future, if there is a need to support inter-zone swapping,
// then just remove the
// zone specific logic that populates nodeIdSet and add all nodes
// from across all zones.
int zoneIdOffset = i % zoneIds.size();
Set<Integer> nodeIdSet = nextCandidateCluster.getNodeIdsInZone(zoneIds.get(zoneIdOffset));
nodeIds = new ArrayList<Integer>(nodeIdSet);
Collections.shuffle(zoneIds, new Random(System.currentTimeMillis()));
Cluster shuffleResults = swapRandomPartitionsAmongNodes(returnCluster, nodeIds);
double nextUtility = new PartitionBalance(shuffleResults, storeDefs).getUtility();
if(nextUtility < currentUtility) {
System.out.println("Swap improved max-min ratio: " + currentUtility + " -> "
+ nextUtility + " (improvement " + successes
+ " on swap attempt " + i + ")");
successes++;
returnCluster = shuffleResults;
currentUtility = nextUtility;
}
if(successes >= randomSwapSuccesses) {
// Enough successes, move on.
break;
}
}
return returnCluster;
} | [
"public",
"static",
"Cluster",
"randomShufflePartitions",
"(",
"final",
"Cluster",
"nextCandidateCluster",
",",
"final",
"int",
"randomSwapAttempts",
",",
"final",
"int",
"randomSwapSuccesses",
",",
"final",
"List",
"<",
"Integer",
">",
"randomSwapZoneIds",
",",
"List... | Randomly shuffle partitions between nodes within every zone.
@param nextCandidateCluster cluster object.
@param randomSwapAttempts See RebalanceCLI.
@param randomSwapSuccesses See RebalanceCLI.
@param randomSwapZoneIds The set of zoneIds to consider. Each zone is done
independently.
@param storeDefs List of store definitions
@return updated cluster | [
"Randomly",
"shuffle",
"partitions",
"between",
"nodes",
"within",
"every",
"zone",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/Repartitioner.java#L705-L754 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/CommonUtils.java | CommonUtils.getPrimaryGroupName | public static String getPrimaryGroupName(String userName, AlluxioConfiguration conf)
throws IOException {
List<String> groups = getGroups(userName, conf);
return (groups != null && groups.size() > 0) ? groups.get(0) : "";
} | java | public static String getPrimaryGroupName(String userName, AlluxioConfiguration conf)
throws IOException {
List<String> groups = getGroups(userName, conf);
return (groups != null && groups.size() > 0) ? groups.get(0) : "";
} | [
"public",
"static",
"String",
"getPrimaryGroupName",
"(",
"String",
"userName",
",",
"AlluxioConfiguration",
"conf",
")",
"throws",
"IOException",
"{",
"List",
"<",
"String",
">",
"groups",
"=",
"getGroups",
"(",
"userName",
",",
"conf",
")",
";",
"return",
"(... | Gets the primary group name of a user.
@param userName Alluxio user name
@param conf Alluxio configuration
@return primary group name | [
"Gets",
"the",
"primary",
"group",
"name",
"of",
"a",
"user",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/CommonUtils.java#L321-L325 |
Netflix/denominator | clouddns/src/main/java/denominator/clouddns/CloudDNSResourceRecordSetApi.java | CloudDNSResourceRecordSetApi.getPriority | private Integer getPriority(Map<String, Object> mutableRData) {
Integer priority = null;
if (mutableRData.containsKey("priority")) { // SRVData
priority = Integer.class.cast(mutableRData.remove("priority"));
} else if (mutableRData.containsKey("preference")) { // MXData
priority = Integer.class.cast(mutableRData.remove("preference"));
}
return priority;
} | java | private Integer getPriority(Map<String, Object> mutableRData) {
Integer priority = null;
if (mutableRData.containsKey("priority")) { // SRVData
priority = Integer.class.cast(mutableRData.remove("priority"));
} else if (mutableRData.containsKey("preference")) { // MXData
priority = Integer.class.cast(mutableRData.remove("preference"));
}
return priority;
} | [
"private",
"Integer",
"getPriority",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"mutableRData",
")",
"{",
"Integer",
"priority",
"=",
"null",
";",
"if",
"(",
"mutableRData",
".",
"containsKey",
"(",
"\"priority\"",
")",
")",
"{",
"// SRVData",
"priority"... | Has the side effect of removing the priority from the mutableRData.
@return null or the priority, if it exists for a MX or SRV record | [
"Has",
"the",
"side",
"effect",
"of",
"removing",
"the",
"priority",
"from",
"the",
"mutableRData",
"."
] | train | https://github.com/Netflix/denominator/blob/c565e3b8c6043051252e0947029511f9ac5d306f/clouddns/src/main/java/denominator/clouddns/CloudDNSResourceRecordSetApi.java#L119-L129 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/tools/net/support/AbstractClientServerSupport.java | AbstractClientServerSupport.newSocket | public Socket newSocket(String host, int port) {
try {
Socket socket = newSocket();
socket.setReuseAddress(DEFAULT_REUSE_ADDRESS);
socket.setSoTimeout(intValue(DEFAULT_SO_TIMEOUT));
socket.connect(newSocketAddress(host, port));
return socket;
}
catch (IOException cause) {
throw newRuntimeException(cause, "Failed to create a client Socket on host [%s] and port [%d]", host, port);
}
} | java | public Socket newSocket(String host, int port) {
try {
Socket socket = newSocket();
socket.setReuseAddress(DEFAULT_REUSE_ADDRESS);
socket.setSoTimeout(intValue(DEFAULT_SO_TIMEOUT));
socket.connect(newSocketAddress(host, port));
return socket;
}
catch (IOException cause) {
throw newRuntimeException(cause, "Failed to create a client Socket on host [%s] and port [%d]", host, port);
}
} | [
"public",
"Socket",
"newSocket",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"try",
"{",
"Socket",
"socket",
"=",
"newSocket",
"(",
")",
";",
"socket",
".",
"setReuseAddress",
"(",
"DEFAULT_REUSE_ADDRESS",
")",
";",
"socket",
".",
"setSoTimeout",
... | Constructs and configures a new client {@link Socket}.
Sets {@link Socket#setReuseAddress(boolean)} to {@literal true} and sets the {@link Socket#setSoTimeout(int)}
to {@literal 15 seconds}.
@param host {@link String} specifying the host on which the server is running.
@param port {@link Integer} specifying the port on which the server is listening.
@return a new client {@link Socket} connected to host and port.
@throws RuntimeException if the {@link Socket} could not be created.
@see java.net.Socket | [
"Constructs",
"and",
"configures",
"a",
"new",
"client",
"{",
"@link",
"Socket",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/tools/net/support/AbstractClientServerSupport.java#L154-L165 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java | ApiOvhDbaaslogs.serviceName_output_graylog_stream_streamId_archive_archiveId_url_POST | public OvhArchiveUrl serviceName_output_graylog_stream_streamId_archive_archiveId_url_POST(String serviceName, String streamId, String archiveId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/archive/{archiveId}/url";
StringBuilder sb = path(qPath, serviceName, streamId, archiveId);
String resp = exec(qPath, "POST", sb.toString(), null);
return convertTo(resp, OvhArchiveUrl.class);
} | java | public OvhArchiveUrl serviceName_output_graylog_stream_streamId_archive_archiveId_url_POST(String serviceName, String streamId, String archiveId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/archive/{archiveId}/url";
StringBuilder sb = path(qPath, serviceName, streamId, archiveId);
String resp = exec(qPath, "POST", sb.toString(), null);
return convertTo(resp, OvhArchiveUrl.class);
} | [
"public",
"OvhArchiveUrl",
"serviceName_output_graylog_stream_streamId_archive_archiveId_url_POST",
"(",
"String",
"serviceName",
",",
"String",
"streamId",
",",
"String",
"archiveId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dbaas/logs/{serviceName}/outpu... | Get a public temporary URL to access the archive
REST: POST /dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/archive/{archiveId}/url
@param serviceName [required] Service name
@param streamId [required] Stream ID
@param archiveId [required] Archive ID | [
"Get",
"a",
"public",
"temporary",
"URL",
"to",
"access",
"the",
"archive"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L1472-L1477 |
opensourceBIM/BIMserver | PluginBase/src/org/bimserver/geometry/Matrix.java | Matrix.setIdentityM | public static void setIdentityM(float[] sm, int smOffset) {
for (int i=0 ; i<16 ; i++) {
sm[smOffset + i] = 0;
}
for(int i = 0; i < 16; i += 5) {
sm[smOffset + i] = 1.0f;
}
} | java | public static void setIdentityM(float[] sm, int smOffset) {
for (int i=0 ; i<16 ; i++) {
sm[smOffset + i] = 0;
}
for(int i = 0; i < 16; i += 5) {
sm[smOffset + i] = 1.0f;
}
} | [
"public",
"static",
"void",
"setIdentityM",
"(",
"float",
"[",
"]",
"sm",
",",
"int",
"smOffset",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"16",
";",
"i",
"++",
")",
"{",
"sm",
"[",
"smOffset",
"+",
"i",
"]",
"=",
"0",
";",
... | Sets matrix m to the identity matrix.
@param sm returns the result
@param smOffset index into sm where the result matrix starts | [
"Sets",
"matrix",
"m",
"to",
"the",
"identity",
"matrix",
"."
] | train | https://github.com/opensourceBIM/BIMserver/blob/116803c3047d1b32217366757cee1bb3880fda63/PluginBase/src/org/bimserver/geometry/Matrix.java#L653-L660 |
allcolor/YaHP-Converter | YaHPConverter/src/org/allcolor/yahp/converter/CClassLoader.java | CClassLoader.getLoader | public static final CClassLoader getLoader(final String fpath) {
String path = fpath;
CClassLoader currentLoader = CClassLoader.rootLoader;
if (path == null) {
return CClassLoader.getRootLoader();
}
if (path.startsWith(CClassLoader.ROOT_LOADER)) {
path = path.substring(10);
}
final StringTokenizer tokenizer = new StringTokenizer(path, "/", false);
while (tokenizer.hasMoreTokens()) {
final String name = tokenizer.nextToken();
currentLoader = currentLoader.getLoaderByName(name);
}
return currentLoader;
} | java | public static final CClassLoader getLoader(final String fpath) {
String path = fpath;
CClassLoader currentLoader = CClassLoader.rootLoader;
if (path == null) {
return CClassLoader.getRootLoader();
}
if (path.startsWith(CClassLoader.ROOT_LOADER)) {
path = path.substring(10);
}
final StringTokenizer tokenizer = new StringTokenizer(path, "/", false);
while (tokenizer.hasMoreTokens()) {
final String name = tokenizer.nextToken();
currentLoader = currentLoader.getLoaderByName(name);
}
return currentLoader;
} | [
"public",
"static",
"final",
"CClassLoader",
"getLoader",
"(",
"final",
"String",
"fpath",
")",
"{",
"String",
"path",
"=",
"fpath",
";",
"CClassLoader",
"currentLoader",
"=",
"CClassLoader",
".",
"rootLoader",
";",
"if",
"(",
"path",
"==",
"null",
")",
"{",... | return the loader with the given path
@param fpath
the path to lookup
@return the loader with the given path | [
"return",
"the",
"loader",
"with",
"the",
"given",
"path"
] | train | https://github.com/allcolor/YaHP-Converter/blob/d72745281766a784a6b319f3787aa1d8de7cd0fe/YaHPConverter/src/org/allcolor/yahp/converter/CClassLoader.java#L689-L709 |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/core/SetSupport.java | SetSupport.convertToExpectedType | private Object convertToExpectedType(final Object value, Method m) throws ELException {
if (value == null) {
return null;
}
Class<?> expectedType = m.getParameterTypes()[0];
return getExpressionFactory().coerceToType(value, expectedType);
} | java | private Object convertToExpectedType(final Object value, Method m) throws ELException {
if (value == null) {
return null;
}
Class<?> expectedType = m.getParameterTypes()[0];
return getExpressionFactory().coerceToType(value, expectedType);
} | [
"private",
"Object",
"convertToExpectedType",
"(",
"final",
"Object",
"value",
",",
"Method",
"m",
")",
"throws",
"ELException",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Class",
"<",
"?",
">",
"expectedType",
"=",
"m"... | Convert an object to an expected type of the method parameter according to the conversion
rules of the Expression Language.
@param value the value to convert
@param m the setter method
@return value converted to an instance of the expected type; will be null if value was null
@throws javax.el.ELException if there was a problem coercing the value | [
"Convert",
"an",
"object",
"to",
"an",
"expected",
"type",
"of",
"the",
"method",
"parameter",
"according",
"to",
"the",
"conversion",
"rules",
"of",
"the",
"Expression",
"Language",
"."
] | train | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/core/SetSupport.java#L256-L262 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/locale/Locale.java | Locale.getString | @Pure
public static String getString(ClassLoader classLoader, String key, Object... params) {
return getString(classLoader, detectResourceClass(null), key, params);
} | java | @Pure
public static String getString(ClassLoader classLoader, String key, Object... params) {
return getString(classLoader, detectResourceClass(null), key, params);
} | [
"@",
"Pure",
"public",
"static",
"String",
"getString",
"(",
"ClassLoader",
"classLoader",
",",
"String",
"key",
",",
"Object",
"...",
"params",
")",
"{",
"return",
"getString",
"(",
"classLoader",
",",
"detectResourceClass",
"(",
"null",
")",
",",
"key",
",... | Replies the text that corresponds to the specified resource.
<p>This function assumes the classname of the caller as the
resource provider.
@param classLoader is the classLoader to use.
@param key is the name of the resource into the specified file
@param params is the the list of parameters which will
replaces the <code>#1</code>, <code>#2</code>... into the string.
@return the text that corresponds to the specified resource | [
"Replies",
"the",
"text",
"that",
"corresponds",
"to",
"the",
"specified",
"resource",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/locale/Locale.java#L326-L329 |
fcrepo4-labs/fcrepo4-client | fcrepo-client-impl/src/main/java/org/fcrepo/client/utils/HttpHelper.java | HttpHelper.createPostMethod | public HttpPost createPostMethod(final String path, final Map<String, List<String>> params) {
return new HttpPost(repositoryURL + path + queryString(params));
} | java | public HttpPost createPostMethod(final String path, final Map<String, List<String>> params) {
return new HttpPost(repositoryURL + path + queryString(params));
} | [
"public",
"HttpPost",
"createPostMethod",
"(",
"final",
"String",
"path",
",",
"final",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"params",
")",
"{",
"return",
"new",
"HttpPost",
"(",
"repositoryURL",
"+",
"path",
"+",
"queryString",
"(",... | Create POST method with list of parameters
@param path Resource path, relative to repository baseURL
@param params Query parameters
@return PUT method | [
"Create",
"POST",
"method",
"with",
"list",
"of",
"parameters"
] | train | https://github.com/fcrepo4-labs/fcrepo4-client/blob/21eaf27200c5b2542095f6ebb9dd8ec865b95bbd/fcrepo-client-impl/src/main/java/org/fcrepo/client/utils/HttpHelper.java#L261-L263 |
libgdx/gdx-ai | gdx-ai/src/com/badlogic/gdx/ai/utils/ArithmeticUtils.java | ArithmeticUtils.gcdPositive | public static int gcdPositive (int a, int b) {
if (a == 0) return b;
if (b == 0) return a;
// Make "a" and "b" odd, keeping track of common power of 2.
final int aTwos = Integer.numberOfTrailingZeros(a);
a >>= aTwos;
final int bTwos = Integer.numberOfTrailingZeros(b);
b >>= bTwos;
final int shift = aTwos <= bTwos ? aTwos : bTwos; // min(aTwos, bTwos);
// "a" and "b" are positive.
// If a > b then "gdc(a, b)" is equal to "gcd(a - b, b)".
// If a < b then "gcd(a, b)" is equal to "gcd(b - a, a)".
// Hence, in the successive iterations:
// "a" becomes the absolute difference of the current values,
// "b" becomes the minimum of the current values.
while (a != b) {
final int delta = a - b;
b = a <= b ? a : b; // min(a, b);
a = delta < 0 ? -delta : delta; // abs(delta);
// Remove any power of 2 in "a" ("b" is guaranteed to be odd).
a >>= Integer.numberOfTrailingZeros(a);
}
// Recover the common power of 2.
return a << shift;
} | java | public static int gcdPositive (int a, int b) {
if (a == 0) return b;
if (b == 0) return a;
// Make "a" and "b" odd, keeping track of common power of 2.
final int aTwos = Integer.numberOfTrailingZeros(a);
a >>= aTwos;
final int bTwos = Integer.numberOfTrailingZeros(b);
b >>= bTwos;
final int shift = aTwos <= bTwos ? aTwos : bTwos; // min(aTwos, bTwos);
// "a" and "b" are positive.
// If a > b then "gdc(a, b)" is equal to "gcd(a - b, b)".
// If a < b then "gcd(a, b)" is equal to "gcd(b - a, a)".
// Hence, in the successive iterations:
// "a" becomes the absolute difference of the current values,
// "b" becomes the minimum of the current values.
while (a != b) {
final int delta = a - b;
b = a <= b ? a : b; // min(a, b);
a = delta < 0 ? -delta : delta; // abs(delta);
// Remove any power of 2 in "a" ("b" is guaranteed to be odd).
a >>= Integer.numberOfTrailingZeros(a);
}
// Recover the common power of 2.
return a << shift;
} | [
"public",
"static",
"int",
"gcdPositive",
"(",
"int",
"a",
",",
"int",
"b",
")",
"{",
"if",
"(",
"a",
"==",
"0",
")",
"return",
"b",
";",
"if",
"(",
"b",
"==",
"0",
")",
"return",
"a",
";",
"// Make \"a\" and \"b\" odd, keeping track of common power of 2."... | Returns the greatest common divisor of two <em>positive</em> numbers (this precondition is <em>not</em> checked and the
result is undefined if not fulfilled) using the "binary gcd" method which avoids division and modulo operations. See Knuth
4.5.2 algorithm B. The algorithm is due to Josef Stein (1961).
<p>
Special cases:
<ul>
<li>The result of {@code gcd(x, x)}, {@code gcd(0, x)} and {@code gcd(x, 0)} is the value of {@code x}.</li>
<li>The invocation {@code gcd(0, 0)} is the only one which returns {@code 0}.</li>
</ul>
@param a a non negative number.
@param b a non negative number.
@return the greatest common divisor. | [
"Returns",
"the",
"greatest",
"common",
"divisor",
"of",
"two",
"<em",
">",
"positive<",
"/",
"em",
">",
"numbers",
"(",
"this",
"precondition",
"is",
"<em",
">",
"not<",
"/",
"em",
">",
"checked",
"and",
"the",
"result",
"is",
"undefined",
"if",
"not",
... | train | https://github.com/libgdx/gdx-ai/blob/2d1523a97193a45e18e11a4837c6800d08f177c5/gdx-ai/src/com/badlogic/gdx/ai/utils/ArithmeticUtils.java#L57-L86 |
liferay/com-liferay-commerce | commerce-product-type-virtual-service/src/main/java/com/liferay/commerce/product/type/virtual/service/persistence/impl/CPDefinitionVirtualSettingPersistenceImpl.java | CPDefinitionVirtualSettingPersistenceImpl.removeByUUID_G | @Override
public CPDefinitionVirtualSetting removeByUUID_G(String uuid, long groupId)
throws NoSuchCPDefinitionVirtualSettingException {
CPDefinitionVirtualSetting cpDefinitionVirtualSetting = findByUUID_G(uuid,
groupId);
return remove(cpDefinitionVirtualSetting);
} | java | @Override
public CPDefinitionVirtualSetting removeByUUID_G(String uuid, long groupId)
throws NoSuchCPDefinitionVirtualSettingException {
CPDefinitionVirtualSetting cpDefinitionVirtualSetting = findByUUID_G(uuid,
groupId);
return remove(cpDefinitionVirtualSetting);
} | [
"@",
"Override",
"public",
"CPDefinitionVirtualSetting",
"removeByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchCPDefinitionVirtualSettingException",
"{",
"CPDefinitionVirtualSetting",
"cpDefinitionVirtualSetting",
"=",
"findByUUID_G",
"(",
"uu... | Removes the cp definition virtual setting where uuid = ? and groupId = ? from the database.
@param uuid the uuid
@param groupId the group ID
@return the cp definition virtual setting that was removed | [
"Removes",
"the",
"cp",
"definition",
"virtual",
"setting",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-virtual-service/src/main/java/com/liferay/commerce/product/type/virtual/service/persistence/impl/CPDefinitionVirtualSettingPersistenceImpl.java#L822-L829 |
wildfly/wildfly-core | embedded/src/main/java/org/wildfly/core/embedded/EmbeddedProcessFactory.java | EmbeddedProcessFactory.createStandaloneServer | public static StandaloneServer createStandaloneServer(String jbossHomePath, String modulePath, String... systemPackages) {
return createStandaloneServer(jbossHomePath, modulePath, systemPackages, null);
} | java | public static StandaloneServer createStandaloneServer(String jbossHomePath, String modulePath, String... systemPackages) {
return createStandaloneServer(jbossHomePath, modulePath, systemPackages, null);
} | [
"public",
"static",
"StandaloneServer",
"createStandaloneServer",
"(",
"String",
"jbossHomePath",
",",
"String",
"modulePath",
",",
"String",
"...",
"systemPackages",
")",
"{",
"return",
"createStandaloneServer",
"(",
"jbossHomePath",
",",
"modulePath",
",",
"systemPack... | Create an embedded standalone server.
@param jbossHomePath the location of the root of server installation. Cannot be {@code null} or empty.
@param modulePath the location of the root of the module repository. May be {@code null} if the standard
location under {@code jbossHomePath} should be used
@param systemPackages names of any packages that must be treated as system packages, with the same classes
visible to the caller's classloader visible to server-side classes loaded from
the server's modular classloader
@return the server. Will not be {@code null} | [
"Create",
"an",
"embedded",
"standalone",
"server",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/embedded/src/main/java/org/wildfly/core/embedded/EmbeddedProcessFactory.java#L92-L94 |
virgo47/javasimon | core/src/main/java/org/javasimon/callback/quantiles/QuantilesCallback.java | QuantilesCallback.onStopwatchStop | @Override
public void onStopwatchStop(Split split, StopwatchSample sample) {
onStopwatchSplit(split.getStopwatch(), split);
} | java | @Override
public void onStopwatchStop(Split split, StopwatchSample sample) {
onStopwatchSplit(split.getStopwatch(), split);
} | [
"@",
"Override",
"public",
"void",
"onStopwatchStop",
"(",
"Split",
"split",
",",
"StopwatchSample",
"sample",
")",
"{",
"onStopwatchSplit",
"(",
"split",
".",
"getStopwatch",
"(",
")",
",",
"split",
")",
";",
"}"
] | When a split is stopped, if buckets have been initialized, the value
is added to appropriate bucket. | [
"When",
"a",
"split",
"is",
"stopped",
"if",
"buckets",
"have",
"been",
"initialized",
"the",
"value",
"is",
"added",
"to",
"appropriate",
"bucket",
"."
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/quantiles/QuantilesCallback.java#L157-L160 |
qcloudsms/qcloudsms_java | src/main/java/com/github/qcloudsms/SmsBase.java | SmsBase.handleError | public HTTPResponse handleError(HTTPResponse response) throws HTTPException {
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new HTTPException(response.statusCode, response.reason);
}
return response;
} | java | public HTTPResponse handleError(HTTPResponse response) throws HTTPException {
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new HTTPException(response.statusCode, response.reason);
}
return response;
} | [
"public",
"HTTPResponse",
"handleError",
"(",
"HTTPResponse",
"response",
")",
"throws",
"HTTPException",
"{",
"if",
"(",
"response",
".",
"statusCode",
"<",
"200",
"||",
"response",
".",
"statusCode",
">=",
"300",
")",
"{",
"throw",
"new",
"HTTPException",
"(... | Handle http status error
@param response raw http response
@return response raw http response
@throws HTTPException http status exception | [
"Handle",
"http",
"status",
"error"
] | train | https://github.com/qcloudsms/qcloudsms_java/blob/920ba838b4fdafcbf684e71bb09846de72294eea/src/main/java/com/github/qcloudsms/SmsBase.java#L34-L39 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/URI.java | URI.setFragment | public void setFragment(String p_fragment) throws MalformedURIException
{
if (p_fragment == null)
{
m_fragment = null;
}
else if (!isGenericURI())
{
throw new MalformedURIException(
Utils.messages.createMessage(MsgKey.ER_FRAG_FOR_GENERIC_URI, null)); //"Fragment can only be set for a generic URI!");
}
else if (getPath() == null)
{
throw new MalformedURIException(
Utils.messages.createMessage(MsgKey.ER_FRAG_WHEN_PATH_NULL, null)); //"Fragment cannot be set when path is null!");
}
else if (!isURIString(p_fragment))
{
throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_FRAG_INVALID_CHAR, null)); //"Fragment contains invalid character!");
}
else
{
m_fragment = p_fragment;
}
} | java | public void setFragment(String p_fragment) throws MalformedURIException
{
if (p_fragment == null)
{
m_fragment = null;
}
else if (!isGenericURI())
{
throw new MalformedURIException(
Utils.messages.createMessage(MsgKey.ER_FRAG_FOR_GENERIC_URI, null)); //"Fragment can only be set for a generic URI!");
}
else if (getPath() == null)
{
throw new MalformedURIException(
Utils.messages.createMessage(MsgKey.ER_FRAG_WHEN_PATH_NULL, null)); //"Fragment cannot be set when path is null!");
}
else if (!isURIString(p_fragment))
{
throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_FRAG_INVALID_CHAR, null)); //"Fragment contains invalid character!");
}
else
{
m_fragment = p_fragment;
}
} | [
"public",
"void",
"setFragment",
"(",
"String",
"p_fragment",
")",
"throws",
"MalformedURIException",
"{",
"if",
"(",
"p_fragment",
"==",
"null",
")",
"{",
"m_fragment",
"=",
"null",
";",
"}",
"else",
"if",
"(",
"!",
"isGenericURI",
"(",
")",
")",
"{",
"... | Set the fragment for this URI. A non-null value is valid only
if this is a URI conforming to the generic URI syntax and
the path value is not null.
@param p_fragment the fragment for this URI
@throws MalformedURIException if p_fragment is not null and this
URI does not conform to the generic
URI syntax or if the path is null | [
"Set",
"the",
"fragment",
"for",
"this",
"URI",
".",
"A",
"non",
"-",
"null",
"value",
"is",
"valid",
"only",
"if",
"this",
"is",
"a",
"URI",
"conforming",
"to",
"the",
"generic",
"URI",
"syntax",
"and",
"the",
"path",
"value",
"is",
"not",
"null",
"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/URI.java#L1286-L1311 |
srikalyc/Sql4D | Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/Mapper4Bean.java | Mapper4Bean.extractKeyAndRow | private T extractKeyAndRow(String timestamp, JSONObject jsonRow) {
T rowValues = null;
try {
rowValues = rowMapper.newInstance();
rowValues.getClass().getMethod("setTimestamp", String.class).invoke(rowValues, timestamp);
for (Object key : jsonRow.keySet()) {
Util.applyKVToBean(rowValues, key.toString(), jsonRow.get(key.toString()));
}
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException ex) {
Logger.getLogger(Mapper4Bean.class.getName()).log(Level.SEVERE, null, ex);
}
return rowValues;
} | java | private T extractKeyAndRow(String timestamp, JSONObject jsonRow) {
T rowValues = null;
try {
rowValues = rowMapper.newInstance();
rowValues.getClass().getMethod("setTimestamp", String.class).invoke(rowValues, timestamp);
for (Object key : jsonRow.keySet()) {
Util.applyKVToBean(rowValues, key.toString(), jsonRow.get(key.toString()));
}
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException ex) {
Logger.getLogger(Mapper4Bean.class.getName()).log(Level.SEVERE, null, ex);
}
return rowValues;
} | [
"private",
"T",
"extractKeyAndRow",
"(",
"String",
"timestamp",
",",
"JSONObject",
"jsonRow",
")",
"{",
"T",
"rowValues",
"=",
"null",
";",
"try",
"{",
"rowValues",
"=",
"rowMapper",
".",
"newInstance",
"(",
")",
";",
"rowValues",
".",
"getClass",
"(",
")"... | Extract v = all fields from json. The first field is always timestamp and
is not extracted here.
@param timestamp
@param jsonRow
@return | [
"Extract",
"v",
"=",
"all",
"fields",
"from",
"json",
".",
"The",
"first",
"field",
"is",
"always",
"timestamp",
"and",
"is",
"not",
"extracted",
"here",
"."
] | train | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/Mapper4Bean.java#L80-L93 |
steveohara/j2mod | src/main/java/com/ghgande/j2mod/modbus/msg/ReadCommEventLogResponse.java | ReadCommEventLogResponse.getEvent | public int getEvent(int index) {
if (events == null || index < 0 || index >= events.length) {
throw new IndexOutOfBoundsException("index = " + index + ", limit = " + (events == null ? "null" : events.length));
}
return events[index] & 0xFF;
} | java | public int getEvent(int index) {
if (events == null || index < 0 || index >= events.length) {
throw new IndexOutOfBoundsException("index = " + index + ", limit = " + (events == null ? "null" : events.length));
}
return events[index] & 0xFF;
} | [
"public",
"int",
"getEvent",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"events",
"==",
"null",
"||",
"index",
"<",
"0",
"||",
"index",
">=",
"events",
".",
"length",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"index = \"",
"+",
"index"... | getEvent -- get an event from the event log.
@param index Index of the event
@return Event ID | [
"getEvent",
"--",
"get",
"an",
"event",
"from",
"the",
"event",
"log",
"."
] | train | https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/msg/ReadCommEventLogResponse.java#L106-L112 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/MPPUtility.java | MPPUtility.fileHexDump | public static final void fileHexDump(String fileName, byte[] data)
{
System.out.println("FILE HEX DUMP");
try
{
FileOutputStream os = new FileOutputStream(fileName);
os.write(ByteArrayHelper.hexdump(data, true, 16, "").getBytes());
os.close();
}
catch (IOException ex)
{
ex.printStackTrace();
}
} | java | public static final void fileHexDump(String fileName, byte[] data)
{
System.out.println("FILE HEX DUMP");
try
{
FileOutputStream os = new FileOutputStream(fileName);
os.write(ByteArrayHelper.hexdump(data, true, 16, "").getBytes());
os.close();
}
catch (IOException ex)
{
ex.printStackTrace();
}
} | [
"public",
"static",
"final",
"void",
"fileHexDump",
"(",
"String",
"fileName",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"FILE HEX DUMP\"",
")",
";",
"try",
"{",
"FileOutputStream",
"os",
"=",
"new",
"FileOutputS... | Writes a hex dump to a file for a large byte array.
@param fileName output file name
@param data target data | [
"Writes",
"a",
"hex",
"dump",
"to",
"a",
"file",
"for",
"a",
"large",
"byte",
"array",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L955-L969 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/FileBeanStore.java | FileBeanStore.getOutputStream | public OutputStream getOutputStream(BeanId beanId)
throws CSIException
{
final String fileName = getPortableFilename(beanId);
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "getOutputStream: key=" + beanId + ", file=", fileName); //d248740
final long beanTimeoutTime = getBeanTimeoutTime(beanId);
FileOutputStream result = null;
try
{
result = (FileOutputStream) AccessController.doPrivileged(new PrivilegedExceptionAction<FileOutputStream>()
{
public FileOutputStream run()
throws IOException
{
File file = new File(passivationDir, fileName);
if (EJSPlatformHelper.isZOS())
{
return new WSFileOutputStream(file, beanTimeoutTime);
}
return new FileOutputStream(file); //LIDB2018
}
});
} catch (PrivilegedActionException ex)
{
FFDCFilter.processException(ex, CLASS_NAME + ".getUnCompressedOutputStream", "460", this);
Tr.warning(tc, "IOEXCEPTION_WRITING_FILE_FOR_STATEFUL_SESSION_BEAN_CNTR0025W",
new Object[] { fileName, this, ex });
//p111002.3
throw new CSIException("Unable to open output stream", ex);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getOutputStream");
return result;
} | java | public OutputStream getOutputStream(BeanId beanId)
throws CSIException
{
final String fileName = getPortableFilename(beanId);
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "getOutputStream: key=" + beanId + ", file=", fileName); //d248740
final long beanTimeoutTime = getBeanTimeoutTime(beanId);
FileOutputStream result = null;
try
{
result = (FileOutputStream) AccessController.doPrivileged(new PrivilegedExceptionAction<FileOutputStream>()
{
public FileOutputStream run()
throws IOException
{
File file = new File(passivationDir, fileName);
if (EJSPlatformHelper.isZOS())
{
return new WSFileOutputStream(file, beanTimeoutTime);
}
return new FileOutputStream(file); //LIDB2018
}
});
} catch (PrivilegedActionException ex)
{
FFDCFilter.processException(ex, CLASS_NAME + ".getUnCompressedOutputStream", "460", this);
Tr.warning(tc, "IOEXCEPTION_WRITING_FILE_FOR_STATEFUL_SESSION_BEAN_CNTR0025W",
new Object[] { fileName, this, ex });
//p111002.3
throw new CSIException("Unable to open output stream", ex);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getOutputStream");
return result;
} | [
"public",
"OutputStream",
"getOutputStream",
"(",
"BeanId",
"beanId",
")",
"throws",
"CSIException",
"{",
"final",
"String",
"fileName",
"=",
"getPortableFilename",
"(",
"beanId",
")",
";",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEn... | LIDB2018-1
new method for just dumping in the byte array to a file,
byte array in gzip format.
@param key the BeanId for this SFSB
@return an OutputStream | [
"LIDB2018",
"-",
"1",
"new",
"method",
"for",
"just",
"dumping",
"in",
"the",
"byte",
"array",
"to",
"a",
"file",
"byte",
"array",
"in",
"gzip",
"format",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/FileBeanStore.java#L401-L439 |
wkgcass/Style | src/main/java/net/cassite/style/aggregation/ListFuncSup.java | ListFuncSup.forThose | public <R> R forThose(RFunc1<Boolean, T> predicate, def<R> func, int index) {
ListIterator<T> it = ((List<T>) iterable).listIterator(index);
IteratorInfo<R> info = new IteratorInfo<>();
return While(it::hasNext, (loopInfo) -> {
int previousIndex = it.previousIndex();
int nextIndex = it.nextIndex();
boolean hasPrevious = it.hasPrevious();
boolean hasNext = it.hasNext();
T t = it.next();
try {
return If(predicate.apply(t), () -> {
return func.apply(t, info.setValues(previousIndex, nextIndex, hasPrevious, hasNext, loopInfo.currentIndex,
loopInfo.effectiveIndex, loopInfo.lastRes));
}).Else(() -> null);
} catch (Throwable err) {
StyleRuntimeException sErr = $(err);
Throwable throwable = sErr.origin();
if (throwable instanceof Add) {
it.add(((Add) throwable).getAdd());
} else if (throwable instanceof $Set) {
it.set((($Set) throwable).getSet());
} else if (throwable instanceof Remove) {
it.remove();
} else {
throw sErr;
}
}
return null;
} | java | public <R> R forThose(RFunc1<Boolean, T> predicate, def<R> func, int index) {
ListIterator<T> it = ((List<T>) iterable).listIterator(index);
IteratorInfo<R> info = new IteratorInfo<>();
return While(it::hasNext, (loopInfo) -> {
int previousIndex = it.previousIndex();
int nextIndex = it.nextIndex();
boolean hasPrevious = it.hasPrevious();
boolean hasNext = it.hasNext();
T t = it.next();
try {
return If(predicate.apply(t), () -> {
return func.apply(t, info.setValues(previousIndex, nextIndex, hasPrevious, hasNext, loopInfo.currentIndex,
loopInfo.effectiveIndex, loopInfo.lastRes));
}).Else(() -> null);
} catch (Throwable err) {
StyleRuntimeException sErr = $(err);
Throwable throwable = sErr.origin();
if (throwable instanceof Add) {
it.add(((Add) throwable).getAdd());
} else if (throwable instanceof $Set) {
it.set((($Set) throwable).getSet());
} else if (throwable instanceof Remove) {
it.remove();
} else {
throw sErr;
}
}
return null;
} | [
"public",
"<",
"R",
">",
"R",
"forThose",
"(",
"RFunc1",
"<",
"Boolean",
",",
"T",
">",
"predicate",
",",
"def",
"<",
"R",
">",
"func",
",",
"int",
"index",
")",
"{",
"ListIterator",
"<",
"T",
">",
"it",
"=",
"(",
"(",
"List",
"<",
"T",
">",
... | define a function to deal with each element in the list with given
start index
@param predicate
a function takes in each element from list and returns
true or false(or null)
@param func
a function returns 'last loop result'
@param index
the index where to start iteration
@return return 'last loop value'.<br>
check
<a href="https://github.com/wkgcass/Style/">tutorial</a> for
more info about 'last loop value' | [
"define",
"a",
"function",
"to",
"deal",
"with",
"each",
"element",
"in",
"the",
"list",
"with",
"given",
"start",
"index"
] | train | https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/aggregation/ListFuncSup.java#L253-L281 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/random/RandomInteger.java | RandomInteger.nextInteger | public static int nextInteger(int min, int max) {
if (max - min <= 0)
return min;
return min + _random.nextInt(max - min);
} | java | public static int nextInteger(int min, int max) {
if (max - min <= 0)
return min;
return min + _random.nextInt(max - min);
} | [
"public",
"static",
"int",
"nextInteger",
"(",
"int",
"min",
",",
"int",
"max",
")",
"{",
"if",
"(",
"max",
"-",
"min",
"<=",
"0",
")",
"return",
"min",
";",
"return",
"min",
"+",
"_random",
".",
"nextInt",
"(",
"max",
"-",
"min",
")",
";",
"}"
] | Generates a integer in the range ['min', 'max']. If 'max' is omitted, then
the range will be set to [0, 'min'].
@param min minimum value of the integer that will be generated. If 'max' is
omitted, then 'max' is set to 'min' and 'min' is set to 0.
@param max (optional) maximum value of the integer that will be generated.
Defaults to 'min' if omitted.
@return generated random integer value. | [
"Generates",
"a",
"integer",
"in",
"the",
"range",
"[",
"min",
"max",
"]",
".",
"If",
"max",
"is",
"omitted",
"then",
"the",
"range",
"will",
"be",
"set",
"to",
"[",
"0",
"min",
"]",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/random/RandomInteger.java#L41-L46 |
dadoonet/elasticsearch-beyonder | src/main/java/fr/pilato/elasticsearch/tools/template/TemplateElasticsearchUpdater.java | TemplateElasticsearchUpdater.isTemplateExist | @Deprecated
public static boolean isTemplateExist(Client client, String template) {
return !client.admin().indices().prepareGetTemplates(template).get().getIndexTemplates().isEmpty();
} | java | @Deprecated
public static boolean isTemplateExist(Client client, String template) {
return !client.admin().indices().prepareGetTemplates(template).get().getIndexTemplates().isEmpty();
} | [
"@",
"Deprecated",
"public",
"static",
"boolean",
"isTemplateExist",
"(",
"Client",
"client",
",",
"String",
"template",
")",
"{",
"return",
"!",
"client",
".",
"admin",
"(",
")",
".",
"indices",
"(",
")",
".",
"prepareGetTemplates",
"(",
"template",
")",
... | Check if a template exists
@param client Elasticsearch client
@param template template name
@return true if the template exists
@deprecated Will be removed when we don't support TransportClient anymore | [
"Check",
"if",
"a",
"template",
"exists"
] | train | https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/template/TemplateElasticsearchUpdater.java#L131-L134 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_oldPhone_GET | public ArrayList<OvhPhone> billingAccount_oldPhone_GET(String billingAccount) throws IOException {
String qPath = "/telephony/{billingAccount}/oldPhone";
StringBuilder sb = path(qPath, billingAccount);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t16);
} | java | public ArrayList<OvhPhone> billingAccount_oldPhone_GET(String billingAccount) throws IOException {
String qPath = "/telephony/{billingAccount}/oldPhone";
StringBuilder sb = path(qPath, billingAccount);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t16);
} | [
"public",
"ArrayList",
"<",
"OvhPhone",
">",
"billingAccount_oldPhone_GET",
"(",
"String",
"billingAccount",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/oldPhone\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
"... | List old phones archived as they were not returned after an RMA
REST: GET /telephony/{billingAccount}/oldPhone
@param billingAccount [required] The name of your billingAccount | [
"List",
"old",
"phones",
"archived",
"as",
"they",
"were",
"not",
"returned",
"after",
"an",
"RMA"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L5006-L5011 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/reflect/RecursiveObjectWriter.java | RecursiveObjectWriter.setProperty | public static void setProperty(Object obj, String name, Object value) {
if (obj == null || name == null)
return;
String[] names = name.split("\\.");
if (names == null || names.length == 0)
return;
performSetProperty(obj, names, 0, value);
} | java | public static void setProperty(Object obj, String name, Object value) {
if (obj == null || name == null)
return;
String[] names = name.split("\\.");
if (names == null || names.length == 0)
return;
performSetProperty(obj, names, 0, value);
} | [
"public",
"static",
"void",
"setProperty",
"(",
"Object",
"obj",
",",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
"||",
"name",
"==",
"null",
")",
"return",
";",
"String",
"[",
"]",
"names",
"=",
"name",
".",
... | Recursively sets value of object and its subobjects property specified by its
name.
The object can be a user defined object, map or array. The property name
correspondently must be object property, map key or array index.
If the property does not exist or introspection fails this method doesn't do
anything and doesn't any throw errors.
@param obj an object to write property to.
@param name a name of the property to set.
@param value a new value for the property to set. | [
"Recursively",
"sets",
"value",
"of",
"object",
"and",
"its",
"subobjects",
"property",
"specified",
"by",
"its",
"name",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/reflect/RecursiveObjectWriter.java#L52-L61 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/VoiceApi.java | VoiceApi.initiateTransfer | public ApiSuccessResponse initiateTransfer(String id, InitiateTransferData initiateTransferData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = initiateTransferWithHttpInfo(id, initiateTransferData);
return resp.getData();
} | java | public ApiSuccessResponse initiateTransfer(String id, InitiateTransferData initiateTransferData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = initiateTransferWithHttpInfo(id, initiateTransferData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"initiateTransfer",
"(",
"String",
"id",
",",
"InitiateTransferData",
"initiateTransferData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"initiateTransferWithHttpInfo",
"(",
"id",
",",
... | Initiate a transfer
Initiate a two-step transfer by placing the first call on hold and dialing the destination number (step 1). After initiating the transfer, you can use [/voice/calls/{id}/complete-transfer](/reference/workspace/Voice/index.html#completeTransfer) to complete the transfer (step 2).
@param id The connection ID of the call to be transferred. This call will be placed on hold. (required)
@param initiateTransferData (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Initiate",
"a",
"transfer",
"Initiate",
"a",
"two",
"-",
"step",
"transfer",
"by",
"placing",
"the",
"first",
"call",
"on",
"hold",
"and",
"dialing",
"the",
"destination",
"number",
"(",
"step",
"1",
")",
".",
"After",
"initiating",
"the",
"transfer",
"yo... | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L1969-L1972 |
amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.ifEmpty | @SafeVarargs
public final StreamEx<T> ifEmpty(T... values) {
return ifEmpty(null, Spliterators.spliterator(values, Spliterator.ORDERED));
} | java | @SafeVarargs
public final StreamEx<T> ifEmpty(T... values) {
return ifEmpty(null, Spliterators.spliterator(values, Spliterator.ORDERED));
} | [
"@",
"SafeVarargs",
"public",
"final",
"StreamEx",
"<",
"T",
">",
"ifEmpty",
"(",
"T",
"...",
"values",
")",
"{",
"return",
"ifEmpty",
"(",
"null",
",",
"Spliterators",
".",
"spliterator",
"(",
"values",
",",
"Spliterator",
".",
"ORDERED",
")",
")",
";",... | Returns a stream which contents is the same as this stream, except the case when
this stream is empty. In this case its contents is replaced with supplied values.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate
operation</a>.
@param values values to replace the contents of this stream if this stream is empty.
@return the stream which contents is replaced by supplied values only if this stream is empty.
@since 0.6.6 | [
"Returns",
"a",
"stream",
"which",
"contents",
"is",
"the",
"same",
"as",
"this",
"stream",
"except",
"the",
"case",
"when",
"this",
"stream",
"is",
"empty",
".",
"In",
"this",
"case",
"its",
"contents",
"is",
"replaced",
"with",
"supplied",
"values",
"."
... | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L1387-L1390 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/EnumFacingUtils.java | EnumFacingUtils.getRealSide | public static EnumFacing getRealSide(IBlockState state, EnumFacing side)
{
if (state == null || side == null)
return side;
EnumFacing direction = DirectionalComponent.getDirection(state);
if (direction == EnumFacing.SOUTH)
return side;
if (direction == EnumFacing.DOWN)
return side.rotateAround(Axis.X);
else if (direction == EnumFacing.UP)
switch (side)
{
case UP:
return EnumFacing.SOUTH;
case DOWN:
return EnumFacing.NORTH;
case NORTH:
return EnumFacing.UP;
case SOUTH:
return EnumFacing.DOWN;
default:
return side;
}
int count = EnumFacingUtils.getRotationCount(direction);
side = EnumFacingUtils.rotateFacing(side, count);
return side;
} | java | public static EnumFacing getRealSide(IBlockState state, EnumFacing side)
{
if (state == null || side == null)
return side;
EnumFacing direction = DirectionalComponent.getDirection(state);
if (direction == EnumFacing.SOUTH)
return side;
if (direction == EnumFacing.DOWN)
return side.rotateAround(Axis.X);
else if (direction == EnumFacing.UP)
switch (side)
{
case UP:
return EnumFacing.SOUTH;
case DOWN:
return EnumFacing.NORTH;
case NORTH:
return EnumFacing.UP;
case SOUTH:
return EnumFacing.DOWN;
default:
return side;
}
int count = EnumFacingUtils.getRotationCount(direction);
side = EnumFacingUtils.rotateFacing(side, count);
return side;
} | [
"public",
"static",
"EnumFacing",
"getRealSide",
"(",
"IBlockState",
"state",
",",
"EnumFacing",
"side",
")",
"{",
"if",
"(",
"state",
"==",
"null",
"||",
"side",
"==",
"null",
")",
"return",
"side",
";",
"EnumFacing",
"direction",
"=",
"DirectionalComponent",... | Gets the real side of a rotated block.
@param state the state
@param side the side
@return the real side | [
"Gets",
"the",
"real",
"side",
"of",
"a",
"rotated",
"block",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/EnumFacingUtils.java#L99-L129 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java | HttpOutboundServiceContextImpl.sendRawRequestBody | @Override
public VirtualConnection sendRawRequestBody(WsByteBuffer[] body, InterChannelCallback callback, boolean bForce) throws MessageSentException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "sendRawRequestBody(async)");
}
setRawBody(true);
VirtualConnection vc = sendRequestBody(body, callback, bForce);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "sendRawRequestBody(async): " + vc);
}
return vc;
} | java | @Override
public VirtualConnection sendRawRequestBody(WsByteBuffer[] body, InterChannelCallback callback, boolean bForce) throws MessageSentException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "sendRawRequestBody(async)");
}
setRawBody(true);
VirtualConnection vc = sendRequestBody(body, callback, bForce);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "sendRawRequestBody(async): " + vc);
}
return vc;
} | [
"@",
"Override",
"public",
"VirtualConnection",
"sendRawRequestBody",
"(",
"WsByteBuffer",
"[",
"]",
"body",
",",
"InterChannelCallback",
"callback",
",",
"boolean",
"bForce",
")",
"throws",
"MessageSentException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingE... | Send an array of raw body buffers out asynchronously. This method will
avoid any body modifications, such as compression or chunked-encoding.
<p>
This will return null if the data is being written asynchronously and the provided callback will be used when finished. However, if the write could complete automatically,
then the callback will not be used and instead a non-null VC will be returned back.
<p>
The force parameter allows the caller to force the asynchronous call and to always have the callback used, thus the return code will always be null.
@param body
@param callback
@param bForce
@return VirtualConnection
@throws MessageSentException
-- if a finishMessage API was already used | [
"Send",
"an",
"array",
"of",
"raw",
"body",
"buffers",
"out",
"asynchronously",
".",
"This",
"method",
"will",
"avoid",
"any",
"body",
"modifications",
"such",
"as",
"compression",
"or",
"chunked",
"-",
"encoding",
".",
"<p",
">",
"This",
"will",
"return",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L1091-L1102 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/CsvFiles.java | CsvFiles.getCsvDataMap | public static Map<String, String> getCsvDataMap(String fileName,
final int key, final int value, boolean headerPresent) throws IOException {
final Map<String, String> result = Maps.newHashMap();
new CsvReader(fileName, headerPresent)
.processReader((header, line, lineNumber) -> result.put(line[key], line[value]));
return result;
} | java | public static Map<String, String> getCsvDataMap(String fileName,
final int key, final int value, boolean headerPresent) throws IOException {
final Map<String, String> result = Maps.newHashMap();
new CsvReader(fileName, headerPresent)
.processReader((header, line, lineNumber) -> result.put(line[key], line[value]));
return result;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"getCsvDataMap",
"(",
"String",
"fileName",
",",
"final",
"int",
"key",
",",
"final",
"int",
"value",
",",
"boolean",
"headerPresent",
")",
"throws",
"IOException",
"{",
"final",
"Map",
"<",
"St... | Returns a {@code Map<String, String>} mapping of the column designated by
{@code key} to the column designated by {@code value}. This method also
ignores all columns other than the columns specified by {@code key} and
{@code value}.
@param fileName the CSV file to load
@param key the 0-indexed column number to map to the key of the returned
data map
@param value the column number to map to the value of the returned data
map
@param headerPresent {@code true} if the fist line is the header
@return a {@code Map<String, String>} mapping of the columns specified by
{@code key} and {@code value}
@throws IOException if there was an error while reading the file
@throws IllegalArgumentException if CSV file does not have the
columns specified by {@code key} or {@code value} | [
"Returns",
"a",
"{",
"@code",
"Map<String",
"String",
">",
"}",
"mapping",
"of",
"the",
"column",
"designated",
"by",
"{",
"@code",
"key",
"}",
"to",
"the",
"column",
"designated",
"by",
"{",
"@code",
"value",
"}",
".",
"This",
"method",
"also",
"ignores... | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/CsvFiles.java#L58-L64 |
marvinlabs/android-intents | library/src/main/java/com/marvinlabs/intents/PhoneIntents.java | PhoneIntents.newEmptySmsIntent | public static Intent newEmptySmsIntent(Context context, String[] phoneNumbers) {
return newSmsIntent(context, null, phoneNumbers);
} | java | public static Intent newEmptySmsIntent(Context context, String[] phoneNumbers) {
return newSmsIntent(context, null, phoneNumbers);
} | [
"public",
"static",
"Intent",
"newEmptySmsIntent",
"(",
"Context",
"context",
",",
"String",
"[",
"]",
"phoneNumbers",
")",
"{",
"return",
"newSmsIntent",
"(",
"context",
",",
"null",
",",
"phoneNumbers",
")",
";",
"}"
] | Creates an intent that will allow to send an SMS without specifying the phone number
@param phoneNumbers The phone numbers to send the SMS to
@return the intent | [
"Creates",
"an",
"intent",
"that",
"will",
"allow",
"to",
"send",
"an",
"SMS",
"without",
"specifying",
"the",
"phone",
"number"
] | train | https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/PhoneIntents.java#L61-L63 |
Netflix/Nicobar | nicobar-core/src/main/java/com/netflix/nicobar/core/module/jboss/JBossModuleUtils.java | JBossModuleUtils.addPropertiesToSpec | public static void addPropertiesToSpec(ModuleSpec.Builder moduleSpecBuilder, Map<String, String> properties) {
for (Entry<String, String> entry : properties.entrySet()) {
moduleSpecBuilder.addProperty(entry.getKey(), entry.getValue());
}
} | java | public static void addPropertiesToSpec(ModuleSpec.Builder moduleSpecBuilder, Map<String, String> properties) {
for (Entry<String, String> entry : properties.entrySet()) {
moduleSpecBuilder.addProperty(entry.getKey(), entry.getValue());
}
} | [
"public",
"static",
"void",
"addPropertiesToSpec",
"(",
"ModuleSpec",
".",
"Builder",
"moduleSpecBuilder",
",",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"propertie... | Add properties to the {@link ModuleSpec}
@param moduleSpecBuilder builder to populate
@param properties properties to add | [
"Add",
"properties",
"to",
"the",
"{",
"@link",
"ModuleSpec",
"}"
] | train | https://github.com/Netflix/Nicobar/blob/507173dcae4a86a955afc3df222a855862fab8d7/nicobar-core/src/main/java/com/netflix/nicobar/core/module/jboss/JBossModuleUtils.java#L261-L265 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.pressText | public static void pressText(ImageInputStream srcStream, ImageOutputStream destStream, String pressText, Color color, Font font, int x, int y, float alpha) {
pressText(read(srcStream), destStream, pressText, color, font, x, y, alpha);
} | java | public static void pressText(ImageInputStream srcStream, ImageOutputStream destStream, String pressText, Color color, Font font, int x, int y, float alpha) {
pressText(read(srcStream), destStream, pressText, color, font, x, y, alpha);
} | [
"public",
"static",
"void",
"pressText",
"(",
"ImageInputStream",
"srcStream",
",",
"ImageOutputStream",
"destStream",
",",
"String",
"pressText",
",",
"Color",
"color",
",",
"Font",
"font",
",",
"int",
"x",
",",
"int",
"y",
",",
"float",
"alpha",
")",
"{",
... | 给图片添加文字水印<br>
此方法并不关闭流
@param srcStream 源图像流
@param destStream 目标图像流
@param pressText 水印文字
@param color 水印的字体颜色
@param font {@link Font} 字体相关信息,如果默认则为{@code null}
@param x 修正值。 默认在中间,偏移量相对于中间偏移
@param y 修正值。 默认在中间,偏移量相对于中间偏移
@param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 | [
"给图片添加文字水印<br",
">",
"此方法并不关闭流"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L788-L790 |
couchbase/couchbase-lite-java-core | src/main/java/com/couchbase/lite/Manager.java | Manager.runAsync | @InterfaceAudience.Private
public Future runAsync(String databaseName, final AsyncTask function) throws CouchbaseLiteException {
final Database database = getDatabase(databaseName);
return runAsync(new Runnable() {
@Override
public void run() {
function.run(database);
}
});
} | java | @InterfaceAudience.Private
public Future runAsync(String databaseName, final AsyncTask function) throws CouchbaseLiteException {
final Database database = getDatabase(databaseName);
return runAsync(new Runnable() {
@Override
public void run() {
function.run(database);
}
});
} | [
"@",
"InterfaceAudience",
".",
"Private",
"public",
"Future",
"runAsync",
"(",
"String",
"databaseName",
",",
"final",
"AsyncTask",
"function",
")",
"throws",
"CouchbaseLiteException",
"{",
"final",
"Database",
"database",
"=",
"getDatabase",
"(",
"databaseName",
")... | Asynchronously dispatches a callback to run on a background thread. The callback will be passed
Database instance. There is not currently a known reason to use it, it may not make
sense on the Android API, but it was added for the purpose of having a consistent API with iOS.
@exclude | [
"Asynchronously",
"dispatches",
"a",
"callback",
"to",
"run",
"on",
"a",
"background",
"thread",
".",
"The",
"callback",
"will",
"be",
"passed",
"Database",
"instance",
".",
"There",
"is",
"not",
"currently",
"a",
"known",
"reason",
"to",
"use",
"it",
"it",
... | train | https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/Manager.java#L538-L547 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/ParameterValue.java | ParameterValue.toCollection | @SuppressWarnings("unchecked")
public <X extends Collection<T>, T> X toCollection(Class<? extends Collection> collectionClass, Class<T> classOfT, String pattern) {
if (collectionClass == null || classOfT == null) {
return null;
}
try {
// reflectively instantiate the target collection type using the default constructor
Constructor<?> constructor = collectionClass.getConstructor();
X collection = (X) constructor.newInstance();
// cheat by not instantiating a ParameterValue for every value
ParameterValue parameterValue = newParameterValuePlaceHolder();
List<String> list = toList();
for (String value : list) {
parameterValue.values[0] = value;
T t = (T) parameterValue.toObject(classOfT, pattern);
collection.add(t);
}
return collection;
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
throw new PippoRuntimeException(e, "Failed to create collection");
}
} | java | @SuppressWarnings("unchecked")
public <X extends Collection<T>, T> X toCollection(Class<? extends Collection> collectionClass, Class<T> classOfT, String pattern) {
if (collectionClass == null || classOfT == null) {
return null;
}
try {
// reflectively instantiate the target collection type using the default constructor
Constructor<?> constructor = collectionClass.getConstructor();
X collection = (X) constructor.newInstance();
// cheat by not instantiating a ParameterValue for every value
ParameterValue parameterValue = newParameterValuePlaceHolder();
List<String> list = toList();
for (String value : list) {
parameterValue.values[0] = value;
T t = (T) parameterValue.toObject(classOfT, pattern);
collection.add(t);
}
return collection;
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
throw new PippoRuntimeException(e, "Failed to create collection");
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"X",
"extends",
"Collection",
"<",
"T",
">",
",",
"T",
">",
"X",
"toCollection",
"(",
"Class",
"<",
"?",
"extends",
"Collection",
">",
"collectionClass",
",",
"Class",
"<",
"T",
">",
"cla... | Converts a string value(s) to the target collection type. You may optionally specify
a string pattern to assist in the type conversion.
@param collectionClass
@param classOfT
@param pattern optional pattern for interpreting the underlying request
string value. (used for date & time conversions)
@return a collection of the values | [
"Converts",
"a",
"string",
"value",
"(",
"s",
")",
"to",
"the",
"target",
"collection",
"type",
".",
"You",
"may",
"optionally",
"specify",
"a",
"string",
"pattern",
"to",
"assist",
"in",
"the",
"type",
"conversion",
"."
] | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/ParameterValue.java#L443-L469 |
aws/aws-sdk-java | aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/ItemResponse.java | ItemResponse.withEventsItemResponse | public ItemResponse withEventsItemResponse(java.util.Map<String, EventItemResponse> eventsItemResponse) {
setEventsItemResponse(eventsItemResponse);
return this;
} | java | public ItemResponse withEventsItemResponse(java.util.Map<String, EventItemResponse> eventsItemResponse) {
setEventsItemResponse(eventsItemResponse);
return this;
} | [
"public",
"ItemResponse",
"withEventsItemResponse",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"EventItemResponse",
">",
"eventsItemResponse",
")",
"{",
"setEventsItemResponse",
"(",
"eventsItemResponse",
")",
";",
"return",
"this",
";",
"}"
] | A multipart response object that contains a key and value for each event ID in the request. In each object, the
event ID is the key, and an EventItemResponse object is the value.
@param eventsItemResponse
A multipart response object that contains a key and value for each event ID in the request. In each
object, the event ID is the key, and an EventItemResponse object is the value.
@return Returns a reference to this object so that method calls can be chained together. | [
"A",
"multipart",
"response",
"object",
"that",
"contains",
"a",
"key",
"and",
"value",
"for",
"each",
"event",
"ID",
"in",
"the",
"request",
".",
"In",
"each",
"object",
"the",
"event",
"ID",
"is",
"the",
"key",
"and",
"an",
"EventItemResponse",
"object",... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/ItemResponse.java#L106-L109 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/spout/AmBaseSpout.java | AmBaseSpout.emitWithNoKeyIdAndStream | protected void emitWithNoKeyIdAndStream(StreamMessage message, String streamId)
{
this.getCollector().emit(streamId, new Values("", message));
} | java | protected void emitWithNoKeyIdAndStream(StreamMessage message, String streamId)
{
this.getCollector().emit(streamId, new Values("", message));
} | [
"protected",
"void",
"emitWithNoKeyIdAndStream",
"(",
"StreamMessage",
"message",
",",
"String",
"streamId",
")",
"{",
"this",
".",
"getCollector",
"(",
")",
".",
"emit",
"(",
"streamId",
",",
"new",
"Values",
"(",
"\"\"",
",",
"message",
")",
")",
";",
"}... | Not use this class's key history function, and not use MessageId(Id identify by storm).<br>
Send message to downstream component with streamId.<br>
Use following situation.
<ol>
<li>Not use this class's key history function.</li>
<li>Not use storm's fault detect function.</li>
</ol>
@param message sending message
@param streamId streamId | [
"Not",
"use",
"this",
"class",
"s",
"key",
"history",
"function",
"and",
"not",
"use",
"MessageId",
"(",
"Id",
"identify",
"by",
"storm",
")",
".",
"<br",
">",
"Send",
"message",
"to",
"downstream",
"component",
"with",
"streamId",
".",
"<br",
">",
"Use"... | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/spout/AmBaseSpout.java#L389-L392 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/ModuleContentTypes.java | ModuleContentTypes.fetchAll | public CMAArray<CMAContentType> fetchAll(Map<String, String> query) {
return fetchAll(spaceId, environmentId, query);
} | java | public CMAArray<CMAContentType> fetchAll(Map<String, String> query) {
return fetchAll(spaceId, environmentId, query);
} | [
"public",
"CMAArray",
"<",
"CMAContentType",
">",
"fetchAll",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"query",
")",
"{",
"return",
"fetchAll",
"(",
"spaceId",
",",
"environmentId",
",",
"query",
")",
";",
"}"
] | Fetch all Content Types from the configured space and environment, using default query
parameter.
<p>
This fetch uses the default parameter defined in {@link DefaultQueryParameter#FETCH}
@param query to specify to narrow down results.
@return {@link CMAArray} result instance
@throws IllegalArgumentException if spaceId is null.
@see CMAClient.Builder#setSpaceId(String)
@see CMAClient.Builder#setEnvironmentId(String) | [
"Fetch",
"all",
"Content",
"Types",
"from",
"the",
"configured",
"space",
"and",
"environment",
"using",
"default",
"query",
"parameter",
".",
"<p",
">",
"This",
"fetch",
"uses",
"the",
"default",
"parameter",
"defined",
"in",
"{",
"@link",
"DefaultQueryParamete... | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleContentTypes.java#L168-L170 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/CsvFiles.java | CsvFiles.getCsvDataListMap | public static List<Map<String, String>> getCsvDataListMap(String fileName,
boolean headerPresent) throws IOException {
final List<Map<String, String>> result = Lists.newArrayList();
new CsvReader(fileName, headerPresent)
.processReader(
(headers, line, lineNumber) -> {
Map<String, String> data = Maps.newHashMap();
for (int i = 0; i < line.length; i++) {
if (headers != null) {
data.put(headers[i], line[i]);
} else {
data.put(i + "", line[i]);
}
}
result.add(data);
});
return result;
} | java | public static List<Map<String, String>> getCsvDataListMap(String fileName,
boolean headerPresent) throws IOException {
final List<Map<String, String>> result = Lists.newArrayList();
new CsvReader(fileName, headerPresent)
.processReader(
(headers, line, lineNumber) -> {
Map<String, String> data = Maps.newHashMap();
for (int i = 0; i < line.length; i++) {
if (headers != null) {
data.put(headers[i], line[i]);
} else {
data.put(i + "", line[i]);
}
}
result.add(data);
});
return result;
} | [
"public",
"static",
"List",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"getCsvDataListMap",
"(",
"String",
"fileName",
",",
"boolean",
"headerPresent",
")",
"throws",
"IOException",
"{",
"final",
"List",
"<",
"Map",
"<",
"String",
",",
"String",
"... | Returns a {@code List<Map<String, String>>} that contains all rows with
a field mapping defined by the header. If no header is present,
then each field is the 0-indexed column number.
@param fileName the CSV file to load
@param headerPresent {@code true} if the first line is the header
@return a {@code List<Map<String, String>>} that contains all rows with
with a field mapping defined by the header if present.
@throws IOException if there was an exception reading the file | [
"Returns",
"a",
"{",
"@code",
"List<Map<String",
"String",
">>",
"}",
"that",
"contains",
"all",
"rows",
"with",
"a",
"field",
"mapping",
"defined",
"by",
"the",
"header",
".",
"If",
"no",
"header",
"is",
"present",
"then",
"each",
"field",
"is",
"the",
... | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/CsvFiles.java#L121-L138 |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/chrono/EthiopicChronology.java | EthiopicChronology.dateYearDay | @Override
public EthiopicDate dateYearDay(Era era, int yearOfEra, int dayOfYear) {
return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);
} | java | @Override
public EthiopicDate dateYearDay(Era era, int yearOfEra, int dayOfYear) {
return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);
} | [
"@",
"Override",
"public",
"EthiopicDate",
"dateYearDay",
"(",
"Era",
"era",
",",
"int",
"yearOfEra",
",",
"int",
"dayOfYear",
")",
"{",
"return",
"dateYearDay",
"(",
"prolepticYear",
"(",
"era",
",",
"yearOfEra",
")",
",",
"dayOfYear",
")",
";",
"}"
] | Obtains a local date in Ethiopic calendar system from the
era, year-of-era and day-of-year fields.
@param era the Ethiopic era, not null
@param yearOfEra the year-of-era
@param dayOfYear the day-of-year
@return the Ethiopic local date, not null
@throws DateTimeException if unable to create the date
@throws ClassCastException if the {@code era} is not a {@code EthiopicEra} | [
"Obtains",
"a",
"local",
"date",
"in",
"Ethiopic",
"calendar",
"system",
"from",
"the",
"era",
"year",
"-",
"of",
"-",
"era",
"and",
"day",
"-",
"of",
"-",
"year",
"fields",
"."
] | train | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/EthiopicChronology.java#L183-L186 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/cdn/CdnClient.java | CdnClient.setDomainCacheTTL | public SetDomainCacheTTLResponse setDomainCacheTTL(SetDomainCacheTTLRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
InternalRequest internalRequest = createRequest(request, HttpMethodName.PUT, DOMAIN, request.getDomain(), "config");
internalRequest.addParameter("cacheTTL","");
this.attachRequestToBody(request, internalRequest);
return invokeHttpClient(internalRequest, SetDomainCacheTTLResponse.class);
} | java | public SetDomainCacheTTLResponse setDomainCacheTTL(SetDomainCacheTTLRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
InternalRequest internalRequest = createRequest(request, HttpMethodName.PUT, DOMAIN, request.getDomain(), "config");
internalRequest.addParameter("cacheTTL","");
this.attachRequestToBody(request, internalRequest);
return invokeHttpClient(internalRequest, SetDomainCacheTTLResponse.class);
} | [
"public",
"SetDomainCacheTTLResponse",
"setDomainCacheTTL",
"(",
"SetDomainCacheTTLRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"InternalRequest",
"internalRequest",
"=",
"createRequest",
"(",
"... | Update cache policies of specified domain acceleration.
@param request The request containing all of the options related to the update request.
@return Result of the setDomainCacheTTL operation returned by the service. | [
"Update",
"cache",
"policies",
"of",
"specified",
"domain",
"acceleration",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/cdn/CdnClient.java#L356-L362 |
elki-project/elki | elki-database/src/main/java/de/lmu/ifi/dbs/elki/database/query/range/LinearScanPrimitiveDistanceRangeQuery.java | LinearScanPrimitiveDistanceRangeQuery.linearScan | private void linearScan(Relation<? extends O> relation, DBIDIter iter, O obj, double range, ModifiableDoubleDBIDList result) {
final PrimitiveDistanceFunction<? super O> rawdist = this.rawdist;
while(iter.valid()) {
final double distance = rawdist.distance(obj, relation.get(iter));
if(distance <= range) {
result.add(distance, iter);
}
iter.advance();
}
} | java | private void linearScan(Relation<? extends O> relation, DBIDIter iter, O obj, double range, ModifiableDoubleDBIDList result) {
final PrimitiveDistanceFunction<? super O> rawdist = this.rawdist;
while(iter.valid()) {
final double distance = rawdist.distance(obj, relation.get(iter));
if(distance <= range) {
result.add(distance, iter);
}
iter.advance();
}
} | [
"private",
"void",
"linearScan",
"(",
"Relation",
"<",
"?",
"extends",
"O",
">",
"relation",
",",
"DBIDIter",
"iter",
",",
"O",
"obj",
",",
"double",
"range",
",",
"ModifiableDoubleDBIDList",
"result",
")",
"{",
"final",
"PrimitiveDistanceFunction",
"<",
"?",
... | Main loop for linear scan,
@param relation Data relation
@param iter Iterator
@param obj Query object
@param range Query radius
@param result Output data structure | [
"Main",
"loop",
"for",
"linear",
"scan"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-database/src/main/java/de/lmu/ifi/dbs/elki/database/query/range/LinearScanPrimitiveDistanceRangeQuery.java#L102-L111 |
alkacon/opencms-core | src/org/opencms/workflow/CmsDefaultWorkflowManager.java | CmsDefaultWorkflowManager.actionForcePublish | protected CmsWorkflowResponse actionForcePublish(
CmsObject userCms,
CmsPublishOptions options,
List<CmsResource> resources)
throws CmsException {
CmsPublish publish = new CmsPublish(userCms, options.getParameters());
publish.publishResources(resources);
CmsWorkflowResponse response = new CmsWorkflowResponse(
true,
"",
new ArrayList<CmsPublishResource>(),
new ArrayList<CmsWorkflowAction>(),
null);
return response;
} | java | protected CmsWorkflowResponse actionForcePublish(
CmsObject userCms,
CmsPublishOptions options,
List<CmsResource> resources)
throws CmsException {
CmsPublish publish = new CmsPublish(userCms, options.getParameters());
publish.publishResources(resources);
CmsWorkflowResponse response = new CmsWorkflowResponse(
true,
"",
new ArrayList<CmsPublishResource>(),
new ArrayList<CmsWorkflowAction>(),
null);
return response;
} | [
"protected",
"CmsWorkflowResponse",
"actionForcePublish",
"(",
"CmsObject",
"userCms",
",",
"CmsPublishOptions",
"options",
",",
"List",
"<",
"CmsResource",
">",
"resources",
")",
"throws",
"CmsException",
"{",
"CmsPublish",
"publish",
"=",
"new",
"CmsPublish",
"(",
... | The implementation of the "forcepublish" workflow action.<p>
@param userCms the user CMS context
@param resources the resources which the action should process
@param options the publish options to use
@return the workflow response
@throws CmsException if something goes wrong | [
"The",
"implementation",
"of",
"the",
"forcepublish",
"workflow",
"action",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workflow/CmsDefaultWorkflowManager.java#L364-L379 |
james-hu/jabb-core | src/main/java/net/sf/jabb/camel/XmlSocketUtility.java | XmlSocketUtility.addServer | static public void addServer(CamelContext camelContext, final String serverUri, final boolean syncFlag, final String toUri,
String topLevelTagName, Charset messageCharset, int maxMessageBytes) throws Exception {
// Netty 用的encoder/decoder
XmlDecoder xmlDecoder = new XmlDecoder(maxMessageBytes, topLevelTagName, messageCharset);
StringEncoder stringEncoder = new StringEncoder(messageCharset);
final String xmlFrameDecoderName = "xmlFrameDecoder" + xmlFrameDecoderSeq.next();
final String xmlStringDecoderName = "xmlStringDecoder" + xmlStringDecoderSeq.next();
final String stringEncoderName = "stringEncoder" + stringEncoderSeq.next();
RegistryUtility.addDecoder(camelContext, xmlFrameDecoderName, xmlDecoder.getFrameDecoder());
RegistryUtility.addDecoder(camelContext, xmlStringDecoderName, xmlDecoder.getStringDecoder());
RegistryUtility.addEncoder(camelContext, stringEncoderName, stringEncoder);
camelContext.addRoutes(new RouteBuilder(){
@Override
public void configure(){
StringBuilder sb = new StringBuilder();
sb.append("netty:").append(serverUri);
sb.append(serverUri.contains("?")? '&' : '?');
sb.append("sync=").append(syncFlag);
sb.append("&decoders=#").append(xmlFrameDecoderName)
.append(",#").append(xmlStringDecoderName)
.append("&encoders=#").append(stringEncoderName);
from(sb.toString()).to(toUri);
}
});
} | java | static public void addServer(CamelContext camelContext, final String serverUri, final boolean syncFlag, final String toUri,
String topLevelTagName, Charset messageCharset, int maxMessageBytes) throws Exception {
// Netty 用的encoder/decoder
XmlDecoder xmlDecoder = new XmlDecoder(maxMessageBytes, topLevelTagName, messageCharset);
StringEncoder stringEncoder = new StringEncoder(messageCharset);
final String xmlFrameDecoderName = "xmlFrameDecoder" + xmlFrameDecoderSeq.next();
final String xmlStringDecoderName = "xmlStringDecoder" + xmlStringDecoderSeq.next();
final String stringEncoderName = "stringEncoder" + stringEncoderSeq.next();
RegistryUtility.addDecoder(camelContext, xmlFrameDecoderName, xmlDecoder.getFrameDecoder());
RegistryUtility.addDecoder(camelContext, xmlStringDecoderName, xmlDecoder.getStringDecoder());
RegistryUtility.addEncoder(camelContext, stringEncoderName, stringEncoder);
camelContext.addRoutes(new RouteBuilder(){
@Override
public void configure(){
StringBuilder sb = new StringBuilder();
sb.append("netty:").append(serverUri);
sb.append(serverUri.contains("?")? '&' : '?');
sb.append("sync=").append(syncFlag);
sb.append("&decoders=#").append(xmlFrameDecoderName)
.append(",#").append(xmlStringDecoderName)
.append("&encoders=#").append(stringEncoderName);
from(sb.toString()).to(toUri);
}
});
} | [
"static",
"public",
"void",
"addServer",
"(",
"CamelContext",
"camelContext",
",",
"final",
"String",
"serverUri",
",",
"final",
"boolean",
"syncFlag",
",",
"final",
"String",
"toUri",
",",
"String",
"topLevelTagName",
",",
"Charset",
"messageCharset",
",",
"int",... | Creates a XML protocol based socket server in Camel.<br>
在Camel中,创建一个基于XML的Socket接口服务器。
@param camelContext CamelContext which must be based on CombinedRegistry, because additional entries must
be added to the Registry.<br>
Camel的Context,它必须用的是CombinedRegistry,因为要往Registry里放东西。
@param serverUri URI of the socket server which will be used by Camel Netty component
to create an Endpoint.<br>
服务器的URI,它将被Camel的Netty组件用来创建一个Endpoint。
<p>For example: <code>tcp://localhost:9000</code>
@param syncFlag The sync parameter that will be send to Camel Netty component,
true means sync and false means async.<br>
传递给Camel Netty组件的sync参数,true表示同步,false表示异步。
@param toUri The Pipe that receives the messages, usually it should be either direct or seda.<br>
接收到的消息都会被送给这个Pipe,一般来说它要么是direct,要么是seda。
@param topLevelTagName Name of the top level tag that will be used to find the boundaries of XML messages.<br>
标识XML消息开头和结尾的标签名称。
@param messageCharset Charset that the XML messages received are supposed to be encoded in.<br>
XML消息的字符编码方式
@param maxMessageBytes The maximum possible length of the XML messages received.<br>
接收到的XML消息的最大可能长度
@throws Exception Exception if the routes could not be created for whatever reason | [
"Creates",
"a",
"XML",
"protocol",
"based",
"socket",
"server",
"in",
"Camel",
".",
"<br",
">",
"在Camel中,创建一个基于XML的Socket接口服务器。"
] | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/camel/XmlSocketUtility.java#L67-L95 |
micronaut-projects/micronaut-core | inject-java/src/main/java/io/micronaut/annotation/processing/ModelUtils.java | ModelUtils.overridingOrHidingMethod | Optional<ExecutableElement> overridingOrHidingMethod(ExecutableElement overridden, TypeElement classElement) {
List<ExecutableElement> methods = ElementFilter.methodsIn(elementUtils.getAllMembers(classElement));
for (ExecutableElement method : methods) {
if (!method.equals(overridden) && method.getSimpleName().equals(overridden.getSimpleName())) {
return Optional.of(method);
}
}
// might be looking for a package private & packages differ method in a superclass
// that is not visible to the most concrete subclass, really!
// e.g. see injectPackagePrivateMethod4() for SpareTire -> Tire -> RoundThing in Inject tck
// check the superclass until we reach Object, then bail out with empty if necessary.
TypeElement superClass = superClassFor(classElement);
if (superClass != null && !isObjectClass(superClass)) {
return overridingOrHidingMethod(overridden, superClass);
}
return Optional.empty();
} | java | Optional<ExecutableElement> overridingOrHidingMethod(ExecutableElement overridden, TypeElement classElement) {
List<ExecutableElement> methods = ElementFilter.methodsIn(elementUtils.getAllMembers(classElement));
for (ExecutableElement method : methods) {
if (!method.equals(overridden) && method.getSimpleName().equals(overridden.getSimpleName())) {
return Optional.of(method);
}
}
// might be looking for a package private & packages differ method in a superclass
// that is not visible to the most concrete subclass, really!
// e.g. see injectPackagePrivateMethod4() for SpareTire -> Tire -> RoundThing in Inject tck
// check the superclass until we reach Object, then bail out with empty if necessary.
TypeElement superClass = superClassFor(classElement);
if (superClass != null && !isObjectClass(superClass)) {
return overridingOrHidingMethod(overridden, superClass);
}
return Optional.empty();
} | [
"Optional",
"<",
"ExecutableElement",
">",
"overridingOrHidingMethod",
"(",
"ExecutableElement",
"overridden",
",",
"TypeElement",
"classElement",
")",
"{",
"List",
"<",
"ExecutableElement",
">",
"methods",
"=",
"ElementFilter",
".",
"methodsIn",
"(",
"elementUtils",
... | Tests if candidate method is overridden from a given class or subclass.
@param overridden the candidate overridden method
@param classElement the type element that may contain the overriding method, either directly or in a subclass
@return the overriding method | [
"Tests",
"if",
"candidate",
"method",
"is",
"overridden",
"from",
"a",
"given",
"class",
"or",
"subclass",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject-java/src/main/java/io/micronaut/annotation/processing/ModelUtils.java#L435-L451 |
jenkinsci/jenkins | core/src/main/java/hudson/slaves/SlaveComputer.java | SlaveComputer.setChannel | public void setChannel(@Nonnull InputStream in, @Nonnull OutputStream out,
@CheckForNull OutputStream launchLog,
@CheckForNull Channel.Listener listener) throws IOException, InterruptedException {
ChannelBuilder cb = new ChannelBuilder(nodeName,threadPoolForRemoting)
.withMode(Channel.Mode.NEGOTIATE)
.withHeaderStream(launchLog);
for (ChannelConfigurator cc : ChannelConfigurator.all()) {
cc.onChannelBuilding(cb,this);
}
Channel channel = cb.build(in,out);
setChannel(channel,launchLog,listener);
} | java | public void setChannel(@Nonnull InputStream in, @Nonnull OutputStream out,
@CheckForNull OutputStream launchLog,
@CheckForNull Channel.Listener listener) throws IOException, InterruptedException {
ChannelBuilder cb = new ChannelBuilder(nodeName,threadPoolForRemoting)
.withMode(Channel.Mode.NEGOTIATE)
.withHeaderStream(launchLog);
for (ChannelConfigurator cc : ChannelConfigurator.all()) {
cc.onChannelBuilding(cb,this);
}
Channel channel = cb.build(in,out);
setChannel(channel,launchLog,listener);
} | [
"public",
"void",
"setChannel",
"(",
"@",
"Nonnull",
"InputStream",
"in",
",",
"@",
"Nonnull",
"OutputStream",
"out",
",",
"@",
"CheckForNull",
"OutputStream",
"launchLog",
",",
"@",
"CheckForNull",
"Channel",
".",
"Listener",
"listener",
")",
"throws",
"IOExcep... | Creates a {@link Channel} from the given stream and sets that to this agent.
@param in
Stream connected to the remote agent. It's the caller's responsibility to do
buffering on this stream, if that's necessary.
@param out
Stream connected to the remote peer. It's the caller's responsibility to do
buffering on this stream, if that's necessary.
@param launchLog
If non-null, receive the portion of data in {@code is} before
the data goes into the "binary mode". This is useful
when the established communication channel might include some data that might
be useful for debugging/trouble-shooting.
@param listener
Gets a notification when the channel closes, to perform clean up. Can be null.
By the time this method is called, the cause of the termination is reported to the user,
so the implementation of the listener doesn't need to do that again. | [
"Creates",
"a",
"{",
"@link",
"Channel",
"}",
"from",
"the",
"given",
"stream",
"and",
"sets",
"that",
"to",
"this",
"agent",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/slaves/SlaveComputer.java#L420-L433 |
logic-ng/LogicNG | src/main/java/org/logicng/solvers/MaxSATSolver.java | MaxSATSolver.addClause | private void addClause(final Formula formula, int weight) {
this.result = UNDEF;
final LNGIntVector clauseVec = new LNGIntVector((int) formula.numberOfAtoms());
for (Literal lit : formula.literals()) {
Integer index = this.var2index.get(lit.variable());
if (index == null) {
index = this.solver.newLiteral(false) >> 1;
this.var2index.put(lit.variable(), index);
this.index2var.put(index, lit.variable());
}
int litNum = lit.phase() ? index * 2 : (index * 2) ^ 1;
clauseVec.push(litNum);
}
if (weight == -1) {
this.solver.addHardClause(clauseVec);
} else {
this.solver.setCurrentWeight(weight);
this.solver.updateSumWeights(weight);
this.solver.addSoftClause(weight, clauseVec);
}
} | java | private void addClause(final Formula formula, int weight) {
this.result = UNDEF;
final LNGIntVector clauseVec = new LNGIntVector((int) formula.numberOfAtoms());
for (Literal lit : formula.literals()) {
Integer index = this.var2index.get(lit.variable());
if (index == null) {
index = this.solver.newLiteral(false) >> 1;
this.var2index.put(lit.variable(), index);
this.index2var.put(index, lit.variable());
}
int litNum = lit.phase() ? index * 2 : (index * 2) ^ 1;
clauseVec.push(litNum);
}
if (weight == -1) {
this.solver.addHardClause(clauseVec);
} else {
this.solver.setCurrentWeight(weight);
this.solver.updateSumWeights(weight);
this.solver.addSoftClause(weight, clauseVec);
}
} | [
"private",
"void",
"addClause",
"(",
"final",
"Formula",
"formula",
",",
"int",
"weight",
")",
"{",
"this",
".",
"result",
"=",
"UNDEF",
";",
"final",
"LNGIntVector",
"clauseVec",
"=",
"new",
"LNGIntVector",
"(",
"(",
"int",
")",
"formula",
".",
"numberOfA... | Adds a clause to the solver.
@param formula the clause
@param weight the weight of the clause (or -1 for a hard clause) | [
"Adds",
"a",
"clause",
"to",
"the",
"solver",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MaxSATSolver.java#L270-L290 |
alkacon/opencms-core | src/org/opencms/flex/CmsFlexResponse.java | CmsFlexResponse.writeCachedResultToStream | private void writeCachedResultToStream(HttpServletResponse res) throws IOException {
List<Object> elements = m_cachedEntry.elements();
int count = 0;
if (elements != null) {
for (int i = 0; i < elements.size(); i++) {
Object o = elements.get(i);
if (o instanceof byte[]) {
res.getOutputStream().write((byte[])o);
} else {
if ((m_includeResults != null) && (m_includeResults.size() > count)) {
// make sure that we don't run behind end of list (should never happen, though)
res.getOutputStream().write(m_includeResults.get(count));
count++;
}
// skip next entry, which is the parameter map for this include call
i++;
// skip next entry, which is the attribute map for this include call
i++;
}
}
} | java | private void writeCachedResultToStream(HttpServletResponse res) throws IOException {
List<Object> elements = m_cachedEntry.elements();
int count = 0;
if (elements != null) {
for (int i = 0; i < elements.size(); i++) {
Object o = elements.get(i);
if (o instanceof byte[]) {
res.getOutputStream().write((byte[])o);
} else {
if ((m_includeResults != null) && (m_includeResults.size() > count)) {
// make sure that we don't run behind end of list (should never happen, though)
res.getOutputStream().write(m_includeResults.get(count));
count++;
}
// skip next entry, which is the parameter map for this include call
i++;
// skip next entry, which is the attribute map for this include call
i++;
}
}
} | [
"private",
"void",
"writeCachedResultToStream",
"(",
"HttpServletResponse",
"res",
")",
"throws",
"IOException",
"{",
"List",
"<",
"Object",
">",
"elements",
"=",
"m_cachedEntry",
".",
"elements",
"(",
")",
";",
"int",
"count",
"=",
"0",
";",
"if",
"(",
"ele... | This delivers cached sub-elements back to the stream.
Needed to overcome JSP buffering.<p>
@param res the response to write the cached results to
@throws IOException in case something goes wrong writing to the responses output stream | [
"This",
"delivers",
"cached",
"sub",
"-",
"elements",
"back",
"to",
"the",
"stream",
".",
"Needed",
"to",
"overcome",
"JSP",
"buffering",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexResponse.java#L1213-L1234 |
davidmoten/grumpy | grumpy-ogc/src/main/java/com/github/davidmoten/grumpy/wms/ImageCache.java | ImageCache.setEnabled | public void setEnabled(String layerName, boolean enabled) {
synchronized (this) {
if (enabled)
layers.add(layerName);
else
layers.remove(layerName);
}
} | java | public void setEnabled(String layerName, boolean enabled) {
synchronized (this) {
if (enabled)
layers.add(layerName);
else
layers.remove(layerName);
}
} | [
"public",
"void",
"setEnabled",
"(",
"String",
"layerName",
",",
"boolean",
"enabled",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"enabled",
")",
"layers",
".",
"add",
"(",
"layerName",
")",
";",
"else",
"layers",
".",
"remove",
"(",
"... | Enables/disables a layer for caching.
@param layerName
name of the WMS layer
@param enabled
is true if want to cache | [
"Enables",
"/",
"disables",
"a",
"layer",
"for",
"caching",
"."
] | train | https://github.com/davidmoten/grumpy/blob/f2d03e6b9771f15425fb3f76314837efc08c1233/grumpy-ogc/src/main/java/com/github/davidmoten/grumpy/wms/ImageCache.java#L102-L109 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/impl/ImplRectifyImageOps_F32.java | ImplRectifyImageOps_F32.adjustCalibrated | private static void adjustCalibrated(FMatrixRMaj rectifyLeft, FMatrixRMaj rectifyRight,
FMatrixRMaj rectifyK,
RectangleLength2D_F32 bound, float scale) {
// translation
float deltaX = -bound.x0*scale;
float deltaY = -bound.y0*scale;
// adjustment matrix
SimpleMatrix A = new SimpleMatrix(3,3,true,new float[]{scale,0,deltaX,0,scale,deltaY,0,0,1});
SimpleMatrix rL = SimpleMatrix.wrap(rectifyLeft);
SimpleMatrix rR = SimpleMatrix.wrap(rectifyRight);
SimpleMatrix K = SimpleMatrix.wrap(rectifyK);
// remove previous calibration matrix
SimpleMatrix K_inv = K.invert();
rL = K_inv.mult(rL);
rR = K_inv.mult(rR);
// compute new calibration matrix and apply it
K = A.mult(K);
rectifyK.set(K.getFDRM());
rectifyLeft.set(K.mult(rL).getFDRM());
rectifyRight.set(K.mult(rR).getFDRM());
} | java | private static void adjustCalibrated(FMatrixRMaj rectifyLeft, FMatrixRMaj rectifyRight,
FMatrixRMaj rectifyK,
RectangleLength2D_F32 bound, float scale) {
// translation
float deltaX = -bound.x0*scale;
float deltaY = -bound.y0*scale;
// adjustment matrix
SimpleMatrix A = new SimpleMatrix(3,3,true,new float[]{scale,0,deltaX,0,scale,deltaY,0,0,1});
SimpleMatrix rL = SimpleMatrix.wrap(rectifyLeft);
SimpleMatrix rR = SimpleMatrix.wrap(rectifyRight);
SimpleMatrix K = SimpleMatrix.wrap(rectifyK);
// remove previous calibration matrix
SimpleMatrix K_inv = K.invert();
rL = K_inv.mult(rL);
rR = K_inv.mult(rR);
// compute new calibration matrix and apply it
K = A.mult(K);
rectifyK.set(K.getFDRM());
rectifyLeft.set(K.mult(rL).getFDRM());
rectifyRight.set(K.mult(rR).getFDRM());
} | [
"private",
"static",
"void",
"adjustCalibrated",
"(",
"FMatrixRMaj",
"rectifyLeft",
",",
"FMatrixRMaj",
"rectifyRight",
",",
"FMatrixRMaj",
"rectifyK",
",",
"RectangleLength2D_F32",
"bound",
",",
"float",
"scale",
")",
"{",
"// translation",
"float",
"deltaX",
"=",
... | Internal function which applies the rectification adjustment to a calibrated stereo pair | [
"Internal",
"function",
"which",
"applies",
"the",
"rectification",
"adjustment",
"to",
"a",
"calibrated",
"stereo",
"pair"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/impl/ImplRectifyImageOps_F32.java#L127-L151 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java | AbstractCachedGenerator.getResourceCacheKey | protected String getResourceCacheKey(String path, GeneratorContext context) {
StringBuilder strbCacheKey = new StringBuilder(path);
if (StringUtils.isNotEmpty(context.getBracketsParam())) {
strbCacheKey.append("_").append(context.getBracketsParam());
}
if (StringUtils.isNotEmpty(context.getParenthesesParam())) {
strbCacheKey.append("_").append(context.getParenthesesParam());
}
String cacheKey = strbCacheKey.toString();
Locale locale = context.getLocale();
if (locale != null) {
cacheKey = LocaleUtils.toBundleName(strbCacheKey.toString(), locale);
}
cacheKey = cacheKey.replaceAll("[^\\w\\.\\-]", "_");
return cacheKey;
} | java | protected String getResourceCacheKey(String path, GeneratorContext context) {
StringBuilder strbCacheKey = new StringBuilder(path);
if (StringUtils.isNotEmpty(context.getBracketsParam())) {
strbCacheKey.append("_").append(context.getBracketsParam());
}
if (StringUtils.isNotEmpty(context.getParenthesesParam())) {
strbCacheKey.append("_").append(context.getParenthesesParam());
}
String cacheKey = strbCacheKey.toString();
Locale locale = context.getLocale();
if (locale != null) {
cacheKey = LocaleUtils.toBundleName(strbCacheKey.toString(), locale);
}
cacheKey = cacheKey.replaceAll("[^\\w\\.\\-]", "_");
return cacheKey;
} | [
"protected",
"String",
"getResourceCacheKey",
"(",
"String",
"path",
",",
"GeneratorContext",
"context",
")",
"{",
"StringBuilder",
"strbCacheKey",
"=",
"new",
"StringBuilder",
"(",
"path",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"context",
"... | Returns the cache key for linked resources map
@param path
the resource path
@param context
the generator context
@return the cache key for linked resource map | [
"Returns",
"the",
"cache",
"key",
"for",
"linked",
"resources",
"map"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java#L328-L349 |
jwtk/jjwt | api/src/main/java/io/jsonwebtoken/lang/Assert.java | Assert.hasText | public static void hasText(String text, String message) {
if (!Strings.hasText(text)) {
throw new IllegalArgumentException(message);
}
} | java | public static void hasText(String text, String message) {
if (!Strings.hasText(text)) {
throw new IllegalArgumentException(message);
}
} | [
"public",
"static",
"void",
"hasText",
"(",
"String",
"text",
",",
"String",
"message",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"hasText",
"(",
"text",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
")",
";",
"}",
"}"
] | Assert that the given String has valid text content; that is, it must not
be <code>null</code> and must contain at least one non-whitespace character.
<pre class="code">Assert.hasText(name, "'name' must not be empty");</pre>
@param text the String to check
@param message the exception message to use if the assertion fails
@see Strings#hasText | [
"Assert",
"that",
"the",
"given",
"String",
"has",
"valid",
"text",
"content",
";",
"that",
"is",
"it",
"must",
"not",
"be",
"<code",
">",
"null<",
"/",
"code",
">",
"and",
"must",
"contain",
"at",
"least",
"one",
"non",
"-",
"whitespace",
"character",
... | train | https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Assert.java#L130-L134 |
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java | DatabaseAccountsInner.createOrUpdate | public DatabaseAccountInner createOrUpdate(String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, createUpdateParameters).toBlocking().last().body();
} | java | public DatabaseAccountInner createOrUpdate(String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, createUpdateParameters).toBlocking().last().body();
} | [
"public",
"DatabaseAccountInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"DatabaseAccountCreateUpdateParameters",
"createUpdateParameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",... | Creates or updates an Azure Cosmos DB database account.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param createUpdateParameters The parameters to provide for the current database account.
@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 DatabaseAccountInner object if successful. | [
"Creates",
"or",
"updates",
"an",
"Azure",
"Cosmos",
"DB",
"database",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L445-L447 |
dynjs/dynjs | src/main/java/org/dynjs/runtime/util/SafePropertyAccessor.java | SafePropertyAccessor.getProperty | public static String getProperty(String property, String defValue) {
try {
return System.getProperty(property, defValue);
} catch (SecurityException se) {
return defValue;
}
} | java | public static String getProperty(String property, String defValue) {
try {
return System.getProperty(property, defValue);
} catch (SecurityException se) {
return defValue;
}
} | [
"public",
"static",
"String",
"getProperty",
"(",
"String",
"property",
",",
"String",
"defValue",
")",
"{",
"try",
"{",
"return",
"System",
".",
"getProperty",
"(",
"property",
",",
"defValue",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"se",
")",
... | An extension over <code>System.getProperty</code> method.
Handles security restrictions, and returns the default
value if the access to the property is restricted.
@param property The system property name.
@param defValue The default value.
@return The value of the system property,
or the default value. | [
"An",
"extension",
"over",
"<code",
">",
"System",
".",
"getProperty<",
"/",
"code",
">",
"method",
".",
"Handles",
"security",
"restrictions",
"and",
"returns",
"the",
"default",
"value",
"if",
"the",
"access",
"to",
"the",
"property",
"is",
"restricted",
"... | train | https://github.com/dynjs/dynjs/blob/4bc6715eff8768f8cd92c6a167d621bbfc1e1a91/src/main/java/org/dynjs/runtime/util/SafePropertyAccessor.java#L13-L19 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java | SphereUtil.ellipsoidVincentyFormulaRad | @Reference(authors = "T. Vincenty", //
title = "Direct and inverse solutions of geodesics on the ellipsoid with application of nested equations", //
booktitle = "Survey Review 23:176", //
url = "https://doi.org/10.1179/sre.1975.23.176.88", //
bibkey = "doi:10.1179/sre.1975.23.176.88")
public static double ellipsoidVincentyFormulaRad(double f, double lat1, double lon1, double lat2, double lon2) {
final double dlon = (lon2 >= lon1) ? (lon2 - lon1) : (lon1 - lon2);
final double onemf = 1 - f; // = 1 - (a-b)/a = b/a
// Second eccentricity squared
final double a_b = 1. / onemf; // = a/b
final double ecc2 = (a_b + 1) * (a_b - 1); // (a^2-b^2)/(b^2)
// Reduced latitudes:
final double u1 = atan(onemf * tan(lat1));
final double u2 = atan(onemf * tan(lat2));
// Trigonometric values
final DoubleWrapper tmp = new DoubleWrapper(); // To return cosine
final double su1 = sinAndCos(u1, tmp), cu1 = tmp.value;
final double su2 = sinAndCos(u2, tmp), cu2 = tmp.value;
// Eqn (13) - initial value
double lambda = dlon;
for(int i = 0;; i++) {
final double slon = sinAndCos(lambda, tmp), clon = tmp.value;
// Eqn (14) - \sin \sigma
final double term1 = cu2 * slon, term2 = cu1 * su2 - su1 * cu2 * clon;
final double ssig = sqrt(term1 * term1 + term2 * term2);
// Eqn (15) - \cos \sigma
final double csig = su1 * su2 + cu1 * cu2 * clon;
// Two identical points?
if(!(ssig > 0)) {
return 0.;
}
// Eqn (16) - \sigma from \tan \sigma
final double sigma = atan2(ssig, csig);
// Eqn (17) - \sin \alpha, and this way \cos^2 \alpha
final double salp = cu1 * cu2 * slon / ssig;
final double c2alp = (1. + salp) * (1. - salp);
// Eqn (18) - \cos 2 \sigma_m
final double ctwosigm = (Math.abs(c2alp) > 0) ? csig - 2.0 * su1 * su2 / c2alp : 0.;
final double c2twosigm = ctwosigm * ctwosigm;
// Eqn (10) - C
final double cc = f * .0625 * c2alp * (4.0 + f * (4.0 - 3.0 * c2alp));
// Eqn (11) - new \lambda
final double prevlambda = lambda;
lambda = dlon + (1.0 - cc) * f * salp * //
(sigma + cc * ssig * (ctwosigm + cc * csig * (-1.0 + 2.0 * c2twosigm)));
// Check for convergence:
if(Math.abs(prevlambda - lambda) < PRECISION || i >= MAX_ITER) {
// TODO: what is the proper result to return on MAX_ITER (antipodal
// points)?
// Definition of u^2, rewritten to use second eccentricity.
final double usq = c2alp * ecc2;
// Eqn (3) - A
final double aa = 1.0 + usq / 16384.0 * (4096.0 + usq * (-768.0 + usq * (320.0 - 175.0 * usq)));
// Eqn (4) - B
final double bb = usq / 1024.0 * (256.0 + usq * (-128.0 + usq * (74.0 - 47.0 * usq)));
// Eqn (6) - \Delta \sigma
final double dsig = bb * ssig * (ctwosigm + .25 * bb * (csig * (-1.0 + 2.0 * c2twosigm) //
- ONE_SIXTH * bb * ctwosigm * (-3.0 + 4.0 * ssig * ssig) * (-3.0 + 4.0 * c2twosigm)));
// Eqn (19) - s
return aa * (sigma - dsig);
}
}
} | java | @Reference(authors = "T. Vincenty", //
title = "Direct and inverse solutions of geodesics on the ellipsoid with application of nested equations", //
booktitle = "Survey Review 23:176", //
url = "https://doi.org/10.1179/sre.1975.23.176.88", //
bibkey = "doi:10.1179/sre.1975.23.176.88")
public static double ellipsoidVincentyFormulaRad(double f, double lat1, double lon1, double lat2, double lon2) {
final double dlon = (lon2 >= lon1) ? (lon2 - lon1) : (lon1 - lon2);
final double onemf = 1 - f; // = 1 - (a-b)/a = b/a
// Second eccentricity squared
final double a_b = 1. / onemf; // = a/b
final double ecc2 = (a_b + 1) * (a_b - 1); // (a^2-b^2)/(b^2)
// Reduced latitudes:
final double u1 = atan(onemf * tan(lat1));
final double u2 = atan(onemf * tan(lat2));
// Trigonometric values
final DoubleWrapper tmp = new DoubleWrapper(); // To return cosine
final double su1 = sinAndCos(u1, tmp), cu1 = tmp.value;
final double su2 = sinAndCos(u2, tmp), cu2 = tmp.value;
// Eqn (13) - initial value
double lambda = dlon;
for(int i = 0;; i++) {
final double slon = sinAndCos(lambda, tmp), clon = tmp.value;
// Eqn (14) - \sin \sigma
final double term1 = cu2 * slon, term2 = cu1 * su2 - su1 * cu2 * clon;
final double ssig = sqrt(term1 * term1 + term2 * term2);
// Eqn (15) - \cos \sigma
final double csig = su1 * su2 + cu1 * cu2 * clon;
// Two identical points?
if(!(ssig > 0)) {
return 0.;
}
// Eqn (16) - \sigma from \tan \sigma
final double sigma = atan2(ssig, csig);
// Eqn (17) - \sin \alpha, and this way \cos^2 \alpha
final double salp = cu1 * cu2 * slon / ssig;
final double c2alp = (1. + salp) * (1. - salp);
// Eqn (18) - \cos 2 \sigma_m
final double ctwosigm = (Math.abs(c2alp) > 0) ? csig - 2.0 * su1 * su2 / c2alp : 0.;
final double c2twosigm = ctwosigm * ctwosigm;
// Eqn (10) - C
final double cc = f * .0625 * c2alp * (4.0 + f * (4.0 - 3.0 * c2alp));
// Eqn (11) - new \lambda
final double prevlambda = lambda;
lambda = dlon + (1.0 - cc) * f * salp * //
(sigma + cc * ssig * (ctwosigm + cc * csig * (-1.0 + 2.0 * c2twosigm)));
// Check for convergence:
if(Math.abs(prevlambda - lambda) < PRECISION || i >= MAX_ITER) {
// TODO: what is the proper result to return on MAX_ITER (antipodal
// points)?
// Definition of u^2, rewritten to use second eccentricity.
final double usq = c2alp * ecc2;
// Eqn (3) - A
final double aa = 1.0 + usq / 16384.0 * (4096.0 + usq * (-768.0 + usq * (320.0 - 175.0 * usq)));
// Eqn (4) - B
final double bb = usq / 1024.0 * (256.0 + usq * (-128.0 + usq * (74.0 - 47.0 * usq)));
// Eqn (6) - \Delta \sigma
final double dsig = bb * ssig * (ctwosigm + .25 * bb * (csig * (-1.0 + 2.0 * c2twosigm) //
- ONE_SIXTH * bb * ctwosigm * (-3.0 + 4.0 * ssig * ssig) * (-3.0 + 4.0 * c2twosigm)));
// Eqn (19) - s
return aa * (sigma - dsig);
}
}
} | [
"@",
"Reference",
"(",
"authors",
"=",
"\"T. Vincenty\"",
",",
"//",
"title",
"=",
"\"Direct and inverse solutions of geodesics on the ellipsoid with application of nested equations\"",
",",
"//",
"booktitle",
"=",
"\"Survey Review 23:176\"",
",",
"//",
"url",
"=",
"\"https:/... | Compute the approximate great-circle distance of two points.
<p>
Reference:
<p>
T. Vincenty<br>
Direct and inverse solutions of geodesics on the ellipsoid with application
of nested equations<br>
Survey review 23 176, 1975
@param f Ellipsoid flattening
@param lat1 Latitude of first point in degree
@param lon1 Longitude of first point in degree
@param lat2 Latitude of second point in degree
@param lon2 Longitude of second point in degree
@return Distance for a minor axis of 1. | [
"Compute",
"the",
"approximate",
"great",
"-",
"circle",
"distance",
"of",
"two",
"points",
".",
"<p",
">",
"Reference",
":",
"<p",
">",
"T",
".",
"Vincenty<br",
">",
"Direct",
"and",
"inverse",
"solutions",
"of",
"geodesics",
"on",
"the",
"ellipsoid",
"wi... | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java#L336-L404 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/TriangularSolver_DDRM.java | TriangularSolver_DDRM.solveTranL | public static void solveTranL( double L[] , double []b , int n )
{
for( int i =n-1; i>=0; i-- ) {
double sum = b[i];
for( int k = i+1; k <n; k++ ) {
sum -= L[k*n+i]* b[k];
}
b[i] = sum/L[i*n+i];
}
} | java | public static void solveTranL( double L[] , double []b , int n )
{
for( int i =n-1; i>=0; i-- ) {
double sum = b[i];
for( int k = i+1; k <n; k++ ) {
sum -= L[k*n+i]* b[k];
}
b[i] = sum/L[i*n+i];
}
} | [
"public",
"static",
"void",
"solveTranL",
"(",
"double",
"L",
"[",
"]",
",",
"double",
"[",
"]",
"b",
",",
"int",
"n",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"n",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"double",
"sum",
"="... | <p>
This is a forward substitution solver for non-singular lower triangular matrices.
<br>
b = (L<sup>T</sup>)<sup>-1</sup>b<br>
<br>
where b is a vector, L is an n by n matrix.<br>
</p>
<p>
L is a lower triangular matrix, but it comes up with a solution as if it was
an upper triangular matrix that was computed by transposing L.
</p>
@param L An n by n non-singular lower triangular matrix. Not modified.
@param b A vector of length n. Modified.
@param n The size of the matrices. | [
"<p",
">",
"This",
"is",
"a",
"forward",
"substitution",
"solver",
"for",
"non",
"-",
"singular",
"lower",
"triangular",
"matrices",
".",
"<br",
">",
"b",
"=",
"(",
"L<sup",
">",
"T<",
"/",
"sup",
">",
")",
"<sup",
">",
"-",
"1<",
"/",
"sup",
">",
... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/TriangularSolver_DDRM.java#L148-L157 |
jdereg/java-util | src/main/java/com/cedarsoftware/util/ProxyFactory.java | ProxyFactory.create | public static <T> T create(Class<T> intf, InvocationHandler h) {
return create(h.getClass().getClassLoader(), intf, h);
} | java | public static <T> T create(Class<T> intf, InvocationHandler h) {
return create(h.getClass().getClassLoader(), intf, h);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"create",
"(",
"Class",
"<",
"T",
">",
"intf",
",",
"InvocationHandler",
"h",
")",
"{",
"return",
"create",
"(",
"h",
".",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
",",
"intf",
",",
"h",
")",
... | Returns an instance of a proxy class for the specified interfaces
that dispatches method invocations to the specified invocation
handler.
@param intf the interface for the proxy to implement
@param h the invocation handler to dispatch method invocations to
@return a proxy instance with the specified invocation handler of a
proxy class that is defined by the specified class loader
and that implements the specified interfaces
@throws IllegalArgumentException if any of the restrictions on the
parameters that may be passed to <code>getProxyClass</code>
are violated
@throws NullPointerException if the <code>interfaces</code> array
argument or any of its elements are <code>null</code>, or
if the invocation handler, <code>h</code>, is
<code>null</code> | [
"Returns",
"an",
"instance",
"of",
"a",
"proxy",
"class",
"for",
"the",
"specified",
"interfaces",
"that",
"dispatches",
"method",
"invocations",
"to",
"the",
"specified",
"invocation",
"handler",
"."
] | train | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/ProxyFactory.java#L50-L52 |
calrissian/mango | mango-core/src/main/java/org/calrissian/mango/net/MoreInetAddresses.java | MoreInetAddresses.forIPv6String | public static Inet6Address forIPv6String(String ipString) {
requireNonNull(ipString);
try{
InetAddress parsed = forString(ipString);
if (parsed instanceof Inet6Address)
return (Inet6Address) parsed;
} catch(Exception ignored){}
throw new IllegalArgumentException(format("Invalid IPv6 representation: %s", ipString));
} | java | public static Inet6Address forIPv6String(String ipString) {
requireNonNull(ipString);
try{
InetAddress parsed = forString(ipString);
if (parsed instanceof Inet6Address)
return (Inet6Address) parsed;
} catch(Exception ignored){}
throw new IllegalArgumentException(format("Invalid IPv6 representation: %s", ipString));
} | [
"public",
"static",
"Inet6Address",
"forIPv6String",
"(",
"String",
"ipString",
")",
"{",
"requireNonNull",
"(",
"ipString",
")",
";",
"try",
"{",
"InetAddress",
"parsed",
"=",
"forString",
"(",
"ipString",
")",
";",
"if",
"(",
"parsed",
"instanceof",
"Inet6Ad... | Generates a new {@link Inet6Address} instance from the provided address. This will NOT do a dns lookup on the address if it
does not represent a valid ip address like {@code InetAddress.getByName()}.
If the provided string is an ipv4 "mapped" address ('ffff:x.x.x.x' this method will still generate a valid {@link Inet6Address}
instance. | [
"Generates",
"a",
"new",
"{",
"@link",
"Inet6Address",
"}",
"instance",
"from",
"the",
"provided",
"address",
".",
"This",
"will",
"NOT",
"do",
"a",
"dns",
"lookup",
"on",
"the",
"address",
"if",
"it",
"does",
"not",
"represent",
"a",
"valid",
"ip",
"add... | train | https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-core/src/main/java/org/calrissian/mango/net/MoreInetAddresses.java#L140-L152 |
cvut/JCOP | src/main/java/cz/cvut/felk/cig/jcop/problem/tsp/City.java | City.addDistance | public City addDistance(City city, Integer distance) {
this.distances.put(city, distance);
return this;
} | java | public City addDistance(City city, Integer distance) {
this.distances.put(city, distance);
return this;
} | [
"public",
"City",
"addDistance",
"(",
"City",
"city",
",",
"Integer",
"distance",
")",
"{",
"this",
".",
"distances",
".",
"put",
"(",
"city",
",",
"distance",
")",
";",
"return",
"this",
";",
"}"
] | Adds new distance to city.
@param city target city
@param distance distance to city
@return self, fluent interface | [
"Adds",
"new",
"distance",
"to",
"city",
"."
] | train | https://github.com/cvut/JCOP/blob/2ec18315a9a452e5f4e3d07cccfde0310adc465a/src/main/java/cz/cvut/felk/cig/jcop/problem/tsp/City.java#L67-L70 |
SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/permission/UserPermissionDao.java | UserPermissionDao.deleteProjectPermissionOfAnyUser | public int deleteProjectPermissionOfAnyUser(DbSession dbSession, long projectId, String permission) {
return mapper(dbSession).deleteProjectPermissionOfAnyUser(projectId, permission);
} | java | public int deleteProjectPermissionOfAnyUser(DbSession dbSession, long projectId, String permission) {
return mapper(dbSession).deleteProjectPermissionOfAnyUser(projectId, permission);
} | [
"public",
"int",
"deleteProjectPermissionOfAnyUser",
"(",
"DbSession",
"dbSession",
",",
"long",
"projectId",
",",
"String",
"permission",
")",
"{",
"return",
"mapper",
"(",
"dbSession",
")",
".",
"deleteProjectPermissionOfAnyUser",
"(",
"projectId",
",",
"permission"... | Deletes the specified permission on the specified project for any user. | [
"Deletes",
"the",
"specified",
"permission",
"on",
"the",
"specified",
"project",
"for",
"any",
"user",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/UserPermissionDao.java#L137-L139 |
apache/groovy | subprojects/groovy-json/src/main/java/groovy/json/JsonBuilder.java | JsonBuilder.call | public Object call(Iterable coll, Closure c) {
List<Object> listContent = new ArrayList<Object>();
if (coll != null) {
for (Object it : coll) {
listContent.add(JsonDelegate.curryDelegateAndGetContent(c, it));
}
}
content = listContent;
return content;
} | java | public Object call(Iterable coll, Closure c) {
List<Object> listContent = new ArrayList<Object>();
if (coll != null) {
for (Object it : coll) {
listContent.add(JsonDelegate.curryDelegateAndGetContent(c, it));
}
}
content = listContent;
return content;
} | [
"public",
"Object",
"call",
"(",
"Iterable",
"coll",
",",
"Closure",
"c",
")",
"{",
"List",
"<",
"Object",
">",
"listContent",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
")",
";",
"if",
"(",
"coll",
"!=",
"null",
")",
"{",
"for",
"(",
"Objec... | A collection and closure passed to a JSON builder will create a root JSON array applying
the closure to each object in the collection
<p>
Example:
<pre><code class="groovyTestCase">
class Author {
String name
}
def authors = [new Author (name: "Guillaume"), new Author (name: "Jochen"), new Author (name: "Paul")]
def json = new groovy.json.JsonBuilder()
json authors, { Author author {@code ->}
name author.name
}
assert json.toString() == '[{"name":"Guillaume"},{"name":"Jochen"},{"name":"Paul"}]'
</code></pre>
@param coll a collection
@param c a closure used to convert the objects of coll
@return a list of values | [
"A",
"collection",
"and",
"closure",
"passed",
"to",
"a",
"JSON",
"builder",
"will",
"create",
"a",
"root",
"JSON",
"array",
"applying",
"the",
"closure",
"to",
"each",
"object",
"in",
"the",
"collection",
"<p",
">",
"Example",
":",
"<pre",
">",
"<code",
... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-json/src/main/java/groovy/json/JsonBuilder.java#L206-L216 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveCopyEntityHelper.java | HiveCopyEntityHelper.getCopyableFilesFromPaths | List<CopyableFile.Builder> getCopyableFilesFromPaths(Collection<FileStatus> paths,
CopyConfiguration configuration, Optional<Partition> partition) throws IOException {
List<CopyableFile.Builder> builders = Lists.newArrayList();
List<SourceAndDestination> dataFiles = Lists.newArrayList();
Configuration hadoopConfiguration = new Configuration();
FileSystem actualSourceFs = null;
String referenceScheme = null;
String referenceAuthority = null;
for (FileStatus status : paths) {
dataFiles.add(new SourceAndDestination(status, getTargetPathHelper().getTargetPath(status.getPath(), this.targetFs, partition, true)));
}
for (SourceAndDestination sourceAndDestination : dataFiles) {
URI uri = sourceAndDestination.getSource().getPath().toUri();
if (actualSourceFs == null || !StringUtils.equals(referenceScheme, uri.getScheme())
|| !StringUtils.equals(referenceAuthority, uri.getAuthority())) {
actualSourceFs = sourceAndDestination.getSource().getPath().getFileSystem(hadoopConfiguration);
referenceScheme = uri.getScheme();
referenceAuthority = uri.getAuthority();
}
if (!this.dataset.getTableRootPath().isPresent()) {
// The logic for computing ancestor owner and permissions for hive copies depends on tables having a non-glob
// location. Currently, this restriction is also imposed by Hive, so this is not a problem. If this ever changes
// on the Hive side, and we try to copy a table with a glob location, this logic will have to change.
throw new IOException(String.format("Table %s does not have a concrete table root path.",
this.dataset.getTable().getCompleteName()));
}
List<OwnerAndPermission> ancestorOwnerAndPermission =
CopyableFile.resolveReplicatedOwnerAndPermissionsRecursively(actualSourceFs,
sourceAndDestination.getSource().getPath().getParent(), this.dataset.getTableRootPath().get().getParent(), configuration);
builders.add(CopyableFile.fromOriginAndDestination(actualSourceFs, sourceAndDestination.getSource(),
sourceAndDestination.getDestination(), configuration).
ancestorsOwnerAndPermission(ancestorOwnerAndPermission));
}
return builders;
} | java | List<CopyableFile.Builder> getCopyableFilesFromPaths(Collection<FileStatus> paths,
CopyConfiguration configuration, Optional<Partition> partition) throws IOException {
List<CopyableFile.Builder> builders = Lists.newArrayList();
List<SourceAndDestination> dataFiles = Lists.newArrayList();
Configuration hadoopConfiguration = new Configuration();
FileSystem actualSourceFs = null;
String referenceScheme = null;
String referenceAuthority = null;
for (FileStatus status : paths) {
dataFiles.add(new SourceAndDestination(status, getTargetPathHelper().getTargetPath(status.getPath(), this.targetFs, partition, true)));
}
for (SourceAndDestination sourceAndDestination : dataFiles) {
URI uri = sourceAndDestination.getSource().getPath().toUri();
if (actualSourceFs == null || !StringUtils.equals(referenceScheme, uri.getScheme())
|| !StringUtils.equals(referenceAuthority, uri.getAuthority())) {
actualSourceFs = sourceAndDestination.getSource().getPath().getFileSystem(hadoopConfiguration);
referenceScheme = uri.getScheme();
referenceAuthority = uri.getAuthority();
}
if (!this.dataset.getTableRootPath().isPresent()) {
// The logic for computing ancestor owner and permissions for hive copies depends on tables having a non-glob
// location. Currently, this restriction is also imposed by Hive, so this is not a problem. If this ever changes
// on the Hive side, and we try to copy a table with a glob location, this logic will have to change.
throw new IOException(String.format("Table %s does not have a concrete table root path.",
this.dataset.getTable().getCompleteName()));
}
List<OwnerAndPermission> ancestorOwnerAndPermission =
CopyableFile.resolveReplicatedOwnerAndPermissionsRecursively(actualSourceFs,
sourceAndDestination.getSource().getPath().getParent(), this.dataset.getTableRootPath().get().getParent(), configuration);
builders.add(CopyableFile.fromOriginAndDestination(actualSourceFs, sourceAndDestination.getSource(),
sourceAndDestination.getDestination(), configuration).
ancestorsOwnerAndPermission(ancestorOwnerAndPermission));
}
return builders;
} | [
"List",
"<",
"CopyableFile",
".",
"Builder",
">",
"getCopyableFilesFromPaths",
"(",
"Collection",
"<",
"FileStatus",
">",
"paths",
",",
"CopyConfiguration",
"configuration",
",",
"Optional",
"<",
"Partition",
">",
"partition",
")",
"throws",
"IOException",
"{",
"L... | Get builders for a {@link CopyableFile} for each file referred to by a {@link org.apache.hadoop.hive.metastore.api.StorageDescriptor}. | [
"Get",
"builders",
"for",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveCopyEntityHelper.java#L729-L770 |
looly/hutool | hutool-socket/src/main/java/cn/hutool/socket/aio/AioClient.java | AioClient.setOption | public <T> AioClient setOption(SocketOption<T> name, T value) throws IOException {
this.session.getChannel().setOption(name, value);
return this;
} | java | public <T> AioClient setOption(SocketOption<T> name, T value) throws IOException {
this.session.getChannel().setOption(name, value);
return this;
} | [
"public",
"<",
"T",
">",
"AioClient",
"setOption",
"(",
"SocketOption",
"<",
"T",
">",
"name",
",",
"T",
"value",
")",
"throws",
"IOException",
"{",
"this",
".",
"session",
".",
"getChannel",
"(",
")",
".",
"setOption",
"(",
"name",
",",
"value",
")",
... | 设置 Socket 的 Option 选项<br>
选项见:{@link java.net.StandardSocketOptions}
@param <T> 选项泛型
@param name {@link SocketOption} 枚举
@param value SocketOption参数
@throws IOException IO异常 | [
"设置",
"Socket",
"的",
"Option",
"选项<br",
">",
"选项见:",
"{",
"@link",
"java",
".",
"net",
".",
"StandardSocketOptions",
"}"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-socket/src/main/java/cn/hutool/socket/aio/AioClient.java#L68-L71 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowRunActionRepetitionsInner.java | WorkflowRunActionRepetitionsInner.listExpressionTracesAsync | public Observable<List<ExpressionRootInner>> listExpressionTracesAsync(String resourceGroupName, String workflowName, String runName, String actionName, String repetitionName) {
return listExpressionTracesWithServiceResponseAsync(resourceGroupName, workflowName, runName, actionName, repetitionName).map(new Func1<ServiceResponse<List<ExpressionRootInner>>, List<ExpressionRootInner>>() {
@Override
public List<ExpressionRootInner> call(ServiceResponse<List<ExpressionRootInner>> response) {
return response.body();
}
});
} | java | public Observable<List<ExpressionRootInner>> listExpressionTracesAsync(String resourceGroupName, String workflowName, String runName, String actionName, String repetitionName) {
return listExpressionTracesWithServiceResponseAsync(resourceGroupName, workflowName, runName, actionName, repetitionName).map(new Func1<ServiceResponse<List<ExpressionRootInner>>, List<ExpressionRootInner>>() {
@Override
public List<ExpressionRootInner> call(ServiceResponse<List<ExpressionRootInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"ExpressionRootInner",
">",
">",
"listExpressionTracesAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"workflowName",
",",
"String",
"runName",
",",
"String",
"actionName",
",",
"String",
"repetitionName",
")",
"{... | Lists a workflow run expression trace.
@param resourceGroupName The resource group name.
@param workflowName The workflow name.
@param runName The workflow run name.
@param actionName The workflow action name.
@param repetitionName The workflow repetition.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<ExpressionRootInner> object | [
"Lists",
"a",
"workflow",
"run",
"expression",
"trace",
"."
] | 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/WorkflowRunActionRepetitionsInner.java#L326-L333 |
diirt/util | src/main/java/org/epics/util/text/CsvParser.java | CsvParser.isTokenNumberParsable | private boolean isTokenNumberParsable(State state, String token) {
if (token.isEmpty()) {
return true;
}
return state.mDouble.reset(token).matches();
} | java | private boolean isTokenNumberParsable(State state, String token) {
if (token.isEmpty()) {
return true;
}
return state.mDouble.reset(token).matches();
} | [
"private",
"boolean",
"isTokenNumberParsable",
"(",
"State",
"state",
",",
"String",
"token",
")",
"{",
"if",
"(",
"token",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"state",
".",
"mDouble",
".",
"reset",
"(",
"token",
"... | Check whether the token can be parsed to a number.
@param state the state of the parser
@param token the token
@return true if token matches a double | [
"Check",
"whether",
"the",
"token",
"can",
"be",
"parsed",
"to",
"a",
"number",
"."
] | train | https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/text/CsvParser.java#L435-L440 |
jmrozanec/cron-utils | src/main/java/com/cronutils/descriptor/TimeDescriptionStrategy.java | TimeDescriptionStrategy.ensureInstance | private FieldExpression ensureInstance(final FieldExpression expression, final FieldExpression defaultExpression) {
Preconditions.checkNotNull(defaultExpression, "Default expression must not be null");
if (expression != null) {
return expression;
} else {
return defaultExpression;
}
} | java | private FieldExpression ensureInstance(final FieldExpression expression, final FieldExpression defaultExpression) {
Preconditions.checkNotNull(defaultExpression, "Default expression must not be null");
if (expression != null) {
return expression;
} else {
return defaultExpression;
}
} | [
"private",
"FieldExpression",
"ensureInstance",
"(",
"final",
"FieldExpression",
"expression",
",",
"final",
"FieldExpression",
"defaultExpression",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"defaultExpression",
",",
"\"Default expression must not be null\"",
")",
... | Give an expression instance, will return it if is not null. Otherwise will return the defaultExpression;
@param expression - CronFieldExpression instance; may be null
@param defaultExpression - CronFieldExpression, never null;
@return the given expression or the given defaultExpression in case the given expression is {@code null} | [
"Give",
"an",
"expression",
"instance",
"will",
"return",
"it",
"if",
"is",
"not",
"null",
".",
"Otherwise",
"will",
"return",
"the",
"defaultExpression",
";"
] | train | https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/descriptor/TimeDescriptionStrategy.java#L73-L80 |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.marketplace_removeListing | public boolean marketplace_removeListing(Long listingId, CharSequence status)
throws FacebookException, IOException {
assert MARKETPLACE_STATUS_DEFAULT.equals(status) || MARKETPLACE_STATUS_SUCCESS.equals(status) ||
MARKETPLACE_STATUS_NOT_SUCCESS.equals(status) : "Invalid status: " + status;
T result =
this.callMethod(FacebookMethod.MARKETPLACE_REMOVE_LISTING, new Pair<String, CharSequence>("listing_id",
listingId.toString()),
new Pair<String, CharSequence>("status", status));
return this.extractBoolean(result);
} | java | public boolean marketplace_removeListing(Long listingId, CharSequence status)
throws FacebookException, IOException {
assert MARKETPLACE_STATUS_DEFAULT.equals(status) || MARKETPLACE_STATUS_SUCCESS.equals(status) ||
MARKETPLACE_STATUS_NOT_SUCCESS.equals(status) : "Invalid status: " + status;
T result =
this.callMethod(FacebookMethod.MARKETPLACE_REMOVE_LISTING, new Pair<String, CharSequence>("listing_id",
listingId.toString()),
new Pair<String, CharSequence>("status", status));
return this.extractBoolean(result);
} | [
"public",
"boolean",
"marketplace_removeListing",
"(",
"Long",
"listingId",
",",
"CharSequence",
"status",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"assert",
"MARKETPLACE_STATUS_DEFAULT",
".",
"equals",
"(",
"status",
")",
"||",
"MARKETPLACE_STATUS_S... | Remove a marketplace listing
@param listingId the listing to be removed
@param status MARKETPLACE_STATUS_DEFAULT, MARKETPLACE_STATUS_SUCCESS, or MARKETPLACE_STATUS_NOT_SUCCESS
@return boolean indicating whether the listing was removed
@see <a href="http://wiki.developers.facebook.com/index.php/Marketplace.removeListing">
Developers Wiki: marketplace.removeListing</a> | [
"Remove",
"a",
"marketplace",
"listing"
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1980-L1990 |
threerings/nenya | core/src/main/java/com/threerings/cast/bundle/BundleUtil.java | BundleUtil.loadObject | public static Object loadObject (ResourceBundle bundle, String path, boolean wipeOnFailure)
throws IOException, ClassNotFoundException
{
InputStream bin = null;
try {
bin = bundle.getResource(path);
if (bin == null) {
return null;
}
return new ObjectInputStream(bin).readObject();
} catch (InvalidClassException ice) {
log.warning("Aiya! Serialized object is hosed [bundle=" + bundle +
", element=" + path + ", error=" + ice.getMessage() + "].");
return null;
} catch (IOException ioe) {
log.warning("Error reading resource from bundle [bundle=" + bundle + ", path=" + path +
", wiping?=" + wipeOnFailure + "].");
if (wipeOnFailure) {
StreamUtil.close(bin);
bin = null;
if (bundle instanceof FileResourceBundle) {
((FileResourceBundle)bundle).wipeBundle(false);
}
}
throw ioe;
} finally {
StreamUtil.close(bin);
}
} | java | public static Object loadObject (ResourceBundle bundle, String path, boolean wipeOnFailure)
throws IOException, ClassNotFoundException
{
InputStream bin = null;
try {
bin = bundle.getResource(path);
if (bin == null) {
return null;
}
return new ObjectInputStream(bin).readObject();
} catch (InvalidClassException ice) {
log.warning("Aiya! Serialized object is hosed [bundle=" + bundle +
", element=" + path + ", error=" + ice.getMessage() + "].");
return null;
} catch (IOException ioe) {
log.warning("Error reading resource from bundle [bundle=" + bundle + ", path=" + path +
", wiping?=" + wipeOnFailure + "].");
if (wipeOnFailure) {
StreamUtil.close(bin);
bin = null;
if (bundle instanceof FileResourceBundle) {
((FileResourceBundle)bundle).wipeBundle(false);
}
}
throw ioe;
} finally {
StreamUtil.close(bin);
}
} | [
"public",
"static",
"Object",
"loadObject",
"(",
"ResourceBundle",
"bundle",
",",
"String",
"path",
",",
"boolean",
"wipeOnFailure",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"InputStream",
"bin",
"=",
"null",
";",
"try",
"{",
"bin",
"=",... | Attempts to load an object from the supplied resource bundle with the specified path.
@param wipeOnFailure if there is an error reading the object from the bundle and this
parameter is true, we will instruct the bundle to delete its underlying jar file before
propagating the exception with the expectation that it will be redownloaded and repaired the
next time the application is run.
@return the unserialized object in question.
@exception IOException thrown if an I/O error occurs while reading the object from the
bundle. | [
"Attempts",
"to",
"load",
"an",
"object",
"from",
"the",
"supplied",
"resource",
"bundle",
"with",
"the",
"specified",
"path",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/bundle/BundleUtil.java#L70-L101 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/BaseAsymmetric.java | BaseAsymmetric.init | @SuppressWarnings("unchecked")
protected T init(String algorithm, PrivateKey privateKey, PublicKey publicKey) {
this.algorithm = algorithm;
if (null == privateKey && null == publicKey) {
initKeys();
} else {
if (null != privateKey) {
this.privateKey = privateKey;
}
if (null != publicKey) {
this.publicKey = publicKey;
}
}
return (T) this;
} | java | @SuppressWarnings("unchecked")
protected T init(String algorithm, PrivateKey privateKey, PublicKey publicKey) {
this.algorithm = algorithm;
if (null == privateKey && null == publicKey) {
initKeys();
} else {
if (null != privateKey) {
this.privateKey = privateKey;
}
if (null != publicKey) {
this.publicKey = publicKey;
}
}
return (T) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"T",
"init",
"(",
"String",
"algorithm",
",",
"PrivateKey",
"privateKey",
",",
"PublicKey",
"publicKey",
")",
"{",
"this",
".",
"algorithm",
"=",
"algorithm",
";",
"if",
"(",
"null",
"==",
"pri... | 初始化<br>
私钥和公钥同时为空时生成一对新的私钥和公钥<br>
私钥和公钥可以单独传入一个,如此则只能使用此钥匙来做加密(签名)或者解密(校验)
@param algorithm 算法
@param privateKey 私钥
@param publicKey 公钥
@return this | [
"初始化<br",
">",
"私钥和公钥同时为空时生成一对新的私钥和公钥<br",
">",
"私钥和公钥可以单独传入一个,如此则只能使用此钥匙来做加密(签名)或者解密(校验)"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/BaseAsymmetric.java#L58-L73 |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/BaseReportGenerator.java | BaseReportGenerator.continueOnDataCollectionMessages | @Override
public boolean continueOnDataCollectionMessages(DataCollectionMessages messages, com.itextpdf.text.Document document) throws VectorPrintException {
if (!messages.getMessages(DataCollectionMessages.Level.ERROR).isEmpty()) {
try {
createAndAddElement(messages.getMessages(DataCollectionMessages.Level.ERROR), Phrase.class, "");
} catch (InstantiationException | IllegalAccessException | DocumentException ex) {
throw new VectorPrintException(ex);
}
return false;
} else {
for (DataCollectionMessages.Level l : DataCollectionMessages.Level.values()) {
for (Object m : messages.getMessages(l)) {
log.warning(String.format("message of level %s during data collection: %s", l.name(), String.valueOf(m)));
}
}
}
return true;
} | java | @Override
public boolean continueOnDataCollectionMessages(DataCollectionMessages messages, com.itextpdf.text.Document document) throws VectorPrintException {
if (!messages.getMessages(DataCollectionMessages.Level.ERROR).isEmpty()) {
try {
createAndAddElement(messages.getMessages(DataCollectionMessages.Level.ERROR), Phrase.class, "");
} catch (InstantiationException | IllegalAccessException | DocumentException ex) {
throw new VectorPrintException(ex);
}
return false;
} else {
for (DataCollectionMessages.Level l : DataCollectionMessages.Level.values()) {
for (Object m : messages.getMessages(l)) {
log.warning(String.format("message of level %s during data collection: %s", l.name(), String.valueOf(m)));
}
}
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"continueOnDataCollectionMessages",
"(",
"DataCollectionMessages",
"messages",
",",
"com",
".",
"itextpdf",
".",
"text",
".",
"Document",
"document",
")",
"throws",
"VectorPrintException",
"{",
"if",
"(",
"!",
"messages",
".",
... | When messages of level {@link Level error} are present, put these in the document and return false. Otherwise log
messages and return true.
@param messages
@param document
@return
@throws VectorPrintException | [
"When",
"messages",
"of",
"level",
"{",
"@link",
"Level",
"error",
"}",
"are",
"present",
"put",
"these",
"in",
"the",
"document",
"and",
"return",
"false",
".",
"Otherwise",
"log",
"messages",
"and",
"return",
"true",
"."
] | train | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/BaseReportGenerator.java#L849-L866 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.batchSynonyms | public JSONObject batchSynonyms(List<JSONObject> objects, boolean forwardToReplicas, RequestOptions requestOptions) throws AlgoliaException {
return batchSynonyms(objects, forwardToReplicas, false, requestOptions);
} | java | public JSONObject batchSynonyms(List<JSONObject> objects, boolean forwardToReplicas, RequestOptions requestOptions) throws AlgoliaException {
return batchSynonyms(objects, forwardToReplicas, false, requestOptions);
} | [
"public",
"JSONObject",
"batchSynonyms",
"(",
"List",
"<",
"JSONObject",
">",
"objects",
",",
"boolean",
"forwardToReplicas",
",",
"RequestOptions",
"requestOptions",
")",
"throws",
"AlgoliaException",
"{",
"return",
"batchSynonyms",
"(",
"objects",
",",
"forwardToRep... | Add or Replace a list of synonyms
@param objects List of synonyms
@param forwardToReplicas Forward the operation to the replica indices
@param requestOptions Options to pass to this request | [
"Add",
"or",
"Replace",
"a",
"list",
"of",
"synonyms"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L1609-L1611 |
io7m/jproperties | com.io7m.jproperties.core/src/main/java/com/io7m/jproperties/JProperties.java | JProperties.getBoolean | public static boolean getBoolean(
final Properties properties,
final String key)
throws JPropertyNonexistent,
JPropertyIncorrectType
{
Objects.requireNonNull(properties, "Properties");
Objects.requireNonNull(key, "Key");
final String text = getString(properties, key);
return parseBoolean(key, text);
} | java | public static boolean getBoolean(
final Properties properties,
final String key)
throws JPropertyNonexistent,
JPropertyIncorrectType
{
Objects.requireNonNull(properties, "Properties");
Objects.requireNonNull(key, "Key");
final String text = getString(properties, key);
return parseBoolean(key, text);
} | [
"public",
"static",
"boolean",
"getBoolean",
"(",
"final",
"Properties",
"properties",
",",
"final",
"String",
"key",
")",
"throws",
"JPropertyNonexistent",
",",
"JPropertyIncorrectType",
"{",
"Objects",
".",
"requireNonNull",
"(",
"properties",
",",
"\"Properties\"",... | <p> Returns the boolean value associated with {@code key} in the
properties referenced by {@code properties}. </p> <p> A boolean value
is syntactically the strings "true" or "false", case insensitive. </p>
@param properties The loaded properties.
@param key The requested key.
@return The value associated with the key, parsed as a boolean.
@throws JPropertyNonexistent If the key does not exist in the given
properties.
@throws JPropertyIncorrectType If the value associated with the key cannot
be parsed as a boolean. | [
"<p",
">",
"Returns",
"the",
"boolean",
"value",
"associated",
"with",
"{",
"@code",
"key",
"}",
"in",
"the",
"properties",
"referenced",
"by",
"{",
"@code",
"properties",
"}",
".",
"<",
"/",
"p",
">",
"<p",
">",
"A",
"boolean",
"value",
"is",
"syntact... | train | https://github.com/io7m/jproperties/blob/b188b8fd87b3b078f1e2b564a9ed5996db0becfd/com.io7m.jproperties.core/src/main/java/com/io7m/jproperties/JProperties.java#L202-L213 |
beihaifeiwu/dolphin | dolphin-common/src/main/java/com/freetmp/common/type/ResolvableType.java | ResolvableType.forMethodReturnType | public static ResolvableType forMethodReturnType(Method method) {
Assert.notNull(method, "Method must not be null");
return forMethodParameter(MethodParameter.forMethodOrConstructor(method, -1));
} | java | public static ResolvableType forMethodReturnType(Method method) {
Assert.notNull(method, "Method must not be null");
return forMethodParameter(MethodParameter.forMethodOrConstructor(method, -1));
} | [
"public",
"static",
"ResolvableType",
"forMethodReturnType",
"(",
"Method",
"method",
")",
"{",
"Assert",
".",
"notNull",
"(",
"method",
",",
"\"Method must not be null\"",
")",
";",
"return",
"forMethodParameter",
"(",
"MethodParameter",
".",
"forMethodOrConstructor",
... | Return a {@link ResolvableType} for the specified {@link Method} return type.
@param method the source for the method return type
@return a {@link ResolvableType} for the specified method return
@see #forMethodReturnType(Method, Class) | [
"Return",
"a",
"{"
] | train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/type/ResolvableType.java#L1029-L1032 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsInner.java | BackupLongTermRetentionVaultsInner.createOrUpdateAsync | public Observable<BackupLongTermRetentionVaultInner> createOrUpdateAsync(String resourceGroupName, String serverName, String recoveryServicesVaultResourceId) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, recoveryServicesVaultResourceId).map(new Func1<ServiceResponse<BackupLongTermRetentionVaultInner>, BackupLongTermRetentionVaultInner>() {
@Override
public BackupLongTermRetentionVaultInner call(ServiceResponse<BackupLongTermRetentionVaultInner> response) {
return response.body();
}
});
} | java | public Observable<BackupLongTermRetentionVaultInner> createOrUpdateAsync(String resourceGroupName, String serverName, String recoveryServicesVaultResourceId) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, recoveryServicesVaultResourceId).map(new Func1<ServiceResponse<BackupLongTermRetentionVaultInner>, BackupLongTermRetentionVaultInner>() {
@Override
public BackupLongTermRetentionVaultInner call(ServiceResponse<BackupLongTermRetentionVaultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"BackupLongTermRetentionVaultInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"recoveryServicesVaultResourceId",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
... | Updates a server backup long term retention vault.
@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 recoveryServicesVaultResourceId The azure recovery services vault resource id
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"a",
"server",
"backup",
"long",
"term",
"retention",
"vault",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsInner.java#L200-L207 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Caster.java | Caster.toUUId | public static Object toUUId(Object o, Object defaultValue) {
String str = toString(o, null);
if (str == null) return defaultValue;
if (!Decision.isUUId(str)) return defaultValue;
return str;
} | java | public static Object toUUId(Object o, Object defaultValue) {
String str = toString(o, null);
if (str == null) return defaultValue;
if (!Decision.isUUId(str)) return defaultValue;
return str;
} | [
"public",
"static",
"Object",
"toUUId",
"(",
"Object",
"o",
",",
"Object",
"defaultValue",
")",
"{",
"String",
"str",
"=",
"toString",
"(",
"o",
",",
"null",
")",
";",
"if",
"(",
"str",
"==",
"null",
")",
"return",
"defaultValue",
";",
"if",
"(",
"!"... | cast a Object to a UUID
@param o Object to cast
@param defaultValue
@return casted Query Object | [
"cast",
"a",
"Object",
"to",
"a",
"UUID"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L3109-L3115 |
OpenTSDB/opentsdb | src/meta/TSUIDQuery.java | TSUIDQuery.resolveNames | private Deferred<IncomingDataPoint> resolveNames(final IncomingDataPoint dp) {
// If the caller gave us a metric and tags, save some time by NOT hitting
// our UID tables or storage.
if (metric != null) {
dp.setMetric(metric);
dp.setTags((HashMap<String, String>)tags);
return Deferred.fromResult(dp);
}
class TagsCB implements Callback<IncomingDataPoint, HashMap<String, String>> {
public IncomingDataPoint call(final HashMap<String, String> tags)
throws Exception {
dp.setTags(tags);
return dp;
}
@Override
public String toString() {
return "Tags resolution CB";
}
}
class MetricCB implements Callback<Deferred<IncomingDataPoint>, String> {
public Deferred<IncomingDataPoint> call(final String name)
throws Exception {
dp.setMetric(name);
final List<byte[]> tags = UniqueId.getTagPairsFromTSUID(tsuid);
return Tags.resolveIdsAsync(tsdb, tags).addCallback(new TagsCB());
}
@Override
public String toString() {
return "Metric resolution CB";
}
}
final byte[] metric_uid = Arrays.copyOfRange(tsuid, 0, TSDB.metrics_width());
return tsdb.getUidName(UniqueIdType.METRIC, metric_uid)
.addCallbackDeferring(new MetricCB());
} | java | private Deferred<IncomingDataPoint> resolveNames(final IncomingDataPoint dp) {
// If the caller gave us a metric and tags, save some time by NOT hitting
// our UID tables or storage.
if (metric != null) {
dp.setMetric(metric);
dp.setTags((HashMap<String, String>)tags);
return Deferred.fromResult(dp);
}
class TagsCB implements Callback<IncomingDataPoint, HashMap<String, String>> {
public IncomingDataPoint call(final HashMap<String, String> tags)
throws Exception {
dp.setTags(tags);
return dp;
}
@Override
public String toString() {
return "Tags resolution CB";
}
}
class MetricCB implements Callback<Deferred<IncomingDataPoint>, String> {
public Deferred<IncomingDataPoint> call(final String name)
throws Exception {
dp.setMetric(name);
final List<byte[]> tags = UniqueId.getTagPairsFromTSUID(tsuid);
return Tags.resolveIdsAsync(tsdb, tags).addCallback(new TagsCB());
}
@Override
public String toString() {
return "Metric resolution CB";
}
}
final byte[] metric_uid = Arrays.copyOfRange(tsuid, 0, TSDB.metrics_width());
return tsdb.getUidName(UniqueIdType.METRIC, metric_uid)
.addCallbackDeferring(new MetricCB());
} | [
"private",
"Deferred",
"<",
"IncomingDataPoint",
">",
"resolveNames",
"(",
"final",
"IncomingDataPoint",
"dp",
")",
"{",
"// If the caller gave us a metric and tags, save some time by NOT hitting",
"// our UID tables or storage.",
"if",
"(",
"metric",
"!=",
"null",
")",
"{",
... | Resolve the UIDs to names. If the query was for a metric and tags then we
can just use those.
@param dp The data point to fill in values for
@return A deferred with the data point or an exception if something went
wrong. | [
"Resolve",
"the",
"UIDs",
"to",
"names",
".",
"If",
"the",
"query",
"was",
"for",
"a",
"metric",
"and",
"tags",
"then",
"we",
"can",
"just",
"use",
"those",
"."
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/TSUIDQuery.java#L566-L603 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.updatePatternAnyEntityRoleAsync | public Observable<OperationStatus> updatePatternAnyEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdatePatternAnyEntityRoleOptionalParameter updatePatternAnyEntityRoleOptionalParameter) {
return updatePatternAnyEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, updatePatternAnyEntityRoleOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | java | public Observable<OperationStatus> updatePatternAnyEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdatePatternAnyEntityRoleOptionalParameter updatePatternAnyEntityRoleOptionalParameter) {
return updatePatternAnyEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, updatePatternAnyEntityRoleOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatus",
">",
"updatePatternAnyEntityRoleAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"UUID",
"roleId",
",",
"UpdatePatternAnyEntityRoleOptionalParameter",
"updatePatternAnyEntityRoleOptionalPar... | Update an entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity ID.
@param roleId The entity role ID.
@param updatePatternAnyEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatus object | [
"Update",
"an",
"entity",
"role",
"for",
"a",
"given",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L12888-L12895 |
anotheria/moskito | moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/CounterAspect.java | CounterAspect.countByParameter | @Around(value = "execution(* *(..)) && (@annotation(annotation))")
public Object countByParameter(ProceedingJoinPoint pjp, CountByParameter annotation) throws Throwable {
return countByParameter(pjp, annotation.producerId(), annotation.subsystem(), annotation.category());
} | java | @Around(value = "execution(* *(..)) && (@annotation(annotation))")
public Object countByParameter(ProceedingJoinPoint pjp, CountByParameter annotation) throws Throwable {
return countByParameter(pjp, annotation.producerId(), annotation.subsystem(), annotation.category());
} | [
"@",
"Around",
"(",
"value",
"=",
"\"execution(* *(..)) && (@annotation(annotation))\"",
")",
"public",
"Object",
"countByParameter",
"(",
"ProceedingJoinPoint",
"pjp",
",",
"CountByParameter",
"annotation",
")",
"throws",
"Throwable",
"{",
"return",
"countByParameter",
"... | Pointcut definition for @CountByParameter annotation.
@param pjp ProceedingJoinPoint.
@param annotation @CountByParameter annotation.
@return
@throws Throwable | [
"Pointcut",
"definition",
"for"
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/CounterAspect.java#L43-L46 |
fcrepo4/fcrepo4 | fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/SubjectMappingUtil.java | SubjectMappingUtil.mapSubject | public static Triple mapSubject(final Triple t, final String resourceUri, final Node destinationNode) {
final Node tripleSubj = t.getSubject();
final String tripleSubjUri = tripleSubj.getURI();
final Node subject;
if (tripleSubjUri.equals(resourceUri)) {
subject = destinationNode;
} else if (tripleSubjUri.startsWith(resourceUri)) {
// If the subject begins with the originating resource uri, such as a hash uri, then rebase
// the portions of the subject after the resource uri to the destination uri.
final String suffix = tripleSubjUri.substring(resourceUri.length());
subject = createURI(destinationNode.getURI() + suffix);
} else {
subject = t.getSubject();
}
return new Triple(subject, t.getPredicate(), t.getObject());
} | java | public static Triple mapSubject(final Triple t, final String resourceUri, final Node destinationNode) {
final Node tripleSubj = t.getSubject();
final String tripleSubjUri = tripleSubj.getURI();
final Node subject;
if (tripleSubjUri.equals(resourceUri)) {
subject = destinationNode;
} else if (tripleSubjUri.startsWith(resourceUri)) {
// If the subject begins with the originating resource uri, such as a hash uri, then rebase
// the portions of the subject after the resource uri to the destination uri.
final String suffix = tripleSubjUri.substring(resourceUri.length());
subject = createURI(destinationNode.getURI() + suffix);
} else {
subject = t.getSubject();
}
return new Triple(subject, t.getPredicate(), t.getObject());
} | [
"public",
"static",
"Triple",
"mapSubject",
"(",
"final",
"Triple",
"t",
",",
"final",
"String",
"resourceUri",
",",
"final",
"Node",
"destinationNode",
")",
"{",
"final",
"Node",
"tripleSubj",
"=",
"t",
".",
"getSubject",
"(",
")",
";",
"final",
"String",
... | Maps the subject of t from resourceUri to destinationNode to produce a new Triple.
If the triple does not have the subject resourceUri, then the triple is unchanged.
@param t triple to be remapped.
@param resourceUri resource subject uri to be remapped.
@param destinationNode subject node for the resultant triple.
@return triple with subject remapped to destinationNode or the original subject. | [
"Maps",
"the",
"subject",
"of",
"t",
"from",
"resourceUri",
"to",
"destinationNode",
"to",
"produce",
"a",
"new",
"Triple",
".",
"If",
"the",
"triple",
"does",
"not",
"have",
"the",
"subject",
"resourceUri",
"then",
"the",
"triple",
"is",
"unchanged",
"."
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/SubjectMappingUtil.java#L59-L74 |
Asana/java-asana | src/main/java/com/asana/Client.java | Client.basicAuth | public static Client basicAuth(String apiKey, HttpTransport httpTransport) {
return new Client(new BasicAuthDispatcher(apiKey, httpTransport));
} | java | public static Client basicAuth(String apiKey, HttpTransport httpTransport) {
return new Client(new BasicAuthDispatcher(apiKey, httpTransport));
} | [
"public",
"static",
"Client",
"basicAuth",
"(",
"String",
"apiKey",
",",
"HttpTransport",
"httpTransport",
")",
"{",
"return",
"new",
"Client",
"(",
"new",
"BasicAuthDispatcher",
"(",
"apiKey",
",",
"httpTransport",
")",
")",
";",
"}"
] | WARNING: API Keys are deprecated and have been removed from Asana's API.
Prefer using {@link #accessToken(String, HttpTransport) accessToken method}.
@param apiKey Basic Auth API key
@param httpTransport HttpTransport implementation to use for requests
@deprecated
@return Client instance | [
"WARNING",
":",
"API",
"Keys",
"are",
"deprecated",
"and",
"have",
"been",
"removed",
"from",
"Asana",
"s",
"API",
".",
"Prefer",
"using",
"{"
] | train | https://github.com/Asana/java-asana/blob/abeea92fd5a71260a5d804db4da94e52fd7a15a7/src/main/java/com/asana/Client.java#L269-L271 |
datoin/http-requests | src/main/java/org/datoin/net/http/Request.java | Request.setParam | public Request setParam(String name, Iterable<String> values) {
this.params.putAll(name, values);
return this;
} | java | public Request setParam(String name, Iterable<String> values) {
this.params.putAll(name, values);
return this;
} | [
"public",
"Request",
"setParam",
"(",
"String",
"name",
",",
"Iterable",
"<",
"String",
">",
"values",
")",
"{",
"this",
".",
"params",
".",
"putAll",
"(",
"name",
",",
"values",
")",
";",
"return",
"this",
";",
"}"
] | set a request param and return modified request
@param name : name of the request param
@param values : values of the request param
@return : Request Object with request param name, value set | [
"set",
"a",
"request",
"param",
"and",
"return",
"modified",
"request"
] | train | https://github.com/datoin/http-requests/blob/660a4bc516c594f321019df94451fead4dea19b6/src/main/java/org/datoin/net/http/Request.java#L324-L327 |
moleculer-java/moleculer-java | src/main/java/services/moleculer/cacher/JCacheCacher.java | JCacheCacher.addCacheConfiguration | public void addCacheConfiguration(String partition, Configuration<String, byte[]> configuration) {
cacheConfigurations.put(partition, configuration);
} | java | public void addCacheConfiguration(String partition, Configuration<String, byte[]> configuration) {
cacheConfigurations.put(partition, configuration);
} | [
"public",
"void",
"addCacheConfiguration",
"(",
"String",
"partition",
",",
"Configuration",
"<",
"String",
",",
"byte",
"[",
"]",
">",
"configuration",
")",
"{",
"cacheConfigurations",
".",
"put",
"(",
"partition",
",",
"configuration",
")",
";",
"}"
] | --- ADD / REMOVE CACHE CONFIGURATIONS BY CACHE REGION / PARTITION --- | [
"---",
"ADD",
"/",
"REMOVE",
"CACHE",
"CONFIGURATIONS",
"BY",
"CACHE",
"REGION",
"/",
"PARTITION",
"---"
] | train | https://github.com/moleculer-java/moleculer-java/blob/27575c44b9ecacc17c4456ceacf5d1851abf1cc4/src/main/java/services/moleculer/cacher/JCacheCacher.java#L381-L383 |
crawljax/crawljax | core/src/main/java/com/crawljax/forms/TrainingFormHandler.java | TrainingFormHandler.getInputValue | private InputValue getInputValue(FormInput input) {
/* Get the DOM element from Selenium. */
WebElement inputElement = browser.getWebElement(input.getIdentification());
switch (input.getType()) {
case TEXT:
case PASSWORD:
case HIDDEN:
case SELECT:
case TEXTAREA:
return new InputValue(inputElement.getAttribute("value"));
case RADIO:
case CHECKBOX:
default:
String value = inputElement.getAttribute("value");
Boolean checked = inputElement.isSelected();
return new InputValue(value, checked);
}
} | java | private InputValue getInputValue(FormInput input) {
/* Get the DOM element from Selenium. */
WebElement inputElement = browser.getWebElement(input.getIdentification());
switch (input.getType()) {
case TEXT:
case PASSWORD:
case HIDDEN:
case SELECT:
case TEXTAREA:
return new InputValue(inputElement.getAttribute("value"));
case RADIO:
case CHECKBOX:
default:
String value = inputElement.getAttribute("value");
Boolean checked = inputElement.isSelected();
return new InputValue(value, checked);
}
} | [
"private",
"InputValue",
"getInputValue",
"(",
"FormInput",
"input",
")",
"{",
"/* Get the DOM element from Selenium. */",
"WebElement",
"inputElement",
"=",
"browser",
".",
"getWebElement",
"(",
"input",
".",
"getIdentification",
"(",
")",
")",
";",
"switch",
"(",
... | Generates the InputValue for the form input by inspecting the current
value of the corresponding WebElement on the DOM.
@return The current InputValue for the element on the DOM. | [
"Generates",
"the",
"InputValue",
"for",
"the",
"form",
"input",
"by",
"inspecting",
"the",
"current",
"value",
"of",
"the",
"corresponding",
"WebElement",
"on",
"the",
"DOM",
"."
] | train | https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/forms/TrainingFormHandler.java#L195-L215 |
sababado/CircularView | library/src/main/java/com/sababado/circularview/CircularView.java | CircularView.getDefaultSize | public static int getDefaultSize(final int size, final int measureSpec) {
final int result;
final int specMode = MeasureSpec.getMode(measureSpec);
final int specSize = MeasureSpec.getSize(measureSpec);
switch (specMode) {
case MeasureSpec.AT_MOST:
result = Math.min(size, specSize);
break;
case MeasureSpec.EXACTLY:
result = specSize;
break;
default:
result = size;
break;
}
return result;
} | java | public static int getDefaultSize(final int size, final int measureSpec) {
final int result;
final int specMode = MeasureSpec.getMode(measureSpec);
final int specSize = MeasureSpec.getSize(measureSpec);
switch (specMode) {
case MeasureSpec.AT_MOST:
result = Math.min(size, specSize);
break;
case MeasureSpec.EXACTLY:
result = specSize;
break;
default:
result = size;
break;
}
return result;
} | [
"public",
"static",
"int",
"getDefaultSize",
"(",
"final",
"int",
"size",
",",
"final",
"int",
"measureSpec",
")",
"{",
"final",
"int",
"result",
";",
"final",
"int",
"specMode",
"=",
"MeasureSpec",
".",
"getMode",
"(",
"measureSpec",
")",
";",
"final",
"i... | Utility to return a default size. Uses the supplied size if the
MeasureSpec imposed no constraints. Will get larger if allowed
by the MeasureSpec.
@param size Default size for this view
@param measureSpec Constraints imposed by the parent
@return The size this view should be. | [
"Utility",
"to",
"return",
"a",
"default",
"size",
".",
"Uses",
"the",
"supplied",
"size",
"if",
"the",
"MeasureSpec",
"imposed",
"no",
"constraints",
".",
"Will",
"get",
"larger",
"if",
"allowed",
"by",
"the",
"MeasureSpec",
"."
] | train | https://github.com/sababado/CircularView/blob/c9ab818d063bcc0796183616f8a82166a9b80aac/library/src/main/java/com/sababado/circularview/CircularView.java#L203-L220 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.